@deftai/directive-core 0.106.0 → 0.108.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 (249) hide show
  1. package/dist/architecture/sor-preflight.js +2 -0
  2. package/dist/check/cached-orchestrator.js +28 -3
  3. package/dist/check/gate-lists.js +2 -0
  4. package/dist/check/named-cause.js +18 -3
  5. package/dist/codebase/provider.js +7 -1
  6. package/dist/delivery-attempt/handoff.js +1 -1
  7. package/dist/design-critique/citation-grammar.d.ts +53 -0
  8. package/dist/design-critique/citation-grammar.js +303 -0
  9. package/dist/design-critique/completed-arc-record.d.ts +62 -0
  10. package/dist/design-critique/completed-arc-record.js +232 -0
  11. package/dist/design-critique/exclusive-chip.d.ts +33 -0
  12. package/dist/design-critique/exclusive-chip.js +68 -0
  13. package/dist/design-critique/parent-audit.d.ts +59 -0
  14. package/dist/design-critique/parent-audit.js +121 -0
  15. package/dist/doctor/checks.d.ts +6 -0
  16. package/dist/doctor/checks.js +35 -0
  17. package/dist/freshness/bind.d.ts +32 -3
  18. package/dist/freshness/bind.js +58 -12
  19. package/dist/hooks/classify/host-session-identity.d.ts +76 -0
  20. package/dist/hooks/classify/host-session-identity.js +470 -0
  21. package/dist/hooks/classify/index.d.ts +3 -2
  22. package/dist/hooks/classify/index.js +3 -2
  23. package/dist/hooks/classify/paths.d.ts +7 -0
  24. package/dist/hooks/classify/paths.js +35 -0
  25. package/dist/hooks/classify/stdin.d.ts +5 -0
  26. package/dist/hooks/classify/stdin.js +27 -0
  27. package/dist/hooks/dest-form.d.ts +46 -0
  28. package/dist/hooks/dest-form.js +575 -0
  29. package/dist/hooks/dispatcher.d.ts +69 -2
  30. package/dist/hooks/dispatcher.js +609 -45
  31. package/dist/hooks/fixtures/cases.d.ts +16 -2
  32. package/dist/hooks/fixtures/cases.js +175 -0
  33. package/dist/hooks/index.d.ts +1 -0
  34. package/dist/hooks/index.js +1 -0
  35. package/dist/hooks/scope.js +3 -1
  36. package/dist/init-deposit/agent-hooks.d.ts +2 -1
  37. package/dist/init-deposit/agent-hooks.js +8 -1
  38. package/dist/init-deposit/hook-runtime-travel.d.ts +77 -0
  39. package/dist/init-deposit/hook-runtime-travel.js +269 -0
  40. package/dist/intake/clause-derivation.js +9 -3
  41. package/dist/intake/github-auth-modes-cli.js +14 -2
  42. package/dist/intake/github-auth-modes.d.ts +54 -9
  43. package/dist/intake/github-auth-modes.js +326 -123
  44. package/dist/intake/issue-ingest.js +62 -2
  45. package/dist/intake/platform-capabilities.d.ts +9 -2
  46. package/dist/intake/platform-capabilities.js +38 -9
  47. package/dist/lifecycle/completed-tracked-on-delivery.d.ts +26 -0
  48. package/dist/lifecycle/completed-tracked-on-delivery.js +37 -14
  49. package/dist/lifecycle/completed-write-guard.d.ts +48 -0
  50. package/dist/lifecycle/completed-write-guard.js +373 -0
  51. package/dist/lifecycle/index.d.ts +1 -0
  52. package/dist/lifecycle/index.js +1 -0
  53. package/dist/literal-acceptance/capture.d.ts +16 -0
  54. package/dist/literal-acceptance/capture.js +75 -7
  55. package/dist/literal-acceptance/evaluate.js +25 -3
  56. package/dist/literal-acceptance/index.d.ts +2 -2
  57. package/dist/literal-acceptance/index.js +2 -2
  58. package/dist/literal-acceptance/run.js +9 -3
  59. package/dist/literal-acceptance/types.d.ts +6 -0
  60. package/dist/literal-acceptance/types.js +6 -0
  61. package/dist/orphan-active/evaluate.d.ts +25 -0
  62. package/dist/orphan-active/evaluate.js +193 -128
  63. package/dist/orphan-active/index.d.ts +1 -0
  64. package/dist/orphan-active/index.js +1 -0
  65. package/dist/orphan-active/issue-state.d.ts +121 -0
  66. package/dist/orphan-active/issue-state.js +278 -0
  67. package/dist/platform/cursor-managed-runtime.d.ts +95 -0
  68. package/dist/platform/cursor-managed-runtime.js +241 -0
  69. package/dist/platform/index.d.ts +1 -0
  70. package/dist/platform/index.js +1 -0
  71. package/dist/platform/platform-capabilities.d.ts +23 -1
  72. package/dist/platform/platform-capabilities.js +55 -15
  73. package/dist/policy/ceremony-dial.js +5 -9
  74. package/dist/policy/host-hooks.js +4 -9
  75. package/dist/policy/org-force-on-migration.js +5 -10
  76. package/dist/policy/plan-extensions.d.ts +14 -2
  77. package/dist/policy/plan-extensions.js +24 -3
  78. package/dist/policy/product-signal.js +5 -10
  79. package/dist/policy/require-human-merge.js +5 -9
  80. package/dist/policy/resolve.js +77 -16
  81. package/dist/policy/runtime-authority.d.ts +18 -0
  82. package/dist/policy/runtime-authority.js +11 -0
  83. package/dist/policy/value-feedback.js +9 -18
  84. package/dist/policy/write-fence.js +3 -0
  85. package/dist/pr-closeout-attestable/evaluate.d.ts +80 -0
  86. package/dist/pr-closeout-attestable/evaluate.js +306 -0
  87. package/dist/pr-closeout-attestable/index.d.ts +2 -0
  88. package/dist/pr-closeout-attestable/index.js +2 -0
  89. package/dist/pr-protected-issues/gh.d.ts +6 -2
  90. package/dist/pr-protected-issues/gh.js +7 -3
  91. package/dist/pr-wait-mergeable/cascade.d.ts +9 -1
  92. package/dist/pr-wait-mergeable/cascade.js +21 -1
  93. package/dist/pr-wait-mergeable/types.d.ts +2 -0
  94. package/dist/pr-wait-mergeable/wrappers.d.ts +6 -0
  95. package/dist/pr-wait-mergeable/wrappers.js +11 -0
  96. package/dist/preflight/evaluate.d.ts +15 -0
  97. package/dist/preflight/evaluate.js +29 -3
  98. package/dist/preflight-cache/evaluate.js +9 -3
  99. package/dist/product-first-done-gate/acceptance-resolver.d.ts +14 -2
  100. package/dist/product-first-done-gate/acceptance-resolver.js +13 -2
  101. package/dist/product-first-done-gate/evaluate.js +53 -12
  102. package/dist/release/cli-drift-report.d.ts +68 -0
  103. package/dist/release/cli-drift-report.js +189 -0
  104. package/dist/release/index.d.ts +1 -0
  105. package/dist/release/index.js +1 -0
  106. package/dist/release/issue-state-fetch.d.ts +5 -3
  107. package/dist/release/issue-state-fetch.js +86 -21
  108. package/dist/release/native-steps.js +1 -0
  109. package/dist/release/pipeline.js +19 -0
  110. package/dist/release/types.d.ts +14 -0
  111. package/dist/render/constants.d.ts +4 -0
  112. package/dist/render/constants.js +11 -8
  113. package/dist/render/export-spec.js +31 -5
  114. package/dist/render/index.d.ts +1 -1
  115. package/dist/render/index.js +1 -1
  116. package/dist/render/prd-render.d.ts +4 -1
  117. package/dist/render/prd-render.js +82 -23
  118. package/dist/render/project-render.js +14 -7
  119. package/dist/render/scope-outlook.d.ts +2 -0
  120. package/dist/render/scope-outlook.js +3 -0
  121. package/dist/render/spec-render.js +2 -2
  122. package/dist/resolution/package-manager.d.ts +33 -4
  123. package/dist/resolution/package-manager.js +210 -9
  124. package/dist/review-monitor/constants.d.ts +7 -0
  125. package/dist/review-monitor/constants.js +7 -0
  126. package/dist/review-monitor/github-lease.d.ts +98 -1
  127. package/dist/review-monitor/github-lease.js +182 -1
  128. package/dist/review-monitor/lease-comment.d.ts +36 -0
  129. package/dist/review-monitor/lease-comment.js +103 -2
  130. package/dist/scm/call.js +12 -3
  131. package/dist/scm/design-critique-chip.d.ts +38 -0
  132. package/dist/scm/design-critique-chip.js +187 -0
  133. package/dist/scm/gh-rest.d.ts +9 -1
  134. package/dist/scm/gh-rest.js +103 -0
  135. package/dist/scm/index.d.ts +1 -0
  136. package/dist/scm/index.js +1 -0
  137. package/dist/scm/main.d.ts +3 -0
  138. package/dist/scm/main.js +15 -1
  139. package/dist/scm/readiness-cli.d.ts +2 -0
  140. package/dist/scm/readiness-cli.js +42 -1
  141. package/dist/scm/readiness.d.ts +4 -1
  142. package/dist/scm/readiness.js +35 -5
  143. package/dist/scope/decompose.js +2 -1
  144. package/dist/scope/delivery-evidence.d.ts +27 -1
  145. package/dist/scope/index.d.ts +1 -0
  146. package/dist/scope/index.js +1 -0
  147. package/dist/scope/lifecycle-write.d.ts +24 -0
  148. package/dist/scope/lifecycle-write.js +64 -0
  149. package/dist/scope/main.js +3 -1
  150. package/dist/scope/project-definition-sync.js +14 -7
  151. package/dist/scope/transition.js +90 -11
  152. package/dist/scope-provenance/evaluate.js +5 -1
  153. package/dist/session/git.d.ts +42 -0
  154. package/dist/session/git.js +219 -3
  155. package/dist/session/occupancy.d.ts +239 -12
  156. package/dist/session/occupancy.js +820 -27
  157. package/dist/session/ritual-sentinel.d.ts +5 -0
  158. package/dist/session/ritual-sentinel.js +5 -0
  159. package/dist/session/session-ready.d.ts +5 -1
  160. package/dist/session/session-ready.js +98 -8
  161. package/dist/session/session-start.d.ts +17 -1
  162. package/dist/session/session-start.js +49 -17
  163. package/dist/session/toolchain-preflight.d.ts +13 -3
  164. package/dist/session/toolchain-preflight.js +93 -18
  165. package/dist/session/verify-session-ritual.d.ts +33 -3
  166. package/dist/session/verify-session-ritual.js +89 -19
  167. package/dist/slice/constants.d.ts +1 -1
  168. package/dist/spec-authority/constants.d.ts +10 -2
  169. package/dist/spec-authority/constants.js +53 -8
  170. package/dist/spec-authority/resolver.d.ts +3 -0
  171. package/dist/spec-authority/resolver.js +55 -7
  172. package/dist/subprocess/max-buffer.d.ts +14 -0
  173. package/dist/subprocess/max-buffer.js +15 -0
  174. package/dist/swarm/complete-cohort.d.ts +2 -0
  175. package/dist/swarm/complete-cohort.js +21 -13
  176. package/dist/swarm/index.d.ts +1 -0
  177. package/dist/swarm/index.js +1 -0
  178. package/dist/swarm/launch-cli.js +53 -33
  179. package/dist/swarm/launch.d.ts +77 -0
  180. package/dist/swarm/launch.js +248 -38
  181. package/dist/swarm/pre-dispatch-cli.js +2 -1
  182. package/dist/swarm/pre-dispatch.js +10 -1
  183. package/dist/swarm/subagent-status-dir.d.ts +27 -0
  184. package/dist/swarm/subagent-status-dir.js +42 -0
  185. package/dist/swarm/worktrees.d.ts +17 -3
  186. package/dist/swarm/worktrees.js +48 -4
  187. package/dist/triage/actions/index.d.ts +4 -0
  188. package/dist/triage/actions/index.js +6 -0
  189. package/dist/triage/evaluate/evaluate.d.ts +11 -0
  190. package/dist/triage/evaluate/evaluate.js +169 -0
  191. package/dist/triage/evaluate/github.d.ts +16 -0
  192. package/dist/triage/evaluate/github.js +153 -0
  193. package/dist/triage/evaluate/index.d.ts +9 -0
  194. package/dist/triage/evaluate/index.js +8 -0
  195. package/dist/triage/evaluate/paths.d.ts +7 -0
  196. package/dist/triage/evaluate/paths.js +25 -0
  197. package/dist/triage/evaluate/sink.d.ts +5 -0
  198. package/dist/triage/evaluate/sink.js +52 -0
  199. package/dist/triage/evaluate/types.d.ts +93 -0
  200. package/dist/triage/evaluate/types.js +13 -0
  201. package/dist/triage/evaluate/validity.d.ts +8 -0
  202. package/dist/triage/evaluate/validity.js +87 -0
  203. package/dist/triage/evaluate/value.d.ts +12 -0
  204. package/dist/triage/evaluate/value.js +33 -0
  205. package/dist/triage/evaluate/wip-census.d.ts +5 -0
  206. package/dist/triage/evaluate/wip-census.js +39 -0
  207. package/dist/triage/evaluate/worktrees.d.ts +8 -0
  208. package/dist/triage/evaluate/worktrees.js +68 -0
  209. package/dist/triage/evaluate/xbrief-refs.d.ts +8 -0
  210. package/dist/triage/evaluate/xbrief-refs.js +60 -0
  211. package/dist/triage/help/registry-data.d.ts +21 -7
  212. package/dist/triage/help/registry-data.js +53 -5
  213. package/dist/triage/index.d.ts +1 -0
  214. package/dist/triage/index.js +1 -0
  215. package/dist/triage/scope/mutations-core.d.ts +2 -6
  216. package/dist/triage/scope/mutations-core.js +23 -55
  217. package/dist/triage/scope-drift/add-ignore.js +5 -39
  218. package/dist/triage/subscribe/index.d.ts +2 -6
  219. package/dist/triage/subscribe/index.js +15 -65
  220. package/dist/triage/welcome/writers.js +15 -74
  221. package/dist/value/feedback-file.d.ts +17 -2
  222. package/dist/value/feedback-file.js +80 -6
  223. package/dist/vbrief-build/index.d.ts +2 -1
  224. package/dist/vbrief-build/index.js +2 -1
  225. package/dist/vbrief-build/parity-scenarios.js +5 -5
  226. package/dist/vbrief-build/project-definition-io.d.ts +63 -3
  227. package/dist/vbrief-build/project-definition-io.js +357 -31
  228. package/dist/vbrief-build/project-definition-mutation.d.ts +32 -0
  229. package/dist/vbrief-build/project-definition-mutation.js +43 -0
  230. package/dist/vbrief-reconcile/labels.d.ts +1 -0
  231. package/dist/vbrief-reconcile/labels.js +30 -0
  232. package/dist/vbrief-validate/conformance.d.ts +1 -0
  233. package/dist/vbrief-validate/conformance.js +85 -8
  234. package/dist/vbrief-validate/main.js +2 -0
  235. package/dist/vbrief-validate/precutover.js +5 -10
  236. package/dist/vbrief-validation/story-quality.d.ts +7 -0
  237. package/dist/vbrief-validation/story-quality.js +8 -1
  238. package/dist/verify-ac/clauses.d.ts +62 -2
  239. package/dist/verify-ac/clauses.js +183 -111
  240. package/dist/verify-ac/index.d.ts +1 -1
  241. package/dist/verify-ac/index.js +1 -1
  242. package/dist/verify-env/node-runtime.d.ts +8 -4
  243. package/dist/verify-env/node-runtime.js +9 -6
  244. package/dist/verify-env/toolchain-check.d.ts +35 -3
  245. package/dist/verify-env/toolchain-check.js +155 -36
  246. package/dist/verify-source/project-definition-mutation-boundary.d.ts +104 -0
  247. package/dist/verify-source/project-definition-mutation-boundary.js +326 -0
  248. package/dist/xbrief-migrate/agents-header.js +69 -7
  249. package/package.json +7 -3
@@ -9,7 +9,7 @@
9
9
  * so distinct execution contexts are not collapsed.
10
10
  */
11
11
  import { evaluateCommandSafety } from "./safety.js";
12
- import { EXECUTABLE_LITERAL_SOURCES, LITERAL_ACCEPTANCE_REJECTED_METADATA_KEY } from "./types.js";
12
+ import { EXECUTABLE_LITERAL_SOURCES, LITERAL_ACCEPTANCE_NOT_COMMANDS_METADATA_KEY, LITERAL_ACCEPTANCE_REJECTED_METADATA_KEY, } from "./types.js";
13
13
  /** Labeled keywords (single-token, linear match). */
14
14
  const LABELED_KEYWORDS = new Set(["verify", "command", "run", "check", "exec", "shell"]);
15
15
  /** Words that look like a CLI invocation start (not prose). */
@@ -85,8 +85,24 @@ function pushCommand(buckets, cmd) {
85
85
  return;
86
86
  }
87
87
  const key = commandDedupeKey(cmd);
88
- if (buckets.seen.has(key))
88
+ if (buckets.seen.has(key)) {
89
+ const idx = buckets.out.findIndex((row) => commandDedupeKey(row) === key);
90
+ const existing = idx >= 0 ? buckets.out[idx] : undefined;
91
+ if (existing !== undefined &&
92
+ idx >= 0 &&
93
+ isInlineProseMention(existing) &&
94
+ isExecutableSource(cmd.source)) {
95
+ buckets.out[idx] = {
96
+ command: cmd.command,
97
+ cwd: cmd.cwd ?? null,
98
+ expectedStdout: cmd.expectedStdout ?? null,
99
+ expectedExitCode: cmd.expectedExitCode ?? 0,
100
+ source: cmd.source,
101
+ sourceSpan: cmd.sourceSpan ?? null,
102
+ };
103
+ }
89
104
  return;
105
+ }
90
106
  buckets.seen.add(key);
91
107
  buckets.out.push({
92
108
  command: cmd.command,
@@ -382,8 +398,9 @@ function matchMarkdownHeading(line) {
382
398
  * marker). Mid-line label capture is deliberately not attempted (#3484): a
383
399
  * `verify:<verb>` token inside ordinary prose has no terminator, so the capture
384
400
  * swallowed the rest of the paragraph and the phantom then blocked completion on
385
- * the safety ledger. Commands stated mid-sentence must live in a fence, a `$`
386
- * prompt, or an inline backtick span all of which have real delimiters.
401
+ * the safety ledger. Commands stated mid-sentence must live in a fence or a `$`
402
+ * prompt. An inline backtick inside a prose sentence is a reference, not a
403
+ * stated command (#3721).
387
404
  */
388
405
  function extractFromLabeledLines(text, buckets) {
389
406
  const lines = text.split(/\r?\n/);
@@ -412,9 +429,13 @@ function extractFromLabeledLines(text, buckets) {
412
429
  }
413
430
  }
414
431
  }
432
+ /** Reason stamped when an inline backtick is recorded as a mention, not AC (#3721). */
433
+ export const INLINE_PROSE_MENTION_REASON = "inline backtick in prose is a mention, not a stated acceptance command (#3721)";
415
434
  /**
416
435
  * Extract inline `` `command` `` spans that follow verify/run language on the same line.
417
- * Example: `run \`task check\` before done`
436
+ * These are references, not stated acceptance commands (#3721). Recorded on the
437
+ * rejected ledger with an `inline@` span so #3511 demotes them to advisory.
438
+ * They must not enter the stated-command list (that would require promotion).
418
439
  */
419
440
  function extractInlineVerifySpans(text, buckets) {
420
441
  const lines = text.split(/\r?\n/);
@@ -440,10 +461,23 @@ function extractInlineVerifySpans(text, buckets) {
440
461
  const normalized = normalizeCommand(inner);
441
462
  if (normalized === null || !looksLikeShellCommand(normalized))
442
463
  continue;
443
- pushUnique(buckets, normalized, "task_statement", `inline@L${i + 1}`);
464
+ recordRejected(buckets, normalized, INLINE_PROSE_MENTION_REASON, `inline@L${i + 1}`);
444
465
  }
445
466
  }
446
467
  }
468
+ /**
469
+ * True when a capture-only row came from an inline backtick in prose (#3721).
470
+ * Those mentions are not stated acceptance commands. Labeled, prompt, and fence
471
+ * spans stay stated.
472
+ */
473
+ export function isInlineProseMention(cmd) {
474
+ if (cmd.source !== "task_statement")
475
+ return false;
476
+ const span = cmd.sourceSpan;
477
+ if (span === null || span === undefined)
478
+ return false;
479
+ return span.startsWith("inline@");
480
+ }
447
481
  function emptyBuckets() {
448
482
  return {
449
483
  out: [],
@@ -519,7 +553,7 @@ export function readStoredLiteralAcceptanceDetailed(plan) {
519
553
  // swarm.verify_commands is a string list (legacy). Prefer richer
520
554
  // literal_acceptance_commands rows already loaded — do not invent a
521
555
  // null-cwd duplicate for the same command text.
522
- const alreadyHasCommand = (command) => buckets.out.some((c) => c.command === command);
556
+ const alreadyHasCommand = (command) => buckets.out.some((c) => c.command === command && !isInlineProseMention(c));
523
557
  for (const cmd of coerceCommandList(swarm.verify_commands, "verify_commands", "swarm.verify_commands")) {
524
558
  if (alreadyHasCommand(cmd.command))
525
559
  continue;
@@ -793,6 +827,40 @@ export function hasStructuredAcceptanceCommands(plan) {
793
827
  return false;
794
828
  return hasNonEmptyCommandList(swarm.verify_commands);
795
829
  }
830
+ /**
831
+ * Command strings the operator recorded as not acceptance commands (#3721).
832
+ * Listing a string here dispositions a capture without asserting it is AC.
833
+ */
834
+ export function readNotAcceptanceCommands(plan) {
835
+ const rec = asRecord(plan);
836
+ if (rec === null)
837
+ return new Set();
838
+ const metadata = asRecord(rec.metadata);
839
+ if (metadata === null)
840
+ return new Set();
841
+ const raw = metadata[LITERAL_ACCEPTANCE_NOT_COMMANDS_METADATA_KEY] ??
842
+ metadata.literalAcceptanceNotCommands ??
843
+ null;
844
+ const out = new Set();
845
+ if (typeof raw === "string" && raw.trim().length > 0) {
846
+ out.add(raw.trim());
847
+ return out;
848
+ }
849
+ if (!Array.isArray(raw))
850
+ return out;
851
+ for (const entry of raw) {
852
+ if (typeof entry === "string" && entry.trim().length > 0) {
853
+ out.add(entry.trim());
854
+ continue;
855
+ }
856
+ const row = asRecord(entry);
857
+ if (row === null)
858
+ continue;
859
+ if (isNonEmptyString(row.command))
860
+ out.add(row.command.trim());
861
+ }
862
+ return out;
863
+ }
796
864
  /** Format rejected ledger for CLI / complete-gate messages. */
797
865
  export function formatRejectedLedger(rejected) {
798
866
  if (rejected.length === 0)
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { existsSync, readFileSync } from "node:fs";
5
5
  import { resolve } from "node:path";
6
- import { captureLiteralAcceptanceCommandsDetailed, formatRejectedLedger, isProseDerivedRejection, readStoredLiteralAcceptanceDetailed, } from "./capture.js";
6
+ import { captureLiteralAcceptanceCommandsDetailed, formatRejectedLedger, INLINE_PROSE_MENTION_REASON, isInlineProseMention, isProseDerivedRejection, readNotAcceptanceCommands, readStoredLiteralAcceptanceDetailed, } from "./capture.js";
7
7
  import { runLiteralAcceptanceCommands } from "./run.js";
8
8
  function asRecord(value) {
9
9
  if (typeof value === "object" && value !== null && !Array.isArray(value)) {
@@ -40,11 +40,33 @@ function partitionRejected(rejected) {
40
40
  */
41
41
  export function resolveLiteralAcceptanceDetailed(plan, options = {}) {
42
42
  const raw = resolveRawLiteralAcceptance(plan, options);
43
+ const notCommands = readNotAcceptanceCommands(plan);
44
+ const stated = [];
45
+ const mentionAdvisory = [];
46
+ for (const c of raw.commands) {
47
+ if (isInlineProseMention(c)) {
48
+ mentionAdvisory.push({
49
+ command: c.command,
50
+ reason: INLINE_PROSE_MENTION_REASON,
51
+ sourceSpan: c.sourceSpan ?? null,
52
+ });
53
+ continue;
54
+ }
55
+ if (c.source === "task_statement" && notCommands.has(c.command)) {
56
+ mentionAdvisory.push({
57
+ command: c.command,
58
+ reason: "operator recorded this capture as not an acceptance command (#3721)",
59
+ sourceSpan: c.sourceSpan ?? null,
60
+ });
61
+ continue;
62
+ }
63
+ stated.push(c);
64
+ }
43
65
  const split = partitionRejected(raw.rejected);
44
66
  return {
45
- commands: raw.commands,
67
+ commands: stated,
46
68
  rejected: split.blocking,
47
- advisoryRejected: split.advisory,
69
+ advisoryRejected: [...split.advisory, ...mentionAdvisory],
48
70
  transcriptPromptSkipped: raw.transcriptPromptSkipped,
49
71
  };
50
72
  }
@@ -4,9 +4,9 @@
4
4
  * Capture exact stated shell commands at intake; run them verbatim before done.
5
5
  * Extends #973; survives ceremony dial rapid/minimal (#3214).
6
6
  */
7
- export { attachLiteralAcceptanceCommands, type CaptureLiteralAcceptanceResult, captureAndAttachLiteralAcceptance, captureLiteralAcceptanceCommands, captureLiteralAcceptanceCommandsDetailed, formatRejectedLedger, hasStructuredAcceptanceCommands, isProseDerivedRejection, readStoredLiteralAcceptanceCommands, readStoredLiteralAcceptanceDetailed, } from "./capture.js";
7
+ export { attachLiteralAcceptanceCommands, type CaptureLiteralAcceptanceResult, captureAndAttachLiteralAcceptance, captureLiteralAcceptanceCommands, captureLiteralAcceptanceCommandsDetailed, formatRejectedLedger, hasStructuredAcceptanceCommands, INLINE_PROSE_MENTION_REASON, isInlineProseMention, isProseDerivedRejection, readNotAcceptanceCommands, readStoredLiteralAcceptanceCommands, readStoredLiteralAcceptanceDetailed, } from "./capture.js";
8
8
  export { appendLiteralAcceptanceAdvisory, type EvaluateLiteralAcceptanceOptions, evaluateLiteralAcceptanceFromPath, evaluateLiteralAcceptanceFromPlan, formatLiteralAcceptanceAdvisory, isLiteralAcceptanceRequiredAtCeremonyDepth, LITERAL_ACCEPTANCE_ADVISORY_MARKER, type ResolvedLiteralAcceptance, resolveLiteralAcceptanceCommands, resolveLiteralAcceptanceDetailed, stripLiteralAcceptanceAdvisory, } from "./evaluate.js";
9
9
  export { defaultLiteralAcceptanceRunner, runLiteralAcceptanceCommand, runLiteralAcceptanceCommands, } from "./run.js";
10
10
  export { type CommandSafetyResult, evaluateCommandSafety, evaluateNoopDenylist, evaluateStampAcceptanceSafety, isExecutableLiteralSource, isNoopRefusalReason, isVerbatimStatementSpan, NOOP_ACCEPTANCE_REMEDIATION, REJECTED_NOOP_OUTCOME, type RejectedNoopOutcome, type StampAcceptanceCommand, type StampAcceptanceSafetyInput, type StampAcceptanceSafetyResult, type StampSourceRung, } from "./safety.js";
11
- export { EXECUTABLE_LITERAL_SOURCES, LITERAL_ACCEPTANCE_METADATA_KEY, LITERAL_ACCEPTANCE_METADATA_KEY_CAMEL, LITERAL_ACCEPTANCE_REJECTED_METADATA_KEY, type LiteralAcceptanceCommand, type LiteralAcceptanceGateResult, type LiteralAcceptanceRunner, type LiteralAcceptanceRunResult, type LiteralAcceptanceSource, type RejectedLiteralCommand, } from "./types.js";
11
+ export { EXECUTABLE_LITERAL_SOURCES, LITERAL_ACCEPTANCE_METADATA_KEY, LITERAL_ACCEPTANCE_METADATA_KEY_CAMEL, LITERAL_ACCEPTANCE_NOT_COMMANDS_METADATA_KEY, LITERAL_ACCEPTANCE_REJECTED_METADATA_KEY, type LiteralAcceptanceCommand, type LiteralAcceptanceGateResult, type LiteralAcceptanceRunner, type LiteralAcceptanceRunResult, type LiteralAcceptanceSource, type RejectedLiteralCommand, } from "./types.js";
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -4,9 +4,9 @@
4
4
  * Capture exact stated shell commands at intake; run them verbatim before done.
5
5
  * Extends #973; survives ceremony dial rapid/minimal (#3214).
6
6
  */
7
- export { attachLiteralAcceptanceCommands, captureAndAttachLiteralAcceptance, captureLiteralAcceptanceCommands, captureLiteralAcceptanceCommandsDetailed, formatRejectedLedger, hasStructuredAcceptanceCommands, isProseDerivedRejection, readStoredLiteralAcceptanceCommands, readStoredLiteralAcceptanceDetailed, } from "./capture.js";
7
+ export { attachLiteralAcceptanceCommands, captureAndAttachLiteralAcceptance, captureLiteralAcceptanceCommands, captureLiteralAcceptanceCommandsDetailed, formatRejectedLedger, hasStructuredAcceptanceCommands, INLINE_PROSE_MENTION_REASON, isInlineProseMention, isProseDerivedRejection, readNotAcceptanceCommands, readStoredLiteralAcceptanceCommands, readStoredLiteralAcceptanceDetailed, } from "./capture.js";
8
8
  export { appendLiteralAcceptanceAdvisory, evaluateLiteralAcceptanceFromPath, evaluateLiteralAcceptanceFromPlan, formatLiteralAcceptanceAdvisory, isLiteralAcceptanceRequiredAtCeremonyDepth, LITERAL_ACCEPTANCE_ADVISORY_MARKER, resolveLiteralAcceptanceCommands, resolveLiteralAcceptanceDetailed, stripLiteralAcceptanceAdvisory, } from "./evaluate.js";
9
9
  export { defaultLiteralAcceptanceRunner, runLiteralAcceptanceCommand, runLiteralAcceptanceCommands, } from "./run.js";
10
10
  export { evaluateCommandSafety, evaluateNoopDenylist, evaluateStampAcceptanceSafety, isExecutableLiteralSource, isNoopRefusalReason, isVerbatimStatementSpan, NOOP_ACCEPTANCE_REMEDIATION, REJECTED_NOOP_OUTCOME, } from "./safety.js";
11
- export { EXECUTABLE_LITERAL_SOURCES, LITERAL_ACCEPTANCE_METADATA_KEY, LITERAL_ACCEPTANCE_METADATA_KEY_CAMEL, LITERAL_ACCEPTANCE_REJECTED_METADATA_KEY, } from "./types.js";
11
+ export { EXECUTABLE_LITERAL_SOURCES, LITERAL_ACCEPTANCE_METADATA_KEY, LITERAL_ACCEPTANCE_METADATA_KEY_CAMEL, LITERAL_ACCEPTANCE_NOT_COMMANDS_METADATA_KEY, LITERAL_ACCEPTANCE_REJECTED_METADATA_KEY, } from "./types.js";
12
12
  //# sourceMappingURL=index.js.map
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import { spawnSync } from "node:child_process";
9
9
  import { isAbsolute, resolve } from "node:path";
10
+ import { isInlineProseMention } from "./capture.js";
10
11
  import { evaluateCommandSafety, isExecutableLiteralSource } from "./safety.js";
11
12
  /** Default shell runner: exact command string via platform shell. */
12
13
  export function defaultLiteralAcceptanceRunner(input) {
@@ -95,7 +96,9 @@ export function runLiteralAcceptanceCommands(commands, options) {
95
96
  runs: [],
96
97
  };
97
98
  }
98
- const untrusted = commands.filter((c) => c.source === "task_statement" && options.allowTaskStatement !== true);
99
+ const untrusted = commands.filter((c) => c.source === "task_statement" &&
100
+ options.allowTaskStatement !== true &&
101
+ !isInlineProseMention(c));
99
102
  const executable = commands.filter((c) => isExecutableLiteralSource(c.source) ||
100
103
  (c.source === "task_statement" && options.allowTaskStatement === true));
101
104
  // Fail closed: every capture-only stated command must have a matching agent-promoted
@@ -149,8 +152,11 @@ export function runLiteralAcceptanceCommands(commands, options) {
149
152
  code: 1,
150
153
  message: `Literal acceptance-command gate FAILED (#3267): ${unpromoted.length} stated command(s) ` +
151
154
  `are capture-only (source=task_statement) and have no matching agent-promoted peer.\n` +
152
- `Promote the exact command strings (and cwd/expectedStdout/expectedExitCode when stated) ` +
153
- `into plan.metadata.swarm.verify_commands (or plan item / explicit metadata), then re-run.\n` +
155
+ `If the command is this story's acceptance, promote the exact strings ` +
156
+ `(and cwd/expectedStdout/expectedExitCode when stated) into ` +
157
+ `plan.metadata.swarm.verify_commands (or plan item / explicit metadata), then re-run.\n` +
158
+ `If the capture is not an acceptance command, record the exact string in ` +
159
+ `plan.metadata.literal_acceptance_not_commands without promoting it (#3721).\n` +
154
160
  `Note: an unrelated executable peer or a same-text peer with different context does not waive.\n` +
155
161
  listed,
156
162
  commands,
@@ -74,6 +74,12 @@ export interface LiteralAcceptanceGateResult {
74
74
  }
75
75
  /** Metadata key for operator-visible rejected command ledger (#3267). */
76
76
  export declare const LITERAL_ACCEPTANCE_REJECTED_METADATA_KEY: "literal_acceptance_rejected";
77
+ /**
78
+ * Metadata key: command strings the operator recorded as *not* acceptance
79
+ * commands (#3721). Disposition without promotion — listing a string here does
80
+ * not assert it is the story's verification.
81
+ */
82
+ export declare const LITERAL_ACCEPTANCE_NOT_COMMANDS_METADATA_KEY: "literal_acceptance_not_commands";
77
83
  /** Injectable shell runner for tests (default: spawnSync shell). */
78
84
  export type LiteralAcceptanceRunner = (input: {
79
85
  readonly command: string;
@@ -19,6 +19,12 @@ export const EXECUTABLE_LITERAL_SOURCES = [
19
19
  ];
20
20
  /** Metadata key for operator-visible rejected command ledger (#3267). */
21
21
  export const LITERAL_ACCEPTANCE_REJECTED_METADATA_KEY = "literal_acceptance_rejected";
22
+ /**
23
+ * Metadata key: command strings the operator recorded as *not* acceptance
24
+ * commands (#3721). Disposition without promotion — listing a string here does
25
+ * not assert it is the story's verification.
26
+ */
27
+ export const LITERAL_ACCEPTANCE_NOT_COMMANDS_METADATA_KEY = "literal_acceptance_not_commands";
22
28
  /** Metadata key on plan.metadata for captured literal commands (#3267). */
23
29
  export const LITERAL_ACCEPTANCE_METADATA_KEY = "literal_acceptance_commands";
24
30
  /** Alternate camelCase key accepted on read. */
@@ -6,11 +6,28 @@ export interface OrphanActiveBrief {
6
6
  readonly reason: string;
7
7
  readonly kind: OrphanKind;
8
8
  }
9
+ /**
10
+ * How the run's issue-state verdicts were reached (#3767). A pass with
11
+ * `unverified > 0` is not evidence that the tree is clean.
12
+ */
13
+ export interface OrphanActiveBasis {
14
+ readonly inventory: number;
15
+ readonly live: number;
16
+ readonly cache: number;
17
+ readonly unverified: number;
18
+ /** Oldest cache entry that produced a verdict, in ms. */
19
+ readonly maxCacheAgeMs: number | null;
20
+ /** True when reads resolved through `ghx`, a cached GET proxy. */
21
+ readonly proxied: boolean;
22
+ readonly elapsedMs: number;
23
+ readonly budgetMs: number;
24
+ }
9
25
  export interface EvaluateResult {
10
26
  readonly code: 0 | 1 | 2;
11
27
  readonly message: string;
12
28
  readonly stream: OutputStream;
13
29
  readonly orphans: readonly OrphanActiveBrief[];
30
+ readonly basis: OrphanActiveBasis;
14
31
  }
15
32
  export interface EvaluateOptions {
16
33
  readonly quiet?: boolean;
@@ -19,6 +36,8 @@ export interface EvaluateOptions {
19
36
  readonly skipGh?: boolean;
20
37
  /** When set, scan only active/running briefs that reference this issue (#3429). */
21
38
  readonly issue?: number | null;
39
+ /** Monotonic clock seam so basis ages and budget checks are testable. */
40
+ readonly nowMs?: () => number;
22
41
  }
23
42
  /**
24
43
  * Pure evaluator for orphaned active/running xBRIEF detection (#2321 / #3429).
@@ -26,6 +45,12 @@ export interface EvaluateOptions {
26
45
  * issues and/or a merged PR — the stop-at:pr-open orphan signature.
27
46
  * Pass `issue` to scan one origin after merge. Confirmed shipped prints
28
47
  * scope:complete; unresolved lookup still exits 1 with a retry remediation.
48
+ *
49
+ * Issue state resolves by query shape (#3767): scoped `--issue N` takes an
50
+ * authoritative read and stays fail-closed on unknown; the unscoped sweep uses
51
+ * one complete, fail-closed open-issue inventory and stays fail-open on
52
+ * unknown so offline work is not network-authorized. A cache hit is honoured
53
+ * only inside `ISSUE_CACHE_MAX_AGE_MS`, and every verdict reports its basis.
29
54
  */
30
55
  export declare function evaluate(projectRoot: string, options?: EvaluateOptions): EvaluateResult;
31
56
  //# sourceMappingURL=evaluate.d.ts.map