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
@@ -2509,6 +2509,12 @@ export const createVorbisComments = (headerBytes, tags, writeImages) => {
2509
2509
  }
2510
2510
  ;
2511
2511
  break;
2512
+ case 'creationTime':
2513
+ {
2514
+ // Not supported in Vorbis comments
2515
+ }
2516
+ ;
2517
+ break;
2512
2518
  default: assertNever(key);
2513
2519
  }
2514
2520
  }
@@ -9,6 +9,7 @@ import { parseAacAudioSpecificConfig } from '../shared/aac-misc.js';
9
9
  import { MP3_FRAME_HEADER_SIZE } from '../shared/mp3-misc.js';
10
10
  import { av1CodecInfoHasColorInfo, deserializeAvcDecoderConfigurationRecord, deserializeHevcDecoderConfigurationRecord, HevcNalUnitType, parseAvcSps, parseHevcSps, } from './codec-data.js';
11
11
  import { COLOR_PRIMARIES_MAP, COLOR_PRIMARIES_MAP_INVERSE, MATRIX_COEFFICIENTS_MAP, MATRIX_COEFFICIENTS_MAP_INVERSE, TRANSFER_CHARACTERISTICS_MAP, TRANSFER_CHARACTERISTICS_MAP_INVERSE, assert, assertNever, base64ToBytes, bytesToHexString, isAllowSharedBufferSource, isWebKit, last, reverseBitsU32, toDataView, toUint8Array, } from './misc.js';
12
+ import { PCM_ENCODER_PACKET_SIZE } from './media-source.js';
12
13
  /**
13
14
  * List of known video codecs, ordered by encoding preference.
14
15
  * @group Codecs
@@ -762,6 +763,40 @@ export const getAudioPreRollDuration = (codec, decoderConfig) => {
762
763
  }
763
764
  }
764
765
  };
766
+ /** Returns the shortest packet length, in samples, that encoders commonly produce for the given codec */
767
+ export const getMinimumAudioPacketSize = (codec, sampleRate) => {
768
+ switch (codec) {
769
+ case 'aac': return 1024;
770
+ case 'opus': return 0.02 * sampleRate; // Fixed 20 ms frames, regardless of sample rate
771
+ case 'mp3': return 576;
772
+ case 'vorbis': return 256;
773
+ case 'flac': return 1152;
774
+ case 'ac3': return 1536;
775
+ case 'eac3': return 256;
776
+ case 'dts': return 512;
777
+ case 'truehd': return 40;
778
+ case 'pcm-s16':
779
+ case 'pcm-s16be':
780
+ case 'pcm-s24':
781
+ case 'pcm-s24be':
782
+ case 'pcm-s32':
783
+ case 'pcm-s32be':
784
+ case 'pcm-f32':
785
+ case 'pcm-f32be':
786
+ case 'pcm-f64':
787
+ case 'pcm-f64be':
788
+ case 'pcm-u8':
789
+ case 'pcm-s8':
790
+ case 'ulaw':
791
+ case 'alaw': {
792
+ return PCM_ENCODER_PACKET_SIZE;
793
+ }
794
+ default: {
795
+ assertNever(codec);
796
+ assert(false);
797
+ }
798
+ }
799
+ };
765
800
  export const OPUS_SAMPLE_RATE = 48_000;
766
801
  // RFC 7845 recommends 80 ms, but that one's very far from convergence (gives around -30 dBFS error). 400 ms was found
767
802
  // empirically to almost always give an error well below -100 dBFS, so we're using that
@@ -57,7 +57,7 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
57
57
  var e = new Error(message);
58
58
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
59
59
  });
60
- import { AUDIO_CODECS, NON_PCM_AUDIO_CODECS, VIDEO_CODECS, } from './codec.js';
60
+ import { AUDIO_CODECS, getMinimumAudioPacketSize, NON_PCM_AUDIO_CODECS, VIDEO_CODECS, } from './codec.js';
61
61
  import { getEncodableAudioCodecs, getFirstEncodableVideoCodec, Quality, resolveQuality, } from './encode.js';
62
62
  import { Input } from './input.js';
63
63
  import { Logging } from './logging.js';
@@ -159,6 +159,10 @@ const validateVideoOptions = (videoOptions) => {
159
159
  || (Array.isArray(videoOptions.group) && videoOptions.group.every(x => x instanceof OutputTrackGroup)))) {
160
160
  throw new TypeError('options.video.group, when provided, must be an OutputTrackGroup or an array of OutputTrackGroups.');
161
161
  }
162
+ if (videoOptions?.maximumPacketCount !== undefined
163
+ && (!Number.isInteger(videoOptions.maximumPacketCount) || videoOptions.maximumPacketCount < 0)) {
164
+ throw new TypeError('options.video.maximumPacketCount, when provided, must be a non-negative integer.');
165
+ }
162
166
  };
163
167
  const validateAudioOptions = (audioOptions) => {
164
168
  if (!audioOptions || typeof audioOptions !== 'object') {
@@ -212,9 +216,14 @@ const validateAudioOptions = (audioOptions) => {
212
216
  || (Array.isArray(audioOptions.group) && audioOptions.group.every(x => x instanceof OutputTrackGroup)))) {
213
217
  throw new TypeError('options.audio.group, when provided, must be an OutputTrackGroup or an array of OutputTrackGroups.');
214
218
  }
219
+ if (audioOptions?.maximumPacketCount !== undefined
220
+ && (!Number.isInteger(audioOptions.maximumPacketCount) || audioOptions.maximumPacketCount < 0)) {
221
+ throw new TypeError('options.audio.maximumPacketCount, when provided, must be a non-negative integer.');
222
+ }
215
223
  };
216
224
  const FALLBACK_NUMBER_OF_CHANNELS = 2;
217
225
  const FALLBACK_SAMPLE_RATE = 48000;
226
+ const PACKET_STATS_PACKET_COUNT = 256;
218
227
  /**
219
228
  * Represents a media file conversion process, used to convert one media file into another. In addition to conversion,
220
229
  * this class can be used to resize and rotate video, resample audio, drop tracks, or trim to a specific time range.
@@ -252,6 +261,8 @@ export class Conversion {
252
261
  /** @internal */
253
262
  this._copyStartPackets = new Map();
254
263
  /** @internal */
264
+ this._trackDurations = new Map();
265
+ /** @internal */
255
266
  this._nextOutputTrackId = 0;
256
267
  /** @internal */
257
268
  this._outputTrackIds = [];
@@ -600,7 +611,8 @@ export class Conversion {
600
611
  // Now, let's deal with metadata tags. A composable conversion does not touch the output's metadata tags; that
601
612
  // remains the responsibility of whoever owns the output.
602
613
  if (!this._composable) {
603
- const inputTags = await this.input.getMetadataTags();
614
+ const inputTags = { ...await this.input.getMetadataTags() };
615
+ delete inputTags.creationTime; // Makes no sense to inherit this one
604
616
  let outputTags;
605
617
  if (this._options.tags) {
606
618
  const result = typeof this._options.tags === 'function'
@@ -765,12 +777,7 @@ export class Conversion {
765
777
  if (this.onProgress) {
766
778
  // Compute duration using only the utilized tracks
767
779
  const uniqueUtilizedTracks = new Set(this.utilizedTracks);
768
- const durationPromises = [...uniqueUtilizedTracks].map(async (track) => {
769
- if (await track.isLive()) {
770
- return Infinity; // Upper bound (assuming no universe heat death)
771
- }
772
- return (await track.getDurationFromMetadata()) ?? (await track.computeDuration());
773
- });
780
+ const durationPromises = [...uniqueUtilizedTracks].map(track => this._getTrackDuration(track));
774
781
  const duration = Math.max(0, ...await Promise.all(durationPromises));
775
782
  this._computeProgress = true;
776
783
  this._totalDuration = Math.min(duration - this._startTimestamp, this._endTimestamp - this._startTimestamp);
@@ -857,6 +864,17 @@ export class Conversion {
857
864
  });
858
865
  return;
859
866
  }
867
+ if (this.output.format.requiresMaximumPacketCount
868
+ && trackOptions.maximumPacketCount === undefined
869
+ && this._endTimestamp === Infinity
870
+ && await track.isLive()) {
871
+ this.discardedTracks.push({
872
+ track,
873
+ reason: 'unknown_maximum_packet_count',
874
+ trackOptions,
875
+ });
876
+ return;
877
+ }
860
878
  let videoSource;
861
879
  const innateRotation = await track.getRotation();
862
880
  const innateFlip = await track.getFlip();
@@ -1243,6 +1261,16 @@ export class Conversion {
1243
1261
  const bitrate = needsTranscode ? null : await track.getBitrate();
1244
1262
  const averageBitrate = needsTranscode ? null : await track.getAverageBitrate();
1245
1263
  const canBeTransparent = alpha === 'keep' && await track.canBeTransparent();
1264
+ let maximumPacketCount = trackOptions.maximumPacketCount;
1265
+ if (this.output.format.requiresMaximumPacketCount && maximumPacketCount === undefined) {
1266
+ // Frames map 1:1 to packets, so the input's packet rate is a good stand-in unless the frame rate is changed
1267
+ const packetRate = trackOptions.frameRate
1268
+ ?? (await track.computePacketStats(PACKET_STATS_PACKET_COUNT)).averagePacketRate;
1269
+ const startTimestamp = needsTranscode
1270
+ ? this._startTimestamp
1271
+ : copyStartPacket?.timestamp ?? this._startTimestamp;
1272
+ maximumPacketCount = await this._estimateMaximumPacketCount(track, startTimestamp, packetRate);
1273
+ }
1246
1274
  this.output.addVideoTrack(videoSource, {
1247
1275
  frameRate: trackOptions.frameRate,
1248
1276
  // TODO: This condition can be removed when all demuxers properly homogenize to BCP47 in v2
@@ -1258,6 +1286,7 @@ export class Conversion {
1258
1286
  group: ownGroup ?? trackOptions.group,
1259
1287
  bitrate: bitrate ?? undefined,
1260
1288
  averageBitrate: averageBitrate ?? undefined,
1289
+ maximumPacketCount,
1261
1290
  });
1262
1291
  this.utilizedTracks.push(track);
1263
1292
  this._outputTrackIds.push(outputTrackId);
@@ -1274,11 +1303,23 @@ export class Conversion {
1274
1303
  });
1275
1304
  return;
1276
1305
  }
1306
+ if (this.output.format.requiresMaximumPacketCount
1307
+ && trackOptions.maximumPacketCount === undefined
1308
+ && this._endTimestamp === Infinity
1309
+ && await track.isLive()) {
1310
+ this.discardedTracks.push({
1311
+ track,
1312
+ reason: 'unknown_maximum_packet_count',
1313
+ trackOptions,
1314
+ });
1315
+ return;
1316
+ }
1277
1317
  let audioSource;
1278
1318
  const originalNumberOfChannels = await track.getNumberOfChannels();
1279
1319
  const originalSampleRate = await track.getSampleRate();
1280
1320
  let numberOfChannels = trackOptions.numberOfChannels ?? originalNumberOfChannels;
1281
1321
  let sampleRate = trackOptions.sampleRate ?? originalSampleRate;
1322
+ let outputCodec = null;
1282
1323
  let audioCodecs = this.output.format.getSupportedAudioCodecs();
1283
1324
  let needsTranscode = !this._copyMode
1284
1325
  || !!trackOptions.forceTranscode
@@ -1419,7 +1460,6 @@ export class Conversion {
1419
1460
  });
1420
1461
  return;
1421
1462
  }
1422
- let codecOfChoice = null;
1423
1463
  if (trackOptions.codec) {
1424
1464
  audioCodecs = audioCodecs.filter(codec => codec === trackOptions.codec);
1425
1465
  }
@@ -1450,15 +1490,15 @@ export class Conversion {
1450
1490
  .find(codec => NON_PCM_AUDIO_CODECS.includes(codec));
1451
1491
  if (nonPcmCodec) {
1452
1492
  // We are able to encode using a non-PCM codec, but it'll require resampling
1453
- codecOfChoice = nonPcmCodec;
1493
+ outputCodec = nonPcmCodec;
1454
1494
  numberOfChannels = FALLBACK_NUMBER_OF_CHANNELS;
1455
1495
  sampleRate = FALLBACK_SAMPLE_RATE;
1456
1496
  }
1457
1497
  }
1458
1498
  else {
1459
- codecOfChoice = encodableCodecs[0] ?? null;
1499
+ outputCodec = encodableCodecs[0] ?? null;
1460
1500
  }
1461
- if (codecOfChoice === null) {
1501
+ if (outputCodec === null) {
1462
1502
  this.discardedTracks.push({
1463
1503
  track,
1464
1504
  reason: 'no_encodable_target_codec',
@@ -1467,7 +1507,7 @@ export class Conversion {
1467
1507
  return;
1468
1508
  }
1469
1509
  const encodingConfig = {
1470
- codec: codecOfChoice,
1510
+ codec: outputCodec,
1471
1511
  quality,
1472
1512
  transform: {
1473
1513
  sampleFormat: trackOptions.sampleFormat,
@@ -1588,6 +1628,21 @@ export class Conversion {
1588
1628
  // The input's bitrate metadata only stays meaningful when packets are copied
1589
1629
  const bitrate = needsTranscode ? null : await track.getBitrate();
1590
1630
  const averageBitrate = needsTranscode ? null : await track.getAverageBitrate();
1631
+ let maximumPacketCount = trackOptions.maximumPacketCount;
1632
+ if (this.output.format.requiresMaximumPacketCount && maximumPacketCount === undefined) {
1633
+ let packetRate;
1634
+ if (needsTranscode) {
1635
+ assert(outputCodec);
1636
+ packetRate = sampleRate / getMinimumAudioPacketSize(outputCodec, sampleRate);
1637
+ }
1638
+ else {
1639
+ packetRate = (await track.computePacketStats(PACKET_STATS_PACKET_COUNT)).averagePacketRate;
1640
+ }
1641
+ const startTimestamp = needsTranscode
1642
+ ? this._startTimestamp
1643
+ : copyStartPacket?.timestamp ?? this._startTimestamp;
1644
+ maximumPacketCount = await this._estimateMaximumPacketCount(track, startTimestamp, packetRate);
1645
+ }
1591
1646
  this.output.addAudioTrack(audioSource, {
1592
1647
  // TODO: This condition can be removed when all demuxers properly homogenize to BCP47 in v2
1593
1648
  languageCode: isIso639Dash2LanguageCode(audioTrackLanguageCode)
@@ -1598,12 +1653,34 @@ export class Conversion {
1598
1653
  group: ownGroup ?? trackOptions.group,
1599
1654
  bitrate: bitrate ?? undefined,
1600
1655
  averageBitrate: averageBitrate ?? undefined,
1656
+ maximumPacketCount,
1601
1657
  });
1602
1658
  this.utilizedTracks.push(track);
1603
1659
  this._outputTrackIds.push(outputTrackId);
1604
1660
  this._outputOwnTrackGroups.push(ownGroup);
1605
1661
  }
1606
1662
  /** @internal */
1663
+ async _estimateMaximumPacketCount(track, startTimestamp, packetRate) {
1664
+ const endTimestamp = Math.min(await this._getTrackDuration(track), this._endTimestamp);
1665
+ const duration = Math.max(endTimestamp - startTimestamp, 0);
1666
+ // Let's give this a generous margin
1667
+ return Math.ceil(1.5 * packetRate * duration) + 64;
1668
+ }
1669
+ /** @internal */
1670
+ _getTrackDuration(track) {
1671
+ let promise = this._trackDurations.get(track);
1672
+ if (!promise) {
1673
+ promise = (async () => {
1674
+ if (await track.isLive()) {
1675
+ return Infinity; // Upper bound (assuming no universe heat death)
1676
+ }
1677
+ return (await track.getDurationFromMetadata()) ?? (await track.computeDuration());
1678
+ })();
1679
+ this._trackDurations.set(track, promise);
1680
+ }
1681
+ return promise;
1682
+ }
1683
+ /** @internal */
1607
1684
  async _registerAudioSample(pump, sample, source, outputTrackId, getLastSampleTimestamp) {
1608
1685
  this._updateProgress(outputTrackId, sample.timestamp + sample.duration);
1609
1686
  await source.add(sample);
@@ -746,6 +746,12 @@ export class Id3V2Writer {
746
746
  }
747
747
  ;
748
748
  break;
749
+ case 'creationTime':
750
+ {
751
+ // Not supported in ID3
752
+ }
753
+ ;
754
+ break;
749
755
  default: {
750
756
  assertNever(key);
751
757
  }
@@ -1060,12 +1060,15 @@ export const ctts = (trackData) => {
1060
1060
  * Composition to Decode Box: Stores information about the composition and display times of the media samples.
1061
1061
  */
1062
1062
  export const cslg = (trackData) => {
1063
+ assert(trackData.compositionTimeOffsetTable.length > 0);
1064
+ if (trackData.samples.length === 0) {
1065
+ // Happens when the moov is measured before any samples have been added
1066
+ return null;
1067
+ }
1063
1068
  let leastDecodeToDisplayDelta = Infinity;
1064
1069
  let greatestDecodeToDisplayDelta = -Infinity;
1065
1070
  let compositionStartTime = Infinity;
1066
1071
  let compositionEndTime = -Infinity;
1067
- assert(trackData.compositionTimeOffsetTable.length > 0);
1068
- assert(trackData.samples.length > 0);
1069
1072
  for (let i = 0; i < trackData.compositionTimeOffsetTable.length; i++) {
1070
1073
  const entry = trackData.compositionTimeOffsetTable[i];
1071
1074
  leastDecodeToDisplayDelta = Math.min(leastDecodeToDisplayDelta, entry.sampleCompositionTimeOffset);
@@ -1411,6 +1414,12 @@ const addQuickTimeMetadataTagBoxes = (boxes, tags) => {
1411
1414
  }
1412
1415
  ;
1413
1416
  break;
1417
+ case 'creationTime':
1418
+ {
1419
+ // Written in the header boxes
1420
+ }
1421
+ ;
1422
+ break;
1414
1423
  case 'discNumber':
1415
1424
  case 'discsTotal':
1416
1425
  case 'trackNumber':
@@ -1453,6 +1462,9 @@ const DATA_BOX_MIME_TYPE_MAP = {
1453
1462
  'image/png': 14,
1454
1463
  'image/bmp': 27,
1455
1464
  };
1465
+ // FFmpeg parses these assuming a udta layout even when they're not in udta, so we simply skip these if we'd write them
1466
+ // to ilst metadata
1467
+ const ILST_UNSAFE_RAW_KEYS = new Set(['HMMT', 'loci', 'chpl']);
1456
1468
  /**
1457
1469
  * Generates key-value metadata for inclusion in the "meta" box.
1458
1470
  */
@@ -1596,13 +1608,21 @@ const generateMetadataPairs = (tags, isMdta) => {
1596
1608
  }
1597
1609
  ;
1598
1610
  break;
1611
+ case 'creationTime':
1612
+ {
1613
+ // Written in the header boxes
1614
+ }
1615
+ ;
1616
+ break;
1599
1617
  default: assertNever(key);
1600
1618
  }
1601
1619
  }
1602
1620
  if (tags.raw) {
1603
1621
  for (const key in tags.raw) {
1604
1622
  const value = tags.raw[key];
1605
- if (value == null || (!isMdta && key.length !== 4) || pairs.some(x => x.key === key)) {
1623
+ if (value == null
1624
+ || (!isMdta && (key.length !== 4 || ILST_UNSAFE_RAW_KEYS.has(key)))
1625
+ || pairs.some(x => x.key === key)) {
1606
1626
  continue;
1607
1627
  }
1608
1628
  if (typeof value === 'string') {
@@ -11,7 +11,7 @@ import { av1CodecInfoHasColorInfo, extractAv1CodecInfoFromPacket, extractProresC
11
11
  import { Demuxer } from '../demuxer.js';
12
12
  import { assert, binarySearchExact, binarySearchLessOrEqual, bytesToHexString, COLOR_PRIMARIES_MAP_INVERSE, findLastIndex, IDENTITY_MATRIX, isIso639Dash2LanguageCode, isThenable, last, MATRIX_COEFFICIENTS_MAP_INVERSE, multiplyMatrices, textDecoder, TRANSFER_CHARACTERISTICS_MAP_INVERSE, UNDETERMINED_LANGUAGE, toDataView, roundIfAlmostInteger, hexStringToBytes, HEX_STRING_REGEX, EMPTY_COLOR_SPACE, colorSpaceIsComplete, } from '../misc.js';
13
13
  import { EncodedPacket, PLACEHOLDER_DATA } from '../packet.js';
14
- import { buildIsobmffMimeType, parsePsshBoxContents, psshBoxesAreEqual } from './isobmff-misc.js';
14
+ import { buildIsobmffMimeType, parsePsshBoxContents, psshBoxesAreEqual, TIMESTAMP_OFFSET, } from './isobmff-misc.js';
15
15
  import { MAX_BOX_HEADER_SIZE, MIN_BOX_HEADER_SIZE, readBoxHeader, readDataBox, readFixed_16_16, readFixed_2_30, readEsDescriptor, readMetadataStringShort, } from './isobmff-reader.js';
16
16
  import { readBytes, readF64Be, readI16Be, readI32Be, readI64Be, readU16Be, readU24Be, readU32Be, readU64Be, readU8, readAscii, } from '../reader.js';
17
17
  import { DEFAULT_TRACK_DISPOSITION, RichImageData } from '../metadata.js';
@@ -538,16 +538,25 @@ export class IsobmffDemuxer extends Demuxer {
538
538
  {
539
539
  const version = readU8(slice);
540
540
  slice.skip(3); // Flags
541
+ let creationTime;
541
542
  if (version === 1) {
542
- slice.skip(8 + 8);
543
+ creationTime = readU64Be(slice);
544
+ slice.skip(8); // Modification time
543
545
  this.movieTimescale = readU32Be(slice);
544
546
  this.movieDurationInTimescale = readU64Be(slice);
545
547
  }
546
548
  else {
547
- slice.skip(4 + 4);
549
+ creationTime = readU32Be(slice);
550
+ slice.skip(4); // Modification time
548
551
  this.movieTimescale = readU32Be(slice);
549
552
  this.movieDurationInTimescale = readU32Be(slice);
550
553
  }
554
+ if (creationTime !== 0) {
555
+ this.metadataTags.creationTime = new Date(1000 * (creationTime - TIMESTAMP_OFFSET));
556
+ }
557
+ else {
558
+ // Assume this means the creation time isn't set (I doubt the file was created in 1904)
559
+ }
551
560
  if (this.movieTimescale === 0) {
552
561
  throw new Error('Invalid mvhd box: timescale must not be 0.');
553
562
  }
@@ -6,6 +6,7 @@
6
6
  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7
7
  */
8
8
  import { bytesToHexString, toDataView, uint8ArraysAreEqual } from '../misc.js';
9
+ export const TIMESTAMP_OFFSET = 2_082_844_800; // Seconds between Jan 1 1904 and Jan 1 1970
9
10
  export const buildIsobmffMimeType = (info) => {
10
11
  const base = info.hasVideo
11
12
  ? 'video/'
@@ -17,10 +17,9 @@ import { OPUS_PRE_ROLL_DURATION, OPUS_SAMPLE_RATE, parsePcmCodec, PCM_AUDIO_CODE
17
17
  import { MAX_ADTS_FRAME_HEADER_SIZE, MIN_ADTS_FRAME_HEADER_SIZE, readAdtsFrameHeader } from '../adts/adts-reader.js';
18
18
  import { FileSlice } from '../reader.js';
19
19
  import { concatNalUnitsInLengthPrefixed, extractAvcDecoderConfigurationRecord, extractHevcDecoderConfigurationRecord, iterateNalUnitsInAnnexB, parseOpusTocByte, serializeAvcDecoderConfigurationRecord, serializeHevcDecoderConfigurationRecord, } from '../codec-data.js';
20
- import { buildIsobmffMimeType } from './isobmff-misc.js';
20
+ import { buildIsobmffMimeType, TIMESTAMP_OFFSET } from './isobmff-misc.js';
21
21
  import { MAX_BOX_HEADER_SIZE, MIN_BOX_HEADER_SIZE } from './isobmff-reader.js';
22
22
  export const GLOBAL_TIMESCALE = 57600; // LCM of a bunch of common frame rates (24, 25, 30, 60, 144, ...)
23
- const TIMESTAMP_OFFSET = 2_082_844_800; // Seconds between Jan 1 1904 and Jan 1 1970
24
23
  const MIN_CHUNK_DURATION = 0.5; // In seconds
25
24
  export const getTrackMetadata = (trackData) => {
26
25
  const metadata = {};
@@ -68,7 +67,6 @@ export class IsobmffMuxer extends Muxer {
68
67
  this.ftypSize = null;
69
68
  this.trackDatas = [];
70
69
  this.allTracksKnown = promiseWithResolvers();
71
- this.creationTime = Math.floor(Date.now() / 1000) + TIMESTAMP_OFFSET;
72
70
  this.finalizedChunks = [];
73
71
  this.wroteFragmentedHeader = false;
74
72
  this.nextFragmentNumber = 1;
@@ -87,6 +85,15 @@ export class IsobmffMuxer extends Muxer {
87
85
  }
88
86
  async start() {
89
87
  const release = await this.mutex.acquire();
88
+ const creationDate = this.output._metadataTags.creationTime === undefined
89
+ ? new Date()
90
+ : this.output._metadataTags.creationTime;
91
+ this.creationTime = creationDate
92
+ ? Math.floor(creationDate.getTime() / 1000) + TIMESTAMP_OFFSET
93
+ : 0;
94
+ if (creationDate && this.creationTime <= 0) {
95
+ throw new Error('creationTime must be after 1904-01-01T00:00:00Z for MP4/QuickTime files.');
96
+ }
90
97
  if (!this.isCmaf) {
91
98
  this.writer = await this.output._getRootWriter(target => (this.formatOptions.fastStart !== undefined
92
99
  ? this.formatOptions.fastStart === 'fragmented'
@@ -148,6 +155,12 @@ export class IsobmffMuxer extends Muxer {
148
155
  throw new Error('All tracks must specify maximumPacketCount in their metadata when using'
149
156
  + ' fastStart: \'reserve\'.');
150
157
  }
158
+ // Sample counts are stored as u32 in the sample table
159
+ if (track.metadata.maximumPacketCount > 2 ** 32 - 1) {
160
+ throw new Error(`Track #${track.id} has a maximumPacketCount of ${track.metadata.maximumPacketCount}, which`
161
+ + ` exceeds the maximum of ${2 ** 32 - 1} packets per track that a non-fragmented file can`
162
+ + ' hold.');
163
+ }
151
164
  }
152
165
  // We'll start writing once we know all tracks
153
166
  }
@@ -1046,6 +1059,12 @@ export class IsobmffMuxer extends Muxer {
1046
1059
  upperBound += 4 * n;
1047
1060
  // co64 box - we assume 1 sample per chunk and 64-bit chunk offsets (co64 instead of stco)
1048
1061
  upperBound += 8 * n;
1062
+ if (trackData.type === 'audio') {
1063
+ // sgpd box - 1 roll distance per sample, in case each sample's preroll differs from the one before
1064
+ upperBound += 2 * n;
1065
+ // sbgp box - 1 entry per sample, for the same reason
1066
+ upperBound += (4 + 4) * n;
1067
+ }
1049
1068
  }
1050
1069
  return upperBound;
1051
1070
  }
@@ -1257,14 +1276,18 @@ export class IsobmffMuxer extends Muxer {
1257
1276
  const movieBox = moov(this);
1258
1277
  if (this.fastStart === 'reserve') {
1259
1278
  assert(this.ftypSize !== null);
1279
+ const reservedSpace = this.boxWriter.offsets.get(this.mdat) - this.ftypSize;
1280
+ const moovSize = this.boxWriter.measureBox(movieBox);
1281
+ if (moovSize + 8 > reservedSpace) {
1282
+ throw new Error(`The moov box (${moovSize} bytes) plus a free box (8 bytes) exceed the space reserved for them`
1283
+ + ` (${reservedSpace} bytes) with fastStart: 'reserve'. This is a bug; please report it.`);
1284
+ }
1260
1285
  this.writer.seek(this.ftypSize);
1261
1286
  if (this.formatOptions.onMoov) {
1262
1287
  this.writer.startTrackingWrites();
1263
1288
  }
1264
1289
  this.boxWriter.writeBox(movieBox);
1265
- // Fill the remaining space with a free box. If there are less than 8 bytes left, sucks I guess
1266
- const remainingSpace = this.boxWriter.offsets.get(this.mdat) - this.writer.getPos();
1267
- this.boxWriter.writeBox(free(remainingSpace));
1290
+ this.boxWriter.writeBox(free(reservedSpace - moovSize));
1268
1291
  }
1269
1292
  else {
1270
1293
  if (this.formatOptions.onMoov) {
@@ -50,6 +50,7 @@ export var EBMLId;
50
50
  EBMLId[EBMLId["Duration"] = 17545] = "Duration";
51
51
  EBMLId[EBMLId["Info"] = 357149030] = "Info";
52
52
  EBMLId[EBMLId["TimestampScale"] = 2807729] = "TimestampScale";
53
+ EBMLId[EBMLId["DateUTC"] = 17505] = "DateUTC";
53
54
  EBMLId[EBMLId["MuxingApp"] = 19840] = "MuxingApp";
54
55
  EBMLId[EBMLId["WritingApp"] = 22337] = "WritingApp";
55
56
  EBMLId[EBMLId["Tracks"] = 374648427] = "Tracks";
@@ -448,6 +449,7 @@ export class EBMLWriter {
448
449
  }
449
450
  }
450
451
  }
452
+ export const EBML_DATE_EPOCH = Date.UTC(2001, 0, 1); // In milliseconds since the Unix epoch
451
453
  export const MAX_VAR_INT_SIZE = 8;
452
454
  export const MIN_HEADER_SIZE = 2; // 1-byte ID and 1-byte size
453
455
  export const MAX_HEADER_SIZE = 2 * MAX_VAR_INT_SIZE; // 8-byte ID and 8-byte size
@@ -533,6 +535,13 @@ export const readSignedInt = (slice, width) => {
533
535
  }
534
536
  return value;
535
537
  };
538
+ export const readSignedBigInt = (slice, width) => {
539
+ // Zero width is valid and means zero
540
+ if (width === 0) {
541
+ return 0n;
542
+ }
543
+ return BigInt.asIntN(8 * width, readUnsignedBigInt(slice, width));
544
+ };
536
545
  export const readElementId = (slice) => {
537
546
  const size = readVarIntSize(slice);
538
547
  if (size === null) {
@@ -12,7 +12,7 @@ import { Logging } from '../logging.js';
12
12
  import { AttachedFile, DEFAULT_TRACK_DISPOSITION } from '../metadata.js';
13
13
  import { assert, binarySearchLessOrEqual, COLOR_PRIMARIES_MAP_INVERSE, colorSpaceIsComplete, EMPTY_COLOR_SPACE, findLastIndex, isIso639Dash2LanguageCode, isThenable, last, MATRIX_COEFFICIENTS_MAP_INVERSE, centeredTransformationMatrix, DEG_TO_RAD, multiplyMatrices, normalizeRotation, rotationMatrix, roundIfAlmostInteger, scaleMatrix, textDecoder, toDataView, TRANSFER_CHARACTERISTICS_MAP_INVERSE, UNDETERMINED_LANGUAGE, } from '../misc.js';
14
14
  import { EncodedPacket, PLACEHOLDER_DATA } from '../packet.js';
15
- import { assertDefinedSize, CODEC_STRING_MAP, EBMLId, LEVEL_0_AND_1_EBML_IDS, LEVEL_1_EBML_IDS, MAX_HEADER_SIZE, MIN_HEADER_SIZE, readAsciiString, readUnicodeString, readElementHeader, readElementId, readFloat, readUnsignedInt, readVarInt, resync, searchForNextElementId, readUnsignedBigInt, } from './ebml.js';
15
+ import { assertDefinedSize, CODEC_STRING_MAP, EBMLId, LEVEL_0_AND_1_EBML_IDS, LEVEL_1_EBML_IDS, MAX_HEADER_SIZE, MIN_HEADER_SIZE, readAsciiString, readUnicodeString, readElementHeader, readElementId, readFloat, readUnsignedInt, readVarInt, resync, searchForNextElementId, readUnsignedBigInt, readSignedBigInt, EBML_DATE_EPOCH, } from './ebml.js';
16
16
  import { buildMatroskaMimeType } from './matroska-misc.js';
17
17
  import { FileSlice, readBytes, readI16Be, readU8 } from '../reader.js';
18
18
  var BlockLacing;
@@ -754,6 +754,15 @@ export class MatroskaDemuxer extends Demuxer {
754
754
  }
755
755
  ;
756
756
  break;
757
+ case EBMLId.DateUTC:
758
+ {
759
+ if (!this.currentSegment)
760
+ break;
761
+ const nanoseconds = readSignedBigInt(slice, size);
762
+ this.currentSegment.metadataTags.creationTime = new Date(EBML_DATE_EPOCH + Number(nanoseconds / 1000000n));
763
+ }
764
+ ;
765
+ break;
757
766
  case EBMLId.TrackEntry:
758
767
  {
759
768
  if (!this.currentSegment)
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { Bitstream } from '../../shared/bitstream.js';
9
9
  import { COLOR_PRIMARIES_MAP, MATRIX_COEFFICIENTS_MAP, TRANSFER_CHARACTERISTICS_MAP, UNDETERMINED_LANGUAGE, assert, assertNever, colorSpaceIsEmpty, extractRotationFromMatrix, imageMimeTypeToExtension, keyValueIterator, multiplyMatrices, normalizeRotation, promiseWithResolvers, RAD_TO_DEG, rotationMatrix, simplifyRational, textEncoder, toUint8Array, uint8ArraysAreEqual, writeBits, roundToDivisor, } from '../misc.js';
10
- import { CODEC_STRING_MAP, EBMLFloat32, EBMLFloat64, EBMLId, EBMLSignedInt, EBMLUnicodeString, EBMLWriter, } from './ebml.js';
10
+ import { CODEC_STRING_MAP, EBML_DATE_EPOCH, EBMLFloat32, EBMLFloat64, EBMLId, EBMLSignedInt, EBMLUnicodeString, EBMLWriter, } from './ebml.js';
11
11
  import { buildMatroskaMimeType } from './matroska-misc.js';
12
12
  import { WebMOutputFormat } from '../output-format.js';
13
13
  import { formatSubtitleTimestamp, inlineTimestampRegex, parseSubtitleTimestamp, } from '../subtitles.js';
@@ -161,11 +161,24 @@ export class MatroskaMuxer extends Muxer {
161
161
  createSegmentInfo() {
162
162
  const segmentDuration = { id: EBMLId.Duration, data: new EBMLFloat64(0) };
163
163
  this.segmentDuration = segmentDuration;
164
+ const creationDate = this.output._metadataTags.creationTime === undefined
165
+ ? new Date()
166
+ : this.output._metadataTags.creationTime;
167
+ let dateUtc = null;
168
+ if (creationDate) {
169
+ const nanoseconds = 1000000n * BigInt(creationDate.getTime() - EBML_DATE_EPOCH);
170
+ if (BigInt.asIntN(64, nanoseconds) !== nanoseconds) {
171
+ throw new Error('creationTime is out of the range representable by Matroska files.');
172
+ }
173
+ // Signed 64-bit integer, two's complement
174
+ dateUtc = { id: EBMLId.DateUTC, size: 8, data: BigInt.asUintN(64, nanoseconds) };
175
+ }
164
176
  const segmentInfo = { id: EBMLId.Info, data: [
165
177
  { id: EBMLId.TimestampScale, data: 1e6 },
178
+ !this.format._options.appendOnly ? segmentDuration : null,
179
+ dateUtc,
166
180
  { id: EBMLId.MuxingApp, data: VERSIONED_NAME },
167
181
  { id: EBMLId.WritingApp, data: VERSIONED_NAME },
168
- !this.format._options.appendOnly ? segmentDuration : null,
169
182
  ] };
170
183
  this.segmentInfo = segmentInfo;
171
184
  }
@@ -465,6 +478,7 @@ export class MatroskaMuxer extends Muxer {
465
478
  break;
466
479
  case 'images':
467
480
  case 'raw':
481
+ case 'creationTime':
468
482
  {
469
483
  // Handled elsewhere
470
484
  }