@neurcode-ai/cli 0.16.7 → 0.16.9

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.
@@ -0,0 +1,238 @@
1
+ /**
2
+ * Enterprise evaluator report + dashboard summary — pure builders.
3
+ *
4
+ * The `neurcode eval demo` runner (utils/eval-demo.ts) drives a complete, safe,
5
+ * local governance loop against a throwaway fixture and gathers a single
6
+ * source-free facts object: {@link EvalDemoFacts}. This module turns that facts
7
+ * object into the two shareable artifacts a first-time enterprise evaluator
8
+ * needs:
9
+ *
10
+ * 1. {@link buildEnterpriseEvalReport} / {@link renderEnterpriseEvalReportMarkdown}
11
+ * — a polished, source-free report an engineering manager can read. It is
12
+ * deliberately honest: deterministic path/symbol/graph/policy facts are
13
+ * separated from advisory inference, and the trust posture never claims
14
+ * public-key signing when only an HMAC backend receipt (or self-attested
15
+ * local record) exists.
16
+ *
17
+ * 2. {@link buildEvalDemoSummary} — a compact machine-readable JSON the hosted
18
+ * dashboard can import (paste / upload). It carries completion status,
19
+ * pass/fail checkpoints, the boundary/approval/neighbor facts, the trust
20
+ * posture, the recommended next command, and a design-partner-pilot verdict.
21
+ *
22
+ * Everything here is pure (no I/O) and source-free. The orchestration engine
23
+ * runs {@link assertEnterpriseEvalSourceFree} over the rendered artifacts before
24
+ * anything is written, and the harness/tests assert the same contract.
25
+ *
26
+ * Keep the truth tiers and step ids in lockstep with utils/guided-eval.ts and
27
+ * the dashboard mirrors (web/dashboard/src/lib/guidedEval.ts + evalDemoImport.ts).
28
+ */
29
+ import { type GuidedEvalAgent, type GuidedEvalEnforcement, type GuidedEvalRepoBrainFindings, type GuidedEvalTruthTier } from './guided-eval';
30
+ import type { ImpactSummary } from './repo-brain-impact';
31
+ export declare const EVAL_DEMO_SUMMARY_SCHEMA_VERSION: "neurcode.eval-demo-summary.v1";
32
+ export declare const ENTERPRISE_EVAL_REPORT_SCHEMA_VERSION: "neurcode.enterprise-eval-report.v1";
33
+ export type DemoCheckpointStatus = 'pass' | 'fail' | 'advisory' | 'skipped';
34
+ /** A single asserted step in the demo loop. */
35
+ export interface DemoCheckpoint {
36
+ id: string;
37
+ title: string;
38
+ truthTier: GuidedEvalTruthTier;
39
+ status: DemoCheckpointStatus;
40
+ /** What the runner expected to observe. */
41
+ expected: string;
42
+ /** What it actually observed (source-free: paths, verdicts, counts). */
43
+ observed: string;
44
+ /** True when a failure here should fail the whole demo. */
45
+ critical: boolean;
46
+ }
47
+ export type BoundaryDecision = 'allow' | 'deny' | 'warn';
48
+ export type BoundaryPhase = 'safe_edit' | 'boundary_block' | 'post_approval_allow' | 'neighbor_block';
49
+ export interface BoundaryTimelineEntry {
50
+ order: number;
51
+ phase: BoundaryPhase;
52
+ path: string;
53
+ toolName: string;
54
+ decision: BoundaryDecision;
55
+ blockType: string | null;
56
+ owners: string[];
57
+ }
58
+ export interface EvalDemoBackendReceipt {
59
+ /** A backend/HMAC signing secret was present in the environment. */
60
+ configured: boolean;
61
+ /** The runner attempted an export + verify against that key. */
62
+ attempted: boolean;
63
+ /** Verification returned backend_signed_verified. */
64
+ verified: boolean;
65
+ trustLevel: string | null;
66
+ /** Honest provenance, e.g. "self-attested local record" or "local test HMAC key". */
67
+ provenance: string;
68
+ }
69
+ /**
70
+ * The single source-free facts object produced by one demo run. Every field is
71
+ * a path, owner, symbol name, count, verdict, hash, or boolean — never source.
72
+ */
73
+ export interface EvalDemoFacts {
74
+ agent: GuidedEvalAgent;
75
+ enforcement: GuidedEvalEnforcement;
76
+ enforcementLabel: string;
77
+ /** Honest description of how the local proof was driven for this posture. */
78
+ enforcementMethod: string;
79
+ mode: 'fixture' | 'real';
80
+ generatedAt: string;
81
+ durationMs: number;
82
+ sessionId: string | null;
83
+ repoRootHash: string;
84
+ fixtureRelativeDir: string;
85
+ adapter: string | null;
86
+ compatibilityMode: string | null;
87
+ cliVersion: string | null;
88
+ safeEditAllowed: boolean;
89
+ boundaryBlockPath: string | null;
90
+ boundaryOwners: string[];
91
+ boundaryBlockType: string | null;
92
+ exactApprovalPath: string | null;
93
+ exactApprovalOnly: boolean;
94
+ approvedPathAllowedAfter: boolean;
95
+ neighborPath: string | null;
96
+ neighborContained: boolean;
97
+ aiChangeRecordSessionId: string | null;
98
+ aiChangeRecordRelativePath: string | null;
99
+ admissionBlockedCount: number | null;
100
+ admissionApprovedCount: number | null;
101
+ backendReceipt: EvalDemoBackendReceipt;
102
+ repoBrain: GuidedEvalRepoBrainFindings;
103
+ /** Source-free change-impact map for the fixture's changed set (advisory). */
104
+ impactIntelligence: ImpactSummary | null;
105
+ boundaryTimeline: BoundaryTimelineEntry[];
106
+ commandsRun: string[];
107
+ }
108
+ export type ReadinessLevel = 'ready' | 'ready_with_caveats' | 'not_ready';
109
+ export interface EvalDemoVerdict {
110
+ founderDemo: ReadinessLevel;
111
+ designPartnerPilot: ReadinessLevel;
112
+ seriousEnterprisePilot: ReadinessLevel;
113
+ reasons: string[];
114
+ }
115
+ /** The deterministic core loop that must hold for the demo to be meaningful. */
116
+ export declare const CORE_CHECKPOINT_IDS: readonly ["safe_edit_allowed", "boundary_block", "exact_approval", "approved_path_allowed", "neighbor_contained", "ai_change_record"];
117
+ export declare function deriveVerdict(checkpoints: DemoCheckpoint[], facts: EvalDemoFacts): EvalDemoVerdict;
118
+ export interface EnterpriseEvalReport {
119
+ schemaVersion: typeof ENTERPRISE_EVAL_REPORT_SCHEMA_VERSION;
120
+ generatedAt: string;
121
+ agent: GuidedEvalAgent;
122
+ enforcement: GuidedEvalEnforcement;
123
+ enforcementLabel: string;
124
+ enforcementMethod: string;
125
+ mode: 'fixture' | 'real';
126
+ durationMs: number;
127
+ repo: {
128
+ rootHash: string;
129
+ fixtureRelativeDir: string;
130
+ };
131
+ result: {
132
+ complete: boolean;
133
+ passed: number;
134
+ total: number;
135
+ criticalFailures: number;
136
+ };
137
+ checkpoints: Array<DemoCheckpoint & {
138
+ truthTierLabel: string;
139
+ }>;
140
+ whatThisProves: string[];
141
+ whatThisDoesNotProve: string[];
142
+ deterministicFacts: string[];
143
+ advisoryFacts: string[];
144
+ boundaryTimeline: BoundaryTimelineEntry[];
145
+ exactApprovalContainment: {
146
+ approvedPath: string | null;
147
+ exactOnly: boolean;
148
+ allowedAfterApproval: boolean;
149
+ owners: string[];
150
+ };
151
+ neighborContainment: {
152
+ neighborPath: string | null;
153
+ stayedBlocked: boolean;
154
+ };
155
+ repoBrain: GuidedEvalRepoBrainFindings;
156
+ impactIntelligence: ImpactSummary | null;
157
+ evidenceTrustPosture: {
158
+ aiChangeRecord: {
159
+ sessionId: string | null;
160
+ relativePath: string | null;
161
+ };
162
+ backendReceipt: EvalDemoBackendReceipt;
163
+ statement: string;
164
+ };
165
+ commandsRun: string[];
166
+ nextStepForRealRepo: string[];
167
+ verdict: EvalDemoVerdict;
168
+ truthTaxonomy: Record<GuidedEvalTruthTier, string>;
169
+ privacy: {
170
+ sourceFree: true;
171
+ excludes: string[];
172
+ };
173
+ }
174
+ export declare function buildEnterpriseEvalReport(facts: EvalDemoFacts, checkpoints: DemoCheckpoint[]): EnterpriseEvalReport;
175
+ export declare function renderEnterpriseEvalReportMarkdown(report: EnterpriseEvalReport): string;
176
+ export interface EvalDemoSummary {
177
+ schemaVersion: typeof EVAL_DEMO_SUMMARY_SCHEMA_VERSION;
178
+ generatedAt: string;
179
+ agent: GuidedEvalAgent;
180
+ enforcement: GuidedEvalEnforcement;
181
+ enforcementLabel: string;
182
+ mode: 'fixture' | 'real';
183
+ repo: {
184
+ rootHash: string;
185
+ };
186
+ completion: {
187
+ complete: boolean;
188
+ passed: number;
189
+ total: number;
190
+ percent: number;
191
+ };
192
+ checkpoints: Array<{
193
+ id: string;
194
+ title: string;
195
+ truthTier: GuidedEvalTruthTier;
196
+ status: DemoCheckpointStatus;
197
+ observed: string;
198
+ }>;
199
+ facts: {
200
+ boundaryBlock: {
201
+ path: string | null;
202
+ owners: string[];
203
+ blockType: string | null;
204
+ };
205
+ exactApproval: {
206
+ path: string | null;
207
+ exactOnly: boolean;
208
+ allowedAfter: boolean;
209
+ };
210
+ neighbor: {
211
+ path: string | null;
212
+ contained: boolean;
213
+ };
214
+ aiChangeRecord: {
215
+ sessionId: string | null;
216
+ relativePath: string | null;
217
+ };
218
+ };
219
+ sourceFree: true;
220
+ trustPosture: {
221
+ backendReceiptConfigured: boolean;
222
+ backendReceiptVerified: boolean;
223
+ label: string;
224
+ provenance: string;
225
+ };
226
+ recommendedNextCommand: string;
227
+ verdict: EvalDemoVerdict;
228
+ /** Source-free change-impact map for the fixture's changed set (advisory). */
229
+ impactIntelligence: ImpactSummary | null;
230
+ privacy: {
231
+ sourceFree: true;
232
+ excludes: string[];
233
+ };
234
+ }
235
+ export declare function buildEvalDemoSummary(facts: EvalDemoFacts, checkpoints: DemoCheckpoint[]): EvalDemoSummary;
236
+ /** Throw if a would-be enterprise artifact contains source/diff/secret shapes. */
237
+ export declare function assertEnterpriseEvalSourceFree(value: unknown, label?: string): void;
238
+ //# sourceMappingURL=enterprise-eval-report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enterprise-eval-report.d.ts","sourceRoot":"","sources":["../../src/utils/enterprise-eval-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,mBAAmB,EACzB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,eAAO,MAAM,gCAAgC,EAAG,+BAAwC,CAAC;AACzF,eAAO,MAAM,qCAAqC,EAAG,oCAA6C,CAAC;AAInG,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;AAE5E,+CAA+C;AAC/C,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;I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