@telora/daemon 0.19.74 → 0.19.82
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/build-info.json +5 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +23 -0
- package/dist/config.js.map +1 -1
- package/dist/focus-executor.d.ts.map +1 -1
- package/dist/focus-executor.js +40 -5
- package/dist/focus-executor.js.map +1 -1
- package/dist/focus-merge.js +3 -3
- package/dist/focus-merge.js.map +1 -1
- package/dist/focus-prompt-builder.d.ts.map +1 -1
- package/dist/focus-prompt-builder.js +4 -1
- package/dist/focus-prompt-builder.js.map +1 -1
- package/dist/prompt-contradictions.d.ts +55 -0
- package/dist/prompt-contradictions.d.ts.map +1 -0
- package/dist/prompt-contradictions.js +114 -0
- package/dist/prompt-contradictions.js.map +1 -0
- package/dist/prompt-listing.d.ts +19 -0
- package/dist/prompt-listing.d.ts.map +1 -1
- package/dist/prompt-listing.js +49 -0
- package/dist/prompt-listing.js.map +1 -1
- package/dist/prompt-sections/execution-sections.d.ts +3 -2
- package/dist/prompt-sections/execution-sections.d.ts.map +1 -1
- package/dist/prompt-sections/execution-sections.js +70 -97
- package/dist/prompt-sections/execution-sections.js.map +1 -1
- package/dist/prompt-sections/role-sections.js +2 -2
- package/dist/prompt-sections/role-sections.js.map +1 -1
- package/dist/queries/context-assembly.d.ts +14 -4
- package/dist/queries/context-assembly.d.ts.map +1 -1
- package/dist/queries/context-assembly.js +14 -4
- package/dist/queries/context-assembly.js.map +1 -1
- package/dist/queries/deliveries.d.ts +30 -0
- package/dist/queries/deliveries.d.ts.map +1 -1
- package/dist/queries/deliveries.js.map +1 -1
- package/dist/queries/focuses.d.ts +0 -7
- package/dist/queries/focuses.d.ts.map +1 -1
- package/dist/queries/focuses.js +0 -9
- package/dist/queries/focuses.js.map +1 -1
- package/dist/queries/index.d.ts +1 -1
- package/dist/queries/index.d.ts.map +1 -1
- package/dist/queries/index.js +1 -1
- package/dist/queries/index.js.map +1 -1
- package/dist/resolvers/escalation-answers.d.ts +40 -0
- package/dist/resolvers/escalation-answers.d.ts.map +1 -1
- package/dist/resolvers/escalation-answers.js +54 -35
- package/dist/resolvers/escalation-answers.js.map +1 -1
- package/dist/resolvers/shared/wiki.d.ts +27 -0
- package/dist/resolvers/shared/wiki.d.ts.map +1 -1
- package/dist/resolvers/shared/wiki.js +39 -0
- package/dist/resolvers/shared/wiki.js.map +1 -1
- package/dist/spawn/delivered-manifest.d.ts +42 -0
- package/dist/spawn/delivered-manifest.d.ts.map +1 -0
- package/dist/spawn/delivered-manifest.js +64 -0
- package/dist/spawn/delivered-manifest.js.map +1 -0
- package/dist/spawn/process-spawn.d.ts +9 -0
- package/dist/spawn/process-spawn.d.ts.map +1 -1
- package/dist/spawn/process-spawn.js +8 -1
- package/dist/spawn/process-spawn.js.map +1 -1
- package/dist/spawn/prompt-assembly.d.ts +28 -1
- package/dist/spawn/prompt-assembly.d.ts.map +1 -1
- package/dist/spawn/prompt-assembly.js +16 -7
- package/dist/spawn/prompt-assembly.js.map +1 -1
- package/dist/spawn/shared.d.ts +27 -3
- package/dist/spawn/shared.d.ts.map +1 -1
- package/dist/spawn/spawn-decision.d.ts +50 -0
- package/dist/spawn/spawn-decision.d.ts.map +1 -1
- package/dist/spawn/spawn-decision.js +114 -38
- package/dist/spawn/spawn-decision.js.map +1 -1
- package/dist/spawner/lifecycle.js +3 -3
- package/dist/spawner/lifecycle.js.map +1 -1
- package/dist/spawner/resolution.js +3 -3
- package/dist/spawner/resolution.js.map +1 -1
- package/dist/types/config.d.ts +44 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/verification-baseline.d.ts +112 -0
- package/dist/verification-baseline.d.ts.map +1 -0
- package/dist/verification-baseline.js +264 -0
- package/dist/verification-baseline.js.map +1 -0
- package/dist/verification-config.d.ts +53 -0
- package/dist/verification-config.d.ts.map +1 -0
- package/dist/verification-config.js +72 -0
- package/dist/verification-config.js.map +1 -0
- package/dist/verification-default-on.d.ts +87 -0
- package/dist/verification-default-on.d.ts.map +1 -0
- package/dist/verification-default-on.js +186 -0
- package/dist/verification-default-on.js.map +1 -0
- package/dist/verification-deterministic.d.ts +56 -0
- package/dist/verification-deterministic.d.ts.map +1 -0
- package/dist/verification-deterministic.js +123 -0
- package/dist/verification-deterministic.js.map +1 -0
- package/dist/verification-engine.d.ts +22 -15
- package/dist/verification-engine.d.ts.map +1 -1
- package/dist/verification-engine.js +79 -65
- package/dist/verification-engine.js.map +1 -1
- package/dist/verification-failure-parser.d.ts +48 -0
- package/dist/verification-failure-parser.d.ts.map +1 -0
- package/dist/verification-failure-parser.js +102 -0
- package/dist/verification-failure-parser.js.map +1 -0
- package/dist/verification-feedback.d.ts +58 -0
- package/dist/verification-feedback.d.ts.map +1 -0
- package/dist/verification-feedback.js +110 -0
- package/dist/verification-feedback.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default-on deterministic verification: selection + concurrency cap.
|
|
3
|
+
*
|
|
4
|
+
* The deterministic verification method used to be opt-in (a delivery only ran
|
|
5
|
+
* a check when it carried an explicit verification_method). This module makes
|
|
6
|
+
* it the DEFAULT for every delivery entering verify: it discovers verify-status
|
|
7
|
+
* deliveries with no explicit method and synthesizes a `deterministic`
|
|
8
|
+
* PendingVerification carrying the config-default command, and it caps
|
|
9
|
+
* concurrent daemon-side runs so a burst cannot spawn N whole-repo suites.
|
|
10
|
+
*
|
|
11
|
+
* Extracted from verification-engine.ts to keep that file under the daemon
|
|
12
|
+
* 800-line limit. The dispatch (runVerificationForDelivery / runVerificationTick)
|
|
13
|
+
* stays in verification-engine.ts and imports from here.
|
|
14
|
+
*
|
|
15
|
+
* @module verification-default-on
|
|
16
|
+
*/
|
|
17
|
+
import { DELIVERY_STATUS } from '@telora/daemon-core';
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
// Concurrency cap
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
/**
|
|
22
|
+
* Counting semaphore capping concurrent daemon-side verification runs.
|
|
23
|
+
*
|
|
24
|
+
* A default-on deterministic run is a full build+test sweep (minutes), while
|
|
25
|
+
* the verification loop ticks every 60s and `safeInterval` has NO re-entry
|
|
26
|
+
* guard -- so without a cap, overlapping ticks (and multiple products in one
|
|
27
|
+
* tick) could spawn N whole-repo suites at once and thrash the host. The
|
|
28
|
+
* module-level singleton below is shared across every tick invocation, so the
|
|
29
|
+
* cap holds across overlapping ticks, not just within one.
|
|
30
|
+
*
|
|
31
|
+
* A dedicated semaphore (rather than the shared ResourceGovernor) because the
|
|
32
|
+
* governor's per-engine slots model agent-team spawns and are wired through
|
|
33
|
+
* the governor-construction path; runVerificationTick is invoked with only
|
|
34
|
+
* `config` and has no governor handle. The cap value comes from
|
|
35
|
+
* resolveDefaultVerification (maxConcurrent).
|
|
36
|
+
*/
|
|
37
|
+
export class VerificationSemaphore {
|
|
38
|
+
permits;
|
|
39
|
+
limit;
|
|
40
|
+
waiters = [];
|
|
41
|
+
constructor(limit) {
|
|
42
|
+
this.limit = Math.max(1, limit);
|
|
43
|
+
this.permits = this.limit;
|
|
44
|
+
}
|
|
45
|
+
/** Adjust the cap (config change between ticks). Only frees waiters on a raise. */
|
|
46
|
+
setLimit(limit) {
|
|
47
|
+
const next = Math.max(1, limit);
|
|
48
|
+
if (next === this.limit)
|
|
49
|
+
return;
|
|
50
|
+
const delta = next - this.limit;
|
|
51
|
+
this.limit = next;
|
|
52
|
+
this.permits += delta;
|
|
53
|
+
while (this.permits > 0 && this.waiters.length > 0) {
|
|
54
|
+
const w = this.waiters.shift();
|
|
55
|
+
this.permits--;
|
|
56
|
+
w?.();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async acquire() {
|
|
60
|
+
if (this.permits > 0) {
|
|
61
|
+
this.permits--;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
await new Promise((resolve) => this.waiters.push(resolve));
|
|
65
|
+
}
|
|
66
|
+
release() {
|
|
67
|
+
const w = this.waiters.shift();
|
|
68
|
+
if (w) {
|
|
69
|
+
w();
|
|
70
|
+
}
|
|
71
|
+
else if (this.permits < this.limit) {
|
|
72
|
+
this.permits++;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/** Test-only: how many permits are currently available. */
|
|
76
|
+
availablePermits() {
|
|
77
|
+
return this.permits;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** Shared cap across all tick invocations. Sized from config at each tick. */
|
|
81
|
+
export const verificationSemaphore = new VerificationSemaphore(1);
|
|
82
|
+
/** Test-only: inspect the concurrency semaphore. */
|
|
83
|
+
export function __getVerificationSemaphoreForTests() {
|
|
84
|
+
return verificationSemaphore;
|
|
85
|
+
}
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
// Steady-state re-run guard
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
/**
|
|
90
|
+
* A delivery synthesized by the default-on scan is NOT filtered server-side
|
|
91
|
+
* (the edge `daemon_get_pending_verifications` only returns explicit-method
|
|
92
|
+
* rows), so without a guard a delivery sitting in verify -- e.g. awaiting a
|
|
93
|
+
* review window -- would re-run the whole-repo suite on every verification
|
|
94
|
+
* tick. This set records deliveries whose default-on run has already been
|
|
95
|
+
* dispatched during THIS daemon run; a delivery is pruned the moment it is no
|
|
96
|
+
* longer observed in verify (so a genuine re-entry re-runs). Across a daemon
|
|
97
|
+
* restart the set is empty, so at most one extra run per stuck-in-verify
|
|
98
|
+
* delivery -- bounded and idempotent.
|
|
99
|
+
*/
|
|
100
|
+
const defaultOnRan = new Set();
|
|
101
|
+
/** Test-only: reset the default-on re-run guard. */
|
|
102
|
+
export function __resetDefaultOnGuardForTests() {
|
|
103
|
+
defaultOnRan.clear();
|
|
104
|
+
}
|
|
105
|
+
/** Test-only: snapshot of the default-on re-run guard. */
|
|
106
|
+
export function __getDefaultOnGuardForTests() {
|
|
107
|
+
return defaultOnRan;
|
|
108
|
+
}
|
|
109
|
+
/** Mark a delivery as already run this verify-entry (dispatch-time bookkeeping). */
|
|
110
|
+
export function markDefaultOnRan(deliveryId) {
|
|
111
|
+
defaultOnRan.add(deliveryId);
|
|
112
|
+
}
|
|
113
|
+
/** Test-only alias for markDefaultOnRan. */
|
|
114
|
+
export function __markDefaultOnRanForTests(deliveryId) {
|
|
115
|
+
defaultOnRan.add(deliveryId);
|
|
116
|
+
}
|
|
117
|
+
// ---------------------------------------------------------------------------
|
|
118
|
+
// Selection
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
/**
|
|
121
|
+
* Discover deliveries that should receive a DEFAULT-ON deterministic run: in
|
|
122
|
+
* `verify` status, anchored to an injection, with no explicit verification
|
|
123
|
+
* method (so not already returned by getPendingVerifications), not in a
|
|
124
|
+
* read-only audit focus (those are discovery-only and never run a suite), and
|
|
125
|
+
* not already run this verify-entry (steady-state guard).
|
|
126
|
+
*
|
|
127
|
+
* Synthesizes a `deterministic` PendingVerification carrying the resolved
|
|
128
|
+
* config-default command + timeout. Returns [] when the default-on path is
|
|
129
|
+
* disabled (no command configured) so the feature is inert until opted in.
|
|
130
|
+
*
|
|
131
|
+
* `config` must be product-scoped (config.productId identifies the product).
|
|
132
|
+
*/
|
|
133
|
+
export async function collectDefaultOnVerifications(config, resolved, explicitDeliveryIds, deps) {
|
|
134
|
+
if (!resolved.enabled)
|
|
135
|
+
return [];
|
|
136
|
+
const focuses = await deps.getActiveFocuses(config.organizationId, config.productId);
|
|
137
|
+
const candidates = [];
|
|
138
|
+
const observedInVerify = new Set();
|
|
139
|
+
for (const focus of focuses) {
|
|
140
|
+
// Read-only audit/discovery focuses terminalize on Context Group findings;
|
|
141
|
+
// they must never trigger a whole-repo suite.
|
|
142
|
+
if (focus.read_only === true)
|
|
143
|
+
continue;
|
|
144
|
+
let deliveries;
|
|
145
|
+
try {
|
|
146
|
+
deliveries = await deps.getFocusDeliveries(focus.focus_id);
|
|
147
|
+
}
|
|
148
|
+
catch (err) {
|
|
149
|
+
console.warn(`[verification] default-on: failed to fetch deliveries for focus ${focus.focus_id.slice(0, 8)}:`, err.message);
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
for (const d of deliveries) {
|
|
153
|
+
if (d.executionStatus !== DELIVERY_STATUS.VERIFY)
|
|
154
|
+
continue;
|
|
155
|
+
// The default-on path retires an injection on pass, so it requires an
|
|
156
|
+
// injection anchor. Unanchored deliveries fall through to focus-level review.
|
|
157
|
+
if (!d.injectionId)
|
|
158
|
+
continue;
|
|
159
|
+
// An explicit-method delivery is already handled by getPendingVerifications.
|
|
160
|
+
if (explicitDeliveryIds.has(d.id))
|
|
161
|
+
continue;
|
|
162
|
+
observedInVerify.add(d.id);
|
|
163
|
+
if (defaultOnRan.has(d.id))
|
|
164
|
+
continue; // already ran this verify-entry
|
|
165
|
+
candidates.push({
|
|
166
|
+
deliveryId: d.id,
|
|
167
|
+
deliveryName: d.name,
|
|
168
|
+
productId: config.productId,
|
|
169
|
+
focusId: focus.focus_id,
|
|
170
|
+
injectionNodeId: d.injectionId,
|
|
171
|
+
verificationMethod: 'deterministic',
|
|
172
|
+
verificationConfig: { command: resolved.command, timeoutMs: resolved.timeoutMs },
|
|
173
|
+
verificationOutcome: null,
|
|
174
|
+
verificationLastRunAt: null,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
// Prune guard entries for deliveries no longer sitting in verify, so a
|
|
179
|
+
// genuine re-entry (verify_failed -> coding -> verify) runs again.
|
|
180
|
+
for (const id of [...defaultOnRan]) {
|
|
181
|
+
if (!observedInVerify.has(id))
|
|
182
|
+
defaultOnRan.delete(id);
|
|
183
|
+
}
|
|
184
|
+
return candidates;
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=verification-default-on.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verification-default-on.js","sourceRoot":"","sources":["../src/verification-default-on.ts"],"names":[],"mappings":"AAAA;;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AE,CAAC,CAAC,IAAI;gBACpB,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,OAAO,EAAE,KAAK,CAAC,QAAQ;gBACvB,eAAe,EAAE,CAAC,CAAC,WAAW;gBAC9B,kBAAkB,EAAE,eAAe;gBACnC,kBAAkB,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE;gBAChF,mBAAmB,EAAE,IAAI;gBACzB,qBAAqB,EAAE,IAAI;aAC5B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,uEAAuE;IACvE,mEAAmE;IACnE,KAAK,MAAM,EAAE,IAAI,CAAC,GAAG,YAAY,CAAC,EAAE,CAAC;QACnC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic verification strategy: run a shell command and map exit 0 to a
|
|
3
|
+
* pass, streaming the full stdout+stderr to a persistent log file under the
|
|
4
|
+
* daemon state dir.
|
|
5
|
+
*
|
|
6
|
+
* Extracted from verification-engine.ts (which owns dispatch + the pass-path
|
|
7
|
+
* side effects) to keep that file under the daemon 800-line limit. The
|
|
8
|
+
* StrategyResult shape lives here because this is the strategy that produces
|
|
9
|
+
* every field on it; verification-engine imports the type back.
|
|
10
|
+
*
|
|
11
|
+
* @module verification-deterministic
|
|
12
|
+
*/
|
|
13
|
+
import type { VerificationOutcome } from './queries/verification.js';
|
|
14
|
+
/** Default deterministic timeout when the config sets none: 5 minutes. */
|
|
15
|
+
export declare const DEFAULT_VERIFICATION_TIMEOUT_MS: number;
|
|
16
|
+
export interface StrategyResult {
|
|
17
|
+
outcome: VerificationOutcome;
|
|
18
|
+
rationale?: string;
|
|
19
|
+
exitCode?: number | null;
|
|
20
|
+
stdoutTail?: string;
|
|
21
|
+
stderrTail?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Absolute path to the persistent full-log file for a deterministic run
|
|
24
|
+
* (full stdout+stderr, not just the 4000-char tails). Written under the
|
|
25
|
+
* daemon state dir. Undefined when no log sink was supplied (e.g. a strategy
|
|
26
|
+
* that runs no shell command). Carried on the result so the feedback loop
|
|
27
|
+
* (gate_state) can point at it.
|
|
28
|
+
*/
|
|
29
|
+
logPath?: string;
|
|
30
|
+
/** Delivery diff against integration, when the strategy resolved one (ai_inspection). */
|
|
31
|
+
deliveryDiff?: string;
|
|
32
|
+
/** Baseline-diff attribution: NEW failures the focus introduced (these gate). */
|
|
33
|
+
newFailures?: string[];
|
|
34
|
+
/** Baseline-diff attribution: pre-existing base failures (recorded, non-blocking). */
|
|
35
|
+
preExisting?: string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Context for persisting a deterministic run's full log to a file. When
|
|
39
|
+
* supplied, runDeterministicStrategy streams the complete stdout+stderr to
|
|
40
|
+
* `<stateDir>/verification/verification-<deliveryId>-<startedAtMs>.log` and
|
|
41
|
+
* returns the absolute path on the result. Optional so unit tests that only
|
|
42
|
+
* assert exit-code handling can omit it (no file written).
|
|
43
|
+
*/
|
|
44
|
+
export interface DeterministicLogContext {
|
|
45
|
+
deliveryId: string;
|
|
46
|
+
/** Millisecond timestamp for a stable, unique filename (injectable for tests). */
|
|
47
|
+
startedAtMs: number;
|
|
48
|
+
/** Override the log directory (defaults to <stateDir>/verification). */
|
|
49
|
+
logDir?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Run a configured shell command in the focus's worktree (or the product
|
|
53
|
+
* repo path as fallback). Pass = exit 0.
|
|
54
|
+
*/
|
|
55
|
+
export declare function runDeterministicStrategy(config: Record<string, unknown> | null, cwd: string, logContext?: DeterministicLogContext): Promise<StrategyResult>;
|
|
56
|
+
//# sourceMappingURL=verification-deterministic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verification-deterministic.d.ts","sourceRoot":"","sources":["../src/verification-deterministic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,0EAA0E;AAC1E,eAAO,MAAM,+BAA+B,QAAgB,CAAC;AAE7D,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,mBAAmB,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yFAAyF;IACzF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,sFAAsF;IACtF,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,WAAW,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACtC,GAAG,EAAE,MAAM,EACX,UAAU,CAAC,EAAE,uBAAuB,GACnC,OAAO,CAAC,cAAc,CAAC,CAsGzB"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic verification strategy: run a shell command and map exit 0 to a
|
|
3
|
+
* pass, streaming the full stdout+stderr to a persistent log file under the
|
|
4
|
+
* daemon state dir.
|
|
5
|
+
*
|
|
6
|
+
* Extracted from verification-engine.ts (which owns dispatch + the pass-path
|
|
7
|
+
* side effects) to keep that file under the daemon 800-line limit. The
|
|
8
|
+
* StrategyResult shape lives here because this is the strategy that produces
|
|
9
|
+
* every field on it; verification-engine imports the type back.
|
|
10
|
+
*
|
|
11
|
+
* @module verification-deterministic
|
|
12
|
+
*/
|
|
13
|
+
import { spawn } from 'node:child_process';
|
|
14
|
+
import { createWriteStream, mkdirSync } from 'node:fs';
|
|
15
|
+
import { resolve as resolvePath } from 'node:path';
|
|
16
|
+
import { resolveGlobalStateDir } from './daemon-process.js';
|
|
17
|
+
/** Default deterministic timeout when the config sets none: 5 minutes. */
|
|
18
|
+
export const DEFAULT_VERIFICATION_TIMEOUT_MS = 5 * 60 * 1000;
|
|
19
|
+
/**
|
|
20
|
+
* Run a configured shell command in the focus's worktree (or the product
|
|
21
|
+
* repo path as fallback). Pass = exit 0.
|
|
22
|
+
*/
|
|
23
|
+
export async function runDeterministicStrategy(config, cwd, logContext) {
|
|
24
|
+
const command = config?.command;
|
|
25
|
+
if (typeof command !== 'string' || command.length === 0 || !config) {
|
|
26
|
+
return {
|
|
27
|
+
outcome: 'escalated',
|
|
28
|
+
rationale: 'deterministic strategy missing config.command',
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const timeoutMs = typeof config.timeoutMs === 'number' && config.timeoutMs > 0
|
|
32
|
+
? config.timeoutMs
|
|
33
|
+
: DEFAULT_VERIFICATION_TIMEOUT_MS;
|
|
34
|
+
// Open a persistent full-log sink under the state dir (best-effort). The
|
|
35
|
+
// 4000-char tails stay as inline evidence; the file captures the WHOLE run
|
|
36
|
+
// so a failure discovered later has the complete output to point at.
|
|
37
|
+
let logPath;
|
|
38
|
+
let logStream;
|
|
39
|
+
if (logContext) {
|
|
40
|
+
try {
|
|
41
|
+
const dir = logContext.logDir ?? resolvePath(resolveGlobalStateDir(), 'verification');
|
|
42
|
+
mkdirSync(dir, { recursive: true });
|
|
43
|
+
logPath = resolvePath(dir, `verification-${logContext.deliveryId}-${logContext.startedAtMs}.log`);
|
|
44
|
+
logStream = createWriteStream(logPath, { mode: 0o600 });
|
|
45
|
+
// Swallow late write/close errors (e.g. the dir removed mid-flush): a log
|
|
46
|
+
// sink failure must never crash the tick with an unhandled 'error' event.
|
|
47
|
+
logStream.on('error', (err) => {
|
|
48
|
+
console.warn(`[verification] log stream error for delivery ${logContext.deliveryId}:`, err.message);
|
|
49
|
+
});
|
|
50
|
+
logStream.write(`$ ${command}\n(cwd: ${cwd})\n\n`);
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
console.warn(`[verification] failed to open log file for delivery ${logContext.deliveryId}:`, err.message);
|
|
54
|
+
logPath = undefined;
|
|
55
|
+
logStream = undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return new Promise((resolve) => {
|
|
59
|
+
const child = spawn('sh', ['-c', command], {
|
|
60
|
+
cwd,
|
|
61
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
62
|
+
});
|
|
63
|
+
let stdout = '';
|
|
64
|
+
let stderr = '';
|
|
65
|
+
const tail = (buf, max = 4000) => buf.length <= max ? buf : buf.slice(buf.length - max);
|
|
66
|
+
child.stdout?.on('data', (chunk) => {
|
|
67
|
+
const text = chunk.toString('utf8');
|
|
68
|
+
logStream?.write(text);
|
|
69
|
+
stdout += text;
|
|
70
|
+
stdout = tail(stdout);
|
|
71
|
+
});
|
|
72
|
+
child.stderr?.on('data', (chunk) => {
|
|
73
|
+
const text = chunk.toString('utf8');
|
|
74
|
+
logStream?.write(text);
|
|
75
|
+
stderr += text;
|
|
76
|
+
stderr = tail(stderr);
|
|
77
|
+
});
|
|
78
|
+
const finish = (result) => {
|
|
79
|
+
const finalResult = { ...result, ...(logPath ? { logPath } : {}) };
|
|
80
|
+
if (logStream) {
|
|
81
|
+
// Resolve only AFTER the stream has flushed + closed, so the full log
|
|
82
|
+
// file is durable on disk before a caller (or a reader) touches logPath.
|
|
83
|
+
try {
|
|
84
|
+
logStream.end(() => resolve(finalResult));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// fall through to immediate resolve
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
resolve(finalResult);
|
|
92
|
+
};
|
|
93
|
+
const timer = setTimeout(() => {
|
|
94
|
+
try {
|
|
95
|
+
child.kill('SIGKILL');
|
|
96
|
+
}
|
|
97
|
+
catch { /* ignore */ }
|
|
98
|
+
}, timeoutMs);
|
|
99
|
+
child.on('error', (err) => {
|
|
100
|
+
clearTimeout(timer);
|
|
101
|
+
finish({
|
|
102
|
+
outcome: 'failed',
|
|
103
|
+
rationale: `deterministic spawn error: ${err.message}`,
|
|
104
|
+
stdoutTail: stdout,
|
|
105
|
+
stderrTail: stderr,
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
child.on('close', (code) => {
|
|
109
|
+
clearTimeout(timer);
|
|
110
|
+
const passed = code === 0;
|
|
111
|
+
finish({
|
|
112
|
+
outcome: passed ? 'passed' : 'failed',
|
|
113
|
+
rationale: passed
|
|
114
|
+
? 'deterministic check passed (exit 0)'
|
|
115
|
+
: `deterministic check failed (exit ${code})`,
|
|
116
|
+
exitCode: code,
|
|
117
|
+
stdoutTail: stdout,
|
|
118
|
+
stderrTail: stderr,
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=verification-deterministic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verification-deterministic.js","sourceRoot":"","sources":["../src/verification-deterministic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,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AAU,EAAE,MAAM;aACnB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC;YAC1B,MAAM,CAAC;gBACL,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;gBACrC,SAAS,EAAE,MAAM;oBACf,CAAC,CAAC,qCAAqC;oBACvC,CAAC,CAAC,oCAAoC,IAAI,GAAG;gBAC/C,QAAQ,EAAE,IAAI;gBACd,UAAU,EAAE,MAAM;gBAClB,UAAU,EAAE,MAAM;aACnB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -22,28 +22,20 @@
|
|
|
22
22
|
*
|
|
23
23
|
* @module verification-engine
|
|
24
24
|
*/
|
|
25
|
+
import { runDeterministicStrategy, type StrategyResult } from './verification-deterministic.js';
|
|
26
|
+
export { runDeterministicStrategy, type DeterministicLogContext } from './verification-deterministic.js';
|
|
25
27
|
import { getPendingVerifications, type PendingVerification, type VerificationOutcome } from './queries/verification.js';
|
|
26
28
|
import type { NodeWriteback } from './reality-writeback.js';
|
|
27
29
|
import { type ReconcileTargetsResult, type TargetRestatement, type VerifyEvidence } from './verify-restatement.js';
|
|
28
30
|
import { type FileEscalationInput } from './escalations.js';
|
|
29
31
|
import type { DaemonConfig } from './types.js';
|
|
32
|
+
import { type ResolvedDefaultVerification } from './verification-config.js';
|
|
33
|
+
import { getActiveFocuses, getFocusDeliveries } from './supabase.js';
|
|
34
|
+
import { type FailureClassification } from './verification-baseline.js';
|
|
35
|
+
export { collectDefaultOnVerifications, verificationSemaphore, VerificationSemaphore, __getVerificationSemaphoreForTests, __resetDefaultOnGuardForTests, __getDefaultOnGuardForTests, __markDefaultOnRanForTests, } from './verification-default-on.js';
|
|
30
36
|
import { type AiInspectionInputs } from './ai-inspection-context.js';
|
|
31
37
|
import { runAiInspection as defaultRunAiInspection, type InspectionResult } from './ai-inspection-runner.js';
|
|
32
38
|
import { type SecurityFindingGateDeps } from './security-finding-gate.js';
|
|
33
|
-
interface StrategyResult {
|
|
34
|
-
outcome: VerificationOutcome;
|
|
35
|
-
rationale?: string;
|
|
36
|
-
exitCode?: number | null;
|
|
37
|
-
stdoutTail?: string;
|
|
38
|
-
stderrTail?: string;
|
|
39
|
-
/** Delivery diff against integration, when the strategy resolved one (ai_inspection). */
|
|
40
|
-
deliveryDiff?: string;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Run a configured shell command in the focus's worktree (or the product
|
|
44
|
-
* repo path as fallback). Pass = exit 0.
|
|
45
|
-
*/
|
|
46
|
-
export declare function runDeterministicStrategy(config: Record<string, unknown> | null, cwd: string): Promise<StrategyResult>;
|
|
47
39
|
export declare function runBehavioralStrategy(): Promise<StrategyResult>;
|
|
48
40
|
/**
|
|
49
41
|
* Spawn a tool-augmented Claude runner against the focus worktree to judge
|
|
@@ -121,6 +113,22 @@ export interface VerificationDeps {
|
|
|
121
113
|
* and the engine demotes the verification outcome to 'failed'.
|
|
122
114
|
*/
|
|
123
115
|
securityFindingGate: SecurityFindingGateDeps;
|
|
116
|
+
/**
|
|
117
|
+
* Resolve the default-on deterministic verification config (env > file >
|
|
118
|
+
* default). When it yields `enabled: false` (no command configured) the
|
|
119
|
+
* default-on scan is a no-op and only explicit-method deliveries verify.
|
|
120
|
+
*/
|
|
121
|
+
resolveDefaultVerification: (config: DaemonConfig) => ResolvedDefaultVerification;
|
|
122
|
+
/** Enumerate active focuses for a product (default-on candidate discovery). */
|
|
123
|
+
getActiveFocuses: typeof getActiveFocuses;
|
|
124
|
+
/** Fetch a focus's deliveries (default-on candidate discovery). */
|
|
125
|
+
getFocusDeliveries: typeof getFocusDeliveries;
|
|
126
|
+
/** Failed-run feedback (gate_state + live inject). Optional; defaultDeps provides it. */
|
|
127
|
+
deliverFailureFeedback?: (v: PendingVerification, result: StrategyResult) => Promise<void>;
|
|
128
|
+
/** cwd for the HEAD run -- the focus worktree. Optional; dispatch falls back to resolveCwd. */
|
|
129
|
+
resolveVerificationCwd?: (v: PendingVerification) => string;
|
|
130
|
+
/** Baseline-diff attribution; null => no baseline resolvable (gate all). Optional. */
|
|
131
|
+
attributeFailures?: (v: PendingVerification, result: StrategyResult) => Promise<FailureClassification | null>;
|
|
124
132
|
}
|
|
125
133
|
/**
|
|
126
134
|
* Run verification for a single delivery.
|
|
@@ -151,5 +159,4 @@ export declare function runVerificationTick(config: DaemonConfig, deps?: Partial
|
|
|
151
159
|
pending: number;
|
|
152
160
|
escalated: number;
|
|
153
161
|
}>;
|
|
154
|
-
export {};
|
|
155
162
|
//# sourceMappingURL=verification-engine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verification-engine.d.ts","sourceRoot":"","sources":["../src/verification-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;
|
|
1
|
+
{"version":3,"file":"verification-engine.d.ts","sourceRoot":"","sources":["../src/verification-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,wBAAwB,EAAE,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAChG,OAAO,EAAE,wBAAwB,EAAE,KAAK,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AACzG,OAAO,EACL,uBAAuB,EAIvB,KAAK,mBAAmB,EAExB,KAAK,mBAAmB,EACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EAEtB,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAA2C,KAAK,mBA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