@cloakapi/sdk 1.6.0 → 1.6.2

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.
@@ -147,7 +147,7 @@ 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.6.0";
150
+ declare const SDK_VERSION = "1.6.2";
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
 
@@ -147,7 +147,7 @@ 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.6.0";
150
+ declare const SDK_VERSION = "1.6.2";
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
 
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
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, 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';
3
+ import { S as SurrogateMode, a as SurrogateModeReport, E as ExactReviewHandler, R as ReviewProcessingStatus, b as ExactReviewDecision } from './disclosure-DnB-xYCb.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-DnB-xYCb.mjs';
5
5
  import { U as UncheckedContentReason } from './request-body-slots-BMShK1YO.mjs';
6
6
 
7
7
  /**
@@ -653,11 +653,11 @@ type ReasoningEffort = 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh'
653
653
  interface SendWarning {
654
654
  /**
655
655
  * `unchecked_content`: some content could not be checked or replaced on this device and was sent as written.
656
- * `reduced_coverage`: only the structured rules ran (no engine, or a configured engine was not used).
656
+ * `reduced_coverage`: the local engine or its optional name model was unavailable.
657
657
  */
658
658
  code: 'unchecked_content' | 'reduced_coverage';
659
659
  /** What the notice is about. */
660
- reason: UncheckedContentReason | 'engine_refused' | 'engine_missing' | 'engine_unloadable' | 'pin_missing' | 'pin_mismatch' | 'ruleset_mismatch';
660
+ reason: UncheckedContentReason | 'engine_refused' | 'model_missing' | 'engine_missing' | 'engine_unloadable' | 'pin_missing' | 'pin_mismatch' | 'ruleset_mismatch';
661
661
  message: string;
662
662
  }
663
663
  /** Why a local engine is not used for this client. `undefined` when one is used. */
@@ -667,7 +667,7 @@ interface CloakAPIResponse {
667
667
  [key: string]: unknown;
668
668
  coverage: CoverageStatus;
669
669
  degraded?: boolean;
670
- /** Present only when this send carried content the device could not check or replace. */
670
+ /** Notices about reduced coverage or content the device could not check or replace. */
671
671
  warnings?: SendWarning[];
672
672
  }
673
673
  /** What the `review` callback is told about the text it is asked to approve. */
@@ -976,7 +976,7 @@ declare class CloakAPI {
976
976
  _tokeniseRequestBody<T>(body: T): T;
977
977
  /** @internal — attach the local coverage label to a successful provider response. */
978
978
  _requestCoverage(body: object): CoverageStatus;
979
- /** @internal — whether a rules-only scan exhausted its per-call budget. */
979
+ /** @internal — whether text preparation marked the request degraded. */
980
980
  _requestDegraded(body: object): boolean;
981
981
  _withCoverage(response: unknown, coverage: CoverageStatus, degraded?: boolean): CloakAPIResponse;
982
982
  /**
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
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, 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';
3
+ import { S as SurrogateMode, a as SurrogateModeReport, E as ExactReviewHandler, R as ReviewProcessingStatus, b as ExactReviewDecision } from './disclosure-DnB-xYCb.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-DnB-xYCb.js';
5
5
  import { U as UncheckedContentReason } from './request-body-slots-BMShK1YO.js';
6
6
 
7
7
  /**
@@ -653,11 +653,11 @@ type ReasoningEffort = 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh'
653
653
  interface SendWarning {
654
654
  /**
655
655
  * `unchecked_content`: some content could not be checked or replaced on this device and was sent as written.
656
- * `reduced_coverage`: only the structured rules ran (no engine, or a configured engine was not used).
656
+ * `reduced_coverage`: the local engine or its optional name model was unavailable.
657
657
  */
658
658
  code: 'unchecked_content' | 'reduced_coverage';
659
659
  /** What the notice is about. */
660
- reason: UncheckedContentReason | 'engine_refused' | 'engine_missing' | 'engine_unloadable' | 'pin_missing' | 'pin_mismatch' | 'ruleset_mismatch';
660
+ reason: UncheckedContentReason | 'engine_refused' | 'model_missing' | 'engine_missing' | 'engine_unloadable' | 'pin_missing' | 'pin_mismatch' | 'ruleset_mismatch';
661
661
  message: string;
662
662
  }
663
663
  /** Why a local engine is not used for this client. `undefined` when one is used. */
@@ -667,7 +667,7 @@ interface CloakAPIResponse {
667
667
  [key: string]: unknown;
668
668
  coverage: CoverageStatus;
669
669
  degraded?: boolean;
670
- /** Present only when this send carried content the device could not check or replace. */
670
+ /** Notices about reduced coverage or content the device could not check or replace. */
671
671
  warnings?: SendWarning[];
672
672
  }
673
673
  /** What the `review` callback is told about the text it is asked to approve. */
@@ -976,7 +976,7 @@ declare class CloakAPI {
976
976
  _tokeniseRequestBody<T>(body: T): T;
977
977
  /** @internal — attach the local coverage label to a successful provider response. */
978
978
  _requestCoverage(body: object): CoverageStatus;
979
- /** @internal — whether a rules-only scan exhausted its per-call budget. */
979
+ /** @internal — whether text preparation marked the request degraded. */
980
980
  _requestDegraded(body: object): boolean;
981
981
  _withCoverage(response: unknown, coverage: CoverageStatus, degraded?: boolean): CloakAPIResponse;
982
982
  /**
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.6.0";
4089
+ var SDK_VERSION = "1.6.2";
4090
4090
  var RULESET_VERSION = "1.6.1";
4091
4091
  var RULESET_HASH = "8660b7abe553154802c9d27888a144863bcceaa3703517b8401cc56c590df2f9";
4092
4092
 
@@ -7066,7 +7066,7 @@ var CloakAPI = class {
7066
7066
  return {
7067
7067
  text: result2.text,
7068
7068
  tokenMap: __privateGet(this, _tokenMap),
7069
- coverage: reduced ? "rules_only" : "full",
7069
+ coverage: reduced ? "rules_and_names" : "full",
7070
7070
  degraded: reduced
7071
7071
  };
7072
7072
  }
@@ -7124,7 +7124,7 @@ var CloakAPI = class {
7124
7124
  _requestCoverage(body) {
7125
7125
  return __privateGet(this, _requestCoverageByBody).get(body) ?? "full";
7126
7126
  }
7127
- /** @internal — whether a rules-only scan exhausted its per-call budget. */
7127
+ /** @internal — whether text preparation marked the request degraded. */
7128
7128
  _requestDegraded(body) {
7129
7129
  return __privateGet(this, _requestDegradedByBody).has(body);
7130
7130
  }
@@ -7334,12 +7334,19 @@ request_fn = async function(path, body, routeProvider, routeStrategy, endUser, t
7334
7334
  if (typeof rawBody !== "string") {
7335
7335
  throw new CloakAPIError("request body is not JSON-serializable; refusing to relay.", 0, "invalid_request_body");
7336
7336
  }
7337
- const engineIssue = this._engineUse().issue;
7337
+ const { issue: engineIssue, identity } = this._engineUse();
7338
7338
  if (engineIssue) {
7339
7339
  sendWarnings.push({
7340
7340
  code: "reduced_coverage",
7341
7341
  reason: engineIssue,
7342
- message: `${engineIssueMessage(engineIssue, this._engineUse().identity.version)} Structured rules ran instead.`
7342
+ message: `${engineIssueMessage(engineIssue, identity.version)} Structured rules ran instead.`
7343
+ });
7344
+ reviewStatus = "degraded";
7345
+ } else if (coverage === "rules_and_names") {
7346
+ sendWarnings.push({
7347
+ code: "reduced_coverage",
7348
+ reason: "model_missing",
7349
+ message: "Model-based name detection is unavailable. Structured rules and built-in name detection ran. Some names may remain unchanged."
7343
7350
  });
7344
7351
  reviewStatus = "degraded";
7345
7352
  }
package/dist/index.mjs CHANGED
@@ -36,7 +36,7 @@ import {
36
36
  isSurrogateMode,
37
37
  resolveSurrogateMode,
38
38
  withDisclosure
39
- } from "./chunk-JCTZ572R.mjs";
39
+ } from "./chunk-ZAO5PEAG.mjs";
40
40
  import {
41
41
  assertRequestBodyReviewable,
42
42
  assertRequestBodySlotReviewable,
@@ -4458,7 +4458,7 @@ var CloakAPI = class {
4458
4458
  return {
4459
4459
  text: result2.text,
4460
4460
  tokenMap: __privateGet(this, _tokenMap),
4461
- coverage: reduced ? "rules_only" : "full",
4461
+ coverage: reduced ? "rules_and_names" : "full",
4462
4462
  degraded: reduced
4463
4463
  };
4464
4464
  }
@@ -4516,7 +4516,7 @@ var CloakAPI = class {
4516
4516
  _requestCoverage(body) {
4517
4517
  return __privateGet(this, _requestCoverageByBody).get(body) ?? "full";
4518
4518
  }
4519
- /** @internal — whether a rules-only scan exhausted its per-call budget. */
4519
+ /** @internal — whether text preparation marked the request degraded. */
4520
4520
  _requestDegraded(body) {
4521
4521
  return __privateGet(this, _requestDegradedByBody).has(body);
4522
4522
  }
@@ -4726,12 +4726,19 @@ request_fn = async function(path, body, routeProvider, routeStrategy, endUser, t
4726
4726
  if (typeof rawBody !== "string") {
4727
4727
  throw new CloakAPIError("request body is not JSON-serializable; refusing to relay.", 0, "invalid_request_body");
4728
4728
  }
4729
- const engineIssue = this._engineUse().issue;
4729
+ const { issue: engineIssue, identity } = this._engineUse();
4730
4730
  if (engineIssue) {
4731
4731
  sendWarnings.push({
4732
4732
  code: "reduced_coverage",
4733
4733
  reason: engineIssue,
4734
- message: `${engineIssueMessage(engineIssue, this._engineUse().identity.version)} Structured rules ran instead.`
4734
+ message: `${engineIssueMessage(engineIssue, identity.version)} Structured rules ran instead.`
4735
+ });
4736
+ reviewStatus = "degraded";
4737
+ } else if (coverage === "rules_and_names") {
4738
+ sendWarnings.push({
4739
+ code: "reduced_coverage",
4740
+ reason: "model_missing",
4741
+ message: "Model-based name detection is unavailable. Structured rules and built-in name detection ran. Some names may remain unchanged."
4735
4742
  });
4736
4743
  reviewStatus = "degraded";
4737
4744
  }
package/dist/node.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CloakConversation, BrowserTokeniseResult } from './browser/index.mjs';
2
- import { S as SurrogateMode } from './disclosure-Cslh-RaS.mjs';
2
+ import { S as SurrogateMode } from './disclosure-DnB-xYCb.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
5
  import './request-body-slots-BMShK1YO.mjs';
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CloakConversation, BrowserTokeniseResult } from './browser/index.js';
2
- import { S as SurrogateMode } from './disclosure-Cslh-RaS.js';
2
+ import { S as SurrogateMode } from './disclosure-DnB-xYCb.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
5
  import './request-body-slots-BMShK1YO.js';