@stll/anonymize-wasm 2.0.0 → 2.0.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.
package/dist/wasm.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as OPERATOR_TYPES, i as DetectionSource, n as DETECTION_SOURCES, o as OperatorType, r as DETECTOR_PRIORITY, t as DEFAULT_ENTITY_LABELS } from "./constants2.mjs";
2
-
1
+ import { a as DetectionSource, c as ENTITY_SELECTIONS, d as EntitySelection, f as OPERATOR_TYPES, i as DefaultEntityLabel, l as EntityCapability, n as DETECTION_SOURCES, o as ENTITY_CAPABILITIES, p as OperatorType, r as DETECTOR_PRIORITY, s as ENTITY_LABELS, t as DEFAULT_ENTITY_LABELS, u as EntityLabel } from "./constants2.mjs";
2
+ import { CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_RUNTIMES, CapabilityManifest, CapabilityRuntime } from "./capabilities.mjs";
3
3
  //#region src/native-search-config.d.ts
4
4
  /**
5
5
  * Structural type for the prepared static-search config the native binding
@@ -344,7 +344,8 @@ type DetectedEntity = EntityBase & {
344
344
  * write — or that a later pass could clear.
345
345
  */
346
346
  type CorefAliasEntity = EntityBase & {
347
- source: typeof DETECTION_SOURCES.COREFERENCE; /** Full text of the source entity this alias refers to. */
347
+ source: typeof DETECTION_SOURCES.COREFERENCE;
348
+ /** Full text of the source entity this alias refers to. */
348
349
  corefSourceText: string;
349
350
  };
350
351
  /**
@@ -361,13 +362,36 @@ type ReviewedEntity = Entity & {
361
362
  decision?: ReviewDecision;
362
363
  originalLabel?: string;
363
364
  };
365
+ /**
366
+ * A single entry in the workspace-scoped gazetteer
367
+ * (deny list). Persisted in IndexedDB.
368
+ */
369
+ type GazetteerEntry = {
370
+ id: string;
371
+ canonical: string;
372
+ label: string;
373
+ variants: string[];
374
+ workspaceId: string;
375
+ createdAt: number;
376
+ source: "manual" | "confirmed-from-model";
377
+ };
364
378
  /** Per-label operator selection. Key is the entity label. */
379
+ type MaskDirection = "start" | "end";
380
+ type MaskOperatorConfig = {
381
+ type: "mask";
382
+ maskingCharacter: string;
383
+ charactersToMask: number;
384
+ direction: MaskDirection;
385
+ };
386
+ type OperatorSelection = Exclude<OperatorType, "mask"> | MaskOperatorConfig;
365
387
  type OperatorConfig = {
366
- /** Operator per label. Missing labels default to "replace". */operators: Record<string, OperatorType>; /** Custom replacement string for the redact operator. */
388
+ /** Operator per label. Missing labels default to "replace". */
389
+ operators: Record<string, OperatorSelection>;
390
+ /** Custom replacement string for the redact operator. */
367
391
  redactString: string;
368
392
  };
369
393
  /** Whether an operator produces a reversible redaction entry. */
370
- type OperatorReversibility = "reversible" | "irreversible";
394
+ type OperatorReversibility = "reversible" | "irreversible" | "preserving";
371
395
  type AnonymisationOperator = {
372
396
  type: OperatorType;
373
397
  reversibility: OperatorReversibility;
@@ -375,7 +399,7 @@ type AnonymisationOperator = {
375
399
  * Apply the operator to a single entity occurrence.
376
400
  * Returns the replacement string to embed in the document.
377
401
  */
378
- apply: (text: string, label: string, placeholder: string, redactString: string) => string;
402
+ apply: (text: string, label: string, placeholder: string, redactString: string, selection: OperatorSelection) => string;
379
403
  };
380
404
  /**
381
405
  * Redacted document output with stable entity mapping.
@@ -384,18 +408,221 @@ type RedactionResult = {
384
408
  redactedText: string;
385
409
  /**
386
410
  * Maps placeholder to original text. Only populated for
387
- * reversible operators (replace). Empty for redact.
411
+ * reversible operators (replace). Empty for redact, keep, and mask.
388
412
  */
389
- redactionMap: Map<string, string>; /** Maps placeholder to the operator that produced it. */
413
+ redactionMap: Map<string, string>;
414
+ /** Maps placeholder to the operator that produced it. */
390
415
  operatorMap: Map<string, OperatorType>;
391
416
  entityCount: number;
392
417
  };
418
+ /**
419
+ * Configuration for the detection pipeline.
420
+ */
421
+ type DenyListCategory = "Names" | "Places" | "Addresses" | "Courts" | "Financial" | "Government" | "Healthcare" | "Education" | "Political" | "Organizations" | "International";
422
+ /**
423
+ * Metadata for a single dictionary entry in the
424
+ * deny-list system. Mirrors the shape from
425
+ * the anonymize-data package so consumers can pass
426
+ * pre-loaded data without a runtime dependency.
427
+ */
428
+ type DictionaryMeta = {
429
+ label: string;
430
+ category: DenyListCategory;
431
+ country: string | null;
432
+ };
433
+ /**
434
+ * Caller-supplied exact terms for deny-list matching.
435
+ * These entries are merged with the published deny-list
436
+ * dictionaries when `enableDenyList` is enabled.
437
+ */
438
+ type CustomDenyListEntry = {
439
+ value: string;
440
+ label: string;
441
+ variants?: readonly string[];
442
+ };
443
+ /**
444
+ * Caller-supplied regex detector. The pattern is passed
445
+ * to the underlying text-search regex engine, so use its
446
+ * supported regex syntax. Inline flags such as `(?i)` are
447
+ * accepted when supported by that engine.
448
+ */
449
+ type CustomRegexPattern = {
450
+ pattern: string;
451
+ label: string;
452
+ score?: number;
453
+ preparedArtifactPolicy?: "include" | "omit";
454
+ };
455
+ /**
456
+ * Pre-loaded dictionary data for dependency injection.
457
+ * Consumers that want name/city/deny-list detection
458
+ * load dictionaries themselves (e.g. from the
459
+ * anonymize-data package) and pass them here; the
460
+ * anonymize package has zero cross-package imports.
461
+ *
462
+ * All fields are optional. When a field is absent,
463
+ * the corresponding detection path is skipped (same
464
+ * behavior as when no dictionaries are available).
465
+ */
466
+ type Dictionaries = {
467
+ /**
468
+ * First names per language code (e.g., "cs", "de").
469
+ * Merged with legacy config names at init time.
470
+ */
471
+ firstNames?: Readonly<Record<string, readonly string[]>>;
472
+ /**
473
+ * Surnames per language code.
474
+ * Merged with legacy config names at init time.
475
+ */
476
+ surnames?: Readonly<Record<string, readonly string[]>>;
477
+ /**
478
+ * Non-Western name tokens per locale code
479
+ * (e.g., "in", "ar", "ja-latn", "ko", "zh-latn",
480
+ * "th", "vi", "fil", "id"). Merged with bundled
481
+ * names-nw-*.json data at init time.
482
+ */
483
+ nonWesternNames?: Readonly<Record<string, readonly string[]>>;
484
+ /**
485
+ * Pre-loaded deny-list dictionaries keyed by
486
+ * dictionary ID (e.g., "courts/CZ", "banks/DE").
487
+ * Each value is the array of terms for that
488
+ * dictionary.
489
+ */
490
+ denyList?: Readonly<Record<string, readonly string[]>>;
491
+ /**
492
+ * Metadata per dictionary ID. Required when
493
+ * `denyList` is provided so the pipeline knows
494
+ * labels, categories, and country filters.
495
+ */
496
+ denyListMeta?: Readonly<Record<string, DictionaryMeta>>;
497
+ /**
498
+ * Pre-loaded city names, already merged across
499
+ * all desired countries.
500
+ *
501
+ * Prefer `citiesByCountry` when callers also pass
502
+ * `denyListCountries` / `denyListRegions`; merged
503
+ * city arrays cannot be scoped after injection.
504
+ */
505
+ cities?: readonly string[];
506
+ /**
507
+ * Pre-loaded city names keyed by ISO 3166-1 alpha-2
508
+ * country code. When provided, the deny-list builder
509
+ * applies `denyListCountries` / `denyListRegions`
510
+ * before adding city patterns to the search automaton.
511
+ */
512
+ citiesByCountry?: Readonly<Record<string, readonly string[]>>;
513
+ };
514
+ type PipelineConfig = {
515
+ threshold: number;
516
+ enableTriggerPhrases: boolean;
517
+ enableRegex: boolean;
518
+ /**
519
+ * Expected content language codes. When present, these
520
+ * derive default dictionary scopes for name corpus and
521
+ * deny-list matching unless the lower-level scope fields
522
+ * below are set explicitly.
523
+ */
524
+ languages?: string[];
525
+ /**
526
+ * Convenience form for single-language documents. Ignored
527
+ * when `languages` is also provided.
528
+ */
529
+ language?: string;
530
+ /**
531
+ * Enables legal-form organization detection.
532
+ * Required for typed callers; legacy untyped
533
+ * callers that omit this field are treated as
534
+ * enabled at runtime for backward compatibility.
535
+ */
536
+ enableLegalForms: boolean;
537
+ /**
538
+ * Enables first-name/surname/title corpus matching.
539
+ * When deny-list mode is enabled, this also controls
540
+ * whether name-corpus entries are injected into the
541
+ * deny-list search automaton.
542
+ */
543
+ enableNameCorpus: boolean;
544
+ /**
545
+ * Optional language scope for first-name/surname
546
+ * dictionaries, using the keys present in
547
+ * `dictionaries.firstNames` / `dictionaries.surnames`
548
+ * (for example `["en", "de"]`). When omitted, all
549
+ * injected name languages are used for backward
550
+ * compatibility.
551
+ */
552
+ nameCorpusLanguages?: string[];
553
+ enableDenyList: boolean;
554
+ denyListCountries?: string[];
555
+ denyListRegions?: string[];
556
+ denyListExcludeCategories?: string[];
557
+ /**
558
+ * Caller-owned exact terms to match through the
559
+ * deny-list layer. Requires `enableDenyList: true`.
560
+ */
561
+ customDenyList?: readonly CustomDenyListEntry[];
562
+ /**
563
+ * Caller-owned regex detectors. Requires
564
+ * `enableRegex: true`.
565
+ */
566
+ customRegexes?: readonly CustomRegexPattern[];
567
+ enableGazetteer: boolean;
568
+ /**
569
+ * Detect country names (ISO 3166-1 names, curated
570
+ * aliases, alpha-3 codes). Defaults to true. Names
571
+ * span all manifest languages plus widely-used
572
+ * additions (Dutch, Russian, Chinese, Arabic, etc.).
573
+ */
574
+ enableCountries?: boolean;
575
+ /**
576
+ * Reserved for compatibility with the removed TypeScript pipeline.
577
+ * The native pipeline rejects `true`; supply deterministic custom rules today
578
+ * and use the future caller-detection API for model-produced spans.
579
+ *
580
+ * @deprecated Native NER is not implemented.
581
+ */
582
+ enableNer?: boolean;
583
+ enableConfidenceBoost: boolean;
584
+ enableCoreference: boolean;
585
+ enableZoneClassification?: boolean;
586
+ enableHotwordRules?: boolean;
587
+ /**
588
+ * Requested output labels. An empty array means
589
+ * "do not filter by label" for deterministic detectors.
590
+ */
591
+ labels: string[];
592
+ workspaceId: string;
593
+ /**
594
+ * Pre-loaded dictionary data for name, deny-list,
595
+ * and city detection. When omitted, dictionary-based
596
+ * detection paths are skipped. Consumers load from
597
+ * the anonymize-data package and pass the data here.
598
+ */
599
+ dictionaries?: Dictionaries;
600
+ };
393
601
  //#endregion
394
602
  //#region src/native.d.ts
395
603
  type NativeBindingOperatorConfig = {
396
- operators?: Record<string, OperatorType>;
604
+ operators?: Record<string, OperatorSelection>;
397
605
  redactString?: string;
398
606
  };
607
+ type NativeBindingCallerRedactionOptions = {
608
+ requestJson: string;
609
+ operators?: NativeBindingOperatorConfig;
610
+ };
611
+ type NativeBindingSessionCallerRedactionInput = {
612
+ fullText: string;
613
+ requestJson: string;
614
+ };
615
+ type NativeBindingSessionCallerRedactionPlanOptions = {
616
+ inputs: NativeBindingSessionCallerRedactionInput[];
617
+ operators?: NativeBindingOperatorConfig;
618
+ observedAtEpochSeconds?: number;
619
+ };
620
+ type NativeBindingOpenSessionArchiveOptions = {
621
+ archive: Uint8Array;
622
+ key: Uint8Array;
623
+ expectedSessionId: string;
624
+ observedAtEpochSeconds?: number;
625
+ };
399
626
  type NativeDiagnosticsBatchCallback = (diagnosticsJson: string) => void;
400
627
  type NativeResultEventCallback = (eventJson: string) => void;
401
628
  type NativeBindingRedactionEntry = {
@@ -414,6 +641,8 @@ type NativeBindingPipelineEntity = {
414
641
  score: number;
415
642
  source: string;
416
643
  sourceDetail?: string | null;
644
+ providerId?: string | null;
645
+ detectionId?: string | null;
417
646
  };
418
647
  type NativeBindingRedactionResult = {
419
648
  redactedText: string;
@@ -425,14 +654,69 @@ type NativeBindingStaticRedactionResult = {
425
654
  resolvedEntities: NativeBindingPipelineEntity[];
426
655
  redaction: NativeBindingRedactionResult;
427
656
  };
657
+ type NativeSessionStatus = "active" | "not_yet_active" | "expired" | "deleted";
658
+ type NativeSessionLifecycle = {
659
+ createdAtEpochSeconds: number;
660
+ expiresAtEpochSeconds?: number;
661
+ };
662
+ type NativeSessionMetadata = {
663
+ sessionId: string;
664
+ createdAtEpochSeconds: number | null;
665
+ expiresAtEpochSeconds: number | null;
666
+ mappingCount: number;
667
+ status: NativeSessionStatus;
668
+ };
669
+ type NativeSessionDeletionSummary = {
670
+ sessionId: string;
671
+ deletedMappingCount: number;
672
+ };
673
+ type NativeSessionRedactionAtOptions = {
674
+ fullText: string;
675
+ observedAtEpochSeconds: number;
676
+ operators?: NativeOperatorConfig;
677
+ };
678
+ type NativeCreateSessionWithLifecycleOptions = NativeSessionLifecycle & {
679
+ sessionId: string;
680
+ };
681
+ type NativeOpenSessionArchiveOptions = {
682
+ archive: Uint8Array;
683
+ key: Uint8Array;
684
+ expectedSessionId: string;
685
+ observedAtEpochSeconds?: number;
686
+ };
687
+ type NativePreparedRedactionSessionBinding = {
688
+ sessionId: () => string;
689
+ mappingCount: () => number;
690
+ restoreText?: (fullText: string) => string;
691
+ restoreTextAt?: (fullText: string, observedAtEpochSeconds: number) => string;
692
+ toPlaintextJson: () => string;
693
+ toPlaintextJsonAt?: (observedAtEpochSeconds: number) => string;
694
+ toEncryptedArchive?: (key: Uint8Array) => Uint8Array;
695
+ toEncryptedArchiveAt?: (key: Uint8Array, observedAtEpochSeconds: number) => Uint8Array;
696
+ inspectJson?: (observedAtEpochSeconds?: number) => string;
697
+ deleteJson?: () => string;
698
+ redactStaticEntitiesJson: (fullText: string, operators?: NativeBindingOperatorConfig) => string;
699
+ redactStaticEntitiesJsonAt?: (fullText: string, observedAtEpochSeconds: number, operators?: NativeBindingOperatorConfig) => string;
700
+ planStaticEntitiesWithCallerDetections?: (options: NativeBindingSessionCallerRedactionPlanOptions) => NativePreparedSessionRedactionPlanBinding;
701
+ };
702
+ type NativePreparedSessionRedactionPlanBinding = {
703
+ resultJson: () => string;
704
+ commit: () => void;
705
+ };
428
706
  type NativePreparedSearchBinding = {
429
707
  prepareDiagnosticsJson?: () => string;
430
708
  warmLazyRegex?: () => void;
431
709
  warm_lazy_regex?: () => void;
432
710
  warmLazyRegexDiagnosticsJson?: () => string;
433
711
  warm_lazy_regex_diagnostics_json?: () => string;
712
+ createRedactionSession?: (sessionId: string) => NativePreparedRedactionSessionBinding;
713
+ createRedactionSessionWithLifecycle?: (sessionId: string, createdAtEpochSeconds: number, expiresAtEpochSeconds?: number) => NativePreparedRedactionSessionBinding;
714
+ restoreRedactionSession?: (plaintextJson: string) => NativePreparedRedactionSessionBinding;
715
+ restoreEncryptedRedactionSession?: (options: NativeBindingOpenSessionArchiveOptions) => NativePreparedRedactionSessionBinding;
434
716
  redactStaticEntities: (fullText: string, operators?: NativeBindingOperatorConfig) => NativeBindingStaticRedactionResult;
435
717
  redactStaticEntitiesJson?: (fullText: string, operators?: NativeBindingOperatorConfig) => string;
718
+ redactStaticEntitiesWithCallerDetectionsJson?: (fullText: string, options: NativeBindingCallerRedactionOptions) => string;
719
+ redactStaticEntitiesWithCallerDetectionsDiagnosticsJson?: (fullText: string, options: NativeBindingCallerRedactionOptions) => string;
436
720
  redactStaticEntitiesResultStreamJson?: (fullText: string, operators: NativeBindingOperatorConfig | undefined, onEvent: NativeResultEventCallback) => string;
437
721
  redactStaticEntitiesDiagnosticsJson?: (fullText: string, operators?: NativeBindingOperatorConfig) => string;
438
722
  redactStaticEntitiesDiagnosticsStreamJson?: (fullText: string, operators: NativeBindingOperatorConfig | undefined, onBatch: NativeDiagnosticsBatchCallback) => string;
@@ -455,9 +739,41 @@ type NativeAnonymizeBinding = {
455
739
  assembleStaticSearchCompressedPackageBytes?: (pipelineConfigJson: Uint8Array, dictionariesJson?: Uint8Array, gazetteerJson?: Uint8Array) => Uint8Array;
456
740
  };
457
741
  type NativeOperatorConfig = {
458
- operators?: Record<string, OperatorType>;
742
+ operators?: Record<string, OperatorSelection>;
459
743
  redactString?: string;
460
744
  };
745
+ declare const CALLER_DETECTION_CONTRACT_VERSION = 2;
746
+ type NativeCallerDetection = {
747
+ start: number;
748
+ end: number;
749
+ label: string;
750
+ score: number;
751
+ providerId: string;
752
+ detectionId: string;
753
+ };
754
+ type NativeCallerRedactionOptions = {
755
+ detections: readonly NativeCallerDetection[];
756
+ operators?: NativeOperatorConfig;
757
+ };
758
+ type NativeSessionCallerRedactionInput = {
759
+ fullText: string;
760
+ detections: readonly NativeCallerDetection[];
761
+ };
762
+ type NativeSessionCallerRedactionPlanOptions = {
763
+ inputs: readonly NativeSessionCallerRedactionInput[];
764
+ operators?: NativeOperatorConfig;
765
+ observedAtEpochSeconds?: number;
766
+ };
767
+ type NativeTextReplacement = {
768
+ start: number;
769
+ end: number;
770
+ replacement: string;
771
+ };
772
+ type NativeSessionBlockRedactionPlan = {
773
+ replacements: readonly NativeTextReplacement[];
774
+ entityCount: number;
775
+ callerEntityCount: number;
776
+ };
461
777
  type NativePipelineEntity = {
462
778
  start: number;
463
779
  end: number;
@@ -466,6 +782,8 @@ type NativePipelineEntity = {
466
782
  score: number;
467
783
  source: string;
468
784
  sourceDetail?: string;
785
+ providerId?: string;
786
+ detectionId?: string;
469
787
  };
470
788
  type NativeRedactionResult = {
471
789
  redactedText: string;
@@ -523,6 +841,44 @@ type NativeBindingVersionOptions = {
523
841
  binding: NativeAnonymizeBinding;
524
842
  expectedVersion: string;
525
843
  };
844
+ declare class PreparedNativeRedactionSession {
845
+ #private;
846
+ constructor(session: NativePreparedRedactionSessionBinding);
847
+ sessionId(): string;
848
+ session_id(): string;
849
+ mappingCount(): number;
850
+ mapping_count(): number;
851
+ restoreText(fullText: string, observedAtEpochSeconds?: number): string;
852
+ restore_text(fullText: string, observedAtEpochSeconds?: number): string;
853
+ toPlaintextJson(): string;
854
+ to_plaintext_json(): string;
855
+ toPlaintextJsonAt(observedAtEpochSeconds: number): string;
856
+ to_plaintext_json_at(observedAtEpochSeconds: number): string;
857
+ toEncryptedArchive(key: Uint8Array): Uint8Array;
858
+ to_encrypted_archive(key: Uint8Array): Uint8Array;
859
+ toEncryptedArchiveAt(key: Uint8Array, observedAtEpochSeconds: number): Uint8Array;
860
+ to_encrypted_archive_at(key: Uint8Array, observedAtEpochSeconds: number): Uint8Array;
861
+ inspect(observedAtEpochSeconds?: number): NativeSessionMetadata;
862
+ delete(): NativeSessionDeletionSummary;
863
+ redactStaticEntities(fullText: string, operators?: NativeOperatorConfig): NativeStaticRedactionResult;
864
+ redactText(fullText: string, operators?: NativeOperatorConfig): NativeStaticRedactionResult;
865
+ redact_text(fullText: string, operators?: NativeOperatorConfig): NativeStaticRedactionResult;
866
+ redactTextJson(fullText: string, operators?: NativeOperatorConfig): string;
867
+ redact_text_json(fullText: string, operators?: NativeOperatorConfig): string;
868
+ redactStaticEntitiesAt(options: NativeSessionRedactionAtOptions): NativeStaticRedactionResult;
869
+ redactTextAt(options: NativeSessionRedactionAtOptions): NativeStaticRedactionResult;
870
+ redact_text_at(options: NativeSessionRedactionAtOptions): NativeStaticRedactionResult;
871
+ redact_static_entities_at(options: NativeSessionRedactionAtOptions): NativeStaticRedactionResult;
872
+ redactTextJsonAt({ fullText, observedAtEpochSeconds, operators }: NativeSessionRedactionAtOptions): string;
873
+ redact_text_json_at(options: NativeSessionRedactionAtOptions): string;
874
+ planTextBatchWithCallerDetections({ inputs, operators, observedAtEpochSeconds }: NativeSessionCallerRedactionPlanOptions): PreparedNativeSessionRedactionPlan;
875
+ }
876
+ declare class PreparedNativeSessionRedactionPlan {
877
+ #private;
878
+ readonly blocks: readonly NativeSessionBlockRedactionPlan[];
879
+ constructor(plan: NativePreparedSessionRedactionPlanBinding);
880
+ commit(): void;
881
+ }
526
882
  declare class PreparedNativeAnonymizer {
527
883
  #private;
528
884
  constructor(prepared: NativePreparedSearchBinding);
@@ -532,9 +888,21 @@ declare class PreparedNativeAnonymizer {
532
888
  warm_lazy_regex(): void;
533
889
  warmLazyRegexDiagnosticsJson(): string | null;
534
890
  warm_lazy_regex_diagnostics_json(): string | null;
891
+ createRedactionSession(sessionId: string): PreparedNativeRedactionSession;
892
+ create_redaction_session(sessionId: string): PreparedNativeRedactionSession;
893
+ createRedactionSessionWithLifecycle({ sessionId, createdAtEpochSeconds, expiresAtEpochSeconds }: NativeCreateSessionWithLifecycleOptions): PreparedNativeRedactionSession;
894
+ create_redaction_session_with_lifecycle(options: NativeCreateSessionWithLifecycleOptions): PreparedNativeRedactionSession;
895
+ restoreRedactionSession(plaintextJson: string): PreparedNativeRedactionSession;
896
+ restore_redaction_session(plaintextJson: string): PreparedNativeRedactionSession;
897
+ restoreEncryptedRedactionSession({ archive, key, expectedSessionId, observedAtEpochSeconds }: NativeOpenSessionArchiveOptions): PreparedNativeRedactionSession;
898
+ restore_encrypted_redaction_session(options: NativeOpenSessionArchiveOptions): PreparedNativeRedactionSession;
535
899
  redactStaticEntities(fullText: string, operators?: NativeOperatorConfig): NativeStaticRedactionResult;
536
900
  redact_text(fullText: string, operators?: NativeOperatorConfig): NativeStaticRedactionResult;
537
901
  redact_text_json(fullText: string, operators?: NativeOperatorConfig): string;
902
+ redactStaticEntitiesWithCallerDetections(fullText: string, options: NativeCallerRedactionOptions): NativeStaticRedactionResult;
903
+ redact_text_with_caller_detections(fullText: string, options: NativeCallerRedactionOptions): NativeStaticRedactionResult;
904
+ redactStaticEntitiesWithCallerDetectionsDiagnosticsJson(fullText: string, options: NativeCallerRedactionOptions): string | null;
905
+ redact_static_entities_with_caller_detections_diagnostics_json(fullText: string, options: NativeCallerRedactionOptions): string | null;
538
906
  redactTextJson(fullText: string, operators?: NativeOperatorConfig): string;
539
907
  redactTextStreamJson(fullText: string, onEvent: NativeResultEventCallback, operators?: NativeOperatorConfig): string | null;
540
908
  redact_text_stream_json(fullText: string, onEvent: NativeResultEventCallback, operators?: NativeOperatorConfig): string | null;
@@ -554,9 +922,21 @@ declare class PreparedNativePipeline {
554
922
  warm_lazy_regex(): void;
555
923
  warmLazyRegexDiagnosticsJson(): string | null;
556
924
  warm_lazy_regex_diagnostics_json(): string | null;
925
+ createRedactionSession(sessionId: string): PreparedNativeRedactionSession;
926
+ create_redaction_session(sessionId: string): PreparedNativeRedactionSession;
927
+ createRedactionSessionWithLifecycle(options: NativeCreateSessionWithLifecycleOptions): PreparedNativeRedactionSession;
928
+ create_redaction_session_with_lifecycle(options: NativeCreateSessionWithLifecycleOptions): PreparedNativeRedactionSession;
929
+ restoreRedactionSession(plaintextJson: string): PreparedNativeRedactionSession;
930
+ restore_redaction_session(plaintextJson: string): PreparedNativeRedactionSession;
931
+ restoreEncryptedRedactionSession(options: NativeOpenSessionArchiveOptions): PreparedNativeRedactionSession;
932
+ restore_encrypted_redaction_session(options: NativeOpenSessionArchiveOptions): PreparedNativeRedactionSession;
557
933
  redactText(fullText: string, operators?: NativeOperatorConfig): NativeStaticRedactionResult;
558
934
  redact_text(fullText: string, operators?: NativeOperatorConfig): NativeStaticRedactionResult;
559
935
  redact_text_json(fullText: string, operators?: NativeOperatorConfig): string;
936
+ redactTextWithCallerDetections(fullText: string, options: NativeCallerRedactionOptions): NativeStaticRedactionResult;
937
+ redact_text_with_caller_detections(fullText: string, options: NativeCallerRedactionOptions): NativeStaticRedactionResult;
938
+ redactTextWithCallerDetectionsDiagnosticsJson(fullText: string, options: NativeCallerRedactionOptions): string | null;
939
+ redact_text_with_caller_detections_diagnostics_json(fullText: string, options: NativeCallerRedactionOptions): string | null;
560
940
  redactTextJson(fullText: string, operators?: NativeOperatorConfig): string;
561
941
  redactTextStreamJson(fullText: string, onEvent: NativeResultEventCallback, operators?: NativeOperatorConfig): string | null;
562
942
  redact_text_stream_json(fullText: string, onEvent: NativeResultEventCallback, operators?: NativeOperatorConfig): string | null;
@@ -570,32 +950,32 @@ declare class PreparedNativePipeline {
570
950
  declare const encodeNativeSearchConfig: (config: NativePreparedSearchConfig) => Uint8Array;
571
951
  declare const encodeNativeSearchConfigInput: (config: NativeSearchPackageInput) => Uint8Array;
572
952
  declare const getNativeBindingVersion: (binding: NativeAnonymizeBinding) => string;
573
- declare const assertNativeBindingVersion: ({
574
- binding,
575
- expectedVersion
576
- }: NativeBindingVersionOptions) => void;
577
- declare const prepareNativeSearchPackage: ({
578
- binding,
579
- config,
580
- compressed
581
- }: NativeSearchPackageOptions) => Uint8Array;
582
- declare const createNativeAnonymizerFromConfig: ({
583
- binding,
584
- config
585
- }: NativeAnonymizerFromConfigOptions) => PreparedNativeAnonymizer;
586
- declare const createNativeAnonymizerFromPackage: ({
587
- binding,
588
- packageBytes
589
- }: NativeAnonymizerFromPackageOptions) => PreparedNativeAnonymizer;
590
- declare const createNativePipelineFromPackage: ({
591
- binding,
592
- packageBytes
593
- }: NativePipelineFromPackageOptions) => PreparedNativePipeline;
953
+ declare const assertNativeBindingVersion: ({ binding, expectedVersion }: NativeBindingVersionOptions) => void;
954
+ declare const prepareNativeSearchPackage: ({ binding, config, compressed }: NativeSearchPackageOptions) => Uint8Array;
955
+ declare const createNativeAnonymizerFromConfig: ({ binding, config }: NativeAnonymizerFromConfigOptions) => PreparedNativeAnonymizer;
956
+ declare const createNativeAnonymizerFromPackage: ({ binding, packageBytes }: NativeAnonymizerFromPackageOptions) => PreparedNativeAnonymizer;
957
+ declare const createNativePipelineFromPackage: ({ binding, packageBytes }: NativePipelineFromPackageOptions) => PreparedNativePipeline;
594
958
  declare const PreparedSearch: typeof PreparedNativeAnonymizer;
595
959
  type PreparedSearch = PreparedNativeAnonymizer;
596
960
  declare const PreparedAnonymizer: typeof PreparedNativeAnonymizer;
597
961
  type PreparedAnonymizer = PreparedNativeAnonymizer;
598
962
  //#endregion
963
+ //#region src/context.d.ts
964
+ /**
965
+ * Cached state for a single pipeline run (or a sequence of runs sharing the
966
+ * same config). The native pipeline builds its prepared package once and reuses
967
+ * it across calls with the same config; the package bytes and the key/promise
968
+ * that guard concurrent builds live here so callers can share one warmed
969
+ * context.
970
+ */
971
+ type PipelineContext = {
972
+ nativePipelinePackage: Uint8Array | null;
973
+ nativePipelinePackageKey: string;
974
+ nativePipelinePackagePromise: Promise<Uint8Array> | null;
975
+ };
976
+ /** Create a fresh, empty pipeline context. */
977
+ declare const createPipelineContext: () => PipelineContext;
978
+ //#endregion
599
979
  //#region src/redact.d.ts
600
980
  /**
601
981
  * Serialize the redaction key to JSON for export.
@@ -609,6 +989,29 @@ declare const exportRedactionKey: (redactionMap: Map<string, string>, operatorMa
609
989
  */
610
990
  declare const deanonymise: (redactedText: string, redactionMap: Map<string, string>) => string;
611
991
  //#endregion
992
+ //#region src/native-pipeline.d.ts
993
+ type NativePipelineUnsupportedFeature = "enableNer";
994
+ type NativePipelineCompatibility = {
995
+ status: "supported";
996
+ } | {
997
+ status: "unsupported";
998
+ unsupportedFeatures: NativePipelineUnsupportedFeature[];
999
+ };
1000
+ type NativePipelineBuildOptions = {
1001
+ binding: NativeAnonymizeBinding;
1002
+ config: PipelineConfig;
1003
+ gazetteerEntries?: GazetteerEntry[];
1004
+ context?: PipelineContext;
1005
+ };
1006
+ type NativePipelinePackageOptions = NativePipelineBuildOptions & {
1007
+ compressed?: boolean;
1008
+ };
1009
+ declare const getNativePipelineCompatibility: (config: PipelineConfig) => NativePipelineCompatibility;
1010
+ declare const assertNativePipelineSupported: (config: PipelineConfig) => void;
1011
+ declare const prepareNativePipelineConfig: ({ binding, config, gazetteerEntries }: Omit<NativePipelineBuildOptions, "context">) => Promise<NativePreparedSearchConfig>;
1012
+ declare const prepareNativePipelinePackage: ({ binding, config, gazetteerEntries, context, compressed }: NativePipelinePackageOptions) => Promise<Uint8Array>;
1013
+ declare const createNativePipelineFromConfig: ({ binding, config, gazetteerEntries, context }: NativePipelineBuildOptions) => Promise<PreparedNativePipeline>;
1014
+ //#endregion
612
1015
  //#region src/wasm.d.ts
613
1016
  /** A prepared package the caller supplies: raw bytes, an ArrayBuffer, or a URL
614
1017
  * (string or `URL`) that resolves to the package and is fetched. */
@@ -653,10 +1056,7 @@ declare const normalize_for_search: (text: string, options?: WasmBindingOptions)
653
1056
  type PrepareSearchPackageOptions = WasmBindingOptions & {
654
1057
  compressed?: boolean;
655
1058
  };
656
- declare const prepare_search_package: (config: NativeSearchPackageInput, {
657
- compressed,
658
- ...options
659
- }?: PrepareSearchPackageOptions) => Promise<Uint8Array>;
1059
+ declare const prepare_search_package: (config: NativeSearchPackageInput, { compressed, ...options }?: PrepareSearchPackageOptions) => Promise<Uint8Array>;
660
1060
  declare const redact_text: (config: NativeSearchPackageInput, fullText: string, operators?: NativeOperatorConfig, options?: WasmBindingOptions) => Promise<NativeStaticRedactionResult>;
661
1061
  declare const redact_text_json: (config: NativeSearchPackageInput, fullText: string, operators?: NativeOperatorConfig, options?: WasmBindingOptions) => Promise<string>;
662
1062
  declare const redact_text_stream_json: (config: NativeSearchPackageInput, fullText: string, onEvent: NativeResultEventCallback, operators?: NativeOperatorConfig, options?: WasmBindingOptions) => Promise<string | null>;
@@ -664,5 +1064,5 @@ declare const diagnostics_json: (config: NativeSearchPackageInput, fullText: str
664
1064
  declare const diagnostics_stream_json: (config: NativeSearchPackageInput, fullText: string, onBatch: NativeDiagnosticsBatchCallback, operators?: NativeOperatorConfig, options?: WasmBindingOptions) => Promise<string | null>;
665
1065
  declare const summary_diagnostics_json: (config: NativeSearchPackageInput, fullText: string, operators?: NativeOperatorConfig, options?: WasmBindingOptions) => Promise<string | null>;
666
1066
  //#endregion
667
- export { type AnonymisationOperator, DEFAULT_ENTITY_LABELS, DETECTION_SOURCES, DETECTOR_PRIORITY, type DetectionSource, type Entity, LoadPreparedPackageOptions, NativeAnonymizeBinding, NativeAnonymizerFromConfigOptions, NativeAnonymizerFromPackageOptions, NativeBindingVersionOptions, NativeDiagnosticsBatchCallback, NativeNormalizeOptions, NativeOperatorConfig, NativePipelineEntity, NativePipelineFromPackageOptions, NativePreparedSearchBinding, type NativePreparedSearchConfig, NativeRedactionResult, NativeResultEventCallback, NativeSearchPackageInput, NativeSearchPackageOptions, NativeStaticRedactionResult, OPERATOR_TYPES, type OperatorConfig, type OperatorType, PrepareSearchPackageOptions, PreparedAnonymizer, PreparedNativeAnonymizer, PreparedNativePipeline, PreparedPackageSource, PreparedSearch, type RedactionResult, type ReviewDecision, type ReviewedEntity, SharedNativeDiagnosticsJsonOptions, SharedNativeDiagnosticsStreamJsonOptions, SharedNativePreparedPackageOptions, SharedNativeRedactTextJsonOptions, SharedNativeRedactTextOptions, SharedNativeRedactTextStreamJsonOptions, SharedNativeSearchPackageOptions, WasmBindingOptions, assertNativeBindingVersion, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromPackage, deanonymise, defaultPackageUrl, diagnostics_json, diagnostics_stream_json, encodeNativeSearchConfig, encodeNativeSearchConfigInput, exportRedactionKey, getBinding, getDefaultPipeline, getNativeBindingVersion, loadDefaultPipeline, loadPipeline, load_prepared_package, native_package_version, normalize_for_search, prepareNativeSearchPackage, prepare_search_package, redactDefaultText, redactDefaultTextJson, redact_text, redact_text_json, redact_text_stream_json, summary_diagnostics_json };
1067
+ export { type AnonymisationOperator, CALLER_DETECTION_CONTRACT_VERSION, CAPABILITY_MANIFEST, CAPABILITY_MANIFEST_SCHEMA_VERSION, CAPABILITY_RUNTIMES, type CapabilityManifest, type CapabilityRuntime, DEFAULT_ENTITY_LABELS, DETECTION_SOURCES, DETECTOR_PRIORITY, type DefaultEntityLabel, type DetectionSource, type Dictionaries, ENTITY_CAPABILITIES, ENTITY_LABELS, ENTITY_SELECTIONS, type Entity, type EntityCapability, type EntityLabel, type EntitySelection, type GazetteerEntry, LoadPreparedPackageOptions, NativeAnonymizeBinding, NativeAnonymizerFromConfigOptions, NativeAnonymizerFromPackageOptions, NativeBindingVersionOptions, NativeCallerDetection, NativeCallerRedactionOptions, NativeCreateSessionWithLifecycleOptions, NativeDiagnosticsBatchCallback, NativeNormalizeOptions, NativeOpenSessionArchiveOptions, NativeOperatorConfig, type NativePipelineBuildOptions, type NativePipelineCompatibility, NativePipelineEntity, NativePipelineFromPackageOptions, type NativePipelinePackageOptions, type NativePipelineUnsupportedFeature, NativePreparedRedactionSessionBinding, NativePreparedSearchBinding, type NativePreparedSearchConfig, NativePreparedSessionRedactionPlanBinding, NativeRedactionResult, NativeResultEventCallback, NativeSearchPackageInput, NativeSearchPackageOptions, NativeSessionBlockRedactionPlan, NativeSessionCallerRedactionInput, NativeSessionCallerRedactionPlanOptions, NativeSessionDeletionSummary, NativeSessionLifecycle, NativeSessionMetadata, NativeSessionRedactionAtOptions, NativeSessionStatus, NativeStaticRedactionResult, NativeTextReplacement, OPERATOR_TYPES, type OperatorConfig, type OperatorType, type PipelineConfig, type PipelineContext, PrepareSearchPackageOptions, PreparedAnonymizer, PreparedNativeAnonymizer, PreparedNativePipeline, PreparedNativeRedactionSession, PreparedNativeSessionRedactionPlan, PreparedPackageSource, PreparedSearch, type RedactionResult, type ReviewDecision, type ReviewedEntity, SharedNativeDiagnosticsJsonOptions, SharedNativeDiagnosticsStreamJsonOptions, SharedNativePreparedPackageOptions, SharedNativeRedactTextJsonOptions, SharedNativeRedactTextOptions, SharedNativeRedactTextStreamJsonOptions, SharedNativeSearchPackageOptions, WasmBindingOptions, assertNativeBindingVersion, assertNativePipelineSupported, createNativeAnonymizerFromConfig, createNativeAnonymizerFromPackage, createNativePipelineFromConfig, createNativePipelineFromPackage, createPipelineContext, deanonymise, defaultPackageUrl, diagnostics_json, diagnostics_stream_json, encodeNativeSearchConfig, encodeNativeSearchConfigInput, exportRedactionKey, getBinding, getDefaultPipeline, getNativeBindingVersion, getNativePipelineCompatibility, loadDefaultPipeline, loadPipeline, load_prepared_package, native_package_version, normalize_for_search, prepareNativePipelineConfig, prepareNativePipelinePackage, prepareNativeSearchPackage, prepare_search_package, redactDefaultText, redactDefaultTextJson, redact_text, redact_text_json, redact_text_stream_json, summary_diagnostics_json };
668
1068
  //# sourceMappingURL=wasm.d.mts.map