@idmission/websdk-core 0.2.0-rc.2 → 0.2.0

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 (82) hide show
  1. package/README.md +8 -1
  2. package/dist/client/IdmissionClient.d.ts +2 -0
  3. package/dist/client/IdmissionClient.d.ts.map +1 -1
  4. package/dist/client/IdmissionClient.js +3 -0
  5. package/dist/client/artifacts.d.ts +2 -0
  6. package/dist/client/artifacts.d.ts.map +1 -1
  7. package/dist/client/payload.d.ts.map +1 -1
  8. package/dist/client/payload.js +2 -1
  9. package/dist/client/types.d.ts +2 -0
  10. package/dist/client/types.d.ts.map +1 -1
  11. package/dist/documentCapture/autoCaptureEngine.d.ts +106 -0
  12. package/dist/documentCapture/autoCaptureEngine.d.ts.map +1 -0
  13. package/dist/documentCapture/autoCaptureEngine.js +456 -0
  14. package/dist/documentCapture/autoCaptureGeometry.d.ts +424 -0
  15. package/dist/documentCapture/autoCaptureGeometry.d.ts.map +1 -0
  16. package/dist/documentCapture/autoCaptureGeometry.js +394 -0
  17. package/dist/documentCapture/autoCaptureGuidance.d.ts +61 -0
  18. package/dist/documentCapture/autoCaptureGuidance.d.ts.map +1 -0
  19. package/dist/documentCapture/autoCaptureGuidance.js +73 -0
  20. package/dist/documentCapture/autoCaptureMetadata.d.ts +185 -0
  21. package/dist/documentCapture/autoCaptureMetadata.d.ts.map +1 -0
  22. package/dist/documentCapture/autoCaptureMetadata.js +197 -0
  23. package/dist/documentCapture/autoCaptureOptions.d.ts +212 -0
  24. package/dist/documentCapture/autoCaptureOptions.d.ts.map +1 -0
  25. package/dist/documentCapture/autoCaptureOptions.js +178 -0
  26. package/dist/documentCapture/autoCaptureShutter.d.ts +162 -0
  27. package/dist/documentCapture/autoCaptureShutter.d.ts.map +1 -0
  28. package/dist/documentCapture/autoCaptureShutter.js +183 -0
  29. package/dist/documentCapture/controller.d.ts +33 -1
  30. package/dist/documentCapture/controller.d.ts.map +1 -1
  31. package/dist/documentCapture/controller.js +604 -40
  32. package/dist/documentCapture/index.d.ts +8 -2
  33. package/dist/documentCapture/index.d.ts.map +1 -1
  34. package/dist/documentCapture/index.js +6 -0
  35. package/dist/documentCapture/reducer.d.ts +26 -1
  36. package/dist/documentCapture/reducer.d.ts.map +1 -1
  37. package/dist/documentCapture/reducer.js +43 -0
  38. package/dist/documentCapture/state.d.ts +118 -0
  39. package/dist/documentCapture/state.d.ts.map +1 -1
  40. package/dist/documentCapture/state.js +24 -0
  41. package/dist/idCapture/controller.d.ts +20 -0
  42. package/dist/idCapture/controller.d.ts.map +1 -1
  43. package/dist/idCapture/controller.js +42 -3
  44. package/dist/idCapture/index.d.ts +1 -1
  45. package/dist/idCapture/index.d.ts.map +1 -1
  46. package/dist/idCapture/index.js +12 -1
  47. package/dist/idCapture/pipeline.d.ts +30 -0
  48. package/dist/idCapture/pipeline.d.ts.map +1 -1
  49. package/dist/idCapture/pipeline.js +33 -10
  50. package/dist/models/DocumentDetection.d.ts +29 -1
  51. package/dist/models/DocumentDetection.d.ts.map +1 -1
  52. package/dist/models/DocumentDetection.js +37 -5
  53. package/dist/models/defaults/PoaDocumentDetectorLiteRT.d.ts +3 -0
  54. package/dist/models/defaults/PoaDocumentDetectorLiteRT.d.ts.map +1 -0
  55. package/dist/models/defaults/PoaDocumentDetectorLiteRT.js +15 -0
  56. package/dist/models/defaults/index.d.ts +4 -1
  57. package/dist/models/defaults/index.d.ts.map +1 -1
  58. package/dist/models/defaults/index.js +4 -0
  59. package/dist/models/preloadModels.d.ts +21 -14
  60. package/dist/models/preloadModels.d.ts.map +1 -1
  61. package/dist/models/preloadModels.js +10 -0
  62. package/dist/models/providers/litert/docDetectPrePost.d.ts.map +1 -1
  63. package/dist/models/providers/litert/docDetectPrePost.js +5 -0
  64. package/dist/selfieCapture/guidance.d.ts +49 -0
  65. package/dist/selfieCapture/guidance.d.ts.map +1 -1
  66. package/dist/selfieCapture/guidance.js +51 -0
  67. package/dist/selfieCapture/index.d.ts +1 -1
  68. package/dist/selfieCapture/index.d.ts.map +1 -1
  69. package/dist/selfieCapture/index.js +1 -1
  70. package/dist/signatureCapture/controller.d.ts.map +1 -1
  71. package/dist/signatureCapture/controller.js +71 -21
  72. package/dist/signatureCapture/pipeline.d.ts +14 -2
  73. package/dist/signatureCapture/pipeline.d.ts.map +1 -1
  74. package/dist/signatureCapture/pipeline.js +30 -7
  75. package/dist/signatureCapture/state.d.ts +15 -0
  76. package/dist/signatureCapture/state.d.ts.map +1 -1
  77. package/dist/version.d.ts +1 -1
  78. package/dist/version.d.ts.map +1 -1
  79. package/dist/version.js +1 -1
  80. package/dist/videoIdCapture/controller.d.ts.map +1 -1
  81. package/dist/videoIdCapture/controller.js +64 -3
  82. package/package.json +1 -1
@@ -0,0 +1,178 @@
1
+ // The one place auto-capture defaults are applied (#340).
2
+ //
3
+ // This repo has had FOUR cascade-default incidents — `specific ?? general ??
4
+ // default` dying silently the moment the specific operand picks up a
5
+ // non-`undefined` default of its own — and every one of them passed review. The
6
+ // structure here is chosen so the hazard is absent rather than policed: the
7
+ // per-document `autoCapture` bag is the ONLY source of behavioural and
8
+ // threshold overrides, the engine knobs are a disjoint set on
9
+ // `DocumentCaptureControllerConfig`, and there is exactly one function that
10
+ // turns an all-optional bag into a total one.
11
+ //
12
+ // The rule that goes with it, which reviewers must hold:
13
+ //
14
+ // Defaults live in `resolveAutoCapture` and nowhere else. Banned everywhere
15
+ // else: React prop-destructure defaults, `= {}` parameter defaults, `??
16
+ // <value>` in the compat mapper, and any `autoCapture` value in a Storybook
17
+ // `meta.args`.
18
+ import { warn } from '../utils/logger';
19
+ import { POA_FILL_MAX, POA_FILL_MIN, POA_FOCUS_THRESHOLDS, POA_MIN_SCORE, POA_TARGET_LABELS, } from './autoCaptureGeometry';
20
+ /** Frames the IoU window holds before a stability verdict is possible. */
21
+ export const DEFAULT_STABILITY_FRAMES = 12;
22
+ /**
23
+ * Minimum pairwise IoU across the stability window.
24
+ *
25
+ * Seeded from `defaultDocumentDetectionThresholds.stability.singlePage` and
26
+ * left there by #380: stability resolves in ~690 ms of not moving, so it is
27
+ * rarely the binding gate.
28
+ */
29
+ export const DEFAULT_STABILITY_IOU = 0.5;
30
+ /**
31
+ * ms of sustained gate failure before the manual shutter is offered (#345).
32
+ *
33
+ * RAISED FROM 8000 ON FIELD EVIDENCE. The 8 s value was inherited from
34
+ * `idCapture`'s `allowOverrideWrongDocumentTypeAfterMs`, tuned for the
35
+ * wrong-document-type case, with no POA number behind it — and its own note
36
+ * predicted this outcome:
37
+ *
38
+ * > The hard recording first-captures at 11.5 s, so on hard-but-recoverable
39
+ * > framings the dialog will be offered BEFORE the loop succeeds. That is
40
+ * > harmless by construction — the loop stays armed until the applicant
41
+ * > accepts — but the dialog will be common, and nobody has watched a real
42
+ * > applicant react to it.
43
+ *
44
+ * Someone has now watched, and it pops while the loop is still converging.
45
+ * "Harmless by construction" was true of the CAPTURE and false of the
46
+ * experience: being offered a way out mid-attempt reads as the SDK giving up.
47
+ *
48
+ * 30 s clears the 11.5 s hard-recording first-capture with room, so the offer
49
+ * arrives after the loop has plainly failed rather than during its slowest
50
+ * success. Still an operating point rather than a measurement — what would
51
+ * move it is a distribution of real time-to-capture, not another guess.
52
+ */
53
+ export const DEFAULT_MANUAL_FALLBACK_AFTER_MS = 30_000;
54
+ /**
55
+ * Camera width worth requesting for auto-capture, as a RECOMMENDATION.
56
+ *
57
+ * The submitted image is the guide rect cropped out of the camera frame, so an
58
+ * A4 portrait guide on the default 1920-wide 16:9 stream is 764x1080 and the
59
+ * sheet inside it lands near 90 DPI — 6pt print about two pixels tall. That is
60
+ * a sampling limit, not blur, and no focus threshold recovers it. The same
61
+ * guide on 2560 is 1018x1440.
62
+ *
63
+ * NOT APPLIED AUTOMATICALLY, and that is the finding rather than an oversight.
64
+ * It was, briefly, and it made captures materially harder to land: the loop
65
+ * draws every frame at the stream's size, so a bigger frame costs more per
66
+ * frame, and both the stability and fill windows are twelve FRAMES — a slower
67
+ * loop stretches the hold-still the applicant has to sustain. Some devices
68
+ * also answer a larger width with a lower-frame-rate capture mode, which
69
+ * compounds it.
70
+ *
71
+ * So this is a number to pass deliberately, per integration, after watching
72
+ * `frameRate` on the tuning overlay:
73
+ *
74
+ * <DocumentCapture camera={{ maxVideoWidth: AUTO_CAPTURE_VIDEO_WIDTH }} … />
75
+ *
76
+ * Re-landing it as a default needs a frame-rate measurement across the target
77
+ * device range, not another guess.
78
+ */
79
+ export const AUTO_CAPTURE_VIDEO_WIDTH = 2560;
80
+ /**
81
+ * ms to keep looking for a sharper frame after the gates first go green.
82
+ *
83
+ * WHY THIS EXISTS. Two of the three gates are windowed and slow-moving — fill
84
+ * is a 12-frame mean and stability is a 12-frame IoU — so they ratchet into
85
+ * satisfaction and stay there. Focus is the only single-frame gate. Firing on
86
+ * the first satisfied frame therefore fires the instant FOCUS first crosses
87
+ * its threshold, and that threshold is deliberately permissive: #380 lowered
88
+ * it to 0.5 because 0.6 was rejecting 4.8% of live frames.
89
+ *
90
+ * A first-crossing rule on a noisy signal is biased toward the threshold by
91
+ * construction — it catches marginal upward excursions. So the shutter was
92
+ * systematically capturing near the floor on exactly the holds where focus was
93
+ * the binding gate, which is the motion blur this addresses.
94
+ *
95
+ * Expressed in MILLISECONDS and converted through the measured frame rate,
96
+ * like `manualFallbackAfterMs`, so the pause is the same length of time on a
97
+ * fast phone and a slow one. A fixed frame count would be 200 ms at 30 fps and
98
+ * 750 ms at 8 fps — the device that can least afford the wait would wait
99
+ * longest.
100
+ *
101
+ * 300 ms is #383's `mean of 6` translated into time: six frames at the ~20 fps
102
+ * this loop runs at. It is an operating point, not a measurement.
103
+ */
104
+ export const DEFAULT_BURST_WINDOW_MS = 300;
105
+ /**
106
+ * The same idea pointed at the applicant's tap, and longer on purpose.
107
+ *
108
+ * Pressing a phone's screen moves the phone. The frame the tap lands on is
109
+ * therefore among the WORST frames available — the finger has already made
110
+ * contact and the transient has not damped — so saving it is sampling the
111
+ * blur rather than avoiding it. This is the one complaint about hand-held
112
+ * manual capture that no amount of guidance can fix, because the guidance is
113
+ * correct right up until the moment the applicant acts on it.
114
+ *
115
+ * The window opens AT the tap and never reaches backwards. Frames from before
116
+ * it are sharper still, and deliberately out of scope: the tap is the
117
+ * applicant's intent expressed at a moment of their choosing, and submitting
118
+ * pixels from before it would be a different photo than the one they took.
119
+ * What the window buys is the settle on the far side.
120
+ *
121
+ * Longer than `burstWindowMs` because it has different work to do. That one
122
+ * picks the best of frames the gates have already certified; this one has to
123
+ * OUTLIVE a physical transient, and a window that ends inside the jostle has
124
+ * only jostled frames to choose between. 400 ms covers the damping on a
125
+ * hand-held phone with room on either side. It is an operating point, not a
126
+ * measurement — if it reads as lag, this is the number to turn down.
127
+ */
128
+ export const DEFAULT_MANUAL_BURST_WINDOW_MS = 400;
129
+ /**
130
+ * Pin the document detector to the runtime that can actually run the POA
131
+ * artifact.
132
+ *
133
+ * The artifact's input tensor is uint8, and the mediapipe provider cannot load
134
+ * a raw `.tflite` at all — so `'mediapipe'` is downgraded with a warning rather
135
+ * than left to fail at the first frame, where it reads as a broken camera.
136
+ *
137
+ * The WebGPU half of this hazard is already closed one layer down:
138
+ * `providers/litert/DocumentDetection.ts` forces the `'wasm'` accelerator
139
+ * unconditionally, because LiteRT.js's WebGPU backend cannot allocate uint8
140
+ * tensor buffers and throws at the first `model.run()`. No knob on this surface
141
+ * can reach WebGPU, which is also why the Adreno/Snapdragon WebGPU hazard is
142
+ * moot here — it returns only if a future export drops uint8.
143
+ */
144
+ export function resolveDocumentDetectorRuntime(requested) {
145
+ if (requested && requested !== 'litert') {
146
+ warn(`[documentCapture] auto-capture ignores documentDetectorRuntime="${requested}" ` +
147
+ 'and runs on "litert": the POA detector is a uint8-input .tflite that ' +
148
+ 'the mediapipe provider cannot load.');
149
+ }
150
+ return 'litert';
151
+ }
152
+ /**
153
+ * Turn an all-optional `autoCapture` bag into a total one.
154
+ *
155
+ * Both parameters are `| undefined` and the return type has no optional
156
+ * members, which is the whole point: there is exactly one `??` per value, in
157
+ * one file, against one constant.
158
+ */
159
+ export function resolveAutoCapture(options, environment) {
160
+ const onMobile = environment?.onMobile === true;
161
+ const focusBranch = onMobile ? 'mobile' : 'desktop';
162
+ return {
163
+ targetLabels: options?.targetLabels ?? POA_TARGET_LABELS,
164
+ minScore: options?.minScore ?? POA_MIN_SCORE,
165
+ stabilityFrames: options?.stabilityFrames ?? DEFAULT_STABILITY_FRAMES,
166
+ manualFallbackAfterMs: options?.manualFallbackAfterMs ?? DEFAULT_MANUAL_FALLBACK_AFTER_MS,
167
+ burstWindowMs: options?.burstWindowMs ?? DEFAULT_BURST_WINDOW_MS,
168
+ manualBurstWindowMs: options?.manualBurstWindowMs ?? DEFAULT_MANUAL_BURST_WINDOW_MS,
169
+ thresholds: {
170
+ fillMin: options?.thresholds?.fillMin ?? POA_FILL_MIN,
171
+ fillMax: options?.thresholds?.fillMax ?? POA_FILL_MAX,
172
+ stability: options?.thresholds?.stability ?? DEFAULT_STABILITY_IOU,
173
+ focus: options?.thresholds?.focus ?? POA_FOCUS_THRESHOLDS[focusBranch],
174
+ },
175
+ focusBranch,
176
+ documentDetectorRuntime: resolveDocumentDetectorRuntime(environment?.documentDetectorRuntime),
177
+ };
178
+ }
@@ -0,0 +1,162 @@
1
+ /** Per-document shutter state. Nothing here is shared between documents. */
2
+ export type AutoCaptureShutterState = {
3
+ /**
4
+ * Frames that failed at least one gate since this document's budget started.
5
+ *
6
+ * EVERY unsatisfied frame spends the budget, including frames with no box at
7
+ * all. Counting only frames that had a target and failed a gate would
8
+ * protect the slow starter, but it leaves an applicant the detector cannot
9
+ * see (dark paper, bad light) in a permanent dead-end. A premature offer can
10
+ * be ignored; a dead-end cannot.
11
+ */
12
+ unsatisfiedFrames: number;
13
+ /**
14
+ * The applicant may tap to capture.
15
+ *
16
+ * STICKY, including across `retry()`. Once the SDK has conceded that it
17
+ * cannot frame this document unaided, taking the button back because the
18
+ * applicant retried would answer a struggle with a demotion.
19
+ *
20
+ * THERE IS NO LONGER A DIALOG IN FRONT OF THIS. The escape used to be a two
21
+ * step — offer a sheet, hand the shutter over on accept — and the sheet was
22
+ * the problem: it covered the guidance pill, which is the one thing on screen
23
+ * that tells the applicant how to fix the framing it was asking them about.
24
+ * A prompt that hides the answer to its own question is worse than no prompt,
25
+ * so the budget running out now reveals the button directly, with a caption
26
+ * beside it saying why it appeared.
27
+ *
28
+ * Revealing the shutter does not drop the gate. This diverges from
29
+ * `idCapture`, whose dialog removes the blocking gate outright. For POA the
30
+ * blocking gate IS the product requirement: dropping the fill window means
31
+ * auto-capturing a crop with no human intent behind it, stamped
32
+ * `autoCapture: 'Y'`, which is indistinguishable from the failure this whole
33
+ * workstream exists to fix. A human choosing to submit that framing is a
34
+ * categorically different event, and the only one that yields an honest 'N'.
35
+ *
36
+ * Auto-capture also STAYS ARMED, which the accept-step version could not do:
37
+ * it had to disarm, because firing out from under someone who had explicitly
38
+ * chosen manual would stamp 'Y' on them and corrupt the metric. Nobody
39
+ * chooses anything now, so there is no choice to contradict — the button is
40
+ * an addition, and a frame the model can still certify beats a tap.
41
+ */
42
+ manualShutterAvailable: boolean;
43
+ /**
44
+ * Frames left in the burst window, or null when no burst is open.
45
+ *
46
+ * Opened by the first satisfied frame and counted down on EVERY frame after
47
+ * it, satisfied or not — it is a length of time expressed in frames, not a
48
+ * streak. That is deliberate: the shutter must tolerate gaps of at least 3
49
+ * frames, and requiring continued satisfaction would reintroduce exactly the
50
+ * streak rule #383 measured at 5.2 seconds.
51
+ */
52
+ burstFramesRemaining: number | null;
53
+ /**
54
+ * Frames left in a burst the APPLICANT opened by tapping, or null.
55
+ *
56
+ * Separate from `burstFramesRemaining` because it means something different.
57
+ * That window picks the sharpest of frames the gates have already certified;
58
+ * this one exists because pressing a phone's screen moves the phone, so the
59
+ * frame the tap landed on is among the worst available. It outlives a
60
+ * physical transient rather than sampling a certified one.
61
+ *
62
+ * While it is open the auto window is closed and auto-capture cannot fire —
63
+ * the tap has taken this shot, and two shutters racing for one slot would
64
+ * mean the applicant sometimes gets a photo they did not take.
65
+ */
66
+ manualBurstFramesRemaining: number | null;
67
+ };
68
+ /**
69
+ * How many frames a burst window is worth at this frame rate.
70
+ *
71
+ * Same conversion as `escapeBudgetFrames`, and for the same reason: the window
72
+ * is a length of TIME, so it has to be the same length of time on a phone
73
+ * running at 8 fps and one running at 30. Counting raw frames would make the
74
+ * slowest device wait longest.
75
+ */
76
+ export declare function burstWindowFrames(burstWindowMs: number, frameRate: number): number;
77
+ /** The frame data the shutter decides on. */
78
+ export type AutoCaptureShutterFrame = {
79
+ /** `isAutoCaptureSatisfied` for this frame. */
80
+ satisfied: boolean;
81
+ /** ms since the loop started, from the frame's own diagnostics. */
82
+ timeRunning: number;
83
+ /** Measured detections/second over the recent window. */
84
+ frameRate: number;
85
+ };
86
+ export type AutoCaptureShutterDecision = {
87
+ state: AutoCaptureShutterState;
88
+ /** Fire the shutter on this frame. */
89
+ capture: boolean;
90
+ /** The applicant's own burst closed on this frame. Save it as `'Manual'`. */
91
+ captureManual: boolean;
92
+ /**
93
+ * The frame the manual shutter appears on — true exactly once per document,
94
+ * since the grant is sticky and nothing clears it.
95
+ */
96
+ revealManualShutter: boolean;
97
+ };
98
+ export declare function createAutoCaptureShutterState(): AutoCaptureShutterState;
99
+ /**
100
+ * How many unsatisfied frames the escape budget is worth at this frame rate.
101
+ *
102
+ * The mechanism is better than `idCapture`'s prop docs suggest, and this is
103
+ * the half worth porting: it does NOT run a wall clock. It converts the ms into
104
+ * a frame count via the measured rate and counts frames that actually
105
+ * exhibited the blocking condition. A slow model load, a fumbled start, dropped
106
+ * frames — none spend the budget. Only evidence that the loop is stuck does,
107
+ * which removes the "when does the clock start" problem a wall clock creates.
108
+ */
109
+ export declare function escapeBudgetFrames(manualFallbackAfterMs: number, frameRate: number): number;
110
+ /**
111
+ * Advance the shutter by one frame.
112
+ *
113
+ * The first satisfied frame OPENS A BURST WINDOW rather than firing. The
114
+ * window is a length of time (`burstWindowMs`, converted through the measured
115
+ * frame rate), and the shutter fires when it closes — by which point the
116
+ * caller has had a chance to bank the sharpest frame it saw.
117
+ *
118
+ * This reopens #383, whose own note nominated `mean of 6` if it ever did. The
119
+ * reason it reopened: two of the three gates are windowed and slow-moving, so
120
+ * they ratchet into satisfaction and stay there, leaving focus — the only
121
+ * single-frame gate — to decide the moment. Firing on first satisfaction
122
+ * therefore fired the instant focus first crossed a deliberately permissive
123
+ * threshold, and a first-crossing rule on a noisy signal sits near the
124
+ * threshold by construction. That is motion blur the hold could have avoided.
125
+ *
126
+ * THE 3-FRAME-GAP GUARANTEE IS INTACT, and it is why the window counts down on
127
+ * every frame rather than only on satisfied ones. A window that reset on an
128
+ * unsatisfied frame would be the consecutive-frame streak #383 measured at 5.2
129
+ * seconds; this one cannot be reset by a focus excursion, only outlived.
130
+ *
131
+ * `idCapture`'s 3-second integrator is still rejected: this does not stack a
132
+ * second aggregation on the gates, it delays the trigger by a fixed short
133
+ * interval after they agree.
134
+ */
135
+ export declare function advanceAutoCaptureShutter(state: AutoCaptureShutterState, frame: AutoCaptureShutterFrame, manualFallbackAfterMs: number, burstWindowMs?: number): AutoCaptureShutterDecision;
136
+ /**
137
+ * The applicant tapped: hold the shutter open for `manualBurstWindowMs`.
138
+ *
139
+ * Returns the state unchanged when there is no window to open — a zero
140
+ * setting, or no measured frame rate to convert one with — and the caller is
141
+ * expected to read `manualBurstFramesRemaining` to tell the two apart. Saving
142
+ * the frame the tap landed on is the correct fallback there: it is what this
143
+ * flow did before the window existed, and a window that never closes is a
144
+ * shutter that never fires.
145
+ *
146
+ * Closes any open AUTO window. Auto-capture firing inside the pause the
147
+ * applicant's own tap opened would hand them a photo they did not take, and
148
+ * stamp `autoCapture: 'Y'` on it.
149
+ */
150
+ export declare function openManualBurst(state: AutoCaptureShutterState, frameRate: number, manualBurstWindowMs: number): AutoCaptureShutterState;
151
+ /**
152
+ * `retry()` restarts the budget for the SAME document.
153
+ *
154
+ * What survives is the BUTTON — see `manualShutterAvailable`. Everything that
155
+ * measures resets, because a retry is a fresh framing attempt and the old
156
+ * attempt's evidence says nothing about it.
157
+ *
158
+ * A FRESH document gets a fresh state, button included: a second document is a
159
+ * fresh framing problem, and the model may well handle it unaided.
160
+ */
161
+ export declare function retryAutoCaptureShutter(state: AutoCaptureShutterState): AutoCaptureShutterState;
162
+ //# sourceMappingURL=autoCaptureShutter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autoCaptureShutter.d.ts","sourceRoot":"","sources":["../../src/documentCapture/autoCaptureShutter.ts"],"names":[],"mappings":"AAaA,4EAA4E;AAC5E,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;;;;;;OAQG;IACH,iBAAiB,EAAE,MAAM,CAAA;IACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,sBAAsB,EAAE,OAAO,CAAA;IAC/B;;;;;;;;OAQG;IACH,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC;;;;;;;;;;;;OAYG;IACH,0BAA0B,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1C,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,CAGR;AAED,6CAA6C;AAC7C,MAAM,MAAM,uBAAuB,GAAG;IACpC,+CAA+C;IAC/C,SAAS,EAAE,OAAO,CAAA;IAClB,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAA;IACnB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,EAAE,uBAAuB,CAAA;IAC9B,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAA;IAChB,6EAA6E;IAC7E,aAAa,EAAE,OAAO,CAAA;IACtB;;;OAGG;IACH,mBAAmB,EAAE,OAAO,CAAA;CAC7B,CAAA;AAYD,wBAAgB,6BAA6B,IAAI,uBAAuB,CAOvE;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,qBAAqB,EAAE,MAAM,EAC7B,SAAS,EAAE,MAAM,GAChB,MAAM,CAGR;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,uBAAuB,EAC9B,KAAK,EAAE,uBAAuB,EAC9B,qBAAqB,EAAE,MAAM,EAC7B,aAAa,SAAI,GAChB,0BAA0B,CA0D5B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,uBAAuB,EAC9B,SAAS,EAAE,MAAM,EACjB,mBAAmB,EAAE,MAAM,GAC1B,uBAAuB,CAQzB;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,uBAAuB,GAC7B,uBAAuB,CAUzB"}
@@ -0,0 +1,183 @@
1
+ // The shutter and its escape hatch (#345), as a pure per-frame reducer.
2
+ //
3
+ // Auto-capture is ASSISTANCE, not enforcement. The original framing assumed
4
+ // enforcement — gate the shutter, re-enable it after a timeout — and that
5
+ // framing does not survive its own escape hatch: if the fallback has to exist,
6
+ // and the box-spill false positive makes it a correctness requirement, then
7
+ // enforcement was never a property of the system, only a delay. The job is to
8
+ // get a better frame than a tap would, and to concede when it cannot.
9
+ //
10
+ // Everything here is driven by data carried ON the frame — `satisfied`,
11
+ // `timeRunning`, `frameRate` — and never by a clock read, which is what makes
12
+ // the escape testable without fake timers.
13
+ /**
14
+ * How many frames a burst window is worth at this frame rate.
15
+ *
16
+ * Same conversion as `escapeBudgetFrames`, and for the same reason: the window
17
+ * is a length of TIME, so it has to be the same length of time on a phone
18
+ * running at 8 fps and one running at 30. Counting raw frames would make the
19
+ * slowest device wait longest.
20
+ */
21
+ export function burstWindowFrames(burstWindowMs, frameRate) {
22
+ if (burstWindowMs <= 0 || frameRate <= 0)
23
+ return 0;
24
+ return Math.ceil((burstWindowMs / 1000) * frameRate);
25
+ }
26
+ /**
27
+ * The loop must have been running this long before the shutter can appear.
28
+ *
29
+ * Ported from `idCapture`'s `hasBeenRunningForLongEnough`. It exists because
30
+ * `frameRate` is meaningless over the first handful of frames, and a threshold
31
+ * computed from a garbage rate would either reveal the shutter instantly or
32
+ * never.
33
+ */
34
+ const MIN_RUNNING_MS_BEFORE_ESCAPE = 1000;
35
+ export function createAutoCaptureShutterState() {
36
+ return {
37
+ unsatisfiedFrames: 0,
38
+ manualShutterAvailable: false,
39
+ burstFramesRemaining: null,
40
+ manualBurstFramesRemaining: null,
41
+ };
42
+ }
43
+ /**
44
+ * How many unsatisfied frames the escape budget is worth at this frame rate.
45
+ *
46
+ * The mechanism is better than `idCapture`'s prop docs suggest, and this is
47
+ * the half worth porting: it does NOT run a wall clock. It converts the ms into
48
+ * a frame count via the measured rate and counts frames that actually
49
+ * exhibited the blocking condition. A slow model load, a fumbled start, dropped
50
+ * frames — none spend the budget. Only evidence that the loop is stuck does,
51
+ * which removes the "when does the clock start" problem a wall clock creates.
52
+ */
53
+ export function escapeBudgetFrames(manualFallbackAfterMs, frameRate) {
54
+ if (manualFallbackAfterMs <= 0 || frameRate <= 0)
55
+ return 0;
56
+ return Math.ceil((manualFallbackAfterMs / 1000) * frameRate);
57
+ }
58
+ /**
59
+ * Advance the shutter by one frame.
60
+ *
61
+ * The first satisfied frame OPENS A BURST WINDOW rather than firing. The
62
+ * window is a length of time (`burstWindowMs`, converted through the measured
63
+ * frame rate), and the shutter fires when it closes — by which point the
64
+ * caller has had a chance to bank the sharpest frame it saw.
65
+ *
66
+ * This reopens #383, whose own note nominated `mean of 6` if it ever did. The
67
+ * reason it reopened: two of the three gates are windowed and slow-moving, so
68
+ * they ratchet into satisfaction and stay there, leaving focus — the only
69
+ * single-frame gate — to decide the moment. Firing on first satisfaction
70
+ * therefore fired the instant focus first crossed a deliberately permissive
71
+ * threshold, and a first-crossing rule on a noisy signal sits near the
72
+ * threshold by construction. That is motion blur the hold could have avoided.
73
+ *
74
+ * THE 3-FRAME-GAP GUARANTEE IS INTACT, and it is why the window counts down on
75
+ * every frame rather than only on satisfied ones. A window that reset on an
76
+ * unsatisfied frame would be the consecutive-frame streak #383 measured at 5.2
77
+ * seconds; this one cannot be reset by a focus excursion, only outlived.
78
+ *
79
+ * `idCapture`'s 3-second integrator is still rejected: this does not stack a
80
+ * second aggregation on the gates, it delays the trigger by a fixed short
81
+ * interval after they agree.
82
+ */
83
+ export function advanceAutoCaptureShutter(state, frame, manualFallbackAfterMs, burstWindowMs = 0) {
84
+ const unsatisfiedFrames = frame.satisfied
85
+ ? state.unsatisfiedFrames
86
+ : state.unsatisfiedFrames + 1;
87
+ const budget = escapeBudgetFrames(manualFallbackAfterMs, frame.frameRate);
88
+ const revealManualShutter = !state.manualShutterAvailable &&
89
+ budget > 0 &&
90
+ frame.timeRunning > MIN_RUNNING_MS_BEFORE_ESCAPE &&
91
+ unsatisfiedFrames >= budget;
92
+ let burstFramesRemaining = state.burstFramesRemaining;
93
+ let manualBurstFramesRemaining = state.manualBurstFramesRemaining;
94
+ let capture = false;
95
+ let captureManual = false;
96
+ if (manualBurstFramesRemaining !== null) {
97
+ // The tap owns this shot. `openManualBurst` already closed the auto
98
+ // window; this keeps it closed for the rest of the tap's window, so a
99
+ // frame going satisfied mid-settle cannot open a second one behind it.
100
+ burstFramesRemaining = null;
101
+ manualBurstFramesRemaining -= 1;
102
+ if (manualBurstFramesRemaining <= 0) {
103
+ captureManual = true;
104
+ manualBurstFramesRemaining = null;
105
+ }
106
+ }
107
+ else if (burstFramesRemaining !== null) {
108
+ // Counting down. NOT gated on `frame.satisfied` — see the header.
109
+ burstFramesRemaining -= 1;
110
+ if (burstFramesRemaining <= 0) {
111
+ capture = true;
112
+ burstFramesRemaining = null;
113
+ }
114
+ }
115
+ else if (frame.satisfied) {
116
+ const window = burstWindowFrames(burstWindowMs, frame.frameRate);
117
+ if (window <= 0) {
118
+ // No window asked for, or no measured frame rate to convert it with:
119
+ // fall back to firing on this frame, which is the pre-burst behaviour.
120
+ capture = true;
121
+ }
122
+ else {
123
+ burstFramesRemaining = window;
124
+ }
125
+ }
126
+ return {
127
+ state: {
128
+ ...state,
129
+ unsatisfiedFrames,
130
+ manualShutterAvailable: state.manualShutterAvailable || revealManualShutter,
131
+ burstFramesRemaining,
132
+ manualBurstFramesRemaining,
133
+ },
134
+ capture,
135
+ captureManual,
136
+ revealManualShutter,
137
+ };
138
+ }
139
+ /**
140
+ * The applicant tapped: hold the shutter open for `manualBurstWindowMs`.
141
+ *
142
+ * Returns the state unchanged when there is no window to open — a zero
143
+ * setting, or no measured frame rate to convert one with — and the caller is
144
+ * expected to read `manualBurstFramesRemaining` to tell the two apart. Saving
145
+ * the frame the tap landed on is the correct fallback there: it is what this
146
+ * flow did before the window existed, and a window that never closes is a
147
+ * shutter that never fires.
148
+ *
149
+ * Closes any open AUTO window. Auto-capture firing inside the pause the
150
+ * applicant's own tap opened would hand them a photo they did not take, and
151
+ * stamp `autoCapture: 'Y'` on it.
152
+ */
153
+ export function openManualBurst(state, frameRate, manualBurstWindowMs) {
154
+ const window = burstWindowFrames(manualBurstWindowMs, frameRate);
155
+ if (window <= 0)
156
+ return state;
157
+ return {
158
+ ...state,
159
+ manualBurstFramesRemaining: window,
160
+ burstFramesRemaining: null,
161
+ };
162
+ }
163
+ /**
164
+ * `retry()` restarts the budget for the SAME document.
165
+ *
166
+ * What survives is the BUTTON — see `manualShutterAvailable`. Everything that
167
+ * measures resets, because a retry is a fresh framing attempt and the old
168
+ * attempt's evidence says nothing about it.
169
+ *
170
+ * A FRESH document gets a fresh state, button included: a second document is a
171
+ * fresh framing problem, and the model may well handle it unaided.
172
+ */
173
+ export function retryAutoCaptureShutter(state) {
174
+ return {
175
+ ...state,
176
+ unsatisfiedFrames: 0,
177
+ // A window left open across a retry would fire on the new attempt's first
178
+ // frames, before the gates have had anything to say about them. The same
179
+ // goes for a tap the applicant has already seen the result of.
180
+ burstFramesRemaining: null,
181
+ manualBurstFramesRemaining: null,
182
+ };
183
+ }
@@ -1,6 +1,8 @@
1
1
  import { acquireCamera, type AcquireCameraOptions } from '../camera/acquireCamera';
2
2
  import type { SubmissionArtifacts } from '../client/artifacts';
3
3
  import type { IdmissionClient } from '../client/IdmissionClient';
4
+ import { createAutoCaptureEngine, type AutoCaptureEngineConfig } from './autoCaptureEngine';
5
+ import type { AutoCaptureDiagnostics } from './autoCaptureGeometry';
4
6
  import { type CapturedDocument, type DocumentCaptureCompleteHandler, type DocumentCaptureControllerState, type DocumentCaptureInput } from './state';
5
7
  export type DocumentCaptureControllerConfig = {
6
8
  client: IdmissionClient;
@@ -11,14 +13,26 @@ export type DocumentCaptureControllerConfig = {
11
13
  camera?: AcquireCameraOptions;
12
14
  /** Skip acquiring the camera during attach(); call actions.requestCamera() later. */
13
15
  deferCameraAcquisition?: boolean;
16
+ /**
17
+ * Engine knobs for the auto-capture detection loop, mirroring
18
+ * `IdCaptureControllerConfig`'s names (#340). Whether the loop runs at all is
19
+ * decided per-document by `DocumentCaptureInput.autoCapture`; these only say
20
+ * how. Deliberately NOT on the 2.x façade day one.
21
+ */
22
+ autoCaptureEngine?: Omit<AutoCaptureEngineConfig, 'autoCapture' | 'onDiagnostics' | 'onModelsChanged'>;
14
23
  onDocumentCaptured?: (document: CapturedDocument, index: number) => void;
15
24
  onDocumentUploaded?: (document: CapturedDocument, index: number) => void;
16
25
  onAllDocumentsUploaded?: DocumentCaptureCompleteHandler;
26
+ /** Test seams; production defaults. */
17
27
  io?: {
18
28
  now?: () => Date;
19
29
  acquireCamera?: typeof acquireCamera;
20
30
  createObjectUrl?: (blob: Blob) => string;
21
- captureFrame?: (video: HTMLVideoElement) => Promise<Blob | null>;
31
+ captureFrame?: (source: CaptureFrameSource, aspectRatio?: number) => Promise<Blob | null>;
32
+ /** Mirrors idCapture's `io.createPipeline`: the whole ML half, injectable. */
33
+ createAutoCaptureEngine?: typeof createAutoCaptureEngine;
34
+ /** Backs the banked best-frame canvas; production default. */
35
+ createCanvas?: () => HTMLCanvasElement;
22
36
  };
23
37
  };
24
38
  export type DocumentCaptureController = {
@@ -26,6 +40,12 @@ export type DocumentCaptureController = {
26
40
  detach(): void;
27
41
  getState(): DocumentCaptureControllerState;
28
42
  subscribe(cb: (state: DocumentCaptureControllerState) => void): () => void;
43
+ /**
44
+ * The auto-capture diagnostics ring buffer, oldest frame first. Empty unless
45
+ * `autoCaptureEngine.debugMode` was set at construction. This — not the
46
+ * on-glass text — is the deliverable of a tuning session (#341).
47
+ */
48
+ getAutoCaptureLog(): AutoCaptureDiagnostics[];
29
49
  collectArtifacts(): SubmissionArtifacts;
30
50
  actions: {
31
51
  requestCamera(): Promise<void>;
@@ -34,5 +54,17 @@ export type DocumentCaptureController = {
34
54
  upload(): Promise<void>;
35
55
  };
36
56
  };
57
+ /**
58
+ * The pixels a capture is cropped from, with the dimensions they measure.
59
+ *
60
+ * Not always the video element: an auto-capture saves the frame the detector
61
+ * and focus model actually GRADED, which by then is one inference round-trip
62
+ * behind the live feed. See `captureSource`.
63
+ */
64
+ export type CaptureFrameSource = {
65
+ image: CanvasImageSource;
66
+ width: number;
67
+ height: number;
68
+ };
37
69
  export declare function createDocumentCaptureController(config: DocumentCaptureControllerConfig): DocumentCaptureController;
38
70
  //# sourceMappingURL=controller.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/documentCapture/controller.ts"],"names":[],"mappings":"AAiBA,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,EAE1B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAKhE,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EAGnC,KAAK,oBAAoB,EAC1B,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAA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