@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
@@ -1,10 +1,10 @@
1
- import * as Token from 'token-types';
2
- import { EndOfStreamError } from 'strtok3';
3
1
  import initDebug from 'debug';
2
+ import { EndOfStreamError } from 'strtok3';
3
+ import * as Token from 'token-types';
4
4
  import * as common from '../common/Util.js';
5
5
  import { AbstractID3Parser } from '../id3v2/AbstractID3Parser.js';
6
- import { InfoTagHeaderTag, LameEncoderVersion, readXingHeader } from './XingTag.js';
7
6
  import { makeUnexpectedFileContentError } from '../ParseError.js';
7
+ import { InfoTagHeaderTag, LameEncoderVersion, readXingHeader } from './XingTag.js';
8
8
  const debug = initDebug('music-metadata:parser:mpeg');
9
9
  export class MpegContentError extends makeUnexpectedFileContentError('MPEG') {
10
10
  }
@@ -31,7 +31,22 @@ const MPEG4 = {
31
31
  * https://wiki.multimedia.cx/index.php/MPEG-4_Audio#Sampling_Frequencies
32
32
  */
33
33
  SamplingFrequencies: [
34
- 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350, null, null, null
34
+ 96000,
35
+ 88200,
36
+ 64000,
37
+ 48000,
38
+ 44100,
39
+ 32000,
40
+ 24000,
41
+ 22050,
42
+ 16000,
43
+ 12000,
44
+ 11025,
45
+ 8000,
46
+ 7350,
47
+ null,
48
+ null,
49
+ null
35
50
  ]
36
51
  /**
37
52
  * Channel Configurations
@@ -87,14 +102,15 @@ class MpegFrameHeader {
87
102
  this.isProtectedByCRC = !common.isBitSet(buf, off + 1, 7);
88
103
  }
89
104
  calcDuration(numFrames) {
90
- return this.samplingRate == null ? null : (numFrames * this.calcSamplesPerFrame() / this.samplingRate);
105
+ return this.samplingRate == null ? null : (numFrames * this.calcSamplesPerFrame()) / this.samplingRate;
91
106
  }
92
107
  calcSamplesPerFrame() {
93
108
  return MpegFrameHeader.samplesInFrameTable[this.version === 1 ? 0 : 1][this.layer];
94
109
  }
95
110
  calculateSideInfoLength() {
96
- if (this.layer !== 3)
111
+ if (this.layer !== 3) {
97
112
  return 2;
113
+ }
98
114
  if (this.channelModeIndex === 3) {
99
115
  // mono
100
116
  if (this.version === 1) {
@@ -153,7 +169,7 @@ class MpegFrameHeader {
153
169
  }
154
170
  }
155
171
  parseAdtsHeader(buf, off) {
156
- debug("layer=0 => ADTS");
172
+ debug('layer=0 => ADTS');
157
173
  this.version = this.versionIndex === 2 ? 4 : 2;
158
174
  this.container = `ADTS/MPEG-${this.version}`;
159
175
  const profileIndex = common.getBitAllignedNumber(buf, off + 2, 0, 2);
@@ -170,7 +186,8 @@ class MpegFrameHeader {
170
186
  }
171
187
  calcBitrate() {
172
188
  if (this.bitrateIndex === 0x00 || // free
173
- this.bitrateIndex === 0x0F) { // reserved
189
+ this.bitrateIndex === 0x0f) {
190
+ // reserved
174
191
  return null;
175
192
  }
176
193
  if (this.version && this.bitrateIndex) {
@@ -180,13 +197,14 @@ class MpegFrameHeader {
180
197
  return null;
181
198
  }
182
199
  calcSamplingRate() {
183
- if (this.sampRateFreqIndex === 0x03 || this.version === null || this.sampRateFreqIndex == null)
200
+ if (this.sampRateFreqIndex === 0x03 || this.version === null || this.sampRateFreqIndex == null) {
184
201
  return null; // 'reserved'
202
+ }
185
203
  return MpegFrameHeader.sampling_rate_freq_index[this.version][this.sampRateFreqIndex];
186
204
  }
187
205
  }
188
- MpegFrameHeader.SyncByte1 = 0xFF;
189
- MpegFrameHeader.SyncByte2 = 0xE0;
206
+ MpegFrameHeader.SyncByte1 = 0xff;
207
+ MpegFrameHeader.SyncByte2 = 0xe0;
190
208
  MpegFrameHeader.VersionID = [2.5, null, 2, 1];
191
209
  MpegFrameHeader.LayerDescription = [0, 3, 2, 1];
192
210
  MpegFrameHeader.ChannelMode = ['stereo', 'joint_stereo', 'dual_channel', 'mono'];
@@ -264,7 +282,7 @@ export class MpegParser extends AbstractID3Parser {
264
282
  }
265
283
  catch (err) {
266
284
  if (err instanceof EndOfStreamError) {
267
- debug("End-of-stream");
285
+ debug('End-of-stream');
268
286
  if (this.calculateEofDuration) {
269
287
  if (this.samplesPerFrame !== null) {
270
288
  const numberOfSamples = this.frameCount * this.samplesPerFrame;
@@ -292,7 +310,7 @@ export class MpegParser extends AbstractID3Parser {
292
310
  if (format.duration && this.tokenizer.fileInfo.size) {
293
311
  const mpegSize = this.tokenizer.fileInfo.size - this.mpegOffset - (hasID3v1 ? 128 : 0);
294
312
  if (format.codecProfile && format.codecProfile[0] === 'V') {
295
- this.metadata.setFormat('bitrate', mpegSize * 8 / format.duration);
313
+ this.metadata.setFormat('bitrate', (mpegSize * 8) / format.duration);
296
314
  }
297
315
  }
298
316
  if (this.tokenizer.fileInfo.size && format.codecProfile === 'CBR') {
@@ -302,7 +320,7 @@ export class MpegParser extends AbstractID3Parser {
302
320
  this.metadata.setFormat('numberOfSamples', numberOfSamples);
303
321
  if (format.sampleRate && !format.duration) {
304
322
  const duration = numberOfSamples / format.sampleRate;
305
- debug("Calculate CBR duration based on file size: %s", duration);
323
+ debug('Calculate CBR duration based on file size: %s', duration);
306
324
  this.metadata.setFormat('duration', duration);
307
325
  }
308
326
  }
@@ -318,7 +336,7 @@ export class MpegParser extends AbstractID3Parser {
318
336
  throw new EndOfStreamError();
319
337
  }
320
338
  while (true) {
321
- if (gotFirstSync && (this.syncPeek.buf[bo] & 0xE0) === 0xE0) {
339
+ if (gotFirstSync && (this.syncPeek.buf[bo] & 0xe0) === 0xe0) {
322
340
  this.buf_frame_header[0] = MpegFrameHeader.SyncByte1;
323
341
  this.buf_frame_header[1] = this.syncPeek.buf[bo];
324
342
  await this.tokenizer.ignore(bo);
@@ -372,7 +390,9 @@ export class MpegParser extends AbstractID3Parser {
372
390
  this.metadata.setFormat('lossless', false);
373
391
  this.metadata.setFormat('sampleRate', header.samplingRate);
374
392
  this.frameCount++;
375
- return header.version !== null && header.version >= 2 && header.layer === 0 ? this.parseAdts(header) : this.parseAudioFrameHeader(header);
393
+ return header.version !== null && header.version >= 2 && header.layer === 0
394
+ ? this.parseAdts(header)
395
+ : this.parseAudioFrameHeader(header);
376
396
  }
377
397
  /**
378
398
  * @return {Promise<boolean>} true if parser should quit
@@ -391,7 +411,7 @@ export class MpegParser extends AbstractID3Parser {
391
411
  debug(`samples_per_frame=${samples_per_frame}`);
392
412
  const bps = samples_per_frame / 8.0;
393
413
  if (header.bitrate !== null && header.samplingRate != null) {
394
- const fsize = (bps * header.bitrate / header.samplingRate) + ((header.padding) ? slot_size : 0);
414
+ const fsize = (bps * header.bitrate) / header.samplingRate + (header.padding ? slot_size : 0);
395
415
  this.frame_size = Math.floor(fsize);
396
416
  }
397
417
  this.audioFrameHeader = header;
@@ -410,8 +430,9 @@ export class MpegParser extends AbstractID3Parser {
410
430
  // Actual calculation will be done in finalize
411
431
  this.samplesPerFrame = samples_per_frame;
412
432
  this.metadata.setFormat('codecProfile', 'CBR');
413
- if (this.tokenizer.fileInfo.size)
433
+ if (this.tokenizer.fileInfo.size) {
414
434
  return true; // Will calculate duration based on the file size
435
+ }
415
436
  }
416
437
  else if (this.metadata.format.duration) {
417
438
  return true; // We already got the duration, stop processing MPEG stream any further
@@ -556,8 +577,9 @@ export class MpegParser extends AbstractID3Parser {
556
577
  return infoTag;
557
578
  }
558
579
  async skipFrameData(frameDataLeft) {
559
- if (frameDataLeft < 0)
580
+ if (frameDataLeft < 0) {
560
581
  throw new MpegContentError('frame-data-left cannot be negative');
582
+ }
561
583
  await this.tokenizer.ignore(frameDataLeft);
562
584
  }
563
585
  areAllSame(array) {
@@ -21,7 +21,7 @@ declare const NameCode: {
21
21
  */
22
22
  audiophile: number;
23
23
  };
24
- type NameCode = typeof NameCode[keyof typeof NameCode];
24
+ type NameCode = (typeof NameCode)[keyof typeof NameCode];
25
25
  /**
26
26
  * https://github.com/Borewit/music-metadata/wiki/Replay-Gain-Data-Format#originator-code
27
27
  */
@@ -47,7 +47,7 @@ declare const ReplayGainOriginator: {
47
47
  */
48
48
  rms_average: number;
49
49
  };
50
- type ReplayGainOriginator = typeof ReplayGainOriginator[keyof typeof ReplayGainOriginator];
50
+ type ReplayGainOriginator = (typeof ReplayGainOriginator)[keyof typeof ReplayGainOriginator];
51
51
  /**
52
52
  * Replay Gain Data Format
53
53
  *
@@ -56,7 +56,7 @@ export const ReplayGain = {
56
56
  return {
57
57
  type: common.getBitAllignedNumber(buf, off, 0, 3),
58
58
  origin: common.getBitAllignedNumber(buf, off, 3, 3),
59
- adjustment: (sign ? -gain_adj : gain_adj)
59
+ adjustment: sign ? -gain_adj : gain_adj
60
60
  };
61
61
  }
62
62
  return undefined;
@@ -1,5 +1,5 @@
1
- import * as Token from 'token-types';
2
1
  import type { IGetToken, ITokenizer } from 'strtok3';
2
+ import * as Token from 'token-types';
3
3
  import { type IExtendedLameHeader } from './ExtendedLameHeader.js';
4
4
  export interface IXingHeaderFlags {
5
5
  frames: boolean;
@@ -1,9 +1,9 @@
1
1
  import initDebug from 'debug';
2
2
  import * as Token from 'token-types';
3
3
  import { AbstractID3Parser } from '../id3v2/AbstractID3Parser.js';
4
- import { MpcSv8Parser } from './sv8/MpcSv8Parser.js';
5
- import { MpcSv7Parser } from './sv7/MpcSv7Parser.js';
6
4
  import { MusepackContentError } from './MusepackConentError.js';
5
+ import { MpcSv7Parser } from './sv7/MpcSv7Parser.js';
6
+ import { MpcSv8Parser } from './sv8/MpcSv8Parser.js';
7
7
  const debug = initDebug('music-metadata:parser:musepack');
8
8
  export class MusepackParser extends AbstractID3Parser {
9
9
  async postId3v2Parse() {
@@ -16,7 +16,7 @@ export class BitReader {
16
16
  let out = this.dword;
17
17
  this.pos += bits;
18
18
  if (this.pos < 32) {
19
- out >>>= (32 - this.pos);
19
+ out >>>= 32 - this.pos;
20
20
  return out & ((1 << bits) - 1);
21
21
  }
22
22
  this.pos -= 32;
@@ -1,9 +1,9 @@
1
1
  import initDebug from 'debug';
2
- import { BasicParser } from '../../common/BasicParser.js';
3
2
  import { tryParseApeHeader } from '../../apev2/APEv2Parser.js';
3
+ import { BasicParser } from '../../common/BasicParser.js';
4
+ import { MusepackContentError } from '../MusepackConentError.js';
4
5
  import { BitReader } from './BitReader.js';
5
6
  import * as SV7 from './StreamVersion7.js';
6
- import { MusepackContentError } from '../MusepackConentError.js';
7
7
  const debug = initDebug('music-metadata:parser:musepack');
8
8
  export class MpcSv7Parser extends BasicParser {
9
9
  constructor() {
@@ -14,8 +14,9 @@ export class MpcSv7Parser extends BasicParser {
14
14
  }
15
15
  async parse() {
16
16
  const header = await this.tokenizer.readToken(SV7.Header);
17
- if (header.signature !== 'MP+')
17
+ if (header.signature !== 'MP+') {
18
18
  throw new MusepackContentError('Unexpected magic number');
19
+ }
19
20
  debug(`stream-version=${header.streamMajorVersion}.${header.streamMinorVersion}`);
20
21
  this.metadata.setFormat('container', 'Musepack, SV7');
21
22
  this.metadata.setFormat('sampleRate', header.sampleFrequency);
@@ -1,6 +1,6 @@
1
+ import { textDecode } from '@borewit/text-codec';
1
2
  import * as Token from 'token-types';
2
3
  import * as util from '../../common/Util.js';
3
- import { textDecode } from '@borewit/text-codec';
4
4
  /**
5
5
  * BASIC STRUCTURE
6
6
  */
@@ -30,10 +30,10 @@ export const Header = {
30
30
  albumPeak: Token.UINT16_LE.get(buf, off + 16),
31
31
  albumGain: Token.UINT16_LE.get(buf, off + 18),
32
32
  // word
33
- lastFrameLength: (Token.UINT32_LE.get(buf, off + 20) >>> 20) & 0x7FF,
33
+ lastFrameLength: (Token.UINT32_LE.get(buf, off + 20) >>> 20) & 0x7ff,
34
34
  trueGapless: util.isBitSet(buf, off + 23, 0)
35
35
  };
36
- header.lastFrameLength = header.trueGapless ? (Token.UINT32_LE.get(buf, 20) >>> 20) & 0x7FF : 0;
36
+ header.lastFrameLength = header.trueGapless ? (Token.UINT32_LE.get(buf, 20) >>> 20) & 0x7ff : 0;
37
37
  return header;
38
38
  }
39
39
  };
@@ -1,9 +1,9 @@
1
1
  import initDebug from 'debug';
2
- import { BasicParser } from '../../common/BasicParser.js';
3
2
  import { tryParseApeHeader } from '../../apev2/APEv2Parser.js';
3
+ import { BasicParser } from '../../common/BasicParser.js';
4
4
  import { FourCcToken } from '../../common/FourCC.js';
5
- import * as SV8 from './StreamVersion8.js';
6
5
  import { MusepackContentError } from '../MusepackConentError.js';
6
+ import * as SV8 from './StreamVersion8.js';
7
7
  const debug = initDebug('music-metadata:parser:musepack');
8
8
  export class MpcSv8Parser extends BasicParser {
9
9
  constructor() {
@@ -12,8 +12,9 @@ export class MpcSv8Parser extends BasicParser {
12
12
  }
13
13
  async parse() {
14
14
  const signature = await this.tokenizer.readToken(FourCcToken);
15
- if (signature !== 'MPCK')
15
+ if (signature !== 'MPCK') {
16
16
  throw new MusepackContentError('Invalid Magic number');
17
+ }
17
18
  this.metadata.setFormat('container', 'Musepack, SV8');
18
19
  return this.parsePacket();
19
20
  }
@@ -23,7 +24,8 @@ export class MpcSv8Parser extends BasicParser {
23
24
  const header = await sv8reader.readPacketHeader();
24
25
  debug(`packet-header key=${header.key}, payloadLength=${header.payloadLength}`);
25
26
  switch (header.key) {
26
- case 'SH': { // Stream Header
27
+ case 'SH': {
28
+ // Stream Header
27
29
  const sh = await sv8reader.readStreamHeader(header.payloadLength);
28
30
  this.metadata.setFormat('numberOfSamples', sh.sampleCount);
29
31
  this.metadata.setFormat('sampleRate', sh.sampleFrequency);
@@ -44,7 +46,7 @@ export class MpcSv8Parser extends BasicParser {
44
46
  break;
45
47
  case 'SE': // Stream End
46
48
  if (this.metadata.format.duration) {
47
- this.metadata.setFormat('bitrate', this.audioLength * 8 / this.metadata.format.duration);
49
+ this.metadata.setFormat('bitrate', (this.audioLength * 8) / this.metadata.format.duration);
48
50
  }
49
51
  return tryParseApeHeader(this.metadata, this.tokenizer, this.options);
50
52
  default:
@@ -1,5 +1,5 @@
1
- import * as Token from 'token-types';
2
1
  import initDebug from 'debug';
2
+ import * as Token from 'token-types';
3
3
  import * as util from '../../common/Util.js';
4
4
  const debug = initDebug('music-metadata:parser:musepack:sv8');
5
5
  const PacketKey = new Token.StringType(2, 'latin1');
@@ -75,7 +75,7 @@ export class StreamReader {
75
75
  if ((n & 0x80) === 0) {
76
76
  return { len, value: hb + n };
77
77
  }
78
- n &= 0x7F;
78
+ n &= 0x7f;
79
79
  n += hb;
80
80
  return this.readVariableSizeField(len + 1, n << 7);
81
81
  }
@@ -1,14 +1,14 @@
1
- import * as Token from 'token-types';
2
- import { EndOfStreamError } from 'strtok3';
3
1
  import initDebug from 'debug';
2
+ import { EndOfStreamError } from 'strtok3';
3
+ import * as Token from 'token-types';
4
4
  import { BasicParser } from '../common/BasicParser.js';
5
- import { VorbisStream } from './vorbis/VorbisStream.js';
5
+ import { makeUnexpectedFileContentError } from '../ParseError.js';
6
+ import { FlacStream } from './flac/FlacStream.js';
7
+ import { PageHeader, SegmentTable } from './OggToken.js';
6
8
  import { OpusStream } from './opus/OpusStream.js';
7
9
  import { SpeexStream } from './speex/SpeexStream.js';
8
10
  import { TheoraStream } from './theora/TheoraStream.js';
9
- import { makeUnexpectedFileContentError } from '../ParseError.js';
10
- import { PageHeader, SegmentTable } from './OggToken.js';
11
- import { FlacStream } from './flac/FlacStream.js';
11
+ import { VorbisStream } from './vorbis/VorbisStream.js';
12
12
  export class OggContentError extends makeUnexpectedFileContentError('Ogg') {
13
13
  }
14
14
  const debug = initDebug('music-metadata:parser:ogg');
@@ -66,8 +66,9 @@ class OggStream {
66
66
  if (this.pageConsumer) {
67
67
  await this.pageConsumer.parsePage(header, pageData);
68
68
  }
69
- else
69
+ else {
70
70
  throw new Error('pageConsumer should be initialized');
71
+ }
71
72
  }
72
73
  }
73
74
  /**
@@ -85,38 +86,47 @@ export class OggParser extends BasicParser {
85
86
  async parse() {
86
87
  this.streams = new Map();
87
88
  let enfOfStream = false;
89
+ let stoppedEarly = false;
88
90
  let header;
89
91
  try {
90
92
  do {
91
93
  header = await this.tokenizer.readToken(PageHeader);
92
- if (header.capturePattern !== 'OggS')
94
+ if (header.capturePattern !== 'OggS') {
93
95
  throw new OggContentError('Invalid Ogg capture pattern');
96
+ }
94
97
  let stream = this.streams.get(header.streamSerialNumber);
95
98
  if (!stream) {
96
99
  stream = new OggStream(this.metadata, header.streamSerialNumber, this.options);
97
100
  this.streams.set(header.streamSerialNumber, stream);
98
101
  }
99
102
  await stream.parsePage(this.tokenizer, header);
100
- if (stream.pageNumber > 12 && !(this.options.duration && [...this.streams.values()].find(stream => stream.pageConsumer?.durationOnLastPage))) {
101
- debug("Stop processing Ogg stream");
103
+ if (stream.pageNumber > 12 &&
104
+ // A comment (including its cover art) may span more than 13 pages.
105
+ [...this.streams.values()].every(stream => stream.pageConsumer?.isMetadataComplete !== false) &&
106
+ !(this.options.duration && [...this.streams.values()].find(stream => stream.pageConsumer?.durationOnLastPage))) {
107
+ stoppedEarly = true;
108
+ debug('Stop processing Ogg stream');
102
109
  break;
103
110
  }
104
111
  } while (![...this.streams.values()].every(item => item.closed));
105
112
  }
106
113
  catch (err) {
107
114
  if (err instanceof EndOfStreamError) {
108
- debug("Reached end-of-stream");
115
+ debug('Reached end-of-stream');
109
116
  enfOfStream = true;
110
117
  }
111
118
  else if (err instanceof OggContentError) {
112
119
  this.metadata.addWarning(`Corrupt Ogg content at ${this.tokenizer.position}`);
113
120
  }
114
- else
121
+ else {
115
122
  throw err;
123
+ }
116
124
  }
117
125
  for (const stream of this.streams.values()) {
118
126
  if (!stream.closed) {
119
- this.metadata.addWarning(`End-of-stream reached before reaching last page in Ogg stream serial=${stream.streamSerial}`);
127
+ if (!stoppedEarly) {
128
+ this.metadata.addWarning(`End-of-stream reached before reaching last page in Ogg stream serial=${stream.streamSerial}`);
129
+ }
120
130
  await stream.pageConsumer?.flush();
121
131
  }
122
132
  stream.pageConsumer?.calculateDuration(enfOfStream);
@@ -62,6 +62,8 @@ export declare class SegmentTable implements IGetToken<ISegmentTable> {
62
62
  get(buf: Uint8Array, off: number): ISegmentTable;
63
63
  }
64
64
  export interface IPageConsumer {
65
+ /** False while required metadata is still being read; undefined if not tracked. */
66
+ isMetadataComplete?: boolean;
65
67
  /**
66
68
  * Need to parse to end to be able to calculate the duration
67
69
  */
@@ -1,6 +1,6 @@
1
1
  import * as Token from 'token-types';
2
- import * as util from '../common/Util.js';
3
2
  import { StringType } from 'token-types';
3
+ import * as util from '../common/Util.js';
4
4
  export const PageHeader = {
5
5
  len: 27,
6
6
  get: (buf, off) => {
@@ -1,7 +1,7 @@
1
1
  import type { ITokenizer } from 'strtok3';
2
- import type * as Ogg from '../OggToken.js';
3
- import type { IOptions } from '../../type.js';
4
2
  import type { INativeMetadataCollector } from '../../common/MetadataCollector.js';
3
+ import type { IOptions } from '../../type.js';
4
+ import type * as Ogg from '../OggToken.js';
5
5
  /**
6
6
  * Ref:
7
7
  * - https://xiph.org/flac/ogg_mapping.html
@@ -1,7 +1,7 @@
1
1
  import initDebug from 'debug';
2
- import * as Flac from '../../flac/FlacToken.js';
3
- import { FlacParser } from '../../flac/FlacParser.js';
4
2
  import { FourCcToken } from '../../common/FourCC.js';
3
+ import { FlacParser } from '../../flac/FlacParser.js';
4
+ import * as Flac from '../../flac/FlacToken.js';
5
5
  import { VorbisPictureToken } from '../vorbis/Vorbis.js';
6
6
  const debug = initDebug('music-metadata:parser:ogg:theora');
7
7
  /**
@@ -1,8 +1,8 @@
1
1
  import type { ITokenizer } from 'strtok3';
2
+ import type { INativeMetadataCollector } from '../../common/MetadataCollector.js';
3
+ import type { IOptions } from '../../type.js';
2
4
  import type { IPageHeader } from '../OggToken.js';
3
5
  import { VorbisStream } from '../vorbis/VorbisStream.js';
4
- import type { IOptions } from '../../type.js';
5
- import type { INativeMetadataCollector } from '../../common/MetadataCollector.js';
6
6
  /**
7
7
  * Opus parser
8
8
  * Internet Engineering Task Force (IETF) - RFC 6716
@@ -24,8 +24,9 @@ export class OpusStream extends VorbisStream {
24
24
  this.metadata.setFormat('codec', 'Opus');
25
25
  // Parse Opus ID Header
26
26
  this.idHeader = new Opus.IdHeader(pageData.length).get(pageData, 0);
27
- if (this.idHeader.magicSignature !== "OpusHead")
28
- throw new OpusContentError("Illegal ogg/Opus magic-signature");
27
+ if (this.idHeader.magicSignature !== 'OpusHead') {
28
+ throw new OpusContentError('Illegal ogg/Opus magic-signature');
29
+ }
29
30
  this.metadata.setFormat('sampleRate', this.idHeader.inputSampleRate);
30
31
  this.metadata.setFormat('numberOfChannels', this.idHeader.channelCount);
31
32
  this.metadata.setAudioOnly();
@@ -42,14 +43,17 @@ export class OpusStream extends VorbisStream {
42
43
  }
43
44
  }
44
45
  calculateDuration(enfOfStream) {
45
- if (this.lastPageHeader && (enfOfStream || this.lastPageHeader.headerType.lastPage) && this.metadata.format.sampleRate && this.lastPageHeader.absoluteGranulePosition >= 0) {
46
+ if (this.lastPageHeader &&
47
+ (enfOfStream || this.lastPageHeader.headerType.lastPage) &&
48
+ this.metadata.format.sampleRate &&
49
+ this.lastPageHeader.absoluteGranulePosition >= 0) {
46
50
  // Calculate duration
47
51
  const pos_48bit = this.lastPageHeader.absoluteGranulePosition - this.idHeader.preSkip;
48
52
  this.metadata.setFormat('numberOfSamples', pos_48bit);
49
53
  this.metadata.setFormat('duration', pos_48bit / 48000);
50
54
  if (this.lastPos !== -1 && this.tokenizer.fileInfo.size && this.metadata.format.duration) {
51
55
  const dataSize = this.tokenizer.fileInfo.size - this.lastPos;
52
- this.metadata.setFormat('bitrate', 8 * dataSize / this.metadata.format.duration);
56
+ this.metadata.setFormat('bitrate', (8 * dataSize) / this.metadata.format.duration);
53
57
  }
54
58
  }
55
59
  }
@@ -1,8 +1,8 @@
1
1
  import type { ITokenizer } from 'strtok3';
2
+ import type { INativeMetadataCollector } from '../../common/MetadataCollector.js';
3
+ import type { IOptions } from '../../type.js';
2
4
  import type { IPageHeader } from '../OggToken.js';
3
5
  import { VorbisStream } from '../vorbis/VorbisStream.js';
4
- import type { IOptions } from '../../type.js';
5
- import type { INativeMetadataCollector } from '../../common/MetadataCollector.js';
6
6
  /**
7
7
  * Speex, RFC 5574
8
8
  * Ref:
@@ -35,8 +35,9 @@ export class SpeexStream extends VorbisStream {
35
35
  * Ref: https://tools.ietf.org/html/rfc5574#section-3
36
36
  */
37
37
  async parseFullPage(pageData) {
38
- if (this.commentHeaderParsed)
38
+ if (this.commentHeaderParsed) {
39
39
  return;
40
+ }
40
41
  this.commentHeaderParsed = true;
41
42
  debug('Parse Ogg/Speex comment header');
42
43
  await this.parseUserCommentList(pageData, 0);
@@ -1,7 +1,7 @@
1
1
  import type { ITokenizer } from 'strtok3';
2
- import type * as Ogg from '../OggToken.js';
3
- import type { IOptions } from '../../type.js';
4
2
  import type { INativeMetadataCollector } from '../../common/MetadataCollector.js';
3
+ import type { IOptions } from '../../type.js';
4
+ import type * as Ogg from '../OggToken.js';
5
5
  /**
6
6
  * Ref:
7
7
  * - https://theora.org/doc/Theora.pdf
@@ -1,5 +1,5 @@
1
- import type { IPicture } from '../../type.js';
2
1
  import type { IGetToken } from 'strtok3';
2
+ import type { IPicture } from '../../type.js';
3
3
  /**
4
4
  * Interface to parsed result of METADATA_BLOCK_PICTURE
5
5
  * Ref: https://wiki.xiph.org/VorbisComment#METADATA_BLOCK_PICTURE
@@ -1,5 +1,5 @@
1
- import * as Token from 'token-types';
2
1
  import { textDecode } from '@borewit/text-codec';
2
+ import * as Token from 'token-types';
3
3
  export class VorbisDecoder {
4
4
  constructor(data, offset) {
5
5
  this.data = data;
@@ -1,7 +1,7 @@
1
- import { type IVorbisPicture } from './Vorbis.js';
2
- import type { IPageConsumer, IPageHeader } from '../OggToken.js';
3
- import type { IOptions } from '../../type.js';
4
1
  import type { INativeMetadataCollector } from '../../common/MetadataCollector.js';
2
+ import type { IOptions } from '../../type.js';
3
+ import type { IPageConsumer, IPageHeader } from '../OggToken.js';
4
+ import { type IVorbisPicture } from './Vorbis.js';
5
5
  declare const VorbisContentError_base: {
6
6
  new (message: string): {
7
7
  readonly fileType: string;
@@ -26,6 +26,7 @@ export declare class VorbisStream implements IPageConsumer {
26
26
  protected options: IOptions;
27
27
  protected lastPageHeader?: IPageHeader;
28
28
  durationOnLastPage: boolean;
29
+ isMetadataComplete: boolean;
29
30
  constructor(metadata: INativeMetadataCollector, options: IOptions);
30
31
  /**
31
32
  * Vorbis 1 parser
@@ -1,8 +1,8 @@
1
- import * as Token from 'token-types';
2
1
  import debugInit from 'debug';
3
- import { VorbisDecoder } from './VorbisDecoder.js';
4
- import { CommonHeader, IdentificationHeader, VorbisPictureToken } from './Vorbis.js';
2
+ import * as Token from 'token-types';
5
3
  import { makeUnexpectedFileContentError } from '../../ParseError.js';
4
+ import { CommonHeader, IdentificationHeader, VorbisPictureToken } from './Vorbis.js';
5
+ import { VorbisDecoder } from './VorbisDecoder.js';
6
6
  const debug = debugInit('music-metadata:parser:ogg:vorbis1');
7
7
  export class VorbisContentError extends makeUnexpectedFileContentError('Vorbis') {
8
8
  }
@@ -14,6 +14,7 @@ export class VorbisStream {
14
14
  constructor(metadata, options) {
15
15
  this.pageSegments = [];
16
16
  this.durationOnLastPage = true;
17
+ this.isMetadataComplete = false;
17
18
  this.metadata = metadata;
18
19
  this.options = options;
19
20
  }
@@ -64,9 +65,9 @@ export class VorbisStream {
64
65
  return tag.len;
65
66
  }
66
67
  async addTag(id, value) {
67
- if (id === 'METADATA_BLOCK_PICTURE' && (typeof value === 'string')) {
68
+ if (id === 'METADATA_BLOCK_PICTURE' && typeof value === 'string') {
68
69
  if (this.options.skipCovers) {
69
- debug("Ignore picture");
70
+ debug('Ignore picture');
70
71
  return;
71
72
  }
72
73
  value = VorbisPictureToken.fromBase64(value);
@@ -78,7 +79,10 @@ export class VorbisStream {
78
79
  await this.metadata.addTag('vorbis', id, value);
79
80
  }
80
81
  calculateDuration(enfOfStream) {
81
- if (this.lastPageHeader && (enfOfStream || this.lastPageHeader.headerType.lastPage) && this.metadata.format.sampleRate && this.lastPageHeader.absoluteGranulePosition >= 0) {
82
+ if (this.lastPageHeader &&
83
+ (enfOfStream || this.lastPageHeader.headerType.lastPage) &&
84
+ this.metadata.format.sampleRate &&
85
+ this.lastPageHeader.absoluteGranulePosition >= 0) {
82
86
  // Calculate duration
83
87
  this.metadata.setFormat('numberOfSamples', this.lastPageHeader.absoluteGranulePosition);
84
88
  this.metadata.setFormat('duration', this.lastPageHeader.absoluteGranulePosition / this.metadata.format.sampleRate);
@@ -95,8 +99,9 @@ export class VorbisStream {
95
99
  debug('Parse first page');
96
100
  // Parse Vorbis common header
97
101
  const commonHeader = CommonHeader.get(pageData, 0);
98
- if (commonHeader.vorbis !== 'vorbis')
102
+ if (commonHeader.vorbis !== 'vorbis') {
99
103
  throw new VorbisContentError('Metadata does not look like Vorbis');
104
+ }
100
105
  if (commonHeader.packetType === 1) {
101
106
  const idHeader = IdentificationHeader.get(pageData, CommonHeader.len);
102
107
  this.metadata.setFormat('sampleRate', idHeader.sampleRate);
@@ -104,8 +109,9 @@ export class VorbisStream {
104
109
  this.metadata.setFormat('numberOfChannels', idHeader.channelMode);
105
110
  debug('sample-rate=%s[hz], bitrate=%s[b/s], channel-mode=%s', idHeader.sampleRate, idHeader.bitrateNominal, idHeader.channelMode);
106
111
  }
107
- else
112
+ else {
108
113
  throw new VorbisContentError('First Ogg page should be type 1: the identification header');
114
+ }
109
115
  }
110
116
  async parseFullPage(pageData) {
111
117
  // New page
@@ -130,7 +136,8 @@ export class VorbisStream {
130
136
  let userCommentListLength = Token.UINT32_LE.get(pageData, offset);
131
137
  offset += 4;
132
138
  while (userCommentListLength-- > 0) {
133
- offset += (await this.parseUserComment(pageData, offset));
139
+ offset += await this.parseUserComment(pageData, offset);
134
140
  }
141
+ this.isMetadataComplete = true;
135
142
  }
136
143
  }