@deftai/directive-core 0.104.0 → 0.106.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/dist/authz/classify.js +1108 -67
  2. package/dist/check/cached-orchestrator.d.ts +1 -1
  3. package/dist/check/cached-orchestrator.js +2 -2
  4. package/dist/check/named-cause.d.ts +1 -1
  5. package/dist/check/named-cause.js +34 -4
  6. package/dist/codebase/default-extractor.d.ts +5 -0
  7. package/dist/codebase/default-extractor.js +7 -15
  8. package/dist/deposit/copy-tree.js +60 -0
  9. package/dist/deposit/python-free.js +26 -18
  10. package/dist/doctor/checks.d.ts +8 -0
  11. package/dist/doctor/checks.js +37 -25
  12. package/dist/doctor/doctor-state.d.ts +4 -0
  13. package/dist/doctor/doctor-state.js +7 -1
  14. package/dist/doctor/main.js +9 -19
  15. package/dist/doctor/types.d.ts +9 -0
  16. package/dist/forward-coverage/diff-coverage.d.ts +39 -0
  17. package/dist/forward-coverage/diff-coverage.js +112 -0
  18. package/dist/forward-coverage/diff-lines.d.ts +19 -0
  19. package/dist/forward-coverage/diff-lines.js +173 -0
  20. package/dist/forward-coverage/evaluate.d.ts +24 -9
  21. package/dist/forward-coverage/evaluate.js +125 -19
  22. package/dist/fs/contained-write.d.ts +115 -1
  23. package/dist/fs/contained-write.js +241 -5
  24. package/dist/fs/mutation-ledger.d.ts +54 -0
  25. package/dist/fs/mutation-ledger.js +133 -0
  26. package/dist/fs/non-product-dirs.d.ts +79 -0
  27. package/dist/fs/non-product-dirs.js +96 -0
  28. package/dist/hooks/dispatcher.d.ts +3 -1
  29. package/dist/hooks/dispatcher.js +14 -0
  30. package/dist/index.d.ts +1 -0
  31. package/dist/index.js +2 -0
  32. package/dist/init-deposit/agent-hooks.d.ts +1 -1
  33. package/dist/init-deposit/agent-hooks.js +18 -16
  34. package/dist/init-deposit/core-guard-pin-content.d.ts +7 -0
  35. package/dist/init-deposit/core-guard-pin-content.js +393 -0
  36. package/dist/init-deposit/gitignore.js +9 -0
  37. package/dist/init-deposit/hygiene.d.ts +47 -11
  38. package/dist/init-deposit/hygiene.js +172 -37
  39. package/dist/init-deposit/legacy-detect.js +6 -2
  40. package/dist/init-deposit/refresh.d.ts +21 -1
  41. package/dist/init-deposit/refresh.js +106 -9
  42. package/dist/init-deposit/scaffold.js +28 -279
  43. package/dist/init-deposit/slash-deposit.js +13 -7
  44. package/dist/init-deposit/xbrief-projections.d.ts +8 -1
  45. package/dist/init-deposit/xbrief-projections.js +24 -11
  46. package/dist/intake/clause-derivation.d.ts +47 -1
  47. package/dist/intake/clause-derivation.js +238 -9
  48. package/dist/intake/issue-ingest.d.ts +3 -1
  49. package/dist/intake/issue-ingest.js +35 -6
  50. package/dist/lifecycle/completed-tracked-on-delivery.d.ts +5 -0
  51. package/dist/lifecycle/completed-tracked-on-delivery.js +85 -18
  52. package/dist/lifecycle-visible/evaluate.d.ts +98 -0
  53. package/dist/lifecycle-visible/evaluate.js +710 -0
  54. package/dist/lifecycle-visible/index.d.ts +2 -0
  55. package/dist/lifecycle-visible/index.js +2 -0
  56. package/dist/literal-acceptance/capture.d.ts +10 -0
  57. package/dist/literal-acceptance/capture.js +226 -77
  58. package/dist/literal-acceptance/evaluate.d.ts +29 -4
  59. package/dist/literal-acceptance/evaluate.js +70 -2
  60. package/dist/literal-acceptance/index.d.ts +3 -3
  61. package/dist/literal-acceptance/index.js +3 -3
  62. package/dist/literal-acceptance/safety.d.ts +41 -0
  63. package/dist/literal-acceptance/safety.js +126 -2
  64. package/dist/literal-acceptance/types.d.ts +8 -0
  65. package/dist/orchestration/judgment-policy.d.ts +13 -0
  66. package/dist/orchestration/judgment-policy.js +15 -0
  67. package/dist/orchestration/probe-session.js +13 -8
  68. package/dist/orchestration/verify-judgment-gates.d.ts +4 -0
  69. package/dist/orchestration/verify-judgment-gates.js +43 -11
  70. package/dist/orphan-active/evaluate.d.ts +7 -1
  71. package/dist/orphan-active/evaluate.js +102 -23
  72. package/dist/platform/platform-capabilities.js +2 -3
  73. package/dist/policy/base-branch.d.ts +37 -0
  74. package/dist/policy/base-branch.js +114 -0
  75. package/dist/policy/branch-sync.d.ts +80 -0
  76. package/dist/policy/branch-sync.js +211 -0
  77. package/dist/policy/ceremony-dial-escalation.js +1 -0
  78. package/dist/policy/ceremony-dial.js +11 -21
  79. package/dist/policy/delivery-branch.d.ts +5 -3
  80. package/dist/policy/delivery-branch.js +7 -3
  81. package/dist/policy/file-size-thresholds.d.ts +24 -0
  82. package/dist/policy/file-size-thresholds.js +23 -0
  83. package/dist/policy/forge-outage-retry.d.ts +47 -0
  84. package/dist/policy/forge-outage-retry.js +157 -0
  85. package/dist/policy/host-hooks.d.ts +20 -0
  86. package/dist/policy/host-hooks.js +121 -2
  87. package/dist/policy/index.d.ts +7 -0
  88. package/dist/policy/index.js +66 -7
  89. package/dist/policy/org-force-on-migration.js +2 -1
  90. package/dist/policy/plan-extensions.d.ts +1 -1
  91. package/dist/policy/plan-extensions.js +2 -0
  92. package/dist/policy/product-signal.js +6 -7
  93. package/dist/policy/project-invariants.d.ts +50 -0
  94. package/dist/policy/project-invariants.js +205 -0
  95. package/dist/policy/require-human-merge.js +8 -6
  96. package/dist/policy/resolve.d.ts +7 -2
  97. package/dist/policy/resolve.js +25 -8
  98. package/dist/policy/sync-default.d.ts +129 -0
  99. package/dist/policy/sync-default.js +452 -0
  100. package/dist/policy/sync-max-files.d.ts +93 -0
  101. package/dist/policy/sync-max-files.js +192 -0
  102. package/dist/policy/value-feedback.js +7 -8
  103. package/dist/pr-monitor/absent-required.d.ts +11 -0
  104. package/dist/pr-monitor/absent-required.js +61 -0
  105. package/dist/pr-monitor/constants.d.ts +7 -0
  106. package/dist/pr-monitor/constants.js +7 -0
  107. package/dist/pr-monitor/index.d.ts +2 -1
  108. package/dist/pr-monitor/index.js +2 -1
  109. package/dist/pr-monitor/main.js +4 -0
  110. package/dist/pr-monitor/monitor.js +24 -1
  111. package/dist/pr-wait-mergeable/classify.js +6 -0
  112. package/dist/preflight/evaluate.d.ts +4 -0
  113. package/dist/preflight/evaluate.js +35 -1
  114. package/dist/preflight/index.d.ts +4 -0
  115. package/dist/preflight/index.js +2 -0
  116. package/dist/preflight/intended-placement.d.ts +62 -0
  117. package/dist/preflight/intended-placement.js +275 -0
  118. package/dist/preflight/project-invariants-gate.d.ts +29 -0
  119. package/dist/preflight/project-invariants-gate.js +82 -0
  120. package/dist/preflight-cache/evaluate.d.ts +12 -0
  121. package/dist/preflight-cache/evaluate.js +15 -1
  122. package/dist/preflight-cache/index.d.ts +1 -1
  123. package/dist/preflight-cache/index.js +1 -1
  124. package/dist/product-first-done-gate/acceptance-resolver.d.ts +128 -0
  125. package/dist/product-first-done-gate/acceptance-resolver.js +144 -0
  126. package/dist/product-first-done-gate/acceptance.d.ts +7 -4
  127. package/dist/product-first-done-gate/acceptance.js +79 -8
  128. package/dist/product-first-done-gate/empty-resolution.d.ts +4 -1
  129. package/dist/product-first-done-gate/empty-resolution.js +12 -1
  130. package/dist/product-first-done-gate/evaluate.d.ts +16 -0
  131. package/dist/product-first-done-gate/evaluate.js +298 -34
  132. package/dist/product-first-done-gate/index.d.ts +2 -0
  133. package/dist/product-first-done-gate/index.js +1 -0
  134. package/dist/release/build-dist.d.ts +101 -0
  135. package/dist/release/build-dist.js +428 -46
  136. package/dist/release/closed-verb-gate.d.ts +12 -0
  137. package/dist/release/closed-verb-gate.js +51 -0
  138. package/dist/release/index.d.ts +1 -0
  139. package/dist/release/index.js +1 -0
  140. package/dist/release/pipeline.js +7 -0
  141. package/dist/release/types.d.ts +12 -0
  142. package/dist/render/constants.d.ts +2 -1
  143. package/dist/render/constants.js +2 -1
  144. package/dist/render/framework-commands.js +4 -0
  145. package/dist/render/spec-validate.js +23 -12
  146. package/dist/run-summary/emit.d.ts +16 -10
  147. package/dist/run-summary/emit.js +26 -15
  148. package/dist/run-summary/index.d.ts +3 -2
  149. package/dist/run-summary/index.js +2 -1
  150. package/dist/run-summary/session-id.d.ts +21 -0
  151. package/dist/run-summary/session-id.js +92 -0
  152. package/dist/run-summary/types.d.ts +33 -4
  153. package/dist/run-summary/types.js +1 -0
  154. package/dist/scope/acceptance-evidence.d.ts +19 -7
  155. package/dist/scope/acceptance-evidence.js +38 -11
  156. package/dist/scope/delivery-evidence.d.ts +3 -3
  157. package/dist/scope/delivery-evidence.js +22 -27
  158. package/dist/scope/index.d.ts +1 -0
  159. package/dist/scope/index.js +1 -0
  160. package/dist/scope/main.js +15 -5
  161. package/dist/scope/parent-lineage.js +7 -6
  162. package/dist/scope/project-invariant-coverage.d.ts +54 -0
  163. package/dist/scope/project-invariant-coverage.js +322 -0
  164. package/dist/scope/promote-from-issue.js +5 -5
  165. package/dist/scope/transition.js +1 -1
  166. package/dist/scope-provenance/compare-intent.d.ts +27 -0
  167. package/dist/scope-provenance/compare-intent.js +233 -0
  168. package/dist/scope-provenance/digest.d.ts +18 -1
  169. package/dist/scope-provenance/digest.js +16 -11
  170. package/dist/scope-provenance/evaluate.d.ts +5 -1
  171. package/dist/scope-provenance/evaluate.js +67 -7
  172. package/dist/scope-provenance/extract-intent.d.ts +43 -0
  173. package/dist/scope-provenance/extract-intent.js +262 -0
  174. package/dist/scope-provenance/index.d.ts +7 -1
  175. package/dist/scope-provenance/index.js +7 -1
  176. package/dist/scope-provenance/intent-digest.d.ts +12 -0
  177. package/dist/scope-provenance/intent-digest.js +33 -0
  178. package/dist/scope-provenance/intent-evaluate.d.ts +43 -0
  179. package/dist/scope-provenance/intent-evaluate.js +149 -0
  180. package/dist/scope-provenance/json-tokenizer.d.ts +19 -0
  181. package/dist/scope-provenance/json-tokenizer.js +225 -0
  182. package/dist/scope-provenance/known-machine.d.ts +38 -0
  183. package/dist/scope-provenance/known-machine.js +157 -0
  184. package/dist/scope-provenance/mint-artifacts.d.ts +102 -0
  185. package/dist/scope-provenance/mint-artifacts.js +425 -0
  186. package/dist/session/ac-pass-banking.d.ts +9 -36
  187. package/dist/session/ac-pass-banking.js +33 -79
  188. package/dist/session/ac-pass-reuse.d.ts +53 -0
  189. package/dist/session/ac-pass-reuse.js +95 -0
  190. package/dist/session/git.js +19 -4
  191. package/dist/session/index.d.ts +4 -0
  192. package/dist/session/index.js +4 -0
  193. package/dist/session/occupancy-stress-worker.d.ts +7 -0
  194. package/dist/session/occupancy-stress-worker.js +36 -0
  195. package/dist/session/occupancy.d.ts +97 -0
  196. package/dist/session/occupancy.js +422 -0
  197. package/dist/session/openclaw-soft-rebind-deposit.js +6 -6
  198. package/dist/session/process-cost.d.ts +32 -10
  199. package/dist/session/process-cost.js +189 -1
  200. package/dist/session/product-state-hash.d.ts +26 -0
  201. package/dist/session/product-state-hash.js +700 -0
  202. package/dist/session/ritual-entrypoint.js +16 -1
  203. package/dist/session/session-ready.d.ts +2 -0
  204. package/dist/session/session-ready.js +52 -30
  205. package/dist/session/session-start.d.ts +13 -0
  206. package/dist/session/session-start.js +103 -9
  207. package/dist/session/verify-ac-session-cache.d.ts +42 -0
  208. package/dist/session/verify-ac-session-cache.js +126 -0
  209. package/dist/session/verify-session-ritual.d.ts +28 -0
  210. package/dist/session/verify-session-ritual.js +97 -5
  211. package/dist/slash/openclaw-deposit.js +13 -9
  212. package/dist/slice/constants.d.ts +2 -2
  213. package/dist/slice/constants.js +2 -2
  214. package/dist/slice/existing.js +9 -3
  215. package/dist/slice/lock.d.ts +16 -1
  216. package/dist/slice/lock.js +137 -11
  217. package/dist/story-ready/evaluate.d.ts +2 -0
  218. package/dist/story-ready/evaluate.js +13 -0
  219. package/dist/swarm/complete-cohort.d.ts +3 -0
  220. package/dist/swarm/complete-cohort.js +59 -11
  221. package/dist/swarm/finalize-cohort-cli.d.ts +7 -2
  222. package/dist/swarm/finalize-cohort-cli.js +165 -35
  223. package/dist/swarm/finalize-cohort.d.ts +1 -0
  224. package/dist/swarm/finalize-cohort.js +47 -4
  225. package/dist/swarm/launch.d.ts +22 -0
  226. package/dist/swarm/launch.js +155 -0
  227. package/dist/swarm/routing-set-cli.d.ts +11 -1
  228. package/dist/swarm/routing-set-cli.js +15 -3
  229. package/dist/swarm/routing-verify.d.ts +13 -1
  230. package/dist/swarm/routing-verify.js +60 -21
  231. package/dist/swarm/routing.d.ts +14 -0
  232. package/dist/swarm/routing.js +53 -3
  233. package/dist/telemetry-coverage/fake-trial.js +10 -0
  234. package/dist/telemetry-coverage/kinds.js +2 -0
  235. package/dist/triage/actions/index.js +4 -1
  236. package/dist/triage/bootstrap/index.js +6 -6
  237. package/dist/triage/help/registry-data.d.ts +1 -1
  238. package/dist/triage/help/registry-data.js +1 -1
  239. package/dist/triage/welcome/writers.d.ts +1 -1
  240. package/dist/triage/welcome/writers.js +10 -5
  241. package/dist/ts-check-lane/index.d.ts +3 -0
  242. package/dist/ts-check-lane/index.js +2 -0
  243. package/dist/ts-check-lane/progress-reporter.d.ts +17 -0
  244. package/dist/ts-check-lane/progress-reporter.js +38 -0
  245. package/dist/ts-check-lane/progress.d.ts +32 -0
  246. package/dist/ts-check-lane/progress.js +57 -0
  247. package/dist/ts-check-lane/run-lane.d.ts +3 -1
  248. package/dist/ts-check-lane/run-lane.js +8 -6
  249. package/dist/validate-content/validate-links.d.ts +8 -0
  250. package/dist/validate-content/validate-links.js +9 -15
  251. package/dist/value/feedback-file.js +12 -2
  252. package/dist/value/readback.d.ts +4 -1
  253. package/dist/value/readback.js +51 -12
  254. package/dist/vbrief-build/index.d.ts +1 -0
  255. package/dist/vbrief-build/index.js +1 -0
  256. package/dist/vbrief-build/project-invariants-io.d.ts +16 -0
  257. package/dist/vbrief-build/project-invariants-io.js +41 -0
  258. package/dist/vbrief-reconcile/graph.js +18 -1
  259. package/dist/vbrief-reconcile/index.d.ts +1 -1
  260. package/dist/vbrief-reconcile/index.js +1 -1
  261. package/dist/vbrief-reconcile/types.d.ts +13 -0
  262. package/dist/vbrief-reconcile/umbrellas.d.ts +14 -0
  263. package/dist/vbrief-reconcile/umbrellas.js +261 -26
  264. package/dist/vbrief-validate/index.d.ts +1 -1
  265. package/dist/vbrief-validate/index.js +1 -1
  266. package/dist/vbrief-validate/plan-hooks.d.ts +4 -0
  267. package/dist/vbrief-validate/plan-hooks.js +68 -0
  268. package/dist/vbrief-validate/schema.d.ts +4 -0
  269. package/dist/vbrief-validate/schema.js +1 -1
  270. package/dist/verify-ac/evaluate.d.ts +7 -1
  271. package/dist/verify-ac/evaluate.js +34 -26
  272. package/dist/verify-ac/flag.d.ts +4 -0
  273. package/dist/verify-ac/flag.js +16 -0
  274. package/dist/verify-ac/index.d.ts +2 -2
  275. package/dist/verify-ac/index.js +2 -2
  276. package/dist/verify-env/agent-hook-readiness.d.ts +2 -2
  277. package/dist/verify-env/agent-hook-readiness.js +12 -8
  278. package/dist/verify-env/agent-hooks-live-probe.d.ts +5 -1
  279. package/dist/verify-env/agent-hooks-live-probe.js +26 -5
  280. package/dist/verify-env/agent-hooks.js +3 -4
  281. package/dist/verify-source/contained-writes.js +2 -0
  282. package/dist/verify-source/verify-stubs.d.ts +15 -1
  283. package/dist/verify-source/verify-stubs.js +20 -16
  284. package/dist/vitest-runner/win32-coverage-tmp-setup.d.ts +5 -6
  285. package/dist/vitest-runner/win32-coverage-tmp-setup.js +5 -6
  286. package/dist/xbrief-migrate/migrate-project.js +2 -5
  287. package/package.json +7 -3
@@ -0,0 +1,144 @@
1
+ /**
2
+ * One resolver for "does this artifact carry executable acceptance that passed?" (#3497).
3
+ *
4
+ * Before this module `verify:ac` and `scope:complete` read the same artifact through
5
+ * two different lenses and reported two different things:
6
+ *
7
+ * - verify:ac composed a message from the sub-gates (`verify:ac passed`, `Literal
8
+ * acceptance-command gate passed`) and then flipped `ok` in a later stage
9
+ * (clause walk / no-op ledger / oracle integrity) without relabelling the message.
10
+ * - scope:complete took that `ok=false` and asserted "empty or failing acceptance"
11
+ * even when acceptance was neither empty nor failing.
12
+ *
13
+ * Both now read the verdict here. One predicate name, one observed value, printed
14
+ * identically by both consumers.
15
+ *
16
+ * This module is intentionally structural (no import of `VerifyAcResult`) so the
17
+ * done-gate evaluator and the scope gate can both depend on it without a cycle.
18
+ */
19
+ import { NOOP_ACCEPTANCE_REMEDIATION } from "../literal-acceptance/index.js";
20
+ const REMEDY = {
21
+ "executable-pass": "",
22
+ "empty-pass": "",
23
+ "config-error": "fix plan.acceptance so it matches the #3284 schema, then re-run task verify:ac",
24
+ "noop-refused": NOOP_ACCEPTANCE_REMEDIATION,
25
+ "safety-rejected": "promote a safe alternative into plan.metadata.swarm.verify_commands or remove the stated command from the task statement (#3267)",
26
+ "commands-failed": "fix the product until the stated acceptance command exits as expected — the command, not the gate, is the oracle (#3284)",
27
+ "empty-acceptance": "stamp executable commands on plan.acceptance.commands (or plan.metadata.swarm.verify_commands) with source_rung derived|project_floor (#3334)",
28
+ "clause-walk-failed": "ship the artifact each failed clause names, or bind the clause to the path it actually landed at (#3323)",
29
+ "integrity-discrepancy": "resolve by a product change under the same method, or independently re-derive both sides and record independent_rederivation=true (#3322)",
30
+ unclassified: "read the verify:ac message below; the deciding check did not name itself",
31
+ };
32
+ function countClauses(reading, outcome) {
33
+ return (reading.clauseOutcomes ?? []).filter((row) => row.outcome === outcome).length;
34
+ }
35
+ function firstLine(message) {
36
+ const line = message.split("\n").find((row) => row.trim().length > 0);
37
+ return line === undefined ? "(no detail)" : line.trim();
38
+ }
39
+ function verdict(ok, predicate, observed) {
40
+ return { ok, predicate, observed, remedy: REMEDY[predicate] };
41
+ }
42
+ /** Executable command count this reading resolved (stamped or ledger). */
43
+ export function resolvedAcceptanceCommandCount(reading) {
44
+ return Math.max(reading.commands.length, reading.acceptance.commands.length);
45
+ }
46
+ /**
47
+ * Name the predicate that decided this verify:ac result, and the value it read.
48
+ *
49
+ * Order matters: the earliest fail-closed stage wins so the operator is pointed at
50
+ * the check that actually refused rather than a downstream symptom.
51
+ */
52
+ export function resolveAcceptanceVerdict(reading) {
53
+ const commandCount = resolvedAcceptanceCommandCount(reading);
54
+ const greenRuns = reading.runs.filter((run) => run.ok).length;
55
+ const failedRuns = reading.runs.filter((run) => !run.ok);
56
+ if (reading.ok) {
57
+ if (reading.runs.length > 0) {
58
+ return verdict(true, "executable-pass", `${greenRuns}/${reading.runs.length} command(s) exited as expected [rung=${reading.sourceRung}]`);
59
+ }
60
+ return verdict(true, "empty-pass", `no executable command resolved; project floor allows it [rung=${reading.sourceRung}]`);
61
+ }
62
+ if (reading.resolution === "config" || reading.code === 2) {
63
+ return verdict(false, "config-error", firstLine(reading.message));
64
+ }
65
+ if (reading.resolution === "rejected-noop") {
66
+ const noop = (reading.rejected ?? []).map((row) => row.command);
67
+ return verdict(false, "noop-refused", noop.length > 0
68
+ ? `blocking ledger command(s) that cannot fail: ${noop.join(", ")}`
69
+ : firstLine(reading.message));
70
+ }
71
+ const rejected = reading.rejected ?? [];
72
+ if (rejected.length > 0) {
73
+ return verdict(false, "safety-rejected", `${rejected.length} blocking safety-rejected command(s): ${rejected
74
+ .map((row) => row.command)
75
+ .join(", ")}`);
76
+ }
77
+ if (failedRuns.length > 0) {
78
+ return verdict(false, "commands-failed", `${failedRuns.length}/${reading.runs.length} command(s) did not exit as expected: ${failedRuns
79
+ .map((row) => row.command)
80
+ .join(", ")}`);
81
+ }
82
+ if (reading.resolution === "soft_empty") {
83
+ return verdict(false, "empty-acceptance", `plan.acceptance.commands=${commandCount}, runs=0 [rung=${reading.sourceRung}]`);
84
+ }
85
+ if ((reading.clauseOutcomes?.length ?? 0) > 0) {
86
+ const failed = countClauses(reading, "failed");
87
+ const unverifiable = countClauses(reading, "unverifiable");
88
+ const verified = countClauses(reading, "verified");
89
+ return verdict(false, "clause-walk-failed", `clause walk read ${verified} verified, ${unverifiable} unverifiable, ${failed} failed ` +
90
+ `against ${commandCount} stamped command(s) and ${reading.runs.length} run(s)`);
91
+ }
92
+ if (/#3322/.test(reading.message)) {
93
+ return verdict(false, "integrity-discrepancy", firstLine(reading.message));
94
+ }
95
+ if (commandCount === 0) {
96
+ return verdict(false, "empty-acceptance", `plan.acceptance.commands=0, runs=0 [rung=${reading.sourceRung}]`);
97
+ }
98
+ return verdict(false, "unclassified", firstLine(reading.message));
99
+ }
100
+ /** One line naming the predicate and the value it read (#3497). */
101
+ export function formatAcceptanceVerdict(verdictResult) {
102
+ const lead = `acceptance verdict (#3497): ${verdictResult.predicate} — ${verdictResult.observed}`;
103
+ if (verdictResult.ok || verdictResult.remedy.length === 0) {
104
+ return lead;
105
+ }
106
+ return `${lead}\n remedy: ${verdictResult.remedy}`;
107
+ }
108
+ /**
109
+ * Clause-walk composition (#3323 / #3497).
110
+ *
111
+ * A clause the shipped artifact contradicts (`failed`) always blocks. A clause the
112
+ * static walk cannot decide (`unverifiable`) is evidence of nothing — it blocks only
113
+ * when nothing else verified the product. A green executable acceptance run IS that
114
+ * something: the product-first oracle already ran. Before #3497 an all-unverifiable
115
+ * clause set refused an artifact whose stated command had just exited 0.
116
+ */
117
+ export function clauseWalkBlocks(input) {
118
+ if (input.failed > 0) {
119
+ return true;
120
+ }
121
+ if (input.walked === 0 || input.verified > 0) {
122
+ return false;
123
+ }
124
+ return !input.hasGreenExecutableRun;
125
+ }
126
+ /**
127
+ * The single option set each reader uses. Previously verify:ac and scope:complete
128
+ * hand-assembled divergent option objects at their call sites (#3497).
129
+ */
130
+ export function resolveAcceptanceGateProfile(profile) {
131
+ switch (profile) {
132
+ case "check":
133
+ // Re-scanning issue prose during `task check` re-captures backtick lines
134
+ // as rejected and deadlocks the graph (#3323).
135
+ return { captureFromNarratives: false, checkIntegrated: true, reuseMode: "auto" };
136
+ case "complete":
137
+ // Completion re-scans narratives so a narrative-only stated command fails
138
+ // closed rather than being skipped, and never serves from a same-session cache.
139
+ return { captureFromNarratives: true, checkIntegrated: false, reuseMode: "bank" };
140
+ default:
141
+ return { captureFromNarratives: undefined, checkIntegrated: false, reuseMode: "auto" };
142
+ }
143
+ }
144
+ //# sourceMappingURL=acceptance-resolver.js.map
@@ -4,7 +4,7 @@
4
4
  * Captures stated acceptance.commands at intake; empty requires none_stated:true.
5
5
  * Interoperates with #3267 plan.metadata.literal_acceptance_commands.
6
6
  */
7
- import { type AcceptanceCommand, type PlanAcceptance } from "./types.js";
7
+ import { type AcceptanceCommand, type AcSourceRung, type PlanAcceptance } from "./types.js";
8
8
  /** Validation errors for a plan.acceptance object (empty list = valid). */
9
9
  export declare function validatePlanAcceptance(value: unknown): string[];
10
10
  /**
@@ -15,11 +15,14 @@ export declare function readPlanAcceptance(plan: Record<string, unknown> | null
15
15
  /** Attach a validated PlanAcceptance onto plan.acceptance + mirror to #3267 metadata. */
16
16
  export declare function attachPlanAcceptance(plan: Record<string, unknown>, acceptance: PlanAcceptance): Record<string, unknown>;
17
17
  /**
18
- * Build plan.acceptance from intake capture (#3284).
19
- * Stated commands none_stated:false, source_rung:stated.
18
+ * Build plan.acceptance from intake capture (#3284 / #3396).
19
+ * Stated only when capture recorded a verbatim statement span.
20
20
  * No stated commands → none_stated:true, source_rung:project_floor (until agent derives).
21
21
  */
22
- export declare function buildAcceptanceFromIntakeCapture(capturedCommands: readonly AcceptanceCommand[]): PlanAcceptance;
22
+ export declare function buildAcceptanceFromIntakeCapture(capturedCommands: readonly AcceptanceCommand[], options?: {
23
+ readonly hasVerbatimStatementSpan?: boolean;
24
+ readonly previousRung?: AcSourceRung;
25
+ }): PlanAcceptance;
23
26
  /** Stamp plan.acceptance from existing literal capture after issue ingest. */
24
27
  export declare function stampAcceptanceFromLiteralCapture(plan: Record<string, unknown>): Record<string, unknown>;
25
28
  //# sourceMappingURL=acceptance.d.ts.map
@@ -4,7 +4,7 @@
4
4
  * Captures stated acceptance.commands at intake; empty requires none_stated:true.
5
5
  * Interoperates with #3267 plan.metadata.literal_acceptance_commands.
6
6
  */
7
- import { attachLiteralAcceptanceCommands, readStoredLiteralAcceptanceCommands, } from "../literal-acceptance/index.js";
7
+ import { attachLiteralAcceptanceCommands, evaluateStampAcceptanceSafety, isNoopRefusalReason, isVerbatimStatementSpan, NOOP_ACCEPTANCE_REMEDIATION, readStoredLiteralAcceptanceCommands, } from "../literal-acceptance/index.js";
8
8
  import { readAcceptanceClauses, serializeAcceptanceClauses } from "../verify-ac/clauses.js";
9
9
  import { PLAN_ACCEPTANCE_KEY, } from "./types.js";
10
10
  function asRecord(value) {
@@ -100,6 +100,12 @@ export function validatePlanAcceptance(value) {
100
100
  errors.push("plan.acceptance: none_stated:true with source_rung:stated is contradictory " +
101
101
  "(use source_rung:derived when commands are agent-authored under none_stated)");
102
102
  }
103
+ for (const cmd of commands) {
104
+ const stamp = evaluateStampAcceptanceSafety({ commands: [{ command: cmd.command }] });
105
+ if (!stamp.ok && isNoopRefusalReason(stamp.reason)) {
106
+ errors.push(stamp.reason ?? NOOP_ACCEPTANCE_REMEDIATION);
107
+ }
108
+ }
103
109
  return errors;
104
110
  }
105
111
  /**
@@ -218,11 +224,11 @@ export function attachPlanAcceptance(plan, acceptance) {
218
224
  return next;
219
225
  }
220
226
  /**
221
- * Build plan.acceptance from intake capture (#3284).
222
- * Stated commands none_stated:false, source_rung:stated.
227
+ * Build plan.acceptance from intake capture (#3284 / #3396).
228
+ * Stated only when capture recorded a verbatim statement span.
223
229
  * No stated commands → none_stated:true, source_rung:project_floor (until agent derives).
224
230
  */
225
- export function buildAcceptanceFromIntakeCapture(capturedCommands) {
231
+ export function buildAcceptanceFromIntakeCapture(capturedCommands, options = {}) {
226
232
  if (capturedCommands.length === 0) {
227
233
  return {
228
234
  commands: [],
@@ -231,17 +237,82 @@ export function buildAcceptanceFromIntakeCapture(capturedCommands) {
231
237
  derived_reason: "no shell acceptance commands stated in task text; floor until agent derives AC (#3284 ladder)",
232
238
  };
233
239
  }
240
+ const stamp = evaluateStampAcceptanceSafety({
241
+ commands: capturedCommands.map((cmd) => ({ command: cmd.command })),
242
+ previousRung: options.previousRung,
243
+ });
244
+ if (!stamp.ok) {
245
+ throw new Error(stamp.reason ?? NOOP_ACCEPTANCE_REMEDIATION);
246
+ }
247
+ const sourceRung = options.hasVerbatimStatementSpan === true ? "stated" : "derived";
234
248
  return {
235
249
  commands: capturedCommands,
236
- none_stated: false,
237
- source_rung: "stated",
238
- derived_reason: null,
250
+ none_stated: sourceRung !== "stated",
251
+ source_rung: sourceRung,
252
+ derived_reason: sourceRung === "stated"
253
+ ? null
254
+ : "no recorded verbatim statement span; derived not stated (#3396)",
239
255
  };
240
256
  }
257
+ function rawStampCommandStrings(plan) {
258
+ const out = [];
259
+ const seen = new Set();
260
+ const push = (value) => {
261
+ if (typeof value === "string" && value.trim().length > 0) {
262
+ const command = value.trim();
263
+ if (seen.has(command))
264
+ return;
265
+ seen.add(command);
266
+ out.push(command);
267
+ return;
268
+ }
269
+ const rec = asRecord(value);
270
+ if (rec === null)
271
+ return;
272
+ const command = rec.command ?? rec.cmd ?? rec.shell;
273
+ if (isNonEmptyString(command)) {
274
+ const trimmed = command.trim();
275
+ if (seen.has(trimmed))
276
+ return;
277
+ seen.add(trimmed);
278
+ out.push(trimmed);
279
+ }
280
+ };
281
+ const acceptance = asRecord(plan[PLAN_ACCEPTANCE_KEY]);
282
+ if (acceptance !== null && Array.isArray(acceptance.commands)) {
283
+ for (const entry of acceptance.commands) {
284
+ push(entry);
285
+ }
286
+ }
287
+ const metadata = asRecord(plan.metadata);
288
+ if (metadata !== null) {
289
+ const explicit = metadata.literal_acceptance_commands ?? metadata.literalAcceptanceCommands;
290
+ if (Array.isArray(explicit)) {
291
+ for (const entry of explicit) {
292
+ push(entry);
293
+ }
294
+ }
295
+ }
296
+ return out;
297
+ }
241
298
  /** Stamp plan.acceptance from existing literal capture after issue ingest. */
242
299
  export function stampAcceptanceFromLiteralCapture(plan) {
300
+ const previous = asRecord(plan[PLAN_ACCEPTANCE_KEY]);
301
+ const previousRung = isAcSourceRung(previous?.source_rung) ? previous.source_rung : undefined;
302
+ const attempted = rawStampCommandStrings(plan);
303
+ const refuse = evaluateStampAcceptanceSafety({
304
+ commands: attempted.map((command) => ({ command })),
305
+ previousRung,
306
+ });
307
+ if (!refuse.ok) {
308
+ throw new Error(refuse.reason ?? NOOP_ACCEPTANCE_REMEDIATION);
309
+ }
243
310
  const literal = readStoredLiteralAcceptanceCommands(plan);
244
- const acceptance = buildAcceptanceFromIntakeCapture(literal.map(literalToAcceptance));
311
+ const hasVerbatimStatementSpan = literal.some((cmd) => cmd.source === "task_statement" && isVerbatimStatementSpan(cmd.sourceSpan ?? null));
312
+ const acceptance = buildAcceptanceFromIntakeCapture(literal.map(literalToAcceptance), {
313
+ hasVerbatimStatementSpan,
314
+ previousRung,
315
+ });
245
316
  // Avoid re-mirroring task_statement into verify_commands (ingest strips those).
246
317
  const serializable = {
247
318
  commands: acceptance.commands.map((c) => {
@@ -8,7 +8,9 @@ import type { PlanAcceptance } from "./types.js";
8
8
  export declare const EMPTY_AC_OUTCOME: "soft_empty";
9
9
  export declare const EMPTY_AC_CAUSE = "no acceptance stamped \u2014 floor is empty in this project";
10
10
  export declare const EMPTY_AC_REMEDY = "stamp plan.acceptance via clause derivation (scope:activate / scope:promote runs #3323, or task issue:ingest)";
11
- export type VerifyAcResolution = "verified-pass" | "empty-pass" | "soft_empty" | "fail" | "config" | "skipped";
11
+ export declare const TRANSCRIPT_EMPTY_CAUSE = "transcript skip left zero captured commands";
12
+ export declare const TRANSCRIPT_EMPTY_REMEDY = "stamp real acceptance commands; suite-floor empty-pass does not apply when a transcript fence dropped prompt lines (#3511)";
13
+ export type VerifyAcResolution = "verified-pass" | "empty-pass" | "soft_empty" | "fail" | "config" | "skipped" | "rejected-noop";
12
14
  /** True when this project check composition includes a suite gate (#3188). */
13
15
  export declare function projectHasSuiteFloor(projectRoot: string): boolean;
14
16
  export declare function isSoftEmptyAcText(text: string): boolean;
@@ -23,4 +25,5 @@ export interface EmptyAcResolutionInput {
23
25
  /** Zero executable commands, no rejected/unpromoted ledger, not already classified. */
24
26
  export declare function isEmptyAcResolution(input: EmptyAcResolutionInput): boolean;
25
27
  export declare function formatSoftEmptyMessage(acceptance: PlanAcceptance, quiet?: boolean): string;
28
+ export declare function formatTranscriptEmptyMessage(acceptance: PlanAcceptance, quiet?: boolean): string;
26
29
  //# sourceMappingURL=empty-resolution.d.ts.map
@@ -8,6 +8,8 @@ import { isFrameworkRepoRoot } from "../check/context.js";
8
8
  export const EMPTY_AC_OUTCOME = "soft_empty";
9
9
  export const EMPTY_AC_CAUSE = "no acceptance stamped — floor is empty in this project";
10
10
  export const EMPTY_AC_REMEDY = "stamp plan.acceptance via clause derivation (scope:activate / scope:promote runs #3323, or task issue:ingest)";
11
+ export const TRANSCRIPT_EMPTY_CAUSE = "transcript skip left zero captured commands";
12
+ export const TRANSCRIPT_EMPTY_REMEDY = "stamp real acceptance commands; suite-floor empty-pass does not apply when a transcript fence dropped prompt lines (#3511)";
11
13
  /** True when this project check composition includes a suite gate (#3188). */
12
14
  export function projectHasSuiteFloor(projectRoot) {
13
15
  return isFrameworkRepoRoot(projectRoot);
@@ -17,7 +19,9 @@ export function isSoftEmptyAcText(text) {
17
19
  }
18
20
  /** Zero executable commands, no rejected/unpromoted ledger, not already classified. */
19
21
  export function isEmptyAcResolution(input) {
20
- if (input.resolution === "config" || input.resolution === "skipped") {
22
+ if (input.resolution === "config" ||
23
+ input.resolution === "skipped" ||
24
+ input.resolution === "rejected-noop") {
21
25
  return false;
22
26
  }
23
27
  if (input.code === 2) {
@@ -35,4 +39,11 @@ export function formatSoftEmptyMessage(acceptance, quiet) {
35
39
  return (`verify:ac ${EMPTY_AC_OUTCOME} (#3334) [rung=${acceptance.source_rung}]: ` +
36
40
  `${EMPTY_AC_CAUSE}. ${EMPTY_AC_REMEDY}.`);
37
41
  }
42
+ export function formatTranscriptEmptyMessage(acceptance, quiet) {
43
+ if (quiet) {
44
+ return "";
45
+ }
46
+ return (`verify:ac FAILED (#3511) [rung=${acceptance.source_rung}]: ` +
47
+ `${TRANSCRIPT_EMPTY_CAUSE}. ${TRANSCRIPT_EMPTY_REMEDY}.`);
48
+ }
38
49
  //# sourceMappingURL=empty-resolution.js.map
@@ -9,6 +9,7 @@
9
9
  */
10
10
  import { type EvaluateLiteralAcceptanceOptions, type LiteralAcceptanceGateResult } from "../literal-acceptance/index.js";
11
11
  import { type AcceptanceRunSummaryOutcome } from "../run-summary/index.js";
12
+ import { type AcServedFrom } from "../session/verify-ac-session-cache.js";
12
13
  import { type ClauseWalkResult } from "../verify-ac/clauses.js";
13
14
  import { type VerifyAcResolution } from "./empty-resolution.js";
14
15
  import type { AcSourceRung, PlanAcceptance } from "./types.js";
@@ -20,6 +21,12 @@ export interface VerifyAcResult extends LiteralAcceptanceGateResult {
20
21
  readonly resolvedCommandCount: number;
21
22
  readonly clauseOutcomes?: readonly ClauseWalkResult[];
22
23
  readonly clauseWalked?: boolean;
24
+ /** How the result was obtained (#3387). */
25
+ readonly servedFrom?: AcServedFrom;
26
+ /** Config-error cause when resolution is config (#3559). */
27
+ readonly cause?: string;
28
+ /** Reuse-gate miss cause when servedFrom is executed (#3558). */
29
+ readonly missReason?: string;
23
30
  }
24
31
  export interface EvaluateVerifyAcOptions extends EvaluateLiteralAcceptanceOptions {
25
32
  /**
@@ -74,6 +81,15 @@ export interface EvaluateVerifyAcOptions extends EvaluateLiteralAcceptanceOption
74
81
  * under one session must not share a single global `verify:ac` check id.
75
82
  */
76
83
  readonly oracleScopeKey?: string | null;
84
+ /**
85
+ * Reuse a matching #3285 bank / same-session cache (#3387).
86
+ * - auto (default): cache then bank
87
+ * - bank: complete walk — bank only
88
+ * - never: always execute
89
+ */
90
+ readonly reuseMode?: "auto" | "bank" | "never";
91
+ readonly sessionId?: string | null;
92
+ readonly productPaths?: readonly string[];
77
93
  }
78
94
  /**
79
95
  * Evaluate product AC from an in-memory plan.