@aeptus/aexeo-emdash 0.8.18 → 0.9.0
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 +196 -4
- package/INSTALL.md +126 -8
- package/LICENSE +0 -0
- package/README.md +12 -5
- package/dist/adapter.d.ts +30 -2
- package/dist/adapter.d.ts.map +1 -1
- package/dist/admin/Absorbability.d.ts +0 -0
- package/dist/admin/Absorbability.d.ts.map +0 -0
- package/dist/admin/Accessibility.d.ts +0 -0
- package/dist/admin/Accessibility.d.ts.map +0 -0
- package/dist/admin/Citability.d.ts +0 -0
- package/dist/admin/Citability.d.ts.map +0 -0
- package/dist/admin/EntityLegitimacy.d.ts +0 -0
- package/dist/admin/EntityLegitimacy.d.ts.map +0 -0
- package/dist/admin/EntityPresence.d.ts +0 -0
- package/dist/admin/EntityPresence.d.ts.map +0 -0
- package/dist/admin/Facts.d.ts +0 -0
- package/dist/admin/Facts.d.ts.map +0 -0
- package/dist/admin/Findings.d.ts +0 -0
- package/dist/admin/Findings.d.ts.map +0 -0
- package/dist/admin/PillarView.d.ts +0 -0
- package/dist/admin/PillarView.d.ts.map +0 -0
- package/dist/admin/Retrievability.d.ts +0 -0
- package/dist/admin/Retrievability.d.ts.map +0 -0
- package/dist/admin.d.ts +0 -0
- package/dist/admin.d.ts.map +1 -1
- package/dist/admin.js +2 -2
- package/dist/configured.d.ts +6 -0
- package/dist/configured.d.ts.map +1 -1
- package/dist/configured.js +817 -334
- package/dist/content-evaluator.d.ts +14 -0
- package/dist/content-evaluator.d.ts.map +1 -0
- package/dist/content.d.ts +51 -0
- package/dist/content.d.ts.map +1 -0
- package/dist/content.js +365 -0
- package/dist/data-route.d.ts +3 -0
- package/dist/data-route.d.ts.map +1 -1
- package/dist/evaluator-sandbox.d.ts +1 -1
- package/dist/evaluator-sandbox.d.ts.map +1 -1
- package/dist/evaluator.d.ts +1 -1
- package/dist/evaluator.d.ts.map +1 -1
- package/dist/facts-route.d.ts +0 -0
- package/dist/facts-route.d.ts.map +0 -0
- package/dist/findings-view.d.ts +141 -0
- package/dist/findings-view.d.ts.map +1 -0
- package/dist/index.d.ts +15 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +111 -5
- package/dist/inventory.d.ts +51 -0
- package/dist/inventory.d.ts.map +1 -0
- package/dist/plugin.d.ts +51 -4
- package/dist/plugin.d.ts.map +1 -1
- package/dist/presence-check.d.ts +1 -0
- package/dist/presence-check.d.ts.map +1 -1
- package/dist/presence-route.d.ts +0 -0
- package/dist/presence-route.d.ts.map +0 -0
- package/dist/sandbox-entry.d.ts +4 -23
- package/dist/sandbox-entry.d.ts.map +1 -1
- package/dist/sandbox-entry.js +738 -396
- package/dist/sandbox.d.ts +2 -0
- package/dist/sandbox.d.ts.map +1 -1
- package/dist/sidecar-url.d.ts +18 -0
- package/dist/sidecar-url.d.ts.map +1 -0
- package/dist/sidecar.d.ts +7 -1
- package/dist/sidecar.d.ts.map +1 -1
- package/dist/suppressions.d.ts +0 -0
- package/dist/suppressions.d.ts.map +0 -0
- package/dist/types.d.ts +11 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/wasm-init.d.ts +4 -0
- package/dist/wasm-init.d.ts.map +1 -1
- package/package.json +21 -8
- package/wasm/aexeo_emdash_bridge.d.ts +11 -0
- package/wasm/aexeo_emdash_bridge.js +1 -1
- package/wasm/aexeo_emdash_bridge_bg.d.ts +11 -0
- package/wasm/aexeo_emdash_bridge_bg.js +68 -0
- package/wasm/aexeo_emdash_bridge_bg.wasm +0 -0
- package/wasm/aexeo_emdash_bridge_bg.wasm.d.ts +2 -0
- package/dist/indexnow.d.ts +0 -15
- package/dist/indexnow.d.ts.map +0 -1
- package/dist/mcp.d.ts +0 -28
- package/dist/mcp.d.ts.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ContentReport } from "./content.js";
|
|
2
|
+
import type { EvaluatorFn } from "./plugin.js";
|
|
3
|
+
import type { EmdashDocument } from "./types.js";
|
|
4
|
+
export interface ContentPresetOptions {
|
|
5
|
+
name: string;
|
|
6
|
+
sources?: Record<string, string>;
|
|
7
|
+
evidenceSources?: Record<string, string>;
|
|
8
|
+
byCollection?: Record<string, string>;
|
|
9
|
+
/** Restrict preset evaluation to these collections; site checks still run for all. */
|
|
10
|
+
collections?: readonly string[];
|
|
11
|
+
}
|
|
12
|
+
/** Add portable content findings to an existing evaluator without hiding skipped gates. */
|
|
13
|
+
export declare function withContentPreset(base: EvaluatorFn, preset: ContentPresetOptions | undefined, evaluate: (document: EmdashDocument, name: string, sources?: Record<string, string>, evidenceSources?: Record<string, string>) => Promise<ContentReport>): EvaluatorFn;
|
|
14
|
+
//# sourceMappingURL=content-evaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-evaluator.d.ts","sourceRoot":"","sources":["../src/content-evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,sFAAsF;IACtF,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACjC;AAED,2FAA2F;AAC3F,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,oBAAoB,GAAG,SAAS,EACxC,QAAQ,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,OAAO,CAAC,aAAa,CAAC,GACvJ,WAAW,CAgCb"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { EmdashDocument, Finding } from "./types.js";
|
|
2
|
+
export interface ContentGateResult {
|
|
3
|
+
gate_id: string;
|
|
4
|
+
status: "passed" | "failed" | "not_checked";
|
|
5
|
+
blocking: boolean;
|
|
6
|
+
scope: "document" | "collection" | "site";
|
|
7
|
+
required_capability: "text" | "source_text" | "metadata" | "headings" | "paragraphs" | "links" | "link_destinations" | "collection_metadata" | "site" | "extension" | "text_and_evidence";
|
|
8
|
+
findings: Finding[];
|
|
9
|
+
reason: string | null;
|
|
10
|
+
measurements?: Record<string, number>;
|
|
11
|
+
}
|
|
12
|
+
/** Coordinates inside the exact Portable Text snapshot sent for evaluation. */
|
|
13
|
+
export interface EmdashSourceLocation {
|
|
14
|
+
gate_id: string;
|
|
15
|
+
finding_index: number;
|
|
16
|
+
block_index: number;
|
|
17
|
+
span_index: number;
|
|
18
|
+
/** Zero-based UTF-16 code unit offset in the span text. */
|
|
19
|
+
utf16_offset: number;
|
|
20
|
+
}
|
|
21
|
+
export interface ContentReport {
|
|
22
|
+
preset: string;
|
|
23
|
+
input_id: string;
|
|
24
|
+
gates: ContentGateResult[];
|
|
25
|
+
summary?: {
|
|
26
|
+
passed: number;
|
|
27
|
+
failed: number;
|
|
28
|
+
not_checked: number;
|
|
29
|
+
blocking_failed: number;
|
|
30
|
+
blocking_not_checked: number;
|
|
31
|
+
};
|
|
32
|
+
applied_fixes: string[];
|
|
33
|
+
/** Omitted for collection reports; link findings point to the first marked span. */
|
|
34
|
+
source_locations?: EmdashSourceLocation[];
|
|
35
|
+
}
|
|
36
|
+
/** Local, opt-in aggregate metrics; contains no document text or identifiers. */
|
|
37
|
+
export interface ContentEvaluationTelemetry {
|
|
38
|
+
/** End-to-end wrapper duration, including serialization and WASM initialization. */
|
|
39
|
+
evaluation_ms: number;
|
|
40
|
+
source_locations_mapped: number;
|
|
41
|
+
/** Aggregate destination occurrences; omitted when the gate did not measure them. */
|
|
42
|
+
link_destinations?: {
|
|
43
|
+
checked: number;
|
|
44
|
+
invalid: number;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** Evaluate a document locally using the built-in or supplied named TOML presets. */
|
|
48
|
+
export declare function evaluateContent(document: EmdashDocument, preset: string, sources?: Record<string, string>, evidenceSources?: Record<string, string>, onTelemetry?: (event: ContentEvaluationTelemetry) => void): Promise<ContentReport>;
|
|
49
|
+
/** Evaluate collection gates; callers must provide the complete collection. */
|
|
50
|
+
export declare function evaluateContentCollection(documents: EmdashDocument[], preset: string, sources?: Record<string, string>): Promise<ContentReport>;
|
|
51
|
+
//# sourceMappingURL=content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../src/content.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,aAAa,CAAC;IAC5C,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,UAAU,GAAG,YAAY,GAAG,MAAM,CAAC;IAC1C,mBAAmB,EAAE,MAAM,GAAG,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,GAAG,OAAO,GAAG,mBAAmB,GAAG,qBAAqB,GAAG,MAAM,GAAG,WAAW,GAAG,mBAAmB,CAAC;IAC1L,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB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AAED,+EAA+E;AAC/E,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,cAAc,EAAE,EAC3B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACnC,OAAO,CAAC,aAAa,CAAC,CAExB"}
|
package/dist/content.js
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// wasm/aexeo_emdash_bridge_bg.js
|
|
8
|
+
var aexeo_emdash_bridge_bg_exports = {};
|
|
9
|
+
__export(aexeo_emdash_bridge_bg_exports, {
|
|
10
|
+
__wbg_Error_960c155d3d49e4c2: () => __wbg_Error_960c155d3d49e4c2,
|
|
11
|
+
__wbg_error_a6fa202b58aa1cd3: () => __wbg_error_a6fa202b58aa1cd3,
|
|
12
|
+
__wbg_new_227d7c05414eb861: () => __wbg_new_227d7c05414eb861,
|
|
13
|
+
__wbg_set_wasm: () => __wbg_set_wasm,
|
|
14
|
+
__wbg_stack_3b0d974bbf31e44f: () => __wbg_stack_3b0d974bbf31e44f,
|
|
15
|
+
__wbindgen_init_externref_table: () => __wbindgen_init_externref_table,
|
|
16
|
+
evaluateContent: () => evaluateContent,
|
|
17
|
+
evaluateContentCollection: () => evaluateContentCollection,
|
|
18
|
+
evaluateDocuments: () => evaluateDocuments,
|
|
19
|
+
generateFactsPrompt: () => generateFactsPrompt,
|
|
20
|
+
scoreIntelligence: () => scoreIntelligence,
|
|
21
|
+
validateFactsManifest: () => validateFactsManifest
|
|
22
|
+
});
|
|
23
|
+
function evaluateContent(document_json, preset_name, sources_json, evidence_json) {
|
|
24
|
+
let deferred6_0;
|
|
25
|
+
let deferred6_1;
|
|
26
|
+
try {
|
|
27
|
+
const ptr0 = passStringToWasm0(document_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
28
|
+
const len0 = WASM_VECTOR_LEN;
|
|
29
|
+
const ptr1 = passStringToWasm0(preset_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
30
|
+
const len1 = WASM_VECTOR_LEN;
|
|
31
|
+
var ptr2 = isLikeNone(sources_json) ? 0 : passStringToWasm0(sources_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
32
|
+
var len2 = WASM_VECTOR_LEN;
|
|
33
|
+
var ptr3 = isLikeNone(evidence_json) ? 0 : passStringToWasm0(evidence_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
34
|
+
var len3 = WASM_VECTOR_LEN;
|
|
35
|
+
const ret = wasm.evaluateContent(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
36
|
+
var ptr5 = ret[0];
|
|
37
|
+
var len5 = ret[1];
|
|
38
|
+
if (ret[3]) {
|
|
39
|
+
ptr5 = 0;
|
|
40
|
+
len5 = 0;
|
|
41
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
42
|
+
}
|
|
43
|
+
deferred6_0 = ptr5;
|
|
44
|
+
deferred6_1 = len5;
|
|
45
|
+
return getStringFromWasm0(ptr5, len5);
|
|
46
|
+
} finally {
|
|
47
|
+
wasm.__wbindgen_free(deferred6_0, deferred6_1, 1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function evaluateContentCollection(documents_json, preset_name, sources_json) {
|
|
51
|
+
let deferred5_0;
|
|
52
|
+
let deferred5_1;
|
|
53
|
+
try {
|
|
54
|
+
const ptr0 = passStringToWasm0(documents_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
55
|
+
const len0 = WASM_VECTOR_LEN;
|
|
56
|
+
const ptr1 = passStringToWasm0(preset_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
57
|
+
const len1 = WASM_VECTOR_LEN;
|
|
58
|
+
var ptr2 = isLikeNone(sources_json) ? 0 : passStringToWasm0(sources_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
59
|
+
var len2 = WASM_VECTOR_LEN;
|
|
60
|
+
const ret = wasm.evaluateContentCollection(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
61
|
+
var ptr4 = ret[0];
|
|
62
|
+
var len4 = ret[1];
|
|
63
|
+
if (ret[3]) {
|
|
64
|
+
ptr4 = 0;
|
|
65
|
+
len4 = 0;
|
|
66
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
67
|
+
}
|
|
68
|
+
deferred5_0 = ptr4;
|
|
69
|
+
deferred5_1 = len4;
|
|
70
|
+
return getStringFromWasm0(ptr4, len4);
|
|
71
|
+
} finally {
|
|
72
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function evaluateDocuments(documents_json, config_json) {
|
|
76
|
+
let deferred4_0;
|
|
77
|
+
let deferred4_1;
|
|
78
|
+
try {
|
|
79
|
+
const ptr0 = passStringToWasm0(documents_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
80
|
+
const len0 = WASM_VECTOR_LEN;
|
|
81
|
+
var ptr1 = isLikeNone(config_json) ? 0 : passStringToWasm0(config_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
82
|
+
var len1 = WASM_VECTOR_LEN;
|
|
83
|
+
const ret = wasm.evaluateDocuments(ptr0, len0, ptr1, len1);
|
|
84
|
+
var ptr3 = ret[0];
|
|
85
|
+
var len3 = ret[1];
|
|
86
|
+
if (ret[3]) {
|
|
87
|
+
ptr3 = 0;
|
|
88
|
+
len3 = 0;
|
|
89
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
90
|
+
}
|
|
91
|
+
deferred4_0 = ptr3;
|
|
92
|
+
deferred4_1 = len3;
|
|
93
|
+
return getStringFromWasm0(ptr3, len3);
|
|
94
|
+
} finally {
|
|
95
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function generateFactsPrompt(documents_json) {
|
|
99
|
+
let deferred3_0;
|
|
100
|
+
let deferred3_1;
|
|
101
|
+
try {
|
|
102
|
+
const ptr0 = passStringToWasm0(documents_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
103
|
+
const len0 = WASM_VECTOR_LEN;
|
|
104
|
+
const ret = wasm.generateFactsPrompt(ptr0, len0);
|
|
105
|
+
var ptr2 = ret[0];
|
|
106
|
+
var len2 = ret[1];
|
|
107
|
+
if (ret[3]) {
|
|
108
|
+
ptr2 = 0;
|
|
109
|
+
len2 = 0;
|
|
110
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
111
|
+
}
|
|
112
|
+
deferred3_0 = ptr2;
|
|
113
|
+
deferred3_1 = len2;
|
|
114
|
+
return getStringFromWasm0(ptr2, len2);
|
|
115
|
+
} finally {
|
|
116
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function scoreIntelligence(documents_json, manifest_json) {
|
|
120
|
+
let deferred4_0;
|
|
121
|
+
let deferred4_1;
|
|
122
|
+
try {
|
|
123
|
+
const ptr0 = passStringToWasm0(documents_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
124
|
+
const len0 = WASM_VECTOR_LEN;
|
|
125
|
+
var ptr1 = isLikeNone(manifest_json) ? 0 : passStringToWasm0(manifest_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
126
|
+
var len1 = WASM_VECTOR_LEN;
|
|
127
|
+
const ret = wasm.scoreIntelligence(ptr0, len0, ptr1, len1);
|
|
128
|
+
var ptr3 = ret[0];
|
|
129
|
+
var len3 = ret[1];
|
|
130
|
+
if (ret[3]) {
|
|
131
|
+
ptr3 = 0;
|
|
132
|
+
len3 = 0;
|
|
133
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
134
|
+
}
|
|
135
|
+
deferred4_0 = ptr3;
|
|
136
|
+
deferred4_1 = len3;
|
|
137
|
+
return getStringFromWasm0(ptr3, len3);
|
|
138
|
+
} finally {
|
|
139
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function validateFactsManifest(manifest_json, documents_json) {
|
|
143
|
+
let deferred4_0;
|
|
144
|
+
let deferred4_1;
|
|
145
|
+
try {
|
|
146
|
+
const ptr0 = passStringToWasm0(manifest_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
147
|
+
const len0 = WASM_VECTOR_LEN;
|
|
148
|
+
const ptr1 = passStringToWasm0(documents_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
149
|
+
const len1 = WASM_VECTOR_LEN;
|
|
150
|
+
const ret = wasm.validateFactsManifest(ptr0, len0, ptr1, len1);
|
|
151
|
+
var ptr3 = ret[0];
|
|
152
|
+
var len3 = ret[1];
|
|
153
|
+
if (ret[3]) {
|
|
154
|
+
ptr3 = 0;
|
|
155
|
+
len3 = 0;
|
|
156
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
157
|
+
}
|
|
158
|
+
deferred4_0 = ptr3;
|
|
159
|
+
deferred4_1 = len3;
|
|
160
|
+
return getStringFromWasm0(ptr3, len3);
|
|
161
|
+
} finally {
|
|
162
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function __wbg_Error_960c155d3d49e4c2(arg0, arg1) {
|
|
166
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
167
|
+
return ret;
|
|
168
|
+
}
|
|
169
|
+
function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
|
|
170
|
+
let deferred0_0;
|
|
171
|
+
let deferred0_1;
|
|
172
|
+
try {
|
|
173
|
+
deferred0_0 = arg0;
|
|
174
|
+
deferred0_1 = arg1;
|
|
175
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
176
|
+
} finally {
|
|
177
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function __wbg_new_227d7c05414eb861() {
|
|
181
|
+
const ret = new Error();
|
|
182
|
+
return ret;
|
|
183
|
+
}
|
|
184
|
+
function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
185
|
+
const ret = arg1.stack;
|
|
186
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
187
|
+
const len1 = WASM_VECTOR_LEN;
|
|
188
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
189
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
190
|
+
}
|
|
191
|
+
function __wbindgen_init_externref_table() {
|
|
192
|
+
const table = wasm.__wbindgen_externrefs;
|
|
193
|
+
const offset = table.grow(4);
|
|
194
|
+
table.set(0, void 0);
|
|
195
|
+
table.set(offset + 0, void 0);
|
|
196
|
+
table.set(offset + 1, null);
|
|
197
|
+
table.set(offset + 2, true);
|
|
198
|
+
table.set(offset + 3, false);
|
|
199
|
+
}
|
|
200
|
+
var cachedDataViewMemory0 = null;
|
|
201
|
+
function getDataViewMemory0() {
|
|
202
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
|
|
203
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
204
|
+
}
|
|
205
|
+
return cachedDataViewMemory0;
|
|
206
|
+
}
|
|
207
|
+
function getStringFromWasm0(ptr, len) {
|
|
208
|
+
ptr = ptr >>> 0;
|
|
209
|
+
return decodeText(ptr, len);
|
|
210
|
+
}
|
|
211
|
+
var cachedUint8ArrayMemory0 = null;
|
|
212
|
+
function getUint8ArrayMemory0() {
|
|
213
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
214
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
215
|
+
}
|
|
216
|
+
return cachedUint8ArrayMemory0;
|
|
217
|
+
}
|
|
218
|
+
function isLikeNone(x) {
|
|
219
|
+
return x === void 0 || x === null;
|
|
220
|
+
}
|
|
221
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
222
|
+
if (realloc === void 0) {
|
|
223
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
224
|
+
const ptr2 = malloc(buf.length, 1) >>> 0;
|
|
225
|
+
getUint8ArrayMemory0().subarray(ptr2, ptr2 + buf.length).set(buf);
|
|
226
|
+
WASM_VECTOR_LEN = buf.length;
|
|
227
|
+
return ptr2;
|
|
228
|
+
}
|
|
229
|
+
let len = arg.length;
|
|
230
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
231
|
+
const mem = getUint8ArrayMemory0();
|
|
232
|
+
let offset = 0;
|
|
233
|
+
for (; offset < len; offset++) {
|
|
234
|
+
const code = arg.charCodeAt(offset);
|
|
235
|
+
if (code > 127) break;
|
|
236
|
+
mem[ptr + offset] = code;
|
|
237
|
+
}
|
|
238
|
+
if (offset !== len) {
|
|
239
|
+
if (offset !== 0) {
|
|
240
|
+
arg = arg.slice(offset);
|
|
241
|
+
}
|
|
242
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
243
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
244
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
245
|
+
offset += ret.written;
|
|
246
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
247
|
+
}
|
|
248
|
+
WASM_VECTOR_LEN = offset;
|
|
249
|
+
return ptr;
|
|
250
|
+
}
|
|
251
|
+
function takeFromExternrefTable0(idx) {
|
|
252
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
253
|
+
wasm.__externref_table_dealloc(idx);
|
|
254
|
+
return value;
|
|
255
|
+
}
|
|
256
|
+
var cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
257
|
+
cachedTextDecoder.decode();
|
|
258
|
+
var MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
259
|
+
var numBytesDecoded = 0;
|
|
260
|
+
function decodeText(ptr, len) {
|
|
261
|
+
numBytesDecoded += len;
|
|
262
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
263
|
+
cachedTextDecoder = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
|
|
264
|
+
cachedTextDecoder.decode();
|
|
265
|
+
numBytesDecoded = len;
|
|
266
|
+
}
|
|
267
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
268
|
+
}
|
|
269
|
+
var cachedTextEncoder = new TextEncoder();
|
|
270
|
+
if (!("encodeInto" in cachedTextEncoder)) {
|
|
271
|
+
cachedTextEncoder.encodeInto = function(arg, view) {
|
|
272
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
273
|
+
view.set(buf);
|
|
274
|
+
return {
|
|
275
|
+
read: arg.length,
|
|
276
|
+
written: buf.length
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
var WASM_VECTOR_LEN = 0;
|
|
281
|
+
var wasm;
|
|
282
|
+
function __wbg_set_wasm(val) {
|
|
283
|
+
wasm = val;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// src/wasm-init.ts
|
|
287
|
+
var WASM_SPECIFIER = "../wasm/aexeo_emdash_bridge_bg.wasm";
|
|
288
|
+
var initialized = false;
|
|
289
|
+
var cachedModule = null;
|
|
290
|
+
async function loadBridgeModule() {
|
|
291
|
+
if (cachedModule !== null) {
|
|
292
|
+
return cachedModule;
|
|
293
|
+
}
|
|
294
|
+
try {
|
|
295
|
+
const mod = await import(WASM_SPECIFIER);
|
|
296
|
+
if (mod.default instanceof WebAssembly.Module) {
|
|
297
|
+
cachedModule = mod.default;
|
|
298
|
+
return cachedModule;
|
|
299
|
+
}
|
|
300
|
+
} catch {
|
|
301
|
+
}
|
|
302
|
+
const wasmUrl = new URL(WASM_SPECIFIER, import.meta.url);
|
|
303
|
+
if (wasmUrl.protocol === "file:") {
|
|
304
|
+
const [{ readFile }, { fileURLToPath }] = await Promise.all([
|
|
305
|
+
import("node:fs/promises"),
|
|
306
|
+
import("node:url")
|
|
307
|
+
]);
|
|
308
|
+
const bytes = await readFile(fileURLToPath(wasmUrl));
|
|
309
|
+
cachedModule = await WebAssembly.compile(bytes);
|
|
310
|
+
return cachedModule;
|
|
311
|
+
}
|
|
312
|
+
const response = await fetch(wasmUrl);
|
|
313
|
+
cachedModule = await WebAssembly.compileStreaming(response);
|
|
314
|
+
return cachedModule;
|
|
315
|
+
}
|
|
316
|
+
async function ensureInitialized() {
|
|
317
|
+
if (initialized) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
const bridgeModule = await loadBridgeModule();
|
|
321
|
+
const instance = new WebAssembly.Instance(bridgeModule, {
|
|
322
|
+
"./aexeo_emdash_bridge_bg.js": aexeo_emdash_bridge_bg_exports
|
|
323
|
+
});
|
|
324
|
+
__wbg_set_wasm(instance.exports);
|
|
325
|
+
instance.exports.__wbindgen_start();
|
|
326
|
+
initialized = true;
|
|
327
|
+
}
|
|
328
|
+
async function evaluateContent2(documentJson, presetName, sourcesJson, evidenceJson) {
|
|
329
|
+
await ensureInitialized();
|
|
330
|
+
return evaluateContent(documentJson, presetName, sourcesJson, evidenceJson);
|
|
331
|
+
}
|
|
332
|
+
async function evaluateContentCollection2(documentsJson, presetName, sourcesJson) {
|
|
333
|
+
await ensureInitialized();
|
|
334
|
+
return evaluateContentCollection(documentsJson, presetName, sourcesJson);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// src/content.ts
|
|
338
|
+
async function evaluateContent3(document, preset, sources = {}, evidenceSources, onTelemetry) {
|
|
339
|
+
const started = onTelemetry ? performance.now() : 0;
|
|
340
|
+
const documentJson = JSON.stringify(document);
|
|
341
|
+
const sourcesJson = JSON.stringify(sources);
|
|
342
|
+
const result = evidenceSources === void 0 ? await evaluateContent2(documentJson, preset, sourcesJson) : await evaluateContent2(documentJson, preset, sourcesJson, JSON.stringify(evidenceSources));
|
|
343
|
+
const report = JSON.parse(result);
|
|
344
|
+
if (onTelemetry) {
|
|
345
|
+
const event = { evaluation_ms: performance.now() - started, source_locations_mapped: report.source_locations?.length ?? 0 };
|
|
346
|
+
for (const gate of report.gates) {
|
|
347
|
+
const checked = gate.measurements?.checked_destinations;
|
|
348
|
+
const invalid = gate.measurements?.invalid_destinations;
|
|
349
|
+
if (checked !== void 0 && invalid !== void 0) {
|
|
350
|
+
event.link_destinations ??= { checked: 0, invalid: 0 };
|
|
351
|
+
event.link_destinations.checked += checked;
|
|
352
|
+
event.link_destinations.invalid += invalid;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
onTelemetry(event);
|
|
356
|
+
}
|
|
357
|
+
return report;
|
|
358
|
+
}
|
|
359
|
+
async function evaluateContentCollection3(documents, preset, sources = {}) {
|
|
360
|
+
return JSON.parse(await evaluateContentCollection2(JSON.stringify(documents), preset, JSON.stringify(sources)));
|
|
361
|
+
}
|
|
362
|
+
export {
|
|
363
|
+
evaluateContent3 as evaluateContent,
|
|
364
|
+
evaluateContentCollection3 as evaluateContentCollection
|
|
365
|
+
};
|
package/dist/data-route.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CustomBlockMappings } from "./adapter.js";
|
|
1
2
|
import type { EvaluatorFn, RefreshSummary, SandboxCtx } from "./plugin.js";
|
|
2
3
|
import type { Finding } from "./types.js";
|
|
3
4
|
export interface FindingsPayload {
|
|
@@ -44,6 +45,8 @@ export interface FindingRow {
|
|
|
44
45
|
layers?: import("./types.js").RuleLayers;
|
|
45
46
|
}
|
|
46
47
|
interface DataRouteOptions {
|
|
48
|
+
blockMappings?: CustomBlockMappings | undefined;
|
|
49
|
+
contentFieldsByCollection?: Record<string, readonly string[]> | undefined;
|
|
47
50
|
collections: readonly string[];
|
|
48
51
|
evaluator: EvaluatorFn;
|
|
49
52
|
refresh: boolean;
|
package/dist/data-route.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-route.d.ts","sourceRoot":"","sources":["../src/data-route.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data-route.d.ts","sourceRoot":"","sources":["../src/data-route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAUxD,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,UAAU,EAEX,MAAM,aAAa,CAAC;AAQrB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAM1C,MAAM,WAAW,eAAe;IAG9B,MAAM,EAAE,YAAY,EAAE,CAAC;IAIvB,QAAQ,EAAE,UAAU,EAAE,CAAC;IAIvB,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;IAIF,cAAc,EAAE,cAAc,EAAE,CAAC;IAIjC,gBAAgB,EAAE,OAAO,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,OAAO,YAAY,EAAE,KAAK,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IAGd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAA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Finding, SiteIntelligenceScore } from "./types.js";
|
|
2
2
|
export declare function evaluate(_documents: readonly EmdashDocument[]): Promise<Finding[]>;
|
|
3
|
-
export declare function scoreSite(_documents: readonly EmdashDocument[]): Promise<SiteIntelligenceScore>;
|
|
3
|
+
export declare function scoreSite(_documents: readonly EmdashDocument[]): Promise<SiteIntelligenceScore | null>;
|
|
4
4
|
export declare function errorFindings(findings: readonly Finding[]): Finding[];
|
|
5
5
|
export declare function findingsByRoute(findings: readonly Finding[]): Map<string, Finding[]>;
|
|
6
6
|
//# sourceMappingURL=evaluator-sandbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluator-sandbox.d.ts","sourceRoot":"","sources":["../src/evaluator-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,OAAO,EACP,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAkBpB,wBAAsB,QAAQ,CAC5B,UAAU,EAAE,SAAS,cAAc,EAAE,GACpC,OAAO,CAAC,OAAO,EAAE,CAAC,CAEpB;AAED,wBAAsB,SAAS,CAC7B,UAAU,EAAE,SAAS,cAAc,EAAE,GACpC,OAAO,CAAC,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"evaluator-sandbox.d.ts","sourceRoot":"","sources":["../src/evaluator-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,OAAO,EACP,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAkBpB,wBAAsB,QAAQ,CAC5B,UAAU,EAAE,SAAS,cAAc,EAAE,GACpC,OAAO,CAAC,OAAO,EAAE,CAAC,CAEpB;AAED,wBAAsB,SAAS,CAC7B,UAAU,EAAE,SAAS,cAAc,EAAE,GACpC,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAEvC;AAQD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,CAErE;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,SAAS,OAAO,EAAE,GAC3B,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAWxB"}
|
package/dist/evaluator.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ export interface EvaluateOptions {
|
|
|
5
5
|
export declare function evaluate(documents: readonly EmdashDocument[], options?: EvaluateOptions): Promise<Finding[]>;
|
|
6
6
|
export declare function errorFindings(findings: readonly Finding[]): Finding[];
|
|
7
7
|
export declare function findingsByRoute(findings: readonly Finding[]): Map<string, Finding[]>;
|
|
8
|
-
export declare function scoreSite(documents: readonly EmdashDocument[]): Promise<SiteIntelligenceScore>;
|
|
8
|
+
export declare function scoreSite(documents: readonly EmdashDocument[]): Promise<SiteIntelligenceScore | null>;
|
|
9
9
|
//# sourceMappingURL=evaluator.d.ts.map
|
package/dist/evaluator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../src/evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,OAAO,EACP,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAapB,MAAM,WAAW,eAAe;IAG9B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,QAAQ,CAC5B,SAAS,EAAE,SAAS,cAAc,EAAE,EACpC,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,OAAO,EAAE,CAAC,CAIpB;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,CAErE;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,SAAS,OAAO,EAAE,GAC3B,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAWxB;
|
|
1
|
+
{"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../src/evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,OAAO,EACP,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAapB,MAAM,WAAW,eAAe;IAG9B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,QAAQ,CAC5B,SAAS,EAAE,SAAS,cAAc,EAAE,EACpC,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,OAAO,EAAE,CAAC,CAIpB;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,CAErE;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,SAAS,OAAO,EAAE,GAC3B,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAWxB;AAMD,wBAAsB,SAAS,CAC7B,SAAS,EAAE,SAAS,cAAc,EAAE,GACnC,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAGvC"}
|
package/dist/facts-route.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { CustomBlockMappings } from "./adapter.js";
|
|
2
|
+
import type { EmdashDocument, Finding, SiteIntelligenceScore } from "./types.js";
|
|
3
|
+
import type { EvaluatorFn, KvNamespace, SandboxCtx } from "./plugin.js";
|
|
4
|
+
import type { SuppressionFilter } from "./suppressions.js";
|
|
5
|
+
export type BlockInteraction = {
|
|
6
|
+
type: "page_load";
|
|
7
|
+
page: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: "block_action";
|
|
10
|
+
action_id: string;
|
|
11
|
+
block_id?: string;
|
|
12
|
+
value?: unknown;
|
|
13
|
+
} | {
|
|
14
|
+
type: "form_submit";
|
|
15
|
+
action_id: string;
|
|
16
|
+
block_id?: string;
|
|
17
|
+
values: Record<string, unknown>;
|
|
18
|
+
};
|
|
19
|
+
export interface BlockResponse {
|
|
20
|
+
blocks: unknown[];
|
|
21
|
+
toast?: {
|
|
22
|
+
message: string;
|
|
23
|
+
type: "success" | "error" | "info";
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Coerce raw `ctx.input` (which emdash 0.17 may deliver as
|
|
28
|
+
* undefined, an empty object, or a partial interaction during
|
|
29
|
+
* admin/widget hydration) into a well-shaped BlockInteraction.
|
|
30
|
+
*
|
|
31
|
+
* Defaults follow Aeptus's hardening suggestion:
|
|
32
|
+
* - Missing/non-object → `page_load /findings` (the canonical
|
|
33
|
+
* landing view).
|
|
34
|
+
* - `page_load` with missing `page` → `/findings`.
|
|
35
|
+
* - `block_action` with missing `action_id` → empty string;
|
|
36
|
+
* falls through to `notFound("")` rather than throwing.
|
|
37
|
+
* - `form_submit` with missing `values` → empty object;
|
|
38
|
+
* downstream code already handles "no route picked" via
|
|
39
|
+
* the `typeof picked === "string"` guard.
|
|
40
|
+
*
|
|
41
|
+
* Exported (and pinned by tests/findings-view.test.ts) because this
|
|
42
|
+
* function carries a production hotfix: 0.8.16 + emdash@0.17.2 crashed
|
|
43
|
+
* with `TypeError: Cannot read properties of undefined (reading 'type')`
|
|
44
|
+
* at the admin endpoint because dispatch read `body.type` straight off
|
|
45
|
+
* an un-normalized `ctx.input`. Ten edge cases are covered there.
|
|
46
|
+
*/
|
|
47
|
+
export declare function normalizeInteraction(input: unknown): BlockInteraction;
|
|
48
|
+
/**
|
|
49
|
+
* Presentation and evaluation knobs that legitimately differ between the
|
|
50
|
+
* configured and sandboxed entrypoints. Everything else about the Block
|
|
51
|
+
* Kit output is byte-identical and lives in the shared renderers below.
|
|
52
|
+
*
|
|
53
|
+
* Adding a field here to paper over a difference that only reproduces on
|
|
54
|
+
* one entrypoint is a smell: that is how the suppression bug got here.
|
|
55
|
+
*/
|
|
56
|
+
export interface AdminViewTuning {
|
|
57
|
+
/**
|
|
58
|
+
* Context line rendered in place of the findings table when it has no
|
|
59
|
+
* rows.
|
|
60
|
+
*/
|
|
61
|
+
emptyFindingsText: string;
|
|
62
|
+
/**
|
|
63
|
+
* Context line rendered by the score widget when no documents are
|
|
64
|
+
* indexed.
|
|
65
|
+
*/
|
|
66
|
+
emptyScoreText: string;
|
|
67
|
+
/**
|
|
68
|
+
* Banner variant for a hard Refresh failure (the sweep threw, or the
|
|
69
|
+
* host rejected the call outright). Block Kit's variants are
|
|
70
|
+
* "default" | "alert" | "error"; a "warning" value silently lands as
|
|
71
|
+
* undefined in the renderer's variant->classes lookup and surfaces as
|
|
72
|
+
* "Cannot read properties of undefined (reading 'classes')" in the
|
|
73
|
+
* browser. The configured entry has always rendered "error" for a hard
|
|
74
|
+
* failure, the sandboxed entry "alert".
|
|
75
|
+
*/
|
|
76
|
+
refreshFailureVariant: "alert" | "error";
|
|
77
|
+
/**
|
|
78
|
+
* Backing scorer for the dashboard widget. Configured mode passes the
|
|
79
|
+
* manifest-aware in-process scorer; sandbox mode passes the
|
|
80
|
+
* sidecar-backed `scoreSite`.
|
|
81
|
+
*/
|
|
82
|
+
score: (documents: readonly EmdashDocument[], kv: KvNamespace) => Promise<SiteIntelligenceScore | null>;
|
|
83
|
+
/**
|
|
84
|
+
* Label for the widget's truth-consistency stat. Configured mode badges
|
|
85
|
+
* it with the real signal source so a schema-only 60 doesn't read the
|
|
86
|
+
* same as a manifest-backed 60; sandbox mode uses the flat "Truth".
|
|
87
|
+
*/
|
|
88
|
+
truthLabel: (score: SiteIntelligenceScore) => string;
|
|
89
|
+
}
|
|
90
|
+
export interface RefreshOptions {
|
|
91
|
+
blockMappings?: CustomBlockMappings | undefined;
|
|
92
|
+
contentFieldsByCollection?: Record<string, readonly string[]> | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Host context. `evaluateAndPersistAll` needs kv/http/content/log, and
|
|
95
|
+
* the follow-up `renderFindingsPage` needs kv.
|
|
96
|
+
*/
|
|
97
|
+
ctx: SandboxCtx;
|
|
98
|
+
/** Collections the sweep walks. */
|
|
99
|
+
collections: readonly string[];
|
|
100
|
+
/**
|
|
101
|
+
* Evaluation strategy: in-process WASM (configured) or sidecar fetch
|
|
102
|
+
* (sandbox). The only real difference between the two entries.
|
|
103
|
+
*/
|
|
104
|
+
evaluator: EvaluatorFn;
|
|
105
|
+
/**
|
|
106
|
+
* Compiled editor suppressions, applied by `evaluateAndPersistAll`
|
|
107
|
+
* before anything is written to KV.
|
|
108
|
+
*
|
|
109
|
+
* Required rather than optional on purpose. This is the parameter whose
|
|
110
|
+
* omission from `configured.ts`'s copy of this function shipped the bug
|
|
111
|
+
* described at the top of the file, so the type system now refuses to
|
|
112
|
+
* let a caller forget it. Entrypoints with no suppressions configured
|
|
113
|
+
* pass `compileSuppressions(undefined)`.
|
|
114
|
+
*/
|
|
115
|
+
suppressionFilter: SuppressionFilter;
|
|
116
|
+
/** Copy and variant knobs; see {@link AdminViewTuning}. */
|
|
117
|
+
tuning: AdminViewTuning;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The full-site sweep behind the "Refresh" button on the Block Kit
|
|
121
|
+
* /findings page. Runs in a live request context: the configured entry
|
|
122
|
+
* sweeps in-process through WASM, the sandboxed entry through the
|
|
123
|
+
* sidecar. afterSave still owns single-document updates.
|
|
124
|
+
*/
|
|
125
|
+
export declare function handleRefresh(options: RefreshOptions): Promise<BlockResponse>;
|
|
126
|
+
export interface FindingRow extends Finding {
|
|
127
|
+
document_route: string;
|
|
128
|
+
}
|
|
129
|
+
export declare function readAllFindings(kv: KvNamespace): Promise<FindingRow[]>;
|
|
130
|
+
export declare function severityFirst(a: Finding, b: Finding): number;
|
|
131
|
+
export declare function uniqueRoutes(rows: FindingRow[]): string[];
|
|
132
|
+
export declare function renderFindingsPage(kv: KvNamespace, tuning: AdminViewTuning): Promise<BlockResponse>;
|
|
133
|
+
export declare function findingsTable(rows: FindingRow[]): unknown;
|
|
134
|
+
export declare function renderScoreWidget(kv: KvNamespace, tuning: AdminViewTuning, log?: {
|
|
135
|
+
error(message: string, data?: unknown): void;
|
|
136
|
+
}): Promise<BlockResponse>;
|
|
137
|
+
export declare function topBlockersLine(score: SiteIntelligenceScore): string;
|
|
138
|
+
export declare function renderDocumentPanel(kv: KvNamespace, route?: string): Promise<BlockResponse>;
|
|
139
|
+
export declare function documentFindingsTable(findings: Finding[]): unknown;
|
|
140
|
+
export declare function notFound(page: string): BlockResponse;
|
|
141
|
+
//# sourceMappingURL=findings-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findings-view.d.ts","sourceRoot":"","sources":["../src/findings-view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAmBxD,OAAO,KAAK,EACV,cAAc,EACd,OAAO,EACP,qBAAqB,EACtB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EAEX,UAAU,EACX,MAAM,aAAa,CAAC;AAMrB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAK3D,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACnC;IACE,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GACD;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC,CAAC;AAEN,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAA;KAAE,CAAC;CACjE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB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