@contextrail/assess 0.0.0-stage → 1.0.0-alpha.1
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/LICENSE +202 -0
- package/README.md +82 -2
- package/assets/brand/icon-dark.png +0 -0
- package/assets/brand/icon-light.png +0 -0
- package/dist/assess.d.ts +109 -0
- package/dist/assess.js +1548 -0
- package/dist/assessment.d.ts +566 -0
- package/dist/assessment.js +404 -0
- package/dist/budget.d.ts +24 -0
- package/dist/budget.js +52 -0
- package/dist/candidate.d.ts +147 -0
- package/dist/candidate.js +321 -0
- package/dist/change-summary.d.ts +33 -0
- package/dist/change-summary.js +26 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +406 -0
- package/dist/contracts.d.ts +99 -0
- package/dist/contracts.js +62 -0
- package/dist/diagnostics.d.ts +44 -0
- package/dist/diagnostics.js +412 -0
- package/dist/evidence.d.ts +73 -0
- package/dist/evidence.js +297 -0
- package/dist/feedback.d.ts +21 -0
- package/dist/feedback.js +140 -0
- package/dist/git.d.ts +40 -0
- package/dist/git.js +207 -0
- package/dist/github.d.ts +90 -0
- package/dist/github.js +1342 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +14 -0
- package/dist/mcp.d.ts +28 -0
- package/dist/mcp.js +173 -0
- package/dist/pack.d.ts +160 -0
- package/dist/pack.js +377 -0
- package/dist/phases.d.ts +65 -0
- package/dist/phases.js +63 -0
- package/dist/planning.d.ts +64 -0
- package/dist/planning.js +135 -0
- package/dist/pr-context.d.ts +316 -0
- package/dist/pr-context.js +198 -0
- package/dist/prepare.d.ts +71 -0
- package/dist/prepare.js +335 -0
- package/dist/presentation.d.ts +309 -0
- package/dist/presentation.js +1026 -0
- package/dist/provider-diagnostics.d.ts +93 -0
- package/dist/provider-diagnostics.js +233 -0
- package/dist/providers.d.ts +45 -0
- package/dist/providers.js +291 -0
- package/dist/report-contract.d.ts +132 -0
- package/dist/report-contract.js +240 -0
- package/dist/results.d.ts +90 -0
- package/dist/results.js +128 -0
- package/dist/resume.d.ts +25 -0
- package/dist/resume.js +116 -0
- package/dist/source.d.ts +167 -0
- package/dist/source.js +675 -0
- package/dist/verification.d.ts +386 -0
- package/dist/verification.js +168 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +9 -0
- package/docs/README.md +24 -0
- package/docs/action-reference.md +85 -0
- package/docs/architecture.md +156 -0
- package/docs/configuration.md +83 -0
- package/docs/contributing.md +46 -0
- package/docs/getting-started.md +92 -0
- package/docs/github-actions.md +141 -0
- package/docs/operations.md +203 -0
- package/docs/review-results.md +173 -0
- package/docs/security.md +64 -0
- package/docs/standards.md +62 -0
- package/examples/assess-pull-request.yml +109 -0
- package/package.json +56 -5
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type Citation, type EvidenceLedger } from './evidence.js';
|
|
3
|
+
import { type AssessmentProposal } from './assessment.js';
|
|
4
|
+
import { type AcceptedResult, type AssessmentEntry } from './results.js';
|
|
5
|
+
export declare const verificationSchema: z.ZodObject<{
|
|
6
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
7
|
+
assessmentId: z.ZodString;
|
|
8
|
+
disposition: z.ZodEnum<{
|
|
9
|
+
unresolved: "unresolved";
|
|
10
|
+
accept: "accept";
|
|
11
|
+
reject: "reject";
|
|
12
|
+
revise: "revise";
|
|
13
|
+
}>;
|
|
14
|
+
reason: z.ZodString;
|
|
15
|
+
citations: z.ZodArray<z.ZodObject<{
|
|
16
|
+
ref: z.ZodString;
|
|
17
|
+
quote: z.ZodString;
|
|
18
|
+
start: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
end: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
}, z.core.$strict>>;
|
|
21
|
+
missingChecks: z.ZodArray<z.ZodString>;
|
|
22
|
+
resolution: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
23
|
+
assessmentId: z.ZodString;
|
|
24
|
+
revisionOf: z.ZodNullable<z.ZodNumber>;
|
|
25
|
+
disposition: z.ZodEnum<{
|
|
26
|
+
evaluated: "evaluated";
|
|
27
|
+
observed: "observed";
|
|
28
|
+
not_applicable: "not_applicable";
|
|
29
|
+
unresolved: "unresolved";
|
|
30
|
+
}>;
|
|
31
|
+
adherence: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodNull]>;
|
|
32
|
+
confidence: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodNull]>;
|
|
33
|
+
confidenceReason: z.ZodString;
|
|
34
|
+
finding: z.ZodEnum<{
|
|
35
|
+
none: "none";
|
|
36
|
+
binding_violation: "binding_violation";
|
|
37
|
+
behavioral_defect: "behavioral_defect";
|
|
38
|
+
guidance_departure: "guidance_departure";
|
|
39
|
+
}>;
|
|
40
|
+
explanation: z.ZodString;
|
|
41
|
+
consequence: z.ZodString;
|
|
42
|
+
correction: z.ZodString;
|
|
43
|
+
limitations: z.ZodArray<z.ZodString>;
|
|
44
|
+
citations: z.ZodArray<z.ZodObject<{
|
|
45
|
+
ref: z.ZodString;
|
|
46
|
+
quote: z.ZodString;
|
|
47
|
+
start: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
end: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
}, z.core.$strict>>;
|
|
50
|
+
}, z.core.$strict>>>;
|
|
51
|
+
amendment: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
52
|
+
result: z.ZodObject<{
|
|
53
|
+
assessmentId: z.ZodString;
|
|
54
|
+
revisionOf: z.ZodNullable<z.ZodNumber>;
|
|
55
|
+
disposition: z.ZodEnum<{
|
|
56
|
+
evaluated: "evaluated";
|
|
57
|
+
observed: "observed";
|
|
58
|
+
not_applicable: "not_applicable";
|
|
59
|
+
unresolved: "unresolved";
|
|
60
|
+
}>;
|
|
61
|
+
adherence: z.ZodUnion<readonly [z.ZodLiteral<0>, z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodNull]>;
|
|
62
|
+
confidence: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodNull]>;
|
|
63
|
+
confidenceReason: z.ZodString;
|
|
64
|
+
finding: z.ZodEnum<{
|
|
65
|
+
none: "none";
|
|
66
|
+
binding_violation: "binding_violation";
|
|
67
|
+
behavioral_defect: "behavioral_defect";
|
|
68
|
+
guidance_departure: "guidance_departure";
|
|
69
|
+
}>;
|
|
70
|
+
explanation: z.ZodString;
|
|
71
|
+
consequence: z.ZodString;
|
|
72
|
+
correction: z.ZodString;
|
|
73
|
+
limitations: z.ZodArray<z.ZodString>;
|
|
74
|
+
citations: z.ZodArray<z.ZodObject<{
|
|
75
|
+
ref: z.ZodString;
|
|
76
|
+
quote: z.ZodString;
|
|
77
|
+
start: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
end: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
}, z.core.$strict>>;
|
|
80
|
+
}, z.core.$strict>;
|
|
81
|
+
followUps: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
82
|
+
kind: z.ZodEnum<{
|
|
83
|
+
human_check: "human_check";
|
|
84
|
+
operational_check: "operational_check";
|
|
85
|
+
}>;
|
|
86
|
+
required: z.ZodBoolean;
|
|
87
|
+
explanation: z.ZodString;
|
|
88
|
+
action: z.ZodString;
|
|
89
|
+
passage: z.ZodObject<{
|
|
90
|
+
ref: z.ZodString;
|
|
91
|
+
quote: z.ZodString;
|
|
92
|
+
start: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
end: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
}, z.core.$strict>;
|
|
95
|
+
sourceRefs: z.ZodArray<z.ZodObject<{
|
|
96
|
+
ref: z.ZodString;
|
|
97
|
+
quote: z.ZodString;
|
|
98
|
+
start: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
end: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
}, z.core.$strict>>;
|
|
101
|
+
}, z.core.$strict>>>;
|
|
102
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
103
|
+
disposition: z.ZodEnum<{
|
|
104
|
+
evaluated: "evaluated";
|
|
105
|
+
not_applicable: "not_applicable";
|
|
106
|
+
unresolved: "unresolved";
|
|
107
|
+
}>;
|
|
108
|
+
sourceRefs: z.ZodArray<z.ZodObject<{
|
|
109
|
+
ref: z.ZodString;
|
|
110
|
+
quote: z.ZodString;
|
|
111
|
+
start: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
end: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
}, z.core.$strict>>;
|
|
114
|
+
explanation: z.ZodString;
|
|
115
|
+
contraryEvidence: z.ZodString;
|
|
116
|
+
missingEvidence: z.ZodString;
|
|
117
|
+
passage: z.ZodObject<{
|
|
118
|
+
ref: z.ZodString;
|
|
119
|
+
quote: z.ZodString;
|
|
120
|
+
start: z.ZodOptional<z.ZodNumber>;
|
|
121
|
+
end: z.ZodOptional<z.ZodNumber>;
|
|
122
|
+
}, z.core.$strict>;
|
|
123
|
+
interpretation: z.ZodString;
|
|
124
|
+
}, z.core.$strict>>;
|
|
125
|
+
findings: z.ZodArray<z.ZodObject<{
|
|
126
|
+
explanation: z.ZodString;
|
|
127
|
+
consequence: z.ZodString;
|
|
128
|
+
correction: z.ZodString;
|
|
129
|
+
limitations: z.ZodArray<z.ZodString>;
|
|
130
|
+
classification: z.ZodEnum<{
|
|
131
|
+
binding_violation: "binding_violation";
|
|
132
|
+
behavioral_defect: "behavioral_defect";
|
|
133
|
+
guidance_departure: "guidance_departure";
|
|
134
|
+
}>;
|
|
135
|
+
locationRefs: z.ZodArray<z.ZodObject<{
|
|
136
|
+
ref: z.ZodString;
|
|
137
|
+
quote: z.ZodString;
|
|
138
|
+
start: z.ZodOptional<z.ZodNumber>;
|
|
139
|
+
end: z.ZodOptional<z.ZodNumber>;
|
|
140
|
+
}, z.core.$strict>>;
|
|
141
|
+
proposedReplacement: z.ZodNullable<z.ZodObject<{
|
|
142
|
+
path: z.ZodString;
|
|
143
|
+
blob: z.ZodString;
|
|
144
|
+
startLine: z.ZodNumber;
|
|
145
|
+
endLine: z.ZodNumber;
|
|
146
|
+
before: z.ZodString;
|
|
147
|
+
replacement: z.ZodString;
|
|
148
|
+
}, z.core.$strict>>;
|
|
149
|
+
checkIndices: z.ZodArray<z.ZodNumber>;
|
|
150
|
+
}, z.core.$strict>>;
|
|
151
|
+
}, z.core.$strict>>>;
|
|
152
|
+
findings: z.ZodArray<z.ZodObject<{
|
|
153
|
+
findingId: z.ZodString;
|
|
154
|
+
accepted: z.ZodBoolean;
|
|
155
|
+
suggestionAccepted: z.ZodBoolean;
|
|
156
|
+
explanation: z.ZodString;
|
|
157
|
+
}, z.core.$strict>>;
|
|
158
|
+
}, z.core.$strict>>;
|
|
159
|
+
}, z.core.$strict>;
|
|
160
|
+
export declare const verificationSelectionSchema: z.ZodObject<{
|
|
161
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
162
|
+
assessmentId: z.ZodString;
|
|
163
|
+
disposition: z.ZodEnum<{
|
|
164
|
+
unresolved: "unresolved";
|
|
165
|
+
accept: "accept";
|
|
166
|
+
reject: "reject";
|
|
167
|
+
revise: "revise";
|
|
168
|
+
}>;
|
|
169
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
170
|
+
citations: z.ZodArray<z.ZodObject<{
|
|
171
|
+
ref: z.ZodString;
|
|
172
|
+
startSegment: z.ZodNumber;
|
|
173
|
+
endSegment: z.ZodNumber;
|
|
174
|
+
}, z.core.$strict>>;
|
|
175
|
+
missingChecks: z.ZodArray<z.ZodString>;
|
|
176
|
+
amendment: z.ZodNullable<z.ZodObject<{
|
|
177
|
+
result: z.ZodObject<{
|
|
178
|
+
assessmentId: z.ZodString;
|
|
179
|
+
disposition: z.ZodEnum<{
|
|
180
|
+
evaluated: "evaluated";
|
|
181
|
+
observed: "observed";
|
|
182
|
+
not_applicable: "not_applicable";
|
|
183
|
+
unresolved: "unresolved";
|
|
184
|
+
}>;
|
|
185
|
+
confidence: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodNull]>;
|
|
186
|
+
confidenceReason: z.ZodString;
|
|
187
|
+
explanation: z.ZodString;
|
|
188
|
+
limitations: z.ZodArray<z.ZodString>;
|
|
189
|
+
}, z.core.$strict>;
|
|
190
|
+
followUps: z.ZodArray<z.ZodObject<{
|
|
191
|
+
kind: z.ZodEnum<{
|
|
192
|
+
human_check: "human_check";
|
|
193
|
+
operational_check: "operational_check";
|
|
194
|
+
}>;
|
|
195
|
+
required: z.ZodBoolean;
|
|
196
|
+
explanation: z.ZodString;
|
|
197
|
+
action: z.ZodString;
|
|
198
|
+
passage: z.ZodObject<{
|
|
199
|
+
ref: z.ZodString;
|
|
200
|
+
startSegment: z.ZodNumber;
|
|
201
|
+
endSegment: z.ZodNumber;
|
|
202
|
+
}, z.core.$strict>;
|
|
203
|
+
sourceRefs: z.ZodArray<z.ZodObject<{
|
|
204
|
+
ref: z.ZodString;
|
|
205
|
+
startSegment: z.ZodNumber;
|
|
206
|
+
endSegment: z.ZodNumber;
|
|
207
|
+
}, z.core.$strict>>;
|
|
208
|
+
}, z.core.$strict>>;
|
|
209
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
210
|
+
disposition: z.ZodEnum<{
|
|
211
|
+
evaluated: "evaluated";
|
|
212
|
+
not_applicable: "not_applicable";
|
|
213
|
+
unresolved: "unresolved";
|
|
214
|
+
}>;
|
|
215
|
+
explanation: z.ZodString;
|
|
216
|
+
contraryEvidence: z.ZodString;
|
|
217
|
+
missingEvidence: z.ZodString;
|
|
218
|
+
interpretation: z.ZodString;
|
|
219
|
+
passage: z.ZodObject<{
|
|
220
|
+
ref: z.ZodString;
|
|
221
|
+
startSegment: z.ZodNumber;
|
|
222
|
+
endSegment: z.ZodNumber;
|
|
223
|
+
}, z.core.$strict>;
|
|
224
|
+
sourceRefs: z.ZodArray<z.ZodObject<{
|
|
225
|
+
ref: z.ZodString;
|
|
226
|
+
startSegment: z.ZodNumber;
|
|
227
|
+
endSegment: z.ZodNumber;
|
|
228
|
+
}, z.core.$strict>>;
|
|
229
|
+
}, z.core.$strict>>;
|
|
230
|
+
findings: z.ZodArray<z.ZodObject<{
|
|
231
|
+
explanation: z.ZodString;
|
|
232
|
+
consequence: z.ZodString;
|
|
233
|
+
correction: z.ZodString;
|
|
234
|
+
limitations: z.ZodArray<z.ZodString>;
|
|
235
|
+
classification: z.ZodEnum<{
|
|
236
|
+
binding_violation: "binding_violation";
|
|
237
|
+
behavioral_defect: "behavioral_defect";
|
|
238
|
+
guidance_departure: "guidance_departure";
|
|
239
|
+
}>;
|
|
240
|
+
proposedReplacement: z.ZodNullable<z.ZodObject<{
|
|
241
|
+
path: z.ZodString;
|
|
242
|
+
blob: z.ZodString;
|
|
243
|
+
startLine: z.ZodNumber;
|
|
244
|
+
endLine: z.ZodNumber;
|
|
245
|
+
before: z.ZodString;
|
|
246
|
+
replacement: z.ZodString;
|
|
247
|
+
}, z.core.$strict>>;
|
|
248
|
+
checkIndices: z.ZodArray<z.ZodNumber>;
|
|
249
|
+
locationRefs: z.ZodArray<z.ZodObject<{
|
|
250
|
+
ref: z.ZodString;
|
|
251
|
+
startSegment: z.ZodNumber;
|
|
252
|
+
endSegment: z.ZodNumber;
|
|
253
|
+
}, z.core.$strict>>;
|
|
254
|
+
}, z.core.$strict>>;
|
|
255
|
+
}, z.core.$strict>>;
|
|
256
|
+
findings: z.ZodArray<z.ZodObject<{
|
|
257
|
+
findingId: z.ZodString;
|
|
258
|
+
decision: z.ZodEnum<{
|
|
259
|
+
accept: "accept";
|
|
260
|
+
reject: "reject";
|
|
261
|
+
accept_with_suggestion: "accept_with_suggestion";
|
|
262
|
+
}>;
|
|
263
|
+
explanation: z.ZodNullable<z.ZodString>;
|
|
264
|
+
}, z.core.$strict>>;
|
|
265
|
+
}, z.core.$strict>>;
|
|
266
|
+
changeSummary: z.ZodUnion<readonly [z.ZodObject<{
|
|
267
|
+
overview: z.ZodString;
|
|
268
|
+
reviewFocus: z.ZodArray<z.ZodString>;
|
|
269
|
+
sourceRefs: z.ZodArray<z.ZodObject<{
|
|
270
|
+
ref: z.ZodString;
|
|
271
|
+
startSegment: z.ZodNumber;
|
|
272
|
+
endSegment: z.ZodNumber;
|
|
273
|
+
}, z.core.$strict>>;
|
|
274
|
+
}, z.core.$strict>, z.ZodLiteral<false>, z.ZodNull]>;
|
|
275
|
+
}, z.core.$strict>;
|
|
276
|
+
/** Expand resolved model selections using known records before strict canonical validation. */
|
|
277
|
+
export declare function resolveVerificationAmendments(input: unknown, entries: AssessmentEntry[], proposals: AssessmentProposal[]): {
|
|
278
|
+
entries: {
|
|
279
|
+
reason: string;
|
|
280
|
+
citations: {
|
|
281
|
+
ref: string;
|
|
282
|
+
quote: string;
|
|
283
|
+
start?: number | undefined;
|
|
284
|
+
end?: number | undefined;
|
|
285
|
+
}[];
|
|
286
|
+
resolution: null;
|
|
287
|
+
amendment: {
|
|
288
|
+
result: {
|
|
289
|
+
disposition: "evaluated" | "observed" | "not_applicable" | "unresolved";
|
|
290
|
+
citations: {
|
|
291
|
+
ref: string;
|
|
292
|
+
quote: string;
|
|
293
|
+
start?: number | undefined;
|
|
294
|
+
end?: number | undefined;
|
|
295
|
+
}[];
|
|
296
|
+
revisionOf: number | null;
|
|
297
|
+
confidence: 1 | 2 | 3 | null;
|
|
298
|
+
adherence: number | null;
|
|
299
|
+
finding: string;
|
|
300
|
+
consequence: string;
|
|
301
|
+
correction: string;
|
|
302
|
+
assessmentId: string;
|
|
303
|
+
confidenceReason: string;
|
|
304
|
+
explanation: string;
|
|
305
|
+
limitations: string[];
|
|
306
|
+
};
|
|
307
|
+
followUps: {
|
|
308
|
+
kind: "human_check" | "operational_check";
|
|
309
|
+
required: boolean;
|
|
310
|
+
explanation: string;
|
|
311
|
+
action: string;
|
|
312
|
+
passage: {
|
|
313
|
+
ref: string;
|
|
314
|
+
quote: string;
|
|
315
|
+
start?: number | undefined;
|
|
316
|
+
end?: number | undefined;
|
|
317
|
+
};
|
|
318
|
+
sourceRefs: {
|
|
319
|
+
ref: string;
|
|
320
|
+
quote: string;
|
|
321
|
+
start?: number | undefined;
|
|
322
|
+
end?: number | undefined;
|
|
323
|
+
}[];
|
|
324
|
+
}[];
|
|
325
|
+
checks: {
|
|
326
|
+
disposition: "evaluated" | "not_applicable" | "unresolved";
|
|
327
|
+
sourceRefs: {
|
|
328
|
+
ref: string;
|
|
329
|
+
quote: string;
|
|
330
|
+
start?: number | undefined;
|
|
331
|
+
end?: number | undefined;
|
|
332
|
+
}[];
|
|
333
|
+
explanation: string;
|
|
334
|
+
contraryEvidence: string;
|
|
335
|
+
missingEvidence: string;
|
|
336
|
+
passage: {
|
|
337
|
+
ref: string;
|
|
338
|
+
quote: string;
|
|
339
|
+
start?: number | undefined;
|
|
340
|
+
end?: number | undefined;
|
|
341
|
+
};
|
|
342
|
+
interpretation: string;
|
|
343
|
+
}[];
|
|
344
|
+
findings: {
|
|
345
|
+
explanation: string;
|
|
346
|
+
consequence: string;
|
|
347
|
+
correction: string;
|
|
348
|
+
limitations: string[];
|
|
349
|
+
classification: "binding_violation" | "behavioral_defect" | "guidance_departure";
|
|
350
|
+
locationRefs: {
|
|
351
|
+
ref: string;
|
|
352
|
+
quote: string;
|
|
353
|
+
start?: number | undefined;
|
|
354
|
+
end?: number | undefined;
|
|
355
|
+
}[];
|
|
356
|
+
proposedReplacement: {
|
|
357
|
+
path: string;
|
|
358
|
+
blob: string;
|
|
359
|
+
startLine: number;
|
|
360
|
+
endLine: number;
|
|
361
|
+
before: string;
|
|
362
|
+
replacement: string;
|
|
363
|
+
} | null;
|
|
364
|
+
checkIndices: number[];
|
|
365
|
+
}[];
|
|
366
|
+
} | null;
|
|
367
|
+
findings: {
|
|
368
|
+
findingId: string;
|
|
369
|
+
accepted: boolean;
|
|
370
|
+
suggestionAccepted: boolean;
|
|
371
|
+
explanation: string;
|
|
372
|
+
}[];
|
|
373
|
+
assessmentId: string;
|
|
374
|
+
disposition: "unresolved" | "accept" | "reject" | "revise";
|
|
375
|
+
missingChecks: string[];
|
|
376
|
+
}[];
|
|
377
|
+
};
|
|
378
|
+
export type VerificationEntry = Omit<z.infer<typeof verificationSchema>['entries'][number], 'citations' | 'resolution' | 'amendment'> & {
|
|
379
|
+
citations: Citation[];
|
|
380
|
+
resolution?: AcceptedResult | null;
|
|
381
|
+
amendment?: AssessmentProposal | null;
|
|
382
|
+
};
|
|
383
|
+
export declare function validateVerification(input: unknown, proposals: AssessmentProposal[], ledger: EvidenceLedger, entries?: AssessmentEntry[], structured?: Record<string, Array<{
|
|
384
|
+
path: string;
|
|
385
|
+
value: unknown;
|
|
386
|
+
}>>): VerificationEntry[];
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { changeSummarySelectionSchema } from './change-summary.js';
|
|
3
|
+
import { citationSchema, selectionSchema } from './evidence.js';
|
|
4
|
+
import { exactIds } from './planning.js';
|
|
5
|
+
import { assessmentSubmissionSchema, investigationSubmissionSchema, deriveAssessmentCitations, assessmentSelectionSchema, validateAssessmentSubmission, } from './assessment.js';
|
|
6
|
+
import { resultSchema, validateResult } from './results.js';
|
|
7
|
+
export const verificationSchema = z.strictObject({
|
|
8
|
+
entries: z.array(z.strictObject({
|
|
9
|
+
assessmentId: z.string(),
|
|
10
|
+
disposition: z
|
|
11
|
+
.enum(['accept', 'revise', 'reject', 'unresolved'])
|
|
12
|
+
.describe('Whether the ASSESSMENT is supported, not whether the code is compliant. Accept a correct assessment even when it establishes violations. accept requires no missing checks and all finding claims supported; otherwise revise/reject/unresolved.'),
|
|
13
|
+
reason: z.string().min(1),
|
|
14
|
+
citations: z.array(citationSchema),
|
|
15
|
+
missingChecks: z.array(z.string()),
|
|
16
|
+
resolution: resultSchema
|
|
17
|
+
.nullable()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('Corrected final criterion judgment after independent inspection, or null. Use with revise/reject when the original conclusion is wrong but available evidence settles the correction. Missing decisive checks require unresolved. Never infer a clean result merely by rejecting findings.'),
|
|
20
|
+
amendment: assessmentSubmissionSchema.shape.assessments.element
|
|
21
|
+
.nullable()
|
|
22
|
+
.optional()
|
|
23
|
+
.describe('Complete replacement criterion assessment with passage-backed checks and final findings. Use to add missed findings or correct classifications. Supersedes all original findings; include every still-supported finding. Cannot be combined with resolution.'),
|
|
24
|
+
findings: z.array(z.strictObject({
|
|
25
|
+
findingId: z.string(),
|
|
26
|
+
accepted: z
|
|
27
|
+
.boolean()
|
|
28
|
+
.describe('True means this finding is supported by governing criteria and source, including a real code violation. False means the finding claim needs rejection or revision; it is not a code-approval flag.'),
|
|
29
|
+
suggestionAccepted: z
|
|
30
|
+
.boolean()
|
|
31
|
+
.describe('False unless this exact finding has a non-null proposedReplacement object and independent source inspection supports that replacement. A textual correction alone is not a replacement. Requires accepted=true.'),
|
|
32
|
+
explanation: z.string().min(1),
|
|
33
|
+
})),
|
|
34
|
+
})),
|
|
35
|
+
});
|
|
36
|
+
/** Compact model decisions reference immutable proposals; canonical validation stays independent. */
|
|
37
|
+
const modelVerification = z.strictObject({
|
|
38
|
+
assessmentId: z.string(),
|
|
39
|
+
disposition: verificationSchema.shape.entries.element.shape.disposition,
|
|
40
|
+
reason: z
|
|
41
|
+
.string()
|
|
42
|
+
.min(1)
|
|
43
|
+
.nullable()
|
|
44
|
+
.describe('Null records confirmation of the original assessment on acceptance only.'),
|
|
45
|
+
citations: z.array(selectionSchema).describe('Empty reuses original assessment citations on acceptance only.'),
|
|
46
|
+
missingChecks: z.array(z.string()),
|
|
47
|
+
amendment: assessmentSelectionSchema.shape.assessments.element.nullable(),
|
|
48
|
+
findings: z.array(z.strictObject({
|
|
49
|
+
findingId: z.string(),
|
|
50
|
+
decision: z.enum(['accept', 'accept_with_suggestion', 'reject']),
|
|
51
|
+
explanation: z.string().min(1).nullable().describe('Null reuses a supported original finding explanation.'),
|
|
52
|
+
})),
|
|
53
|
+
});
|
|
54
|
+
export const verificationSelectionSchema = z.strictObject({
|
|
55
|
+
entries: z.array(modelVerification),
|
|
56
|
+
changeSummary: z
|
|
57
|
+
.union([changeSummarySelectionSchema, z.literal(false), z.null()])
|
|
58
|
+
.describe('A checked summary object replaces the narrative; null contributes no update in this batch; false explicitly withdraws an unsupported summary.'),
|
|
59
|
+
});
|
|
60
|
+
/** Expand resolved model selections using known records before strict canonical validation. */
|
|
61
|
+
export function resolveVerificationAmendments(input, entries, proposals) {
|
|
62
|
+
const parsed = z
|
|
63
|
+
.strictObject({
|
|
64
|
+
entries: z.array(modelVerification.extend({
|
|
65
|
+
citations: z.array(citationSchema),
|
|
66
|
+
amendment: investigationSubmissionSchema.shape.assessments.element.nullable(),
|
|
67
|
+
})),
|
|
68
|
+
})
|
|
69
|
+
.parse(input);
|
|
70
|
+
return {
|
|
71
|
+
entries: parsed.entries.map((entry) => {
|
|
72
|
+
const proposal = proposals.find((p) => p.result.assessmentId === entry.assessmentId);
|
|
73
|
+
if (!proposal)
|
|
74
|
+
throw new Error('foreign_assessment_id');
|
|
75
|
+
if (entry.disposition !== 'accept' && (!entry.reason || !entry.citations.length))
|
|
76
|
+
throw new Error('verification_correction_evidence_required');
|
|
77
|
+
return {
|
|
78
|
+
...entry,
|
|
79
|
+
reason: entry.reason ??
|
|
80
|
+
'Independent verification confirmed the supplied assessment against the provided evidence.',
|
|
81
|
+
citations: entry.citations.length
|
|
82
|
+
? entry.citations
|
|
83
|
+
: proposal.result.citations.map(({ ref, quote, start, end }) => ({ ref, quote, start, end })),
|
|
84
|
+
resolution: null,
|
|
85
|
+
amendment: entry.amendment
|
|
86
|
+
? deriveAssessmentCitations({ assessments: [entry.amendment] }, entries)
|
|
87
|
+
: null,
|
|
88
|
+
findings: entry.findings.map((finding) => {
|
|
89
|
+
const original = proposal.findings.find((f) => f.findingId === finding.findingId);
|
|
90
|
+
if (!original)
|
|
91
|
+
throw new Error('foreign_finding_id');
|
|
92
|
+
if (finding.decision === 'reject' && !finding.explanation)
|
|
93
|
+
throw new Error('verification_rejection_explanation_required');
|
|
94
|
+
return {
|
|
95
|
+
findingId: finding.findingId,
|
|
96
|
+
accepted: finding.decision !== 'reject',
|
|
97
|
+
suggestionAccepted: finding.decision === 'accept_with_suggestion',
|
|
98
|
+
explanation: finding.explanation ?? original.explanation,
|
|
99
|
+
};
|
|
100
|
+
}),
|
|
101
|
+
};
|
|
102
|
+
}),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export function validateVerification(input, proposals, ledger, entries = [], structured = {}) {
|
|
106
|
+
const parsed = verificationSchema.parse(input);
|
|
107
|
+
exactIds(parsed.entries.map((e) => e.assessmentId), proposals.map((p) => p.result.assessmentId));
|
|
108
|
+
return parsed.entries.map((e, entryIndex) => {
|
|
109
|
+
const p = proposals.find((p) => p.result.assessmentId === e.assessmentId);
|
|
110
|
+
exactIds(e.findings.map((f) => f.findingId), p.findings.map((f) => f.findingId));
|
|
111
|
+
const citations = e.citations.map((c, citationIndex) => ledger.cite(c, ['entries', entryIndex, 'citations', citationIndex]));
|
|
112
|
+
if (!citations.some((c) => c.provenance.kind === 'publication' &&
|
|
113
|
+
p.result.citations.some((o) => o.provenance.kind === 'publication' &&
|
|
114
|
+
o.provenance.nodeId === c.provenance.nodeId &&
|
|
115
|
+
o.provenance.version === c.provenance.version &&
|
|
116
|
+
o.provenance.contentHash === c.provenance.contentHash)))
|
|
117
|
+
throw new Error('verification_governing_evidence_required');
|
|
118
|
+
if (e.disposition === 'accept' && (e.missingChecks.length || e.findings.some((f) => !f.accepted)))
|
|
119
|
+
throw new Error('verification_acceptance_inconsistent');
|
|
120
|
+
if (((e.disposition === 'accept' && p.result.disposition === 'evaluated') ||
|
|
121
|
+
e.findings.some((finding) => finding.accepted)) &&
|
|
122
|
+
!citations.some((c) => c.provenance.kind === 'source'))
|
|
123
|
+
throw new Error('verification_source_required');
|
|
124
|
+
if (e.findings.some((f) => f.suggestionAccepted &&
|
|
125
|
+
(!f.accepted || !p.findings.find((o) => o.findingId === f.findingId)?.proposedReplacement)))
|
|
126
|
+
throw new Error('unproposed_suggestion_acceptance');
|
|
127
|
+
const resolution = e.resolution ? validateResolution(e, p, entries, ledger) : null;
|
|
128
|
+
const amendment = e.amendment ? validateAmendment(e, entries, ledger, structured) : null;
|
|
129
|
+
return { ...e, citations, resolution: amendment?.result ?? resolution, amendment };
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function validateAmendment(verdict, entries, ledger, structured) {
|
|
133
|
+
const input = verdict.amendment;
|
|
134
|
+
if (verdict.disposition === 'accept' ||
|
|
135
|
+
verdict.resolution ||
|
|
136
|
+
input.result.assessmentId !== verdict.assessmentId ||
|
|
137
|
+
verdict.findings.some((f) => f.accepted || f.suggestionAccepted))
|
|
138
|
+
throw new Error('verification_amendment_inconsistent');
|
|
139
|
+
if (input.findings.some((f) => f.proposedReplacement !== null))
|
|
140
|
+
throw new Error('verification_amendment_suggestion_unchecked');
|
|
141
|
+
const amendment = validateAssessmentSubmission({ assessments: [input] }, entries, ledger, structured);
|
|
142
|
+
if (verdict.missingChecks.length && amendment.result.disposition !== 'unresolved')
|
|
143
|
+
throw new Error('verification_resolution_missing_checks');
|
|
144
|
+
return {
|
|
145
|
+
...amendment,
|
|
146
|
+
checks: amendment.checks.map((check) => ({ ...check, verified: true })),
|
|
147
|
+
findings: amendment.findings.map((finding) => ({ ...finding, verified: true })),
|
|
148
|
+
...(amendment.followUps
|
|
149
|
+
? { followUps: amendment.followUps.map((followUp) => ({ ...followUp, verified: true })) }
|
|
150
|
+
: {}),
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function validateResolution(verdict, proposal, entries, ledger) {
|
|
154
|
+
const input = verdict.resolution;
|
|
155
|
+
if (verdict.disposition === 'accept' || input.assessmentId !== verdict.assessmentId)
|
|
156
|
+
throw new Error('verification_resolution_inconsistent');
|
|
157
|
+
const result = validateResult(input, entries, ledger, ['resolution']);
|
|
158
|
+
const accepted = proposal.findings.filter((finding) => verdict.findings.some((f) => f.findingId === finding.findingId && f.accepted));
|
|
159
|
+
if (verdict.missingChecks.length && result.disposition !== 'unresolved')
|
|
160
|
+
throw new Error('verification_resolution_missing_checks');
|
|
161
|
+
if (result.disposition !== 'unresolved') {
|
|
162
|
+
const classifications = accepted.map((finding) => finding.classification);
|
|
163
|
+
const classification = ['binding_violation', 'behavioral_defect', 'guidance_departure'].find((value) => classifications.includes(value)) ?? 'none';
|
|
164
|
+
if (result.finding !== classification || (accepted.length > 0 && result.disposition !== 'evaluated'))
|
|
165
|
+
throw new Error('verification_resolution_findings_mismatch');
|
|
166
|
+
}
|
|
167
|
+
return result;
|
|
168
|
+
}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
// Both src/ and dist/ resolve the prepared package manifest at the public root.
|
|
3
|
+
const manifest = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
4
|
+
export const packageVersion = manifest.version;
|
|
5
|
+
// The exporter creates this exact tag before npm publication. Local checkouts have no public asset ref.
|
|
6
|
+
export const assessLogoBaseUrl = manifest.repository?.url === 'git+https://github.com/contextrail/assess.git' &&
|
|
7
|
+
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-alpha\.[1-9]\d*)?$/.test(packageVersion)
|
|
8
|
+
? `https://raw.githubusercontent.com/contextrail/assess/v${packageVersion}/assets/brand`
|
|
9
|
+
: null;
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# ContextRail Assess documentation
|
|
2
|
+
|
|
3
|
+
[Product overview](../README.md)
|
|
4
|
+
|
|
5
|
+
For teams adopting Assess, start with the setup path that matches your work. ContextRail maintains
|
|
6
|
+
these docs alongside the package and Action; the same pages ship in the public repository and npm package.
|
|
7
|
+
|
|
8
|
+
| What you need to do | Read |
|
|
9
|
+
| ------------------------------------------ | --------------------------------------------- |
|
|
10
|
+
| Choose and publish the standards to assess | [Standards setup](standards.md) |
|
|
11
|
+
| Get your first local result | [First assessment](getting-started.md) |
|
|
12
|
+
| Connect GitHub pull requests | [GitHub Actions](github-actions.md) |
|
|
13
|
+
| Act on findings, questions or a failure | [Results and next actions](review-results.md) |
|
|
14
|
+
| Evaluate data handling and access | [Security and data handling](security.md) |
|
|
15
|
+
| Configure models, effort and limits | [CLI configuration](configuration.md) |
|
|
16
|
+
| Look up Action inputs and outputs | [Action reference](action-reference.md) |
|
|
17
|
+
| Diagnose, resume or inspect a run | [Operations](operations.md) |
|
|
18
|
+
| Understand or change the harness | [Architecture](architecture.md) |
|
|
19
|
+
| Develop or publish the package | [Contributing](contributing.md) |
|
|
20
|
+
|
|
21
|
+
For coding agents: load the page for the current task, then follow the links needed to resolve a
|
|
22
|
+
specific question. The CLI's `--help` and [Action metadata](https://github.com/contextrail/assess/blob/main/action/action.yml)
|
|
23
|
+
define the executable interface. Published reviewer skills and contexts define the assessment
|
|
24
|
+
criteria; documentation and PR discussion do not override them.
|