@openclaw/matrix 2026.10.2 → 2026.10.5-beta.2

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 (279) hide show
  1. package/dist/.setup/{account-selection-BDeeqwwR.mjs → account-selection-Bs_jCAaG.mjs} +3 -5
  2. package/dist/.setup/{approval-handler.runtime-QkHLH2az.mjs → approval-handler.runtime-rxLn8CbP.mjs} +60 -83
  3. package/dist/.setup/{channel-CeRXEAEP.mjs → channel-BcwGspPw.mjs} +92 -120
  4. package/dist/.setup/{channel.runtime-DBQA2y1F.mjs → channel.runtime-CUc6rbu1.mjs} +23 -18
  5. package/dist/.setup/{channel.setup-DC2t7_PK.mjs → channel.setup-CwuYD_CT.mjs} +2 -3
  6. package/dist/.setup/{cli-Be8tdNw8.mjs → cli-mbL9jCro.mjs} +80 -120
  7. package/dist/.setup/{cli-metadata-CtcjBFhc.mjs → cli-metadata-6MOGuyHq.mjs} +1 -1
  8. package/dist/.setup/{client-DY3HExqI.mjs → client-BlTvpEWC.mjs} +2 -2
  9. package/dist/.setup/{client-bootstrap-CZvJjr29.mjs → client-bootstrap-D05xy1HB.mjs} +2 -3
  10. package/dist/.setup/{client-support-D7BlioUb.mjs → client-support-D-xHScuo.mjs} +1 -1
  11. package/dist/.setup/{client-kmih04ng.mjs → client-vPPbaxNp.mjs} +14 -24
  12. package/dist/.setup/{create-client-CbJVyFDy.mjs → create-client-CroC4BVc.mjs} +4 -4
  13. package/dist/.setup/{credentials-C2dvc_kB.mjs → credentials-Bf9PQ7xs.mjs} +4 -18
  14. package/dist/.setup/{crypto-runtime-B2AjWo-i.mjs → crypto-runtime-CpJ0b7vY.mjs} +80 -123
  15. package/dist/.setup/{deps-CFNl7tQo.mjs → deps-L_1bUAGL.mjs} +20 -37
  16. package/dist/.setup/{direct-management-DJtQhLKH.mjs → direct-management-B3wYhx_M.mjs} +25 -51
  17. package/dist/.setup/{directory-live-DW5UykLL.mjs → directory-live-B1WbfSHo.mjs} +3 -3
  18. package/dist/.setup/{draft-stream-B87DfA6a.mjs → draft-stream-Bdrh7dRt.mjs} +2 -3
  19. package/dist/.setup/{encryption-guidance-BEjKbiMR.mjs → encryption-guidance-D5_IsDIy.mjs} +1 -1
  20. package/dist/.setup/{env-vars-dGqak9dN.mjs → env-vars-aEBngJPa.mjs} +2 -17
  21. package/dist/.setup/{event-helpers-CspuhE9k.mjs → event-helpers-CxNgMQqH.mjs} +5 -7
  22. package/dist/.setup/{exec-approvals-BLDAMyHs.mjs → exec-approvals-BgNWWJg1.mjs} +6 -12
  23. package/dist/.setup/{file-sync-store-Clc9iEdn.mjs → file-sync-store-BdKx_gMi.mjs} +2 -5
  24. package/dist/.setup/{http-client-DfJY5Ck0.mjs → http-client-ByR4STVQ.mjs} +55 -59
  25. package/dist/.setup/{messages-uCbwLRKS.mjs → messages-B1CZqU8u.mjs} +4 -16
  26. package/dist/.setup/{monitor-skIntQVG.mjs → monitor-Dk_fQL1k.mjs} +176 -232
  27. package/dist/.setup/{onboarding-Cm_tOJxs.mjs → onboarding-CrSexor_.mjs} +33 -50
  28. package/dist/.setup/{outbound-CqQou3ny.mjs → outbound-LR3SqPIq.mjs} +2 -2
  29. package/dist/.setup/{profile-update-C1n8SRqH.mjs → profile-update-C7bjaGR6.mjs} +2 -3
  30. package/dist/.setup/{reaction-events-Cqq46xsG.mjs → reaction-events-CTSvOlXO.mjs} +4 -4
  31. package/dist/.setup/{resolve-targets-DFeU1Ww6.mjs → resolve-targets-BVVbbvP6.mjs} +15 -21
  32. package/dist/.setup/{retired-state-BXUQ2I-C.mjs → retired-state-DW5pLH05.mjs} +22 -3
  33. package/dist/.setup/{room-info-BPMbwe8I.mjs → room-info-9Uqlpt1V.mjs} +4 -4
  34. package/dist/.setup/{sdk-CgQGkCsS.mjs → sdk-Cfc6m7fY.mjs} +115 -195
  35. package/dist/.setup/{secret-contract-JlB6VmI3.mjs → secret-contract-DSBRvhdZ.mjs} +1 -1
  36. package/dist/.setup/{secret-contract-api-B-iJoQEv.mjs → secret-contract-api-DzEJ-X7n.mjs} +1 -1
  37. package/dist/.setup/{send-B1Y2L4wj.mjs → send-LCOuTVc1.mjs} +10 -30
  38. package/dist/.setup/{setup-bootstrap-UNIGyKnk.mjs → setup-bootstrap-CV-hHBXu.mjs} +2 -2
  39. package/dist/.setup/setup-core-CKnNTfgD.mjs +673 -0
  40. package/dist/.setup/{setup-plugin-api-BRs9bcp4.mjs → setup-plugin-api-BDAYk1a5.mjs} +1 -1
  41. package/dist/.setup/{startup-verification-D00eUt74.mjs → startup-verification-CgfUb4yJ.mjs} +3 -3
  42. package/dist/.setup/{storage-D7agewjH.mjs → storage-DkC6bHgA.mjs} +24 -49
  43. package/dist/.setup/{subagent-hooks-D5kd_kzN.mjs → subagent-hooks-D8jyeQsO.mjs} +1 -1
  44. package/dist/.setup/{sync-cache-state-C2z64uyk.mjs → sync-cache-state-D4G-fi3t.mjs} +20 -33
  45. package/dist/.setup/{target-ids-Nwx7cMVE.mjs → target-ids-HhcaKX1n.mjs} +15 -1
  46. package/dist/.setup/{thread-binding-api-DRMC62cs.mjs → thread-binding-api-BvuaKpd0.mjs} +1 -1
  47. package/dist/.setup/{thread-bindings-DveHVZqN.mjs → thread-bindings-CT4P-OSZ.mjs} +38 -58
  48. package/dist/.setup/{thread-bindings-shared-hxKkYC1W.mjs → thread-bindings-shared-CbsFNbAY.mjs} +19 -37
  49. package/dist/.setup/{tool-actions-BqlK2ilM.mjs → tool-actions-DAp6_XSJ.mjs} +17 -18
  50. package/dist/.setup/{verification-kMlFYUn0.mjs → verification-B3VswneT.mjs} +15 -21
  51. package/dist/api.js +7 -7
  52. package/dist/channel-plugin-api.js +1 -1
  53. package/dist/cli-metadata.js +1 -1
  54. package/dist/contract-api.js +2 -2
  55. package/dist/doctor-contract-api.js +13 -22
  56. package/dist/helper-api.js +2 -2
  57. package/dist/index.js +1 -1
  58. package/dist/plugin-entry.handlers.runtime.js +2 -2
  59. package/dist/runtime-api.js +4 -4
  60. package/dist/secret-contract-api.js +1 -1
  61. package/dist/session-binding-contract-api.js +1 -1
  62. package/dist/setup-entry.js +2 -2
  63. package/dist/setup-plugin-api.js +1 -1
  64. package/dist/subagent-hooks-api.js +1 -1
  65. package/dist/thread-binding-api.js +1 -1
  66. package/dist/thread-bindings-runtime.js +1 -1
  67. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/package.json +1 -1
  68. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm.d.ts +129 -129
  69. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.cjs +688 -688
  70. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.js +512 -512
  71. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm +0 -0
  72. package/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm.d.ts +84 -84
  73. package/node_modules/@openclaw/fs-safe/CHANGELOG.md +35 -0
  74. package/node_modules/@openclaw/fs-safe/README.md +1 -1
  75. package/node_modules/@openclaw/fs-safe/dist/advanced.d.ts +1 -1
  76. package/node_modules/@openclaw/fs-safe/dist/advanced.js +1 -1
  77. package/node_modules/@openclaw/fs-safe/dist/archive-durability.js +1 -1
  78. package/node_modules/@openclaw/fs-safe/dist/archive-merge.js +4 -4
  79. package/node_modules/@openclaw/fs-safe/dist/archive-parser.wasm +0 -0
  80. package/node_modules/@openclaw/fs-safe/dist/archive-read.js +5 -4
  81. package/node_modules/@openclaw/fs-safe/dist/archive-staging.d.ts +1 -1
  82. package/node_modules/@openclaw/fs-safe/dist/archive-staging.js +22 -38
  83. package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.d.ts +17 -0
  84. package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.js +117 -0
  85. package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.d.ts +8 -5
  86. package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.js +27 -50
  87. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.d.ts +3 -0
  88. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-acquire.js +57 -11
  89. package/node_modules/@openclaw/fs-safe/dist/guarded-mutation.js +5 -5
  90. package/node_modules/@openclaw/fs-safe/dist/guest-native-python.js +52 -5
  91. package/node_modules/@openclaw/fs-safe/dist/guest.js +1 -1
  92. package/node_modules/@openclaw/fs-safe/dist/native-binding.d.ts +1 -0
  93. package/node_modules/@openclaw/fs-safe/dist/native-operations.d.ts +0 -1
  94. package/node_modules/@openclaw/fs-safe/dist/native-operations.js +22 -26
  95. package/node_modules/@openclaw/fs-safe/dist/native-pinned-write-windows.js +5 -1
  96. package/node_modules/@openclaw/fs-safe/dist/native-staged-file.js +4 -1
  97. package/node_modules/@openclaw/fs-safe/dist/permission-exec.js +2 -1
  98. package/node_modules/@openclaw/fs-safe/dist/pinned-write-types.d.ts +6 -1
  99. package/node_modules/@openclaw/fs-safe/dist/private-temp-workspace.js +2 -2
  100. package/node_modules/@openclaw/fs-safe/dist/publish-file.js +34 -7
  101. package/node_modules/@openclaw/fs-safe/dist/replace-file-copy-fallback.js +1 -4
  102. package/node_modules/@openclaw/fs-safe/dist/replace-file-descriptor.js +6 -0
  103. package/node_modules/@openclaw/fs-safe/dist/root-create-input.d.ts +15 -1
  104. package/node_modules/@openclaw/fs-safe/dist/root-create-input.js +4 -0
  105. package/node_modules/@openclaw/fs-safe/dist/root-directory-entry.js +1 -1
  106. package/node_modules/@openclaw/fs-safe/dist/root-directory-list.d.ts +0 -1
  107. package/node_modules/@openclaw/fs-safe/dist/root-directory-list.js +6 -12
  108. package/node_modules/@openclaw/fs-safe/dist/root-impl.js +15 -15
  109. package/node_modules/@openclaw/fs-safe/dist/root-paths.js +1 -1
  110. package/node_modules/@openclaw/fs-safe/dist/root-walk.js +4 -4
  111. package/node_modules/@openclaw/fs-safe/dist/root-write-verification.d.ts +10 -1
  112. package/node_modules/@openclaw/fs-safe/dist/root-write-verification.js +20 -0
  113. package/node_modules/@openclaw/fs-safe/dist/secure-temp-dir.js +19 -7
  114. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-acquire.js +25 -3
  115. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-admission.d.ts +2 -0
  116. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.d.ts +14 -0
  117. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock-retained.js +187 -0
  118. package/node_modules/@openclaw/fs-safe/dist/sidecar-lock.js +15 -1
  119. package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.d.ts +10 -0
  120. package/node_modules/@openclaw/fs-safe/dist/temp-directory-diagnostics.js +29 -0
  121. package/node_modules/@openclaw/fs-safe/dist/temp-target.js +1 -1
  122. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-admission.js +6 -6
  123. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.d.ts +4 -4
  124. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-child-admission.js +17 -16
  125. package/node_modules/@openclaw/fs-safe/dist/temp-workspace-descriptor.js +20 -28
  126. package/node_modules/@openclaw/fs-safe/dist/walk.js +2 -13
  127. package/node_modules/@openclaw/fs-safe/dist/watch-native.d.ts +2 -2
  128. package/node_modules/@openclaw/fs-safe/dist/watch-native.js +3 -1
  129. package/node_modules/@openclaw/fs-safe/dist/watch-rescan.js +3 -9
  130. package/node_modules/@openclaw/fs-safe/dist/watch.js +2 -3
  131. package/node_modules/@openclaw/fs-safe/docs/advanced.md +1 -1
  132. package/node_modules/@openclaw/fs-safe/docs/archive.md +3 -0
  133. package/node_modules/@openclaw/fs-safe/docs/atomic.md +11 -3
  134. package/node_modules/@openclaw/fs-safe/docs/contributing.md +1 -1
  135. package/node_modules/@openclaw/fs-safe/docs/copy.md +48 -0
  136. package/node_modules/@openclaw/fs-safe/docs/guest.md +21 -4
  137. package/node_modules/@openclaw/fs-safe/docs/path-scope.md +4 -0
  138. package/node_modules/@openclaw/fs-safe/docs/sidecar-lock.md +46 -8
  139. package/node_modules/@openclaw/fs-safe/docs/temp.md +12 -0
  140. package/node_modules/@openclaw/fs-safe/docs/watch.md +3 -2
  141. package/node_modules/@openclaw/fs-safe/package.json +15 -15
  142. package/node_modules/@openclaw/fs-safe-darwin-arm64/fs-safe-native.node +0 -0
  143. package/node_modules/@openclaw/fs-safe-darwin-arm64/package.json +1 -1
  144. package/node_modules/@openclaw/fs-safe-darwin-x64/fs-safe-native.node +0 -0
  145. package/node_modules/@openclaw/fs-safe-darwin-x64/package.json +1 -1
  146. package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/fs-safe-native.node +0 -0
  147. package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/package.json +1 -1
  148. package/node_modules/@openclaw/fs-safe-linux-arm64-musl/fs-safe-native.node +0 -0
  149. package/node_modules/@openclaw/fs-safe-linux-arm64-musl/package.json +1 -1
  150. package/node_modules/@openclaw/fs-safe-linux-x64-gnu/fs-safe-native.node +0 -0
  151. package/node_modules/@openclaw/fs-safe-linux-x64-gnu/package.json +1 -1
  152. package/node_modules/@openclaw/fs-safe-linux-x64-musl/fs-safe-native.node +0 -0
  153. package/node_modules/@openclaw/fs-safe-linux-x64-musl/package.json +1 -1
  154. package/node_modules/@openclaw/fs-safe-win32-x64-msvc/fs-safe-native.node +0 -0
  155. package/node_modules/@openclaw/fs-safe-win32-x64-msvc/package.json +1 -1
  156. package/node_modules/matrix-widget-api/lib/interfaces/RtcLivekitActions.d.ts +6 -12
  157. package/node_modules/matrix-widget-api/lib/interfaces/RtcLivekitActions.js.map +1 -1
  158. package/node_modules/matrix-widget-api/package.json +1 -1
  159. package/node_modules/matrix-widget-api/src/interfaces/RtcLivekitActions.ts +6 -13
  160. package/node_modules/music-metadata/README.md +35 -32
  161. package/node_modules/music-metadata/lib/ParserFactory.d.ts +1 -1
  162. package/node_modules/music-metadata/lib/ParserFactory.js +17 -13
  163. package/node_modules/music-metadata/lib/aiff/AiffParser.js +19 -12
  164. package/node_modules/music-metadata/lib/aiff/AiffToken.d.ts +1 -1
  165. package/node_modules/music-metadata/lib/aiff/AiffToken.js +2 -1
  166. package/node_modules/music-metadata/lib/apev2/APEv2Parser.d.ts +4 -3
  167. package/node_modules/music-metadata/lib/apev2/APEv2Parser.js +59 -16
  168. package/node_modules/music-metadata/lib/apev2/APEv2TagMapper.js +1 -0
  169. package/node_modules/music-metadata/lib/apev2/APEv2Token.d.ts +1 -1
  170. package/node_modules/music-metadata/lib/apev2/APEv2Token.js +1 -1
  171. package/node_modules/music-metadata/lib/asf/AsfGuid.js +56 -50
  172. package/node_modules/music-metadata/lib/asf/AsfObject.d.ts +1 -1
  173. package/node_modules/music-metadata/lib/asf/AsfObject.js +3 -2
  174. package/node_modules/music-metadata/lib/asf/AsfParser.js +15 -7
  175. package/node_modules/music-metadata/lib/asf/AsfTagMapper.d.ts +3 -2
  176. package/node_modules/music-metadata/lib/asf/AsfTagMapper.js +21 -4
  177. package/node_modules/music-metadata/lib/common/CaseInsensitiveTagMap.d.ts +1 -1
  178. package/node_modules/music-metadata/lib/common/CombinedTagMapper.d.ts +2 -2
  179. package/node_modules/music-metadata/lib/common/CombinedTagMapper.js +6 -6
  180. package/node_modules/music-metadata/lib/common/FourCC.js +3 -2
  181. package/node_modules/music-metadata/lib/common/GenericTagMapper.d.ts +1 -1
  182. package/node_modules/music-metadata/lib/common/GenericTagTypes.js +1 -1
  183. package/node_modules/music-metadata/lib/common/MetadataCollector.d.ts +3 -1
  184. package/node_modules/music-metadata/lib/common/MetadataCollector.js +28 -9
  185. package/node_modules/music-metadata/lib/common/Util.js +25 -17
  186. package/node_modules/music-metadata/lib/core.d.ts +4 -4
  187. package/node_modules/music-metadata/lib/core.js +18 -11
  188. package/node_modules/music-metadata/lib/dsdiff/DsdiffParser.js +29 -16
  189. package/node_modules/music-metadata/lib/dsf/DsfChunk.d.ts +1 -1
  190. package/node_modules/music-metadata/lib/dsf/DsfParser.js +3 -5
  191. package/node_modules/music-metadata/lib/ebml/EbmlIterator.d.ts +1 -1
  192. package/node_modules/music-metadata/lib/ebml/EbmlIterator.js +35 -6
  193. package/node_modules/music-metadata/lib/ebml/types.d.ts +1 -1
  194. package/node_modules/music-metadata/lib/ebml/types.js +1 -1
  195. package/node_modules/music-metadata/lib/flac/FlacParser.d.ts +1 -1
  196. package/node_modules/music-metadata/lib/flac/FlacParser.js +6 -5
  197. package/node_modules/music-metadata/lib/flac/FlacToken.d.ts +1 -1
  198. package/node_modules/music-metadata/lib/flac/FlacToken.js +1 -1
  199. package/node_modules/music-metadata/lib/id3v1/ID3v1Parser.d.ts +1 -1
  200. package/node_modules/music-metadata/lib/id3v1/ID3v1Parser.js +212 -42
  201. package/node_modules/music-metadata/lib/id3v2/AbstractID3Parser.js +5 -5
  202. package/node_modules/music-metadata/lib/id3v2/FrameHeader.d.ts +1 -1
  203. package/node_modules/music-metadata/lib/id3v2/FrameHeader.js +8 -5
  204. package/node_modules/music-metadata/lib/id3v2/FrameParser.d.ts +2 -1
  205. package/node_modules/music-metadata/lib/id3v2/FrameParser.js +54 -23
  206. package/node_modules/music-metadata/lib/id3v2/ID3v22TagMapper.d.ts +1 -1
  207. package/node_modules/music-metadata/lib/id3v2/ID3v22TagMapper.js +1 -1
  208. package/node_modules/music-metadata/lib/id3v2/ID3v24TagMapper.js +3 -3
  209. package/node_modules/music-metadata/lib/id3v2/ID3v2ChapterToken.js +2 -2
  210. package/node_modules/music-metadata/lib/id3v2/ID3v2Parser.d.ts +1 -1
  211. package/node_modules/music-metadata/lib/id3v2/ID3v2Parser.js +32 -16
  212. package/node_modules/music-metadata/lib/id3v2/ID3v2Token.d.ts +2 -2
  213. package/node_modules/music-metadata/lib/id3v2/ID3v2Token.js +2 -3
  214. package/node_modules/music-metadata/lib/index.js +6 -3
  215. package/node_modules/music-metadata/lib/lrc/LyricsParser.js +3 -5
  216. package/node_modules/music-metadata/lib/matroska/MatroskaDtd.js +7 -3
  217. package/node_modules/music-metadata/lib/matroska/MatroskaParser.js +22 -11
  218. package/node_modules/music-metadata/lib/matroska/types.d.ts +2 -2
  219. package/node_modules/music-metadata/lib/mp4/Atom.d.ts +4 -3
  220. package/node_modules/music-metadata/lib/mp4/Atom.js +44 -11
  221. package/node_modules/music-metadata/lib/mp4/AtomToken.d.ts +1 -1
  222. package/node_modules/music-metadata/lib/mp4/AtomToken.js +30 -8
  223. package/node_modules/music-metadata/lib/mp4/MP4Parser.d.ts +2 -0
  224. package/node_modules/music-metadata/lib/mp4/MP4Parser.js +79 -54
  225. package/node_modules/music-metadata/lib/mp4/MP4TagMapper.d.ts +2 -2
  226. package/node_modules/music-metadata/lib/mpeg/MpegLoader.js +1 -1
  227. package/node_modules/music-metadata/lib/mpeg/MpegParser.js +41 -19
  228. package/node_modules/music-metadata/lib/mpeg/ReplayGainDataFormat.d.ts +2 -2
  229. package/node_modules/music-metadata/lib/mpeg/ReplayGainDataFormat.js +1 -1
  230. package/node_modules/music-metadata/lib/mpeg/XingTag.d.ts +1 -1
  231. package/node_modules/music-metadata/lib/musepack/MusepackParser.js +2 -2
  232. package/node_modules/music-metadata/lib/musepack/sv7/BitReader.js +1 -1
  233. package/node_modules/music-metadata/lib/musepack/sv7/MpcSv7Parser.js +4 -3
  234. package/node_modules/music-metadata/lib/musepack/sv7/StreamVersion7.js +3 -3
  235. package/node_modules/music-metadata/lib/musepack/sv8/MpcSv8Parser.js +7 -5
  236. package/node_modules/music-metadata/lib/musepack/sv8/StreamVersion8.js +2 -2
  237. package/node_modules/music-metadata/lib/ogg/OggParser.js +23 -13
  238. package/node_modules/music-metadata/lib/ogg/OggToken.d.ts +2 -0
  239. package/node_modules/music-metadata/lib/ogg/OggToken.js +1 -1
  240. package/node_modules/music-metadata/lib/ogg/flac/FlacStream.d.ts +2 -2
  241. package/node_modules/music-metadata/lib/ogg/flac/FlacStream.js +2 -2
  242. package/node_modules/music-metadata/lib/ogg/opus/OpusStream.d.ts +2 -2
  243. package/node_modules/music-metadata/lib/ogg/opus/OpusStream.js +8 -4
  244. package/node_modules/music-metadata/lib/ogg/speex/SpeexStream.d.ts +2 -2
  245. package/node_modules/music-metadata/lib/ogg/speex/SpeexStream.js +2 -1
  246. package/node_modules/music-metadata/lib/ogg/theora/TheoraStream.d.ts +2 -2
  247. package/node_modules/music-metadata/lib/ogg/vorbis/Vorbis.d.ts +1 -1
  248. package/node_modules/music-metadata/lib/ogg/vorbis/VorbisDecoder.js +1 -1
  249. package/node_modules/music-metadata/lib/ogg/vorbis/VorbisStream.d.ts +4 -3
  250. package/node_modules/music-metadata/lib/ogg/vorbis/VorbisStream.js +16 -9
  251. package/node_modules/music-metadata/lib/ogg/vorbis/VorbisTagMapper.js +4 -0
  252. package/node_modules/music-metadata/lib/riff/RiffChunk.d.ts +3 -1
  253. package/node_modules/music-metadata/lib/riff/RiffChunk.js +3 -2
  254. package/node_modules/music-metadata/lib/riff/RiffInfoTagMap.d.ts +1 -1
  255. package/node_modules/music-metadata/lib/type.d.ts +3 -3
  256. package/node_modules/music-metadata/lib/type.js +1 -1
  257. package/node_modules/music-metadata/lib/wav/WaveChunk.d.ts +1 -1
  258. package/node_modules/music-metadata/lib/wav/WaveChunk.js +3 -2
  259. package/node_modules/music-metadata/lib/wav/WaveParser.d.ts +6 -2
  260. package/node_modules/music-metadata/lib/wav/WaveParser.js +75 -22
  261. package/node_modules/music-metadata/lib/wavpack/WavPackParser.js +22 -13
  262. package/node_modules/music-metadata/lib/wavpack/WavPackToken.js +3 -2
  263. package/node_modules/music-metadata/package.json +3 -2
  264. package/node_modules/uint8array-extras/index.d.ts +7 -7
  265. package/node_modules/uint8array-extras/index.js +27 -13
  266. package/node_modules/uint8array-extras/package.json +6 -6
  267. package/node_modules/uint8array-extras/readme.md +7 -7
  268. package/package.json +7 -7
  269. package/dist/.setup/accounts-C_r0UlEm.mjs +0 -138
  270. package/dist/.setup/config-update-CZndPxNd.mjs +0 -102
  271. package/dist/.setup/profile-DS0xdJAi.mjs +0 -80
  272. package/dist/.setup/setup-core-6DppLENo.mjs +0 -377
  273. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-arbitration.d.ts +0 -17
  274. package/node_modules/@openclaw/fs-safe/dist/file-lock-sync-root-arbitration.js +0 -66
  275. package/node_modules/@openclaw/fs-safe/dist/publish-file-native.d.ts +0 -4
  276. package/node_modules/@openclaw/fs-safe/dist/publish-file-native.js +0 -35
  277. package/node_modules/@openclaw/fs-safe/dist/root-move-preflight.d.ts +0 -7
  278. package/node_modules/@openclaw/fs-safe/dist/root-move-preflight.js +0 -16
  279. package/dist/.setup/{errors-DKVS3_DO.mjs → errors-Bw4EHwKX.mjs} +1 -1
@@ -75,7 +75,7 @@ export interface ICueReference {
75
75
  }
76
76
  export interface ISimpleTag {
77
77
  name?: string;
78
- 'string'?: string;
78
+ string?: string;
79
79
  binary?: Uint8Array;
80
80
  language?: string;
81
81
  default?: boolean;
@@ -98,7 +98,7 @@ export declare const TrackType: {
98
98
  button: number;
99
99
  control: number;
100
100
  };
101
- export type TrackType = typeof TrackType[keyof typeof TrackType];
101
+ export type TrackType = (typeof TrackType)[keyof typeof TrackType];
102
102
  export type TrackTypeKey = keyof typeof TrackType;
103
103
  export declare const TrackTypeValueToKeyMap: Record<TrackType, TrackTypeKey>;
104
104
  export interface ITarget {
@@ -1,16 +1,17 @@
1
- import * as AtomToken from './AtomToken.js';
2
1
  import type { ITokenizer } from 'strtok3';
2
+ import * as AtomToken from './AtomToken.js';
3
3
  export type AtomDataHandler = (atom: Atom, remaining: number) => Promise<void>;
4
4
  export declare class Atom {
5
+ private readonly payloadLength;
5
6
  static readAtom(tokenizer: ITokenizer, dataHandler: AtomDataHandler, parent: Atom | null, remaining: number): Promise<Atom>;
6
7
  readonly children: Atom[];
7
8
  readonly atomPath: string;
8
9
  readonly header: AtomToken.IAtomHeader;
9
10
  extended: boolean;
10
11
  readonly parent: Atom | null;
11
- constructor(header: AtomToken.IAtomHeader, extended: boolean, parent: Atom | null);
12
+ constructor(header: AtomToken.IAtomHeader, extended: boolean, parent: Atom | null, payloadLength: number);
12
13
  getHeaderLength(): number;
13
- getPayloadLength(remaining: number): number;
14
+ getPayloadLength(): number;
14
15
  readAtoms(tokenizer: ITokenizer, dataHandler: AtomDataHandler, size: number): Promise<void>;
15
16
  private readData;
16
17
  }
@@ -1,24 +1,43 @@
1
1
  import initDebug from 'debug';
2
2
  import * as AtomToken from './AtomToken.js';
3
- import { Header } from './AtomToken.js';
3
+ import { Header, Mp4ContentError } from './AtomToken.js';
4
4
  const debug = initDebug('music-metadata:parser:MP4:Atom');
5
5
  export class Atom {
6
6
  static async readAtom(tokenizer, dataHandler, parent, remaining) {
7
- // Parse atom header
7
+ // Validate boundaries before reading either header or dispatching a payload parser.
8
8
  const offset = tokenizer.position;
9
+ remaining = Math.min(remaining, (tokenizer.fileInfo.size ?? Number.POSITIVE_INFINITY) - offset);
10
+ if (remaining < AtomToken.Header.len) {
11
+ throw new Mp4ContentError('Truncated atom header');
12
+ }
9
13
  debug(`Reading next token on offset=${offset}...`); // buf.toString('ascii')
10
14
  const header = await tokenizer.readToken(AtomToken.Header);
11
15
  const extended = header.length === 1n;
12
16
  if (extended) {
17
+ if (remaining < 16) {
18
+ throw new Mp4ContentError('Truncated extended atom header');
19
+ }
13
20
  header.length = await tokenizer.readToken(AtomToken.ExtendedSize);
14
21
  }
15
- const atomBean = new Atom(header, extended, parent);
16
- const payloadLength = atomBean.getPayloadLength(remaining);
22
+ const headerLength = extended ? 16 : 8;
23
+ if ((extended || header.length !== 0n) && header.length < BigInt(headerLength)) {
24
+ throw new Mp4ContentError(`Invalid atom size: ${header.length}`);
25
+ }
26
+ if (header.length > BigInt(Number.MAX_SAFE_INTEGER)) {
27
+ throw new Mp4ContentError(`Atom size exceeds Number.MAX_SAFE_INTEGER: ${header.length}`);
28
+ }
29
+ const length = header.length === 0n ? remaining : Number(header.length);
30
+ if (length > remaining) {
31
+ throw new Mp4ContentError(`Atom size exceeds remaining bytes: ${header.length} > ${remaining}`);
32
+ }
33
+ const payloadLength = length - headerLength;
34
+ const atomBean = new Atom(header, extended, parent, payloadLength);
17
35
  debug(`parse atom name=${atomBean.atomPath}, extended=${atomBean.extended}, offset=${offset}, len=${atomBean.header.length}`); // buf.toString('ascii')
18
36
  await atomBean.readData(tokenizer, dataHandler, payloadLength);
19
37
  return atomBean;
20
38
  }
21
- constructor(header, extended, parent) {
39
+ constructor(header, extended, parent, payloadLength) {
40
+ this.payloadLength = payloadLength;
22
41
  this.header = header;
23
42
  this.extended = extended;
24
43
  this.parent = parent;
@@ -28,14 +47,24 @@ export class Atom {
28
47
  getHeaderLength() {
29
48
  return this.extended ? 16 : 8;
30
49
  }
31
- getPayloadLength(remaining) {
32
- return (this.header.length === 0n ? remaining : Number(this.header.length)) - this.getHeaderLength();
50
+ getPayloadLength() {
51
+ return this.payloadLength;
33
52
  }
34
53
  async readAtoms(tokenizer, dataHandler, size) {
35
54
  while (size > 0) {
55
+ if (size === Number.POSITIVE_INFINITY) {
56
+ // An open-ended container ends only at clean EOF, before the next header.
57
+ const bytesRead = await tokenizer.peekBuffer(new Uint8Array(Header.len), { mayBeLess: true });
58
+ if (bytesRead === 0) {
59
+ return;
60
+ }
61
+ if (bytesRead < Header.len) {
62
+ throw new Mp4ContentError('Truncated atom header');
63
+ }
64
+ }
36
65
  const atomBean = await Atom.readAtom(tokenizer, dataHandler, this, size);
37
66
  this.children.push(atomBean);
38
- size -= atomBean.header.length === 0n ? size : Number(atomBean.header.length);
67
+ size = atomBean.header.length === 0n ? 0 : size - Number(atomBean.header.length);
39
68
  }
40
69
  }
41
70
  async readData(tokenizer, dataHandler, remaining) {
@@ -50,13 +79,17 @@ export class Atom {
50
79
  case 'ilst':
51
80
  case 'tref':
52
81
  case 'moof':
53
- return this.readAtoms(tokenizer, dataHandler, this.getPayloadLength(remaining));
54
- case 'meta': { // Metadata Atom, ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW8
82
+ return this.readAtoms(tokenizer, dataHandler, remaining);
83
+ case 'meta': {
84
+ // Metadata Atom, ref: https://developer.apple.com/library/content/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW8
85
+ if (remaining < 8) {
86
+ throw new Mp4ContentError('Truncated meta atom');
87
+ }
55
88
  // meta has 4 bytes of padding, ignore
56
89
  const peekHeader = await tokenizer.peekToken(Header);
57
90
  const paddingLength = peekHeader.name === 'hdlr' ? 0 : 4;
58
91
  await tokenizer.ignore(paddingLength);
59
- return this.readAtoms(tokenizer, dataHandler, this.getPayloadLength(remaining) - paddingLength);
92
+ return this.readAtoms(tokenizer, dataHandler, remaining - paddingLength);
60
93
  }
61
94
  default:
62
95
  return dataHandler(this, remaining);
@@ -1,4 +1,4 @@
1
- import type { IToken, IGetToken } from 'strtok3';
1
+ import type { IGetToken, IToken } from 'strtok3';
2
2
  declare const Mp4ContentError_base: {
3
3
  new (message: string): {
4
4
  readonly fileType: string;
@@ -1,9 +1,8 @@
1
- import * as Token from 'token-types';
2
1
  import initDebug from 'debug';
2
+ import * as Token from 'token-types';
3
3
  import { FourCcToken } from '../common/FourCC.js';
4
- import { makeUnexpectedFileContentError } from '../ParseError.js';
5
4
  import * as util from '../common/Util.js';
6
- import { FieldDecodingError } from '../ParseError.js';
5
+ import { FieldDecodingError, makeUnexpectedFileContentError } from '../ParseError.js';
7
6
  const debug = initDebug('music-metadata:parser:MP4:atom');
8
7
  export class Mp4ContentError extends makeUnexpectedFileContentError('MP4') {
9
8
  }
@@ -11,8 +10,9 @@ export const Header = {
11
10
  len: 8,
12
11
  get: (buf, off) => {
13
12
  const length = Token.UINT32_BE.get(buf, off);
14
- if (length < 0)
13
+ if (length < 0) {
15
14
  throw new Mp4ContentError('Invalid atom header length');
15
+ }
16
16
  return {
17
17
  length: BigInt(length),
18
18
  name: new Token.StringType(4, 'latin1').get(buf, off + 4)
@@ -226,7 +226,15 @@ export class TrackHeaderAtom {
226
226
  this.len = len;
227
227
  }
228
228
  get(buf, off) {
229
+ const available = Math.min(this.len, buf.length - off);
230
+ if (available < 4) {
231
+ throw new Mp4ContentError('Truncated tkhd header');
232
+ }
229
233
  const version = Token.UINT8.get(buf, off);
234
+ // Validate through the volume field, the last field currently decoded.
235
+ if ((version === 0 && available < 38) || (version === 1 && available < 50)) {
236
+ throw new Mp4ContentError('Truncated tkhd header');
237
+ }
230
238
  const flags = Token.UINT24_BE.get(buf, off + 1);
231
239
  switch (version) {
232
240
  case 0:
@@ -306,11 +314,23 @@ export class StsdAtom {
306
314
  this.len = len;
307
315
  }
308
316
  get(buf, off) {
317
+ const end = Math.min(off + this.len, buf.length);
318
+ if (end - off < stsdHeader.len) {
319
+ throw new Mp4ContentError('Truncated stsd header');
320
+ }
309
321
  const header = stsdHeader.get(buf, off);
310
322
  off += stsdHeader.len;
311
323
  const table = [];
312
324
  for (let n = 0; n < header.numberOfEntries; ++n) {
325
+ if (end - off < Token.UINT32_BE.len) {
326
+ throw new Mp4ContentError('Truncated stsd sample entry');
327
+ }
313
328
  const size = Token.UINT32_BE.get(buf, off); // Sample description size
329
+ // A SampleEntry needs its size, format, reserved bytes and data reference index.
330
+ // Requiring it to fit also bounds the loop by the available payload, not entry_count.
331
+ if (size < 16 || size > end - off) {
332
+ throw new Mp4ContentError(`Invalid stsd sample entry size: ${size}`);
333
+ }
314
334
  off += Token.UINT32_BE.len;
315
335
  table.push(new SampleDescriptionTable(size - Token.UINT32_BE.len).get(buf, off));
316
336
  // A SampleEntry extends Box, so its size covers the size field already stepped over
@@ -449,10 +469,12 @@ export class ChapterText {
449
469
  }
450
470
  function readTokenTable(buf, token, off, remainingLen, numberOfEntries) {
451
471
  debug(`remainingLen=${remainingLen}, numberOfEntries=${numberOfEntries} * token-len=${token.len}`);
452
- if (remainingLen === 0)
472
+ if (remainingLen === 0) {
453
473
  return [];
454
- if (remainingLen !== numberOfEntries * token.len)
474
+ }
475
+ if (remainingLen !== numberOfEntries * token.len) {
455
476
  throw new Mp4ContentError('mismatch number-of-entries with remaining atom-length');
477
+ }
456
478
  const entries = [];
457
479
  // parse offset-table
458
480
  for (let n = 0; n < numberOfEntries; ++n) {
@@ -539,7 +561,7 @@ export class TrackRunBox {
539
561
  }
540
562
  for (let n = 0; n < trun.sampleCount; ++n) {
541
563
  if (dynOffset >= this.len) {
542
- debug("TrackRunBox size mismatch");
564
+ debug('TrackRunBox size mismatch');
543
565
  break;
544
566
  }
545
567
  const sample = {};
@@ -579,7 +601,7 @@ export class HandlerBox {
579
601
  flags: Token.UINT24_BE.get(buf, off + 1),
580
602
  componentType: charTypeToken.get(buf, off + 4),
581
603
  handlerType: charTypeToken.get(buf, off + 8),
582
- componentName: new Token.StringType(this.len - 28, 'utf-8').get(buf, off + 28),
604
+ componentName: new Token.StringType(this.len - 28, 'utf-8').get(buf, off + 28)
583
605
  };
584
606
  }
585
607
  }
@@ -2,6 +2,8 @@ import { BasicParser } from '../common/BasicParser.js';
2
2
  import { Atom } from './Atom.js';
3
3
  export declare class MP4Parser extends BasicParser {
4
4
  private static read_BE_Integer;
5
+ private validatePayloadLength;
6
+ private readToken;
5
7
  private tracks;
6
8
  private hasVideoTrack;
7
9
  private hasAudioTrack;
@@ -1,13 +1,13 @@
1
+ import { textDecode } from '@borewit/text-codec';
1
2
  import initDebug from 'debug';
2
3
  import * as Token from 'token-types';
4
+ import { uint8ArrayToHex } from 'uint8array-extras';
3
5
  import { BasicParser } from '../common/BasicParser.js';
4
6
  import { Genres } from '../id3v1/ID3v1Parser.js';
7
+ import { TrackType } from '../type.js';
5
8
  import { Atom } from './Atom.js';
6
9
  import * as AtomToken from './AtomToken.js';
7
10
  import { ChapterTrackReferenceBox, Mp4ContentError } from './AtomToken.js';
8
- import { TrackType } from '../type.js';
9
- import { uint8ArrayToHex } from 'uint8array-extras';
10
- import { textDecode } from '@borewit/text-codec';
11
11
  const debug = initDebug('music-metadata:parser:MP4');
12
12
  const tagFormat = 'iTunes';
13
13
  const encoderDict = {
@@ -122,7 +122,7 @@ export class MP4Parser extends BasicParser {
122
122
  * Ref: https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-56313
123
123
  */
124
124
  mvhd: async (len) => {
125
- const mvhd = await this.tokenizer.readToken(new AtomToken.MvhdAtom(len));
125
+ const mvhd = await this.readToken(new AtomToken.MvhdAtom(len));
126
126
  this.metadata.setFormat('creationTime', mvhd.creationTime);
127
127
  this.metadata.setFormat('modificationTime', mvhd.modificationTime);
128
128
  },
@@ -153,9 +153,12 @@ export class MP4Parser extends BasicParser {
153
153
  await this.tokenizer.ignore(len);
154
154
  },
155
155
  ftyp: async (len) => {
156
+ if (len < 8 || len % AtomToken.ftyp.len !== 0) {
157
+ throw new Mp4ContentError(`Invalid ftyp payload length: ${len}`);
158
+ }
156
159
  const types = [];
157
160
  while (len > 0) {
158
- const ftype = await this.tokenizer.readToken(AtomToken.ftyp);
161
+ const ftype = await this.readToken(AtomToken.ftyp);
159
162
  len -= AtomToken.ftyp.len;
160
163
  const value = ftype.type.replace(/\W/g, '');
161
164
  if (value.length > 0) {
@@ -170,7 +173,7 @@ export class MP4Parser extends BasicParser {
170
173
  * Parse sample description atom
171
174
  */
172
175
  stsd: async (len) => {
173
- const stsd = await this.tokenizer.readToken(new AtomToken.StsdAtom(len));
176
+ const stsd = await this.readToken(new AtomToken.StsdAtom(len));
174
177
  const trackDescription = this.getTrackDescription();
175
178
  trackDescription.soundSampleDescription = stsd.table.map(dfEntry => this.parseSoundSampleDescription(dfEntry));
176
179
  },
@@ -178,13 +181,13 @@ export class MP4Parser extends BasicParser {
178
181
  * Parse sample-sizes atom ('stsz')
179
182
  */
180
183
  stsz: async (len) => {
181
- const stsz = await this.tokenizer.readToken(new AtomToken.StszAtom(len));
184
+ const stsz = await this.readToken(new AtomToken.StszAtom(len));
182
185
  const td = this.getTrackDescription();
183
186
  td.sampleSize = stsz.sampleSize;
184
187
  td.sampleSizeTable = stsz.entries;
185
188
  },
186
189
  date: async (len) => {
187
- const date = await this.tokenizer.readToken(new Token.StringType(len, 'utf-8'));
190
+ const date = await this.readToken(new Token.StringType(len, 'utf-8'));
188
191
  await this.addTag('date', date);
189
192
  }
190
193
  };
@@ -197,12 +200,23 @@ export class MP4Parser extends BasicParser {
197
200
  }
198
201
  return Number(token.get(array, 0));
199
202
  }
203
+ // Metadata and sample tables are buffered; media data is skipped separately.
204
+ // A bound is also necessary for streams whose total size is unknown.
205
+ validatePayloadLength(length) {
206
+ if (!Number.isSafeInteger(length) || length < 0 || length > 64 * 1024 * 1024) {
207
+ throw new Mp4ContentError(`Atom payload exceeds the 64 MiB buffering limit: ${length}`);
208
+ }
209
+ }
210
+ async readToken(token) {
211
+ this.validatePayloadLength(token.len);
212
+ return this.tokenizer.readToken(token);
213
+ }
200
214
  async parse() {
201
215
  this.hasVideoTrack = false;
202
216
  this.hasAudioTrack = true;
203
217
  this.tracks.clear();
204
- let remainingFileSize = this.tokenizer.fileInfo.size || 0;
205
- while (!this.tokenizer.fileInfo.size || remainingFileSize > 0) {
218
+ let remainingFileSize = this.tokenizer.fileInfo.size ?? Number.POSITIVE_INFINITY;
219
+ while (remainingFileSize > 0) {
206
220
  try {
207
221
  const token = await this.tokenizer.peekToken(AtomToken.Header);
208
222
  if (token.name === '\0\0\0\0') {
@@ -218,12 +232,13 @@ export class MP4Parser extends BasicParser {
218
232
  debug(errMsg);
219
233
  this.addWarning(errMsg);
220
234
  }
221
- else
235
+ else {
222
236
  throw error;
237
+ }
223
238
  break;
224
239
  }
225
240
  const rootAtom = await Atom.readAtom(this.tokenizer, (atom, remaining) => this.handleAtom(atom, remaining), null, remainingFileSize);
226
- remainingFileSize -= rootAtom.header.length === BigInt(0) ? remainingFileSize : Number(rootAtom.header.length);
241
+ remainingFileSize = rootAtom.header.length === 0n ? 0 : remainingFileSize - Number(rootAtom.header.length);
227
242
  }
228
243
  // Post process metadata
229
244
  const formatList = [];
@@ -279,10 +294,10 @@ export class MP4Parser extends BasicParser {
279
294
  const dur = sample.sampleDuration ?? fragment.header.defaultSampleDuration ?? 0;
280
295
  const size = sample.sampleSize ?? fragment.header.defaultSampleSize ?? 0;
281
296
  if (dur === 0) {
282
- throw new Error("Missing sampleDuration and no defaultSampleDuration in track fragment header");
297
+ throw new Error('Missing sampleDuration and no defaultSampleDuration in track fragment header');
283
298
  }
284
299
  if (size === 0) {
285
- throw new Error("Missing sampleSize and no defaultSampleSize in track fragment header");
300
+ throw new Error('Missing sampleSize and no defaultSampleSize in track fragment header');
286
301
  }
287
302
  totalTimeUnits += dur;
288
303
  audioTrack.sizeInBytes += size;
@@ -321,7 +336,7 @@ export class MP4Parser extends BasicParser {
321
336
  if (firstAudioTrack.duration) {
322
337
  this.metadata.setFormat('duration', firstAudioTrack.duration);
323
338
  if (firstAudioTrack.sizeInBytes) {
324
- this.metadata.setFormat('bitrate', 8 * firstAudioTrack.sizeInBytes / firstAudioTrack.duration);
339
+ this.metadata.setFormat('bitrate', (8 * firstAudioTrack.sizeInBytes) / firstAudioTrack.duration);
325
340
  }
326
341
  }
327
342
  }
@@ -349,8 +364,10 @@ export class MP4Parser extends BasicParser {
349
364
  }
350
365
  }
351
366
  }
352
- // const payloadLength = atom.getPayloadLength(remaining);
353
367
  if (this.atomParsers[atom.header.name]) {
368
+ if (atom.header.name !== 'mdat') {
369
+ this.validatePayloadLength(remaining);
370
+ }
354
371
  return this.atomParsers[atom.header.name](remaining);
355
372
  }
356
373
  debug(`No parser for atom path=${atom.atomPath}, payload-len=${remaining}, ignoring atom`);
@@ -375,27 +392,27 @@ export class MP4Parser extends BasicParser {
375
392
  */
376
393
  parseMetadataItemData(metaAtom) {
377
394
  let tagKey = metaAtom.header.name;
378
- return metaAtom.readAtoms(this.tokenizer, async (child, remaining) => {
379
- const payLoadLength = child.getPayloadLength(remaining);
395
+ return metaAtom.readAtoms(this.tokenizer, async (child) => {
396
+ const payLoadLength = child.getPayloadLength();
380
397
  switch (child.header.name) {
381
398
  case 'data': // value atom
382
399
  return this.parseValueAtom(tagKey, child);
383
400
  case 'name': // name atom (optional)
384
401
  case 'mean':
385
402
  case 'rate': {
386
- const name = await this.tokenizer.readToken(new AtomToken.NameAtom(payLoadLength));
403
+ const name = await this.readToken(new AtomToken.NameAtom(payLoadLength));
387
404
  tagKey += `:${name.name}`;
388
405
  break;
389
406
  }
390
407
  default: {
391
- const uint8Array = await this.tokenizer.readToken(new Token.Uint8ArrayType(payLoadLength));
408
+ const uint8Array = await this.readToken(new Token.Uint8ArrayType(payLoadLength));
392
409
  this.addWarning(`Unsupported meta-item: ${tagKey}[${child.header.name}] => value=${uint8ArrayToHex(uint8Array)} ascii=${textDecode(uint8Array, 'ascii')}`);
393
410
  }
394
411
  }
395
- }, metaAtom.getPayloadLength(0));
412
+ }, metaAtom.getPayloadLength());
396
413
  }
397
414
  async parseValueAtom(tagKey, metaAtom) {
398
- const dataAtom = await this.tokenizer.readToken(new AtomToken.DataAtom(Number(metaAtom.header.length) - AtomToken.Header.len));
415
+ const dataAtom = await this.readToken(new AtomToken.DataAtom(metaAtom.getPayloadLength()));
399
416
  if (dataAtom.type.set !== 0) {
400
417
  throw new Mp4ContentError(`Unsupported type-set != 0: ${dataAtom.type.set}`);
401
418
  }
@@ -433,16 +450,18 @@ export class MP4Parser extends BasicParser {
433
450
  await this.addTag(tagKey, textDecode(dataAtom.value));
434
451
  break;
435
452
  case 13: // JPEG
436
- if (this.options.skipCovers)
453
+ if (this.options.skipCovers) {
437
454
  break;
455
+ }
438
456
  await this.addTag(tagKey, {
439
457
  format: 'image/jpeg',
440
458
  data: Uint8Array.from(dataAtom.value)
441
459
  });
442
460
  break;
443
461
  case 14: // PNG
444
- if (this.options.skipCovers)
462
+ if (this.options.skipCovers) {
445
463
  break;
464
+ }
446
465
  await this.addTag(tagKey, {
447
466
  format: 'image/png',
448
467
  data: Uint8Array.from(dataAtom.value)
@@ -473,19 +492,19 @@ export class MP4Parser extends BasicParser {
473
492
  media: {},
474
493
  fragments: []
475
494
  };
476
- await trakBox.readAtoms(this.tokenizer, async (child, remaining) => {
477
- const payLoadLength = child.getPayloadLength(remaining);
495
+ await trakBox.readAtoms(this.tokenizer, async (child) => {
496
+ const payLoadLength = child.getPayloadLength();
478
497
  switch (child.header.name) {
479
498
  case 'chap': {
480
- const chap = await this.tokenizer.readToken(new ChapterTrackReferenceBox(remaining));
499
+ const chap = await this.readToken(new ChapterTrackReferenceBox(payLoadLength));
481
500
  track.chapterList = chap;
482
501
  break;
483
502
  }
484
503
  case 'tkhd': // TrackHeaderBox
485
- track.header = await this.tokenizer.readToken(new AtomToken.TrackHeaderAtom(payLoadLength));
504
+ track.header = await this.readToken(new AtomToken.TrackHeaderAtom(payLoadLength));
486
505
  break;
487
506
  case 'hdlr': // TrackHeaderBox
488
- track.handler = await this.tokenizer.readToken(new AtomToken.HandlerBox(payLoadLength));
507
+ track.handler = await this.readToken(new AtomToken.HandlerBox(payLoadLength));
489
508
  track.isAudio = () => track.handler.handlerType === 'audi' || track.handler.handlerType === 'soun';
490
509
  track.isVideo = () => track.handler.handlerType === 'vide';
491
510
  if (track.isAudio()) {
@@ -495,33 +514,37 @@ export class MP4Parser extends BasicParser {
495
514
  this.hasVideoTrack = true;
496
515
  }
497
516
  break;
498
- case 'mdhd': { // Parse media header (mdhd) box
499
- const mdhd_data = await this.tokenizer.readToken(new AtomToken.MdhdAtom(payLoadLength));
517
+ case 'mdhd': {
518
+ // Parse media header (mdhd) box
519
+ const mdhd_data = await this.readToken(new AtomToken.MdhdAtom(payLoadLength));
500
520
  track.media.header = mdhd_data;
501
521
  break;
502
522
  }
503
523
  case 'stco': {
504
- const stco = await this.tokenizer.readToken(new AtomToken.StcoAtom(payLoadLength));
524
+ const stco = await this.readToken(new AtomToken.StcoAtom(payLoadLength));
505
525
  track.chunkOffsetTable = stco.entries; // remember chunk offsets
506
526
  break;
507
527
  }
508
- case 'stsc': { // sample-to-Chunk box
509
- const stsc = await this.tokenizer.readToken(new AtomToken.StscAtom(payLoadLength));
528
+ case 'stsc': {
529
+ // sample-to-Chunk box
530
+ const stsc = await this.readToken(new AtomToken.StscAtom(payLoadLength));
510
531
  track.sampleToChunkTable = stsc.entries;
511
532
  break;
512
533
  }
513
- case 'stsd': { // sample description box
514
- const stsd = await this.tokenizer.readToken(new AtomToken.StsdAtom(payLoadLength));
534
+ case 'stsd': {
535
+ // sample description box
536
+ const stsd = await this.readToken(new AtomToken.StsdAtom(payLoadLength));
515
537
  track.soundSampleDescription = stsd.table.map(dfEntry => this.parseSoundSampleDescription(dfEntry));
516
538
  break;
517
539
  }
518
- case 'stts': { // time-to-sample table
519
- const stts = await this.tokenizer.readToken(new AtomToken.SttsAtom(payLoadLength));
540
+ case 'stts': {
541
+ // time-to-sample table
542
+ const stts = await this.readToken(new AtomToken.SttsAtom(payLoadLength));
520
543
  track.timeToSampleTable = stts.entries;
521
544
  break;
522
545
  }
523
546
  case 'stsz': {
524
- const stsz = await this.tokenizer.readToken(new AtomToken.StszAtom(payLoadLength));
547
+ const stsz = await this.readToken(new AtomToken.StszAtom(payLoadLength));
525
548
  track.sampleSize = stsz.sampleSize;
526
549
  track.sampleSizeTable = stsz.entries;
527
550
  break;
@@ -537,26 +560,28 @@ export class MP4Parser extends BasicParser {
537
560
  await this.tokenizer.ignore(payLoadLength);
538
561
  }
539
562
  }
540
- }, trakBox.getPayloadLength(0));
563
+ }, trakBox.getPayloadLength());
541
564
  // Register track
542
565
  this.tracks.set(track.header.trackId, track);
543
566
  }
544
567
  parseTrackFragmentBox(trafBox) {
545
568
  let tfhd;
546
- return trafBox.readAtoms(this.tokenizer, async (child, remaining) => {
547
- const payLoadLength = child.getPayloadLength(remaining);
569
+ return trafBox.readAtoms(this.tokenizer, async (child) => {
570
+ const payLoadLength = child.getPayloadLength();
548
571
  switch (child.header.name) {
549
- case 'tfhd': { // TrackFragmentHeaderBox
550
- const fragmentHeaderBox = new AtomToken.TrackFragmentHeaderBox(child.getPayloadLength(remaining));
551
- tfhd = await this.tokenizer.readToken(fragmentHeaderBox);
572
+ case 'tfhd': {
573
+ // TrackFragmentHeaderBox
574
+ const fragmentHeaderBox = new AtomToken.TrackFragmentHeaderBox(child.getPayloadLength());
575
+ tfhd = await this.readToken(fragmentHeaderBox);
552
576
  break;
553
577
  }
554
578
  case 'tfdt': // TrackFragmentBaseMediaDecodeTimeBo
555
579
  await this.tokenizer.ignore(payLoadLength);
556
580
  break;
557
- case 'trun': { // TrackRunBox
581
+ case 'trun': {
582
+ // TrackRunBox
558
583
  const trackRunBox = new AtomToken.TrackRunBox(payLoadLength);
559
- const trun = await this.tokenizer.readToken(trackRunBox);
584
+ const trun = await this.readToken(trackRunBox);
560
585
  if (tfhd) {
561
586
  const track = this.tracks.get(tfhd.trackId);
562
587
  track?.fragments.push({ header: tfhd, trackRun: trun });
@@ -568,7 +593,7 @@ export class MP4Parser extends BasicParser {
568
593
  await this.tokenizer.ignore(payLoadLength);
569
594
  }
570
595
  }
571
- }, trafBox.getPayloadLength(0));
596
+ }, trafBox.getPayloadLength());
572
597
  }
573
598
  /**
574
599
  * @param sampleDescription
@@ -603,22 +628,22 @@ export class MP4Parser extends BasicParser {
603
628
  }
604
629
  async parseChapterTrack(chapterTrack, track, len) {
605
630
  if (!chapterTrack.sampleSize) {
606
- if (chapterTrack.chunkOffsetTable.length !== chapterTrack.sampleSizeTable.length)
631
+ if (chapterTrack.chunkOffsetTable.length !== chapterTrack.sampleSizeTable.length) {
607
632
  throw new Error('Expected equal chunk-offset-table & sample-size-table length.');
633
+ }
608
634
  }
609
635
  const chapters = [];
610
636
  for (let i = 0; i < chapterTrack.chunkOffsetTable.length && len > 0; ++i) {
611
- const start = chapterTrack.timeToSampleTable
612
- .slice(0, i)
613
- .reduce((acc, cur) => acc + cur.duration, 0);
637
+ const start = chapterTrack.timeToSampleTable.slice(0, i).reduce((acc, cur) => acc + cur.duration, 0);
614
638
  const chunkOffset = chapterTrack.chunkOffsetTable[i];
615
639
  const nextChunkLen = chunkOffset - this.tokenizer.position;
616
640
  const sampleSize = chapterTrack.sampleSize > 0 ? chapterTrack.sampleSize : chapterTrack.sampleSizeTable[i];
617
641
  len -= nextChunkLen + sampleSize;
618
- if (len < 0)
642
+ if (len < 0) {
619
643
  throw new Mp4ContentError('Chapter chunk exceeding token length');
644
+ }
620
645
  await this.tokenizer.ignore(nextChunkLen);
621
- const title = await this.tokenizer.readToken(new AtomToken.ChapterText(sampleSize));
646
+ const title = await this.readToken(new AtomToken.ChapterText(sampleSize));
622
647
  debug(`Chapter ${i + 1}: ${title}`);
623
648
  const chapter = {
624
649
  title,
@@ -1,6 +1,6 @@
1
1
  import { CaseInsensitiveTagMap } from '../common/CaseInsensitiveTagMap.js';
2
- import type { ITag } from "../type.js";
3
- import type { INativeMetadataCollector } from "../common/MetadataCollector.js";
2
+ import type { INativeMetadataCollector } from '../common/MetadataCollector.js';
3
+ import type { ITag } from '../type.js';
4
4
  export declare const tagType = "iTunes";
5
5
  export declare class MP4TagMapper extends CaseInsensitiveTagMap {
6
6
  constructor();
@@ -1,6 +1,6 @@
1
1
  export const mpegParserLoader = {
2
2
  parserType: 'mpeg',
3
- extensions: ['.mp2', '.mp3', '.m2a', '.aac', 'aacp'],
3
+ extensions: ['.mp1', '.mp2', '.mp3', '.m2a', '.aac', 'aacp'],
4
4
  mimeTypes: ['audio/mpeg', 'audio/mp3', 'audio/aacs', 'audio/aacp'],
5
5
  async load() {
6
6
  return (await import('./MpegParser.js')).MpegParser;