@deftai/directive-core 0.99.0 → 0.101.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/actions.d.ts +6 -0
- package/dist/authz/actions.js +3 -0
- package/dist/authz/classify.js +241 -30
- package/dist/authz/decompose-apply.d.ts +81 -0
- package/dist/authz/decompose-apply.js +377 -0
- package/dist/authz/index.d.ts +3 -1
- package/dist/authz/index.js +3 -1
- package/dist/authz/store.d.ts +53 -0
- package/dist/authz/store.js +219 -1
- package/dist/authz/types.d.ts +19 -2
- package/dist/authz/types.js +5 -1
- package/dist/check/cached-orchestrator.d.ts +26 -5
- package/dist/check/cached-orchestrator.js +228 -6
- package/dist/check/gate-lists.d.ts +10 -4
- package/dist/check/gate-lists.js +19 -5
- package/dist/check/index.d.ts +3 -2
- package/dist/check/index.js +2 -1
- package/dist/check/named-cause.d.ts +45 -0
- package/dist/check/named-cause.js +121 -0
- package/dist/check/orchestrator.js +6 -1
- package/dist/doctor/checks.d.ts +44 -0
- package/dist/doctor/checks.js +428 -2
- package/dist/doctor/help.d.ts +5 -0
- package/dist/doctor/help.js +31 -0
- package/dist/doctor/index.d.ts +2 -0
- package/dist/doctor/index.js +2 -0
- package/dist/doctor/main.d.ts +6 -7
- package/dist/doctor/main.js +130 -79
- package/dist/doctor/session-coda.d.ts +82 -0
- package/dist/doctor/session-coda.js +151 -0
- package/dist/doctor/types.d.ts +16 -0
- package/dist/doctor/which.d.ts +20 -1
- package/dist/doctor/which.js +67 -1
- package/dist/finish-loop/pr-finish-loop.d.ts +13 -2
- package/dist/finish-loop/pr-finish-loop.js +116 -5
- package/dist/finish-loop/types.d.ts +1 -1
- package/dist/hooks/dispatcher.d.ts +9 -5
- package/dist/hooks/dispatcher.js +23 -15
- package/dist/hooks/readonly.d.ts +6 -3
- package/dist/hooks/readonly.js +44 -25
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/init-deposit/agent-hooks.d.ts +20 -0
- package/dist/init-deposit/agent-hooks.js +51 -31
- package/dist/init-deposit/gitignore.js +2 -0
- package/dist/intake/issue-ingest.js +36 -0
- package/dist/lifecycle/completed-consistency.d.ts +60 -0
- package/dist/lifecycle/completed-consistency.js +443 -0
- package/dist/lifecycle/completed-tracked-on-delivery.d.ts +47 -0
- package/dist/lifecycle/completed-tracked-on-delivery.js +415 -0
- package/dist/lifecycle/index.d.ts +2 -0
- package/dist/lifecycle/index.js +2 -0
- package/dist/literal-acceptance/capture.d.ts +52 -0
- package/dist/literal-acceptance/capture.js +658 -0
- package/dist/literal-acceptance/evaluate.d.ts +47 -0
- package/dist/literal-acceptance/evaluate.js +193 -0
- package/dist/literal-acceptance/index.d.ts +12 -0
- package/dist/literal-acceptance/index.js +12 -0
- package/dist/literal-acceptance/run.d.ts +38 -0
- package/dist/literal-acceptance/run.js +216 -0
- package/dist/literal-acceptance/safety.d.ts +24 -0
- package/dist/literal-acceptance/safety.js +251 -0
- package/dist/literal-acceptance/types.d.ts +82 -0
- package/dist/literal-acceptance/types.js +26 -0
- package/dist/policy/ac-pass-banking.d.ts +58 -0
- package/dist/policy/ac-pass-banking.js +150 -0
- package/dist/policy/ceremony-dial.d.ts +96 -11
- package/dist/policy/ceremony-dial.js +250 -23
- package/dist/policy/index.d.ts +2 -0
- package/dist/policy/index.js +16 -1
- package/dist/policy/merge-approval-head.d.ts +129 -0
- package/dist/policy/merge-approval-head.js +461 -0
- package/dist/policy/require-human-merge.d.ts +5 -0
- package/dist/policy/require-human-merge.js +5 -0
- package/dist/pr-merge-readiness/ci-gate.d.ts +20 -3
- package/dist/pr-merge-readiness/ci-gate.js +65 -5
- package/dist/pr-merge-readiness/compute.d.ts +13 -0
- package/dist/pr-merge-readiness/compute.js +99 -14
- package/dist/pr-merge-readiness/gh.d.ts +49 -0
- package/dist/pr-merge-readiness/gh.js +268 -0
- package/dist/pr-merge-readiness/index.d.ts +2 -2
- package/dist/pr-merge-readiness/index.js +2 -2
- package/dist/pr-merge-readiness/test-gh-fixtures.helpers.js +4 -0
- package/dist/pr-wait-mergeable/cascade.d.ts +11 -0
- package/dist/pr-wait-mergeable/cascade.js +115 -1
- package/dist/pr-wait-mergeable/main.d.ts +4 -0
- package/dist/pr-wait-mergeable/main.js +4 -0
- package/dist/pr-wait-mergeable/types.d.ts +3 -1
- package/dist/pr-wait-mergeable/wrappers.d.ts +6 -1
- package/dist/pr-wait-mergeable/wrappers.js +7 -1
- package/dist/preflight/evaluate.d.ts +15 -1
- package/dist/preflight/evaluate.js +33 -2
- package/dist/preflight-cache/evaluate.d.ts +3 -0
- package/dist/preflight-cache/evaluate.js +3 -0
- package/dist/product-first-done-gate/acceptance.d.ts +25 -0
- package/dist/product-first-done-gate/acceptance.js +247 -0
- package/dist/product-first-done-gate/check-mode.d.ts +45 -0
- package/dist/product-first-done-gate/check-mode.js +148 -0
- package/dist/product-first-done-gate/evaluate.d.ts +50 -0
- package/dist/product-first-done-gate/evaluate.js +255 -0
- package/dist/product-first-done-gate/index.d.ts +11 -0
- package/dist/product-first-done-gate/index.js +11 -0
- package/dist/product-first-done-gate/types.d.ts +64 -0
- package/dist/product-first-done-gate/types.js +61 -0
- package/dist/render/framework-commands.js +4 -0
- package/dist/run-summary/emit.d.ts +56 -0
- package/dist/run-summary/emit.js +171 -0
- package/dist/run-summary/index.d.ts +4 -0
- package/dist/run-summary/index.js +4 -0
- package/dist/run-summary/path.d.ts +25 -0
- package/dist/run-summary/path.js +78 -0
- package/dist/run-summary/types.d.ts +76 -0
- package/dist/run-summary/types.js +21 -0
- package/dist/scope/acceptance-evidence.d.ts +110 -0
- package/dist/scope/acceptance-evidence.js +422 -0
- package/dist/scope/coverage-map.d.ts +98 -0
- package/dist/scope/coverage-map.js +558 -0
- package/dist/scope/decompose.d.ts +5 -0
- package/dist/scope/decompose.js +134 -11
- package/dist/scope/index.d.ts +3 -0
- package/dist/scope/index.js +3 -0
- package/dist/scope/parent-lineage.d.ts +125 -0
- package/dist/scope/parent-lineage.js +626 -0
- package/dist/scope/transition.d.ts +8 -0
- package/dist/scope/transition.js +61 -2
- package/dist/session/ac-pass-banking.d.ts +221 -0
- package/dist/session/ac-pass-banking.js +761 -0
- package/dist/session/active-cli.d.ts +79 -0
- package/dist/session/active-cli.js +382 -0
- package/dist/session/deposit-sha.d.ts +49 -0
- package/dist/session/deposit-sha.js +121 -0
- package/dist/session/effort-budget.d.ts +136 -0
- package/dist/session/effort-budget.js +352 -0
- package/dist/session/index.d.ts +7 -0
- package/dist/session/index.js +7 -0
- package/dist/session/orientation-compression.d.ts +127 -0
- package/dist/session/orientation-compression.js +425 -0
- package/dist/session/orientation-state.d.ts +29 -0
- package/dist/session/orientation-state.js +85 -0
- package/dist/session/session-start.d.ts +31 -0
- package/dist/session/session-start.js +228 -2
- package/dist/session/toolchain-preflight.d.ts +64 -0
- package/dist/session/toolchain-preflight.js +151 -0
- package/dist/session/verify-session-ritual.d.ts +14 -0
- package/dist/session/verify-session-ritual.js +33 -0
- package/dist/story-ready/evaluate.d.ts +11 -0
- package/dist/story-ready/evaluate.js +41 -3
- package/dist/triage/actions/candidates-log.d.ts +1 -2
- package/dist/triage/actions/candidates-log.js +37 -6
- package/dist/triage/bootstrap/gitignore.d.ts +1 -1
- package/dist/triage/bootstrap/gitignore.js +8 -2
- package/dist/triage/bootstrap/index.js +15 -3
- package/dist/triage/classify/index.d.ts +1 -0
- package/dist/triage/classify/index.js +2 -0
- package/dist/triage/classify/label-mirror.js +16 -0
- package/dist/triage/classify/mirror-discovery-tip.d.ts +95 -0
- package/dist/triage/classify/mirror-discovery-tip.js +234 -0
- package/dist/triage/reconcile/reconcile.js +28 -6
- package/dist/triage/summary/index.js +12 -4
- package/dist/triage/welcome/default-mode.js +16 -0
- package/dist/ts-check-lane/run-lane.js +21 -4
- package/dist/vbrief-validate/conformance.js +7 -0
- package/dist/vitest-runner/coverage-debt-teardown.js +16 -4
- package/dist/xbrief-migrate/migrate-project.d.ts +4 -0
- package/dist/xbrief-migrate/migrate-project.js +92 -3
- package/package.json +15 -3
package/dist/scope/transition.js
CHANGED
|
@@ -3,6 +3,9 @@ import { dirname, join, resolve } from "node:path";
|
|
|
3
3
|
import { InstrumentedVbriefCrud, persistCrudMetrics } from "../eval/crud-telemetry.js";
|
|
4
4
|
import { assertProjectionContained, ProjectionContainmentError, } from "../fs/projection-containment.js";
|
|
5
5
|
import { hasArtifactSuffix } from "../layout/resolve.js";
|
|
6
|
+
import { evaluateCompletedPlanConsistency } from "../lifecycle/completed-consistency.js";
|
|
7
|
+
import { evaluateLiteralAcceptanceFromPlan } from "../literal-acceptance/index.js";
|
|
8
|
+
import { evaluateAcceptanceEvidenceGate, formatAcceptanceCompletionListing, } from "./acceptance-evidence.js";
|
|
6
9
|
import { append, canonicalLogPath, newDecisionId } from "./audit-log.js";
|
|
7
10
|
import { atomicWriteBrief, formatBriefJson, readBriefForMutation } from "./brief-io.js";
|
|
8
11
|
import { stampCompletionMetadata } from "./capacity-stamp.js";
|
|
@@ -165,16 +168,65 @@ export function runTransition(action, filePath, now = new Date(), options = {})
|
|
|
165
168
|
stampDeliveryProvenance(planObj, gate.provenance);
|
|
166
169
|
}
|
|
167
170
|
}
|
|
171
|
+
// #3240: per-criterion typed evidence or human-origin disposition before auto-advance.
|
|
172
|
+
let acceptanceReports;
|
|
173
|
+
let acceptanceListing = "";
|
|
174
|
+
if (act === "complete" && options.skipAcceptanceEvidenceGate !== true) {
|
|
175
|
+
const acceptanceGate = evaluateAcceptanceEvidenceGate(planObj);
|
|
176
|
+
acceptanceReports = acceptanceGate.reports;
|
|
177
|
+
if (!acceptanceGate.ok) {
|
|
178
|
+
return {
|
|
179
|
+
ok: false,
|
|
180
|
+
message: acceptanceGate.message,
|
|
181
|
+
acceptanceReports: acceptanceGate.reports,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
acceptanceListing = formatAcceptanceCompletionListing(acceptanceGate.reports);
|
|
185
|
+
// #3267: run agent-authored literal AC before complete; re-scan narratives so
|
|
186
|
+
// narrative-only stated commands fail closed (promote required) rather than skip.
|
|
187
|
+
const literalGate = evaluateLiteralAcceptanceFromPlan(planObj, {
|
|
188
|
+
projectRoot,
|
|
189
|
+
captureFromNarratives: true,
|
|
190
|
+
});
|
|
191
|
+
if (!literalGate.ok) {
|
|
192
|
+
return {
|
|
193
|
+
ok: false,
|
|
194
|
+
message: `Literal acceptance-command gate failed before scope:complete (#3267).\n` +
|
|
195
|
+
literalGate.message,
|
|
196
|
+
acceptanceReports: acceptanceGate.reports,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
if (literalGate.commands.length > 0 || literalGate.message.length > 0) {
|
|
200
|
+
acceptanceListing =
|
|
201
|
+
acceptanceListing.length > 0
|
|
202
|
+
? `${acceptanceListing}\n${literalGate.message}`
|
|
203
|
+
: literalGate.message;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
168
206
|
planObj.status = targetStatus;
|
|
169
207
|
planObj.updated = nowIso;
|
|
170
208
|
// Keep the envelope clock aligned with plan.updated on every mutating transition (#2862).
|
|
171
209
|
stampEnvelopeUpdated(data, nowIso);
|
|
172
210
|
// Reconcile the completing brief's own plan.items (mirrors #1527 / #2566 registry sync) (#2862).
|
|
211
|
+
// On complete, items only reach here when #3240 evidence/disposition gate passed.
|
|
173
212
|
if (OWN_ITEMS_RECONCILE_ACTIONS.has(act)) {
|
|
174
213
|
advanceNonTerminalOwnItems(planObj.items, targetStatus);
|
|
175
214
|
}
|
|
176
215
|
if (act === "complete") {
|
|
177
216
|
stampCompletionMetadata(planObj, projectRoot, nowIso);
|
|
217
|
+
// #3242 / epic #3237 Q4: after reconcile, completed lifecycle must match
|
|
218
|
+
// plan.status=completed and terminal plan.items (compose with #3240).
|
|
219
|
+
const consistency = evaluateCompletedPlanConsistency(planObj, {
|
|
220
|
+
relPath: basename,
|
|
221
|
+
requireStatus: "completed",
|
|
222
|
+
});
|
|
223
|
+
if (!consistency.ok) {
|
|
224
|
+
return {
|
|
225
|
+
ok: false,
|
|
226
|
+
message: consistency.message,
|
|
227
|
+
acceptanceReports,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
178
230
|
}
|
|
179
231
|
const formatted = formatBriefJson(data);
|
|
180
232
|
const crud = new InstrumentedVbriefCrud({ now: () => now });
|
|
@@ -219,12 +271,16 @@ export function runTransition(action, filePath, now = new Date(), options = {})
|
|
|
219
271
|
ok: false,
|
|
220
272
|
message: `${actionLabel} ${basename}: brief moved to ${targetFolder}/ but ` +
|
|
221
273
|
`PROJECT-DEFINITION sync failed: ${pdSyncError}`,
|
|
274
|
+
acceptanceReports,
|
|
222
275
|
};
|
|
223
276
|
}
|
|
224
277
|
syncSpecificationAfterScopeMove(data, resolvedPath, destPath, vbriefRoot, targetStatus);
|
|
278
|
+
const moveMsg = `${actionLabel} ${basename}: ${currentFolder}/ -> ${targetFolder}/ (status: ${targetStatus})` +
|
|
279
|
+
(acceptanceListing.length > 0 ? `\n${acceptanceListing}` : "");
|
|
225
280
|
return {
|
|
226
281
|
ok: true,
|
|
227
|
-
message:
|
|
282
|
+
message: moveMsg,
|
|
283
|
+
acceptanceReports,
|
|
228
284
|
};
|
|
229
285
|
}
|
|
230
286
|
const writeResult = atomicWriteBrief(resolvedPath, data, vbriefRoot, { projectRoot });
|
|
@@ -239,9 +295,12 @@ export function runTransition(action, filePath, now = new Date(), options = {})
|
|
|
239
295
|
/* best-effort telemetry persistence */
|
|
240
296
|
}
|
|
241
297
|
const actionLabel = STAY_LABELS[act] ?? act.charAt(0).toUpperCase() + act.slice(1);
|
|
298
|
+
const stayMsg = `${actionLabel} ${basename}: stays in ${currentFolder}/ (status: ${targetStatus})` +
|
|
299
|
+
(acceptanceListing.length > 0 ? `\n${acceptanceListing}` : "");
|
|
242
300
|
return {
|
|
243
301
|
ok: true,
|
|
244
|
-
message:
|
|
302
|
+
message: stayMsg,
|
|
303
|
+
acceptanceReports,
|
|
245
304
|
};
|
|
246
305
|
}
|
|
247
306
|
export function recordWipCapOverride(filePath, projectRoot, check, now = new Date()) {
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AC-pass banking checkpoint (#3285).
|
|
3
|
+
*
|
|
4
|
+
* When stated acceptance criteria first pass, FINALIZE: record a durable bank
|
|
5
|
+
* checkpoint, optionally append a bank-event to the run summary, and refuse
|
|
6
|
+
* self-imposed deepening unless remaining budget meets the surplus threshold
|
|
7
|
+
* (default 20% of max turns/cost). Post-bank out-of-scope findings are
|
|
8
|
+
* reported, not chased, when surplus is insufficient.
|
|
9
|
+
*
|
|
10
|
+
* Sharpens #3266 bank-the-pass. Composes product-first done-gate (#3284) and
|
|
11
|
+
* optional DEFT_RUN_SUMMARY_PATH telemetry (#3282 hook, fail-open).
|
|
12
|
+
*/
|
|
13
|
+
import { type AcPassBankingConfig } from "../policy/ac-pass-banking.js";
|
|
14
|
+
import type { HardEffortBudget, VerificationDepthPolicy } from "./effort-budget.js";
|
|
15
|
+
/** Durable bank ledger directory (gitignored under `.deft/`). */
|
|
16
|
+
export declare const AC_PASS_BANK_DIR = ".deft/ac-pass-banks";
|
|
17
|
+
export declare const AC_PASS_BANK_SCHEMA_VERSION: 1;
|
|
18
|
+
/** Env path for optional JSONL run summary (#3282). Unset = silent. */
|
|
19
|
+
export declare const ENV_RUN_SUMMARY_PATH = "DEFT_RUN_SUMMARY_PATH";
|
|
20
|
+
export type PostBankFindingAction = "report" | "chase" | "fix-regression";
|
|
21
|
+
export type AcPassNextAction = "still_open" | "finalize_and_ship" | "finalize_and_deepen";
|
|
22
|
+
export interface SurplusEvaluation {
|
|
23
|
+
readonly hasSurplus: boolean;
|
|
24
|
+
/** Remaining / max when both known; null when unknown. */
|
|
25
|
+
readonly remainingFraction: number | null;
|
|
26
|
+
readonly surplusThreshold: number;
|
|
27
|
+
readonly axis: "turns" | "cost" | "both" | "unknown";
|
|
28
|
+
readonly reason: string;
|
|
29
|
+
}
|
|
30
|
+
export interface PostBankFinding {
|
|
31
|
+
readonly summary: string;
|
|
32
|
+
readonly action: PostBankFindingAction;
|
|
33
|
+
readonly recordedAt: string;
|
|
34
|
+
readonly regressesStatedAc: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface AcPassBankRecord {
|
|
37
|
+
readonly schemaVersion: typeof AC_PASS_BANK_SCHEMA_VERSION;
|
|
38
|
+
readonly scopeId: string;
|
|
39
|
+
readonly bankedAt: string;
|
|
40
|
+
readonly headSha: string | null;
|
|
41
|
+
readonly remainingTurns: number | null;
|
|
42
|
+
readonly remainingBudget: number | null;
|
|
43
|
+
readonly maxTurns: number | null;
|
|
44
|
+
readonly maxBudget: number | null;
|
|
45
|
+
readonly surplusThreshold: number;
|
|
46
|
+
readonly hadSurplus: boolean;
|
|
47
|
+
readonly nextAction: Exclude<AcPassNextAction, "still_open">;
|
|
48
|
+
readonly postBankFindings: readonly PostBankFinding[];
|
|
49
|
+
}
|
|
50
|
+
export interface EvaluateSurplusInput {
|
|
51
|
+
readonly budget: HardEffortBudget;
|
|
52
|
+
/** Fraction 0–1; default from policy / {@link DEFAULT_SURPLUS_THRESHOLD}. */
|
|
53
|
+
readonly surplusThreshold?: number;
|
|
54
|
+
}
|
|
55
|
+
export interface EvaluateAcPassBankingInput {
|
|
56
|
+
readonly budget: HardEffortBudget;
|
|
57
|
+
/** Whether stated AC (verify:ac / official checker) is met. */
|
|
58
|
+
readonly statedAcceptanceMet: boolean;
|
|
59
|
+
readonly config?: Partial<AcPassBankingConfig>;
|
|
60
|
+
/** Absolute turn reserve floor (still applied; #3266). Default 3. */
|
|
61
|
+
readonly deepenReserveTurns?: number;
|
|
62
|
+
readonly deepenReserveBudget?: number | null;
|
|
63
|
+
}
|
|
64
|
+
export interface AcPassBankingDecision {
|
|
65
|
+
readonly nextAction: AcPassNextAction;
|
|
66
|
+
readonly surplus: SurplusEvaluation;
|
|
67
|
+
readonly depthPolicy: VerificationDepthPolicy;
|
|
68
|
+
readonly deepeningAllowed: boolean;
|
|
69
|
+
readonly notes: readonly string[];
|
|
70
|
+
}
|
|
71
|
+
export interface BankAcPassInput {
|
|
72
|
+
readonly projectRoot: string;
|
|
73
|
+
readonly scopeId: string;
|
|
74
|
+
readonly budget: HardEffortBudget;
|
|
75
|
+
readonly surplus: SurplusEvaluation;
|
|
76
|
+
readonly nextAction: Exclude<AcPassNextAction, "still_open">;
|
|
77
|
+
readonly headSha?: string | null;
|
|
78
|
+
readonly now?: string;
|
|
79
|
+
readonly environ?: Readonly<Record<string, string | undefined>>;
|
|
80
|
+
}
|
|
81
|
+
export interface DecidePostBankFindingInput {
|
|
82
|
+
readonly findingSummary: string;
|
|
83
|
+
readonly regressesStatedAc: boolean;
|
|
84
|
+
readonly hasSurplus: boolean;
|
|
85
|
+
readonly now?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Evaluate whether remaining budget meets the surplus threshold (#3285).
|
|
89
|
+
*
|
|
90
|
+
* When max is known: remaining/max >= threshold on every known axis.
|
|
91
|
+
* When only remaining is known (no max): surplus is false (fail-safe) —
|
|
92
|
+
* absolute #3266 reserve still applies separately via recommendVerificationDepth.
|
|
93
|
+
*/
|
|
94
|
+
export declare function evaluateSurplus(input: EvaluateSurplusInput): SurplusEvaluation;
|
|
95
|
+
/**
|
|
96
|
+
* Full AC-pass banking decision: still open / finalize+ship / finalize+deepen.
|
|
97
|
+
*/
|
|
98
|
+
export declare function evaluateAcPassBanking(input: EvaluateAcPassBankingInput): AcPassBankingDecision;
|
|
99
|
+
/**
|
|
100
|
+
* Post-bank finding disposition: report (default) vs chase (only with surplus)
|
|
101
|
+
* vs fix-regression (always when stated AC regressed).
|
|
102
|
+
*/
|
|
103
|
+
export declare function decidePostBankFinding(input: DecidePostBankFindingInput): PostBankFinding;
|
|
104
|
+
export declare function acPassBanksDir(projectRoot: string): string;
|
|
105
|
+
/**
|
|
106
|
+
* Sanitize scopeId for a ledger filename without unbounded quantifiers (CodeQL).
|
|
107
|
+
* Walks characters once — O(n), no ReDoS risk on pathological "-" runs.
|
|
108
|
+
*/
|
|
109
|
+
export declare function sanitizeScopeIdForFilename(scopeId: string): string;
|
|
110
|
+
/** Stable filename for a scope bank record. */
|
|
111
|
+
export declare function acPassBankFilename(scopeId: string): string;
|
|
112
|
+
export declare function acPassBankPath(projectRoot: string, scopeId: string): string;
|
|
113
|
+
/**
|
|
114
|
+
* Persist a bank checkpoint that survives session death (#3285).
|
|
115
|
+
* Also appends a bank-event to DEFT_RUN_SUMMARY_PATH when set (fail-open).
|
|
116
|
+
*/
|
|
117
|
+
/** Append-only findings journal (never truncated by re-bank). */
|
|
118
|
+
export declare function acPassFindingsJournalPath(projectRoot: string, scopeId: string): string;
|
|
119
|
+
export declare function bankAcPass(input: BankAcPassInput): AcPassBankRecord;
|
|
120
|
+
/** Recover complete JSON objects from a (possibly truncated) array body. */
|
|
121
|
+
export declare function recoverCompleteJsonObjects(arrayBody: string): readonly unknown[];
|
|
122
|
+
export declare function recoverFindingsFromLedgerText(raw: string): readonly PostBankFinding[];
|
|
123
|
+
/**
|
|
124
|
+
* Load bank record. When both primary and .tmp exist, prefer a fully-valid
|
|
125
|
+
* JSON primary over a partial tmp, and union recovered findings so partial
|
|
126
|
+
* recovery cannot erase durable history (#3285 Greptile residual).
|
|
127
|
+
*/
|
|
128
|
+
export declare function readAcPassBank(projectRoot: string, scopeId: string): AcPassBankRecord | null;
|
|
129
|
+
/**
|
|
130
|
+
* Append a post-bank finding to an existing bank record (report/chase/fix).
|
|
131
|
+
*/
|
|
132
|
+
export declare function recordPostBankFinding(projectRoot: string, scopeId: string, finding: PostBankFinding): AcPassBankRecord | null;
|
|
133
|
+
export interface BankEventPayload {
|
|
134
|
+
readonly type: "ac_pass_bank" | "ac_pass_post_bank_finding" | "ac_pass_deepening_skipped";
|
|
135
|
+
readonly schemaVersion: number;
|
|
136
|
+
readonly scopeId?: string;
|
|
137
|
+
readonly bankedAt?: string;
|
|
138
|
+
readonly nextAction?: string;
|
|
139
|
+
readonly hadSurplus?: boolean;
|
|
140
|
+
readonly surplusThreshold?: number;
|
|
141
|
+
readonly remainingFraction?: number | null;
|
|
142
|
+
readonly remainingTurns?: number | null;
|
|
143
|
+
readonly remainingBudget?: number | null;
|
|
144
|
+
readonly maxTurns?: number | null;
|
|
145
|
+
readonly maxBudget?: number | null;
|
|
146
|
+
readonly headSha?: string | null;
|
|
147
|
+
readonly path?: string;
|
|
148
|
+
readonly finding?: PostBankFinding;
|
|
149
|
+
readonly note?: string;
|
|
150
|
+
readonly [key: string]: unknown;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Format one JSONL bank-event line for run-summary telemetry (#3285 / #3282).
|
|
154
|
+
*/
|
|
155
|
+
export declare function formatBankEventLine(event: BankEventPayload): string;
|
|
156
|
+
/**
|
|
157
|
+
* Append bank event to DEFT_RUN_SUMMARY_PATH when set.
|
|
158
|
+
* Unset = silent. `-` = stdout. Failures warn once to stderr (fail-open).
|
|
159
|
+
*/
|
|
160
|
+
export declare function appendBankEventToRunSummary(input: {
|
|
161
|
+
readonly environ?: Readonly<Record<string, string | undefined>>;
|
|
162
|
+
readonly event: BankEventPayload;
|
|
163
|
+
readonly writeLine?: (path: string, line: string) => void;
|
|
164
|
+
readonly warn?: (message: string) => void;
|
|
165
|
+
}): {
|
|
166
|
+
written: boolean;
|
|
167
|
+
path: string | null;
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* Simulated run used by the surplus-insufficient acceptance test (#3285):
|
|
171
|
+
* AC passes → bank → extra checks would exceed budget → ship + report finding.
|
|
172
|
+
*/
|
|
173
|
+
export declare function simulateSurplusInsufficientRun(input: {
|
|
174
|
+
readonly projectRoot: string;
|
|
175
|
+
readonly scopeId: string;
|
|
176
|
+
readonly budget: HardEffortBudget;
|
|
177
|
+
readonly findingSummary: string;
|
|
178
|
+
readonly surplusThreshold?: number;
|
|
179
|
+
readonly headSha?: string | null;
|
|
180
|
+
readonly now?: string;
|
|
181
|
+
readonly environ?: Readonly<Record<string, string | undefined>>;
|
|
182
|
+
}): {
|
|
183
|
+
readonly decision: AcPassBankingDecision;
|
|
184
|
+
readonly bank: AcPassBankRecord;
|
|
185
|
+
readonly finding: PostBankFinding;
|
|
186
|
+
readonly shipped: boolean;
|
|
187
|
+
readonly findingAction: PostBankFindingAction;
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Resolve policy config for a project root (typed → env → default).
|
|
191
|
+
*/
|
|
192
|
+
export declare function resolveBankingConfigForRoot(projectRoot?: string | null, environ?: Readonly<Record<string, string | undefined>>): AcPassBankingConfig;
|
|
193
|
+
export interface MaybeBankOnAcPassInput {
|
|
194
|
+
readonly projectRoot: string;
|
|
195
|
+
/** plan.id or path-derived scope key. */
|
|
196
|
+
readonly scopeId: string;
|
|
197
|
+
readonly budget?: HardEffortBudget;
|
|
198
|
+
readonly config?: Partial<AcPassBankingConfig>;
|
|
199
|
+
readonly headSha?: string | null;
|
|
200
|
+
readonly now?: string;
|
|
201
|
+
readonly environ?: Readonly<Record<string, string | undefined>>;
|
|
202
|
+
/**
|
|
203
|
+
* Only bank when real acceptance commands executed and passed.
|
|
204
|
+
* Soft/advisory passes with zero runs do not bank.
|
|
205
|
+
*/
|
|
206
|
+
readonly executableRuns: number;
|
|
207
|
+
readonly quiet?: boolean;
|
|
208
|
+
}
|
|
209
|
+
export interface MaybeBankOnAcPassResult {
|
|
210
|
+
readonly banked: boolean;
|
|
211
|
+
readonly decision: AcPassBankingDecision | null;
|
|
212
|
+
readonly bank: AcPassBankRecord | null;
|
|
213
|
+
readonly notes: readonly string[];
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Production bridge (#3285 Greptile P1): after verify:ac reports executable
|
|
217
|
+
* success, FINALIZE the bank checkpoint + surplus decision.
|
|
218
|
+
* Throws on I/O failure so verify:ac can fail closed (checkpoint mandatory).
|
|
219
|
+
*/
|
|
220
|
+
export declare function maybeBankOnAcPass(input: MaybeBankOnAcPassInput): MaybeBankOnAcPassResult;
|
|
221
|
+
//# sourceMappingURL=ac-pass-banking.d.ts.map
|