@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.
@@ -99,25 +99,32 @@ import {
99
99
  typeFromSurrogateMarker,
100
100
  unloadEnhancedGazetteer,
101
101
  wheelUrl
102
- } from "../chunk-7OIXV4CE.mjs";
102
+ } from "../chunk-DDXSTIZ5.mjs";
103
103
  import "../chunk-DLKR3ZVZ.mjs";
104
104
  import "../chunk-DMJIRWAT.mjs";
105
105
  import "../chunk-6E6T2YO5.mjs";
106
106
  import {
107
107
  PRIVACY_TIERS,
108
+ applyPrivacyMode,
109
+ applyPrivacyModeToReview,
108
110
  canonicalise,
111
+ copyPrivacyLedger,
112
+ createModeLedger,
109
113
  fetchJwks,
110
114
  fetchReceiptByJti,
111
115
  isCountersignedResult,
116
+ isSealedSecretMarker,
117
+ privacyLedgerFor,
112
118
  privacyPosture,
113
119
  receiptHash,
120
+ resetDefaultModeLedger,
114
121
  verifyChain,
115
122
  verifyCountersigned,
116
123
  verifyCountersignedJson,
117
124
  verifyDeviceReceipt,
118
125
  verifyReceipt,
119
126
  verifyReceiptJson
120
- } from "../chunk-EY35G37A.mjs";
127
+ } from "../chunk-746IWCJ4.mjs";
121
128
  import {
122
129
  CLK_DISCLOSURE_TEXT,
123
130
  CLK_DISCLOSURE_TEXT_MESSAGE_SCOPED,
@@ -139,7 +146,7 @@ import {
139
146
  isSurrogateMode,
140
147
  resolveSurrogateMode,
141
148
  withDisclosure
142
- } from "../chunk-JCTZ572R.mjs";
149
+ } from "../chunk-ZAO5PEAG.mjs";
143
150
  import {
144
151
  DEFAULT_ENHANCED_NER_MODEL_ID,
145
152
  DETECTION_LAYER_ORDER,
@@ -173,7 +180,7 @@ import {
173
180
  unloadNonLatinNerModel,
174
181
  vacateDetectionLayer,
175
182
  waitForDetectionLayer
176
- } from "../chunk-6JZLCPZ7.mjs";
183
+ } from "../chunk-3MXGO6NA.mjs";
177
184
  import {
178
185
  hasWholeTokenOccurrence,
179
186
  indexOfWholeToken,
@@ -181,6 +188,7 @@ import {
181
188
  replaceWholeTokenOccurrences
182
189
  } from "../chunk-QIORVVUD.mjs";
183
190
  import "../chunk-L7RLVZMD.mjs";
191
+ import "../chunk-TWAQCP3Z.mjs";
184
192
  import {
185
193
  activePersonModelTier,
186
194
  enhancedGazetteerActive,
@@ -271,6 +279,8 @@ export {
271
279
  acceptReducedCoverage,
272
280
  accuracyStillPlaceholder,
273
281
  activePersonModelTier,
282
+ applyPrivacyMode,
283
+ applyPrivacyModeToReview,
274
284
  applyReviewDecisions,
275
285
  modelRoot as asrModelRoot,
276
286
  requiredMirrorFiles as asrRequiredMirrorFiles,
@@ -297,9 +307,11 @@ export {
297
307
  cloneConversation,
298
308
  codeInterpreter,
299
309
  coerceSurrogateMode,
310
+ copyPrivacyLedger,
300
311
  coverageStatusForNer,
301
312
  createBrowserEngine,
302
313
  createFailClosedRelay,
314
+ createModeLedger,
303
315
  declareDetectionLayerUnsupported,
304
316
  decodeToPcm16k,
305
317
  defaultLanguageFromLocale,
@@ -339,6 +351,7 @@ export {
339
351
  isNonLatinNerModelActive,
340
352
  isPlaceIndexReady,
341
353
  isRebuildableFormat,
354
+ isSealedSecretMarker,
342
355
  isSupportedLanguage,
343
356
  isSurrogateMode,
344
357
  isWholeTokenOccurrence,
@@ -359,6 +372,7 @@ export {
359
372
  parseFileSpec,
360
373
  parseRunPython,
361
374
  prewarmPlaceIndex,
375
+ privacyLedgerFor,
362
376
  privacyPosture,
363
377
  pyodideIndexUrl,
364
378
  rebuildTextFile,
@@ -368,6 +382,7 @@ export {
368
382
  renderSelectionSplit,
369
383
  replaceWholeTokenOccurrences,
370
384
  resampleLinear,
385
+ resetDefaultModeLedger,
371
386
  residualRawPII,
372
387
  resolveModel as resolveAsrModel,
373
388
  resolveConversation,
@@ -1,7 +1,7 @@
1
1
  import { CreateBrowserEngineOptions, BrowserEngine } from './index.mjs';
2
- export { ASR_WORKER_SOURCE, ApplyReviewOptions, ApplyReviewResult, AsrError, AsrProgress, AsrTask, AudioLike, BrowserEngineError, BrowserTokenMap, BrowserTokeniseResult, CATEGORICAL_DARK, CATEGORICAL_LIGHT, CODE_INTERPRETER_CAPABILITY_LABEL, CODE_INTERPRETER_SYSTEM_PROMPT, CODE_INTERPRETER_TOOLS, ChartSeries, ChartSpec, ChartTheme, ChartType, CloakConversation, CodeInterpreterCall, CodeInterpreterCapability, CodeInterpreterConfig, CodeInterpreterKind, CodeInterpreterManifest, CodeInterpreterResult, CodeInterpreterToolDescriptor, CountersignedResult, DEFAULT_ASR_MIRROR_BASE, DEFAULT_ASR_MODEL, DEFAULT_ASR_RUNTIME_BASE, DEFAULT_ENHANCED_NER_MODEL_ID, DEFAULT_MIRROR_BASE, DEFAULT_WHEELS, DETECTION_LAYER_ORDER, DetectedEntity, DetectionLayerId, DetectionLayerLoadHandle, DetectionLayerPhase, DetectionLayerProgress, DetectionLayerReport, DetectionLayerSnapshot, DetectionLayerState, DeviceKeyPair, DeviceReceipt, DeviceReceiptError, DeviceReceiptInput, DocBlock, EngineThreadInfo, EngineThreadReason, EnhancedGazetteerAsset, EnhancedNerLoadResult, EnhancedNerModelInfo, EnhancedNerModelProgress, EnhancedNerProgress, ExtractFileForReviewResult, ExtractOptions, FailClosedRelay, FailClosedRelayConfig, FailClosedRelayResponse, FileBuildClaim, FileBuildFile, FileBuildReceiptInput, FileEgressClaim, FileEgressFile, FileEgressReceiptInput, FileExtractFailure, FileExtractKind, FileExtractResult, FileExtractSuccess, FileFormat, FileLike, FileSpec, GeneratedFile, HEADLINE_LANGUAGES, InputBindings, InputHandle, InterpreterError, InterpreterRow, InterpreterTokenMap, LAYER_ACCURACY, LAYER_ACCURACY_PENDING_NOTE, LAYER_ACCURACY_PLACEHOLDER, LayerAccuracyCopy, LayerWaitOutcome, LayerWaitResult, LoadEnhancedNerModelOptions, LoadEnhancedNerOptions, MICROPIP_WHEELS, MakeFilePayload, MakeFilesOptions, ManualRedaction, NETWORK_GUARD_SOURCE, NerTokenizerStyle, NerUnavailableError, NetworkGuardOptions, PORTAL_ENHANCED_NER_MODEL_ID, PRIVACY_TIERS, PYODIDE_PACKAGES, PYODIDE_VERSION, PYODIDE_WORKER_SOURCE, PostureMarkerFormat, PreparedRequestBodyResult, PrivacyPosture, PrivacyPostureOptions, RECEIPT_ATTESTATION_VERSION, RebuildableFormat, RebuiltFile, RelayError, RelayTier, RelayTierInput, ResidualScanSpan, ReviewDecision, ReviewSpan, ReviewSpanType, ReviewTokenMap, RowsOrHandle, RunCallOptions, RunProgress, RunPythonOptions, RunPythonPayload, SelectionPart, SelectionSplit, SheetSpec, SignDeviceReceiptOptions, SpliceReviewedBodyOptions, TRANSCRIPTION_CAPABILITY_LABEL, TRANSCRIPTION_TOOLS, TokeniseOptions, TokeniseRequestBodyResult, TokeniseReviewOptions, TokeniseReviewResult, TokenisedRequestBodyResult, TranscribeOptions, TranscriptSegment, TranscriptionCapability, TranscriptionConfig, TranscriptionManifest, TranscriptionResult, TranscriptionToolDescriptor, UnmeasurableReason, VALUE_CONSISTENCY_MAX_PER_VALUE, VALUE_CONSISTENCY_MAX_TOTAL, VALUE_CONSISTENCY_MIN_LENGTH, Verdict, VerdictCheck, WHISPER_LANGUAGES, WHISPER_MODELS, WHISPER_SAMPLE_RATE, WaitForDetectionLayerOptions, WhisperDtype, WhisperModel, accuracyStillPlaceholder, applyReviewDecisions, asrModelRoot, asrRequiredMirrorFiles, asrRuntimeUrl, asrRuntimeWasmBase, beginDetectionLayerLoad, bindConversationSurrogates, bindRows, bindValue, bridgeOrgConnectorSpans, buildAsrWorkerSource, buildFile, buildPyodideWorkerSource, buildReviewSpans, bundleZip, cancelDetectionLayer, canonicaliseReceipt, categorical, chartToSvg, classifyEntityType, classifyFileForExtraction, cloneConversation, codeInterpreter, createFailClosedRelay, declareDetectionLayerUnsupported, decodeToPcm16k, defaultLanguageFromLocale, describeCodeInterpreter, describeTranscription, detectTokenizerStyle, detectionLayerProgressSink, detectionLayerReport, detectionLayerSnapshot, detectionLayerState, detokeniseString, detokeniseValue, engineThreadInfo, enhancedNerModelInfo, expandValueOccurrences, extractFileForReview, extractTextFromFile, fetchJwks, fetchReceiptByJti, fileBuildOf, fileEgressOf, generateDeviceKeyPair, hasWholeTokenOccurrence, indexOfWholeToken, installNoNetworkGuard, isCountersignedResult, isEnhancedNerModelActive, isNerLoadAbortError, isNonLatinNerModelActive, isPlaceIndexReady, isRebuildableFormat, isSupportedLanguage, isWholeTokenOccurrence, loadEnhancedGazetteer, loadEnhancedNerModel, loadNonLatinNerModel, makeFiles, makeFilesWithBundle, newConversation, nonLatinNerModelInfo, offerWasmNameGazetteerIfEmpty, onDetectionLayerChange, onEngineThreadChange, parseFileSpec, parseRunPython, prewarmPlaceIndex, privacyPosture, pyodideIndexUrl, rebuildTextFile, receiptHashAsync, recommendedNerThreads, reconstructOrgSpans, renderSelectionSplit, replaceWholeTokenOccurrences, resampleLinear, residualRawPII, resolveAsrModel, resolveConversation, resolveWhisperLanguage, reviewWithGracefulCards, runPython, runPythonWithBundle, signDeviceReceipt, signFileBuildReceipt, signFileEgressReceipt, specsOf, splitSelectionIntoEntities, textLikelyContainsNames, transcribe, transcription, typeFromSurrogateMarker, unloadEnhancedGazetteer, unloadEnhancedNerModel, unloadNonLatinNerModel, vacateDetectionLayer, verifyCountersigned, verifyCountersignedJson, verifyDeviceReceipt, verifyReceipt, verifyReceiptChain, verifyReceiptJson, waitForDetectionLayer, wheelUrl } from './index.mjs';
2
+ export { ASR_WORKER_SOURCE, ApplyReviewOptions, ApplyReviewResult, AsrError, AsrProgress, AsrTask, AudioLike, BrowserEngineError, BrowserTokenMap, BrowserTokeniseResult, CATEGORICAL_DARK, CATEGORICAL_LIGHT, CODE_INTERPRETER_CAPABILITY_LABEL, CODE_INTERPRETER_SYSTEM_PROMPT, CODE_INTERPRETER_TOOLS, ChartSeries, ChartSpec, ChartTheme, ChartType, CloakConversation, CodeInterpreterCall, CodeInterpreterCapability, CodeInterpreterConfig, CodeInterpreterKind, CodeInterpreterManifest, CodeInterpreterResult, CodeInterpreterToolDescriptor, CountersignedResult, DEFAULT_ASR_MIRROR_BASE, DEFAULT_ASR_MODEL, DEFAULT_ASR_RUNTIME_BASE, DEFAULT_ENHANCED_NER_MODEL_ID, DEFAULT_MIRROR_BASE, DEFAULT_WHEELS, DETECTION_LAYER_ORDER, DetectedEntity, DetectionLayerId, DetectionLayerLoadHandle, DetectionLayerPhase, DetectionLayerProgress, DetectionLayerReport, DetectionLayerSnapshot, DetectionLayerState, DeviceKeyPair, DeviceReceipt, DeviceReceiptError, DeviceReceiptInput, DocBlock, EngineThreadInfo, EngineThreadReason, EnhancedGazetteerAsset, EnhancedNerLoadResult, EnhancedNerModelInfo, EnhancedNerModelProgress, EnhancedNerProgress, ExtractFileForReviewResult, ExtractOptions, FailClosedRelay, FailClosedRelayConfig, FailClosedRelayResponse, FileBuildClaim, FileBuildFile, FileBuildReceiptInput, FileEgressClaim, FileEgressFile, FileEgressReceiptInput, FileExtractFailure, FileExtractKind, FileExtractResult, FileExtractSuccess, FileFormat, FileLike, FileSpec, GeneratedFile, HEADLINE_LANGUAGES, InputBindings, InputHandle, InterpreterError, InterpreterRow, InterpreterTokenMap, LAYER_ACCURACY, LAYER_ACCURACY_PENDING_NOTE, LAYER_ACCURACY_PLACEHOLDER, LayerAccuracyCopy, LayerWaitOutcome, LayerWaitResult, LoadEnhancedNerModelOptions, LoadEnhancedNerOptions, MICROPIP_WHEELS, MakeFilePayload, MakeFilesOptions, ManualRedaction, ModeLedger, ModeReviewLike, ModeSpanLike, NETWORK_GUARD_SOURCE, NerTokenizerStyle, NerUnavailableError, NetworkGuardOptions, PORTAL_ENHANCED_NER_MODEL_ID, PRIVACY_TIERS, PYODIDE_PACKAGES, PYODIDE_VERSION, PYODIDE_WORKER_SOURCE, PostureMarkerFormat, PreparedRequestBodyResult, PrivacyMode, PrivacyPosture, PrivacyPostureOptions, RECEIPT_ATTESTATION_VERSION, RebuildableFormat, RebuiltFile, RelayError, RelayTier, RelayTierInput, ResidualScanSpan, ReviewDecision, ReviewSpan, ReviewSpanType, ReviewTokenMap, RowsOrHandle, RunCallOptions, RunProgress, RunPythonOptions, RunPythonPayload, SelectionPart, SelectionSplit, SheetSpec, SignDeviceReceiptOptions, SpliceReviewedBodyOptions, TRANSCRIPTION_CAPABILITY_LABEL, TRANSCRIPTION_TOOLS, TokeniseOptions, TokeniseRequestBodyResult, TokeniseReviewOptions, TokeniseReviewResult, TokenisedRequestBodyResult, TranscribeOptions, TranscriptSegment, TranscriptionCapability, TranscriptionConfig, TranscriptionManifest, TranscriptionResult, TranscriptionToolDescriptor, UnmeasurableReason, VALUE_CONSISTENCY_MAX_PER_VALUE, VALUE_CONSISTENCY_MAX_TOTAL, VALUE_CONSISTENCY_MIN_LENGTH, Verdict, VerdictCheck, WHISPER_LANGUAGES, WHISPER_MODELS, WHISPER_SAMPLE_RATE, WaitForDetectionLayerOptions, WhisperDtype, WhisperModel, accuracyStillPlaceholder, applyPrivacyMode, applyPrivacyModeToReview, applyReviewDecisions, asrModelRoot, asrRequiredMirrorFiles, asrRuntimeUrl, asrRuntimeWasmBase, beginDetectionLayerLoad, bindConversationSurrogates, bindRows, bindValue, bridgeOrgConnectorSpans, buildAsrWorkerSource, buildFile, buildPyodideWorkerSource, buildReviewSpans, bundleZip, cancelDetectionLayer, canonicaliseReceipt, categorical, chartToSvg, classifyEntityType, classifyFileForExtraction, cloneConversation, codeInterpreter, copyPrivacyLedger, createFailClosedRelay, createModeLedger, declareDetectionLayerUnsupported, decodeToPcm16k, defaultLanguageFromLocale, describeCodeInterpreter, describeTranscription, detectTokenizerStyle, detectionLayerProgressSink, detectionLayerReport, detectionLayerSnapshot, detectionLayerState, detokeniseString, detokeniseValue, engineThreadInfo, enhancedNerModelInfo, expandValueOccurrences, extractFileForReview, extractTextFromFile, fetchJwks, fetchReceiptByJti, fileBuildOf, fileEgressOf, generateDeviceKeyPair, hasWholeTokenOccurrence, indexOfWholeToken, installNoNetworkGuard, isCountersignedResult, isEnhancedNerModelActive, isNerLoadAbortError, isNonLatinNerModelActive, isPlaceIndexReady, isRebuildableFormat, isSealedSecretMarker, isSupportedLanguage, isWholeTokenOccurrence, loadEnhancedGazetteer, loadEnhancedNerModel, loadNonLatinNerModel, makeFiles, makeFilesWithBundle, newConversation, nonLatinNerModelInfo, offerWasmNameGazetteerIfEmpty, onDetectionLayerChange, onEngineThreadChange, parseFileSpec, parseRunPython, prewarmPlaceIndex, privacyLedgerFor, privacyPosture, pyodideIndexUrl, rebuildTextFile, receiptHashAsync, recommendedNerThreads, reconstructOrgSpans, renderSelectionSplit, replaceWholeTokenOccurrences, resampleLinear, resetDefaultModeLedger, residualRawPII, resolveAsrModel, resolveConversation, resolveWhisperLanguage, reviewWithGracefulCards, runPython, runPythonWithBundle, signDeviceReceipt, signFileBuildReceipt, signFileEgressReceipt, specsOf, splitSelectionIntoEntities, textLikelyContainsNames, transcribe, transcription, typeFromSurrogateMarker, unloadEnhancedGazetteer, unloadEnhancedNerModel, unloadNonLatinNerModel, vacateDetectionLayer, verifyCountersigned, verifyCountersignedJson, verifyDeviceReceipt, verifyReceipt, verifyReceiptChain, verifyReceiptJson, waitForDetectionLayer, wheelUrl } from './index.mjs';
3
3
  export { D as DEFAULT_NER_REQUIREMENT, E as EnhancedNerRunner, p as EnhancedOrgRunner, N as NerCoverage, q as NerLayerName, r as NerLayerOutcome, u as NerOrgSpan, v as NerPersonSpan, w as NerRequirement, x as NerUnavailableErrorShape, P as PersonModelTier, y as PersonNonLatinOutcome, z as ScriptRange, U as UserCoverageAcceptance, A as acceptReducedCoverage, B as assertNerCoverage, F as buildNerCoverage, G as coverageStatusForNer, H as enhancedGazetteerActive, e as enhancedNerModelActive, I as enhancedNerRequirement, J as enhancedOrgModelActive, i as isAllowlistedOrg, K as isCoverageAcceptance, b as makeOrgSurrogate, n as nonLatinNerModelActive, L as nonLatinSentenceRanges, M as normaliseOrg, O as sentenceIsNonLatin, d as setEnhancedGazetteer, Q as setEnhancedNerRequirement, j as setEnhancedOrgModel, k as setNonLatinNerModel, R as splitSentenceRanges } from '../local-pii-supplement-BsWNf5uP.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, n as SDK_VERSION, o as SURROGATE_MODES, p as SurrogateContinuity, S as SurrogateMode, q as SurrogateModeCopy, r as SurrogateModeError, a as SurrogateModeReport, 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';
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, n as SDK_VERSION, o as SURROGATE_MODES, p as SurrogateContinuity, S as SurrogateMode, q as SurrogateModeCopy, r as SurrogateModeError, a as SurrogateModeReport, 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
  export { C as CoverageStatus } from '../coverage-OYGXtboB.mjs';
6
6
  import '../request-body-slots-BMShK1YO.mjs';
7
7
 
@@ -1,7 +1,7 @@
1
1
  import { CreateBrowserEngineOptions, BrowserEngine } from './index.js';
2
- export { ASR_WORKER_SOURCE, ApplyReviewOptions, ApplyReviewResult, AsrError, AsrProgress, AsrTask, AudioLike, BrowserEngineError, BrowserTokenMap, BrowserTokeniseResult, CATEGORICAL_DARK, CATEGORICAL_LIGHT, CODE_INTERPRETER_CAPABILITY_LABEL, CODE_INTERPRETER_SYSTEM_PROMPT, CODE_INTERPRETER_TOOLS, ChartSeries, ChartSpec, ChartTheme, ChartType, CloakConversation, CodeInterpreterCall, CodeInterpreterCapability, CodeInterpreterConfig, CodeInterpreterKind, CodeInterpreterManifest, CodeInterpreterResult, CodeInterpreterToolDescriptor, CountersignedResult, DEFAULT_ASR_MIRROR_BASE, DEFAULT_ASR_MODEL, DEFAULT_ASR_RUNTIME_BASE, DEFAULT_ENHANCED_NER_MODEL_ID, DEFAULT_MIRROR_BASE, DEFAULT_WHEELS, DETECTION_LAYER_ORDER, DetectedEntity, DetectionLayerId, DetectionLayerLoadHandle, DetectionLayerPhase, DetectionLayerProgress, DetectionLayerReport, DetectionLayerSnapshot, DetectionLayerState, DeviceKeyPair, DeviceReceipt, DeviceReceiptError, DeviceReceiptInput, DocBlock, EngineThreadInfo, EngineThreadReason, EnhancedGazetteerAsset, EnhancedNerLoadResult, EnhancedNerModelInfo, EnhancedNerModelProgress, EnhancedNerProgress, ExtractFileForReviewResult, ExtractOptions, FailClosedRelay, FailClosedRelayConfig, FailClosedRelayResponse, FileBuildClaim, FileBuildFile, FileBuildReceiptInput, FileEgressClaim, FileEgressFile, FileEgressReceiptInput, FileExtractFailure, FileExtractKind, FileExtractResult, FileExtractSuccess, FileFormat, FileLike, FileSpec, GeneratedFile, HEADLINE_LANGUAGES, InputBindings, InputHandle, InterpreterError, InterpreterRow, InterpreterTokenMap, LAYER_ACCURACY, LAYER_ACCURACY_PENDING_NOTE, LAYER_ACCURACY_PLACEHOLDER, LayerAccuracyCopy, LayerWaitOutcome, LayerWaitResult, LoadEnhancedNerModelOptions, LoadEnhancedNerOptions, MICROPIP_WHEELS, MakeFilePayload, MakeFilesOptions, ManualRedaction, NETWORK_GUARD_SOURCE, NerTokenizerStyle, NerUnavailableError, NetworkGuardOptions, PORTAL_ENHANCED_NER_MODEL_ID, PRIVACY_TIERS, PYODIDE_PACKAGES, PYODIDE_VERSION, PYODIDE_WORKER_SOURCE, PostureMarkerFormat, PreparedRequestBodyResult, PrivacyPosture, PrivacyPostureOptions, RECEIPT_ATTESTATION_VERSION, RebuildableFormat, RebuiltFile, RelayError, RelayTier, RelayTierInput, ResidualScanSpan, ReviewDecision, ReviewSpan, ReviewSpanType, ReviewTokenMap, RowsOrHandle, RunCallOptions, RunProgress, RunPythonOptions, RunPythonPayload, SelectionPart, SelectionSplit, SheetSpec, SignDeviceReceiptOptions, SpliceReviewedBodyOptions, TRANSCRIPTION_CAPABILITY_LABEL, TRANSCRIPTION_TOOLS, TokeniseOptions, TokeniseRequestBodyResult, TokeniseReviewOptions, TokeniseReviewResult, TokenisedRequestBodyResult, TranscribeOptions, TranscriptSegment, TranscriptionCapability, TranscriptionConfig, TranscriptionManifest, TranscriptionResult, TranscriptionToolDescriptor, UnmeasurableReason, VALUE_CONSISTENCY_MAX_PER_VALUE, VALUE_CONSISTENCY_MAX_TOTAL, VALUE_CONSISTENCY_MIN_LENGTH, Verdict, VerdictCheck, WHISPER_LANGUAGES, WHISPER_MODELS, WHISPER_SAMPLE_RATE, WaitForDetectionLayerOptions, WhisperDtype, WhisperModel, accuracyStillPlaceholder, applyReviewDecisions, asrModelRoot, asrRequiredMirrorFiles, asrRuntimeUrl, asrRuntimeWasmBase, beginDetectionLayerLoad, bindConversationSurrogates, bindRows, bindValue, bridgeOrgConnectorSpans, buildAsrWorkerSource, buildFile, buildPyodideWorkerSource, buildReviewSpans, bundleZip, cancelDetectionLayer, canonicaliseReceipt, categorical, chartToSvg, classifyEntityType, classifyFileForExtraction, cloneConversation, codeInterpreter, createFailClosedRelay, declareDetectionLayerUnsupported, decodeToPcm16k, defaultLanguageFromLocale, describeCodeInterpreter, describeTranscription, detectTokenizerStyle, detectionLayerProgressSink, detectionLayerReport, detectionLayerSnapshot, detectionLayerState, detokeniseString, detokeniseValue, engineThreadInfo, enhancedNerModelInfo, expandValueOccurrences, extractFileForReview, extractTextFromFile, fetchJwks, fetchReceiptByJti, fileBuildOf, fileEgressOf, generateDeviceKeyPair, hasWholeTokenOccurrence, indexOfWholeToken, installNoNetworkGuard, isCountersignedResult, isEnhancedNerModelActive, isNerLoadAbortError, isNonLatinNerModelActive, isPlaceIndexReady, isRebuildableFormat, isSupportedLanguage, isWholeTokenOccurrence, loadEnhancedGazetteer, loadEnhancedNerModel, loadNonLatinNerModel, makeFiles, makeFilesWithBundle, newConversation, nonLatinNerModelInfo, offerWasmNameGazetteerIfEmpty, onDetectionLayerChange, onEngineThreadChange, parseFileSpec, parseRunPython, prewarmPlaceIndex, privacyPosture, pyodideIndexUrl, rebuildTextFile, receiptHashAsync, recommendedNerThreads, reconstructOrgSpans, renderSelectionSplit, replaceWholeTokenOccurrences, resampleLinear, residualRawPII, resolveAsrModel, resolveConversation, resolveWhisperLanguage, reviewWithGracefulCards, runPython, runPythonWithBundle, signDeviceReceipt, signFileBuildReceipt, signFileEgressReceipt, specsOf, splitSelectionIntoEntities, textLikelyContainsNames, transcribe, transcription, typeFromSurrogateMarker, unloadEnhancedGazetteer, unloadEnhancedNerModel, unloadNonLatinNerModel, vacateDetectionLayer, verifyCountersigned, verifyCountersignedJson, verifyDeviceReceipt, verifyReceipt, verifyReceiptChain, verifyReceiptJson, waitForDetectionLayer, wheelUrl } from './index.js';
2
+ export { ASR_WORKER_SOURCE, ApplyReviewOptions, ApplyReviewResult, AsrError, AsrProgress, AsrTask, AudioLike, BrowserEngineError, BrowserTokenMap, BrowserTokeniseResult, CATEGORICAL_DARK, CATEGORICAL_LIGHT, CODE_INTERPRETER_CAPABILITY_LABEL, CODE_INTERPRETER_SYSTEM_PROMPT, CODE_INTERPRETER_TOOLS, ChartSeries, ChartSpec, ChartTheme, ChartType, CloakConversation, CodeInterpreterCall, CodeInterpreterCapability, CodeInterpreterConfig, CodeInterpreterKind, CodeInterpreterManifest, CodeInterpreterResult, CodeInterpreterToolDescriptor, CountersignedResult, DEFAULT_ASR_MIRROR_BASE, DEFAULT_ASR_MODEL, DEFAULT_ASR_RUNTIME_BASE, DEFAULT_ENHANCED_NER_MODEL_ID, DEFAULT_MIRROR_BASE, DEFAULT_WHEELS, DETECTION_LAYER_ORDER, DetectedEntity, DetectionLayerId, DetectionLayerLoadHandle, DetectionLayerPhase, DetectionLayerProgress, DetectionLayerReport, DetectionLayerSnapshot, DetectionLayerState, DeviceKeyPair, DeviceReceipt, DeviceReceiptError, DeviceReceiptInput, DocBlock, EngineThreadInfo, EngineThreadReason, EnhancedGazetteerAsset, EnhancedNerLoadResult, EnhancedNerModelInfo, EnhancedNerModelProgress, EnhancedNerProgress, ExtractFileForReviewResult, ExtractOptions, FailClosedRelay, FailClosedRelayConfig, FailClosedRelayResponse, FileBuildClaim, FileBuildFile, FileBuildReceiptInput, FileEgressClaim, FileEgressFile, FileEgressReceiptInput, FileExtractFailure, FileExtractKind, FileExtractResult, FileExtractSuccess, FileFormat, FileLike, FileSpec, GeneratedFile, HEADLINE_LANGUAGES, InputBindings, InputHandle, InterpreterError, InterpreterRow, InterpreterTokenMap, LAYER_ACCURACY, LAYER_ACCURACY_PENDING_NOTE, LAYER_ACCURACY_PLACEHOLDER, LayerAccuracyCopy, LayerWaitOutcome, LayerWaitResult, LoadEnhancedNerModelOptions, LoadEnhancedNerOptions, MICROPIP_WHEELS, MakeFilePayload, MakeFilesOptions, ManualRedaction, ModeLedger, ModeReviewLike, ModeSpanLike, NETWORK_GUARD_SOURCE, NerTokenizerStyle, NerUnavailableError, NetworkGuardOptions, PORTAL_ENHANCED_NER_MODEL_ID, PRIVACY_TIERS, PYODIDE_PACKAGES, PYODIDE_VERSION, PYODIDE_WORKER_SOURCE, PostureMarkerFormat, PreparedRequestBodyResult, PrivacyMode, PrivacyPosture, PrivacyPostureOptions, RECEIPT_ATTESTATION_VERSION, RebuildableFormat, RebuiltFile, RelayError, RelayTier, RelayTierInput, ResidualScanSpan, ReviewDecision, ReviewSpan, ReviewSpanType, ReviewTokenMap, RowsOrHandle, RunCallOptions, RunProgress, RunPythonOptions, RunPythonPayload, SelectionPart, SelectionSplit, SheetSpec, SignDeviceReceiptOptions, SpliceReviewedBodyOptions, TRANSCRIPTION_CAPABILITY_LABEL, TRANSCRIPTION_TOOLS, TokeniseOptions, TokeniseRequestBodyResult, TokeniseReviewOptions, TokeniseReviewResult, TokenisedRequestBodyResult, TranscribeOptions, TranscriptSegment, TranscriptionCapability, TranscriptionConfig, TranscriptionManifest, TranscriptionResult, TranscriptionToolDescriptor, UnmeasurableReason, VALUE_CONSISTENCY_MAX_PER_VALUE, VALUE_CONSISTENCY_MAX_TOTAL, VALUE_CONSISTENCY_MIN_LENGTH, Verdict, VerdictCheck, WHISPER_LANGUAGES, WHISPER_MODELS, WHISPER_SAMPLE_RATE, WaitForDetectionLayerOptions, WhisperDtype, WhisperModel, accuracyStillPlaceholder, applyPrivacyMode, applyPrivacyModeToReview, applyReviewDecisions, asrModelRoot, asrRequiredMirrorFiles, asrRuntimeUrl, asrRuntimeWasmBase, beginDetectionLayerLoad, bindConversationSurrogates, bindRows, bindValue, bridgeOrgConnectorSpans, buildAsrWorkerSource, buildFile, buildPyodideWorkerSource, buildReviewSpans, bundleZip, cancelDetectionLayer, canonicaliseReceipt, categorical, chartToSvg, classifyEntityType, classifyFileForExtraction, cloneConversation, codeInterpreter, copyPrivacyLedger, createFailClosedRelay, createModeLedger, declareDetectionLayerUnsupported, decodeToPcm16k, defaultLanguageFromLocale, describeCodeInterpreter, describeTranscription, detectTokenizerStyle, detectionLayerProgressSink, detectionLayerReport, detectionLayerSnapshot, detectionLayerState, detokeniseString, detokeniseValue, engineThreadInfo, enhancedNerModelInfo, expandValueOccurrences, extractFileForReview, extractTextFromFile, fetchJwks, fetchReceiptByJti, fileBuildOf, fileEgressOf, generateDeviceKeyPair, hasWholeTokenOccurrence, indexOfWholeToken, installNoNetworkGuard, isCountersignedResult, isEnhancedNerModelActive, isNerLoadAbortError, isNonLatinNerModelActive, isPlaceIndexReady, isRebuildableFormat, isSealedSecretMarker, isSupportedLanguage, isWholeTokenOccurrence, loadEnhancedGazetteer, loadEnhancedNerModel, loadNonLatinNerModel, makeFiles, makeFilesWithBundle, newConversation, nonLatinNerModelInfo, offerWasmNameGazetteerIfEmpty, onDetectionLayerChange, onEngineThreadChange, parseFileSpec, parseRunPython, prewarmPlaceIndex, privacyLedgerFor, privacyPosture, pyodideIndexUrl, rebuildTextFile, receiptHashAsync, recommendedNerThreads, reconstructOrgSpans, renderSelectionSplit, replaceWholeTokenOccurrences, resampleLinear, resetDefaultModeLedger, residualRawPII, resolveAsrModel, resolveConversation, resolveWhisperLanguage, reviewWithGracefulCards, runPython, runPythonWithBundle, signDeviceReceipt, signFileBuildReceipt, signFileEgressReceipt, specsOf, splitSelectionIntoEntities, textLikelyContainsNames, transcribe, transcription, typeFromSurrogateMarker, unloadEnhancedGazetteer, unloadEnhancedNerModel, unloadNonLatinNerModel, vacateDetectionLayer, verifyCountersigned, verifyCountersignedJson, verifyDeviceReceipt, verifyReceipt, verifyReceiptChain, verifyReceiptJson, waitForDetectionLayer, wheelUrl } from './index.js';
3
3
  export { D as DEFAULT_NER_REQUIREMENT, E as EnhancedNerRunner, p as EnhancedOrgRunner, N as NerCoverage, q as NerLayerName, r as NerLayerOutcome, u as NerOrgSpan, v as NerPersonSpan, w as NerRequirement, x as NerUnavailableErrorShape, P as PersonModelTier, y as PersonNonLatinOutcome, z as ScriptRange, U as UserCoverageAcceptance, A as acceptReducedCoverage, B as assertNerCoverage, F as buildNerCoverage, G as coverageStatusForNer, H as enhancedGazetteerActive, e as enhancedNerModelActive, I as enhancedNerRequirement, J as enhancedOrgModelActive, i as isAllowlistedOrg, K as isCoverageAcceptance, b as makeOrgSurrogate, n as nonLatinNerModelActive, L as nonLatinSentenceRanges, M as normaliseOrg, O as sentenceIsNonLatin, d as setEnhancedGazetteer, Q as setEnhancedNerRequirement, j as setEnhancedOrgModel, k as setNonLatinNerModel, R as splitSentenceRanges } from '../local-pii-supplement-Db8n7ZuO.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, n as SDK_VERSION, o as SURROGATE_MODES, p as SurrogateContinuity, S as SurrogateMode, q as SurrogateModeCopy, r as SurrogateModeError, a as SurrogateModeReport, 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';
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, n as SDK_VERSION, o as SURROGATE_MODES, p as SurrogateContinuity, S as SurrogateMode, q as SurrogateModeCopy, r as SurrogateModeError, a as SurrogateModeReport, 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
  export { C as CoverageStatus } from '../coverage-OYGXtboB.js';
6
6
  import '../request-body-slots-BMShK1YO.js';
7
7
 
@@ -4,7 +4,7 @@
4
4
  // name is the full module's own export and its state exists once.
5
5
  Object.defineProperty(exports, '__esModule', { value: true });
6
6
  const full = require('./index.js');
7
- const names = ["CLK_DISCLOSURE_TEXT","CLK_DISCLOSURE_TEXT_MESSAGE_SCOPED","CLOAK_ANGLE_DISCLOSURE_TEXT","CLOAK_ANGLE_DISCLOSURE_TEXT_MESSAGE_SCOPED","CLOAK_ANGLE_HEADER","CLOAK_ANGLE_HEADER_MESSAGE_SCOPED","CONTINUITY_SENTENCE","DEFAULT_NER_REQUIREMENT","DEFAULT_SURROGATE_MODE","LEGACY_SURROGATE_MODE_ALIASES","MODE_COPY","MODE_SHARED_NOTE","PRIVACY_TIERS","SDK_VERSION","SURROGATE_MODES","SurrogateModeError","abortEnhancedNerLoad","acceptReducedCoverage","activePersonModelTier","assertNerCoverage","buildNerCoverage","canonicaliseReceipt","coerceSurrogateMode","coverageStatusForNer","createBrowserEngine","detectMarkerFormat","disclosureText","enhancedNerRequirement","fetchJwks","fetchReceiptByJti","hasWholeTokenOccurrence","indexOfWholeToken","isCountersignedResult","isCoverageAcceptance","isSurrogateMode","isWholeTokenOccurrence","nonLatinSentenceRanges","privacyPosture","receiptHashAsync","replaceWholeTokenOccurrences","resolveSurrogateMode","sentenceIsNonLatin","setEnhancedNerRequirement","splitSentenceRanges","verifyCountersigned","verifyCountersignedJson","verifyDeviceReceipt","verifyReceipt","verifyReceiptChain","verifyReceiptJson","withDisclosure"];
7
+ const names = ["CLK_DISCLOSURE_TEXT","CLK_DISCLOSURE_TEXT_MESSAGE_SCOPED","CLOAK_ANGLE_DISCLOSURE_TEXT","CLOAK_ANGLE_DISCLOSURE_TEXT_MESSAGE_SCOPED","CLOAK_ANGLE_HEADER","CLOAK_ANGLE_HEADER_MESSAGE_SCOPED","CONTINUITY_SENTENCE","DEFAULT_NER_REQUIREMENT","DEFAULT_SURROGATE_MODE","LEGACY_SURROGATE_MODE_ALIASES","MODE_COPY","MODE_SHARED_NOTE","PRIVACY_TIERS","SDK_VERSION","SURROGATE_MODES","SurrogateModeError","abortEnhancedNerLoad","acceptReducedCoverage","activePersonModelTier","applyPrivacyMode","applyPrivacyModeToReview","assertNerCoverage","buildNerCoverage","canonicaliseReceipt","coerceSurrogateMode","copyPrivacyLedger","coverageStatusForNer","createBrowserEngine","createModeLedger","detectMarkerFormat","disclosureText","enhancedNerRequirement","fetchJwks","fetchReceiptByJti","hasWholeTokenOccurrence","indexOfWholeToken","isCountersignedResult","isCoverageAcceptance","isSealedSecretMarker","isSurrogateMode","isWholeTokenOccurrence","nonLatinSentenceRanges","privacyLedgerFor","privacyPosture","receiptHashAsync","replaceWholeTokenOccurrences","resetDefaultModeLedger","resolveSurrogateMode","sentenceIsNonLatin","setEnhancedNerRequirement","splitSentenceRanges","verifyCountersigned","verifyCountersignedJson","verifyDeviceReceipt","verifyReceipt","verifyReceiptChain","verifyReceiptJson","withDisclosure"];
8
8
  for (const name of names) {
9
9
  Object.defineProperty(exports, name, { enumerable: true, get: () => full[name] });
10
10
  }
@@ -1,20 +1,27 @@
1
1
  import {
2
2
  PRIVACY_TIERS,
3
+ applyPrivacyMode,
4
+ applyPrivacyModeToReview,
3
5
  boundFullBrowserModule,
4
6
  canonicalise,
7
+ copyPrivacyLedger,
8
+ createModeLedger,
5
9
  fetchJwks,
6
10
  fetchReceiptByJti,
7
11
  holdAbortUntilBound,
8
12
  isCountersignedResult,
13
+ isSealedSecretMarker,
14
+ privacyLedgerFor,
9
15
  privacyPosture,
10
16
  receiptHash,
17
+ resetDefaultModeLedger,
11
18
  verifyChain,
12
19
  verifyCountersigned,
13
20
  verifyCountersignedJson,
14
21
  verifyDeviceReceipt,
15
22
  verifyReceipt,
16
23
  verifyReceiptJson
17
- } from "../chunk-EY35G37A.mjs";
24
+ } from "../chunk-746IWCJ4.mjs";
18
25
  import {
19
26
  CLK_DISCLOSURE_TEXT,
20
27
  CLK_DISCLOSURE_TEXT_MESSAGE_SCOPED,
@@ -36,13 +43,14 @@ import {
36
43
  isSurrogateMode,
37
44
  resolveSurrogateMode,
38
45
  withDisclosure
39
- } from "../chunk-JCTZ572R.mjs";
46
+ } from "../chunk-ZAO5PEAG.mjs";
40
47
  import {
41
48
  hasWholeTokenOccurrence,
42
49
  indexOfWholeToken,
43
50
  isWholeTokenOccurrence,
44
51
  replaceWholeTokenOccurrences
45
52
  } from "../chunk-QIORVVUD.mjs";
53
+ import "../chunk-TWAQCP3Z.mjs";
46
54
  import {
47
55
  nonLatinSentenceRanges,
48
56
  sentenceIsNonLatin,
@@ -94,12 +102,16 @@ export {
94
102
  abortEnhancedNerLoad,
95
103
  acceptReducedCoverage,
96
104
  activePersonModelTier,
105
+ applyPrivacyMode,
106
+ applyPrivacyModeToReview,
97
107
  assertNerCoverage,
98
108
  buildNerCoverage,
99
109
  canonicalise as canonicaliseReceipt,
100
110
  coerceSurrogateMode,
111
+ copyPrivacyLedger,
101
112
  coverageStatusForNer,
102
113
  createBrowserEngine,
114
+ createModeLedger,
103
115
  detectMarkerFormat,
104
116
  disclosureText,
105
117
  enhancedNerRequirement,
@@ -109,12 +121,15 @@ export {
109
121
  indexOfWholeToken,
110
122
  isCountersignedResult,
111
123
  isCoverageAcceptance,
124
+ isSealedSecretMarker,
112
125
  isSurrogateMode,
113
126
  isWholeTokenOccurrence,
114
127
  nonLatinSentenceRanges,
128
+ privacyLedgerFor,
115
129
  privacyPosture,
116
130
  receiptHash as receiptHashAsync,
117
131
  replaceWholeTokenOccurrences,
132
+ resetDefaultModeLedger,
118
133
  resolveSurrogateMode,
119
134
  sentenceIsNonLatin,
120
135
  setEnhancedNerRequirement,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  buildNerPipeline,
3
3
  localNerTokenOps
4
- } from "../chunk-6JZLCPZ7.mjs";
4
+ } from "../chunk-3MXGO6NA.mjs";
5
5
  import "../chunk-QIORVVUD.mjs";
6
6
  import "../chunk-66SEKCCN.mjs";
7
7
  import "../chunk-KBDFJIEW.mjs";
@@ -127,19 +127,23 @@ function beginDetectionLayerLoad(id) {
127
127
  progress: NOT_STARTED,
128
128
  changedAt: phase === prev.phase ? prev.changedAt : Date.now()
129
129
  });
130
- const live = () => GENERATION[id] === gen && get(id).phase !== "cancelled";
130
+ const active = () => {
131
+ if (GENERATION[id] !== gen) return false;
132
+ const { phase: phase2 } = get(id);
133
+ return phase2 === "downloading" || phase2 === "initialising";
134
+ };
131
135
  return {
132
136
  id,
133
- active: () => live() && (get(id).phase === "downloading" || get(id).phase === "initialising"),
137
+ active,
134
138
  progress(p) {
135
- if (!live()) return;
139
+ if (!active()) return;
136
140
  const cur = get(id);
137
141
  const measurable = typeof p.loaded === "number" && typeof p.total === "number" && p.total > 0;
138
142
  const next = measurable ? { measurable: true, loaded: p.loaded, total: p.total } : { measurable: false, unmeasurable: p.unmeasurable ?? "no-content-length" };
139
143
  put({ ...cur, progress: next });
140
144
  },
141
145
  initialising() {
142
- if (!live()) return;
146
+ if (!active()) return;
143
147
  const cur = get(id);
144
148
  if (id === "L1") return;
145
149
  put({
@@ -150,7 +154,7 @@ function beginDetectionLayerLoad(id) {
150
154
  });
151
155
  },
152
156
  ready() {
153
- if (!live()) return;
157
+ if (!active()) return;
154
158
  const cur = get(id);
155
159
  const backed = engineBacksLayer(id);
156
160
  if (backed === false) {
@@ -161,11 +165,11 @@ function beginDetectionLayerLoad(id) {
161
165
  id,
162
166
  phase: "ready",
163
167
  progress: cur.progress,
164
- changedAt: cur.phase === "ready" ? cur.changedAt : Date.now()
168
+ changedAt: Date.now()
165
169
  });
166
170
  },
167
171
  fail(detail) {
168
- if (!live()) return;
172
+ if (!active()) return;
169
173
  const cur = get(id);
170
174
  put({ id, phase: "error", progress: cur.progress, detail, changedAt: Date.now() });
171
175
  }
@@ -1,3 +1,209 @@
1
+ import {
2
+ indexOfWholeToken,
3
+ isWholeTokenOccurrence
4
+ } from "./chunk-QIORVVUD.mjs";
5
+ import {
6
+ finalCardBackstop
7
+ } from "./chunk-TWAQCP3Z.mjs";
8
+
9
+ // src/browser/privacy-mode-apply.ts
10
+ var SEALED_SECRET = /^\[CLK-(?:CARD|GOVID|IBAN|SECRET|PASSPORT)-[a-p]+\]$/;
11
+ function isSealedSecretMarker(value) {
12
+ return typeof value === "string" && SEALED_SECRET.test(value);
13
+ }
14
+ function hasOwn(obj, key) {
15
+ return Object.prototype.hasOwnProperty.call(obj, key);
16
+ }
17
+ function escapeRe(s) {
18
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
19
+ }
20
+ function tagOf(type) {
21
+ const t = String(type ?? "").toUpperCase().replace(/[^A-Z_]/g, "");
22
+ return t || "PII";
23
+ }
24
+ function createModeLedger() {
25
+ return { perOriginal: /* @__PURE__ */ new Map(), counters: /* @__PURE__ */ new Map() };
26
+ }
27
+ var defaultLedger = createModeLedger();
28
+ function resetDefaultModeLedger() {
29
+ defaultLedger.perOriginal.clear();
30
+ defaultLedger.counters.clear();
31
+ }
32
+ var conversationLedgers = /* @__PURE__ */ new WeakMap();
33
+ function privacyLedgerFor(conversation) {
34
+ let ledger = conversationLedgers.get(conversation);
35
+ if (!ledger) {
36
+ ledger = createModeLedger();
37
+ conversationLedgers.set(conversation, ledger);
38
+ }
39
+ return ledger;
40
+ }
41
+ function copyPrivacyLedger(from, to) {
42
+ const ledger = conversationLedgers.get(from);
43
+ if (!ledger) return;
44
+ conversationLedgers.set(to, {
45
+ perOriginal: new Map(ledger.perOriginal),
46
+ counters: new Map(ledger.counters)
47
+ });
48
+ }
49
+ function repairIdentityStandIns(review, ledger) {
50
+ if (!review || typeof review.body !== "string" || !review.map) return review;
51
+ const spans = review.spans ?? [];
52
+ const repairs = /* @__PURE__ */ new Map();
53
+ const addRepair = (original, type, surrogate, invalid) => {
54
+ const existing = repairs.get(original) ?? { type, needsOpaque: false };
55
+ existing.type ?? (existing.type = type);
56
+ existing.needsOpaque || (existing.needsOpaque = invalid);
57
+ if (!existing.surrogate && typeof surrogate === "string" && surrogate.length > 0 && surrogate !== original) {
58
+ existing.surrogate = surrogate;
59
+ }
60
+ repairs.set(original, existing);
61
+ };
62
+ for (const span of spans) {
63
+ if (!span || typeof span.original !== "string" || !span.original || !/\S/.test(span.original)) continue;
64
+ if (isSealedSecretMarker(span.surrogate)) continue;
65
+ const hasSurrogate = typeof span.surrogate === "string" && span.surrogate.length > 0;
66
+ const invalid = !hasSurrogate || span.surrogate === span.original;
67
+ if (invalid || review.body.includes(span.original)) {
68
+ addRepair(span.original, span.type, span.surrogate, invalid);
69
+ }
70
+ }
71
+ for (const [surrogate, original] of Object.entries(review.map)) {
72
+ if (isSealedSecretMarker(surrogate)) continue;
73
+ if (surrogate && typeof original === "string" && original.length > 0 && /\S/.test(original)) {
74
+ const invalid = surrogate === original;
75
+ if (invalid || review.body.includes(original)) addRepair(original, void 0, surrogate, invalid);
76
+ }
77
+ }
78
+ if (repairs.size === 0) return review;
79
+ const used = /* @__PURE__ */ new Set([
80
+ ...Object.keys(review.map),
81
+ ...spans.map((span) => span?.surrogate).filter((value) => typeof value === "string")
82
+ ]);
83
+ const opaqueMarker = (type, original) => {
84
+ const tag = tagOf(type);
85
+ const available = (candidate) => typeof candidate === "string" && candidate.length > 0 && candidate !== original && !used.has(candidate) && !review.body.includes(candidate) && (review.map[candidate] === void 0 || review.map[candidate] === original);
86
+ const bound = ledger.perOriginal.get(original);
87
+ if (available(bound)) {
88
+ used.add(bound);
89
+ return bound;
90
+ }
91
+ let n = ledger.counters.get(tag) ?? 0;
92
+ let marker;
93
+ do {
94
+ n += 1;
95
+ marker = `<<CLOAK:${tag}:${n}>>`;
96
+ } while (!available(marker));
97
+ ledger.counters.set(tag, n);
98
+ ledger.perOriginal.set(original, marker);
99
+ used.add(marker);
100
+ return marker;
101
+ };
102
+ const replacementByOriginal = /* @__PURE__ */ new Map();
103
+ for (const [original, repair] of repairs) {
104
+ let candidate = repair.needsOpaque ? void 0 : repair.surrogate;
105
+ if (typeof candidate !== "string" || candidate.length === 0 || candidate === original || review.map[candidate] !== void 0 && review.map[candidate] !== original) {
106
+ candidate = opaqueMarker(repair.type, original);
107
+ }
108
+ replacementByOriginal.set(original, candidate);
109
+ }
110
+ const nextSpans = spans.map((span) => {
111
+ if (!span || typeof span.original !== "string") return span;
112
+ const replacement = replacementByOriginal.get(span.original);
113
+ return replacement ? { ...span, surrogate: replacement } : span;
114
+ });
115
+ const needles = /* @__PURE__ */ new Map();
116
+ for (const [original, replacement] of replacementByOriginal) needles.set(original, { replacement, original: true });
117
+ const addStandIn = (needle, original) => {
118
+ const replacement = typeof original === "string" ? replacementByOriginal.get(original) : void 0;
119
+ if (replacement === void 0 || typeof needle !== "string" || needle.length === 0 || needle === replacement || needles.has(needle)) return;
120
+ needles.set(needle, { replacement, original: false });
121
+ };
122
+ for (const span of spans) addStandIn(span?.surrogate, span?.original);
123
+ for (const [surrogate, original] of Object.entries(review.map)) addStandIn(surrogate, original);
124
+ const source = review.body;
125
+ const ordered = [...needles.keys()].sort((a, b) => b.length - a.length);
126
+ const hasWholeToken = new Map(ordered.map((needle) => [needle, indexOfWholeToken(source, needle) >= 0]));
127
+ const body = source.replace(new RegExp(ordered.map(escapeRe).join("|"), "g"), (found, offset) => {
128
+ const needle = needles.get(found);
129
+ const whole = isWholeTokenOccurrence(source, offset, offset + found.length);
130
+ return whole || !needle.original && !hasWholeToken.get(found) ? needle.replacement : found;
131
+ });
132
+ const map = { ...review.map };
133
+ for (const [original, replacement] of replacementByOriginal) {
134
+ for (const [surrogate, mappedOriginal] of Object.entries(map)) {
135
+ if (mappedOriginal === original) delete map[surrogate];
136
+ }
137
+ map[replacement] = original;
138
+ }
139
+ return { ...review, body, map, ...review.spans ? { spans: nextSpans } : {} };
140
+ }
141
+ function applyPrivacyModeInner(review, mode, ledger) {
142
+ review = repairIdentityStandIns(review, ledger);
143
+ if (mode !== "max") return review;
144
+ if (!review || typeof review.body !== "string" || !review.map) return review;
145
+ const typeOfSurrogate = /* @__PURE__ */ new Map();
146
+ for (const s of review.spans ?? []) {
147
+ if (s && typeof s.surrogate === "string") typeOfSurrogate.set(s.surrogate, tagOf(s.type));
148
+ }
149
+ const surrogates = Object.keys(review.map).filter((s) => s.length > 0).sort((a, b) => b.length - a.length);
150
+ if (surrogates.length === 0) return review;
151
+ const rewrite = /* @__PURE__ */ new Map();
152
+ const nextMap = {};
153
+ for (const sur of surrogates) {
154
+ const original = review.map[sur];
155
+ if (isSealedSecretMarker(sur)) {
156
+ nextMap[sur] = original;
157
+ continue;
158
+ }
159
+ let placeholder = ledger.perOriginal.get(original);
160
+ const tag = typeOfSurrogate.get(sur) ?? "PII";
161
+ let n = ledger.counters.get(tag) ?? 0;
162
+ if (placeholder === void 0) {
163
+ n += 1;
164
+ placeholder = `<<CLOAK:${tag}:${n}>>`;
165
+ }
166
+ while (review.body.includes(placeholder) || hasOwn(review.map, placeholder) || hasOwn(nextMap, placeholder) && nextMap[placeholder] !== original || isSealedSecretMarker(placeholder)) {
167
+ placeholder = `<<CLOAK:${tag}:${++n}>>`;
168
+ }
169
+ ledger.counters.set(tag, n);
170
+ ledger.perOriginal.set(original, placeholder);
171
+ rewrite.set(sur, placeholder);
172
+ nextMap[placeholder] = original;
173
+ }
174
+ if (rewrite.size === 0) return review;
175
+ const rewriteKeys = [...rewrite.keys()];
176
+ const ordered = [...rewriteKeys, ...surrogates.filter((s) => isSealedSecretMarker(s))].sort(
177
+ (a, b) => b.length - a.length
178
+ );
179
+ const hasWholeToken = new Map(
180
+ rewriteKeys.map((s) => [s, indexOfWholeToken(review.body, s) >= 0])
181
+ );
182
+ const source = review.body;
183
+ const re = new RegExp(ordered.map(escapeRe).join("|"), "g");
184
+ const body = source.replace(re, (m, off) => {
185
+ if (isSealedSecretMarker(m) || !rewrite.has(m)) return m;
186
+ return hasWholeToken.get(m) && !isWholeTokenOccurrence(source, off, off + m.length) ? m : rewrite.get(m);
187
+ });
188
+ const spans = (review.spans ?? []).map(
189
+ (s) => s && typeof s.surrogate === "string" && rewrite.has(s.surrogate) ? { ...s, surrogate: rewrite.get(s.surrogate) } : s
190
+ );
191
+ return { ...review, body, map: nextMap, ...review.spans ? { spans } : {} };
192
+ }
193
+ function lockUnspannedCards(review) {
194
+ if (!review || typeof review.body !== "string" || !review.map) return review;
195
+ const cardLock = finalCardBackstop(review.body, Object.keys(review.map));
196
+ if (cardLock.locked === 0) return review;
197
+ return { ...review, body: cardLock.body, map: { ...review.map, ...cardLock.map } };
198
+ }
199
+ function applyPrivacyModeRewrite(review, mode, ledger = defaultLedger) {
200
+ return applyPrivacyModeInner(review, mode, ledger);
201
+ }
202
+ function applyPrivacyMode(review, mode, ledger = defaultLedger) {
203
+ return lockUnspannedCards(applyPrivacyModeRewrite(review, mode, ledger));
204
+ }
205
+ var applyPrivacyModeToReview = applyPrivacyMode;
206
+
1
207
  // src/browser/verify/strict-json.js
2
208
  var MAX_JSON_CODE_UNITS = 8 * 1024 * 1024;
3
209
  var MAX_JSON_DEPTH = 256;
@@ -791,7 +997,16 @@ async function fetchReceiptByJti(jti) {
791
997
  }).catch(() => {
792
998
  throw new Error("receipt lookup failed");
793
999
  });
794
- if (!res.ok) throw new Error("No receipt found for that ID (HTTP " + res.status + ").");
1000
+ if (!res.ok) {
1001
+ const data2 = await res.json().catch(() => null);
1002
+ const code = typeof data2?.error?.code === "string" ? data2.error.code : "";
1003
+ const message = typeof data2?.error?.message === "string" ? data2.error.message : "";
1004
+ if (code || message) {
1005
+ const status = code ? res.status + ", " + code : String(res.status);
1006
+ throw new Error("Receipt lookup failed (HTTP " + status + ")." + (message ? " " + message : ""));
1007
+ }
1008
+ throw new Error("No receipt found for that ID (HTTP " + res.status + ").");
1009
+ }
795
1010
  const data = parseStrictJson(await res.text());
796
1011
  return data && data.receipt ? data.receipt : data;
797
1012
  }
@@ -1205,6 +1420,14 @@ function holdAbortUntilBound(id) {
1205
1420
  }
1206
1421
 
1207
1422
  export {
1423
+ isSealedSecretMarker,
1424
+ createModeLedger,
1425
+ resetDefaultModeLedger,
1426
+ privacyLedgerFor,
1427
+ copyPrivacyLedger,
1428
+ applyPrivacyModeRewrite,
1429
+ applyPrivacyMode,
1430
+ applyPrivacyModeToReview,
1208
1431
  canonicalise,
1209
1432
  receiptHash,
1210
1433
  isCountersignedResult,