@cloakapi/sdk 1.5.0 → 1.6.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 +7 -0
- package/README.md +21 -1
- package/dist/browser/index.d.mts +3 -2
- package/dist/browser/index.d.ts +3 -2
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.mjs +8 -7
- package/dist/browser/light.d.mts +2 -1
- package/dist/browser/light.d.ts +2 -1
- package/dist/browser/light.mjs +1 -1
- package/dist/browser/names/public.mjs +2 -2
- package/dist/browser/ner-pipeline-worker.mjs +3 -3
- package/dist/{chunk-G6TZ6722.mjs → chunk-6E6T2YO5.mjs} +5 -915
- package/dist/{chunk-6TMC2A6M.mjs → chunk-6JZLCPZ7.mjs} +1 -1
- package/dist/{chunk-36BC4GYL.mjs → chunk-7OIXV4CE.mjs} +22 -20
- package/dist/{chunk-JV52VGVZ.mjs → chunk-JCTZ572R.mjs} +1 -1
- package/dist/chunk-L7RLVZMD.mjs +922 -0
- package/dist/device/index.d.mts +1448 -0
- package/dist/device/index.d.ts +1448 -0
- package/dist/device/index.js +4539 -0
- package/dist/device/index.mjs +3706 -0
- package/dist/{disclosure-Cx6xS8Tj.d.mts → disclosure-Cslh-RaS.d.mts} +2 -12
- package/dist/{disclosure-Cx6xS8Tj.d.ts → disclosure-Cslh-RaS.d.ts} +2 -12
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +14 -12
- package/dist/{local-pii-supplement-SUOJZO7X.mjs → local-pii-supplement-5KFFPDDN.mjs} +4 -4
- package/dist/node.d.mts +2 -1
- package/dist/node.d.ts +2 -1
- package/dist/node.mjs +10 -9
- package/dist/request-body-slots-BMShK1YO.d.mts +56 -0
- package/dist/request-body-slots-BMShK1YO.d.ts +56 -0
- package/package.json +9 -2
- package/dist/{chunk-PEDVEDAW.mjs → chunk-66SEKCCN.mjs} +8 -8
|
@@ -147,20 +147,10 @@ declare const MODE_SHARED_NOTE = "Either way, the same detail always maps to the
|
|
|
147
147
|
* desynced (1.1.49 recorded at package 1.1.52); it is now generated, and
|
|
148
148
|
* `version.lockstep.test.ts` fails the suite if it ever drifts again.
|
|
149
149
|
*/
|
|
150
|
-
declare const SDK_VERSION = "1.
|
|
150
|
+
declare const SDK_VERSION = "1.6.0";
|
|
151
151
|
/** Shared patterns semver and SHA-256 identity (R12), generated from the full file. */
|
|
152
152
|
declare const RULESET_VERSION = "1.6.1";
|
|
153
153
|
|
|
154
|
-
/**
|
|
155
|
-
* One reason list for an `unchecked_content` notice.
|
|
156
|
-
* The Node client and the browser relay both use this union.
|
|
157
|
-
*/
|
|
158
|
-
type UncheckedContentReason = 'unverified_script' | 'value_not_replaced' | 'media_not_checked' | 'unrecognised_block';
|
|
159
|
-
interface ValuePlacementWarning {
|
|
160
|
-
reason: Extract<UncheckedContentReason, 'value_not_replaced' | 'media_not_checked' | 'unrecognised_block'>;
|
|
161
|
-
message: string;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
154
|
interface ExactReviewDecision {
|
|
165
155
|
approved: boolean;
|
|
166
156
|
text: string;
|
|
@@ -329,4 +319,4 @@ interface WithDisclosureOptions {
|
|
|
329
319
|
*/
|
|
330
320
|
declare function withDisclosure<T>(input: T, opts?: WithDisclosureOptions): T;
|
|
331
321
|
|
|
332
|
-
export { CLK_DISCLOSURE_TEXT as C, DEFAULT_SURROGATE_MODE as D, type ExactReviewHandler as E, LEGACY_SURROGATE_MODE_ALIASES as L, MODE_COPY as M, type ReviewProcessingStatus as R, type SurrogateMode as S, type
|
|
322
|
+
export { CLK_DISCLOSURE_TEXT as C, DEFAULT_SURROGATE_MODE as D, type ExactReviewHandler as E, LEGACY_SURROGATE_MODE_ALIASES as L, MODE_COPY as M, type ReviewProcessingStatus as R, type SurrogateMode as S, type WithDisclosureOptions as W, type SurrogateModeReport as a, type ExactReviewDecision as b, CLK_DISCLOSURE_TEXT_MESSAGE_SCOPED as c, CLOAK_ANGLE_DISCLOSURE_TEXT as d, CLOAK_ANGLE_DISCLOSURE_TEXT_MESSAGE_SCOPED as e, CLOAK_ANGLE_HEADER as f, CLOAK_ANGLE_HEADER_MESSAGE_SCOPED as g, CONTINUITY_SENTENCE as h, type DisclosureMessage as i, type DisclosureTextOptions as j, MODE_SHARED_NOTE as k, type MarkerFormat as l, RULESET_VERSION as m, SDK_VERSION as n, SURROGATE_MODES as o, type SurrogateContinuity as p, type SurrogateModeCopy as q, SurrogateModeError as r, coerceSurrogateMode as s, detectMarkerFormat as t, disclosureText as u, isSurrogateMode as v, resolveSurrogateMode as w, withDisclosure as x };
|
|
@@ -147,20 +147,10 @@ declare const MODE_SHARED_NOTE = "Either way, the same detail always maps to the
|
|
|
147
147
|
* desynced (1.1.49 recorded at package 1.1.52); it is now generated, and
|
|
148
148
|
* `version.lockstep.test.ts` fails the suite if it ever drifts again.
|
|
149
149
|
*/
|
|
150
|
-
declare const SDK_VERSION = "1.
|
|
150
|
+
declare const SDK_VERSION = "1.6.0";
|
|
151
151
|
/** Shared patterns semver and SHA-256 identity (R12), generated from the full file. */
|
|
152
152
|
declare const RULESET_VERSION = "1.6.1";
|
|
153
153
|
|
|
154
|
-
/**
|
|
155
|
-
* One reason list for an `unchecked_content` notice.
|
|
156
|
-
* The Node client and the browser relay both use this union.
|
|
157
|
-
*/
|
|
158
|
-
type UncheckedContentReason = 'unverified_script' | 'value_not_replaced' | 'media_not_checked' | 'unrecognised_block';
|
|
159
|
-
interface ValuePlacementWarning {
|
|
160
|
-
reason: Extract<UncheckedContentReason, 'value_not_replaced' | 'media_not_checked' | 'unrecognised_block'>;
|
|
161
|
-
message: string;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
154
|
interface ExactReviewDecision {
|
|
165
155
|
approved: boolean;
|
|
166
156
|
text: string;
|
|
@@ -329,4 +319,4 @@ interface WithDisclosureOptions {
|
|
|
329
319
|
*/
|
|
330
320
|
declare function withDisclosure<T>(input: T, opts?: WithDisclosureOptions): T;
|
|
331
321
|
|
|
332
|
-
export { CLK_DISCLOSURE_TEXT as C, DEFAULT_SURROGATE_MODE as D, type ExactReviewHandler as E, LEGACY_SURROGATE_MODE_ALIASES as L, MODE_COPY as M, type ReviewProcessingStatus as R, type SurrogateMode as S, type
|
|
322
|
+
export { CLK_DISCLOSURE_TEXT as C, DEFAULT_SURROGATE_MODE as D, type ExactReviewHandler as E, LEGACY_SURROGATE_MODE_ALIASES as L, MODE_COPY as M, type ReviewProcessingStatus as R, type SurrogateMode as S, type WithDisclosureOptions as W, type SurrogateModeReport as a, type ExactReviewDecision as b, CLK_DISCLOSURE_TEXT_MESSAGE_SCOPED as c, CLOAK_ANGLE_DISCLOSURE_TEXT as d, CLOAK_ANGLE_DISCLOSURE_TEXT_MESSAGE_SCOPED as e, CLOAK_ANGLE_HEADER as f, CLOAK_ANGLE_HEADER_MESSAGE_SCOPED as g, CONTINUITY_SENTENCE as h, type DisclosureMessage as i, type DisclosureTextOptions as j, MODE_SHARED_NOTE as k, type MarkerFormat as l, RULESET_VERSION as m, SDK_VERSION as n, SURROGATE_MODES as o, type SurrogateContinuity as p, type SurrogateModeCopy as q, SurrogateModeError as r, coerceSurrogateMode as s, detectMarkerFormat as t, disclosureText as u, isSurrogateMode as v, resolveSurrogateMode as w, withDisclosure as x };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { inspect } from 'node:util';
|
|
2
2
|
import { C as CoverageStatus } from './coverage-OYGXtboB.mjs';
|
|
3
|
-
import { S as SurrogateMode, a as SurrogateModeReport,
|
|
4
|
-
export { C as CLK_DISCLOSURE_TEXT, c as CLK_DISCLOSURE_TEXT_MESSAGE_SCOPED, d as CLOAK_ANGLE_DISCLOSURE_TEXT, e as CLOAK_ANGLE_DISCLOSURE_TEXT_MESSAGE_SCOPED, f as CLOAK_ANGLE_HEADER, g as CLOAK_ANGLE_HEADER_MESSAGE_SCOPED, h as CONTINUITY_SENTENCE, D as DEFAULT_SURROGATE_MODE, i as DisclosureMessage, j as DisclosureTextOptions, L as LEGACY_SURROGATE_MODE_ALIASES, M as MODE_COPY, k as MODE_SHARED_NOTE, l as MarkerFormat, m as RULESET_VERSION, n as SDK_VERSION, o as SURROGATE_MODES, p as SurrogateContinuity, q as SurrogateModeCopy, r as SurrogateModeError, W as WithDisclosureOptions, s as coerceSurrogateMode, t as detectMarkerFormat, u as disclosureText, v as isSurrogateMode, w as resolveSurrogateMode, x as withDisclosure } from './disclosure-
|
|
3
|
+
import { S as SurrogateMode, a as SurrogateModeReport, E as ExactReviewHandler, R as ReviewProcessingStatus, b as ExactReviewDecision } from './disclosure-Cslh-RaS.mjs';
|
|
4
|
+
export { C as CLK_DISCLOSURE_TEXT, c as CLK_DISCLOSURE_TEXT_MESSAGE_SCOPED, d as CLOAK_ANGLE_DISCLOSURE_TEXT, e as CLOAK_ANGLE_DISCLOSURE_TEXT_MESSAGE_SCOPED, f as CLOAK_ANGLE_HEADER, g as CLOAK_ANGLE_HEADER_MESSAGE_SCOPED, h as CONTINUITY_SENTENCE, D as DEFAULT_SURROGATE_MODE, i as DisclosureMessage, j as DisclosureTextOptions, L as LEGACY_SURROGATE_MODE_ALIASES, M as MODE_COPY, k as MODE_SHARED_NOTE, l as MarkerFormat, m as RULESET_VERSION, n as SDK_VERSION, o as SURROGATE_MODES, p as SurrogateContinuity, q as SurrogateModeCopy, r as SurrogateModeError, W as WithDisclosureOptions, s as coerceSurrogateMode, t as detectMarkerFormat, u as disclosureText, v as isSurrogateMode, w as resolveSurrogateMode, x as withDisclosure } from './disclosure-Cslh-RaS.mjs';
|
|
5
|
+
import { U as UncheckedContentReason } from './request-body-slots-BMShK1YO.mjs';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* PII detection patterns for CloakAPI SDK — Level 1 (Regex only)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { inspect } from 'node:util';
|
|
2
2
|
import { C as CoverageStatus } from './coverage-OYGXtboB.js';
|
|
3
|
-
import { S as SurrogateMode, a as SurrogateModeReport,
|
|
4
|
-
export { C as CLK_DISCLOSURE_TEXT, c as CLK_DISCLOSURE_TEXT_MESSAGE_SCOPED, d as CLOAK_ANGLE_DISCLOSURE_TEXT, e as CLOAK_ANGLE_DISCLOSURE_TEXT_MESSAGE_SCOPED, f as CLOAK_ANGLE_HEADER, g as CLOAK_ANGLE_HEADER_MESSAGE_SCOPED, h as CONTINUITY_SENTENCE, D as DEFAULT_SURROGATE_MODE, i as DisclosureMessage, j as DisclosureTextOptions, L as LEGACY_SURROGATE_MODE_ALIASES, M as MODE_COPY, k as MODE_SHARED_NOTE, l as MarkerFormat, m as RULESET_VERSION, n as SDK_VERSION, o as SURROGATE_MODES, p as SurrogateContinuity, q as SurrogateModeCopy, r as SurrogateModeError, W as WithDisclosureOptions, s as coerceSurrogateMode, t as detectMarkerFormat, u as disclosureText, v as isSurrogateMode, w as resolveSurrogateMode, x as withDisclosure } from './disclosure-
|
|
3
|
+
import { S as SurrogateMode, a as SurrogateModeReport, E as ExactReviewHandler, R as ReviewProcessingStatus, b as ExactReviewDecision } from './disclosure-Cslh-RaS.js';
|
|
4
|
+
export { C as CLK_DISCLOSURE_TEXT, c as CLK_DISCLOSURE_TEXT_MESSAGE_SCOPED, d as CLOAK_ANGLE_DISCLOSURE_TEXT, e as CLOAK_ANGLE_DISCLOSURE_TEXT_MESSAGE_SCOPED, f as CLOAK_ANGLE_HEADER, g as CLOAK_ANGLE_HEADER_MESSAGE_SCOPED, h as CONTINUITY_SENTENCE, D as DEFAULT_SURROGATE_MODE, i as DisclosureMessage, j as DisclosureTextOptions, L as LEGACY_SURROGATE_MODE_ALIASES, M as MODE_COPY, k as MODE_SHARED_NOTE, l as MarkerFormat, m as RULESET_VERSION, n as SDK_VERSION, o as SURROGATE_MODES, p as SurrogateContinuity, q as SurrogateModeCopy, r as SurrogateModeError, W as WithDisclosureOptions, s as coerceSurrogateMode, t as detectMarkerFormat, u as disclosureText, v as isSurrogateMode, w as resolveSurrogateMode, x as withDisclosure } from './disclosure-Cslh-RaS.js';
|
|
5
|
+
import { U as UncheckedContentReason } from './request-body-slots-BMShK1YO.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* PII detection patterns for CloakAPI SDK — Level 1 (Regex only)
|
package/dist/index.js
CHANGED
|
@@ -4086,7 +4086,7 @@ var MODE_COPY = Object.freeze({
|
|
|
4086
4086
|
var MODE_SHARED_NOTE = "Either way, the same detail always maps to the same replacement for the whole conversation, and the real values are restored in the reply on your device.";
|
|
4087
4087
|
|
|
4088
4088
|
// src/version.ts
|
|
4089
|
-
var SDK_VERSION = "1.
|
|
4089
|
+
var SDK_VERSION = "1.6.0";
|
|
4090
4090
|
var RULESET_VERSION = "1.6.1";
|
|
4091
4091
|
var RULESET_HASH = "8660b7abe553154802c9d27888a144863bcceaa3703517b8401cc56c590df2f9";
|
|
4092
4092
|
|
package/dist/index.mjs
CHANGED
|
@@ -2,27 +2,17 @@ import {
|
|
|
2
2
|
EgressGateError,
|
|
3
3
|
assertClientTokenisationProof,
|
|
4
4
|
assertExactReview,
|
|
5
|
-
assertRequestBodyReviewable,
|
|
6
|
-
assertRequestBodySlotReviewable,
|
|
7
5
|
builtinRuleSources,
|
|
8
|
-
collectRequestBodyTextSlots,
|
|
9
|
-
collectValuePlacementWarnings,
|
|
10
|
-
deepClone,
|
|
11
6
|
detectPiiWithCoverage,
|
|
12
7
|
engineIdentityHeaders,
|
|
13
8
|
inspectClientTokenisation,
|
|
14
9
|
inspectResidual,
|
|
15
10
|
lowerCoverage,
|
|
16
|
-
maskArgumentKeysForResidualCheck,
|
|
17
|
-
metadataKeyOutcomeWarnings,
|
|
18
11
|
refuseIfResidual,
|
|
19
|
-
replaceObjectKeys,
|
|
20
|
-
slotIsLeftAsWritten,
|
|
21
12
|
tokenizedHeaderValue,
|
|
22
|
-
transformJsonArgumentText,
|
|
23
13
|
validateGatewayBaseUrl,
|
|
24
14
|
warningsForResidual
|
|
25
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-6E6T2YO5.mjs";
|
|
26
16
|
import {
|
|
27
17
|
CLK_DISCLOSURE_TEXT,
|
|
28
18
|
CLK_DISCLOSURE_TEXT_MESSAGE_SCOPED,
|
|
@@ -46,7 +36,19 @@ import {
|
|
|
46
36
|
isSurrogateMode,
|
|
47
37
|
resolveSurrogateMode,
|
|
48
38
|
withDisclosure
|
|
49
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-JCTZ572R.mjs";
|
|
40
|
+
import {
|
|
41
|
+
assertRequestBodyReviewable,
|
|
42
|
+
assertRequestBodySlotReviewable,
|
|
43
|
+
collectRequestBodyTextSlots,
|
|
44
|
+
collectValuePlacementWarnings,
|
|
45
|
+
deepClone,
|
|
46
|
+
maskArgumentKeysForResidualCheck,
|
|
47
|
+
metadataKeyOutcomeWarnings,
|
|
48
|
+
replaceObjectKeys,
|
|
49
|
+
slotIsLeftAsWritten,
|
|
50
|
+
transformJsonArgumentText
|
|
51
|
+
} from "./chunk-L7RLVZMD.mjs";
|
|
50
52
|
import "./chunk-44DSUIC2.mjs";
|
|
51
53
|
import {
|
|
52
54
|
__privateAdd,
|
|
@@ -53,7 +53,10 @@ import {
|
|
|
53
53
|
titleCaseAllCapsRuns,
|
|
54
54
|
titleCaseLowercaseRuns,
|
|
55
55
|
trimToProperNounEdges
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-66SEKCCN.mjs";
|
|
57
|
+
import {
|
|
58
|
+
makePlaceSurrogate
|
|
59
|
+
} from "./chunk-KBDFJIEW.mjs";
|
|
57
60
|
import "./chunk-44DSUIC2.mjs";
|
|
58
61
|
import {
|
|
59
62
|
nonLatinSentenceRanges,
|
|
@@ -61,9 +64,6 @@ import {
|
|
|
61
64
|
splitSentenceRanges
|
|
62
65
|
} from "./chunk-SUUFGE34.mjs";
|
|
63
66
|
import "./chunk-MOHR4UIG.mjs";
|
|
64
|
-
import {
|
|
65
|
-
makePlaceSurrogate
|
|
66
|
-
} from "./chunk-KBDFJIEW.mjs";
|
|
67
67
|
import "./chunk-I6KKUHEY.mjs";
|
|
68
68
|
export {
|
|
69
69
|
CARD_SECRETS_MESSAGE,
|
package/dist/node.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { CloakConversation, BrowserTokeniseResult } from './browser/index.mjs';
|
|
2
|
-
import { S as SurrogateMode } from './disclosure-
|
|
2
|
+
import { S as SurrogateMode } from './disclosure-Cslh-RaS.mjs';
|
|
3
3
|
export { C as CARD_SECRETS_MESSAGE, S as SURROGATE_SALT, a as applySupplement, e as enhancedNerModelActive, i as isAllowlistedOrg, m as makeNameSurrogate, b as makeOrgSurrogate, n as nonLatinNerModelActive, s as scanCardSecrets, c as scanCuedHandles, d as setEnhancedGazetteer, f as setEnhancedLocModel, g as setEnhancedNerModel, h as setEnhancedNerTokenCoverage, j as setEnhancedOrgModel, k as setNonLatinNerModel, l as spanIsAllCommonWords, t as titleCaseAllCapsRuns, o as titleCaseLowercaseRuns } from './local-pii-supplement-BsWNf5uP.mjs';
|
|
4
4
|
import './coverage-OYGXtboB.mjs';
|
|
5
|
+
import './request-body-slots-BMShK1YO.mjs';
|
|
5
6
|
|
|
6
7
|
declare function verifyNodeNerModelPins(base: string, id?: string): void;
|
|
7
8
|
|
package/dist/node.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { CloakConversation, BrowserTokeniseResult } from './browser/index.js';
|
|
2
|
-
import { S as SurrogateMode } from './disclosure-
|
|
2
|
+
import { S as SurrogateMode } from './disclosure-Cslh-RaS.js';
|
|
3
3
|
export { C as CARD_SECRETS_MESSAGE, S as SURROGATE_SALT, a as applySupplement, e as enhancedNerModelActive, i as isAllowlistedOrg, m as makeNameSurrogate, b as makeOrgSurrogate, n as nonLatinNerModelActive, s as scanCardSecrets, c as scanCuedHandles, d as setEnhancedGazetteer, f as setEnhancedLocModel, g as setEnhancedNerModel, h as setEnhancedNerTokenCoverage, j as setEnhancedOrgModel, k as setNonLatinNerModel, l as spanIsAllCommonWords, t as titleCaseAllCapsRuns, o as titleCaseLowercaseRuns } from './local-pii-supplement-Db8n7ZuO.js';
|
|
4
4
|
import './coverage-OYGXtboB.js';
|
|
5
|
+
import './request-body-slots-BMShK1YO.js';
|
|
5
6
|
|
|
6
7
|
declare function verifyNodeNerModelPins(base: string, id?: string): void;
|
|
7
8
|
|
package/dist/node.mjs
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createBrowserEngine,
|
|
3
3
|
newConversation
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-7OIXV4CE.mjs";
|
|
5
|
+
import {
|
|
6
|
+
scanGazetteerPlaces
|
|
7
|
+
} from "./chunk-DLKR3ZVZ.mjs";
|
|
5
8
|
import "./chunk-DMJIRWAT.mjs";
|
|
6
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-6E6T2YO5.mjs";
|
|
7
10
|
import "./chunk-EY35G37A.mjs";
|
|
8
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-JCTZ572R.mjs";
|
|
9
12
|
import {
|
|
10
13
|
PORTAL_ENHANCED_NER_MODEL_ID,
|
|
11
14
|
loadNodePinnedEnhancedNerModel,
|
|
12
15
|
loadNodePinnedNonLatinNerModel
|
|
13
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-6JZLCPZ7.mjs";
|
|
14
17
|
import "./chunk-QIORVVUD.mjs";
|
|
18
|
+
import "./chunk-L7RLVZMD.mjs";
|
|
15
19
|
import {
|
|
16
20
|
CARD_SECRETS_MESSAGE,
|
|
17
21
|
SURROGATE_SALT,
|
|
@@ -33,14 +37,11 @@ import {
|
|
|
33
37
|
spanIsAllCommonWords,
|
|
34
38
|
titleCaseAllCapsRuns,
|
|
35
39
|
titleCaseLowercaseRuns
|
|
36
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-66SEKCCN.mjs";
|
|
41
|
+
import "./chunk-KBDFJIEW.mjs";
|
|
37
42
|
import "./chunk-44DSUIC2.mjs";
|
|
38
43
|
import "./chunk-SUUFGE34.mjs";
|
|
39
44
|
import "./chunk-MOHR4UIG.mjs";
|
|
40
|
-
import {
|
|
41
|
-
scanGazetteerPlaces
|
|
42
|
-
} from "./chunk-DLKR3ZVZ.mjs";
|
|
43
|
-
import "./chunk-KBDFJIEW.mjs";
|
|
44
45
|
import "./chunk-I6KKUHEY.mjs";
|
|
45
46
|
|
|
46
47
|
// src/node.ts
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The request-body CHANNEL LIST — which string fields of an OpenAI/Anthropic-style
|
|
3
|
+
* request body carry customer text — as ONE pure module with NO imports.
|
|
4
|
+
*
|
|
5
|
+
* ⛔ WHY THIS LIVES IN ITS OWN FILE (B1, 2026-09-29). It used to sit inside
|
|
6
|
+
* `browser/request-body.ts`, whose `tokeniseRequestBody` needs the browser WASM
|
|
7
|
+
* engine (`./index`). The Node client (`src/client.ts`) could not import the
|
|
8
|
+
* channel list from there without dragging that whole engine into the Node entry
|
|
9
|
+
* point, so it did not — it kept its own two-line walk (`messages[].content` when
|
|
10
|
+
* a string) and relayed `system`, content blocks, `tool_use.input`,
|
|
11
|
+
* `tool_calls[].function.arguments`, tool descriptions and `metadata` RAW.
|
|
12
|
+
*
|
|
13
|
+
* The browser drivers (`tokeniseRequestBody`, `spliceReviewedBody`) and the Node
|
|
14
|
+
* client now all read THIS list. A channel added here reaches every surface; a
|
|
15
|
+
* surface can no longer be one traversal behind.
|
|
16
|
+
*
|
|
17
|
+
* `browser/request-body.ts` re-exports everything below, so every existing import
|
|
18
|
+
* of `collectRequestBodyTextSlots` / `RequestBodyTextSlot` keeps working.
|
|
19
|
+
*/
|
|
20
|
+
/** Plain deep clone for JSON-shaped request bodies (preserves arrays + objects). */
|
|
21
|
+
declare function deepClone<T>(v: T, seen?: WeakSet<object>): T;
|
|
22
|
+
/** One mutable text field of a request body, addressed by its owner + key. */
|
|
23
|
+
interface RequestBodyTextSlot {
|
|
24
|
+
/** Dotted path — diagnostics and tests only. Never egressed. */
|
|
25
|
+
readonly path: string;
|
|
26
|
+
/** The current string. */
|
|
27
|
+
get(): string;
|
|
28
|
+
/** Write the transformed string back into the body. */
|
|
29
|
+
set(v: string): void;
|
|
30
|
+
/** Schema contract literals may pass only when tokenisation leaves them unchanged. */
|
|
31
|
+
readonly policy: 'tokenise' | 'reject-if-changed' | 'json-argument' | 'json-number';
|
|
32
|
+
}
|
|
33
|
+
/** Only ordinary prose slots use the standalone encoded-payload shape guard. */
|
|
34
|
+
/** Schema literals, attachment URLs and data: URLs stay as written. They are not probed into the stand-in map. */
|
|
35
|
+
declare function slotIsLeftAsWritten(slot: {
|
|
36
|
+
policy: string;
|
|
37
|
+
}, value: string): boolean;
|
|
38
|
+
declare function collectRequestBodyTextSlots(root: unknown): RequestBodyTextSlot[];
|
|
39
|
+
declare const PLACEMENT_SCHEMA = "A tool schema holds a fixed value or property name that looks like personal data. Replacing it would change the tool's contract, so it was not replaced. It is sent as written.";
|
|
40
|
+
/**
|
|
41
|
+
* One reason list for an `unchecked_content` notice.
|
|
42
|
+
* The Node client and the browser relay both use this union.
|
|
43
|
+
*/
|
|
44
|
+
type UncheckedContentReason = 'unverified_script' | 'value_not_replaced' | 'media_not_checked' | 'unrecognised_block';
|
|
45
|
+
interface ValuePlacementWarning {
|
|
46
|
+
reason: Extract<UncheckedContentReason, 'value_not_replaced' | 'media_not_checked' | 'unrecognised_block'>;
|
|
47
|
+
message: string;
|
|
48
|
+
}
|
|
49
|
+
declare function collectValuePlacementWarnings(root: unknown, personal: (value: string) => boolean, options?: {
|
|
50
|
+
metadataKeys?: boolean;
|
|
51
|
+
}): ValuePlacementWarning[];
|
|
52
|
+
/** Contract literals cannot be replaced without changing their caller-visible meaning. */
|
|
53
|
+
/** Schema literals stay as written. Replacing one would change the tool contract. */
|
|
54
|
+
declare function assertContractLiteralSafe(_original: string, _tokenised: string, _path: string): void;
|
|
55
|
+
|
|
56
|
+
export { PLACEMENT_SCHEMA as P, type UncheckedContentReason as U, type ValuePlacementWarning as V, assertContractLiteralSafe as a, collectValuePlacementWarnings as b, collectRequestBodyTextSlots as c, deepClone as d, slotIsLeftAsWritten as s };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The request-body CHANNEL LIST — which string fields of an OpenAI/Anthropic-style
|
|
3
|
+
* request body carry customer text — as ONE pure module with NO imports.
|
|
4
|
+
*
|
|
5
|
+
* ⛔ WHY THIS LIVES IN ITS OWN FILE (B1, 2026-09-29). It used to sit inside
|
|
6
|
+
* `browser/request-body.ts`, whose `tokeniseRequestBody` needs the browser WASM
|
|
7
|
+
* engine (`./index`). The Node client (`src/client.ts`) could not import the
|
|
8
|
+
* channel list from there without dragging that whole engine into the Node entry
|
|
9
|
+
* point, so it did not — it kept its own two-line walk (`messages[].content` when
|
|
10
|
+
* a string) and relayed `system`, content blocks, `tool_use.input`,
|
|
11
|
+
* `tool_calls[].function.arguments`, tool descriptions and `metadata` RAW.
|
|
12
|
+
*
|
|
13
|
+
* The browser drivers (`tokeniseRequestBody`, `spliceReviewedBody`) and the Node
|
|
14
|
+
* client now all read THIS list. A channel added here reaches every surface; a
|
|
15
|
+
* surface can no longer be one traversal behind.
|
|
16
|
+
*
|
|
17
|
+
* `browser/request-body.ts` re-exports everything below, so every existing import
|
|
18
|
+
* of `collectRequestBodyTextSlots` / `RequestBodyTextSlot` keeps working.
|
|
19
|
+
*/
|
|
20
|
+
/** Plain deep clone for JSON-shaped request bodies (preserves arrays + objects). */
|
|
21
|
+
declare function deepClone<T>(v: T, seen?: WeakSet<object>): T;
|
|
22
|
+
/** One mutable text field of a request body, addressed by its owner + key. */
|
|
23
|
+
interface RequestBodyTextSlot {
|
|
24
|
+
/** Dotted path — diagnostics and tests only. Never egressed. */
|
|
25
|
+
readonly path: string;
|
|
26
|
+
/** The current string. */
|
|
27
|
+
get(): string;
|
|
28
|
+
/** Write the transformed string back into the body. */
|
|
29
|
+
set(v: string): void;
|
|
30
|
+
/** Schema contract literals may pass only when tokenisation leaves them unchanged. */
|
|
31
|
+
readonly policy: 'tokenise' | 'reject-if-changed' | 'json-argument' | 'json-number';
|
|
32
|
+
}
|
|
33
|
+
/** Only ordinary prose slots use the standalone encoded-payload shape guard. */
|
|
34
|
+
/** Schema literals, attachment URLs and data: URLs stay as written. They are not probed into the stand-in map. */
|
|
35
|
+
declare function slotIsLeftAsWritten(slot: {
|
|
36
|
+
policy: string;
|
|
37
|
+
}, value: string): boolean;
|
|
38
|
+
declare function collectRequestBodyTextSlots(root: unknown): RequestBodyTextSlot[];
|
|
39
|
+
declare const PLACEMENT_SCHEMA = "A tool schema holds a fixed value or property name that looks like personal data. Replacing it would change the tool's contract, so it was not replaced. It is sent as written.";
|
|
40
|
+
/**
|
|
41
|
+
* One reason list for an `unchecked_content` notice.
|
|
42
|
+
* The Node client and the browser relay both use this union.
|
|
43
|
+
*/
|
|
44
|
+
type UncheckedContentReason = 'unverified_script' | 'value_not_replaced' | 'media_not_checked' | 'unrecognised_block';
|
|
45
|
+
interface ValuePlacementWarning {
|
|
46
|
+
reason: Extract<UncheckedContentReason, 'value_not_replaced' | 'media_not_checked' | 'unrecognised_block'>;
|
|
47
|
+
message: string;
|
|
48
|
+
}
|
|
49
|
+
declare function collectValuePlacementWarnings(root: unknown, personal: (value: string) => boolean, options?: {
|
|
50
|
+
metadataKeys?: boolean;
|
|
51
|
+
}): ValuePlacementWarning[];
|
|
52
|
+
/** Contract literals cannot be replaced without changing their caller-visible meaning. */
|
|
53
|
+
/** Schema literals stay as written. Replacing one would change the tool contract. */
|
|
54
|
+
declare function assertContractLiteralSafe(_original: string, _tokenised: string, _path: string): void;
|
|
55
|
+
|
|
56
|
+
export { PLACEMENT_SCHEMA as P, type UncheckedContentReason as U, type ValuePlacementWarning as V, assertContractLiteralSafe as a, collectValuePlacementWarnings as b, collectRequestBodyTextSlots as c, deepClone as d, slotIsLeftAsWritten as s };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloakapi/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "CloakAPI TypeScript SDK: detects personal data with structured rules on your device, replaces it with stand-ins before the request leaves, sends it through the CloakAPI gateway and restores the reply. Without the native engine it runs its built-in rules and says so. OpenAI- and Anthropic-shaped clients for Node and the browser.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -52,6 +52,11 @@
|
|
|
52
52
|
"types": "./dist/node.d.ts",
|
|
53
53
|
"import": "./dist/node.mjs",
|
|
54
54
|
"require": "./dist/node.js"
|
|
55
|
+
},
|
|
56
|
+
"./device": {
|
|
57
|
+
"types": "./dist/device/index.d.ts",
|
|
58
|
+
"import": "./dist/device/index.mjs",
|
|
59
|
+
"require": "./dist/device/index.js"
|
|
55
60
|
}
|
|
56
61
|
},
|
|
57
62
|
"sideEffects": [
|
|
@@ -66,6 +71,8 @@
|
|
|
66
71
|
"./dist/browser/names/public.mjs",
|
|
67
72
|
"./dist/browser/ner-pipeline-worker.js",
|
|
68
73
|
"./dist/browser/ner-pipeline-worker.mjs",
|
|
74
|
+
"./dist/device/index.js",
|
|
75
|
+
"./dist/device/index.mjs",
|
|
69
76
|
"./dist/chunk-*.mjs",
|
|
70
77
|
"./dist/*-*.mjs",
|
|
71
78
|
"./dist/browser/engine-heavy-worker.js",
|
|
@@ -75,7 +82,7 @@
|
|
|
75
82
|
"scripts": {
|
|
76
83
|
"gen:wasm": "node scripts/gen-wasm-inline.mjs",
|
|
77
84
|
"gen:wasm-worker": "node scripts/gen-wasm-worker.mjs",
|
|
78
|
-
"build": "npm run check:shared && npm run gen:version && npm run check:release-set && node scripts/copy-wasm.mjs --port && npm run gen:wasm && npm run gen:wasm-worker && tsup src/index.ts src/browser/index.ts src/browser/light.ts src/browser/names/public.ts src/browser/ner-pipeline-worker.ts src/node.ts --format esm --splitting --clean --dts && tsup src/index.ts src/browser/index.ts src/browser/light.ts src/browser/names/public.ts src/browser/ner-pipeline-worker.ts src/node.ts --format cjs --dts && node scripts/copy-wasm.mjs --kopi && node -e \"require('node:fs').copyFileSync('src/browser/engine/engine-heavy-worker.js','dist/engine-heavy-worker.js');require('node:fs').copyFileSync('src/browser/engine/engine-heavy-worker.js','dist/browser/engine-heavy-worker.js')\" && node scripts/gen-light-cjs.mjs && node scripts/dist-motor-vakt.mjs && node scripts/light-entry-vakt.mjs && node scripts/dist-types-vakt.mjs",
|
|
85
|
+
"build": "npm run check:shared && npm run gen:version && npm run check:release-set && node scripts/copy-wasm.mjs --port && npm run gen:wasm && npm run gen:wasm-worker && tsup src/index.ts src/browser/index.ts src/browser/light.ts src/browser/names/public.ts src/browser/ner-pipeline-worker.ts src/node.ts src/device/index.ts --format esm --splitting --clean --dts && tsup src/index.ts src/browser/index.ts src/browser/light.ts src/browser/names/public.ts src/browser/ner-pipeline-worker.ts src/node.ts src/device/index.ts --format cjs --dts && node scripts/copy-wasm.mjs --kopi && node -e \"require('node:fs').copyFileSync('src/browser/engine/engine-heavy-worker.js','dist/engine-heavy-worker.js');require('node:fs').copyFileSync('src/browser/engine/engine-heavy-worker.js','dist/browser/engine-heavy-worker.js')\" && node scripts/gen-light-cjs.mjs && node scripts/dist-motor-vakt.mjs && node scripts/light-entry-vakt.mjs && node scripts/dist-types-vakt.mjs",
|
|
79
86
|
"prepack": "npm run test:gate && npm run build",
|
|
80
87
|
"prepublishOnly": "bash ../../../bin/publiseringstre-vakt.sh --sti \"$PWD\" && npm run build && bash ../../../bin/sdk-lisens-vakt.sh --pakke \"$PWD\"",
|
|
81
88
|
"test": "vitest run",
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LATIN_POOLS,
|
|
3
|
+
LOCALE_POOLS,
|
|
4
|
+
detectDocCyrillicLocale,
|
|
5
|
+
makeLatinLocaleSurrogate,
|
|
6
|
+
makeLocaleSurrogate,
|
|
7
|
+
makePlaceSurrogate
|
|
8
|
+
} from "./chunk-KBDFJIEW.mjs";
|
|
1
9
|
import {
|
|
2
10
|
findCardSpans
|
|
3
11
|
} from "./chunk-44DSUIC2.mjs";
|
|
@@ -9,14 +17,6 @@ import {
|
|
|
9
17
|
import {
|
|
10
18
|
buildNerCoverage
|
|
11
19
|
} from "./chunk-MOHR4UIG.mjs";
|
|
12
|
-
import {
|
|
13
|
-
LATIN_POOLS,
|
|
14
|
-
LOCALE_POOLS,
|
|
15
|
-
detectDocCyrillicLocale,
|
|
16
|
-
makeLatinLocaleSurrogate,
|
|
17
|
-
makeLocaleSurrogate,
|
|
18
|
-
makePlaceSurrogate
|
|
19
|
-
} from "./chunk-KBDFJIEW.mjs";
|
|
20
20
|
|
|
21
21
|
// src/browser/names/local-names-data.ts
|
|
22
22
|
var GIVEN_NAMES = /* @__PURE__ */ new Set([
|