@ai-dossier/core 1.2.0 → 1.3.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/dist/coherence/checks.d.ts +13 -0
- package/dist/coherence/checks.d.ts.map +1 -0
- package/dist/coherence/checks.js +239 -0
- package/dist/coherence/checks.js.map +1 -0
- package/dist/coherence/index.d.ts +47 -0
- package/dist/coherence/index.d.ts.map +1 -0
- package/dist/coherence/index.js +89 -0
- package/dist/coherence/index.js.map +1 -0
- package/dist/coherence/types.d.ts +70 -0
- package/dist/coherence/types.d.ts.map +1 -0
- package/dist/coherence/types.js +11 -0
- package/dist/coherence/types.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/security-scanner/code-block-context.d.ts +24 -0
- package/dist/security-scanner/code-block-context.d.ts.map +1 -0
- package/dist/security-scanner/code-block-context.js +68 -0
- package/dist/security-scanner/code-block-context.js.map +1 -0
- package/dist/security-scanner/index.d.ts +21 -0
- package/dist/security-scanner/index.d.ts.map +1 -0
- package/dist/security-scanner/index.js +92 -0
- package/dist/security-scanner/index.js.map +1 -0
- package/dist/security-scanner/match-utils.d.ts +21 -0
- package/dist/security-scanner/match-utils.d.ts.map +1 -0
- package/dist/security-scanner/match-utils.js +40 -0
- package/dist/security-scanner/match-utils.js.map +1 -0
- package/dist/security-scanner/registry.d.ts +11 -0
- package/dist/security-scanner/registry.d.ts.map +1 -0
- package/dist/security-scanner/registry.js +79 -0
- package/dist/security-scanner/registry.js.map +1 -0
- package/dist/security-scanner/rules/agent-hijacking.d.ts +3 -0
- package/dist/security-scanner/rules/agent-hijacking.d.ts.map +1 -0
- package/dist/security-scanner/rules/agent-hijacking.js +56 -0
- package/dist/security-scanner/rules/agent-hijacking.js.map +1 -0
- package/dist/security-scanner/rules/dangerous-execution.d.ts +3 -0
- package/dist/security-scanner/rules/dangerous-execution.d.ts.map +1 -0
- package/dist/security-scanner/rules/dangerous-execution.js +86 -0
- package/dist/security-scanner/rules/dangerous-execution.js.map +1 -0
- package/dist/security-scanner/rules/data-exfiltration.d.ts +3 -0
- package/dist/security-scanner/rules/data-exfiltration.d.ts.map +1 -0
- package/dist/security-scanner/rules/data-exfiltration.js +61 -0
- package/dist/security-scanner/rules/data-exfiltration.js.map +1 -0
- package/dist/security-scanner/rules/index.d.ts +12 -0
- package/dist/security-scanner/rules/index.d.ts.map +1 -0
- package/dist/security-scanner/rules/index.js +30 -0
- package/dist/security-scanner/rules/index.js.map +1 -0
- package/dist/security-scanner/rules/prompt-injection.d.ts +3 -0
- package/dist/security-scanner/rules/prompt-injection.d.ts.map +1 -0
- package/dist/security-scanner/rules/prompt-injection.js +56 -0
- package/dist/security-scanner/rules/prompt-injection.js.map +1 -0
- package/dist/security-scanner/rules/supply-chain.d.ts +3 -0
- package/dist/security-scanner/rules/supply-chain.d.ts.map +1 -0
- package/dist/security-scanner/rules/supply-chain.js +61 -0
- package/dist/security-scanner/rules/supply-chain.js.map +1 -0
- package/dist/security-scanner/rules/unicode-attacks.d.ts +3 -0
- package/dist/security-scanner/rules/unicode-attacks.d.ts.map +1 -0
- package/dist/security-scanner/rules/unicode-attacks.js +83 -0
- package/dist/security-scanner/rules/unicode-attacks.js.map +1 -0
- package/dist/security-scanner/rules/url-threats.d.ts +3 -0
- package/dist/security-scanner/rules/url-threats.d.ts.map +1 -0
- package/dist/security-scanner/rules/url-threats.js +82 -0
- package/dist/security-scanner/rules/url-threats.js.map +1 -0
- package/dist/security-scanner/rules/xss-html-injection.d.ts +3 -0
- package/dist/security-scanner/rules/xss-html-injection.d.ts.map +1 -0
- package/dist/security-scanner/rules/xss-html-injection.js +82 -0
- package/dist/security-scanner/rules/xss-html-injection.js.map +1 -0
- package/dist/security-scanner/types.d.ts +45 -0
- package/dist/security-scanner/types.d.ts.map +1 -0
- package/dist/security-scanner/types.js +3 -0
- package/dist/security-scanner/types.js.map +1 -0
- package/dist/trace-recorder.d.ts +45 -0
- package/dist/trace-recorder.d.ts.map +1 -0
- package/dist/trace-recorder.js +43 -0
- package/dist/trace-recorder.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Individual coherence checks for dossier execution outputs.
|
|
3
|
+
*
|
|
4
|
+
* Each check is a pure function: (context) => diagnostics[].
|
|
5
|
+
* Checks are lightweight and fast -- they catch messy failures,
|
|
6
|
+
* not enforce strict contracts.
|
|
7
|
+
*/
|
|
8
|
+
import type { CoherenceContext, CoherenceDiagnostic } from './types';
|
|
9
|
+
export declare function checkSchemaCompliance(context: CoherenceContext): CoherenceDiagnostic[];
|
|
10
|
+
export declare function checkAnomalies(context: CoherenceContext): CoherenceDiagnostic[];
|
|
11
|
+
export declare function checkCrossStepCoherence(context: CoherenceContext): CoherenceDiagnostic[];
|
|
12
|
+
export declare function checkInternalConsistency(context: CoherenceContext): CoherenceDiagnostic[];
|
|
13
|
+
//# sourceMappingURL=checks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../src/coherence/checks.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAMrE,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,EAAE,CA+CtF;AASD,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,EAAE,CAmE/E;AAoBD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,EAAE,CAsCxF;AAMD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,gBAAgB,GAAG,mBAAmB,EAAE,CAwDzF"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Individual coherence checks for dossier execution outputs.
|
|
4
|
+
*
|
|
5
|
+
* Each check is a pure function: (context) => diagnostics[].
|
|
6
|
+
* Checks are lightweight and fast -- they catch messy failures,
|
|
7
|
+
* not enforce strict contracts.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.checkSchemaCompliance = checkSchemaCompliance;
|
|
11
|
+
exports.checkAnomalies = checkAnomalies;
|
|
12
|
+
exports.checkCrossStepCoherence = checkCrossStepCoherence;
|
|
13
|
+
exports.checkInternalConsistency = checkInternalConsistency;
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// 1. Schema compliance — do outputs match declared output schemas?
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
function checkSchemaCompliance(context) {
|
|
18
|
+
const diagnostics = [];
|
|
19
|
+
if (!context.declaredSchemas)
|
|
20
|
+
return diagnostics;
|
|
21
|
+
for (const step of context.steps) {
|
|
22
|
+
const schema = context.declaredSchemas.get(step.stepName);
|
|
23
|
+
if (!schema)
|
|
24
|
+
continue;
|
|
25
|
+
// Check that declared configuration keys are present in outputs
|
|
26
|
+
if (schema.configuration) {
|
|
27
|
+
for (const declared of schema.configuration) {
|
|
28
|
+
if (!(declared.key in step.outputs)) {
|
|
29
|
+
diagnostics.push({
|
|
30
|
+
checkId: 'schema-compliance',
|
|
31
|
+
severity: 'warning',
|
|
32
|
+
message: `Step "${step.stepName}" declares output "${declared.key}" but it was not reported`,
|
|
33
|
+
stepName: step.stepName,
|
|
34
|
+
field: declared.key,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// Check for undeclared outputs (outputs not in any declared category)
|
|
40
|
+
const declaredKeys = new Set();
|
|
41
|
+
if (schema.configuration) {
|
|
42
|
+
for (const c of schema.configuration) {
|
|
43
|
+
declaredKeys.add(c.key);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (declaredKeys.size > 0) {
|
|
47
|
+
for (const key of Object.keys(step.outputs)) {
|
|
48
|
+
if (!declaredKeys.has(key)) {
|
|
49
|
+
diagnostics.push({
|
|
50
|
+
checkId: 'schema-compliance',
|
|
51
|
+
severity: 'info',
|
|
52
|
+
message: `Step "${step.stepName}" reported undeclared output "${key}" — not in outputs.configuration`,
|
|
53
|
+
stepName: step.stepName,
|
|
54
|
+
field: key,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return diagnostics;
|
|
61
|
+
}
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
// 2. Anomaly detection — unexpected empty outputs, size outliers
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
/** Ratio threshold: a step's output count differs from the mean by more than this factor */
|
|
66
|
+
const SIZE_OUTLIER_FACTOR = 3;
|
|
67
|
+
function checkAnomalies(context) {
|
|
68
|
+
const diagnostics = [];
|
|
69
|
+
for (const step of context.steps) {
|
|
70
|
+
// Empty output check
|
|
71
|
+
if (Object.keys(step.outputs).length === 0) {
|
|
72
|
+
diagnostics.push({
|
|
73
|
+
checkId: 'anomaly-empty-output',
|
|
74
|
+
severity: 'warning',
|
|
75
|
+
message: `Step "${step.stepName}" completed with no outputs — expected at least one key`,
|
|
76
|
+
stepName: step.stepName,
|
|
77
|
+
});
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
// Null / undefined value check
|
|
81
|
+
for (const [key, value] of Object.entries(step.outputs)) {
|
|
82
|
+
if (value === null || value === undefined) {
|
|
83
|
+
diagnostics.push({
|
|
84
|
+
checkId: 'anomaly-null-value',
|
|
85
|
+
severity: 'warning',
|
|
86
|
+
message: `Step "${step.stepName}" output "${key}" is ${value === null ? 'null' : 'undefined'}`,
|
|
87
|
+
stepName: step.stepName,
|
|
88
|
+
field: key,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (value === '') {
|
|
92
|
+
diagnostics.push({
|
|
93
|
+
checkId: 'anomaly-empty-value',
|
|
94
|
+
severity: 'info',
|
|
95
|
+
message: `Step "${step.stepName}" output "${key}" is an empty string`,
|
|
96
|
+
stepName: step.stepName,
|
|
97
|
+
field: key,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// Size outlier detection: flag steps whose key count is drastically larger than
|
|
103
|
+
// the median of all other steps. Using median (not mean) prevents a single outlier
|
|
104
|
+
// from skewing the baseline.
|
|
105
|
+
const completedSteps = context.steps.filter((s) => Object.keys(s.outputs).length > 0);
|
|
106
|
+
if (completedSteps.length >= 3) {
|
|
107
|
+
for (const step of completedSteps) {
|
|
108
|
+
const size = Object.keys(step.outputs).length;
|
|
109
|
+
const otherSizes = completedSteps
|
|
110
|
+
.filter((s) => s !== step)
|
|
111
|
+
.map((s) => Object.keys(s.outputs).length)
|
|
112
|
+
.sort((a, b) => a - b);
|
|
113
|
+
const median = otherSizes.length % 2 === 0
|
|
114
|
+
? (otherSizes[otherSizes.length / 2 - 1] + otherSizes[otherSizes.length / 2]) / 2
|
|
115
|
+
: otherSizes[Math.floor(otherSizes.length / 2)];
|
|
116
|
+
if (median > 0 && size / median > SIZE_OUTLIER_FACTOR) {
|
|
117
|
+
diagnostics.push({
|
|
118
|
+
checkId: 'anomaly-size-outlier',
|
|
119
|
+
severity: 'info',
|
|
120
|
+
message: `Step "${step.stepName}" has ${size} output keys — ${(size / median).toFixed(1)}x the median of ${median}`,
|
|
121
|
+
stepName: step.stepName,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return diagnostics;
|
|
127
|
+
}
|
|
128
|
+
// ---------------------------------------------------------------------------
|
|
129
|
+
// 3. Cross-step coherence — does step N's output make sense given step N-1?
|
|
130
|
+
// ---------------------------------------------------------------------------
|
|
131
|
+
/**
|
|
132
|
+
* Extracts "entity-like" string values from an output record.
|
|
133
|
+
* Looks for values that resemble paths, URLs, identifiers, etc.
|
|
134
|
+
*/
|
|
135
|
+
function extractEntityValues(outputs) {
|
|
136
|
+
const entities = new Map();
|
|
137
|
+
for (const [key, value] of Object.entries(outputs)) {
|
|
138
|
+
if (typeof value === 'string' && value.length > 0) {
|
|
139
|
+
entities.set(key, value);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return entities;
|
|
143
|
+
}
|
|
144
|
+
function checkCrossStepCoherence(context) {
|
|
145
|
+
const diagnostics = [];
|
|
146
|
+
if (context.steps.length < 2)
|
|
147
|
+
return diagnostics;
|
|
148
|
+
// Build a map of all outputs from prior steps
|
|
149
|
+
const priorOutputs = new Map();
|
|
150
|
+
for (let i = 0; i < context.steps.length; i++) {
|
|
151
|
+
const step = context.steps[i];
|
|
152
|
+
if (i > 0) {
|
|
153
|
+
// Check if this step references keys from prior steps with different values
|
|
154
|
+
const currentEntities = extractEntityValues(step.outputs);
|
|
155
|
+
for (const [key, currentValue] of currentEntities) {
|
|
156
|
+
const prior = priorOutputs.get(key);
|
|
157
|
+
if (prior && prior.value !== currentValue) {
|
|
158
|
+
diagnostics.push({
|
|
159
|
+
checkId: 'cross-step-value-drift',
|
|
160
|
+
severity: 'warning',
|
|
161
|
+
message: `Output key "${key}" changed from "${truncate(prior.value)}" (step "${prior.fromStep}") ` +
|
|
162
|
+
`to "${truncate(currentValue)}" (step "${step.stepName}") — verify this is intentional`,
|
|
163
|
+
stepName: step.stepName,
|
|
164
|
+
field: key,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// Add this step's outputs to the prior map
|
|
170
|
+
const entities = extractEntityValues(step.outputs);
|
|
171
|
+
for (const [key, value] of entities) {
|
|
172
|
+
priorOutputs.set(key, { value, fromStep: step.stepName });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return diagnostics;
|
|
176
|
+
}
|
|
177
|
+
// ---------------------------------------------------------------------------
|
|
178
|
+
// 4. Internal consistency — within a single step's outputs
|
|
179
|
+
// ---------------------------------------------------------------------------
|
|
180
|
+
function checkInternalConsistency(context) {
|
|
181
|
+
const diagnostics = [];
|
|
182
|
+
for (const step of context.steps) {
|
|
183
|
+
const entries = Object.entries(step.outputs);
|
|
184
|
+
if (entries.length === 0)
|
|
185
|
+
continue;
|
|
186
|
+
// Check for duplicate values under different keys (potential copy-paste / hallucination)
|
|
187
|
+
// Only meaningful when there are at least 2 entries
|
|
188
|
+
if (entries.length >= 2) {
|
|
189
|
+
const valueMap = new Map();
|
|
190
|
+
for (const [key, value] of entries) {
|
|
191
|
+
if (typeof value === 'string' && value.length > 0) {
|
|
192
|
+
const existing = valueMap.get(value) || [];
|
|
193
|
+
existing.push(key);
|
|
194
|
+
valueMap.set(value, existing);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const trivialValues = new Set(['true', 'false', 'yes', 'no', 'ok', 'none', 'null']);
|
|
198
|
+
for (const [value, keys] of valueMap) {
|
|
199
|
+
if (keys.length > 1 && value.length > 3) {
|
|
200
|
+
if (!trivialValues.has(value.toLowerCase())) {
|
|
201
|
+
diagnostics.push({
|
|
202
|
+
checkId: 'internal-duplicate-values',
|
|
203
|
+
severity: 'info',
|
|
204
|
+
message: `Step "${step.stepName}" has identical value "${truncate(value)}" ` +
|
|
205
|
+
`for keys: ${keys.join(', ')} — possible copy-paste error`,
|
|
206
|
+
stepName: step.stepName,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
// Check for boolean-like string inconsistencies (e.g., "true" vs true)
|
|
213
|
+
for (const [key, value] of entries) {
|
|
214
|
+
if (typeof value === 'string') {
|
|
215
|
+
const lower = value.toLowerCase();
|
|
216
|
+
if (lower === 'true' || lower === 'false') {
|
|
217
|
+
diagnostics.push({
|
|
218
|
+
checkId: 'internal-boolean-string',
|
|
219
|
+
severity: 'info',
|
|
220
|
+
message: `Step "${step.stepName}" output "${key}" is "${value}" (string) ` +
|
|
221
|
+
`instead of ${lower === 'true'} (boolean) — may cause type mismatches downstream`,
|
|
222
|
+
stepName: step.stepName,
|
|
223
|
+
field: key,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return diagnostics;
|
|
230
|
+
}
|
|
231
|
+
// ---------------------------------------------------------------------------
|
|
232
|
+
// Helpers
|
|
233
|
+
// ---------------------------------------------------------------------------
|
|
234
|
+
function truncate(value, maxLen = 60) {
|
|
235
|
+
if (value.length <= maxLen)
|
|
236
|
+
return value;
|
|
237
|
+
return `${value.slice(0, maxLen - 3)}...`;
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=checks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.js","sourceRoot":"","sources":["../../src/coherence/checks.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAQH,sDA+CC;AASD,wCAmEC;AAoBD,0DAsCC;AAMD,4DAwDC;AAvPD,8EAA8E;AAC9E,mEAAmE;AACnE,8EAA8E;AAE9E,SAAgB,qBAAqB,CAAC,OAAyB;IAC7D,MAAM,WAAW,GAA0B,EAAE,CAAC;IAC9C,IAAI,CAAC,OAAO,CAAC,eAAe;QAAE,OAAO,WAAW,CAAC;IAEjD,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACjC,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1D,IAAI,CAAC,MAAM;YAAE,SAAS;QAEtB,gEAAgE;QAChE,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;YACzB,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;gBAC5C,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;oBACpC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;QAED,uEAAuE;QACvE,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,OAAO,EAAE,CAAC;YACnC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC9B,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;gBAClC,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;oBAC1C,WAAW,CAAC,IAAI,CAAC;wBACf,OAAO,EAAE,yBAAyB;wBAClC,QAAQ,EAAE,MAAM;wBAChB,OAAO,EACL,SAAS,IAAI,CAAC,QAAQ,aAAa,GAAG,SAAS,KAAK,aAAa;4BACjE,cAAc,KAAK,KAAK,MAAM,mDAAmD;wBACnF,QAAQ,EAAE,IAAI,CAAC,QAAQ;wBACvB,KAAK,EAAE,GAAG;qBACX,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,SAAS,QAAQ,CAAC,KAAa,EAAE,MAAM,GAAG,EAAE;IAC1C,IAAI,KAAK,CAAC,MAAM,IAAI,MAAM;QAAE,OAAO,KAAK,CAAC;IACzC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output coherence validation for dossier execution results.
|
|
3
|
+
*
|
|
4
|
+
* Inspired by Anthropic's ICLR 2026 finding that AI fails incoherently
|
|
5
|
+
* on complex tasks (not systematically). This module provides lightweight
|
|
6
|
+
* sanity checks that catch the messy failures:
|
|
7
|
+
*
|
|
8
|
+
* - Schema compliance: do outputs match declared output schemas?
|
|
9
|
+
* - Anomaly detection: unexpected empty outputs, null values, size outliers
|
|
10
|
+
* - Cross-step coherence: does step N's output make sense given step N-1?
|
|
11
|
+
* - Internal consistency: duplicate values, type mismatches within a step
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* import { validateCoherence } from '@ai-dossier/core';
|
|
15
|
+
*
|
|
16
|
+
* const result = validateCoherence({
|
|
17
|
+
* steps: [
|
|
18
|
+
* { stepName: 'setup', stepIndex: 0, outputs: { path: '/tmp/app' } },
|
|
19
|
+
* { stepName: 'build', stepIndex: 1, outputs: { artifact: '/tmp/app/dist' } },
|
|
20
|
+
* ],
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* if (!result.coherent) {
|
|
24
|
+
* console.warn('Coherence issues found:', result.diagnostics);
|
|
25
|
+
* }
|
|
26
|
+
*/
|
|
27
|
+
import type { CoherenceContext, CoherenceResult } from './types';
|
|
28
|
+
export type { CoherenceContext, CoherenceDiagnostic, CoherenceResult, CoherenceSeverity, DeclaredOutputSchema, StepOutput, } from './types';
|
|
29
|
+
/**
|
|
30
|
+
* Run all coherence checks against a set of step outputs.
|
|
31
|
+
* Returns a result with diagnostics and summary counts.
|
|
32
|
+
*/
|
|
33
|
+
export declare function validateCoherence(context: CoherenceContext): CoherenceResult;
|
|
34
|
+
/**
|
|
35
|
+
* Validate coherence for a single step's outputs (e.g., called after each step_complete).
|
|
36
|
+
* This is a lighter-weight version that only checks the latest step against prior context.
|
|
37
|
+
*/
|
|
38
|
+
export declare function validateStepCoherence(currentStep: {
|
|
39
|
+
stepName: string;
|
|
40
|
+
stepIndex: number;
|
|
41
|
+
outputs: Record<string, unknown>;
|
|
42
|
+
}, priorSteps: Array<{
|
|
43
|
+
stepName: string;
|
|
44
|
+
stepIndex: number;
|
|
45
|
+
outputs: Record<string, unknown>;
|
|
46
|
+
}>, declaredSchema?: Map<string, import('./types').DeclaredOutputSchema>): CoherenceResult;
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/coherence/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAQH,OAAO,KAAK,EAAE,gBAAgB,EAAuB,eAAe,EAAE,MAAM,SAAS,CAAC;AAEtF,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,UAAU,GACX,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe,CAmB5E;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,EACtF,UAAU,EAAE,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC,EAC5F,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,SAAS,EAAE,oBAAoB,CAAC,GACnE,eAAe,CAiCjB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Output coherence validation for dossier execution results.
|
|
4
|
+
*
|
|
5
|
+
* Inspired by Anthropic's ICLR 2026 finding that AI fails incoherently
|
|
6
|
+
* on complex tasks (not systematically). This module provides lightweight
|
|
7
|
+
* sanity checks that catch the messy failures:
|
|
8
|
+
*
|
|
9
|
+
* - Schema compliance: do outputs match declared output schemas?
|
|
10
|
+
* - Anomaly detection: unexpected empty outputs, null values, size outliers
|
|
11
|
+
* - Cross-step coherence: does step N's output make sense given step N-1?
|
|
12
|
+
* - Internal consistency: duplicate values, type mismatches within a step
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* import { validateCoherence } from '@ai-dossier/core';
|
|
16
|
+
*
|
|
17
|
+
* const result = validateCoherence({
|
|
18
|
+
* steps: [
|
|
19
|
+
* { stepName: 'setup', stepIndex: 0, outputs: { path: '/tmp/app' } },
|
|
20
|
+
* { stepName: 'build', stepIndex: 1, outputs: { artifact: '/tmp/app/dist' } },
|
|
21
|
+
* ],
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* if (!result.coherent) {
|
|
25
|
+
* console.warn('Coherence issues found:', result.diagnostics);
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.validateCoherence = validateCoherence;
|
|
30
|
+
exports.validateStepCoherence = validateStepCoherence;
|
|
31
|
+
const checks_1 = require("./checks");
|
|
32
|
+
/**
|
|
33
|
+
* Run all coherence checks against a set of step outputs.
|
|
34
|
+
* Returns a result with diagnostics and summary counts.
|
|
35
|
+
*/
|
|
36
|
+
function validateCoherence(context) {
|
|
37
|
+
const diagnostics = [
|
|
38
|
+
...(0, checks_1.checkSchemaCompliance)(context),
|
|
39
|
+
...(0, checks_1.checkAnomalies)(context),
|
|
40
|
+
...(0, checks_1.checkCrossStepCoherence)(context),
|
|
41
|
+
...(0, checks_1.checkInternalConsistency)(context),
|
|
42
|
+
];
|
|
43
|
+
const errorCount = diagnostics.filter((d) => d.severity === 'error').length;
|
|
44
|
+
const warningCount = diagnostics.filter((d) => d.severity === 'warning').length;
|
|
45
|
+
const infoCount = diagnostics.filter((d) => d.severity === 'info').length;
|
|
46
|
+
return {
|
|
47
|
+
diagnostics,
|
|
48
|
+
errorCount,
|
|
49
|
+
warningCount,
|
|
50
|
+
infoCount,
|
|
51
|
+
coherent: errorCount === 0 && warningCount === 0,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Validate coherence for a single step's outputs (e.g., called after each step_complete).
|
|
56
|
+
* This is a lighter-weight version that only checks the latest step against prior context.
|
|
57
|
+
*/
|
|
58
|
+
function validateStepCoherence(currentStep, priorSteps, declaredSchema) {
|
|
59
|
+
const context = {
|
|
60
|
+
steps: [...priorSteps, currentStep],
|
|
61
|
+
declaredSchemas: declaredSchema,
|
|
62
|
+
};
|
|
63
|
+
// Run all checks but filter to only diagnostics about the current step
|
|
64
|
+
const allDiagnostics = [
|
|
65
|
+
...(0, checks_1.checkSchemaCompliance)({
|
|
66
|
+
steps: [currentStep],
|
|
67
|
+
declaredSchemas: declaredSchema,
|
|
68
|
+
}),
|
|
69
|
+
...(0, checks_1.checkAnomalies)({
|
|
70
|
+
steps: [currentStep],
|
|
71
|
+
declaredSchemas: declaredSchema,
|
|
72
|
+
}),
|
|
73
|
+
...(0, checks_1.checkCrossStepCoherence)(context),
|
|
74
|
+
...(0, checks_1.checkInternalConsistency)({
|
|
75
|
+
steps: [currentStep],
|
|
76
|
+
}),
|
|
77
|
+
];
|
|
78
|
+
const errorCount = allDiagnostics.filter((d) => d.severity === 'error').length;
|
|
79
|
+
const warningCount = allDiagnostics.filter((d) => d.severity === 'warning').length;
|
|
80
|
+
const infoCount = allDiagnostics.filter((d) => d.severity === 'info').length;
|
|
81
|
+
return {
|
|
82
|
+
diagnostics: allDiagnostics,
|
|
83
|
+
errorCount,
|
|
84
|
+
warningCount,
|
|
85
|
+
infoCount,
|
|
86
|
+
coherent: errorCount === 0 && warningCount === 0,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/coherence/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;AAuBH,8CAmBC;AAMD,sDAqCC;AAnFD,qCAKkB;AAYlB;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,OAAyB;IACzD,MAAM,WAAW,GAA0B;QACzC,GAAG,IAAA,8BAAqB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AAK,EAAE,CAAC,WAAW,CAAC;SACrB,CAAC;KACH,CAAC;IAEF,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,MAAM,CAAC;IAC/E,MAAM,YAAY,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC;IACnF,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC;IAE7E,OAAO;QACL,WAAW,EAAE,cAAc;QAC3B,UAAU;QACV,YAAY;QACZ,SAAS;QACT,QAAQ,EAAE,UAAU,KAAK,CAAC,IAAI,YAAY,KAAK,CAAC;KACjD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for output coherence validation.
|
|
3
|
+
*
|
|
4
|
+
* Coherence validation catches the "incoherent failures" described in
|
|
5
|
+
* Anthropic's ICLR 2026 research: AI doesn't fail systematically on
|
|
6
|
+
* complex tasks -- it fails *messily*. These types support lightweight
|
|
7
|
+
* sanity checks on dossier execution outputs.
|
|
8
|
+
*/
|
|
9
|
+
export type CoherenceSeverity = 'error' | 'warning' | 'info';
|
|
10
|
+
export interface CoherenceDiagnostic {
|
|
11
|
+
checkId: string;
|
|
12
|
+
severity: CoherenceSeverity;
|
|
13
|
+
message: string;
|
|
14
|
+
stepName?: string;
|
|
15
|
+
field?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A single step's output record, as reported by the LLM via step_complete.
|
|
19
|
+
* Maps output key -> value.
|
|
20
|
+
*/
|
|
21
|
+
export interface StepOutput {
|
|
22
|
+
stepName: string;
|
|
23
|
+
stepIndex: number;
|
|
24
|
+
outputs: Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Declared output schema from a dossier's frontmatter `outputs` field.
|
|
28
|
+
* Maps step name -> declared output keys and their metadata.
|
|
29
|
+
*/
|
|
30
|
+
export interface DeclaredOutputSchema {
|
|
31
|
+
files?: Array<{
|
|
32
|
+
path: string;
|
|
33
|
+
description: string;
|
|
34
|
+
required?: boolean;
|
|
35
|
+
format?: string;
|
|
36
|
+
}>;
|
|
37
|
+
configuration?: Array<{
|
|
38
|
+
key: string;
|
|
39
|
+
description: string;
|
|
40
|
+
export_as?: string;
|
|
41
|
+
}>;
|
|
42
|
+
state_changes?: Array<{
|
|
43
|
+
description: string;
|
|
44
|
+
affects?: string;
|
|
45
|
+
reversible?: boolean;
|
|
46
|
+
}>;
|
|
47
|
+
artifacts?: Array<{
|
|
48
|
+
path: string;
|
|
49
|
+
purpose: string;
|
|
50
|
+
type?: string;
|
|
51
|
+
}>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Full context for coherence validation across a journey.
|
|
55
|
+
*/
|
|
56
|
+
export interface CoherenceContext {
|
|
57
|
+
/** All step outputs collected so far, in execution order. */
|
|
58
|
+
steps: StepOutput[];
|
|
59
|
+
/** Declared output schemas per step name (from frontmatter). */
|
|
60
|
+
declaredSchemas?: Map<string, DeclaredOutputSchema>;
|
|
61
|
+
}
|
|
62
|
+
export interface CoherenceResult {
|
|
63
|
+
diagnostics: CoherenceDiagnostic[];
|
|
64
|
+
errorCount: number;
|
|
65
|
+
warningCount: number;
|
|
66
|
+
infoCount: number;
|
|
67
|
+
/** true when no errors or warnings were found */
|
|
68
|
+
coherent: boolean;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/coherence/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM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AAC,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,QAAQ,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Types for output coherence validation.
|
|
4
|
+
*
|
|
5
|
+
* Coherence validation catches the "incoherent failures" described in
|
|
6
|
+
* Anthropic's ICLR 2026 research: AI doesn't fail systematically on
|
|
7
|
+
* complex tasks -- it fails *messily*. These types support lightweight
|
|
8
|
+
* sanity checks on dossier execution outputs.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/coherence/types.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,9 +5,12 @@
|
|
|
5
5
|
* - Dossier parsing (frontmatter + body extraction)
|
|
6
6
|
* - Checksum verification (SHA256 integrity checks)
|
|
7
7
|
* - Signature verification (Minisign and AWS KMS)
|
|
8
|
+
* - Output coherence validation
|
|
8
9
|
* - TypeScript type definitions
|
|
9
10
|
*/
|
|
10
11
|
export { calculateChecksum, verifyIntegrity } from './checksum';
|
|
12
|
+
export type { CoherenceContext, CoherenceDiagnostic, CoherenceResult, CoherenceSeverity, DeclaredOutputSchema, StepOutput, } from './coherence';
|
|
13
|
+
export { validateCoherence, validateStepCoherence } from './coherence';
|
|
11
14
|
export type { FormatOptions, FormatResult } from './formatter';
|
|
12
15
|
export { formatDossierContent, formatDossierFile } from './formatter';
|
|
13
16
|
export type { LintConfig, LintDiagnostic, LintResult, LintRule, LintRuleContext, LintSeverity, RuleSeverityOverride, } from './linter';
|
|
@@ -15,8 +18,12 @@ export { defaultRules, LintRuleRegistry, lintDossier, lintDossierFile, loadLintC
|
|
|
15
18
|
export { parseDossierContent, parseDossierFile, RECOMMENDED_FIELDS, REQUIRED_FIELDS, VALID_RISK_LEVELS, VALID_STATUSES, validateFrontmatter, } from './parser';
|
|
16
19
|
export type { ChecksumStatus, ContentRiskResult, SignatureStatus, VerificationRiskLevel, VerificationRiskResult, } from './risk-assessment';
|
|
17
20
|
export { assessContentRisk, assessVerificationRisk } from './risk-assessment';
|
|
21
|
+
export type { SecurityCategory, SecurityFinding, SecurityReport, SecurityRule, SecurityRuleContext, SecurityRuleSeverityOverride, SecurityScanConfig, SecuritySeverity, } from './security-scanner';
|
|
22
|
+
export { buildReport, defaultSecurityRules, SecurityRuleRegistry, scanDossier, scanDossierFile, scanMarkdown, } from './security-scanner';
|
|
18
23
|
export { loadTrustedKeys, verifySignature, verifyWithEd25519, verifyWithKms } from './signature';
|
|
19
24
|
export { Ed25519Signer, Ed25519Verifier, getVerifierRegistry, KmsSigner, KmsVerifier, SignatureResult, Signer, Verifier, VerifierRegistry, VerifyResult, } from './signers';
|
|
25
|
+
export type { StepInput as TraceStepInput, TraceInput, TraceRecorder, TraceRecorderOptions, TraceStatus, TraceUpdate, } from './trace-recorder';
|
|
26
|
+
export { createTraceRecorder, VALID_TRACE_STATUSES } from './trace-recorder';
|
|
20
27
|
export * from './types';
|
|
21
28
|
export { sha256Hash, sha256Hex } from './utils/crypto';
|
|
22
29
|
export { getErrorMessage, getErrorStack } from './utils/errors';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"A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AAa,CAAC;AAEjG,OAAO,EACL,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,SAAS,EACT,WAAW,EACX,eAAe,EACf,MAAM,EACN,QAAQ,EACR,gBAAgB,EAChB,YAAY,GACb,MAAM,WAAW,CAAC;AAEnB,YAAY,EACV,SAAS,IAAI,cAAc,EAC3B,UAAU,EACV,aAAa,EACb,oBAAoB,EACpB,WAAW,EACX,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7E,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* - Dossier parsing (frontmatter + body extraction)
|
|
7
7
|
* - Checksum verification (SHA256 integrity checks)
|
|
8
8
|
* - Signature verification (Minisign and AWS KMS)
|
|
9
|
+
* - Output coherence validation
|
|
9
10
|
* - TypeScript type definitions
|
|
10
11
|
*/
|
|
11
12
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
@@ -23,11 +24,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
23
24
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
24
25
|
};
|
|
25
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.createDefaultVerificationResult = exports.scanBodyForUrls = exports.isUrlCoveredByDeclared = exports.isPlaceholderUrl = exports.findUndeclaredUrls = exports.findStaleReferences = exports.collectDeclaredUrls = exports.readFileIfExists = exports.getErrorStack = exports.getErrorMessage = exports.sha256Hex = exports.sha256Hash = exports.VerifierRegistry = exports.KmsVerifier = exports.KmsSigner = exports.getVerifierRegistry = exports.Ed25519Verifier = exports.Ed25519Signer = exports.verifyWithKms = exports.verifyWithEd25519 = exports.verifySignature = exports.loadTrustedKeys = exports.assessVerificationRisk = exports.assessContentRisk = exports.validateFrontmatter = exports.VALID_STATUSES = exports.VALID_RISK_LEVELS = exports.REQUIRED_FIELDS = exports.RECOMMENDED_FIELDS = exports.parseDossierFile = exports.parseDossierContent = exports.loadLintConfig = exports.lintDossierFile = exports.lintDossier = exports.LintRuleRegistry = exports.defaultRules = exports.formatDossierFile = exports.formatDossierContent = exports.verifyIntegrity = exports.calculateChecksum = void 0;
|
|
27
|
+
exports.createDefaultVerificationResult = exports.scanBodyForUrls = exports.isUrlCoveredByDeclared = exports.isPlaceholderUrl = exports.findUndeclaredUrls = exports.findStaleReferences = exports.collectDeclaredUrls = exports.readFileIfExists = exports.getErrorStack = exports.getErrorMessage = exports.sha256Hex = exports.sha256Hash = exports.VALID_TRACE_STATUSES = exports.createTraceRecorder = exports.VerifierRegistry = exports.KmsVerifier = exports.KmsSigner = exports.getVerifierRegistry = exports.Ed25519Verifier = exports.Ed25519Signer = exports.verifyWithKms = exports.verifyWithEd25519 = exports.verifySignature = exports.loadTrustedKeys = exports.scanMarkdown = exports.scanDossierFile = exports.scanDossier = exports.SecurityRuleRegistry = exports.defaultSecurityRules = exports.buildReport = exports.assessVerificationRisk = exports.assessContentRisk = exports.validateFrontmatter = exports.VALID_STATUSES = exports.VALID_RISK_LEVELS = exports.REQUIRED_FIELDS = exports.RECOMMENDED_FIELDS = exports.parseDossierFile = exports.parseDossierContent = exports.loadLintConfig = exports.lintDossierFile = exports.lintDossier = exports.LintRuleRegistry = exports.defaultRules = exports.formatDossierFile = exports.formatDossierContent = exports.validateStepCoherence = exports.validateCoherence = exports.verifyIntegrity = exports.calculateChecksum = void 0;
|
|
27
28
|
// Checksum exports
|
|
28
29
|
var checksum_1 = require("./checksum");
|
|
29
30
|
Object.defineProperty(exports, "calculateChecksum", { enumerable: true, get: function () { return checksum_1.calculateChecksum; } });
|
|
30
31
|
Object.defineProperty(exports, "verifyIntegrity", { enumerable: true, get: function () { return checksum_1.verifyIntegrity; } });
|
|
32
|
+
var coherence_1 = require("./coherence");
|
|
33
|
+
Object.defineProperty(exports, "validateCoherence", { enumerable: true, get: function () { return coherence_1.validateCoherence; } });
|
|
34
|
+
Object.defineProperty(exports, "validateStepCoherence", { enumerable: true, get: function () { return coherence_1.validateStepCoherence; } });
|
|
31
35
|
// Formatter exports
|
|
32
36
|
var formatter_1 = require("./formatter");
|
|
33
37
|
Object.defineProperty(exports, "formatDossierContent", { enumerable: true, get: function () { return formatter_1.formatDossierContent; } });
|
|
@@ -52,6 +56,13 @@ Object.defineProperty(exports, "validateFrontmatter", { enumerable: true, get: f
|
|
|
52
56
|
var risk_assessment_1 = require("./risk-assessment");
|
|
53
57
|
Object.defineProperty(exports, "assessContentRisk", { enumerable: true, get: function () { return risk_assessment_1.assessContentRisk; } });
|
|
54
58
|
Object.defineProperty(exports, "assessVerificationRisk", { enumerable: true, get: function () { return risk_assessment_1.assessVerificationRisk; } });
|
|
59
|
+
var security_scanner_1 = require("./security-scanner");
|
|
60
|
+
Object.defineProperty(exports, "buildReport", { enumerable: true, get: function () { return security_scanner_1.buildReport; } });
|
|
61
|
+
Object.defineProperty(exports, "defaultSecurityRules", { enumerable: true, get: function () { return security_scanner_1.defaultSecurityRules; } });
|
|
62
|
+
Object.defineProperty(exports, "SecurityRuleRegistry", { enumerable: true, get: function () { return security_scanner_1.SecurityRuleRegistry; } });
|
|
63
|
+
Object.defineProperty(exports, "scanDossier", { enumerable: true, get: function () { return security_scanner_1.scanDossier; } });
|
|
64
|
+
Object.defineProperty(exports, "scanDossierFile", { enumerable: true, get: function () { return security_scanner_1.scanDossierFile; } });
|
|
65
|
+
Object.defineProperty(exports, "scanMarkdown", { enumerable: true, get: function () { return security_scanner_1.scanMarkdown; } });
|
|
55
66
|
// Signature exports
|
|
56
67
|
var signature_1 = require("./signature");
|
|
57
68
|
Object.defineProperty(exports, "loadTrustedKeys", { enumerable: true, get: function () { return signature_1.loadTrustedKeys; } });
|
|
@@ -66,6 +77,9 @@ Object.defineProperty(exports, "getVerifierRegistry", { enumerable: true, get: f
|
|
|
66
77
|
Object.defineProperty(exports, "KmsSigner", { enumerable: true, get: function () { return signers_1.KmsSigner; } });
|
|
67
78
|
Object.defineProperty(exports, "KmsVerifier", { enumerable: true, get: function () { return signers_1.KmsVerifier; } });
|
|
68
79
|
Object.defineProperty(exports, "VerifierRegistry", { enumerable: true, get: function () { return signers_1.VerifierRegistry; } });
|
|
80
|
+
var trace_recorder_1 = require("./trace-recorder");
|
|
81
|
+
Object.defineProperty(exports, "createTraceRecorder", { enumerable: true, get: function () { return trace_recorder_1.createTraceRecorder; } });
|
|
82
|
+
Object.defineProperty(exports, "VALID_TRACE_STATUSES", { enumerable: true, get: function () { return trace_recorder_1.VALID_TRACE_STATUSES; } });
|
|
69
83
|
// Type exports
|
|
70
84
|
__exportStar(require("./types"), exports);
|
|
71
85
|
// Crypto utilities
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;;;;;;;;;;;;AAEH,mBAAmB;AACnB,uCAAgE;AAAvD,6GAAA,iBAAiB,OAAA;AAAE,2GAAA,eAAe,OAAA;AAU3C,yCAAuE;AAA9D,8GAAA,iBAAiB,OAAA;AAAE,kHAAA,qBAAqB,O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AClB,yCAAgE;AAAvD,yGAAA,eAAe,OAAA;AAAE,uGAAA,aAAa,OAAA;AACvC,wBAAwB;AACxB,iCAA8C;AAArC,sGAAA,gBAAgB,OAAA;AACzB,yBAAyB;AACzB,mDAO6B;AAN3B,kHAAA,mBAAmB,OAAA;AACnB,kHAAA,mBAAmB,OAAA;AACnB,iHAAA,kBAAkB,OAAA;AAClB,+GAAA,gBAAgB,OAAA;AAChB,qHAAA,sBAAsB,OAAA;AACtB,8GAAA,eAAe,OAAA;AAEjB,yBAAyB;AACzB,qDAAuE;AAA9D,+HAAA,+BAA+B,OAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for detecting whether content appears inside fenced code blocks.
|
|
3
|
+
*
|
|
4
|
+
* Findings inside code blocks are downgraded in confidence because the content
|
|
5
|
+
* is illustrative/documentary rather than executable instructions.
|
|
6
|
+
*/
|
|
7
|
+
export interface CodeBlockRange {
|
|
8
|
+
startLine: number;
|
|
9
|
+
endLine: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Parse all fenced code block ranges from a markdown body.
|
|
13
|
+
* Supports ``` and ~~~ fences per CommonMark spec.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseCodeBlockRanges(body: string): CodeBlockRange[];
|
|
16
|
+
/**
|
|
17
|
+
* Check whether a given 1-based line number falls inside any fenced code block.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isLineInCodeBlock(line: number, ranges: CodeBlockRange[]): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Get the 1-based line number for a character offset in a string.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getLineNumber(text: string, offset: number): number;
|
|
24
|
+
//# sourceMappingURL=code-block-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-block-context.d.ts","sourceRoot":"","sources":["../../src/security-scanner/code-block-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,EAAE,CAsCnE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAEjF;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAQlE"}
|