@kodr/aiwrangler 0.0.0-stage → 0.1.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/CHANGELOG.md +50 -0
- package/LICENSE +202 -0
- package/NOTICE +9 -0
- package/README.md +434 -2
- package/aiwrangler.config.example.json +62 -0
- package/dist/chunk-2CIV4KGU.js +1276 -0
- package/dist/chunk-2CIV4KGU.js.map +1 -0
- package/dist/chunk-EAQASAXL.js +1252 -0
- package/dist/chunk-EAQASAXL.js.map +1 -0
- package/dist/chunk-EDVWHCQV.js +145 -0
- package/dist/chunk-EDVWHCQV.js.map +1 -0
- package/dist/chunk-NQFO47CV.js +522 -0
- package/dist/chunk-NQFO47CV.js.map +1 -0
- package/dist/cli.js +262 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +697 -0
- package/dist/index.js +77 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp.js +214 -0
- package/dist/mcp.js.map +1 -0
- package/dist/plugin.js +112 -0
- package/dist/plugin.js.map +1 -0
- package/dist/tools.js +127 -0
- package/dist/tools.js.map +1 -0
- package/package.json +87 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,697 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
type SourceKind = "spec" | "rule" | "divergence" | "question" | "door" | "paper" | "doc";
|
|
4
|
+
type EntryStatus = "ruled" | "open" | "answered" | "info";
|
|
5
|
+
interface CorpusSection {
|
|
6
|
+
id: string;
|
|
7
|
+
kind: SourceKind;
|
|
8
|
+
title: string;
|
|
9
|
+
text: string;
|
|
10
|
+
source: string;
|
|
11
|
+
status: EntryStatus;
|
|
12
|
+
ruling?: string;
|
|
13
|
+
paperRef?: string;
|
|
14
|
+
precedence: number;
|
|
15
|
+
}
|
|
16
|
+
interface CorpusSource {
|
|
17
|
+
path: string;
|
|
18
|
+
hash: string;
|
|
19
|
+
}
|
|
20
|
+
interface Corpus {
|
|
21
|
+
sections: CorpusSection[];
|
|
22
|
+
sources: CorpusSource[];
|
|
23
|
+
hash: string;
|
|
24
|
+
paperText: string;
|
|
25
|
+
}
|
|
26
|
+
declare const PRECEDENCE: {
|
|
27
|
+
readonly ruling: 0;
|
|
28
|
+
readonly paper: 1;
|
|
29
|
+
readonly door: 1;
|
|
30
|
+
readonly spec: 2;
|
|
31
|
+
readonly doc: 3;
|
|
32
|
+
readonly nonRuling: 4;
|
|
33
|
+
};
|
|
34
|
+
type Severity = "block" | "review" | "human";
|
|
35
|
+
interface DiffLine {
|
|
36
|
+
kind: "add" | "del" | "ctx";
|
|
37
|
+
text: string;
|
|
38
|
+
newLine?: number;
|
|
39
|
+
oldLine?: number;
|
|
40
|
+
}
|
|
41
|
+
interface DiffHunk {
|
|
42
|
+
header: string;
|
|
43
|
+
lines: DiffLine[];
|
|
44
|
+
}
|
|
45
|
+
interface DiffFile {
|
|
46
|
+
path: string;
|
|
47
|
+
oldPath?: string;
|
|
48
|
+
binary: boolean;
|
|
49
|
+
hunks: DiffHunk[];
|
|
50
|
+
}
|
|
51
|
+
interface RepoDiff {
|
|
52
|
+
repo: string;
|
|
53
|
+
repoDir: string;
|
|
54
|
+
files: DiffFile[];
|
|
55
|
+
}
|
|
56
|
+
interface Finding {
|
|
57
|
+
rule: string;
|
|
58
|
+
severity: Severity;
|
|
59
|
+
repo: string;
|
|
60
|
+
file: string;
|
|
61
|
+
line: number | null;
|
|
62
|
+
evidence: string;
|
|
63
|
+
note: string;
|
|
64
|
+
kind?: "deterministic" | "semantic";
|
|
65
|
+
confidence?: number;
|
|
66
|
+
noul?: number;
|
|
67
|
+
acknowledged?: boolean;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
declare const RuntimeOverridesSchema: z.ZodObject<{
|
|
71
|
+
activePolicy: z.ZodOptional<z.ZodString>;
|
|
72
|
+
egressSemantic: z.ZodOptional<z.ZodBoolean>;
|
|
73
|
+
actionThreshold: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
reviewThreshold: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
gates: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
activePolicy?: string | undefined;
|
|
78
|
+
egressSemantic?: boolean | undefined;
|
|
79
|
+
actionThreshold?: number | undefined;
|
|
80
|
+
reviewThreshold?: number | undefined;
|
|
81
|
+
gates?: Record<string, boolean> | undefined;
|
|
82
|
+
}, {
|
|
83
|
+
activePolicy?: string | undefined;
|
|
84
|
+
egressSemantic?: boolean | undefined;
|
|
85
|
+
actionThreshold?: number | undefined;
|
|
86
|
+
reviewThreshold?: number | undefined;
|
|
87
|
+
gates?: Record<string, boolean> | undefined;
|
|
88
|
+
}>;
|
|
89
|
+
type RuntimeOverrides = z.infer<typeof RuntimeOverridesSchema>;
|
|
90
|
+
|
|
91
|
+
declare const ConfigSchema: z.ZodObject<{
|
|
92
|
+
model: z.ZodDefault<z.ZodString>;
|
|
93
|
+
activePolicy: z.ZodDefault<z.ZodString>;
|
|
94
|
+
egress: z.ZodDefault<z.ZodObject<{
|
|
95
|
+
semantic: z.ZodDefault<z.ZodBoolean>;
|
|
96
|
+
warnOncePerSession: z.ZodDefault<z.ZodBoolean>;
|
|
97
|
+
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
semantic: boolean;
|
|
99
|
+
warnOncePerSession: boolean;
|
|
100
|
+
}, {
|
|
101
|
+
semantic?: boolean | undefined;
|
|
102
|
+
warnOncePerSession?: boolean | undefined;
|
|
103
|
+
}>>;
|
|
104
|
+
corpus: z.ZodDefault<z.ZodObject<{
|
|
105
|
+
spec: z.ZodDefault<z.ZodString>;
|
|
106
|
+
rules: z.ZodDefault<z.ZodString>;
|
|
107
|
+
divergences: z.ZodDefault<z.ZodString>;
|
|
108
|
+
questions: z.ZodDefault<z.ZodString>;
|
|
109
|
+
plan: z.ZodDefault<z.ZodString>;
|
|
110
|
+
docs: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
111
|
+
whitepaper: z.ZodDefault<z.ZodString>;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
spec: string;
|
|
114
|
+
rules: string;
|
|
115
|
+
divergences: string;
|
|
116
|
+
questions: string;
|
|
117
|
+
plan: string;
|
|
118
|
+
docs: string[];
|
|
119
|
+
whitepaper: string;
|
|
120
|
+
}, {
|
|
121
|
+
spec?: string | undefined;
|
|
122
|
+
rules?: string | undefined;
|
|
123
|
+
divergences?: string | undefined;
|
|
124
|
+
questions?: string | undefined;
|
|
125
|
+
plan?: string | undefined;
|
|
126
|
+
docs?: string[] | undefined;
|
|
127
|
+
whitepaper?: string | undefined;
|
|
128
|
+
}>>;
|
|
129
|
+
gates: z.ZodDefault<z.ZodObject<{
|
|
130
|
+
plan: z.ZodDefault<z.ZodObject<{
|
|
131
|
+
inSpec: z.ZodDefault<z.ZodBoolean>;
|
|
132
|
+
ambiguity: z.ZodDefault<z.ZodBoolean>;
|
|
133
|
+
openQuestions: z.ZodDefault<z.ZodBoolean>;
|
|
134
|
+
oneWayDoors: z.ZodDefault<z.ZodBoolean>;
|
|
135
|
+
}, "strip", z.ZodTypeAny, {
|
|
136
|
+
inSpec: boolean;
|
|
137
|
+
ambiguity: boolean;
|
|
138
|
+
openQuestions: boolean;
|
|
139
|
+
oneWayDoors: boolean;
|
|
140
|
+
}, {
|
|
141
|
+
inSpec?: boolean | undefined;
|
|
142
|
+
ambiguity?: boolean | undefined;
|
|
143
|
+
openQuestions?: boolean | undefined;
|
|
144
|
+
oneWayDoors?: boolean | undefined;
|
|
145
|
+
}>>;
|
|
146
|
+
retrieval: z.ZodDefault<z.ZodObject<{
|
|
147
|
+
rerank: z.ZodDefault<z.ZodBoolean>;
|
|
148
|
+
topK: z.ZodDefault<z.ZodNumber>;
|
|
149
|
+
}, "strip", z.ZodTypeAny, {
|
|
150
|
+
rerank: boolean;
|
|
151
|
+
topK: number;
|
|
152
|
+
}, {
|
|
153
|
+
rerank?: boolean | undefined;
|
|
154
|
+
topK?: number | undefined;
|
|
155
|
+
}>>;
|
|
156
|
+
check: z.ZodDefault<z.ZodObject<{
|
|
157
|
+
deterministic: z.ZodDefault<z.ZodBoolean>;
|
|
158
|
+
battery: z.ZodDefault<z.ZodBoolean>;
|
|
159
|
+
selfReport: z.ZodDefault<z.ZodBoolean>;
|
|
160
|
+
testQuality: z.ZodDefault<z.ZodBoolean>;
|
|
161
|
+
docDrift: z.ZodDefault<z.ZodBoolean>;
|
|
162
|
+
injectionDefense: z.ZodDefault<z.ZodBoolean>;
|
|
163
|
+
}, "strip", z.ZodTypeAny, {
|
|
164
|
+
deterministic: boolean;
|
|
165
|
+
battery: boolean;
|
|
166
|
+
selfReport: boolean;
|
|
167
|
+
testQuality: boolean;
|
|
168
|
+
docDrift: boolean;
|
|
169
|
+
injectionDefense: boolean;
|
|
170
|
+
}, {
|
|
171
|
+
deterministic?: boolean | undefined;
|
|
172
|
+
battery?: boolean | undefined;
|
|
173
|
+
selfReport?: boolean | undefined;
|
|
174
|
+
testQuality?: boolean | undefined;
|
|
175
|
+
docDrift?: boolean | undefined;
|
|
176
|
+
injectionDefense?: boolean | undefined;
|
|
177
|
+
}>>;
|
|
178
|
+
security: z.ZodDefault<z.ZodObject<{
|
|
179
|
+
trustBoundary: z.ZodDefault<z.ZodBoolean>;
|
|
180
|
+
severity: z.ZodDefault<z.ZodBoolean>;
|
|
181
|
+
alwaysHuman: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
182
|
+
}, "strip", z.ZodTypeAny, {
|
|
183
|
+
trustBoundary: boolean;
|
|
184
|
+
severity: boolean;
|
|
185
|
+
alwaysHuman: string[];
|
|
186
|
+
}, {
|
|
187
|
+
trustBoundary?: boolean | undefined;
|
|
188
|
+
severity?: boolean | undefined;
|
|
189
|
+
alwaysHuman?: string[] | undefined;
|
|
190
|
+
}>>;
|
|
191
|
+
loop: z.ZodDefault<z.ZodObject<{
|
|
192
|
+
retryProgress: z.ZodDefault<z.ZodBoolean>;
|
|
193
|
+
errorSalience: z.ZodDefault<z.ZodBoolean>;
|
|
194
|
+
maxCycles: z.ZodDefault<z.ZodNumber>;
|
|
195
|
+
}, "strip", z.ZodTypeAny, {
|
|
196
|
+
retryProgress: boolean;
|
|
197
|
+
errorSalience: boolean;
|
|
198
|
+
maxCycles: number;
|
|
199
|
+
}, {
|
|
200
|
+
retryProgress?: boolean | undefined;
|
|
201
|
+
errorSalience?: boolean | undefined;
|
|
202
|
+
maxCycles?: number | undefined;
|
|
203
|
+
}>>;
|
|
204
|
+
session: z.ZodDefault<z.ZodObject<{
|
|
205
|
+
endAudit: z.ZodDefault<z.ZodBoolean>;
|
|
206
|
+
nudge: z.ZodDefault<z.ZodBoolean>;
|
|
207
|
+
maxNudges: z.ZodDefault<z.ZodNumber>;
|
|
208
|
+
}, "strip", z.ZodTypeAny, {
|
|
209
|
+
endAudit: boolean;
|
|
210
|
+
nudge: boolean;
|
|
211
|
+
maxNudges: number;
|
|
212
|
+
}, {
|
|
213
|
+
endAudit?: boolean | undefined;
|
|
214
|
+
nudge?: boolean | undefined;
|
|
215
|
+
maxNudges?: number | undefined;
|
|
216
|
+
}>>;
|
|
217
|
+
}, "strip", z.ZodTypeAny, {
|
|
218
|
+
plan: {
|
|
219
|
+
inSpec: boolean;
|
|
220
|
+
ambiguity: boolean;
|
|
221
|
+
openQuestions: boolean;
|
|
222
|
+
oneWayDoors: boolean;
|
|
223
|
+
};
|
|
224
|
+
retrieval: {
|
|
225
|
+
rerank: boolean;
|
|
226
|
+
topK: number;
|
|
227
|
+
};
|
|
228
|
+
check: {
|
|
229
|
+
deterministic: boolean;
|
|
230
|
+
battery: boolean;
|
|
231
|
+
selfReport: boolean;
|
|
232
|
+
testQuality: boolean;
|
|
233
|
+
docDrift: boolean;
|
|
234
|
+
injectionDefense: boolean;
|
|
235
|
+
};
|
|
236
|
+
security: {
|
|
237
|
+
trustBoundary: boolean;
|
|
238
|
+
severity: boolean;
|
|
239
|
+
alwaysHuman: string[];
|
|
240
|
+
};
|
|
241
|
+
loop: {
|
|
242
|
+
retryProgress: boolean;
|
|
243
|
+
errorSalience: boolean;
|
|
244
|
+
maxCycles: number;
|
|
245
|
+
};
|
|
246
|
+
session: {
|
|
247
|
+
endAudit: boolean;
|
|
248
|
+
nudge: boolean;
|
|
249
|
+
maxNudges: number;
|
|
250
|
+
};
|
|
251
|
+
}, {
|
|
252
|
+
plan?: {
|
|
253
|
+
inSpec?: boolean | undefined;
|
|
254
|
+
ambiguity?: boolean | undefined;
|
|
255
|
+
openQuestions?: boolean | undefined;
|
|
256
|
+
oneWayDoors?: boolean | undefined;
|
|
257
|
+
} | undefined;
|
|
258
|
+
retrieval?: {
|
|
259
|
+
rerank?: boolean | undefined;
|
|
260
|
+
topK?: number | undefined;
|
|
261
|
+
} | undefined;
|
|
262
|
+
check?: {
|
|
263
|
+
deterministic?: boolean | undefined;
|
|
264
|
+
battery?: boolean | undefined;
|
|
265
|
+
selfReport?: boolean | undefined;
|
|
266
|
+
testQuality?: boolean | undefined;
|
|
267
|
+
docDrift?: boolean | undefined;
|
|
268
|
+
injectionDefense?: boolean | undefined;
|
|
269
|
+
} | undefined;
|
|
270
|
+
security?: {
|
|
271
|
+
trustBoundary?: boolean | undefined;
|
|
272
|
+
severity?: boolean | undefined;
|
|
273
|
+
alwaysHuman?: string[] | undefined;
|
|
274
|
+
} | undefined;
|
|
275
|
+
loop?: {
|
|
276
|
+
retryProgress?: boolean | undefined;
|
|
277
|
+
errorSalience?: boolean | undefined;
|
|
278
|
+
maxCycles?: number | undefined;
|
|
279
|
+
} | undefined;
|
|
280
|
+
session?: {
|
|
281
|
+
endAudit?: boolean | undefined;
|
|
282
|
+
nudge?: boolean | undefined;
|
|
283
|
+
maxNudges?: number | undefined;
|
|
284
|
+
} | undefined;
|
|
285
|
+
}>>;
|
|
286
|
+
policies: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
287
|
+
actionThreshold: z.ZodDefault<z.ZodNumber>;
|
|
288
|
+
reviewThreshold: z.ZodDefault<z.ZodNumber>;
|
|
289
|
+
}, "strip", z.ZodTypeAny, {
|
|
290
|
+
actionThreshold: number;
|
|
291
|
+
reviewThreshold: number;
|
|
292
|
+
}, {
|
|
293
|
+
actionThreshold?: number | undefined;
|
|
294
|
+
reviewThreshold?: number | undefined;
|
|
295
|
+
}>>>;
|
|
296
|
+
cache: z.ZodDefault<z.ZodObject<{
|
|
297
|
+
dir: z.ZodDefault<z.ZodString>;
|
|
298
|
+
}, "strip", z.ZodTypeAny, {
|
|
299
|
+
dir: string;
|
|
300
|
+
}, {
|
|
301
|
+
dir?: string | undefined;
|
|
302
|
+
}>>;
|
|
303
|
+
ledger: z.ZodDefault<z.ZodObject<{
|
|
304
|
+
path: z.ZodDefault<z.ZodString>;
|
|
305
|
+
}, "strip", z.ZodTypeAny, {
|
|
306
|
+
path: string;
|
|
307
|
+
}, {
|
|
308
|
+
path?: string | undefined;
|
|
309
|
+
}>>;
|
|
310
|
+
repos: z.ZodDefault<z.ZodObject<{
|
|
311
|
+
super: z.ZodDefault<z.ZodString>;
|
|
312
|
+
members: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
313
|
+
reviewed: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
314
|
+
}, "strip", z.ZodTypeAny, {
|
|
315
|
+
super: string;
|
|
316
|
+
members: string[];
|
|
317
|
+
reviewed: string[];
|
|
318
|
+
}, {
|
|
319
|
+
super?: string | undefined;
|
|
320
|
+
members?: string[] | undefined;
|
|
321
|
+
reviewed?: string[] | undefined;
|
|
322
|
+
}>>;
|
|
323
|
+
}, "strip", z.ZodTypeAny, {
|
|
324
|
+
activePolicy: string;
|
|
325
|
+
gates: {
|
|
326
|
+
plan: {
|
|
327
|
+
inSpec: boolean;
|
|
328
|
+
ambiguity: boolean;
|
|
329
|
+
openQuestions: boolean;
|
|
330
|
+
oneWayDoors: boolean;
|
|
331
|
+
};
|
|
332
|
+
retrieval: {
|
|
333
|
+
rerank: boolean;
|
|
334
|
+
topK: number;
|
|
335
|
+
};
|
|
336
|
+
check: {
|
|
337
|
+
deterministic: boolean;
|
|
338
|
+
battery: boolean;
|
|
339
|
+
selfReport: boolean;
|
|
340
|
+
testQuality: boolean;
|
|
341
|
+
docDrift: boolean;
|
|
342
|
+
injectionDefense: boolean;
|
|
343
|
+
};
|
|
344
|
+
security: {
|
|
345
|
+
trustBoundary: boolean;
|
|
346
|
+
severity: boolean;
|
|
347
|
+
alwaysHuman: string[];
|
|
348
|
+
};
|
|
349
|
+
loop: {
|
|
350
|
+
retryProgress: boolean;
|
|
351
|
+
errorSalience: boolean;
|
|
352
|
+
maxCycles: number;
|
|
353
|
+
};
|
|
354
|
+
session: {
|
|
355
|
+
endAudit: boolean;
|
|
356
|
+
nudge: boolean;
|
|
357
|
+
maxNudges: number;
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
model: string;
|
|
361
|
+
egress: {
|
|
362
|
+
semantic: boolean;
|
|
363
|
+
warnOncePerSession: boolean;
|
|
364
|
+
};
|
|
365
|
+
corpus: {
|
|
366
|
+
spec: string;
|
|
367
|
+
rules: string;
|
|
368
|
+
divergences: string;
|
|
369
|
+
questions: string;
|
|
370
|
+
plan: string;
|
|
371
|
+
docs: string[];
|
|
372
|
+
whitepaper: string;
|
|
373
|
+
};
|
|
374
|
+
policies: Record<string, {
|
|
375
|
+
actionThreshold: number;
|
|
376
|
+
reviewThreshold: number;
|
|
377
|
+
}>;
|
|
378
|
+
cache: {
|
|
379
|
+
dir: string;
|
|
380
|
+
};
|
|
381
|
+
ledger: {
|
|
382
|
+
path: string;
|
|
383
|
+
};
|
|
384
|
+
repos: {
|
|
385
|
+
super: string;
|
|
386
|
+
members: string[];
|
|
387
|
+
reviewed: string[];
|
|
388
|
+
};
|
|
389
|
+
}, {
|
|
390
|
+
activePolicy?: string | undefined;
|
|
391
|
+
gates?: {
|
|
392
|
+
plan?: {
|
|
393
|
+
inSpec?: boolean | undefined;
|
|
394
|
+
ambiguity?: boolean | undefined;
|
|
395
|
+
openQuestions?: boolean | undefined;
|
|
396
|
+
oneWayDoors?: boolean | undefined;
|
|
397
|
+
} | undefined;
|
|
398
|
+
retrieval?: {
|
|
399
|
+
rerank?: boolean | undefined;
|
|
400
|
+
topK?: number | undefined;
|
|
401
|
+
} | undefined;
|
|
402
|
+
check?: {
|
|
403
|
+
deterministic?: boolean | undefined;
|
|
404
|
+
battery?: boolean | undefined;
|
|
405
|
+
selfReport?: boolean | undefined;
|
|
406
|
+
testQuality?: boolean | undefined;
|
|
407
|
+
docDrift?: boolean | undefined;
|
|
408
|
+
injectionDefense?: boolean | undefined;
|
|
409
|
+
} | undefined;
|
|
410
|
+
security?: {
|
|
411
|
+
trustBoundary?: boolean | undefined;
|
|
412
|
+
severity?: boolean | undefined;
|
|
413
|
+
alwaysHuman?: string[] | undefined;
|
|
414
|
+
} | undefined;
|
|
415
|
+
loop?: {
|
|
416
|
+
retryProgress?: boolean | undefined;
|
|
417
|
+
errorSalience?: boolean | undefined;
|
|
418
|
+
maxCycles?: number | undefined;
|
|
419
|
+
} | undefined;
|
|
420
|
+
session?: {
|
|
421
|
+
endAudit?: boolean | undefined;
|
|
422
|
+
nudge?: boolean | undefined;
|
|
423
|
+
maxNudges?: number | undefined;
|
|
424
|
+
} | undefined;
|
|
425
|
+
} | undefined;
|
|
426
|
+
model?: string | undefined;
|
|
427
|
+
egress?: {
|
|
428
|
+
semantic?: boolean | undefined;
|
|
429
|
+
warnOncePerSession?: boolean | undefined;
|
|
430
|
+
} | undefined;
|
|
431
|
+
corpus?: {
|
|
432
|
+
spec?: string | undefined;
|
|
433
|
+
rules?: string | undefined;
|
|
434
|
+
divergences?: string | undefined;
|
|
435
|
+
questions?: string | undefined;
|
|
436
|
+
plan?: string | undefined;
|
|
437
|
+
docs?: string[] | undefined;
|
|
438
|
+
whitepaper?: string | undefined;
|
|
439
|
+
} | undefined;
|
|
440
|
+
policies?: Record<string, {
|
|
441
|
+
actionThreshold?: number | undefined;
|
|
442
|
+
reviewThreshold?: number | undefined;
|
|
443
|
+
}> | undefined;
|
|
444
|
+
cache?: {
|
|
445
|
+
dir?: string | undefined;
|
|
446
|
+
} | undefined;
|
|
447
|
+
ledger?: {
|
|
448
|
+
path?: string | undefined;
|
|
449
|
+
} | undefined;
|
|
450
|
+
repos?: {
|
|
451
|
+
super?: string | undefined;
|
|
452
|
+
members?: string[] | undefined;
|
|
453
|
+
reviewed?: string[] | undefined;
|
|
454
|
+
} | undefined;
|
|
455
|
+
}>;
|
|
456
|
+
type Config = z.infer<typeof ConfigSchema>;
|
|
457
|
+
type GatePath = string;
|
|
458
|
+
interface LoadedConfig {
|
|
459
|
+
config: Config;
|
|
460
|
+
root: string;
|
|
461
|
+
source: "explicit" | "discovered" | "user" | "defaults";
|
|
462
|
+
path: string | null;
|
|
463
|
+
overrides: RuntimeOverrides | null;
|
|
464
|
+
}
|
|
465
|
+
declare function expandPath(p: string, root: string): string;
|
|
466
|
+
declare function findConfigFile(startDir: string): {
|
|
467
|
+
path: string;
|
|
468
|
+
source: "discovered" | "user";
|
|
469
|
+
} | null;
|
|
470
|
+
declare function flattenGates(config: Config): Map<GatePath, boolean>;
|
|
471
|
+
declare function applyGateFlag(config: Config, name: string, value: boolean): string[];
|
|
472
|
+
declare function applyEnvOverrides(config: Config, env?: Record<string, string | undefined>): Config;
|
|
473
|
+
declare function loadConfig(startDir: string, env?: Record<string, string | undefined>): LoadedConfig;
|
|
474
|
+
declare function activeThresholds(config: Config): {
|
|
475
|
+
actionThreshold: number;
|
|
476
|
+
reviewThreshold: number;
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
declare function stripJsonc(text: string): string;
|
|
480
|
+
declare function parseJsonc(text: string): unknown;
|
|
481
|
+
|
|
482
|
+
declare function sha256Hex(text: string): string;
|
|
483
|
+
declare function shortHash(text: string): string;
|
|
484
|
+
|
|
485
|
+
interface MdSection {
|
|
486
|
+
level: number;
|
|
487
|
+
title: string;
|
|
488
|
+
text: string;
|
|
489
|
+
line: number;
|
|
490
|
+
}
|
|
491
|
+
declare function splitMarkdown(md: string): MdSection[];
|
|
492
|
+
declare function slug(title: string): string;
|
|
493
|
+
|
|
494
|
+
declare function parseSpec(md: string, source: string): CorpusSection[];
|
|
495
|
+
declare function parseRules(md: string, source: string): CorpusSection[];
|
|
496
|
+
declare function parseDivergences(md: string, source: string): CorpusSection[];
|
|
497
|
+
declare function parseQuestions(md: string, source: string): CorpusSection[];
|
|
498
|
+
declare function parsePlan(md: string, source: string): CorpusSection[];
|
|
499
|
+
declare function parseDoc(md: string, source: string, label: string): CorpusSection[];
|
|
500
|
+
declare function parsePaper(text: string, source: string): CorpusSection[];
|
|
501
|
+
|
|
502
|
+
declare function ensurePaperText(config: Config, root: string): {
|
|
503
|
+
text: string | null;
|
|
504
|
+
extracted: boolean;
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
declare function loadCorpus(config: Config, root: string): Corpus;
|
|
508
|
+
declare function loadCorpusFrom(startDir: string): {
|
|
509
|
+
loaded: LoadedConfig;
|
|
510
|
+
corpus: Corpus;
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
type JevValue = {
|
|
514
|
+
kind: "noul";
|
|
515
|
+
noul: number;
|
|
516
|
+
} | {
|
|
517
|
+
kind: "choice";
|
|
518
|
+
choice: string;
|
|
519
|
+
confidence: number;
|
|
520
|
+
probabilities: Record<string, number>;
|
|
521
|
+
} | {
|
|
522
|
+
kind: "score";
|
|
523
|
+
score: number;
|
|
524
|
+
confidence: number;
|
|
525
|
+
probabilities: Record<string, number>;
|
|
526
|
+
};
|
|
527
|
+
interface JevResult {
|
|
528
|
+
model: string;
|
|
529
|
+
usage: {
|
|
530
|
+
inputTokens: number;
|
|
531
|
+
outputTokens: number;
|
|
532
|
+
};
|
|
533
|
+
answers: Record<string, JevValue>;
|
|
534
|
+
cached?: boolean;
|
|
535
|
+
}
|
|
536
|
+
interface JevUnavailable {
|
|
537
|
+
ok: false;
|
|
538
|
+
reason: "egress-off" | "no-key";
|
|
539
|
+
}
|
|
540
|
+
declare class Jev {
|
|
541
|
+
private client;
|
|
542
|
+
readonly model: string;
|
|
543
|
+
private readonly semantic;
|
|
544
|
+
private readonly warnOnce;
|
|
545
|
+
private readonly keyPresent;
|
|
546
|
+
private readonly cache;
|
|
547
|
+
constructor(config: Config, opts?: {
|
|
548
|
+
cacheDir?: string;
|
|
549
|
+
cacheEnabled?: boolean;
|
|
550
|
+
});
|
|
551
|
+
unavailable(): JevUnavailable | null;
|
|
552
|
+
private ensure;
|
|
553
|
+
ask(state: unknown, questions: Record<string, unknown>, opts?: {
|
|
554
|
+
signal?: AbortSignal;
|
|
555
|
+
timeoutMs?: number;
|
|
556
|
+
}): Promise<JevResult>;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
interface PlanInput {
|
|
560
|
+
task: string;
|
|
561
|
+
plan?: string;
|
|
562
|
+
}
|
|
563
|
+
interface PlanVerdict {
|
|
564
|
+
question: string;
|
|
565
|
+
label: string;
|
|
566
|
+
noul: number;
|
|
567
|
+
interpretation: "definite" | "possible" | "clear" | "unlikely";
|
|
568
|
+
subject?: string;
|
|
569
|
+
}
|
|
570
|
+
type PlanAction = "pass" | "clarify" | "human";
|
|
571
|
+
interface PlanReport {
|
|
572
|
+
action: PlanAction;
|
|
573
|
+
degraded: boolean;
|
|
574
|
+
degradedReason?: string;
|
|
575
|
+
contextPack: {
|
|
576
|
+
sections: CorpusSection[];
|
|
577
|
+
rulings: CorpusSection[];
|
|
578
|
+
openItems: CorpusSection[];
|
|
579
|
+
doors: CorpusSection[];
|
|
580
|
+
};
|
|
581
|
+
verdicts: PlanVerdict[];
|
|
582
|
+
reasons: string[];
|
|
583
|
+
usage?: {
|
|
584
|
+
inputTokens: number;
|
|
585
|
+
outputTokens: number;
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
declare function runPlanGate(config: Config, jev: Jev, corpus: Corpus, input: PlanInput, opts?: {
|
|
589
|
+
signal?: AbortSignal;
|
|
590
|
+
}): Promise<PlanReport>;
|
|
591
|
+
|
|
592
|
+
interface CargoStep {
|
|
593
|
+
label: string;
|
|
594
|
+
ok: boolean;
|
|
595
|
+
summary: string;
|
|
596
|
+
errors: string[];
|
|
597
|
+
output: string;
|
|
598
|
+
}
|
|
599
|
+
interface Diagnostic {
|
|
600
|
+
file: string;
|
|
601
|
+
line: number | null;
|
|
602
|
+
col: number | null;
|
|
603
|
+
severity: string;
|
|
604
|
+
message: string;
|
|
605
|
+
code: string | null;
|
|
606
|
+
isRootCauseCandidate: boolean;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
interface DeterministicReport {
|
|
610
|
+
repoDiffs: RepoDiff[];
|
|
611
|
+
findings: Finding[];
|
|
612
|
+
cargo: {
|
|
613
|
+
repo: string;
|
|
614
|
+
steps: CargoStep[];
|
|
615
|
+
}[];
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
interface CheckInput {
|
|
619
|
+
diffs: RepoDiff[];
|
|
620
|
+
task?: string;
|
|
621
|
+
claims?: string[];
|
|
622
|
+
agentSummary?: string;
|
|
623
|
+
toolOutput?: string;
|
|
624
|
+
previousReasons?: string[];
|
|
625
|
+
}
|
|
626
|
+
interface SemanticVerdict {
|
|
627
|
+
question: string;
|
|
628
|
+
label: string;
|
|
629
|
+
value: number;
|
|
630
|
+
confidence?: number;
|
|
631
|
+
subject?: string;
|
|
632
|
+
}
|
|
633
|
+
interface SemanticReport {
|
|
634
|
+
findings: Finding[];
|
|
635
|
+
verdicts: SemanticVerdict[];
|
|
636
|
+
sections: CorpusSection[];
|
|
637
|
+
usage: {
|
|
638
|
+
inputTokens: number;
|
|
639
|
+
outputTokens: number;
|
|
640
|
+
};
|
|
641
|
+
examinedFiles: number;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
interface RootCauseResult {
|
|
645
|
+
root: Diagnostic | null;
|
|
646
|
+
cascade: Diagnostic[];
|
|
647
|
+
usedJev: boolean;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
interface CheckOptions extends Omit<CheckInput, "diffs"> {
|
|
651
|
+
cargo?: boolean;
|
|
652
|
+
tests?: boolean;
|
|
653
|
+
diffs?: RepoDiff[];
|
|
654
|
+
sessionID?: string;
|
|
655
|
+
}
|
|
656
|
+
type CheckAction = "pass" | "fix" | "human" | "degraded";
|
|
657
|
+
interface CheckReport {
|
|
658
|
+
action: CheckAction;
|
|
659
|
+
degraded: boolean;
|
|
660
|
+
degradedReason?: string;
|
|
661
|
+
deterministic: DeterministicReport;
|
|
662
|
+
semantic: SemanticReport | null;
|
|
663
|
+
rootCause: RootCauseResult | null;
|
|
664
|
+
diagnostics: Diagnostic[];
|
|
665
|
+
loop: {
|
|
666
|
+
cycle: number;
|
|
667
|
+
escalated: boolean;
|
|
668
|
+
reason?: string;
|
|
669
|
+
};
|
|
670
|
+
reasons: string[];
|
|
671
|
+
exitCode: number;
|
|
672
|
+
corpusHash: string;
|
|
673
|
+
sessionID?: string;
|
|
674
|
+
diffHash?: string;
|
|
675
|
+
files: {
|
|
676
|
+
repo: string;
|
|
677
|
+
path: string;
|
|
678
|
+
added: number;
|
|
679
|
+
removed: number;
|
|
680
|
+
}[];
|
|
681
|
+
examinedFiles: number | null;
|
|
682
|
+
overridesActive: boolean;
|
|
683
|
+
acknowledged: number;
|
|
684
|
+
}
|
|
685
|
+
declare function runCheck(config: Config, root: string, corpus: Corpus, jev: Jev, opts: CheckOptions): Promise<CheckReport>;
|
|
686
|
+
declare function formatReport(report: CheckReport): string;
|
|
687
|
+
|
|
688
|
+
declare function checkRepoDiff(diff: RepoDiff, config: Config): Finding[];
|
|
689
|
+
declare function checkCommitMessage(message: string, repo: string): Finding[];
|
|
690
|
+
|
|
691
|
+
declare function sectionById(corpus: Corpus, id: string): CorpusSection | undefined;
|
|
692
|
+
declare function sectionsOfKind(corpus: Corpus, kind: CorpusSection["kind"]): CorpusSection[];
|
|
693
|
+
declare function effectiveTruth(corpus: Corpus): CorpusSection[];
|
|
694
|
+
declare function paperSectionForSpec(corpus: Corpus, spec: CorpusSection): CorpusSection | undefined;
|
|
695
|
+
declare function authoritativeFor(conflicting: CorpusSection, corpus: Corpus): CorpusSection | null;
|
|
696
|
+
|
|
697
|
+
export { type Config, ConfigSchema, type Corpus, type CorpusSection, type CorpusSource, type DiffFile, type DiffHunk, type DiffLine, type EntryStatus, type Finding, type GatePath, type LoadedConfig, PRECEDENCE, type RepoDiff, type Severity, type SourceKind, activeThresholds, applyEnvOverrides, applyGateFlag, authoritativeFor, checkCommitMessage, checkRepoDiff, effectiveTruth, ensurePaperText, expandPath, findConfigFile, flattenGates, formatReport, loadConfig, loadCorpus, loadCorpusFrom, paperSectionForSpec, parseDivergences, parseDoc, parseJsonc, parsePaper, parsePlan, parseQuestions, parseRules, parseSpec, runCheck, runPlanGate, sectionById, sectionsOfKind, sha256Hex, shortHash, slug, splitMarkdown, stripJsonc };
|