@zxyycom/vibe-check 0.0.2 → 0.0.3

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 (670) hide show
  1. package/README.md +36 -5
  2. package/dist/esm/check/check.mjs +4 -0
  3. package/dist/esm/check/check.mjs.map +1 -1
  4. package/dist/esm/check/flag-enablement.mjs +32 -0
  5. package/dist/esm/check/flag-enablement.mjs.map +1 -0
  6. package/dist/esm/check/handoff-provider-identity.mjs +18 -0
  7. package/dist/esm/check/handoff-provider-identity.mjs.map +1 -0
  8. package/dist/esm/check/inherited-collection.mjs +1 -1
  9. package/dist/esm/check/inherited-collection.mjs.map +1 -1
  10. package/dist/esm/check/project-changes.mjs +2 -0
  11. package/dist/esm/check/project-changes.mjs.map +1 -0
  12. package/dist/esm/check/project-context.mjs +2 -0
  13. package/dist/esm/check/project-context.mjs.map +1 -0
  14. package/dist/esm/check-settlement/facts.mjs.map +1 -1
  15. package/dist/esm/check-settlement/record-store.mjs +1 -1
  16. package/dist/esm/check-settlement/record-store.mjs.map +1 -1
  17. package/dist/esm/data-boundary/canonical-data.mjs +36 -7
  18. package/dist/esm/data-boundary/canonical-data.mjs.map +1 -1
  19. package/dist/esm/data-boundary/canonical-json.mjs.map +1 -1
  20. package/dist/esm/data-boundary/closed-values.mjs +28 -4
  21. package/dist/esm/data-boundary/closed-values.mjs.map +1 -1
  22. package/dist/esm/{package-checks/project-files → data-boundary}/config-glob.mjs +3 -3
  23. package/dist/esm/data-boundary/config-glob.mjs.map +1 -0
  24. package/dist/esm/data-boundary/project-path.mjs +19 -0
  25. package/dist/esm/data-boundary/project-path.mjs.map +1 -0
  26. package/dist/esm/index.mjs +12 -5
  27. package/dist/esm/index.mjs.map +1 -1
  28. package/dist/esm/machine-output/v4/atomic-publication.mjs +4 -1
  29. package/dist/esm/machine-output/v4/atomic-publication.mjs.map +1 -1
  30. package/dist/esm/package-checks/check-authoring.mjs +69 -0
  31. package/dist/esm/package-checks/check-authoring.mjs.map +1 -0
  32. package/dist/esm/package-checks/code-quality-findings/finding-waiver-authoring.mjs.map +1 -1
  33. package/dist/esm/package-checks/code-quality-findings/finding-waiver-evidence.mjs.map +1 -1
  34. package/dist/esm/package-checks/command-check/command-check.mjs +55 -0
  35. package/dist/esm/package-checks/command-check/command-check.mjs.map +1 -0
  36. package/dist/esm/package-checks/command-check/contract.mjs +2 -0
  37. package/dist/esm/package-checks/command-check/contract.mjs.map +1 -0
  38. package/dist/esm/package-checks/command-check/execution.mjs +134 -0
  39. package/dist/esm/package-checks/command-check/execution.mjs.map +1 -0
  40. package/dist/esm/package-checks/command-check/options.mjs +284 -0
  41. package/dist/esm/package-checks/command-check/options.mjs.map +1 -0
  42. package/dist/esm/package-checks/command-check/transcript.mjs +26 -0
  43. package/dist/esm/package-checks/command-check/transcript.mjs.map +1 -0
  44. package/dist/esm/package-checks/duplicate-detection/default-check.mjs +9 -11
  45. package/dist/esm/package-checks/duplicate-detection/default-check.mjs.map +1 -1
  46. package/dist/esm/package-checks/duplicate-detection/execution.mjs +2 -4
  47. package/dist/esm/package-checks/duplicate-detection/execution.mjs.map +1 -1
  48. package/dist/esm/package-checks/duplicate-detection/finding-messages.mjs +1 -1
  49. package/dist/esm/package-checks/duplicate-detection/finding-messages.mjs.map +1 -1
  50. package/dist/esm/package-checks/duplicate-detection/jscpd/availability.mjs +1 -1
  51. package/dist/esm/package-checks/duplicate-detection/jscpd/availability.mjs.map +1 -1
  52. package/dist/esm/package-checks/duplicate-detection/options.mjs.map +1 -1
  53. package/dist/esm/package-checks/duplicate-detection/records.mjs.map +1 -1
  54. package/dist/esm/package-checks/file-metrics/constructor.mjs +9 -11
  55. package/dist/esm/package-checks/file-metrics/constructor.mjs.map +1 -1
  56. package/dist/esm/package-checks/file-metrics/execution.mjs +2 -4
  57. package/dist/esm/package-checks/file-metrics/execution.mjs.map +1 -1
  58. package/dist/esm/package-checks/file-metrics/finding-messages.mjs +1 -1
  59. package/dist/esm/package-checks/file-metrics/finding-messages.mjs.map +1 -1
  60. package/dist/esm/package-checks/file-metrics/options.mjs.map +1 -1
  61. package/dist/esm/package-checks/file-metrics/records.mjs.map +1 -1
  62. package/dist/esm/package-checks/file-metrics/scc/availability.mjs +1 -1
  63. package/dist/esm/package-checks/file-metrics/scc/availability.mjs.map +1 -1
  64. package/dist/esm/package-checks/file-metrics/scc/batch-planner.mjs +38 -0
  65. package/dist/esm/package-checks/file-metrics/scc/batch-planner.mjs.map +1 -0
  66. package/dist/esm/package-checks/file-metrics/scc/logical-scan-resources.mjs +35 -0
  67. package/dist/esm/package-checks/file-metrics/scc/logical-scan-resources.mjs.map +1 -0
  68. package/dist/esm/package-checks/file-metrics/scc/scanner.mjs +102 -29
  69. package/dist/esm/package-checks/file-metrics/scc/scanner.mjs.map +1 -1
  70. package/dist/esm/package-checks/function-metrics/analysis.mjs +7 -2
  71. package/dist/esm/package-checks/function-metrics/analysis.mjs.map +1 -1
  72. package/dist/esm/package-checks/function-metrics/analyzer/analysis-model.mjs +1 -1
  73. package/dist/esm/package-checks/function-metrics/analyzer/analysis-model.mjs.map +1 -1
  74. package/dist/esm/package-checks/function-metrics/analyzer/extensions/lizardcomplextags.mjs +1 -3
  75. package/dist/esm/package-checks/function-metrics/analyzer/extensions/lizardcomplextags.mjs.map +1 -1
  76. package/dist/esm/package-checks/function-metrics/analyzer/extensions/protocol.mjs.map +1 -1
  77. package/dist/esm/package-checks/function-metrics/analyzer/pipeline.mjs +3 -2
  78. package/dist/esm/package-checks/function-metrics/analyzer/pipeline.mjs.map +1 -1
  79. package/dist/esm/package-checks/function-metrics/analyzer/readers/erlang.mjs +6 -6
  80. package/dist/esm/package-checks/function-metrics/analyzer/readers/erlang.mjs.map +1 -1
  81. package/dist/esm/package-checks/function-metrics/analyzer/readers/fortran.mjs +1 -1
  82. package/dist/esm/package-checks/function-metrics/analyzer/readers/fortran.mjs.map +1 -1
  83. package/dist/esm/package-checks/function-metrics/analyzer/readers/objc.mjs +9 -3
  84. package/dist/esm/package-checks/function-metrics/analyzer/readers/objc.mjs.map +1 -1
  85. package/dist/esm/package-checks/function-metrics/analyzer/readers/php-states.mjs +12 -7
  86. package/dist/esm/package-checks/function-metrics/analyzer/readers/php-states.mjs.map +1 -1
  87. package/dist/esm/package-checks/function-metrics/analyzer/readers/plsql.mjs +6 -6
  88. package/dist/esm/package-checks/function-metrics/analyzer/readers/plsql.mjs.map +1 -1
  89. package/dist/esm/package-checks/function-metrics/analyzer/readers/python.mjs +5 -3
  90. package/dist/esm/package-checks/function-metrics/analyzer/readers/python.mjs.map +1 -1
  91. package/dist/esm/package-checks/function-metrics/analyzer/readers/r.mjs +2 -0
  92. package/dist/esm/package-checks/function-metrics/analyzer/readers/r.mjs.map +1 -1
  93. package/dist/esm/package-checks/function-metrics/analyzer/readers/ttcn.mjs +9 -3
  94. package/dist/esm/package-checks/function-metrics/analyzer/readers/ttcn.mjs.map +1 -1
  95. package/dist/esm/package-checks/function-metrics/analyzer/readers/typescript.mjs +9 -3
  96. package/dist/esm/package-checks/function-metrics/analyzer/readers/typescript.mjs.map +1 -1
  97. package/dist/esm/package-checks/function-metrics/analyzer/readers/zig.mjs +3 -1
  98. package/dist/esm/package-checks/function-metrics/analyzer/readers/zig.mjs.map +1 -1
  99. package/dist/esm/package-checks/function-metrics/analyzer/shared/code-reader.mjs +3 -1
  100. package/dist/esm/package-checks/function-metrics/analyzer/shared/code-reader.mjs.map +1 -1
  101. package/dist/esm/package-checks/function-metrics/analyzer/shared/js-style-regex.mjs +12 -5
  102. package/dist/esm/package-checks/function-metrics/analyzer/shared/js-style-regex.mjs.map +1 -1
  103. package/dist/esm/package-checks/function-metrics/analyzer-worker-port.mjs +20 -8
  104. package/dist/esm/package-checks/function-metrics/analyzer-worker-port.mjs.map +1 -1
  105. package/dist/esm/package-checks/function-metrics/constructor.mjs +9 -11
  106. package/dist/esm/package-checks/function-metrics/constructor.mjs.map +1 -1
  107. package/dist/esm/package-checks/function-metrics/execution.mjs +2 -4
  108. package/dist/esm/package-checks/function-metrics/execution.mjs.map +1 -1
  109. package/dist/esm/package-checks/function-metrics/finding-messages.mjs +1 -1
  110. package/dist/esm/package-checks/function-metrics/finding-messages.mjs.map +1 -1
  111. package/dist/esm/package-checks/function-metrics/measurement.mjs +3 -1
  112. package/dist/esm/package-checks/function-metrics/measurement.mjs.map +1 -1
  113. package/dist/esm/package-checks/function-metrics/options.mjs.map +1 -1
  114. package/dist/esm/package-checks/function-metrics/records.mjs.map +1 -1
  115. package/dist/esm/package-checks/host-environment/git.mjs +11 -0
  116. package/dist/esm/package-checks/host-environment/git.mjs.map +1 -1
  117. package/dist/esm/package-checks/host-environment/path.mjs +1 -17
  118. package/dist/esm/package-checks/host-environment/path.mjs.map +1 -1
  119. package/dist/esm/package-checks/host-environment/process/contract.mjs.map +1 -1
  120. package/dist/esm/package-checks/host-environment/process/result.mjs +43 -17
  121. package/dist/esm/package-checks/host-environment/process/result.mjs.map +1 -1
  122. package/dist/esm/package-checks/host-environment/process/runner.mjs +7 -5
  123. package/dist/esm/package-checks/host-environment/process/runner.mjs.map +1 -1
  124. package/dist/esm/package-checks/json-schema-validation/default-check.mjs +9 -11
  125. package/dist/esm/package-checks/json-schema-validation/default-check.mjs.map +1 -1
  126. package/dist/esm/package-checks/json-schema-validation/options.mjs.map +1 -1
  127. package/dist/esm/package-checks/json-schema-validation/reference-resolver.mjs +6 -2
  128. package/dist/esm/package-checks/json-schema-validation/reference-resolver.mjs.map +1 -1
  129. package/dist/esm/package-checks/json-schema-validation/schema-policy.mjs +11 -3
  130. package/dist/esm/package-checks/json-schema-validation/schema-policy.mjs.map +1 -1
  131. package/dist/esm/package-checks/json-validation/default-check.mjs +9 -11
  132. package/dist/esm/package-checks/json-validation/default-check.mjs.map +1 -1
  133. package/dist/esm/package-checks/json-validation/options.mjs.map +1 -1
  134. package/dist/esm/package-checks/local-cache-options.mjs +28 -0
  135. package/dist/esm/package-checks/local-cache-options.mjs.map +1 -0
  136. package/dist/esm/package-checks/maintenance-reminders/maintenance-reminders.mjs +37 -45
  137. package/dist/esm/package-checks/maintenance-reminders/maintenance-reminders.mjs.map +1 -1
  138. package/dist/esm/package-checks/maintenance-reminders/maintenance-support.mjs +3 -1
  139. package/dist/esm/package-checks/maintenance-reminders/maintenance-support.mjs.map +1 -1
  140. package/dist/esm/package-checks/markdown-link-validation/default-check.mjs +19 -33
  141. package/dist/esm/package-checks/markdown-link-validation/default-check.mjs.map +1 -1
  142. package/dist/esm/package-checks/markdown-link-validation/execution.mjs +1 -1
  143. package/dist/esm/package-checks/markdown-link-validation/execution.mjs.map +1 -1
  144. package/dist/esm/package-checks/markdown-link-validation/finding-messages.mjs +1 -1
  145. package/dist/esm/package-checks/markdown-link-validation/finding-messages.mjs.map +1 -1
  146. package/dist/esm/package-checks/markdown-link-validation/markdown-parser.mjs +1 -3
  147. package/dist/esm/package-checks/markdown-link-validation/markdown-parser.mjs.map +1 -1
  148. package/dist/esm/package-checks/markdown-link-validation/options-resolution.mjs +3 -18
  149. package/dist/esm/package-checks/markdown-link-validation/options-resolution.mjs.map +1 -1
  150. package/dist/esm/package-checks/markdown-link-validation/options-validation.mjs +2 -14
  151. package/dist/esm/package-checks/markdown-link-validation/options-validation.mjs.map +1 -1
  152. package/dist/esm/package-checks/markdown-link-validation/options.mjs.map +1 -1
  153. package/dist/esm/package-checks/markdown-link-validation/parse-facts-cache-payload.mjs +4 -5
  154. package/dist/esm/package-checks/markdown-link-validation/parse-facts-cache-payload.mjs.map +1 -1
  155. package/dist/esm/package-checks/markdown-lint/adapter.mjs +125 -0
  156. package/dist/esm/package-checks/markdown-lint/adapter.mjs.map +1 -0
  157. package/dist/esm/package-checks/markdown-lint/default-check.mjs +37 -0
  158. package/dist/esm/package-checks/markdown-lint/default-check.mjs.map +1 -0
  159. package/dist/esm/package-checks/markdown-lint/execution.mjs +202 -0
  160. package/dist/esm/package-checks/markdown-lint/execution.mjs.map +1 -0
  161. package/dist/esm/package-checks/markdown-lint/final-data.mjs +16 -0
  162. package/dist/esm/package-checks/markdown-lint/final-data.mjs.map +1 -0
  163. package/dist/esm/package-checks/markdown-lint/finding-messages.mjs +72 -0
  164. package/dist/esm/package-checks/markdown-lint/finding-messages.mjs.map +1 -0
  165. package/dist/esm/package-checks/markdown-lint/finding-waiver-identity.mjs +41 -0
  166. package/dist/esm/package-checks/markdown-lint/finding-waiver-identity.mjs.map +1 -0
  167. package/dist/esm/package-checks/markdown-lint/findings-cache.mjs +110 -0
  168. package/dist/esm/package-checks/markdown-lint/findings-cache.mjs.map +1 -0
  169. package/dist/esm/package-checks/markdown-lint/options-resolution.mjs +74 -0
  170. package/dist/esm/package-checks/markdown-lint/options-resolution.mjs.map +1 -0
  171. package/dist/esm/package-checks/markdown-lint/options-validation.mjs +41 -0
  172. package/dist/esm/package-checks/markdown-lint/options-validation.mjs.map +1 -0
  173. package/dist/esm/package-checks/markdown-lint/options.mjs +13 -0
  174. package/dist/esm/package-checks/markdown-lint/options.mjs.map +1 -0
  175. package/dist/esm/package-checks/markdown-lint/records.mjs +65 -0
  176. package/dist/esm/package-checks/markdown-lint/records.mjs.map +1 -0
  177. package/dist/esm/package-checks/markdown-lint/unavailable-reasons.mjs +14 -0
  178. package/dist/esm/package-checks/markdown-lint/unavailable-reasons.mjs.map +1 -0
  179. package/dist/esm/package-checks/project-files/collection.mjs +23 -19
  180. package/dist/esm/package-checks/project-files/collection.mjs.map +1 -1
  181. package/dist/esm/package-checks/project-files/configuration.mjs +1 -1
  182. package/dist/esm/package-checks/project-files/configuration.mjs.map +1 -1
  183. package/dist/esm/package-checks/project-files/gitlink-revision.mjs +2 -5
  184. package/dist/esm/package-checks/project-files/gitlink-revision.mjs.map +1 -1
  185. package/dist/esm/package-checks/project-files/gitlink-worktree.mjs +22 -6
  186. package/dist/esm/package-checks/project-files/gitlink-worktree.mjs.map +1 -1
  187. package/dist/esm/package-checks/project-files/public-collection.mjs +1 -1
  188. package/dist/esm/package-checks/project-files/public-collection.mjs.map +1 -1
  189. package/dist/esm/package-checks/project-files/revision-paths.mjs +3 -3
  190. package/dist/esm/package-checks/project-files/revision-paths.mjs.map +1 -1
  191. package/dist/esm/package-checks/project-files/revision-worktree-files.mjs +11 -15
  192. package/dist/esm/package-checks/project-files/revision-worktree-files.mjs.map +1 -1
  193. package/dist/esm/package-checks/secret-detection/default-check.mjs +9 -11
  194. package/dist/esm/package-checks/secret-detection/default-check.mjs.map +1 -1
  195. package/dist/esm/package-checks/secret-detection/execution.mjs +2 -2
  196. package/dist/esm/package-checks/secret-detection/execution.mjs.map +1 -1
  197. package/dist/esm/package-checks/secret-detection/input-preparation.mjs +46 -7
  198. package/dist/esm/package-checks/secret-detection/input-preparation.mjs.map +1 -1
  199. package/dist/esm/package-checks/secret-detection/options.mjs.map +1 -1
  200. package/dist/esm/package-checks/secret-detection/records.mjs.map +1 -1
  201. package/dist/esm/package-checks/secret-detection/secretlint/adapter.mjs +3 -4
  202. package/dist/esm/package-checks/secret-detection/secretlint/adapter.mjs.map +1 -1
  203. package/dist/esm/package-tools/admission-policy/define-admission-policy.mjs +10 -0
  204. package/dist/esm/package-tools/admission-policy/define-admission-policy.mjs.map +1 -0
  205. package/dist/esm/{cache → package-tools/cache}/cache-json-by-key.mjs +13 -14
  206. package/dist/esm/package-tools/cache/cache-json-by-key.mjs.map +1 -0
  207. package/dist/esm/package-tools/finding-presentation/finding-presentation.mjs.map +1 -0
  208. package/dist/esm/{finding-waivers → package-tools/finding-waivers}/reconciliation.mjs +14 -5
  209. package/dist/esm/package-tools/finding-waivers/reconciliation.mjs.map +1 -0
  210. package/dist/esm/package-tools/learned-critical-path/critical-path-ranking.mjs.map +1 -0
  211. package/dist/esm/package-tools/learned-critical-path/duration-model/bounded-history.mjs.map +1 -0
  212. package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/duration-model/prediction.mjs +2 -2
  213. package/dist/esm/package-tools/learned-critical-path/duration-model/prediction.mjs.map +1 -0
  214. package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/duration-model/preparation.mjs +4 -2
  215. package/dist/esm/package-tools/learned-critical-path/duration-model/preparation.mjs.map +1 -0
  216. package/dist/esm/package-tools/learned-critical-path/duration-model/recording.mjs.map +1 -0
  217. package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/duration-model/storage.mjs +8 -8
  218. package/dist/esm/package-tools/learned-critical-path/duration-model/storage.mjs.map +1 -0
  219. package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/selection-layers.mjs +1 -2
  220. package/dist/esm/package-tools/learned-critical-path/selection-layers.mjs.map +1 -0
  221. package/dist/esm/package-tools/learned-critical-path/static-decision.mjs.map +1 -0
  222. package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/strategy.mjs +3 -3
  223. package/dist/esm/package-tools/learned-critical-path/strategy.mjs.map +1 -0
  224. package/dist/esm/project-definition/check-tree/authoring.mjs +8 -5
  225. package/dist/esm/project-definition/check-tree/authoring.mjs.map +1 -1
  226. package/dist/esm/project-definition/check-tree/check-fields-authoring.mjs +79 -66
  227. package/dist/esm/project-definition/check-tree/check-fields-authoring.mjs.map +1 -1
  228. package/dist/esm/project-definition/check-tree/flag-conditions.mjs +71 -0
  229. package/dist/esm/project-definition/check-tree/flag-conditions.mjs.map +1 -0
  230. package/dist/esm/project-definition/check-tree/materialization.mjs +13 -8
  231. package/dist/esm/project-definition/check-tree/materialization.mjs.map +1 -1
  232. package/dist/esm/project-definition/check-tree/resolution.mjs +7 -6
  233. package/dist/esm/project-definition/check-tree/resolution.mjs.map +1 -1
  234. package/dist/esm/project-definition/declarative-snapshot.mjs +2 -1
  235. package/dist/esm/project-definition/declarative-snapshot.mjs.map +1 -1
  236. package/dist/esm/project-definition/project-changes.mjs +70 -0
  237. package/dist/esm/project-definition/project-changes.mjs.map +1 -0
  238. package/dist/esm/project-definition/project-definition-validation.mjs +40 -8
  239. package/dist/esm/project-definition/project-definition-validation.mjs.map +1 -1
  240. package/dist/esm/project-definition/project-definition.mjs +22 -15
  241. package/dist/esm/project-definition/project-definition.mjs.map +1 -1
  242. package/dist/esm/project-definition/scheduler-policy.mjs.map +1 -1
  243. package/dist/esm/project-run/admission-strategy-provider/custom-strategy-preparation.mjs +9 -6
  244. package/dist/esm/project-run/admission-strategy-provider/custom-strategy-preparation.mjs.map +1 -1
  245. package/dist/esm/project-run/admission-strategy-provider/prepared-admission-strategy.mjs.map +1 -1
  246. package/dist/esm/project-run/aggregation.mjs +42 -59
  247. package/dist/esm/project-run/aggregation.mjs.map +1 -1
  248. package/dist/esm/project-run/changes/git.mjs +161 -0
  249. package/dist/esm/project-run/changes/git.mjs.map +1 -0
  250. package/dist/esm/project-run/check-execution/admitted-check-execution.mjs +41 -0
  251. package/dist/esm/project-run/check-execution/admitted-check-execution.mjs.map +1 -0
  252. package/dist/esm/project-run/check-execution/callback.mjs +3 -2
  253. package/dist/esm/project-run/check-execution/callback.mjs.map +1 -1
  254. package/dist/esm/project-run/check-execution/dependencies.mjs +80 -5
  255. package/dist/esm/project-run/check-execution/dependencies.mjs.map +1 -1
  256. package/dist/esm/project-run/check-execution/execution-finalization.mjs +5 -3
  257. package/dist/esm/project-run/check-execution/execution-finalization.mjs.map +1 -1
  258. package/dist/esm/project-run/check-execution/execution-settlement.mjs +37 -16
  259. package/dist/esm/project-run/check-execution/execution-settlement.mjs.map +1 -1
  260. package/dist/esm/project-run/check-execution/flag-controls.mjs +15 -7
  261. package/dist/esm/project-run/check-execution/flag-controls.mjs.map +1 -1
  262. package/dist/esm/project-run/check-execution/lifecycle.mjs.map +1 -1
  263. package/dist/esm/project-run/check-execution/{preflight-result.mjs → preparation-result.mjs} +24 -24
  264. package/dist/esm/project-run/check-execution/preparation-result.mjs.map +1 -0
  265. package/dist/esm/project-run/check-execution/{preflight.mjs → preparation.mjs} +52 -52
  266. package/dist/esm/project-run/check-execution/preparation.mjs.map +1 -0
  267. package/dist/esm/project-run/check-execution/ready-check-execution.mjs +71 -0
  268. package/dist/esm/project-run/check-execution/ready-check-execution.mjs.map +1 -0
  269. package/dist/esm/project-run/check-execution/resolved-checks.mjs +27 -164
  270. package/dist/esm/project-run/check-execution/resolved-checks.mjs.map +1 -1
  271. package/dist/esm/project-run/check-execution/scheduled-check-run.mjs +79 -0
  272. package/dist/esm/project-run/check-execution/scheduled-check-run.mjs.map +1 -0
  273. package/dist/esm/project-run/check-execution/terminal-result.mjs +70 -25
  274. package/dist/esm/project-run/check-execution/terminal-result.mjs.map +1 -1
  275. package/dist/esm/project-run/completion/completion.mjs +18 -1
  276. package/dist/esm/project-run/completion/completion.mjs.map +1 -1
  277. package/dist/esm/project-run/controls/contract.mjs.map +1 -1
  278. package/dist/esm/project-run/controls/validation.mjs +7 -54
  279. package/dist/esm/project-run/controls/validation.mjs.map +1 -1
  280. package/dist/esm/project-run/diagnostic-logging/diagnostic-detail-rendering.mjs +3 -3
  281. package/dist/esm/project-run/diagnostic-logging/diagnostic-detail-rendering.mjs.map +1 -1
  282. package/dist/esm/project-run/diagnostic-logging/observation-rendering.mjs +1 -1
  283. package/dist/esm/project-run/diagnostic-logging/observation-rendering.mjs.map +1 -1
  284. package/dist/esm/project-run/invocation/candidate.mjs +17 -13
  285. package/dist/esm/project-run/invocation/candidate.mjs.map +1 -1
  286. package/dist/esm/project-run/invocation/candidates.mjs +26 -0
  287. package/dist/esm/project-run/invocation/candidates.mjs.map +1 -0
  288. package/dist/esm/project-run/invocation/creation.mjs +7 -3
  289. package/dist/esm/project-run/invocation/creation.mjs.map +1 -1
  290. package/dist/esm/project-run/invocation/execution.mjs +98 -0
  291. package/dist/esm/project-run/invocation/execution.mjs.map +1 -0
  292. package/dist/esm/project-run/invocation/run.mjs +13 -112
  293. package/dist/esm/project-run/invocation/run.mjs.map +1 -1
  294. package/dist/esm/project-run/invocation/scheduler.mjs +13 -6
  295. package/dist/esm/project-run/invocation/scheduler.mjs.map +1 -1
  296. package/dist/esm/project-run/outputs/status.mjs +12 -12
  297. package/dist/esm/project-run/outputs/status.mjs.map +1 -1
  298. package/dist/esm/project-run/progress-rendering/presentation.mjs +31 -11
  299. package/dist/esm/project-run/progress-rendering/presentation.mjs.map +1 -1
  300. package/dist/esm/project-run/progress-rendering/renderer-formatting.mjs +11 -4
  301. package/dist/esm/project-run/progress-rendering/renderer-formatting.mjs.map +1 -1
  302. package/dist/esm/project-run/progress-rendering/renderer-lifecycle.mjs +20 -6
  303. package/dist/esm/project-run/progress-rendering/renderer-lifecycle.mjs.map +1 -1
  304. package/dist/esm/project-run/progress-rendering/renderer.mjs +6 -2
  305. package/dist/esm/project-run/progress-rendering/renderer.mjs.map +1 -1
  306. package/dist/esm/project-run/project-context.mjs +2 -1
  307. package/dist/esm/project-run/project-context.mjs.map +1 -1
  308. package/dist/esm/project-run/result.mjs +2 -2
  309. package/dist/esm/project-run/result.mjs.map +1 -1
  310. package/dist/esm/project-run/run.mjs.map +1 -1
  311. package/dist/esm/project-run/task-scheduler/admission-core/compiled-graph-lookup.mjs +45 -0
  312. package/dist/esm/project-run/task-scheduler/admission-core/compiled-graph-lookup.mjs.map +1 -0
  313. package/dist/esm/project-run/task-scheduler/admission-core/compiled-graph.mjs +9 -4
  314. package/dist/esm/project-run/task-scheduler/admission-core/compiled-graph.mjs.map +1 -1
  315. package/dist/esm/project-run/task-scheduler/admission-core/selection-query.mjs +3 -5
  316. package/dist/esm/project-run/task-scheduler/admission-core/selection-query.mjs.map +1 -1
  317. package/dist/esm/project-run/task-scheduler/admission-core/selection-seed.mjs +25 -8
  318. package/dist/esm/project-run/task-scheduler/admission-core/selection-seed.mjs.map +1 -1
  319. package/dist/esm/project-run/task-scheduler/admission-core/selection-transition.mjs +8 -8
  320. package/dist/esm/project-run/task-scheduler/admission-core/selection-transition.mjs.map +1 -1
  321. package/dist/esm/project-run/task-scheduler/execution-state.mjs.map +1 -1
  322. package/dist/esm/project-run/task-scheduler/measurement/diagnostics.mjs +8 -4
  323. package/dist/esm/project-run/task-scheduler/measurement/diagnostics.mjs.map +1 -1
  324. package/dist/esm/project-run/task-scheduler/measurement/timing.mjs +12 -6
  325. package/dist/esm/project-run/task-scheduler/measurement/timing.mjs.map +1 -1
  326. package/dist/esm/project-run/task-scheduler/scheduler-observation.mjs +3 -1
  327. package/dist/esm/project-run/task-scheduler/scheduler-observation.mjs.map +1 -1
  328. package/dist/esm/project-run/task-scheduler/scheduler-terminal-measurement.mjs +17 -17
  329. package/dist/esm/project-run/task-scheduler/scheduler-terminal-measurement.mjs.map +1 -1
  330. package/dist/esm/project-run/task-scheduler/scheduler.mjs +18 -6
  331. package/dist/esm/project-run/task-scheduler/scheduler.mjs.map +1 -1
  332. package/docs/api-mechanics.md +147 -28
  333. package/docs/changelog.md +145 -2
  334. package/docs/checks/duplicate-detection.md +22 -3
  335. package/docs/checks/file-metrics.md +25 -6
  336. package/docs/checks/function-metrics.md +21 -2
  337. package/docs/checks/json-schema-validation.md +25 -4
  338. package/docs/checks/json-validation.md +24 -5
  339. package/docs/checks/maintenance-reminders.md +30 -6
  340. package/docs/checks/markdown-link-validation.md +24 -4
  341. package/docs/checks/markdown-lint.md +167 -0
  342. package/docs/checks/secret-detection.md +31 -7
  343. package/docs/examples/artifacts/mixed-outcomes/definition.ts +10 -10
  344. package/docs/guides/building-project-gate.md +706 -0
  345. package/docs/guides/callbacks.md +81 -22
  346. package/docs/guides/check-dependencies.md +41 -10
  347. package/docs/guides/collecting-project-files.md +7 -7
  348. package/docs/guides/command-check.md +155 -0
  349. package/docs/guides/data-boundaries.md +140 -0
  350. package/docs/guides/extending-check-lifecycle.md +77 -25
  351. package/docs/guides/finding-waivers.md +43 -1
  352. package/docs/guides/learned-scheduling.md +1 -1
  353. package/docs/guides/run-outputs.md +35 -9
  354. package/docs/guides/scheduling.md +15 -15
  355. package/docs/output.md +6 -5
  356. package/package.json +2 -1
  357. package/src/check/check.ts +332 -92
  358. package/src/check/flag-enablement.ts +76 -0
  359. package/src/check/handoff-provider-identity.ts +34 -0
  360. package/src/check/inherited-collection.ts +1 -1
  361. package/src/check/project-changes.ts +14 -0
  362. package/src/check/project-context.ts +11 -0
  363. package/src/check-settlement/facts.ts +1 -1
  364. package/src/check-settlement/record-store.ts +1 -1
  365. package/src/data-boundary/canonical-data.ts +36 -9
  366. package/src/data-boundary/canonical-json.ts +18 -1
  367. package/src/data-boundary/closed-values.ts +26 -6
  368. package/src/data-boundary/config-glob.ts +17 -0
  369. package/src/data-boundary/project-path.ts +21 -0
  370. package/src/index.ts +72 -11
  371. package/src/machine-output/v4/atomic-publication.ts +3 -1
  372. package/src/package-checks/check-authoring.ts +136 -0
  373. package/src/package-checks/code-quality-findings/finding-waiver-authoring.ts +1 -1
  374. package/src/package-checks/code-quality-findings/finding-waiver-evidence.ts +1 -1
  375. package/src/package-checks/command-check/command-check.ts +152 -0
  376. package/src/package-checks/command-check/contract.ts +168 -0
  377. package/src/package-checks/command-check/execution.ts +211 -0
  378. package/src/package-checks/command-check/options.ts +331 -0
  379. package/src/package-checks/command-check/transcript.ts +35 -0
  380. package/src/package-checks/duplicate-detection/default-check.ts +37 -6
  381. package/src/package-checks/duplicate-detection/execution.ts +2 -4
  382. package/src/package-checks/duplicate-detection/finding-messages.ts +2 -2
  383. package/src/package-checks/duplicate-detection/jscpd/availability.ts +1 -1
  384. package/src/package-checks/duplicate-detection/options.ts +6 -3
  385. package/src/package-checks/duplicate-detection/records.ts +1 -1
  386. package/src/package-checks/file-metrics/constructor.ts +29 -6
  387. package/src/package-checks/file-metrics/execution.ts +2 -4
  388. package/src/package-checks/file-metrics/finding-messages.ts +1 -1
  389. package/src/package-checks/file-metrics/options.ts +6 -3
  390. package/src/package-checks/file-metrics/records.ts +1 -1
  391. package/src/package-checks/file-metrics/scc/availability.ts +1 -1
  392. package/src/package-checks/file-metrics/scc/batch-planner.ts +56 -0
  393. package/src/package-checks/file-metrics/scc/logical-scan-resources.ts +59 -0
  394. package/src/package-checks/file-metrics/scc/scanner.ts +134 -32
  395. package/src/package-checks/function-metrics/analysis.ts +7 -2
  396. package/src/package-checks/function-metrics/analyzer/analysis-model.ts +1 -1
  397. package/src/package-checks/function-metrics/analyzer/extension-output.ts +14 -6
  398. package/src/package-checks/function-metrics/analyzer/extensions/lizardcomplextags.ts +1 -3
  399. package/src/package-checks/function-metrics/analyzer/extensions/protocol.ts +3 -3
  400. package/src/package-checks/function-metrics/analyzer/pipeline.ts +4 -2
  401. package/src/package-checks/function-metrics/analyzer/readers/erlang.ts +6 -6
  402. package/src/package-checks/function-metrics/analyzer/readers/fortran.ts +1 -1
  403. package/src/package-checks/function-metrics/analyzer/readers/objc.ts +9 -3
  404. package/src/package-checks/function-metrics/analyzer/readers/php-states.ts +14 -7
  405. package/src/package-checks/function-metrics/analyzer/readers/plsql.ts +8 -4
  406. package/src/package-checks/function-metrics/analyzer/readers/python.ts +4 -3
  407. package/src/package-checks/function-metrics/analyzer/readers/r.ts +2 -1
  408. package/src/package-checks/function-metrics/analyzer/readers/ttcn.ts +9 -3
  409. package/src/package-checks/function-metrics/analyzer/readers/typescript.ts +9 -3
  410. package/src/package-checks/function-metrics/analyzer/readers/zig.ts +2 -1
  411. package/src/package-checks/function-metrics/analyzer/shared/code-reader.ts +3 -1
  412. package/src/package-checks/function-metrics/analyzer/shared/js-style-regex.ts +10 -5
  413. package/src/package-checks/function-metrics/analyzer-worker-port.ts +20 -6
  414. package/src/package-checks/function-metrics/constructor.ts +30 -7
  415. package/src/package-checks/function-metrics/execution.ts +2 -4
  416. package/src/package-checks/function-metrics/finding-messages.ts +2 -2
  417. package/src/package-checks/function-metrics/measurement.ts +3 -1
  418. package/src/package-checks/function-metrics/options.ts +6 -3
  419. package/src/package-checks/function-metrics/records.ts +1 -1
  420. package/src/package-checks/host-environment/git.ts +11 -0
  421. package/src/package-checks/host-environment/path.ts +1 -20
  422. package/src/package-checks/host-environment/process/contract.ts +17 -9
  423. package/src/package-checks/host-environment/process/result.ts +48 -20
  424. package/src/package-checks/host-environment/process/runner.ts +8 -4
  425. package/src/package-checks/json-schema-validation/default-check.ts +38 -5
  426. package/src/package-checks/json-schema-validation/options.ts +4 -1
  427. package/src/package-checks/json-schema-validation/reference-resolver.ts +6 -2
  428. package/src/package-checks/json-schema-validation/schema-policy.ts +10 -5
  429. package/src/package-checks/json-validation/default-check.ts +27 -6
  430. package/src/package-checks/json-validation/options.ts +4 -1
  431. package/src/package-checks/local-cache-options.ts +40 -0
  432. package/src/package-checks/maintenance-reminders/maintenance-reminders.ts +89 -9
  433. package/src/package-checks/maintenance-reminders/maintenance-support.ts +3 -3
  434. package/src/package-checks/markdown-link-validation/default-check.ts +48 -5
  435. package/src/package-checks/markdown-link-validation/execution.ts +1 -1
  436. package/src/package-checks/markdown-link-validation/finding-messages.ts +1 -1
  437. package/src/package-checks/markdown-link-validation/markdown-parser.ts +1 -5
  438. package/src/package-checks/markdown-link-validation/options-resolution.ts +2 -19
  439. package/src/package-checks/markdown-link-validation/options-validation.ts +2 -17
  440. package/src/package-checks/markdown-link-validation/options.ts +6 -7
  441. package/src/package-checks/markdown-link-validation/parse-facts-cache-payload.ts +4 -5
  442. package/src/package-checks/markdown-lint/adapter.ts +167 -0
  443. package/src/package-checks/markdown-lint/default-check.ts +92 -0
  444. package/src/package-checks/markdown-lint/execution.ts +266 -0
  445. package/src/package-checks/markdown-lint/final-data.ts +33 -0
  446. package/src/package-checks/markdown-lint/finding-messages.ts +87 -0
  447. package/src/package-checks/markdown-lint/finding-waiver-identity.ts +54 -0
  448. package/src/package-checks/markdown-lint/findings-cache.ts +141 -0
  449. package/src/package-checks/markdown-lint/options-resolution.ts +102 -0
  450. package/src/package-checks/markdown-lint/options-validation.ts +50 -0
  451. package/src/package-checks/markdown-lint/options.ts +82 -0
  452. package/src/package-checks/markdown-lint/records.ts +132 -0
  453. package/src/package-checks/markdown-lint/unavailable-reasons.ts +33 -0
  454. package/src/package-checks/project-files/collection.ts +38 -22
  455. package/src/package-checks/project-files/config-glob.ts +1 -17
  456. package/src/package-checks/project-files/configuration.ts +1 -1
  457. package/src/package-checks/project-files/gitlink-revision.ts +4 -6
  458. package/src/package-checks/project-files/gitlink-worktree.ts +35 -7
  459. package/src/package-checks/project-files/public-collection.ts +1 -1
  460. package/src/package-checks/project-files/revision-paths.ts +3 -3
  461. package/src/package-checks/project-files/revision-worktree-files.ts +16 -16
  462. package/src/package-checks/secret-detection/default-check.ts +29 -6
  463. package/src/package-checks/secret-detection/execution.ts +2 -2
  464. package/src/package-checks/secret-detection/input-preparation.ts +64 -7
  465. package/src/package-checks/secret-detection/options.ts +5 -2
  466. package/src/package-checks/secret-detection/records.ts +1 -1
  467. package/src/package-checks/secret-detection/secretlint/adapter.ts +3 -4
  468. package/src/package-tools/admission-policy/define-admission-policy.ts +54 -0
  469. package/src/{cache → package-tools/cache}/cache-json-by-key.ts +13 -17
  470. package/src/{check → package-tools/finding-presentation}/finding-presentation.ts +3 -1
  471. package/src/{finding-waivers → package-tools/finding-waivers}/reconciliation.ts +16 -8
  472. package/src/{learned-critical-path → package-tools/learned-critical-path}/duration-model/prediction.ts +5 -2
  473. package/src/{learned-critical-path → package-tools/learned-critical-path}/duration-model/preparation.ts +5 -3
  474. package/src/{learned-critical-path → package-tools/learned-critical-path}/duration-model/recording.ts +5 -4
  475. package/src/{learned-critical-path → package-tools/learned-critical-path}/duration-model/storage.ts +9 -10
  476. package/src/{learned-critical-path → package-tools/learned-critical-path}/selection-layers.ts +2 -3
  477. package/src/{learned-critical-path → package-tools/learned-critical-path}/static-decision.ts +1 -1
  478. package/src/{learned-critical-path → package-tools/learned-critical-path}/strategy.ts +7 -4
  479. package/src/project-definition/check-tree/authoring.ts +15 -8
  480. package/src/project-definition/check-tree/check-fields-authoring.ts +106 -91
  481. package/src/project-definition/check-tree/flag-conditions.ts +99 -0
  482. package/src/project-definition/check-tree/materialization.ts +12 -8
  483. package/src/project-definition/check-tree/resolution.ts +13 -15
  484. package/src/project-definition/declarative-snapshot.ts +9 -2
  485. package/src/project-definition/project-changes.ts +112 -0
  486. package/src/project-definition/project-definition-validation.ts +58 -10
  487. package/src/project-definition/project-definition.ts +41 -68
  488. package/src/project-definition/scheduler-policy.ts +6 -3
  489. package/src/project-run/admission-strategy-provider/custom-strategy-preparation.ts +11 -8
  490. package/src/project-run/admission-strategy-provider/prepared-admission-strategy.ts +2 -2
  491. package/src/project-run/aggregation.ts +51 -74
  492. package/src/project-run/changes/git.ts +206 -0
  493. package/src/project-run/check-execution/admitted-check-execution.ts +62 -0
  494. package/src/project-run/check-execution/callback.ts +3 -2
  495. package/src/project-run/check-execution/dependencies.ts +120 -6
  496. package/src/project-run/check-execution/execution-finalization.ts +6 -4
  497. package/src/project-run/check-execution/execution-settlement.ts +88 -29
  498. package/src/project-run/check-execution/flag-controls.ts +22 -8
  499. package/src/project-run/check-execution/lifecycle.ts +14 -6
  500. package/src/project-run/check-execution/{preflight-result.ts → preparation-result.ts} +34 -32
  501. package/src/project-run/check-execution/{preflight.ts → preparation.ts} +92 -84
  502. package/src/project-run/check-execution/ready-check-execution.ts +97 -0
  503. package/src/project-run/check-execution/resolved-checks.ts +40 -219
  504. package/src/project-run/check-execution/scheduled-check-run.ts +119 -0
  505. package/src/project-run/check-execution/terminal-result.ts +108 -29
  506. package/src/project-run/completion/completion.ts +17 -3
  507. package/src/project-run/controls/contract.ts +6 -16
  508. package/src/project-run/controls/validation.ts +7 -60
  509. package/src/project-run/diagnostic-logging/diagnostic-detail-rendering.ts +1 -2
  510. package/src/project-run/diagnostic-logging/observation-rendering.ts +1 -1
  511. package/src/project-run/invocation/candidate.ts +28 -15
  512. package/src/project-run/invocation/candidates.ts +56 -0
  513. package/src/project-run/invocation/creation.ts +7 -3
  514. package/src/project-run/invocation/execution.ts +136 -0
  515. package/src/project-run/invocation/run.ts +15 -179
  516. package/src/project-run/invocation/scheduler.ts +13 -6
  517. package/src/project-run/outputs/status.ts +15 -15
  518. package/src/project-run/progress-rendering/presentation.ts +35 -13
  519. package/src/project-run/progress-rendering/renderer-formatting.ts +20 -7
  520. package/src/project-run/progress-rendering/renderer-lifecycle.ts +23 -6
  521. package/src/project-run/progress-rendering/renderer.ts +10 -4
  522. package/src/project-run/project-context.ts +8 -4
  523. package/src/project-run/result.ts +5 -5
  524. package/src/project-run/run.ts +1 -1
  525. package/src/project-run/task-scheduler/admission-core/compiled-graph-lookup.ts +71 -0
  526. package/src/project-run/task-scheduler/admission-core/compiled-graph.ts +9 -4
  527. package/src/project-run/task-scheduler/admission-core/selection-query.ts +6 -4
  528. package/src/project-run/task-scheduler/admission-core/selection-seed.ts +36 -6
  529. package/src/project-run/task-scheduler/admission-core/selection-transition.ts +17 -8
  530. package/src/project-run/task-scheduler/execution-state.ts +4 -4
  531. package/src/project-run/task-scheduler/measurement/diagnostics.ts +10 -4
  532. package/src/project-run/task-scheduler/measurement/timing.ts +13 -5
  533. package/src/project-run/task-scheduler/scheduler-observation.ts +3 -1
  534. package/src/project-run/task-scheduler/scheduler-terminal-measurement.ts +24 -22
  535. package/src/project-run/task-scheduler/scheduler.ts +23 -6
  536. package/types/check/check.d.ts +178 -67
  537. package/types/check/flag-enablement.d.ts +42 -0
  538. package/types/check/handoff-provider-identity.d.ts +12 -0
  539. package/types/check/project-changes.d.ts +13 -0
  540. package/types/check/project-context.d.ts +10 -0
  541. package/types/check-settlement/facts.d.ts +1 -1
  542. package/types/data-boundary/canonical-data.d.ts +28 -5
  543. package/types/data-boundary/canonical-json.d.ts +18 -1
  544. package/types/data-boundary/closed-values.d.ts +17 -1
  545. package/types/data-boundary/config-glob.d.ts +5 -0
  546. package/types/data-boundary/project-path.d.ts +4 -0
  547. package/types/index.d.ts +27 -11
  548. package/types/package-checks/check-authoring.d.ts +45 -0
  549. package/types/package-checks/code-quality-findings/finding-waiver-authoring.d.ts +1 -1
  550. package/types/package-checks/code-quality-findings/finding-waiver-evidence.d.ts +1 -1
  551. package/types/package-checks/command-check/command-check.d.ts +48 -0
  552. package/types/package-checks/command-check/contract.d.ts +108 -0
  553. package/types/package-checks/command-check/execution.d.ts +7 -0
  554. package/types/package-checks/command-check/options.d.ts +11 -0
  555. package/types/package-checks/command-check/transcript.d.ts +8 -0
  556. package/types/package-checks/duplicate-detection/default-check.d.ts +5 -2
  557. package/types/package-checks/duplicate-detection/finding-messages.d.ts +1 -1
  558. package/types/package-checks/duplicate-detection/options.d.ts +4 -3
  559. package/types/package-checks/duplicate-detection/records.d.ts +1 -1
  560. package/types/package-checks/file-metrics/constructor.d.ts +5 -2
  561. package/types/package-checks/file-metrics/options.d.ts +4 -3
  562. package/types/package-checks/file-metrics/records.d.ts +1 -1
  563. package/types/package-checks/file-metrics/scc/batch-planner.d.ts +18 -0
  564. package/types/package-checks/file-metrics/scc/logical-scan-resources.d.ts +14 -0
  565. package/types/package-checks/function-metrics/analyzer/extensions/protocol.d.ts +3 -3
  566. package/types/package-checks/function-metrics/constructor.d.ts +5 -2
  567. package/types/package-checks/function-metrics/finding-messages.d.ts +1 -1
  568. package/types/package-checks/function-metrics/options.d.ts +4 -3
  569. package/types/package-checks/function-metrics/records.d.ts +1 -1
  570. package/types/package-checks/host-environment/git.d.ts +2 -0
  571. package/types/package-checks/host-environment/path.d.ts +1 -3
  572. package/types/package-checks/host-environment/process/contract.d.ts +17 -9
  573. package/types/package-checks/json-schema-validation/default-check.d.ts +4 -1
  574. package/types/package-checks/json-schema-validation/options.d.ts +2 -1
  575. package/types/package-checks/json-validation/default-check.d.ts +4 -1
  576. package/types/package-checks/json-validation/options.d.ts +2 -1
  577. package/types/package-checks/local-cache-options.d.ts +9 -0
  578. package/types/package-checks/maintenance-reminders/maintenance-reminders.d.ts +11 -2
  579. package/types/package-checks/markdown-link-validation/default-check.d.ts +4 -1
  580. package/types/package-checks/markdown-link-validation/options.d.ts +4 -7
  581. package/types/package-checks/markdown-lint/adapter.d.ts +10 -0
  582. package/types/package-checks/markdown-lint/default-check.d.ts +37 -0
  583. package/types/package-checks/markdown-lint/execution.d.ts +24 -0
  584. package/types/package-checks/markdown-lint/final-data.d.ts +8 -0
  585. package/types/package-checks/markdown-lint/finding-messages.d.ts +6 -0
  586. package/types/package-checks/markdown-lint/finding-waiver-identity.d.ts +3 -0
  587. package/types/package-checks/markdown-lint/findings-cache.d.ts +17 -0
  588. package/types/package-checks/markdown-lint/options-resolution.d.ts +3 -0
  589. package/types/package-checks/markdown-lint/options-validation.d.ts +2 -0
  590. package/types/package-checks/markdown-lint/options.d.ts +65 -0
  591. package/types/package-checks/markdown-lint/records.d.ts +39 -0
  592. package/types/package-checks/markdown-lint/unavailable-reasons.d.ts +3 -0
  593. package/types/package-checks/secret-detection/default-check.d.ts +4 -1
  594. package/types/package-checks/secret-detection/options.d.ts +3 -2
  595. package/types/package-tools/admission-policy/define-admission-policy.d.ts +26 -0
  596. package/types/{check → package-tools/finding-presentation}/finding-presentation.d.ts +3 -1
  597. package/types/{finding-waivers → package-tools/finding-waivers}/reconciliation.d.ts +3 -3
  598. package/types/{learned-critical-path → package-tools/learned-critical-path}/duration-model/prediction.d.ts +2 -2
  599. package/types/{learned-critical-path → package-tools/learned-critical-path}/duration-model/preparation.d.ts +1 -1
  600. package/types/{learned-critical-path → package-tools/learned-critical-path}/duration-model/recording.d.ts +1 -1
  601. package/types/{learned-critical-path → package-tools/learned-critical-path}/selection-layers.d.ts +1 -1
  602. package/types/{learned-critical-path → package-tools/learned-critical-path}/static-decision.d.ts +1 -1
  603. package/types/{learned-critical-path → package-tools/learned-critical-path}/strategy.d.ts +1 -1
  604. package/types/project-definition/check-tree/authoring.d.ts +5 -3
  605. package/types/project-definition/check-tree/check-fields-authoring.d.ts +12 -7
  606. package/types/project-definition/check-tree/flag-conditions.d.ts +5 -0
  607. package/types/project-definition/check-tree/resolution.d.ts +6 -4
  608. package/types/project-definition/declarative-snapshot.d.ts +4 -1
  609. package/types/project-definition/project-changes.d.ts +30 -0
  610. package/types/project-definition/project-definition.d.ts +15 -30
  611. package/types/project-definition/scheduler-policy.d.ts +3 -3
  612. package/types/project-run/admission-strategy-provider/prepared-admission-strategy.d.ts +2 -2
  613. package/types/project-run/aggregation.d.ts +8 -6
  614. package/types/project-run/changes/git.d.ts +14 -0
  615. package/types/project-run/check-execution/admitted-check-execution.d.ts +18 -0
  616. package/types/project-run/check-execution/dependencies.d.ts +3 -0
  617. package/types/project-run/check-execution/execution-finalization.d.ts +1 -1
  618. package/types/project-run/check-execution/execution-settlement.d.ts +15 -7
  619. package/types/project-run/check-execution/flag-controls.d.ts +1 -1
  620. package/types/project-run/check-execution/lifecycle.d.ts +9 -5
  621. package/types/project-run/check-execution/{preflight-result.d.ts → preparation-result.d.ts} +3 -3
  622. package/types/project-run/check-execution/{preflight.d.ts → preparation.d.ts} +10 -9
  623. package/types/project-run/check-execution/ready-check-execution.d.ts +18 -0
  624. package/types/project-run/check-execution/resolved-checks.d.ts +12 -13
  625. package/types/project-run/check-execution/scheduled-check-run.d.ts +10 -0
  626. package/types/project-run/check-execution/terminal-result.d.ts +13 -1
  627. package/types/project-run/completion/completion.d.ts +3 -1
  628. package/types/project-run/controls/contract.d.ts +6 -16
  629. package/types/project-run/invocation/candidates.d.ts +8 -0
  630. package/types/project-run/invocation/execution.d.ts +5 -0
  631. package/types/project-run/invocation/run.d.ts +2 -2
  632. package/types/project-run/outputs/status.d.ts +4 -4
  633. package/types/project-run/progress-rendering/presentation.d.ts +4 -3
  634. package/types/project-run/progress-rendering/renderer-formatting.d.ts +5 -2
  635. package/types/project-run/progress-rendering/renderer-lifecycle.d.ts +2 -0
  636. package/types/project-run/progress-rendering/renderer.d.ts +4 -2
  637. package/types/project-run/project-context.d.ts +3 -3
  638. package/types/project-run/result.d.ts +3 -3
  639. package/types/project-run/run.d.ts +1 -1
  640. package/types/project-run/task-scheduler/admission-core/compiled-graph-lookup.d.ts +10 -0
  641. package/types/project-run/task-scheduler/execution-state.d.ts +4 -4
  642. package/types/project-run/task-scheduler/measurement/diagnostics.d.ts +2 -2
  643. package/types/project-run/task-scheduler/scheduler-terminal-measurement.d.ts +1 -1
  644. package/dist/esm/cache/cache-json-by-key.mjs.map +0 -1
  645. package/dist/esm/check/finding-presentation.mjs.map +0 -1
  646. package/dist/esm/finding-waivers/reconciliation.mjs.map +0 -1
  647. package/dist/esm/learned-critical-path/duration-model/bounded-history.mjs.map +0 -1
  648. package/dist/esm/learned-critical-path/duration-model/prediction.mjs.map +0 -1
  649. package/dist/esm/learned-critical-path/duration-model/preparation.mjs.map +0 -1
  650. package/dist/esm/learned-critical-path/duration-model/recording.mjs.map +0 -1
  651. package/dist/esm/learned-critical-path/duration-model/storage.mjs.map +0 -1
  652. package/dist/esm/learned-critical-path/selection-layers.mjs.map +0 -1
  653. package/dist/esm/learned-critical-path/static-decision.mjs.map +0 -1
  654. package/dist/esm/learned-critical-path/strategy.mjs.map +0 -1
  655. package/dist/esm/package-checks/project-files/config-glob.mjs.map +0 -1
  656. package/dist/esm/project-run/check-execution/preflight-result.mjs.map +0 -1
  657. package/dist/esm/project-run/check-execution/preflight.mjs.map +0 -1
  658. package/dist/esm/project-run/task-scheduler/critical-path-ranking.mjs.map +0 -1
  659. package/types/package-checks/project-files/config-glob.d.ts +0 -5
  660. /package/dist/esm/{check → package-tools/finding-presentation}/finding-presentation.mjs +0 -0
  661. /package/dist/esm/{project-run/task-scheduler → package-tools/learned-critical-path}/critical-path-ranking.mjs +0 -0
  662. /package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/duration-model/bounded-history.mjs +0 -0
  663. /package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/duration-model/recording.mjs +0 -0
  664. /package/dist/esm/{learned-critical-path → package-tools/learned-critical-path}/static-decision.mjs +0 -0
  665. /package/src/{project-run/task-scheduler → package-tools/learned-critical-path}/critical-path-ranking.ts +0 -0
  666. /package/src/{learned-critical-path → package-tools/learned-critical-path}/duration-model/bounded-history.ts +0 -0
  667. /package/types/{cache → package-tools/cache}/cache-json-by-key.d.ts +0 -0
  668. /package/types/{project-run/task-scheduler → package-tools/learned-critical-path}/critical-path-ranking.d.ts +0 -0
  669. /package/types/{learned-critical-path → package-tools/learned-critical-path}/duration-model/bounded-history.d.ts +0 -0
  670. /package/types/{learned-critical-path → package-tools/learned-critical-path}/duration-model/storage.d.ts +0 -0
@@ -26,7 +26,7 @@ export function createInvocation(input) {
26
26
  progressLogFile: input.controls.progressLogFile,
27
27
  projectRoot: input.controls.projectRoot ?? process.cwd()
28
28
  });
29
- const outputs = createOutputStatuses(outputConfiguration, paths.diagnosticLoggingReadbackFiles, input.normalized.scheduler.measurementHooks.length > 0);
29
+ const outputs = createOutputStatuses(outputConfiguration, paths.diagnosticLoggingReadbackFiles, input.normalized.scheduler.terminalEffects.length > 0);
30
30
  const diagnosticLogging = createDiagnosticLoggingRouter({
31
31
  clock,
32
32
  coreFile: paths.diagnosticLoggingFiles.core,
@@ -50,8 +50,12 @@ export function createInvocation(input) {
50
50
  normalized: input.normalized,
51
51
  progressRendering: createProgressRendering(outputConfiguration.progressRendering, outputs, {
52
52
  clock,
53
- refreshScheduler: input.dependencies.progressRefreshScheduler,
54
- writerFactory: input.dependencies.progressWriterFactory,
53
+ ...(input.dependencies.progressRefreshScheduler === undefined
54
+ ? {}
55
+ : { refreshScheduler: input.dependencies.progressRefreshScheduler }),
56
+ ...(input.dependencies.progressWriterFactory === undefined
57
+ ? {}
58
+ : { writerFactory: input.dependencies.progressWriterFactory }),
55
59
  file: paths.progressLogFile
56
60
  }),
57
61
  startedAtUtc
@@ -1 +1 @@
1
- {"version":3,"file":"creation.mjs","sourceRoot":"","sources":["../../../../src/project-run/invocation/creation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,4BAA4B,EAK7B,MAAM,gDAAgD,CAAC;AAExD,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC9B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAA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AAC,OAAO;QAC9C,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,OAAO;QAE/C,OAAO,IAAI,CAAC;IACd,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AACrE,CAAC;AAED,SAAS,wBAAwB;IAI/B,MAAM,IAAI,GAAG,UAAU,EAAE,CAAC;IAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,iBAAiB,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,mBAAmB,CAAC,YAAoB,EAAE,cAAsB;IACvE,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACxE,OAAO,GAAG,UAAU,IAAI,cAAc,EAAE,CAAC;AAC3C,CAAC;AAED,SAAS,mBAAmB,CAAC,YAA2B;IACtD,IAAI,YAAY,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IAC9F,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import { randomUUID } from \"node:crypto\";\n\nimport {\n createDeclarativeFingerprint,\n type DefinitionWarning,\n type NormalizedProjectDefinition,\n type ProjectDefinition,\n type ResolvedProjectOutputs\n} from \"../../project-definition/project-definition.ts\";\nimport type { RunControls } from \"../controls/contract.ts\";\nimport {\n createDiagnosticLogger,\n createDiagnosticLoggingRouter\n} from \"../diagnostic-logging/logger.ts\";\nimport type { Invocation, RunInvocationDependencies } from \"./run.ts\";\nimport { createOutputStatuses } from \"../outputs/status.ts\";\nimport { effectiveOutputs } from \"../outputs/configuration.ts\";\nimport { resolveInvocationPaths } from \"./paths.ts\";\nimport { createProgressRendering } from \"../progress-rendering/presentation.ts\";\n\nconst SYSTEM_MONOTONIC_CLOCK: Invocation[\"clock\"] = Object.freeze({\n now: () => performance.now()\n});\n\nexport interface InvocationCreationInput {\n readonly controls: RunControls;\n readonly definition: ProjectDefinition;\n readonly definitionWarnings: readonly DefinitionWarning[];\n readonly dependencies: RunInvocationDependencies;\n readonly normalized: NormalizedProjectDefinition;\n}\n\n/** Creates immutable invocation-owned output state before any planning or execution work. */\nexport function createInvocation(input: InvocationCreationInput): Invocation {\n const outputConfiguration = effectiveOutputs(input.definition, input.controls);\n const clock = input.dependencies.clock ?? SYSTEM_MONOTONIC_CLOCK;\n const diagnosticLoggingEnabled = outputConfiguration.diagnosticLogging.enabled;\n const startedAtUtc = captureOutputCreationTimestamp(outputConfiguration, input.dependencies);\n const identity = createInvocationIdentity();\n const paths = resolveInvocationPaths({\n checkArtifactBaseDirectory: input.controls.checkArtifactBaseDirectory,\n checkIds: input.normalized.checks.map((check) => check.definition.checkId),\n diagnosticLogFileNaming: input.controls.diagnosticLogFileNaming ?? \"unique\",\n diagnosticLogSuffix: diagnosticLoggingEnabled\n ? diagnosticLogSuffix(requireStartedAtUtc(startedAtUtc), identity.uuid)\n : undefined,\n outputConfiguration,\n progressLogFile: input.controls.progressLogFile,\n projectRoot: input.controls.projectRoot ?? process.cwd()\n });\n const outputs = createOutputStatuses(\n outputConfiguration,\n paths.diagnosticLoggingReadbackFiles,\n input.normalized.scheduler.measurementHooks.length > 0\n );\n const diagnosticLogging = createDiagnosticLoggingRouter({\n clock,\n coreFile: paths.diagnosticLoggingFiles.core,\n factory: input.dependencies.diagnosticLoggerFactory ?? createDiagnosticLogger,\n invocationId: identity.id,\n schedulerFile: paths.diagnosticLoggingFiles.scheduler\n });\n\n return Object.freeze({\n admissionStrategyProviderFactory: input.dependencies.admissionStrategyProviderFactory,\n clock,\n controls: input.controls,\n declarativeFingerprint: createDeclarativeFingerprint(input.normalized.declarative),\n definition: input.definition,\n definitionWarnings: Object.freeze([...input.definitionWarnings]),\n diagnosticLogging,\n diagnosticLoggingEnabled,\n outputConfiguration,\n outputs,\n invocationId: identity.id,\n paths,\n normalized: input.normalized,\n progressRendering: createProgressRendering(outputConfiguration.progressRendering, outputs, {\n clock,\n refreshScheduler: input.dependencies.progressRefreshScheduler,\n writerFactory: input.dependencies.progressWriterFactory,\n file: paths.progressLogFile\n }),\n startedAtUtc\n });\n}\n\nfunction captureOutputCreationTimestamp(\n outputConfiguration: ResolvedProjectOutputs,\n dependencies: RunInvocationDependencies\n): string | null {\n if (\n !outputConfiguration.diagnosticLogging.enabled &&\n !outputConfiguration.machinePublication.enabled\n )\n return null;\n return (dependencies.wallClock?.now() ?? new Date()).toISOString();\n}\n\nfunction createInvocationIdentity(): Readonly<{\n readonly id: string;\n readonly uuid: string;\n}> {\n const uuid = randomUUID();\n return Object.freeze({ id: `invocation/v1:${uuid}`, uuid });\n}\n\nfunction diagnosticLogSuffix(startedAtUtc: string, invocationUuid: string): string {\n const compactUtc = startedAtUtc.replaceAll(\"-\", \"\").replaceAll(\":\", \"\");\n return `${compactUtc}-${invocationUuid}`;\n}\n\nfunction requireStartedAtUtc(startedAtUtc: string | null): string {\n if (startedAtUtc === null) throw new Error(\"Enabled output requires an invocation timestamp\");\n return startedAtUtc;\n}\n"]}
1
+ {"version":3,"file":"creation.mjs","sourceRoot":"","sources":["../../../../src/project-run/invocation/creation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,4BAA4B,EAK7B,MAAM,gDAAgD,CAAC;AAExD,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC9B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAEhF,MAAM,sBAAsB,GAAwB,MAAM,CA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ChE,IAAI,EAAE,KAAK,CAAC,eAAe;SAC5B,CAAC;QACF,YAAY;KACb,CAAC,CAAC;AACL,CAAC;AAED,SAAS,8BAA8B,CACrC,mBAA2C,EAC3C,YAAuC;IAEvC,IACE,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,OAAO;QAC9C,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,OAAO;QAE/C,OAAO,IAAI,CAAC;IACd,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AACrE,CAAC;AAED,SAAS,wBAAwB;IAI/B,MAAM,IAAI,GAAG,UAAU,EAAE,CAAC;IAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,iBAAiB,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,mBAAmB,CAAC,YAAoB,EAAE,cAAsB;IACvE,MAAM,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACxE,OAAO,GAAG,UAAU,IAAI,cAAc,EAAE,CAAC;AAC3C,CAAC;AAED,SAAS,mBAAmB,CAAC,YAA2B;IACtD,IAAI,YAAY,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IAC9F,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import { randomUUID } from \"node:crypto\";\n\nimport {\n createDeclarativeFingerprint,\n type DefinitionWarning,\n type NormalizedProjectDefinition,\n type ProjectDefinition,\n type ResolvedProjectOutputs\n} from \"../../project-definition/project-definition.ts\";\nimport type { RunControls } from \"../controls/contract.ts\";\nimport {\n createDiagnosticLogger,\n createDiagnosticLoggingRouter\n} from \"../diagnostic-logging/logger.ts\";\nimport type { Invocation, RunInvocationDependencies } from \"./run.ts\";\nimport { createOutputStatuses } from \"../outputs/status.ts\";\nimport { effectiveOutputs } from \"../outputs/configuration.ts\";\nimport { resolveInvocationPaths } from \"./paths.ts\";\nimport { createProgressRendering } from \"../progress-rendering/presentation.ts\";\n\nconst SYSTEM_MONOTONIC_CLOCK: Invocation[\"clock\"] = Object.freeze({\n now: () => performance.now()\n});\n\nexport interface InvocationCreationInput {\n readonly controls: RunControls;\n readonly definition: ProjectDefinition;\n readonly definitionWarnings: readonly DefinitionWarning[];\n readonly dependencies: RunInvocationDependencies;\n readonly normalized: NormalizedProjectDefinition;\n}\n\n/** Creates immutable invocation-owned output state before any planning or execution work. */\nexport function createInvocation(input: InvocationCreationInput): Invocation {\n const outputConfiguration = effectiveOutputs(input.definition, input.controls);\n const clock = input.dependencies.clock ?? SYSTEM_MONOTONIC_CLOCK;\n const diagnosticLoggingEnabled = outputConfiguration.diagnosticLogging.enabled;\n const startedAtUtc = captureOutputCreationTimestamp(outputConfiguration, input.dependencies);\n const identity = createInvocationIdentity();\n const paths = resolveInvocationPaths({\n checkArtifactBaseDirectory: input.controls.checkArtifactBaseDirectory,\n checkIds: input.normalized.checks.map((check) => check.definition.checkId),\n diagnosticLogFileNaming: input.controls.diagnosticLogFileNaming ?? \"unique\",\n diagnosticLogSuffix: diagnosticLoggingEnabled\n ? diagnosticLogSuffix(requireStartedAtUtc(startedAtUtc), identity.uuid)\n : undefined,\n outputConfiguration,\n progressLogFile: input.controls.progressLogFile,\n projectRoot: input.controls.projectRoot ?? process.cwd()\n });\n const outputs = createOutputStatuses(\n outputConfiguration,\n paths.diagnosticLoggingReadbackFiles,\n input.normalized.scheduler.terminalEffects.length > 0\n );\n const diagnosticLogging = createDiagnosticLoggingRouter({\n clock,\n coreFile: paths.diagnosticLoggingFiles.core,\n factory: input.dependencies.diagnosticLoggerFactory ?? createDiagnosticLogger,\n invocationId: identity.id,\n schedulerFile: paths.diagnosticLoggingFiles.scheduler\n });\n\n return Object.freeze({\n admissionStrategyProviderFactory: input.dependencies.admissionStrategyProviderFactory,\n clock,\n controls: input.controls,\n declarativeFingerprint: createDeclarativeFingerprint(input.normalized.declarative),\n definition: input.definition,\n definitionWarnings: Object.freeze([...input.definitionWarnings]),\n diagnosticLogging,\n diagnosticLoggingEnabled,\n outputConfiguration,\n outputs,\n invocationId: identity.id,\n paths,\n normalized: input.normalized,\n progressRendering: createProgressRendering(outputConfiguration.progressRendering, outputs, {\n clock,\n ...(input.dependencies.progressRefreshScheduler === undefined\n ? {}\n : { refreshScheduler: input.dependencies.progressRefreshScheduler }),\n ...(input.dependencies.progressWriterFactory === undefined\n ? {}\n : { writerFactory: input.dependencies.progressWriterFactory }),\n file: paths.progressLogFile\n }),\n startedAtUtc\n });\n}\n\nfunction captureOutputCreationTimestamp(\n outputConfiguration: ResolvedProjectOutputs,\n dependencies: RunInvocationDependencies\n): string | null {\n if (\n !outputConfiguration.diagnosticLogging.enabled &&\n !outputConfiguration.machinePublication.enabled\n )\n return null;\n return (dependencies.wallClock?.now() ?? new Date()).toISOString();\n}\n\nfunction createInvocationIdentity(): Readonly<{\n readonly id: string;\n readonly uuid: string;\n}> {\n const uuid = randomUUID();\n return Object.freeze({ id: `invocation/v1:${uuid}`, uuid });\n}\n\nfunction diagnosticLogSuffix(startedAtUtc: string, invocationUuid: string): string {\n const compactUtc = startedAtUtc.replaceAll(\"-\", \"\").replaceAll(\":\", \"\");\n return `${compactUtc}-${invocationUuid}`;\n}\n\nfunction requireStartedAtUtc(startedAtUtc: string | null): string {\n if (startedAtUtc === null) throw new Error(\"Enabled output requires an invocation timestamp\");\n return startedAtUtc;\n}\n"]}
@@ -0,0 +1,98 @@
1
+ import { createAdmissionStrategyProvider } from "../admission-strategy-provider/provider.mjs";
2
+ import { AdmissionStrategyPreparationFailure } from "../admission-strategy-provider/custom-strategy-preparation.mjs";
3
+ import { prepareTaskGraph } from "../task-scheduler/graph.mjs";
4
+ import { planStaticCheckGraph } from "../check-execution/plan.mjs";
5
+ import { prepareProjectChanges } from "../changes/git.mjs";
6
+ import { createProjectContext } from "../project-context.mjs";
7
+ import { isCancelled } from "../result.mjs";
8
+ import { mapResolvedExecutionToRunCandidate } from "./candidate.mjs";
9
+ import { cancelledBeforeExecution, executionResult } from "./candidates.mjs";
10
+ import { executeScheduler } from "./scheduler.mjs";
11
+ const EMPTY_EFFECTIVE_FLAGS = Object.freeze([]);
12
+ /** Executes the post-validation invocation phases, from change preparation through Scheduler completion. */
13
+ export async function executePlannedInvocation(invocation, aggregation) {
14
+ if (isCancelled(invocation.controls))
15
+ return cancelledBeforeExecution(invocation, "pre-work");
16
+ const preparedChanges = invocation.normalized.changes === undefined
17
+ ? undefined
18
+ : prepareProjectChanges({
19
+ callerFlags: invocation.controls.flags ?? [],
20
+ changes: invocation.normalized.changes,
21
+ projectRoot: invocation.paths.projectRoot
22
+ });
23
+ const effectiveFlags = preparedChanges?.effectiveFlags ?? invocation.controls.flags ?? EMPTY_EFFECTIVE_FLAGS;
24
+ return executePreparedInvocation(invocation, aggregation, createProjectContext({
25
+ ...(preparedChanges === undefined ? {} : { changes: preparedChanges.projectChanges }),
26
+ flags: effectiveFlags,
27
+ paths: invocation.paths
28
+ }));
29
+ }
30
+ async function executePreparedInvocation(invocation, aggregation, project) {
31
+ if (isCancelled(invocation.controls))
32
+ return cancelledBeforeExecution(invocation, "planning");
33
+ let preparedStrategy;
34
+ try {
35
+ preparedStrategy = await prepareAdmissionStrategy(invocation);
36
+ }
37
+ catch (error) {
38
+ if (error instanceof AdmissionStrategyPreparationFailure) {
39
+ return executionResult(invocation, "admission-strategy-preparation-failed");
40
+ }
41
+ throw error;
42
+ }
43
+ if (preparedStrategy.completion.kind === "terminal-effect") {
44
+ invocation.outputs.enableTerminalEffects();
45
+ }
46
+ invocation.progressRendering.prepared(invocation.normalized.checks.length, invocation.normalized.checks.filter((check) => check.omitQuietPassedRow).length);
47
+ const executionStartedAt = invocation.clock.now();
48
+ const executed = await executeScheduler({ invocation, preparedStrategy, project });
49
+ if (isExecutionRunResult(executed))
50
+ return executed;
51
+ await completeAdmissionStrategyAfterTerminalMeasurement(preparedStrategy, executed, invocation.outputs);
52
+ return mapResolvedExecutionToRunCandidate({
53
+ aggregation,
54
+ executed,
55
+ executionStartedAt,
56
+ invocation
57
+ });
58
+ }
59
+ /** Composes one invocation-local strategy only after the static Task graph is valid. */
60
+ async function prepareAdmissionStrategy(invocation) {
61
+ const graph = prepareTaskGraph(planStaticCheckGraph(invocation.normalized.checks, invocation.normalized.declarative.scheduler.resourceCapacities), invocation.normalized.declarative.scheduler.maxParallel);
62
+ const admissionStrategyProviderFactory = invocation.admissionStrategyProviderFactory ?? createAdmissionStrategyProvider;
63
+ const provider = admissionStrategyProviderFactory({
64
+ admissionPolicy: invocation.normalized.scheduler.admissionPolicy,
65
+ graph: graph.schedulerGraphSnapshot
66
+ });
67
+ return provider.prepare();
68
+ }
69
+ /** The prepared provider closes only after Scheduler terminal measurement and Hooks have settled. */
70
+ async function completeAdmissionStrategyAfterTerminalMeasurement(preparedStrategy, executed, outputs) {
71
+ const terminalMeasurement = executed.terminalSchedulerMeasurement;
72
+ if (terminalMeasurement === undefined)
73
+ return;
74
+ switch (preparedStrategy.completion.kind) {
75
+ case "none":
76
+ return;
77
+ case "internal":
78
+ try {
79
+ await preparedStrategy.completion.complete(Object.freeze({ terminalMeasurement }));
80
+ }
81
+ catch {
82
+ // Private learned lifecycle cannot revise sealed execution or public output facts.
83
+ }
84
+ return;
85
+ case "terminal-effect":
86
+ try {
87
+ await preparedStrategy.completion.terminalEffect(terminalMeasurement);
88
+ outputs.succeeded("terminalEffects");
89
+ }
90
+ catch {
91
+ outputs.failed("terminalEffects");
92
+ }
93
+ }
94
+ }
95
+ function isExecutionRunResult(value) {
96
+ return "declarativeFingerprint" in value;
97
+ }
98
+ //# sourceMappingURL=execution.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution.mjs","sourceRoot":"","sources":["../../../../src/project-run/invocation/execution.ts"],"names":[],"mappings":"AAEA,OAAO,EAA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ACrF,CAAC;YAAC,MAAM,CAAC;gBACP,mFAAmF;YACrF,CAAC;YACD,OAAO;QACT,KAAK,iBAAiB;YACpB,IAAI,CAAC;gBACH,MAAM,gBAAgB,CAAC,UAAU,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;gBACtE,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;YACvC,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;YACpC,CAAC;IACL,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAC3B,KAAyB;IAEzB,OAAO,wBAAwB,IAAI,KAAK,CAAC;AAC3C,CAAC","sourcesContent":["import type { CheckProjectContext } from \"../../check/check.ts\";\nimport type { CheckAggregation } from \"../controls/contract.ts\";\nimport { createAdmissionStrategyProvider } from \"../admission-strategy-provider/provider.ts\";\nimport { AdmissionStrategyPreparationFailure } from \"../admission-strategy-provider/custom-strategy-preparation.ts\";\nimport type { PreparedAdmissionStrategy } from \"../admission-strategy-provider/prepared-admission-strategy.ts\";\nimport { prepareTaskGraph } from \"../task-scheduler/graph.ts\";\nimport type { ResolvedCheckExecution } from \"../check-execution/resolved-execution-result.ts\";\nimport { planStaticCheckGraph } from \"../check-execution/plan.ts\";\nimport { prepareProjectChanges } from \"../changes/git.ts\";\nimport { createProjectContext } from \"../project-context.ts\";\nimport type { OutputStatuses } from \"../outputs/status.ts\";\nimport { isCancelled, type NonConfigurationRunResult } from \"../result.ts\";\nimport { mapResolvedExecutionToRunCandidate } from \"./candidate.ts\";\nimport { cancelledBeforeExecution, executionResult } from \"./candidates.ts\";\nimport type { Invocation } from \"./run.ts\";\nimport { executeScheduler, type SchedulerExecution } from \"./scheduler.ts\";\n\nconst EMPTY_EFFECTIVE_FLAGS: readonly string[] = Object.freeze([]);\n\n/** Executes the post-validation invocation phases, from change preparation through Scheduler completion. */\nexport async function executePlannedInvocation(\n invocation: Invocation,\n aggregation: CheckAggregation | undefined\n): Promise<NonConfigurationRunResult> {\n if (isCancelled(invocation.controls)) return cancelledBeforeExecution(invocation, \"pre-work\");\n const preparedChanges =\n invocation.normalized.changes === undefined\n ? undefined\n : prepareProjectChanges({\n callerFlags: invocation.controls.flags ?? [],\n changes: invocation.normalized.changes,\n projectRoot: invocation.paths.projectRoot\n });\n const effectiveFlags =\n preparedChanges?.effectiveFlags ?? invocation.controls.flags ?? EMPTY_EFFECTIVE_FLAGS;\n return executePreparedInvocation(\n invocation,\n aggregation,\n createProjectContext({\n ...(preparedChanges === undefined ? {} : { changes: preparedChanges.projectChanges }),\n flags: effectiveFlags,\n paths: invocation.paths\n })\n );\n}\nasync function executePreparedInvocation(\n invocation: Invocation,\n aggregation: CheckAggregation | undefined,\n project: CheckProjectContext\n): Promise<NonConfigurationRunResult> {\n if (isCancelled(invocation.controls)) return cancelledBeforeExecution(invocation, \"planning\");\n let preparedStrategy: PreparedAdmissionStrategy;\n try {\n preparedStrategy = await prepareAdmissionStrategy(invocation);\n } catch (error) {\n if (error instanceof AdmissionStrategyPreparationFailure) {\n return executionResult(invocation, \"admission-strategy-preparation-failed\");\n }\n throw error;\n }\n if (preparedStrategy.completion.kind === \"terminal-effect\") {\n invocation.outputs.enableTerminalEffects();\n }\n invocation.progressRendering.prepared(\n invocation.normalized.checks.length,\n invocation.normalized.checks.filter((check) => check.omitQuietPassedRow).length\n );\n const executionStartedAt = invocation.clock.now();\n const executed = await executeScheduler({ invocation, preparedStrategy, project });\n if (isExecutionRunResult(executed)) return executed;\n await completeAdmissionStrategyAfterTerminalMeasurement(\n preparedStrategy,\n executed,\n invocation.outputs\n );\n return mapResolvedExecutionToRunCandidate({\n aggregation,\n executed,\n executionStartedAt,\n invocation\n });\n}\n\n/** Composes one invocation-local strategy only after the static Task graph is valid. */\nasync function prepareAdmissionStrategy(\n invocation: Invocation\n): Promise<PreparedAdmissionStrategy> {\n const graph = prepareTaskGraph(\n planStaticCheckGraph(\n invocation.normalized.checks,\n invocation.normalized.declarative.scheduler.resourceCapacities\n ),\n invocation.normalized.declarative.scheduler.maxParallel\n );\n const admissionStrategyProviderFactory =\n invocation.admissionStrategyProviderFactory ?? createAdmissionStrategyProvider;\n const provider = admissionStrategyProviderFactory({\n admissionPolicy: invocation.normalized.scheduler.admissionPolicy,\n graph: graph.schedulerGraphSnapshot\n });\n return provider.prepare();\n}\n\n/** The prepared provider closes only after Scheduler terminal measurement and Hooks have settled. */\nasync function completeAdmissionStrategyAfterTerminalMeasurement(\n preparedStrategy: PreparedAdmissionStrategy,\n executed: ResolvedCheckExecution,\n outputs: OutputStatuses\n): Promise<void> {\n const terminalMeasurement = executed.terminalSchedulerMeasurement;\n if (terminalMeasurement === undefined) return;\n switch (preparedStrategy.completion.kind) {\n case \"none\":\n return;\n case \"internal\":\n try {\n await preparedStrategy.completion.complete(Object.freeze({ terminalMeasurement }));\n } catch {\n // Private learned lifecycle cannot revise sealed execution or public output facts.\n }\n return;\n case \"terminal-effect\":\n try {\n await preparedStrategy.completion.terminalEffect(terminalMeasurement);\n outputs.succeeded(\"terminalEffects\");\n } catch {\n outputs.failed(\"terminalEffects\");\n }\n }\n}\n\nfunction isExecutionRunResult(\n value: SchedulerExecution\n): value is Extract<NonConfigurationRunResult, { readonly kind: \"execution\" }> {\n return \"declarativeFingerprint\" in value;\n}\n"]}
@@ -1,27 +1,17 @@
1
1
  import { normalizeProjectDefinition } from "../../project-definition/project-definition.mjs";
2
- import { createAdmissionStrategyProvider } from "../admission-strategy-provider/provider.mjs";
3
- import { AdmissionStrategyPreparationFailure } from "../admission-strategy-provider/custom-strategy-preparation.mjs";
4
2
  import { prepareTaskGraph } from "../task-scheduler/graph.mjs";
5
- import { validateCheckAggregationSelection } from "../aggregation.mjs";
3
+ import { CheckAggregationFailure } from "../aggregation.mjs";
6
4
  import {} from "../check-execution/resolved-checks.mjs";
7
5
  import { planStaticCheckGraph } from "../check-execution/plan.mjs";
8
6
  import {} from "../progress-rendering/presentation.mjs";
9
- import { finalizeInvocation } from "../completion/completion.mjs";
10
- import { createProjectContext } from "../project-context.mjs";
11
- import { isCancelled, planning, preExecutionCancellation } from "../result.mjs";
7
+ import { closeAggregationFailure, finalizeInvocation } from "../completion/completion.mjs";
8
+ import { isCancelled } from "../result.mjs";
12
9
  import { diagnosticTags, summarizeDiagnosticValue } from "../diagnostic-logging/logger.mjs";
13
10
  import { createInvocation } from "./creation.mjs";
14
- import { executeScheduler } from "./scheduler.mjs";
15
- import { mapResolvedExecutionToRunCandidate } from "./candidate.mjs";
11
+ import { cancelledBeforeExecution, executionResult, planningResult } from "./candidates.mjs";
12
+ import { executePlannedInvocation } from "./execution.mjs";
16
13
  export async function executeValidatedRun(definition, controls, definitionWarnings, dependencies = {}) {
17
14
  const normalized = normalizeProjectDefinition(definition);
18
- const aggregation = validateCheckAggregationSelection(controls.checkAggregation, normalized.checks.map((check) => check.definition.checkId));
19
- if (!aggregation.ok)
20
- return Object.freeze({
21
- kind: "configuration",
22
- definitionWarnings: Object.freeze([...definitionWarnings]),
23
- diagnostic: aggregation.error
24
- });
25
15
  const invocation = createInvocation({
26
16
  controls,
27
17
  definition,
@@ -31,7 +21,7 @@ export async function executeValidatedRun(definition, controls, definitionWarnin
31
21
  });
32
22
  let candidate;
33
23
  try {
34
- observeInvocationStarted(invocation, aggregation.value);
24
+ observeInvocationStarted(invocation, controls.checkAggregation);
35
25
  if (isCancelled(controls)) {
36
26
  candidate = cancelledBeforeExecution(invocation, "pre-work");
37
27
  }
@@ -39,10 +29,14 @@ export async function executeValidatedRun(definition, controls, definitionWarnin
39
29
  candidate = planningResult(invocation, "task-graph-invalid");
40
30
  }
41
31
  else {
42
- candidate = await executePlannedInvocation(invocation, aggregation.value);
32
+ candidate = await executePlannedInvocation(invocation, controls.checkAggregation);
43
33
  }
44
34
  }
45
- catch {
35
+ catch (error) {
36
+ if (error instanceof CheckAggregationFailure) {
37
+ closeAggregationFailure(invocation);
38
+ throw error.originalError;
39
+ }
46
40
  candidate = executionResult(invocation, "task-engine-failed");
47
41
  }
48
42
  return finalizeInvocation(invocation, candidate);
@@ -52,7 +46,7 @@ function observeInvocationStarted(invocation, aggregation) {
52
46
  event: "run.started",
53
47
  tags: diagnosticTags("RUN", "STARTED"),
54
48
  details: {
55
- aggregation: aggregation ?? null,
49
+ aggregation: aggregation === undefined ? "default" : "custom",
56
50
  checkCount: invocation.normalized.checks.length,
57
51
  flags: summarizeDiagnosticValue(invocation.controls.flags ?? []),
58
52
  outputs: invocation.outputConfiguration,
@@ -85,97 +79,4 @@ function validateTaskGraph(invocation) {
85
79
  return false;
86
80
  }
87
81
  }
88
- async function executePlannedInvocation(invocation, aggregation) {
89
- if (isCancelled(invocation.controls))
90
- return cancelledBeforeExecution(invocation, "pre-work");
91
- return executePreparedInvocation(invocation, aggregation, createProjectContext({ controls: invocation.controls, paths: invocation.paths }));
92
- }
93
- async function executePreparedInvocation(invocation, aggregation, project) {
94
- if (isCancelled(invocation.controls))
95
- return cancelledBeforeExecution(invocation, "planning");
96
- let preparedStrategy;
97
- try {
98
- preparedStrategy = await prepareAdmissionStrategy(invocation);
99
- }
100
- catch (error) {
101
- if (error instanceof AdmissionStrategyPreparationFailure) {
102
- return executionResult(invocation, "admission-strategy-preparation-failed");
103
- }
104
- throw error;
105
- }
106
- if (preparedStrategy.completion.kind === "measurement-hook") {
107
- invocation.outputs.enableMeasurementHooks();
108
- }
109
- invocation.progressRendering.prepared(invocation.normalized.checks.length);
110
- const executionStartedAt = invocation.clock.now();
111
- const executed = await executeScheduler({ invocation, preparedStrategy, project });
112
- if (isExecutionRunResult(executed))
113
- return executed;
114
- await completeAdmissionStrategyAfterTerminalMeasurement(preparedStrategy, executed, invocation.outputs);
115
- return mapResolvedExecutionToRunCandidate({
116
- aggregation,
117
- executed,
118
- executionStartedAt,
119
- invocation
120
- });
121
- }
122
- /** Composes one invocation-local strategy only after the static Task graph is valid. */
123
- async function prepareAdmissionStrategy(invocation) {
124
- const graph = prepareTaskGraph(planStaticCheckGraph(invocation.normalized.checks, invocation.normalized.declarative.scheduler.resourceCapacities), invocation.normalized.declarative.scheduler.maxParallel);
125
- const admissionStrategyProviderFactory = invocation.admissionStrategyProviderFactory ?? createAdmissionStrategyProvider;
126
- const provider = admissionStrategyProviderFactory({
127
- admissionPolicy: invocation.normalized.scheduler.admissionPolicy,
128
- graph: graph.schedulerGraphSnapshot
129
- });
130
- return provider.prepare();
131
- }
132
- /** The prepared provider closes only after Scheduler terminal measurement and Hooks have settled. */
133
- async function completeAdmissionStrategyAfterTerminalMeasurement(preparedStrategy, executed, outputs) {
134
- const terminalMeasurement = executed.terminalSchedulerMeasurement;
135
- if (terminalMeasurement === undefined)
136
- return;
137
- switch (preparedStrategy.completion.kind) {
138
- case "none":
139
- return;
140
- case "internal":
141
- try {
142
- await preparedStrategy.completion.complete(Object.freeze({ terminalMeasurement }));
143
- }
144
- catch {
145
- // Private learned lifecycle cannot revise sealed execution or public output facts.
146
- }
147
- return;
148
- case "measurement-hook":
149
- try {
150
- await preparedStrategy.completion.complete(terminalMeasurement);
151
- outputs.succeeded("measurementHooks");
152
- }
153
- catch {
154
- outputs.failed("measurementHooks");
155
- }
156
- }
157
- }
158
- function cancelledBeforeExecution(invocation, phase) {
159
- invocation.diagnosticLogging.core.observe({
160
- event: "run.cancelled",
161
- tags: diagnosticTags("RUN", "CANCELLED"),
162
- details: { phase }
163
- });
164
- return preExecutionCancellation(invocation.declarativeFingerprint, invocation.definitionWarnings, invocation.outputs.value(), phase);
165
- }
166
- function planningResult(invocation, code) {
167
- return planning(invocation.declarativeFingerprint, invocation.definitionWarnings, invocation.outputs.value(), code);
168
- }
169
- function executionResult(invocation, code) {
170
- return Object.freeze({
171
- kind: "execution",
172
- declarativeFingerprint: invocation.declarativeFingerprint,
173
- definitionWarnings: invocation.definitionWarnings,
174
- diagnostic: Object.freeze({ code }),
175
- outputs: invocation.outputs.value()
176
- });
177
- }
178
- function isExecutionRunResult(value) {
179
- return "declarativeFingerprint" in value;
180
- }
181
82
  //# sourceMapp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,OAAO,CAAC,KAAK,EAAE;KACpC,CAAC,CAAC;AACL,CAAC;AACD,SAAS,oBAAoB,CAC3B,KAAyB;IAEzB,OAAO,wBAAwB,IAAI,KAAK,CAAC;AAC3C,CAAC","sourcesContent":["import type { CheckProjectContext } from \"../../check/check.ts\";\nimport {\n normalizeProjectDefinition,\n type DefinitionWarning,\n type NormalizedProjectDefinition,\n type ProjectDefinition,\n type ResolvedProjectOutputs\n} from \"../../project-definition/project-definition.ts\";\nimport type { CheckAggregation, RunControls } from \"../controls/contract.ts\";\nimport {\n createAdmissionStrategyProvider,\n type AdmissionStrategyProviderFactory\n} from \"../admission-strategy-provider/provider.ts\";\nimport { AdmissionStrategyPreparationFailure } from \"../admission-strategy-provider/custom-strategy-preparation.ts\";\nimport type { PreparedAdmissionStrategy } from \"../admission-strategy-provider/prepared-admission-strategy.ts\";\nimport { prepareTaskGraph } from \"../task-scheduler/graph.ts\";\nimport { validateCheckAggregationSelection } from \"../aggregation.ts\";\nimport { type CheckExecutionClock } from \"../check-execution/resolved-checks.ts\";\nimport type { ResolvedCheckExecution } from \"../check-execution/resolved-execution-result.ts\";\nimport { planStaticCheckGraph } from \"../check-execution/plan.ts\";\nimport {\n type ProgressRefreshScheduler,\n type ProgressRendering,\n type ProgressWriterFactory\n} from \"../progress-rendering/presentation.ts\";\nimport { finalizeInvocation } from \"../completion/completion.ts\";\nimport { createProjectContext } from \"../project-context.ts\";\nimport type { ResolvedInvocationPaths } from \"./paths.ts\";\nimport {\n isCancelled,\n planning,\n preExecutionCancellation,\n type NonConfigurationRunResult,\n type RunDiagnostic,\n type RunResult\n} from \"../result.ts\";\nimport {\n diagnosticTags,\n summarizeDiagnosticValue,\n type DiagnosticLoggerFactory,\n type DiagnosticLoggingRouter\n} from \"../diagnostic-logging/logger.ts\";\nimport { createInvocation } from \"./creation.ts\";\nimport type { OutputStatuses } from \"../outputs/status.ts\";\nimport { executeScheduler, type SchedulerExecution } from \"./scheduler.ts\";\nimport { mapResolvedExecutionToRunCandidate } from \"./candidate.ts\";\nexport type Invocation = Readonly<{\n /** Product-private test seam; package `run` never accepts a provider factory. */\n readonly admissionStrategyProviderFactory: AdmissionStrategyProviderFactory | undefined;\n readonly clock: CheckExecutionClock;\n readonly controls: RunControls;\n readonly declarativeFingerprint: string;\n readonly definition: ProjectDefinition;\n readonly definitionWarnings: readonly DefinitionWarning[];\n readonly diagnosticLogging: DiagnosticLoggingRouter;\n /** Effective output selection, retained privately for enabled-only Scheduler diagnostics. */\n readonly diagnosticLoggingEnabled: boolean;\n readonly outputConfiguration: ResolvedProjectOutputs;\n readonly outputs: OutputStatuses;\n readonly invocationId: string;\n readonly normalized: NormalizedProjectDefinition;\n /** 本次 invocation 冻结的 Product-private output 与 Check artifact paths。 */\n readonly paths: ResolvedInvocationPaths;\n readonly progressRendering: ProgressRendering;\n /** Immutable UTC instant captured for enabled diagnostic or machine output, otherwise `null`. */\n readonly startedAtUtc: string | null;\n}>;\nexport interface RunInvocationDependencies {\n /** Product-private test seam for proving invocation lifecycle sequencing. */\n readonly admissionStrategyProviderFactory?: AdmissionStrategyProviderFactory;\n readonly clock?: CheckExecutionClock;\n readonly progressRefreshScheduler?: ProgressRefreshScheduler;\n readonly progressWriterFactory?: ProgressWriterFactory;\n readonly diagnosticLoggerFactory?: DiagnosticLoggerFactory;\n /** Test seam for the invocation's machine-readable wall-clock timestamp. */\n readonly wallClock?: Readonly<{ now(): Date }>;\n}\n\nexport async function executeValidatedRun(\n definition: ProjectDefinition,\n controls: RunControls,\n definitionWarnings: readonly DefinitionWarning[],\n dependencies: RunInvocationDependencies = {}\n): Promise<RunResult> {\n const normalized = normalizeProjectDefinition(definition);\n const aggregation = validateCheckAggregationSelection(\n controls.checkAggregation,\n normalized.checks.map((check) => check.definition.checkId)\n );\n if (!aggregation.ok)\n return Object.freeze({\n kind: \"configuration\",\n definitionWarnings: Object.freeze([...definitionWarnings]),\n diagnostic: aggregation.error\n });\n\n const invocation = createInvocation({\n controls,\n definition,\n definitionWarnings,\n dependencies,\n normalized\n });\n let candidate: NonConfigurationRunResult;\n try {\n observeInvocationStarted(invocation, aggregation.value);\n if (isCancelled(controls)) {\n candidate = cancelledBeforeExecution(invocation, \"pre-work\");\n } else if (!validateTaskGraph(invocation)) {\n candidate = planningResult(invocation, \"task-graph-invalid\");\n } else {\n candidate = await executePlannedInvocation(invocation, aggregation.value);\n }\n } catch {\n candidate = executionResult(invocation, \"task-engine-failed\");\n }\n return finalizeInvocation(invocation, candidate);\n}\n\nfunction observeInvocationStarted(\n invocation: Invocation,\n aggregation: CheckAggregation | undefined\n): void {\n invocation.diagnosticLogging.core.observe({\n event: \"run.started\",\n tags: diagnosticTags(\"RUN\", \"STARTED\"),\n details: {\n aggregation: aggregation ?? null,\n checkCount: invocation.normalized.checks.length,\n flags: summarizeDiagnosticValue(invocation.controls.flags ?? []),\n outputs: invocation.outputConfiguration,\n scheduler: invocation.normalized.declarative.scheduler\n }\n });\n}\n\nfunction validateTaskGraph(invocation: Invocation): boolean {\n try {\n prepareTaskGraph(\n planStaticCheckGraph(\n invocation.normalized.checks,\n invocation.normalized.declarative.scheduler.resourceCapacities\n ),\n invocation.normalized.declarative.scheduler.maxParallel\n );\n invocation.diagnosticLogging.core.observe({\n event: \"run.planning.succeeded\",\n tags: diagnosticTags(\"RUN\", \"PLANNING\", \"SUCCEEDED\"),\n details: {\n checkCount: invocation.normalized.checks.length,\n maxParallel: invocation.normalized.declarative.scheduler.maxParallel\n }\n });\n return true;\n } catch {\n invocation.diagnosticLogging.core.observe({\n event: \"run.planning.failed\",\n tags: diagnosticTags(\"RUN\", \"PLANNING\", \"FAILED\"),\n details: {\n checkCount: invocation.normalized.checks.length,\n maxParallel: invocation.normalized.declarative.scheduler.maxParallel\n }\n });\n return false;\n }\n}\nasync function executePlannedInvocation(\n invocation: Invocation,\n aggregation: CheckAggregation | undefined\n): Promise<NonConfigurationRunResult> {\n if (isCancelled(invocation.controls)) return cancelledBeforeExecution(invocation, \"pre-work\");\n return executePreparedInvocation(\n invocation,\n aggregation,\n createProjectContext({ controls: invocation.controls, paths: invocation.paths })\n );\n}\nasync function executePreparedInvocation(\n invocation: Invocation,\n aggregation: CheckAggregation | undefined,\n project: CheckProjectContext\n): Promise<NonConfigurationRunResult> {\n if (isCancelled(invocation.controls)) return cancelledBeforeExecution(invocation, \"planning\");\n let preparedStrategy: PreparedAdmissionStrategy;\n try {\n preparedStrategy = await prepareAdmissionStrategy(invocation);\n } catch (error) {\n if (error instanceof AdmissionStrategyPreparationFailure) {\n return executionResult(invocation, \"admission-strategy-preparation-failed\");\n }\n throw error;\n }\n if (preparedStrategy.completion.kind === \"measurement-hook\") {\n invocation.outputs.enableMeasurementHooks();\n }\n invocation.progressRendering.prepared(invocation.normalized.checks.length);\n const executionStartedAt = invocation.clock.now();\n const executed = await executeScheduler({ invocation, preparedStrategy, project });\n if (isExecutionRunResult(executed)) return executed;\n await completeAdmissionStrategyAfterTerminalMeasurement(\n preparedStrategy,\n executed,\n invocation.outputs\n );\n return mapResolvedExecutionToRunCandidate({\n aggregation,\n executed,\n executionStartedAt,\n invocation\n });\n}\n\n/** Composes one invocation-local strategy only after the static Task graph is valid. */\nasync function prepareAdmissionStrategy(\n invocation: Invocation\n): Promise<PreparedAdmissionStrategy> {\n const graph = prepareTaskGraph(\n planStaticCheckGraph(\n invocation.normalized.checks,\n invocation.normalized.declarative.scheduler.resourceCapacities\n ),\n invocation.normalized.declarative.scheduler.maxParallel\n );\n const admissionStrategyProviderFactory =\n invocation.admissionStrategyProviderFactory ?? createAdmissionStrategyProvider;\n const provider = admissionStrategyProviderFactory({\n admissionPolicy: invocation.normalized.scheduler.admissionPolicy,\n graph: graph.schedulerGraphSnapshot\n });\n return provider.prepare();\n}\n\n/** The prepared provider closes only after Scheduler terminal measurement and Hooks have settled. */\nasync function completeAdmissionStrategyAfterTerminalMeasurement(\n preparedStrategy: PreparedAdmissionStrategy,\n executed: ResolvedCheckExecution,\n outputs: OutputStatuses\n): Promise<void> {\n const terminalMeasurement = executed.terminalSchedulerMeasurement;\n if (terminalMeasurement === undefined) return;\n switch (preparedStrategy.completion.kind) {\n case \"none\":\n return;\n case \"internal\":\n try {\n await preparedStrategy.completion.complete(Object.freeze({ terminalMeasurement }));\n } catch {\n // Private learned lifecycle cannot revise sealed execution or public output facts.\n }\n return;\n case \"measurement-hook\":\n try {\n await preparedStrategy.completion.complete(terminalMeasurement);\n outputs.succeeded(\"measurementHooks\");\n } catch {\n outputs.failed(\"measurementHooks\");\n }\n }\n}\n\nfunction cancelledBeforeExecution(\n invocation: Invocation,\n phase: \"pre-work\" | \"planning\"\n): NonConfigurationRunResult {\n invocation.diagnosticLogging.core.observe({\n event: \"run.cancelled\",\n tags: diagnosticTags(\"RUN\", \"CANCELLED\"),\n details: { phase }\n });\n return preExecutionCancellation(\n invocation.declarativeFingerprint,\n invocation.definitionWarnings,\n invocation.outputs.value(),\n phase\n );\n}\n\nfunction planningResult(\n invocation: Invocation,\n code: Extract<RunDiagnostic[\"code\"], \"task-graph-invalid\">\n): NonConfigurationRunResult {\n return planning(\n invocation.declarativeFingerprint,\n invocation.definitionWarnings,\n invocation.outputs.value(),\n code\n );\n}\nfunction executionResult(\n invocation: Invocation,\n code: Extract<\n RunDiagnostic[\"code\"],\n \"admission-strategy-preparation-failed\" | \"task-engine-failed\"\n >\n): NonConfigurationRunResult {\n return Object.freeze({\n kind: \"execution\",\n declarativeFingerprint: invocation.declarativeFingerprint,\n definitionWarnings: invocation.definitionWarnings,\n diagnostic: Object.freeze({ code }),\n outputs: invocation.outputs.value()\n });\n}\nfunction isExecutionRunResult(\n value: SchedulerExecution\n): value is Extract<NonConfigurationRunResult, { readonly kind: \"execution\" }> {\n return \"declarativeFingerprint\" in value;\n}\n"]}
1
+ {"version":3,"file":"run.mjs","sourceRoot":"","sources":["../../../../src/project-run/invocation/run.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAK3B,MAAM,gDAAgD,CAAC;AAGxD,OAAO,EAAE,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,CACxD,CAAC;QACF,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC;YACxC,KAAK,EAAE,wBAAwB;YAC/B,IAAI,EAAE,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,WAAW,CAAC;YACpD,OAAO,EAAE;gBACP,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM;gBAC/C,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,WAAW;aACrE;SACF,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC;YACxC,KAAK,EAAE,qBAAqB;YAC5B,IAAI,EAAE,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC;YACjD,OAAO,EAAE;gBACP,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM;gBAC/C,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,WAAW;aACrE;SACF,CAAC,CAAC;QACH,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC","sourcesContent":["import {\n normalizeProjectDefinition,\n type DefinitionWarning,\n type NormalizedProjectDefinition,\n type ProjectDefinition,\n type ResolvedProjectOutputs\n} from \"../../project-definition/project-definition.ts\";\nimport type { CheckAggregation, RunControls } from \"../controls/contract.ts\";\nimport type { AdmissionStrategyProviderFactory } from \"../admission-strategy-provider/provider.ts\";\nimport { prepareTaskGraph } from \"../task-scheduler/graph.ts\";\nimport { CheckAggregationFailure } from \"../aggregation.ts\";\nimport { type CheckExecutionClock } from \"../check-execution/resolved-checks.ts\";\nimport { planStaticCheckGraph } from \"../check-execution/plan.ts\";\nimport {\n type ProgressRefreshScheduler,\n type ProgressRendering,\n type ProgressWriterFactory\n} from \"../progress-rendering/presentation.ts\";\nimport { closeAggregationFailure, finalizeInvocation } from \"../completion/completion.ts\";\nimport type { ResolvedInvocationPaths } from \"./paths.ts\";\nimport type { OutputStatuses } from \"../outputs/status.ts\";\nimport { isCancelled, type NonConfigurationRunResult, type RunResult } from \"../result.ts\";\nimport {\n diagnosticTags,\n summarizeDiagnosticValue,\n type DiagnosticLoggerFactory,\n type DiagnosticLoggingRouter\n} from \"../diagnostic-logging/logger.ts\";\nimport { createInvocation } from \"./creation.ts\";\nimport { cancelledBeforeExecution, executionResult, planningResult } from \"./candidates.ts\";\nimport { executePlannedInvocation } from \"./execution.ts\";\nexport type Invocation = Readonly<{\n /** Product-private test seam; package `run` never accepts a provider factory. */\n readonly admissionStrategyProviderFactory: AdmissionStrategyProviderFactory | undefined;\n readonly clock: CheckExecutionClock;\n readonly controls: RunControls;\n readonly declarativeFingerprint: string;\n readonly definition: ProjectDefinition;\n readonly definitionWarnings: readonly DefinitionWarning[];\n readonly diagnosticLogging: DiagnosticLoggingRouter;\n /** Effective output selection, retained privately for enabled-only Scheduler diagnostics. */\n readonly diagnosticLoggingEnabled: boolean;\n readonly outputConfiguration: ResolvedProjectOutputs;\n readonly outputs: OutputStatuses;\n readonly invocationId: string;\n readonly normalized: NormalizedProjectDefinition;\n /** 本次 invocation 冻结的 Product-private output 与 Check artifact paths。 */\n readonly paths: ResolvedInvocationPaths;\n readonly progressRendering: ProgressRendering;\n /** Immutable UTC instant captured for enabled diagnostic or machine output, otherwise `null`. */\n readonly startedAtUtc: string | null;\n}>;\nexport interface RunInvocationDependencies {\n /** Product-private test seam for proving invocation lifecycle sequencing. */\n readonly admissionStrategyProviderFactory?: AdmissionStrategyProviderFactory;\n readonly clock?: CheckExecutionClock;\n readonly progressRefreshScheduler?: ProgressRefreshScheduler;\n readonly progressWriterFactory?: ProgressWriterFactory;\n readonly diagnosticLoggerFactory?: DiagnosticLoggerFactory;\n /** Test seam for the invocation's machine-readable wall-clock timestamp. */\n readonly wallClock?: Readonly<{ now(): Date }>;\n}\n\nexport async function executeValidatedRun(\n definition: ProjectDefinition,\n controls: RunControls,\n definitionWarnings: readonly DefinitionWarning[],\n dependencies: RunInvocationDependencies = {}\n): Promise<RunResult> {\n const normalized = normalizeProjectDefinition(definition);\n const invocation = createInvocation({\n controls,\n definition,\n definitionWarnings,\n dependencies,\n normalized\n });\n let candidate: NonConfigurationRunResult;\n try {\n observeInvocationStarted(invocation, controls.checkAggregation);\n if (isCancelled(controls)) {\n candidate = cancelledBeforeExecution(invocation, \"pre-work\");\n } else if (!validateTaskGraph(invocation)) {\n candidate = planningResult(invocation, \"task-graph-invalid\");\n } else {\n candidate = await executePlannedInvocation(invocation, controls.checkAggregation);\n }\n } catch (error) {\n if (error instanceof CheckAggregationFailure) {\n closeAggregationFailure(invocation);\n throw error.originalError;\n }\n candidate = executionResult(invocation, \"task-engine-failed\");\n }\n return finalizeInvocation(invocation, candidate);\n}\n\nfunction observeInvocationStarted(\n invocation: Invocation,\n aggregation: CheckAggregation | undefined\n): void {\n invocation.diagnosticLogging.core.observe({\n event: \"run.started\",\n tags: diagnosticTags(\"RUN\", \"STARTED\"),\n details: {\n aggregation: aggregation === undefined ? \"default\" : \"custom\",\n checkCount: invocation.normalized.checks.length,\n flags: summarizeDiagnosticValue(invocation.controls.flags ?? []),\n outputs: invocation.outputConfiguration,\n scheduler: invocation.normalized.declarative.scheduler\n }\n });\n}\n\nfunction validateTaskGraph(invocation: Invocation): boolean {\n try {\n prepareTaskGraph(\n planStaticCheckGraph(\n invocation.normalized.checks,\n invocation.normalized.declarative.scheduler.resourceCapacities\n ),\n invocation.normalized.declarative.scheduler.maxParallel\n );\n invocation.diagnosticLogging.core.observe({\n event: \"run.planning.succeeded\",\n tags: diagnosticTags(\"RUN\", \"PLANNING\", \"SUCCEEDED\"),\n details: {\n checkCount: invocation.normalized.checks.length,\n maxParallel: invocation.normalized.declarative.scheduler.maxParallel\n }\n });\n return true;\n } catch {\n invocation.diagnosticLogging.core.observe({\n event: \"run.planning.failed\",\n tags: diagnosticTags(\"RUN\", \"PLANNING\", \"FAILED\"),\n details: {\n checkCount: invocation.normalized.checks.length,\n maxParallel: invocation.normalized.declarative.scheduler.maxParallel\n }\n });\n return false;\n }\n}\n"]}
@@ -12,14 +12,21 @@ export async function executeScheduler(input) {
12
12
  ...(invocation.diagnosticLoggingEnabled
13
13
  ? { schedulerDiagnosticLogger: invocation.diagnosticLogging.scheduler }
14
14
  : {}),
15
- schedulerPerformanceDiagnostics: performanceDiagnostics,
16
- schedulerMeasurementHooks: invocation.normalized.scheduler.measurementHooks,
17
- onSchedulerMeasurementHookFailure: () => invocation.outputs.failed("measurementHooks"),
18
- onSchedulerMeasurementHooksSettled: () => invocation.outputs.succeeded("measurementHooks"),
15
+ ...(performanceDiagnostics === undefined
16
+ ? {}
17
+ : { schedulerPerformanceDiagnostics: performanceDiagnostics }),
18
+ schedulerTerminalEffects: invocation.normalized.scheduler.terminalEffects,
19
+ onSchedulerTerminalEffectFailure: () => {
20
+ invocation.outputs.failed("terminalEffects");
21
+ },
22
+ onSchedulerTerminalEffectsSettled: () => {
23
+ invocation.outputs.succeeded("terminalEffects");
24
+ },
19
25
  maxParallel: invocation.normalized.declarative.scheduler.maxParallel,
20
26
  resourceCapacities: invocation.normalized.declarative.scheduler.resourceCapacities,
21
27
  invocationId: invocation.invocationId,
22
- lifecycle: invocation.progressRendering.lifecycle,
28
+ checkLifecycle: invocation.progressRendering.checkLifecycle,
29
+ invocationLifecycle: invocation.progressRendering.invocationLifecycle,
23
30
  paths: invocation.paths,
24
31
  project: input.project,
25
32
  signal: invocation.controls.signal
@@ -32,7 +39,7 @@ export async function executeScheduler(input) {
32
39
  function schedulerPerformanceDiagnostics(input) {
33
40
  const { invocation, preparedStrategy } = input;
34
41
  const shouldCollectSchedulerPerformanceDiagnostics = invocation.diagnosticLoggingEnabled ||
35
- invocation.normalized.scheduler.measurementHooks.length > 0 ||
42
+ invocation.normalized.scheduler.terminalEffects.length > 0 ||
36
43
  preparedStrategy.admissionPolicy.requiresMeasurement === true ||
37
44
  preparedStrategy.requiresTerminalMeasurement;
38
45
  if (!shouldCollectSchedulerPerformanceDiagnostics)
@@ -1 +1 @@
1
- {"version":3,"file":"scheduler.mjs","sourceRoot":"","sources":["../../../../src/project-run/invocation/scheduler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAe9E,mGAAmG;AACnG,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,KAA4B;IACjE,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC;IAC/C,IAAI,CAAC;QACH,MAAM,sBAAsB,GAAG,+BAA+B,CAAC,KAAK,CAAC,CAAC;QACtE,OAAO,MAAM,qBAAqB,CAAC;YACjC,eAAe,EAAE,gBAAgB,CAAC,eAAe;YACjD,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,MAAM;YACpC,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,gBAAgB,EAAE,UAAU,CAAC,iBAAiB,CAAC,IAAI;YACnD,GAAG,CAAC,UAAU,CAAC,wBAAwB;gBACrC,CAAC,CAAC,EAAE,yBAAyB,EAAE,UAAU,CAAC,iBAAiB,CAAC,SAAS,EAAE;gBACvE,CAAC,CAAC,EAAE,CAAC;YACP,+BAA+B,EAAE,sBAAsB;YACvD,yBAAyB,EAAE,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,gBAAgB;YAC3E,iCAAiC,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC;YACtF,kCAAkC,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,kBAAkB,CAAC;YAC1F,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,WAAW;YACpE,kBAAkB,EAAE,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,kBAAkB;YAClF,YAAY,EAAE,UAAU,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,CAAC,KAAK,EAAE;KACpC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { CheckProjectContext } from \"../../check/check.ts\";\nimport type { PreparedAdmissionStrategy } from \"../admission-strategy-provider/prepared-admission-strategy.ts\";\nimport { executeResolvedChecks } from \"../check-execution/resolved-checks.ts\";\nimport type { ResolvedCheckExecution } from \"../check-execution/resolved-execution-result.ts\";\nimport type { Invocation } from \"./run.ts\";\nimport type { NonConfigurationRunResult } from \"../result.ts\";\n\nexport type SchedulerExecution =\n | ResolvedCheckExecution\n | Extract<NonConfigurationRunResult, { readonly kind: \"execution\" }>;\n\ntype SchedulerAdapterInput = Readonly<{\n readonly invocation: Invocation;\n readonly preparedStrategy: PreparedAdmissionStrategy;\n readonly project: CheckProjectContext;\n}>;\n\n/** Bridges one prepared invocation to resolved Check execution and contains task-engine faults. */\nexport async function executeScheduler(input: SchedulerAdapterInput): Promise<SchedulerExecution> {\n const { invocation, preparedStrategy } = input;\n try {\n const performanceDiagnostics = schedulerPerformanceDiagnostics(input);\n return await executeResolvedChecks({\n admissionPolicy: preparedStrategy.admissionPolicy,\n checks: invocation.normalized.checks,\n clock: invocation.clock,\n diagnosticLogger: invocation.diagnosticLogging.core,\n ...(invocation.diagnosticLoggingEnabled\n ? { schedulerDiagnosticLogger: invocation.diagnosticLogging.scheduler }\n : {}),\n schedulerPerformanceDiagnostics: performanceDiagnostics,\n schedulerMeasurementHooks: invocation.normalized.scheduler.measurementHooks,\n onSchedulerMeasurementHookFailure: () => invocation.outputs.failed(\"measurementHooks\"),\n onSchedulerMeasurementHooksSettled: () => invocation.outputs.succeeded(\"measurementHooks\"),\n maxParallel: invocation.normalized.declarative.scheduler.maxParallel,\n resourceCapacities: invocation.normalized.declarative.scheduler.resourceCapacities,\n invocationId: invocation.invocationId,\n lifecycle: invocation.progressRendering.lifecycle,\n paths: invocation.paths,\n project: input.project,\n signal: invocation.controls.signal\n });\n } catch {\n return taskEngineFailure(invocation);\n }\n}\n\nfunction schedulerPerformanceDiagnostics(input: SchedulerAdapterInput) {\n const { invocation, preparedStrategy } = input;\n const shouldCollectSchedulerPerformanceDiagnostics =\n invocation.diagnosticLoggingEnabled ||\n invocation.normalized.scheduler.measurementHooks.length > 0 ||\n preparedStrategy.admissionPolicy.requiresMeasurement === true ||\n preparedStrategy.requiresTerminalMeasurement;\n if (!shouldCollectSchedulerPerformanceDiagnostics) return undefined;\n return Object.freeze({\n clock: invocation.clock,\n declarativeFingerprint: invocation.declarativeFingerprint,\n ...(invocation.diagnosticLoggingEnabled\n ? { logger: invocation.diagnosticLogging.scheduler }\n : {})\n });\n}\n\nfunction taskEngineFailure(\n invocation: Invocation\n): Extract<NonConfigurationRunResult, { readonly kind: \"execution\" }> {\n return Object.freeze({\n kind: \"execution\",\n declarativeFingerprint: invocation.declarativeFingerprint,\n definitionWarnings: invocation.definitionWarnings,\n diagnostic: Object.freeze({ code: \"task-engine-failed\" }),\n outputs: invocation.outputs.value()\n });\n}\n"]}
1
+ {"version":3,"file":"scheduler.mjs","sourceRoot":"","sources":["../../../../src/project-run/invocation/scheduler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAe9E,mGAAmG;AACnG,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,KAA4B;IACjE,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC;IAC/C,IAAI,CAAC;QACH,MAAM,sBAAsB,GAAG,+BAA+B,CAAC,KAAK,CAAC,CAAC;QACtE,OAAO,MAAM,qBAAqB,CAAC;YACjC,eAAe,EAAE,gBAAgB,CAAC,eAAe;YACjD,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,MAAM;YACpC,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,gBAAgB,EAAE,UAAU,CAAC,iBAAiB,CAAC,IAAI;YACnD,GAAG,CAAC,UAAU,CAAC,wBAAwB;gBACrC,CAAC,CAAC,EAAE,yBAAyB,EAAE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AC,eAAe,CAAC,mBAAmB,KAAK,IAAI;QAC7D,gBAAgB,CAAC,2BAA2B,CAAC;IAC/C,IAAI,CAAC,4CAA4C;QAAE,OAAO,SAAS,CAAC;IACpE,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,sBAAsB,EAAE,UAAU,CAAC,sBAAsB;QACzD,GAAG,CAAC,UAAU,CAAC,wBAAwB;YACrC,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,iBAAiB,CAAC,SAAS,EAAE;YACpD,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,CAAC;AACL,CAAC;AAED,SAAS,iBAAiB,CACxB,UAAsB;IAEtB,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,WAAW;QACjB,sBAAsB,EAAE,UAAU,CAAC,sBAAsB;QACzD,kBAAkB,EAAE,UAAU,CAAC,kBAAkB;QACjD,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;QACzD,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE;KACpC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { CheckProjectContext } from \"../../check/check.ts\";\nimport type { PreparedAdmissionStrategy } from \"../admission-strategy-provider/prepared-admission-strategy.ts\";\nimport { executeResolvedChecks } from \"../check-execution/resolved-checks.ts\";\nimport type { ResolvedCheckExecution } from \"../check-execution/resolved-execution-result.ts\";\nimport type { Invocation } from \"./run.ts\";\nimport type { NonConfigurationRunResult } from \"../result.ts\";\n\nexport type SchedulerExecution =\n | ResolvedCheckExecution\n | Extract<NonConfigurationRunResult, { readonly kind: \"execution\" }>;\n\ntype SchedulerAdapterInput = Readonly<{\n readonly invocation: Invocation;\n readonly preparedStrategy: PreparedAdmissionStrategy;\n readonly project: CheckProjectContext;\n}>;\n\n/** Bridges one prepared invocation to resolved Check execution and contains task-engine faults. */\nexport async function executeScheduler(input: SchedulerAdapterInput): Promise<SchedulerExecution> {\n const { invocation, preparedStrategy } = input;\n try {\n const performanceDiagnostics = schedulerPerformanceDiagnostics(input);\n return await executeResolvedChecks({\n admissionPolicy: preparedStrategy.admissionPolicy,\n checks: invocation.normalized.checks,\n clock: invocation.clock,\n diagnosticLogger: invocation.diagnosticLogging.core,\n ...(invocation.diagnosticLoggingEnabled\n ? { schedulerDiagnosticLogger: invocation.diagnosticLogging.scheduler }\n : {}),\n ...(performanceDiagnostics === undefined\n ? {}\n : { schedulerPerformanceDiagnostics: performanceDiagnostics }),\n schedulerTerminalEffects: invocation.normalized.scheduler.terminalEffects,\n onSchedulerTerminalEffectFailure: () => {\n invocation.outputs.failed(\"terminalEffects\");\n },\n onSchedulerTerminalEffectsSettled: () => {\n invocation.outputs.succeeded(\"terminalEffects\");\n },\n maxParallel: invocation.normalized.declarative.scheduler.maxParallel,\n resourceCapacities: invocation.normalized.declarative.scheduler.resourceCapacities,\n invocationId: invocation.invocationId,\n checkLifecycle: invocation.progressRendering.checkLifecycle,\n invocationLifecycle: invocation.progressRendering.invocationLifecycle,\n paths: invocation.paths,\n project: input.project,\n signal: invocation.controls.signal\n });\n } catch {\n return taskEngineFailure(invocation);\n }\n}\n\nfunction schedulerPerformanceDiagnostics(input: SchedulerAdapterInput) {\n const { invocation, preparedStrategy } = input;\n const shouldCollectSchedulerPerformanceDiagnostics =\n invocation.diagnosticLoggingEnabled ||\n invocation.normalized.scheduler.terminalEffects.length > 0 ||\n preparedStrategy.admissionPolicy.requiresMeasurement === true ||\n preparedStrategy.requiresTerminalMeasurement;\n if (!shouldCollectSchedulerPerformanceDiagnostics) return undefined;\n return Object.freeze({\n clock: invocation.clock,\n declarativeFingerprint: invocation.declarativeFingerprint,\n ...(invocation.diagnosticLoggingEnabled\n ? { logger: invocation.diagnosticLogging.scheduler }\n : {})\n });\n}\n\nfunction taskEngineFailure(\n invocation: Invocation\n): Extract<NonConfigurationRunResult, { readonly kind: \"execution\" }> {\n return Object.freeze({\n kind: \"execution\",\n declarativeFingerprint: invocation.declarativeFingerprint,\n definitionWarnings: invocation.definitionWarnings,\n diagnostic: Object.freeze({ code: \"task-engine-failed\" }),\n outputs: invocation.outputs.value()\n });\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { DIAGNOSTIC_CHANNELS } from "../diagnostic-logging/logger.mjs";
2
- export function createOutputStatuses(configuration, diagnosticLoggingFiles, initialMeasurementHooksEnabled) {
3
- let measurementHooksEnabled = initialMeasurementHooksEnabled;
2
+ export function createOutputStatuses(configuration, diagnosticLoggingFiles, initialTerminalEffectsEnabled) {
3
+ let terminalEffectsEnabled = initialTerminalEffectsEnabled;
4
4
  const diagnosticChannelEnabled = Object.freeze({
5
5
  core: configuration.diagnosticLogging.enabled,
6
6
  scheduler: configuration.diagnosticLogging.enabled
@@ -9,13 +9,13 @@ export function createOutputStatuses(configuration, diagnosticLoggingFiles, init
9
9
  machinePublication: initialStatus(configuration.machinePublication.enabled),
10
10
  progressRendering: initialStatus(configuration.progressRendering.enabled),
11
11
  diagnosticLogging: initialStatus(configuration.diagnosticLogging.enabled),
12
- measurementHooks: initialStatus(measurementHooksEnabled)
12
+ terminalEffects: initialStatus(terminalEffectsEnabled)
13
13
  };
14
14
  const diagnosticChannelStatuses = {
15
15
  core: initialStatus(diagnosticChannelEnabled.core),
16
16
  scheduler: initialStatus(diagnosticChannelEnabled.scheduler)
17
17
  };
18
- const enabled = (output) => output === "measurementHooks" ? measurementHooksEnabled : configuration[output].enabled;
18
+ const enabled = (output) => output === "terminalEffects" ? terminalEffectsEnabled : configuration[output].enabled;
19
19
  const refreshDiagnosticAggregate = () => {
20
20
  const enabledStatuses = DIAGNOSTIC_CHANNELS.filter((channel) => diagnosticChannelEnabled[channel]).map((channel) => diagnosticChannelStatuses[channel]);
21
21
  if (enabledStatuses.includes("failed")) {
@@ -31,11 +31,11 @@ export function createOutputStatuses(configuration, diagnosticLoggingFiles, init
31
31
  : "not-run";
32
32
  };
33
33
  return Object.freeze({
34
- enableMeasurementHooks: () => {
35
- if (measurementHooksEnabled)
34
+ enableTerminalEffects: () => {
35
+ if (terminalEffectsEnabled)
36
36
  return;
37
- measurementHooksEnabled = true;
38
- statuses.measurementHooks = "not-run";
37
+ terminalEffectsEnabled = true;
38
+ statuses.terminalEffects = "not-run";
39
39
  },
40
40
  failedDiagnosticChannel: (channel) => {
41
41
  if (!diagnosticChannelEnabled[channel])
@@ -74,9 +74,9 @@ export function createOutputStatuses(configuration, diagnosticLoggingFiles, init
74
74
  enabled: configuration.diagnosticLogging.enabled,
75
75
  status: statuses.diagnosticLogging
76
76
  }),
77
- measurementHooks: Object.freeze({
78
- enabled: measurementHooksEnabled,
79
- status: statuses.measurementHooks
77
+ terminalEffects: Object.freeze({
78
+ enabled: terminalEffectsEnabled,
79
+ status: statuses.terminalEffects
80
80
  })
81
81
  })
82
82
  });
@@ -93,7 +93,7 @@ export function failedOutput(statuses) {
93
93
  "progressRendering",
94
94
  "machinePublication",
95
95
  "diagnosticLogging",
96
- "measurementHooks"
96
+ "terminalEffects"
97
97
  ])
98
98
  if (statuses[output].status === "failed")
99
99
  return output;
@@ -1 +1 @@
1
- {"version":3,"file":"status.mjs","sourceRoot":"","sources":["../../../../src/project-run/outputs/status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAA0B,MAAM,iCAAiC,CAAC;AAmD9F,MAAM,UAAU,oBAAoB,CAClC,aAA6B,EAC7B,sBAA0E,EAC1E,8BAAuC;IAEvC,IAAI,uBAAuB,GAAG,8BAA8B,CAAC;IAC7D,MAAM,wBAAwB,GAAiD,MAAM,CAAC,MAAM,CAAC;QAC3F,IAAI,EAAE,aAAa,CAAC,iBAAiB,CAAC,OAAO;QAC7C,SAAS,EAAE,aAAa,CAAC,iBAAiB,CAAC,OAAO;KACnD,CAAC,CAAC;IACH,MAAM,QAAQ,GAA+D;QAC3E,kBAAkB,EAAE,aAAa,CAAC,aAAa,CAAC,kBAAkB,CAAC,OAA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CHANNELS, type DiagnosticChannel } from \"../diagnostic-logging/logger.ts\";\n\n/** 一项 Run-owned terminal output 或 measurement participant 的最终状态 readback。 */\nexport interface RunOutputStatus {\n /** effective configuration 是否启用该 participant;`false` 时 status 必为 `disabled`。 */\n readonly enabled: boolean;\n /** `disabled` 为未启用;`not-run` 为启用但未到达完成;`succeeded` 为完成,`failed` 为其 own I/O 或 hook failure。 */\n readonly status: \"disabled\" | \"failed\" | \"not-run\" | \"succeeded\";\n}\n\n/** Product-owned 人读 diagnostic channel;即使 setup 失败也保留其 file readback。 */\nexport interface RunDiagnosticLoggingChannelStatus extends RunOutputStatus {\n /**\n * 相对 effective project root 的 target readback;跨卷时可为 absolute path。disabled channel 为 `null`,\n * enabled channel 即使 setup 失败也保留预先计算的 path。\n */\n readonly file: string | null;\n}\n\n/** diagnostic logging aggregate 及其各 owner channel 的最终状态 readback。 */\nexport interface RunDiagnosticLoggingOutputStatus extends RunOutputStatus {\n /** aggregate status 及每个 owner channel 的独立 readback;partial failure 可由此定位。 */\n readonly channels: Readonly<Record<DiagnosticChannel, RunDiagnosticLoggingChannelStatus>>;\n}\n\n/** 配置有效后四个 terminal output participant 的独立最终状态。 */\nexport interface RunOutputStatuses {\n /** `run.json` 与 `records.ndjson` canonical publication 的状态。 */\n readonly machinePublication: RunOutputStatus;\n /** terminal progress 与可选 progress log tee 的状态。 */\n readonly progressRendering: RunOutputStatus;\n /** core 与 scheduler diagnostic channels 的 aggregate 状态。 */\n readonly diagnosticLogging: RunDiagnosticLoggingOutputStatus;\n /**\n * Definition generic Hooks 与 prepared custom strategy 的 optional `complete` 所形成的 terminal participant\n * 状态;它不能由 RunControls 注入或覆盖。\n */\n readonly measurementHooks: RunOutputStatus;\n}\n\nexport interface OutputStatuses {\n /** Enables a runtime-only terminal participant after successful preparation. */\n readonly enableMeasurementHooks: () => void;\n /** A diagnostic channel failure is isolated but updates the aggregate diagnostic output. */\n readonly failedDiagnosticChannel: (channel: DiagnosticChannel) => void;\n readonly failed: (output: keyof RunOutputStatuses) => void;\n readonly succeededDiagnosticChannel: (channel: DiagnosticChannel) => void;\n readonly succeeded: (output: keyof RunOutputStatuses) => void;\n readonly value: () => RunOutputStatuses;\n}\n\nexport function createOutputStatuses(\n configuration: ProjectOutputs,\n diagnosticLoggingFiles: Readonly<Record<DiagnosticChannel, string | null>>,\n initialMeasurementHooksEnabled: boolean\n): OutputStatuses {\n let measurementHooksEnabled = initialMeasurementHooksEnabled;\n const diagnosticChannelEnabled: Readonly<Record<DiagnosticChannel, boolean>> = Object.freeze({\n core: configuration.diagnosticLogging.enabled,\n scheduler: configuration.diagnosticLogging.enabled\n });\n const statuses: Record<keyof RunOutputStatuses, RunOutputStatus[\"status\"]> = {\n machinePublication: initialStatus(configuration.machinePublication.enabled),\n progressRendering: initialStatus(configuration.progressRendering.enabled),\n diagnosticLogging: initialStatus(configuration.diagnosticLogging.enabled),\n measurementHooks: initialStatus(measurementHooksEnabled)\n };\n const diagnosticChannelStatuses: Record<DiagnosticChannel, RunOutputStatus[\"status\"]> = {\n core: initialStatus(diagnosticChannelEnabled.core),\n scheduler: initialStatus(diagnosticChannelEnabled.scheduler)\n };\n const enabled = (output: keyof RunOutputStatuses): boolean =>\n output === \"measurementHooks\" ? measurementHooksEnabled : configuration[output].enabled;\n const refreshDiagnosticAggregate = (): void => {\n const enabledStatuses = DIAGNOSTIC_CHANNELS.filter(\n (channel) => diagnosticChannelEnabled[channel]\n ).map((channel) => diagnosticChannelStatuses[channel]);\n if (enabledStatuses.includes(\"failed\")) {\n statuses.diagnosticLogging = \"failed\";\n return;\n }\n if (enabledStatuses.every((status) => status === \"succeeded\")) {\n statuses.diagnosticLogging = \"succeeded\";\n return;\n }\n statuses.diagnosticLogging = enabledStatuses.every((status) => status === \"disabled\")\n ? \"disabled\"\n : \"not-run\";\n };\n return Object.freeze({\n enableMeasurementHooks: () => {\n if (measurementHooksEnabled) return;\n measurementHooksEnabled = true;\n statuses.measurementHooks = \"not-run\";\n },\n failedDiagnosticChannel: (channel: DiagnosticChannel) => {\n if (!diagnosticChannelEnabled[channel]) return;\n diagnosticChannelStatuses[channel] = \"failed\";\n refreshDiagnosticAggregate();\n },\n failed: (output: keyof RunOutputStatuses) => {\n if (enabled(output)) statuses[output] = \"failed\";\n },\n succeededDiagnosticChannel: (channel: DiagnosticChannel) => {\n if (!diagnosticChannelEnabled[channel] || diagnosticChannelStatuses[channel] === \"failed\")\n return;\n diagnosticChannelStatuses[channel] = \"succeeded\";\n refreshDiagnosticAggregate();\n },\n succeeded: (output: keyof RunOutputStatuses) => {\n if (enabled(output) && statuses[output] !== \"failed\") statuses[output] = \"succeeded\";\n },\n value: () =>\n Object.freeze({\n machinePublication: Object.freeze({\n enabled: configuration.machinePublication.enabled,\n status: statuses.machinePublication\n }),\n progressRendering: Object.freeze({\n enabled: configuration.progressRendering.enabled,\n status: statuses.progressRendering\n }),\n diagnosticLogging: Object.freeze({\n channels: Object.freeze({\n core: diagnosticChannelValue(\"core\"),\n scheduler: diagnosticChannelValue(\"scheduler\")\n }),\n enabled: configuration.diagnosticLogging.enabled,\n status: statuses.diagnosticLogging\n }),\n measurementHooks: Object.freeze({\n enabled: measurementHooksEnabled,\n status: statuses.measurementHooks\n })\n })\n });\n\n function diagnosticChannelValue(channel: DiagnosticChannel): RunDiagnosticLoggingChannelStatus {\n return Object.freeze({\n enabled: diagnosticChannelEnabled[channel],\n file: diagnosticLoggingFiles[channel],\n status: diagnosticChannelStatuses[channel]\n });\n }\n}\n\nexport function failedOutput(statuses: RunOutputStatuses): keyof RunOutputStatuses | undefined {\n for (const output of [\n \"progressRendering\",\n \"machinePublication\",\n \"diagnosticLogging\",\n \"measurementHooks\"\n ] as const)\n if (statuses[output].status === \"failed\") return output;\n return undefined;\n}\n\nfunction initialStatus(enabled: boolean): RunOutputStatus[\"status\"] {\n return enabled ? \"not-run\" : \"disabled\";\n}\n"]}
1
+ {"version":3,"file":"status.mjs","sourceRoot":"","sources":["../../../../src/project-run/outputs/status.ts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AAC;AAED,MAAM,UAAU,YAAY,CAAC,QAA2B;IACtD,KAAK,MAAM,MAAM,IAAI;QACnB,mBAAmB;QACnB,oBAAoB;QACpB,mBAAmB;QACnB,iBAAiB;KACT;QACR,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC;IAC1D,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,aAAa,CAAC,OAAgB;IACrC,OAAO,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC;AAC1C,CAAC","sourcesContent":["import type { ProjectOutputs } from \"../../project-definition/project-definition.ts\";\nimport { DIAGNOSTIC_CHANNELS, type DiagnosticChannel } from \"../diagnostic-logging/logger.ts\";\n\n/** 一项 Run-owned terminal output 或 measurement participant 的最终状态 readback。 */\nexport interface RunOutputStatus {\n /** effective configuration 是否启用该 participant;`false` 时 status 必为 `disabled`。 */\n readonly enabled: boolean;\n /** `disabled` 为未启用;`not-run` 为启用但未到达完成;`succeeded` 为完成,`failed` 为其 own I/O 或 hook failure。 */\n readonly status: \"disabled\" | \"failed\" | \"not-run\" | \"succeeded\";\n}\n\n/** Product-owned 人读 diagnostic channel;即使 setup 失败也保留其 file readback。 */\nexport interface RunDiagnosticLoggingChannelStatus extends RunOutputStatus {\n /**\n * 相对 effective project root 的 target readback;跨卷时可为 absolute path。disabled channel 为 `null`,\n * enabled channel 即使 setup 失败也保留预先计算的 path。\n */\n readonly file: string | null;\n}\n\n/** diagnostic logging aggregate 及其各 owner channel 的最终状态 readback。 */\nexport interface RunDiagnosticLoggingOutputStatus extends RunOutputStatus {\n /** aggregate status 及每个 owner channel 的独立 readback;partial failure 可由此定位。 */\n readonly channels: Readonly<Record<DiagnosticChannel, RunDiagnosticLoggingChannelStatus>>;\n}\n\n/** 配置有效后四个 terminal output participant 的独立最终状态。 */\nexport interface RunOutputStatuses {\n /** `run.json` 与 `records.ndjson` canonical publication 的状态。 */\n readonly machinePublication: RunOutputStatus;\n /** terminal progress 与可选 progress log tee 的状态。 */\n readonly progressRendering: RunOutputStatus;\n /** core 与 scheduler diagnostic channels 的 aggregate 状态。 */\n readonly diagnosticLogging: RunDiagnosticLoggingOutputStatus;\n /**\n * Definition generic effects 与 prepared custom strategy 的 optional `terminalEffect` 所形成的 terminal participant\n * 状态;它不能由 RunControls 注入或覆盖。\n */\n readonly terminalEffects: RunOutputStatus;\n}\n\nexport interface OutputStatuses {\n /** Enables a runtime-only terminal participant after successful preparation. */\n readonly enableTerminalEffects: () => void;\n /** A diagnostic channel failure is isolated but updates the aggregate diagnostic output. */\n readonly failedDiagnosticChannel: (channel: DiagnosticChannel) => void;\n readonly failed: (output: keyof RunOutputStatuses) => void;\n readonly succeededDiagnosticChannel: (channel: DiagnosticChannel) => void;\n readonly succeeded: (output: keyof RunOutputStatuses) => void;\n readonly value: () => RunOutputStatuses;\n}\n\nexport function createOutputStatuses(\n configuration: ProjectOutputs,\n diagnosticLoggingFiles: Readonly<Record<DiagnosticChannel, string | null>>,\n initialTerminalEffectsEnabled: boolean\n): OutputStatuses {\n let terminalEffectsEnabled = initialTerminalEffectsEnabled;\n const diagnosticChannelEnabled: Readonly<Record<DiagnosticChannel, boolean>> = Object.freeze({\n core: configuration.diagnosticLogging.enabled,\n scheduler: configuration.diagnosticLogging.enabled\n });\n const statuses: Record<keyof RunOutputStatuses, RunOutputStatus[\"status\"]> = {\n machinePublication: initialStatus(configuration.machinePublication.enabled),\n progressRendering: initialStatus(configuration.progressRendering.enabled),\n diagnosticLogging: initialStatus(configuration.diagnosticLogging.enabled),\n terminalEffects: initialStatus(terminalEffectsEnabled)\n };\n const diagnosticChannelStatuses: Record<DiagnosticChannel, RunOutputStatus[\"status\"]> = {\n core: initialStatus(diagnosticChannelEnabled.core),\n scheduler: initialStatus(diagnosticChannelEnabled.scheduler)\n };\n const enabled = (output: keyof RunOutputStatuses): boolean =>\n output === \"terminalEffects\" ? terminalEffectsEnabled : configuration[output].enabled;\n const refreshDiagnosticAggregate = (): void => {\n const enabledStatuses = DIAGNOSTIC_CHANNELS.filter(\n (channel) => diagnosticChannelEnabled[channel]\n ).map((channel) => diagnosticChannelStatuses[channel]);\n if (enabledStatuses.includes(\"failed\")) {\n statuses.diagnosticLogging = \"failed\";\n return;\n }\n if (enabledStatuses.every((status) => status === \"succeeded\")) {\n statuses.diagnosticLogging = \"succeeded\";\n return;\n }\n statuses.diagnosticLogging = enabledStatuses.every((status) => status === \"disabled\")\n ? \"disabled\"\n : \"not-run\";\n };\n return Object.freeze({\n enableTerminalEffects: () => {\n if (terminalEffectsEnabled) return;\n terminalEffectsEnabled = true;\n statuses.terminalEffects = \"not-run\";\n },\n failedDiagnosticChannel: (channel: DiagnosticChannel) => {\n if (!diagnosticChannelEnabled[channel]) return;\n diagnosticChannelStatuses[channel] = \"failed\";\n refreshDiagnosticAggregate();\n },\n failed: (output: keyof RunOutputStatuses) => {\n if (enabled(output)) statuses[output] = \"failed\";\n },\n succeededDiagnosticChannel: (channel: DiagnosticChannel) => {\n if (!diagnosticChannelEnabled[channel] || diagnosticChannelStatuses[channel] === \"failed\")\n return;\n diagnosticChannelStatuses[channel] = \"succeeded\";\n refreshDiagnosticAggregate();\n },\n succeeded: (output: keyof RunOutputStatuses) => {\n if (enabled(output) && statuses[output] !== \"failed\") statuses[output] = \"succeeded\";\n },\n value: () =>\n Object.freeze({\n machinePublication: Object.freeze({\n enabled: configuration.machinePublication.enabled,\n status: statuses.machinePublication\n }),\n progressRendering: Object.freeze({\n enabled: configuration.progressRendering.enabled,\n status: statuses.progressRendering\n }),\n diagnosticLogging: Object.freeze({\n channels: Object.freeze({\n core: diagnosticChannelValue(\"core\"),\n scheduler: diagnosticChannelValue(\"scheduler\")\n }),\n enabled: configuration.diagnosticLogging.enabled,\n status: statuses.diagnosticLogging\n }),\n terminalEffects: Object.freeze({\n enabled: terminalEffectsEnabled,\n status: statuses.terminalEffects\n })\n })\n });\n\n function diagnosticChannelValue(channel: DiagnosticChannel): RunDiagnosticLoggingChannelStatus {\n return Object.freeze({\n enabled: diagnosticChannelEnabled[channel],\n file: diagnosticLoggingFiles[channel],\n status: diagnosticChannelStatuses[channel]\n });\n }\n}\n\nexport function failedOutput(statuses: RunOutputStatuses): keyof RunOutputStatuses | undefined {\n for (const output of [\n \"progressRendering\",\n \"machinePublication\",\n \"diagnosticLogging\",\n \"terminalEffects\"\n ] as const)\n if (statuses[output].status === \"failed\") return output;\n return undefined;\n}\n\nfunction initialStatus(enabled: boolean): RunOutputStatus[\"status\"] {\n return enabled ? \"not-run\" : \"disabled\";\n}\n"]}