agentroam-runtime-darwin-arm64 0.2.0-preview.70 → 0.2.0-preview.71

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 (270) hide show
  1. package/manifest.json +2 -2
  2. package/package.json +1 -1
  3. package/runtime/.next/BUILD_ID +1 -1
  4. package/runtime/.next/app-build-manifest.json +8 -8
  5. package/runtime/.next/app-path-routes-manifest.json +1 -1
  6. package/runtime/.next/build-manifest.json +3 -3
  7. package/runtime/.next/prerender-manifest.json +1 -1
  8. package/runtime/.next/required-server-files.json +1 -1
  9. package/runtime/.next/server/app/_not-found/page.js +1 -1
  10. package/runtime/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  11. package/runtime/.next/server/app/_not-found.html +1 -1
  12. package/runtime/.next/server/app/_not-found.rsc +1 -1
  13. package/runtime/.next/server/app/api/agent/abort/route.js +1 -1
  14. package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
  15. package/runtime/.next/server/app/api/agent/codex-sharing/route.js +1 -1
  16. package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
  17. package/runtime/.next/server/app/api/agent/model/route.js +1 -1
  18. package/runtime/.next/server/app/api/agent/models/route.js +1 -1
  19. package/runtime/.next/server/app/api/agent/run/route.js +1 -1
  20. package/runtime/.next/server/app/api/agent/runtime-health/route.js +1 -1
  21. package/runtime/.next/server/app/api/agent/steer/route.js +1 -1
  22. package/runtime/.next/server/app/api/agent/stream/route.js +4 -4
  23. package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
  24. package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
  25. package/runtime/.next/server/app/api/auth/verify/route.js +1 -1
  26. package/runtime/.next/server/app/api/business/route.js +1 -1
  27. package/runtime/.next/server/app/api/client-logs/route.js +1 -1
  28. package/runtime/.next/server/app/api/collaboration/route.js +2 -2
  29. package/runtime/.next/server/app/api/flow/v1/catalog/route.js +1 -1
  30. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js +1 -1
  31. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js +3 -3
  32. package/runtime/.next/server/app/api/flow/v1/runs/route.js +1 -1
  33. package/runtime/.next/server/app/api/flow-studio/config/route.js +1 -1
  34. package/runtime/.next/server/app/api/mcp/connect/route.js +1 -1
  35. package/runtime/.next/server/app/api/mcp/disconnect/route.js +1 -1
  36. package/runtime/.next/server/app/api/mcp/servers/route.js +1 -1
  37. package/runtime/.next/server/app/api/memory/[key]/route.js +1 -1
  38. package/runtime/.next/server/app/api/memory/route.js +1 -1
  39. package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
  40. package/runtime/.next/server/app/api/projects/[id]/route.js +1 -1
  41. package/runtime/.next/server/app/api/projects/check/route.js +1 -1
  42. package/runtime/.next/server/app/api/projects/directories/route.js +1 -1
  43. package/runtime/.next/server/app/api/projects/roots/route.js +1 -1
  44. package/runtime/.next/server/app/api/projects/route.js +1 -1
  45. package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
  46. package/runtime/.next/server/app/api/push/unsubscribe/route.js +3 -3
  47. package/runtime/.next/server/app/api/push/vapid/route.js +2 -2
  48. package/runtime/.next/server/app/api/push/vapid.body +1 -1
  49. package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
  50. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/route.js +1 -1
  51. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/stop/route.js +1 -1
  52. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/route.js +1 -1
  53. package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +2 -2
  54. package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
  55. package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -1
  56. package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
  57. package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
  58. package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js +1 -1
  59. package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
  60. package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
  61. package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
  62. package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
  63. package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
  64. package/runtime/.next/server/app/api/sessions/route.js +1 -1
  65. package/runtime/.next/server/app/api/settings/route.js +1 -1
  66. package/runtime/.next/server/app/api/skills/route.js +1 -1
  67. package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
  68. package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
  69. package/runtime/.next/server/app/api/tools/route.js +1 -1
  70. package/runtime/.next/server/app/api/update/check/route.js +1 -1
  71. package/runtime/.next/server/app/api/update/install/route.js +1 -1
  72. package/runtime/.next/server/app/api/update/status/route.js +1 -1
  73. package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
  74. package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
  75. package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
  76. package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
  77. package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
  78. package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
  79. package/runtime/.next/server/app/api/web-console/computer-settings/route.js +1 -1
  80. package/runtime/.next/server/app/api/web-console/computers/route.js +1 -1
  81. package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
  82. package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
  83. package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
  84. package/runtime/.next/server/app/web/page.js +4 -4
  85. package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
  86. package/runtime/.next/server/app-paths-manifest.json +33 -33
  87. package/runtime/.next/server/chunks/5303.js +2 -2
  88. package/runtime/.next/server/middleware-build-manifest.js +1 -1
  89. package/runtime/.next/server/pages/404.html +1 -1
  90. package/runtime/.next/server/pages/500.html +1 -1
  91. package/runtime/.next/server/server-reference-manifest.json +1 -1
  92. package/runtime/.next/static/chunks/app/web/{error-3acef50d100c88cd.js → error-6470e38a145095eb.js} +1 -1
  93. package/runtime/.next/static/chunks/app/web/layout-ecfb758d244808a4.js +1 -0
  94. package/runtime/.next/static/chunks/app/web/{page-cd202c384ebf79be.js → page-27145471bd2171c2.js} +1 -1
  95. package/runtime/.next/static/chunks/{main-app-1722010a0ff567d7.js → main-app-41078426602904fd.js} +1 -1
  96. package/runtime/lib/tunnel-control.mjs +32 -0
  97. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/MacOS/agentroam-remote-desktop +0 -0
  98. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/Resources/agentroam-component.json +1 -1
  99. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/_CodeSignature/CodeResources +2 -2
  100. package/runtime/node_modules/.package-lock.json +20 -20
  101. package/runtime/node_modules/@agent/core/dist/index.js +13 -3
  102. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +75 -73
  103. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +42 -40
  104. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-07pvccxf.mjs +43 -0
  105. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-kzw924e6.mjs → core-0rjxgk9e.mjs} +3 -3
  106. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-fpeb751h.mjs +33 -0
  107. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-bb8r6h44.mjs → core-jf0rbr11.mjs} +1 -1
  108. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +9 -9
  109. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +19 -21
  110. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +23 -25
  111. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +14 -14
  112. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +61 -57
  113. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.cjs +29701 -29485
  114. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.cjs +20 -20
  115. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.mjs +20 -20
  116. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.mjs +29701 -29485
  117. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.node.cjs +28904 -28688
  118. package/runtime/node_modules/mediabunny/dist/modules/src/codec-data.js +6 -0
  119. package/runtime/node_modules/mediabunny/dist/modules/src/codec.js +35 -0
  120. package/runtime/node_modules/mediabunny/dist/modules/src/conversion.js +90 -13
  121. package/runtime/node_modules/mediabunny/dist/modules/src/id3.js +6 -0
  122. package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-boxes.js +23 -3
  123. package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-demuxer.js +12 -3
  124. package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-misc.js +1 -0
  125. package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-muxer.js +29 -6
  126. package/runtime/node_modules/mediabunny/dist/modules/src/matroska/ebml.js +9 -0
  127. package/runtime/node_modules/mediabunny/dist/modules/src/matroska/matroska-demuxer.js +10 -1
  128. package/runtime/node_modules/mediabunny/dist/modules/src/matroska/matroska-muxer.js +16 -2
  129. package/runtime/node_modules/mediabunny/dist/modules/src/media-source.js +59 -36
  130. package/runtime/node_modules/mediabunny/dist/modules/src/metadata.js +5 -0
  131. package/runtime/node_modules/mediabunny/dist/modules/src/output-format.js +10 -0
  132. package/runtime/node_modules/mediabunny/dist/modules/src/sample.js +1 -1
  133. package/runtime/node_modules/mediabunny/dist/modules/src/tsconfig.tsbuildinfo +1 -1
  134. package/runtime/node_modules/mediabunny/dist/modules/src/version.js +1 -1
  135. package/runtime/node_modules/mediabunny/dist/modules/src/wave/wave-muxer.js +1 -0
  136. package/runtime/node_modules/mediabunny/package.json +1 -1
  137. package/runtime/node_modules/mediabunny/src/codec-data.ts +4 -0
  138. package/runtime/node_modules/mediabunny/src/codec.ts +38 -0
  139. package/runtime/node_modules/mediabunny/src/conversion.ts +128 -16
  140. package/runtime/node_modules/mediabunny/src/id3.ts +4 -0
  141. package/runtime/node_modules/mediabunny/src/isobmff/isobmff-boxes.ts +24 -4
  142. package/runtime/node_modules/mediabunny/src/isobmff/isobmff-demuxer.ts +18 -3
  143. package/runtime/node_modules/mediabunny/src/isobmff/isobmff-misc.ts +2 -0
  144. package/runtime/node_modules/mediabunny/src/isobmff/isobmff-muxer.ts +39 -7
  145. package/runtime/node_modules/mediabunny/src/matroska/ebml.ts +11 -0
  146. package/runtime/node_modules/mediabunny/src/matroska/matroska-demuxer.ts +11 -0
  147. package/runtime/node_modules/mediabunny/src/matroska/matroska-muxer.ts +20 -2
  148. package/runtime/node_modules/mediabunny/src/media-source.ts +77 -52
  149. package/runtime/node_modules/mediabunny/src/metadata.ts +13 -0
  150. package/runtime/node_modules/mediabunny/src/output-format.ts +13 -1
  151. package/runtime/node_modules/mediabunny/src/sample.ts +1 -1
  152. package/runtime/node_modules/mediabunny/src/version.ts +1 -1
  153. package/runtime/node_modules/mediabunny/src/wave/wave-muxer.ts +2 -1
  154. package/runtime/node_modules/tslib/README.md +3 -8
  155. package/runtime/node_modules/tslib/package.json +1 -1
  156. package/runtime/node_modules/tslib/tslib.es6.js +10 -1
  157. package/runtime/node_modules/tslib/tslib.es6.mjs +10 -1
  158. package/runtime/node_modules/tslib/tslib.js +10 -1
  159. package/runtime/node_modules/ws/README.md +21 -29
  160. package/runtime/node_modules/ws/lib/buffer-util.js +13 -2
  161. package/runtime/node_modules/ws/lib/sender.js +4 -1
  162. package/runtime/node_modules/ws/lib/websocket.js +8 -3
  163. package/runtime/node_modules/ws/package.json +1 -1
  164. package/runtime/package-lock.json +44 -44
  165. package/runtime/server.js +1 -1
  166. package/runtime/webapp/dist/assets/{AiHubPane-BQ8CJAQL.js → AiHubPane-Cp_tNJNR.js} +1 -1
  167. package/runtime/webapp/dist/assets/App-Cs8U1u-X.js +175 -0
  168. package/runtime/webapp/dist/assets/App-QWoPBMW0.css +1 -0
  169. package/runtime/webapp/dist/assets/{BrowserLivePanel-DxhSUu4j.js → BrowserLivePanel-B1zYRS_7.js} +1 -1
  170. package/runtime/webapp/dist/assets/{CollaborationDashboard-c_iNusPf.js → CollaborationDashboard-DIVa26zk.js} +1 -1
  171. package/runtime/webapp/dist/assets/{CollaborationPage-DRBPK_iH.js → CollaborationPage-Fsvkw8ZM.js} +1 -1
  172. package/runtime/webapp/dist/assets/{FilePreview-DScFSi_K.js → FilePreview-BjbfWw2s.js} +3 -3
  173. package/runtime/webapp/dist/assets/{FileTree-BB5xTMg6.js → FileTree-C6gg9p4m.js} +1 -1
  174. package/runtime/webapp/dist/assets/{FlowStudioPane-BBf0zyw1.js → FlowStudioPane-CCuxZBVJ.js} +1 -1
  175. package/runtime/webapp/dist/assets/{RemoteDesktopPage-CWW4T1QF.js → RemoteDesktopPage-DpoYuKhA.js} +1 -1
  176. package/runtime/webapp/dist/assets/SessionDashboard-CAoW5-uN.css +1 -0
  177. package/runtime/webapp/dist/assets/SessionDashboard-DOWjUIY1.js +26 -0
  178. package/runtime/webapp/dist/assets/SessionDashboardBridge-DYsMZhuH.js +1 -0
  179. package/runtime/webapp/dist/assets/{TerminalPane-DkEyD1ge.js → TerminalPane-CPOiBcye.js} +1 -1
  180. package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-Dlsyu96y.js → abnfDiagram-VCTEODGH-DCFFqJUU.js} +1 -1
  181. package/runtime/webapp/dist/assets/{arc-D0AvBRtK.js → arc-vjNW9DYV.js} +1 -1
  182. package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-BLAHjBcI.js → architectureDiagram-5GKGNRK7-DoK3A_n1.js} +1 -1
  183. package/runtime/webapp/dist/assets/{arrow-right-B15rGLIR.js → arrow-right-B0uCZ1Pd.js} +1 -1
  184. package/runtime/webapp/dist/assets/{artifact-links-BkoUldDR.js → artifact-links-nzx7joYs.js} +1 -1
  185. package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-CqIb0xz-.js → blockDiagram-I7D4REHJ-DgXszyX7.js} +1 -1
  186. package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-CG98ZTHr.js → c4Diagram-7LVT6UL2-q7KO4v1Q.js} +1 -1
  187. package/runtime/webapp/dist/assets/channel-CsnhvX8S.js +1 -0
  188. package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-DQh8kgcp.js → chunk-2Q5K7J3B-CH8lOKmL.js} +1 -1
  189. package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-BesfCxeX.js → chunk-5VM5RSS4-DwP7xEWd.js} +1 -1
  190. package/runtime/webapp/dist/assets/{chunk-F27PBJKO-BCXEjgx-.js → chunk-F27PBJKO-BV3TTaxI.js} +1 -1
  191. package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-ydMd7mT-.js → chunk-IMKFNOWR-BbaiG4yG.js} +1 -1
  192. package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-K3_myO-F.js → chunk-JWPE2WC7-Dv9x27hI.js} +1 -1
  193. package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-BtqLafwd.js → chunk-POPQ4Y6H-Uk-GiSLP.js} +1 -1
  194. package/runtime/webapp/dist/assets/{chunk-SVP7TREG-mKZUbHcv.js → chunk-SVP7TREG-lFcKEwyL.js} +1 -1
  195. package/runtime/webapp/dist/assets/{chunk-TICWLB2K-hDH9_eNh.js → chunk-TICWLB2K-DFZALWPC.js} +1 -1
  196. package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-B6wXA24N.js → chunk-XXDRQBXY-8jLPZkMb.js} +1 -1
  197. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-Bed40USf.js +1 -0
  198. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-Bed40USf.js +1 -0
  199. package/runtime/webapp/dist/assets/{clipboard-CrmYgzo8.js → clipboard-BteN9-AC.js} +1 -1
  200. package/runtime/webapp/dist/assets/{codeSyntax-KyRYSqw_.js → codeSyntax-Dgv0FfoZ.js} +1 -1
  201. package/runtime/webapp/dist/assets/{collaboration-B7rPFZje.js → collaboration-f29NaKWy.js} +1 -1
  202. package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-MoeyZZ6x.js → cose-bilkent-JH36ORCC-86P-lxD4.js} +1 -1
  203. package/runtime/webapp/dist/assets/{crown-BKylWZLt.js → crown-y1qmM0NZ.js} +1 -1
  204. package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-BWYtTqVq.js → cynefin-OW5HDTMX-mtRVdchl.js} +1 -1
  205. package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-CoqnJ7eo.js → cynefinDiagram-5FMLGOSQ-DhqAIoq6.js} +1 -1
  206. package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-DMwZ_7F7.js → dagre-GXQ25YYZ-DD9olCTy.js} +1 -1
  207. package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-DJ2BAyzP.js → diagram-S7CK7UJ4-CLGKipLp.js} +1 -1
  208. package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-ChujnpjG.js → diagram-UQ7AKVKN-Dm7uGpUO.js} +1 -1
  209. package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-CDSAKYID.js → diagram-VSXAHHWV-OZYfwAth.js} +1 -1
  210. package/runtime/webapp/dist/assets/{diagram-VX7I27RA-DXvCy8w-.js → diagram-VX7I27RA-BpQqNFxQ.js} +1 -1
  211. package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-BWrKegI9.js → diagram-Z3DM3KII-BrWsMYCU.js} +1 -1
  212. package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-CqDhPmpp.js → ebnfDiagram-PWID7BFC-BRH-K-J7.js} +1 -1
  213. package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-D5HR9ddP.js → erDiagram-RLTQ6QDP-BDNSVr6H.js} +1 -1
  214. package/runtime/webapp/dist/assets/{file-types-D_egQYAD.js → file-types-XHMBkbNr.js} +1 -1
  215. package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-Bz89eEJ2.js → flowDiagram-HODETNUW-DseLK02Y.js} +1 -1
  216. package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-Bw1lo_RG.js → ganttDiagram-EL5Y4UJY-v_uNZx1g.js} +1 -1
  217. package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-CMxwIm3p.js → gitGraphDiagram-WWUBYQGX-EdvVYEMk.js} +1 -1
  218. package/runtime/webapp/dist/assets/{index-CkVSxxim.js → index--zKd3rTs.js} +49 -49
  219. package/runtime/webapp/dist/assets/{index-6B8SDnzK.css → index-D0gsdpeQ.css} +1 -1
  220. package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-DEWyQUst.js → infoDiagram-27XIBGKW-Ck26xp1i.js} +1 -1
  221. package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-BfJdGhe_.js → ishikawaDiagram-5VMMS53U-DGnOVObq.js} +1 -1
  222. package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-C6gh2ejc.js → journeyDiagram-3NMN7TZE-S7oKAQs8.js} +1 -1
  223. package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-1UHi9Lfv.js → kanban-definition-UXKFOSKX-DcrYA4VY.js} +1 -1
  224. package/runtime/webapp/dist/assets/{layout-CKq-cSTm.js → layout-CYHINS_I.js} +1 -1
  225. package/runtime/webapp/dist/assets/{linear-DF4sJk10.js → linear-B-lEfto_.js} +1 -1
  226. package/runtime/webapp/dist/assets/{loader-circle-Dpjix4wZ.js → loader-circle-DMWQZenY.js} +1 -1
  227. package/runtime/webapp/dist/assets/{mermaid.core-OAHUFl3p.js → mermaid.core-B3fzlEw9.js} +5 -5
  228. package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-JiyyEKeC.js → mindmap-definition-YA3MSWOX-wJkCh55V.js} +1 -1
  229. package/runtime/webapp/dist/assets/{page-DqgtSgo3.js → page-Cc56wyOt.js} +8 -13
  230. package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-CpBwPi33.js → pegDiagram-XKGWAZYB-H4uk2OUO.js} +1 -1
  231. package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-BjM_PcYH.js → pieDiagram-E7YTZNPT-yLnU_MCb.js} +1 -1
  232. package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-Vdz77obz.js → quadrantDiagram-AXDQQJYC-DyD93O4P.js} +1 -1
  233. package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-DsQjNf1f.js → railroadDiagram-O6MQD6OU-DZ833xbw.js} +1 -1
  234. package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-TpfT8TjT.js → requirementDiagram-BXWQKSXE-DJV4nGui.js} +1 -1
  235. package/runtime/webapp/dist/assets/{rotate-ccw-wJiVuYlm.js → rotate-ccw-CKqo62Ra.js} +1 -1
  236. package/runtime/webapp/dist/assets/{rotate-cw-CtpBETpM.js → rotate-cw-D-M3ZDSa.js} +1 -1
  237. package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-Ckh_skQw.js → sankeyDiagram-P5KCCOFB-BeOYMFTR.js} +1 -1
  238. package/runtime/webapp/dist/assets/{send-DL0qj0xE.js → send-LvtpJMkk.js} +1 -1
  239. package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-CkKC0JEA.js → sequenceDiagram-WJ2MYXX4-BBcgqG33.js} +1 -1
  240. package/runtime/webapp/dist/assets/{shield-check-B5q8YhWs.js → shield-check-SeEkz1Nd.js} +1 -1
  241. package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-DB_NzdXU.js → sizeCapture-INFHLROL-B0GJZjw0.js} +1 -1
  242. package/runtime/webapp/dist/assets/{smartphone-DJEfFl42.js → smartphone-D7oS3YTz.js} +11 -6
  243. package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-Ch2r76jY.js → stateDiagram-D77RDMKH-BmSvB3vd.js} +1 -1
  244. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-CQ9wpJCJ.js +1 -0
  245. package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-BBMlDhHH.js → swimlanes-42K2YHIH-BAZdMUD6.js} +1 -1
  246. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-8XTJp3Fr.js +8 -0
  247. package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-BELJuISI.js → timeline-definition-24CTP7MA-BSgVFMNG.js} +1 -1
  248. package/runtime/webapp/dist/assets/{trash-2-D4LqA3q5.js → trash-2-CHYPyYDY.js} +1 -1
  249. package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-NSlXdmyy.js → vennDiagram-4TSXK5OY-C-brvbkB.js} +1 -1
  250. package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-BVbNDhZr.js → wardleyDiagram-VM6X3IG4-CeqqVR1s.js} +1 -1
  251. package/runtime/webapp/dist/assets/{web-CoxxvfFh.js → web-Dzd7NW_F.js} +1 -1
  252. package/runtime/webapp/dist/assets/{web-BpA_VIiS.js → web-aLPH3xFw.js} +1 -1
  253. package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-Bt3XghTc.js → xychartDiagram-S5SC5T6Z-mPizwpXM.js} +1 -1
  254. package/runtime/webapp/dist/index.html +2 -2
  255. package/runtime/ws-server.mjs +4 -0
  256. package/runtime/.next/static/chunks/app/web/layout-8ec7c101bbab1dc2.js +0 -1
  257. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-a9vq6p1m.mjs +0 -31
  258. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-t4mxrz5y.mjs +0 -43
  259. package/runtime/webapp/dist/assets/App-CdrKKs1h.css +0 -1
  260. package/runtime/webapp/dist/assets/App-GXFFBAhW.js +0 -174
  261. package/runtime/webapp/dist/assets/SessionDashboard-BdGlakPd.js +0 -26
  262. package/runtime/webapp/dist/assets/SessionDashboard-CUCEDkCI.css +0 -1
  263. package/runtime/webapp/dist/assets/SessionDashboardBridge-8zrk0Bub.js +0 -1
  264. package/runtime/webapp/dist/assets/channel-Bw3F6pJc.js +0 -1
  265. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-By2XJYuW.js +0 -1
  266. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-By2XJYuW.js +0 -1
  267. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-BCjtOHJv.js +0 -1
  268. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-CYzCynNs.js +0 -8
  269. /package/runtime/.next/static/{Ow_KjPn75TzR7WqdD4P9x → mGwTFWK2dzlY3HjsjZGzh}/_buildManifest.js +0 -0
  270. /package/runtime/.next/static/{Ow_KjPn75TzR7WqdD4P9x → mGwTFWK2dzlY3HjsjZGzh}/_ssgManifest.js +0 -0
@@ -10,6 +10,7 @@ import {
10
10
  AUDIO_CODECS,
11
11
  AudioCodec,
12
12
  MediaCodec,
13
+ getMinimumAudioPacketSize,
13
14
  NON_PCM_AUDIO_CODECS,
14
15
  VIDEO_CODECS,
15
16
  VideoCodec,
@@ -146,7 +147,7 @@ export type ConversionOptions = {
146
147
  * should be written to the output file. If a function is passed, it will be passed the tags of the input file as
147
148
  * its first argument, allowing you to modify, augment or extend them.
148
149
  *
149
- * If no function is set, the input's metadata tags will be copied to the output.
150
+ * If no function is set, the input's metadata tags will be copied to the output (excluding `creationTime`).
150
151
  */
151
152
  tags?: MetadataTags | ((inputTags: MetadataTags) => MaybePromise<MetadataTags>);
152
153
 
@@ -295,6 +296,13 @@ export type ConversionVideoOptions = {
295
296
  * matches the input track pairability graph.
296
297
  */
297
298
  group?: OutputTrackGroup | OutputTrackGroup[];
299
+ /**
300
+ * Sets {@link BaseTrackMetadata.maximumPacketCount} for the output track. Only relevant when the output format
301
+ * requires it (see {@link OutputFormat.requiresMaximumPacketCount}), in which case it is otherwise estimated
302
+ * automatically. Set this field when the estimate doesn't work for you, for example when `process` returns more
303
+ * than one frame per input frame. Required for live input tracks when no trim end is set.
304
+ */
305
+ maximumPacketCount?: number;
298
306
  };
299
307
 
300
308
  /**
@@ -358,6 +366,13 @@ export type ConversionAudioOptions = {
358
366
  * matches the input track pairability graph.
359
367
  */
360
368
  group?: OutputTrackGroup | OutputTrackGroup[];
369
+ /**
370
+ * Sets {@link BaseTrackMetadata.maximumPacketCount} for the output track. Only relevant when the output format
371
+ * requires it (see {@link OutputFormat.requiresMaximumPacketCount}), in which case it is otherwise estimated
372
+ * automatically. Set this field when the estimate doesn't work for you, for example when using a custom encoder
373
+ * that produces unusually short packets. Required for live input tracks when no trim end is set.
374
+ */
375
+ maximumPacketCount?: number;
361
376
  };
362
377
 
363
378
  /**
@@ -527,6 +542,12 @@ const validateVideoOptions = (videoOptions: ConversionVideoOptions) => {
527
542
  'options.video.group, when provided, must be an OutputTrackGroup or an array of OutputTrackGroups.',
528
543
  );
529
544
  }
545
+ if (
546
+ videoOptions?.maximumPacketCount !== undefined
547
+ && (!Number.isInteger(videoOptions.maximumPacketCount) || videoOptions.maximumPacketCount < 0)
548
+ ) {
549
+ throw new TypeError('options.video.maximumPacketCount, when provided, must be a non-negative integer.');
550
+ }
530
551
  };
531
552
 
532
553
  const validateAudioOptions = (audioOptions: ConversionAudioOptions) => {
@@ -599,10 +620,17 @@ const validateAudioOptions = (audioOptions: ConversionAudioOptions) => {
599
620
  'options.audio.group, when provided, must be an OutputTrackGroup or an array of OutputTrackGroups.',
600
621
  );
601
622
  }
623
+ if (
624
+ audioOptions?.maximumPacketCount !== undefined
625
+ && (!Number.isInteger(audioOptions.maximumPacketCount) || audioOptions.maximumPacketCount < 0)
626
+ ) {
627
+ throw new TypeError('options.audio.maximumPacketCount, when provided, must be a non-negative integer.');
628
+ }
602
629
  };
603
630
 
604
631
  const FALLBACK_NUMBER_OF_CHANNELS = 2;
605
632
  const FALLBACK_SAMPLE_RATE = 48000;
633
+ const PACKET_STATS_PACKET_COUNT = 256;
606
634
 
607
635
  /**
608
636
  * An input track that was discarded (excluded) from a {@link Conversion} alongside the discard reason.
@@ -627,6 +655,8 @@ export type DiscardedTrack = {
627
655
  * you requested a codec that cannot be contained within the output format.
628
656
  * - `'cannot_copy'`: {@link ConversionCopyOptions.mode} was set to `'forced'` but the track could not be copied
629
657
  * with the given copy configuration because it would require a transcode instead.
658
+ * - `'unknown_maximum_packet_count'`: The output format requires a maximum packet count, but it can't be estimated
659
+ * because the track is live and no trim end is set. Set it manually using the `maximumPacketCount` track option.
630
660
  */
631
661
  reason:
632
662
  | 'discarded_by_user'
@@ -635,7 +665,8 @@ export type DiscardedTrack = {
635
665
  | 'unknown_source_codec'
636
666
  | 'undecodable_source_codec'
637
667
  | 'no_encodable_target_codec'
638
- | 'cannot_copy';
668
+ | 'cannot_copy'
669
+ | 'unknown_maximum_packet_count';
639
670
  /** The options that were provided for this track, or `{}` if none were provided. */
640
671
  trackOptions: ConversionVideoOptions | ConversionAudioOptions;
641
672
  };
@@ -703,6 +734,8 @@ export class Conversion {
703
734
  _copyTimestampPossible = new Map<InputTrack, boolean>();
704
735
  /** @internal */
705
736
  _copyStartPackets = new Map<InputTrack, EncodedPacket | null>();
737
+ /** @internal */
738
+ _trackDurations = new Map<InputTrack, Promise<number>>();
706
739
 
707
740
  /** @internal */
708
741
  _nextOutputTrackId = 0;
@@ -1126,7 +1159,8 @@ export class Conversion {
1126
1159
  // remains the responsibility of whoever owns the output.
1127
1160
 
1128
1161
  if (!this._composable) {
1129
- const inputTags = await this.input.getMetadataTags();
1162
+ const inputTags = { ...await this.input.getMetadataTags() };
1163
+ delete inputTags.creationTime; // Makes no sense to inherit this one
1130
1164
  let outputTags: MetadataTags;
1131
1165
 
1132
1166
  if (this._options.tags) {
@@ -1345,13 +1379,7 @@ export class Conversion {
1345
1379
  if (this.onProgress) {
1346
1380
  // Compute duration using only the utilized tracks
1347
1381
  const uniqueUtilizedTracks = new Set(this.utilizedTracks);
1348
- const durationPromises = [...uniqueUtilizedTracks].map(async (track) => {
1349
- if (await track.isLive()) {
1350
- return Infinity; // Upper bound (assuming no universe heat death)
1351
- }
1352
-
1353
- return (await track.getDurationFromMetadata()) ?? (await track.computeDuration());
1354
- });
1382
+ const durationPromises = [...uniqueUtilizedTracks].map(track => this._getTrackDuration(track));
1355
1383
  const duration = Math.max(0, ...await Promise.all(durationPromises));
1356
1384
 
1357
1385
  this._computeProgress = true;
@@ -1457,6 +1485,20 @@ export class Conversion {
1457
1485
  return;
1458
1486
  }
1459
1487
 
1488
+ if (
1489
+ this.output.format.requiresMaximumPacketCount
1490
+ && trackOptions.maximumPacketCount === undefined
1491
+ && this._endTimestamp === Infinity
1492
+ && await track.isLive()
1493
+ ) {
1494
+ this.discardedTracks.push({
1495
+ track,
1496
+ reason: 'unknown_maximum_packet_count',
1497
+ trackOptions,
1498
+ });
1499
+ return;
1500
+ }
1501
+
1460
1502
  let videoSource: VideoSource;
1461
1503
 
1462
1504
  const innateRotation = await track.getRotation();
@@ -1906,6 +1948,18 @@ export class Conversion {
1906
1948
  const averageBitrate = needsTranscode ? null : await track.getAverageBitrate();
1907
1949
  const canBeTransparent = alpha === 'keep' && await track.canBeTransparent();
1908
1950
 
1951
+ let maximumPacketCount = trackOptions.maximumPacketCount;
1952
+ if (this.output.format.requiresMaximumPacketCount && maximumPacketCount === undefined) {
1953
+ // Frames map 1:1 to packets, so the input's packet rate is a good stand-in unless the frame rate is changed
1954
+ const packetRate = trackOptions.frameRate
1955
+ ?? (await track.computePacketStats(PACKET_STATS_PACKET_COUNT)).averagePacketRate;
1956
+ const startTimestamp = needsTranscode
1957
+ ? this._startTimestamp
1958
+ : copyStartPacket?.timestamp ?? this._startTimestamp;
1959
+
1960
+ maximumPacketCount = await this._estimateMaximumPacketCount(track, startTimestamp, packetRate);
1961
+ }
1962
+
1909
1963
  this.output.addVideoTrack(videoSource, {
1910
1964
  frameRate: trackOptions.frameRate,
1911
1965
  // TODO: This condition can be removed when all demuxers properly homogenize to BCP47 in v2
@@ -1921,6 +1975,7 @@ export class Conversion {
1921
1975
  group: ownGroup ?? trackOptions.group,
1922
1976
  bitrate: bitrate ?? undefined,
1923
1977
  averageBitrate: averageBitrate ?? undefined,
1978
+ maximumPacketCount,
1924
1979
  });
1925
1980
 
1926
1981
  this.utilizedTracks.push(track);
@@ -1940,6 +1995,20 @@ export class Conversion {
1940
1995
  return;
1941
1996
  }
1942
1997
 
1998
+ if (
1999
+ this.output.format.requiresMaximumPacketCount
2000
+ && trackOptions.maximumPacketCount === undefined
2001
+ && this._endTimestamp === Infinity
2002
+ && await track.isLive()
2003
+ ) {
2004
+ this.discardedTracks.push({
2005
+ track,
2006
+ reason: 'unknown_maximum_packet_count',
2007
+ trackOptions,
2008
+ });
2009
+ return;
2010
+ }
2011
+
1943
2012
  let audioSource: AudioSource;
1944
2013
 
1945
2014
  const originalNumberOfChannels = await track.getNumberOfChannels();
@@ -1947,6 +2016,7 @@ export class Conversion {
1947
2016
 
1948
2017
  let numberOfChannels = trackOptions.numberOfChannels ?? originalNumberOfChannels;
1949
2018
  let sampleRate = trackOptions.sampleRate ?? originalSampleRate;
2019
+ let outputCodec: AudioCodec | null = null;
1950
2020
 
1951
2021
  let audioCodecs = this.output.format.getSupportedAudioCodecs();
1952
2022
 
@@ -2134,8 +2204,6 @@ export class Conversion {
2134
2204
  return;
2135
2205
  }
2136
2206
 
2137
- let codecOfChoice: AudioCodec | null = null;
2138
-
2139
2207
  if (trackOptions.codec) {
2140
2208
  audioCodecs = audioCodecs.filter(codec => codec === trackOptions.codec);
2141
2209
  }
@@ -2173,15 +2241,15 @@ export class Conversion {
2173
2241
  .find(codec => (NON_PCM_AUDIO_CODECS as readonly string[]).includes(codec));
2174
2242
  if (nonPcmCodec) {
2175
2243
  // We are able to encode using a non-PCM codec, but it'll require resampling
2176
- codecOfChoice = nonPcmCodec;
2244
+ outputCodec = nonPcmCodec;
2177
2245
  numberOfChannels = FALLBACK_NUMBER_OF_CHANNELS;
2178
2246
  sampleRate = FALLBACK_SAMPLE_RATE;
2179
2247
  }
2180
2248
  } else {
2181
- codecOfChoice = encodableCodecs[0] ?? null;
2249
+ outputCodec = encodableCodecs[0] ?? null;
2182
2250
  }
2183
2251
 
2184
- if (codecOfChoice === null) {
2252
+ if (outputCodec === null) {
2185
2253
  this.discardedTracks.push({
2186
2254
  track,
2187
2255
  reason: 'no_encodable_target_codec',
@@ -2191,7 +2259,7 @@ export class Conversion {
2191
2259
  }
2192
2260
 
2193
2261
  const encodingConfig: AudioEncodingConfig = {
2194
- codec: codecOfChoice,
2262
+ codec: outputCodec,
2195
2263
  quality,
2196
2264
  transform: {
2197
2265
  sampleFormat: trackOptions.sampleFormat,
@@ -2316,6 +2384,23 @@ export class Conversion {
2316
2384
  const bitrate = needsTranscode ? null : await track.getBitrate();
2317
2385
  const averageBitrate = needsTranscode ? null : await track.getAverageBitrate();
2318
2386
 
2387
+ let maximumPacketCount = trackOptions.maximumPacketCount;
2388
+ if (this.output.format.requiresMaximumPacketCount && maximumPacketCount === undefined) {
2389
+ let packetRate: number;
2390
+ if (needsTranscode) {
2391
+ assert(outputCodec);
2392
+ packetRate = sampleRate / getMinimumAudioPacketSize(outputCodec, sampleRate);
2393
+ } else {
2394
+ packetRate = (await track.computePacketStats(PACKET_STATS_PACKET_COUNT)).averagePacketRate;
2395
+ }
2396
+
2397
+ const startTimestamp = needsTranscode
2398
+ ? this._startTimestamp
2399
+ : copyStartPacket?.timestamp ?? this._startTimestamp;
2400
+
2401
+ maximumPacketCount = await this._estimateMaximumPacketCount(track, startTimestamp, packetRate);
2402
+ }
2403
+
2319
2404
  this.output.addAudioTrack(audioSource, {
2320
2405
  // TODO: This condition can be removed when all demuxers properly homogenize to BCP47 in v2
2321
2406
  languageCode: isIso639Dash2LanguageCode(audioTrackLanguageCode)
@@ -2326,6 +2411,7 @@ export class Conversion {
2326
2411
  group: ownGroup ?? trackOptions.group,
2327
2412
  bitrate: bitrate ?? undefined,
2328
2413
  averageBitrate: averageBitrate ?? undefined,
2414
+ maximumPacketCount,
2329
2415
  });
2330
2416
 
2331
2417
  this.utilizedTracks.push(track);
@@ -2333,6 +2419,32 @@ export class Conversion {
2333
2419
  this._outputOwnTrackGroups.push(ownGroup);
2334
2420
  }
2335
2421
 
2422
+ /** @internal */
2423
+ async _estimateMaximumPacketCount(track: InputTrack, startTimestamp: number, packetRate: number) {
2424
+ const endTimestamp = Math.min(await this._getTrackDuration(track), this._endTimestamp);
2425
+ const duration = Math.max(endTimestamp - startTimestamp, 0);
2426
+
2427
+ // Let's give this a generous margin
2428
+ return Math.ceil(1.5 * packetRate * duration) + 64;
2429
+ }
2430
+
2431
+ /** @internal */
2432
+ _getTrackDuration(track: InputTrack) {
2433
+ let promise = this._trackDurations.get(track);
2434
+ if (!promise) {
2435
+ promise = (async () => {
2436
+ if (await track.isLive()) {
2437
+ return Infinity; // Upper bound (assuming no universe heat death)
2438
+ }
2439
+
2440
+ return (await track.getDurationFromMetadata()) ?? (await track.computeDuration());
2441
+ })();
2442
+ this._trackDurations.set(track, promise);
2443
+ }
2444
+
2445
+ return promise;
2446
+ }
2447
+
2336
2448
  /** @internal */
2337
2449
  async _registerAudioSample(
2338
2450
  pump: TrackPump,
@@ -798,6 +798,10 @@ export class Id3V2Writer {
798
798
  // Handled later
799
799
  }; break;
800
800
 
801
+ case 'creationTime': {
802
+ // Not supported in ID3
803
+ }; break;
804
+
801
805
  default: {
802
806
  assertNever(key);
803
807
  }
@@ -1348,14 +1348,18 @@ export const ctts = (trackData: IsobmffTrackData) => {
1348
1348
  * Composition to Decode Box: Stores information about the composition and display times of the media samples.
1349
1349
  */
1350
1350
  export const cslg = (trackData: IsobmffTrackData) => {
1351
+ assert(trackData.compositionTimeOffsetTable.length > 0);
1352
+
1353
+ if (trackData.samples.length === 0) {
1354
+ // Happens when the moov is measured before any samples have been added
1355
+ return null;
1356
+ }
1357
+
1351
1358
  let leastDecodeToDisplayDelta = Infinity;
1352
1359
  let greatestDecodeToDisplayDelta = -Infinity;
1353
1360
  let compositionStartTime = Infinity;
1354
1361
  let compositionEndTime = -Infinity;
1355
1362
 
1356
- assert(trackData.compositionTimeOffsetTable.length > 0);
1357
- assert(trackData.samples.length > 0);
1358
-
1359
1363
  for (let i = 0; i < trackData.compositionTimeOffsetTable.length; i++) {
1360
1364
  const entry = trackData.compositionTimeOffsetTable[i]!;
1361
1365
  leastDecodeToDisplayDelta = Math.min(leastDecodeToDisplayDelta, entry.sampleCompositionTimeOffset);
@@ -1738,6 +1742,10 @@ const addQuickTimeMetadataTagBoxes = (boxes: Box[], tags: MetadataTags) => {
1738
1742
  // Handled later
1739
1743
  }; break;
1740
1744
 
1745
+ case 'creationTime': {
1746
+ // Written in the header boxes
1747
+ }; break;
1748
+
1741
1749
  case 'discNumber':
1742
1750
  case 'discsTotal':
1743
1751
  case 'trackNumber':
@@ -1783,6 +1791,10 @@ const DATA_BOX_MIME_TYPE_MAP: Record<string, number> = {
1783
1791
  'image/bmp': 27,
1784
1792
  };
1785
1793
 
1794
+ // FFmpeg parses these assuming a udta layout even when they're not in udta, so we simply skip these if we'd write them
1795
+ // to ilst metadata
1796
+ const ILST_UNSAFE_RAW_KEYS = new Set(['HMMT', 'loci', 'chpl']);
1797
+
1786
1798
  /**
1787
1799
  * Generates key-value metadata for inclusion in the "meta" box.
1788
1800
  */
@@ -1902,6 +1914,10 @@ const generateMetadataPairs = (tags: MetadataTags, isMdta: boolean) => {
1902
1914
  // Handled later
1903
1915
  }; break;
1904
1916
 
1917
+ case 'creationTime': {
1918
+ // Written in the header boxes
1919
+ }; break;
1920
+
1905
1921
  default: assertNever(key);
1906
1922
  }
1907
1923
  }
@@ -1909,7 +1925,11 @@ const generateMetadataPairs = (tags: MetadataTags, isMdta: boolean) => {
1909
1925
  if (tags.raw) {
1910
1926
  for (const key in tags.raw) {
1911
1927
  const value = tags.raw[key];
1912
- if (value == null || (!isMdta && key.length !== 4) || pairs.some(x => x.key === key)) {
1928
+ if (
1929
+ value == null
1930
+ || (!isMdta && (key.length !== 4 || ILST_UNSAFE_RAW_KEYS.has(key)))
1931
+ || pairs.some(x => x.key === key)
1932
+ ) {
1913
1933
  continue;
1914
1934
  }
1915
1935
 
@@ -86,7 +86,13 @@ import {
86
86
  colorSpaceIsComplete,
87
87
  } from '../misc';
88
88
  import { EncodedPacket, PLACEHOLDER_DATA } from '../packet';
89
- import { buildIsobmffMimeType, parsePsshBoxContents, psshBoxesAreEqual, PsshBox } from './isobmff-misc';
89
+ import {
90
+ buildIsobmffMimeType,
91
+ parsePsshBoxContents,
92
+ psshBoxesAreEqual,
93
+ PsshBox,
94
+ TIMESTAMP_OFFSET,
95
+ } from './isobmff-misc';
90
96
  import {
91
97
  MAX_BOX_HEADER_SIZE,
92
98
  MIN_BOX_HEADER_SIZE,
@@ -976,16 +982,25 @@ export class IsobmffDemuxer extends Demuxer {
976
982
  const version = readU8(slice);
977
983
  slice.skip(3); // Flags
978
984
 
985
+ let creationTime: number;
979
986
  if (version === 1) {
980
- slice.skip(8 + 8);
987
+ creationTime = readU64Be(slice);
988
+ slice.skip(8); // Modification time
981
989
  this.movieTimescale = readU32Be(slice);
982
990
  this.movieDurationInTimescale = readU64Be(slice);
983
991
  } else {
984
- slice.skip(4 + 4);
992
+ creationTime = readU32Be(slice);
993
+ slice.skip(4); // Modification time
985
994
  this.movieTimescale = readU32Be(slice);
986
995
  this.movieDurationInTimescale = readU32Be(slice);
987
996
  }
988
997
 
998
+ if (creationTime !== 0) {
999
+ this.metadataTags.creationTime = new Date(1000 * (creationTime - TIMESTAMP_OFFSET));
1000
+ } else {
1001
+ // Assume this means the creation time isn't set (I doubt the file was created in 1904)
1002
+ }
1003
+
989
1004
  if (this.movieTimescale === 0) {
990
1005
  throw new Error('Invalid mvhd box: timescale must not be 0.');
991
1006
  }
@@ -8,6 +8,8 @@
8
8
 
9
9
  import { bytesToHexString, toDataView, uint8ArraysAreEqual } from '../misc';
10
10
 
11
+ export const TIMESTAMP_OFFSET = 2_082_844_800; // Seconds between Jan 1 1904 and Jan 1 1970
12
+
11
13
  export const buildIsobmffMimeType = (info: {
12
14
  isQuickTime: boolean;
13
15
  hasVideo: boolean;
@@ -52,11 +52,10 @@ import {
52
52
  serializeAvcDecoderConfigurationRecord,
53
53
  serializeHevcDecoderConfigurationRecord,
54
54
  } from '../codec-data';
55
- import { buildIsobmffMimeType } from './isobmff-misc';
55
+ import { buildIsobmffMimeType, TIMESTAMP_OFFSET } from './isobmff-misc';
56
56
  import { MAX_BOX_HEADER_SIZE, MIN_BOX_HEADER_SIZE } from './isobmff-reader';
57
57
 
58
58
  export const GLOBAL_TIMESCALE = 57600; // LCM of a bunch of common frame rates (24, 25, 30, 60, 144, ...)
59
- const TIMESTAMP_OFFSET = 2_082_844_800; // Seconds between Jan 1 1904 and Jan 1 1970
60
59
  const MIN_CHUNK_DURATION = 0.5; // In seconds
61
60
 
62
61
  export type Sample = {
@@ -232,7 +231,7 @@ export class IsobmffMuxer extends Muxer {
232
231
  trackDatas: IsobmffTrackData[] = [];
233
232
  private allTracksKnown = promiseWithResolvers();
234
233
 
235
- creationTime = Math.floor(Date.now() / 1000) + TIMESTAMP_OFFSET;
234
+ creationTime!: number;
236
235
  private finalizedChunks: Chunk[] = [];
237
236
 
238
237
  private wroteFragmentedHeader = false;
@@ -260,6 +259,16 @@ export class IsobmffMuxer extends Muxer {
260
259
  async start() {
261
260
  const release = await this.mutex.acquire();
262
261
 
262
+ const creationDate = this.output._metadataTags.creationTime === undefined
263
+ ? new Date()
264
+ : this.output._metadataTags.creationTime;
265
+ this.creationTime = creationDate
266
+ ? Math.floor(creationDate.getTime() / 1000) + TIMESTAMP_OFFSET
267
+ : 0;
268
+ if (creationDate && this.creationTime <= 0) {
269
+ throw new Error('creationTime must be after 1904-01-01T00:00:00Z for MP4/QuickTime files.');
270
+ }
271
+
263
272
  if (!this.isCmaf) {
264
273
  this.writer = await this.output._getRootWriter(target => (
265
274
  this.formatOptions.fastStart !== undefined
@@ -336,6 +345,15 @@ export class IsobmffMuxer extends Muxer {
336
345
  + ' fastStart: \'reserve\'.',
337
346
  );
338
347
  }
348
+
349
+ // Sample counts are stored as u32 in the sample table
350
+ if (track.metadata.maximumPacketCount > 2 ** 32 - 1) {
351
+ throw new Error(
352
+ `Track #${track.id} has a maximumPacketCount of ${track.metadata.maximumPacketCount}, which`
353
+ + ` exceeds the maximum of ${2 ** 32 - 1} packets per track that a non-fragmented file can`
354
+ + ' hold.',
355
+ );
356
+ }
339
357
  }
340
358
 
341
359
  // We'll start writing once we know all tracks
@@ -1524,6 +1542,13 @@ export class IsobmffMuxer extends Muxer {
1524
1542
  upperBound += 4 * n;
1525
1543
  // co64 box - we assume 1 sample per chunk and 64-bit chunk offsets (co64 instead of stco)
1526
1544
  upperBound += 8 * n;
1545
+
1546
+ if (trackData.type === 'audio') {
1547
+ // sgpd box - 1 roll distance per sample, in case each sample's preroll differs from the one before
1548
+ upperBound += 2 * n;
1549
+ // sbgp box - 1 entry per sample, for the same reason
1550
+ upperBound += (4 + 4) * n;
1551
+ }
1527
1552
  }
1528
1553
 
1529
1554
  return upperBound;
@@ -1777,6 +1802,16 @@ export class IsobmffMuxer extends Muxer {
1777
1802
 
1778
1803
  if (this.fastStart === 'reserve') {
1779
1804
  assert(this.ftypSize !== null);
1805
+ const reservedSpace = this.boxWriter.offsets.get(this.mdat)! - this.ftypSize;
1806
+ const moovSize = this.boxWriter.measureBox(movieBox);
1807
+
1808
+ if (moovSize + 8 > reservedSpace) {
1809
+ throw new Error(
1810
+ `The moov box (${moovSize} bytes) plus a free box (8 bytes) exceed the space reserved for them`
1811
+ + ` (${reservedSpace} bytes) with fastStart: 'reserve'. This is a bug; please report it.`,
1812
+ );
1813
+ }
1814
+
1780
1815
  this.writer.seek(this.ftypSize);
1781
1816
 
1782
1817
  if (this.formatOptions.onMoov) {
@@ -1784,10 +1819,7 @@ export class IsobmffMuxer extends Muxer {
1784
1819
  }
1785
1820
 
1786
1821
  this.boxWriter.writeBox(movieBox);
1787
-
1788
- // Fill the remaining space with a free box. If there are less than 8 bytes left, sucks I guess
1789
- const remainingSpace = this.boxWriter.offsets.get(this.mdat)! - this.writer.getPos();
1790
- this.boxWriter.writeBox(free(remainingSpace));
1822
+ this.boxWriter.writeBox(free(reservedSpace - moovSize));
1791
1823
  } else {
1792
1824
  if (this.formatOptions.onMoov) {
1793
1825
  this.writer.startTrackingWrites();
@@ -78,6 +78,7 @@ export enum EBMLId {
78
78
  Duration = 0x4489,
79
79
  Info = 0x1549a966,
80
80
  TimestampScale = 0x2ad7b1,
81
+ DateUTC = 0x4461,
81
82
  MuxingApp = 0x4d80,
82
83
  WritingApp = 0x5741,
83
84
  Tracks = 0x1654ae6b,
@@ -471,6 +472,7 @@ export class EBMLWriter {
471
472
  }
472
473
  }
473
474
 
475
+ export const EBML_DATE_EPOCH = Date.UTC(2001, 0, 1); // In milliseconds since the Unix epoch
474
476
  export const MAX_VAR_INT_SIZE = 8;
475
477
  export const MIN_HEADER_SIZE = 2; // 1-byte ID and 1-byte size
476
478
  export const MAX_HEADER_SIZE = 2 * MAX_VAR_INT_SIZE; // 8-byte ID and 8-byte size
@@ -582,6 +584,15 @@ export const readSignedInt = (slice: FileSlice, width: number) => {
582
584
  return value;
583
585
  };
584
586
 
587
+ export const readSignedBigInt = (slice: FileSlice, width: number) => {
588
+ // Zero width is valid and means zero
589
+ if (width === 0) {
590
+ return 0n;
591
+ }
592
+
593
+ return BigInt.asIntN(8 * width, readUnsignedBigInt(slice, width));
594
+ };
595
+
585
596
  export const readElementId = (slice: FileSlice) => {
586
597
  const size = readVarIntSize(slice);
587
598
  if (size === null) {
@@ -82,6 +82,8 @@ import {
82
82
  resync,
83
83
  searchForNextElementId,
84
84
  readUnsignedBigInt,
85
+ readSignedBigInt,
86
+ EBML_DATE_EPOCH,
85
87
  } from './ebml';
86
88
  import { buildMatroskaMimeType } from './matroska-misc';
87
89
  import { FileSlice, readBytes, Reader, readI16Be, readU8 } from '../reader';
@@ -1114,6 +1116,15 @@ export class MatroskaDemuxer extends Demuxer {
1114
1116
  this.currentSegment.duration = readFloat(slice, size);
1115
1117
  }; break;
1116
1118
 
1119
+ case EBMLId.DateUTC: {
1120
+ if (!this.currentSegment) break;
1121
+
1122
+ const nanoseconds = readSignedBigInt(slice, size);
1123
+ this.currentSegment.metadataTags.creationTime = new Date(
1124
+ EBML_DATE_EPOCH + Number(nanoseconds / 1_000_000n),
1125
+ );
1126
+ }; break;
1127
+
1117
1128
  case EBMLId.TrackEntry: {
1118
1129
  if (!this.currentSegment) break;
1119
1130
 
@@ -35,6 +35,7 @@ import {
35
35
  import {
36
36
  CODEC_STRING_MAP,
37
37
  EBML,
38
+ EBML_DATE_EPOCH,
38
39
  EBMLElement,
39
40
  EBMLFloat32,
40
41
  EBMLFloat64,
@@ -311,11 +312,27 @@ export class MatroskaMuxer extends Muxer {
311
312
  const segmentDuration: EBML = { id: EBMLId.Duration, data: new EBMLFloat64(0) };
312
313
  this.segmentDuration = segmentDuration;
313
314
 
315
+ const creationDate = this.output._metadataTags.creationTime === undefined
316
+ ? new Date()
317
+ : this.output._metadataTags.creationTime;
318
+ let dateUtc: EBML | null = null;
319
+
320
+ if (creationDate) {
321
+ const nanoseconds = 1_000_000n * BigInt(creationDate.getTime() - EBML_DATE_EPOCH);
322
+ if (BigInt.asIntN(64, nanoseconds) !== nanoseconds) {
323
+ throw new Error('creationTime is out of the range representable by Matroska files.');
324
+ }
325
+
326
+ // Signed 64-bit integer, two's complement
327
+ dateUtc = { id: EBMLId.DateUTC, size: 8, data: BigInt.asUintN(64, nanoseconds) };
328
+ }
329
+
314
330
  const segmentInfo: EBML = { id: EBMLId.Info, data: [
315
331
  { id: EBMLId.TimestampScale, data: 1e6 },
332
+ !this.format._options.appendOnly ? segmentDuration : null,
333
+ dateUtc,
316
334
  { id: EBMLId.MuxingApp, data: VERSIONED_NAME },
317
335
  { id: EBMLId.WritingApp, data: VERSIONED_NAME },
318
- !this.format._options.appendOnly ? segmentDuration : null,
319
336
  ] };
320
337
  this.segmentInfo = segmentInfo;
321
338
  }
@@ -617,7 +634,8 @@ export class MatroskaMuxer extends Muxer {
617
634
  }; break;
618
635
 
619
636
  case 'images':
620
- case 'raw': {
637
+ case 'raw':
638
+ case 'creationTime': {
621
639
  // Handled elsewhere
622
640
  }; break;
623
641