@chipmobilesdk/rn-camera 0.4.0 → 0.5.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 (185) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/README.md +11 -7
  3. package/lib/commonjs/config/types.js +54 -0
  4. package/lib/commonjs/config/types.js.map +1 -0
  5. package/lib/commonjs/core/capabilities.js +45 -0
  6. package/lib/commonjs/core/capabilities.js.map +1 -0
  7. package/lib/commonjs/core/captureController.js +107 -0
  8. package/lib/commonjs/core/captureController.js.map +1 -0
  9. package/lib/commonjs/core/contract.js +16 -0
  10. package/lib/commonjs/core/contract.js.map +1 -0
  11. package/lib/commonjs/core/controller.js +452 -0
  12. package/lib/commonjs/core/controller.js.map +1 -0
  13. package/lib/commonjs/core/sessionMachine.js +116 -0
  14. package/lib/commonjs/core/sessionMachine.js.map +1 -0
  15. package/lib/commonjs/core/sessionRuntime.js +218 -0
  16. package/lib/commonjs/core/sessionRuntime.js.map +1 -0
  17. package/lib/commonjs/diagnostics/errors.js +86 -0
  18. package/lib/commonjs/diagnostics/errors.js.map +1 -0
  19. package/lib/commonjs/diagnostics/logger.js +40 -0
  20. package/lib/commonjs/diagnostics/logger.js.map +1 -0
  21. package/lib/commonjs/geometry/coordinateMapping.js +156 -0
  22. package/lib/commonjs/geometry/coordinateMapping.js.map +1 -0
  23. package/lib/commonjs/index.js +130 -0
  24. package/lib/commonjs/index.js.map +1 -0
  25. package/lib/commonjs/native/cameraEngine.js +86 -0
  26. package/lib/commonjs/native/cameraEngine.js.map +1 -0
  27. package/lib/commonjs/native/visionCameraPeer.js +28 -0
  28. package/lib/commonjs/native/visionCameraPeer.js.map +1 -0
  29. package/lib/commonjs/native/visionSurface.js +38 -0
  30. package/lib/commonjs/native/visionSurface.js.map +1 -0
  31. package/lib/commonjs/package.json +1 -0
  32. package/lib/commonjs/permissions/permissionPort.js +105 -0
  33. package/lib/commonjs/permissions/permissionPort.js.map +1 -0
  34. package/lib/commonjs/react/CameraPreview.js +136 -0
  35. package/lib/commonjs/react/CameraPreview.js.map +1 -0
  36. package/lib/commonjs/react/VisionCameraFeed.js +196 -0
  37. package/lib/commonjs/react/VisionCameraFeed.js.map +1 -0
  38. package/lib/commonjs/react/hooks.js +50 -0
  39. package/lib/commonjs/react/hooks.js.map +1 -0
  40. package/lib/commonjs/storage/artifactStore.js +98 -0
  41. package/lib/commonjs/storage/artifactStore.js.map +1 -0
  42. package/lib/commonjs/testing/conformance.js +109 -0
  43. package/lib/commonjs/testing/conformance.js.map +1 -0
  44. package/lib/commonjs/testing/index.js +50 -0
  45. package/lib/commonjs/testing/index.js.map +1 -0
  46. package/lib/commonjs/testing/testCameraAdapter.js +191 -0
  47. package/lib/commonjs/testing/testCameraAdapter.js.map +1 -0
  48. package/lib/module/config/types.js +49 -0
  49. package/lib/module/config/types.js.map +1 -0
  50. package/lib/module/core/capabilities.js +37 -0
  51. package/lib/module/core/capabilities.js.map +1 -0
  52. package/lib/module/core/captureController.js +98 -0
  53. package/lib/module/core/captureController.js.map +1 -0
  54. package/lib/module/core/contract.js +12 -0
  55. package/lib/module/core/contract.js.map +1 -0
  56. package/lib/module/core/controller.js +442 -0
  57. package/lib/module/core/controller.js.map +1 -0
  58. package/lib/module/core/sessionMachine.js +109 -0
  59. package/lib/module/core/sessionMachine.js.map +1 -0
  60. package/lib/module/core/sessionRuntime.js +215 -0
  61. package/lib/module/core/sessionRuntime.js.map +1 -0
  62. package/lib/module/diagnostics/errors.js +79 -0
  63. package/lib/module/diagnostics/errors.js.map +1 -0
  64. package/lib/module/diagnostics/logger.js +35 -0
  65. package/lib/module/diagnostics/logger.js.map +1 -0
  66. package/lib/module/geometry/coordinateMapping.js +149 -0
  67. package/lib/module/geometry/coordinateMapping.js.map +1 -0
  68. package/lib/module/index.js +44 -0
  69. package/lib/module/index.js.map +1 -0
  70. package/lib/module/native/cameraEngine.js +83 -0
  71. package/lib/module/native/cameraEngine.js.map +1 -0
  72. package/lib/module/native/visionCameraPeer.js +24 -0
  73. package/lib/module/native/visionCameraPeer.js.map +1 -0
  74. package/lib/module/native/visionSurface.js +34 -0
  75. package/lib/module/native/visionSurface.js.map +1 -0
  76. package/lib/module/package.json +1 -0
  77. package/lib/module/permissions/permissionPort.js +101 -0
  78. package/lib/module/permissions/permissionPort.js.map +1 -0
  79. package/lib/module/react/CameraPreview.js +130 -0
  80. package/lib/module/react/CameraPreview.js.map +1 -0
  81. package/lib/module/react/VisionCameraFeed.js +190 -0
  82. package/lib/module/react/VisionCameraFeed.js.map +1 -0
  83. package/lib/module/react/hooks.js +45 -0
  84. package/lib/module/react/hooks.js.map +1 -0
  85. package/lib/module/storage/artifactStore.js +94 -0
  86. package/lib/module/storage/artifactStore.js.map +1 -0
  87. package/lib/module/testing/conformance.js +102 -0
  88. package/lib/module/testing/conformance.js.map +1 -0
  89. package/lib/module/testing/index.js +13 -0
  90. package/lib/module/testing/index.js.map +1 -0
  91. package/lib/module/testing/testCameraAdapter.js +185 -0
  92. package/lib/module/testing/testCameraAdapter.js.map +1 -0
  93. package/lib/typescript/commonjs/config/types.d.ts +122 -0
  94. package/lib/typescript/commonjs/config/types.d.ts.map +1 -0
  95. package/lib/typescript/commonjs/core/capabilities.d.ts +16 -0
  96. package/lib/typescript/commonjs/core/capabilities.d.ts.map +1 -0
  97. package/lib/typescript/commonjs/core/captureController.d.ts +48 -0
  98. package/lib/typescript/commonjs/core/captureController.d.ts.map +1 -0
  99. package/lib/typescript/commonjs/core/contract.d.ts +92 -0
  100. package/lib/typescript/commonjs/core/contract.d.ts.map +1 -0
  101. package/lib/typescript/commonjs/core/controller.d.ts +15 -0
  102. package/lib/typescript/commonjs/core/controller.d.ts.map +1 -0
  103. package/lib/typescript/commonjs/core/sessionMachine.d.ts +46 -0
  104. package/lib/typescript/commonjs/core/sessionMachine.d.ts.map +1 -0
  105. package/lib/typescript/commonjs/core/sessionRuntime.d.ts +64 -0
  106. package/lib/typescript/commonjs/core/sessionRuntime.d.ts.map +1 -0
  107. package/lib/typescript/commonjs/diagnostics/errors.d.ts +24 -0
  108. package/lib/typescript/commonjs/diagnostics/errors.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/diagnostics/logger.d.ts +24 -0
  110. package/lib/typescript/commonjs/diagnostics/logger.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/geometry/coordinateMapping.d.ts +23 -0
  112. package/lib/typescript/commonjs/geometry/coordinateMapping.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/index.d.ts +32 -0
  114. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/native/cameraEngine.d.ts +50 -0
  116. package/lib/typescript/commonjs/native/cameraEngine.d.ts.map +1 -0
  117. package/lib/typescript/commonjs/native/visionCameraPeer.d.ts +2 -0
  118. package/lib/typescript/commonjs/native/visionCameraPeer.d.ts.map +1 -0
  119. package/lib/typescript/commonjs/native/visionSurface.d.ts +41 -0
  120. package/lib/typescript/commonjs/native/visionSurface.d.ts.map +1 -0
  121. package/lib/typescript/commonjs/package.json +1 -0
  122. package/lib/typescript/commonjs/permissions/permissionPort.d.ts +24 -0
  123. package/lib/typescript/commonjs/permissions/permissionPort.d.ts.map +1 -0
  124. package/lib/typescript/commonjs/react/CameraPreview.d.ts +25 -0
  125. package/lib/typescript/commonjs/react/CameraPreview.d.ts.map +1 -0
  126. package/lib/typescript/commonjs/react/VisionCameraFeed.d.ts +31 -0
  127. package/lib/typescript/commonjs/react/VisionCameraFeed.d.ts.map +1 -0
  128. package/lib/typescript/commonjs/react/hooks.d.ts +12 -0
  129. package/lib/typescript/commonjs/react/hooks.d.ts.map +1 -0
  130. package/lib/typescript/commonjs/storage/artifactStore.d.ts +54 -0
  131. package/lib/typescript/commonjs/storage/artifactStore.d.ts.map +1 -0
  132. package/lib/typescript/commonjs/testing/conformance.d.ts +37 -0
  133. package/lib/typescript/commonjs/testing/conformance.d.ts.map +1 -0
  134. package/lib/typescript/commonjs/testing/index.d.ts +12 -0
  135. package/lib/typescript/commonjs/testing/index.d.ts.map +1 -0
  136. package/lib/typescript/commonjs/testing/testCameraAdapter.d.ts +61 -0
  137. package/lib/typescript/commonjs/testing/testCameraAdapter.d.ts.map +1 -0
  138. package/lib/typescript/module/config/types.d.ts +122 -0
  139. package/lib/typescript/module/config/types.d.ts.map +1 -0
  140. package/lib/typescript/module/core/capabilities.d.ts +16 -0
  141. package/lib/typescript/module/core/capabilities.d.ts.map +1 -0
  142. package/lib/typescript/module/core/captureController.d.ts +48 -0
  143. package/lib/typescript/module/core/captureController.d.ts.map +1 -0
  144. package/lib/typescript/module/core/contract.d.ts +92 -0
  145. package/lib/typescript/module/core/contract.d.ts.map +1 -0
  146. package/lib/typescript/module/core/controller.d.ts +15 -0
  147. package/lib/typescript/module/core/controller.d.ts.map +1 -0
  148. package/lib/typescript/module/core/sessionMachine.d.ts +46 -0
  149. package/lib/typescript/module/core/sessionMachine.d.ts.map +1 -0
  150. package/lib/typescript/module/core/sessionRuntime.d.ts +64 -0
  151. package/lib/typescript/module/core/sessionRuntime.d.ts.map +1 -0
  152. package/lib/typescript/module/diagnostics/errors.d.ts +24 -0
  153. package/lib/typescript/module/diagnostics/errors.d.ts.map +1 -0
  154. package/lib/typescript/module/diagnostics/logger.d.ts +24 -0
  155. package/lib/typescript/module/diagnostics/logger.d.ts.map +1 -0
  156. package/lib/typescript/module/geometry/coordinateMapping.d.ts +23 -0
  157. package/lib/typescript/module/geometry/coordinateMapping.d.ts.map +1 -0
  158. package/lib/typescript/module/index.d.ts +32 -0
  159. package/lib/typescript/module/index.d.ts.map +1 -0
  160. package/lib/typescript/module/native/cameraEngine.d.ts +50 -0
  161. package/lib/typescript/module/native/cameraEngine.d.ts.map +1 -0
  162. package/lib/typescript/module/native/visionCameraPeer.d.ts +2 -0
  163. package/lib/typescript/module/native/visionCameraPeer.d.ts.map +1 -0
  164. package/lib/typescript/module/native/visionSurface.d.ts +41 -0
  165. package/lib/typescript/module/native/visionSurface.d.ts.map +1 -0
  166. package/lib/typescript/module/package.json +1 -0
  167. package/lib/typescript/module/permissions/permissionPort.d.ts +24 -0
  168. package/lib/typescript/module/permissions/permissionPort.d.ts.map +1 -0
  169. package/lib/typescript/module/react/CameraPreview.d.ts +25 -0
  170. package/lib/typescript/module/react/CameraPreview.d.ts.map +1 -0
  171. package/lib/typescript/module/react/VisionCameraFeed.d.ts +31 -0
  172. package/lib/typescript/module/react/VisionCameraFeed.d.ts.map +1 -0
  173. package/lib/typescript/module/react/hooks.d.ts +12 -0
  174. package/lib/typescript/module/react/hooks.d.ts.map +1 -0
  175. package/lib/typescript/module/storage/artifactStore.d.ts +54 -0
  176. package/lib/typescript/module/storage/artifactStore.d.ts.map +1 -0
  177. package/lib/typescript/module/testing/conformance.d.ts +37 -0
  178. package/lib/typescript/module/testing/conformance.d.ts.map +1 -0
  179. package/lib/typescript/module/testing/index.d.ts +12 -0
  180. package/lib/typescript/module/testing/index.d.ts.map +1 -0
  181. package/lib/typescript/module/testing/testCameraAdapter.d.ts +61 -0
  182. package/lib/typescript/module/testing/testCameraAdapter.d.ts.map +1 -0
  183. package/package.json +49 -13
  184. package/skills/sdk-rn-camera/SKILL.md +6 -3
  185. package/src/index.ts +4 -12
@@ -0,0 +1,54 @@
1
+ /**
2
+ * ArtifactStore port + default cache-directory adapter (FR-026..FR-029).
3
+ *
4
+ * Package-owned artifacts live in a dedicated `rn-camera` subdirectory of the
5
+ * platform cache directory (research R6). That dedicated prefix is what makes
6
+ * ownership checkable rather than advisory: `owns()` is a path-prefix test, so
7
+ * the package can refuse to delete anything it did not create (FR-028).
8
+ */
9
+ export interface ArtifactStore {
10
+ /** Absolute path of the package-owned temporary directory. */
11
+ temporaryDirectory(): string;
12
+ /** True only for paths the package created (FR-028). */
13
+ owns(uri: string): boolean;
14
+ /** Deletes an artifact. Resolves even if already gone (FR-027). */
15
+ remove(uri: string): Promise<void>;
16
+ /** Deletes owned artifacts older than `olderThanMs`; returns the count. */
17
+ sweep(olderThanMs: number): Promise<number>;
18
+ /**
19
+ * Brings a fresh capture under the store and returns its managed URI: a file
20
+ * already inside the store is recorded as created by this process, a file
21
+ * anywhere else is moved in. Without this, a capture the engine wrote to its
22
+ * own temporary directory is never owned, so `cleanup()` refuses it and the
23
+ * sweep never sees it. Optional so app-written stores keep compiling.
24
+ */
25
+ adopt?(uri: string): Promise<string>;
26
+ }
27
+ /** Minimal filesystem surface the adapter needs. Injectable for tests. */
28
+ export interface FileSystemBridge {
29
+ cacheDirectory(): string;
30
+ exists(path: string): Promise<boolean>;
31
+ unlink(path: string): Promise<void>;
32
+ list(directory: string): Promise<readonly string[]>;
33
+ createdAt(path: string): Promise<number>;
34
+ ensureDirectory(directory: string): Promise<void>;
35
+ /**
36
+ * Moves a file. Needed by `adopt()` to pull a capture out of the engine's own
37
+ * temporary directory; a bridge without it can only adopt files already
38
+ * inside the store.
39
+ */
40
+ move?(from: string, to: string): Promise<void>;
41
+ }
42
+ export interface StoreOptions {
43
+ readonly fs?: FileSystemBridge;
44
+ /** Directory name under the cache directory. Defaults to `rn-camera`. */
45
+ readonly directoryName?: string;
46
+ }
47
+ export declare function createArtifactStore(fs: FileSystemBridge, directoryName?: string): ArtifactStore;
48
+ /**
49
+ * Default adapter. The concrete filesystem bridge is supplied by the native
50
+ * layer at runtime; it is a parameter rather than a hard import so the package
51
+ * takes no filesystem dependency of its own.
52
+ */
53
+ export declare function createCacheArtifactStore(options?: StoreOptions): ArtifactStore;
54
+ //# sourceMappingURL=artifactStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifactStore.d.ts","sourceRoot":"","sources":["../../../../src/storage/artifactStore.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,WAAW,aAAa;IAC7B,8DAA8D;IAC9D,kBAAkB,IAAI,MAAM,CAAC;IAC7B,wDAAwD;IACxD,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B,mEAAmE;IACnE,MAAM,CAAC,G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apter and against the real
5
+ * VisionCamera adapters (native module mocked in Jest, or for real on a device),
6
+ * so the fake the app's tests rely on cannot drift from the adapter it stands in
7
+ * for. Each check builds its own port from a harness, under the conditions it
8
+ * needs.
9
+ */
10
+ import { type Check, type ConformanceReport } from '@chipmobilesdk/rn-core/testing';
11
+ import type { CameraEngine } from '../native/cameraEngine';
12
+ import type { PermissionPort } from '../permissions/permissionPort';
13
+ export type SystemPermission = 'undetermined' | 'granted' | 'deniedPermanently';
14
+ export interface PermissionHarness {
15
+ /** A port over a system whose permission starts in `initial`. */
16
+ create(initial: SystemPermission): {
17
+ readonly port: PermissionPort;
18
+ /** Changes the system permission, as Settings would. */
19
+ setSystemState(state: SystemPermission): void;
20
+ /** How many times the system prompt was shown. */
21
+ prompts(): number;
22
+ };
23
+ }
24
+ export interface CameraDeviceSpec {
25
+ readonly position: 'front' | 'back';
26
+ readonly hasFlash?: boolean;
27
+ readonly hasTorch?: boolean;
28
+ }
29
+ export interface EngineHarness {
30
+ /** An engine on a device with these cameras. */
31
+ create(devices: readonly CameraDeviceSpec[]): CameraEngine;
32
+ }
33
+ export declare const permissionPortChecks: readonly Check<PermissionHarness>[];
34
+ export declare const cameraEngineChecks: readonly Check<EngineHarness>[];
35
+ export declare function runPermissionPortConformance(harness: PermissionHarness): Promise<ConformanceReport>;
36
+ export declare function runCameraEngineConformance(harness: EngineHarness): Promise<ConformanceReport>;
37
+ //# sourceMappingURL=conformance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conformance.d.ts","sourceRoot":"","sources":["../../../../src/testing/conformance.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAGN,KAAK,KAAK,EACV,KAAK,iBAAiB,EACtB,MAAM,gCAAgC,CAAC;AAGxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG,SAAS,GAAG,mBAAmB,CAAC;AAEhF,MAAM,WAAW,iBAAiB;IACjC,iEAAiE;IACjE,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG;QAClC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;QAC9B,wDAAwD;QACxD,cAAc,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAC;QAC9C,kDAAkD;QAClD,OAAO,IAAI,MAAM,CAAC;KAClB,CAAC;CACF;AAED,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa;IAC7B,gDAAgD;IAChD,MAAM,CAAC,OAAO,EAAE,SAAS,gBAAgB,EAAE,GAAG,YAAY,CAAC;CAC3D;AAED,eAAO,MAAM,oBAAoB,EAAE,SAAS,KAAK,CAAC,iBAAiB,CAAC,EA2CnE,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,SAAS,KAAK,CAAC,aAAa,CAAC,EAwC7D,CAAC;AAEF,wBAAgB,4BAA4B,CAC3C,OAAO,EAAE,iBAAiB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAE5B;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAE7F"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `@chipmobilesdk/rn-camera/testing`: test doubles and the port conformance suites.
3
+ *
4
+ * A separate entrypoint so the suites cannot reach a production bundle. The test
5
+ * adapter is also exported from the main entrypoint for compatibility; it leaves
6
+ * there only in a major release.
7
+ */
8
+ export { createTestCamera, createMemoryFileSystem, DEFAULT_TEST_CAPABILITIES, } from './testCameraAdapter';
9
+ export type { MemoryFileSystem, TestCameraConfig, TestCameraHandles } from './testCameraAdapter';
10
+ export { cameraEngineChecks, permissionPortChecks, runCameraEngineConformance, runPermissionPortConformance, } from './conformance';
11
+ export type { CameraDeviceSpec, EngineHarness, PermissionHarness, SystemPermission, } from './conformance';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACN,gBAAgB,EAChB,sBAAsB,EACtB,yBAAyB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEjG,OAAO,EACN,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,GAC5B,MAAM,eAAe,CAAC;AACvB,YAAY,EACX,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,GAChB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Deterministic in-memory camera for tests (FR-041, SC-010).
3
+ *
4
+ * These are real implementations of the same published ports the production
5
+ * adapters implement, not a parallel mock — so a contract change breaks them at
6
+ * compile time and they cannot drift. Nothing here touches a native module, the
7
+ * filesystem, or a permission API.
8
+ */
9
+ import { type CameraPermissionState, type CapabilityProfile, type CapturedImage } from '../config/types';
10
+ import { type CameraErrorCode } from '../diagnostics/errors';
11
+ import type { CameraEngine } from '../native/cameraEngine';
12
+ import type { PermissionPort } from '../permissions/permissionPort';
13
+ import { type ArtifactStore, type FileSystemBridge } from '../storage/artifactStore';
14
+ import type { AppStatus } from '../core/controller';
15
+ export interface MemoryFileSystem extends FileSystemBridge {
16
+ /** Seeds a file with an explicit creation time, for time-to-live tests. */
17
+ seed(path: string, createdAtMs: number): void;
18
+ /** Every path currently present. */
19
+ paths(): readonly string[];
20
+ }
21
+ export declare function createMemoryFileSystem(root?: string): MemoryFileSystem;
22
+ export declare const DEFAULT_TEST_CAPABILITIES: CapabilityProfile;
23
+ export interface TestCameraConfig {
24
+ readonly permission?: CameraPermissionState;
25
+ readonly capabilities?: Partial<CapabilityProfile>;
26
+ readonly captureResult?: Partial<CapturedImage>;
27
+ readonly captureError?: CameraErrorCode;
28
+ readonly startError?: CameraErrorCode;
29
+ readonly cacheRoot?: string;
30
+ }
31
+ export interface TestCameraHandles {
32
+ readonly engine: CameraEngine;
33
+ readonly permissions: PermissionPort;
34
+ readonly store: ArtifactStore;
35
+ readonly fs: MemoryFileSystem;
36
+ /** Drives the controller's app foreground/background handling. */
37
+ subscribeToAppState(listener: (status: AppStatus) => void): () => void;
38
+ setAppState(status: AppStatus): void;
39
+ /** Simulates a Settings-level permission change while running (FR-007). */
40
+ setPermission(state: CameraPermissionState): void;
41
+ /**
42
+ * Simulates the OS taking the camera away: an incoming call, another app,
43
+ * a disconnected device. A live session tears down with that code, exactly
44
+ * as the device adapter reports it (CAM-19), and the next start fails until
45
+ * `setStartError(null)` clears it.
46
+ */
47
+ emitInterruption(code?: CameraErrorCode): void;
48
+ /** Simulates the preview failing to produce frames. */
49
+ emitPermissionRequestFailure(enabled: boolean): void;
50
+ setCaptureError(code: CameraErrorCode | null): void;
51
+ setStartError(code: CameraErrorCode | null): void;
52
+ /** How many times `request` showed the system prompt. */
53
+ prompts(): number;
54
+ /** Every capture the engine produced, in order. */
55
+ captures(): readonly CapturedImage[];
56
+ torchState(): boolean;
57
+ startCount(): number;
58
+ stopCount(): number;
59
+ }
60
+ export declare function createTestCamera(config?: TestCameraConfig): TestCameraHandles;
61
+ //# sourceMappingURL=testCameraAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testCameraAdapter.d.ts","sourceRoot":"","sources":["../../../../src/testing/testCameraAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAGN,KAAK,qBAAqB,EAE1B,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAElB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E,mBAAmB,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IACvE,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACrC,2EAA2E;IAC3E,aAAa,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAClD;;;;;OAKG;IACH,gBAAgB,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IAC/C,uDAAuD;IACvD,4BAA4B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACrD,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,GAAG,IAAI,CAAC;IACpD,aAAa,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,GAAG,IAAI,CAAC;IAClD,yDAAyD;IACzD,OAAO,IAAI,MAAM,CAAC;IAClB,mDAAmD;IACnD,QAAQ,IAAI,SAAS,aAAa,EAAE,CAAC;IACrC,UAAU,IAAI,OAAO,CAAC;IACtB,UAAU,IAAI,MAAM,CAAC;IACrB,SAAS,IAAI,MAAM,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,gBAAqB,GAAG,iBAAiB,CAkJjF"}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Public type contract for @chipmobilesdk/rn-camera.
3
+ *
4
+ * Every type here is re-exported from `src/index.ts` (LIB-002/LIB-003). See
5
+ * `specs/006-rn-camera-package/contracts/public-api.md` for the authoritative
6
+ * contract and `data-model.md` for the rules behind each field.
7
+ */
8
+ /** Camera authorization status. Seven distinguishable outcomes (FR-004). */
9
+ export type CameraPermissionState = 'undetermined' | 'requesting' | 'granted' | 'denied' | 'deniedPermanently' | 'unavailable' | 'unsupported';
10
+ export type CameraPosition = 'front' | 'back';
11
+ export type FlashMode = 'auto' | 'on' | 'off';
12
+ export type ResizeMode = 'cover' | 'contain';
13
+ export type ArtifactOwnership = 'packageTemporary' | 'appOwned';
14
+ import type { SurfaceInfo } from '../native/visionSurface.js';
15
+ export type SessionStatus = 'idle' | 'starting' | 'active' | 'paused' | 'stopping' | 'stopped' | 'error';
16
+ /**
17
+ * A metadata field the platform could not determine (FR-022). Distinct from an
18
+ * absent property so consumers can tell "not reported" from "not asked for".
19
+ */
20
+ export interface Unavailable {
21
+ readonly available: false;
22
+ }
23
+ export interface Known<T> {
24
+ readonly available: true;
25
+ readonly value: T;
26
+ }
27
+ export type Maybe<T> = Known<T> | Unavailable;
28
+ export declare function known<T>(value: T): Known<T>;
29
+ export declare function unavailable(): Unavailable;
30
+ /** What this device and platform actually support (FR-033). */
31
+ export interface CapabilityProfile {
32
+ readonly availablePositions: readonly CameraPosition[];
33
+ readonly hasFlash: boolean;
34
+ readonly hasTorch: boolean;
35
+ readonly supportsOrientationChange: boolean;
36
+ readonly hasCameraHardware: boolean;
37
+ }
38
+ /** Instruction to take one still photo. Carries no business context (FR-002). */
39
+ export interface CaptureRequest {
40
+ /** 0..1, clamped to what the device supports. */
41
+ readonly quality?: number;
42
+ /** Longest edge in pixels, applied within device limits. */
43
+ readonly maxDimension?: number;
44
+ readonly cameraPosition?: CameraPosition;
45
+ readonly flashMode?: FlashMode;
46
+ /**
47
+ * Supplying a destination makes the result `appOwned` and the package writes
48
+ * directly there. Omitting it makes the result `packageTemporary` (FR-026a).
49
+ * This is the only way ownership is decided.
50
+ */
51
+ readonly destination?: string;
52
+ }
53
+ /** Result of one successful capture. Always a file reference (FR-021/FR-021a). */
54
+ export interface CapturedImage {
55
+ /** File URI or handle. Never a base64 string, never an in-memory buffer. */
56
+ readonly uri: string;
57
+ readonly mimeType: string;
58
+ readonly width: number;
59
+ readonly height: number;
60
+ readonly timestamp: number;
61
+ readonly cameraPosition: CameraPosition;
62
+ readonly ownership: ArtifactOwnership;
63
+ readonly effectiveQuality: number;
64
+ readonly effectiveMaxDimension: Maybe<number>;
65
+ readonly fileSize: Maybe<number>;
66
+ readonly orientation: Maybe<number>;
67
+ }
68
+ /** Options accepted when starting a session. */
69
+ export interface StartOptions {
70
+ readonly cameraPosition?: CameraPosition;
71
+ }
72
+ /**
73
+ * Relationship between captured-image space and on-screen preview space.
74
+ * Consumed by the pure mapping functions in `geometry/coordinateMapping`.
75
+ */
76
+ export interface PreviewGeometry {
77
+ readonly imageWidth: number;
78
+ readonly imageHeight: number;
79
+ readonly previewWidth: number;
80
+ readonly previewHeight: number;
81
+ readonly resizeMode: ResizeMode;
82
+ /** Clockwise degrees: 0, 90, 180, or 270. */
83
+ readonly orientation: number;
84
+ readonly isMirrored: boolean;
85
+ }
86
+ export interface Point {
87
+ readonly x: number;
88
+ readonly y: number;
89
+ }
90
+ export interface Rect {
91
+ readonly x: number;
92
+ readonly y: number;
93
+ readonly width: number;
94
+ readonly height: number;
95
+ }
96
+ /** Aggregate observable state exposed by the controller. */
97
+ export interface CameraState {
98
+ readonly session: SessionStatus;
99
+ readonly permission: CameraPermissionState;
100
+ readonly capabilities: CapabilityProfile | null;
101
+ readonly cameraPosition: CameraPosition;
102
+ readonly flashMode: FlashMode;
103
+ readonly torchEnabled: boolean;
104
+ readonly capturing: boolean;
105
+ /**
106
+ * What the mounted preview surface reported about itself: the capture
107
+ * dimensions of the selected format, its orientation, and the position of
108
+ * the device actually running. `null` until a surface reports (CAM-10).
109
+ */
110
+ readonly surface: SurfaceInfo | null;
111
+ readonly error: CameraErrorLike | null;
112
+ }
113
+ /**
114
+ * Structural view of a CameraError, kept here so `CameraState` does not create
115
+ * a circular import with the diagnostics module.
116
+ */
117
+ export interface CameraErrorLike {
118
+ readonly code: string;
119
+ readonly recoverable: boolean;
120
+ readonly message: string;
121
+ }
122
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/config/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,4EAA4E;AAC5E,MAAM,MAAM,qBAAqB,GAC9B,cAAc,GACd,YAAY,GACZ,SAAS,GACT,QAA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what lets an app hide a control instead of
6
+ * discovering at tap time that the device has no flash.
7
+ */
8
+ import type { CameraPosition, CapabilityProfile, FlashMode } from '../config/types.js';
9
+ export declare const EMPTY_CAPABILITIES: CapabilityProfile;
10
+ export declare function supportsPosition(profile: CapabilityProfile | null, position: CameraPosition): boolean;
11
+ /** `off` is always legal — it is the absence of flash, not a use of it. */
12
+ export declare function supportsFlashMode(profile: CapabilityProfile | null, mode: FlashMode): boolean;
13
+ export declare function supportsTorch(profile: CapabilityProfile | null): boolean;
14
+ /** Throws the uniform unsupported error so every gate reads the same way. */
15
+ export declare function assertSupported(supported: boolean, what: string): void;
16
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../../src/core/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,oBAAiB,CAAC;AAGpF,eAAO,MAAM,kBAAkB,EAAE,iBAMhC,CAAC;AAEF,wBAAgB,gBAAgB,CAC/B,OAAO,EAAE,iBAAiB,GAAG,IAAI,EACjC,QAAQ,EAAE,cAAc,GACtB,OAAO,CAET;AAED,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAE7F;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,GAAG,OAAO,CAExE;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAItE"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Capture guards, single-flight enforcement, and metadata assembly
3
+ * (FR-020..FR-026b).
4
+ *
5
+ * The single-flight guard rejects rather than queues or coalesces. A queue
6
+ * turns a double-tapped shutter into two photos the user never asked for, and
7
+ * coalescing hides a deliberate second capture behind an accidental one — so a
8
+ * fast, explicit `captureInProgress` error is the only option that lets the app
9
+ * decide (clarification session 2026-07-26).
10
+ */
11
+ import { type CameraPosition, type CapabilityProfile, type CapturedImage, type CaptureRequest, type FlashMode, type Maybe, type SessionStatus } from '../config/types.js';
12
+ import type { CameraEngine } from '../native/cameraEngine.js';
13
+ export declare const DEFAULT_QUALITY = 0.9;
14
+ export declare function clampQuality(quality: number | undefined): number;
15
+ export declare function clampMaxDimension(maxDimension: number | undefined): Maybe<number>;
16
+ export interface CaptureContext {
17
+ readonly engine: CameraEngine;
18
+ readonly sessionStatus: SessionStatus;
19
+ readonly permissionGranted: boolean;
20
+ readonly capabilities: CapabilityProfile | null;
21
+ readonly cameraPosition: CameraPosition;
22
+ readonly flashMode: FlashMode;
23
+ }
24
+ /**
25
+ * Validates a capture request against permission, readiness, and capability.
26
+ * Throws before any artifact could be created, so a rejected capture never
27
+ * leaves a file behind (FR-020).
28
+ */
29
+ export declare function assertCaptureAllowed(context: CaptureContext, request: CaptureRequest): void;
30
+ /**
31
+ * Normalizes whatever the engine returned into the published contract, filling
32
+ * in effective hint values and marking undeterminable fields explicitly
33
+ * unavailable rather than guessing them (FR-022, FR-023).
34
+ */
35
+ export declare function finalizeResult(raw: CapturedImage, request: CaptureRequest, context: CaptureContext): CapturedImage;
36
+ /**
37
+ * Serializes captures. The slot is taken synchronously, before the operation
38
+ * runs, so two calls in the same tick cannot both pass the check — and the
39
+ * operation's own first `emit()` already sees `busy`. Holding the operation's
40
+ * promise instead set the slot only after that first emit, so `capturing: true`
41
+ * was never published at all.
42
+ */
43
+ export declare class SingleFlight {
44
+ private active;
45
+ get busy(): boolean;
46
+ run(operation: () => Promise<CapturedImage>): Promise<CapturedImage>;
47
+ }
48
+ //# sourceMappingURL=captureController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"captureController.d.ts","sourceRoot":"","sources":["../../../../src/core/captureController.ts"],"names":[],"mappings":"AAAA;;;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that drives it.
3
+ *
4
+ * The contract lives apart from the orchestration in `controller.ts`: it is
5
+ * what a consumer reads, and what a test double has to satisfy, while the file
6
+ * next to it is how this package happens to satisfy it.
7
+ */
8
+ import type { CameraPermissionState, CameraState, CapabilityProfile, CapturedImage, CaptureRequest, FlashMode, StartOptions } from '../config/types.js';
9
+ import type { CameraError } from '../diagnostics/errors.js';
10
+ import type { CameraLogger } from '../diagnostics/logger.js';
11
+ import type { CameraEngine } from '../native/cameraEngine.js';
12
+ import type { SurfaceInfo, VisionSurface } from '../native/visionSurface.js';
13
+ import type { PermissionPort } from '../permissions/permissionPort.js';
14
+ import type { ArtifactStore } from '../storage/artifactStore.js';
15
+ export declare const DEFAULT_TEMPORARY_TTL_MS: number;
16
+ export type AppStatus = 'active' | 'background';
17
+ export interface CameraControllerOptions {
18
+ /** Required. Use the default adapters, or `createTestCamera()` in tests. */
19
+ readonly engine: CameraEngine;
20
+ readonly permissions: PermissionPort;
21
+ readonly store?: ArtifactStore | undefined;
22
+ readonly logger?: CameraLogger | undefined;
23
+ readonly temporaryTtlMs?: number;
24
+ /**
25
+ * App foreground/background source. Defaults to rn-core's shared `appLifecycle()`,
26
+ * where `inactive` counts as background. Injectable so lifecycle rules are
27
+ * testable without an app (FR-015).
28
+ */
29
+ readonly subscribeToAppState?: (listener: (status: AppStatus) => void) => () => void;
30
+ /**
31
+ * Set false to skip the sweep that runs when the controller is first used
32
+ * (tests). Defaults to true.
33
+ */
34
+ readonly sweepOnInit?: boolean;
35
+ /**
36
+ * How long to wait for a preview surface to report frames before failing the
37
+ * start (FR-014). Only applies to an engine whose session belongs to the
38
+ * surface (`awaitsSurfaceStart`). Defaults to 8 s.
39
+ */
40
+ readonly startTimeoutMs?: number;
41
+ /** Test seam for that timeout. */
42
+ readonly scheduler?: {
43
+ setTimeout(callback: () => void, ms: number): unknown;
44
+ clearTimeout(handle: unknown): void;
45
+ };
46
+ }
47
+ export interface CameraController {
48
+ readonly state: CameraState;
49
+ subscribe(listener: (state: CameraState) => void): () => void;
50
+ getPermission(): Promise<CameraPermissionState>;
51
+ requestPermission(): Promise<CameraPermissionState>;
52
+ start(options?: StartOptions): Promise<void>;
53
+ pause(): Promise<void>;
54
+ resume(): Promise<void>;
55
+ stop(): Promise<void>;
56
+ capture(request?: CaptureRequest): Promise<CapturedImage>;
57
+ cleanup(image: CapturedImage | string): Promise<void>;
58
+ getCapabilities(): Promise<CapabilityProfile>;
59
+ setFlashMode(mode: FlashMode): void;
60
+ setTorch(enabled: boolean): Promise<void>;
61
+ /** Marks the preview surface mounted, enabling foreground auto-restart. */
62
+ setSurfaceMounted(mounted: boolean): void;
63
+ /**
64
+ * Attaches the mounted preview surface to the engine, for an engine that
65
+ * captures through it. Returns the detach function; a no-op for engines that
66
+ * own their own session.
67
+ */
68
+ attachSurface(surface: VisionSurface): () => void;
69
+ /**
70
+ * The preview reported frames: the session is active for real, not merely
71
+ * requested (CAM-08). What the surface turned out to be — the format's pixel
72
+ * size, the orientation, the device's own position — is published as
73
+ * `state.surface` for coordinate mapping.
74
+ */
75
+ reportSurfaceStarted(info: SurfaceInfo): void;
76
+ /** The preview's own session failed, or the OS took the camera away. */
77
+ reportSurfaceFailed(code: CameraError['code']): void;
78
+ /**
79
+ * Called by `CameraPreview` when the native preview surface cannot load (the
80
+ * VisionCamera module is missing or unlinked). Fails the session with
81
+ * `cameraUnavailable` rather than leaving a black preview and no error.
82
+ */
83
+ reportSurfaceUnavailable(): void;
84
+ /**
85
+ * Releases ports, listeners, and the camera. Safe to call twice. Afterwards
86
+ * `start`, `resume`, `capture` and the permission and capability reads reject
87
+ * with `notReady`; `stop`, `pause` and `cleanup` stay safe no-ops so teardown
88
+ * code never has to check.
89
+ */
90
+ dispose(): Promise<void>;
91
+ }
92
+ //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/core/contract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OA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MAAM,CAAC,GAAG,IAAI,CAAC;IACrD;;;;OAIG;IACH,wBAAwB,IAAI,IAAI,CAAC;IACjC;;;;;OAKG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Camera controller — the object consuming apps actually drive.
3
+ *
4
+ * It owns observable state and orchestrates the three ports (engine,
5
+ * permissions, artifact store). All I/O lives here; the decisions live in
6
+ * `sessionMachine` and `captureController`, which stay pure so they can be
7
+ * tested without a camera.
8
+ */
9
+ import { type CameraController, type CameraControllerOptions } from './contract.js';
10
+ /** 24 hours (FR-029). */
11
+ export { DEFAULT_TEMPORARY_TTL_MS, type AppStatus, type CameraController, type CameraControllerOptions, } from './contract.js';
12
+ /** 8 s: a cold camera on a slow device, with room to spare (PERF-001 is 1.5 s). */
13
+ export declare const DEFAULT_START_TIMEOUT_MS = 8000;
14
+ export declare function createCameraController(options: CameraControllerOptions): CameraController;
15
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../../src/core/controller.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiBH,OAAO,EAGN,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,MAAM,eAAY,CAAC;AAYpB,yBAAyB;AACzB,OAAO,EACN,wBAAwB,EACxB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,GAC5B,MAAM,eAAY,CAAC;AAQpB,mFAAmF;AACnF,eAAO,MAAM,wBAAwB,OAAQ,CAAC;AAE9C,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,gBAAgB,CA2ZzF"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Session lifecycle state machine (FR-014..FR-019).
3
+ *
4
+ * Pure and synchronous: it decides what a transition means, the controller
5
+ * performs the I/O. That split is what makes every lifecycle rule in
6
+ * `data-model.md` section 2 testable without a camera.
7
+ *
8
+ * Backgrounding STOPS rather than pauses. Both operating systems can reclaim
9
+ * the camera anyway, and holding it risks leaving the OS camera indicator lit
10
+ * after the app is no longer in front of the user (FR-015).
11
+ */
12
+ import type { SessionStatus } from '../config/types.js';
13
+ import { CameraError, type CameraErrorCode } from '../diagnostics/errors.js';
14
+ export type SessionEvent = {
15
+ readonly type: 'START';
16
+ } | {
17
+ readonly type: 'STARTED';
18
+ } | {
19
+ readonly type: 'PAUSE';
20
+ } | {
21
+ readonly type: 'RESUME';
22
+ } | {
23
+ readonly type: 'STOP';
24
+ } | {
25
+ readonly type: 'STOPPED';
26
+ } | {
27
+ readonly type: 'BACKGROUND';
28
+ } | {
29
+ readonly type: 'FOREGROUND';
30
+ readonly surfaceMounted: boolean;
31
+ } | {
32
+ readonly type: 'FAIL';
33
+ readonly code: CameraErrorCode;
34
+ } | {
35
+ readonly type: 'START_TIMEOUT';
36
+ };
37
+ export interface SessionSnapshot {
38
+ readonly status: SessionStatus;
39
+ readonly error: CameraError | null;
40
+ }
41
+ export declare const initialSession: SessionSnapshot;
42
+ export declare function canStart(status: SessionStatus): boolean;
43
+ /** Capture is only ever legal from a fully active session (FR-020). */
44
+ export declare function canCapture(status: SessionStatus): boolean;
45
+ export declare function sessionReducer(snapshot: SessionSnapshot, event: SessionEvent): SessionSnapshot;
46
+ //# sourceMappingURL=sessionMachine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionMachine.d.ts","sourceRoot":"","sources":["../../../../src/core/sessionMachine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAiB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,0BAAuB,CAAC;AAE1E,MAAM,MAAM,YAAY,GACrB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;CAAE,GAC/B;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAA;CAAE,GACjE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;CAAE,GACzD;IAAE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC;AAEtC,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;CACnC;AAED,eAAO,MAAM,cAAc,EAAE,eAAiD,CAAC;AAK/E,wBAAgB,QAAQ,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAEvD;AAED,uEAAuE;AACvE,wBAAgB,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAEzD;AAMD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,eAAe,EAAE,KAAK,EAAE,YAAY,GAAG,eAAe,CAqD9F"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * The session's own I/O: starting it, waiting for frames, releasing it, and
3
+ * following the app in and out of the foreground.
4
+ *
5
+ * Split out of `controller.ts`, which had grown to hold three jobs at once:
6
+ * publishing state, running the session, and serving the public API. The
7
+ * decisions still live in `sessionMachine` (pure); this is the part that
8
+ * actually awaits the engine, and the controller composes it.
9
+ *
10
+ * It reads and writes the controller's state through `SessionContext` rather
11
+ * than owning it: one snapshot reaches subscribers, whichever part of the
12
+ * controller changed it.
13
+ */
14
+ import type { StartOptions } from '../config/types.js';
15
+ import { type CameraErrorCode } from '../diagnostics/errors.js';
16
+ import type { CameraLogger } from '../diagnostics/logger.js';
17
+ import type { CameraEngine } from '../native/cameraEngine.js';
18
+ import type { SurfaceInfo } from '../native/visionSurface.js';
19
+ import type { SessionEvent, SessionSnapshot } from './sessionMachine.js';
20
+ /** What the runtime needs from the controller that owns the state. */
21
+ export interface SessionContext {
22
+ readonly engine: CameraEngine;
23
+ readonly logger: CameraLogger;
24
+ /** How long to wait for a preview surface to report frames. */
25
+ readonly startTimeoutMs: number;
26
+ readonly scheduler: {
27
+ setTimeout(callback: () => void, ms: number): unknown;
28
+ clearTimeout(handle: unknown): void;
29
+ };
30
+ session(): SessionSnapshot;
31
+ dispatch(event: SessionEvent): void;
32
+ emit(): void;
33
+ cameraPosition(): 'front' | 'back';
34
+ setCameraPosition(position: 'front' | 'back'): void;
35
+ torchEnabled(): boolean;
36
+ setTorchEnabled(enabled: boolean): void;
37
+ surfaceMounted(): boolean;
38
+ permissionGranted(): boolean;
39
+ disposed(): boolean;
40
+ }
41
+ export interface SessionRuntime {
42
+ /** Starts the engine and, where the surface owns the session, waits for frames. */
43
+ start(options?: StartOptions): Promise<void>;
44
+ /** Turns the torch off and releases the camera. Safe from any state. */
45
+ release(): Promise<void>;
46
+ /** Torch off, whatever the session is doing. */
47
+ forceTorchOff(): Promise<void>;
48
+ /** The app went to the background or came back. */
49
+ onAppState(status: 'active' | 'background'): void;
50
+ /** The preview reported frames; carries what the mounted device turned out to be. */
51
+ reportSurfaceStarted(info: SurfaceInfo): void;
52
+ /** The preview's own session failed, or the OS took the camera. */
53
+ reportSurfaceFailed(code: CameraErrorCode): void;
54
+ /** The engine lost the camera: another app, a call, a disconnected device. */
55
+ onInterruption(code: CameraErrorCode): void;
56
+ /** What the surface last reported, for the published state. */
57
+ surfaceInfo(): SurfaceInfo | null;
58
+ /** Set when the app foregrounds with a surface mounted, so the session restarts. */
59
+ armResumeOnForeground(): void;
60
+ /** A release still in flight, so a restart can wait for it. */
61
+ pending(): Promise<void> | undefined;
62
+ }
63
+ export declare function createSessionRuntime(context: SessionContext): SessionRuntime;
64
+ //# sourceMappingURL=sessionRuntime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionRuntime.d.ts","sourceRoot":"","sources":["../../../../src/core/sessionRuntime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAiB,CAAC;AACpD,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,0BAAuB,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAkB,CAAC;AAEtE,sEAAsE;AACtE,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,+DAA+D;IAC/D,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE;QACnB,UAAU,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;QACtD,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;KACpC,CAAC;IACF,OAAO,IAAI,eAAe,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACpC,IAAI,IAAI,IAAI,CAAC;IACb,cAAc,IAAI,OAAO,GAAG,MAAM,CAAC;IACnC,iBAAiB,CAAC,QAAQ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