cbrowser 19.2.1 → 19.2.3
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/analysis/accessibility-empathy.d.ts +51 -3
- package/dist/analysis/accessibility-empathy.d.ts.map +1 -1
- package/dist/analysis/accessibility-empathy.js +772 -133
- package/dist/analysis/accessibility-empathy.js.map +1 -1
- package/dist/analysis/agent-ready-audit.d.ts +28 -0
- package/dist/analysis/agent-ready-audit.d.ts.map +1 -1
- package/dist/analysis/agent-ready-audit.js +218 -21
- package/dist/analysis/agent-ready-audit.js.map +1 -1
- package/dist/analysis/bug-hunter.d.ts +45 -0
- package/dist/analysis/bug-hunter.d.ts.map +1 -1
- package/dist/analysis/bug-hunter.js +211 -64
- package/dist/analysis/bug-hunter.js.map +1 -1
- package/dist/analysis/competitive-benchmark.d.ts.map +1 -1
- package/dist/analysis/competitive-benchmark.js +4 -2
- package/dist/analysis/competitive-benchmark.js.map +1 -1
- package/dist/browser/session-manager.d.ts.map +1 -1
- package/dist/browser/session-manager.js +4 -2
- package/dist/browser/session-manager.js.map +1 -1
- package/dist/browser.d.ts +11 -2
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +64 -15
- package/dist/browser.js.map +1 -1
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-server-remote.d.ts +3 -0
- package/dist/mcp-server-remote.d.ts.map +1 -1
- package/dist/mcp-server-remote.js +12 -1
- package/dist/mcp-server-remote.js.map +1 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +19 -19
- package/dist/mcp-server.js.map +1 -1
- package/dist/mcp-tools/base/audit-tools.d.ts.map +1 -1
- package/dist/mcp-tools/base/audit-tools.js +122 -59
- package/dist/mcp-tools/base/audit-tools.js.map +1 -1
- package/dist/mcp-tools/base/browser-state-tools.d.ts.map +1 -1
- package/dist/mcp-tools/base/browser-state-tools.js +3 -2
- package/dist/mcp-tools/base/browser-state-tools.js.map +1 -1
- package/dist/mcp-tools/base/bug-analysis-tools.d.ts.map +1 -1
- package/dist/mcp-tools/base/bug-analysis-tools.js +4 -67
- package/dist/mcp-tools/base/bug-analysis-tools.js.map +1 -1
- package/dist/mcp-tools/base/interaction-tools.d.ts.map +1 -1
- package/dist/mcp-tools/base/interaction-tools.js +4 -0
- package/dist/mcp-tools/base/interaction-tools.js.map +1 -1
- package/dist/mcp-tools/base/persona-comparison-tools.d.ts.map +1 -1
- package/dist/mcp-tools/base/persona-comparison-tools.js +6 -0
- package/dist/mcp-tools/base/persona-comparison-tools.js.map +1 -1
- package/dist/mcp-tools/security-layer.d.ts +33 -0
- package/dist/mcp-tools/security-layer.d.ts.map +1 -1
- package/dist/mcp-tools/security-layer.js +191 -1
- package/dist/mcp-tools/security-layer.js.map +1 -1
- package/dist/navigation-errors.d.ts +21 -0
- package/dist/navigation-errors.d.ts.map +1 -0
- package/dist/navigation-errors.js +119 -0
- package/dist/navigation-errors.js.map +1 -0
- package/dist/personas.d.ts +6 -1
- package/dist/personas.d.ts.map +1 -1
- package/dist/personas.js +49 -2
- package/dist/personas.js.map +1 -1
- package/dist/remediation/llms-txt.d.ts.map +1 -1
- package/dist/remediation/llms-txt.js +3 -1
- package/dist/remediation/llms-txt.js.map +1 -1
- package/dist/remediation/structured-data.d.ts.map +1 -1
- package/dist/remediation/structured-data.js +3 -1
- package/dist/remediation/structured-data.js.map +1 -1
- package/dist/security/script-gate.d.ts +7 -0
- package/dist/security/script-gate.d.ts.map +1 -1
- package/dist/security/script-gate.js +7 -0
- package/dist/security/script-gate.js.map +1 -1
- package/dist/testing/flaky-detection.js +1 -1
- package/dist/testing/flaky-detection.js.map +1 -1
- package/dist/testing/nl-test-suite.d.ts +12 -0
- package/dist/testing/nl-test-suite.d.ts.map +1 -1
- package/dist/testing/nl-test-suite.js +92 -14
- package/dist/testing/nl-test-suite.js.map +1 -1
- package/dist/testing/test-repair.js +3 -3
- package/dist/testing/test-repair.js.map +1 -1
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/visual/attention-transport.d.ts +89 -11
- package/dist/visual/attention-transport.d.ts.map +1 -1
- package/dist/visual/attention-transport.js +148 -53
- package/dist/visual/attention-transport.js.map +1 -1
- package/dist/visual/cross-browser.d.ts.map +1 -1
- package/dist/visual/cross-browser.js +3 -1
- package/dist/visual/cross-browser.js.map +1 -1
- package/dist/visual/distance-metrics.js +6 -6
- package/dist/visual/distance-metrics.js.map +1 -1
- package/dist/visual/perceptual-transport.d.ts +14 -3
- package/dist/visual/perceptual-transport.d.ts.map +1 -1
- package/dist/visual/perceptual-transport.js +51 -9
- package/dist/visual/perceptual-transport.js.map +1 -1
- package/package.json +1 -1
|
@@ -14,6 +14,39 @@ export interface DescriptionScanSummary {
|
|
|
14
14
|
}
|
|
15
15
|
/** What the most recent registration pass found. Read-only. */
|
|
16
16
|
export declare function getDescriptionScanSummary(): DescriptionScanSummary;
|
|
17
|
+
/** True when a tool's result is cbrowser's own computed analysis and may have its float residue removed. */
|
|
18
|
+
export declare function isComputedAnalysisTool(name: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Rewrite the residue-carrying number tokens of a JSON text, and nothing
|
|
21
|
+
* else. A scanner, not a parse-and-stringify: it tracks string state and
|
|
22
|
+
* escapes, and replaces only number tokens OUTSIDE strings whose value
|
|
23
|
+
* carries residue and changes when cleaned. Every other byte -- big integer
|
|
24
|
+
* literals, other numbers, whitespace, key order, string contents -- is
|
|
25
|
+
* returned as it came. The caller decides the text is JSON.
|
|
26
|
+
*/
|
|
27
|
+
export declare function cleanResidueInJsonText(text: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Remove binary floating-point residue from a computed-analysis tool's
|
|
30
|
+
* result. The secured wrapper calls it only for isComputedAnalysisTool names.
|
|
31
|
+
*
|
|
32
|
+
* Customers read `totalBarrierDeduction: 29.299999999999997`,
|
|
33
|
+
* `cognitiveLoad: 0.43019999999999997` and `0.30000000000000004` in JSON that
|
|
34
|
+
* was otherwise rounded. There are ~117 hand-written Math.round sites in src/
|
|
35
|
+
* and two private round3 copies, which is how a field gets missed: rounding at
|
|
36
|
+
* each producer depends on every producer remembering. (2026-10-09)
|
|
37
|
+
*
|
|
38
|
+
* - A "text" block is touched only if it contains residue AND parses as JSON,
|
|
39
|
+
* and then only its residue-carrying number tokens are rewritten
|
|
40
|
+
* (cleanResidueInJsonText); every other byte is kept. Non-JSON text and
|
|
41
|
+
* image blocks are untouched.
|
|
42
|
+
* - `structuredContent` (already an object, so no bytes to keep) has each
|
|
43
|
+
* residue-carrying number cleaned.
|
|
44
|
+
* - Strings are never edited: "0.30000000000000004" stays a string.
|
|
45
|
+
*
|
|
46
|
+
* 12 significant digits removes residue (it lives at the 16th-17th) without
|
|
47
|
+
* moving a real value; 1e-9 and integers pass through unchanged.
|
|
48
|
+
*/
|
|
49
|
+
export declare function cleanFloatResidue(result: unknown): unknown;
|
|
17
50
|
/**
|
|
18
51
|
* Wrap a server so every tool registered through it is audited and zone-checked.
|
|
19
52
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-layer.d.ts","sourceRoot":"","sources":["../../src/mcp-tools/security-layer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqCH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,6EAA6E;AAC7E,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD;AAID,+DAA+D;AAC/D,wBAAgB,yBAAyB,IAAI,sBAAsB,CAElE;AAOD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,YAAY,CAAA;CAAE,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"security-layer.d.ts","sourceRoot":"","sources":["../../src/mcp-tools/security-layer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqCH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,6EAA6E;AAC7E,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD;AAID,+DAA+D;AAC/D,wBAAgB,yBAAyB,IAAI,sBAAsB,CAElE;AAgED,4GAA4G;AAC5G,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5D;AAKD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAsC3D;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAgC1D;AAOD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,YAAY,CAAA;CAAE,GAAG,OAAO,CAuG5F"}
|
|
@@ -42,6 +42,193 @@ let lastScan = { scanned: 0, flagged: [] };
|
|
|
42
42
|
export function getDescriptionScanSummary() {
|
|
43
43
|
return { scanned: lastScan.scanned, flagged: [...lastScan.flagged] };
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Binary floating-point residue: a run of six or more 0s or 9s after the
|
|
47
|
+
* decimal point, followed by one more digit. `0.30000000000000004`,
|
|
48
|
+
* `29.299999999999997` and `0.43019999999999997` all match; `0.3`, `29.3`,
|
|
49
|
+
* `1e-9` and integers do not. A cheap gate so a clean payload is never parsed,
|
|
50
|
+
* and the per-number test: only a number that carries residue is rewritten.
|
|
51
|
+
*/
|
|
52
|
+
const FLOAT_RESIDUE = /\d\.\d*(?:0{6,}|9{6,})\d/;
|
|
53
|
+
/** Twelve significant digits: below every measurement this package makes, above the residue. */
|
|
54
|
+
function cleanNumber(v) {
|
|
55
|
+
return Number.isFinite(v) && !Number.isInteger(v) ? Number(v.toPrecision(12)) : v;
|
|
56
|
+
}
|
|
57
|
+
/** A number cleaned only when its shortest form carries residue; every other number is returned as is. */
|
|
58
|
+
function cleanIfResidue(v) {
|
|
59
|
+
return FLOAT_RESIDUE.test(String(v)) ? cleanNumber(v) : v;
|
|
60
|
+
}
|
|
61
|
+
/** Deep copy of plain objects and arrays with residue cleaned; anything else is passed through. */
|
|
62
|
+
function cleanDeep(v) {
|
|
63
|
+
if (typeof v === "number")
|
|
64
|
+
return cleanIfResidue(v);
|
|
65
|
+
if (Array.isArray(v))
|
|
66
|
+
return v.map(cleanDeep);
|
|
67
|
+
if (v && typeof v === "object" && Object.getPrototypeOf(v) === Object.prototype) {
|
|
68
|
+
const out = {};
|
|
69
|
+
for (const [k, x] of Object.entries(v))
|
|
70
|
+
out[k] = cleanDeep(x);
|
|
71
|
+
return out;
|
|
72
|
+
}
|
|
73
|
+
return v;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The tools whose results are cbrowser's OWN computed analysis -- scores,
|
|
77
|
+
* deductions, weights, distances, persona state -- and so the only ones whose
|
|
78
|
+
* float residue is ours to remove. An explicit opt-in, never a default.
|
|
79
|
+
*
|
|
80
|
+
* Applied to every tool, the clean-up rewrote page data: evaluate_script
|
|
81
|
+
* returned a customer's `{cartTotal: 29.299999999999997}` as 29.3, masking the
|
|
82
|
+
* very float bug they were inspecting, and the whole-block re-serialization
|
|
83
|
+
* moved values with more than 12 significant digits and corrupted integer
|
|
84
|
+
* literals above 2^53. Page-data tools (evaluate_script, extract, get_*,
|
|
85
|
+
* cookies, storage, console and network logs, nl_test results, screenshots,
|
|
86
|
+
* navigation) are deliberately absent. (Round 2, 2026-10-09)
|
|
87
|
+
*/
|
|
88
|
+
const COMPUTED_ANALYSIS_PREFIX = /^(?:(?:empathy|attention|cognitive|persona|marketing)_|compare_personas(?:_|$))/;
|
|
89
|
+
const COMPUTED_ANALYSIS_TOOLS = new Set([
|
|
90
|
+
"list_cognitive_personas",
|
|
91
|
+
"list_emotional_personas",
|
|
92
|
+
"get_emotional_state",
|
|
93
|
+
"trigger_emotional_event",
|
|
94
|
+
"list_influence_patterns",
|
|
95
|
+
"agent_ready_audit",
|
|
96
|
+
"hunt_bugs",
|
|
97
|
+
"site_cognitive_assessment",
|
|
98
|
+
"visual_cognitive_story",
|
|
99
|
+
"competitive_benchmark",
|
|
100
|
+
"journey_heatmap_gif",
|
|
101
|
+
"webmcp_ready_audit",
|
|
102
|
+
"ai_benchmark",
|
|
103
|
+
"transport_map",
|
|
104
|
+
]);
|
|
105
|
+
/** True when a tool's result is cbrowser's own computed analysis and may have its float residue removed. */
|
|
106
|
+
export function isComputedAnalysisTool(name) {
|
|
107
|
+
return COMPUTED_ANALYSIS_TOOLS.has(name) || COMPUTED_ANALYSIS_PREFIX.test(name);
|
|
108
|
+
}
|
|
109
|
+
/** One JSON number token, per RFC 8259, anchored where the scanner stands. */
|
|
110
|
+
const NUMBER_TOKEN = /-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/y;
|
|
111
|
+
/**
|
|
112
|
+
* Rewrite the residue-carrying number tokens of a JSON text, and nothing
|
|
113
|
+
* else. A scanner, not a parse-and-stringify: it tracks string state and
|
|
114
|
+
* escapes, and replaces only number tokens OUTSIDE strings whose value
|
|
115
|
+
* carries residue and changes when cleaned. Every other byte -- big integer
|
|
116
|
+
* literals, other numbers, whitespace, key order, string contents -- is
|
|
117
|
+
* returned as it came. The caller decides the text is JSON.
|
|
118
|
+
*/
|
|
119
|
+
export function cleanResidueInJsonText(text) {
|
|
120
|
+
const chunks = [];
|
|
121
|
+
let last = 0;
|
|
122
|
+
let i = 0;
|
|
123
|
+
const n = text.length;
|
|
124
|
+
while (i < n) {
|
|
125
|
+
const ch = text.charCodeAt(i);
|
|
126
|
+
if (ch === 34 /* " */) {
|
|
127
|
+
i++;
|
|
128
|
+
while (i < n) {
|
|
129
|
+
const c = text.charCodeAt(i);
|
|
130
|
+
if (c === 92 /* backslash */) {
|
|
131
|
+
i += 2;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
i++;
|
|
135
|
+
if (c === 34)
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
if (ch === 45 /* - */ || (ch >= 48 && ch <= 57)) {
|
|
141
|
+
NUMBER_TOKEN.lastIndex = i;
|
|
142
|
+
const m = NUMBER_TOKEN.exec(text);
|
|
143
|
+
if (!m) {
|
|
144
|
+
i++;
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
const start = i;
|
|
148
|
+
i += m[0].length;
|
|
149
|
+
if (FLOAT_RESIDUE.test(m[0])) {
|
|
150
|
+
const v = Number(m[0]);
|
|
151
|
+
const c = cleanNumber(v);
|
|
152
|
+
if (c !== v) {
|
|
153
|
+
chunks.push(text.slice(last, start), String(c));
|
|
154
|
+
last = i;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
i++;
|
|
160
|
+
}
|
|
161
|
+
if (chunks.length === 0)
|
|
162
|
+
return text;
|
|
163
|
+
chunks.push(text.slice(last));
|
|
164
|
+
return chunks.join("");
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Remove binary floating-point residue from a computed-analysis tool's
|
|
168
|
+
* result. The secured wrapper calls it only for isComputedAnalysisTool names.
|
|
169
|
+
*
|
|
170
|
+
* Customers read `totalBarrierDeduction: 29.299999999999997`,
|
|
171
|
+
* `cognitiveLoad: 0.43019999999999997` and `0.30000000000000004` in JSON that
|
|
172
|
+
* was otherwise rounded. There are ~117 hand-written Math.round sites in src/
|
|
173
|
+
* and two private round3 copies, which is how a field gets missed: rounding at
|
|
174
|
+
* each producer depends on every producer remembering. (2026-10-09)
|
|
175
|
+
*
|
|
176
|
+
* - A "text" block is touched only if it contains residue AND parses as JSON,
|
|
177
|
+
* and then only its residue-carrying number tokens are rewritten
|
|
178
|
+
* (cleanResidueInJsonText); every other byte is kept. Non-JSON text and
|
|
179
|
+
* image blocks are untouched.
|
|
180
|
+
* - `structuredContent` (already an object, so no bytes to keep) has each
|
|
181
|
+
* residue-carrying number cleaned.
|
|
182
|
+
* - Strings are never edited: "0.30000000000000004" stays a string.
|
|
183
|
+
*
|
|
184
|
+
* 12 significant digits removes residue (it lives at the 16th-17th) without
|
|
185
|
+
* moving a real value; 1e-9 and integers pass through unchanged.
|
|
186
|
+
*/
|
|
187
|
+
export function cleanFloatResidue(result) {
|
|
188
|
+
if (!result || typeof result !== "object")
|
|
189
|
+
return result;
|
|
190
|
+
const r = result;
|
|
191
|
+
let out = null;
|
|
192
|
+
const edit = () => (out ??= { ...result });
|
|
193
|
+
if (Array.isArray(r.content)) {
|
|
194
|
+
let changedAny = false;
|
|
195
|
+
const blocks = r.content.map((block) => {
|
|
196
|
+
const b = block;
|
|
197
|
+
if (!b || b.type !== "text" || typeof b.text !== "string")
|
|
198
|
+
return block;
|
|
199
|
+
const text = b.text;
|
|
200
|
+
const lead = text.trimStart()[0];
|
|
201
|
+
if ((lead !== "{" && lead !== "[") || !FLOAT_RESIDUE.test(text))
|
|
202
|
+
return block;
|
|
203
|
+
try {
|
|
204
|
+
JSON.parse(text);
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
return block;
|
|
208
|
+
}
|
|
209
|
+
const next = cleanResidueInJsonText(text);
|
|
210
|
+
if (next === text)
|
|
211
|
+
return block;
|
|
212
|
+
changedAny = true;
|
|
213
|
+
return { ...block, text: next };
|
|
214
|
+
});
|
|
215
|
+
if (changedAny)
|
|
216
|
+
edit().content = blocks;
|
|
217
|
+
}
|
|
218
|
+
if (r.structuredContent && typeof r.structuredContent === "object") {
|
|
219
|
+
let serialized;
|
|
220
|
+
try {
|
|
221
|
+
serialized = JSON.stringify(r.structuredContent);
|
|
222
|
+
}
|
|
223
|
+
catch {
|
|
224
|
+
serialized = undefined;
|
|
225
|
+
}
|
|
226
|
+
if (serialized && FLOAT_RESIDUE.test(serialized)) {
|
|
227
|
+
edit().structuredContent = cleanDeep(r.structuredContent);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return out ?? result;
|
|
231
|
+
}
|
|
45
232
|
/** Red-zone denial is opt-in; see the module comment for why. */
|
|
46
233
|
function redZoneEnforced() {
|
|
47
234
|
return process.env.CBROWSER_ENFORCE_RED_ZONE === "true" || process.env.CBROWSER_ENFORCE_RED_ZONE === "1";
|
|
@@ -107,7 +294,10 @@ export function applySecurityLayer(server, opts) {
|
|
|
107
294
|
}],
|
|
108
295
|
};
|
|
109
296
|
}
|
|
110
|
-
|
|
297
|
+
const result = await handler(...args);
|
|
298
|
+
// Residue is removed from cbrowser's own computed analysis only, never
|
|
299
|
+
// from page data. See isComputedAnalysisTool and cleanFloatResidue.
|
|
300
|
+
return isComputedAnalysisTool(name) ? cleanFloatResidue(result) : result;
|
|
111
301
|
};
|
|
112
302
|
// Audit wraps the outermost call so a zone refusal is recorded too.
|
|
113
303
|
// wrapToolHandler calls handler(params) with one argument; MCP passes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-layer.js","sourceRoot":"","sources":["../../src/mcp-tools/security-layer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,O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AC,CAAC,CAAC,CAAE,WAAyC,EAAE,WAAW,CAAC,CAAC;YAC5G,MAAM,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;YACvB,IAAI,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,OAAuC,CAAC,CAAC;YACzE,OAAO,YAAY,CAAC,GAAG,IAAI,CAAC,CAAC;QAC/B,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CBrowser - Cognitive Browser Automation
|
|
3
|
+
* Copyright 2026 Alexandria Eden alexandria.shai.eden@gmail.com
|
|
4
|
+
* Learn more at https://cbrowser.ai - MIT License
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A plain-language message for a navigation error, or null when the error is
|
|
8
|
+
* not one of the known net:: failures (the caller then keeps the original).
|
|
9
|
+
*
|
|
10
|
+
* The message names the host, says what to check, says nothing was loaded,
|
|
11
|
+
* and ends with the net:: code in parentheses for anyone searching it. The
|
|
12
|
+
* Playwright "Call log" is dropped.
|
|
13
|
+
*/
|
|
14
|
+
export declare function describeNavigationError(message: string, url: string): string | null;
|
|
15
|
+
/**
|
|
16
|
+
* The error to throw for a failed navigation: a new Error carrying
|
|
17
|
+
* describeNavigationError's message when the failure is a known net:: code,
|
|
18
|
+
* otherwise the original error unchanged.
|
|
19
|
+
*/
|
|
20
|
+
export declare function navigationError(error: unknown, url: string): unknown;
|
|
21
|
+
//# sourceMappingURL=navigation-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-errors.d.ts","sourceRoot":"","sources":["../src/navigation-errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkFH;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMnF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAIpE"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CBrowser - Cognitive Browser Automation
|
|
3
|
+
* Copyright 2026 Alexandria Eden alexandria.shai.eden@gmail.com
|
|
4
|
+
* Learn more at https://cbrowser.ai - MIT License
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Plain-language messages for navigation failures.
|
|
8
|
+
*
|
|
9
|
+
* Reported: navigate("https://cbrowser.ai.invalid/") returned Playwright's raw
|
|
10
|
+
* error,
|
|
11
|
+
*
|
|
12
|
+
* page.goto: net::ERR_NAME_NOT_RESOLVED at https://cbrowser.ai.invalid/
|
|
13
|
+
* Call log:
|
|
14
|
+
* - navigating to "https://cbrowser.ai.invalid/", waiting until "load"
|
|
15
|
+
*
|
|
16
|
+
* which says what Chromium did, not what the caller should do, and carries a
|
|
17
|
+
* Call log that is noise to anyone but a Playwright maintainer. navigate()
|
|
18
|
+
* mapped only the proxy errors (ERR_TUNNEL / ERR_PROXY / ERR_NETWORK_CHANGED)
|
|
19
|
+
* and rethrew everything else as is.
|
|
20
|
+
*
|
|
21
|
+
* Pure: no browser, no Playwright import, so any module that calls page.goto
|
|
22
|
+
* can use it.
|
|
23
|
+
*/
|
|
24
|
+
/** net:: codes mapped to a sentence about the host. `{host}` is filled in. */
|
|
25
|
+
const NET_ERRORS = [
|
|
26
|
+
{
|
|
27
|
+
code: /^ERR_NAME_NOT_RESOLVED$/,
|
|
28
|
+
describe: (host) => `Could not resolve host ${host}. Check the URL spelling or network access. Nothing was loaded.`,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
code: /^ERR_CONNECTION_REFUSED$/,
|
|
32
|
+
describe: (host) => `Connection to ${host} was refused: nothing is listening there, or a firewall rejected it. Check the address and port. Nothing was loaded.`,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
code: /^ERR_(CONNECTION_)?TIMED_OUT$/,
|
|
36
|
+
describe: (host) => `Connection to ${host} timed out: the host did not answer. Check the address and network access. Nothing was loaded.`,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
code: /^ERR_ADDRESS_UNREACHABLE$/,
|
|
40
|
+
describe: (host) => `Host ${host} is unreachable from this machine (no route to it). Check the address and network access. Nothing was loaded.`,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
code: /^ERR_INTERNET_DISCONNECTED$/,
|
|
44
|
+
describe: (host) => `No network connection: could not reach ${host}. Nothing was loaded.`,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
code: /^ERR_(CONNECTION_RESET|CONNECTION_CLOSED|EMPTY_RESPONSE)$/,
|
|
48
|
+
describe: (host) => `${host} closed the connection without sending a page. The server may be down or rejecting this client. Nothing was loaded.`,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
code: /^ERR_CERT_[A-Z_]+$/,
|
|
52
|
+
describe: (host, code) => `The TLS certificate for ${host} was rejected (${certReason(code)}). Nothing was loaded.`,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
code: /^ERR_SSL_[A-Z_]+$/,
|
|
56
|
+
describe: (host) => `A secure (TLS) connection to ${host} could not be established. Nothing was loaded.`,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
code: /^ERR_TOO_MANY_REDIRECTS$/,
|
|
60
|
+
describe: (host) => `${host} redirected too many times (a redirect loop). Nothing was loaded.`,
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
function certReason(code) {
|
|
64
|
+
if (code === "ERR_CERT_DATE_INVALID")
|
|
65
|
+
return "expired or not yet valid";
|
|
66
|
+
if (code === "ERR_CERT_COMMON_NAME_INVALID")
|
|
67
|
+
return "issued for a different host name";
|
|
68
|
+
if (code === "ERR_CERT_AUTHORITY_INVALID")
|
|
69
|
+
return "issued by an untrusted authority, for example self-signed";
|
|
70
|
+
if (code === "ERR_CERT_REVOKED")
|
|
71
|
+
return "revoked";
|
|
72
|
+
return "invalid";
|
|
73
|
+
}
|
|
74
|
+
/** host[:port] of `url`, or the url itself when it does not parse. */
|
|
75
|
+
function hostOf(url, message) {
|
|
76
|
+
try {
|
|
77
|
+
return new URL(url).host || url;
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
const at = message.match(/ at (\S+)/)?.[1];
|
|
81
|
+
if (at) {
|
|
82
|
+
try {
|
|
83
|
+
return new URL(at).host || at;
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return at;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return url;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A plain-language message for a navigation error, or null when the error is
|
|
94
|
+
* not one of the known net:: failures (the caller then keeps the original).
|
|
95
|
+
*
|
|
96
|
+
* The message names the host, says what to check, says nothing was loaded,
|
|
97
|
+
* and ends with the net:: code in parentheses for anyone searching it. The
|
|
98
|
+
* Playwright "Call log" is dropped.
|
|
99
|
+
*/
|
|
100
|
+
export function describeNavigationError(message, url) {
|
|
101
|
+
const code = message.match(/net::(ERR_[A-Z_]+)/)?.[1];
|
|
102
|
+
if (!code)
|
|
103
|
+
return null;
|
|
104
|
+
const entry = NET_ERRORS.find((e) => e.code.test(code));
|
|
105
|
+
if (!entry)
|
|
106
|
+
return null;
|
|
107
|
+
return `${entry.describe(hostOf(url, message), code)} (net::${code})`;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The error to throw for a failed navigation: a new Error carrying
|
|
111
|
+
* describeNavigationError's message when the failure is a known net:: code,
|
|
112
|
+
* otherwise the original error unchanged.
|
|
113
|
+
*/
|
|
114
|
+
export function navigationError(error, url) {
|
|
115
|
+
const message = error instanceof Error ? error.message : String(error ?? "");
|
|
116
|
+
const described = describeNavigationError(message, url);
|
|
117
|
+
return described ? new Error(described) : error;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=navigation-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-errors.js","sourceRoot":"","sources":["../src/navigation-errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAEH,8EAA8E;AAC9E,MAAM,UAAU,GAA8E;IAC5F;QACE,IAAI,EAAE,yBAAyB;QAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,0BAA0B,IAAI,iEAAiE;KACpH;IACD;QACE,IAAI,EAAE,0BAA0B;QAChC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,IAAI,sHAAsH;KAChK;IACD;QACE,IAAI,EAAE,+BAA+B;QACrC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,IAAI,gGAAgG;KAC1I;IACD;QACE,IAAI,EAAE,2BAA2B;QACjC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,IAAI,+GAA+G;KAChJ;IACD;QACE,IAAI,EAAE,6BAA6B;QACnC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,0CAA0C,IAAI,uBAAuB;KAC1F;IACD;QACE,IAAI,EAAE,2DAA2D;QACjE,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,qHAAqH;KACjJ;IACD;QACE,IAAI,EAAE,oBAAoB;QAC1B,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,2BAA2B,IAAI,kBAAkB,UAAU,CAAC,IAAI,CAAC,wBAAwB;KACpH;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,gCAAgC,IAAI,gDAAgD;KACzG;IACD;QACE,IAAI,EAAE,0BAA0B;QAChC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,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O,IAAI,CAAC;IACxB,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,UAAU,IAAI,GAAG,CAAC;AACxE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc,EAAE,GAAW;IACzD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAC7E,MAAM,SAAS,GAAG,uBAAuB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACxD,OAAO,SAAS,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAClD,CAAC"}
|
package/dist/personas.d.ts
CHANGED
|
@@ -204,6 +204,11 @@ export declare function suggestPersonaNames(requested: string, limit?: number):
|
|
|
204
204
|
* known name is not defining a persona, it is a typo. (2026-08-02)
|
|
205
205
|
*/
|
|
206
206
|
export declare function resolvePersonaOrThrow(name: string, syntheticTraits?: Record<string, number> | undefined): Persona | AccessibilityPersona | AgentPersona;
|
|
207
|
+
/**
|
|
208
|
+
* Shorthand -> roster name, shared by every persona-accepting tool.
|
|
209
|
+
* v14.2.5: Added elderly-user mapping (issue #190 - persona dropout)
|
|
210
|
+
*/
|
|
211
|
+
export declare const PERSONA_ALIASES: Record<string, string>;
|
|
207
212
|
/**
|
|
208
213
|
* Resolve a persona name for a measuring tool, or refuse - the one resolver.
|
|
209
214
|
*
|
|
@@ -219,7 +224,7 @@ export declare function resolvePersonaOrThrow(name: string, syntheticTraits?: Re
|
|
|
219
224
|
* When the name that measured differs from the one asked for, `resolvedFrom`
|
|
220
225
|
* says so; a silent substitution reads as the requested persona's result.
|
|
221
226
|
*/
|
|
222
|
-
export declare function resolvePersonaForTool(requested: string, aliases?: Record<string, string
|
|
227
|
+
export declare function resolvePersonaForTool(requested: string, aliases?: Record<string, string>, aliasFirst?: boolean): {
|
|
223
228
|
name: string;
|
|
224
229
|
persona: Persona | AccessibilityPersona | AgentPersona;
|
|
225
230
|
resolvedFrom?: string;
|
package/dist/personas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"personas.d.ts","sourceRoot":"","sources":["../src/personas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEpI,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAwD/H,wFAAwF;AACxF,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,CAIpF;AAiCD,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA+D5D;AAED;;GAEG;AACH;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS;IAAE,eAAe,CAAC,EAAE,eAAe,CAAA;CAAE,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAMrG;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAM1D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAwBzD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD;AAwBD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAoCxF;AAED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;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GACnD,OAAO,GAAG,oBAAoB,GAAG,YAAY,CAO/C;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAoClD,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAmB,EACjD,UAAU,UAAQ,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,GAAG,oBAAoB,GAAG,YAAY,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAYjG;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAOpE;AAED,wBAAgB,eAAe,IAAI,MAAM,EAAE,CAW1C;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,CAI1D;AAOD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,CAAC"}
|
package/dist/personas.js
CHANGED
|
@@ -3485,6 +3485,47 @@ export function resolvePersonaOrThrow(name, syntheticTraits) {
|
|
|
3485
3485
|
}
|
|
3486
3486
|
throw new UnknownPersonaError(name, suggestPersonaNames(name));
|
|
3487
3487
|
}
|
|
3488
|
+
/**
|
|
3489
|
+
* Shorthand -> roster name, shared by every persona-accepting tool.
|
|
3490
|
+
* v14.2.5: Added elderly-user mapping (issue #190 - persona dropout)
|
|
3491
|
+
*/
|
|
3492
|
+
export const PERSONA_ALIASES = {
|
|
3493
|
+
"motor-tremor": "motor-impairment-tremor",
|
|
3494
|
+
"motor": "motor-impairment-tremor",
|
|
3495
|
+
"tremor": "motor-impairment-tremor",
|
|
3496
|
+
"low-vision": "low-vision-magnified",
|
|
3497
|
+
"vision": "low-vision-magnified",
|
|
3498
|
+
"magnified": "low-vision-magnified",
|
|
3499
|
+
"adhd": "cognitive-adhd",
|
|
3500
|
+
"cognitive": "cognitive-adhd",
|
|
3501
|
+
"attention": "cognitive-adhd",
|
|
3502
|
+
"dyslexia": "dyslexic-user",
|
|
3503
|
+
"dyslexic": "dyslexic-user",
|
|
3504
|
+
"reading": "dyslexic-user",
|
|
3505
|
+
"deaf": "deaf-user",
|
|
3506
|
+
"hearing": "deaf-user",
|
|
3507
|
+
"elderly": "elderly-low-vision",
|
|
3508
|
+
"elderly-user": "elderly-low-vision", // v14.2.5: Added missing mapping
|
|
3509
|
+
"elderly-low-vision": "elderly-low-vision",
|
|
3510
|
+
"senior": "elderly-low-vision",
|
|
3511
|
+
"old": "elderly-low-vision", // v14.2.5: Additional synonym
|
|
3512
|
+
"color-blind": "color-blind-deuteranopia",
|
|
3513
|
+
"colorblind": "color-blind-deuteranopia",
|
|
3514
|
+
"deuteranopia": "color-blind-deuteranopia",
|
|
3515
|
+
// v18.35.0: New research-backed cognitive disability personas
|
|
3516
|
+
"autism": "autism-spectrum",
|
|
3517
|
+
"autistic": "autism-spectrum",
|
|
3518
|
+
"asd": "autism-spectrum",
|
|
3519
|
+
"autism-spectrum": "autism-spectrum",
|
|
3520
|
+
"intellectual-disability": "intellectual-disability",
|
|
3521
|
+
"intellectual": "intellectual-disability",
|
|
3522
|
+
"learning-disability": "intellectual-disability",
|
|
3523
|
+
"aphasia": "aphasia-receptive",
|
|
3524
|
+
"aphasia-receptive": "aphasia-receptive",
|
|
3525
|
+
"wernicke": "aphasia-receptive",
|
|
3526
|
+
"dyscalculia": "dyscalculia",
|
|
3527
|
+
"numeracy": "dyscalculia",
|
|
3528
|
+
};
|
|
3488
3529
|
/**
|
|
3489
3530
|
* Resolve a persona name for a measuring tool, or refuse - the one resolver.
|
|
3490
3531
|
*
|
|
@@ -3500,8 +3541,14 @@ export function resolvePersonaOrThrow(name, syntheticTraits) {
|
|
|
3500
3541
|
* When the name that measured differs from the one asked for, `resolvedFrom`
|
|
3501
3542
|
* says so; a silent substitution reads as the requested persona's result.
|
|
3502
3543
|
*/
|
|
3503
|
-
export function resolvePersonaForTool(requested, aliases) {
|
|
3504
|
-
|
|
3544
|
+
export function resolvePersonaForTool(requested, aliases = PERSONA_ALIASES, aliasFirst = false) {
|
|
3545
|
+
// One alias table for every tool: "motor-tremor" resolved in empathy_audit
|
|
3546
|
+
// and was refused by attention_analysis (report v2). Aliases are a FALLBACK by
|
|
3547
|
+
// default, so an exact roster name always wins; empathy_audit passes
|
|
3548
|
+
// aliasFirst because its table deliberately maps elderly-user to the
|
|
3549
|
+
// elderly-low-vision accessibility persona. (2026-10-09)
|
|
3550
|
+
const alias = aliases[requested.toLowerCase()];
|
|
3551
|
+
const aliased = alias && (aliasFirst || !getAnyPersona(requested)) ? alias : requested;
|
|
3505
3552
|
const persona = getAnyPersona(aliased);
|
|
3506
3553
|
if (!persona)
|
|
3507
3554
|
throw new UnknownPersonaError(requested, suggestPersonaNames(requested));
|