@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.
- package/dist/authz/classify.js +1108 -67
- package/dist/check/cached-orchestrator.d.ts +1 -1
- package/dist/check/cached-orchestrator.js +2 -2
- package/dist/check/named-cause.d.ts +1 -1
- package/dist/check/named-cause.js +34 -4
- package/dist/codebase/default-extractor.d.ts +5 -0
- package/dist/codebase/default-extractor.js +7 -15
- package/dist/deposit/copy-tree.js +60 -0
- package/dist/deposit/python-free.js +26 -18
- package/dist/doctor/checks.d.ts +8 -0
- package/dist/doctor/checks.js +37 -25
- package/dist/doctor/doctor-state.d.ts +4 -0
- package/dist/doctor/doctor-state.js +7 -1
- package/dist/doctor/main.js +9 -19
- package/dist/doctor/types.d.ts +9 -0
- package/dist/forward-coverage/diff-coverage.d.ts +39 -0
- package/dist/forward-coverage/diff-coverage.js +112 -0
- package/dist/forward-coverage/diff-lines.d.ts +19 -0
- package/dist/forward-coverage/diff-lines.js +173 -0
- package/dist/forward-coverage/evaluate.d.ts +24 -9
- package/dist/forward-coverage/evaluate.js +125 -19
- package/dist/fs/contained-write.d.ts +115 -1
- package/dist/fs/contained-write.js +241 -5
- package/dist/fs/mutation-ledger.d.ts +54 -0
- package/dist/fs/mutation-ledger.js +133 -0
- package/dist/fs/non-product-dirs.d.ts +79 -0
- package/dist/fs/non-product-dirs.js +96 -0
- package/dist/hooks/dispatcher.d.ts +3 -1
- package/dist/hooks/dispatcher.js +14 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/init-deposit/agent-hooks.d.ts +1 -1
- package/dist/init-deposit/agent-hooks.js +18 -16
- package/dist/init-deposit/core-guard-pin-content.d.ts +7 -0
- package/dist/init-deposit/core-guard-pin-content.js +393 -0
- package/dist/init-deposit/gitignore.js +9 -0
- package/dist/init-deposit/hygiene.d.ts +47 -11
- package/dist/init-deposit/hygiene.js +172 -37
- package/dist/init-deposit/legacy-detect.js +6 -2
- package/dist/init-deposit/refresh.d.ts +21 -1
- package/dist/init-deposit/refresh.js +106 -9
- package/dist/init-deposit/scaffold.js +28 -279
- package/dist/init-deposit/slash-deposit.js +13 -7
- package/dist/init-deposit/xbrief-projections.d.ts +8 -1
- package/dist/init-deposit/xbrief-projections.js +24 -11
- package/dist/intake/clause-derivation.d.ts +47 -1
- package/dist/intake/clause-derivation.js +238 -9
- package/dist/intake/issue-ingest.d.ts +3 -1
- package/dist/intake/issue-ingest.js +35 -6
- package/dist/lifecycle/completed-tracked-on-delivery.d.ts +5 -0
- package/dist/lifecycle/completed-tracked-on-delivery.js +85 -18
- package/dist/lifecycle-visible/evaluate.d.ts +98 -0
- package/dist/lifecycle-visible/evaluate.js +710 -0
- package/dist/lifecycle-visible/index.d.ts +2 -0
- package/dist/lifecycle-visible/index.js +2 -0
- package/dist/literal-acceptance/capture.d.ts +10 -0
- package/dist/literal-acceptance/capture.js +226 -77
- package/dist/literal-acceptance/evaluate.d.ts +29 -4
- package/dist/literal-acceptance/evaluate.js +70 -2
- package/dist/literal-acceptance/index.d.ts +3 -3
- package/dist/literal-acceptance/index.js +3 -3
- package/dist/literal-acceptance/safety.d.ts +41 -0
- package/dist/literal-acceptance/safety.js +126 -2
- package/dist/literal-acceptance/types.d.ts +8 -0
- package/dist/orchestration/judgment-policy.d.ts +13 -0
- package/dist/orchestration/judgment-policy.js +15 -0
- package/dist/orchestration/probe-session.js +13 -8
- package/dist/orchestration/verify-judgment-gates.d.ts +4 -0
- package/dist/orchestration/verify-judgment-gates.js +43 -11
- package/dist/orphan-active/evaluate.d.ts +7 -1
- package/dist/orphan-active/evaluate.js +102 -23
- package/dist/platform/platform-capabilities.js +2 -3
- package/dist/policy/base-branch.d.ts +37 -0
- package/dist/policy/base-branch.js +114 -0
- package/dist/policy/branch-sync.d.ts +80 -0
- package/dist/policy/branch-sync.js +211 -0
- package/dist/policy/ceremony-dial-escalation.js +1 -0
- package/dist/policy/ceremony-dial.js +11 -21
- package/dist/policy/delivery-branch.d.ts +5 -3
- package/dist/policy/delivery-branch.js +7 -3
- package/dist/policy/file-size-thresholds.d.ts +24 -0
- package/dist/policy/file-size-thresholds.js +23 -0
- package/dist/policy/forge-outage-retry.d.ts +47 -0
- package/dist/policy/forge-outage-retry.js +157 -0
- package/dist/policy/host-hooks.d.ts +20 -0
- package/dist/policy/host-hooks.js +121 -2
- package/dist/policy/index.d.ts +7 -0
- package/dist/policy/index.js +66 -7
- package/dist/policy/org-force-on-migration.js +2 -1
- package/dist/policy/plan-extensions.d.ts +1 -1
- package/dist/policy/plan-extensions.js +2 -0
- package/dist/policy/product-signal.js +6 -7
- package/dist/policy/project-invariants.d.ts +50 -0
- package/dist/policy/project-invariants.js +205 -0
- package/dist/policy/require-human-merge.js +8 -6
- package/dist/policy/resolve.d.ts +7 -2
- package/dist/policy/resolve.js +25 -8
- package/dist/policy/sync-default.d.ts +129 -0
- package/dist/policy/sync-default.js +452 -0
- package/dist/policy/sync-max-files.d.ts +93 -0
- package/dist/policy/sync-max-files.js +192 -0
- package/dist/policy/value-feedback.js +7 -8
- package/dist/pr-monitor/absent-required.d.ts +11 -0
- package/dist/pr-monitor/absent-required.js +61 -0
- package/dist/pr-monitor/constants.d.ts +7 -0
- package/dist/pr-monitor/constants.js +7 -0
- package/dist/pr-monitor/index.d.ts +2 -1
- package/dist/pr-monitor/index.js +2 -1
- package/dist/pr-monitor/main.js +4 -0
- package/dist/pr-monitor/monitor.js +24 -1
- package/dist/pr-wait-mergeable/classify.js +6 -0
- package/dist/preflight/evaluate.d.ts +4 -0
- package/dist/preflight/evaluate.js +35 -1
- package/dist/preflight/index.d.ts +4 -0
- package/dist/preflight/index.js +2 -0
- package/dist/preflight/intended-placement.d.ts +62 -0
- package/dist/preflight/intended-placement.js +275 -0
- package/dist/preflight/project-invariants-gate.d.ts +29 -0
- package/dist/preflight/project-invariants-gate.js +82 -0
- package/dist/preflight-cache/evaluate.d.ts +12 -0
- package/dist/preflight-cache/evaluate.js +15 -1
- package/dist/preflight-cache/index.d.ts +1 -1
- package/dist/preflight-cache/index.js +1 -1
- package/dist/product-first-done-gate/acceptance-resolver.d.ts +128 -0
- package/dist/product-first-done-gate/acceptance-resolver.js +144 -0
- package/dist/product-first-done-gate/acceptance.d.ts +7 -4
- package/dist/product-first-done-gate/acceptance.js +79 -8
- package/dist/product-first-done-gate/empty-resolution.d.ts +4 -1
- package/dist/product-first-done-gate/empty-resolution.js +12 -1
- package/dist/product-first-done-gate/evaluate.d.ts +16 -0
- package/dist/product-first-done-gate/evaluate.js +298 -34
- package/dist/product-first-done-gate/index.d.ts +2 -0
- package/dist/product-first-done-gate/index.js +1 -0
- package/dist/release/build-dist.d.ts +101 -0
- package/dist/release/build-dist.js +428 -46
- package/dist/release/closed-verb-gate.d.ts +12 -0
- package/dist/release/closed-verb-gate.js +51 -0
- package/dist/release/index.d.ts +1 -0
- package/dist/release/index.js +1 -0
- package/dist/release/pipeline.js +7 -0
- package/dist/release/types.d.ts +12 -0
- package/dist/render/constants.d.ts +2 -1
- package/dist/render/constants.js +2 -1
- package/dist/render/framework-commands.js +4 -0
- package/dist/render/spec-validate.js +23 -12
- package/dist/run-summary/emit.d.ts +16 -10
- package/dist/run-summary/emit.js +26 -15
- package/dist/run-summary/index.d.ts +3 -2
- package/dist/run-summary/index.js +2 -1
- package/dist/run-summary/session-id.d.ts +21 -0
- package/dist/run-summary/session-id.js +92 -0
- package/dist/run-summary/types.d.ts +33 -4
- package/dist/run-summary/types.js +1 -0
- package/dist/scope/acceptance-evidence.d.ts +19 -7
- package/dist/scope/acceptance-evidence.js +38 -11
- package/dist/scope/delivery-evidence.d.ts +3 -3
- package/dist/scope/delivery-evidence.js +22 -27
- package/dist/scope/index.d.ts +1 -0
- package/dist/scope/index.js +1 -0
- package/dist/scope/main.js +15 -5
- package/dist/scope/parent-lineage.js +7 -6
- package/dist/scope/project-invariant-coverage.d.ts +54 -0
- package/dist/scope/project-invariant-coverage.js +322 -0
- package/dist/scope/promote-from-issue.js +5 -5
- package/dist/scope/transition.js +1 -1
- package/dist/scope-provenance/compare-intent.d.ts +27 -0
- package/dist/scope-provenance/compare-intent.js +233 -0
- package/dist/scope-provenance/digest.d.ts +18 -1
- package/dist/scope-provenance/digest.js +16 -11
- package/dist/scope-provenance/evaluate.d.ts +5 -1
- package/dist/scope-provenance/evaluate.js +67 -7
- package/dist/scope-provenance/extract-intent.d.ts +43 -0
- package/dist/scope-provenance/extract-intent.js +262 -0
- package/dist/scope-provenance/index.d.ts +7 -1
- package/dist/scope-provenance/index.js +7 -1
- package/dist/scope-provenance/intent-digest.d.ts +12 -0
- package/dist/scope-provenance/intent-digest.js +33 -0
- package/dist/scope-provenance/intent-evaluate.d.ts +43 -0
- package/dist/scope-provenance/intent-evaluate.js +149 -0
- package/dist/scope-provenance/json-tokenizer.d.ts +19 -0
- package/dist/scope-provenance/json-tokenizer.js +225 -0
- package/dist/scope-provenance/known-machine.d.ts +38 -0
- package/dist/scope-provenance/known-machine.js +157 -0
- package/dist/scope-provenance/mint-artifacts.d.ts +102 -0
- package/dist/scope-provenance/mint-artifacts.js +425 -0
- package/dist/session/ac-pass-banking.d.ts +9 -36
- package/dist/session/ac-pass-banking.js +33 -79
- package/dist/session/ac-pass-reuse.d.ts +53 -0
- package/dist/session/ac-pass-reuse.js +95 -0
- package/dist/session/git.js +19 -4
- package/dist/session/index.d.ts +4 -0
- package/dist/session/index.js +4 -0
- package/dist/session/occupancy-stress-worker.d.ts +7 -0
- package/dist/session/occupancy-stress-worker.js +36 -0
- package/dist/session/occupancy.d.ts +97 -0
- package/dist/session/occupancy.js +422 -0
- package/dist/session/openclaw-soft-rebind-deposit.js +6 -6
- package/dist/session/process-cost.d.ts +32 -10
- package/dist/session/process-cost.js +189 -1
- package/dist/session/product-state-hash.d.ts +26 -0
- package/dist/session/product-state-hash.js +700 -0
- package/dist/session/ritual-entrypoint.js +16 -1
- package/dist/session/session-ready.d.ts +2 -0
- package/dist/session/session-ready.js +52 -30
- package/dist/session/session-start.d.ts +13 -0
- package/dist/session/session-start.js +103 -9
- package/dist/session/verify-ac-session-cache.d.ts +42 -0
- package/dist/session/verify-ac-session-cache.js +126 -0
- package/dist/session/verify-session-ritual.d.ts +28 -0
- package/dist/session/verify-session-ritual.js +97 -5
- package/dist/slash/openclaw-deposit.js +13 -9
- package/dist/slice/constants.d.ts +2 -2
- package/dist/slice/constants.js +2 -2
- package/dist/slice/existing.js +9 -3
- package/dist/slice/lock.d.ts +16 -1
- package/dist/slice/lock.js +137 -11
- package/dist/story-ready/evaluate.d.ts +2 -0
- package/dist/story-ready/evaluate.js +13 -0
- package/dist/swarm/complete-cohort.d.ts +3 -0
- package/dist/swarm/complete-cohort.js +59 -11
- package/dist/swarm/finalize-cohort-cli.d.ts +7 -2
- package/dist/swarm/finalize-cohort-cli.js +165 -35
- package/dist/swarm/finalize-cohort.d.ts +1 -0
- package/dist/swarm/finalize-cohort.js +47 -4
- package/dist/swarm/launch.d.ts +22 -0
- package/dist/swarm/launch.js +155 -0
- package/dist/swarm/routing-set-cli.d.ts +11 -1
- package/dist/swarm/routing-set-cli.js +15 -3
- package/dist/swarm/routing-verify.d.ts +13 -1
- package/dist/swarm/routing-verify.js +60 -21
- package/dist/swarm/routing.d.ts +14 -0
- package/dist/swarm/routing.js +53 -3
- package/dist/telemetry-coverage/fake-trial.js +10 -0
- package/dist/telemetry-coverage/kinds.js +2 -0
- package/dist/triage/actions/index.js +4 -1
- package/dist/triage/bootstrap/index.js +6 -6
- package/dist/triage/help/registry-data.d.ts +1 -1
- package/dist/triage/help/registry-data.js +1 -1
- package/dist/triage/welcome/writers.d.ts +1 -1
- package/dist/triage/welcome/writers.js +10 -5
- package/dist/ts-check-lane/index.d.ts +3 -0
- package/dist/ts-check-lane/index.js +2 -0
- package/dist/ts-check-lane/progress-reporter.d.ts +17 -0
- package/dist/ts-check-lane/progress-reporter.js +38 -0
- package/dist/ts-check-lane/progress.d.ts +32 -0
- package/dist/ts-check-lane/progress.js +57 -0
- package/dist/ts-check-lane/run-lane.d.ts +3 -1
- package/dist/ts-check-lane/run-lane.js +8 -6
- package/dist/validate-content/validate-links.d.ts +8 -0
- package/dist/validate-content/validate-links.js +9 -15
- package/dist/value/feedback-file.js +12 -2
- package/dist/value/readback.d.ts +4 -1
- package/dist/value/readback.js +51 -12
- package/dist/vbrief-build/index.d.ts +1 -0
- package/dist/vbrief-build/index.js +1 -0
- package/dist/vbrief-build/project-invariants-io.d.ts +16 -0
- package/dist/vbrief-build/project-invariants-io.js +41 -0
- package/dist/vbrief-reconcile/graph.js +18 -1
- package/dist/vbrief-reconcile/index.d.ts +1 -1
- package/dist/vbrief-reconcile/index.js +1 -1
- package/dist/vbrief-reconcile/types.d.ts +13 -0
- package/dist/vbrief-reconcile/umbrellas.d.ts +14 -0
- package/dist/vbrief-reconcile/umbrellas.js +261 -26
- package/dist/vbrief-validate/index.d.ts +1 -1
- package/dist/vbrief-validate/index.js +1 -1
- package/dist/vbrief-validate/plan-hooks.d.ts +4 -0
- package/dist/vbrief-validate/plan-hooks.js +68 -0
- package/dist/vbrief-validate/schema.d.ts +4 -0
- package/dist/vbrief-validate/schema.js +1 -1
- package/dist/verify-ac/evaluate.d.ts +7 -1
- package/dist/verify-ac/evaluate.js +34 -26
- package/dist/verify-ac/flag.d.ts +4 -0
- package/dist/verify-ac/flag.js +16 -0
- package/dist/verify-ac/index.d.ts +2 -2
- package/dist/verify-ac/index.js +2 -2
- package/dist/verify-env/agent-hook-readiness.d.ts +2 -2
- package/dist/verify-env/agent-hook-readiness.js +12 -8
- package/dist/verify-env/agent-hooks-live-probe.d.ts +5 -1
- package/dist/verify-env/agent-hooks-live-probe.js +26 -5
- package/dist/verify-env/agent-hooks.js +3 -4
- package/dist/verify-source/contained-writes.js +2 -0
- package/dist/verify-source/verify-stubs.d.ts +15 -1
- package/dist/verify-source/verify-stubs.js +20 -16
- package/dist/vitest-runner/win32-coverage-tmp-setup.d.ts +5 -6
- package/dist/vitest-runner/win32-coverage-tmp-setup.js +5 -6
- package/dist/xbrief-migrate/migrate-project.js +2 -5
- package/package.json +7 -3
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { type CheckIgnoreMatch, displayIgnoreSource, evaluateLifecycleVisible, formatLifecycleVisibleSessionLines, indexFlagKind, isSelectiveLifecyclePath, LIFECYCLE_ROOT_PREFIXES, LIFECYCLE_STAGE_DIRS, type LifecycleHideFinding, type LifecycleHideKind, type LifecycleVisibleOptions, type LifecycleVisibleResult, type LsFilesVerboseRecord, lifecycleRootRelPaths, parseCheckIgnoreVerboseLine, parseLsFilesVerboseRecord, } from "./evaluate.js";
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { displayIgnoreSource, evaluateLifecycleVisible, formatLifecycleVisibleSessionLines, indexFlagKind, isSelectiveLifecyclePath, LIFECYCLE_ROOT_PREFIXES, LIFECYCLE_STAGE_DIRS, lifecycleRootRelPaths, parseCheckIgnoreVerboseLine, parseLsFilesVerboseRecord, } from "./evaluate.js";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -13,6 +13,8 @@ import type { LiteralAcceptanceCommand, RejectedLiteralCommand } from "./types.j
|
|
|
13
13
|
export interface CaptureLiteralAcceptanceResult {
|
|
14
14
|
readonly commands: readonly LiteralAcceptanceCommand[];
|
|
15
15
|
readonly rejected: readonly RejectedLiteralCommand[];
|
|
16
|
+
/** Prompt lines skipped inside a transcript-shaped fence (#3511). */
|
|
17
|
+
readonly transcriptPromptSkipped: number;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* Capture literal acceptance commands from free-form task statement text.
|
|
@@ -47,6 +49,14 @@ export declare function captureAndAttachLiteralAcceptance(plan: Record<string, u
|
|
|
47
49
|
readonly commands: readonly LiteralAcceptanceCommand[];
|
|
48
50
|
readonly rejected: readonly RejectedLiteralCommand[];
|
|
49
51
|
};
|
|
52
|
+
/** True when a rejected ledger entry was scraped from narrative prose (#3484). */
|
|
53
|
+
export declare function isProseDerivedRejection(rejected: RejectedLiteralCommand): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* True when the author stated acceptance commands structurally — `swarm.verify_commands`
|
|
56
|
+
* or `plan.acceptance.commands` (#3484). Still used by intake/tests; demotion of
|
|
57
|
+
* prose-derived rejections no longer depends on this (#3511).
|
|
58
|
+
*/
|
|
59
|
+
export declare function hasStructuredAcceptanceCommands(plan: Record<string, unknown> | null | undefined): boolean;
|
|
50
60
|
/** Format rejected ledger for CLI / complete-gate messages. */
|
|
51
61
|
export declare function formatRejectedLedger(rejected: readonly RejectedLiteralCommand[]): string;
|
|
52
62
|
//# sourceMappingURL=capture.d.ts.map
|
|
@@ -167,88 +167,156 @@ function matchLabeledCommand(line) {
|
|
|
167
167
|
return null;
|
|
168
168
|
return line.slice(i).trimEnd();
|
|
169
169
|
}
|
|
170
|
-
/**
|
|
171
|
-
function matchMidlineLabeled(line) {
|
|
172
|
-
const low = line.toLowerCase();
|
|
173
|
-
for (const kw of LABELED_KEYWORDS) {
|
|
174
|
-
if (kw === "run" || kw === "check")
|
|
175
|
-
continue; // too ambiguous mid-line
|
|
176
|
-
const needle = `${kw}:`;
|
|
177
|
-
const idx = low.indexOf(needle);
|
|
178
|
-
if (idx < 0)
|
|
179
|
-
continue;
|
|
180
|
-
const rest = line.slice(idx + needle.length).trim();
|
|
181
|
-
if (rest.length > 0)
|
|
182
|
-
return rest;
|
|
183
|
-
}
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
/** `$ cmd` or `> cmd` prompt lines. */
|
|
170
|
+
/** `$ cmd` prompt lines. Markdown blockquote `>` is not a prompt (#3572). */
|
|
187
171
|
function matchPromptCommand(line) {
|
|
188
172
|
let i = skipWs(line, 0);
|
|
189
173
|
if (i >= line.length)
|
|
190
174
|
return null;
|
|
191
|
-
if (line[i] !== "$"
|
|
175
|
+
if (line[i] !== "$")
|
|
192
176
|
return null;
|
|
193
177
|
i = skipWs(line, i + 1);
|
|
194
178
|
if (i >= line.length)
|
|
195
179
|
return null;
|
|
196
180
|
return line.slice(i).trimEnd();
|
|
197
181
|
}
|
|
182
|
+
/** Box-drawing / block elements used in terminal UIs (━, │, …). */
|
|
183
|
+
const BOX_DRAWING_RE = /[\u2500-\u257F\u2580-\u259F]/;
|
|
184
|
+
/**
|
|
185
|
+
* Drop GNU-style long flags and their following value so `--filter fail`
|
|
186
|
+
* is not classified as FAIL transcript output (#3511).
|
|
187
|
+
* Covers `--flag`, `--flag=value`, and `--flag value` (value not another flag).
|
|
188
|
+
*/
|
|
189
|
+
function stripLongFlags(line) {
|
|
190
|
+
return line.replace(/(^|\s)--[\w-]+(?:=[^\s]+|\s+(?!-)[^\s]+)?/g, "$1");
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* True when a fence line is log/transcript, not a stated command (#3511).
|
|
194
|
+
* `[1/13]` / `[ts:check-lane]`, box drawing, or FAIL/FAILED/Error:.
|
|
195
|
+
* Flag tokens (--fail-fast, --failOnError, --no-fail) and flag values
|
|
196
|
+
* (`--filter fail`, `--grep FAIL`) are not FAIL output: `\bFAIL` matches
|
|
197
|
+
* between `-` and `f`, and leftover values still match after name-only strip.
|
|
198
|
+
*/
|
|
199
|
+
function isTranscriptOutputLine(line) {
|
|
200
|
+
const t = line.trim();
|
|
201
|
+
if (t.length === 0)
|
|
202
|
+
return false;
|
|
203
|
+
if (t.startsWith("#") || t.startsWith("//"))
|
|
204
|
+
return false;
|
|
205
|
+
if (/^\[[^\]]{1,80}\]/.test(t))
|
|
206
|
+
return true;
|
|
207
|
+
if (BOX_DRAWING_RE.test(t))
|
|
208
|
+
return true;
|
|
209
|
+
const withoutFlags = stripLongFlags(t);
|
|
210
|
+
if (/\b(?:FAILED|FAIL|Error:)/i.test(withoutFlags))
|
|
211
|
+
return true;
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
function isFenceCommentOrBlank(line) {
|
|
215
|
+
const t = line.trim();
|
|
216
|
+
return t.length === 0 || t.startsWith("#") || t.startsWith("//");
|
|
217
|
+
}
|
|
218
|
+
function isPromptLine(line) {
|
|
219
|
+
const t = line.trim();
|
|
220
|
+
return t.startsWith("$ ") || t.startsWith("> ");
|
|
221
|
+
}
|
|
222
|
+
/** Per-line mask: true for body lines inside ``` / ~~~ fences (not the markers). */
|
|
223
|
+
function fenceBodyMask(lines) {
|
|
224
|
+
const mask = Array.from({ length: lines.length }, () => false);
|
|
225
|
+
let open = null;
|
|
226
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
227
|
+
const line = lines[i] ?? "";
|
|
228
|
+
if (open === null) {
|
|
229
|
+
open = matchFenceOpen(line);
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
if (matchFenceClose(line, open)) {
|
|
233
|
+
open = null;
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
mask[i] = true;
|
|
237
|
+
}
|
|
238
|
+
return mask;
|
|
239
|
+
}
|
|
240
|
+
function captureFenceBodyLine(line, fenceLang, fenceStartLine, buckets) {
|
|
241
|
+
const trimmed = line.trim();
|
|
242
|
+
if (trimmed.length === 0 || trimmed.startsWith("#") || trimmed.startsWith("//")) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
let body = trimmed;
|
|
246
|
+
if (body.startsWith("$ ") || body.startsWith("> ")) {
|
|
247
|
+
body = body.slice(2).trim();
|
|
248
|
+
}
|
|
249
|
+
const normalized = normalizeCommand(body);
|
|
250
|
+
if (normalized === null)
|
|
251
|
+
return;
|
|
252
|
+
const langOk = isShellFenceLang(fenceLang);
|
|
253
|
+
if (!looksLikeShellCommand(normalized) && (fenceLang === "" || !langOk))
|
|
254
|
+
return;
|
|
255
|
+
pushUnique(buckets, normalized, "task_statement", `fence@L${fenceStartLine}${fenceLang ? `:${fenceLang}` : ""}`);
|
|
256
|
+
}
|
|
257
|
+
function flushFenceBody(body, fenceLang, fenceStartLine, requireRegion, regionActive, buckets) {
|
|
258
|
+
if (requireRegion && !regionActive)
|
|
259
|
+
return;
|
|
260
|
+
if (!isShellFenceLang(fenceLang))
|
|
261
|
+
return;
|
|
262
|
+
// Transcript lines are skipped. `$` prompts inside a transcript fence are
|
|
263
|
+
// suggested-fixes (biome migrate), not stated AC (#3511). Comments do not
|
|
264
|
+
// mark a fence as transcript, so a genuine command next to `# Error:` still
|
|
265
|
+
// captures.
|
|
266
|
+
const transcript = body.some((line) => isTranscriptOutputLine(line));
|
|
267
|
+
for (const line of body) {
|
|
268
|
+
if (isFenceCommentOrBlank(line))
|
|
269
|
+
continue;
|
|
270
|
+
if (transcript && isPromptLine(line)) {
|
|
271
|
+
buckets.transcriptPromptSkipped += 1;
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
if (isTranscriptOutputLine(line))
|
|
275
|
+
continue;
|
|
276
|
+
captureFenceBodyLine(line, fenceLang, fenceStartLine, buckets);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
198
279
|
/**
|
|
199
280
|
* Walk fenced ``` / ~~~ blocks; keep fence body lines that look like shell.
|
|
200
281
|
* When `requireRegion` is true, only fences under an acceptance/verify heading.
|
|
282
|
+
* Output-shaped fences (progress tags, box drawing, FAIL/Error:) are skipped (#3511).
|
|
201
283
|
*/
|
|
202
284
|
function extractFromFences(text, requireRegion, buckets) {
|
|
203
285
|
const lines = text.split(/\r?\n/);
|
|
204
|
-
let
|
|
205
|
-
let fenceLang = "";
|
|
286
|
+
let open = null;
|
|
206
287
|
let regionActive = !requireRegion;
|
|
207
288
|
let fenceStartLine = 0;
|
|
289
|
+
let fenceBody = [];
|
|
290
|
+
const flush = () => {
|
|
291
|
+
if (open === null)
|
|
292
|
+
return;
|
|
293
|
+
flushFenceBody(fenceBody, open.lang, fenceStartLine, requireRegion, regionActive, buckets);
|
|
294
|
+
open = null;
|
|
295
|
+
fenceBody = [];
|
|
296
|
+
};
|
|
208
297
|
for (let i = 0; i < lines.length; i += 1) {
|
|
209
298
|
const line = lines[i] ?? "";
|
|
210
299
|
const heading = matchMarkdownHeading(line);
|
|
211
|
-
if (heading !== null &&
|
|
300
|
+
if (heading !== null && open === null) {
|
|
212
301
|
regionActive = requireRegion ? isRegionHeading(heading.text) : true;
|
|
213
302
|
continue;
|
|
214
303
|
}
|
|
215
304
|
const fenceOpen = matchFenceOpen(line);
|
|
216
|
-
if (fenceOpen !== null &&
|
|
217
|
-
|
|
218
|
-
fenceLang = fenceOpen.lang;
|
|
305
|
+
if (fenceOpen !== null && open === null) {
|
|
306
|
+
open = fenceOpen;
|
|
219
307
|
fenceStartLine = i + 1;
|
|
308
|
+
fenceBody = [];
|
|
220
309
|
continue;
|
|
221
310
|
}
|
|
222
|
-
if (
|
|
223
|
-
|
|
224
|
-
fenceLang = "";
|
|
311
|
+
if (open !== null && matchFenceClose(line, open)) {
|
|
312
|
+
flush();
|
|
225
313
|
continue;
|
|
226
314
|
}
|
|
227
|
-
if (
|
|
315
|
+
if (open === null)
|
|
228
316
|
continue;
|
|
229
|
-
|
|
230
|
-
continue;
|
|
231
|
-
// Skip comment-only fence lines.
|
|
232
|
-
const trimmed = line.trim();
|
|
233
|
-
if (trimmed.length === 0 || trimmed.startsWith("#") || trimmed.startsWith("//")) {
|
|
234
|
-
continue;
|
|
235
|
-
}
|
|
236
|
-
// Shell-ish langs always accepted; unknown langs need CLI shape.
|
|
237
|
-
const langOk = isShellFenceLang(fenceLang);
|
|
238
|
-
if (!langOk && fenceLang !== "")
|
|
239
|
-
continue;
|
|
240
|
-
// Strip leading prompt markers inside fences.
|
|
241
|
-
let body = trimmed;
|
|
242
|
-
if (body.startsWith("$ ") || body.startsWith("> ")) {
|
|
243
|
-
body = body.slice(2).trim();
|
|
244
|
-
}
|
|
245
|
-
const normalized = normalizeCommand(body);
|
|
246
|
-
if (normalized === null)
|
|
247
|
-
continue;
|
|
248
|
-
if (!looksLikeShellCommand(normalized) && (fenceLang === "" || !langOk))
|
|
249
|
-
continue;
|
|
250
|
-
pushUnique(buckets, normalized, "task_statement", `fence@L${fenceStartLine}${fenceLang ? `:${fenceLang}` : ""}`);
|
|
317
|
+
fenceBody.push(line);
|
|
251
318
|
}
|
|
319
|
+
flush();
|
|
252
320
|
}
|
|
253
321
|
function isShellFenceLang(lang) {
|
|
254
322
|
return (lang === "" ||
|
|
@@ -262,26 +330,38 @@ function isShellFenceLang(lang) {
|
|
|
262
330
|
lang === "cmd" ||
|
|
263
331
|
lang === "text");
|
|
264
332
|
}
|
|
265
|
-
/**
|
|
333
|
+
/**
|
|
334
|
+
* CommonMark fence open: 3+ backticks or tildes, then an optional info string.
|
|
335
|
+
* Longer openers (````) must close with the same marker at >= that length (#3511 P1).
|
|
336
|
+
*/
|
|
266
337
|
function matchFenceOpen(line) {
|
|
267
|
-
const
|
|
268
|
-
if (
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
return
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
return
|
|
279
|
-
|
|
280
|
-
|
|
338
|
+
const body = line.trimEnd().trimStart();
|
|
339
|
+
if (body.length < 3)
|
|
340
|
+
return null;
|
|
341
|
+
const first = body[0];
|
|
342
|
+
if (first !== "`" && first !== "~")
|
|
343
|
+
return null;
|
|
344
|
+
const marker = first;
|
|
345
|
+
let length = 0;
|
|
346
|
+
while (length < body.length && body[length] === marker)
|
|
347
|
+
length += 1;
|
|
348
|
+
if (length < 3)
|
|
349
|
+
return null;
|
|
350
|
+
const rest = body.slice(length).trim().toLowerCase();
|
|
351
|
+
if (rest.includes(" ") || rest.includes("\t"))
|
|
352
|
+
return null;
|
|
353
|
+
if (rest.includes(marker))
|
|
354
|
+
return null;
|
|
355
|
+
return { lang: rest, marker, length };
|
|
281
356
|
}
|
|
282
|
-
function matchFenceClose(line) {
|
|
357
|
+
function matchFenceClose(line, open) {
|
|
283
358
|
const t = line.trim();
|
|
284
|
-
|
|
359
|
+
let length = 0;
|
|
360
|
+
while (length < t.length && t[length] === open.marker)
|
|
361
|
+
length += 1;
|
|
362
|
+
if (length < open.length)
|
|
363
|
+
return false;
|
|
364
|
+
return t.slice(length).trim().length === 0;
|
|
285
365
|
}
|
|
286
366
|
function matchMarkdownHeading(line) {
|
|
287
367
|
if (!line.startsWith("#"))
|
|
@@ -295,17 +375,25 @@ function matchMarkdownHeading(line) {
|
|
|
295
375
|
return null;
|
|
296
376
|
return { level, text: line.slice(level + 1).trim() };
|
|
297
377
|
}
|
|
298
|
-
/**
|
|
378
|
+
/**
|
|
379
|
+
* Extract from labeled lines and `$` prompts anywhere in the statement.
|
|
380
|
+
*
|
|
381
|
+
* A labeled command MUST start its own line (after an optional bullet / number
|
|
382
|
+
* marker). Mid-line label capture is deliberately not attempted (#3484): a
|
|
383
|
+
* `verify:<verb>` token inside ordinary prose has no terminator, so the capture
|
|
384
|
+
* 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.
|
|
387
|
+
*/
|
|
299
388
|
function extractFromLabeledLines(text, buckets) {
|
|
300
389
|
const lines = text.split(/\r?\n/);
|
|
390
|
+
const inFence = fenceBodyMask(lines);
|
|
301
391
|
for (let i = 0; i < lines.length; i += 1) {
|
|
392
|
+
if (inFence[i] === true)
|
|
393
|
+
continue;
|
|
302
394
|
const line = lines[i] ?? "";
|
|
303
395
|
let capturedLabeled = false;
|
|
304
|
-
|
|
305
|
-
if (labeledBody === null && matchPromptCommand(line) === null) {
|
|
306
|
-
// Avoid treating `$ task verify:branch` as labeled "branch".
|
|
307
|
-
labeledBody = matchMidlineLabeled(line);
|
|
308
|
-
}
|
|
396
|
+
const labeledBody = matchLabeledCommand(line);
|
|
309
397
|
if (labeledBody !== null) {
|
|
310
398
|
const normalized = normalizeCommand(labeledBody);
|
|
311
399
|
if (normalized !== null && looksLikeShellCommand(normalized)) {
|
|
@@ -330,7 +418,10 @@ function extractFromLabeledLines(text, buckets) {
|
|
|
330
418
|
*/
|
|
331
419
|
function extractInlineVerifySpans(text, buckets) {
|
|
332
420
|
const lines = text.split(/\r?\n/);
|
|
421
|
+
const inFence = fenceBodyMask(lines);
|
|
333
422
|
for (let i = 0; i < lines.length; i += 1) {
|
|
423
|
+
if (inFence[i] === true)
|
|
424
|
+
continue;
|
|
334
425
|
const line = lines[i] ?? "";
|
|
335
426
|
if (!/\b(verify|run|execute|acceptance)\b/i.test(line))
|
|
336
427
|
continue;
|
|
@@ -359,6 +450,7 @@ function emptyBuckets() {
|
|
|
359
450
|
seen: new Set(),
|
|
360
451
|
rejected: [],
|
|
361
452
|
rejectedSeen: new Set(),
|
|
453
|
+
transcriptPromptSkipped: 0,
|
|
362
454
|
};
|
|
363
455
|
}
|
|
364
456
|
/**
|
|
@@ -367,7 +459,7 @@ function emptyBuckets() {
|
|
|
367
459
|
*/
|
|
368
460
|
export function captureLiteralAcceptanceCommandsDetailed(taskStatement) {
|
|
369
461
|
if (!isNonEmptyString(taskStatement)) {
|
|
370
|
-
return { commands: [], rejected: [] };
|
|
462
|
+
return { commands: [], rejected: [], transcriptPromptSkipped: 0 };
|
|
371
463
|
}
|
|
372
464
|
const buckets = emptyBuckets();
|
|
373
465
|
// Prefer fences under acceptance/verify headings first.
|
|
@@ -376,7 +468,11 @@ export function captureLiteralAcceptanceCommandsDetailed(taskStatement) {
|
|
|
376
468
|
extractFromFences(taskStatement, false, buckets);
|
|
377
469
|
extractFromLabeledLines(taskStatement, buckets);
|
|
378
470
|
extractInlineVerifySpans(taskStatement, buckets);
|
|
379
|
-
return {
|
|
471
|
+
return {
|
|
472
|
+
commands: buckets.out,
|
|
473
|
+
rejected: buckets.rejected,
|
|
474
|
+
transcriptPromptSkipped: buckets.transcriptPromptSkipped,
|
|
475
|
+
};
|
|
380
476
|
}
|
|
381
477
|
/**
|
|
382
478
|
* Capture literal acceptance commands from free-form task statement text.
|
|
@@ -395,7 +491,7 @@ export function readStoredLiteralAcceptanceCommands(plan) {
|
|
|
395
491
|
/** Read stored commands plus any persisted rejected ledger. */
|
|
396
492
|
export function readStoredLiteralAcceptanceDetailed(plan) {
|
|
397
493
|
if (plan === null || plan === undefined || typeof plan !== "object") {
|
|
398
|
-
return { commands: [], rejected: [] };
|
|
494
|
+
return { commands: [], rejected: [], transcriptPromptSkipped: 0 };
|
|
399
495
|
}
|
|
400
496
|
const buckets = emptyBuckets();
|
|
401
497
|
const metadata = asRecord(plan.metadata);
|
|
@@ -435,7 +531,11 @@ export function readStoredLiteralAcceptanceDetailed(plan) {
|
|
|
435
531
|
}
|
|
436
532
|
}
|
|
437
533
|
walkPlanItems(plan.items, "items", buckets);
|
|
438
|
-
return {
|
|
534
|
+
return {
|
|
535
|
+
commands: buckets.out,
|
|
536
|
+
rejected: buckets.rejected,
|
|
537
|
+
transcriptPromptSkipped: buckets.transcriptPromptSkipped,
|
|
538
|
+
};
|
|
439
539
|
}
|
|
440
540
|
function walkPlanItems(items, pathPrefix, buckets) {
|
|
441
541
|
if (!Array.isArray(items))
|
|
@@ -644,6 +744,55 @@ function toSerializable(cmd) {
|
|
|
644
744
|
}
|
|
645
745
|
return row;
|
|
646
746
|
}
|
|
747
|
+
/**
|
|
748
|
+
* Provenance prefixes stamped by the free-text scrapers in this module.
|
|
749
|
+
* Anything carrying one of these spans came from prose, not from a structured
|
|
750
|
+
* acceptance field the author wrote on purpose (#3484).
|
|
751
|
+
*/
|
|
752
|
+
const PROSE_SPAN_PREFIXES = ["labeled@", "prompt@", "inline@", "fence@"];
|
|
753
|
+
/** True when a rejected ledger entry was scraped from narrative prose (#3484). */
|
|
754
|
+
export function isProseDerivedRejection(rejected) {
|
|
755
|
+
const span = rejected.sourceSpan;
|
|
756
|
+
if (span === null || span === undefined)
|
|
757
|
+
return false;
|
|
758
|
+
return PROSE_SPAN_PREFIXES.some((prefix) => span.startsWith(prefix));
|
|
759
|
+
}
|
|
760
|
+
function hasNonEmptyCommandList(raw) {
|
|
761
|
+
if (typeof raw === "string")
|
|
762
|
+
return raw.trim().length > 0;
|
|
763
|
+
if (!Array.isArray(raw))
|
|
764
|
+
return false;
|
|
765
|
+
for (const entry of raw) {
|
|
766
|
+
if (typeof entry === "string" && entry.trim().length > 0)
|
|
767
|
+
return true;
|
|
768
|
+
const rec = asRecord(entry);
|
|
769
|
+
if (rec === null)
|
|
770
|
+
continue;
|
|
771
|
+
if (isNonEmptyString(rec.command ?? rec.cmd ?? rec.shell))
|
|
772
|
+
return true;
|
|
773
|
+
}
|
|
774
|
+
return false;
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* True when the author stated acceptance commands structurally — `swarm.verify_commands`
|
|
778
|
+
* or `plan.acceptance.commands` (#3484). Still used by intake/tests; demotion of
|
|
779
|
+
* prose-derived rejections no longer depends on this (#3511).
|
|
780
|
+
*/
|
|
781
|
+
export function hasStructuredAcceptanceCommands(plan) {
|
|
782
|
+
const rec = asRecord(plan);
|
|
783
|
+
if (rec === null)
|
|
784
|
+
return false;
|
|
785
|
+
const acceptance = asRecord(rec.acceptance);
|
|
786
|
+
if (acceptance !== null && hasNonEmptyCommandList(acceptance.commands))
|
|
787
|
+
return true;
|
|
788
|
+
const metadata = asRecord(rec.metadata);
|
|
789
|
+
if (metadata === null)
|
|
790
|
+
return false;
|
|
791
|
+
const swarm = asRecord(metadata.swarm);
|
|
792
|
+
if (swarm === null)
|
|
793
|
+
return false;
|
|
794
|
+
return hasNonEmptyCommandList(swarm.verify_commands);
|
|
795
|
+
}
|
|
647
796
|
/** Format rejected ledger for CLI / complete-gate messages. */
|
|
648
797
|
export function formatRejectedLedger(rejected) {
|
|
649
798
|
if (rejected.length === 0)
|
|
@@ -13,6 +13,19 @@ export interface EvaluateLiteralAcceptanceOptions {
|
|
|
13
13
|
/** Quiet success (empty message on pass). */
|
|
14
14
|
readonly quiet?: boolean;
|
|
15
15
|
}
|
|
16
|
+
/** Resolved literal-AC view: executable commands plus the blocking / advisory ledgers. */
|
|
17
|
+
export interface ResolvedLiteralAcceptance {
|
|
18
|
+
readonly commands: readonly LiteralAcceptanceCommand[];
|
|
19
|
+
/** Safety-rejected entries that block completion. */
|
|
20
|
+
readonly rejected: readonly RejectedLiteralCommand[];
|
|
21
|
+
/**
|
|
22
|
+
* Prose/fence/inline-derived rejections demoted to advisory (#3484 / #3511).
|
|
23
|
+
* Reported, never blocking. Structured-field rejections stay on `rejected`.
|
|
24
|
+
*/
|
|
25
|
+
readonly advisoryRejected: readonly RejectedLiteralCommand[];
|
|
26
|
+
/** Prompt lines skipped inside a transcript-shaped fence (#3511). */
|
|
27
|
+
readonly transcriptPromptSkipped: number;
|
|
28
|
+
}
|
|
16
29
|
/**
|
|
17
30
|
* Resolve commands + rejected ledger.
|
|
18
31
|
* Stored first; when captureFromNarratives is true (default), also re-scan narratives
|
|
@@ -21,16 +34,28 @@ export interface EvaluateLiteralAcceptanceOptions {
|
|
|
21
34
|
*/
|
|
22
35
|
export declare function resolveLiteralAcceptanceDetailed(plan: Record<string, unknown>, options?: {
|
|
23
36
|
readonly captureFromNarratives?: boolean;
|
|
24
|
-
}):
|
|
25
|
-
readonly commands: readonly LiteralAcceptanceCommand[];
|
|
26
|
-
readonly rejected: readonly RejectedLiteralCommand[];
|
|
27
|
-
};
|
|
37
|
+
}): ResolvedLiteralAcceptance;
|
|
28
38
|
/**
|
|
29
39
|
* Resolve commands: stored first; optional narrative re-capture when empty.
|
|
30
40
|
*/
|
|
31
41
|
export declare function resolveLiteralAcceptanceCommands(plan: Record<string, unknown>, options?: {
|
|
32
42
|
readonly captureFromNarratives?: boolean;
|
|
33
43
|
}): LiteralAcceptanceCommand[];
|
|
44
|
+
/**
|
|
45
|
+
* Marker that opens the #3484 advisory block. Consumers strip from here to the end
|
|
46
|
+
* before any free-text inspection of a literal-AC message: the block quotes refusal
|
|
47
|
+
* reasons that were explicitly demoted and must not be read back as blocking (#3497).
|
|
48
|
+
*/
|
|
49
|
+
export declare const LITERAL_ACCEPTANCE_ADVISORY_MARKER = "Literal acceptance advisory (#3484):";
|
|
50
|
+
/** Render the #3484 advisory block (reported, never blocking). */
|
|
51
|
+
export declare function formatLiteralAcceptanceAdvisory(advisory: readonly RejectedLiteralCommand[]): string;
|
|
52
|
+
/** Append the #3484 advisory block to a message tail. */
|
|
53
|
+
export declare function appendLiteralAcceptanceAdvisory(message: string, advisory: readonly RejectedLiteralCommand[]): string;
|
|
54
|
+
/**
|
|
55
|
+
* Drop the #3484 advisory block from a rendered message.
|
|
56
|
+
* The block is always the tail, so an index cut is exact.
|
|
57
|
+
*/
|
|
58
|
+
export declare function stripLiteralAcceptanceAdvisory(message: string): string;
|
|
34
59
|
/**
|
|
35
60
|
* Evaluate from an in-memory plan object.
|
|
36
61
|
*/
|
|
@@ -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, readStoredLiteralAcceptanceDetailed, } from "./capture.js";
|
|
6
|
+
import { captureLiteralAcceptanceCommandsDetailed, formatRejectedLedger, isProseDerivedRejection, 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)) {
|
|
@@ -14,6 +14,24 @@ function asRecord(value) {
|
|
|
14
14
|
function planOf(data) {
|
|
15
15
|
return asRecord(data.plan);
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Prose-derived rejections are advisory (#3484 / #3511). A scraper misread must
|
|
19
|
+
* not block completion, whether or not the plan states structured commands —
|
|
20
|
+
* blocking on a capture the extractor itself rejected is backwards. Rejections
|
|
21
|
+
* from structured fields (`swarm.verify_commands`, plan items, explicit metadata)
|
|
22
|
+
* keep blocking — those are real commands the author asked for.
|
|
23
|
+
*/
|
|
24
|
+
function partitionRejected(rejected) {
|
|
25
|
+
const blocking = [];
|
|
26
|
+
const advisory = [];
|
|
27
|
+
for (const r of rejected) {
|
|
28
|
+
if (isProseDerivedRejection(r))
|
|
29
|
+
advisory.push(r);
|
|
30
|
+
else
|
|
31
|
+
blocking.push(r);
|
|
32
|
+
}
|
|
33
|
+
return { blocking, advisory };
|
|
34
|
+
}
|
|
17
35
|
/**
|
|
18
36
|
* Resolve commands + rejected ledger.
|
|
19
37
|
* Stored first; when captureFromNarratives is true (default), also re-scan narratives
|
|
@@ -21,6 +39,16 @@ function planOf(data) {
|
|
|
21
39
|
* (Greptile conf residual).
|
|
22
40
|
*/
|
|
23
41
|
export function resolveLiteralAcceptanceDetailed(plan, options = {}) {
|
|
42
|
+
const raw = resolveRawLiteralAcceptance(plan, options);
|
|
43
|
+
const split = partitionRejected(raw.rejected);
|
|
44
|
+
return {
|
|
45
|
+
commands: raw.commands,
|
|
46
|
+
rejected: split.blocking,
|
|
47
|
+
advisoryRejected: split.advisory,
|
|
48
|
+
transcriptPromptSkipped: raw.transcriptPromptSkipped,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function resolveRawLiteralAcceptance(plan, options = {}) {
|
|
24
52
|
const stored = readStoredLiteralAcceptanceDetailed(plan);
|
|
25
53
|
if (options.captureFromNarratives === false) {
|
|
26
54
|
return stored;
|
|
@@ -74,7 +102,11 @@ export function resolveLiteralAcceptanceDetailed(plan, options = {}) {
|
|
|
74
102
|
rejectedSeen.add(k);
|
|
75
103
|
rejected.push(r);
|
|
76
104
|
}
|
|
77
|
-
return {
|
|
105
|
+
return {
|
|
106
|
+
commands,
|
|
107
|
+
rejected,
|
|
108
|
+
transcriptPromptSkipped: captured.transcriptPromptSkipped,
|
|
109
|
+
};
|
|
78
110
|
}
|
|
79
111
|
/**
|
|
80
112
|
* Resolve commands: stored first; optional narrative re-capture when empty.
|
|
@@ -82,6 +114,36 @@ export function resolveLiteralAcceptanceDetailed(plan, options = {}) {
|
|
|
82
114
|
export function resolveLiteralAcceptanceCommands(plan, options = {}) {
|
|
83
115
|
return [...resolveLiteralAcceptanceDetailed(plan, options).commands];
|
|
84
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Marker that opens the #3484 advisory block. Consumers strip from here to the end
|
|
119
|
+
* before any free-text inspection of a literal-AC message: the block quotes refusal
|
|
120
|
+
* reasons that were explicitly demoted and must not be read back as blocking (#3497).
|
|
121
|
+
*/
|
|
122
|
+
export const LITERAL_ACCEPTANCE_ADVISORY_MARKER = "Literal acceptance advisory (#3484):";
|
|
123
|
+
/** Render the #3484 advisory block (reported, never blocking). */
|
|
124
|
+
export function formatLiteralAcceptanceAdvisory(advisory) {
|
|
125
|
+
if (advisory.length === 0)
|
|
126
|
+
return "";
|
|
127
|
+
return (`${LITERAL_ACCEPTANCE_ADVISORY_MARKER} ${advisory.length} ` +
|
|
128
|
+
`prose/fence-derived capture(s) were safety-rejected but do NOT block — ` +
|
|
129
|
+
`the extractor is not confident these are stated acceptance commands (#3511).\n` +
|
|
130
|
+
formatRejectedLedger(advisory));
|
|
131
|
+
}
|
|
132
|
+
/** Append the #3484 advisory block to a message tail. */
|
|
133
|
+
export function appendLiteralAcceptanceAdvisory(message, advisory) {
|
|
134
|
+
const block = formatLiteralAcceptanceAdvisory(advisory);
|
|
135
|
+
if (block.length === 0)
|
|
136
|
+
return message;
|
|
137
|
+
return message.length > 0 ? `${message}\n${block}` : block;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Drop the #3484 advisory block from a rendered message.
|
|
141
|
+
* The block is always the tail, so an index cut is exact.
|
|
142
|
+
*/
|
|
143
|
+
export function stripLiteralAcceptanceAdvisory(message) {
|
|
144
|
+
const at = message.indexOf(LITERAL_ACCEPTANCE_ADVISORY_MARKER);
|
|
145
|
+
return at === -1 ? message : message.slice(0, at);
|
|
146
|
+
}
|
|
85
147
|
function appendRejectedNote(message, rejected) {
|
|
86
148
|
const ledger = formatRejectedLedger(rejected);
|
|
87
149
|
if (ledger.length === 0)
|
|
@@ -120,11 +182,17 @@ export function evaluateLiteralAcceptanceFromPlan(plan, options = {}) {
|
|
|
120
182
|
ledger +
|
|
121
183
|
(result.message.length > 0 ? `\n${result.message}` : "");
|
|
122
184
|
}
|
|
185
|
+
// Prose/fence-derived rejections (#3484 / #3511) are reported, never blocking.
|
|
186
|
+
if (resolved.advisoryRejected.length > 0) {
|
|
187
|
+
message = appendLiteralAcceptanceAdvisory(message, resolved.advisoryRejected);
|
|
188
|
+
}
|
|
123
189
|
const withRejected = {
|
|
124
190
|
...result,
|
|
125
191
|
ok,
|
|
126
192
|
code,
|
|
127
193
|
rejected: resolved.rejected,
|
|
194
|
+
advisoryRejected: resolved.advisoryRejected,
|
|
195
|
+
transcriptPromptSkipped: resolved.transcriptPromptSkipped,
|
|
128
196
|
message,
|
|
129
197
|
};
|
|
130
198
|
if (options.quiet === true && withRejected.ok) {
|
|
@@ -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, readStoredLiteralAcceptanceCommands, readStoredLiteralAcceptanceDetailed, } from "./capture.js";
|
|
8
|
-
export { type EvaluateLiteralAcceptanceOptions, evaluateLiteralAcceptanceFromPath, evaluateLiteralAcceptanceFromPlan, isLiteralAcceptanceRequiredAtCeremonyDepth, resolveLiteralAcceptanceCommands, resolveLiteralAcceptanceDetailed, } from "./evaluate.js";
|
|
7
|
+
export { attachLiteralAcceptanceCommands, type CaptureLiteralAcceptanceResult, captureAndAttachLiteralAcceptance, captureLiteralAcceptanceCommands, captureLiteralAcceptanceCommandsDetailed, formatRejectedLedger, hasStructuredAcceptanceCommands, isProseDerivedRejection, readStoredLiteralAcceptanceCommands, readStoredLiteralAcceptanceDetailed, } from "./capture.js";
|
|
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
|
-
export { type CommandSafetyResult, evaluateCommandSafety, isExecutableLiteralSource, } from "./safety.js";
|
|
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
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";
|
|
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, readStoredLiteralAcceptanceCommands, readStoredLiteralAcceptanceDetailed, } from "./capture.js";
|
|
8
|
-
export { evaluateLiteralAcceptanceFromPath, evaluateLiteralAcceptanceFromPlan, isLiteralAcceptanceRequiredAtCeremonyDepth, resolveLiteralAcceptanceCommands, resolveLiteralAcceptanceDetailed, } from "./evaluate.js";
|
|
7
|
+
export { attachLiteralAcceptanceCommands, captureAndAttachLiteralAcceptance, captureLiteralAcceptanceCommands, captureLiteralAcceptanceCommandsDetailed, formatRejectedLedger, hasStructuredAcceptanceCommands, isProseDerivedRejection, readStoredLiteralAcceptanceCommands, readStoredLiteralAcceptanceDetailed, } from "./capture.js";
|
|
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
|
-
export { evaluateCommandSafety, isExecutableLiteralSource, } from "./safety.js";
|
|
10
|
+
export { evaluateCommandSafety, evaluateNoopDenylist, evaluateStampAcceptanceSafety, isExecutableLiteralSource, isNoopRefusalReason, isVerbatimStatementSpan, NOOP_ACCEPTANCE_REMEDIATION, REJECTED_NOOP_OUTCOME, } from "./safety.js";
|
|
11
11
|
export { EXECUTABLE_LITERAL_SOURCES, LITERAL_ACCEPTANCE_METADATA_KEY, LITERAL_ACCEPTANCE_METADATA_KEY_CAMEL, LITERAL_ACCEPTANCE_REJECTED_METADATA_KEY, } from "./types.js";
|
|
12
12
|
//# sourceMappingURL=index.js.map
|