@incodetech/core 0.0.0-dev-20260727-4e22043f → 0.0.0-dev-20260727-6d540cf0

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.
Files changed (54) hide show
  1. package/dist/{Face2DProvider-xWUeSJZI.esm.js → Face2DProvider-BZCsS_sf.esm.js} +16 -4
  2. package/dist/PrivacyLensProvider-DA3rp6sf.esm.js +727 -0
  3. package/dist/authentication.d.ts +2 -2
  4. package/dist/authentication.esm.js +2 -2
  5. package/dist/{authenticationManager-CqcUarZL.esm.js → authenticationManager-BugCSsnK.esm.js} +2 -2
  6. package/dist/{authenticationManager-Ce1nLm5y.d.ts → authenticationManager-DqyCzK3H.d.ts} +1 -1
  7. package/dist/{authenticationStateMachine-C65ym-xr.esm.js → authenticationStateMachine-B15J5KEE.esm.js} +2 -2
  8. package/dist/avatar.esm.js +1 -1
  9. package/dist/avatarStats-BIB3SREM.esm.js +146 -0
  10. package/dist/consent.d.ts +1 -1
  11. package/dist/{consentManager-3Pbtj-RV.d.ts → consentManager-uhDPdU6i.d.ts} +4 -4
  12. package/dist/{createFaceAvatar-CwVapQiu.esm.js → createFaceAvatar-x5aaJwVM.esm.js} +2 -2
  13. package/dist/{deepsightLoader-P9BYMXpo.esm.js → deepsightLoader-3f48VAWS.esm.js} +1 -1
  14. package/dist/ekyb.esm.js +3 -3
  15. package/dist/{ekybManager-viscdI3d.esm.js → ekybManager-D86lOKbu.esm.js} +1 -1
  16. package/dist/{ekybStateMachine-DR_8mE1j.esm.js → ekybStateMachine-CscfKZxA.esm.js} +1 -1
  17. package/dist/extensibility.d.ts +8 -8
  18. package/dist/extensibility.esm.js +6 -6
  19. package/dist/{faceCaptureManagerFactory-BUE6z9iY.d.ts → faceCaptureManagerFactory-BpVpExwX.d.ts} +0 -6
  20. package/dist/{faceCaptureManagerFactory-BVZ3fonQ.esm.js → faceCaptureManagerFactory-CWqmMqXq.esm.js} +1 -2
  21. package/dist/{faceCaptureSetup-DWPFfh6J.esm.js → faceCaptureSetup-DJSy9KIH.esm.js} +3 -11
  22. package/dist/flow.d.ts +2 -2
  23. package/dist/flow.esm.js +1 -1
  24. package/dist/{flowServices-DR1uBo_E.esm.js → flowServices-BxqjVAV0.esm.js} +2 -2
  25. package/dist/id-ocr.d.ts +2 -2
  26. package/dist/id.d.ts +2 -2
  27. package/dist/id.esm.js +2 -2
  28. package/dist/{idCaptureManager-DZjNKCN0.esm.js → idCaptureManager-CpqVWwfk.esm.js} +1 -2
  29. package/dist/{idCaptureManager-CtsYvX-Z.d.ts → idCaptureManager-DECjdrKj.d.ts} +1 -2
  30. package/dist/{idCaptureStateMachine-CXMJ1Yjg.esm.js → idCaptureStateMachine-f9guPQn1.esm.js} +6 -19
  31. package/dist/{idOcrManager-DlYG277_.d.ts → idOcrManager-5vi0uwLZ.d.ts} +1 -1
  32. package/dist/index.esm.js +1 -1
  33. package/dist/mandatory-consent.d.ts +1 -1
  34. package/dist/{mandatoryConsentManager-BobEyNBc.d.ts → mandatoryConsentManager-Ck2e2W4o.d.ts} +4 -4
  35. package/dist/{onDeviceFaceResults-Ck6PjuaN.esm.js → onDeviceFaceResults-CXPJhFPL.esm.js} +1 -1
  36. package/dist/personhood.esm.js +2 -2
  37. package/dist/{recordingService-C37o41ar.esm.js → recordingService-rNoh1PIz.esm.js} +1 -1
  38. package/dist/selfie.d.ts +2 -2
  39. package/dist/selfie.esm.js +4 -4
  40. package/dist/{selfieManager-CUSnS_Ty.esm.js → selfieManager-Br-jyeHB.esm.js} +2 -2
  41. package/dist/{selfieManager-LabfZln4.d.ts → selfieManager-DR-EIsRb.d.ts} +1 -1
  42. package/dist/{selfieStateMachine-CSTR3bTY.esm.js → selfieStateMachine-BKelTRVc.esm.js} +2 -2
  43. package/dist/session-Dvgjq8G1.esm.js +1 -0
  44. package/dist/session.esm.js +2 -2
  45. package/dist/{sessionInitializer-B_GKYIAU.esm.js → sessionInitializer-JZoRl_kK.esm.js} +1 -1
  46. package/dist/{setup-Dr_yQTok.esm.js → setup-D8Ptyi5X.esm.js} +2 -2
  47. package/dist/{types-D0ohdBDu.d.ts → types-B02qlnfB.d.ts} +0 -4
  48. package/dist/video-selfie.esm.js +3 -3
  49. package/dist/wasm.esm.js +1 -1
  50. package/dist/workflow.esm.js +6 -6
  51. package/package.json +1 -1
  52. package/dist/PrivacyLensProvider-BrYSd1dr.esm.js +0 -336
  53. package/dist/session-DTuRfMtr.esm.js +0 -1
  54. /package/dist/{types-CBJI9n6h.d.ts → types-CBJI9n6h2.d.ts} +0 -0
@@ -1,336 +0,0 @@
1
- import { t as createHiddenVideoElement } from "./video-BtSWtHy1.esm.js";
2
- //#region ../infra/src/avatar/privacy-lens/privacyLensShaders.ts
3
- /** Starting point; tuned live via the privacy-lens demo sliders. */
4
- const PRIVACY_LENS_DEFAULTS = {
5
- frost: .55,
6
- sandblast: .28,
7
- grainSize: .5,
8
- brightness: 1.12,
9
- shadowLift: .12,
10
- warmth: .5,
11
- sun: .71,
12
- sunSpeed: .26
13
- };
14
- const PRIVACY_LENS_VERT = `
15
- attribute vec2 aPos;
16
- varying vec2 vUv;
17
- void main() {
18
- vUv = aPos * 0.5 + 0.5;
19
- gl_Position = vec4(aPos, 0.0, 1.0);
20
- }`;
21
- const PRIVACY_LENS_FRAG = `
22
- // The grain hash (h21 below) feeds large gl_FragCoord-derived values through
23
- // sin()*43758.5 — that overflows mediump's range on many mobile GPUs and
24
- // collapses the grain to a flat artifact. Use highp where available (all WebGL2
25
- // and most WebGL1 devices); fall back to mediump on the rare device without it.
26
- #ifdef GL_FRAGMENT_PRECISION_HIGH
27
- precision highp float;
28
- #else
29
- precision mediump float;
30
- #endif
31
- varying vec2 vUv;
32
- uniform sampler2D uVideo;
33
- uniform vec2 uRes; // canvas pixel size (square)
34
- uniform vec2 uVideoRes; // decoded video pixel size
35
- uniform float uTime; // seconds (sun drift only)
36
- uniform float uFrost;
37
- uniform float uSandblast;
38
- uniform float uGrainSize;
39
- uniform float uWarmth;
40
- uniform float uBright;
41
- uniform float uShadow;
42
- uniform float uSun;
43
- uniform float uSunSpeed;
44
-
45
- // Static per-cell hash — NO time term, so the grain is a fixed matte surface.
46
- float h21(vec2 p) {
47
- return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
48
- }
49
-
50
- // Cover-fit the (non-square) video into the square output, centre-cropped, so
51
- // faces are never stretched.
52
- vec2 coverUv(vec2 uv) {
53
- float va = uVideoRes.x / max(uVideoRes.y, 1.0);
54
- vec2 o = uv;
55
- if (va > 1.0) o.x = (uv.x - 0.5) / va + 0.5; // landscape: crop sides
56
- else o.y = (uv.y - 0.5) * va + 0.5; // portrait: crop top/bottom
57
- return o;
58
- }
59
-
60
- const int N = 12;
61
-
62
- void main() {
63
- vec2 uv = vUv;
64
- vec2 base = coverUv(uv);
65
- float aspect = uRes.y / max(uRes.x, 1.0);
66
-
67
- // Per-fragment static seed, clustered into grain cells. Small cells = ultra
68
- // fine sandblast (effectively invisible pattern); larger = coarser frosting.
69
- vec2 cell = floor(gl_FragCoord.xy / max(uGrainSize, 0.5));
70
- float rnd = h21(cell);
71
- float baseAngle = rnd * 6.2831853;
72
-
73
- // Stochastic sandblasted scatter: an even golden-angle disk, but each pixel
74
- // cell rotates + jitters the kernel differently → a fine matte grain rather
75
- // than a smooth blur. The video moves UNDER this fixed glass grain.
76
- vec3 col = vec3(0.0);
77
- for (int i = 0; i < N; i++) {
78
- float fi = float(i) + 0.5;
79
- float ang = baseAngle + fi * 2.399963; // golden angle
80
- float rad = sqrt(fi / float(N)); // even area coverage 0..1
81
- float j = h21(cell + vec2(fi * 7.13, fi * 3.71));
82
- float r = uFrost * 0.06 * rad + (j - 0.5) * uSandblast * 0.03;
83
- vec2 off = vec2(cos(ang), sin(ang)) * r;
84
- off.x *= aspect;
85
- col += texture2D(uVideo, base + off).rgb;
86
- }
87
- col /= float(N);
88
-
89
- // Airy + warm grade (luminous frosted glass, not murky).
90
- col = col + uShadow * (1.0 - col);
91
- col *= uBright;
92
- vec3 warm = vec3(1.0, 0.92, 0.80);
93
- col = mix(col, col * warm + vec3(0.03, 0.015, 0.0), uWarmth);
94
-
95
- // Drifting sun: a broad soft glow + a fine STATIC sparkle (per-cell) that
96
- // catches the ground-glass grain only where the light falls — not all-over.
97
- vec2 sun = vec2(0.34 + 0.16 * sin(uTime * uSunSpeed),
98
- 0.26 + 0.10 * cos(uTime * uSunSpeed * 0.8));
99
- float glow = smoothstep(0.7, 0.0, distance(uv, sun));
100
- vec3 sunCol = vec3(1.0, 0.96, 0.88);
101
- col += sunCol * glow * (0.20 + (rnd - 0.5) * 0.18 * uSandblast) * uSun;
102
-
103
- gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);
104
- }`;
105
- //#endregion
106
- //#region ../infra/src/avatar/privacy-lens/PrivacyLensProvider.ts
107
- /**
108
- * Privacy-lens avatar — sandblasted-glass effect over the **real** selfie video.
109
- * **Self-contained** (see FACE_AVATAR.md → Isolation and ownership). No MediaPipe, no landmarks, no
110
- * three/VRM, no npm deps, no textures but the live video — just a raw-WebGL
111
- * fragment shader run on the video each frame (see `privacyLensShaders.ts`).
112
- *
113
- * Implements `IFaceAvatarCapability` (the generic `start/getCanvas/stop`
114
- * contract) so it rides the existing concealment seam
115
- * (`selfieConcealmentOption: 'OPTION_SILHOUETTE'`). The UI swaps the live `<Video>` for this
116
- * canvas exactly as it does for the other avatars. Cosmetic-only: the authoritative
117
- * pipeline still runs on the real frames; this only changes what is *displayed*.
118
- *
119
- * Mirroring is the UI's job (CSS), like every other provider — the shader
120
- * renders forward.
121
- */
122
- const DEFAULT_MAX_FPS = 30;
123
- const RENDER_SIZE = 512;
124
- const asRvfc = (video) => {
125
- const v = video;
126
- return typeof v.requestVideoFrameCallback === "function" && typeof v.cancelVideoFrameCallback === "function" ? v : null;
127
- };
128
- const readParams = () => {
129
- if (typeof window === "undefined") return PRIVACY_LENS_DEFAULTS;
130
- const override = window.__incodePrivacyLensParams;
131
- return override ? {
132
- ...PRIVACY_LENS_DEFAULTS,
133
- ...override
134
- } : PRIVACY_LENS_DEFAULTS;
135
- };
136
- var PrivacyLensProvider = class {
137
- constructor() {
138
- this.gl = null;
139
- this.program = null;
140
- this.quad = null;
141
- this.videoTex = null;
142
- this.uniforms = /* @__PURE__ */ new Map();
143
- this.videoHandle = null;
144
- this.rafId = null;
145
- this.rvfcHandle = null;
146
- this.usingRvfc = false;
147
- this.stopped = false;
148
- this.lastFrameAt = 0;
149
- this.minFrameIntervalMs = 1e3 / DEFAULT_MAX_FPS;
150
- this.startTime = 0;
151
- this.loop = (now) => {
152
- if (this.stopped) return;
153
- this.scheduleNextFrame();
154
- if (now - this.lastFrameAt < this.minFrameIntervalMs) return;
155
- this.lastFrameAt = now;
156
- const gl = this.gl;
157
- const video = this.videoHandle?.element;
158
- if (!gl || !this.program) return;
159
- if (!video || video.readyState < 2 || !video.videoWidth) {
160
- gl.clear(gl.COLOR_BUFFER_BIT);
161
- return;
162
- }
163
- gl.activeTexture(gl.TEXTURE0);
164
- gl.bindTexture(gl.TEXTURE_2D, this.videoTex);
165
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, video);
166
- const p = readParams();
167
- const setF = (name, value) => {
168
- const loc = this.uniforms.get(name);
169
- if (loc) gl.uniform1f(loc, value);
170
- };
171
- const set2 = (name, x, y) => {
172
- const loc = this.uniforms.get(name);
173
- if (loc) gl.uniform2f(loc, x, y);
174
- };
175
- set2("uRes", RENDER_SIZE, RENDER_SIZE);
176
- set2("uVideoRes", video.videoWidth, video.videoHeight);
177
- setF("uTime", (now - this.startTime) / 1e3);
178
- setF("uFrost", p.frost);
179
- setF("uSandblast", p.sandblast);
180
- setF("uGrainSize", p.grainSize);
181
- setF("uWarmth", p.warmth);
182
- setF("uBright", p.brightness);
183
- setF("uShadow", p.shadowLift);
184
- setF("uSun", p.sun);
185
- setF("uSunSpeed", p.sunSpeed);
186
- gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
187
- };
188
- this.canvas = document.createElement("canvas");
189
- this.canvas.width = RENDER_SIZE;
190
- this.canvas.height = RENDER_SIZE;
191
- }
192
- getCanvas() {
193
- return this.canvas;
194
- }
195
- async start(stream, options = {}) {
196
- this.minFrameIntervalMs = 1e3 / (options.maxFps ?? DEFAULT_MAX_FPS);
197
- this.videoHandle = createHiddenVideoElement(stream, { keepStreamAlive: true });
198
- try {
199
- this.initGl();
200
- if (this.stopped) return;
201
- this.startTime = performance.now();
202
- const video = this.videoHandle.element;
203
- this.usingRvfc = !!asRvfc(video);
204
- this.scheduleNextFrame();
205
- } catch (error) {
206
- this.stop();
207
- throw error;
208
- }
209
- return Promise.resolve();
210
- }
211
- stop() {
212
- this.stopped = true;
213
- if (this.rafId != null) {
214
- cancelAnimationFrame(this.rafId);
215
- this.rafId = null;
216
- }
217
- const video = this.videoHandle?.element;
218
- if (video && this.rvfcHandle != null) {
219
- asRvfc(video)?.cancelVideoFrameCallback(this.rvfcHandle);
220
- this.rvfcHandle = null;
221
- }
222
- const gl = this.gl;
223
- if (gl) {
224
- if (this.program) gl.deleteProgram(this.program);
225
- if (this.quad) gl.deleteBuffer(this.quad);
226
- if (this.videoTex) gl.deleteTexture(this.videoTex);
227
- gl.getExtension("WEBGL_lose_context")?.loseContext();
228
- }
229
- this.program = null;
230
- this.quad = null;
231
- this.videoTex = null;
232
- this.gl = null;
233
- this.videoHandle?.dispose();
234
- this.videoHandle = null;
235
- }
236
- initGl() {
237
- const gl = this.canvas.getContext("webgl", {
238
- alpha: false,
239
- antialias: false,
240
- premultipliedAlpha: false,
241
- preserveDrawingBuffer: false
242
- }) ?? this.canvas.getContext("experimental-webgl");
243
- if (!gl) throw new Error("PrivacyLensProvider: WebGL is not available");
244
- this.gl = gl;
245
- const program = this.buildProgram(gl, PRIVACY_LENS_VERT, PRIVACY_LENS_FRAG);
246
- this.program = program;
247
- gl.useProgram(program);
248
- const quad = gl.createBuffer();
249
- gl.bindBuffer(gl.ARRAY_BUFFER, quad);
250
- gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
251
- -1,
252
- -1,
253
- 1,
254
- -1,
255
- -1,
256
- 1,
257
- 1,
258
- 1
259
- ]), gl.STATIC_DRAW);
260
- const aPos = gl.getAttribLocation(program, "aPos");
261
- gl.enableVertexAttribArray(aPos);
262
- gl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 0, 0);
263
- this.quad = quad;
264
- this.videoTex = this.makeTexture(gl, gl.CLAMP_TO_EDGE);
265
- gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
266
- for (const name of [
267
- "uVideo",
268
- "uRes",
269
- "uVideoRes",
270
- "uTime",
271
- "uFrost",
272
- "uSandblast",
273
- "uGrainSize",
274
- "uWarmth",
275
- "uBright",
276
- "uShadow",
277
- "uSun",
278
- "uSunSpeed"
279
- ]) this.uniforms.set(name, gl.getUniformLocation(program, name));
280
- gl.uniform1i(this.uniforms.get("uVideo") ?? null, 0);
281
- gl.viewport(0, 0, RENDER_SIZE, RENDER_SIZE);
282
- gl.clearColor(.88, .86, .83, 1);
283
- }
284
- buildProgram(gl, vertSrc, fragSrc) {
285
- const compile = (type, src) => {
286
- const shader = gl.createShader(type);
287
- if (!shader) throw new Error("PrivacyLensProvider: createShader failed");
288
- gl.shaderSource(shader, src);
289
- gl.compileShader(shader);
290
- if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
291
- const log = gl.getShaderInfoLog(shader);
292
- gl.deleteShader(shader);
293
- throw new Error(`PrivacyLensProvider: shader compile failed: ${log}`);
294
- }
295
- return shader;
296
- };
297
- const vs = compile(gl.VERTEX_SHADER, vertSrc);
298
- const fs = compile(gl.FRAGMENT_SHADER, fragSrc);
299
- const program = gl.createProgram();
300
- if (!program) throw new Error("PrivacyLensProvider: createProgram failed");
301
- gl.attachShader(program, vs);
302
- gl.attachShader(program, fs);
303
- gl.linkProgram(program);
304
- gl.deleteShader(vs);
305
- gl.deleteShader(fs);
306
- if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
307
- const log = gl.getProgramInfoLog(program);
308
- gl.deleteProgram(program);
309
- throw new Error(`PrivacyLensProvider: program link failed: ${log}`);
310
- }
311
- return program;
312
- }
313
- makeTexture(gl, wrap) {
314
- const tex = gl.createTexture();
315
- if (!tex) throw new Error("PrivacyLensProvider: createTexture failed");
316
- gl.bindTexture(gl.TEXTURE_2D, tex);
317
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrap);
318
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, wrap);
319
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
320
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
321
- return tex;
322
- }
323
- scheduleNextFrame() {
324
- if (this.stopped) return;
325
- const video = this.videoHandle?.element;
326
- const rvfc = this.usingRvfc && video ? asRvfc(video) : null;
327
- if (rvfc) this.rvfcHandle = rvfc.requestVideoFrameCallback(this.loop);
328
- else this.rafId = requestAnimationFrame(this.loop);
329
- }
330
- };
331
- /** Factory used by the avatar actor's provider selection (privacy-lens avatar). */
332
- function createProvider() {
333
- return new PrivacyLensProvider();
334
- }
335
- //#endregion
336
- export { createProvider };
@@ -1 +0,0 @@
1
- import "./sessionInitializer-B_GKYIAU.esm.js";