@incodetech/core 0.0.0-dev-20260928-e8e00ca9 → 0.0.0-dev-20260928-85249f77
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/{BrowserDiagnosticsCryptoProvider-CglolaLX.esm.js → BrowserDiagnosticsCryptoProvider-BuzqvbhN.esm.js} +6 -24
- package/dist/{FaceDetectionProvider-ZWuTisXf.esm.js → FaceDetectionProvider-CSjiXOo7.esm.js} +7 -7
- package/dist/{MotionSensorProvider-Bti5f6op.esm.js → MotionSensorProvider-1Ul_1GPn.esm.js} +1 -1
- package/dist/ae-signature.esm.js +1 -1
- package/dist/{apiError-DqxsUXGC.esm.js → apiError-DmDlw1pl.esm.js} +1 -1
- package/dist/authentication.d.ts +2 -2
- package/dist/authentication.esm.js +2 -2
- package/dist/{authenticationManager-DgCLrxXN.esm.js → authenticationManager-B9l6NeDe.esm.js} +4 -4
- package/dist/{authenticationManager-B-MR_-Si.d.ts → authenticationManager-DE40FMUU.d.ts} +1 -1
- package/dist/{authenticationStateMachine-DECsoldb.esm.js → authenticationStateMachine-BGme0djA.esm.js} +3 -3
- package/dist/camera.esm.js +1 -1
- package/dist/consent.d.ts +1 -1
- package/dist/{consentManager-Cv_0QKLD.d.ts → consentManager-CTdFloVJ.d.ts} +1 -1
- package/dist/{createCameraCycleOwnership-BjoMVvya.esm.js → createCameraCycleOwnership-P1AtkhRJ.esm.js} +6 -1
- package/dist/{deepsightLoader-DidR7w-7.esm.js → deepsightLoader-BY2NIp7n.esm.js} +6 -6
- package/dist/document-capture.d.ts +1 -1
- package/dist/document-capture.esm.js +2 -2
- package/dist/{documentCaptureManager-CbAGkHWh.d.ts → documentCaptureManager-C8eO0hbv.d.ts} +1 -1
- package/dist/{documentCaptureManager-7e1RLKhG.esm.js → documentCaptureManager-DRAn04PI.esm.js} +1 -1
- package/dist/{documentCaptureStateMachine-DyJb_vDQ.esm.js → documentCaptureStateMachine-BS9VBtqN.esm.js} +2 -2
- package/dist/dynamic-forms.esm.js +2 -2
- package/dist/{dynamicFormsManager-B5GSLZvO.esm.js → dynamicFormsManager-CTJzsDqC.esm.js} +1 -1
- package/dist/{dynamicFormsStateMachine-DAq-HoCA.esm.js → dynamicFormsStateMachine-8oOTouxq.esm.js} +1 -1
- package/dist/ekyb.esm.js +3 -3
- package/dist/{ekybManager-7ljnpTt2.esm.js → ekybManager-CKNCVYs7.esm.js} +1 -1
- package/dist/{ekybStateMachine-CD8oLnoa.esm.js → ekybStateMachine-BDQHv558.esm.js} +1 -1
- package/dist/electronic-signature.esm.js +1 -1
- package/dist/{electronicSignatureManager-r2Zci23-.esm.js → electronicSignatureManager-BbgLJk1x.esm.js} +1 -1
- package/dist/extensibility.d.ts +9 -9
- package/dist/extensibility.esm.js +12 -12
- package/dist/{faceCaptureManagerFactory-OSygJ72q.esm.js → faceCaptureManagerFactory-DG4z3rkR.esm.js} +3 -3
- package/dist/{faceCaptureManagerFactory-BgbP5N1j.d.ts → faceCaptureManagerFactory-s0Vhw_wP.d.ts} +80 -40
- package/dist/{faceCaptureSetup-DSvOibxj.esm.js → faceCaptureSetup-GzW2oNiM.esm.js} +261 -58
- package/dist/{feature-management-BhzWEsyZ.esm.js → feature-management-02JHuEhD.esm.js} +1 -1
- package/dist/feature-management.esm.js +1 -1
- package/dist/flow.esm.js +3 -3
- package/dist/{flowCompletionService-B-ri1Pvq.esm.js → flowCompletionService-BAg6qc6d.esm.js} +1 -1
- package/dist/{flowServices-C62Eyo7N.esm.js → flowServices-Dc-EUuwB.esm.js} +5 -5
- package/dist/geolocation.esm.js +2 -2
- package/dist/{geolocationManager-BU4OLtRY.esm.js → geolocationManager-v0LZK1kW.esm.js} +1 -1
- package/dist/{geolocationStateMachine-D8UrSeXQ.esm.js → geolocationStateMachine-DfdsEj7L.esm.js} +1 -1
- package/dist/id-ocr.d.ts +1 -1
- package/dist/id-selfie-flow.esm.js +9 -10
- package/dist/id.d.ts +2 -2
- package/dist/id.esm.js +4 -4
- package/dist/{idCaptureDefaults-B6gkShby.esm.js → idCaptureDefaults-Ba-m1uO3.esm.js} +3 -3
- package/dist/{idCaptureManager-DIT7ZyEa.esm.js → idCaptureManager-Bfrj7DvH.esm.js} +6 -5
- package/dist/{idCaptureManager-poTdJI74.d.ts → idCaptureManager-DfHdJLmj.d.ts} +29 -5
- package/dist/{idCaptureServices-Cl67CI_t.esm.js → idCaptureServices-DKeVf0Gu.esm.js} +67 -12
- package/dist/{idCaptureStateMachine-BADMFRXg.esm.js → idCaptureStateMachine-BL3MnDOu.esm.js} +222 -77
- package/dist/{idOcrManager-DT3kPIB3.d.ts → idOcrManager-BTdHlJ9D.d.ts} +1 -1
- package/dist/identity-reuse.d.ts +1 -1
- package/dist/{identityReuseManager-x2QG6QAm.d.ts → identityReuseManager-D0-4bAeK.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/mandatory-consent.d.ts +1 -1
- package/dist/{mandatoryConsentManager-DzIGk6u7.d.ts → mandatoryConsentManager-S94mjtTG.d.ts} +1 -1
- package/dist/{multipartRecordingService-Dw0scizg.esm.js → multipartRecordingService-mwKFTlhR.esm.js} +42 -1
- package/dist/{permissionGuards-DAyjPT2R.esm.js → permissionGuards-DS36X5Hh.esm.js} +1 -1
- package/dist/{permissionServices-DIaG8BlW.esm.js → permissionServices-B9IqVf3c.esm.js} +2 -2
- package/dist/qe-signature.esm.js +1 -1
- package/dist/{runChildModule-CoWvzHhB.esm.js → runChildModule-DQbERvPv.esm.js} +1 -1
- package/dist/{safeStorage-C511Hltw.esm.js → safeStorage-Q_iUpxa8.esm.js} +1 -1
- package/dist/{sdkVersion-sSFpdmZk.esm.js → sdkVersion-kGZmwBhf.esm.js} +1 -1
- package/dist/selfie.d.ts +2 -2
- package/dist/selfie.esm.js +7 -7
- package/dist/{selfieManager-Be-moOeO.esm.js → selfieManager-B-F-lrAH.esm.js} +4 -4
- package/dist/{selfieManager-oSsnyvBl.d.ts → selfieManager-PVc2k2Oq.d.ts} +1 -1
- package/dist/{selfieStateMachine-0bHX1R9_.esm.js → selfieStateMachine--KjoErrq.esm.js} +2 -2
- package/dist/{session-DjUhUWYA.esm.js → session-Bb5KuwEu.esm.js} +3 -3
- package/dist/session.esm.js +4 -4
- package/dist/{sessionInitializer-_BmsjkUB.esm.js → sessionInitializer-D-gzxDwN.esm.js} +4 -4
- package/dist/{setup-CHHZ8BBM.d.ts → setup-BdeKbA9K.d.ts} +4 -17
- package/dist/{setup-D7B4g7Jc.esm.js → setup-Cb7Ws1HA.esm.js} +8 -58
- package/dist/{tri-4RsGrIt6.esm.js → tri-xzRLIIMN.esm.js} +0 -10
- package/dist/tri.esm.js +1 -1
- package/dist/{trueSightService-Bb116pCE.esm.js → trueSightService-D8dk4ZID.esm.js} +16 -554
- package/dist/video-selfie.esm.js +5 -5
- package/dist/{videoSelfieCameraWarmer-CeZLd5w_.esm.js → videoSelfieCameraWarmer-CkdLS8NK.esm.js} +5 -5
- package/dist/{warmup-REsua-sF.esm.js → warmup-DLq_t-Zu.esm.js} +5 -0
- package/dist/wasm.d.ts +1 -1
- package/dist/wasm.esm.js +3 -3
- package/dist/{wasmDsFlagSync-Czjlp68o.esm.js → wasmDsFlagSync-DyNj8RY_.esm.js} +1 -1
- package/dist/workflow.esm.js +15 -15
- package/package.json +2 -7
- package/dist/FaceDetectionProvider-Di1DmZu1.d.ts +0 -36
- package/dist/StreamCanvasProcessingSession-CBnbTnOr.esm.js +0 -42
- package/dist/personhood.d.ts +0 -537
- package/dist/personhood.esm.js +0 -1574
- package/dist/types-CfuWgAi-.d.ts +0 -1
|
@@ -2,8 +2,8 @@ import { a as setWebApiHttpTransport, f as deriveSiblingJsPath, i as initializeW
|
|
|
2
2
|
import { t as getTimestamp } from "./IBrowserEnvironmentCapability-DEaRRk-R.esm.js";
|
|
3
3
|
import { i as isApiConfigured, n as getApi, o as setClient, r as getToken, t as api } from "./api-Bx3gKW_y.esm.js";
|
|
4
4
|
import { n as reportHttpError, t as HttpRequestError } from "./HttpRequestError-Bh0pNGSC.esm.js";
|
|
5
|
-
import {
|
|
6
|
-
import { t as SDK_VERSION } from "./sdkVersion-
|
|
5
|
+
import { n as eventModuleNames } from "./events-ijlbX_Wx.esm.js";
|
|
6
|
+
import { t as SDK_VERSION } from "./sdkVersion-kGZmwBhf.esm.js";
|
|
7
7
|
import { t as endpoints } from "./endpoints-B-3Q-LUw.esm.js";
|
|
8
8
|
//#region ../infra/src/wasm/wasmDefaults.ts
|
|
9
9
|
const WASM_CDN_BASE_URL = "https://cdn.incodesmile.com/ml-wasm-kit-release";
|
|
@@ -681,8 +681,6 @@ async function withHandshakeFailureContext(wantsEncryption, fn) {
|
|
|
681
681
|
throw error;
|
|
682
682
|
}
|
|
683
683
|
}
|
|
684
|
-
/** Dirty-timer half of the interrupted-snapshot rebuild debounce (module boundaries + timer). */
|
|
685
|
-
const SNAPSHOT_DIRTY_INTERVAL_MS = 15e3;
|
|
686
684
|
/** Hard cap per log message, UTF-8 bytes (contract). */
|
|
687
685
|
const MESSAGE_MAX_BYTES = 8 * 1024;
|
|
688
686
|
const TRUESIGHT_SDK_ID = "IncdOnboarding";
|
|
@@ -763,92 +761,6 @@ function truncateUtf8(value, maxBytes) {
|
|
|
763
761
|
}
|
|
764
762
|
return result + TRUNCATION_SUFFIX;
|
|
765
763
|
}
|
|
766
|
-
const EVICTION_ORDER = [
|
|
767
|
-
"verbose",
|
|
768
|
-
"debug",
|
|
769
|
-
"info"
|
|
770
|
-
];
|
|
771
|
-
function createLogBuffer(options = {}) {
|
|
772
|
-
const flushThresholdBytes = options.flushThresholdBytes ?? 6e5;
|
|
773
|
-
const maxEntries = options.maxEntries ?? 5e3;
|
|
774
|
-
const { onOverflow } = options;
|
|
775
|
-
const entries = [];
|
|
776
|
-
let mode = onOverflow ? "flush" : "evict";
|
|
777
|
-
let nextIndex = 0;
|
|
778
|
-
let bytes = 0;
|
|
779
|
-
let dropped = 0;
|
|
780
|
-
let overflowPending = false;
|
|
781
|
-
function entryCost(entry) {
|
|
782
|
-
return utf8ByteLength(entry.message) + utf8ByteLength(entry.subsystem) + 120;
|
|
783
|
-
}
|
|
784
|
-
function removeAt(position) {
|
|
785
|
-
const [removed] = entries.splice(position, 1);
|
|
786
|
-
bytes -= entryCost(removed);
|
|
787
|
-
dropped += 1;
|
|
788
|
-
}
|
|
789
|
-
/** Lowest level first (oldest within it); warning+ only as the last resort. */
|
|
790
|
-
function evictOne() {
|
|
791
|
-
for (const level of EVICTION_ORDER) {
|
|
792
|
-
const position = entries.findIndex((entry) => entry.level === level);
|
|
793
|
-
if (position !== -1) {
|
|
794
|
-
removeAt(position);
|
|
795
|
-
return;
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
removeAt(0);
|
|
799
|
-
}
|
|
800
|
-
function copyOf(entry) {
|
|
801
|
-
return { ...entry };
|
|
802
|
-
}
|
|
803
|
-
return {
|
|
804
|
-
append(level, subsystem, category, message) {
|
|
805
|
-
const entry = {
|
|
806
|
-
index: nextIndex,
|
|
807
|
-
timestampMs: getTimestamp(),
|
|
808
|
-
level,
|
|
809
|
-
subsystem,
|
|
810
|
-
category,
|
|
811
|
-
message: sanitizeMessage(message)
|
|
812
|
-
};
|
|
813
|
-
nextIndex += 1;
|
|
814
|
-
entries.push(entry);
|
|
815
|
-
bytes += entryCost(entry);
|
|
816
|
-
if (mode === "flush" && onOverflow) {
|
|
817
|
-
if (!overflowPending && bytes >= flushThresholdBytes) {
|
|
818
|
-
overflowPending = true;
|
|
819
|
-
onOverflow(entries.map(copyOf));
|
|
820
|
-
}
|
|
821
|
-
} else while (bytes > flushThresholdBytes && entries.length > 1) evictOne();
|
|
822
|
-
while (entries.length > maxEntries) evictOne();
|
|
823
|
-
},
|
|
824
|
-
snapshot() {
|
|
825
|
-
return entries.map(copyOf);
|
|
826
|
-
},
|
|
827
|
-
sliceSince(index) {
|
|
828
|
-
return entries.filter((entry) => entry.index > index).map(copyOf);
|
|
829
|
-
},
|
|
830
|
-
markFlushed(uptoIndex) {
|
|
831
|
-
let removedBytes = 0;
|
|
832
|
-
let keepFrom = 0;
|
|
833
|
-
while (keepFrom < entries.length && entries[keepFrom].index <= uptoIndex) {
|
|
834
|
-
removedBytes += entryCost(entries[keepFrom]);
|
|
835
|
-
keepFrom += 1;
|
|
836
|
-
}
|
|
837
|
-
entries.splice(0, keepFrom);
|
|
838
|
-
bytes -= removedBytes;
|
|
839
|
-
overflowPending = false;
|
|
840
|
-
},
|
|
841
|
-
setOverflowMode(next) {
|
|
842
|
-
mode = next;
|
|
843
|
-
},
|
|
844
|
-
get droppedCount() {
|
|
845
|
-
return dropped;
|
|
846
|
-
},
|
|
847
|
-
get byteEstimate() {
|
|
848
|
-
return bytes;
|
|
849
|
-
}
|
|
850
|
-
};
|
|
851
|
-
}
|
|
852
764
|
//#endregion
|
|
853
765
|
//#region ../infra/src/crypto/randomUUID.ts
|
|
854
766
|
/**
|
|
@@ -965,14 +877,6 @@ function toContractEntry(entry) {
|
|
|
965
877
|
category: entry.category
|
|
966
878
|
};
|
|
967
879
|
}
|
|
968
|
-
//#endregion
|
|
969
|
-
//#region src/internal/trueSight/sessionMetadata.ts
|
|
970
|
-
/**
|
|
971
|
-
* Hosts that match this pattern are non-prod by heuristic. Known failure modes
|
|
972
|
-
* (customer CNAMEs, devMode left on in prod) are documented for the planned
|
|
973
|
-
* P1 team review — see plan §Operating decisions (B6).
|
|
974
|
-
*/
|
|
975
|
-
const NON_PROD_HOST_PATTERN = /stage|demo|saas-dev|localhost/i;
|
|
976
880
|
function createInitialState() {
|
|
977
881
|
return {
|
|
978
882
|
sessionId: null,
|
|
@@ -996,67 +900,16 @@ function createInitialState() {
|
|
|
996
900
|
}
|
|
997
901
|
let state = createInitialState();
|
|
998
902
|
let sources = {};
|
|
999
|
-
function stampStartedAtOnce() {
|
|
1000
|
-
if (state.startedAtMs === null) state.startedAtMs = getTimestamp();
|
|
1001
|
-
}
|
|
1002
903
|
/** Tap for `createSession` — sessionId comes from the returned `interviewId`. */
|
|
1003
|
-
function noteSessionCreated(session, options = {}) {
|
|
1004
|
-
|
|
1005
|
-
stampStartedAtOnce();
|
|
1006
|
-
state.sdkLanguage = options.language ?? state.sdkLanguage;
|
|
1007
|
-
state.hasConfigurationId = state.hasConfigurationId || options.configurationId !== void 0;
|
|
1008
|
-
state.hasExternalCustomerId = state.hasExternalCustomerId || options.externalCustomerId !== void 0;
|
|
1009
|
-
state.hasProvidedSessionId = state.hasProvidedSessionId || options.interviewId !== void 0;
|
|
1010
|
-
}
|
|
1011
|
-
/**
|
|
1012
|
-
* Fallback sessionId for host-minted-token integrations that never called
|
|
1013
|
-
* `createSession`: `Features.sessionIdentifier` — used only when no
|
|
1014
|
-
* `interviewId` was observed.
|
|
1015
|
-
*/
|
|
1016
|
-
function noteFeatureConfig(features) {
|
|
1017
|
-
if (!state.sessionId && features.sessionIdentifier) {
|
|
1018
|
-
state.sessionId = features.sessionIdentifier;
|
|
1019
|
-
stampStartedAtOnce();
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
/**
|
|
1023
|
-
* Entry-surface discriminator. `startOnboardingSection` is the default (weakest
|
|
1024
|
-
* signal — standalone module managers); richer surfaces upgrade it and are never
|
|
1025
|
-
* downgraded back.
|
|
1026
|
-
*/
|
|
1027
|
-
function noteIntegrationSurface(integrationType) {
|
|
1028
|
-
if (integrationType === "startOnboardingSection") return;
|
|
1029
|
-
state.integrationType = integrationType;
|
|
1030
|
-
}
|
|
1031
|
-
function noteEnvironment(environment) {
|
|
1032
|
-
state.browser = environment.browser ?? state.browser;
|
|
1033
|
-
state.osVersion = environment.osVersion ?? state.osVersion;
|
|
1034
|
-
state.osLanguage = environment.osLanguage ?? state.osLanguage;
|
|
1035
|
-
}
|
|
1036
|
-
/**
|
|
1037
|
-
* WRITE-ONCE orchestrator identity (determinism guarantee for debugging):
|
|
1038
|
-
* a session is a flow or a workflow from its first orchestrator observation
|
|
1039
|
-
* and can never flip mid-session — a record labeled `flow` must always point
|
|
1040
|
-
* at a real flow. First non-null value wins for each of flowType/flowId/
|
|
1041
|
-
* workflowId; later calls are ignored (the service logs a self-health line
|
|
1042
|
-
* when a CONFLICTING orchestrator kind shows up).
|
|
1043
|
-
*/
|
|
1044
|
-
function noteFlowContext(context) {
|
|
1045
|
-
state.flowType = state.flowType ?? context.flowType;
|
|
1046
|
-
state.flowId = state.flowId ?? context.flowId ?? null;
|
|
1047
|
-
state.workflowId = state.workflowId ?? context.workflowId ?? null;
|
|
1048
|
-
}
|
|
904
|
+
function noteSessionCreated(session, options = {}) {}
|
|
905
|
+
function noteEnvironment(environment) {}
|
|
1049
906
|
/**
|
|
1050
907
|
* `testing` heuristic: devMode OR non-prod API host pattern. Always a boolean —
|
|
1051
908
|
* the contract requires the field present on every record. Signals MERGE across
|
|
1052
909
|
* calls (a later apiUrl-only call must not erase an earlier devMode signal);
|
|
1053
910
|
* `testing` is recomputed from the merged pair.
|
|
1054
911
|
*/
|
|
1055
|
-
function noteTestingSignals(signals) {
|
|
1056
|
-
state.devModeSignal = signals.devMode ?? state.devModeSignal;
|
|
1057
|
-
state.apiUrlSignal = signals.apiUrl ?? state.apiUrlSignal;
|
|
1058
|
-
state.testing = state.devModeSignal === true || state.apiUrlSignal !== void 0 && NON_PROD_HOST_PATTERN.test(state.apiUrlSignal);
|
|
1059
|
-
}
|
|
912
|
+
function noteTestingSignals(signals) {}
|
|
1060
913
|
/**
|
|
1061
914
|
* Live read of the merged testing signal (devMode OR non-prod host). Used to
|
|
1062
915
|
* gate host-console self-health noise so production host pages stay quiet while
|
|
@@ -1067,25 +920,12 @@ function isTrueSightTesting() {
|
|
|
1067
920
|
return state.testing;
|
|
1068
921
|
}
|
|
1069
922
|
/**
|
|
1070
|
-
* Tap for `initializeSession({ token })` with a host-minted token — records
|
|
1071
|
-
* only the presence fact ("this token came from outside the SDK"), never the
|
|
1072
|
-
* token itself.
|
|
1073
|
-
*/
|
|
1074
|
-
function noteExternalTokenProvided() {
|
|
1075
|
-
state.hasExternalToken = true;
|
|
1076
|
-
}
|
|
1077
|
-
/**
|
|
1078
923
|
* Wiring tap for every `initializeSession({ token })`: a token activated
|
|
1079
924
|
* before any `createSession` was observed on this page is host-minted, i.e.
|
|
1080
925
|
* external. (The exact `token`/`externalToken` web-semantics are a pending
|
|
1081
926
|
* Phase 0 contract ask — this inference is the interim mapping.)
|
|
1082
927
|
*/
|
|
1083
|
-
function noteTokenActivated() {
|
|
1084
|
-
if (state.sessionId === null) noteExternalTokenProvided();
|
|
1085
|
-
}
|
|
1086
|
-
function configureTrueSightMetadataSources(next) {
|
|
1087
|
-
sources = next;
|
|
1088
|
-
}
|
|
928
|
+
function noteTokenActivated() {}
|
|
1089
929
|
/** Explicit literal — the metadata half handed to the record builder. */
|
|
1090
930
|
function buildSessionMetadata() {
|
|
1091
931
|
return {
|
|
@@ -1260,100 +1100,10 @@ async function fetchFeatureConfig(signal) {
|
|
|
1260
1100
|
function resetFeatureConfigCache() {
|
|
1261
1101
|
cachedFeatures = null;
|
|
1262
1102
|
}
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
* lowercase dotted string per SDK area. The raw `eventModuleNames` wire
|
|
1268
|
-
* values are inconsistent (`SELFIE`, `datasharingconsent`, `AdSign`…), four
|
|
1269
|
-
* keys collapse into `ID`, and `workflow` doubles as a module name — this
|
|
1270
|
-
* table is the single normalization point, snapshot-frozen in tests so the
|
|
1271
|
-
* dashboard facet stays bounded (~70 strings) forever.
|
|
1272
|
-
*/
|
|
1273
|
-
const MODULE_SUBSYSTEMS = {
|
|
1274
|
-
[eventModuleNames.selfie]: "module.selfie",
|
|
1275
|
-
[eventModuleNames.faceCapture]: "module.face-capture",
|
|
1276
|
-
[eventModuleNames.authentication]: "module.authentication",
|
|
1277
|
-
[eventModuleNames.authFace]: "module.auth-face",
|
|
1278
|
-
[eventModuleNames.mlConsent]: "module.ml-consent",
|
|
1279
|
-
[eventModuleNames.combinedConsent]: "module.combined-consent",
|
|
1280
|
-
[eventModuleNames.curpValidation]: "module.curp",
|
|
1281
|
-
[eventModuleNames.faceMatch]: "module.face-match",
|
|
1282
|
-
[eventModuleNames.qr]: "module.qr",
|
|
1283
|
-
[eventModuleNames.videoSelfie]: "module.video-selfie",
|
|
1284
|
-
[eventModuleNames.id]: "module.id",
|
|
1285
|
-
[eventModuleNames.idCapture]: "module.id-capture",
|
|
1286
|
-
[eventModuleNames.idVerification]: "module.id-verification",
|
|
1287
|
-
[eventModuleNames.idOcr]: "module.id-ocr",
|
|
1288
|
-
[eventModuleNames.document]: "module.document-capture",
|
|
1289
|
-
[eventModuleNames.creditCard]: "module.credit-card-front",
|
|
1290
|
-
[eventModuleNames.creditCardBack]: "module.credit-card-back",
|
|
1291
|
-
[eventModuleNames.conference]: "module.conference",
|
|
1292
|
-
[eventModuleNames.otp]: "module.otp",
|
|
1293
|
-
[eventModuleNames.signature]: "module.e-sign",
|
|
1294
|
-
[eventModuleNames.ekyc]: "module.e-kyc",
|
|
1295
|
-
[eventModuleNames.watchlist]: "module.watchlist",
|
|
1296
|
-
[eventModuleNames.globalWatchList]: "module.global-watchlist",
|
|
1297
|
-
[eventModuleNames.customWatchList]: "module.custom-watchlist",
|
|
1298
|
-
[eventModuleNames.email]: "module.email",
|
|
1299
|
-
[eventModuleNames.phone]: "module.phone-number",
|
|
1300
|
-
[eventModuleNames.instantVerifyEmail]: "module.instant-verify-email",
|
|
1301
|
-
[eventModuleNames.instantVerifyConsent]: "module.instant-verify-consent",
|
|
1302
|
-
[eventModuleNames.forms]: "module.forms",
|
|
1303
|
-
[eventModuleNames.customModule]: "module.custom-module",
|
|
1304
|
-
[eventModuleNames.geolocation]: "module.geolocation",
|
|
1305
|
-
[eventModuleNames.ekyb]: "module.e-kyb",
|
|
1306
|
-
[eventModuleNames.identityReuse]: "module.identity-reuse",
|
|
1307
|
-
[eventModuleNames.antifraud]: "module.antifraud",
|
|
1308
|
-
[eventModuleNames.aeSignature]: "module.ae-signature",
|
|
1309
|
-
[eventModuleNames.qeSignature]: "module.qe-signature",
|
|
1310
|
-
[eventModuleNames.crossDocumentDataMatch]: "module.cross-document-data-match",
|
|
1311
|
-
[eventModuleNames.customFields]: "module.custom-fields",
|
|
1312
|
-
[eventModuleNames.fieldComparison]: "module.field-comparison",
|
|
1313
|
-
[eventModuleNames.personhood]: "module.personhood",
|
|
1314
|
-
[eventModuleNames.watchlistForBusiness]: "module.watchlist-for-business",
|
|
1315
|
-
[eventModuleNames.trustGraph]: "module.trust-graph",
|
|
1316
|
-
[eventModuleNames.certificateIssuance]: "module.certificate-issuance",
|
|
1317
|
-
[eventModuleNames.governmentValidation]: "module.government-validation",
|
|
1318
|
-
[eventModuleNames.documentUpload]: "module.document-upload",
|
|
1319
|
-
[eventModuleNames.home]: "module.home",
|
|
1320
|
-
[eventModuleNames.workflow]: "module.workflow",
|
|
1321
|
-
[eventModuleNames.fiscalQr]: "module.fiscal-qr"
|
|
1322
|
-
};
|
|
1323
|
-
const CUSTOM_SUBSYSTEM_MAX_CHARS = 40;
|
|
1324
|
-
/**
|
|
1325
|
-
* Canonical `module.<kebab>` for a raw wire module name. Unknown/integrator-
|
|
1326
|
-
* custom names get a sanitized lowercase fallback (capped) — custom SDK 2
|
|
1327
|
-
* integrations get real per-module detail, not a lumped `other`.
|
|
1328
|
-
*/
|
|
1329
|
-
function normalizeSubsystem(rawModule) {
|
|
1330
|
-
if (rawModule === void 0) return "module.unknown";
|
|
1331
|
-
const canonical = MODULE_SUBSYSTEMS[rawModule];
|
|
1332
|
-
if (canonical !== void 0) return canonical;
|
|
1333
|
-
const sanitized = rawModule.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, CUSTOM_SUBSYSTEM_MAX_CHARS).replace(/-+$/g, "");
|
|
1334
|
-
return `module.${sanitized === "" ? "unknown" : sanitized}`;
|
|
1335
|
-
}
|
|
1336
|
-
const ID_SCAN_MODULES = /* @__PURE__ */ new Set([
|
|
1337
|
-
eventModuleNames.id,
|
|
1338
|
-
eventModuleNames.idCapture,
|
|
1339
|
-
eventModuleNames.idVerification,
|
|
1340
|
-
eventModuleNames.idOcr,
|
|
1341
|
-
eventModuleNames.document,
|
|
1342
|
-
eventModuleNames.documentUpload,
|
|
1343
|
-
eventModuleNames.creditCard,
|
|
1344
|
-
eventModuleNames.creditCardBack,
|
|
1345
|
-
eventModuleNames.curpValidation
|
|
1346
|
-
]);
|
|
1347
|
-
const FACE_SCAN_MODULES = /* @__PURE__ */ new Set([
|
|
1348
|
-
eventModuleNames.selfie,
|
|
1349
|
-
eventModuleNames.faceCapture,
|
|
1350
|
-
eventModuleNames.authentication,
|
|
1351
|
-
eventModuleNames.authFace,
|
|
1352
|
-
eventModuleNames.faceMatch,
|
|
1353
|
-
eventModuleNames.videoSelfie,
|
|
1354
|
-
eventModuleNames.personhood
|
|
1355
|
-
]);
|
|
1356
|
-
const ORCHESTRATION_MODULES = /* @__PURE__ */ new Set([eventModuleNames.home, eventModuleNames.workflow]);
|
|
1103
|
+
eventModuleNames.selfie, eventModuleNames.faceCapture, eventModuleNames.authentication, eventModuleNames.authFace, eventModuleNames.mlConsent, eventModuleNames.combinedConsent, eventModuleNames.curpValidation, eventModuleNames.faceMatch, eventModuleNames.qr, eventModuleNames.videoSelfie, eventModuleNames.id, eventModuleNames.idCapture, eventModuleNames.idVerification, eventModuleNames.idOcr, eventModuleNames.document, eventModuleNames.creditCard, eventModuleNames.creditCardBack, eventModuleNames.conference, eventModuleNames.otp, eventModuleNames.signature, eventModuleNames.ekyc, eventModuleNames.watchlist, eventModuleNames.globalWatchList, eventModuleNames.customWatchList, eventModuleNames.email, eventModuleNames.phone, eventModuleNames.instantVerifyEmail, eventModuleNames.instantVerifyConsent, eventModuleNames.forms, eventModuleNames.customModule, eventModuleNames.geolocation, eventModuleNames.ekyb, eventModuleNames.identityReuse, eventModuleNames.antifraud, eventModuleNames.aeSignature, eventModuleNames.qeSignature, eventModuleNames.crossDocumentDataMatch, eventModuleNames.customFields, eventModuleNames.fieldComparison, eventModuleNames.personhood, eventModuleNames.watchlistForBusiness, eventModuleNames.trustGraph, eventModuleNames.certificateIssuance, eventModuleNames.governmentValidation, eventModuleNames.documentUpload, eventModuleNames.home, eventModuleNames.workflow, eventModuleNames.fiscalQr;
|
|
1104
|
+
eventModuleNames.id, eventModuleNames.idCapture, eventModuleNames.idVerification, eventModuleNames.idOcr, eventModuleNames.document, eventModuleNames.documentUpload, eventModuleNames.creditCard, eventModuleNames.creditCardBack, eventModuleNames.curpValidation;
|
|
1105
|
+
eventModuleNames.selfie, eventModuleNames.faceCapture, eventModuleNames.authentication, eventModuleNames.authFace, eventModuleNames.faceMatch, eventModuleNames.videoSelfie, eventModuleNames.personhood;
|
|
1106
|
+
eventModuleNames.home, eventModuleNames.workflow;
|
|
1357
1107
|
/**
|
|
1358
1108
|
* Coarse category for HTTP-failure entries, from the endpoint path (event
|
|
1359
1109
|
* map row 23: "by endpoint"). A conservative token heuristic — the category
|
|
@@ -1366,101 +1116,6 @@ function categoryForEndpoint(endpoint) {
|
|
|
1366
1116
|
if (/start|flow|workflow|feature-config|onboarding|finish-status/.test(endpoint)) return "orchestration";
|
|
1367
1117
|
return "other";
|
|
1368
1118
|
}
|
|
1369
|
-
/** Coarse contract category from the RAW `event.module` value (plan rule). */
|
|
1370
|
-
function categoryForModule(rawModule) {
|
|
1371
|
-
if (rawModule === void 0) return "other";
|
|
1372
|
-
if (ID_SCAN_MODULES.has(rawModule)) return "idScan";
|
|
1373
|
-
if (FACE_SCAN_MODULES.has(rawModule)) return "faceScan";
|
|
1374
|
-
if (ORCHESTRATION_MODULES.has(rawModule)) return "orchestration";
|
|
1375
|
-
return "other";
|
|
1376
|
-
}
|
|
1377
|
-
/** `verb key=value` line: undefined values drop their pair entirely. */
|
|
1378
|
-
function formatLine(verb, pairs = []) {
|
|
1379
|
-
const parts = [verb];
|
|
1380
|
-
for (const [key, value] of pairs) if (value !== void 0 && value !== null && value !== "") parts.push(`${key}=${String(value)}`);
|
|
1381
|
-
return parts.join(" ");
|
|
1382
|
-
}
|
|
1383
|
-
/**
|
|
1384
|
-
* Analytics event → contract log tuple, or `null` for codes the taxonomy
|
|
1385
|
-
* does not cover (deny-by-default: nothing rides into the record unreviewed).
|
|
1386
|
-
* Levels/subsystems/categories per the plan's event map rows 5–6 and 16–20.
|
|
1387
|
-
*/
|
|
1388
|
-
function mapAnalyticsEventToLog(event) {
|
|
1389
|
-
const payload = event.payload ?? {};
|
|
1390
|
-
const subsystem = normalizeSubsystem(event.module);
|
|
1391
|
-
const category = categoryForModule(event.module);
|
|
1392
|
-
switch (event.code) {
|
|
1393
|
-
case "moduleOpened":
|
|
1394
|
-
case "moduleClosed": return {
|
|
1395
|
-
level: "info",
|
|
1396
|
-
subsystem,
|
|
1397
|
-
category,
|
|
1398
|
-
message: formatLine(event.code === "moduleOpened" ? "module opened" : "module closed", [["screen", event.screen]])
|
|
1399
|
-
};
|
|
1400
|
-
case "screenOpened":
|
|
1401
|
-
case "screenClosed": return {
|
|
1402
|
-
level: "debug",
|
|
1403
|
-
subsystem,
|
|
1404
|
-
category,
|
|
1405
|
-
message: formatLine(event.code === "screenOpened" ? "screen opened" : "screen closed", [["screen", event.screen]])
|
|
1406
|
-
};
|
|
1407
|
-
case "errorTriggered": return {
|
|
1408
|
-
level: "error",
|
|
1409
|
-
subsystem,
|
|
1410
|
-
category,
|
|
1411
|
-
message: formatLine("errorTriggered", [
|
|
1412
|
-
["errorName", stringOrUndefined(payload.errorName) ?? "unknown"],
|
|
1413
|
-
["errorCode", stringOrUndefined(payload.errorCode)],
|
|
1414
|
-
["reason", stringOrUndefined(payload.reason)]
|
|
1415
|
-
])
|
|
1416
|
-
};
|
|
1417
|
-
case "captureAttemptFinished": return {
|
|
1418
|
-
level: "debug",
|
|
1419
|
-
subsystem,
|
|
1420
|
-
category,
|
|
1421
|
-
message: formatLine("capture attempt finished", [["logs", stringOrUndefined(payload.logs)]])
|
|
1422
|
-
};
|
|
1423
|
-
case "background":
|
|
1424
|
-
case "foreground": return {
|
|
1425
|
-
level: "debug",
|
|
1426
|
-
subsystem,
|
|
1427
|
-
category,
|
|
1428
|
-
message: `visibility ${event.code}`
|
|
1429
|
-
};
|
|
1430
|
-
case "elementClicked": return {
|
|
1431
|
-
level: "debug",
|
|
1432
|
-
subsystem,
|
|
1433
|
-
category,
|
|
1434
|
-
message: formatLine("element clicked", [["element", stringOrUndefined(payload.element)], ["action", stringOrUndefined(payload.action)]])
|
|
1435
|
-
};
|
|
1436
|
-
case "browser": {
|
|
1437
|
-
const browser = nameVersion(payload.browser);
|
|
1438
|
-
const os = nameVersion(payload.os);
|
|
1439
|
-
const device = typeof payload.device === "object" && payload.device !== null ? stringOrUndefined(payload.device.type) : void 0;
|
|
1440
|
-
return {
|
|
1441
|
-
level: "info",
|
|
1442
|
-
subsystem: "session",
|
|
1443
|
-
category: "other",
|
|
1444
|
-
message: formatLine("browser info", [
|
|
1445
|
-
["browser", browser],
|
|
1446
|
-
["os", os],
|
|
1447
|
-
["device", device],
|
|
1448
|
-
["webrtc", typeof payload.isWebRtcSupported === "boolean" ? payload.isWebRtcSupported : void 0]
|
|
1449
|
-
])
|
|
1450
|
-
};
|
|
1451
|
-
}
|
|
1452
|
-
default: return null;
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
function stringOrUndefined(value) {
|
|
1456
|
-
return typeof value === "string" ? value : void 0;
|
|
1457
|
-
}
|
|
1458
|
-
function nameVersion(value) {
|
|
1459
|
-
if (typeof value !== "object" || value === null) return;
|
|
1460
|
-
const { name, version } = value;
|
|
1461
|
-
const joined = [name, version].filter((part) => typeof part === "string" && part !== "").join(" ");
|
|
1462
|
-
return joined === "" ? void 0 : joined;
|
|
1463
|
-
}
|
|
1464
1119
|
//#endregion
|
|
1465
1120
|
//#region src/internal/trueSight/uploader.ts
|
|
1466
1121
|
let cryptoProviderPromise = null;
|
|
@@ -1470,7 +1125,7 @@ let cryptoProviderPromise = null;
|
|
|
1470
1125
|
* the service's prewarm).
|
|
1471
1126
|
*/
|
|
1472
1127
|
function loadDiagnosticsCryptoProvider() {
|
|
1473
|
-
cryptoProviderPromise ??= import("./BrowserDiagnosticsCryptoProvider-
|
|
1128
|
+
cryptoProviderPromise ??= import("./BrowserDiagnosticsCryptoProvider-BuzqvbhN.esm.js").then((module) => new module.BrowserDiagnosticsCryptoProvider());
|
|
1474
1129
|
return cryptoProviderPromise;
|
|
1475
1130
|
}
|
|
1476
1131
|
/**
|
|
@@ -1479,35 +1134,7 @@ function loadDiagnosticsCryptoProvider() {
|
|
|
1479
1134
|
* rebuild ONCE with the oldest half of the logs dropped; still over → drop
|
|
1480
1135
|
* the upload entirely rather than send an invalid envelope.
|
|
1481
1136
|
*/
|
|
1482
|
-
async function uploadDiagnostics(record, options) {
|
|
1483
|
-
const warn = options.warn ?? defaultWarn;
|
|
1484
|
-
try {
|
|
1485
|
-
const sealer = await (options.loadCrypto ?? loadDiagnosticsCryptoProvider)();
|
|
1486
|
-
let envelope = await sealer.seal(JSON.stringify(record));
|
|
1487
|
-
let envelopeBytes = utf8ByteLength(JSON.stringify(envelope));
|
|
1488
|
-
if (envelopeBytes > 1e6) {
|
|
1489
|
-
const trimmed = {
|
|
1490
|
-
...record,
|
|
1491
|
-
logs: record.logs.slice(Math.floor(record.logs.length / 2))
|
|
1492
|
-
};
|
|
1493
|
-
warn(`[TrueSight] envelope ${envelopeBytes}B over the 1MB cap — rebuilt with the oldest ${record.logs.length - trimmed.logs.length} logs dropped`);
|
|
1494
|
-
envelope = await sealer.seal(JSON.stringify(trimmed));
|
|
1495
|
-
envelopeBytes = utf8ByteLength(JSON.stringify(envelope));
|
|
1496
|
-
if (envelopeBytes > 1e6) {
|
|
1497
|
-
warn("[TrueSight] envelope still over the cap after trim — upload dropped");
|
|
1498
|
-
return;
|
|
1499
|
-
}
|
|
1500
|
-
} else if (envelopeBytes > 9e5) warn(`[TrueSight] envelope ${envelopeBytes}B is approaching the 1MB cap`);
|
|
1501
|
-
const keepalive = options.keepalive === true && envelopeBytes <= 6e4;
|
|
1502
|
-
if (isForwardedFalse((await options.post(endpoints.diagnosticsData, envelope, keepalive ? { keepalive: true } : {})).data)) warn("[TrueSight] proxy accepted the record but did not forward it (forwarded:false)");
|
|
1503
|
-
} catch (error) {
|
|
1504
|
-
warn(`[TrueSight] diagnostics upload failed (no retry): ${String(error)}`);
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
function isForwardedFalse(data) {
|
|
1508
|
-
return typeof data === "object" && data !== null && "forwarded" in data && data.forwarded === false;
|
|
1509
|
-
}
|
|
1510
|
-
function defaultWarn() {}
|
|
1137
|
+
async function uploadDiagnostics(record, options) {}
|
|
1511
1138
|
//#endregion
|
|
1512
1139
|
//#region src/internal/trueSight/trueSightService.ts
|
|
1513
1140
|
let active = false;
|
|
@@ -1524,21 +1151,15 @@ let options = defaultOptions();
|
|
|
1524
1151
|
let observedManagerKind = null;
|
|
1525
1152
|
let orchestratorConflictLogged = false;
|
|
1526
1153
|
let snapshotRecordId = null;
|
|
1527
|
-
let cachedPendingEnvelope = null;
|
|
1528
1154
|
let snapshotDirty = false;
|
|
1529
1155
|
let captureActive = false;
|
|
1530
1156
|
let rebuildInFlight = false;
|
|
1531
1157
|
let sealFailureLogged = false;
|
|
1532
1158
|
let pendingSlotRegistered = false;
|
|
1533
1159
|
let recoveryStarted = false;
|
|
1534
|
-
let bridgeFailureCount = 0;
|
|
1535
|
-
let envSnapshotLogged = false;
|
|
1536
1160
|
let hintTransitionCount = 0;
|
|
1537
1161
|
let hintSuppressedCount = 0;
|
|
1538
1162
|
let lastHintStatus = null;
|
|
1539
|
-
let overflowBatchCount = 0;
|
|
1540
|
-
let lastFlushRecordId = null;
|
|
1541
|
-
let overflowDormant = false;
|
|
1542
1163
|
let overflowFlushInFlightUpTo = null;
|
|
1543
1164
|
let dirtyTimerHandle = null;
|
|
1544
1165
|
let unsubscribePageHide = null;
|
|
@@ -1556,25 +1177,7 @@ function defaultOptions() {
|
|
|
1556
1177
|
* encryption lock); `reset()` → `resetTrueSight()` starts a new one.
|
|
1557
1178
|
* `enabled:false` is a no-op by design: zero subscriptions, zero state.
|
|
1558
1179
|
*/
|
|
1559
|
-
function initializeTrueSightDiagnostics(serviceOptions) {
|
|
1560
|
-
if (!serviceOptions.enabled || active) return;
|
|
1561
|
-
active = true;
|
|
1562
|
-
options = {
|
|
1563
|
-
...defaultOptions(),
|
|
1564
|
-
...pickDefined(serviceOptions)
|
|
1565
|
-
};
|
|
1566
|
-
buffer = createLogBuffer({ onOverflow: handleBufferOverflow });
|
|
1567
|
-
configureTrueSightMetadataSources({
|
|
1568
|
-
getHasToken: () => getToken() !== null,
|
|
1569
|
-
getE2eEncryptionEnabled: isHttpEncrypted
|
|
1570
|
-
});
|
|
1571
|
-
unsubscribeEvents = subscribeEvent(handleAnalyticsEvent);
|
|
1572
|
-
trueSightLog("debug", "diagnostics", "other", "diagnostics initialized");
|
|
1573
|
-
if (options.pageLifecycle && options.storage) unsubscribePageHide = options.pageLifecycle.onPageHide(handlePageHide);
|
|
1574
|
-
if (options.timer && options.storage) dirtyTimerHandle = options.timer.setInterval(() => {
|
|
1575
|
-
maybeRebuildSnapshot();
|
|
1576
|
-
}, SNAPSHOT_DIRTY_INTERVAL_MS);
|
|
1577
|
-
}
|
|
1180
|
+
function initializeTrueSightDiagnostics(serviceOptions) {}
|
|
1578
1181
|
/**
|
|
1579
1182
|
* Session-time entry, called from `initializeSession` once feature config is
|
|
1580
1183
|
* known. Collection is already running by then (buffering starts at
|
|
@@ -1589,7 +1192,6 @@ function startTrueSightCollection(features) {
|
|
|
1589
1192
|
prewarmCrypto();
|
|
1590
1193
|
}
|
|
1591
1194
|
if (features) {
|
|
1592
|
-
noteFeatureConfig(features);
|
|
1593
1195
|
if (!flagResolutionStarted) {
|
|
1594
1196
|
flagResolutionStarted = true;
|
|
1595
1197
|
applyFeatureResolution(features, false);
|
|
@@ -1597,7 +1199,6 @@ function startTrueSightCollection(features) {
|
|
|
1597
1199
|
} else if (!flagResolutionStarted) {
|
|
1598
1200
|
flagResolutionStarted = true;
|
|
1599
1201
|
options.fetchFeatures().then((fetched) => {
|
|
1600
|
-
noteFeatureConfig(fetched);
|
|
1601
1202
|
applyFeatureResolution(fetched, false);
|
|
1602
1203
|
}, () => {
|
|
1603
1204
|
applyFeatureResolution(null, true);
|
|
@@ -1610,10 +1211,7 @@ function startTrueSightCollection(features) {
|
|
|
1610
1211
|
* snapshot rebuilds are suppressed — the collector must never compete with
|
|
1611
1212
|
* 30 fps capture. Deactivation flushes the deferred rebuild.
|
|
1612
1213
|
*/
|
|
1613
|
-
function noteTrueSightCaptureActivity(activityActive) {
|
|
1614
|
-
captureActive = activityActive;
|
|
1615
|
-
if (!activityActive) maybeRebuildSnapshot();
|
|
1616
|
-
}
|
|
1214
|
+
function noteTrueSightCaptureActivity(activityActive) {}
|
|
1617
1215
|
/**
|
|
1618
1216
|
* Seals and uploads the one final record per session. The upload-relevant
|
|
1619
1217
|
* state — transport, metadata (live token/E2EE getters read NOW), buffered
|
|
@@ -1631,7 +1229,6 @@ function finalizeTrueSight(outcome, failureReason) {
|
|
|
1631
1229
|
if (transport === null || cryptoUnsupported) return Promise.resolve();
|
|
1632
1230
|
const record = buildDiagnosticsRecord(metadata, logs, outcome, failureReason);
|
|
1633
1231
|
if (record === null) return Promise.resolve();
|
|
1634
|
-
cachedPendingEnvelope = null;
|
|
1635
1232
|
if (options.storage && metadata.sessionId) clearPending(metadata.sessionId, { storage: options.storage });
|
|
1636
1233
|
return options.upload(record, {
|
|
1637
1234
|
post: transport,
|
|
@@ -1663,12 +1260,6 @@ function trueSightHintTransition(subsystem, category, status) {
|
|
|
1663
1260
|
}
|
|
1664
1261
|
trueSightLog("debug", subsystem, category, `hint changed status=${status}`);
|
|
1665
1262
|
}
|
|
1666
|
-
function resetHintBudget() {
|
|
1667
|
-
if (hintSuppressedCount > 0) trueSightLog("debug", "diagnostics", "other", `hint transitions suppressed count=${hintSuppressedCount}`);
|
|
1668
|
-
hintTransitionCount = 0;
|
|
1669
|
-
hintSuppressedCount = 0;
|
|
1670
|
-
lastHintStatus = null;
|
|
1671
|
-
}
|
|
1672
1263
|
/** Buffer tap for wiring points and self-health lines. No-op when inactive. */
|
|
1673
1264
|
function trueSightLog(level, subsystem, category, message) {
|
|
1674
1265
|
if (buffer === null) return;
|
|
@@ -1691,11 +1282,7 @@ function notifyTrueSightFlowEvent(event, managerKind) {
|
|
|
1691
1282
|
trueSightLog("info", managerKind, "orchestration", "flow.started");
|
|
1692
1283
|
break;
|
|
1693
1284
|
case "flow.ready":
|
|
1694
|
-
if (identityAccepted)
|
|
1695
|
-
flowType: managerKind,
|
|
1696
|
-
flowId: managerKind === "flow" ? event.flowId ?? null : null,
|
|
1697
|
-
workflowId: managerKind === "workflow" ? event.flowId ?? null : null
|
|
1698
|
-
});
|
|
1285
|
+
if (identityAccepted) managerKind === "flow" && event.flowId, managerKind === "workflow" && event.flowId;
|
|
1699
1286
|
trueSightLog("info", managerKind, "orchestration", `flow.ready ${managerKind === "workflow" ? "workflowId" : "flowId"}=${event.flowId ?? "unknown"}`);
|
|
1700
1287
|
break;
|
|
1701
1288
|
case "flow.module.started":
|
|
@@ -1753,8 +1340,6 @@ function stampOrchestratorIdentity(managerKind) {
|
|
|
1753
1340
|
}
|
|
1754
1341
|
return false;
|
|
1755
1342
|
}
|
|
1756
|
-
noteIntegrationSurface(managerKind === "workflow" ? "startWorkflow" : "startFlow");
|
|
1757
|
-
noteFlowContext({ flowType: managerKind });
|
|
1758
1343
|
return true;
|
|
1759
1344
|
}
|
|
1760
1345
|
/** Full teardown, called from `reset()` AFTER finalize captured its snapshot. */
|
|
@@ -1778,51 +1363,19 @@ function resetTrueSight() {
|
|
|
1778
1363
|
observedManagerKind = null;
|
|
1779
1364
|
orchestratorConflictLogged = false;
|
|
1780
1365
|
snapshotRecordId = null;
|
|
1781
|
-
cachedPendingEnvelope = null;
|
|
1782
1366
|
snapshotDirty = false;
|
|
1783
1367
|
captureActive = false;
|
|
1784
1368
|
rebuildInFlight = false;
|
|
1785
1369
|
sealFailureLogged = false;
|
|
1786
1370
|
pendingSlotRegistered = false;
|
|
1787
1371
|
recoveryStarted = false;
|
|
1788
|
-
bridgeFailureCount = 0;
|
|
1789
|
-
envSnapshotLogged = false;
|
|
1790
1372
|
hintTransitionCount = 0;
|
|
1791
1373
|
hintSuppressedCount = 0;
|
|
1792
1374
|
lastHintStatus = null;
|
|
1793
|
-
overflowBatchCount = 0;
|
|
1794
|
-
lastFlushRecordId = null;
|
|
1795
|
-
overflowDormant = false;
|
|
1796
1375
|
overflowFlushInFlightUpTo = null;
|
|
1797
1376
|
options = defaultOptions();
|
|
1798
1377
|
resetTrueSightMetadata();
|
|
1799
1378
|
}
|
|
1800
|
-
function handleAnalyticsEvent(event) {
|
|
1801
|
-
if (finalized) return;
|
|
1802
|
-
try {
|
|
1803
|
-
const mapped = mapAnalyticsEventToLog(event);
|
|
1804
|
-
if (mapped === null) return;
|
|
1805
|
-
trueSightLog(mapped.level, mapped.subsystem, mapped.category, mapped.message);
|
|
1806
|
-
if (mapped.level === "error" || mapped.level === "severe") logEnvironmentSnapshotOnce();
|
|
1807
|
-
if (event.code === "captureAttemptFinished") resetHintBudget();
|
|
1808
|
-
} catch {
|
|
1809
|
-
bridgeFailureCount += 1;
|
|
1810
|
-
if (bridgeFailureCount === 1) trueSightLog("warning", "diagnostics", "other", "bridge mapping failed");
|
|
1811
|
-
}
|
|
1812
|
-
}
|
|
1813
|
-
/**
|
|
1814
|
-
* Environment-snapshot-on-first-error (event map 19d): the "conditions at
|
|
1815
|
-
* the moment of failure" line — logged once per session, right after the
|
|
1816
|
-
* first error-level entry. The snapshot closure is injected (navigator
|
|
1817
|
-
* facts live behind the L0 environment provider).
|
|
1818
|
-
*/
|
|
1819
|
-
function logEnvironmentSnapshotOnce() {
|
|
1820
|
-
if (envSnapshotLogged || options.getEnvironmentSnapshot === void 0) return;
|
|
1821
|
-
envSnapshotLogged = true;
|
|
1822
|
-
try {
|
|
1823
|
-
trueSightLog("info", "session", "other", `environment at first error ${options.getEnvironmentSnapshot()}`);
|
|
1824
|
-
} catch {}
|
|
1825
|
-
}
|
|
1826
1379
|
function applyFeatureResolution(features, unresolvable) {
|
|
1827
1380
|
if (!active || remoteKilled || finalized) return;
|
|
1828
1381
|
const entry = features?.features?.find((candidate) => candidate.feature === "TRUESIGHT_DIAGNOSTICS");
|
|
@@ -1839,67 +1392,6 @@ function remoteKill() {
|
|
|
1839
1392
|
unsubscribeEvents = null;
|
|
1840
1393
|
}
|
|
1841
1394
|
/**
|
|
1842
|
-
* Size-limit overflow flush (plan §1.3, event map 10b): the buffer crossed
|
|
1843
|
-
* ~600 KB mid-session — ship the slice as its OWN contract-valid record
|
|
1844
|
-
* (fresh id, same sessionId, index continuity ties the records together)
|
|
1845
|
-
* and keep logging. **STAGING-ONLY until BE ships `inProgress`/`flushReason`
|
|
1846
|
-
* (hard gate B2)**: outside staging (`testing !== true`) the machinery goes
|
|
1847
|
-
* dormant and the buffer falls back to eviction. Interim outcome marker is
|
|
1848
|
-
* the sanctioned `failure/interrupted` pair; the terminal record supersedes.
|
|
1849
|
-
*/
|
|
1850
|
-
function handleBufferOverflow(slice) {
|
|
1851
|
-
dispatchOverflowSlice(slice);
|
|
1852
|
-
}
|
|
1853
|
-
async function dispatchOverflowSlice(slice) {
|
|
1854
|
-
if (!active || remoteKilled || finalized || overflowDormant || slice.length === 0) return;
|
|
1855
|
-
const metadata = buildSessionMetadata();
|
|
1856
|
-
if (metadata.testing !== true) {
|
|
1857
|
-
goOverflowDormant("overflowFlush dormant reason=prod");
|
|
1858
|
-
return;
|
|
1859
|
-
}
|
|
1860
|
-
if (cryptoUnsupported) {
|
|
1861
|
-
goOverflowDormant("overflowFlush dormant reason=cryptoUnsupported");
|
|
1862
|
-
return;
|
|
1863
|
-
}
|
|
1864
|
-
const transport = safeCaptureTransport();
|
|
1865
|
-
if (transport === null) {
|
|
1866
|
-
goOverflowDormant("overflowFlush dormant reason=noTransport");
|
|
1867
|
-
return;
|
|
1868
|
-
}
|
|
1869
|
-
overflowBatchCount += 1;
|
|
1870
|
-
const record = buildDiagnosticsRecord(metadata, [{
|
|
1871
|
-
index: slice[0].index,
|
|
1872
|
-
timestampMs: getTimestamp(),
|
|
1873
|
-
level: "info",
|
|
1874
|
-
subsystem: "diagnostics",
|
|
1875
|
-
category: "other",
|
|
1876
|
-
message: `sizeLimitFlush batch=${overflowBatchCount} prevRecordId=${lastFlushRecordId ?? "none"}`
|
|
1877
|
-
}, ...slice], "failure", "interrupted");
|
|
1878
|
-
if (record === null) {
|
|
1879
|
-
goOverflowDormant("overflowFlush dormant reason=unbuildable");
|
|
1880
|
-
return;
|
|
1881
|
-
}
|
|
1882
|
-
lastFlushRecordId = record.id;
|
|
1883
|
-
const upToIndex = slice[slice.length - 1].index;
|
|
1884
|
-
overflowFlushInFlightUpTo = upToIndex;
|
|
1885
|
-
await options.upload(record, {
|
|
1886
|
-
post: transport,
|
|
1887
|
-
loadCrypto: options.loadCrypto,
|
|
1888
|
-
warn: selfHealthWarn
|
|
1889
|
-
});
|
|
1890
|
-
buffer?.markFlushed(upToIndex);
|
|
1891
|
-
overflowFlushInFlightUpTo = null;
|
|
1892
|
-
snapshotDirty = true;
|
|
1893
|
-
trueSightLog("info", "diagnostics", "other", `sizeLimitFlush dispatched batch=${overflowBatchCount} recordId=${record.id} entries=${slice.length}`);
|
|
1894
|
-
}
|
|
1895
|
-
/** B2 fallback: machinery dormant, eviction takes over — logged exactly once. */
|
|
1896
|
-
function goOverflowDormant(message) {
|
|
1897
|
-
if (overflowDormant) return;
|
|
1898
|
-
overflowDormant = true;
|
|
1899
|
-
trueSightLog("warning", "diagnostics", "other", message);
|
|
1900
|
-
buffer?.setOverflowMode("evict");
|
|
1901
|
-
}
|
|
1902
|
-
/**
|
|
1903
1395
|
* Debounced interrupted-snapshot rebuild (plan §1.8): triggered by module
|
|
1904
1396
|
* boundaries and the dirty-interval tick, suppressed while a capture loop is
|
|
1905
1397
|
* active (C7). Seals the CURRENT state as a `failure/interrupted` record
|
|
@@ -1918,7 +1410,6 @@ function maybeRebuildSnapshot() {
|
|
|
1918
1410
|
snapshotDirty = false;
|
|
1919
1411
|
rebuildInFlight = true;
|
|
1920
1412
|
options.loadCrypto().then((sealer) => sealer.seal(JSON.stringify(record))).then(async (envelope) => {
|
|
1921
|
-
cachedPendingEnvelope = envelope;
|
|
1922
1413
|
if (!pendingSlotRegistered) {
|
|
1923
1414
|
pendingSlotRegistered = true;
|
|
1924
1415
|
await registerPendingSlot(sessionId, { storage });
|
|
@@ -1939,22 +1430,6 @@ function maybeRebuildSnapshot() {
|
|
|
1939
1430
|
});
|
|
1940
1431
|
}
|
|
1941
1432
|
/**
|
|
1942
|
-
* Page-hide = persist only, NEVER send (locked decision): one synchronous-
|
|
1943
|
-
* effective write of the freshest pre-sealed snapshot. Building or posting
|
|
1944
|
-
* here is forbidden — a hidden tab is frequently a user who returns.
|
|
1945
|
-
*/
|
|
1946
|
-
function handlePageHide() {
|
|
1947
|
-
if (!active || remoteKilled || finalized || cachedPendingEnvelope === null || options.storage === void 0) return;
|
|
1948
|
-
const sessionId = buildSessionMetadata().sessionId;
|
|
1949
|
-
if (!sessionId) return;
|
|
1950
|
-
writePendingEnvelope(sessionId, {
|
|
1951
|
-
v: 1,
|
|
1952
|
-
persistedAt: getTimestamp(),
|
|
1953
|
-
envelope: cachedPendingEnvelope
|
|
1954
|
-
}, { storage: options.storage });
|
|
1955
|
-
trueSightLog("debug", "diagnostics", "other", "snapshot persisted on pagehide");
|
|
1956
|
-
}
|
|
1957
|
-
/**
|
|
1958
1433
|
* Next-load recovery off the first-token-observed hook (A1) — runs once per
|
|
1959
1434
|
* lifecycle, fire-and-forget, and reports the A5 loss counters as a
|
|
1960
1435
|
* self-health line when there was anything to report.
|
|
@@ -2019,19 +1494,6 @@ function selfHealthWarn(message) {
|
|
|
2019
1494
|
if (isTrueSightTesting()) console.warn(message);
|
|
2020
1495
|
trueSightLog("warning", "diagnostics", "other", message);
|
|
2021
1496
|
}
|
|
2022
|
-
/** Spread-safe subset: injected seams only, `undefined` values dropped. */
|
|
2023
|
-
function pickDefined(serviceOptions) {
|
|
2024
|
-
const picked = {};
|
|
2025
|
-
if (serviceOptions.fetchFeatures) picked.fetchFeatures = serviceOptions.fetchFeatures;
|
|
2026
|
-
if (serviceOptions.captureTransport) picked.captureTransport = serviceOptions.captureTransport;
|
|
2027
|
-
if (serviceOptions.upload) picked.upload = serviceOptions.upload;
|
|
2028
|
-
if (serviceOptions.loadCrypto) picked.loadCrypto = serviceOptions.loadCrypto;
|
|
2029
|
-
if (serviceOptions.pageLifecycle) picked.pageLifecycle = serviceOptions.pageLifecycle;
|
|
2030
|
-
if (serviceOptions.timer) picked.timer = serviceOptions.timer;
|
|
2031
|
-
if (serviceOptions.storage) picked.storage = serviceOptions.storage;
|
|
2032
|
-
if (serviceOptions.getEnvironmentSnapshot) picked.getEnvironmentSnapshot = serviceOptions.getEnvironmentSnapshot;
|
|
2033
|
-
return picked;
|
|
2034
|
-
}
|
|
2035
1497
|
/** ` index=i total=n` suffix when the flow event carries module positioning. */
|
|
2036
1498
|
function modulePosition(payload) {
|
|
2037
1499
|
if (typeof payload !== "object" || payload === null) return "";
|
|
@@ -2039,4 +1501,4 @@ function modulePosition(payload) {
|
|
|
2039
1501
|
return `${typeof moduleIndex === "number" ? ` index=${moduleIndex}` : ""}${typeof totalModules === "number" ? ` total=${totalModules}` : ""}`;
|
|
2040
1502
|
}
|
|
2041
1503
|
//#endregion
|
|
2042
|
-
export {
|
|
1504
|
+
export { DEFAULT_WASM_VERSION as C, resolveWasmConfig as D, getBarcodeEnhanceModelUrl as E, upgradeToWasmHttpClient as S, buildWasmConfigFromBasePath as T, noteTestingSignals as _, notifyTrueSightManagerStopped as a, installFreshHttpClient as b, trueSightHintTransition as c, fetchFeatureConfig as d, isFeatureEnabled as f, noteSessionCreated as g, noteEnvironment as h, notifyTrueSightFlowEvent as i, trueSightLog as l, isTrueSightTesting as m, initializeTrueSightDiagnostics as n, resetTrueSight as o, resetFeatureConfigCache as p, noteTrueSightCaptureActivity as r, startTrueSightCollection as s, finalizeTrueSight as t, categoryForEndpoint as u, noteTokenActivated as v, buildDefaultWasmConfig as w, resetHttpClientState as x, getStoredHttpConfig as y };
|