@deftai/directive-core 0.101.0 → 0.103.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 +97 -8
- package/dist/check/cached-orchestrator.d.ts +4 -0
- package/dist/check/cached-orchestrator.js +70 -5
- package/dist/check/cli-native-gates.d.ts +43 -0
- package/dist/check/cli-native-gates.js +84 -0
- package/dist/check/index.d.ts +1 -0
- package/dist/check/index.js +1 -0
- package/dist/check/named-cause.js +10 -0
- package/dist/doctor/checks.d.ts +5 -6
- package/dist/doctor/checks.js +13 -56
- package/dist/eval/later-graduation.d.ts +39 -0
- package/dist/eval/later-graduation.js +91 -0
- package/dist/eval/report.d.ts +6 -0
- package/dist/eval/report.js +27 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/init-deposit/hygiene.d.ts +7 -1
- package/dist/init-deposit/hygiene.js +11 -3
- package/dist/init-deposit/scaffold.d.ts +12 -0
- package/dist/init-deposit/scaffold.js +81 -8
- package/dist/intake/issue-ingest.js +42 -0
- package/dist/policy/ceremony-dial-escalation.d.ts +52 -0
- package/dist/policy/ceremony-dial-escalation.js +92 -0
- package/dist/policy/ceremony-dial.d.ts +3 -1
- package/dist/policy/ceremony-dial.js +52 -1
- package/dist/policy/check-resume.d.ts +9 -38
- package/dist/policy/check-resume.js +18 -156
- package/dist/policy/coverage-debt.d.ts +18 -37
- package/dist/policy/coverage-debt.js +38 -147
- package/dist/policy/index.d.ts +1 -1
- package/dist/policy/index.js +1 -1
- package/dist/product-first-done-gate/acceptance.js +22 -0
- package/dist/product-first-done-gate/empty-resolution.d.ts +26 -0
- package/dist/product-first-done-gate/empty-resolution.js +38 -0
- package/dist/product-first-done-gate/evaluate.d.ts +40 -2
- package/dist/product-first-done-gate/evaluate.js +253 -61
- package/dist/product-first-done-gate/index.d.ts +2 -1
- package/dist/product-first-done-gate/index.js +2 -1
- package/dist/product-first-done-gate/types.d.ts +3 -0
- package/dist/product-first-done-gate/types.js +0 -7
- package/dist/run-summary/emit.d.ts +11 -1
- package/dist/run-summary/emit.js +48 -2
- package/dist/run-summary/index.d.ts +2 -1
- package/dist/run-summary/index.js +2 -1
- package/dist/run-summary/path.d.ts +1 -1
- package/dist/run-summary/path.js +1 -1
- package/dist/run-summary/share.d.ts +25 -0
- package/dist/run-summary/share.js +106 -0
- package/dist/run-summary/types.d.ts +60 -2
- package/dist/run-summary/types.js +7 -0
- package/dist/scope/acceptance-activate-gate.d.ts +23 -0
- package/dist/scope/acceptance-activate-gate.js +70 -0
- package/dist/scope/index.d.ts +1 -0
- package/dist/scope/index.js +1 -0
- package/dist/scope/transition.js +5 -0
- package/dist/session/index.d.ts +0 -1
- package/dist/session/index.js +0 -1
- package/dist/session/orientation-compression.js +19 -9
- package/dist/session/session-start.d.ts +6 -0
- package/dist/session/session-start.js +44 -22
- package/dist/session/toolchain-preflight.d.ts +15 -0
- package/dist/session/toolchain-preflight.js +65 -5
- package/dist/verify-ac/clauses.d.ts +51 -0
- package/dist/verify-ac/clauses.js +490 -0
- package/dist/verify-ac/evaluate.d.ts +73 -0
- package/dist/verify-ac/evaluate.js +167 -0
- package/dist/verify-ac/flag.d.ts +35 -0
- package/dist/verify-ac/flag.js +104 -0
- package/dist/verify-ac/index.d.ts +10 -0
- package/dist/verify-ac/index.js +10 -0
- package/package.json +7 -3
- package/dist/policy/coverage-check-resume-presets.d.ts +0 -46
- package/dist/policy/coverage-check-resume-presets.js +0 -228
- package/dist/session/coverage-check-resume-nudge.d.ts +0 -34
- package/dist/session/coverage-check-resume-nudge.js +0 -66
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apply product-oracle integrity to verify:ac (#3322).
|
|
3
|
+
*
|
|
4
|
+
* Missing run-summary is a no-op (no evidence). A flagged
|
|
5
|
+
* fail → method-change → pass without independent_rederivation fails closed.
|
|
6
|
+
* Stdout dest (`DEFT_RUN_SUMMARY_PATH=-`) evaluates the same-process
|
|
7
|
+
* attempts just emitted by this verify:ac — it does not treat non-file
|
|
8
|
+
* dest as no evidence.
|
|
9
|
+
*/
|
|
10
|
+
import type { LiteralAcceptanceRunResult } from "../literal-acceptance/types.js";
|
|
11
|
+
import { type FlaggedMethodChangePass } from "./flag.js";
|
|
12
|
+
export interface EvaluateProductOracleIntegrityOptions {
|
|
13
|
+
readonly projectRoot: string;
|
|
14
|
+
/** Injected JSONL (tests). Undefined → read dest; null → empty. */
|
|
15
|
+
readonly runSummaryText?: string | null;
|
|
16
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
17
|
+
}
|
|
18
|
+
export interface ProductOracleIntegrityVerdict {
|
|
19
|
+
readonly ok: boolean;
|
|
20
|
+
readonly code: 0 | 1;
|
|
21
|
+
readonly flagged: readonly FlaggedMethodChangePass[];
|
|
22
|
+
readonly unresolved: readonly FlaggedMethodChangePass[];
|
|
23
|
+
readonly message: string;
|
|
24
|
+
}
|
|
25
|
+
export interface OracleIntegrityResultFields {
|
|
26
|
+
readonly ok: boolean;
|
|
27
|
+
readonly code: number;
|
|
28
|
+
readonly message: string;
|
|
29
|
+
}
|
|
30
|
+
/** Stable prefix for product-oracle check ids emitted by verify:ac (#3322 / #3337). */
|
|
31
|
+
export declare const VERIFY_AC_CHECK_ID_PREFIX = "verify:ac";
|
|
32
|
+
/**
|
|
33
|
+
* Namespace product-oracle check_id per active scope (#3337).
|
|
34
|
+
*
|
|
35
|
+
* Same-session multi-active verify:ac must not pair fail/pass across briefs.
|
|
36
|
+
* Prefer plan.id or xBRIEF path as scopeKey; empty → global fallback `verify:ac`
|
|
37
|
+
* (unknown-scope single-brief / tests without a plan).
|
|
38
|
+
*/
|
|
39
|
+
export declare function verifyAcCheckId(scopeKey?: string | null): string;
|
|
40
|
+
/** Test seam: isolate stdout-dest buffer across cases. */
|
|
41
|
+
export declare function resetInProcessVerificationBuffer(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Record each executed acceptance command as a verification event (#3322).
|
|
44
|
+
* Fail-open: missing dest / write errors never change the AC result.
|
|
45
|
+
* Stdout dest also appends to the same-process buffer so evaluate can
|
|
46
|
+
* inspect this invocation without re-reading a file.
|
|
47
|
+
* check_id is namespaced per active scope when scopeKey is provided (#3337).
|
|
48
|
+
*/
|
|
49
|
+
export declare function emitVerifyAcAttempts(options: {
|
|
50
|
+
readonly projectRoot: string;
|
|
51
|
+
readonly runs: readonly LiteralAcceptanceRunResult[];
|
|
52
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
53
|
+
readonly sessionId?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Active scope identity (plan.id or xBRIEF path stem). When set, check_id
|
|
56
|
+
* becomes `verify:ac/<scopeKey>` so multi-active sessions do not false-deny (#3337).
|
|
57
|
+
*/
|
|
58
|
+
readonly scopeKey?: string | null;
|
|
59
|
+
/** Full check_id override (tests). Wins over scopeKey when non-empty. */
|
|
60
|
+
readonly checkId?: string | null;
|
|
61
|
+
/** stdout seam (tests). */
|
|
62
|
+
readonly writeStdout?: (line: string) => void;
|
|
63
|
+
}): void;
|
|
64
|
+
/**
|
|
65
|
+
* Evaluate run-summary verification events for pass-after-fail-with-method-change.
|
|
66
|
+
*/
|
|
67
|
+
export declare function evaluateProductOracleIntegrity(options: EvaluateProductOracleIntegrityOptions): ProductOracleIntegrityVerdict;
|
|
68
|
+
/**
|
|
69
|
+
* Lead the verify:ac message with any unresolved discrepancy.
|
|
70
|
+
* Config errors (code 2) stay 2; unresolved oracle is exit 1.
|
|
71
|
+
*/
|
|
72
|
+
export declare function mergeOracleVerdict<T extends OracleIntegrityResultFields>(result: T, verdict: ProductOracleIntegrityVerdict): T;
|
|
73
|
+
//# sourceMappingURL=evaluate.d.ts.map
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apply product-oracle integrity to verify:ac (#3322).
|
|
3
|
+
*
|
|
4
|
+
* Missing run-summary is a no-op (no evidence). A flagged
|
|
5
|
+
* fail → method-change → pass without independent_rederivation fails closed.
|
|
6
|
+
* Stdout dest (`DEFT_RUN_SUMMARY_PATH=-`) evaluates the same-process
|
|
7
|
+
* attempts just emitted by this verify:ac — it does not treat non-file
|
|
8
|
+
* dest as no evidence.
|
|
9
|
+
*/
|
|
10
|
+
import { randomUUID } from "node:crypto";
|
|
11
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
12
|
+
import { resolve } from "node:path";
|
|
13
|
+
import { parseRunSummaryJsonl, RunSummaryEmitter, resolveRunSummaryDestination, } from "../run-summary/index.js";
|
|
14
|
+
import { flagPassAfterFailWithMethodChange, readVerificationAttempts, unresolvedMethodChangePasses, } from "./flag.js";
|
|
15
|
+
function formatUnresolved(flag) {
|
|
16
|
+
return (`check_id=${flag.check_id} fail method=${flag.failed_method} ` +
|
|
17
|
+
`then pass method=${flag.passed_method} without independent re-derivation`);
|
|
18
|
+
}
|
|
19
|
+
/** Stable prefix for product-oracle check ids emitted by verify:ac (#3322 / #3337). */
|
|
20
|
+
export const VERIFY_AC_CHECK_ID_PREFIX = "verify:ac";
|
|
21
|
+
/**
|
|
22
|
+
* Namespace product-oracle check_id per active scope (#3337).
|
|
23
|
+
*
|
|
24
|
+
* Same-session multi-active verify:ac must not pair fail/pass across briefs.
|
|
25
|
+
* Prefer plan.id or xBRIEF path as scopeKey; empty → global fallback `verify:ac`
|
|
26
|
+
* (unknown-scope single-brief / tests without a plan).
|
|
27
|
+
*/
|
|
28
|
+
export function verifyAcCheckId(scopeKey) {
|
|
29
|
+
const key = typeof scopeKey === "string" ? scopeKey.trim() : "";
|
|
30
|
+
if (key.length === 0) {
|
|
31
|
+
return VERIFY_AC_CHECK_ID_PREFIX;
|
|
32
|
+
}
|
|
33
|
+
// Keep pairing keys readable; strip control chars that would corrupt JSONL.
|
|
34
|
+
const safe = key.replace(/[\0\n\r]/g, "_");
|
|
35
|
+
return `${VERIFY_AC_CHECK_ID_PREFIX}/${safe}`;
|
|
36
|
+
}
|
|
37
|
+
/** Same-process verification JSONL when dest is stdout (`-`). */
|
|
38
|
+
const inProcessVerificationLines = [];
|
|
39
|
+
let inProcessStdoutSessionId;
|
|
40
|
+
/** Test seam: isolate stdout-dest buffer across cases. */
|
|
41
|
+
export function resetInProcessVerificationBuffer() {
|
|
42
|
+
inProcessVerificationLines.length = 0;
|
|
43
|
+
inProcessStdoutSessionId = undefined;
|
|
44
|
+
}
|
|
45
|
+
function inProcessVerificationText() {
|
|
46
|
+
if (inProcessVerificationLines.length === 0) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return inProcessVerificationLines.join("\n");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Record each executed acceptance command as a verification event (#3322).
|
|
53
|
+
* Fail-open: missing dest / write errors never change the AC result.
|
|
54
|
+
* Stdout dest also appends to the same-process buffer so evaluate can
|
|
55
|
+
* inspect this invocation without re-reading a file.
|
|
56
|
+
* check_id is namespaced per active scope when scopeKey is provided (#3337).
|
|
57
|
+
*/
|
|
58
|
+
export function emitVerifyAcAttempts(options) {
|
|
59
|
+
if (options.runs.length === 0) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
const env = options.env ?? process.env;
|
|
64
|
+
const projectRoot = resolve(options.projectRoot);
|
|
65
|
+
const dest = resolveRunSummaryDestination(projectRoot, { env });
|
|
66
|
+
const explicitSession = options.sessionId?.trim() ||
|
|
67
|
+
(typeof env.DEFT_SESSION_ID === "string" ? env.DEFT_SESSION_ID.trim() : "");
|
|
68
|
+
let sessionId = explicitSession;
|
|
69
|
+
if (!sessionId) {
|
|
70
|
+
if (dest.kind === "stdout") {
|
|
71
|
+
inProcessStdoutSessionId ??= randomUUID();
|
|
72
|
+
sessionId = inProcessStdoutSessionId;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
sessionId = randomUUID();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const explicitCheck = typeof options.checkId === "string" && options.checkId.trim().length > 0
|
|
79
|
+
? options.checkId.trim()
|
|
80
|
+
: null;
|
|
81
|
+
const checkId = explicitCheck ?? verifyAcCheckId(options.scopeKey);
|
|
82
|
+
const emitter = new RunSummaryEmitter({
|
|
83
|
+
projectRoot,
|
|
84
|
+
sessionId,
|
|
85
|
+
env,
|
|
86
|
+
writeStdout: options.writeStdout,
|
|
87
|
+
});
|
|
88
|
+
for (const run of options.runs) {
|
|
89
|
+
const emitted = emitter.emitVerification({
|
|
90
|
+
check_id: checkId,
|
|
91
|
+
method_fingerprint: `${run.command}\0${run.cwd}`,
|
|
92
|
+
outcome: run.ok ? "pass" : "fail",
|
|
93
|
+
});
|
|
94
|
+
if (dest.kind === "stdout" && emitted.line !== null) {
|
|
95
|
+
inProcessVerificationLines.push(JSON.stringify(emitted.line));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
// fail-open
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function loadRunSummaryText(projectRoot, env) {
|
|
104
|
+
const dest = resolveRunSummaryDestination(resolve(projectRoot), { env });
|
|
105
|
+
if (dest.kind === "stdout") {
|
|
106
|
+
return inProcessVerificationText();
|
|
107
|
+
}
|
|
108
|
+
if (dest.kind !== "file") {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
if (!existsSync(dest.path)) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
return readFileSync(dest.path, "utf8");
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Evaluate run-summary verification events for pass-after-fail-with-method-change.
|
|
123
|
+
*/
|
|
124
|
+
export function evaluateProductOracleIntegrity(options) {
|
|
125
|
+
const env = options.env;
|
|
126
|
+
const text = options.runSummaryText === undefined
|
|
127
|
+
? env !== undefined
|
|
128
|
+
? loadRunSummaryText(options.projectRoot, env)
|
|
129
|
+
: null
|
|
130
|
+
: options.runSummaryText;
|
|
131
|
+
if (text === null || text.trim().length === 0) {
|
|
132
|
+
return { ok: true, code: 0, flagged: [], unresolved: [], message: "" };
|
|
133
|
+
}
|
|
134
|
+
const flagged = flagPassAfterFailWithMethodChange(readVerificationAttempts(parseRunSummaryJsonl(text)));
|
|
135
|
+
const unresolved = unresolvedMethodChangePasses(flagged);
|
|
136
|
+
if (unresolved.length === 0) {
|
|
137
|
+
return { ok: true, code: 0, flagged, unresolved, message: "" };
|
|
138
|
+
}
|
|
139
|
+
const lead = `UNRESOLVED product-oracle discrepancy (#3322): ${unresolved.map(formatUnresolved).join("; ")}. ` +
|
|
140
|
+
"Resolve by a product change (same method) or independently re-derive both sides " +
|
|
141
|
+
"and record independent_rederivation=true.";
|
|
142
|
+
return {
|
|
143
|
+
ok: false,
|
|
144
|
+
code: 1,
|
|
145
|
+
flagged,
|
|
146
|
+
unresolved,
|
|
147
|
+
message: lead,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Lead the verify:ac message with any unresolved discrepancy.
|
|
152
|
+
* Config errors (code 2) stay 2; unresolved oracle is exit 1.
|
|
153
|
+
*/
|
|
154
|
+
export function mergeOracleVerdict(result, verdict) {
|
|
155
|
+
if (verdict.ok || verdict.message.length === 0) {
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
158
|
+
const message = result.message ? `${verdict.message}\n${result.message}` : verdict.message;
|
|
159
|
+
const code = result.code === 2 ? 2 : 1;
|
|
160
|
+
return {
|
|
161
|
+
...result,
|
|
162
|
+
ok: false,
|
|
163
|
+
code,
|
|
164
|
+
message,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=evaluate.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flag fail → method-change → pass on one product-oracle check id (#3322).
|
|
3
|
+
*
|
|
4
|
+
* A red verification may be resolved only by a product change (same method)
|
|
5
|
+
* or an independently re-derived oracle (both sides rebuilt, different method).
|
|
6
|
+
* In-place comparison repair then pass is unresolved.
|
|
7
|
+
*/
|
|
8
|
+
import { type RunSummaryLine } from "../run-summary/index.js";
|
|
9
|
+
import type { VerificationOutcome } from "../run-summary/types.js";
|
|
10
|
+
export interface VerificationAttempt {
|
|
11
|
+
readonly check_id: string;
|
|
12
|
+
readonly method_fingerprint: string;
|
|
13
|
+
readonly outcome: VerificationOutcome;
|
|
14
|
+
readonly independent_rederivation: boolean;
|
|
15
|
+
/** Session that emitted the attempt; used to avoid cross-session pairing. */
|
|
16
|
+
readonly session_id: string;
|
|
17
|
+
}
|
|
18
|
+
export interface FlaggedMethodChangePass {
|
|
19
|
+
readonly check_id: string;
|
|
20
|
+
readonly failed_method: string;
|
|
21
|
+
readonly passed_method: string;
|
|
22
|
+
readonly independent_rederivation: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** Extract well-formed verification attempts in stream order. */
|
|
25
|
+
export declare function readVerificationAttempts(lines: readonly RunSummaryLine[]): VerificationAttempt[];
|
|
26
|
+
/**
|
|
27
|
+
* Flag each fail → different method → pass sequence on the same check id.
|
|
28
|
+
* Independent re-derivation is recorded on the pass event, not inferred.
|
|
29
|
+
*/
|
|
30
|
+
export declare function flagPassAfterFailWithMethodChange(attempts: readonly VerificationAttempt[]): FlaggedMethodChangePass[];
|
|
31
|
+
/** Unresolved flags: method-change pass without recorded re-derivation. */
|
|
32
|
+
export declare function unresolvedMethodChangePasses(flagged: readonly FlaggedMethodChangePass[]): FlaggedMethodChangePass[];
|
|
33
|
+
/** Parse JSONL (or DEFT-TLM capture) and flag method-change passes. */
|
|
34
|
+
export declare function flagPassAfterFailFromJsonl(text: string): FlaggedMethodChangePass[];
|
|
35
|
+
//# sourceMappingURL=flag.d.ts.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flag fail → method-change → pass on one product-oracle check id (#3322).
|
|
3
|
+
*
|
|
4
|
+
* A red verification may be resolved only by a product change (same method)
|
|
5
|
+
* or an independently re-derived oracle (both sides rebuilt, different method).
|
|
6
|
+
* In-place comparison repair then pass is unresolved.
|
|
7
|
+
*/
|
|
8
|
+
import { parseRunSummaryJsonl } from "../run-summary/index.js";
|
|
9
|
+
function asRecord(value) {
|
|
10
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
function isVerificationOutcome(value) {
|
|
16
|
+
return value === "pass" || value === "fail";
|
|
17
|
+
}
|
|
18
|
+
function readAttempt(line) {
|
|
19
|
+
if (line.event !== "verification") {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const payload = asRecord(line.payload);
|
|
23
|
+
if (payload === null) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const checkId = payload.check_id;
|
|
27
|
+
const fingerprint = payload.method_fingerprint;
|
|
28
|
+
if (typeof checkId !== "string" || checkId.trim().length === 0) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
if (typeof fingerprint !== "string" || fingerprint.trim().length === 0) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
if (!isVerificationOutcome(payload.outcome)) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
check_id: checkId,
|
|
39
|
+
method_fingerprint: fingerprint,
|
|
40
|
+
outcome: payload.outcome,
|
|
41
|
+
independent_rederivation: payload.independent_rederivation === true,
|
|
42
|
+
session_id: line.session_id,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** Extract well-formed verification attempts in stream order. */
|
|
46
|
+
export function readVerificationAttempts(lines) {
|
|
47
|
+
const attempts = [];
|
|
48
|
+
for (const line of lines) {
|
|
49
|
+
const attempt = readAttempt(line);
|
|
50
|
+
if (attempt !== null) {
|
|
51
|
+
attempts.push(attempt);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return attempts;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Flag each fail → different method → pass sequence on the same check id.
|
|
58
|
+
* Independent re-derivation is recorded on the pass event, not inferred.
|
|
59
|
+
*/
|
|
60
|
+
export function flagPassAfterFailWithMethodChange(attempts) {
|
|
61
|
+
const failedMethods = new Map();
|
|
62
|
+
const flagged = [];
|
|
63
|
+
for (const attempt of attempts) {
|
|
64
|
+
const key = `${attempt.session_id}\0${attempt.check_id}`;
|
|
65
|
+
if (attempt.outcome === "fail") {
|
|
66
|
+
const set = failedMethods.get(key) ?? new Set();
|
|
67
|
+
set.add(attempt.method_fingerprint);
|
|
68
|
+
failedMethods.set(key, set);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const prior = failedMethods.get(key);
|
|
72
|
+
if (prior === undefined || prior.size === 0) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const other = [...prior].find((method) => method !== attempt.method_fingerprint);
|
|
76
|
+
if (other !== undefined) {
|
|
77
|
+
flagged.push({
|
|
78
|
+
check_id: attempt.check_id,
|
|
79
|
+
failed_method: other,
|
|
80
|
+
passed_method: attempt.method_fingerprint,
|
|
81
|
+
independent_rederivation: attempt.independent_rederivation,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (attempt.independent_rederivation || other === undefined) {
|
|
85
|
+
failedMethods.delete(key);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
prior.delete(attempt.method_fingerprint);
|
|
89
|
+
if (prior.size === 0) {
|
|
90
|
+
failedMethods.delete(key);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return flagged;
|
|
95
|
+
}
|
|
96
|
+
/** Unresolved flags: method-change pass without recorded re-derivation. */
|
|
97
|
+
export function unresolvedMethodChangePasses(flagged) {
|
|
98
|
+
return flagged.filter((flag) => !flag.independent_rederivation);
|
|
99
|
+
}
|
|
100
|
+
/** Parse JSONL (or DEFT-TLM capture) and flag method-change passes. */
|
|
101
|
+
export function flagPassAfterFailFromJsonl(text) {
|
|
102
|
+
return flagPassAfterFailWithMethodChange(readVerificationAttempts(parseRunSummaryJsonl(text)));
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=flag.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product-oracle gate integrity for verify:ac (#3322).
|
|
3
|
+
*
|
|
4
|
+
* Extends #3156: a red product verification may not be self-adjudicated
|
|
5
|
+
* by editing the comparison. Deterministic surface is the flagged event.
|
|
6
|
+
*/
|
|
7
|
+
export { type AcceptanceClause, type AcceptanceClauseReading, type ClauseOutcome, type ClauseWalkReport, type ClauseWalkResult, deriveAcceptanceClauses, formatClauseWalkMessage, isScratchArtifactPath, readAcceptanceClauses, serializeAcceptanceClauses, stampDerivedClausesOnAcceptance, walkAcceptanceClauses, } from "./clauses.js";
|
|
8
|
+
export { type EvaluateProductOracleIntegrityOptions, emitVerifyAcAttempts, evaluateProductOracleIntegrity, mergeOracleVerdict, type OracleIntegrityResultFields, type ProductOracleIntegrityVerdict, VERIFY_AC_CHECK_ID_PREFIX, verifyAcCheckId, } from "./evaluate.js";
|
|
9
|
+
export { type FlaggedMethodChangePass, flagPassAfterFailFromJsonl, flagPassAfterFailWithMethodChange, readVerificationAttempts, unresolvedMethodChangePasses, type VerificationAttempt, } from "./flag.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product-oracle gate integrity for verify:ac (#3322).
|
|
3
|
+
*
|
|
4
|
+
* Extends #3156: a red product verification may not be self-adjudicated
|
|
5
|
+
* by editing the comparison. Deterministic surface is the flagged event.
|
|
6
|
+
*/
|
|
7
|
+
export { deriveAcceptanceClauses, formatClauseWalkMessage, isScratchArtifactPath, readAcceptanceClauses, serializeAcceptanceClauses, stampDerivedClausesOnAcceptance, walkAcceptanceClauses, } from "./clauses.js";
|
|
8
|
+
export { emitVerifyAcAttempts, evaluateProductOracleIntegrity, mergeOracleVerdict, VERIFY_AC_CHECK_ID_PREFIX, verifyAcCheckId, } from "./evaluate.js";
|
|
9
|
+
export { flagPassAfterFailFromJsonl, flagPassAfterFailWithMethodChange, readVerificationAttempts, unresolvedMethodChangePasses, } from "./flag.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deftai/directive-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.103.0",
|
|
4
4
|
"description": "TypeScript engine core for the Directive framework.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -291,6 +291,10 @@
|
|
|
291
291
|
"types": "./dist/product-first-done-gate/index.d.ts",
|
|
292
292
|
"default": "./dist/product-first-done-gate/index.js"
|
|
293
293
|
},
|
|
294
|
+
"./verify-ac": {
|
|
295
|
+
"types": "./dist/verify-ac/index.d.ts",
|
|
296
|
+
"default": "./dist/verify-ac/index.js"
|
|
297
|
+
},
|
|
294
298
|
"./packs": {
|
|
295
299
|
"types": "./dist/packs/index.d.ts",
|
|
296
300
|
"default": "./dist/packs/index.js"
|
|
@@ -378,8 +382,8 @@
|
|
|
378
382
|
"provenance": true
|
|
379
383
|
},
|
|
380
384
|
"dependencies": {
|
|
381
|
-
"@deftai/directive-content": "^0.
|
|
382
|
-
"@deftai/directive-types": "^0.
|
|
385
|
+
"@deftai/directive-content": "^0.103.0",
|
|
386
|
+
"@deftai/directive-types": "^0.103.0",
|
|
383
387
|
"archiver": "^8.0.0"
|
|
384
388
|
},
|
|
385
389
|
"scripts": {
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bundled presets for coverageDebt + checkResume (#3189).
|
|
3
|
-
*
|
|
4
|
-
* One project decision (not five micro-toggles in v1).
|
|
5
|
-
* Later does not write decided; Strict / Hatch-aware / dismiss-with-reason do.
|
|
6
|
-
*
|
|
7
|
-
* Both fields are written in a single PROJECT-DEFINITION mutation lock so a
|
|
8
|
-
* partial decision (coverageDebt decided, checkResume still unset) cannot
|
|
9
|
-
* persist after a mid-write failure.
|
|
10
|
-
*/
|
|
11
|
-
export declare const COVERAGE_CHECK_RESUME_PRESETS: readonly ["strict", "hatch-aware"];
|
|
12
|
-
export type CoverageCheckResumePreset = (typeof COVERAGE_CHECK_RESUME_PRESETS)[number];
|
|
13
|
-
export interface ApplyCoverageCheckResumePresetOptions {
|
|
14
|
-
readonly actor?: string;
|
|
15
|
-
readonly note?: string;
|
|
16
|
-
}
|
|
17
|
-
export interface ApplyCoverageCheckResumePresetResult {
|
|
18
|
-
readonly exitCode: 0 | 1 | 2;
|
|
19
|
-
readonly stdout: string;
|
|
20
|
-
readonly changed: boolean;
|
|
21
|
-
readonly preset: CoverageCheckResumePreset | "dismiss" | "later";
|
|
22
|
-
}
|
|
23
|
-
/** True when either policy is still unset (coupled v1 nag). */
|
|
24
|
-
export declare function isCoverageCheckResumeUndecided(projectRoot: string): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Apply Strict: coverageDebt.mode=off, checkResume.localStamp=off, both decided.
|
|
27
|
-
* Recommended for most apps.
|
|
28
|
-
*/
|
|
29
|
-
export declare function applyStrictCoverageCheckResumePreset(projectRoot: string, options?: ApplyCoverageCheckResumePresetOptions): ApplyCoverageCheckResumePresetResult;
|
|
30
|
-
/**
|
|
31
|
-
* Apply Hatch-aware: coverageDebt.mode=hatch autoFile=false; localStamp=on for DX.
|
|
32
|
-
* CI still never trusts local stamps.
|
|
33
|
-
*/
|
|
34
|
-
export declare function applyHatchAwareCoverageCheckResumePreset(projectRoot: string, options?: ApplyCoverageCheckResumePresetOptions): ApplyCoverageCheckResumePresetResult;
|
|
35
|
-
/**
|
|
36
|
-
* Dismiss-with-reason: marks both decided as fail-closed (mode off / localStamp off)
|
|
37
|
-
* and records the reason for policy:show / doctor visibility. Stops the session nag.
|
|
38
|
-
*/
|
|
39
|
-
export declare function dismissCoverageCheckResume(projectRoot: string, reason: string, options?: ApplyCoverageCheckResumePresetOptions): ApplyCoverageCheckResumePresetResult;
|
|
40
|
-
/**
|
|
41
|
-
* Later: does NOT write status=decided. Caller skips for this session;
|
|
42
|
-
* next session-start ritual nags again.
|
|
43
|
-
*/
|
|
44
|
-
export declare function applyLaterCoverageCheckResumeSkip(): ApplyCoverageCheckResumePresetResult;
|
|
45
|
-
export declare function formatCoverageCheckResumeBundleStatus(projectRoot: string): string;
|
|
46
|
-
//# sourceMappingURL=coverage-check-resume-presets.d.ts.map
|