gps-plus-slam-app-framework 1.0.0 → 1.0.7

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 (216) hide show
  1. package/LICENSE +4 -4
  2. package/README.md +249 -108
  3. package/dist/accuracy-circles-CsxE_7x1.d.ts +43 -0
  4. package/dist/{app-selectors-DyMzxCEC.d.ts → app-selectors-BeU0_ab8.d.ts} +14 -15
  5. package/dist/ar/camera-blit-capture.d.ts +1 -1
  6. package/dist/ar/capture-failure-tracker.d.ts +1 -1
  7. package/dist/ar/chromium-camera-access-workaround.d.ts +1 -1
  8. package/dist/ar/depth-sampler.d.ts +2 -2
  9. package/dist/ar/depth-sampler.js +1 -1
  10. package/dist/ar/frame-loop.d.ts +2 -0
  11. package/dist/ar/frame-loop.js +40 -0
  12. package/dist/ar/image-capture.d.ts +1 -1
  13. package/dist/ar/image-capture.js +1 -1
  14. package/dist/ar/index.d.ts +12 -12
  15. package/dist/ar/index.js +3 -3
  16. package/dist/ar/replay-scene.d.ts +1 -1
  17. package/dist/ar/scene-node-names.d.ts +1 -1
  18. package/dist/ar/webxr-session.d.ts +4 -4
  19. package/dist/ar/webxr-session.js +151 -56
  20. package/dist/ar/xr-camera-texture.d.ts +1 -1
  21. package/dist/ar/xr-error-handler.d.ts +1 -1
  22. package/dist/core/index.d.ts +2 -0
  23. package/dist/core/index.js +2 -0
  24. package/dist/create-slam-app-store-CNsZ3rcX.d.ts +371 -0
  25. package/dist/{depth-sampler-BNCtnEoP.d.ts → depth-sampler-xg8vna6c.d.ts} +1 -1
  26. package/dist/file-system-DTApEv_Q.d.ts +114 -0
  27. package/dist/frame-loop-QJIxLin0.d.ts +42 -0
  28. package/dist/frustum-visibility-BHnFrSKQ.d.ts +58 -0
  29. package/dist/{fused-path-DtqCSqJh.d.ts → fused-path-CB4DwWOG.d.ts} +1 -1
  30. package/dist/geo/h3-proximity.d.ts +2 -0
  31. package/dist/{ref-points/h3-ref-point.js → geo/h3-proximity.js} +16 -12
  32. package/dist/geo/index.d.ts +2 -0
  33. package/dist/geo/index.js +2 -0
  34. package/dist/{geo-types-Xx-LVcnw.d.ts → geo-types-CTuF23gG.d.ts} +16 -1
  35. package/dist/{gps-Ddzr2KlX.d.ts → gps-DXoQb9Kf.d.ts} +1 -1
  36. package/dist/gps-anchor-CnWY61XK.d.ts +48 -0
  37. package/dist/gps-anchor-DjC_3MoT.js +257 -0
  38. package/dist/gps-ar-pose-sampler-DsM1Kb2N.d.ts +43 -0
  39. package/dist/{recording-coordinator-DzflP07_.d.ts → gps-event-coordinator-DBx9I1YX.d.ts} +7 -6
  40. package/dist/gps-event-markers-BGr-iLvi.d.ts +103 -0
  41. package/dist/{h3-ref-point-CFhayNSZ.d.ts → h3-proximity-BhfgNbdW.d.ts} +16 -12
  42. package/dist/{image-capture-2pKjYUS6.d.ts → image-capture-DZLxHDN9.d.ts} +1 -1
  43. package/dist/index-gzWJMVpo.d.ts +2 -0
  44. package/dist/index-pOjUCKEP.d.ts +24 -0
  45. package/dist/index.d.ts +59 -56
  46. package/dist/index.js +22 -21
  47. package/dist/{leaflet-map-overlay-CvfQXTye.d.ts → leaflet-map-overlay-Cew7XAoO.d.ts} +32 -17
  48. package/dist/licensing/index.d.ts +1 -1
  49. package/dist/licensing/index.js +1 -1
  50. package/dist/{logger-B81iwxx0.d.ts → logger-C9vugiQb.d.ts} +7 -1
  51. package/dist/map-data-sih4g64v.d.ts +49 -0
  52. package/dist/map-overlay-draw-B3R1c9Xp.d.ts +42 -0
  53. package/dist/{null-storage-backend-CsWvQwN8.d.ts → null-storage-backend-BKOS7JpL.d.ts} +4 -2
  54. package/dist/{opfs-storage-ChOzF_Wp.d.ts → opfs-storage-DOPkzgeT.d.ts} +54 -51
  55. package/dist/opfs-storage-backend-Cj_7PWoq.d.ts +13 -0
  56. package/dist/{permission-checker-jO2ziCWC.d.ts → permission-checker-DPJl_RU6.d.ts} +41 -1
  57. package/dist/persistence-middleware-BkHIqvaA.d.ts +55 -0
  58. package/dist/{recording-replayer-oOzPITrd.d.ts → recording-replayer-CmCIIZ02.d.ts} +2 -2
  59. package/dist/recording-slice-d6OtCrza.d.ts +28 -0
  60. package/dist/{replay-engine-DuX316ae.d.ts → replay-engine-BGBRQyXs.d.ts} +4 -1
  61. package/dist/{replay-scene-DtUm6bsr.d.ts → replay-scene-DpAGcAKY.d.ts} +3 -3
  62. package/dist/sensors/gps-error-handler.d.ts +1 -1
  63. package/dist/sensors/gps.d.ts +1 -1
  64. package/dist/sensors/gps.js +2 -2
  65. package/dist/sensors/index.d.ts +3 -3
  66. package/dist/sensors/index.js +1 -1
  67. package/dist/sensors/permission-checker.d.ts +2 -2
  68. package/dist/sensors/permission-checker.js +79 -1
  69. package/dist/state/app-selectors.d.ts +2 -2
  70. package/dist/state/app-selectors.js +33 -3
  71. package/dist/state/combined-root-state.d.ts +2 -0
  72. package/dist/state/combined-root-state.js +1 -0
  73. package/dist/state/create-slam-app-store.d.ts +2 -0
  74. package/dist/state/create-slam-app-store.js +75 -0
  75. package/dist/state/gps-ar-pose-sampler.d.ts +4 -0
  76. package/dist/state/gps-ar-pose-sampler.js +19 -0
  77. package/dist/state/{recording-coordinator.d.ts → gps-event-coordinator.d.ts} +1 -1
  78. package/dist/state/{recording-coordinator.js → gps-event-coordinator.js} +3 -4
  79. package/dist/state/index.d.ts +17 -17
  80. package/dist/state/index.js +10 -8
  81. package/dist/state/persistence-middleware.d.ts +2 -2
  82. package/dist/state/persistence-middleware.js +39 -11
  83. package/dist/state/recording-options.d.ts +1 -1
  84. package/dist/state/recording-replayer.d.ts +3 -2
  85. package/dist/state/recording-replayer.js +2 -2
  86. package/dist/state/recording-slice.d.ts +2 -0
  87. package/dist/state/{recorder-slice.js → recording-slice.js} +7 -15
  88. package/dist/state/replay-engine.d.ts +1 -1
  89. package/dist/state/replay-engine.js +3 -3
  90. package/dist/state/store-subscribers.d.ts +2 -2
  91. package/dist/state/store-subscribers.js +38 -20
  92. package/dist/state/subscribe-to-selector.d.ts +1 -1
  93. package/dist/state/tracking-quality.d.ts +2 -0
  94. package/dist/state/tracking-quality.js +723 -0
  95. package/dist/state/tracking-slice.d.ts +2 -0
  96. package/dist/state/tracking-slice.js +147 -0
  97. package/dist/storage/file-system-utils.d.ts +1 -1
  98. package/dist/storage/file-system.d.ts +2 -2
  99. package/dist/storage/file-system.js +154 -94
  100. package/dist/storage/index.d.ts +9 -11
  101. package/dist/storage/index.js +5 -7
  102. package/dist/storage/null-storage-backend.d.ts +1 -1
  103. package/dist/storage/null-storage-backend.js +7 -0
  104. package/dist/storage/opfs-storage-backend.d.ts +1 -1
  105. package/dist/storage/opfs-storage-backend.js +7 -1
  106. package/dist/storage/opfs-storage.d.ts +2 -2
  107. package/dist/storage/opfs-storage.js +69 -85
  108. package/dist/storage/storage-backend.d.ts +2 -2
  109. package/dist/storage/zip-export.d.ts +2 -2
  110. package/dist/storage/zip-export.js +55 -62
  111. package/dist/storage/zip-reader.d.ts +2 -2
  112. package/dist/storage/zip-reader.js +32 -5
  113. package/dist/storage-backend-CT0Il_AB.d.ts +28 -0
  114. package/dist/{store-subscribers-CuoIzB5T.d.ts → store-subscribers-Dce_CoJF.d.ts} +31 -7
  115. package/dist/{subscribe-to-selector-UTZ0KkAc.d.ts → subscribe-to-selector-DIHm3BRZ.d.ts} +1 -1
  116. package/dist/test-utils/browser-mocks.d.ts +1 -1
  117. package/dist/test-utils/zip-round-trip-helpers.d.ts +7 -1
  118. package/dist/test-utils/zip-round-trip-helpers.js +6 -5
  119. package/dist/tracking-slice-utCNND8t.d.ts +86 -0
  120. package/dist/types/ar-types.d.ts +1 -1
  121. package/dist/types/geo-types.d.ts +2 -2
  122. package/dist/types/index.d.ts +3 -3
  123. package/dist/utils/concurrency.d.ts +1 -1
  124. package/dist/utils/failure-tracker.d.ts +1 -1
  125. package/dist/utils/format-file-size.d.ts +1 -1
  126. package/dist/utils/fused-path.d.ts +1 -1
  127. package/dist/utils/index.d.ts +6 -6
  128. package/dist/utils/list-formatter.d.ts +1 -1
  129. package/dist/utils/logger.d.ts +1 -1
  130. package/dist/utils/logger.js +68 -8
  131. package/dist/visualization/accuracy-circles.d.ts +2 -0
  132. package/dist/visualization/accuracy-circles.js +57 -0
  133. package/dist/visualization/alignment-lerper.d.ts +1 -1
  134. package/dist/visualization/camera-follower.d.ts +1 -1
  135. package/dist/visualization/css3d-renderer-manager.d.ts +1 -1
  136. package/dist/visualization/frustum-visibility.d.ts +2 -0
  137. package/dist/visualization/frustum-visibility.js +139 -0
  138. package/dist/visualization/gps-anchor.d.ts +2 -0
  139. package/dist/visualization/gps-anchor.js +2 -0
  140. package/dist/visualization/gps-compass-cubes.d.ts +1 -1
  141. package/dist/visualization/gps-event-markers.d.ts +2 -2
  142. package/dist/visualization/gps-event-markers.js +69 -2
  143. package/dist/visualization/index.d.ts +17 -12
  144. package/dist/visualization/index.js +6 -2
  145. package/dist/visualization/leaflet-map-overlay.d.ts +1 -1
  146. package/dist/visualization/leaflet-map-overlay.js +56 -98
  147. package/dist/visualization/lerp-utils.d.ts +1 -1
  148. package/dist/visualization/map-data.d.ts +2 -0
  149. package/dist/visualization/map-data.js +33 -0
  150. package/dist/visualization/map-overlay-draw.d.ts +2 -0
  151. package/dist/visualization/map-overlay-draw.js +107 -0
  152. package/dist/visualization/map-overlay.d.ts +1 -1
  153. package/dist/visualization/three-dispose.d.ts +1 -1
  154. package/dist/visualization/vis-colors.d.ts +1 -1
  155. package/dist/{webxr-session-COlSrXdL.d.ts → webxr-session-DB5cIZnN.d.ts} +53 -12
  156. package/dist/{zip-export-Rtpi75JJ.d.ts → zip-export-QO4iLIi7.d.ts} +58 -7
  157. package/dist/{zip-reader-D7pkpX8K.d.ts → zip-reader-D1105idz.d.ts} +38 -1
  158. package/package.json +29 -18
  159. package/dist/ar/tracking-state.d.ts +0 -2
  160. package/dist/ar/tracking-state.js +0 -164
  161. package/dist/community-license-key-ChZLCJyO.d.ts +0 -21
  162. package/dist/file-system-BsQgYCU3.d.ts +0 -128
  163. package/dist/gps-event-markers-DpEy2qRd.d.ts +0 -67
  164. package/dist/licensing/community-license-key.d.ts +0 -2
  165. package/dist/licensing/community-license-key.js +0 -21
  166. package/dist/opfs-storage-backend-CVcmfJHN.d.ts +0 -11
  167. package/dist/persistence-middleware-DrptY02i.d.ts +0 -31
  168. package/dist/recorder-slice-fcwAXrsh.d.ts +0 -35
  169. package/dist/ref-point-importer-B_wn5ABk.d.ts +0 -62
  170. package/dist/ref-point-loader-Pt1smgHS.d.ts +0 -117
  171. package/dist/ref-points/h3-ref-point.d.ts +0 -2
  172. package/dist/ref-points/index.d.ts +0 -2
  173. package/dist/ref-points/index.js +0 -2
  174. package/dist/ref-points-slice-tC-Wd6XJ.d.ts +0 -48
  175. package/dist/reference-points-CFWy8_wj.d.ts +0 -68
  176. package/dist/routing-slice-BlHTM8eh.d.ts +0 -23
  177. package/dist/state/recorder-slice.d.ts +0 -2
  178. package/dist/state/ref-points-slice.d.ts +0 -2
  179. package/dist/state/ref-points-slice.js +0 -44
  180. package/dist/state/routing-slice.d.ts +0 -2
  181. package/dist/state/routing-slice.js +0 -13
  182. package/dist/state/store.d.ts +0 -9
  183. package/dist/state/store.js +0 -71
  184. package/dist/storage/ref-point-importer.d.ts +0 -2
  185. package/dist/storage/ref-point-importer.js +0 -163
  186. package/dist/storage/ref-point-loader.d.ts +0 -2
  187. package/dist/storage/ref-point-loader.js +0 -248
  188. package/dist/storage/ref-point-recovery.d.ts +0 -28
  189. package/dist/storage/ref-point-recovery.js +0 -159
  190. package/dist/storage-backend-BcEItnFr.d.ts +0 -20
  191. package/dist/store-C7PKOj8S.d.ts +0 -96
  192. package/dist/tracking-state-B9QfuZCg.d.ts +0 -101
  193. package/dist/visualization/reference-points.d.ts +0 -2
  194. package/dist/visualization/reference-points.js +0 -160
  195. /package/dist/{alignment-lerper-D9BeDwZX.d.ts → alignment-lerper-L1RbWHQ4.d.ts} +0 -0
  196. /package/dist/{ar-types-B-ORgk6Z.d.ts → ar-types-Ck8LEq8k.d.ts} +0 -0
  197. /package/dist/{camera-blit-capture-DHuyrrxr.d.ts → camera-blit-capture-C1V9I1Z6.d.ts} +0 -0
  198. /package/dist/{camera-follower-BMqPddxx.d.ts → camera-follower-1k8mnw5J.d.ts} +0 -0
  199. /package/dist/{capture-failure-tracker-2Q6oI2uQ.d.ts → capture-failure-tracker-JKb1ST8E.d.ts} +0 -0
  200. /package/dist/{chromium-camera-access-workaround-CU5zSKNr.d.ts → chromium-camera-access-workaround-NvChXsi8.d.ts} +0 -0
  201. /package/dist/{concurrency-p6gB30fT.d.ts → concurrency-CMw8pSaG.d.ts} +0 -0
  202. /package/dist/{css3d-renderer-manager-rgLMVAvd.d.ts → css3d-renderer-manager-CkjCb2HW.d.ts} +0 -0
  203. /package/dist/{failure-tracker-1sQ_Cgyw.d.ts → failure-tracker-DnHXOIRa.d.ts} +0 -0
  204. /package/dist/{file-system-utils-5cWO8Xyv.d.ts → file-system-utils-CtKiiw27.d.ts} +0 -0
  205. /package/dist/{format-file-size-onGq0k1Q.d.ts → format-file-size-BTS5H62-.d.ts} +0 -0
  206. /package/dist/{gps-compass-cubes-C-6JEnpR.d.ts → gps-compass-cubes-CsLtFv4B.d.ts} +0 -0
  207. /package/dist/{gps-error-handler-VPuNOuf8.d.ts → gps-error-handler-Dg3ziRVY.d.ts} +0 -0
  208. /package/dist/{lerp-utils-87NWjUOD.d.ts → lerp-utils-B8MM8zCR.d.ts} +0 -0
  209. /package/dist/{list-formatter-DKQQVLcl.d.ts → list-formatter-CNqi-E2j.d.ts} +0 -0
  210. /package/dist/{map-overlay-DuiZuCTx.d.ts → map-overlay-DAmreyA3.d.ts} +0 -0
  211. /package/dist/{recording-options-BYUFX8iU.d.ts → recording-options-Dq6IsKAv.d.ts} +0 -0
  212. /package/dist/{scene-node-names-DPsaE2z3.d.ts → scene-node-names-6LBjPmwz.d.ts} +0 -0
  213. /package/dist/{three-dispose-CCBHjE_a.d.ts → three-dispose-C2drkp6f.d.ts} +0 -0
  214. /package/dist/{vis-colors-Qi2vlRGt.d.ts → vis-colors-CHQhjal3.d.ts} +0 -0
  215. /package/dist/{xr-camera-texture-BbukNE79.d.ts → xr-camera-texture-BU5YvKAM.d.ts} +0 -0
  216. /package/dist/{xr-error-handler-DTHfmvrl.d.ts → xr-error-handler-CDY5QxGb.d.ts} +0 -0
@@ -0,0 +1,2 @@
1
+ import { a as TrackingSliceState, c as poseLost, d as selectLastRestartedPayload, f as selectLastSensorOrientation, g as trackingReducer, h as selectTrackingPhase, i as TrackingPhase, l as poseReceived, m as selectLostFrameCount, n as PoseReceivedPayload, o as clearLastRestartedPayload, p as selectLastValidPose, r as ResetTransformData, s as originReset, t as DeviceOrientation, u as resetTracking } from "../tracking-slice-utCNND8t.js";
2
+ export { DeviceOrientation, PoseReceivedPayload, ResetTransformData, TrackingPhase, TrackingSliceState, clearLastRestartedPayload, originReset, poseLost, poseReceived, resetTracking, selectLastRestartedPayload, selectLastSensorOrientation, selectLastValidPose, selectLostFrameCount, selectTrackingPhase, trackingReducer };
@@ -0,0 +1,147 @@
1
+ import { createSlice } from "@reduxjs/toolkit";
2
+ //#region ../src/state/tracking-slice.ts
3
+ const initialState = {
4
+ phase: "initializing",
5
+ lastValidPose: null,
6
+ lastSensorOrientation: null,
7
+ lostFrameCount: 0,
8
+ originResetDuringLoss: false,
9
+ resetTransform: void 0,
10
+ lastRestartedPayload: null
11
+ };
12
+ const trackingSlice = createSlice({
13
+ name: "tracking",
14
+ initialState,
15
+ reducers: {
16
+ /**
17
+ * A valid AR pose was received this frame. Drives INITIALIZING|LOST →
18
+ * TRACKING transitions; on LOST → TRACKING with `originResetDuringLoss`
19
+ * also populates `lastRestartedPayload` (Case 2 of the manager doc).
20
+ */
21
+ poseReceived(state, action) {
22
+ const { pose, sensorOrientation } = action.payload;
23
+ if (state.phase === "lost") {
24
+ const hadReset = state.originResetDuringLoss;
25
+ const savedResetTransform = state.resetTransform;
26
+ state.originResetDuringLoss = false;
27
+ state.resetTransform = void 0;
28
+ if (hadReset && state.lastValidPose !== null) {
29
+ const lastOrientation = state.lastSensorOrientation ?? sensorOrientation;
30
+ state.lastRestartedPayload = {
31
+ lastValidOdomPos: [
32
+ state.lastValidPose.position.x,
33
+ state.lastValidPose.position.y,
34
+ state.lastValidPose.position.z
35
+ ],
36
+ lastValidOdomRot: [
37
+ state.lastValidPose.orientation.x,
38
+ state.lastValidPose.orientation.y,
39
+ state.lastValidPose.orientation.z,
40
+ state.lastValidPose.orientation.w
41
+ ],
42
+ lastSensorOrientation: {
43
+ alpha: lastOrientation.alpha,
44
+ beta: lastOrientation.beta,
45
+ gamma: lastOrientation.gamma,
46
+ absolute: lastOrientation.absolute
47
+ },
48
+ newOdomRot: [
49
+ pose.orientation.x,
50
+ pose.orientation.y,
51
+ pose.orientation.z,
52
+ pose.orientation.w
53
+ ],
54
+ newSensorOrientation: {
55
+ alpha: sensorOrientation.alpha,
56
+ beta: sensorOrientation.beta,
57
+ gamma: sensorOrientation.gamma,
58
+ absolute: sensorOrientation.absolute
59
+ },
60
+ newOdomPos: [
61
+ pose.position.x,
62
+ pose.position.y,
63
+ pose.position.z
64
+ ],
65
+ resetTransform: savedResetTransform
66
+ };
67
+ }
68
+ }
69
+ state.phase = "tracking";
70
+ state.lastValidPose = pose;
71
+ state.lastSensorOrientation = sensorOrientation;
72
+ state.lostFrameCount = 0;
73
+ },
74
+ /**
75
+ * Pose was unavailable this frame. TRACKING → LOST on the first call;
76
+ * subsequent calls only bump `lostFrameCount`.
77
+ */
78
+ poseLost(state) {
79
+ state.lostFrameCount += 1;
80
+ if (state.phase === "tracking") state.phase = "lost";
81
+ },
82
+ /**
83
+ * `XRReferenceSpace` reset event fired. Only meaningful while LOST.
84
+ * The payload distinguishes three cases:
85
+ * - `ResetTransformData` — runtime supplied the transform.
86
+ * - `null` — runtime could not determine the delta.
87
+ * - `undefined` (action with no payload) — backwards compat for
88
+ * callers without an event reference.
89
+ */
90
+ originReset: {
91
+ reducer(state, action) {
92
+ if (state.phase !== "lost") return state;
93
+ return {
94
+ ...state,
95
+ originResetDuringLoss: true,
96
+ resetTransform: action.payload
97
+ };
98
+ },
99
+ prepare(transform) {
100
+ return { payload: transform };
101
+ }
102
+ },
103
+ /**
104
+ * Drops the manager back to its initial state. Host calls on new XR
105
+ * session start.
106
+ */
107
+ resetTracking() {
108
+ return initialState;
109
+ },
110
+ /**
111
+ * Host calls this after firing its `onTrackingRestarted` callback with
112
+ * the contents of `selectLastRestartedPayload`. Failure to call it would
113
+ * leave a stale payload; the test matrix locks this in.
114
+ */
115
+ clearLastRestartedPayload(state) {
116
+ state.lastRestartedPayload = null;
117
+ }
118
+ }
119
+ });
120
+ const { poseReceived, poseLost, originReset, resetTracking, clearLastRestartedPayload } = trackingSlice.actions;
121
+ const trackingReducer = trackingSlice.reducer;
122
+ function selectTrackingPhase(state) {
123
+ return state.tracking.phase;
124
+ }
125
+ function selectLastValidPose(state) {
126
+ return state.tracking.lastValidPose;
127
+ }
128
+ function selectLostFrameCount(state) {
129
+ return state.tracking.lostFrameCount;
130
+ }
131
+ function selectLastRestartedPayload(state) {
132
+ return state.tracking.lastRestartedPayload;
133
+ }
134
+ /**
135
+ * Selector for the last `DeviceOrientation` captured alongside a valid
136
+ * AR pose. Used by the §4.3 compass / alignment heading cross-check in
137
+ * the tracking-quality reporter (see
138
+ * docs/2026-05-16-tracking-quality-metrics-plan.md).
139
+ *
140
+ * Returns `null` before any pose has been received and after
141
+ * `resetTracking` clears the slice.
142
+ */
143
+ function selectLastSensorOrientation(state) {
144
+ return state.tracking.lastSensorOrientation;
145
+ }
146
+ //#endregion
147
+ export { clearLastRestartedPayload, originReset, poseLost, poseReceived, resetTracking, selectLastRestartedPayload, selectLastSensorOrientation, selectLastValidPose, selectLostFrameCount, selectTrackingPhase, trackingReducer };
@@ -1,2 +1,2 @@
1
- import { n as formatFrameFilename, r as formatTimestamp, t as formatActionFilename } from "../file-system-utils-5cWO8Xyv.js";
1
+ import { n as formatFrameFilename, r as formatTimestamp, t as formatActionFilename } from "../file-system-utils-CtKiiw27.js";
2
2
  export { formatActionFilename, formatFrameFilename, formatTimestamp };
@@ -1,2 +1,2 @@
1
- import { a as initStorage, c as resetForNewSession, d as startSession, f as verifyWriteAccess, h as writeSessionMetadata, i as getCurrentScenarioHandle, l as resetStorageState, m as writeFrame, n as WriteAccessResult, o as isRefPointAction, p as writeAction, r as ensureScenarioDirectory, s as loadScenarioRefPoints, t as RefPointRecord, u as setCurrentScenario } from "../file-system-BsQgYCU3.js";
2
- export { RefPointRecord, WriteAccessResult, ensureScenarioDirectory, getCurrentScenarioHandle, initStorage, isRefPointAction, loadScenarioRefPoints, resetForNewSession, resetStorageState, setCurrentScenario, startSession, verifyWriteAccess, writeAction, writeFrame, writeSessionMetadata };
1
+ import { a as getCurrentScenarioHandle, c as resetForNewSession, d as startSession, f as verifyWriteAccess, h as writeSessionMetadata, i as ensureScenarioDirectory, l as resetStorageState, m as writeFrame, n as WriteAccessResult, o as initStorage, p as writeAction, r as clearRefPointsCacheForAllScenarios, s as listSessions, t as ClearRefPointsCacheResult, u as setCurrentScenario } from "../file-system-DTApEv_Q.js";
2
+ export { ClearRefPointsCacheResult, WriteAccessResult, clearRefPointsCacheForAllScenarios, ensureScenarioDirectory, getCurrentScenarioHandle, initStorage, listSessions, resetForNewSession, resetStorageState, setCurrentScenario, startSession, verifyWriteAccess, writeAction, writeFrame, writeSessionMetadata };
@@ -1,15 +1,34 @@
1
1
  import { createLogger } from "../utils/logger.js";
2
2
  import { setFileSystemState } from "../sensors/permission-checker.js";
3
- import { createSession, getScenarioHandle, getScenariosRootHandle, initOpfsStorage, listScenarios, resetOpfsStorage, resetSessionHandles, writeAction as writeAction$1, writeFrame as writeFrame$1, writeSessionMetadata as writeSessionMetadata$1 } from "./opfs-storage.js";
3
+ import { formatTimestamp } from "./file-system-utils.js";
4
+ import { createSession, getAppRootHandle, initOpfsStorage, listSessions as listSessions$1, resetOpfsStorage, resetSessionHandles, setSessionHandles, writeAction as writeAction$1, writeFrame as writeFrame$1, writeSessionMetadata as writeSessionMetadata$1 } from "./opfs-storage.js";
4
5
  //#region ../src/storage/file-system.ts
6
+ /**
7
+ * File System Storage Module
8
+ *
9
+ * Facade over the OPFS storage module. Provides session lifecycle, write
10
+ * operations, and backwards-compatible scenario management for the recorder.
11
+ *
12
+ * The core OPFS module (opfs-storage.ts) is scenario-free — it manages
13
+ * flat sessions/{timestamp}/ directories. This module bridges the gap by
14
+ * managing scenario directory handles for consumers that still need them
15
+ * (recorder, ref-point loader, etc.) until those are migrated to
16
+ * ScenarioWrappingStorageBackend in later iterations.
17
+ */
5
18
  const log = createLogger("Storage");
19
+ let _currentScenarioName = null;
6
20
  let storageInitialized = false;
21
+ let scenariosDir = null;
22
+ let currentScenarioHandle = null;
7
23
  /**
8
24
  * Reset module state - exported for testing only
9
25
  * @internal
10
26
  */
11
27
  function resetStorageState() {
28
+ _currentScenarioName = null;
12
29
  storageInitialized = false;
30
+ scenariosDir = null;
31
+ currentScenarioHandle = null;
13
32
  resetOpfsStorage();
14
33
  }
15
34
  /**
@@ -18,25 +37,14 @@ function resetStorageState() {
18
37
  * Clears scenario/session names and OPFS session handles, but preserves
19
38
  * `storageInitialized` and the OPFS root so `initStorage()` doesn't need
20
39
  * to be called again.
21
- *
22
- * Used during soft reset for new recordings (Issue 4, 2026-02-06 user feedback).
23
40
  */
24
41
  function resetForNewSession() {
42
+ _currentScenarioName = null;
43
+ currentScenarioHandle = null;
25
44
  resetSessionHandles();
26
45
  }
27
46
  /**
28
47
  * Verify that we have actual write access to a directory.
29
- *
30
- * This probes the directory by creating a test file, writing content,
31
- * and cleaning up. This catches cases where showDirectoryPicker grants
32
- * a handle but the underlying file system is read-only.
33
- *
34
- * User Feedback Issue #1: Even with mode: 'readwrite', Android can
35
- * return a handle where getFileHandle({create: true}) succeeds but
36
- * createWritable() fails with NoModificationAllowedError.
37
- *
38
- * @param dirHandle - Directory handle to verify
39
- * @returns Success status and optional error message
40
48
  */
41
49
  async function verifyWriteAccess(dirHandle) {
42
50
  const testFilename = `.write-test-${Date.now()}`;
@@ -64,12 +72,27 @@ async function verifyWriteAccess(dirHandle) {
64
72
  };
65
73
  }
66
74
  }
75
+ async function ensureScenariosDir() {
76
+ if (scenariosDir) return scenariosDir;
77
+ const appRoot = getAppRootHandle();
78
+ if (!appRoot) return null;
79
+ scenariosDir = await appRoot.getDirectoryHandle("scenarios", { create: true });
80
+ return scenariosDir;
81
+ }
82
+ /**
83
+ * List all scenario names in OPFS storage.
84
+ * Legacy: scenarios are managed by the recorder, not the framework.
85
+ */
86
+ async function listScenarios() {
87
+ const dir = await ensureScenariosDir();
88
+ if (!dir) return [];
89
+ const scenarios = [];
90
+ for await (const entry of dir.values()) if (entry.kind === "directory") scenarios.push(entry.name);
91
+ return scenarios;
92
+ }
67
93
  /**
68
94
  * Initialize storage using OPFS.
69
95
  *
70
- * This replaces the old showDirectoryPicker approach which failed on Android Chrome.
71
- * OPFS is automatically available and doesn't require user folder selection.
72
- *
73
96
  * @returns List of existing scenario folder names
74
97
  * @throws Error if OPFS is not supported
75
98
  */
@@ -81,6 +104,7 @@ async function initStorage() {
81
104
  folderSelected: true,
82
105
  writeVerified: true
83
106
  });
107
+ await ensureScenariosDir();
84
108
  const scenarios = await listScenarios();
85
109
  log.info("OPFS storage initialized, found scenarios:", scenarios);
86
110
  return scenarios;
@@ -96,24 +120,61 @@ async function initStorage() {
96
120
  }
97
121
  }
98
122
  /**
99
- * Create or open a scenario folder, then create a new session folder.
123
+ * Create a new session folder.
100
124
  *
101
- * Now uses OPFS backend instead of showDirectoryPicker.
125
+ * When scenarioName is provided, creates under the scenario directory
126
+ * (legacy scenario layout for the recorder). When omitted, creates under
127
+ * the flat sessions/ directory.
102
128
  *
103
- * @param scenarioName - Name of the scenario
129
+ * @param scenarioName - Optional name of the scenario (omit for flat layout)
104
130
  */
105
131
  async function startSession(scenarioName) {
106
132
  if (!storageInitialized) throw new Error("Storage not initialized. Call initStorage first.");
107
- const result = await createSession(scenarioName, /* @__PURE__ */ new Date());
108
- result.scenarioName;
133
+ if (scenarioName) {
134
+ const dir = await ensureScenariosDir();
135
+ if (!dir) throw new Error("Failed to access scenarios directory.");
136
+ const scenarioHandle = await dir.getDirectoryHandle(scenarioName, { create: true });
137
+ currentScenarioHandle = scenarioHandle;
138
+ const sessionName = `recording-${formatTimestamp(/* @__PURE__ */ new Date())}`;
139
+ const sessionHandle = await scenarioHandle.getDirectoryHandle(sessionName, { create: true });
140
+ setSessionHandles(sessionHandle, await sessionHandle.getDirectoryHandle("actions", { create: true }), await sessionHandle.getDirectoryHandle("frames", { create: true }));
141
+ _currentScenarioName = scenarioName;
142
+ log.info("Session started:", `${scenarioName}/${sessionName}`);
143
+ return {
144
+ scenarioPath: scenarioName,
145
+ sessionPath: sessionName
146
+ };
147
+ }
148
+ const result = await createSession(/* @__PURE__ */ new Date());
149
+ _currentScenarioName = "";
109
150
  result.sessionName;
110
- log.info("Session started:", `${result.scenarioName}/${result.sessionName}`);
151
+ log.info("Session started:", result.sessionName);
111
152
  return {
112
- scenarioPath: result.scenarioName,
153
+ scenarioPath: "",
113
154
  sessionPath: result.sessionName
114
155
  };
115
156
  }
116
157
  /**
158
+ * List all session names.
159
+ * When scenarioName is provided, lists sessions under that scenario.
160
+ * Otherwise lists flat sessions.
161
+ */
162
+ async function listSessions(scenarioName) {
163
+ if (scenarioName) {
164
+ const dir = await ensureScenariosDir();
165
+ if (!dir) return [];
166
+ try {
167
+ const scenarioHandle = await dir.getDirectoryHandle(scenarioName);
168
+ const sessions = [];
169
+ for await (const entry of scenarioHandle.values()) if (entry.kind === "directory") sessions.push(entry.name);
170
+ return sessions;
171
+ } catch {
172
+ return [];
173
+ }
174
+ }
175
+ return listSessions$1();
176
+ }
177
+ /**
117
178
  * Write a Redux action to OPFS as a JSON file.
118
179
  */
119
180
  async function writeAction(action, index) {
@@ -127,82 +188,30 @@ async function writeFrame(blob, index) {
127
188
  }
128
189
  /**
129
190
  * Write session metadata (session.json) to OPFS.
130
- * Contains timing, counts, and user agent for the recording session.
131
191
  */
132
192
  async function writeSessionMetadata(metadata) {
133
193
  await writeSessionMetadata$1(metadata);
134
194
  }
135
195
  /**
136
- * Type guard for reference point actions
137
- * Exported for testing
138
- */
139
- function isRefPointAction(action) {
140
- if (typeof action !== "object" || action === null) return false;
141
- const obj = action;
142
- const payload = obj.payload;
143
- return obj.type === "recorder/markRefPoint" && typeof payload === "object" && payload !== null && !Array.isArray(payload);
144
- }
145
- /**
146
- * Parse action files from a session's actions directory
147
- */
148
- async function parseSessionRefPoints(actionsDir, sessionName) {
149
- const refPoints = [];
150
- for await (const actionEntry of actionsDir.values()) {
151
- if (actionEntry.kind !== "file" || !actionEntry.name.endsWith(".json")) continue;
152
- const text = await (await (await actionsDir.getFileHandle(actionEntry.name)).getFile()).text();
153
- try {
154
- const action = JSON.parse(text);
155
- if (isRefPointAction(action)) refPoints.push({
156
- id: action.payload.id,
157
- sessionName,
158
- gpsPosition: action.payload.gpsPosition,
159
- arPose: action.payload.arPose
160
- });
161
- } catch {}
162
- }
163
- return refPoints;
164
- }
165
- /**
166
- * Load existing reference points from a scenario (across all sessions).
167
- * Now uses OPFS storage backend.
168
- */
169
- async function loadScenarioRefPoints(scenarioName) {
170
- const scenariosRoot = getScenariosRootHandle();
171
- if (!scenariosRoot) return [];
172
- const refPoints = [];
173
- try {
174
- const scenarioHandle = await scenariosRoot.getDirectoryHandle(scenarioName);
175
- for await (const sessionEntry of scenarioHandle.values()) {
176
- if (sessionEntry.kind !== "directory") continue;
177
- const sessionHandle = await scenarioHandle.getDirectoryHandle(sessionEntry.name);
178
- let actionsDir;
179
- try {
180
- actionsDir = await sessionHandle.getDirectoryHandle("actions");
181
- } catch {
182
- continue;
183
- }
184
- const sessionRefPoints = await parseSessionRefPoints(actionsDir, sessionEntry.name);
185
- refPoints.push(...sessionRefPoints);
186
- }
187
- } catch {}
188
- return refPoints;
189
- }
190
- /**
191
196
  * Get the current scenario handle (for loading prior sessions).
192
- * Now delegates to OPFS storage backend.
197
+ * Legacy: uses scenario directory layout.
193
198
  */
194
199
  function getCurrentScenarioHandle() {
195
- return getScenarioHandle();
200
+ if (!_currentScenarioName) return null;
201
+ return currentScenarioHandle;
196
202
  }
197
203
  /**
198
204
  * Set the current scenario handle (when user selects a scenario).
199
- * With OPFS, we just store the name - the actual handle is retrieved when needed.
205
+ * Legacy: uses scenario directory layout.
200
206
  */
201
207
  async function setCurrentScenario(scenarioName) {
202
- const scenariosRoot = getScenariosRootHandle();
203
- if (!scenariosRoot) return null;
208
+ const scenRoot = await ensureScenariosDir();
209
+ if (!scenRoot) return null;
204
210
  try {
205
- return await scenariosRoot.getDirectoryHandle(scenarioName);
211
+ const handle = await scenRoot.getDirectoryHandle(scenarioName);
212
+ _currentScenarioName = scenarioName;
213
+ currentScenarioHandle = handle;
214
+ return handle;
206
215
  } catch {
207
216
  log.warn("Scenario not found:", scenarioName);
208
217
  return null;
@@ -210,20 +219,71 @@ async function setCurrentScenario(scenarioName) {
210
219
  }
211
220
  /**
212
221
  * Ensure a scenario directory exists in OPFS, creating it if necessary.
213
- * Used during OPFS recovery when the scenario directory was lost but ZIP
214
- * data is available for restoration.
215
- *
216
- * Unlike setCurrentScenario() which only reads, this creates on demand.
222
+ * Legacy: used during OPFS recovery.
217
223
  */
218
224
  async function ensureScenarioDirectory(scenarioName) {
219
- const scenariosRoot = getScenariosRootHandle();
220
- if (!scenariosRoot) return null;
225
+ const scenRoot = await ensureScenariosDir();
226
+ if (!scenRoot) return null;
221
227
  try {
222
- return await scenariosRoot.getDirectoryHandle(scenarioName, { create: true });
228
+ const handle = await scenRoot.getDirectoryHandle(scenarioName, { create: true });
229
+ _currentScenarioName = scenarioName;
230
+ currentScenarioHandle = handle;
231
+ return handle;
223
232
  } catch (err) {
224
233
  log.error("Failed to create scenario directory:", err);
225
234
  return null;
226
235
  }
227
236
  }
237
+ /**
238
+ * Clear the cached `refPoints/` directory for every scenario in OPFS.
239
+ *
240
+ * Used by the "Clear Reference Point Cache" maintenance action so that the
241
+ * next scenario load re-imports ref points from the read folder's `*.zip`
242
+ * recordings (see ref-point-recovery in the recorder app).
243
+ *
244
+ * Failures for individual scenarios are collected in `errors` rather than
245
+ * aborting the whole operation — partial progress is still useful.
246
+ *
247
+ * @throws Error if OPFS storage is unavailable (e.g. `initStorage()` not yet
248
+ * called, or browser does not support OPFS). Surfacing this loudly avoids
249
+ * reporting a silent "0 scenarios cleared" success that would mask the
250
+ * real failure to the user.
251
+ */
252
+ async function clearRefPointsCacheForAllScenarios() {
253
+ const dir = await ensureScenariosDir();
254
+ if (!dir) throw new Error("clearRefPointsCacheForAllScenarios: OPFS scenarios directory is unavailable — call initStorage() first or check OPFS support");
255
+ const errors = [];
256
+ let scenariosCleared = 0;
257
+ let scenariosScanned = 0;
258
+ const scenarios = await listScenarios();
259
+ for (const scenarioName of scenarios) {
260
+ scenariosScanned++;
261
+ try {
262
+ const handle = await dir.getDirectoryHandle(scenarioName);
263
+ if (!handle) continue;
264
+ try {
265
+ await handle.removeEntry("refPoints", { recursive: true });
266
+ scenariosCleared++;
267
+ } catch (err) {
268
+ if ((err instanceof Error ? err.name : String(err?.name)) === "NotFoundError") continue;
269
+ errors.push({
270
+ scenarioName,
271
+ reason: err instanceof Error ? err.message : String(err)
272
+ });
273
+ }
274
+ } catch (err) {
275
+ errors.push({
276
+ scenarioName,
277
+ reason: err instanceof Error ? err.message : String(err)
278
+ });
279
+ }
280
+ }
281
+ log.info(`Cleared ref-point cache for ${scenariosCleared}/${scenariosScanned} scenarios (${errors.length} errors)`);
282
+ return {
283
+ scenariosCleared,
284
+ scenariosScanned,
285
+ errors
286
+ };
287
+ }
228
288
  //#endregion
229
- export { ensureScenarioDirectory, getCurrentScenarioHandle, initStorage, isRefPointAction, loadScenarioRefPoints, resetForNewSession, resetStorageState, setCurrentScenario, startSession, verifyWriteAccess, writeAction, writeFrame, writeSessionMetadata };
289
+ export { clearRefPointsCacheForAllScenarios, ensureScenarioDirectory, getCurrentScenarioHandle, initStorage, listSessions, resetForNewSession, resetStorageState, setCurrentScenario, startSession, verifyWriteAccess, writeAction, writeFrame, writeSessionMetadata };
@@ -1,11 +1,9 @@
1
- import { a as getScenarioHandle, c as initOpfsStorage, d as resetOpfsStorage, f as resetSessionHandles, h as writeSessionMetadata$1, i as createSession, n as SessionMetadata, o as getScenariosRootHandle, r as checkStorageQuota, s as getSessionHandle, t as CreateSessionResult, u as listSessions } from "../opfs-storage-ChOzF_Wp.js";
2
- import { t as StorageBackend } from "../storage-backend-BcEItnFr.js";
3
- import { n as RefPointImportResult, r as importRefPointsFromFolder, t as ImportedRefPoint } from "../ref-point-importer-B_wn5ABk.js";
4
- import { a as flattenRefPointsToMarks, c as loadRefPoint, i as averageGpsPerRefPoint, l as saveRefPointObservation, n as RefPointMark, o as listRefPointIds, r as RefPointObservation, s as loadAllRefPoints, t as RefPointDefinition } from "../ref-point-loader-Pt1smgHS.js";
5
- import { a as ZipActionEntry, c as loadSessionMetadata, i as RecordedAction, l as loadSessionMetadataFromBlob, n as GpsPathCoord, o as loadActionsFromZip, r as MAX_ACTION_FILE_SIZE, s as loadGpsPathFromBlob, t as Entry, u as readZipEntries } from "../zip-reader-D7pkpX8K.js";
6
- import { t as NullStorageBackend } from "../null-storage-backend-CsWvQwN8.js";
7
- import { t as OpfsStorageBackend } from "../opfs-storage-backend-CVcmfJHN.js";
8
- import { a as initStorage, c as resetForNewSession, d as startSession, f as verifyWriteAccess, h as writeSessionMetadata, i as getCurrentScenarioHandle, l as resetStorageState, m as writeFrame, n as WriteAccessResult, o as isRefPointAction, p as writeAction, s as loadScenarioRefPoints, u as setCurrentScenario } from "../file-system-BsQgYCU3.js";
9
- import { n as formatFrameFilename, r as formatTimestamp, t as formatActionFilename } from "../file-system-utils-5cWO8Xyv.js";
10
- import { a as syncToExternalZip, i as exportSessionAsZip, n as downloadZip, r as exportAndDownloadSession, t as ZipExportResult } from "../zip-export-Rtpi75JJ.js";
11
- export { type CreateSessionResult, type Entry, type GpsPathCoord, type ImportedRefPoint, MAX_ACTION_FILE_SIZE, NullStorageBackend, OpfsStorageBackend, type RecordedAction, type RefPointDefinition, type RefPointImportResult, type RefPointMark, type RefPointObservation, type SessionMetadata, type StorageBackend, type WriteAccessResult, type ZipActionEntry, type ZipExportResult, averageGpsPerRefPoint, checkStorageQuota, createSession, downloadZip, exportAndDownloadSession, exportSessionAsZip, flattenRefPointsToMarks, formatActionFilename, formatFrameFilename, formatTimestamp, getCurrentScenarioHandle, getScenarioHandle, getScenariosRootHandle, getSessionHandle, importRefPointsFromFolder, initOpfsStorage, initStorage, isRefPointAction, listRefPointIds, listSessions, loadActionsFromZip, loadAllRefPoints, loadGpsPathFromBlob, loadRefPoint, loadScenarioRefPoints, loadSessionMetadataFromBlob, loadSessionMetadata as loadSessionMetadataFromZip, readZipEntries, resetForNewSession, resetOpfsStorage, resetSessionHandles, resetStorageState, saveRefPointObservation, setCurrentScenario, startSession as startStorageSession, syncToExternalZip, verifyWriteAccess, writeAction, writeFrame, writeSessionMetadata as writeSessionMeta, writeSessionMetadata$1 as writeSessionMetadata };
1
+ import { a as getAppRootHandle, c as initOpfsStorage, d as resetSessionHandles, h as writeSessionMetadata$1, i as createSession, l as listSessions, n as SessionMetadata, o as getSessionHandle, r as checkStorageQuota, s as getSessionsRootHandle, u as resetOpfsStorage } from "../opfs-storage-DOPkzgeT.js";
2
+ import { n as StorageBackend, t as CreateSessionResult } from "../storage-backend-CT0Il_AB.js";
3
+ import { a as ZipActionEntry, c as loadEntriesFromSubdir, d as loadSessionMetadataFromBlob, f as readZipEntries, i as RecordedAction, l as loadGpsPathFromBlob, n as GpsPathCoord, o as ZipSubdirEntry, r as MAX_ACTION_FILE_SIZE, s as loadActionsFromZip, t as Entry, u as loadSessionMetadata } from "../zip-reader-D1105idz.js";
4
+ import { t as NullStorageBackend } from "../null-storage-backend-BKOS7JpL.js";
5
+ import { t as OpfsStorageBackend } from "../opfs-storage-backend-Cj_7PWoq.js";
6
+ import { a as getCurrentScenarioHandle, c as resetForNewSession, d as startSession, f as verifyWriteAccess, h as writeSessionMetadata, i as ensureScenarioDirectory, l as resetStorageState, m as writeFrame, n as WriteAccessResult, o as initStorage, p as writeAction, s as listSessions$1, u as setCurrentScenario } from "../file-system-DTApEv_Q.js";
7
+ import { n as formatFrameFilename, r as formatTimestamp, t as formatActionFilename } from "../file-system-utils-CtKiiw27.js";
8
+ import { a as downloadZip, c as syncToExternalZip, i as ZipExportResult, n as ZipContributorAddFile, o as exportAndDownloadSession, r as ZipExportContributor, s as exportSessionAsZip, t as ExportSessionAsZipOptions } from "../zip-export-QO4iLIi7.js";
9
+ export { type CreateSessionResult, type Entry, type ExportSessionAsZipOptions, type GpsPathCoord, MAX_ACTION_FILE_SIZE, NullStorageBackend, OpfsStorageBackend, type RecordedAction, type SessionMetadata, type StorageBackend, type WriteAccessResult, type ZipActionEntry, type ZipContributorAddFile, type ZipExportContributor, type ZipExportResult, type ZipSubdirEntry, checkStorageQuota, createSession, downloadZip, ensureScenarioDirectory, exportAndDownloadSession, exportSessionAsZip, formatActionFilename, formatFrameFilename, formatTimestamp, getAppRootHandle, getCurrentScenarioHandle, getSessionHandle, getSessionsRootHandle, initOpfsStorage, initStorage, listSessions, listSessions$1 as listSessionsFromFileSystem, loadActionsFromZip, loadEntriesFromSubdir, loadGpsPathFromBlob, loadSessionMetadataFromBlob, loadSessionMetadata as loadSessionMetadataFromZip, readZipEntries, resetForNewSession, resetOpfsStorage, resetSessionHandles, resetStorageState, setCurrentScenario, startSession as startStorageSession, syncToExternalZip, verifyWriteAccess, writeAction, writeFrame, writeSessionMetadata as writeSessionMeta, writeSessionMetadata$1 as writeSessionMetadata };
@@ -1,10 +1,8 @@
1
+ import { MAX_ACTION_FILE_SIZE, loadActionsFromZip, loadEntriesFromSubdir, loadGpsPathFromBlob, loadSessionMetadata, loadSessionMetadataFromBlob, readZipEntries } from "./zip-reader.js";
1
2
  import { formatActionFilename, formatFrameFilename, formatTimestamp } from "./file-system-utils.js";
2
- import { checkStorageQuota, createSession, getScenarioHandle, getScenariosRootHandle, getSessionHandle, initOpfsStorage, listSessions, resetOpfsStorage, resetSessionHandles, writeSessionMetadata as writeSessionMetadata$1 } from "./opfs-storage.js";
3
- import { getCurrentScenarioHandle, initStorage, isRefPointAction, loadScenarioRefPoints, resetForNewSession, resetStorageState, setCurrentScenario, startSession, verifyWriteAccess, writeAction, writeFrame, writeSessionMetadata } from "./file-system.js";
4
- import { OpfsStorageBackend } from "./opfs-storage-backend.js";
5
- import { MAX_ACTION_FILE_SIZE, loadActionsFromZip, loadGpsPathFromBlob, loadSessionMetadata, loadSessionMetadataFromBlob, readZipEntries } from "./zip-reader.js";
6
3
  import { NullStorageBackend } from "./null-storage-backend.js";
7
- import { importRefPointsFromFolder } from "./ref-point-importer.js";
8
- import { averageGpsPerRefPoint, flattenRefPointsToMarks, listRefPointIds, loadAllRefPoints, loadRefPoint, saveRefPointObservation } from "./ref-point-loader.js";
4
+ import { checkStorageQuota, createSession, getAppRootHandle, getSessionHandle, getSessionsRootHandle, initOpfsStorage, listSessions, resetOpfsStorage, resetSessionHandles, writeSessionMetadata as writeSessionMetadata$1 } from "./opfs-storage.js";
5
+ import { ensureScenarioDirectory, getCurrentScenarioHandle, initStorage, listSessions as listSessions$1, resetForNewSession, resetStorageState, setCurrentScenario, startSession, verifyWriteAccess, writeAction, writeFrame, writeSessionMetadata } from "./file-system.js";
6
+ import { OpfsStorageBackend } from "./opfs-storage-backend.js";
9
7
  import { downloadZip, exportAndDownloadSession, exportSessionAsZip, syncToExternalZip } from "./zip-export.js";
10
- export { MAX_ACTION_FILE_SIZE, NullStorageBackend, OpfsStorageBackend, averageGpsPerRefPoint, checkStorageQuota, createSession, downloadZip, exportAndDownloadSession, exportSessionAsZip, flattenRefPointsToMarks, formatActionFilename, formatFrameFilename, formatTimestamp, getCurrentScenarioHandle, getScenarioHandle, getScenariosRootHandle, getSessionHandle, importRefPointsFromFolder, initOpfsStorage, initStorage, isRefPointAction, listRefPointIds, listSessions, loadActionsFromZip, loadAllRefPoints, loadGpsPathFromBlob, loadRefPoint, loadScenarioRefPoints, loadSessionMetadataFromBlob, loadSessionMetadata as loadSessionMetadataFromZip, readZipEntries, resetForNewSession, resetOpfsStorage, resetSessionHandles, resetStorageState, saveRefPointObservation, setCurrentScenario, startSession as startStorageSession, syncToExternalZip, verifyWriteAccess, writeAction, writeFrame, writeSessionMetadata as writeSessionMeta, writeSessionMetadata$1 as writeSessionMetadata };
8
+ export { MAX_ACTION_FILE_SIZE, NullStorageBackend, OpfsStorageBackend, checkStorageQuota, createSession, downloadZip, ensureScenarioDirectory, exportAndDownloadSession, exportSessionAsZip, formatActionFilename, formatFrameFilename, formatTimestamp, getAppRootHandle, getCurrentScenarioHandle, getSessionHandle, getSessionsRootHandle, initOpfsStorage, initStorage, listSessions, listSessions$1 as listSessionsFromFileSystem, loadActionsFromZip, loadEntriesFromSubdir, loadGpsPathFromBlob, loadSessionMetadataFromBlob, loadSessionMetadata as loadSessionMetadataFromZip, readZipEntries, resetForNewSession, resetOpfsStorage, resetSessionHandles, resetStorageState, setCurrentScenario, startSession as startStorageSession, syncToExternalZip, verifyWriteAccess, writeAction, writeFrame, writeSessionMetadata as writeSessionMeta, writeSessionMetadata$1 as writeSessionMetadata };
@@ -1,2 +1,2 @@
1
- import { t as NullStorageBackend } from "../null-storage-backend-CsWvQwN8.js";
1
+ import { t as NullStorageBackend } from "../null-storage-backend-BKOS7JpL.js";
2
2
  export { NullStorageBackend };
@@ -1,5 +1,12 @@
1
+ import { formatTimestamp } from "./file-system-utils.js";
1
2
  //#region ../src/storage/null-storage-backend.ts
2
3
  var NullStorageBackend = class {
4
+ createSession(timestamp, _contextTag) {
5
+ return Promise.resolve({ sessionName: `recording-${formatTimestamp(timestamp)}` });
6
+ }
7
+ listSessions() {
8
+ return Promise.resolve([]);
9
+ }
3
10
  async writeAction(_action, _index) {}
4
11
  async writeFrame(_blob, _index) {}
5
12
  async writeSessionMetadata(_metadata) {}
@@ -1,2 +1,2 @@
1
- import { t as OpfsStorageBackend } from "../opfs-storage-backend-CVcmfJHN.js";
1
+ import { t as OpfsStorageBackend } from "../opfs-storage-backend-Cj_7PWoq.js";
2
2
  export { OpfsStorageBackend };
@@ -1,6 +1,12 @@
1
- import { writeAction, writeFrame, writeSessionMetadata } from "./file-system.js";
1
+ import { listSessions, startSession, writeAction, writeFrame, writeSessionMetadata } from "./file-system.js";
2
2
  //#region ../src/storage/opfs-storage-backend.ts
3
3
  var OpfsStorageBackend = class {
4
+ async createSession(_timestamp, _contextTag) {
5
+ return { sessionName: (await startSession()).sessionPath };
6
+ }
7
+ async listSessions() {
8
+ return listSessions();
9
+ }
4
10
  async writeAction(action, index) {
5
11
  await writeAction(action, index);
6
12
  }
@@ -1,2 +1,2 @@
1
- import { a as getScenarioHandle, c as initOpfsStorage, d as resetOpfsStorage, f as resetSessionHandles, h as writeSessionMetadata, i as createSession, l as listScenarios, m as writeFrame, n as SessionMetadata, o as getScenariosRootHandle, p as writeAction, r as checkStorageQuota, s as getSessionHandle, t as CreateSessionResult, u as listSessions } from "../opfs-storage-ChOzF_Wp.js";
2
- export { CreateSessionResult, SessionMetadata, checkStorageQuota, createSession, getScenarioHandle, getScenariosRootHandle, getSessionHandle, initOpfsStorage, listScenarios, listSessions, resetOpfsStorage, resetSessionHandles, writeAction, writeFrame, writeSessionMetadata };
1
+ import { a as getAppRootHandle, c as initOpfsStorage, d as resetSessionHandles, f as setSessionHandles, h as writeSessionMetadata, i as createSession, l as listSessions, m as writeFrame, n as SessionMetadata, o as getSessionHandle, p as writeAction, r as checkStorageQuota, s as getSessionsRootHandle, t as CreateSessionResult, u as resetOpfsStorage } from "../opfs-storage-DOPkzgeT.js";
2
+ export { CreateSessionResult, SessionMetadata, checkStorageQuota, createSession, getAppRootHandle, getSessionHandle, getSessionsRootHandle, initOpfsStorage, listSessions, resetOpfsStorage, resetSessionHandles, setSessionHandles, writeAction, writeFrame, writeSessionMetadata };