@cloakapi/sdk 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +4 -4
- package/dist/browser/index.d.mts +98 -89
- package/dist/browser/index.d.ts +98 -89
- package/dist/browser/index.js +1245 -123
- package/dist/browser/index.mjs +19 -4
- package/dist/browser/light.d.mts +2 -2
- package/dist/browser/light.d.ts +2 -2
- package/dist/browser/light.js +1 -1
- package/dist/browser/light.mjs +17 -2
- package/dist/browser/ner-pipeline-worker.mjs +1 -1
- package/dist/{chunk-6JZLCPZ7.mjs → chunk-3MXGO6NA.mjs} +11 -7
- package/dist/{chunk-EY35G37A.mjs → chunk-746IWCJ4.mjs} +224 -1
- package/dist/{chunk-JCTZ572R.mjs → chunk-TRWGRB2P.mjs} +1 -1
- package/dist/chunk-TWAQCP3Z.mjs +1258 -0
- package/dist/{chunk-7OIXV4CE.mjs → chunk-VYGV643D.mjs} +242 -104
- package/dist/device/index.d.mts +1 -1
- package/dist/device/index.d.ts +1 -1
- package/dist/device/index.mjs +7 -1251
- package/dist/{disclosure-Cslh-RaS.d.mts → disclosure-BhM2Aqa2.d.mts} +1 -1
- package/dist/{disclosure-Cslh-RaS.d.ts → disclosure-BhM2Aqa2.d.ts} +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/node.d.mts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +311 -58
- package/dist/node.mjs +11 -6
- package/package.json +1 -1
|
@@ -29,10 +29,13 @@ import {
|
|
|
29
29
|
warningsForResidual
|
|
30
30
|
} from "./chunk-6E6T2YO5.mjs";
|
|
31
31
|
import {
|
|
32
|
+
applyPrivacyModeRewrite,
|
|
32
33
|
bindFullBrowserModule,
|
|
33
34
|
canonicalise,
|
|
35
|
+
copyPrivacyLedger,
|
|
36
|
+
privacyLedgerFor,
|
|
34
37
|
privacyPosture
|
|
35
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-746IWCJ4.mjs";
|
|
36
39
|
import {
|
|
37
40
|
DEFAULT_SURROGATE_MODE,
|
|
38
41
|
RULESET_HASH,
|
|
@@ -40,7 +43,7 @@ import {
|
|
|
40
43
|
disclosureText,
|
|
41
44
|
resolveSurrogateMode,
|
|
42
45
|
withDisclosure
|
|
43
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-TRWGRB2P.mjs";
|
|
44
47
|
import {
|
|
45
48
|
abortEnhancedNerLoad,
|
|
46
49
|
detectionLayerReport,
|
|
@@ -49,7 +52,7 @@ import {
|
|
|
49
52
|
resolvePinnedModelMirrorUrl,
|
|
50
53
|
resolveSameOriginMirrorUrl,
|
|
51
54
|
resolveSameOriginWorkerUrl
|
|
52
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-3MXGO6NA.mjs";
|
|
53
56
|
import {
|
|
54
57
|
hasWholeTokenOccurrence,
|
|
55
58
|
indexOfWholeToken,
|
|
@@ -1655,13 +1658,15 @@ function newConversation() {
|
|
|
1655
1658
|
};
|
|
1656
1659
|
}
|
|
1657
1660
|
function cloneConversation(c) {
|
|
1658
|
-
|
|
1661
|
+
const copy = {
|
|
1659
1662
|
seedHex: c.seedHex,
|
|
1660
1663
|
salt: c.salt,
|
|
1661
1664
|
bindings: new Map(c.bindings),
|
|
1662
1665
|
claimed: new Map(c.claimed),
|
|
1663
1666
|
counters: new Map(c.counters)
|
|
1664
1667
|
};
|
|
1668
|
+
copyPrivacyLedger(c, copy);
|
|
1669
|
+
return copy;
|
|
1665
1670
|
}
|
|
1666
1671
|
var MAX_LABELS = Object.freeze({
|
|
1667
1672
|
PERSON: "PERSON",
|
|
@@ -2212,6 +2217,7 @@ var FORMATS = /* @__PURE__ */ new Set([
|
|
|
2212
2217
|
"pdf",
|
|
2213
2218
|
"svg",
|
|
2214
2219
|
"png"
|
|
2220
|
+
// Accepted as a request. The builder may report an SVG substitution.
|
|
2215
2221
|
]);
|
|
2216
2222
|
function isObj(v) {
|
|
2217
2223
|
return !!v && typeof v === "object" && !Array.isArray(v);
|
|
@@ -2643,7 +2649,7 @@ async function buildDocx(spec, bindings, map) {
|
|
|
2643
2649
|
const blocks = spec.blocks && spec.blocks.length ? spec.blocks : [{ type: "table", columns: spec.columns, rows: spec.rows }];
|
|
2644
2650
|
const titleXml = spec.title ? runP(detokeniseString(spec.title, map), { style: "Title", bold: true, size: 20 }) : "";
|
|
2645
2651
|
const body = titleXml + renderBlocks(blocks, bindings, map);
|
|
2646
|
-
const
|
|
2652
|
+
const document2 = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:body>${body}<w:sectPr><w:pgSz w:w="12240" w:h="15840"/><w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440"/></w:sectPr></w:body></w:document>`;
|
|
2647
2653
|
const styles = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:style w:type="paragraph" w:styleId="Title"><w:name w:val="Title"/></w:style><w:style w:type="paragraph" w:styleId="Heading1"><w:name w:val="heading 1"/></w:style><w:style w:type="paragraph" w:styleId="Heading2"><w:name w:val="heading 2"/></w:style><w:style w:type="paragraph" w:styleId="Heading3"><w:name w:val="heading 3"/></w:style></w:styles>`;
|
|
2648
2654
|
const contentTypes = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/></Types>`;
|
|
2649
2655
|
const rootRels = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/></Relationships>`;
|
|
@@ -2651,7 +2657,7 @@ async function buildDocx(spec, bindings, map) {
|
|
|
2651
2657
|
const entries = [
|
|
2652
2658
|
{ path: "[Content_Types].xml", data: contentTypes },
|
|
2653
2659
|
{ path: "_rels/.rels", data: rootRels },
|
|
2654
|
-
{ path: "word/document.xml", data:
|
|
2660
|
+
{ path: "word/document.xml", data: document2 },
|
|
2655
2661
|
{ path: "word/styles.xml", data: styles },
|
|
2656
2662
|
{ path: "word/_rels/document.xml.rels", data: docRels }
|
|
2657
2663
|
];
|
|
@@ -2987,7 +2993,44 @@ function niceMax(v) {
|
|
|
2987
2993
|
const step = norm <= 1 ? 1 : norm <= 2 ? 2 : norm <= 5 ? 5 : 10;
|
|
2988
2994
|
return step * mag;
|
|
2989
2995
|
}
|
|
2996
|
+
var FONT_FAMILY = "system-ui,-apple-system,Segoe UI,Roboto,sans-serif";
|
|
2990
2997
|
function chartToSvg(c, theme = "light") {
|
|
2998
|
+
const { width, height } = c;
|
|
2999
|
+
const parts = [
|
|
3000
|
+
`<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" font-family="${FONT_FAMILY}">`
|
|
3001
|
+
];
|
|
3002
|
+
drawChart(c, theme, {
|
|
3003
|
+
rect(x, y, w, h, fill, radius) {
|
|
3004
|
+
const position = radius === void 0 ? "" : `x="${x}" y="${y}" `;
|
|
3005
|
+
const rounded = radius === void 0 ? "" : ` rx="${radius}"`;
|
|
3006
|
+
parts.push(`<rect ${position}width="${w}" height="${h}"${rounded} fill="${fill}"/>`);
|
|
3007
|
+
},
|
|
3008
|
+
line(x1, y1, x2, y2, stroke) {
|
|
3009
|
+
parts.push(`<line x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" stroke="${stroke}" stroke-width="1"/>`);
|
|
3010
|
+
},
|
|
3011
|
+
text(x, y, text, size, fill, anchor, style) {
|
|
3012
|
+
const alignment = anchor ? ` text-anchor="${anchor}"` : "";
|
|
3013
|
+
const weight = style === "title" ? ' font-weight="600"' : "";
|
|
3014
|
+
const transform = style === "vertical" ? ` transform="rotate(-90 ${x} ${y})"` : "";
|
|
3015
|
+
parts.push(`<text x="${x}" y="${y}" font-size="${size}"${alignment}${weight} fill="${fill}"${transform}>${xmlEscape(text)}</text>`);
|
|
3016
|
+
},
|
|
3017
|
+
circle(x, y, radius, fill, opacity) {
|
|
3018
|
+
const alpha = opacity === void 0 ? "" : ` fill-opacity="${opacity}"`;
|
|
3019
|
+
parts.push(`<circle cx="${x}" cy="${y}" r="${radius}" fill="${fill}"${alpha}/>`);
|
|
3020
|
+
},
|
|
3021
|
+
polyline(points, stroke) {
|
|
3022
|
+
const coordinates = points.map(([x, y]) => `${x},${y}`).join(" ");
|
|
3023
|
+
parts.push(`<polyline points="${coordinates}" fill="none" stroke="${stroke}" stroke-width="2" stroke-linejoin="round" stroke-linecap="round"/>`);
|
|
3024
|
+
},
|
|
3025
|
+
slice(x, y, r, start, end, large, fill, stroke) {
|
|
3026
|
+
const point = (a) => `${(x + r * Math.cos(a)).toFixed(2)} ${(y + r * Math.sin(a)).toFixed(2)}`;
|
|
3027
|
+
parts.push(`<path d="M ${x} ${y} L ${point(start)} A ${r} ${r} 0 ${large} 1 ${point(end)} Z" fill="${fill}" stroke="${stroke}" stroke-width="2"/>`);
|
|
3028
|
+
}
|
|
3029
|
+
});
|
|
3030
|
+
parts.push("</svg>");
|
|
3031
|
+
return parts.join("");
|
|
3032
|
+
}
|
|
3033
|
+
function drawChart(c, theme, drawing) {
|
|
2991
3034
|
const W = c.width;
|
|
2992
3035
|
const H = c.height;
|
|
2993
3036
|
const ink = INK[theme];
|
|
@@ -2998,13 +3041,8 @@ function chartToSvg(c, theme = "light") {
|
|
|
2998
3041
|
const plotH = H - pad.top - pad.bottom - legendH;
|
|
2999
3042
|
const x0 = pad.left;
|
|
3000
3043
|
const y0 = pad.top;
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
`<svg xmlns="http://www.w3.org/2000/svg" width="${W}" height="${H}" viewBox="0 0 ${W} ${H}" font-family="system-ui,-apple-system,Segoe UI,Roboto,sans-serif">`
|
|
3004
|
-
);
|
|
3005
|
-
parts.push(`<rect width="${W}" height="${H}" fill="${surface}"/>`);
|
|
3006
|
-
if (c.title) parts.push(`<text x="${x0}" y="28" font-size="17" font-weight="600" fill="${ink.primary}">${xmlEscape(c.title)}</text>`);
|
|
3007
|
-
const gridLine = (x1, yy1, x2, yy2) => `<line x1="${x1}" y1="${yy1}" x2="${x2}" y2="${yy2}" stroke="${ink.grid}" stroke-width="1"/>`;
|
|
3044
|
+
drawing.rect(0, 0, W, H, surface);
|
|
3045
|
+
if (c.title) drawing.text(x0, 28, c.title, 17, ink.primary, void 0, "title");
|
|
3008
3046
|
if (c.type === "pie") {
|
|
3009
3047
|
const vals = c.series.length ? c.series[0].values : [];
|
|
3010
3048
|
const total = vals.reduce((a, b) => a + Math.max(0, b), 0) || 1;
|
|
@@ -3015,24 +3053,16 @@ function chartToSvg(c, theme = "light") {
|
|
|
3015
3053
|
vals.forEach((v, i) => {
|
|
3016
3054
|
const frac = Math.max(0, v) / total;
|
|
3017
3055
|
const a1 = a0 + frac * 2 * Math.PI;
|
|
3018
|
-
|
|
3019
|
-
const px0 = cx + r * Math.cos(a0);
|
|
3020
|
-
const py0 = cy + r * Math.sin(a0);
|
|
3021
|
-
const px1 = cx + r * Math.cos(a1);
|
|
3022
|
-
const py1 = cy + r * Math.sin(a1);
|
|
3023
|
-
parts.push(
|
|
3024
|
-
`<path d="M ${cx} ${cy} L ${px0.toFixed(2)} ${py0.toFixed(2)} A ${r} ${r} 0 ${large} 1 ${px1.toFixed(2)} ${py1.toFixed(2)} Z" fill="${categorical(i, theme)}" stroke="${surface}" stroke-width="2"/>`
|
|
3025
|
-
);
|
|
3056
|
+
drawing.slice(cx, cy, r, a0, a1, frac > 0.5 ? 1 : 0, categorical(i, theme), surface);
|
|
3026
3057
|
a0 = a1;
|
|
3027
3058
|
});
|
|
3028
3059
|
c.categories.forEach((cat, i) => {
|
|
3029
3060
|
const ly = y0 + plotH + 20 + Math.floor(i / 4) * 18;
|
|
3030
3061
|
const lx = x0 + i % 4 * (plotW / 4);
|
|
3031
|
-
|
|
3032
|
-
|
|
3062
|
+
drawing.rect(lx, ly - 9, 10, 10, categorical(i, theme), 2);
|
|
3063
|
+
drawing.text(lx + 15, ly, cat, 12, ink.secondary);
|
|
3033
3064
|
});
|
|
3034
|
-
|
|
3035
|
-
return parts.join("");
|
|
3065
|
+
return;
|
|
3036
3066
|
}
|
|
3037
3067
|
let maxY = 0;
|
|
3038
3068
|
let minY = 0;
|
|
@@ -3053,11 +3083,11 @@ function chartToSvg(c, theme = "light") {
|
|
|
3053
3083
|
for (let t = 0; t <= 4; t++) {
|
|
3054
3084
|
const val = bottom + span * t / 4;
|
|
3055
3085
|
const py = yToPx(val);
|
|
3056
|
-
|
|
3057
|
-
|
|
3086
|
+
drawing.line(x0, py, x0 + plotW, py, ink.grid);
|
|
3087
|
+
drawing.text(x0 - 8, py + 4, String(Number(val.toFixed(2))), 11, ink.muted, "end");
|
|
3058
3088
|
}
|
|
3059
|
-
|
|
3060
|
-
|
|
3089
|
+
drawing.line(x0, y0, x0, y0 + plotH, ink.axis);
|
|
3090
|
+
drawing.line(x0, yToPx(0), x0 + plotW, yToPx(0), ink.axis);
|
|
3061
3091
|
const cats = c.categories.length ? c.categories : c.series[0]?.values.map((_v, i) => String(i + 1)) ?? [];
|
|
3062
3092
|
if (c.type === "bar") {
|
|
3063
3093
|
const n = cats.length || 1;
|
|
@@ -3073,19 +3103,22 @@ function chartToSvg(c, theme = "light") {
|
|
|
3073
3103
|
const bx = gx + si * barW;
|
|
3074
3104
|
const bh = Math.abs(zeroY - py);
|
|
3075
3105
|
const by = Math.min(py, zeroY);
|
|
3076
|
-
|
|
3106
|
+
drawing.rect(bx.toFixed(1), by.toFixed(1), barW.toFixed(1), bh.toFixed(1), categorical(si, theme), 3);
|
|
3077
3107
|
});
|
|
3078
|
-
|
|
3108
|
+
drawing.text((x0 + ci * groupW + groupW / 2).toFixed(1), y0 + plotH + 16, cat, 11, ink.muted, "middle");
|
|
3079
3109
|
});
|
|
3080
3110
|
} else if (c.type === "line") {
|
|
3081
3111
|
const n = cats.length || 1;
|
|
3082
3112
|
const step = n > 1 ? plotW / (n - 1) : plotW;
|
|
3083
3113
|
c.series.forEach((s, si) => {
|
|
3084
|
-
const
|
|
3085
|
-
|
|
3086
|
-
|
|
3114
|
+
const points = s.values.map((v, i) => [(x0 + i * step).toFixed(1), yToPx(v).toFixed(1)]);
|
|
3115
|
+
const color = categorical(si, theme);
|
|
3116
|
+
drawing.polyline(points, color);
|
|
3117
|
+
points.forEach(([x, y]) => drawing.circle(x, y, 3, color));
|
|
3118
|
+
});
|
|
3119
|
+
cats.forEach((cat, ci) => {
|
|
3120
|
+
drawing.text((x0 + ci * step).toFixed(1), y0 + plotH + 16, cat, 11, ink.muted, "middle");
|
|
3087
3121
|
});
|
|
3088
|
-
cats.forEach((cat, ci) => parts.push(`<text x="${(x0 + ci * step).toFixed(1)}" y="${y0 + plotH + 16}" font-size="11" text-anchor="middle" fill="${ink.muted}">${xmlEscape(cat)}</text>`));
|
|
3089
3122
|
} else if (c.type === "scatter") {
|
|
3090
3123
|
let maxX = 0;
|
|
3091
3124
|
let minX = 0;
|
|
@@ -3098,50 +3131,138 @@ function chartToSvg(c, theme = "light") {
|
|
|
3098
3131
|
const spanX = topX - botX || 1;
|
|
3099
3132
|
const xToPx = (v) => x0 + (v - botX) / spanX * plotW;
|
|
3100
3133
|
c.series.forEach((s, si) => {
|
|
3101
|
-
for (const p of s.points ?? [])
|
|
3134
|
+
for (const p of s.points ?? []) {
|
|
3135
|
+
drawing.circle(xToPx(p.x).toFixed(1), yToPx(p.y).toFixed(1), 4, categorical(si, theme), 0.85);
|
|
3136
|
+
}
|
|
3102
3137
|
});
|
|
3103
3138
|
}
|
|
3104
|
-
if (c.xLabel)
|
|
3105
|
-
if (c.yLabel)
|
|
3139
|
+
if (c.xLabel) drawing.text(x0 + plotW / 2, H - legendH - 8, c.xLabel, 12, ink.secondary, "middle");
|
|
3140
|
+
if (c.yLabel) drawing.text(16, y0 + plotH / 2, c.yLabel, 12, ink.secondary, "middle", "vertical");
|
|
3106
3141
|
if (c.series.length >= 2) {
|
|
3107
3142
|
const ly = H - 10;
|
|
3108
3143
|
let lx = x0;
|
|
3109
3144
|
c.series.forEach((s, si) => {
|
|
3110
|
-
|
|
3111
|
-
|
|
3145
|
+
drawing.rect(lx, ly - 10, 11, 11, categorical(si, theme), 2);
|
|
3146
|
+
drawing.text(lx + 16, ly, s.name, 12, ink.secondary);
|
|
3112
3147
|
lx += 24 + s.name.length * 7.5;
|
|
3113
3148
|
});
|
|
3114
3149
|
}
|
|
3115
|
-
parts.push(`</svg>`);
|
|
3116
|
-
return parts.join("");
|
|
3117
3150
|
}
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3151
|
+
function drawChartOnCanvas(c, theme, ctx) {
|
|
3152
|
+
drawChart(c, theme, {
|
|
3153
|
+
rect(x, y, w, h, fill, radius) {
|
|
3154
|
+
ctx.fillStyle = fill;
|
|
3155
|
+
if (radius === void 0) {
|
|
3156
|
+
ctx.fillRect(Number(x), Number(y), Number(w), Number(h));
|
|
3157
|
+
return;
|
|
3158
|
+
}
|
|
3159
|
+
ctx.beginPath();
|
|
3160
|
+
ctx.roundRect(Number(x), Number(y), Number(w), Number(h), radius);
|
|
3161
|
+
ctx.fill();
|
|
3162
|
+
},
|
|
3163
|
+
line(x1, y1, x2, y2, stroke) {
|
|
3164
|
+
ctx.beginPath();
|
|
3165
|
+
ctx.moveTo(x1, y1);
|
|
3166
|
+
ctx.lineTo(x2, y2);
|
|
3167
|
+
ctx.strokeStyle = stroke;
|
|
3168
|
+
ctx.lineWidth = 1;
|
|
3169
|
+
ctx.stroke();
|
|
3170
|
+
},
|
|
3171
|
+
text(x, y, text, size, fill, anchor = "start", style) {
|
|
3172
|
+
ctx.font = `${style === "title" ? "600 " : ""}${size}px ${FONT_FAMILY}`;
|
|
3173
|
+
ctx.fillStyle = fill;
|
|
3174
|
+
ctx.textAlign = anchor === "middle" ? "center" : anchor === "end" ? "right" : "left";
|
|
3175
|
+
if (style === "vertical") {
|
|
3176
|
+
ctx.save();
|
|
3177
|
+
ctx.translate(Number(x), y);
|
|
3178
|
+
ctx.rotate(-Math.PI / 2);
|
|
3179
|
+
ctx.fillText(text, 0, 0);
|
|
3180
|
+
ctx.restore();
|
|
3181
|
+
} else {
|
|
3182
|
+
ctx.fillText(text, Number(x), y);
|
|
3183
|
+
}
|
|
3184
|
+
},
|
|
3185
|
+
circle(x, y, radius, fill, opacity = 1) {
|
|
3186
|
+
ctx.beginPath();
|
|
3187
|
+
ctx.arc(Number(x), Number(y), radius, 0, 2 * Math.PI);
|
|
3188
|
+
ctx.fillStyle = fill;
|
|
3189
|
+
ctx.globalAlpha = opacity;
|
|
3190
|
+
ctx.fill();
|
|
3191
|
+
ctx.globalAlpha = 1;
|
|
3192
|
+
},
|
|
3193
|
+
polyline(points, stroke) {
|
|
3194
|
+
if (points.length < 2) return;
|
|
3195
|
+
ctx.beginPath();
|
|
3196
|
+
ctx.moveTo(Number(points[0][0]), Number(points[0][1]));
|
|
3197
|
+
for (const [x, y] of points.slice(1)) ctx.lineTo(Number(x), Number(y));
|
|
3198
|
+
ctx.strokeStyle = stroke;
|
|
3199
|
+
ctx.lineWidth = 2;
|
|
3200
|
+
ctx.lineJoin = "round";
|
|
3201
|
+
ctx.lineCap = "round";
|
|
3202
|
+
ctx.stroke();
|
|
3203
|
+
},
|
|
3204
|
+
slice(x, y, radius, start, end, _large, fill, stroke) {
|
|
3205
|
+
if (radius <= 0) return;
|
|
3206
|
+
ctx.beginPath();
|
|
3207
|
+
ctx.moveTo(x, y);
|
|
3208
|
+
ctx.arc(x, y, radius, start, end);
|
|
3209
|
+
ctx.closePath();
|
|
3210
|
+
ctx.fillStyle = fill;
|
|
3211
|
+
ctx.fill();
|
|
3212
|
+
ctx.strokeStyle = stroke;
|
|
3213
|
+
ctx.lineWidth = 2;
|
|
3214
|
+
ctx.stroke();
|
|
3215
|
+
}
|
|
3216
|
+
});
|
|
3217
|
+
}
|
|
3218
|
+
async function chartToPng(c, theme) {
|
|
3219
|
+
const mime = "image/png";
|
|
3220
|
+
try {
|
|
3221
|
+
if (typeof OffscreenCanvas === "function") {
|
|
3222
|
+
const canvas = new OffscreenCanvas(c.width, c.height);
|
|
3223
|
+
const ctx = canvas.getContext("2d");
|
|
3224
|
+
if (ctx) {
|
|
3225
|
+
drawChartOnCanvas(c, theme, ctx);
|
|
3226
|
+
const blob = await canvas.convertToBlob({ type: mime });
|
|
3227
|
+
if (blob.type === mime && blob.size > 0) return new Uint8Array(await blob.arrayBuffer());
|
|
3228
|
+
}
|
|
3229
|
+
}
|
|
3230
|
+
} catch {
|
|
3122
3231
|
}
|
|
3123
3232
|
try {
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3233
|
+
if (typeof document !== "undefined") {
|
|
3234
|
+
const canvas = document.createElement("canvas");
|
|
3235
|
+
canvas.width = c.width;
|
|
3236
|
+
canvas.height = c.height;
|
|
3237
|
+
const ctx = canvas.getContext("2d");
|
|
3238
|
+
if (ctx) {
|
|
3239
|
+
drawChartOnCanvas(c, theme, ctx);
|
|
3240
|
+
const blob = await new Promise((resolve) => canvas.toBlob(resolve, mime));
|
|
3241
|
+
if (blob?.type === mime && blob.size > 0) return new Uint8Array(await blob.arrayBuffer());
|
|
3242
|
+
}
|
|
3243
|
+
}
|
|
3131
3244
|
} catch {
|
|
3132
|
-
return null;
|
|
3133
3245
|
}
|
|
3246
|
+
return null;
|
|
3134
3247
|
}
|
|
3135
3248
|
async function buildChart(spec, bindings, map, theme = "light") {
|
|
3136
3249
|
if (!spec.chart) throw new InterpreterError('chart spec missing "chart".');
|
|
3137
3250
|
const resolved = resolveChart(spec.chart, bindings, map);
|
|
3138
|
-
const svg = chartToSvg(resolved, theme);
|
|
3139
3251
|
if (spec.format === "png") {
|
|
3140
|
-
const png = await
|
|
3252
|
+
const png = await chartToPng(resolved, theme);
|
|
3141
3253
|
if (png) return { name: withExt(spec.filename, "chart", "png"), mime: "image/png", bytes: png };
|
|
3142
|
-
return {
|
|
3254
|
+
return {
|
|
3255
|
+
name: withExt(spec.filename, "chart", "svg"),
|
|
3256
|
+
mime: "image/svg+xml",
|
|
3257
|
+
bytes: utf8(chartToSvg(resolved, theme)),
|
|
3258
|
+
formatSubstitution: { requested: "png", actual: "svg", reason: "png-rendering-unavailable" }
|
|
3259
|
+
};
|
|
3143
3260
|
}
|
|
3144
|
-
return {
|
|
3261
|
+
return {
|
|
3262
|
+
name: withExt(spec.filename, "chart", "svg"),
|
|
3263
|
+
mime: "image/svg+xml",
|
|
3264
|
+
bytes: utf8(chartToSvg(resolved, theme))
|
|
3265
|
+
};
|
|
3145
3266
|
}
|
|
3146
3267
|
|
|
3147
3268
|
// src/browser/code-interpreter/make-file.ts
|
|
@@ -3211,6 +3332,8 @@ Supported \`format\`: "csv", "json", "xlsx", "docx", "pdf", "svg", "png".
|
|
|
3211
3332
|
{type:"list",ordered?,items}, {type:"table",columns?,rows} ] }.
|
|
3212
3333
|
- svg/png charts: { chart: { type:"bar"|"line"|"scatter"|"pie", title?, categories?,
|
|
3213
3334
|
series:[{name,values}] , xLabel?, yLabel? } }.
|
|
3335
|
+
PNG requires working canvas encoding. The result contains an SVG with
|
|
3336
|
+
\`formatSubstitution\` set if PNG cannot be encoded; use the returned format in the UI.
|
|
3214
3337
|
- Multiple files at once: { "files": [ <spec>, <spec>, ... ] } \u2014 the user gets each
|
|
3215
3338
|
file plus a "download all as zip".
|
|
3216
3339
|
|
|
@@ -3220,12 +3343,12 @@ product's chart palette automatically.
|
|
|
3220
3343
|
|
|
3221
3344
|
## Full-power file building (\`run_python\`)
|
|
3222
3345
|
|
|
3223
|
-
When a request genuinely needs
|
|
3224
|
-
|
|
3346
|
+
When a request genuinely needs pandas / numpy / matplotlib / openpyxl / Pillow
|
|
3347
|
+
capabilities that the declarative \`make_file\` tool can't cleanly
|
|
3225
3348
|
express (real dataframe transforms, statistical work, styled matplotlib figures,
|
|
3226
3349
|
multi-sheet workbooks with formulas), emit a \`run_python\` artifact whose body is
|
|
3227
|
-
Python source. It runs ON THE USER'S DEVICE in a Web Worker that blocks
|
|
3228
|
-
requests and permits app-origin mirror loads; write output files to the \`/out\` directory \u2014 every file there is
|
|
3350
|
+
Python source. It runs ON THE USER'S DEVICE in a Web Worker that blocks covered
|
|
3351
|
+
off-origin requests and permits app-origin mirror loads; write output files to the \`/out\` directory \u2014 every file there is
|
|
3229
3352
|
offered to the user as a local download.
|
|
3230
3353
|
|
|
3231
3354
|
<artifact identifier="tco" type="run_python" title="TCO comparison">
|
|
@@ -3240,8 +3363,8 @@ named handle \`INPUT_ROWS\` / \`INPUT_TABLE\` / \`INPUT_TEXT\` (injected as real
|
|
|
3240
3363
|
Python objects on the device) or by the tokenised surrogates you saw \u2014 NEVER by a
|
|
3241
3364
|
real value you guessed. Write results to \`/out/\u2026\`; multiple files there all
|
|
3242
3365
|
download (plus a "download all as zip"). Available packages: pandas, numpy,
|
|
3243
|
-
matplotlib, openpyxl, python-docx, Pillow, lxml (
|
|
3244
|
-
|
|
3366
|
+
matplotlib, openpyxl, python-docx, Pillow, lxml (preloaded from the app's pinned
|
|
3367
|
+
mirror when the worker starts; do NOT pip-install or fetch other packages). For PDF
|
|
3245
3368
|
output, prefer the \`make_file\` PDF builder. PREFER
|
|
3246
3369
|
\`make_file\` for ordinary tabular / document / standard-chart
|
|
3247
3370
|
outputs; reach for \`run_python\` only when the transformation truly needs Python.
|
|
@@ -3317,6 +3440,7 @@ function wheelUrl(handle, mirrorBase = DEFAULT_MIRROR_BASE) {
|
|
|
3317
3440
|
function installNoNetworkGuard(scope, options) {
|
|
3318
3441
|
const selfOrigin = options.selfOrigin;
|
|
3319
3442
|
const allowSameOrigin = options.allowSameOrigin !== false;
|
|
3443
|
+
const mirrorPathPrefixes = options.mirrorPathPrefixes ?? ["/pyodide/", "/models/", "/vendor/transformers/"];
|
|
3320
3444
|
class NetworkBlockedError extends Error {
|
|
3321
3445
|
constructor(_target) {
|
|
3322
3446
|
super("Off-origin request blocked in the on-device code sandbox by the worker guard.");
|
|
@@ -3334,13 +3458,13 @@ function installNoNetworkGuard(scope, options) {
|
|
|
3334
3458
|
return "";
|
|
3335
3459
|
}
|
|
3336
3460
|
};
|
|
3337
|
-
const
|
|
3461
|
+
const resolveMirrorRead = (raw, method, body, headers) => {
|
|
3338
3462
|
if (!allowSameOrigin || String(method ?? "GET").toUpperCase() !== "GET" || body !== void 0 && body !== null) {
|
|
3339
|
-
return
|
|
3463
|
+
return null;
|
|
3340
3464
|
}
|
|
3341
3465
|
if (headers !== void 0 && headers !== null) {
|
|
3342
3466
|
if (Array.isArray(headers)) {
|
|
3343
|
-
if (headers.length > 0) return
|
|
3467
|
+
if (headers.length > 0) return null;
|
|
3344
3468
|
} else if (typeof headers === "object") {
|
|
3345
3469
|
const headerObject = headers;
|
|
3346
3470
|
if (typeof headerObject.forEach === "function") {
|
|
@@ -3348,23 +3472,21 @@ function installNoNetworkGuard(scope, options) {
|
|
|
3348
3472
|
headerObject.forEach(() => {
|
|
3349
3473
|
count += 1;
|
|
3350
3474
|
});
|
|
3351
|
-
if (count > 0) return
|
|
3475
|
+
if (count > 0) return null;
|
|
3352
3476
|
} else if (Object.keys(headers).length > 0) {
|
|
3353
|
-
return
|
|
3477
|
+
return null;
|
|
3354
3478
|
}
|
|
3355
3479
|
} else {
|
|
3356
|
-
return
|
|
3480
|
+
return null;
|
|
3357
3481
|
}
|
|
3358
3482
|
}
|
|
3359
3483
|
try {
|
|
3360
3484
|
const resolved = new URL((raw || "").trim(), selfOrigin);
|
|
3361
3485
|
const path = resolved.pathname;
|
|
3362
|
-
if (resolved.protocol !== "http:" && resolved.protocol !== "https:" || resolved.origin !== selfOrigin || resolved.username !== "" || resolved.password !== "" || resolved.
|
|
3363
|
-
return
|
|
3364
|
-
(prefix) => path.startsWith(prefix)
|
|
3365
|
-
);
|
|
3486
|
+
if (resolved.protocol !== "http:" && resolved.protocol !== "https:" || resolved.origin !== selfOrigin || resolved.username !== "" || resolved.password !== "" || resolved.href !== resolved.origin + path || path.includes("%") || path.includes("\\") || path.split("/").some((part) => part === "." || part === "..")) return null;
|
|
3487
|
+
return mirrorPathPrefixes.some((prefix) => path.startsWith(prefix)) ? resolved.href : null;
|
|
3366
3488
|
} catch {
|
|
3367
|
-
return
|
|
3489
|
+
return null;
|
|
3368
3490
|
}
|
|
3369
3491
|
};
|
|
3370
3492
|
const originalFetch = typeof scope.fetch === "function" ? scope.fetch : void 0;
|
|
@@ -3375,9 +3497,17 @@ function installNoNetworkGuard(scope, options) {
|
|
|
3375
3497
|
const method = options2.method ?? request?.method ?? "GET";
|
|
3376
3498
|
const body = options2.body ?? request?.body;
|
|
3377
3499
|
const headers = options2.headers ?? request?.headers;
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3500
|
+
const url = resolveMirrorRead(target, method, body, headers);
|
|
3501
|
+
if (originalFetch && url) {
|
|
3502
|
+
const safeOptions = {
|
|
3503
|
+
integrity: options2.integrity ?? request?.integrity,
|
|
3504
|
+
signal: options2.signal ?? request?.signal,
|
|
3505
|
+
cache: options2.cache ?? request?.cache,
|
|
3506
|
+
credentials: "omit",
|
|
3507
|
+
redirect: "error",
|
|
3508
|
+
referrerPolicy: "no-referrer"
|
|
3509
|
+
};
|
|
3510
|
+
return Promise.resolve(originalFetch.call(scope, url, safeOptions));
|
|
3381
3511
|
}
|
|
3382
3512
|
return Promise.reject(new NetworkBlockedError(target));
|
|
3383
3513
|
};
|
|
@@ -3407,12 +3537,13 @@ function installNoNetworkGuard(scope, options) {
|
|
|
3407
3537
|
const realImport = typeof scope.importScripts === "function" ? scope.importScripts : void 0;
|
|
3408
3538
|
if (realImport) {
|
|
3409
3539
|
scope.importScripts = function guardedImportScripts(...urls) {
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3540
|
+
const safeUrls = urls.map((value) => {
|
|
3541
|
+
const raw = urlOf(value);
|
|
3542
|
+
const url = resolveMirrorRead(raw, "GET", void 0, void 0);
|
|
3543
|
+
if (!url) throw new NetworkBlockedError(raw);
|
|
3544
|
+
return url;
|
|
3545
|
+
});
|
|
3546
|
+
return realImport.apply(scope, safeUrls);
|
|
3416
3547
|
};
|
|
3417
3548
|
}
|
|
3418
3549
|
}
|
|
@@ -3425,7 +3556,10 @@ function buildPyodideWorkerSource(guardSource = NETWORK_GUARD_SOURCE) {
|
|
|
3425
3556
|
'use strict';
|
|
3426
3557
|
|
|
3427
3558
|
/* [1] WORKER GUARD FIRST \u2014 before Pyodide, before any model code. */
|
|
3428
|
-
(${guardSource})(self, {
|
|
3559
|
+
(${guardSource})(self, {
|
|
3560
|
+
selfOrigin: self.location.origin, allowSameOrigin: true,
|
|
3561
|
+
mirrorPathPrefixes: ['/pyodide/v${PYODIDE_VERSION}/']
|
|
3562
|
+
});
|
|
3429
3563
|
|
|
3430
3564
|
var validatePyodideIndexUrl = (${mirrorUrlGuard});
|
|
3431
3565
|
|
|
@@ -3480,7 +3614,7 @@ var pyodideReady = null;
|
|
|
3480
3614
|
function ensurePyodide(indexURL, packages, wheels) {
|
|
3481
3615
|
if (pyodideReady) return pyodideReady;
|
|
3482
3616
|
pyodideReady = (async function () {
|
|
3483
|
-
progress('runtime', 'Loading the on-device Python runtime
|
|
3617
|
+
progress('runtime', 'Loading the on-device Python runtime\u2026');
|
|
3484
3618
|
/* importScripts bypasses fetch wrappers: pin its exact origin and version. */
|
|
3485
3619
|
var safeIndexURL = validatePyodideIndexUrl(indexURL, self.location.origin, '${PYODIDE_VERSION}');
|
|
3486
3620
|
self.importScripts(safeIndexURL + 'pyodide.js');
|
|
@@ -3883,27 +4017,27 @@ function fileEgressOf(receipt) {
|
|
|
3883
4017
|
}
|
|
3884
4018
|
|
|
3885
4019
|
// src/browser/code-interpreter/capability.ts
|
|
3886
|
-
var CODE_INTERPRETER_CAPABILITY_LABEL = "Client-side code interpreter \u2014 execution runs on YOUR device. The AI sees tokenised placeholders; your real values are filled in locally. The Python worker blocks off-origin requests and can load packages from your app-origin mirror. This SDK does not measure whether the host app later sends output files. (Local execution, not local inference \u2014 the language model still runs upstream on the tokenised prompt.)";
|
|
4020
|
+
var CODE_INTERPRETER_CAPABILITY_LABEL = "Client-side code interpreter \u2014 execution runs on YOUR device. The AI sees tokenised placeholders; your real values are filled in locally. The Python worker blocks covered off-origin requests and can load packages from your app-origin mirror. This SDK does not measure whether the host app later sends output files. (Local execution, not local inference \u2014 the language model still runs upstream on the tokenised prompt.)";
|
|
3887
4021
|
var CODE_INTERPRETER_TOOLS = [
|
|
3888
4022
|
{
|
|
3889
4023
|
name: "make_file",
|
|
3890
4024
|
execution: "client-side",
|
|
3891
4025
|
title: "Build a file (declarative)",
|
|
3892
4026
|
bodyFormat: "json-spec",
|
|
3893
|
-
description: `Build real files (
|
|
4027
|
+
description: `Build real files (CSV, JSON, XLSX, DOCX, PDF, SVG charts, and PNG charts when canvas encoding is available). A PNG request that cannot be encoded returns SVG with formatSubstitution set. Supports multiple files and "download all as zip") from a declarative JSON spec. The file is built ON THE CALLER'S OWN DEVICE with pure-JS builders \u2014 no code execution on CloakAPI and no network request during this build helper. This SDK does not measure later uploads by the host app. Reference the real data by tokenised surrogate or the named handles INPUT_ROWS / INPUT_TABLE / INPUT_TEXT, never by a real value.`
|
|
3894
4028
|
},
|
|
3895
4029
|
{
|
|
3896
4030
|
name: "run_python",
|
|
3897
4031
|
execution: "client-side",
|
|
3898
4032
|
title: "Build a file (full Python power)",
|
|
3899
4033
|
bodyFormat: "python-source",
|
|
3900
|
-
description: "Run model-emitted Python (pandas/numpy/matplotlib/openpyxl/python-docx/Pillow) ON THE CALLER'S OWN DEVICE, in a Web Worker that blocks off-origin requests, writing output files to /out. Same-origin app-mirror requests can load packages; this SDK does not measure egress or later uploads by the host app. Reference real data only by INPUT_ROWS / INPUT_TABLE / INPUT_TEXT or tokenised surrogates. Prefer make_file for ordinary tabular/document/standard-chart output."
|
|
4034
|
+
description: "Run model-emitted Python (pandas/numpy/matplotlib/openpyxl/python-docx/Pillow) ON THE CALLER'S OWN DEVICE, in a Web Worker that blocks covered off-origin requests, writing output files to /out. Same-origin app-mirror requests can load packages; this SDK does not measure egress or later uploads by the host app. Reference real data only by INPUT_ROWS / INPUT_TABLE / INPUT_TEXT or tokenised surrogates. Prefer make_file for ordinary tabular/document/standard-chart output."
|
|
3901
4035
|
}
|
|
3902
4036
|
];
|
|
3903
4037
|
var HONEST_LIMITS = [
|
|
3904
4038
|
"Local execution is NOT local inference \u2014 the language model still runs upstream on the tokenised prompt.",
|
|
3905
4039
|
"The AI is content-blind, not blind: it sees TOKENISED placeholders, not your real values.",
|
|
3906
|
-
"Egress bytes are not measured. The Python worker blocks off-origin requests
|
|
4040
|
+
"Egress bytes are not measured. The Python worker blocks covered off-origin requests and permits same-origin app-mirror loads; the host app controls later uploads."
|
|
3907
4041
|
];
|
|
3908
4042
|
function formatOf(file) {
|
|
3909
4043
|
const name = String(file?.name ?? "");
|
|
@@ -5402,13 +5536,23 @@ async function createBrowserEngine(options) {
|
|
|
5402
5536
|
structuredMap
|
|
5403
5537
|
)
|
|
5404
5538
|
);
|
|
5405
|
-
const spans = bindConversationSurrogates(detected, conversation, mode, text);
|
|
5539
|
+
const spans = bindConversationSurrogates(detected, conversation, mode === "max" ? "balanced" : mode, text);
|
|
5406
5540
|
const applied = applyReviewDecisions(text, spans, {});
|
|
5407
5541
|
const sealed = lockResidualCardRuns(applied.body, applied.map);
|
|
5408
5542
|
assertNoRawCardLeak(sealed.body);
|
|
5543
|
+
const styled = applyPrivacyModeRewrite(
|
|
5544
|
+
{
|
|
5545
|
+
body: sealed.body,
|
|
5546
|
+
map: sealed.map,
|
|
5547
|
+
spans
|
|
5548
|
+
},
|
|
5549
|
+
mode,
|
|
5550
|
+
privacyLedgerFor(conversation)
|
|
5551
|
+
);
|
|
5552
|
+
assertNoRawCardLeak(styled.body);
|
|
5409
5553
|
return {
|
|
5410
|
-
body:
|
|
5411
|
-
map:
|
|
5554
|
+
body: styled.body,
|
|
5555
|
+
map: styled.map,
|
|
5412
5556
|
// PERSON count is TYPE-based, not source-based: the WASM's title-anchored
|
|
5413
5557
|
// name detector routes some person names through the structured channel, so a
|
|
5414
5558
|
// source-based count under-reports names (the '2 names' ledger defect). Count
|
|
@@ -5476,34 +5620,28 @@ async function createBrowserEngine(options) {
|
|
|
5476
5620
|
structuredMap
|
|
5477
5621
|
)
|
|
5478
5622
|
);
|
|
5479
|
-
const spans = bindConversationSurrogates(detected, conversation, mode, text);
|
|
5623
|
+
const spans = bindConversationSurrogates(detected, conversation, mode === "max" ? "balanced" : mode, text);
|
|
5480
5624
|
const applied = applyReviewDecisions(text, spans, {});
|
|
5481
5625
|
const sealed = lockResidualCardRuns(applied.body, applied.map);
|
|
5482
5626
|
assertNoRawCardLeak(sealed.body);
|
|
5483
|
-
|
|
5627
|
+
const drafted = {
|
|
5484
5628
|
originalText: text,
|
|
5485
5629
|
body: sealed.body,
|
|
5486
5630
|
map: sealed.map,
|
|
5487
5631
|
spans,
|
|
5488
|
-
// PERSON count is TYPE-based, not source-based: the WASM's title-anchored
|
|
5489
|
-
// name detector routes some person names through the structured channel, so a
|
|
5490
|
-
// source-based count under-reports names (the '2 names' ledger defect). Count
|
|
5491
|
-
// every PERSON span; 'structured' is then the non-person remainder (no overlap).
|
|
5492
5632
|
names: spans.filter((s) => s.type === "PERSON").length,
|
|
5493
5633
|
structured: spans.filter((s) => s.type !== "PERSON").length,
|
|
5494
5634
|
engineVersion: identity.version,
|
|
5495
5635
|
engineHash: identity.binaryHash,
|
|
5496
5636
|
coverage: coverageStatusForNer(supplement.ner),
|
|
5497
|
-
// Coverage and processing status are carried on the result so an outcome
|
|
5498
|
-
// can record what ran and whether the local time budget was met.
|
|
5499
5637
|
ner: supplement.ner,
|
|
5500
5638
|
processing: supplement.processing,
|
|
5501
|
-
// REQUIRED: which detection layers were ready when this call ran.
|
|
5502
5639
|
layers: layersAtDetection,
|
|
5503
|
-
// REQUIRED: the style these reviewed surrogates were rendered in, and the
|
|
5504
|
-
// scope over which they are stable.
|
|
5505
5640
|
surrogateMode: { mode, continuity }
|
|
5506
5641
|
};
|
|
5642
|
+
const styled = applyPrivacyModeRewrite(drafted, mode, privacyLedgerFor(conversation));
|
|
5643
|
+
assertNoRawCardLeak(styled.body);
|
|
5644
|
+
return styled;
|
|
5507
5645
|
}
|
|
5508
5646
|
function tokeniseWithReview(text, opts) {
|
|
5509
5647
|
return reviewWithGracefulCards(text, (t) => runReviewPass(t, opts?.avoid, opts));
|
package/dist/device/index.d.mts
CHANGED
|
@@ -422,7 +422,7 @@ declare function recommendedNerThreads(): number;
|
|
|
422
422
|
* Capitalised run or (b) a run of ≥2 NON-LATIN letters. Recall-favouring.
|
|
423
423
|
*/
|
|
424
424
|
declare function looksNameLikely(text: string): boolean;
|
|
425
|
-
/**
|
|
425
|
+
/** Quantized ONNX model plus tokenizer, in bytes, for the UI. The browser can drop the cache, so a later visit may download it again. */
|
|
426
426
|
declare const ENHANCED_NER_MODEL_BYTES = 135000000;
|
|
427
427
|
declare const ENHANCED_NER_MODEL_LABEL = "multilingual name detection";
|
|
428
428
|
/**
|
package/dist/device/index.d.ts
CHANGED
|
@@ -422,7 +422,7 @@ declare function recommendedNerThreads(): number;
|
|
|
422
422
|
* Capitalised run or (b) a run of ≥2 NON-LATIN letters. Recall-favouring.
|
|
423
423
|
*/
|
|
424
424
|
declare function looksNameLikely(text: string): boolean;
|
|
425
|
-
/**
|
|
425
|
+
/** Quantized ONNX model plus tokenizer, in bytes, for the UI. The browser can drop the cache, so a later visit may download it again. */
|
|
426
426
|
declare const ENHANCED_NER_MODEL_BYTES = 135000000;
|
|
427
427
|
declare const ENHANCED_NER_MODEL_LABEL = "multilingual name detection";
|
|
428
428
|
/**
|