agentroam-runtime-darwin-arm64 0.2.0-preview.80 → 0.2.0-preview.82

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 (361) 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 +5 -5
  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/composer/route.js +1 -0
  17. package/runtime/.next/server/app/api/agent/composer/route.js.nft.json +1 -0
  18. package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
  19. package/runtime/.next/server/app/api/agent/model/route.js +1 -1
  20. package/runtime/.next/server/app/api/agent/models/route.js +1 -1
  21. package/runtime/.next/server/app/api/agent/run/route.js +1 -1
  22. package/runtime/.next/server/app/api/agent/runtime-health/route.js +1 -1
  23. package/runtime/.next/server/app/api/agent/steer/route.js +1 -1
  24. package/runtime/.next/server/app/api/agent/stream/route.js +2 -2
  25. package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
  26. package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
  27. package/runtime/.next/server/app/api/auth/verify/route.js +1 -1
  28. package/runtime/.next/server/app/api/business/route.js +1 -1
  29. package/runtime/.next/server/app/api/calendar/route.js +2 -2
  30. package/runtime/.next/server/app/api/client-logs/route.js +1 -1
  31. package/runtime/.next/server/app/api/collaboration/route.js +2 -2
  32. package/runtime/.next/server/app/api/engine-threads/route.js +1 -1
  33. package/runtime/.next/server/app/api/engine-threads.body +1 -1
  34. package/runtime/.next/server/app/api/flow/v1/catalog/route.js +1 -1
  35. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js +1 -1
  36. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js +2 -2
  37. package/runtime/.next/server/app/api/flow/v1/runs/route.js +1 -1
  38. package/runtime/.next/server/app/api/flow-studio/config/route.js +1 -1
  39. package/runtime/.next/server/app/api/internal/todo-bootstrap/route.js +1 -1
  40. package/runtime/.next/server/app/api/internal/todo-mcp/route.js +1 -1
  41. package/runtime/.next/server/app/api/mcp/connect/route.js +1 -1
  42. package/runtime/.next/server/app/api/mcp/disconnect/route.js +1 -1
  43. package/runtime/.next/server/app/api/mcp/servers/route.js +1 -1
  44. package/runtime/.next/server/app/api/memory/[key]/route.js +1 -1
  45. package/runtime/.next/server/app/api/memory/route.js +1 -1
  46. package/runtime/.next/server/app/api/messaging/route.js +1 -1
  47. package/runtime/.next/server/app/api/notifications/[id]/ack/route.js +1 -1
  48. package/runtime/.next/server/app/api/notifications/[id]/route.js +1 -1
  49. package/runtime/.next/server/app/api/notifications/route.js +1 -1
  50. package/runtime/.next/server/app/api/notifications/stream/route.js +2 -2
  51. package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
  52. package/runtime/.next/server/app/api/projects/[id]/route.js +1 -1
  53. package/runtime/.next/server/app/api/projects/check/route.js +1 -1
  54. package/runtime/.next/server/app/api/projects/directories/route.js +1 -1
  55. package/runtime/.next/server/app/api/projects/roots/route.js +1 -1
  56. package/runtime/.next/server/app/api/projects/route.js +1 -1
  57. package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
  58. package/runtime/.next/server/app/api/push/unsubscribe/route.js +2 -2
  59. package/runtime/.next/server/app/api/push/vapid/route.js +2 -2
  60. package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
  61. package/runtime/.next/server/app/api/session-images/[id]/route.js +1 -1
  62. package/runtime/.next/server/app/api/session-views/route.js +1 -1
  63. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/route.js +1 -1
  64. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/[jobId]/stop/route.js +1 -1
  65. package/runtime/.next/server/app/api/sessions/[id]/background-jobs/route.js +1 -1
  66. package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +2 -2
  67. package/runtime/.next/server/app/api/sessions/[id]/engine-switches/route.js +1 -1
  68. package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
  69. package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -1
  70. package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
  71. package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
  72. package/runtime/.next/server/app/api/sessions/[id]/native-goal/route.js +1 -1
  73. package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
  74. package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
  75. package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
  76. package/runtime/.next/server/app/api/sessions/[id]/switch-engine/route.js +1 -1
  77. package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
  78. package/runtime/.next/server/app/api/sessions/[id]/thread-history/route.js +1 -1
  79. package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
  80. package/runtime/.next/server/app/api/sessions/parallel/route.js +1 -1
  81. package/runtime/.next/server/app/api/sessions/route.js +1 -1
  82. package/runtime/.next/server/app/api/settings/route.js +1 -1
  83. package/runtime/.next/server/app/api/skills/route.js +1 -1
  84. package/runtime/.next/server/app/api/todos/[id]/commands/route.js +1 -1
  85. package/runtime/.next/server/app/api/todos/[id]/executions/route.js +1 -1
  86. package/runtime/.next/server/app/api/todos/[id]/route.js +1 -1
  87. package/runtime/.next/server/app/api/todos/route.js +1 -1
  88. package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
  89. package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
  90. package/runtime/.next/server/app/api/tools/route.js +1 -1
  91. package/runtime/.next/server/app/api/update/check/route.js +1 -1
  92. package/runtime/.next/server/app/api/update/install/route.js +1 -1
  93. package/runtime/.next/server/app/api/update/status/route.js +1 -1
  94. package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
  95. package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
  96. package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
  97. package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
  98. package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
  99. package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
  100. package/runtime/.next/server/app/api/web-console/computer-settings/route.js +1 -1
  101. package/runtime/.next/server/app/api/web-console/computers/route.js +1 -1
  102. package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
  103. package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
  104. package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
  105. package/runtime/.next/server/app/api/workspace-changes/route.js +1 -1
  106. package/runtime/.next/server/app/web/page.js +4 -4
  107. package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
  108. package/runtime/.next/server/app-paths-manifest.json +36 -35
  109. package/runtime/.next/server/chunks/5303.js +2 -2
  110. package/runtime/.next/server/chunks/5801.js +1 -1
  111. package/runtime/.next/server/chunks/9119.js +3 -3
  112. package/runtime/.next/server/middleware-build-manifest.js +1 -1
  113. package/runtime/.next/server/pages/404.html +1 -1
  114. package/runtime/.next/server/pages/500.html +1 -1
  115. package/runtime/.next/server/server-reference-manifest.json +1 -1
  116. package/runtime/.next/static/chunks/app/web/{error-f313c4014e78cef5.js → error-828d278147a0619d.js} +1 -1
  117. package/runtime/.next/static/chunks/app/web/layout-1127176e7e88e395.js +1 -0
  118. package/runtime/.next/static/chunks/app/web/{page-2e962377e57d3383.js → page-f008ab6dfeab7ce7.js} +1 -1
  119. package/runtime/.next/static/chunks/{main-68faabab5d101471.js → main-9c08f7656f9692e6.js} +1 -1
  120. package/runtime/.next/static/chunks/main-app-07d67f2d4e96ecb8.js +1 -0
  121. package/runtime/lib/remote-control/application/paced-video-sender.mjs +20 -1
  122. package/runtime/lib/remote-control/application/remote-video-session.mjs +18 -4
  123. package/runtime/lib/remote-control/helper-manager.mjs +36 -2
  124. package/runtime/lib/remote-control/infrastructure/native-video-encoder.mjs +15 -2
  125. package/runtime/lib/remote-control/infrastructure/werift-video-transport.mjs +3 -1
  126. package/runtime/lib/remote-control/macos-helper-app.mjs +85 -15
  127. package/runtime/lib/remote-control/macos-helper-permissions.mjs +113 -0
  128. package/runtime/lib/remote-control/remote-authorization.mjs +2 -2
  129. package/runtime/lib/remote-control/remote-video-signal.mjs +2 -0
  130. package/runtime/lib/todo-completion-worker.mjs +45 -0
  131. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/MacOS/agentroam-remote-desktop +0 -0
  132. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/Resources/agentroam-component.json +1 -1
  133. package/runtime/native/Support.noindex/AgentRoam Remote Desktop.app/Contents/_CodeSignature/CodeResources +2 -2
  134. package/runtime/node_modules/.package-lock.json +129 -129
  135. package/runtime/node_modules/@agent/core/dist/index.js +286 -68
  136. package/runtime/node_modules/@agent/native-runtime/dist/index.js +444 -127
  137. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +75 -79
  138. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +52 -52
  139. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-2g5j09ba.mjs +16 -0
  140. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-59ydwk0g.mjs +17 -0
  141. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-q4cwy1ja.mjs → core-664d5mmy.mjs} +2 -2
  142. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/{core-zn1abzvs.mjs → core-70sfhqm6.mjs} +2 -2
  143. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-95gcz3n1.mjs +38 -0
  144. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ew5sfvfe.mjs +39 -0
  145. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-gjhs7gf6.mjs +20 -0
  146. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-kvdt1szx.mjs +18 -0
  147. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-p654hjkr.mjs +22 -0
  148. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-q9bjbxkv.mjs +19 -0
  149. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-samdvsjh.mjs +33 -0
  150. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-x6bt758j.mjs +17 -0
  151. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +12 -12
  152. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +22 -22
  153. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +26 -26
  154. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +22 -23
  155. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +84 -83
  156. package/runtime/node_modules/caniuse-lite/package.json +1 -1
  157. package/runtime/node_modules/mediabunny/README.md +4 -0
  158. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.cjs +185 -127
  159. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.cjs +11 -11
  160. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.min.mjs +12 -12
  161. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.mjs +185 -127
  162. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.node.cjs +185 -127
  163. package/runtime/node_modules/mediabunny/dist/bundles/mediabunny.worker.js +8 -0
  164. package/runtime/node_modules/mediabunny/dist/modules/src/adts/adts-demuxer.js +4 -0
  165. package/runtime/node_modules/mediabunny/dist/modules/src/aes.js +6 -4
  166. package/runtime/node_modules/mediabunny/dist/modules/src/hls/hls-demuxer.js +6 -0
  167. package/runtime/node_modules/mediabunny/dist/modules/src/hls/hls-segmented-input.js +17 -5
  168. package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-boxes.js +2 -1
  169. package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-demuxer.js +12 -1
  170. package/runtime/node_modules/mediabunny/dist/modules/src/isobmff/isobmff-muxer.js +34 -18
  171. package/runtime/node_modules/mediabunny/dist/modules/src/matroska/matroska-demuxer.js +3 -0
  172. package/runtime/node_modules/mediabunny/dist/modules/src/media-sink.js +3 -8
  173. package/runtime/node_modules/mediabunny/dist/modules/src/media-source.js +5 -12
  174. package/runtime/node_modules/mediabunny/dist/modules/src/misc.js +19 -5
  175. package/runtime/node_modules/mediabunny/dist/modules/src/mp3/mp3-demuxer.js +4 -0
  176. package/runtime/node_modules/mediabunny/dist/modules/src/mpeg-ts/mpeg-ts-demuxer.js +22 -13
  177. package/runtime/node_modules/mediabunny/dist/modules/src/mpeg-ts/mpeg-ts-muxer.js +2 -2
  178. package/runtime/node_modules/mediabunny/dist/modules/src/segmented-input.js +70 -65
  179. package/runtime/node_modules/mediabunny/dist/modules/src/tsconfig.tsbuildinfo +1 -1
  180. package/runtime/node_modules/mediabunny/dist/modules/src/version.js +1 -1
  181. package/runtime/node_modules/mediabunny/dist/modules/src/worker.js +26 -0
  182. package/runtime/node_modules/mediabunny/package.json +1 -1
  183. package/runtime/node_modules/mediabunny/src/adts/adts-demuxer.ts +5 -0
  184. package/runtime/node_modules/mediabunny/src/aes.ts +7 -4
  185. package/runtime/node_modules/mediabunny/src/hls/hls-demuxer.ts +7 -0
  186. package/runtime/node_modules/mediabunny/src/hls/hls-segmented-input.ts +19 -6
  187. package/runtime/node_modules/mediabunny/src/isobmff/isobmff-boxes.ts +2 -1
  188. package/runtime/node_modules/mediabunny/src/isobmff/isobmff-demuxer.ts +15 -1
  189. package/runtime/node_modules/mediabunny/src/isobmff/isobmff-muxer.ts +37 -19
  190. package/runtime/node_modules/mediabunny/src/matroska/matroska-demuxer.ts +4 -0
  191. package/runtime/node_modules/mediabunny/src/media-sink.ts +3 -12
  192. package/runtime/node_modules/mediabunny/src/media-source.ts +5 -20
  193. package/runtime/node_modules/mediabunny/src/misc.ts +26 -5
  194. package/runtime/node_modules/mediabunny/src/mp3/mp3-demuxer.ts +5 -0
  195. package/runtime/node_modules/mediabunny/src/mpeg-ts/mpeg-ts-demuxer.ts +30 -19
  196. package/runtime/node_modules/mediabunny/src/mpeg-ts/mpeg-ts-muxer.ts +2 -2
  197. package/runtime/node_modules/mediabunny/src/segmented-input.ts +76 -79
  198. package/runtime/node_modules/mediabunny/src/version.ts +1 -1
  199. package/runtime/node_modules/mediabunny/src/worker.ts +28 -0
  200. package/runtime/package-lock.json +162 -162
  201. package/runtime/server.js +1 -1
  202. package/runtime/webapp/dist/assets/AIHubView-CNKanNZa.js +1 -0
  203. package/runtime/webapp/dist/assets/{AgentManager-dXI31b0a.js → AgentManager-B8TTqJaL.js} +2 -2
  204. package/runtime/webapp/dist/assets/AiHubPane-Coyn3P-J.js +1 -0
  205. package/runtime/webapp/dist/assets/App-BGIGpBp3.js +68 -0
  206. package/runtime/webapp/dist/assets/BrowserLivePanel-DnzJOz5w.js +61 -0
  207. package/runtime/webapp/dist/assets/CalendarPage-D0oaq2_l.js +1 -0
  208. package/runtime/webapp/dist/assets/{CalendarView-QfbrlL9X.js → CalendarView-QXZbXnXA.js} +3 -3
  209. package/runtime/webapp/dist/assets/CollaborationCreateDialog-CE8OML-A.js +1 -0
  210. package/runtime/webapp/dist/assets/CollaborationDashboard-CV18iiBO.js +1 -0
  211. package/runtime/webapp/dist/assets/{CollaborationPage-B1tiqgnG.js → CollaborationPage-B2mIAc-h.js} +2 -2
  212. package/runtime/webapp/dist/assets/{FilePreview-CPY6dP8Q.js → FilePreview-BCEiERA1.js} +9 -9
  213. package/runtime/webapp/dist/assets/{FileTree-BBgrOian.js → FileTree-CMbs1Gj3.js} +2 -2
  214. package/runtime/webapp/dist/assets/FileWorkspaceDrawer-BxFS-0sF.js +1 -0
  215. package/runtime/webapp/dist/assets/FlowStudioPane-CVP0Q6zR.js +5 -0
  216. package/runtime/webapp/dist/assets/HostProjectPicker-DUUgM2Cm.js +1 -0
  217. package/runtime/webapp/dist/assets/{LSPServerList-B-R7HDSP.js → LSPServerList-COMVmsvb.js} +1 -1
  218. package/runtime/webapp/dist/assets/{MCPServerList-CTc0iAwT.js → MCPServerList-C_juD6B4.js} +1 -1
  219. package/runtime/webapp/dist/assets/{MemoryViewer-Dzh_miRv.js → MemoryViewer-Et2vysSN.js} +1 -1
  220. package/runtime/webapp/dist/assets/NewSessionWindow-DwJhkRJd.js +1 -0
  221. package/runtime/webapp/dist/assets/RemoteDesktopPage-Cqsea4X7.js +1 -0
  222. package/runtime/webapp/dist/assets/{RemoteDesktopTabBridge-BA_HQv3V.js → RemoteDesktopTabBridge-BFzNwpUn.js} +1 -1
  223. package/runtime/webapp/dist/assets/{RunningSessionsIcon-BvFSI9OF.js → RunningSessionsIcon-D_cOqmmk.js} +1 -1
  224. package/runtime/webapp/dist/assets/{SessionDashboard-DcPPoXe2.js → SessionDashboard-yjdEKypJ.js} +2 -2
  225. package/runtime/webapp/dist/assets/{SessionDashboardBridge-CjoeUy-v.js → SessionDashboardBridge-Kc_1Et9r.js} +1 -1
  226. package/runtime/webapp/dist/assets/{SettingsPanel-DmdXDQUm.js → SettingsPanel-t26XhKHP.js} +2 -2
  227. package/runtime/webapp/dist/assets/{SkillManager-CS_skFZj.js → SkillManager-nZU7b1sc.js} +1 -1
  228. package/runtime/webapp/dist/assets/{TaskPaneTerminal-BFHDRCb9.js → TaskPaneTerminal-BPaCKman.js} +1 -1
  229. package/runtime/webapp/dist/assets/{TerminalPane-Dr_nY9pI.js → TerminalPane-CiIpI1Id.js} +1 -1
  230. package/runtime/webapp/dist/assets/TodoPage-CG__S6_l.js +1 -0
  231. package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-FEEApB15.js → abnfDiagram-VCTEODGH-DmKjGVfG.js} +1 -1
  232. package/runtime/webapp/dist/assets/{arc-CycwMc2c.js → arc-D6bpvBke.js} +1 -1
  233. package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-BFq9JapX.js → architectureDiagram-5GKGNRK7-NEKc2BYf.js} +1 -1
  234. package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-DkOJ55Ag.js → blockDiagram-I7D4REHJ-V6G00twZ.js} +1 -1
  235. package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-CRvi_3RM.js → c4Diagram-7LVT6UL2-CojA33V5.js} +1 -1
  236. package/runtime/webapp/dist/assets/{calendar-days-CLwKstxM.js → calendar-days-DXE_2mLa.js} +1 -1
  237. package/runtime/webapp/dist/assets/channel-D66Qxmo0.js +1 -0
  238. package/runtime/webapp/dist/assets/{check-8EVJMrTV.js → check-UipgMBET.js} +1 -1
  239. package/runtime/webapp/dist/assets/{chevron-down-ChNxfI2x.js → chevron-down-Dvinwg2S.js} +1 -1
  240. package/runtime/webapp/dist/assets/{chevron-right-Cbkc_d70.js → chevron-right-BGU3tcLA.js} +1 -1
  241. package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-Cklzvs8u.js → chunk-2Q5K7J3B-DObpPEgk.js} +1 -1
  242. package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-NxozE5UP.js → chunk-5VM5RSS4-PaTzAg6w.js} +1 -1
  243. package/runtime/webapp/dist/assets/{chunk-F27PBJKO-Dyb8E7YM.js → chunk-F27PBJKO-Pn4gut94.js} +1 -1
  244. package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-BqbMMc1n.js → chunk-IMKFNOWR-nRaVFzK9.js} +1 -1
  245. package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-do0R2H6U.js → chunk-JWPE2WC7-CxssjKKN.js} +1 -1
  246. package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-B2HIaynf.js → chunk-POPQ4Y6H-CweDXr-B.js} +1 -1
  247. package/runtime/webapp/dist/assets/{chunk-SVP7TREG-C_zmjkwn.js → chunk-SVP7TREG-C7T3FGE-.js} +1 -1
  248. package/runtime/webapp/dist/assets/{chunk-TICWLB2K-Dh2bZgM1.js → chunk-TICWLB2K-Nc0H-0_V.js} +1 -1
  249. package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-CnqciVDz.js → chunk-XXDRQBXY-D_GQGF5g.js} +1 -1
  250. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BAX0-S6b.js +1 -0
  251. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BAX0-S6b.js +1 -0
  252. package/runtime/webapp/dist/assets/{client-I0ZVCjOI.js → client-Bb0hpbIR.js} +1 -1
  253. package/runtime/webapp/dist/assets/{codeSyntax-C8n4_KZS.js → codeSyntax-DHonp3tF.js} +3 -3
  254. package/runtime/webapp/dist/assets/{collaboration-lVxWL5ce.js → collaboration-e_iziKU1.js} +1 -1
  255. package/runtime/webapp/dist/assets/composer-file-routing-CWyT7leB.js +6 -0
  256. package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-CulKVUkj.js → cose-bilkent-JH36ORCC-Ac_FBan4.js} +1 -1
  257. package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-C1LUI1_G.js → cynefin-OW5HDTMX-vr6c389q.js} +1 -1
  258. package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-D3Ymzw_P.js → cynefinDiagram-5FMLGOSQ-sXmUCrp_.js} +1 -1
  259. package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-DRaL0cGu.js → dagre-GXQ25YYZ-B0DmGxDv.js} +1 -1
  260. package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-D8gLHoZo.js → diagram-S7CK7UJ4-Dn-2jJ6S.js} +1 -1
  261. package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-CaVU0aQT.js → diagram-UQ7AKVKN-BcasYsju.js} +1 -1
  262. package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-LFAKRvZz.js → diagram-VSXAHHWV-DCgGkc82.js} +1 -1
  263. package/runtime/webapp/dist/assets/{diagram-VX7I27RA-DXpxUERc.js → diagram-VX7I27RA-Cjs0Ny4i.js} +1 -1
  264. package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-vAiik55G.js → diagram-Z3DM3KII-0nyddp0v.js} +1 -1
  265. package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-MaFL7Kgb.js → ebnfDiagram-PWID7BFC-By7gCUsz.js} +1 -1
  266. package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-DuEu79B3.js → erDiagram-RLTQ6QDP-DdwBp45A.js} +1 -1
  267. package/runtime/webapp/dist/assets/{file-types-ZVLWtslN.js → file-types-nujx8XUw.js} +1 -1
  268. package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-BAQ6nP2D.js → flowDiagram-HODETNUW-DbOwRaT9.js} +1 -1
  269. package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-C48VBnPy.js → ganttDiagram-EL5Y4UJY-CG8obc7O.js} +3 -3
  270. package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-BfWAh9Kr.js → gitGraphDiagram-WWUBYQGX-ru6aSu_g.js} +1 -1
  271. package/runtime/webapp/dist/assets/{history-D4E3D_aM.js → history-DaBh5_SJ.js} +1 -1
  272. package/runtime/webapp/dist/assets/{image-plus-DQV_EEAN.js → image-plus-Cm9jq1yo.js} +1 -1
  273. package/runtime/webapp/dist/assets/index-BAGzBXQc.css +1 -0
  274. package/runtime/webapp/dist/assets/index-YrEOkxAg.js +500 -0
  275. package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-BM7P_-u_.js → infoDiagram-27XIBGKW-Crx1iSbW.js} +1 -1
  276. package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-Cwd8XR-p.js → ishikawaDiagram-5VMMS53U-ClQPMEk5.js} +1 -1
  277. package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-MOgiksTh.js → journeyDiagram-3NMN7TZE-DHso2Xht.js} +1 -1
  278. package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-DulC5OLL.js → kanban-definition-UXKFOSKX-D6psIAhv.js} +1 -1
  279. package/runtime/webapp/dist/assets/{layout-Dku9sXQ7.js → layout-B6AVZ9v9.js} +1 -1
  280. package/runtime/webapp/dist/assets/{linear-B3-dddD7.js → linear-CEZOUjlB.js} +1 -1
  281. package/runtime/webapp/dist/assets/{list-todo-Bik5IY2r.js → list-todo-D9ChIz0f.js} +1 -1
  282. package/runtime/webapp/dist/assets/{loader-circle-C5C-IzGK.js → loader-circle-CAHZbD5s.js} +1 -1
  283. package/runtime/webapp/dist/assets/{locate-fixed-CHkezEEh.js → locate-fixed-2R48MVg_.js} +1 -1
  284. package/runtime/webapp/dist/assets/{mermaid.core-CRRXKysA.js → mermaid.core-DH0df9xk.js} +5 -5
  285. package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-CaaP-nEb.js → mindmap-definition-YA3MSWOX-QWt8leZC.js} +1 -1
  286. package/runtime/webapp/dist/assets/{mobileViewport-CekmYKqS.js → mobileViewport-CKvpvxYc.js} +1 -1
  287. package/runtime/webapp/dist/assets/new-session-window-CiRwM3Od.js +191 -0
  288. package/runtime/webapp/dist/assets/{new-session-window-BfDMd-h3.css → new-session-window-DIU2v1uh.css} +1 -1
  289. package/runtime/webapp/dist/assets/{page-_fFyRId-.js → page-Cd9ci9uo.js} +6 -6
  290. package/runtime/webapp/dist/assets/{pause-BsmUCuwZ.js → pause-ddt7BLlm.js} +1 -1
  291. package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-BqybPEwk.js → pegDiagram-XKGWAZYB-JNBt0nDx.js} +1 -1
  292. package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-BX1H2lh2.js → pieDiagram-E7YTZNPT-g0hnDqNp.js} +1 -1
  293. package/runtime/webapp/dist/assets/{pin-BsEEYq8M.js → pin-BTP5lC_c.js} +1 -1
  294. package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-Btnywv1k.js → quadrantDiagram-AXDQQJYC-mLZASjSm.js} +1 -1
  295. package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-Da_TV1ER.js → railroadDiagram-O6MQD6OU-CAXNAZhB.js} +1 -1
  296. package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-5V1Aow9h.js → requirementDiagram-BXWQKSXE-BC8y1ZXE.js} +1 -1
  297. package/runtime/webapp/dist/assets/{rotate-ccw-BbSby0GQ.js → rotate-ccw-CHFTy38a.js} +1 -1
  298. package/runtime/webapp/dist/assets/{rotate-cw-BMdX-ln4.js → rotate-cw-CFCtRFDl.js} +1 -1
  299. package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-D_OIVihV.js → sankeyDiagram-P5KCCOFB-Boi5NPjT.js} +1 -1
  300. package/runtime/webapp/dist/assets/{send-Cb7EWSJF.js → send-CzCncLlt.js} +1 -1
  301. package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-LKeF5Mri.js → sequenceDiagram-WJ2MYXX4-D4ccoVEB.js} +1 -1
  302. package/runtime/webapp/dist/assets/{session-dashboard-BFqNDCc8.js → session-dashboard-C0KfSCDl.js} +1 -1
  303. package/runtime/webapp/dist/assets/{session-tree-BK_qaCnb.js → session-tree-CTzXmV6R.js} +1 -1
  304. package/runtime/webapp/dist/assets/{shield-check-C-r87aMq.js → shield-check-Da6EGdIt.js} +1 -1
  305. package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-B6j7Q_MN.js → sizeCapture-INFHLROL-Cd5jIVgK.js} +1 -1
  306. package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-zhPFqHdQ.js → stateDiagram-D77RDMKH-DXlmaNwu.js} +1 -1
  307. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-Dh6coc1l.js +1 -0
  308. package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-C_FCENx1.js → swimlanes-42K2YHIH-DyhRB_e0.js} +1 -1
  309. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-BzriATjP.js +8 -0
  310. package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-C3DBXjDU.js → timeline-definition-24CTP7MA-Bkfs9Mi-.js} +1 -1
  311. package/runtime/webapp/dist/assets/{trash-2-DjggJGbw.js → trash-2-C682LDDA.js} +1 -1
  312. package/runtime/webapp/dist/assets/{types-BQCEWNQz.js → types-CfOuS-6l.js} +1 -1
  313. package/runtime/webapp/dist/assets/{use-session-activity-BbTXGW7Z.js → use-session-activity-C9Cn92Hj.js} +1 -1
  314. package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-CssdTIB0.js → vennDiagram-4TSXK5OY-APWT64sw.js} +1 -1
  315. package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-C58K2vVU.js → wardleyDiagram-VM6X3IG4-H7xLoxwM.js} +1 -1
  316. package/runtime/webapp/dist/assets/{web-B4y8vdRZ.js → web-CT8e03DV.js} +1 -1
  317. package/runtime/webapp/dist/assets/{web-D9rJZXHW.js → web-DG022HwJ.js} +1 -1
  318. package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-CQi8bD6A.js → xychartDiagram-S5SC5T6Z-DIrxZ4UJ.js} +1 -1
  319. package/runtime/webapp/dist/assets/{zoom-out-iMMWRXJs.js → zoom-out-CRN76HNZ.js} +1 -1
  320. package/runtime/webapp/dist/index.html +2 -2
  321. package/runtime/ws-server.mjs +5 -0
  322. package/runtime/.next/static/chunks/app/web/layout-80fa1b5f4c96b0b5.js +0 -1
  323. package/runtime/.next/static/chunks/main-app-ea4c5663714943e2.js +0 -1
  324. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0e6mn0ck.mjs +0 -17
  325. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-0ssqfy51.mjs +0 -18
  326. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-82ghff97.mjs +0 -39
  327. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-82yhcz2x.mjs +0 -17
  328. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-b8jr1m8m.mjs +0 -23
  329. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-cj0jh226.mjs +0 -17
  330. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-ebtbxtjf.mjs +0 -28
  331. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-pb4erfqh.mjs +0 -42
  332. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-rs058s2g.mjs +0 -16
  333. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-w6pv4szb.mjs +0 -18
  334. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-wjeh40nr.mjs +0 -20
  335. package/runtime/webapp/dist/assets/AIHubView-CM6ugXG3.js +0 -1
  336. package/runtime/webapp/dist/assets/AiHubPane-DFzC3nbd.js +0 -1
  337. package/runtime/webapp/dist/assets/App-mF6ELC07.js +0 -68
  338. package/runtime/webapp/dist/assets/BrowserLivePanel-CamAULwS.js +0 -61
  339. package/runtime/webapp/dist/assets/CalendarPage-BbYdGYWn.js +0 -1
  340. package/runtime/webapp/dist/assets/CollaborationCreateDialog-CWhmFQtA.js +0 -1
  341. package/runtime/webapp/dist/assets/CollaborationDashboard-XL5SnFOu.js +0 -1
  342. package/runtime/webapp/dist/assets/FileWorkspaceDrawer-BXDuKlrL.js +0 -1
  343. package/runtime/webapp/dist/assets/FlowStudioPane-lnjLcd9c.js +0 -5
  344. package/runtime/webapp/dist/assets/HostProjectPicker-DN_vGqQb.js +0 -1
  345. package/runtime/webapp/dist/assets/NewSessionWindow-zjqAUfKb.js +0 -1
  346. package/runtime/webapp/dist/assets/RemoteDesktopPage-9AhztqA2.js +0 -1
  347. package/runtime/webapp/dist/assets/TodoPage-guIvBCW0.js +0 -1
  348. package/runtime/webapp/dist/assets/artifact-links-B0ApmgK6.js +0 -2
  349. package/runtime/webapp/dist/assets/channel-BwDuyJO4.js +0 -1
  350. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BfyV8P0w.js +0 -1
  351. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BfyV8P0w.js +0 -1
  352. package/runtime/webapp/dist/assets/composer-file-routing-qSvJpT-v.js +0 -6
  353. package/runtime/webapp/dist/assets/download-BE31-Qm0.js +0 -6
  354. package/runtime/webapp/dist/assets/index-DSgLFE4Q.js +0 -489
  355. package/runtime/webapp/dist/assets/index-zQk0NCEB.css +0 -1
  356. package/runtime/webapp/dist/assets/new-session-window-Dgl7UWPR.js +0 -190
  357. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-DWnBZAiI.js +0 -1
  358. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-DOZCbCJP.js +0 -8
  359. package/runtime/webapp/dist/assets/x-BYUglEo9.js +0 -6
  360. /package/runtime/.next/static/{57IUKkg-db8mOGDMma8be → _rMvYWpbWkNWrFkCQx3rK}/_buildManifest.js +0 -0
  361. /package/runtime/.next/static/{57IUKkg-db8mOGDMma8be → _rMvYWpbWkNWrFkCQx3rK}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[744],{701:function(e,n,t){Promise.resolve().then(t.t.bind(t,7709,23)),Promise.resolve().then(t.t.bind(t,5613,23)),Promise.resolve().then(t.t.bind(t,6554,23)),Promise.resolve().then(t.t.bind(t,1338,23)),Promise.resolve().then(t.t.bind(t,9011,23)),Promise.resolve().then(t.t.bind(t,1573,23))}},function(e){var n=function(n){return e(e.s=n)};e.O(0,[37,183],function(){return n(5130),n(701)}),_N_E=e.O()}]);
@@ -6,7 +6,7 @@ export class PacedVideoSender {
6
6
  * Packet values and frame contexts are opaque to this coordinator.
7
7
  */
8
8
  constructor({ policy, clock, write, writeRepair, onRepairExpired = () => undefined,
9
- onRecovery = () => undefined, onKeyframe, onError, onFrameSent = () => undefined }) {
9
+ onRecovery = () => undefined, onKeyframe, onError, onFrameSent = () => undefined, onEncoderPressure }) {
10
10
  this.policy = policy;
11
11
  this.clock = clock;
12
12
  this.write = write;
@@ -16,6 +16,9 @@ export class PacedVideoSender {
16
16
  this.onKeyframe = onKeyframe;
17
17
  this.onError = onError;
18
18
  this.onFrameSent = onFrameSent;
19
+ this.onEncoderPressure = onEncoderPressure;
20
+ this.encoderBlocked = false;
21
+ this.pressureSentAt = -Infinity;
19
22
  this.queue = [];
20
23
  this.repairs = [];
21
24
  this.queuedRepairBytes = 0;
@@ -99,6 +102,20 @@ export class PacedVideoSender {
99
102
  return oldest ? Math.max(0, this.clock.now() - oldest.enqueuedAt) : 0;
100
103
  }
101
104
 
105
+ updateEncoderPressure() {
106
+ if (!this.onEncoderPressure) return;
107
+ const now = this.clock.now();
108
+ const bytes = this.queuedBytes + this.queuedRepairBytes;
109
+ const delay = Math.max(this.queueDelayMs, bytes * 8000 / Math.max(1, this.policy.pacingBitRate));
110
+ const blocked = this.running && delay >= (this.encoderBlocked ? 25 : 50);
111
+ // Refresh a bounded native hold while the pacer is busy. An interrupted
112
+ // control pipe can never strand the final screen update in the encoder.
113
+ if (blocked === this.encoderBlocked && (!blocked || now - this.pressureSentAt < 100)) return;
114
+ this.encoderBlocked = blocked;
115
+ this.pressureSentAt = now;
116
+ this.onEncoderPressure(blocked);
117
+ }
118
+
102
119
  snapshot() {
103
120
  const oldest = this.current ?? this.queue[0];
104
121
  const snapshot = {
@@ -126,6 +143,7 @@ export class PacedVideoSender {
126
143
  this.queuedBytes = 0;
127
144
  this.droppedFrames = 0; this.supersededFrames = 0;
128
145
  this.policy.requireKeyframe();
146
+ this.updateEncoderPressure();
129
147
  this.onRecovery();
130
148
  }
131
149
 
@@ -196,6 +214,7 @@ export class PacedVideoSender {
196
214
  }
197
215
 
198
216
  wake(delay = 0) {
217
+ this.updateEncoderPressure();
199
218
  if (!this.running || this.draining || this.timer !== null || (!this.current && !this.queue.length && !this.repairs.length)) return;
200
219
  const generation = this.generation;
201
220
  this.timer = this.clock.schedule(() => {
@@ -160,6 +160,8 @@ export class RemoteVideoSession {
160
160
  encoderQueuedFrames: encoder.queuedFrames,
161
161
  encoderCoalescedFrames: encoder.coalescedFrames,
162
162
  encoderAdmissionLimit: encoder.admissionLimit,
163
+ captureMaxFps: encoder.captureMaxFps,
164
+ capturePixelFormat: encoder.capturePixelFormat,
163
165
  encoderLatencyMs: encoder.encodeLatencyMs,
164
166
  encoderDroppedFrames: encoder.droppedFrames,
165
167
  encoderSequence: encoder.sequence,
@@ -217,10 +219,13 @@ export class RemoteVideoSession {
217
219
  const generation = this.generation;
218
220
  this.policy.setCapabilities?.(this.encoder.capabilities());
219
221
  this.policy.resetSession?.();
222
+ this.policy.setMotionMode?.(data.motionMode ?? 'balanced');
223
+ this.captureFps = data.motionMode === 'motion-60' ? 60 : 30;
220
224
  this.sessionStartedAt = Date.now();
221
225
  const receiverProfiles = Array.isArray(data.receiverProfiles) ? data.receiverProfiles : ['baseline'];
222
226
  const profile = this.policy.selectCodec?.(receiverProfiles) ?? 'baseline';
223
- this.compoundRequested = data.compoundVersion === 1 && this.encoder.capabilities().compoundVideo === true;
227
+ this.compoundRequested = (data.motionMode ?? 'balanced') === 'balanced'
228
+ && data.compoundVersion === 1 && this.encoder.capabilities().compoundVideo === true;
224
229
  return this.startAttempt(profile, generation);
225
230
  }
226
231
  if (data.kind === 'answer') {
@@ -257,6 +262,10 @@ export class RemoteVideoSession {
257
262
  onKeyframe: () => { if (!this.paused) void this.encoder.requestKeyframe().catch(() => undefined); },
258
263
  onState: state => { void this.onTransportState(state, transport, generation); },
259
264
  onFeedback: sample => this.onTransportFeedback(sample, transport, generation),
265
+ onEncoderPressure: blocked => {
266
+ if (this.transport === transport && this.generation === generation && this.encoderActive && !this.paused)
267
+ this.encoder.setEncoderPressure?.(blocked);
268
+ },
260
269
  onFrameSent: frame => this.onFrameSent(frame, generation, transport),
261
270
  compound: this.compoundRequested === true,
262
271
  inputStream: inputContext?.stream,
@@ -296,11 +305,11 @@ export class RemoteVideoSession {
296
305
  if (generation !== this.generation || this.transport !== transport) return;
297
306
  if (state === 'connected') {
298
307
  clearTimeout(this.connectTimer);
299
- const decision = { ...this.policy.current('connected'), preferredCodec: this.profile };
308
+ let decision = { ...this.policy.current('connected'), preferredCodec: this.profile };
300
309
  transport.setTuning?.(decision);
301
310
  this.seedProtection(transport);
302
311
  try {
303
- await this.encoder.start({ profile: this.profile, decision });
312
+ await this.encoder.start({ profile: this.profile, decision, videoOnly: !this.compoundRequested, captureFps: this.captureFps });
304
313
  if (generation !== this.generation || this.transport !== transport) {
305
314
  await this.encoder.stop().catch(() => undefined);
306
315
  return;
@@ -309,6 +318,7 @@ export class RemoteVideoSession {
309
318
  // Native extensions become available only after the helper capability receipt.
310
319
  this.policy.setCapabilities?.(this.encoder.capabilities());
311
320
  this.policy.selectCodec?.([this.profile]);
321
+ decision = { ...this.policy.current('connected'), preferredCodec: this.profile };
312
322
  if (this.compound) {
313
323
  await this.compound.start();
314
324
  if (generation !== this.generation || this.transport !== transport) return;
@@ -317,7 +327,8 @@ export class RemoteVideoSession {
317
327
  this.log('info', 'webrtc connected; encoder started', {
318
328
  profile: this.profile, bitRate: decision.bitRate, maxFps: decision.maxFps, preferredCodec: decision.preferredCodec,
319
329
  });
320
- this.signal({ kind: 'state', state: 'connected', attemptId: this.attemptId });
330
+ this.signal({ kind: 'state', state: 'connected', attemptId: this.attemptId,
331
+ ...(this.encoder.capabilities().maxFrameRate === 60 ? { maxFrameRate: 60 } : {}) });
321
332
  this.watchFrames(transport, generation);
322
333
  this.watchStats(transport, generation);
323
334
  this.watchProtection(transport, generation);
@@ -486,6 +497,8 @@ export class RemoteVideoSession {
486
497
  }
487
498
  }
488
499
  async stopAttempt() {
500
+ this.pendingDecision = null;
501
+ this.latestDecision = null;
489
502
  this.playbackHealthy = false;
490
503
  this.receiverObservation = null;
491
504
  this.lastUrgentNetworkAt = -Infinity;
@@ -498,6 +511,7 @@ export class RemoteVideoSession {
498
511
  const transport = this.transport; this.transport = null;
499
512
  this.attemptId = undefined;
500
513
  transport?.pause?.();
514
+ await this.tuningChain;
501
515
  const compound = this.compound; this.compound = null;
502
516
  await compound?.stop();
503
517
  if (hadAttempt) await this.encoder.stop();
@@ -81,7 +81,10 @@ export class RemoteHelper {
81
81
  await this.stop();
82
82
  const generation = this.generation;
83
83
  if (!await this.available()) throw new Error('当前 CLI 未包含远程授权组件,请升级 CLI');
84
- if (this.application) return this.application.withPreparedApp(() => this.openPrepared(generation));
84
+ if (this.application) return this.application.withPreparedApp(async (_path, fingerprint) => {
85
+ await this.openPrepared(generation);
86
+ this.componentFingerprint = fingerprint;
87
+ });
85
88
  return this.openPrepared(generation);
86
89
  }
87
90
  async openPrepared(generation) {
@@ -174,6 +177,23 @@ export class RemoteHelper {
174
177
  } catch (error) { await this.stop(); throw error; }
175
178
  }
176
179
  request(command) {
180
+ if (command.op === 'authorize' && this.componentFingerprint) return this.requestPermission(command);
181
+ return this.sendCommand(command);
182
+ }
183
+ async requestPermission(command) {
184
+ const generation = this.generation, fingerprint = this.componentFingerprint;
185
+ const reset = await this.preparePermission(command.permission);
186
+ if (generation !== this.generation) throw new Error('远控组件已切换,请重新授权');
187
+ if (reset && (!this.socket || this.socket.destroyed)) {
188
+ await this.start();
189
+ if (this.componentFingerprint !== fingerprint) return this.request(command);
190
+ }
191
+ return this.sendCommand(command);
192
+ }
193
+ preparePermission(permission) {
194
+ return this.application.beforePermissionPrompt(this.componentFingerprint, permission, () => this.sendCommand({ op: 'status' }));
195
+ }
196
+ sendCommand(command) {
177
197
  if (!this.socket || this.socket.destroyed) return Promise.reject(new Error('远程授权组件未连接'));
178
198
  const id = ++this.sequence;
179
199
  return new Promise((resolve, reject) => {
@@ -187,7 +207,7 @@ export class RemoteHelper {
187
207
  }
188
208
  rejectPending() { for (const item of this.pending.values()) { clearTimeout(item.timer); item.reject(new Error('远程授权组件已断开')); } this.pending.clear(); }
189
209
  async stop() {
190
- this.generation += 1; this.cancelStart?.(); this.cancelStart = null;
210
+ this.generation += 1; this.componentFingerprint = null; this.cancelStart?.(); this.cancelStart = null;
191
211
  const socket = this.socket;
192
212
  if (socket && !socket.destroyed) {
193
213
  const closed = new Promise((resolve) => socket.once('close', resolve));
@@ -200,3 +220,17 @@ export class RemoteHelper {
200
220
  if (this.directory) { await rm(this.directory, { recursive: true, force: true }); this.directory = null; }
201
221
  }
202
222
  }
223
+
224
+ // A newer CLI or desktop may still be connected to an older gateway. Prepare
225
+ // its own payload locally, then let the selected gateway open the system dialog.
226
+ export async function prepareMacRemoteComponent(sourcePath, permission) {
227
+ const application = new MacRemoteHelperApp({ sourcePath });
228
+ const pending = await application.withPreparedApp((_path, hash) =>
229
+ permission && application.permissions.hasPending(hash, permission));
230
+ if (!pending) return;
231
+ const helper = new RemoteHelper({ application });
232
+ try {
233
+ await helper.start();
234
+ await helper.preparePermission(permission);
235
+ } finally { await helper.stop(); }
236
+ }
@@ -13,6 +13,7 @@ export class NativeVideoEncoder {
13
13
  return {
14
14
  dynamicBitrate: !this.legacyVideo,
15
15
  dynamicFrameRate: !this.legacyVideo,
16
+ maxFrameRate: this.maxFrameRate ?? 30,
16
17
  dynamicResolution: !this.legacyVideo && this.resolutionSupported === true,
17
18
  encoderQueueTelemetry: !this.legacyVideo,
18
19
  explicitH264Profile: this.highProfile && !this.legacyVideo,
@@ -53,7 +54,7 @@ export class NativeVideoEncoder {
53
54
  }));
54
55
  }
55
56
 
56
- async start({ profile, decision }) {
57
+ async start({ profile, decision, videoOnly = false, captureFps = 30 }) {
57
58
  if (this.legacyVideo) {
58
59
  if (profile !== 'baseline') throw new Error('Legacy video helper supports Baseline only');
59
60
  await this.helper.request({ op: 'video', enabled: true });
@@ -61,10 +62,14 @@ export class NativeVideoEncoder {
61
62
  }
62
63
  try {
63
64
  this.resolutionConfigured = decision.maxEdge !== undefined;
64
- const reply = await this.helper.request({ op: 'video-start', profile, bitRate: decision.bitRate, maxFps: decision.maxFps,
65
+ // Start within the legacy limit until this specific helper advertises 60 fps.
66
+ const reply = await this.helper.request({ op: 'video-start', profile, bitRate: decision.bitRate, maxFps: Math.min(decision.maxFps, 30),
67
+ ...(videoOnly ? { videoOnly: true } : {}), ...(captureFps === 60 ? { captureFps } : {}),
65
68
  ...(decision.maxEdge !== undefined || this.resolutionConfigured ? { maxEdge: decision.maxEdge ?? 0 } : {}),
66
69
  ...liveView.remoteVideoEncodeAdmission(decision.maxFps), keyFrameInterval: liveView.remoteVideoKeyframeInterval(decision.maxFps, decision.reason) });
67
70
  this.resolutionSupported = reply?.adaptiveResolutionVersion === 1;
71
+ this.maxFrameRate = reply?.maxFrameRate === 60 ? 60 : 30;
72
+ this.canHoldEncoder = reply?.encoderPressureVersion === 1;
68
73
  } catch (error) {
69
74
  if (profile === 'high') throw error;
70
75
  await this.helper.request({ op: 'video', enabled: true });
@@ -72,6 +77,10 @@ export class NativeVideoEncoder {
72
77
  }
73
78
  }
74
79
 
80
+ setEncoderPressure(blocked) {
81
+ if (this.canHoldEncoder) return this.helper.request({ op: 'video-backpressure', blocked }).catch(() => undefined);
82
+ }
83
+
75
84
  apply(decision) {
76
85
  if (this.legacyVideo) return Promise.resolve();
77
86
  const resolution = decision.maxEdge !== undefined || this.resolutionConfigured ? { maxEdge: decision.maxEdge ?? 0 } : {};
@@ -92,6 +101,8 @@ export class NativeVideoEncoder {
92
101
  const result = await this.helper.request({ op: 'video-stats' });
93
102
  if (!result || result.ok === false) return null;
94
103
  const telemetry = {
104
+ captureMaxFps: [30, 60].includes(result.captureMaxFps) ? result.captureMaxFps : undefined,
105
+ capturePixelFormat: ['BGRA', 'NV12'].includes(result.capturePixelFormat) ? result.capturePixelFormat : undefined,
95
106
  pendingFrames: Number.isFinite(result.pendingFrames) ? result.pendingFrames : undefined,
96
107
  queuedFrames: Number.isFinite(result.queuedFrames) ? result.queuedFrames : undefined,
97
108
  coalescedFrames: Number.isFinite(result.coalescedFrames) ? result.coalescedFrames : undefined,
@@ -111,6 +122,8 @@ export class NativeVideoEncoder {
111
122
  }
112
123
 
113
124
  stop() {
125
+ this.canHoldEncoder = false;
126
+ this.maxFrameRate = 30;
114
127
  return this.helper.request({ op: 'video', enabled: false }).catch(() => undefined);
115
128
  }
116
129
  }
@@ -42,13 +42,14 @@ export function packetizeH264(nals, timestamp, state) {
42
42
 
43
43
  export class WeriftVideoTransport {
44
44
  constructor({ signal, iceConfig, onState = () => undefined, onKeyframe = () => undefined, onFeedback = () => undefined,
45
- onFrameSent = () => undefined, compound = false, onCompoundMessage = () => undefined, inputStream, inputVersion = 1, onInput = () => 'unavailable', onReliableInput, clock }) {
45
+ onFrameSent = () => undefined, onEncoderPressure, compound = false, onCompoundMessage = () => undefined, inputStream, inputVersion = 1, onInput = () => 'unavailable', onReliableInput, clock }) {
46
46
  this.signal = signal;
47
47
  this.iceConfig = iceConfig;
48
48
  this.onState = onState;
49
49
  this.onKeyframe = onKeyframe;
50
50
  this.onFeedback = onFeedback;
51
51
  this.onFrameSent = onFrameSent;
52
+ this.onEncoderPressure = onEncoderPressure;
52
53
  this.compound = compound;
53
54
  this.onCompoundMessage = onCompoundMessage;
54
55
  this.inputStream = inputStream; this.inputVersion = inputVersion; this.onInput = onInput; this.onReliableInput = onReliableInput;
@@ -94,6 +95,7 @@ export class WeriftVideoTransport {
94
95
  onRecovery: () => this.recovery?.reset(),
95
96
  onKeyframe: () => this.requestKeyframe(),
96
97
  onFrameSent: context => this.onFrameSent(context),
98
+ onEncoderPressure: this.onEncoderPressure,
97
99
  onError: () => { this.connected = false; this.onState('failed'); },
98
100
  });
99
101
  }
@@ -1,16 +1,16 @@
1
1
  import { execFile, spawn } from 'node:child_process';
2
2
  import { createHash } from 'node:crypto';
3
3
  import { existsSync } from 'node:fs';
4
- import { access, cp, lstat, mkdir, mkdtemp, open, readFile, readdir, rename, rm } from 'node:fs/promises';
4
+ import { access, cp, lstat, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm } from 'node:fs/promises';
5
5
  import { homedir } from 'node:os';
6
6
  import { dirname, join, resolve } from 'node:path';
7
7
  import { fileURLToPath } from 'node:url';
8
8
  import { promisify } from 'node:util';
9
9
  import { setTimeout as delay } from 'node:timers/promises';
10
10
  import { componentVersionPattern as versionPattern, compareComponentVersions as compareVersions } from './component-version.mjs';
11
+ import { MacHelperPermissions, macRemoteBundleId } from './macos-helper-permissions.mjs';
11
12
 
12
13
  const run = promisify(execFile);
13
- const bundleId = 'com.agentroam.remote-desktop';
14
14
  const executable = 'Contents/MacOS/agentroam-remote-desktop';
15
15
  const metadata = 'Contents/Resources/agentroam-component.json';
16
16
 
@@ -29,7 +29,7 @@ async function readBundle(path) {
29
29
  let version = 'legacy';
30
30
  try {
31
31
  const value = JSON.parse(await readFile(join(path, metadata), 'utf8'));
32
- if (value.bundleId !== bundleId || !versionPattern.test(value.version)) throw new Error('远控组件版本信息无效');
32
+ if (value.bundleId !== macRemoteBundleId || !versionPattern.test(value.version)) throw new Error('远控组件版本信息无效');
33
33
  version = value.version;
34
34
  } catch (error) { if (error.code !== 'ENOENT') throw error; }
35
35
  const hash = createHash('sha256');
@@ -102,6 +102,28 @@ async function unregisterApp(path) {
102
102
  await run(register, ['-u', path], { timeout: 5000, maxBuffer: 4096 });
103
103
  }
104
104
 
105
+ async function registeredInactiveCopies() {
106
+ // Query Launch Services via AppKit. This does not send Apple Events or prompt.
107
+ const script = `function run(args) {
108
+ ObjC.import("AppKit");
109
+ const running = $.NSRunningApplication.runningApplicationsWithBundleIdentifier(args[0]);
110
+ const active = new Set();
111
+ for (let i = 0; i < running.count; i++) {
112
+ const url = running.objectAtIndex(i).bundleURL;
113
+ if (url && !url.isNil()) active.add(ObjC.unwrap(url.path));
114
+ }
115
+ const urls = $.NSWorkspace.sharedWorkspace.URLsForApplicationsWithBundleIdentifier(args[0]);
116
+ const paths = [];
117
+ for (let i = 0; i < urls.count; i++) {
118
+ const path = ObjC.unwrap(urls.objectAtIndex(i).path);
119
+ if (!active.has(path)) paths.push(path);
120
+ }
121
+ return JSON.stringify(paths);
122
+ }`;
123
+ const { stdout } = await run('/usr/bin/osascript', ['-l', 'JavaScript', '-e', script, macRemoteBundleId], { timeout: 5000 });
124
+ return JSON.parse(stdout);
125
+ }
126
+
105
127
  export async function acquireMacInstallLock(path, timeoutMs) {
106
128
  const handle = await open(path, 'a', 0o600);
107
129
  try {
@@ -119,8 +141,16 @@ export async function acquireMacInstallLock(path, timeoutMs) {
119
141
 
120
142
  /** One installed app per user; npm version directories only carry its payload. */
121
143
  export class MacRemoteHelperApp {
122
- constructor({ sourcePath = bundledRemoteAppPath(), appPath = join(homedir(), 'Library/Application Support/AgentRoamRemoteDesktop/Services.noindex/AgentRoam Remote Desktop.app'), processes = macHelperProcesses, stopProcesses = stopMacHelperProcesses, verify = verifyBundle, register = registerApp, unregister = unregisterApp, acquireLock = acquireMacInstallLock, lockTimeoutMs = 10000 } = {}) {
123
- Object.assign(this, { sourcePath, appPath, processes, stopProcesses, verify, register, unregister, acquireLock, lockTimeoutMs });
144
+ constructor({
145
+ sourcePath = bundledRemoteAppPath(),
146
+ appPath = join(homedir(), 'Library/Application Support/AgentRoamRemoteDesktop/Services.noindex/AgentRoam Remote Desktop.app'),
147
+ processes = macHelperProcesses, stopProcesses = stopMacHelperProcesses, verify = verifyBundle,
148
+ register = registerApp, unregister = unregisterApp, registeredCopies = registeredInactiveCopies,
149
+ acquireLock = acquireMacInstallLock, lockTimeoutMs = 10000,
150
+ permissions = new MacHelperPermissions(join(dirname(appPath), '.remote-helper-permissions.json')),
151
+ } = {}) {
152
+ Object.assign(this, { sourcePath, appPath, processes, stopProcesses, verify, register, unregister, registeredCopies, acquireLock, lockTimeoutMs });
153
+ this.permissions = permissions;
124
154
  }
125
155
  async available() { try { await access(join(this.sourcePath, executable)); return true; } catch { return false; } }
126
156
  async registerInstalled(hash) {
@@ -133,7 +163,39 @@ export class MacRemoteHelperApp {
133
163
  const source = await readBundle(this.sourcePath);
134
164
  return { name: 'AgentRoam Remote Desktop', path: this.appPath, version: installed?.version ?? source?.version ?? 'unknown', fingerprint: (installed ?? source)?.hash.slice(0, 12), installed: Boolean(installed), updatePending: false };
135
165
  }
166
+ async removeObsoleteRegistrations(installed) {
167
+ const managed = await realpath(this.appPath);
168
+ for (const path of new Set(await this.registeredCopies())) {
169
+ try {
170
+ if (resolve(path) === managed) continue;
171
+ const info = await lstat(path);
172
+ if (!info.isDirectory() || info.uid !== process.getuid() || await realpath(path) === managed) continue;
173
+ const copy = await readBundle(path);
174
+ if (!copy || (copy.hash !== installed.hash && compareVersions(copy.version, installed.version) >= 0)) continue;
175
+ await this.verify(path);
176
+ // Registration only. A backup or another CLI's repair payload belongs to its owner.
177
+ await this.unregister(path);
178
+ } catch { /* Ignore missing, unreadable or unrelated registrations. */ }
179
+ }
180
+ await this.register(this.appPath, this.appPath);
181
+ }
136
182
  lock() { return this.acquireLock(join(dirname(this.appPath), '.remote-helper-install.lock'), this.lockTimeoutMs); }
183
+ async beforePermissionPrompt(fingerprint, permission, probe) {
184
+ const unlock = await this.lock();
185
+ try {
186
+ return await this.permissions.beforePrompt(fingerprint, permission, async () => {
187
+ const installed = await readBundle(this.appPath);
188
+ if (installed?.hash !== fingerprint) throw new Error('远控组件已更新,请重新授权');
189
+ const status = await probe();
190
+ if (status.locked === false && status[permission] === false) {
191
+ await this.removeObsoleteRegistrations(installed).catch(error => {
192
+ console.warn('远控旧应用登记清理失败,将继续请求系统授权', { code: error.code });
193
+ });
194
+ }
195
+ return status;
196
+ });
197
+ } finally { await unlock(); }
198
+ }
137
199
  prepare() { return this.withPreparedApp(path => path); }
138
200
  async withPreparedApp(use) {
139
201
  await mkdir(dirname(this.appPath), { recursive: true, mode: 0o700 });
@@ -144,7 +206,9 @@ export class MacRemoteHelperApp {
144
206
  const backup = join(dirname(this.appPath), '.remote-helper-previous.app');
145
207
  const previous = await lstat(backup).catch(error => { if (error.code !== 'ENOENT') throw error; return null; });
146
208
  if (previous) {
147
- if (!previous.isDirectory() || previous.isSymbolicLink() || !await readBundle(backup)) throw new Error('远控组件更新备份无效,未覆盖');
209
+ if (!previous.isDirectory() || previous.isSymbolicLink()) throw new Error('远控组件更新备份无效,未覆盖');
210
+ const previousBundle = await readBundle(backup);
211
+ if (!previousBundle) throw new Error('远控组件更新备份无效,未覆盖');
148
212
  // Recover a process exit between the two renames before considering
149
213
  // the current CLI's version, which might be older than the backup.
150
214
  if (!existing) {
@@ -152,8 +216,10 @@ export class MacRemoteHelperApp {
152
216
  await rename(backup, this.appPath);
153
217
  existing = await lstat(this.appPath);
154
218
  } else {
155
- if (!await readBundle(this.appPath)) throw new Error('远控组件更新未完成,已保留旧应用备份');
219
+ const current = await readBundle(this.appPath);
220
+ if (!current) throw new Error('远控组件更新未完成,已保留旧应用备份');
156
221
  await this.verify(this.appPath);
222
+ await this.permissions.recordReplacement(backup, previousBundle.hash, this.appPath, current.hash);
157
223
  await rm(backup, { recursive: true });
158
224
  }
159
225
  }
@@ -186,10 +252,11 @@ export class MacRemoteHelperApp {
186
252
  const stoppedPaths = new Set(stop.map(item => resolve(item.path)));
187
253
  if ((await this.processes()).some(item => stoppedPaths.has(resolve(item.path)))) throw new Error('旧远控组件仍在使用,未替换现有应用');
188
254
  };
189
- const cleanup = async () => {
255
+ const cleanup = async targetHash => {
190
256
  for (const item of new Map(retired.filter(item => item.remove).map(item => [resolve(item.appPath), item])).values()) {
191
257
  if ((await readBundle(item.appPath))?.hash !== item.hash) throw new Error('旧远控组件已变化,未删除');
192
258
  if ((await this.processes()).some(process => resolve(process.path) === resolve(item.path))) throw new Error('旧远控组件重新启动,未删除');
259
+ await this.permissions.recordReplacement(item.appPath, item.hash, this.appPath, targetHash);
193
260
  await this.unregister(item.appPath);
194
261
  await rm(item.appPath, { recursive: true });
195
262
  }
@@ -198,8 +265,9 @@ export class MacRemoteHelperApp {
198
265
  await this.verify(this.appPath);
199
266
  await retire();
200
267
  await this.registerInstalled(installed.hash);
201
- await cleanup();
202
- return await use(this.appPath);
268
+ await cleanup(installed.hash);
269
+ await this.permissions.trackInstallation(installed.hash, this.appPath);
270
+ return await use(this.appPath, installed.hash);
203
271
  }
204
272
  const staging = await mkdtemp(join(dirname(this.appPath), '.remote-helper-update-'));
205
273
  const staged = join(staging, 'AgentRoam Remote Desktop.app');
@@ -219,14 +287,16 @@ export class MacRemoteHelperApp {
219
287
  throw error;
220
288
  }
221
289
  await this.registerInstalled(source.hash);
222
- if (moved) await rm(backup, { recursive: true });
223
- await cleanup();
290
+ if (moved) {
291
+ await this.permissions.recordReplacement(backup, installed.hash, this.appPath, source.hash);
292
+ await rm(backup, { recursive: true });
293
+ }
294
+ await cleanup(source.hash);
295
+ await this.permissions.trackInstallation(source.hash);
224
296
  } finally {
225
- // Backups are removed only after replacement. Permission records and
226
- // user data are not part of component cleanup.
227
297
  await rm(staging, { recursive: true, force: true });
228
298
  }
229
- return await use(this.appPath);
299
+ return await use(this.appPath, source.hash);
230
300
  } finally { await unlock(); }
231
301
  }
232
302
  }
@@ -0,0 +1,113 @@
1
+ import { execFile } from 'node:child_process';
2
+ import { randomUUID } from 'node:crypto';
3
+ import { readFile, rename, rm, writeFile } from 'node:fs/promises';
4
+ import { promisify } from 'node:util';
5
+
6
+ const run = promisify(execFile);
7
+ const services = new Map([['screen', 'ScreenCapture'], ['accessibility', 'Accessibility']]);
8
+ export const macRemoteBundleId = 'com.agentroam.remote-desktop';
9
+
10
+ async function designatedRequirement(app) {
11
+ try {
12
+ const { stdout, stderr } = await run('/usr/bin/codesign', ['-d', '-r-', app], { timeout: 5000 });
13
+ return /^#?\s*designated => (.+)$/m.exec(stdout + '\n' + stderr)?.[1].trim();
14
+ } catch { return undefined; }
15
+ }
16
+
17
+ // macOS uses the previous binary's designated requirement to recognize an
18
+ // update. A new CDHash alone is normal for a Developer ID signed upgrade.
19
+ export async function requiresNewMacGrant(previousApp, nextApp) {
20
+ const requirement = await designatedRequirement(previousApp);
21
+ if (!requirement) return false;
22
+ try { await run('/usr/bin/codesign', ['--verify', '--deep', '--strict', previousApp], { timeout: 10000 }); }
23
+ catch { return false; }
24
+ try {
25
+ await run('/usr/bin/codesign', ['--verify', '-R', '=' + requirement, nextApp], { timeout: 5000 });
26
+ return false;
27
+ } catch (error) {
28
+ // Exit 3 specifically means a verified signature did not meet the requirement.
29
+ return error.code === 3;
30
+ }
31
+ }
32
+
33
+ async function hasBuildSpecificIdentity(app) {
34
+ return /^cdhash H"[0-9a-f]+"$/i.test(await designatedRequirement(app) ?? '');
35
+ }
36
+
37
+ async function resetService(service) {
38
+ await run('/usr/bin/tccutil', ['reset', service, macRemoteBundleId], { timeout: 5000 });
39
+ }
40
+
41
+ /** Shared by all CLI and desktop runtimes, under the managed app's install lock. */
42
+ export class MacHelperPermissions {
43
+ constructor(file, { requiresNewGrant = requiresNewMacGrant, buildSpecific = hasBuildSpecificIdentity, reset = resetService } = {}) {
44
+ this.file = file;
45
+ this.requiresNewGrant = requiresNewGrant;
46
+ this.buildSpecific = buildSpecific;
47
+ this.reset = reset;
48
+ }
49
+
50
+ async read() {
51
+ try {
52
+ const state = JSON.parse(await readFile(this.file, 'utf8'));
53
+ return typeof state?.fingerprint === 'string' && Array.isArray(state.pending) ? state : null;
54
+ } catch (error) {
55
+ if (error.code === 'ENOENT' || error instanceof SyntaxError) return null;
56
+ throw error;
57
+ }
58
+ }
59
+
60
+ async save(fingerprint, pending, migration) {
61
+ const temporary = this.file + '.' + randomUUID();
62
+ try {
63
+ await writeFile(temporary, JSON.stringify({ fingerprint, pending, migration }), { flag: 'wx', mode: 0o600 });
64
+ await rename(temporary, this.file);
65
+ } finally { await rm(temporary, { force: true }); }
66
+ }
67
+
68
+ async trackInstallation(fingerprint, preexistingApp) {
69
+ if ((await this.read())?.fingerprint === fingerprint) return;
70
+ // Older installers have already discarded the previous signature. Admit a
71
+ // legacy ad hoc install once, and only act if the user requests a missing grant.
72
+ const migration = Boolean(preexistingApp && await this.buildSpecific(preexistingApp));
73
+ await this.save(fingerprint, migration ? [...services.keys()] : [], migration);
74
+ }
75
+
76
+ async recordReplacement(previousApp, previousHash, nextApp, nextHash) {
77
+ if (previousHash === nextHash) return;
78
+ const state = await this.read();
79
+ if (state?.fingerprint === nextHash && state.migration) return;
80
+ if (await this.requiresNewGrant(previousApp, nextApp)) {
81
+ await this.save(nextHash, [...services.keys()], true);
82
+ } else if (state?.fingerprint === previousHash) {
83
+ // A compatible second upgrade may happen before the user opens Settings.
84
+ await this.save(nextHash, state.pending, state.migration);
85
+ }
86
+ }
87
+
88
+ async hasPending(fingerprint, permission) {
89
+ const state = await this.read();
90
+ return Boolean(state && state.fingerprint === fingerprint && state.pending.includes(permission));
91
+ }
92
+
93
+ async beforePrompt(fingerprint, permission, probe) {
94
+ const service = services.get(permission);
95
+ if (!service) throw new Error('未知权限');
96
+ const state = await this.read();
97
+ if (!state || state.fingerprint !== fingerprint || !state.pending.includes(permission)) return false;
98
+ const status = await probe();
99
+ if (status.locked !== false || typeof status[permission] !== 'boolean') return false;
100
+ const missing = !status[permission];
101
+ if (missing) {
102
+ try { await this.reset(service); }
103
+ catch (error) {
104
+ console.warn('远控旧权限清理失败,将继续请求系统授权', { service, code: error.code });
105
+ return false;
106
+ }
107
+ }
108
+ // Consume each migration once, even if the new prompt is dismissed. Also
109
+ // retire permissions the currently running binary already demonstrably has.
110
+ await this.save(fingerprint, state.pending.filter(key => key !== permission && status[key] !== true), state.migration);
111
+ return missing;
112
+ }
113
+ }
@@ -535,7 +535,7 @@ export class RemoteAuthorization {
535
535
  // background keeps the queue free (a full werift close takes seconds).
536
536
  if (event.data.kind === 'stop') {
537
537
  this.video.playbackHealthy = false;
538
- void this.mediaChain.then(() => this.video.stop()).catch(() => {});
538
+ this.mediaChain = this.mediaChain.then(() => this.video.stop()).catch(() => {});
539
539
  return;
540
540
  }
541
541
  // answer/ice handlers block inside werift until the offer's ICE gathering
@@ -575,7 +575,7 @@ export class RemoteAuthorization {
575
575
  // confirm or input hit-test would otherwise stall behind it. Chaining
576
576
  // behind pending signaling keeps the teardown ordered after any start.
577
577
  await this.releaseInput().catch(() => {});
578
- void this.mediaChain.then(() => this.video.stop()).catch(() => {});
578
+ this.mediaChain = this.mediaChain.then(() => this.video.stop()).catch(() => {});
579
579
  void this.stopAudio();
580
580
  this.registry.producerState(this.peer, this.sessionId, 'agent-controlled');
581
581
  this.controlState = 'agent-controlled';
@@ -140,6 +140,7 @@ export function parseViewerRemoteVideoSignal(value) {
140
140
  if (!validProfiles(data.receiverProfiles)) invalid();
141
141
  if (data.compoundVersion !== undefined && data.compoundVersion !== 1) invalid();
142
142
  if (data.inputVersion !== undefined && ![1, 2].includes(data.inputVersion)) invalid();
143
+ if (data.motionMode !== undefined && !['balanced', 'motion-30', 'motion-60'].includes(data.motionMode)) invalid();
143
144
  break;
144
145
  case 'answer':
145
146
  if (!validDescription(data.sdp, 'answer')) invalid();
@@ -179,6 +180,7 @@ export function parseProducerRemoteVideoSignal(value) {
179
180
  if (!validCandidate(data.candidate)) invalid();
180
181
  break;
181
182
  case 'state':
183
+ if (data.maxFrameRate !== undefined && ![30, 60].includes(data.maxFrameRate)) invalid();
182
184
  if (!['new', 'connecting', 'connected', 'disconnected', 'failed', 'closed'].includes(String(data.state))) invalid();
183
185
  if (!boundedString(data.error, 500) || !boundedString(data.fallbackReason, 500)) invalid();
184
186
  break;