@xopcai/xopc 0.0.285 → 0.0.291

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 (1223) hide show
  1. package/README.md +16 -0
  2. package/README.zh-CN.md +16 -0
  3. package/dist/browser-ext/dist/assets/{auth-DB30ywek.js → auth-B2CDTr_F.js} +3 -2
  4. package/dist/browser-ext/dist/background.js +2 -2
  5. package/dist/browser-ext/dist/sidepanel.html +1 -1
  6. package/dist/browser-ext/dist/sidepanel.js +171 -145
  7. package/dist/browser-ext/manifest.json +1 -1
  8. package/dist/extensions/feishu/src/adapters/gateway-setup.js +14 -14
  9. package/dist/extensions/feishu/src/state/message-bindings.d.ts +1 -1
  10. package/dist/extensions/feishu/src/state/thread-bindings.d.ts +4 -4
  11. package/dist/extensions/feishu/src/state/thread-bindings.js +6 -6
  12. package/dist/extensions/feishu/src/subagent-hooks.d.ts +1 -1
  13. package/dist/extensions/feishu/src/subagent-hooks.js +5 -5
  14. package/dist/extensions/feishu/src/transport/socket-mode/monitor.js +9 -9
  15. package/dist/extensions/feishu/src/transport/webhook/monitor.js +4 -4
  16. package/dist/extensions/feishu/src/workflow-progress.d.ts +1 -1
  17. package/dist/extensions/feishu/src/workflow-progress.js +8 -7
  18. package/dist/extensions/telegram/src/approval-store.d.ts +2 -2
  19. package/dist/extensions/telegram/src/approval-store.js +1 -1
  20. package/dist/extensions/telegram/src/command-handler.d.ts +2 -2
  21. package/dist/extensions/telegram/src/command-handler.js +8 -8
  22. package/dist/extensions/telegram/src/delivery-chat-id.d.ts +1 -1
  23. package/dist/extensions/telegram/src/delivery-chat-id.js +7 -3
  24. package/dist/extensions/telegram/src/exec-approval-handler.js +1 -1
  25. package/dist/extensions/telegram/src/focus-handler.d.ts +2 -2
  26. package/dist/extensions/telegram/src/focus-handler.js +10 -10
  27. package/dist/extensions/telegram/src/inbound-processor.d.ts +3 -3
  28. package/dist/extensions/telegram/src/inbound-processor.js +11 -11
  29. package/dist/extensions/telegram/src/plugin.js +5 -5
  30. package/dist/extensions/telegram/src/routing-integration.d.ts +1 -1
  31. package/dist/extensions/telegram/src/routing-integration.js +19 -21
  32. package/dist/extensions/telegram/src/thread-bindings.d.ts +1 -1
  33. package/dist/extensions/telegram/src/workflow-progress.js +8 -7
  34. package/dist/extensions/telegram/xopc.extension.json +1 -1
  35. package/dist/extensions/weixin/src/auth/login-qr.d.ts +4 -4
  36. package/dist/extensions/weixin/src/auth/login-qr.js +21 -21
  37. package/dist/extensions/weixin/src/auth/weixin-account-id.d.ts +1 -1
  38. package/dist/extensions/weixin/src/auth/weixin-account-id.js +1 -1
  39. package/dist/extensions/weixin/src/cli/gateway-qr-login.d.ts +2 -2
  40. package/dist/extensions/weixin/src/cli/gateway-qr-login.js +13 -13
  41. package/dist/extensions/weixin/src/cli/qr-login.js +1 -1
  42. package/dist/extensions/weixin/src/delivery-to.js +6 -2
  43. package/dist/extensions/weixin/src/messaging/inbound.d.ts +1 -1
  44. package/dist/extensions/weixin/src/messaging/inbound.js +1 -1
  45. package/dist/extensions/weixin/src/messaging/process-message.js +3 -3
  46. package/dist/extensions/weixin/src/plugin.js +5 -5
  47. package/dist/extensions/weixin/src/routing-integration.d.ts +1 -1
  48. package/dist/extensions/weixin/src/routing-integration.js +3 -3
  49. package/dist/extensions/weixin/src/workflow-progress.d.ts +1 -1
  50. package/dist/extensions/weixin/src/workflow-progress.js +7 -6
  51. package/dist/gateway/static/root/assets/{activity-store-B0BTIk9j.js → activity-store-6lmzUBEr.js} +1 -1
  52. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Dc-0QZTQ.js → agent-avatar-dicebear-BCtrkF15.js} +1 -1
  53. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D2eYNelh.js +1 -0
  54. package/dist/gateway/static/root/assets/agents-BedA5XwI.js +1 -0
  55. package/dist/gateway/static/root/assets/{api-Coly9ab6.js → api-D6yepxBp.js} +1 -1
  56. package/dist/gateway/static/root/assets/api-Dnfnl1Gd.js +1 -0
  57. package/dist/gateway/static/root/assets/{app-management-settings-panel-TWBO-msg.js → app-management-settings-panel-Md562Fo-.js} +1 -1
  58. package/dist/gateway/static/root/assets/{appearance-settings-CpTZ2KuT.js → appearance-settings-BiBFI4BM.js} +1 -1
  59. package/dist/gateway/static/root/assets/apps-page-Corla83b.js +1 -0
  60. package/dist/gateway/static/root/assets/{archive-plugin-z_u6alob.js → archive-plugin-A_Unp751.js} +1 -1
  61. package/dist/gateway/static/root/assets/{attachment-load-C2nS04TC.js → attachment-load-D6idSUyP.js} +1 -1
  62. package/dist/gateway/static/root/assets/{automations-page-aIBsw9zR.js → automations-page-C6j71Lgs.js} +1 -1
  63. package/dist/gateway/static/root/assets/automations-workspace-DjZdhLQ5.js +6 -0
  64. package/dist/gateway/static/root/assets/{binary-plugins-CGmXoZnl.js → binary-plugins-BkKYh-8v.js} +1 -1
  65. package/dist/gateway/static/root/assets/{block-editor-CtvzCZhC.js → block-editor-CDcMvaku.js} +3 -3
  66. package/dist/gateway/static/root/assets/{browser-automation-inputs-BOTU1isH.js → browser-automation-inputs-Cq4sIJt2.js} +1 -1
  67. package/dist/gateway/static/root/assets/{browser-automations-page-BwU5V8J0.js → browser-automations-page-C64k4TBH.js} +2 -2
  68. package/dist/gateway/static/root/assets/browser-settings-page-1k5rj_qR.js +8 -0
  69. package/dist/gateway/static/root/assets/button-CGlRPNzi.js +1 -0
  70. package/dist/gateway/static/root/assets/capabilities-settings-panel-B2NvoTYb.js +8 -0
  71. package/dist/gateway/static/root/assets/channels-settings-DExixzp4.js +1 -0
  72. package/dist/gateway/static/root/assets/{channels-status-swr-Dfi0Desh.js → channels-status-swr-CVzEYBpX.js} +1 -1
  73. package/dist/gateway/static/root/assets/{chat-terminal-dock-B0MvcO6j.js → chat-terminal-dock-B9eKFkbg.js} +2 -2
  74. package/dist/gateway/static/root/assets/computer-model-settings-DW6j2lsn.js +1 -0
  75. package/dist/gateway/static/root/assets/computer-settings-page-C2Qyw63Q.js +1 -0
  76. package/dist/gateway/static/root/assets/connectors-page-C3ubZz7K.js +2 -0
  77. package/dist/gateway/static/root/assets/{cron-expression-CjrWuy2m.js → cron-expression-GDPX4NxC.js} +1 -1
  78. package/dist/gateway/static/root/assets/{date-picker-DXOvbHCr.js → date-picker-BdxjXVKL.js} +1 -1
  79. package/dist/gateway/static/root/assets/{dependency-picker-BEnC-eS0.js → dependency-picker-CXOa4uh4.js} +1 -1
  80. package/dist/gateway/static/root/assets/desktop-pet-CBWiAaSv.js +1 -0
  81. package/dist/gateway/static/root/assets/{desktop-pet-settings-CYyjcSn6.js → desktop-pet-settings-BX1aILDK.js} +1 -1
  82. package/dist/gateway/static/root/assets/{device-pairing-wizard-BPMGvAKE.js → device-pairing-wizard-bqm_Yf4i.js} +1 -1
  83. package/dist/gateway/static/root/assets/{extension-debug-page-H_aPMGXW.js → extension-debug-page-B4MMerja.js} +1 -1
  84. package/dist/gateway/static/root/assets/{extension-page-C1JnpeMt.js → extension-page-B3ZtINak.js} +1 -1
  85. package/dist/gateway/static/root/assets/extension-settings-page-8BkQVh0z.js +1 -0
  86. package/dist/gateway/static/root/assets/{gateway-config-swr-G2lQt7Ak.js → gateway-config-swr-BBovMBQ1.js} +1 -1
  87. package/dist/gateway/static/root/assets/gateway-settings-ZyhacQX5.js +1 -0
  88. package/dist/gateway/static/root/assets/{gateway-startup-retry-GP31PUrG.js → gateway-startup-retry-NXDtzZED.js} +1 -1
  89. package/dist/gateway/static/root/assets/heartbeat-settings-Bllcxm2A.js +1 -0
  90. package/dist/gateway/static/root/assets/home-page-Cv2e8XBR.js +1 -0
  91. package/dist/gateway/static/root/assets/{image-generation-api-CKFhfHSw.js → image-generation-api-D01ieqGC.js} +1 -1
  92. package/dist/gateway/static/root/assets/{imports-page-GROumhj8.js → imports-page-DJG1BJzd.js} +1 -1
  93. package/dist/gateway/static/root/assets/index-B7EieIE4.js +75 -0
  94. package/dist/gateway/static/root/assets/index-BD5uNzie.css +2 -0
  95. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-zcI822m_.js → keyboard-shortcuts-settings-6A6JOHTI.js} +1 -1
  96. package/dist/gateway/static/root/assets/local-app-workbench-page-Cipj52Zq.js +2 -0
  97. package/dist/gateway/static/root/assets/{local-apps-page-BtgDJ92Q.js → local-apps-page-bD-m7YHJ.js} +1 -1
  98. package/dist/gateway/static/root/assets/locale-store-eliqUnBr.js +1 -0
  99. package/dist/gateway/static/root/assets/logs-page-D5feO2yw.js +2 -0
  100. package/dist/gateway/static/root/assets/{management-settings-DasZxCyD.js → management-settings-B7mz0_44.js} +1 -1
  101. package/dist/gateway/static/root/assets/{markdown-view-6oYdBahT.js → markdown-view-BIg7cei7.js} +1 -1
  102. package/dist/gateway/static/root/assets/{media-plugins-CxthbBvk.js → media-plugins-DQ2HfMeG.js} +1 -1
  103. package/dist/gateway/static/root/assets/messages-NYDOR8-j.js +3 -0
  104. package/dist/gateway/static/root/assets/note-detail-panel-DhYJigb3.js +5 -0
  105. package/dist/gateway/static/root/assets/notes-page-Bg5NPUdf.js +8 -0
  106. package/dist/gateway/static/root/assets/page-tabs-DmG_Qjl8.js +1 -0
  107. package/dist/gateway/static/root/assets/popover-select-DldSX8GX.js +1 -0
  108. package/dist/gateway/static/root/assets/{preview-open-alternatives-Bevpbq9f.js → preview-open-alternatives-Y9J1kjKC.js} +1 -1
  109. package/dist/gateway/static/root/assets/proactive-page-Duc_NQ8l.js +1 -0
  110. package/dist/gateway/static/root/assets/{product-open-page-Bi1seZpM.js → product-open-page-DtgWUAwT.js} +1 -1
  111. package/dist/gateway/static/root/assets/project-detail-page-DVOiucVA.js +1 -0
  112. package/dist/gateway/static/root/assets/projects-page-Dr_kDoCJ.js +1 -0
  113. package/dist/gateway/static/root/assets/{registry-api-D0ddwBFj.js → registry-api-Dpm3N2h0.js} +1 -1
  114. package/dist/gateway/static/root/assets/remote-access-hub-hyJ2KKKK.js +1 -0
  115. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Wkru8_My.js → runtime-tools-settings-panel-DB7J9opJ.js} +2 -2
  116. package/dist/gateway/static/root/assets/{schema-form-CSMRzj9Y.js → schema-form-CMYuPOlE.js} +1 -1
  117. package/dist/gateway/static/root/assets/sessions-page-DGsnYcoh.js +1 -0
  118. package/dist/gateway/static/root/assets/settings-advanced-gate-DuzZqQMn.js +1 -0
  119. package/dist/gateway/static/root/assets/settings-form-section-BayJP08a.js +1 -0
  120. package/dist/gateway/static/root/assets/{settings-page-BcQGAnCs.js → settings-page-CWBqZtt6.js} +1 -1
  121. package/dist/gateway/static/root/assets/settings-page-layout-CsUQKRq0.js +1 -0
  122. package/dist/gateway/static/root/assets/setup-status-panel-C97S5g5c.js +1 -0
  123. package/dist/gateway/static/root/assets/{share-preview-page-DQocUl-1.js → share-preview-page-Wn5bQA-5.js} +1 -1
  124. package/dist/gateway/static/root/assets/shares-settings-pfVzP8F7.js +1 -0
  125. package/dist/gateway/static/root/assets/skill-reload-api-DDJ0ZKx3.js +1 -0
  126. package/dist/gateway/static/root/assets/skills-page-DbDpLjDW.js +2 -0
  127. package/dist/gateway/static/root/assets/{skills-page.utils-DtlfCgJp.js → skills-page.utils-DCHY_kou.js} +1 -1
  128. package/dist/gateway/static/root/assets/{system-settings-panel-Ct698Nf-.js → system-settings-panel-DhgITgId.js} +1 -1
  129. package/dist/gateway/static/root/assets/task-detail-page-UqwtiHYu.js +1 -0
  130. package/dist/gateway/static/root/assets/{theme-store-ng8KJsAT.js → theme-store-DUHPzKzv.js} +1 -1
  131. package/dist/gateway/static/root/assets/tunnel-api-DJ3gz2tM.js +1 -0
  132. package/dist/gateway/static/root/assets/{use-autosave-BSyxRHt2.js → use-autosave-htvgT192.js} +1 -1
  133. package/dist/gateway/static/root/assets/user-model-page-xOsXY_2W.js +2 -0
  134. package/dist/gateway/static/root/assets/{voice-api-key-field-SE3OQI1s.js → voice-api-key-field-BviJF3Oa.js} +1 -1
  135. package/dist/gateway/static/root/assets/{voice-config-api-VNuCmdFe.js → voice-config-api-Bjy8EFqi.js} +1 -1
  136. package/dist/gateway/static/root/assets/{work-discovery-overlay-Dn1vy2oq.js → work-discovery-overlay-BOBVNEYZ.js} +1 -1
  137. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BJEfGY-k.js → workflow-run-setup-panel-D1N9uUyM.js} +2 -2
  138. package/dist/gateway/static/root/assets/workflows-page-2ylzlgkG.js +6 -0
  139. package/dist/gateway/static/root/index.html +12 -12
  140. package/dist/package.js +1 -1
  141. package/dist/packages/computer-control-contract/src/index.js +178 -0
  142. package/dist/packages/endpoint-tools-protocol/src/index.js +312 -305
  143. package/dist/packages/gateway-contract/src/agent-stream.js +6 -0
  144. package/dist/packages/gateway-contract/src/automations.js +215 -0
  145. package/dist/packages/gateway-contract/src/browser-page-context.js +48 -39
  146. package/dist/packages/gateway-contract/src/browser-tab-binding.js +30 -25
  147. package/dist/packages/gateway-contract/src/clarifications.js +6 -0
  148. package/dist/packages/gateway-contract/src/connection-waits.js +6 -0
  149. package/dist/packages/gateway-contract/src/conversation-identity.js +17 -0
  150. package/dist/packages/gateway-contract/src/device-pairing.js +84 -78
  151. package/dist/packages/gateway-contract/src/discussions.js +19 -15
  152. package/dist/packages/gateway-contract/src/files.js +55 -0
  153. package/dist/packages/gateway-contract/src/home.js +188 -0
  154. package/dist/packages/gateway-contract/src/index.js +65 -0
  155. package/dist/packages/gateway-contract/src/mobile-privacy.js +26 -0
  156. package/dist/packages/gateway-contract/src/model-selection.js +4 -1
  157. package/dist/packages/gateway-contract/src/new-session.js +5 -1
  158. package/dist/packages/gateway-contract/src/notifications.js +64 -59
  159. package/dist/packages/gateway-contract/src/proactive.js +133 -128
  160. package/dist/packages/gateway-contract/src/product-delivery.js +56 -50
  161. package/dist/packages/gateway-contract/src/project-monitoring.js +33 -28
  162. package/dist/packages/gateway-contract/src/project-operating.js +100 -0
  163. package/dist/packages/gateway-contract/src/session-identity.js +38 -34
  164. package/dist/packages/gateway-contract/src/session-input-reliability.js +6 -0
  165. package/dist/packages/gateway-contract/src/sessions.js +145 -0
  166. package/dist/packages/gateway-contract/src/task-lifecycle.js +69 -64
  167. package/dist/packages/gateway-contract/src/task-runs.js +80 -75
  168. package/dist/packages/gateway-contract/src/tasks.js +445 -438
  169. package/dist/packages/gateway-contract/src/tool-activity.js +154 -149
  170. package/dist/packages/gateway-contract/src/turn-outcome.js +118 -112
  171. package/dist/packages/gateway-contract/src/user-message-display.js +13 -8
  172. package/dist/packages/gateway-contract/src/welcome-suggestions.js +6 -0
  173. package/dist/packages/realtime-client/src/index.js +1 -1
  174. package/dist/packages/realtime-protocol/src/index.js +4 -2
  175. package/dist/packages/realtime-protocol/src/voice-audio.js +15 -10
  176. package/dist/packages/realtime-protocol/src/voice-catalog.js +61 -0
  177. package/dist/packages/realtime-protocol/src/voice.js +257 -248
  178. package/dist/src/activity/types.d.ts +1 -1
  179. package/dist/src/agent/agent-instance-gateway.d.ts +18 -18
  180. package/dist/src/agent/agent-manager.d.ts +28 -27
  181. package/dist/src/agent/agent-manager.js +184 -182
  182. package/dist/src/agent/background-review/coordinator.d.ts +3 -3
  183. package/dist/src/agent/background-review/coordinator.js +10 -10
  184. package/dist/src/agent/background-review/run-background-review.d.ts +1 -1
  185. package/dist/src/agent/background-review/run-background-review.js +15 -15
  186. package/dist/src/agent/bootstrap/bootstrap-cache.d.ts +4 -4
  187. package/dist/src/agent/bootstrap/bootstrap-cache.js +9 -9
  188. package/dist/src/agent/bootstrap/bootstrap-files.d.ts +4 -4
  189. package/dist/src/agent/bootstrap/bootstrap-files.js +9 -9
  190. package/dist/src/agent/bootstrap/filter-bootstrap-files.d.ts +1 -1
  191. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +3 -3
  192. package/dist/src/agent/child-agent-factory.d.ts +3 -3
  193. package/dist/src/agent/child-agent-factory.js +5 -5
  194. package/dist/src/agent/coding/workspace-revision.js +1 -1
  195. package/dist/src/agent/commands/command-registry.js +2 -1
  196. package/dist/src/agent/context/audit.d.ts +2 -2
  197. package/dist/src/agent/context/audit.js +5 -4
  198. package/dist/src/agent/context/coordinator.d.ts +6 -6
  199. package/dist/src/agent/context/coordinator.js +13 -13
  200. package/dist/src/agent/context/execution-context.js +4 -3
  201. package/dist/src/agent/context/execution-scope.d.ts +3 -3
  202. package/dist/src/agent/context/execution-scope.js +13 -13
  203. package/dist/src/agent/context/project-context.d.ts +1 -1
  204. package/dist/src/agent/context/project-context.js +4 -4
  205. package/dist/src/agent/embedded/execution-context.d.ts +1 -1
  206. package/dist/src/agent/embedded/execution-context.js +3 -3
  207. package/dist/src/agent/embedded/index.d.ts +1 -1
  208. package/dist/src/agent/embedded/index.js +2 -2
  209. package/dist/src/agent/embedded/model-runtime.js +1 -1
  210. package/dist/src/agent/embedded/run-for-session.d.ts +1 -1
  211. package/dist/src/agent/embedded/run-for-session.js +79 -105
  212. package/dist/src/agent/embedded/run-turn.js +86 -34
  213. package/dist/src/agent/embedded/runs.d.ts +11 -11
  214. package/dist/src/agent/embedded/runs.js +22 -22
  215. package/dist/src/agent/embedded/session-runner.d.ts +2 -2
  216. package/dist/src/agent/embedded/session-runner.js +5 -5
  217. package/dist/src/agent/embedded/session-tool-result-guard.d.ts +2 -2
  218. package/dist/src/agent/embedded/session-tool-result-guard.js +8 -8
  219. package/dist/src/agent/embedded/sqlite-hydrating-session-manager.d.ts +2 -2
  220. package/dist/src/agent/embedded/sqlite-hydrating-session-manager.js +4 -4
  221. package/dist/src/agent/embedded/transcript-runtime.d.ts +4 -3
  222. package/dist/src/agent/embedded/transcript-runtime.js +33 -20
  223. package/dist/src/agent/embedded/types.d.ts +2 -1
  224. package/dist/src/agent/external-tools/composio-provider.d.ts +1 -1
  225. package/dist/src/agent/external-tools/composio-provider.js +12 -11
  226. package/dist/src/agent/external-tools/endpoint-provider.js +5 -3
  227. package/dist/src/agent/external-tools/extension-provider.d.ts +1 -1
  228. package/dist/src/agent/external-tools/extension-provider.js +1 -1
  229. package/dist/src/agent/external-tools/gateway-tools.js +9 -8
  230. package/dist/src/agent/external-tools/index.js +3 -3
  231. package/dist/src/agent/external-tools/mcp-provider.d.ts +2 -2
  232. package/dist/src/agent/external-tools/mcp-provider.js +8 -8
  233. package/dist/src/agent/external-tools/memory-provider.d.ts +1 -1
  234. package/dist/src/agent/external-tools/memory-provider.js +1 -1
  235. package/dist/src/agent/external-tools/types.d.ts +1 -1
  236. package/dist/src/agent/image/tool-model-config.js +1 -1
  237. package/dist/src/agent/inbound/attachment-pipeline.d.ts +7 -7
  238. package/dist/src/agent/inbound/attachment-pipeline.js +22 -21
  239. package/dist/src/agent/inbound/inbound-loop.d.ts +6 -6
  240. package/dist/src/agent/inbound/inbound-loop.js +23 -23
  241. package/dist/src/agent/inbound/turn-dispatcher.d.ts +14 -14
  242. package/dist/src/agent/inbound/turn-dispatcher.js +16 -16
  243. package/dist/src/agent/ipc/bus.d.ts +1 -1
  244. package/dist/src/agent/ipc/types.d.ts +3 -3
  245. package/dist/src/agent/ipc/types.js +1 -1
  246. package/dist/src/agent/lifecycle/hook-handler.d.ts +2 -2
  247. package/dist/src/agent/lifecycle/hook-handler.js +6 -6
  248. package/dist/src/agent/lifecycle/manager.d.ts +1 -1
  249. package/dist/src/agent/lifecycle/manager.js +4 -4
  250. package/dist/src/agent/lifecycle/types.d.ts +1 -1
  251. package/dist/src/agent/mcp/bundle-mcp-runtime.d.ts +4 -4
  252. package/dist/src/agent/mcp/bundle-mcp-runtime.js +21 -20
  253. package/dist/src/agent/mcp/bundle-mcp-tools.d.ts +1 -1
  254. package/dist/src/agent/mcp/bundle-mcp-tools.js +2 -2
  255. package/dist/src/agent/mcp/bundle-mcp-types.d.ts +4 -4
  256. package/dist/src/agent/mcp/index.js +2 -2
  257. package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +9 -8
  258. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
  259. package/dist/src/agent/memory/compaction-ledger.js +9 -2
  260. package/dist/src/agent/memory/compaction-promotion.d.ts +2 -2
  261. package/dist/src/agent/memory/compaction-promotion.js +6 -6
  262. package/dist/src/agent/memory/compaction-source-planner.d.ts +2 -0
  263. package/dist/src/agent/memory/compaction-source-planner.js +9 -1
  264. package/dist/src/agent/memory/compaction.d.ts +6 -1
  265. package/dist/src/agent/memory/compaction.js +22 -11
  266. package/dist/src/agent/memory/context-recovery.d.ts +44 -0
  267. package/dist/src/agent/memory/context-recovery.js +96 -0
  268. package/dist/src/agent/memory/manager.js +11 -11
  269. package/dist/src/agent/memory/turn-provenance.d.ts +5 -5
  270. package/dist/src/agent/memory/turn-provenance.js +21 -17
  271. package/dist/src/agent/memory/types.d.ts +2 -2
  272. package/dist/src/agent/messaging/command-handler.d.ts +11 -11
  273. package/dist/src/agent/messaging/command-handler.js +7 -7
  274. package/dist/src/agent/messaging/message-router.d.ts +1 -1
  275. package/dist/src/agent/messaging/message-router.js +4 -4
  276. package/dist/src/agent/messaging/outbound-coordinator.d.ts +2 -2
  277. package/dist/src/agent/messaging/outbound-coordinator.js +4 -4
  278. package/dist/src/agent/middleware/context.d.ts +1 -2
  279. package/dist/src/agent/middleware/context.js +2 -5
  280. package/dist/src/agent/models/manager.d.ts +10 -10
  281. package/dist/src/agent/models/manager.js +34 -34
  282. package/dist/src/agent/orchestration/agent-event-handler.js +14 -14
  283. package/dist/src/agent/orchestration/agent-orchestrator.d.ts +7 -7
  284. package/dist/src/agent/orchestration/agent-orchestrator.js +29 -29
  285. package/dist/src/agent/orchestration/context-overflow.js +2 -0
  286. package/dist/src/agent/orchestration/llm-turn-retry.d.ts +1 -1
  287. package/dist/src/agent/orchestration/llm-turn-retry.js +2 -2
  288. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +1 -1
  289. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +2 -2
  290. package/dist/src/agent/prompt/response-language.d.ts +1 -1
  291. package/dist/src/agent/prompt/response-language.js +2 -2
  292. package/dist/src/agent/prompt/service-prompt-builder.d.ts +2 -2
  293. package/dist/src/agent/prompt/service-prompt-builder.js +4 -4
  294. package/dist/src/agent/prompt/subagent-context.d.ts +4 -4
  295. package/dist/src/agent/prompt/subagent-context.js +1 -1
  296. package/dist/src/agent/prompt/system-prompt-params.d.ts +4 -4
  297. package/dist/src/agent/prompt/system-prompt-params.js +13 -12
  298. package/dist/src/agent/reply/apply-turn-user-enrichment.d.ts +1 -1
  299. package/dist/src/agent/reply/apply-turn-user-enrichment.js +3 -3
  300. package/dist/src/agent/reply/post-compaction-context.d.ts +1 -1
  301. package/dist/src/agent/reply/post-compaction-context.js +2 -2
  302. package/dist/src/agent/service/btw-query.d.ts +1 -1
  303. package/dist/src/agent/service/btw-query.js +4 -4
  304. package/dist/src/agent/service/build-direct-message-content.d.ts +1 -1
  305. package/dist/src/agent/service/build-direct-message-content.js +2 -2
  306. package/dist/src/agent/service/direct-turn-helpers.d.ts +6 -6
  307. package/dist/src/agent/service/direct-turn-helpers.js +17 -16
  308. package/dist/src/agent/service/parse-outbound-session-key.d.ts +1 -1
  309. package/dist/src/agent/service/parse-outbound-session-key.js +8 -9
  310. package/dist/src/agent/service/process-direct-one-shot.d.ts +11 -11
  311. package/dist/src/agent/service/process-direct-one-shot.js +16 -16
  312. package/dist/src/agent/service/process-direct-streaming.d.ts +18 -18
  313. package/dist/src/agent/service/process-direct-streaming.js +45 -40
  314. package/dist/src/agent/service/session-context-report.d.ts +1 -1
  315. package/dist/src/agent/service/session-context-report.js +3 -3
  316. package/dist/src/agent/service/webchat-tts.d.ts +3 -3
  317. package/dist/src/agent/service/webchat-tts.js +7 -7
  318. package/dist/src/agent/service.d.ts +23 -23
  319. package/dist/src/agent/service.js +113 -110
  320. package/dist/src/agent/service.types.d.ts +3 -3
  321. package/dist/src/agent/session/session-config-service.d.ts +5 -5
  322. package/dist/src/agent/session/session-config-service.js +53 -66
  323. package/dist/src/agent/session/session-context.d.ts +2 -2
  324. package/dist/src/agent/session/session-context.js +2 -2
  325. package/dist/src/agent/session/session-hydrator.d.ts +3 -3
  326. package/dist/src/agent/session/session-hydrator.js +19 -19
  327. package/dist/src/agent/session/session-inspector.d.ts +7 -7
  328. package/dist/src/agent/session/session-inspector.js +46 -46
  329. package/dist/src/agent/session/session-lifecycle.d.ts +2 -2
  330. package/dist/src/agent/session/session-lifecycle.js +17 -17
  331. package/dist/src/agent/session/session-state-bag.d.ts +18 -18
  332. package/dist/src/agent/session/session-state-bag.js +46 -46
  333. package/dist/src/agent/session/tracker.d.ts +7 -7
  334. package/dist/src/agent/session/tracker.js +27 -27
  335. package/dist/src/agent/skills/hub-lock.js +1 -1
  336. package/dist/src/agent/skills/index.js +25 -15
  337. package/dist/src/agent/skills/parse-skill-metadata.d.ts +5 -1
  338. package/dist/src/agent/skills/parse-skill-metadata.js +21 -1
  339. package/dist/src/agent/skills/types.d.ts +7 -0
  340. package/dist/src/agent/source-context/types.d.ts +1 -1
  341. package/dist/src/agent/tasks/task-judge-service.d.ts +1 -1
  342. package/dist/src/agent/tasks/task-judge-service.js +14 -13
  343. package/dist/src/agent/tool-manuals/computer.d.ts +1 -0
  344. package/dist/src/agent/tool-manuals/computer.js +19 -0
  345. package/dist/src/agent/tool-manuals/index.js +7 -0
  346. package/dist/src/agent/tools/automation-tool.js +2 -0
  347. package/dist/src/agent/tools/chain-tracker.d.ts +10 -10
  348. package/dist/src/agent/tools/chain-tracker.js +31 -31
  349. package/dist/src/agent/tools/clarify-tool.d.ts +1 -1
  350. package/dist/src/agent/tools/computer-use-tool.d.ts +11 -0
  351. package/dist/src/agent/tools/computer-use-tool.js +86 -0
  352. package/dist/src/agent/tools/create-share-tool.js +2 -0
  353. package/dist/src/agent/tools/delegate-tool.d.ts +1 -1
  354. package/dist/src/agent/tools/delegate-tool.js +4 -4
  355. package/dist/src/agent/tools/exec-command.d.ts +1 -1
  356. package/dist/src/agent/tools/exec-command.js +1 -1
  357. package/dist/src/agent/tools/factory.d.ts +5 -3
  358. package/dist/src/agent/tools/factory.js +66 -36
  359. package/dist/src/agent/tools/knowledge-memory-tool.js +2 -2
  360. package/dist/src/agent/tools/managed-job-tool.d.ts +1 -1
  361. package/dist/src/agent/tools/managed-job-tool.js +2 -2
  362. package/dist/src/agent/tools/publish-artifacts.js +2 -0
  363. package/dist/src/agent/tools/send-media.js +2 -0
  364. package/dist/src/agent/tools/session-recall-tool.d.ts +1 -1
  365. package/dist/src/agent/tools/session-recall-tool.js +3 -3
  366. package/dist/src/agent/tools/session-search-tool.d.ts +1 -1
  367. package/dist/src/agent/tools/session-search-tool.js +6 -6
  368. package/dist/src/agent/tools/skill-install-tool.d.ts +3 -3
  369. package/dist/src/agent/tools/skill-install-tool.js +3 -3
  370. package/dist/src/agent/tools/todo-tool.d.ts +3 -3
  371. package/dist/src/agent/tools/todo-tool.js +4 -4
  372. package/dist/src/agent/tools/workflow-tool.d.ts +1 -1
  373. package/dist/src/agent/tools/workflow-tool.js +15 -13
  374. package/dist/src/agent/tools/write.js +2 -0
  375. package/dist/src/agent/tools/xopc-use-tool.d.ts +1 -1
  376. package/dist/src/agent/tools/xopc-use-tool.js +16 -13
  377. package/dist/src/agent/types.d.ts +1 -1
  378. package/dist/src/agent/workflow/catalog.js +4 -2
  379. package/dist/src/agent/workflow/channel-capability.d.ts +2 -2
  380. package/dist/src/agent/workflow/progress-broker.d.ts +4 -4
  381. package/dist/src/agent/workflow/progress-broker.js +17 -17
  382. package/dist/src/agent/workflow/subagent-runner.js +10 -10
  383. package/dist/src/agent/workflow/types.d.ts +2 -2
  384. package/dist/src/agent/workflow/workflow-child-tools.js +1 -1
  385. package/dist/src/agent/workspace-runtime/registry.js +1 -1
  386. package/dist/src/agent-config/index.js +2 -2
  387. package/dist/src/agent-config/resolver.js +5 -0
  388. package/dist/src/agent-config/schema.d.ts +32 -0
  389. package/dist/src/agent-config/schema.js +5 -2
  390. package/dist/src/ai-assist/text-assist.js +1 -1
  391. package/dist/src/auth/credentials.js +2 -2
  392. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  393. package/dist/src/auth/profiles/store.js +1 -1
  394. package/dist/src/auth/sync-provider-auth.js +2 -2
  395. package/dist/src/automations/domain/types.d.ts +7 -7
  396. package/dist/src/automations/domain/validation.js +2 -0
  397. package/dist/src/automations/service/action-executor.js +15 -15
  398. package/dist/src/automations/service/automation-service.js +4 -3
  399. package/dist/src/automations/storage/automation-repository.js +2 -1
  400. package/dist/src/automations/storage/automation-run-repository.js +9 -8
  401. package/dist/src/browser/native-messaging-host.js +4 -1
  402. package/dist/src/browser/policy/approval-store.d.ts +4 -4
  403. package/dist/src/browser/policy/approval-store.js +8 -8
  404. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  405. package/dist/src/browser/providers/extension.js +6 -6
  406. package/dist/src/browser/providers/realtime-extension.js +2 -2
  407. package/dist/src/browser/runtime/browser-runtime.js +3 -3
  408. package/dist/src/capabilities/readiness/from-config.js +14 -2
  409. package/dist/src/capabilities/readiness/planner.js +3 -2
  410. package/dist/src/capabilities/readiness/types.d.ts +1 -1
  411. package/dist/src/channels/exec-approval-runtime.d.ts +1 -1
  412. package/dist/src/channels/manager.js +1 -1
  413. package/dist/src/channels/pipeline.js +2 -2
  414. package/dist/src/channels/plugin-types.d.ts +2 -2
  415. package/dist/src/channels/plugins/types.adapters.d.ts +1 -1
  416. package/dist/src/channels/telegram/index.d.ts +1 -1
  417. package/dist/src/channels/telegram/index.js +2 -2
  418. package/dist/src/chat-commands/agent-edit.js +2 -2
  419. package/dist/src/chat-commands/builtins/review.js +4 -4
  420. package/dist/src/chat-commands/builtins/session.js +1 -1
  421. package/dist/src/chat-commands/builtins/system.js +2 -2
  422. package/dist/src/chat-commands/builtins/thinking.js +7 -7
  423. package/dist/src/chat-commands/builtins/understanding.js +4 -4
  424. package/dist/src/chat-commands/builtins/workflow.js +8 -8
  425. package/dist/src/chat-commands/context.d.ts +9 -9
  426. package/dist/src/chat-commands/context.js +35 -35
  427. package/dist/src/chat-commands/index.d.ts +1 -1
  428. package/dist/src/chat-commands/index.js +2 -2
  429. package/dist/src/chat-commands/processor.js +2 -2
  430. package/dist/src/chat-commands/registry.js +1 -1
  431. package/dist/src/chat-commands/session-key.d.ts +3 -3
  432. package/dist/src/chat-commands/session-key.js +20 -24
  433. package/dist/src/chat-commands/types.d.ts +3 -3
  434. package/dist/src/cli/command-manifest.js +1 -1
  435. package/dist/src/cli/commands/agent/interactive.d.ts +1 -1
  436. package/dist/src/cli/commands/agent/interactive.js +8 -8
  437. package/dist/src/cli/commands/agent/stream-renderer.d.ts +1 -1
  438. package/dist/src/cli/commands/agent/stream-renderer.js +2 -2
  439. package/dist/src/cli/commands/agent.js +10 -6
  440. package/dist/src/cli/commands/doctor/checks/database-schema.js +3 -2
  441. package/dist/src/cli/commands/doctor/checks/provider-auth.js +3 -3
  442. package/dist/src/cli/commands/doctor/checks/session-integrity.js +9 -9
  443. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  444. package/dist/src/cli/commands/gateway/run-foreground.js +2 -1
  445. package/dist/src/cli/commands/import.js +2 -1
  446. package/dist/src/cli/commands/logs.js +3 -3
  447. package/dist/src/cli/commands/models.js +1 -1
  448. package/dist/src/cli/commands/project.js +5 -5
  449. package/dist/src/cli/commands/resume.js +4 -4
  450. package/dist/src/cli/commands/tunnel.js +2 -1
  451. package/dist/src/computer/broker.d.ts +97 -0
  452. package/dist/src/computer/broker.js +337 -0
  453. package/dist/src/computer/config.d.ts +9 -0
  454. package/dist/src/computer/config.js +16 -0
  455. package/dist/src/computer/control-guard.d.ts +4 -0
  456. package/dist/src/computer/control-guard.js +17 -0
  457. package/dist/src/computer/errors.d.ts +7 -0
  458. package/dist/src/computer/errors.js +30 -0
  459. package/dist/src/computer/model-adapter.d.ts +44 -0
  460. package/dist/src/computer/model-adapter.js +273 -0
  461. package/dist/src/computer/model-config.d.ts +3 -0
  462. package/dist/src/computer/model-config.js +27 -0
  463. package/dist/src/computer/model-policy.d.ts +3 -0
  464. package/dist/src/computer/model-policy.js +20 -0
  465. package/dist/src/computer/runtime.d.ts +128 -0
  466. package/dist/src/computer/runtime.js +388 -0
  467. package/dist/src/config/agent-profile.d.ts +3 -3
  468. package/dist/src/config/agent-profile.js +12 -12
  469. package/dist/src/config/index.js +4 -4
  470. package/dist/src/config/loader.js +2 -2
  471. package/dist/src/config/models-json.d.ts +42 -6
  472. package/dist/src/config/models-json.js +15 -1
  473. package/dist/src/config/schema.d.ts +38 -1
  474. package/dist/src/config/schema.js +11 -2
  475. package/dist/src/config/voice.js +2 -2
  476. package/dist/src/connectors/catalog.js +2 -1
  477. package/dist/src/connectors/composio-sessions.d.ts +1 -1
  478. package/dist/src/connectors/composio-sessions.js +3 -3
  479. package/dist/src/connectors/connection-recovery-service.d.ts +4 -4
  480. package/dist/src/connectors/connection-recovery-service.js +41 -37
  481. package/dist/src/connectors/principal.d.ts +1 -1
  482. package/dist/src/connectors/principal.js +4 -3
  483. package/dist/src/connectors/types.d.ts +2 -2
  484. package/dist/src/discussions/action-tasks.js +5 -2
  485. package/dist/src/discussions/analyzer.js +2 -1
  486. package/dist/src/discussions/edits.js +4 -2
  487. package/dist/src/discussions/index.js +1 -1
  488. package/dist/src/discussions/organizer.js +3 -2
  489. package/dist/src/discussions/recording.js +5 -2
  490. package/dist/src/discussions/recordingJobs.js +2 -1
  491. package/dist/src/discussions/repository.js +2 -1
  492. package/dist/src/discussions/revisions.js +2 -1
  493. package/dist/src/discussions/sealer.js +1 -1
  494. package/dist/src/discussions/service.js +6 -3
  495. package/dist/src/discussions/types.js +4 -0
  496. package/dist/src/endpoint-tools/auth.js +2 -1
  497. package/dist/src/endpoint-tools/binding-service.d.ts +8 -8
  498. package/dist/src/endpoint-tools/binding-service.js +14 -14
  499. package/dist/src/endpoint-tools/invocation-service.d.ts +1 -0
  500. package/dist/src/endpoint-tools/invocation-service.js +7 -3
  501. package/dist/src/endpoint-tools/policy.js +9 -1
  502. package/dist/src/endpoint-tools/registry.js +2 -1
  503. package/dist/src/endpoint-tools/runtime.js +1 -0
  504. package/dist/src/endpoint-tools/upload-service.d.ts +13 -1
  505. package/dist/src/endpoint-tools/upload-service.js +75 -9
  506. package/dist/src/execution-environments/local-worktree-manager.d.ts +1 -1
  507. package/dist/src/execution-environments/local-worktree-manager.js +2 -2
  508. package/dist/src/execution-environments/session-environment-service.d.ts +3 -3
  509. package/dist/src/execution-environments/session-environment-service.js +10 -10
  510. package/dist/src/execution-environments/store.d.ts +2 -2
  511. package/dist/src/execution-environments/store.js +15 -14
  512. package/dist/src/execution-environments/subject.d.ts +1 -1
  513. package/dist/src/execution-environments/subject.js +2 -2
  514. package/dist/src/execution-environments/types.d.ts +2 -2
  515. package/dist/src/extensions/api.js +1 -1
  516. package/dist/src/extensions/install.js +1 -1
  517. package/dist/src/extensions/loader.d.ts +1 -1
  518. package/dist/src/extensions/lockfile.js +1 -1
  519. package/dist/src/extensions/types/core.d.ts +2 -2
  520. package/dist/src/extensions/types/hooks.d.ts +12 -12
  521. package/dist/src/extensions/types/tools.d.ts +3 -3
  522. package/dist/src/extensions/types/tui.d.ts +3 -3
  523. package/dist/src/files/file-service.d.ts +3 -3
  524. package/dist/src/files/file-service.js +3 -3
  525. package/dist/src/gateway/agent-builtin-tools.d.ts +7 -1
  526. package/dist/src/gateway/agent-builtin-tools.js +7 -0
  527. package/dist/src/gateway/agents-admin.js +1 -1
  528. package/dist/src/gateway/automation-agent-session.js +5 -5
  529. package/dist/src/gateway/chat-stream/mapper.d.ts +1 -1
  530. package/dist/src/gateway/chat-stream/mapper.js +4 -2
  531. package/dist/src/gateway/chat-stream/protocol.d.ts +1 -1
  532. package/dist/src/gateway/chat-stream/thinking-delta-coalescer.js +1 -1
  533. package/dist/src/gateway/clarify-runtime.d.ts +2 -2
  534. package/dist/src/gateway/clarify-runtime.js +2 -2
  535. package/dist/src/gateway/file-path-classifier.d.ts +2 -2
  536. package/dist/src/gateway/file-path-classifier.js +5 -5
  537. package/dist/src/gateway/file-reference-registry.d.ts +2 -2
  538. package/dist/src/gateway/file-reference-registry.js +1 -1
  539. package/dist/src/gateway/file-space-service.js +3 -3
  540. package/dist/src/gateway/gateway-workflow-host.types.d.ts +1 -1
  541. package/dist/src/gateway/global-defaults-admin.js +16 -0
  542. package/dist/src/gateway/heartbeat/check-store.js +2 -1
  543. package/dist/src/gateway/heartbeat/service.js +23 -9
  544. package/dist/src/gateway/hono/lib/config-payload.d.ts +15 -0
  545. package/dist/src/gateway/hono/lib/config-payload.js +2 -1
  546. package/dist/src/gateway/hono/middleware/log-context.d.ts +1 -1
  547. package/dist/src/gateway/hono/middleware/log-context.js +3 -3
  548. package/dist/src/gateway/hono/routes/agent-stream.js +20 -20
  549. package/dist/src/gateway/hono/routes/browser-session.js +2 -2
  550. package/dist/src/gateway/hono/routes/browser.js +22 -20
  551. package/dist/src/gateway/hono/routes/chat-model-config.d.ts +1 -1
  552. package/dist/src/gateway/hono/routes/chat-model-config.js +6 -6
  553. package/dist/src/gateway/hono/routes/commands-skills.js +13 -13
  554. package/dist/src/gateway/hono/routes/config-patch/misc.js +13 -2
  555. package/dist/src/gateway/hono/routes/connection-waits.js +5 -5
  556. package/dist/src/gateway/hono/routes/connectors.js +5 -5
  557. package/dist/src/gateway/hono/routes/context-sources.js +2 -1
  558. package/dist/src/gateway/hono/routes/device-pairing-approval.js +2 -0
  559. package/dist/src/gateway/hono/routes/devices.js +2 -0
  560. package/dist/src/gateway/hono/routes/discussions.js +2 -2
  561. package/dist/src/gateway/hono/routes/endpoint-tools.js +11 -9
  562. package/dist/src/gateway/hono/routes/execution-environments.js +11 -11
  563. package/dist/src/gateway/hono/routes/file-references.js +5 -5
  564. package/dist/src/gateway/hono/routes/home.js +1 -1
  565. package/dist/src/gateway/hono/routes/interaction-state.js +6 -6
  566. package/dist/src/gateway/hono/routes/logs.js +2 -2
  567. package/dist/src/gateway/hono/routes/media.js +3 -3
  568. package/dist/src/gateway/hono/routes/models.js +6 -3
  569. package/dist/src/gateway/hono/routes/notes.js +11 -11
  570. package/dist/src/gateway/hono/routes/projects.js +26 -26
  571. package/dist/src/gateway/hono/routes/public-gateway.js +3 -3
  572. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +10 -10
  573. package/dist/src/gateway/hono/routes/session-input-handler.js +20 -17
  574. package/dist/src/gateway/hono/routes/sessions.js +79 -50
  575. package/dist/src/gateway/hono/routes/shares.js +38 -38
  576. package/dist/src/gateway/hono/routes/side-chats.js +4 -2
  577. package/dist/src/gateway/hono/routes/site-shares.js +6 -6
  578. package/dist/src/gateway/hono/routes/tasks.js +18 -13
  579. package/dist/src/gateway/hono/routes/tui.js +2 -2
  580. package/dist/src/gateway/hono/routes/user-model.js +1 -1
  581. package/dist/src/gateway/hono/routes/voice.js +56 -2
  582. package/dist/src/gateway/hono/routes/workflows.js +7 -7
  583. package/dist/src/gateway/media-access.d.ts +1 -1
  584. package/dist/src/gateway/media-access.js +3 -3
  585. package/dist/src/gateway/resolve-webchat-session-key.d.ts +5 -5
  586. package/dist/src/gateway/resolve-webchat-session-key.js +5 -5
  587. package/dist/src/gateway/security/gateway-scopes.d.ts +1 -1
  588. package/dist/src/gateway/security/gateway-scopes.js +3 -0
  589. package/dist/src/gateway/service/agent-runner.d.ts +15 -15
  590. package/dist/src/gateway/service/agent-runner.js +63 -62
  591. package/dist/src/gateway/service/config-coordinator.js +4 -1
  592. package/dist/src/gateway/service/marketplace-service.d.ts +3 -3
  593. package/dist/src/gateway/service/marketplace-service.js +6 -6
  594. package/dist/src/gateway/service/run-gateway-agent.js +51 -49
  595. package/dist/src/gateway/service/session-input-coordinator.d.ts +11 -11
  596. package/dist/src/gateway/service/session-input-coordinator.js +76 -74
  597. package/dist/src/gateway/service/sessions-api.d.ts +19 -20
  598. package/dist/src/gateway/service/sessions-api.js +30 -38
  599. package/dist/src/gateway/service/task-conversation-query-service.d.ts +3 -2
  600. package/dist/src/gateway/service/task-conversation-query-service.js +3 -3
  601. package/dist/src/gateway/service.d.ts +4 -4
  602. package/dist/src/gateway/service.js +76 -70
  603. package/dist/src/gateway/session-context-summary.d.ts +1 -1
  604. package/dist/src/gateway/session-context-summary.js +13 -11
  605. package/dist/src/gateway/session-reset-service.d.ts +4 -4
  606. package/dist/src/gateway/session-reset-service.js +12 -12
  607. package/dist/src/gateway/side-chat/context-snapshot.d.ts +2 -2
  608. package/dist/src/gateway/side-chat/context-snapshot.js +2 -2
  609. package/dist/src/gateway/side-chat/manager.d.ts +4 -4
  610. package/dist/src/gateway/side-chat/manager.js +13 -13
  611. package/dist/src/gateway/side-chat/run-service.js +8 -8
  612. package/dist/src/gateway/side-chat/types.d.ts +4 -4
  613. package/dist/src/heartbeat/index.js +1 -1
  614. package/dist/src/heartbeat/wake.d.ts +1 -1
  615. package/dist/src/history/ctx/exporter.js +11 -11
  616. package/dist/src/history/ctx/format.d.ts +1 -1
  617. package/dist/src/history/ctx/format.js +7 -7
  618. package/dist/src/imports/contextImport.js +2 -1
  619. package/dist/src/imports/productImport.js +2 -1
  620. package/dist/src/infra/node-sqlite.js +9 -3
  621. package/dist/src/infra/process-diagnostics.js +9 -5
  622. package/dist/src/infra/sqlite-errors.js +25 -20
  623. package/dist/src/infra/unhandled-rejections.js +15 -7
  624. package/dist/src/infra/update-restart.js +1 -1
  625. package/dist/src/infra/warning-filter.js +9 -3
  626. package/dist/src/knowledge-memory/domain.d.ts +2 -2
  627. package/dist/src/knowledge-memory/repository.d.ts +1 -1
  628. package/dist/src/knowledge-memory/repository.js +10 -8
  629. package/dist/src/mcp/channel-bridge.d.ts +3 -3
  630. package/dist/src/mcp/channel-bridge.js +7 -7
  631. package/dist/src/mcp/channel-shared.d.ts +4 -4
  632. package/dist/src/mcp/channel-shared.js +3 -3
  633. package/dist/src/mcp/channel-tools.js +19 -19
  634. package/dist/src/media/session-references.js +2 -2
  635. package/dist/src/memory-maintenance/service.js +2 -1
  636. package/dist/src/migrations/conversation-routing-config.d.ts +2 -0
  637. package/dist/src/migrations/conversation-routing-config.js +42 -0
  638. package/dist/src/migrations/runner.js +6 -5
  639. package/dist/src/notes/service.d.ts +2 -2
  640. package/dist/src/notes/service.js +6 -6
  641. package/dist/src/notes/store.js +2 -1
  642. package/dist/src/notes/types.d.ts +3 -3
  643. package/dist/src/notifications/device-store.js +2 -1
  644. package/dist/src/notifications/planner.js +5 -3
  645. package/dist/src/notifications/proactive-channel.js +4 -1
  646. package/dist/src/notifications/proactive-policy.js +2 -1
  647. package/dist/src/notifications/service.d.ts +4 -4
  648. package/dist/src/notifications/service.js +4 -1
  649. package/dist/src/notifications/store.js +4 -1
  650. package/dist/src/notifications/web-push.js +4 -1
  651. package/dist/src/platform/contracts.d.ts +3 -3
  652. package/dist/src/proactive/actions/service.js +2 -1
  653. package/dist/src/proactive/events/product-event-bridge.js +1 -1
  654. package/dist/src/proactive/events/repository.js +2 -1
  655. package/dist/src/proactive/execution/authorization.js +2 -1
  656. package/dist/src/proactive/execution/context.js +2 -1
  657. package/dist/src/proactive/execution/insight.js +2 -0
  658. package/dist/src/proactive/execution/repository.js +2 -1
  659. package/dist/src/proactive/execution/worker.js +3 -2
  660. package/dist/src/proactive/experience.d.ts +1 -1
  661. package/dist/src/proactive/experience.js +4 -3
  662. package/dist/src/proactive/follow-ups.d.ts +7 -7
  663. package/dist/src/proactive/follow-ups.js +5 -4
  664. package/dist/src/proactive/inbox/cards.js +5 -2
  665. package/dist/src/proactive/inbox/delivery.js +2 -1
  666. package/dist/src/proactive/inbox/digest.js +2 -1
  667. package/dist/src/proactive/inbox/lifecycle.js +2 -1
  668. package/dist/src/proactive/inbox/repository.js +2 -1
  669. package/dist/src/proactive/inbox/service.js +2 -1
  670. package/dist/src/proactive/mail-thread.js +2 -1
  671. package/dist/src/proactive/maintenance.js +2 -1
  672. package/dist/src/proactive/metrics.js +2 -1
  673. package/dist/src/proactive/policy/presence.js +2 -1
  674. package/dist/src/proactive/policy/service.js +4 -1
  675. package/dist/src/proactive/routing/batch-repository.js +2 -1
  676. package/dist/src/proactive/scenarios/control.js +4 -1
  677. package/dist/src/proactive/scenarios/repository.js +2 -1
  678. package/dist/src/proactive/service.js +2 -1
  679. package/dist/src/proactive/source-freshness.js +2 -1
  680. package/dist/src/proactive/status.js +2 -1
  681. package/dist/src/proactive/temporal/schedule.js +2 -1
  682. package/dist/src/projects/automation-bind.js +2 -1
  683. package/dist/src/projects/index.js +2 -2
  684. package/dist/src/projects/knowledge-bind.js +2 -1
  685. package/dist/src/projects/project-agent.js +4 -1
  686. package/dist/src/projects/project-service.d.ts +4 -4
  687. package/dist/src/projects/project-service.js +11 -10
  688. package/dist/src/projects/project-store.js +11 -9
  689. package/dist/src/projects/session-bind.d.ts +5 -5
  690. package/dist/src/projects/session-bind.js +18 -17
  691. package/dist/src/projects/types.d.ts +1 -1
  692. package/dist/src/projects/workflow-bind.js +2 -1
  693. package/dist/src/projects/workspace.d.ts +3 -3
  694. package/dist/src/projects/workspace.js +6 -6
  695. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  696. package/dist/src/providers/index.js +2 -2
  697. package/dist/src/providers/model-catalog-persistence.js +11 -2
  698. package/dist/src/providers/model-catalog-store.js +1 -0
  699. package/dist/src/providers/model-catalog-types.d.ts +7 -2
  700. package/dist/src/providers/model-reference-auditor.js +7 -4
  701. package/dist/src/providers/model-registry.js +4 -1
  702. package/dist/src/providers/model-supplements.js +18 -2
  703. package/dist/src/providers/presentation.js +4 -2
  704. package/dist/src/providers/prompt-cache-lifecycle.d.ts +2 -2
  705. package/dist/src/providers/prompt-cache-lifecycle.js +6 -6
  706. package/dist/src/providers/register-runtime-providers.js +1 -1
  707. package/dist/src/providers/xopc-cloud-model-source.js +10 -4
  708. package/dist/src/realtime/broker.js +3 -3
  709. package/dist/src/realtime/runtime.js +1 -1
  710. package/dist/src/retrieval/queryProfile.d.ts +1 -1
  711. package/dist/src/routing/agent-session-key.d.ts +12 -41
  712. package/dist/src/routing/agent-session-key.js +39 -120
  713. package/dist/src/routing/conversation-route.d.ts +28 -0
  714. package/dist/src/routing/conversation-route.js +50 -0
  715. package/dist/src/routing/index.d.ts +2 -2
  716. package/dist/src/routing/index.js +5 -5
  717. package/dist/src/routing/resolve-route.d.ts +4 -9
  718. package/dist/src/routing/resolve-route.js +20 -60
  719. package/dist/src/routing/resolve-tui-session-key.d.ts +5 -13
  720. package/dist/src/routing/resolve-tui-session-key.js +11 -36
  721. package/dist/src/routing/session-key.d.ts +6 -39
  722. package/dist/src/routing/session-key.js +13 -161
  723. package/dist/src/session/client-history.js +2 -0
  724. package/dist/src/session/compaction-types.js +18 -13
  725. package/dist/src/session/config-store.d.ts +8 -8
  726. package/dist/src/session/config-store.js +19 -19
  727. package/dist/src/session/index.d.ts +2 -2
  728. package/dist/src/session/index.js +9 -5
  729. package/dist/src/session/init-session-turn.d.ts +7 -7
  730. package/dist/src/session/init-session-turn.js +18 -18
  731. package/dist/src/session/manager.d.ts +7 -7
  732. package/dist/src/session/manager.js +6 -6
  733. package/dist/src/session/model-config-lock.d.ts +1 -1
  734. package/dist/src/session/model-config-lock.js +4 -4
  735. package/dist/src/session/resolve-session.d.ts +10 -10
  736. package/dist/src/session/resolve-session.js +20 -20
  737. package/dist/src/session/session-context-for-llm.js +17 -10
  738. package/dist/src/session/session-title.d.ts +5 -5
  739. package/dist/src/session/session-title.js +28 -28
  740. package/dist/src/session/session-workspace.d.ts +1 -1
  741. package/dist/src/session/session-workspace.js +3 -3
  742. package/dist/src/session/store.d.ts +14 -14
  743. package/dist/src/session/store.js +70 -50
  744. package/dist/src/session/stored-rows-to-file-entries.d.ts +1 -1
  745. package/dist/src/session/stored-rows-to-file-entries.js +5 -3
  746. package/dist/src/session/thinking-resolve.d.ts +2 -2
  747. package/dist/src/session/thinking-resolve.js +4 -4
  748. package/dist/src/session/transcript-events.d.ts +1 -1
  749. package/dist/src/session/transcript-events.js +3 -3
  750. package/dist/src/session/transcript-outline.js +2 -1
  751. package/dist/src/session/turn-outcome-projector.js +2 -0
  752. package/dist/src/session/types.d.ts +5 -4
  753. package/dist/src/session/types.js +13 -9
  754. package/dist/src/session/user-message-display.js +2 -0
  755. package/dist/src/session/user-round-delete.js +2 -1
  756. package/dist/src/session/voice-transcript.js +8 -3
  757. package/dist/src/share/hosted-session-share.d.ts +6 -6
  758. package/dist/src/share/hosted-session-share.js +13 -11
  759. package/dist/src/share/hosted-static-site-publish.d.ts +1 -1
  760. package/dist/src/share/hosted-static-site-publish.js +1 -1
  761. package/dist/src/share/session-share-service.d.ts +9 -9
  762. package/dist/src/share/session-share-service.js +19 -19
  763. package/dist/src/share/share-store.d.ts +2 -2
  764. package/dist/src/share/share-store.js +9 -7
  765. package/dist/src/share/share-types.d.ts +2 -2
  766. package/dist/src/share/site-share-router.d.ts +2 -2
  767. package/dist/src/share/site-share-store.js +4 -2
  768. package/dist/src/share/site-share-types.d.ts +1 -1
  769. package/dist/src/storage/sqlite/activity-repository.js +2 -1
  770. package/dist/src/storage/sqlite/browser-session-repository.js +2 -1
  771. package/dist/src/storage/sqlite/browser-tab-binding-repository.d.ts +2 -2
  772. package/dist/src/storage/sqlite/browser-tab-binding-repository.js +10 -9
  773. package/dist/src/storage/sqlite/clarification-wait-repository.d.ts +7 -7
  774. package/dist/src/storage/sqlite/clarification-wait-repository.js +58 -53
  775. package/dist/src/storage/sqlite/collaboration-rule-repository.js +2 -1
  776. package/dist/src/storage/sqlite/composer-input-history-repository.js +2 -1
  777. package/dist/src/storage/sqlite/config-repository.d.ts +6 -6
  778. package/dist/src/storage/sqlite/config-repository.js +29 -25
  779. package/dist/src/storage/sqlite/connection-wait-repository.d.ts +11 -11
  780. package/dist/src/storage/sqlite/connection-wait-repository.js +61 -51
  781. package/dist/src/storage/sqlite/connection.js +28 -18
  782. package/dist/src/storage/sqlite/connector-account-repository.js +2 -1
  783. package/dist/src/storage/sqlite/connector-learning-repository.js +2 -1
  784. package/dist/src/storage/sqlite/connector-repository.d.ts +1 -1
  785. package/dist/src/storage/sqlite/connector-repository.js +11 -10
  786. package/dist/src/storage/sqlite/connector-sync-policy-repository.js +2 -1
  787. package/dist/src/storage/sqlite/context-evidence-repository.d.ts +1 -1
  788. package/dist/src/storage/sqlite/context-evidence-repository.js +7 -6
  789. package/dist/src/storage/sqlite/context-extraction-repository.js +2 -1
  790. package/dist/src/storage/sqlite/context-relation-repository.js +2 -1
  791. package/dist/src/storage/sqlite/conversation-repository.d.ts +12 -0
  792. package/dist/src/storage/sqlite/conversation-repository.js +76 -0
  793. package/dist/src/storage/sqlite/device-access-repository.js +4 -1
  794. package/dist/src/storage/sqlite/device-pairing-approval.js +4 -1
  795. package/dist/src/storage/sqlite/device-pairing-repository.js +2 -1
  796. package/dist/src/storage/sqlite/durable-queue.js +4 -2
  797. package/dist/src/storage/sqlite/durable-state.js +4 -2
  798. package/dist/src/storage/sqlite/endpoint-principal-repository.js +2 -1
  799. package/dist/src/storage/sqlite/endpoint-session-binding-repository.d.ts +3 -3
  800. package/dist/src/storage/sqlite/endpoint-session-binding-repository.js +12 -11
  801. package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +2 -1
  802. package/dist/src/storage/sqlite/fts.js +39 -34
  803. package/dist/src/storage/sqlite/gateway-identity-repository.js +2 -1
  804. package/dist/src/storage/sqlite/home-attention-repository.js +2 -1
  805. package/dist/src/storage/sqlite/import-repository.js +2 -1
  806. package/dist/src/storage/sqlite/import-selection-repository.js +2 -1
  807. package/dist/src/storage/sqlite/index.d.ts +2 -2
  808. package/dist/src/storage/sqlite/index.js +25 -11
  809. package/dist/src/storage/sqlite/interaction-state-repository.d.ts +4 -4
  810. package/dist/src/storage/sqlite/interaction-state-repository.js +12 -11
  811. package/dist/src/storage/sqlite/knowledge-repository.js +2 -1
  812. package/dist/src/storage/sqlite/migrations/178_conversation_uuid.sql +2 -0
  813. package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +11 -0
  814. package/dist/src/storage/sqlite/migrations/conversation-backup.js +98 -0
  815. package/dist/src/storage/sqlite/migrations/conversation-key-decoder.d.ts +8 -0
  816. package/dist/src/storage/sqlite/migrations/conversation-key-decoder.js +87 -0
  817. package/dist/src/storage/sqlite/migrations/conversation-uuid.d.ts +8 -0
  818. package/dist/src/storage/sqlite/migrations/conversation-uuid.js +366 -0
  819. package/dist/src/storage/sqlite/migrations/conversation-windows-owners.d.ts +1 -0
  820. package/dist/src/storage/sqlite/migrations/conversation-windows-owners.js +95 -0
  821. package/dist/src/storage/sqlite/migrations/discover.js +9 -5
  822. package/dist/src/storage/sqlite/migrations/errors.d.ts +5 -0
  823. package/dist/src/storage/sqlite/migrations/errors.js +38 -23
  824. package/dist/src/storage/sqlite/migrations/runner.d.ts +2 -2
  825. package/dist/src/storage/sqlite/migrations/runner.js +44 -14
  826. package/dist/src/storage/sqlite/migrations/types.d.ts +1 -1
  827. package/dist/src/storage/sqlite/note-agent-context-repository.js +2 -1
  828. package/dist/src/storage/sqlite/notes-repository.js +4 -2
  829. package/dist/src/storage/sqlite/paths.js +6 -2
  830. package/dist/src/storage/sqlite/relationship-settings-repository.js +2 -1
  831. package/dist/src/storage/sqlite/row-mappers.d.ts +10 -10
  832. package/dist/src/storage/sqlite/row-mappers.js +22 -15
  833. package/dist/src/storage/sqlite/schema-version.js +7 -2
  834. package/dist/src/storage/sqlite/schema.js +16 -8
  835. package/dist/src/storage/sqlite/schema.sql +2641 -526
  836. package/dist/src/storage/sqlite/session-identity-sql.js +12 -5
  837. package/dist/src/storage/sqlite/session-input-repository.d.ts +14 -14
  838. package/dist/src/storage/sqlite/session-input-repository.js +69 -61
  839. package/dist/src/storage/sqlite/session-instance-repository.d.ts +1 -1
  840. package/dist/src/storage/sqlite/session-instance-repository.js +6 -3
  841. package/dist/src/storage/sqlite/session-metadata.d.ts +2 -2
  842. package/dist/src/storage/sqlite/session-metadata.js +7 -3
  843. package/dist/src/storage/sqlite/session-repository.d.ts +15 -15
  844. package/dist/src/storage/sqlite/session-repository.js +126 -102
  845. package/dist/src/storage/sqlite/session-task-plan-repository.d.ts +3 -3
  846. package/dist/src/storage/sqlite/session-task-plan-repository.js +21 -19
  847. package/dist/src/storage/sqlite/session-turn-replace-repository.d.ts +2 -2
  848. package/dist/src/storage/sqlite/session-turn-replace-repository.js +26 -22
  849. package/dist/src/storage/sqlite/transaction.js +12 -6
  850. package/dist/src/storage/sqlite/transcript-repository.d.ts +14 -14
  851. package/dist/src/storage/sqlite/transcript-repository.js +107 -102
  852. package/dist/src/storage/sqlite/user-people-repository.js +2 -1
  853. package/dist/src/storage/sqlite/user-trust-repository.js +2 -1
  854. package/dist/src/support/collect-support-report.js +7 -7
  855. package/dist/src/support/types.d.ts +2 -2
  856. package/dist/src/support/types.js +1 -1
  857. package/dist/src/tasks/execution-context.d.ts +2 -2
  858. package/dist/src/tasks/execution-context.js +3 -3
  859. package/dist/src/tasks/home-query-service.d.ts +2 -2
  860. package/dist/src/tasks/home-query-service.js +6 -6
  861. package/dist/src/tasks/index.js +6 -2
  862. package/dist/src/tasks/project-monitoring-service.js +2 -1
  863. package/dist/src/tasks/project-operating-view-service.js +2 -1
  864. package/dist/src/tasks/task-application-service.js +9 -4
  865. package/dist/src/tasks/task-change-events.js +7 -2
  866. package/dist/src/tasks/task-context-assembler.d.ts +2 -2
  867. package/dist/src/tasks/task-context-assembler.js +12 -9
  868. package/dist/src/tasks/task-context-repository.d.ts +1 -1
  869. package/dist/src/tasks/task-context-repository.js +4 -3
  870. package/dist/src/tasks/task-conversation-repository.d.ts +7 -7
  871. package/dist/src/tasks/task-conversation-repository.js +27 -26
  872. package/dist/src/tasks/task-deletion-service.js +2 -1
  873. package/dist/src/tasks/task-dependency-service.js +2 -1
  874. package/dist/src/tasks/task-handoff-service.d.ts +2 -2
  875. package/dist/src/tasks/task-handoff-service.js +16 -15
  876. package/dist/src/tasks/task-outbox-dispatcher.js +2 -1
  877. package/dist/src/tasks/task-read-model-projector.js +4 -2
  878. package/dist/src/tasks/task-repository.js +2 -1
  879. package/dist/src/tasks/task-run-coordinator.js +6 -5
  880. package/dist/src/tasks/task-run-dispatcher.d.ts +1 -1
  881. package/dist/src/tasks/task-run-dispatcher.js +4 -3
  882. package/dist/src/tasks/task-run-repository.d.ts +2 -2
  883. package/dist/src/tasks/task-run-repository.js +219 -212
  884. package/dist/src/tasks/task-signal-service.js +6 -2
  885. package/dist/src/tasks/task-workflow-coordinator.js +2 -1
  886. package/dist/src/tui/backends/embedded-backend.d.ts +33 -32
  887. package/dist/src/tui/backends/embedded-backend.js +95 -83
  888. package/dist/src/tui/backends/gateway-realtime-backend.d.ts +34 -33
  889. package/dist/src/tui/backends/gateway-realtime-backend.js +95 -78
  890. package/dist/src/tui/components/branch-summary.js +3 -3
  891. package/dist/src/tui/components/session-selector.d.ts +5 -5
  892. package/dist/src/tui/components/session-selector.js +7 -7
  893. package/dist/src/tui/components/tui-bottom-bar.js +1 -1
  894. package/dist/src/tui/components/tui-header.d.ts +1 -1
  895. package/dist/src/tui/components/tui-header.js +2 -2
  896. package/dist/src/tui/extension-host/autocomplete.d.ts +2 -2
  897. package/dist/src/tui/extension-host/autocomplete.js +4 -4
  898. package/dist/src/tui/extension-host/host.d.ts +1 -1
  899. package/dist/src/tui/extension-host/runtime-context.d.ts +1 -1
  900. package/dist/src/tui/extension-host/runtime-context.js +2 -2
  901. package/dist/src/tui/extension-host/runtime.d.ts +1 -1
  902. package/dist/src/tui/extension-host/runtime.js +6 -6
  903. package/dist/src/tui/tui-backend.d.ts +43 -39
  904. package/dist/src/tui/tui-command-formatters.d.ts +2 -2
  905. package/dist/src/tui/tui-command-formatters.js +10 -18
  906. package/dist/src/tui/tui-commands.d.ts +3 -3
  907. package/dist/src/tui/tui-commands.js +31 -33
  908. package/dist/src/tui/tui-empty-session-cleanup.d.ts +2 -3
  909. package/dist/src/tui/tui-empty-session-cleanup.js +7 -15
  910. package/dist/src/tui/tui-file-autocomplete.d.ts +1 -1
  911. package/dist/src/tui/tui-file-autocomplete.js +2 -2
  912. package/dist/src/tui/tui-new-session-preferences.js +2 -0
  913. package/dist/src/tui/tui-picker-overlay.d.ts +1 -1
  914. package/dist/src/tui/tui-picker-overlay.js +41 -53
  915. package/dist/src/tui/tui-picker-services.d.ts +3 -3
  916. package/dist/src/tui/tui-session-actions.d.ts +1 -1
  917. package/dist/src/tui/tui-session-actions.js +8 -17
  918. package/dist/src/tui/tui-session-format.js +4 -1
  919. package/dist/src/tui/tui-session-snapshot.d.ts +2 -2
  920. package/dist/src/tui/tui-session-snapshot.js +4 -4
  921. package/dist/src/tui/tui-settings.js +2 -0
  922. package/dist/src/tui/tui-startup-resources.d.ts +1 -1
  923. package/dist/src/tui/tui-startup-resources.js +4 -4
  924. package/dist/src/tui/tui-startup-text.js +1 -1
  925. package/dist/src/tui/tui-transcript-tree-picker.d.ts +1 -1
  926. package/dist/src/tui/tui-transcript-tree-picker.js +2 -2
  927. package/dist/src/tui/tui-types.d.ts +4 -2
  928. package/dist/src/tui/tui-types.js +2 -2
  929. package/dist/src/tui/tui.js +116 -114
  930. package/dist/src/user-context/access-policy.d.ts +1 -1
  931. package/dist/src/user-context/access-policy.js +6 -5
  932. package/dist/src/user-context/changes.js +9 -4
  933. package/dist/src/user-context/domain.d.ts +1 -1
  934. package/dist/src/user-context/relationship-continuity.d.ts +1 -1
  935. package/dist/src/user-context/relationship-continuity.js +1 -1
  936. package/dist/src/user-context/sources/repository.js +4 -2
  937. package/dist/src/user-model/capture/executor.d.ts +1 -1
  938. package/dist/src/user-model/capture/executor.js +3 -3
  939. package/dist/src/user-model/goals.js +2 -1
  940. package/dist/src/user-model/repository.js +2 -1
  941. package/dist/src/utils/global-singleton.js +4 -1
  942. package/dist/src/utils/logger/context.d.ts +1 -1
  943. package/dist/src/utils/logger/context.js +2 -2
  944. package/dist/src/utils/logger/log-store.js +2 -2
  945. package/dist/src/utils/logger/pino-record.js +6 -6
  946. package/dist/src/utils/logger/types.d.ts +6 -6
  947. package/dist/src/voice/platform-catalog.d.ts +81 -0
  948. package/dist/src/voice/platform-catalog.js +16 -0
  949. package/dist/src/voice/platform-settings.d.ts +4 -0
  950. package/dist/src/voice/platform-settings.js +120 -0
  951. package/dist/src/voice/platform-streams.d.ts +12 -0
  952. package/dist/src/voice/platform-streams.js +250 -0
  953. package/dist/src/voice/realtime/agentBroker.d.ts +6 -6
  954. package/dist/src/voice/realtime/agentBroker.js +6 -6
  955. package/dist/src/voice/realtime/agentEngine.js +6 -6
  956. package/dist/src/voice/realtime/memory-context.d.ts +2 -2
  957. package/dist/src/voice/realtime/memory-context.js +15 -15
  958. package/dist/src/voice/realtime/omniEngine.js +8 -5
  959. package/dist/src/voice/realtime/omniRoute.d.ts +1 -0
  960. package/dist/src/voice/realtime/omniRoute.js +11 -1
  961. package/dist/src/voice/realtime/persona-context.d.ts +1 -1
  962. package/dist/src/voice/realtime/persona-context.js +6 -6
  963. package/dist/src/voice/realtime/runtime.d.ts +1 -1
  964. package/dist/src/voice/realtime/runtime.js +28 -19
  965. package/dist/src/voice/realtime/runtime.types.d.ts +6 -6
  966. package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +15 -8
  967. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +12 -19
  968. package/dist/src/work-discovery/investigation-repository.js +4 -2
  969. package/dist/src/work-discovery/probe.js +1 -1
  970. package/dist/src/work-discovery/repository.js +7 -5
  971. package/dist/src/work-discovery/service.js +35 -31
  972. package/dist/src/work-discovery/types.d.ts +1 -1
  973. package/dist/src/workflows/context/workflow-context-snapshot-repository.js +2 -1
  974. package/dist/src/workflows/domain/event.d.ts +1 -1
  975. package/dist/src/workflows/domain/run.d.ts +5 -5
  976. package/dist/src/workflows/engine/projector.js +1 -1
  977. package/dist/src/workflows/engine/workflow-engine.d.ts +2 -2
  978. package/dist/src/workflows/engine/workflow-engine.js +15 -18
  979. package/dist/src/workflows/index.js +3 -3
  980. package/dist/src/workflows/project-presets/project-workflow-preset-repository.js +2 -1
  981. package/dist/src/workflows/service/run-view-to-snapshot.js +1 -1
  982. package/dist/src/workflows/service/workflow-run-service.d.ts +2 -2
  983. package/dist/src/workflows/service/workflow-run-service.js +53 -42
  984. package/dist/src/workflows/service/workflow-run-service.types.d.ts +2 -2
  985. package/dist/src/workflows/service/workflow-session-bridge.d.ts +2 -2
  986. package/dist/src/workflows/service/workflow-session-bridge.js +31 -31
  987. package/dist/src/workflows/service/workflow-session-key.d.ts +1 -1
  988. package/dist/src/workflows/service/workflow-session-key.js +4 -4
  989. package/dist/src/workflows/service/workflow-writeback-service.js +2 -1
  990. package/dist/src/workflows/store/event-store.js +4 -2
  991. package/dist/src/workflows/store/run-index-store.js +9 -8
  992. package/package.json +6 -3
  993. package/skills/creative/algorithmic-art/SKILL.md +7 -0
  994. package/skills/creative/frontend-design/SKILL.md +8 -0
  995. package/skills/creative/hatch-pet/SKILL.md +7 -0
  996. package/skills/creative/theme-factory/SKILL.md +8 -0
  997. package/skills/documents/doc-coauthoring/SKILL.md +7 -0
  998. package/skills/documents/docx/SKILL.md +7 -0
  999. package/skills/documents/pdf/SKILL.md +7 -0
  1000. package/skills/documents/pptx/SKILL.md +7 -0
  1001. package/skills/documents/xlsx/SKILL.md +9 -1
  1002. package/skills/engineering/build-xopc-local-app/SKILL.md +7 -0
  1003. package/skills/engineering/define-task/SKILL.md +7 -0
  1004. package/skills/engineering/diagnose/SKILL.md +8 -0
  1005. package/skills/engineering/tdd/SKILL.md +8 -0
  1006. package/skills/tools/find-skills/SKILL.md +8 -0
  1007. package/skills/tools/github/SKILL.md +7 -0
  1008. package/skills/tools/summarize/SKILL.md +8 -0
  1009. package/skills/tools/webapp-testing/SKILL.md +8 -1
  1010. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CcmqK1Sc.js +0 -1
  1011. package/dist/gateway/static/root/assets/agents-B_7PVt7S.js +0 -1
  1012. package/dist/gateway/static/root/assets/api-COG_Tzpv.js +0 -1
  1013. package/dist/gateway/static/root/assets/apps-page-6qxxKFsK.js +0 -1
  1014. package/dist/gateway/static/root/assets/automations-workspace-BRQlU4qk.js +0 -6
  1015. package/dist/gateway/static/root/assets/browser-settings-page-DDjbDeHQ.js +0 -8
  1016. package/dist/gateway/static/root/assets/button-BA45yciM.js +0 -1
  1017. package/dist/gateway/static/root/assets/capabilities-settings-panel-DM1Bcf1x.js +0 -8
  1018. package/dist/gateway/static/root/assets/channels-settings-Bq36CUxL.js +0 -1
  1019. package/dist/gateway/static/root/assets/connectors-page-L8JehrxF.js +0 -2
  1020. package/dist/gateway/static/root/assets/desktop-pet-DtPNvznL.js +0 -1
  1021. package/dist/gateway/static/root/assets/extension-settings-page-C75kCOqe.js +0 -1
  1022. package/dist/gateway/static/root/assets/gateway-settings-BCF732TU.js +0 -1
  1023. package/dist/gateway/static/root/assets/heartbeat-settings-C7fjiowt.js +0 -1
  1024. package/dist/gateway/static/root/assets/home-page-DZXeXdUL.js +0 -1
  1025. package/dist/gateway/static/root/assets/index-ChIrvv3t.js +0 -74
  1026. package/dist/gateway/static/root/assets/index-R1VNlHjj.css +0 -2
  1027. package/dist/gateway/static/root/assets/local-app-workbench-page-CAEKGTAg.js +0 -2
  1028. package/dist/gateway/static/root/assets/locale-store-DlOv7896.js +0 -1
  1029. package/dist/gateway/static/root/assets/logs-page-DHZ4BEkG.js +0 -2
  1030. package/dist/gateway/static/root/assets/messages-Ls1Aaiqd.js +0 -3
  1031. package/dist/gateway/static/root/assets/note-detail-panel-BcWq3ddw.js +0 -5
  1032. package/dist/gateway/static/root/assets/notes-page-DfZ8QWyv.js +0 -8
  1033. package/dist/gateway/static/root/assets/page-tabs-BG39KidE.js +0 -1
  1034. package/dist/gateway/static/root/assets/popover-select-DGmMQt4t.js +0 -1
  1035. package/dist/gateway/static/root/assets/proactive-page-D2U_xQaS.js +0 -1
  1036. package/dist/gateway/static/root/assets/project-detail-page-CzlGTW4F.js +0 -1
  1037. package/dist/gateway/static/root/assets/projects-page-mQsM-TsP.js +0 -1
  1038. package/dist/gateway/static/root/assets/remote-access-hub-Cb56JcO1.js +0 -1
  1039. package/dist/gateway/static/root/assets/sessions-page-Hj9uFcIO.js +0 -1
  1040. package/dist/gateway/static/root/assets/settings-advanced-gate-CV4-_EVA.js +0 -1
  1041. package/dist/gateway/static/root/assets/settings-form-section-wcAdCkK8.js +0 -1
  1042. package/dist/gateway/static/root/assets/settings-page-layout-DYelDcMV.js +0 -1
  1043. package/dist/gateway/static/root/assets/setup-status-panel-DzxmsaQG.js +0 -1
  1044. package/dist/gateway/static/root/assets/shares-settings-xlJh1ccG.js +0 -1
  1045. package/dist/gateway/static/root/assets/skill-reload-api-wSXJRSxX.js +0 -1
  1046. package/dist/gateway/static/root/assets/skills-page-AmqtBJo7.js +0 -2
  1047. package/dist/gateway/static/root/assets/task-detail-page-sQpwq5-c.js +0 -1
  1048. package/dist/gateway/static/root/assets/tunnel-api-Boajol0M.js +0 -1
  1049. package/dist/gateway/static/root/assets/user-model-page-DIEHnAER.js +0 -2
  1050. package/dist/gateway/static/root/assets/workflows-page-DgRNIyr7.js +0 -6
  1051. package/dist/src/routing/session-key-utils.d.ts +0 -23
  1052. package/dist/src/routing/session-key-utils.js +0 -85
  1053. package/dist/src/session/session-id.d.ts +0 -3
  1054. package/dist/src/session/session-id.js +0 -10
  1055. package/dist/src/storage/sqlite/migrations/002_add_flush_columns.sql +0 -3
  1056. package/dist/src/storage/sqlite/migrations/003_add_note_markdown_meta.sql +0 -4
  1057. package/dist/src/storage/sqlite/migrations/004_add_session_type_metadata.sql +0 -15
  1058. package/dist/src/storage/sqlite/migrations/005_add_note_agent_contexts.sql +0 -10
  1059. package/dist/src/storage/sqlite/migrations/006_add_goals.sql +0 -108
  1060. package/dist/src/storage/sqlite/migrations/007_goal_run_judge_schema.sql +0 -4
  1061. package/dist/src/storage/sqlite/migrations/008_goal_queue_workflow_runs.sql +0 -53
  1062. package/dist/src/storage/sqlite/migrations/009_cron_jobs.sql +0 -24
  1063. package/dist/src/storage/sqlite/migrations/010_session_id_identity.sql +0 -30
  1064. package/dist/src/storage/sqlite/migrations/011_goal_context_messages.sql +0 -8
  1065. package/dist/src/storage/sqlite/migrations/012_memory_records.sql +0 -63
  1066. package/dist/src/storage/sqlite/migrations/013_memory_trace_events.sql +0 -21
  1067. package/dist/src/storage/sqlite/migrations/014_memory_record_governance.sql +0 -10
  1068. package/dist/src/storage/sqlite/migrations/015_memory_trace_feedback.sql +0 -4
  1069. package/dist/src/storage/sqlite/migrations/016_automations.sql +0 -47
  1070. package/dist/src/storage/sqlite/migrations/017_automation_run_events.sql +0 -14
  1071. package/dist/src/storage/sqlite/migrations/018_automation_safety.sql +0 -1
  1072. package/dist/src/storage/sqlite/migrations/019_projects.sql +0 -40
  1073. package/dist/src/storage/sqlite/migrations/020_project_default_agent.sql +0 -1
  1074. package/dist/src/storage/sqlite/migrations/021_projects_fts.sql +0 -21
  1075. package/dist/src/storage/sqlite/migrations/022_work_items.sql +0 -61
  1076. package/dist/src/storage/sqlite/migrations/023_work_item_attachments.sql +0 -15
  1077. package/dist/src/storage/sqlite/migrations/024_activity_events.sql +0 -62
  1078. package/dist/src/storage/sqlite/migrations/025_project_pinned_at.sql +0 -5
  1079. package/dist/src/storage/sqlite/migrations/026_goal_contracts.sql +0 -10
  1080. package/dist/src/storage/sqlite/migrations/027_mobile_notifications.sql +0 -43
  1081. package/dist/src/storage/sqlite/migrations/028_goal_evidence_requirements.sql +0 -47
  1082. package/dist/src/storage/sqlite/migrations/029_user_understanding.sql +0 -133
  1083. package/dist/src/storage/sqlite/migrations/030_connectors.sql +0 -94
  1084. package/dist/src/storage/sqlite/migrations/031_connector_approvals.sql +0 -24
  1085. package/dist/src/storage/sqlite/migrations/032_connector_webhook_deliveries.sql +0 -15
  1086. package/dist/src/storage/sqlite/migrations/033_user_trust_policies.sql +0 -6
  1087. package/dist/src/storage/sqlite/migrations/034_allow_global_auto_trust.sql +0 -14
  1088. package/dist/src/storage/sqlite/migrations/035_user_profile_prompt_state.sql +0 -7
  1089. package/dist/src/storage/sqlite/migrations/036_goal_outcome_metric.sql +0 -12
  1090. package/dist/src/storage/sqlite/migrations/037_connected_knowledge_pipeline.sql +0 -47
  1091. package/dist/src/storage/sqlite/migrations/038_user_owned_memory.sql +0 -68
  1092. package/dist/src/storage/sqlite/migrations/039_memory_reference_consents.sql +0 -19
  1093. package/dist/src/storage/sqlite/migrations/040_local_apps.sql +0 -32
  1094. package/dist/src/storage/sqlite/migrations/041_local_app_release_lifecycle.sql +0 -17
  1095. package/dist/src/storage/sqlite/migrations/042_work_discovery.sql +0 -41
  1096. package/dist/src/storage/sqlite/migrations/043_local_app_acceptance_runs.sql +0 -16
  1097. package/dist/src/storage/sqlite/migrations/044_repair_work_discovery_foreign_keys.sql +0 -75
  1098. package/dist/src/storage/sqlite/migrations/045_extension_ui_grants.sql +0 -13
  1099. package/dist/src/storage/sqlite/migrations/046_work_discovery_feedback.sql +0 -13
  1100. package/dist/src/storage/sqlite/migrations/047_work_discovery_sources.sql +0 -16
  1101. package/dist/src/storage/sqlite/migrations/048_work_understanding_investigations.sql +0 -40
  1102. package/dist/src/storage/sqlite/migrations/049_work_understanding_threads.sql +0 -52
  1103. package/dist/src/storage/sqlite/migrations/050_work_discovery_source_refreshes.sql +0 -15
  1104. package/dist/src/storage/sqlite/migrations/051_focus_watches.sql +0 -26
  1105. package/dist/src/storage/sqlite/migrations/052_proactive_insights.sql +0 -25
  1106. package/dist/src/storage/sqlite/migrations/053_browser_recipes.sql +0 -45
  1107. package/dist/src/storage/sqlite/migrations/054_task_outcomes.sql +0 -24
  1108. package/dist/src/storage/sqlite/migrations/055_relationship_settings.sql +0 -14
  1109. package/dist/src/storage/sqlite/migrations/056_task_verification.sql +0 -6
  1110. package/dist/src/storage/sqlite/migrations/057_interaction_states.sql +0 -11
  1111. package/dist/src/storage/sqlite/migrations/058_proactive_value.sql +0 -3
  1112. package/dist/src/storage/sqlite/migrations/059_composer_input_history.sql +0 -8
  1113. package/dist/src/storage/sqlite/migrations/060_remove_runtime_transcript_messages.sql +0 -45
  1114. package/dist/src/storage/sqlite/migrations/061_drop_compaction_checkpoints.sql +0 -2
  1115. package/dist/src/storage/sqlite/migrations/062_connector_learning_jobs.sql +0 -27
  1116. package/dist/src/storage/sqlite/migrations/063_knowledge_collection_scopes.sql +0 -14
  1117. package/dist/src/storage/sqlite/migrations/064_user_claims.sql +0 -60
  1118. package/dist/src/storage/sqlite/migrations/065_knowledge_item_scope_identity.sql +0 -116
  1119. package/dist/src/storage/sqlite/migrations/066_first_class_focuses.sql +0 -126
  1120. package/dist/src/storage/sqlite/migrations/067_home_attention_acknowledgements.sql +0 -9
  1121. package/dist/src/storage/sqlite/migrations/068_proactive_event_spine.sql +0 -71
  1122. package/dist/src/storage/sqlite/migrations/069_proactive_scenario_control.sql +0 -69
  1123. package/dist/src/storage/sqlite/migrations/070_proactive_execution.sql +0 -55
  1124. package/dist/src/storage/sqlite/migrations/071_proactive_inbox.sql +0 -45
  1125. package/dist/src/storage/sqlite/migrations/072_proactive_judgments.sql +0 -14
  1126. package/dist/src/storage/sqlite/migrations/073_enable_default_proactive_scenarios.sql +0 -13
  1127. package/dist/src/storage/sqlite/migrations/074_deduplicate_blocked_work_routing.sql +0 -5
  1128. package/dist/src/storage/sqlite/migrations/075_connector_sync_policies.sql +0 -13
  1129. package/dist/src/storage/sqlite/migrations/076_meeting_preparation_scenario.sql +0 -29
  1130. package/dist/src/storage/sqlite/migrations/077_proactive_insight_fingerprints.sql +0 -4
  1131. package/dist/src/storage/sqlite/migrations/078_discussion_captures.sql +0 -64
  1132. package/dist/src/storage/sqlite/migrations/079_discussion_follow_up_scenario.sql +0 -29
  1133. package/dist/src/storage/sqlite/migrations/080_task_outcome_context.sql +0 -15
  1134. package/dist/src/storage/sqlite/migrations/081_project_monitoring_policies.sql +0 -10
  1135. package/dist/src/storage/sqlite/migrations/082_one_click_live_discussions.sql +0 -100
  1136. package/dist/src/storage/sqlite/migrations/083_session_task_plans.sql +0 -9
  1137. package/dist/src/storage/sqlite/migrations/084_work_intake_lifecycle.sql +0 -26
  1138. package/dist/src/storage/sqlite/migrations/085_task_outcome_projection.sql +0 -19
  1139. package/dist/src/storage/sqlite/migrations/086_outcome_aggregates.sql +0 -168
  1140. package/dist/src/storage/sqlite/migrations/087_context_snapshots.sql +0 -21
  1141. package/dist/src/storage/sqlite/migrations/088_automation_execution_deadlines.sql +0 -5
  1142. package/dist/src/storage/sqlite/migrations/089_automation_run_leases.sql +0 -8
  1143. package/dist/src/storage/sqlite/migrations/090_outcome_contract_judgment.sql +0 -2
  1144. package/dist/src/storage/sqlite/migrations/091_context_allocation.sql +0 -1
  1145. package/dist/src/storage/sqlite/migrations/092_outcome_execution_runtime.sql +0 -88
  1146. package/dist/src/storage/sqlite/migrations/093_remove_legacy_goals.sql +0 -174
  1147. package/dist/src/storage/sqlite/migrations/094_outcome_judgment_and_authority.sql +0 -3
  1148. package/dist/src/storage/sqlite/migrations/095_session_input_queue.sql +0 -35
  1149. package/dist/src/storage/sqlite/migrations/096_drop_work_intakes.sql +0 -6
  1150. package/dist/src/storage/sqlite/migrations/097_work_item_lifecycle.sql +0 -194
  1151. package/dist/src/storage/sqlite/migrations/098_discussion_note_documents.sql +0 -99
  1152. package/dist/src/storage/sqlite/migrations/099_task_model.sql +0 -500
  1153. package/dist/src/storage/sqlite/migrations/100_project_task_taskrun.sql +0 -763
  1154. package/dist/src/storage/sqlite/migrations/101_session_response_language.sql +0 -1
  1155. package/dist/src/storage/sqlite/migrations/102_session_user_context_mode.sql +0 -2
  1156. package/dist/src/storage/sqlite/migrations/103_finalize_structured_memory.sql +0 -3
  1157. package/dist/src/storage/sqlite/migrations/104_turn_memory_feedback.sql +0 -77
  1158. package/dist/src/storage/sqlite/migrations/105_dreaming_ledger.sql +0 -34
  1159. package/dist/src/storage/sqlite/migrations/106_dreaming_run_reproducibility.sql +0 -2
  1160. package/dist/src/storage/sqlite/migrations/107_connector_accounts.sql +0 -146
  1161. package/dist/src/storage/sqlite/migrations/108_repair_user_memory_provider.sql +0 -18
  1162. package/dist/src/storage/sqlite/migrations/109_endpoint_principals.sql +0 -14
  1163. package/dist/src/storage/sqlite/migrations/110_session_input_origin.sql +0 -43
  1164. package/dist/src/storage/sqlite/migrations/111_endpoint_tool_invocations.sql +0 -18
  1165. package/dist/src/storage/sqlite/migrations/112_endpoint_instance_bindings.sql +0 -8
  1166. package/dist/src/storage/sqlite/migrations/113_memory_evidence_single_source.sql +0 -76
  1167. package/dist/src/storage/sqlite/migrations/114_user_context_domain.sql +0 -193
  1168. package/dist/src/storage/sqlite/migrations/115_remove_legacy_user_context.sql +0 -6
  1169. package/dist/src/storage/sqlite/migrations/116_structured_context_consolidation.sql +0 -38
  1170. package/dist/src/storage/sqlite/migrations/117_unified_understanding_sources.sql +0 -110
  1171. package/dist/src/storage/sqlite/migrations/118_task_board_rank.sql +0 -6
  1172. package/dist/src/storage/sqlite/migrations/119_proactive_disposition.sql +0 -13
  1173. package/dist/src/storage/sqlite/migrations/120_task_conversation.sql +0 -112
  1174. package/dist/src/storage/sqlite/migrations/121_automation_inbox.sql +0 -24
  1175. package/dist/src/storage/sqlite/migrations/122_automation_session_projects.sql +0 -18
  1176. package/dist/src/storage/sqlite/migrations/123_remove_v2_compaction_boundaries.sql +0 -25
  1177. package/dist/src/storage/sqlite/migrations/124_workflow_context_snapshots.sql +0 -15
  1178. package/dist/src/storage/sqlite/migrations/125_project_workflow_presets.sql +0 -12
  1179. package/dist/src/storage/sqlite/migrations/126_focus_context_governance.sql +0 -72
  1180. package/dist/src/storage/sqlite/migrations/127_context_object_origin.sql +0 -36
  1181. package/dist/src/storage/sqlite/migrations/128_context_extraction.sql +0 -73
  1182. package/dist/src/storage/sqlite/migrations/129_focus_versions.sql +0 -51
  1183. package/dist/src/storage/sqlite/migrations/130_context_evidence_provenance.sql +0 -18
  1184. package/dist/src/storage/sqlite/migrations/131_session_input_contexts.sql +0 -2
  1185. package/dist/src/storage/sqlite/migrations/132_transcript_source_context_metadata.sql +0 -34
  1186. package/dist/src/storage/sqlite/migrations/133_archive_legacy_work_discovery_profile_facts.sql +0 -11
  1187. package/dist/src/storage/sqlite/migrations/134_memory_provenance.sql +0 -18
  1188. package/dist/src/storage/sqlite/migrations/135_user_people.sql +0 -59
  1189. package/dist/src/storage/sqlite/migrations/136_product_notifications.sql +0 -79
  1190. package/dist/src/storage/sqlite/migrations/137_understanding_status_audit.sql +0 -71
  1191. package/dist/src/storage/sqlite/migrations/138_device_access.sql +0 -96
  1192. package/dist/src/storage/sqlite/migrations/139_turn_outcome_artifact_backfill.sql +0 -231
  1193. package/dist/src/storage/sqlite/migrations/140_endpoint_session_bindings.sql +0 -8
  1194. package/dist/src/storage/sqlite/migrations/141_device_pairing_approval.sql +0 -17
  1195. package/dist/src/storage/sqlite/migrations/142_session_input_instance.sql +0 -1
  1196. package/dist/src/storage/sqlite/migrations/143_fixed_session_model.sql +0 -1
  1197. package/dist/src/storage/sqlite/migrations/144_execution_environments.sql +0 -59
  1198. package/dist/src/storage/sqlite/migrations/145_project_execution_mode.sql +0 -5
  1199. package/dist/src/storage/sqlite/migrations/146_understanding_focus_exclusions.sql +0 -9
  1200. package/dist/src/storage/sqlite/migrations/147_durable_application_state.sql +0 -39
  1201. package/dist/src/storage/sqlite/migrations/148_user_model_foundation.sql +0 -554
  1202. package/dist/src/storage/sqlite/migrations/149_separate_source_index_from_memory.sql +0 -18
  1203. package/dist/src/storage/sqlite/migrations/150_session_connection_waits.sql +0 -47
  1204. package/dist/src/storage/sqlite/migrations/151_proactive_scope_cleanup.sql +0 -6
  1205. package/dist/src/storage/sqlite/migrations/152_proactive_scenario_contract.sql +0 -140
  1206. package/dist/src/storage/sqlite/migrations/153_browser_control_v2.sql +0 -45
  1207. package/dist/src/storage/sqlite/migrations/154_session_clarification_waits.sql +0 -60
  1208. package/dist/src/storage/sqlite/migrations/155_browser_extension.sql +0 -120
  1209. package/dist/src/storage/sqlite/migrations/156_browser_tab_bindings.sql +0 -14
  1210. package/dist/src/storage/sqlite/migrations/157_browser_endpoint_principals.sql +0 -50
  1211. package/dist/src/storage/sqlite/migrations/158_browser_native_enrollment.sql +0 -4
  1212. package/dist/src/storage/sqlite/migrations/159_proactive_controls.sql +0 -68
  1213. package/dist/src/storage/sqlite/migrations/160_proactive_web_push.sql +0 -27
  1214. package/dist/src/storage/sqlite/migrations/161_proactive_delivery_and_lifecycle.sql +0 -51
  1215. package/dist/src/storage/sqlite/migrations/162_proactive_product.sql +0 -7
  1216. package/dist/src/storage/sqlite/migrations/163_proactive_follow_ups.sql +0 -29
  1217. package/dist/src/storage/sqlite/migrations/164_browser_sessions.sql +0 -8
  1218. package/dist/src/storage/sqlite/migrations/165_device_pairing_target.sql +0 -40
  1219. package/dist/src/storage/sqlite/migrations/__tests__/mobile-discussion-source.test.ts +0 -20
  1220. package/dist/src/storage/sqlite/migrations/discover.ts +0 -52
  1221. package/dist/src/storage/sqlite/migrations/errors.ts +0 -32
  1222. package/dist/src/storage/sqlite/migrations/runner.ts +0 -194
  1223. package/dist/src/storage/sqlite/migrations/types.ts +0 -15
@@ -0,0 +1,5 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/block-editor-CDcMvaku.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-B7EieIE4.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/markdown-view-BIg7cei7.js","assets/dist-BGTk37IG.js","assets/chunk-KS7C4IRE-Cq1tE_3b.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/locale-store-eliqUnBr.js","assets/messages-NYDOR8-j.js","assets/cn-JdwAhgNB.js","assets/app-link-BiBXVEvp.js","assets/product-delivery-CCC4FJ3Y.js","assets/schemas-BaskVM5g.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/markdown-view-Y68dCxuc.css","assets/dist-Che_jiQF.js","assets/vendor-swr-BIWyz7Rc.js","assets/check-DUBLcKHA.js","assets/popover-select-DldSX8GX.js","assets/skeleton-BwbyijEw.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/settings-shell-layer-context-DCp6ykjQ.js","assets/circle-check-C23XjkUj.js","assets/clock-3-DnrAnuyZ.js","assets/copy-Dv6d4Dvw.js","assets/external-link-DjqjBmc3.js","assets/git-branch-Dh9uxTot.js","assets/globe-DSSGFWFn.js","assets/loader-circle-CifKLtgG.js","assets/message-circle-Badhj-4D.js","assets/message-square-fVE7Ghj1.js","assets/middleware-Pd0e8Igk.js","assets/files-Be5viEFY.js","assets/tool-activity-R8V9l6nk.js","assets/button-CGlRPNzi.js","assets/registry-api-Dpm3N2h0.js","assets/gateway-startup-retry-NXDtzZED.js","assets/gateway-config-swr-BBovMBQ1.js","assets/electron-env-DH5wF8X8.js","assets/activity-store-6lmzUBEr.js","assets/theme-store-DUHPzKzv.js","assets/index-BD5uNzie.css","assets/vendor-codemirror-DFxP3B9T.js","assets/with-selector-aYPsXwdl.js","assets/block-editor-D4ZIVQbk.css","assets/markdown-editor-BhBJANcx.js","assets/code-editor-CXIH8jQw.js","assets/languages-BFe8nIOO.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{d as a,t as o}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as s}from"./check-DUBLcKHA.js";import{n as c,r as l}from"./popover-select-DldSX8GX.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./copy-Dv6d4Dvw.js";import{t as f}from"./download-Dk-ZjtO6.js";import{t as p}from"./external-link-DjqjBmc3.js";import{t as m}from"./loader-circle-CifKLtgG.js";import{t as h}from"./message-circle-Badhj-4D.js";import{t as g}from"./x-B_N4OPjy.js";import{t as _}from"./cn-JdwAhgNB.js";import{a as v,f as y,n as b,r as x}from"./locale-store-eliqUnBr.js";import{t as S}from"./messages-NYDOR8-j.js";import{a as C,i as w,n as T,o as E,r as D,s as O,t as k}from"./dist-BGTk37IG.js";import{t as A}from"./copy-to-clipboard-HOJ79TWv.js";import{i as j}from"./vendor-swr-BIWyz7Rc.js";import{t as M}from"./button-CGlRPNzi.js";import{i as N}from"./theme-store-DUHPzKzv.js";import{t as P}from"./skeleton-BwbyijEw.js";import{$l as F,$n as I,$s as ee,Ai as L,An as R,Bn as z,Ci as te,Di as ne,Dn as B,En as V,Fn as re,Hu as ie,In as ae,Kn as H,Lc as oe,Ln as se,Mn as ce,Mo as le,Nl as U,Nn as ue,On as de,Ql as W,Qn as G,Rn as fe,Un as K,Uu as q,Vc as pe,Vn as me,Wn as he,Xn as ge,Zi as _e,Zn as ve,_l as ye,a as be,bt as xe,c as Se,cr as Ce,cu as we,ec as Te,er as Ee,ho as De,ji as Oe,jn as ke,kc as J,kn as Ae,l as je,lc as Me,lr as Ne,nn as Pe,o as Fe,pc as Ie,ql as Le,rn as Re,rr as ze,s as Be,sr as Ve,tc as Y,tr as He,ur as Ue,wc as We,wi as X,wu as Ge,yc as Ke,zn as qe}from"./index-B7EieIE4.js";var Je=n(),Z=e(t(),1),Q=r(),Ye=(0,Z.createContext)(null);function Xe(){let e=(0,Je.c)(1),t=(0,Z.useContext)(Ye);if(!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={openImage:Ze},e[0]=t):t=e[0],t}return t}function Ze(){}function Qe(e){let t=(0,Je.c)(22),{children:n,closeLabel:r}=e,i=r===void 0?`Close`:r,[a,o]=(0,Z.useState)(null),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(e,t)=>{o({src:e,alt:t})},t[0]=s):s=t[0];let c=s,l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={openImage:c},t[1]=l):l=t[1];let u=l,d=a!==null,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>{e||o(null)},t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(C,{className:`fixed inset-0 z-[70] bg-scrim/90 backdrop-blur-sm`}),t[3]=p):p=t[3];let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=_(`fixed inset-0 z-[71] flex items-center justify-center p-4 outline-none`,`data-[state=open]:animate-in data-[state=closed]:animate-out`),t[4]=m):m=t[4];let h=a?.alt||`Image preview`,v;t[5]===h?v=t[6]:(v=(0,Q.jsx)(O,{className:`sr-only`,children:h}),t[5]=h,t[6]=v);let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(g,{className:`size-5`,"aria-hidden":!0}),t[7]=y):y=t[7];let b;t[8]===i?b=t[9]:(b=(0,Q.jsx)(T,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":i,className:`absolute right-4 top-4 z-10 rounded-lg bg-surface-panel/80 p-2 text-fg-muted backdrop-blur transition-colors hover:bg-surface-hover hover:text-fg`,children:y})}),t[8]=i,t[9]=b);let x;t[10]===a?x=t[11]:(x=a?(0,Q.jsx)(`img`,{src:a.src,alt:a.alt??``,className:`max-h-[min(90vh,900px)] max-w-[min(95vw,1200px)] rounded-lg object-contain shadow-lg`}):null,t[10]=a,t[11]=x);let S;t[12]!==b||t[13]!==x||t[14]!==v?(S=(0,Q.jsxs)(E,{children:[p,(0,Q.jsxs)(D,{className:m,"aria-describedby":void 0,children:[v,b,x]})]}),t[12]=b,t[13]=x,t[14]=v,t[15]=S):S=t[15];let w;t[16]!==S||t[17]!==d?(w=(0,Q.jsx)(k,{open:d,onOpenChange:f,children:S}),t[16]=S,t[17]=d,t[18]=w):w=t[18];let A;return t[19]!==n||t[20]!==w?(A=(0,Q.jsxs)(Ye.Provider,{value:u,children:[n,w]}),t[19]=n,t[20]=w,t[21]=A):A=t[21],A}var $e=6e4,et=36e5,$=864e5;function tt(e){let t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}function nt(e,t,n){let r=t-e;if(r<$e)return n.justNow;if(r<et){let e=Math.floor(r/$e);return n.minutesAgo.replace(`{{n}}`,String(e))}let i=tt(t);if(e>=i)return n.today+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(e>=i-$)return n.yesterday+` `+new Date(e).toLocaleTimeString(n.locale,{hour:`2-digit`,minute:`2-digit`});if(r<7*$){let e=Math.floor(r/$);return n.daysAgo.replace(`{{n}}`,String(e))}return new Date(e).toLocaleDateString(n.locale,{month:`short`,day:`numeric`})}function rt(e,t,n){let r=tt(t);if(e>=r)return n.today;if(e>=r-$)return n.yesterday;let i=new Date(e),a=new Date(t);return i.getFullYear()===a.getFullYear()?i.toLocaleDateString(n.locale,{month:`long`,day:`numeric`}):i.toLocaleDateString(n.locale,{year:`numeric`,month:`long`,day:`numeric`})}function it(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function at(e){let t=(0,Je.c)(45),{title:n,description:r,prompt:i,coverage:o,className:s,variant:c}=e,l=c===void 0?`card`:c,d=b(ct),f=S(d).automations.suggestions,p=S(d).automations,m=a(),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,refreshInterval:15e3},t[0]=h):h=t[0];let{data:g}=j(o?`automation-suggestion-coverage`:null,st,h),v=o?g?.automations.find(e=>Se(e,o)):void 0,y=v?Fe(v,p):[];if(l===`titleAction`){if(v){let e;t[1]===s?e=t[2]:(e=_(`flex min-w-0 items-center gap-2 rounded-lg border border-emerald-500/25 bg-emerald-500/10 px-2.5 py-1.5`,s),t[1]=s,t[2]=e);let n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(u,{className:`size-3.5 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[3]=n):n=t[3];let r;return t[4]===m?r=t[5]:(r=()=>m(`/automations`),t[4]=m,t[5]=r),(0,Q.jsxs)(`section`,{className:e,children:[n,(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:f.coveredTitle}),(0,Q.jsx)(M,{variant:`ghost`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:r,children:f.manage})]})}let e;t[6]===s?e=t[7]:(e=_(`flex min-w-0 items-center gap-2 rounded-lg bg-surface-panel px-2.5 py-1.5 shadow-surface`,s),t[6]=s,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(ye,{className:`size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),t[8]=a):a=t[8];let o;t[9]!==r||t[10]!==n?(o=(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,title:r,children:n}),t[9]=r,t[10]=n,t[11]=o):o=t[11];let c;t[12]!==m||t[13]!==i?(c=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[12]=m,t[13]=i,t[14]=c):c=t[14];let l;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(Ie,{className:`size-3.5`,"aria-hidden":!0}),t[15]=l):l=t[15],(0,Q.jsxs)(`section`,{className:e,children:[a,o,(0,Q.jsxs)(M,{variant:`secondary`,className:`h-7 shrink-0 rounded-md px-2 text-xs`,onClick:c,children:[l,f.setup]})]})}if(v){let e;t[16]===s?e=t[17]:(e=_(`rounded-lg border border-emerald-500/25 bg-emerald-500/10 p-3`,s),t[16]=s,t[17]=e);let n;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-emerald-700 dark:text-emerald-300`,"aria-hidden":!0}),t[18]=n):n=t[18];let r;t[19]===m?r=t[20]:(r=()=>m(`/automations`),t[19]=m,t[20]=r);let i;return t[21]!==f||t[22]!==r?(i=(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsx)(M,{variant:`ghost`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:r,children:f.manage})}),t[21]=f,t[22]=r,t[23]=i):i=t[23],(0,Q.jsxs)(`section`,{className:e,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[n,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:f.coveredTitle}),(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:Be(f.coveredDescription,{name:v.name})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-2 rounded-md bg-surface-base/55 px-2.5 py-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg`,children:p.explain.whyCovered}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:y.map(ot)})]}),i]})}let x;t[24]===s?x=t[25]:(x=_(`rounded-lg bg-surface-panel p-3 shadow-surface`,s),t[24]=s,t[25]=x);let C;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(ye,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[26]=C):C=t[26];let w;t[27]===n?w=t[28]:(w=(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n}),t[27]=n,t[28]=w);let T;t[29]===r?T=t[30]:(T=(0,Q.jsx)(`p`,{className:`mt-1 break-words text-xs leading-5 text-fg-muted`,children:r}),t[29]=r,t[30]=T);let E;t[31]!==w||t[32]!==T?(E=(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[C,(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[w,T]})]}),t[31]=w,t[32]=T,t[33]=E):E=t[33];let D;t[34]!==m||t[35]!==i?(D=()=>{m(`/automations?${new URLSearchParams({draft:i,autogenerate:`1`}).toString()}`)},t[34]=m,t[35]=i,t[36]=D):D=t[36];let O;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(Ie,{className:`size-3.5`,"aria-hidden":!0}),t[37]=O):O=t[37];let k;t[38]!==f.create||t[39]!==D?(k=(0,Q.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Q.jsxs)(M,{variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,onClick:D,children:[O,f.create]})}),t[38]=f.create,t[39]=D,t[40]=k):k=t[40];let A;return t[41]!==k||t[42]!==x||t[43]!==E?(A=(0,Q.jsxs)(`section`,{className:x,children:[E,k]}),t[41]=k,t[42]=x,t[43]=E,t[44]=A):A=t[44],A}function ot(e){return(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function st(){return je.list()}function ct(e){return e.language}function lt(e){let t=(0,Je.c)(51),{initial:n,zh:r,busy:i,onClose:a,onSave:o}=e,[s,c]=(0,Z.useState)(n),l;t[0]!==i||t[1]!==a?(l=e=>{!e&&!i&&a()},t[0]=i,t[1]=a,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(C,{className:`fixed inset-0 z-[70] bg-surface-base/80`}),t[3]=u):u=t[3];let d=r?`编辑纪要内容`:`Edit meeting content`,f;t[4]===d?f=t[5]:(f=(0,Q.jsx)(`header`,{className:`border-b border-edge p-4`,children:(0,Q.jsx)(O,{children:d})}),t[4]=d,t[5]=f);let p=r?`人工修改会保留,重新整理不会覆盖。已创建任务保持不变。`:`Your changes survive regeneration. Existing tasks remain unchanged.`,m;t[6]===p?m=t[7]:(m=(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[6]=p,t[7]=m);let h=r?`内容`:`Content`,g;t[8]===s?g=t[9]:(g=e=>c({...s,text:e.target.value}),t[8]=s,t[9]=g);let _;t[10]!==s.text||t[11]!==g?(_=(0,Q.jsx)(`textarea`,{className:`mt-1 min-h-32 w-full rounded border border-edge bg-transparent p-2`,value:s.text,onChange:g}),t[10]=s.text,t[11]=g,t[12]=_):_=t[12];let v;t[13]!==h||t[14]!==_?(v=(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[h,_]}),t[13]=h,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==s||t[17]!==r?(y=s.kind===`actionItems`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`负责人原话`:`Owner as stated`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.owner??``,onChange:e=>c({...s,owner:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`block text-sm`,children:[r?`期限原话`:`Date as stated`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2`,value:s.dueDate??``,onChange:e=>c({...s,dueDate:e.target.value})})]})]}):null,t[16]=s,t[17]=r,t[18]=y):y=t[18];let b;t[19]!==s||t[20]!==r?(b=s.kind===`summary`?null:(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!s.ignored,onChange:e=>c({...s,ignored:e.target.checked})}),r?`忽略此项`:`Ignore this item`]}),t[19]=s,t[20]=r,t[21]=b):b=t[21];let x;t[22]!==v||t[23]!==y||t[24]!==b||t[25]!==m?(x=(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:[m,v,y,b]}),t[22]=v,t[23]=y,t[24]=b,t[25]=m,t[26]=x):x=t[26];let S=r?`取消`:`Cancel`,w;t[27]!==i||t[28]!==a||t[29]!==S?(w=(0,Q.jsx)(M,{disabled:i,onClick:a,children:S}),t[27]=i,t[28]=a,t[29]=S,t[30]=w):w=t[30];let T;t[31]!==i||t[32]!==s.text?(T=i||!s.text.trim(),t[31]=i,t[32]=s.text,t[33]=T):T=t[33];let A;t[34]!==s||t[35]!==o?(A=()=>void o(s),t[34]=s,t[35]=o,t[36]=A):A=t[36];let j=r?`保存修改`:`Save changes`,N;t[37]!==T||t[38]!==A||t[39]!==j?(N=(0,Q.jsx)(M,{variant:`primary`,disabled:T,onClick:A,children:j}),t[37]=T,t[38]=A,t[39]=j,t[40]=N):N=t[40];let P;t[41]!==w||t[42]!==N?(P=(0,Q.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge p-3`,children:[w,N]}),t[41]=w,t[42]=N,t[43]=P):P=t[43];let F;t[44]!==x||t[45]!==P||t[46]!==f?(F=(0,Q.jsxs)(E,{children:[u,(0,Q.jsxs)(D,{"aria-describedby":void 0,className:`fixed left-1/2 top-1/2 z-[71] flex h-[min(32rem,90dvh)] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[f,x,P]})]}),t[44]=x,t[45]=P,t[46]=f,t[47]=F):F=t[47];let I;return t[48]!==l||t[49]!==F?(I=(0,Q.jsx)(k,{open:!0,onOpenChange:l,children:F}),t[48]=l,t[49]=F,t[50]=I):I=t[50],I}var ut=e=>`${String(Math.floor(e/6e4)).padStart(2,`0`)}:${String(Math.floor(e/1e3)%60).padStart(2,`0`)}`;function dt({noteId:e}){let t=b(e=>e.language)===`zh`,{data:n,mutate:r,isLoading:i}=j([`note-discussion-document`,e],()=>Pe(e),{refreshInterval:e=>e&&([`recording`,`stopping`,`sealing`,`organizing`].includes(e.discussion.status)||e.recordingJob?.state===`queued`||e.recordingJob?.state===`running`)?3e3:0}),a=n?.discussion.id,u=`/api/discussions/${encodeURIComponent(a??``)}`,{data:d=[],mutate:p}=j(a?`${u}/actions`:null,e=>v(x(e)),{refreshInterval:1e4}),[m,h]=(0,Z.useState)(`summary`),[_,y]=(0,Z.useState)(``),[S,w]=(0,Z.useState)(`general`),[T,A]=(0,Z.useState)(null),[N,F]=(0,Z.useState)(null),[I,ee]=(0,Z.useState)(null),[L,R]=(0,Z.useState)(!1),[z,te]=(0,Z.useState)([]),[ne,B]=(0,Z.useState)(null),[V,re]=(0,Z.useState)(!1),[ie,ae]=(0,Z.useState)(1),H=(0,Z.useRef)(null),se=(0,Z.useRef)(null),[ce,le]=(0,Z.useState)(0);(0,Z.useEffect)(()=>{let e=()=>{r(),p()};return window.addEventListener(`discussion-updated`,e),window.addEventListener(`discussion-segment-updated`,e),()=>{window.removeEventListener(`discussion-updated`,e),window.removeEventListener(`discussion-segment-updated`,e)}},[r,p]),(0,Z.useEffect)(()=>{n?.discussion.template&&w(n.discussion.template)},[n?.discussion.template]);async function U(e){if(!V){re(!0),B(null);try{await e(),await r(),await p()}catch(e){B(e instanceof Error?e.message:String(e))}finally{re(!1)}}}function ue(e){H.current&&(H.current.readyState===0?(se.current=e/1e3,H.current.load()):H.current.currentTime=e/1e3,H.current.play().catch(()=>void 0))}async function de(e,t){n?.organization&&await U(async()=>{A((await v(x(`${u}/transcript?revision=${t??n.organization.transcriptRevision}`))).segments.filter(t=>e.includes(t.sequence)))})}let W=(e,n,r)=>n.some(e=>L||!e.ignored)?(0,Q.jsxs)(`section`,{className:`space-y-2`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold text-fg`,children:e}),n.filter(e=>L||!e.ignored).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 text-sm`,children:[(0,Q.jsxs)(`p`,{className:`flex-1 whitespace-pre-wrap`,children:[e.text,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:t?`有后续变更`:`Later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:t?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:V,onClick:()=>ee({kind:r,itemId:e.id,text:e.text,ignored:e.ignored}),children:t?`编辑`:`Edit`}),e.evidenceSegmentIds.length?(0,Q.jsx)(`button`,{disabled:V,className:`shrink-0 text-accent-fg`,onClick:()=>void de(e.evidenceSegmentIds,e.evidenceRevision),children:t?`原话`:`Source`}):(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t?`暂无定位`:`No source timing`})]},e.id))]}):null;if(i)return(0,Q.jsx)(P,{className:`h-48 w-full`});if(!n)return null;let{discussion:G,transcript:fe,organization:K}=n,q=K?.organization,pe=[`stopping`,`sealing`,`organizing`].includes(G.status),me=[`recording`,`completed`,`needs_attention`].includes(G.status),he=fe.segments.filter(e=>(e.displayText??e.rawText??``).toLocaleLowerCase().includes(_.toLocaleLowerCase())||e.speakerLabel?.toLocaleLowerCase().includes(_.toLocaleLowerCase()));return(0,Q.jsxs)(`section`,{className:`relative flex h-full min-h-0 w-full flex-col text-fg`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center gap-3 border-b border-edge-subtle p-4`,children:[(0,Q.jsx)(Le,{className:`size-4 text-accent`}),(0,Q.jsxs)(`span`,{className:`text-sm font-medium`,children:[ut(G.durationMs??0),` · `,pe?t?`正在整理`:`Processing`:G.status===`completed`?t?`整理完成`:`Ready`:G.status]}),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,Q.jsxs)(c,{value:S,"aria-label":t?`纪要模板`:`Summary template`,onChange:e=>w(e.target.value),children:[(0,Q.jsx)(l,{value:`general`,children:t?`通用会议`:`General`}),(0,Q.jsx)(l,{value:`project`,children:t?`项目例会`:`Project`}),(0,Q.jsx)(l,{value:`review`,children:t?`需求评审`:`Review`}),(0,Q.jsx)(l,{value:`interview`,children:t?`客户访谈`:`Interview`})]}),(0,Q.jsxs)(M,{disabled:V||pe||!G.canonicalTranscript,onClick:()=>void U(()=>v(x(`${u}/organize`),{method:`POST`,body:JSON.stringify({template:S})})),children:[(0,Q.jsx)(J,{className:`size-3.5`}),t?`重新整理`:`Regenerate`]})]})]}),(0,Q.jsxs)(`nav`,{"aria-label":t?`会议内容`:`Meeting content`,className:`flex shrink-0 items-center gap-4 border-b border-edge-subtle px-4 py-2 text-sm`,children:[[`summary`,`transcript`].map(e=>(0,Q.jsx)(`button`,{className:m===e?`font-medium text-accent-fg`:`text-fg-muted`,onClick:()=>h(e),children:e===`summary`?t?`纪要与行动`:`Summary & actions`:t?`逐字稿`:`Transcript`},e)),(0,Q.jsxs)(`div`,{className:`ml-auto flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(f,{className:`size-3`}),[`md`,`txt`,`srt`].map(e=>(0,Q.jsx)(`a`,{className:`text-accent-fg`,href:x(`${u}/export?format=${e}`),download:!0,children:e.toUpperCase()},e))]})]}),ne?(0,Q.jsx)(`p`,{role:`alert`,className:`px-4 py-2 text-sm text-danger`,children:ne}):null,n.recordingJob?.state===`queued`||n.recordingJob?.state===`running`?(0,Q.jsx)(`p`,{role:`status`,className:`px-4 py-2 text-sm text-fg-muted`,children:t?`录音已上传,正在后台校验与保存。关闭此页面不会中断处理。`:`Recording uploaded. Verification and saving continue in the background, even if you close this page.`}):null,G.status===`needs_attention`?(0,Q.jsxs)(`div`,{className:`flex gap-2 p-4 text-sm text-danger`,children:[(0,Q.jsx)(`span`,{children:G.failureMessage}),(0,Q.jsx)(`button`,{disabled:V,onClick:()=>void U(()=>Re(G.id)),children:t?`重试`:`Retry`})]}):null,K&&K.transcriptRevision!==fe.revision?(0,Q.jsx)(`p`,{className:`px-4 py-2 text-xs text-fg-muted`,children:t?`转写已修改,当前纪要引用的是修改前版本。重新整理可生成新版纪要。`:`Transcript changed. This summary cites the previous revision; regenerate to update.`}):null,(0,Q.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-4 sm:p-6`,children:m===`summary`?q?(0,Q.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-6`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:q.summaryEditedByUser?t?`概要已人工编辑`:`Overview edited`:``}),(0,Q.jsx)(`button`,{disabled:V||pe,onClick:()=>ee({kind:`summary`,itemId:`summary`,text:q.summary}),children:t?`编辑概要`:`Edit overview`})]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:q.summary}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:L,onChange:e=>R(e.target.checked)}),t?`显示已忽略项`:`Show ignored items`]}),z.length?(0,Q.jsx)(M,{disabled:V,onClick:()=>void U(async()=>{for(let e of z)await v(x(`${u}/actions/${encodeURIComponent(e)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:K.revision})});te([])}),children:t?`加入所选 ${z.length} 项任务`:`Add ${z.length} selected tasks`}):null,W(t?`已决定事项`:`Decisions`,q.decisions,`decisions`),q.actionItems.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:t?`下一步行动`:`Next actions`}),q.actionItems.filter(e=>L||!e.ignored).map(e=>{let n=d.find(t=>t.actionId===e.id);return(0,Q.jsxs)(`article`,{className:`rounded-lg border border-edge-subtle p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[!n&&!e.ignored&&(!(e.supersededBy||e.disputedBy)||e.reviewedChangeId===(e.supersededBy??e.disputedBy))?(0,Q.jsx)(`input`,{type:`checkbox`,"aria-label":`${t?`选择行动`:`Select action`}: ${e.title}`,className:`ui-checkbox`,checked:z.includes(e.id),onChange:t=>te(t.target.checked?[...z,e.id]:z.filter(t=>t!==e.id))}):null,(0,Q.jsxs)(`p`,{className:`flex-1 text-sm font-medium`,children:[e.title,e.supersededBy||e.disputedBy?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:t?`有后续变更,请复核`:`Review later changes`}):null,e.editedByUser?(0,Q.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:t?e.ignored?`已忽略`:`人工编辑`:e.ignored?`Ignored`:`Edited`}):null]}),(0,Q.jsx)(`button`,{className:`text-xs text-fg-muted`,disabled:V||pe,onClick:()=>ee({kind:`actionItems`,itemId:e.id,text:e.title,owner:e.owner,dueDate:e.dueDate,ignored:e.ignored}),children:t?`编辑`:`Edit`})]}),(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[e.owner??(t?`负责人未明确`:`Owner unspecified`),` · `,e.dueDate??(t?`期限未明确`:`Date unspecified`)]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-xs`,children:[e.evidenceSegmentIds.length?(0,Q.jsx)(`button`,{disabled:V,className:`text-accent-fg`,onClick:()=>void de(e.evidenceSegmentIds,e.evidenceRevision),children:t?`查看原话`:`Source`}):null,n?n.deleted?(0,Q.jsx)(`span`,{children:t?`关联任务已删除`:`Linked task deleted`}):(0,Q.jsx)(o,{className:`text-accent-fg`,to:`/tasks/${encodeURIComponent(n.taskId)}`,children:n.resolution===`done`?t?`已完成 · 查看任务`:`Done · View task`:t?`查看任务 / 交给助手`:`View task / Delegate`}):e.ignored?null:(0,Q.jsx)(M,{disabled:V||!!(e.supersededBy||e.disputedBy)&&e.reviewedChangeId!==(e.supersededBy??e.disputedBy),onClick:()=>void U(()=>v(x(`${u}/actions/${encodeURIComponent(e.id)}/convert`),{method:`POST`,body:JSON.stringify({organizationRevision:K.revision})})),children:t?`加入我的任务`:`Add to my tasks`})]})]},e.id)})]}):null,W(t?`风险`:`Risks`,q.risks,`risks`),W(t?`尚未确定`:`Open questions`,q.openQuestions,`openQuestions`),q.changes?.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:t?`前后变更`:`Changes during the meeting`}),q.changes.map(e=>{let n=[...q.decisions,...q.actionItems,...q.risks,...q.openQuestions],r=n.find(t=>t.id===e.fromId),i=n.find(t=>t.id===e.toId);return!r||!i?null:(0,Q.jsxs)(`article`,{className:`space-y-2 rounded border border-edge p-3 text-sm`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.relation===`supersedes`?t?`后续撤销或替代`:`Later superseded`:t?`存在冲突,尚未明确解决`:`Unresolved conflict`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void de(r.evidenceSegmentIds,r.evidenceRevision),children:`title`in r?r.title:r.text}),(0,Q.jsx)(`span`,{children:`↓`}),(0,Q.jsx)(`button`,{className:`block text-left text-accent-fg`,onClick:()=>void de(i.evidenceSegmentIds,i.evidenceRevision),children:`title`in i?i.title:i.text})]},`${e.fromId}:${e.toId}`)})]}):null,q.chapters.length?(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold`,children:t?`章节回顾`:`Chapters`}),q.chapters.map((e,t)=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`button`,{className:`text-sm text-accent-fg`,onClick:()=>ue(e.startedAtMs),children:[ut(e.startedAtMs),` · `,e.title]}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-sm text-fg-muted`,children:e.summary})]},t))]}):null]}):(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:pe?t?`录音已保存,纪要正在生成。可以先查看逐字稿。`:`Recording saved. Summary is processing; you can read the transcript.`:t?`录音结束后自动生成纪要。`:`Summary appears after recording ends.`}),pe?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(P,{className:`h-6 w-3/4`}),(0,Q.jsx)(P,{className:`h-24 w-full`})]}):null]}):(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-edge px-3`,children:[(0,Q.jsx)(We,{className:`size-4 text-fg-muted`}),(0,Q.jsx)(`input`,{className:`w-full bg-transparent py-2 text-sm outline-none`,placeholder:t?`查找原话或说话人`:`Search words or speaker`,value:_,onChange:e=>{y(e.target.value),ae(1)}})]}),he.slice(0,ie*50).map(e=>(0,Q.jsxs)(`article`,{className:`rounded-md border p-3 ${ce>=e.startedAtMs&&ce<e.endedAtMs?`border-accent`:`border-edge-subtle`}`,children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center gap-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-accent-fg`,onClick:()=>ue(e.startedAtMs),children:[(0,Q.jsx)(oe,{className:`size-3`}),ut(e.startedAtMs)]}),(0,Q.jsx)(`span`,{children:e.speakerLabel??(t?`未区分说话人`:`Speaker unknown`)}),me&&e.status===`confirmed`?(0,Q.jsx)(`button`,{className:`ml-auto`,onClick:()=>F({segment:e,text:e.displayText??e.rawText??``,speaker:e.speakerLabel??``}),children:t?`校对`:`Edit`}):null]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-6`,children:e.displayText??e.rawText??(t?`等待转写`:`Awaiting transcription`)})]},e.sequence)),he.length>ie*50?(0,Q.jsx)(M,{onClick:()=>ae(ie+1),children:t?`加载更多`:`More`}):null]})}),G.audioAttachmentId&&!G.audioDeletedAt?(0,Q.jsxs)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:[(0,Q.jsx)(`audio`,{ref:H,controls:!0,preload:`metadata`,className:`h-10 w-full`,src:x(`${u}/audio`),onTimeUpdate:()=>le((H.current?.currentTime??0)*1e3),onLoadedMetadata:()=>{se.current!==null&&H.current&&(H.current.currentTime=se.current,se.current=null)},onError:()=>B(t?`录音暂不可播放`:`Recording unavailable`)}),(0,Q.jsx)(`a`,{className:`mt-1 block text-right text-xs text-accent-fg`,href:x(`${u}/audio`),download:!0,children:t?`下载录音`:`Download recording`})]}):null,T?(0,Q.jsxs)(`aside`,{"aria-label":t?`原话证据`:`Source evidence`,className:`absolute inset-y-0 right-0 z-10 flex w-[min(26rem,100%)] flex-col border-l border-edge bg-surface-panel`,children:[(0,Q.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsx)(`h3`,{children:t?`原话证据`:`Source evidence`}),(0,Q.jsx)(`button`,{"aria-label":t?`关闭`:`Close`,onClick:()=>A(null),children:(0,Q.jsx)(g,{className:`size-4`})})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-4`,children:T.length?T.map(e=>(0,Q.jsxs)(`article`,{children:[(0,Q.jsxs)(`button`,{className:`mb-2 text-xs text-accent-fg`,onClick:()=>ue(e.startedAtMs),children:[ut(e.startedAtMs),` · `,e.speakerLabel??(t?`说话人未明确`:`Unknown speaker`)]}),(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap text-sm leading-7`,children:e.displayText??e.rawText})]},e.sequence)):(0,Q.jsx)(`p`,{children:t?`此版本暂无可定位原话。`:`No timed source available for this revision.`})})]}):null,I&&K?(0,Q.jsx)(lt,{initial:I,zh:t,busy:V,onClose:()=>ee(null),onSave:e=>U(async()=>{await v(x(`${u}/summary`),{method:`PATCH`,body:JSON.stringify({...e,expectedRevision:K.revision})}),ee(null)})},`${I.kind}:${I.itemId}:${K.revision}`):null,N?(0,Q.jsx)(k,{open:!0,onOpenChange:e=>{e||F(null)},children:(0,Q.jsxs)(E,{children:[(0,Q.jsx)(C,{className:`fixed inset-0 z-[70] bg-surface-base/80`}),(0,Q.jsxs)(D,{"aria-describedby":void 0,className:`fixed left-1/2 top-1/2 z-[71] flex h-[min(28rem,90dvh)] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,Q.jsxs)(`header`,{className:`flex items-center justify-between border-b border-edge p-4`,children:[(0,Q.jsx)(O,{children:t?`校对逐字稿`:`Edit transcript`}),(0,Q.jsx)(`button`,{"aria-label":t?`关闭校对`:`Close editor`,onClick:()=>F(null),children:(0,Q.jsx)(g,{className:`size-4`})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-4`,children:[(0,Q.jsxs)(`label`,{className:`block text-xs`,children:[t?`本段说话人`:`Speaker for this segment`,(0,Q.jsx)(`input`,{className:`mt-1 w-full rounded border border-edge bg-transparent p-2 text-sm`,value:N.speaker,onChange:e=>F({...N,speaker:e.target.value})})]}),N.segment.speakerLabel?(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!N.applyToSpeakerGroup,onChange:e=>F({...N,applyToSpeakerGroup:e.target.checked})}),t?`同时更名所有同标签片段;输入已有标签可合并说话人`:`Rename all segments with this label; use an existing label to merge speakers`]}):null,(0,Q.jsx)(`textarea`,{className:`min-h-32 w-full rounded border border-edge bg-transparent p-2 text-sm`,value:N.text,onChange:e=>F({...N,text:e.target.value})})]}),(0,Q.jsx)(`footer`,{className:`border-t border-edge p-3`,children:(0,Q.jsxs)(M,{variant:`primary`,disabled:V||!N.text.trim(),onClick:()=>void U(async()=>{await v(x(`${u}/segments/${N.segment.sequence}`),{method:`PATCH`,body:JSON.stringify({displayText:N.text,speakerLabel:N.speaker,expectedRevision:N.segment.revision,applyToSpeakerGroup:N.applyToSpeakerGroup,expectedTranscriptRevision:fe.revision})}),F(null)}),children:[(0,Q.jsx)(s,{className:`size-4`}),t?`保存修订`:`Save revision`]})})]})]})}):null]})}var ft={edit:pe,ai_edit:Ie,sync:J,restore:q};function pt(e,t){return{edit:t.triggerEdit,ai_edit:t.triggerAiEdit,sync:t.triggerSync,restore:t.triggerRestore}[e]??e}function mt({noteId:e,activeTimestamp:t,onSelect:n,onClose:r,onRestored:i}){let a=b(e=>e.language),o=S(a).notes,s={justNow:o.justNow,minutesAgo:o.minutesAgo,today:o.today,yesterday:o.yesterday,daysAgo:o.daysAgo,locale:y(a)},{data:c}=j(e?[`note-history`,e]:null,()=>me(e)),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(null),h=(0,Z.useCallback)(async t=>{u(!0),m(null);try{await Ee(e,t),f(null),i()}catch{m(o.restoreFailed)}finally{u(!1)}},[e,o.restoreSuccess,o.restoreFailed,i]),v=Date.now();return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,Q.jsx)(U,{className:`size-4`,"aria-hidden":!0}),o.history]}),(0,Q.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-lg p-1 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,Q.jsx)(g,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[p?(0,Q.jsx)(`p`,{className:`border-b border-danger/20 bg-danger-soft px-4 py-2 text-xs text-danger`,role:`alert`,children:p}):null,c?.length?(0,Q.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>{let r=ft[e.trigger]??pe,i=t===e.timestamp,a=d===e.timestamp;return(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:_(`w-full px-4 py-3 text-left transition-colors`,i?`bg-accent/10`:`hover:bg-surface-hover`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(r,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:pt(e.trigger,o)}),(0,Q.jsx)(`span`,{className:`ml-auto text-xs text-fg-muted`,children:nt(e.timestamp,v,s)})]}),e.snippet&&(0,Q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted/60`,children:e.snippet})]}),i&&(0,Q.jsx)(`div`,{className:`border-t border-edge/50 px-4 py-2`,children:a?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-xs text-fg-muted`,children:o.restoreConfirm}),(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),h(e.timestamp)},disabled:l,className:`shrink-0 rounded-lg bg-accent px-3 py-1 text-xs font-medium text-on-accent transition-colors hover:bg-accent/90 disabled:opacity-50`,children:l?`...`:o.restore}),(0,Q.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),f(null)},className:`shrink-0 rounded-lg px-2 py-1 text-xs text-fg-muted hover:bg-surface-hover`,children:`Cancel`})]}):(0,Q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),f(e.timestamp)},className:`rounded-lg bg-surface-hover px-3 py-1 text-xs font-medium text-fg transition-colors hover:bg-accent hover:text-on-accent`,children:o.restore})})]},e.timestamp)})}):(0,Q.jsxs)(`div`,{className:`px-4 py-8 text-center`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg-muted`,children:o.historyEmpty}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted/60`,children:o.historyEmptyDescription})]})]})]})}function ht({noteId:e,note:t,catalyzing:n,onCatalyze:r,onClose:i,noteThreads:o,openingChat:s,onOpenChat:c,onOpenNewChat:l}){let u=S(b(e=>e.language)).notes,d=a(),f=t?.aiDeep?.catalysis,p=f?.report??null,[m,g]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(!1),{data:x,mutate:C,isLoading:w}=j(e?[`note-agent-context-status`,e]:null,()=>fe(e),{revalidateOnFocus:!1}),T=(0,Z.useCallback)(async()=>{if(!v){y(!0),g(null);try{await C(()=>ge(e),{revalidate:!1})}catch(e){g(`${u.contextRebuildFailed}: ${e instanceof Error?e.message:u.quickCaptureFailedHint}`)}finally{y(!1)}}},[v,C,u.contextRebuildFailed,u.quickCaptureFailedHint,e]),E=(0,Z.useCallback)(async t=>{try{await ve(e,t)}catch{}},[e]);return(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(Ie,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:u.catalysisSectionTitle})]}),(0,Q.jsx)(`button`,{type:`button`,onClick:i,"aria-label":u.lightboxClose,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:(0,Q.jsx)(ie,{className:`size-4 rotate-180`,"aria-hidden":!0})})]}),(0,Q.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:[(0,Q.jsx)(`p`,{className:`mb-4 text-xs leading-relaxed text-fg-muted`,children:u.catalysisSectionDescription}),x?(0,Q.jsxs)(`section`,{className:`mb-4 rounded-xl bg-surface-base p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.contextStatusTitle}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void T(),disabled:w||v,className:`rounded-md px-1.5 py-0.5 text-[11px] font-medium text-accent transition-colors hover:bg-accent/10 disabled:cursor-not-allowed disabled:opacity-50`,children:v?u.processing:u.contextRebuild}),(0,Q.jsx)(`span`,{className:_(`rounded-full px-2 py-0.5 text-[11px] font-medium`,x.status===`ready`?`bg-emerald-500/10 text-emerald-600 dark:text-emerald-300`:x.status===`partial`?`bg-amber-500/10 text-amber-600 dark:text-amber-300`:`bg-red-500/10 text-red-600 dark:text-red-300`),children:x.status})]}),(0,Q.jsx)(`div`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:u.contextStatusDetail.replace(`{{attachments}}`,String(x.attachments.length)).replace(`{{tokens}}`,String(x.tokenEstimate??0))}),m?(0,Q.jsx)(`p`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-xs text-danger`,role:`alert`,children:m}):null,x.attachments.length>0?(0,Q.jsx)(`div`,{className:`mt-3 space-y-1.5`,children:x.attachments.slice(0,5).map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg bg-surface-hover px-2 py-1.5 text-xs`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:e.status})]},e.attachmentId))}):null]}):null,(0,Q.jsx)(`button`,{type:`button`,onClick:r,disabled:n,className:`w-full rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:n?u.processing:p?u.recatalyze:u.catalyzeAction}),p?(0,Q.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.valueHypothesis}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg`,children:p.valueHypothesis})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.targetUsers}),(0,Q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1.5`,children:p.targetUsers.slice(0,5).map(e=>(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg`,children:e},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.keyQuestions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.keyQuestions.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-accent`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.mvpPathLabel}),(0,Q.jsx)(`ol`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.mvpPath.slice(0,3).map((e,t)=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[t+1,`.`]}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.risks}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.risks.slice(0,3).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`mt-2 size-1 shrink-0 rounded-full bg-fg-muted`}),(0,Q.jsx)(`span`,{children:e})]},e))})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:u.nextActions}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm leading-relaxed text-fg`,children:p.nextActions.slice(0,4).map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-2`,children:[(0,Q.jsx)(`span`,{className:`rounded bg-accent/10 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-accent`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.text})]},`${e.kind}:${e.text}`))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:u.confidenceLabel.replace(`{{percent}}`,String(Math.round(p.confidence*100)))}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void E(`helpful`),className:_(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackHelpfulAria,children:(0,Q.jsx)(Te,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void E(`not_helpful`),className:_(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,f?.feedback===`not_helpful`&&`bg-accent/10 text-accent`),"aria-label":u.feedbackNotHelpfulAria,children:(0,Q.jsx)(Y,{className:`size-3.5`,"aria-hidden":!0})})]})]})]}):(0,Q.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-edge-subtle px-3 py-6 text-center text-sm text-fg-muted`,children:u.noCatalysisReportHint}),(0,Q.jsxs)(`section`,{className:`mt-6 rounded-xl bg-surface-base p-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,Q.jsx)(h,{className:`size-4 text-accent`,"aria-hidden":!0}),u.relatedThreadsTitle]}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:u.relatedThreadsDescription})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:c,disabled:s,className:`rounded-lg border border-edge px-2.5 py-1.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`,children:s?u.openingChat:u.openThread}),(0,Q.jsx)(`button`,{type:`button`,onClick:l,disabled:s,className:`rounded-lg bg-accent px-2.5 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent/90 disabled:cursor-not-allowed disabled:opacity-50`,children:u.newThread})]})]}),o.length>0?(0,Q.jsx)(`div`,{className:`space-y-2`,children:o.slice(0,5).map(e=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>d(`/chat/${encodeURIComponent(e.key)}`),className:`w-full rounded-lg border border-edge-subtle px-3 py-2 text-left transition-colors hover:bg-surface-hover`,children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.name||u.noteDiscussionFallback}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:u.messageCount.replace(`{{count}}`,String(e.messageCount??0))})]},e.key))}):(0,Q.jsx)(`div`,{className:`rounded-lg border border-dashed border-edge-subtle px-3 py-5 text-center text-sm text-fg-muted`,children:u.noThreads})]})]})]})}var gt=[{value:`86400000`,zh:`24 小时`,en:`24 hours`},{value:`604800000`,zh:`7 天`,en:`7 days`},{value:`2592000000`,zh:`30 天`,en:`30 days`}];function _t({open:e,onOpenChange:t,note:n}){let r=b(e=>e.language)===`zh`,i=r?xt:St,{data:a,mutate:o}=j(e?[`note-shares`,n.id]:null,()=>K(n.id)),u=j(e?`hosted-share-auth-status`:null,ne),f=u.data===!0,h=j(e&&f?`hosted-publication-capabilities`:null,X),_=h.data?.publishing.allowed===!0,v=j(e&&f?[`hosted-note-publications`,n.id]:null,()=>z(n.id)),[y,x]=(0,Z.useState)(new Set),[S,N]=(0,Z.useState)(`86400000`),[P,F]=(0,Z.useState)(``),[ee,R]=(0,Z.useState)(``),[B,V]=(0,Z.useState)(`hosted`),[ie,ae]=(0,Z.useState)(!1),[H,oe]=(0,Z.useState)(null),[se,ce]=(0,Z.useState)(null),[le,U]=(0,Z.useState)(!1),[de,W]=(0,Z.useState)(null),fe=(0,Z.useMemo)(()=>{let e=new Set;return n.markdown.replace(/xopc-attachment:\/\/notes\/([^/]+)\/([^\s)]+)/gi,(t,r,i)=>{try{decodeURIComponent(r)===n.id&&e.add(decodeURIComponent(i))}catch{}return t}),(n.attachments??[]).filter(t=>e.has(t.id))},[n.attachments,n.id,n.markdown]);(0,Z.useEffect)(()=>{e&&(x(new Set(fe.map(e=>e.id))),ce(null),U(!1),W(null))},[e,fe]);let q=async()=>{ae(!0),W(null);try{let e={expectedNoteVersion:n.updatedAt,attachmentIds:[...y],ttlMs:Number(S),maxViews:P.trim()?Number(P):null,description:ee.trim()||void 0};B===`hosted`?(ce((await ue(n.id,e)).shareUrl),await v.mutate()):(ce((await re(n.id,e)).payload.shareUrl),await o())}catch(e){W(e instanceof Error?e.message:String(e))}finally{ae(!1)}},pe=async(e,t)=>{oe(e.id),W(null);try{t===`refresh`?await G(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...y]}):await L(e.id),await v.mutate()}catch(e){W(e instanceof Error?e.message:String(e))}finally{oe(null)}},me=async(e,t)=>{oe(e.id),W(null);try{t===`refresh`?await I(n.id,e.id,{expectedNoteVersion:n.updatedAt,attachmentIds:[...y]}):t===`extend`?await te(e.id,864e5):await Oe(e.id),await o()}catch(e){W(e instanceof Error?e.message:String(e))}finally{oe(null)}},he=async e=>{W(null);try{if(!await A(e)){U(!1),W(i.copyFailed);return}U(!0),window.setTimeout(()=>U(!1),1500)}catch{U(!1),W(i.copyFailed)}};return(0,Q.jsx)(k,{open:e,onOpenChange:t,children:(0,Q.jsxs)(E,{children:[(0,Q.jsx)(C,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),(0,Q.jsxs)(D,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(40rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between border-b border-edge px-5 py-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(O,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,Q.jsx)(Ke,{className:`size-4`}),i.title]}),(0,Q.jsx)(w,{className:`mt-1 text-xs text-fg-muted`,children:i.description})]}),(0,Q.jsx)(T,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`rounded-md p-1.5 text-fg-muted hover:bg-surface-hover`,"aria-label":i.close,children:(0,Q.jsx)(g,{className:`size-4`})})})]}),(0,Q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Q.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-subtle p-4`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.title||i.untitled}),(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-4 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.markdown||i.empty}),(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:i.privateExcluded})]}),fe.length>0?(0,Q.jsxs)(`section`,{className:`mt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.attachments}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:fe.map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-3 rounded-lg border border-edge-subtle px-3 py-2 text-sm text-fg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:y.has(e.id),onChange:()=>x(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),className:`accent-accent`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.fileName}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:bt(e.size)})]},e.id))})]}):null,(0,Q.jsxs)(`section`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.delivery,(0,Q.jsxs)(c,{value:B,onChange:e=>V(e.target.value),children:[(0,Q.jsx)(l,{value:`hosted`,children:i.deliveryHosted}),(0,Q.jsx)(l,{value:`local`,children:i.deliveryLocal})]})]}),B===`hosted`&&u.data===!1?(0,Q.jsx)(`div`,{className:`sm:col-span-2`,children:(0,Q.jsx)(xe,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:()=>void u.mutate(!0,{revalidate:!1})})}):null,B===`hosted`&&f&&h.data&&!_?(0,Q.jsx)(`p`,{className:`rounded-lg border border-warning/30 bg-warning-soft px-3 py-2 text-xs text-warning sm:col-span-2`,children:i.hostedDisabled}):null,(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.expires,(0,Q.jsx)(c,{value:S,onChange:e=>N(e.target.value),children:gt.map(e=>(0,Q.jsx)(l,{value:e.value,children:r?e.zh:e.en},e.value))})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[i.maxViews,(0,Q.jsx)(`input`,{type:`number`,min:1,max:1e3,value:P,onChange:e=>F(e.target.value),placeholder:i.unlimited,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]}),(0,Q.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted sm:col-span-2`,children:[i.publicDescription,(0,Q.jsx)(`input`,{value:ee,onChange:e=>R(e.target.value),className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`})]})]}),se?(0,Q.jsx)(`div`,{className:`mt-5 rounded-lg border border-success/25 bg-success-soft p-3`,children:(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`input`,{readOnly:!0,value:se,className:`min-w-0 flex-1 bg-transparent text-xs text-fg outline-none`}),(0,Q.jsxs)(M,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void he(se),children:[le?(0,Q.jsx)(s,{className:`size-4`}):(0,Q.jsx)(d,{className:`size-4`}),le?i.copied:i.copy]}),(0,Q.jsxs)(M,{type:`button`,className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>window.open(se,`_blank`,`noopener,noreferrer`),children:[(0,Q.jsx)(p,{className:`size-4`}),i.open]})]})}):null,de?(0,Q.jsx)(`p`,{className:`mt-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,children:de}):null,(a?.items.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.activeLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:a.items.map(e=>(0,Q.jsx)(yt,{share:e,busy:H===e.id,t:i,onCopy:he,onAction:me},e.id))})]}):null,(v.data?.length??0)>0?(0,Q.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:i.hostedLinks}),(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:v.data.map(e=>(0,Q.jsx)(vt,{publication:e,stale:e.source?.version!==String(n.updatedAt),busy:H===e.id,publishingAllowed:_,t:i,onCopy:he,onAction:pe},e.id))})]}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-edge px-5 py-3`,children:[(0,Q.jsx)(T,{asChild:!0,children:(0,Q.jsx)(M,{type:`button`,variant:`ghost`,children:i.close})}),(0,Q.jsxs)(M,{type:`button`,onClick:()=>void q(),disabled:ie||B===`hosted`&&(!f||!_),children:[ie?(0,Q.jsx)(m,{className:`size-4 animate-spin`}):(0,Q.jsx)(Ke,{className:`size-4`}),ie?i.creating:i.create]})]})]})]})})}function vt(e){let t=(0,Je.c)(64),{publication:n,stale:r,busy:i,publishingAllowed:a,t:o,onCopy:s,onAction:c}=e,l=n.revoked||n.expired,u=l&&`opacity-60`,f;t[0]===u?f=t[1]:(f=_(`rounded-lg border border-edge-subtle p-3`,u),t[0]=u,t[1]=f);let h=r&&!l?o.stale:l?o.inactive:o.active,g;t[2]===h?g=t[3]:(g=(0,Q.jsx)(`span`,{children:h}),t[2]=h,t[3]=g);let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(`span`,{children:`·`}),t[4]=v):v=t[4];let y=n.maxViews===null?``:` / ${n.maxViews}`,b;t[5]!==n.viewCount||t[6]!==o.views||t[7]!==y?(b=(0,Q.jsxs)(`span`,{children:[o.views,` `,n.viewCount,y]}),t[5]=n.viewCount,t[6]=o.views,t[7]=y,t[8]=b):b=t[8];let x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(`span`,{children:`·`}),t[9]=x):x=t[9];let S;t[10]!==n.revision||t[11]!==o.revision?(S=(0,Q.jsxs)(`span`,{children:[o.revision,` `,n.revision]}),t[10]=n.revision,t[11]=o.revision,t[12]=S):S=t[12];let C;t[13]!==g||t[14]!==b||t[15]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[g,v,b,x,S]}),t[13]=g,t[14]=b,t[15]=S,t[16]=C):C=t[16];let w;t[17]===n.shareUrl?w=t[18]:(w=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[17]=n.shareUrl,t[18]=w);let T;t[19]!==C||t[20]!==w?(T=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[C,w]}),t[19]=C,t[20]=w,t[21]=T):T=t[21];let E;t[22]===i?E=t[23]:(E=i?(0,Q.jsx)(m,{className:`size-4 animate-spin text-fg-muted`}):null,t[22]=i,t[23]=E);let D;t[24]!==T||t[25]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,E]}),t[24]=T,t[25]=E,t[26]=D):D=t[26];let O=!a,k;t[27]!==s||t[28]!==n.shareUrl?(k=()=>void s(n.shareUrl),t[27]=s,t[28]=n.shareUrl,t[29]=k):k=t[29];let A;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(d,{className:`size-3.5`}),t[30]=A):A=t[30];let j;t[31]!==o.copy||t[32]!==O||t[33]!==k?(j=(0,Q.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:O,onClick:k,children:[A,o.copy]}),t[31]=o.copy,t[32]=O,t[33]=k,t[34]=j):j=t[34];let N=!a,P;t[35]===n.shareUrl?P=t[36]:(P=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=P);let F;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(p,{className:`size-3.5`}),t[37]=F):F=t[37];let I;t[38]!==o.open||t[39]!==N||t[40]!==P?(I=(0,Q.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:N,onClick:P,children:[F,o.open]}),t[38]=o.open,t[39]=N,t[40]=P,t[41]=I):I=t[41];let L;t[42]!==i||t[43]!==l||t[44]!==c||t[45]!==n||t[46]!==a||t[47]!==r||t[48]!==o.refresh?(L=r&&!l?(0,Q.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i||!a,onClick:()=>void c(n,`refresh`),children:[(0,Q.jsx)(J,{className:`size-3.5`}),o.refresh]}):null,t[42]=i,t[43]=l,t[44]=c,t[45]=n,t[46]=a,t[47]=r,t[48]=o.refresh,t[49]=L):L=t[49];let R;t[50]!==i||t[51]!==c||t[52]!==n||t[53]!==o.revoke?(R=n.revoked?null:(0,Q.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:i,onClick:()=>void c(n,`revoke`),children:[(0,Q.jsx)(ee,{className:`size-3.5`}),o.revoke]}),t[50]=i,t[51]=c,t[52]=n,t[53]=o.revoke,t[54]=R):R=t[54];let z;t[55]!==j||t[56]!==I||t[57]!==L||t[58]!==R?(z=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[j,I,L,R]}),t[55]=j,t[56]=I,t[57]=L,t[58]=R,t[59]=z):z=t[59];let te;return t[60]!==D||t[61]!==f||t[62]!==z?(te=(0,Q.jsxs)(`div`,{className:f,children:[D,z]}),t[60]=D,t[61]=f,t[62]=z,t[63]=te):te=t[63],te}function yt(e){let t=(0,Je.c)(68),{share:n,busy:r,t:i,onCopy:a,onAction:o}=e,s=n.revoked||n.expired,c=s&&`opacity-60`,l;t[0]===c?l=t[1]:(l=_(`rounded-lg border border-edge-subtle p-3`,c),t[0]=c,t[1]=l);let u=n.stale&&!s?i.stale:s?i.inactive:i.active,f;t[2]===u?f=t[3]:(f=(0,Q.jsx)(`span`,{children:u}),t[2]=u,t[3]=f);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(`span`,{children:`·`}),t[4]=h):h=t[4];let g=n.maxViews===null?``:` / ${n.maxViews}`,v;t[5]!==n.viewCount||t[6]!==i.views||t[7]!==g?(v=(0,Q.jsxs)(`span`,{children:[i.views,` `,n.viewCount,g]}),t[5]=n.viewCount,t[6]=i.views,t[7]=g,t[8]=v):v=t[8];let y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(`span`,{children:`·`}),t[9]=y):y=t[9];let b;t[10]===n.expiresAt?b=t[11]:(b=new Date(n.expiresAt).toLocaleDateString(),t[10]=n.expiresAt,t[11]=b);let x;t[12]===b?x=t[13]:(x=(0,Q.jsx)(`span`,{children:b}),t[12]=b,t[13]=x);let S;t[14]!==x||t[15]!==f||t[16]!==v?(S=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[f,h,v,y,x]}),t[14]=x,t[15]=f,t[16]=v,t[17]=S):S=t[17];let C;t[18]===n.shareUrl?C=t[19]:(C=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.shareUrl}),t[18]=n.shareUrl,t[19]=C);let w;t[20]!==S||t[21]!==C?(w=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[S,C]}),t[20]=S,t[21]=C,t[22]=w):w=t[22];let T;t[23]===r?T=t[24]:(T=r?(0,Q.jsx)(m,{className:`size-4 animate-spin text-fg-muted`}):null,t[23]=r,t[24]=T);let E;t[25]!==w||t[26]!==T?(E=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[w,T]}),t[25]=w,t[26]=T,t[27]=E):E=t[27];let D;t[28]!==a||t[29]!==n.shareUrl?(D=()=>void a(n.shareUrl),t[28]=a,t[29]=n.shareUrl,t[30]=D):D=t[30];let O;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(d,{className:`size-3.5`}),t[31]=O):O=t[31];let k;t[32]!==i.copy||t[33]!==D?(k=(0,Q.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:D,children:[O,i.copy]}),t[32]=i.copy,t[33]=D,t[34]=k):k=t[34];let A;t[35]===n.shareUrl?A=t[36]:(A=()=>window.open(n.shareUrl,`_blank`,`noopener,noreferrer`),t[35]=n.shareUrl,t[36]=A);let j;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(p,{className:`size-3.5`}),t[37]=j):j=t[37];let N;t[38]!==i.open||t[39]!==A?(N=(0,Q.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:A,children:[j,i.open]}),t[38]=i.open,t[39]=A,t[40]=N):N=t[40];let P;t[41]!==r||t[42]!==s||t[43]!==o||t[44]!==n||t[45]!==i.refresh?(P=n.stale&&!s?(0,Q.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`refresh`),children:[(0,Q.jsx)(J,{className:`size-3.5`}),i.refresh]}):null,t[41]=r,t[42]=s,t[43]=o,t[44]=n,t[45]=i.refresh,t[46]=P):P=t[46];let F;t[47]!==r||t[48]!==s||t[49]!==o||t[50]!==n||t[51]!==i.extend?(F=s?null:(0,Q.jsx)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`extend`),children:i.extend}),t[47]=r,t[48]=s,t[49]=o,t[50]=n,t[51]=i.extend,t[52]=F):F=t[52];let I;t[53]!==r||t[54]!==o||t[55]!==n||t[56]!==i.revoke?(I=n.revoked?null:(0,Q.jsxs)(M,{className:`px-2 py-1 text-xs`,variant:`ghost`,disabled:r,onClick:()=>void o(n,`revoke`),children:[(0,Q.jsx)(ee,{className:`size-3.5`}),i.revoke]}),t[53]=r,t[54]=o,t[55]=n,t[56]=i.revoke,t[57]=I):I=t[57];let L;t[58]!==k||t[59]!==N||t[60]!==P||t[61]!==F||t[62]!==I?(L=(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[k,N,P,F,I]}),t[58]=k,t[59]=N,t[60]=P,t[61]=F,t[62]=I,t[63]=L):L=t[63];let R;return t[64]!==E||t[65]!==l||t[66]!==L?(R=(0,Q.jsxs)(`div`,{className:l,children:[E,L]}),t[64]=E,t[65]=l,t[66]=L,t[67]=R):R=t[67],R}function bt(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}var xt={title:`分享笔记`,description:`创建一个无需登录即可查看的只读快照。`,close:`关闭`,untitled:`无标题笔记`,empty:`空笔记`,privateExcluded:`不会分享标签、AI 元数据、项目、讨论、历史版本或未引用附件。`,attachments:`包含的附件`,expires:`有效期`,maxViews:`最多查看次数`,unlimited:`不限`,publicDescription:`公开说明(可选)`,create:`创建分享链接`,creating:`创建中…`,copy:`复制`,copied:`已复制`,open:`打开`,activeLinks:`这条笔记的分享`,copyFailed:`无法复制到剪贴板,请手动选择链接并复制。`,delivery:`发布方式`,deliveryHosted:`平台托管(外网稳定访问)`,deliveryLocal:`本机直连(需要隧道或公网部署)`,hostedLinks:`平台托管发布`,revision:`版本`,hostedDisabled:`管理员已暂停你的公网分享能力。已有托管链接当前不可访问,但仍可撤销。`,stale:`旧版本`,inactive:`已失效`,active:`有效`,views:`查看`,refresh:`更新快照`,extend:`延长 24 小时`,revoke:`撤销`},St={title:`Share Note`,description:`Create a read-only snapshot that opens without sign-in.`,close:`Close`,untitled:`Untitled Note`,empty:`Empty Note`,privateExcluded:`Tags, AI metadata, projects, discussions, history, and unreferenced attachments are excluded.`,attachments:`Included attachments`,expires:`Expires`,maxViews:`Maximum views`,unlimited:`Unlimited`,publicDescription:`Public description (optional)`,create:`Create share link`,creating:`Creating…`,copy:`Copy`,copied:`Copied`,open:`Open`,activeLinks:`Shares for this Note`,copyFailed:`Could not copy to the clipboard. Select the link and copy it manually.`,delivery:`Publishing method`,deliveryHosted:`Hosted platform (stable public access)`,deliveryLocal:`Direct from this device (requires public access)`,hostedLinks:`Hosted publications`,revision:`Revision`,hostedDisabled:`An administrator has paused public sharing for your account. Existing hosted links are unavailable, but can still be revoked.`,stale:`Older version`,inactive:`Inactive`,active:`Active`,views:`Views`,refresh:`Update snapshot`,extend:`Extend 24 hours`,revoke:`Revoke`};function Ct(e){let t=(0,Je.c)(18),{input:n,labels:r,showLabel:i}=e,a=i===void 0?!0:i,o;t[0]===n?o=t[1]:(o=n(),t[0]=n,t[1]=o);let s=o.source.id,c;t[2]===s?c=t[3]:(c=e=>e.source?.type===`note`&&e.source.id===s&&e.status!==`idle`,t[2]=s,t[3]=c);let l=Ce(c),u;t[4]===s?u=t[5]:(u=e=>e.source?.type===`note`&&e.source.id===s&&e.status===`preparing`,t[4]=s,t[5]=u);let d=Ce(u),f=Ce(wt),p;t[6]!==n||t[7]!==r||t[8]!==d||t[9]!==a?(p=(0,Q.jsx)(Ve,{input:n,labels:r,disabled:d,showLabel:a}),t[6]=n,t[7]=r,t[8]=d,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==l||t[12]!==r||t[13]!==f?(m=l?(0,Q.jsx)(`button`,{type:`button`,onClick:f,title:r.stop,"aria-label":r.stop,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,Q.jsx)(Me,{className:`size-3.5`,"aria-hidden":!0})}):null,t[11]=l,t[12]=r,t[13]=f,t[14]=m):m=t[14];let h;return t[15]!==p||t[16]!==m?(h=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[p,m]}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function wt(e){return e.stop}function Tt(e,t){let n=Ne(t.replace(/^\s*(`{3,}|~{3,})[^\n]*$/gm,``).replace(/xopc-attachment:\/\/[^\s)]+/g,``).replace(/^(\s*[-*+]\s+)\[[ xX]\]\s*/gm,`$1`)),r=Ne(e);return!r||n.split(`
3
+ `)[0]===r?n:[r,n].filter(Boolean).join(`
4
+
5
+ `)}var Et=()=>i(()=>import(`./block-editor-CDcMvaku.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53])),Dt=()=>i(()=>import(`./markdown-editor-BhBJANcx.js`),__vite__mapDeps([54,1,51,5,55,56,3])),Ot=(0,Z.lazy)(()=>Et().then(e=>({default:e.BlockEditor}))),kt=(0,Z.lazy)(()=>Dt().then(e=>({default:e.MarkdownEditor})));function At(){let e=(0,Je.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-6 py-4`,"aria-busy":!0,children:[(0,Q.jsx)(`div`,{className:`h-8 w-56 max-w-full animate-pulse rounded-md bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-6 h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Q.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function jt(e){let t=(0,Je.c)(29),{mode:n,onModeChange:r,labels:i}=e,a;t[0]===i.edit?a=t[1]:(a={id:`wysiwyg`,label:i.edit,Icon:Le},t[0]=i.edit,t[1]=a);let o;t[2]===i.source?o=t[3]:(o={id:`source`,label:i.source,Icon:we},t[2]=i.source,t[3]=o);let c;t[4]===i.preview?c=t[5]:(c={id:`preview`,label:i.preview,Icon:W},t[4]=i.preview,t[5]=c);let l;t[6]!==a||t[7]!==o||t[8]!==c?(l=[a,o,c],t[6]=a,t[7]=o,t[8]=c,t[9]=l):l=t[9];let u=l,d;t[10]!==n||t[11]!==u?(d=u.find(e=>e.id===n)??u[0],t[10]=n,t[11]=u,t[12]=d):d=t[12];let f=d,p=f.Icon,m=Mt,h;t[13]===p?h=t[14]:(h=(0,Q.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),t[13]=p,t[14]=h);let g;t[15]===f.label?g=t[16]:(g=(0,Q.jsx)(`span`,{children:f.label}),t[15]=f.label,t[16]=g);let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(Ge,{className:`size-3 text-fg-subtle`,"aria-hidden":!0}),t[17]=_):_=t[17];let v;t[18]!==f.label||t[19]!==h||t[20]!==g?(v=(0,Q.jsx)(ke,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"aria-label":f.label,className:`inline-flex h-8 items-center gap-1.5 rounded-lg border border-edge px-2.5 text-xs font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[h,g,_]})}),t[18]=f.label,t[19]=h,t[20]=g,t[21]=v):v=t[21];let y;t[22]!==n||t[23]!==u||t[24]!==r?(y=(0,Q.jsx)(de,{children:(0,Q.jsx)(V,{align:`end`,sideOffset:6,className:`z-50 min-w-36 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:u.map(e=>{let{id:t,label:i,Icon:a}=e;return(0,Q.jsxs)(B,{onSelect:()=>r(t),onPointerMove:()=>m(t),onFocus:()=>m(t),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(a,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:i}),n===t?(0,Q.jsx)(s,{className:`size-4 text-accent`,"aria-hidden":!0}):null]},t)})})}),t[22]=n,t[23]=u,t[24]=r,t[25]=y):y=t[25];let b;return t[26]!==y||t[27]!==v?(b=(0,Q.jsxs)(Ae,{modal:!1,children:[v,y]}),t[26]=y,t[27]=v,t[28]=b):b=t[28],b}function Mt(e){e===`wysiwyg`&&Et(),e===`source`&&Dt()}function Nt(e){let t=(0,Je.c)(16),{noteId:n,onBack:r,onSaved:i,showBackButton:a,backButtonClassName:o,clearHeaderOnCleanup:s,onOpenSearch:c,autoFocus:l,initialMode:u,onAutoFocusConsumed:d}=e,f=a===void 0?!0:a,p=s===void 0?!0:s,m=l===void 0?!1:l,h=b(Pt),g;t[0]===h?g=t[1]:(g=S(h),t[0]=h,t[1]=g);let _=g.notes.lightboxClose,v;t[2]!==m||t[3]!==o||t[4]!==p||t[5]!==u||t[6]!==n||t[7]!==d||t[8]!==r||t[9]!==c||t[10]!==i||t[11]!==f?(v=(0,Q.jsx)(Ft,{noteId:n,onBack:r,onSaved:i,showBackButton:f,backButtonClassName:o,clearHeaderOnCleanup:p,onOpenSearch:c,autoFocus:m,initialMode:u,onAutoFocusConsumed:d}),t[2]=m,t[3]=o,t[4]=p,t[5]=u,t[6]=n,t[7]=d,t[8]=r,t[9]=c,t[10]=i,t[11]=f,t[12]=v):v=t[12];let y;return t[13]!==_||t[14]!==v?(y=(0,Q.jsx)(Qe,{closeLabel:_,children:v}),t[13]=_,t[14]=v,t[15]=y):y=t[15],y}function Pt(e){return e.language}function Ft({noteId:e,onBack:t,onSaved:n,showBackButton:r=!0,backButtonClassName:i,clearHeaderOnCleanup:o=!0,onOpenSearch:c,autoFocus:l=!1,initialMode:u=`wysiwyg`,onAutoFocusConsumed:d}){let f=b(e=>e.language),p=S(f).notes,m=S(f).automations.suggestions,{data:g}=j([`note-discussion-document`,e],()=>Pe(e)),[v,y]=(0,Z.useState)(!0),x=a(),C=N(e=>e.resolved)===`dark`,{openImage:w}=Xe(),[T,E]=(0,Z.useState)(u),[D,O]=(0,Z.useState)(null),[k,A]=(0,Z.useState)(null),[M,P]=(0,Z.useState)(!1),[I,L]=(0,Z.useState)(``),[z,te]=(0,Z.useState)(360),[ne,re]=(0,Z.useState)(!1),[oe,ue]=(0,Z.useState)(!1),[W,G]=(0,Z.useState)(!1),[fe,K]=(0,Z.useState)(null),[q,pe]=(0,Z.useState)(!1),[me,ge]=(0,Z.useState)(null),[ve,ye]=(0,Z.useState)(!1),[xe,Se]=(0,Z.useState)(!1),we=(0,Z.useRef)(!1),Te=(0,Z.useRef)(!1),Ee=(0,Z.useRef)(null),Oe=(0,Z.useRef)(null),J=(0,Z.useRef)(null),je=(0,Z.useRef)(null),Me=(0,Z.useRef)(null),Ne=(0,Z.useRef)(null),Fe=(0,Z.useRef)(null),Le=(0,Z.useRef)(null),Re=(0,Z.useRef)(null),Be=De(e=>e.setPageHeader),Ve=De(e=>e.clearPageHeader),{data:Y,mutate:X,error:Ge}=j(e?[`note-detail`,e]:null,()=>se(e)),{data:Je=[],mutate:Ye}=j(e?[`note-threads`,e]:null,()=>he(e),{revalidateOnFocus:!1}),Ze=k!==null,Qe=(0,Z.useCallback)(e=>{K(`${p.refreshFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)},[p.quickCaptureFailedHint,p.refreshFailed]);(0,Z.useEffect)(()=>{if(!e)return;let t=t=>{t.detail?.noteId===e&&X().catch(Qe)};return window.addEventListener(`note-updated`,t),()=>window.removeEventListener(`note-updated`,t)},[X,e,Qe]),(0,Z.useEffect)(()=>{we.current=!1,L(``),A(null),O(null),Te.current=!1,Re.current=null},[e]),(0,Z.useEffect)(()=>{!Y||we.current||(L(Y.title??``),we.current=!0)},[Y]),(0,Z.useEffect)(()=>{if(!l||!Y||Ze||Re.current===e)return;let t=window.requestAnimationFrame(()=>{Le.current?.focus(),d?.()});return Re.current=e,()=>window.cancelAnimationFrame(t)},[l,Ze,Y,e,d]);let $e=Y?new Date(Y.createdAt).toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``,et=(0,Z.useMemo)(()=>r?(0,Q.jsx)(`button`,{type:`button`,onClick:t,"aria-label":p.back,className:_(`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,le,i),children:(0,Q.jsx)(ie,{className:`size-4`,"aria-hidden":!0})}):null,[i,p.back,t,r]),$=(0,Z.useCallback)(()=>{let t=Ce.getState();t.source?.type===`note`&&t.source.id===e&&t.stop()},[e]),tt=(0,Z.useCallback)(e=>{e!==`preview`&&$(),E(e)},[$]),nt=(0,Z.useCallback)(t=>{$(),L(t),e&&(je.current=t,Oe.current&&clearTimeout(Oe.current),Oe.current=setTimeout(async()=>{let t=je.current;if(je.current=null,t!==null){P(!0);try{await He(e,{title:t}),await X(),n?.()}catch{}finally{P(!1)}}},600))},[$,e,X,n]),rt=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:_(`flex min-w-0 items-center gap-2`,le),children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-fg`,title:I||$e||void 0,children:I||$e}),M?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-fg-muted opacity-60`,children:p.saving}):null]}),[p.saving,M,$e,I]),it=(0,Z.useCallback)(async(t=!1)=>{G(!0),K(null);try{let n=await H(e,{forceNew:t});await X(),await Ye(),x(`/chat/${encodeURIComponent(n.conversationId)}`)}catch(e){K(`${p.chatOpenFailedTitle}: ${e instanceof Error?e.message:p.chatOpenFailedMessage}`)}finally{G(!1)}},[X,Ye,x,e,p.chatOpenFailedMessage,p.chatOpenFailedTitle]),ot=(0,Z.useCallback)(async()=>{ue(!0),K(null);try{await ce(e),await X()}catch(e){K(`${p.catalysisFailed}: ${e instanceof Error?e.message:p.chatOpenFailedMessage}`)}finally{ue(!1)}},[X,e]),st=(0,Z.useCallback)(()=>{O(D===`breakdown`?null:`breakdown`),!Y?.aiDeep?.catalysis?.report&&!oe&&ot()},[D,oe,ot,Y?.aiDeep?.catalysis?.report]),ct=(0,Z.useCallback)(()=>{let t=k?k.markdown??``:J.current??Y?.markdown??``,n=k?k.title??``:I,r=Tt(n,t);return{source:{type:`note`,id:e,title:n||p.titlePlaceholder},text:r,language:Ue(r,f)}},[f,p.titlePlaceholder,Y?.markdown,e,k,I]),lt=(0,Z.useCallback)(async()=>{Ee.current&&clearTimeout(Ee.current),Oe.current&&clearTimeout(Oe.current),Ee.current=null,Oe.current=null;let t=J.current,r=je.current;J.current=null,je.current=null;let i={};if(t!==null&&(i.markdown=t),r!==null&&(i.title=r),Object.keys(i).length===0)return Y??null;P(!0);try{let t=await He(e,i);return await X(t,{revalidate:!1}),n?.(),t}catch(e){return K(`${p.saveFailed}: ${e instanceof Error?e.message:p.saveFailedHint}`),null}finally{P(!1)}},[X,p.saveFailed,p.saveFailedHint,Y,e,n]),ut=(0,Z.useCallback)(async()=>{K(null);let e=await lt();e&&(ge(e),pe(!0))},[lt]),ft=(0,Z.useCallback)(async()=>{if(!(xe||M)){ye(!1),Se(!0),K(null),$(),Ee.current&&clearTimeout(Ee.current),Oe.current&&clearTimeout(Oe.current),Ee.current=null,Oe.current=null,J.current=null,je.current=null;try{await ae(e),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e}})),n?.(),t()}catch(e){K(`${p.deleteFailed}: ${e instanceof Error?e.message:p.quickCaptureFailedHint}`)}finally{Se(!1)}}},[xe,p.deleteFailed,p.quickCaptureFailedHint,e,t,n,M,$]),pt=(0,Z.useMemo)(()=>(0,Q.jsxs)(`div`,{className:_(`flex min-w-0 items-center gap-1 sm:gap-2`,le),children:[c?(0,Q.jsx)(`button`,{type:`button`,onClick:c,"aria-label":p.searchDialogTitle,className:`rounded-lg p-1.5 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,Q.jsx)(We,{className:`size-4`,"aria-hidden":!0})}):null,(0,Q.jsx)(Ct,{input:ct,showLabel:!1,labels:{read:p.readAloud,preparing:p.readAloudPreparing,pause:p.readAloudPause,resume:p.readAloudResume,retry:p.readAloudRetry,stop:p.readAloudStop}}),(0,Q.jsxs)(`button`,{type:`button`,onClick:st,disabled:oe,"aria-label":p.catalysisSectionTitle,className:_(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50`,D===`breakdown`?`bg-accent/10 text-accent`:`bg-accent/10 text-fg hover:bg-accent/15`),children:[(0,Q.jsx)(Ie,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:oe?p.catalyzing:p.catalyzeButton})]}),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>it(!1),"aria-label":p.openChatButton,disabled:W,className:_(`inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,`border border-edge text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-50`),children:[(0,Q.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`hidden sm:inline`,children:W?p.openingChat:p.openChatButton})]}),(0,Q.jsx)(jt,{mode:T,onModeChange:tt,labels:{edit:p.modeEdit,source:p.modeSource,preview:p.modePreview}}),(0,Q.jsxs)(Ae,{modal:!1,children:[(0,Q.jsx)(ke,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":p.noteActions,title:p.noteActions,className:`inline-flex size-8 items-center justify-center rounded-lg text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:(0,Q.jsx)(F,{className:`size-4`,"aria-hidden":!0})})}),(0,Q.jsx)(de,{children:(0,Q.jsxs)(V,{align:`end`,sideOffset:6,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Q.jsxs)(B,{onSelect:()=>void ut(),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(Ke,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),f===`zh`?`分享`:`Share`]}),(0,Q.jsxs)(B,{onSelect:()=>O(D===`history`?null:`history`),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,children:[(0,Q.jsx)(U,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`flex-1`,children:p.history}),D===`history`?(0,Q.jsx)(s,{className:`size-4 text-accent`,"aria-hidden":!0}):null]}),(0,Q.jsx)(R,{className:`my-1 h-px bg-edge-subtle`}),(0,Q.jsxs)(B,{disabled:xe||M,onSelect:()=>ye(!0),className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,children:[(0,Q.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),p.delete]})]})})]})]}),[oe,st,it,T,p.history,p.modeEdit,p.modePreview,p.modeSource,W,D,c,p.searchDialogTitle,p.readAloud,p.readAloudPause,p.readAloudPreparing,p.readAloudResume,p.readAloudRetry,p.readAloudStop,tt,ct,ut,xe,M,f,p.delete,ye]);(0,Z.useLayoutEffect)(()=>(Be({startExtra:et,main:Y?rt:null,end:Y?pt:null}),()=>{o&&Ve()}),[o,Ve,pt,rt,et,Y,Be]);let gt=(0,Z.useCallback)(t=>{e&&($(),J.current=t,Ee.current&&clearTimeout(Ee.current),Ee.current=setTimeout(async()=>{let t=J.current;if(J.current=null,t!==null){P(!0),K(null);try{await He(e,{markdown:t}),await X(),n?.()}catch(e){K(`${p.saveFailed}: ${e instanceof Error?e.message:p.saveFailedHint}`)}finally{P(!1)}}},600))},[$,e,X,p.saveFailed,p.saveFailedHint,n]),vt=(0,Z.useCallback)(t=>{qe(e,t.timestamp).then(e=>{e&&($(),A(e))})},[e,$]),yt=(0,Z.useCallback)(()=>{$(),O(null),A(null)},[$]),bt=(0,Z.useCallback)(()=>{$(),O(null),A(null),X().catch(Qe),n?.()},[X,n,Qe,$]);if((0,Z.useEffect)(()=>()=>{Ee.current&&clearTimeout(Ee.current),Oe.current&&clearTimeout(Oe.current);let t=J.current,n=je.current;J.current=null,je.current=null;let r={};t!==null&&(r.markdown=t),n!==null&&(r.title=n),Object.keys(r).length>0&&He(e,r).catch(()=>void 0)},[e]),Y===void 0)return Ge?(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 p-6 text-center`,role:`alert`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-danger`,children:p.home.loadFailed}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void X().catch(Qe),className:`rounded-lg border border-edge px-3 py-2 text-sm text-fg hover:bg-surface-hover`,children:p.home.retry}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`text-sm text-fg-muted hover:text-fg`,children:p.back})]}):(0,Q.jsx)(At,{});if(Y===null)return(0,Q.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-center`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:p.notFoundTitle}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:p.notFoundDescription}),(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg border border-edge px-3 py-1.5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,children:p.back})]});let xt=Ze?k.title??``:I,St=Ze?k.markdown??``:J.current??Y.markdown??``,wt=new Date(Y.createdAt).getTime(),Et=Number.isFinite(wt)&&Date.now()-wt<3600*1e3?(0,Q.jsx)(at,{title:m.noteCreatedTitle,description:m.noteCreatedDescription,prompt:m.noteCreatedPrompt,coverage:{eventType:`note.created`,source:`notes`,eventPayload:{noteId:e}},variant:`titleAction`,className:`ml-3 hidden max-w-[18rem] shrink-0 md:flex`}):null;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 gap-3 p-4 sm:px-5`,children:[(0,Q.jsxs)(`div`,{className:`mx-auto flex min-h-0 min-w-0 w-full max-w-[60rem] flex-1 flex-col`,children:[fe?(0,Q.jsx)(`p`,{className:`mb-3 shrink-0 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:fe}):null,(0,Q.jsx)(be,{eventType:`note.created`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),(0,Q.jsx)(be,{eventType:`note.updated`,source:`notes`,payloadKey:`noteId`,payloadValue:e,className:`mb-3 shrink-0`}),g?(0,Q.jsxs)(`div`,{className:`mb-2 flex shrink-0 gap-4 text-sm`,children:[(0,Q.jsx)(`button`,{className:v?`text-accent-fg`:`text-fg-muted`,onClick:()=>y(!0),children:f===`zh`?`会议`:`Meeting`}),(0,Q.jsx)(`button`,{className:v?`text-fg-muted`:`text-accent-fg`,onClick:()=>y(!1),children:f===`zh`?`我的笔记`:`My notes`})]}):null,(0,Q.jsxs)(`div`,{ref:Me,className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel xl:flex-row`,children:[g&&v?(0,Q.jsx)(dt,{noteId:e}):null,(0,Q.jsx)(`div`,{className:g&&v?`hidden`:`min-h-0 min-w-0 flex-1`,children:Ze?(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,children:[xt&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg/70`,children:xt}),St?(0,Q.jsx)(ze,{noteId:e,content:St,className:`opacity-80`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:p.emptyPreview})]}):(0,Q.jsxs)(Q.Fragment,{children:[T===`wysiwyg`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:Le,type:`text`,value:I,onChange:e=>nt(e.target.value),onCompositionStart:()=>{Te.current=!0},onCompositionEnd:()=>{Te.current=!1},onKeyDown:e=>{let t=e.nativeEvent;e.key===`Enter`&&!Te.current&&!t.isComposing&&(e.preventDefault(),(Me.current?.querySelector(`.ProseMirror`))?.focus())},placeholder:p.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Et]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(At,{}),children:(0,Q.jsx)(Ot,{initialContent:Y.markdown??``,onChange:gt,noteId:e},`wysiwyg-${e}`)})})]}),T===`source`&&(0,Q.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start px-6 pt-4`,children:[(0,Q.jsx)(`input`,{ref:Le,type:`text`,value:I,onChange:e=>nt(e.target.value),placeholder:p.titlePlaceholder,className:`min-w-0 flex-1 border-none bg-transparent text-2xl font-bold text-fg placeholder:text-fg-muted/40 focus:outline-none`}),Et]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(At,{}),children:(0,Q.jsx)(kt,{initialContent:Y.markdown??``,onChange:gt,isDark:C},`source-${e}`)})})]}),T===`preview`&&(0,Q.jsxs)(`div`,{className:`h-full overflow-y-auto px-4 py-4 sm:px-6`,onClick:e=>{let t=e.target;t instanceof HTMLImageElement&&w(t.currentSrc||t.src,t.alt)},children:[I&&!Y.markdown.trimStart().startsWith(`# ${I.trim()}\n`)&&Y.markdown.trim()!==`# ${I.trim()}`&&(0,Q.jsx)(`h1`,{className:`mb-4 text-2xl font-bold text-fg`,children:I}),Y.markdown?(0,Q.jsx)(ze,{noteId:e,content:Y.markdown,className:`[&_img]:cursor-zoom-in`}):(0,Q.jsx)(`p`,{className:`italic text-fg-muted`,children:p.emptyPreview})]})]})})]})]}),(0,Q.jsx)(`div`,{ref:Ne,className:_(`relative flex min-h-0 shrink-0 flex-col overflow-hidden`,!ne&&`transition-[width] duration-300 ease-in-out`),style:{width:D?z:0},children:(0,Q.jsxs)(`div`,{ref:Fe,className:`flex min-h-0 flex-1 flex-col`,style:{width:z},children:[(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,onPointerDown:e=>{e.preventDefault();let t=e.currentTarget;t.setPointerCapture(e.pointerId),re(!0);let n=e.clientX,r=z,i=e.pointerId,a=0,o=z,s=z,c=()=>{a=0,s=o,D&&Ne.current?.style.setProperty(`width`,`${s}px`),Fe.current?.style.setProperty(`width`,`${s}px`)},l=e=>{let t=r-(e.clientX-n);o=Math.max(280,Math.min(600,Math.round(t))),a===0&&(a=window.requestAnimationFrame(c))},u=()=>{a!==0&&(window.cancelAnimationFrame(a),c());try{t.releasePointerCapture(i)}catch{}re(!1),te(s),window.removeEventListener(`pointermove`,l),window.removeEventListener(`pointerup`,u),window.removeEventListener(`pointercancel`,u)};window.addEventListener(`pointermove`,l),window.addEventListener(`pointerup`,u),window.addEventListener(`pointercancel`,u)},className:_(`absolute left-0 top-0 z-10 h-full w-2 -translate-x-1/2 cursor-col-resize`,`before:content-[''] before:pointer-events-none before:absolute before:left-1/2 before:top-0 before:h-full before:w-px before:-translate-x-1/2`,`before:bg-transparent before:transition-[background-color] before:duration-150`,`hover:before:bg-edge/65 dark:hover:before:bg-edge/75`,ne&&`before:!bg-edge/80 dark:before:!bg-edge/85`,`touch-none select-none`)}),(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,children:D===`history`?(0,Q.jsx)(mt,{noteId:e,activeTimestamp:k?.timestamp??null,onSelect:vt,onClose:yt,onRestored:bt}):D===`breakdown`?(0,Q.jsx)(ht,{noteId:e,note:Y??null,catalyzing:oe,onCatalyze:ot,onClose:()=>O(null),noteThreads:Je,openingChat:W,onOpenChat:()=>it(!1),onOpenNewChat:()=>it(!0)}):null})]})})]}),me?(0,Q.jsx)(_t,{open:q,onOpenChange:pe,note:me}):null,(0,Q.jsx)(_e,{open:ve,title:p.deleteConfirmTitle,description:p.deleteConfirmDescription.replace(`{{title}}`,Y.title||p.titlePlaceholder),confirmLabel:p.deleteConfirmLabel,cancelLabel:p.deleteCancelLabel,destructive:!0,onConfirm:()=>void ft(),onCancel:()=>ye(!1)})]})}export{Xe as a,nt as i,it as n,rt as r,Nt as t};
@@ -0,0 +1,8 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,h as a,p as o,u as s}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as c}from"./popover-select-DldSX8GX.js";import{d as l}from"./markdown-view-BIg7cei7.js";import{t as u}from"./loader-circle-CifKLtgG.js";import{t as d}from"./plus-Q2yW6OE7.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./cn-JdwAhgNB.js";import{c as m,f as h,n as g}from"./locale-store-eliqUnBr.js";import{t as _}from"./messages-NYDOR8-j.js";import{i as v}from"./vendor-swr-BIWyz7Rc.js";import{t as y}from"./skeleton-BwbyijEw.js";import{$l as b,$s as ee,$t as x,Bl as te,Dn as S,En as ne,Gn as re,Hn as C,Hu as w,In as ie,Ka as ae,Kn as T,Mo as E,Mu as D,Ol as oe,On as se,Pn as ce,Qt as O,Ru as le,Tc as k,Tu as A,Vu as ue,Wc as j,Wu as de,Xt as M,Yc as fe,Ys as pe,Yt as N,Zi as me,Zt as P,ar as he,cc as ge,en as _e,ho as ve,jn as ye,kn as be,nr as xe,pc as Se,ql as Ce,tl as F,tn as I,tr as we,wa as Te,wc as Ee,zu as De}from"./index-B7EieIE4.js";import{i as Oe,t as ke}from"./note-detail-panel-DhYJigb3.js";var L=n(),R=e(t(),1),z=r();function B({projectId:e}){let t=g(e=>e.language)===`zh`,n=i(),r=(0,R.useRef)(null),a=(0,R.useRef)(null),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(null),[u,d]=(0,R.useState)(null);async function f(){let t=a.current;if(!(!t||o!==null)){s(0),l(null);try{let r=await I();if(r.consentAcknowledgedAt==null){d(r.consentPolicyVersion);return}let i=await N(t.file,t.requestId),o=await _e({clientRequestId:t.requestId,contextProjectId:e,source:`web`,consentPolicyVersion:r.consentPolicyVersion});t.discussionId=o.discussion.id,await O({...i,serverDiscussionId:o.discussion.id,projectId:e}),o.discussion.audioAttachmentId||await M(i,o.discussion.id,s),await P(t.requestId),a.current=null,n(`/notes/${encodeURIComponent(o.note.id)}`)}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(null)}}}return(0,z.jsxs)(`div`,{className:`inline-flex flex-wrap items-center gap-2 text-xs`,children:[(0,z.jsx)(`input`,{ref:r,hidden:!0,type:`file`,accept:`audio/*,.m4a,.wav,.mp3,.webm,.ogg`,onChange:e=>{let n=e.target.files?.[0];if(e.target.value=``,n){if(!n.size||n.size>1073741824){l(t?`音频须为 1 字节至 1 GiB`:`Audio must be between 1 byte and 1 GiB`);return}a.current={file:n,requestId:crypto.randomUUID()},f()}}}),(0,z.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md p-2 hover:bg-surface-hover`,disabled:o!==null,onClick:()=>c&&a.current?void f():r.current?.click(),children:[(0,z.jsx)(pe,{className:`size-3.5`}),o===null?c&&a.current?t?`重试导入`:`Retry import`:t?`导入录音`:`Import recording`:`${o}%`]}),u===null?null:(0,z.jsxs)(`span`,{children:[t?`请确认你有权上传此录音,并允许配置的语音服务处理。`:`Confirm permission to upload this recording and process it with your configured speech service.`,(0,z.jsx)(`button`,{type:`button`,className:`p-2 text-accent`,onClick:()=>void x(u).then(()=>(d(null),f())).catch(e=>l(String(e))),children:t?`确认导入`:`Confirm import`})]}),c?(0,z.jsx)(`span`,{role:`alert`,className:`text-danger`,children:c}):null]})}async function V(e){e.note??=await ce({title:e.title,markdown:e.markdown,projectId:e.projectId,channel:`web`},e.requestId);let t=e.note.id;for(let n=e.attachments.length;n<e.files.length;n++)e.attachments.push(await xe(t,e.files[n],`${e.requestId}:file:${n}`));if(e.attachments.length){let n=e.attachments.map(e=>`[${e.fileName.replace(/[\\[\]]/g,`\\$&`).replace(/[\r\n]/g,` `)}](${he(t,e.id)})`);e.note=await we(t,{markdown:`${e.markdown}\n\n## ${e.materialHeading}\n\n${n.join(`
2
+
3
+ `)}`})}return{noteId:t,conversationId:(await T(t,{projectId:e.projectId})).conversationId}}function H(e,t,n){let r=new URLSearchParams({draft:n.replace(`{{id}}`,t),autoSend:`1`});return`/chat/${encodeURIComponent(e)}?${r}`}var U={meeting:le,requirements:Ce,research:k,weekly:A};function Ae({projects:e,projectId:t,onProjectChange:n,onCreated:r,labels:a,projectsLoading:o,projectsError:s}){let l=a.home,d=i(),[m,h]=(0,R.useState)(``),[g,_]=(0,R.useState)(null),[v,y]=(0,R.useState)([]),[b,ee]=(0,R.useState)(!1),[x,S]=(0,R.useState)(null),[ne,re]=(0,R.useState)(``),C=(0,R.useRef)(null),w=(0,R.useRef)(!1),ie=(0,R.useRef)(null),T=(0,R.useRef)(null),E=b||!!C.current,D=g?l.templateOptions[g]:null,oe=!!(m.trim()||v.length);async function se(){if(!(w.current||!oe&&!C.current)){w.current=!0,ee(!0),S(null),C.current??={requestId:crypto.randomUUID(),title:m.trim().split(`
4
+ `)[0]?.slice(0,80)||D?.label||a.titlePlaceholder,markdown:`## ${l.requestHeading}\n\n${D?`${D.prompt}\n`:``}${m.trim()}`,projectId:t||void 0,files:[...v],attachments:[],materialHeading:l.materialsHeading};try{let e=await V(C.current);r(),d(H(e.conversationId,e.noteId,l.agentPrompt))}catch(e){C.current.note&&r(),S(e instanceof Error?e.message:a.quickCaptureFailedHint)}finally{w.current=!1,ee(!1)}}}function ce(){C.current=null,S(null),h(``),y([]),_(null),T.current?.focus()}return(0,z.jsxs)(`section`,{"aria-label":l.askLabel,children:[(0,z.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),se()},className:`relative rounded-xl border border-edge bg-surface-panel p-4 focus-within:border-accent/60 sm:p-5`,children:[(0,z.jsxs)(`fieldset`,{disabled:E,className:`min-w-0`,children:[(0,z.jsxs)(`label`,{htmlFor:`notes-home-prompt`,className:`flex items-center gap-2 text-xs font-medium text-accent-fg`,children:[(0,z.jsx)(Se,{className:`size-4`,"aria-hidden":!0}),l.askLabel]}),D?(0,z.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-lg bg-accent-soft px-3 py-2 text-xs leading-5 text-accent-fg`,children:[(0,z.jsxs)(`p`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`span`,{className:`font-medium`,children:[D.label,` · `]}),D.prompt.split(`
5
+
6
+ `)[0]]}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>_(null),"aria-label":a.searchClear,className:`shrink-0 rounded p-1 hover:bg-surface-hover`,children:(0,z.jsx)(f,{className:`size-3.5`})})]}):null,(0,z.jsx)(`textarea`,{ref:T,id:`notes-home-prompt`,value:m,onChange:e=>h(e.target.value),placeholder:D?D.prompt.split(`
7
+
8
+ `).at(-1):l.askPlaceholder,rows:2,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),se())},className:`mt-2 min-h-16 w-full resize-y bg-transparent py-2 text-base leading-6 text-fg outline-none placeholder:text-fg-muted sm:text-sm`}),v.length?(0,z.jsx)(`ul`,{className:`mb-3 flex flex-wrap gap-2`,children:v.map((e,t)=>(0,z.jsxs)(`li`,{className:`flex max-w-full items-center gap-2 rounded-md border border-edge px-2 py-1 text-xs text-fg-muted`,children:[(0,z.jsx)(j,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`truncate`,children:e.name}),(0,z.jsx)(`button`,{type:`button`,"aria-label":`${l.removeMaterial}: ${e.name}`,onClick:()=>y(e=>e.filter((e,n)=>n!==t)),className:`rounded p-1 hover:bg-surface-hover`,children:(0,z.jsx)(f,{className:`size-3`})})]},`${e.name}-${t}`))}):null,(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:pr-40`,children:[(0,z.jsx)(`div`,{className:`w-44 max-w-full`,children:(0,z.jsx)(c,{value:t,options:e.filter(e=>e.name.toLowerCase().includes(ne.toLowerCase())).map(e=>({value:e.id,label:e.name})),selectedLabel:t?e.find(e=>e.id===t)?.name:l.unassigned,placeholder:l.unassigned,emptyLabel:l.unassigned,ariaLabel:l.assignProject,triggerIcon:(0,z.jsx)(te,{className:`size-4 shrink-0`,"aria-hidden":!0}),triggerClassName:`h-8 border-transparent bg-transparent px-2 text-xs text-fg-muted hover:bg-surface-hover`,onChange:n,disabled:E,loading:o,statusMessage:s?l.projectsLoadFailed:void 0,searchPlaceholder:l.projectSearch,searchValue:ne,onSearchChange:re})}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>ie.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover`,children:[(0,z.jsx)(j,{className:`size-4`,"aria-hidden":!0}),l.addMaterials]}),(0,z.jsx)(`input`,{ref:ie,type:`file`,multiple:!0,className:`hidden`,"aria-label":l.addMaterials,onChange:e=>{let t=Array.from(e.target.files??[]);y(e=>[...e,...t]),e.target.value=``}})]})]}),(0,z.jsx)(`div`,{className:`mt-2 flex justify-end sm:absolute sm:bottom-5 sm:right-5 sm:mt-0`,children:(0,z.jsxs)(`button`,{type:`submit`,disabled:b||!C.current&&!oe,className:`inline-flex h-9 items-center gap-2 rounded-lg bg-accent px-4 text-sm font-medium text-white hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:[b?(0,z.jsx)(u,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,z.jsx)(De,{className:`size-4`,"aria-hidden":!0}),b?l.creating:x?l.retry:l.agentCreate]})})]}),x?(0,z.jsxs)(`div`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-3 text-xs text-danger`,role:`alert`,children:[(0,z.jsx)(`p`,{children:x}),C.current?.note?(0,z.jsx)(`p`,{className:`mt-1`,children:l.partialFailure}):null,(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[C.current?.note?(0,z.jsx)(`button`,{type:`button`,onClick:()=>d(`/notes/${encodeURIComponent(C.current.note.id)}?edit=1`),className:`underline`,children:l.openSavedDraft}):null,(0,z.jsx)(`button`,{type:`button`,onClick:ce,className:`underline`,children:l.newRequest})]})]}):null,(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-1 gap-y-1 text-xs text-fg-muted`,children:[(0,z.jsx)(`span`,{className:`mr-1 py-2`,children:l.templates}),Object.keys(U).map(e=>{let t=U[e];return(0,z.jsxs)(`button`,{type:`button`,disabled:E,"aria-pressed":g===e,onClick:()=>{_(g===e?null:e),T.current?.focus()},className:p(`inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover disabled:opacity-50`,g===e&&`bg-accent-soft text-accent-fg`),children:[(0,z.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),l.templateOptions[e].label]},e)}),(0,z.jsx)(B,{}),(0,z.jsxs)(`button`,{type:`button`,disabled:b,onClick:()=>ae(),className:`ml-auto inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover`,children:[(0,z.jsx)(F,{className:`size-3.5`,"aria-hidden":!0}),l.recordDiscussion]})]})]})}function je(e,t){let n=Number(e.get(`page`)??0),r=Number.isSafeInteger(n)&&n>=0?n:0,i=e.get(`view`);return{projectId:e.get(`projectId`)||void 0,unassigned:e.get(`unassigned`)===`true`||i===`unassigned`||void 0,pinned:i===`favorites`?!0:void 0,agentEdited:i===`agent`||void 0,status:i===`archived`?`archived`:void 0,search:t.trim()||void 0,sortBy:`updatedAt`,sortOrder:`desc`,limit:12,offset:r*12}}function Me(e){let t=e.snippet?.trim()??``,n=e.title?.trim();return n&&t.startsWith(n)?t.slice(n.length).replace(/^[\s::·—-]+/,``):t}var W=`touch-target inline-flex min-h-9 items-center justify-center gap-2 rounded-lg px-3 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`;function G(){let e=g(e=>e.language),t=_(e).notes,n=t.home,r=m(e=>e.conversationId),o=ve(e=>e.setPageHeader),l=ve(e=>e.clearPageHeader),f=i(),{pathname:x,search:ae}=s(),[T,O]=a(),k=T.get(`projectId`)||``,A=T.get(`view`)||`all`,j=T.get(`unassigned`)===`true`||A===`unassigned`,M=T.get(`search`)||``,[pe]=Te(M,250),[N,P]=(0,R.useState)(k),[he,_e]=(0,R.useState)(``),[xe,F]=(0,R.useState)(null),[I,De]=(0,R.useState)(!1),[ke,L]=(0,R.useState)(new Set),[B,V]=(0,R.useState)(null),[H,U]=(0,R.useState)(null),G=(0,R.useRef)(new Set),K=(0,R.useRef)(null),q=(0,R.useRef)(!1),Ne=(0,R.useRef)(null),Pe=je(T,pe),J=(Pe.offset??0)/12,{data:Fe,error:Ie,isLoading:Le,mutate:Re}=v(r?[`notes-home`,r,Pe]:null,()=>re(Pe)),{data:ze,error:Be,isLoading:Y,mutate:Ve}=v(r?[`notes-home-projects`,r]:null,C),X=ze?.items??[],He=X.find(e=>e.id===k)?.name??n.projectNotes,Ue=Fe?.items??[],Z=Fe?.total??0,We=Le||M!==pe,Ge=(0,R.useMemo)(()=>({justNow:t.justNow,minutesAgo:t.minutesAgo,today:t.today,yesterday:t.yesterday,daysAgo:t.daysAgo,locale:h(e)}),[e,t.justNow,t.minutesAgo,t.today,t.yesterday,t.daysAgo]),[Ke,qe]=(0,R.useState)(()=>Date.now());(0,R.useEffect)(()=>{P(k)},[k]),(0,R.useEffect)(()=>{let e=window.setInterval(()=>qe(Date.now()),6e4);return()=>window.clearInterval(e)},[]);let Q=(0,R.useCallback)(()=>{Re().catch(()=>void 0),Ve().catch(()=>void 0)},[Re,Ve]);(0,R.useEffect)(()=>{let e=[`note-updated`,`note-created`,`note-deleted`,`project-updated`,`project-created`,`project-deleted`];return e.forEach(e=>window.addEventListener(e,Q)),()=>e.forEach(e=>window.removeEventListener(e,Q))},[Q]);let Je=(0,R.useCallback)((e,t=!1)=>{let n=`${x}${ae}`,r=new URLSearchParams({returnTo:n});t&&r.set(`edit`,`1`),f(`/notes/${encodeURIComponent(e)}?${r}`)},[x,ae,f]),$=(0,R.useCallback)(async()=>{if(!(q.current||!r)){q.current=!0,De(!0),F(null),K.current??={key:crypto.randomUUID(),projectId:N||void 0};try{let e=await ce({markdown:``,kind:`thought`,projectId:K.current.projectId},K.current.key);K.current=null,Q(),Je(e.id,!0)}catch(e){F(`${t.createBlankFailed}: ${e instanceof Error?e.message:t.createBlankFailedHint}`)}finally{q.current=!1,De(!1)}}},[N,t.createBlankFailed,t.createBlankFailedHint,Je,Q,r]),Ye=(0,R.useCallback)(e=>{O(t=>{let n=new URLSearchParams(t);return e?n.set(`search`,e):n.delete(`search`),n.delete(`page`),n},{replace:!0})},[O]);function Xe(e,t=`all`){let n=new URLSearchParams;e&&n.set(`projectId`,e),t===`unassigned`?n.set(`unassigned`,`true`):t!==`all`&&n.set(`view`,t),P(e),O(n)}function Ze(e){O(t=>{let n=new URLSearchParams(t);return j&&n.set(`unassigned`,`true`),e===`all`?n.delete(`view`):n.set(`view`,e),n.delete(`page`),n})}async function Qe(e,n){if(!G.current.has(e)){G.current.add(e),L(new Set(G.current)),F(null);try{await we(e,{pinned:n}),Q()}catch(e){F(`${t.actionFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{G.current.delete(e),L(new Set(G.current))}}}async function $e(){let e=B;if(!(!e||H)){V(null),U(e.id),F(null);try{await ie(e.id),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e.id}})),Q()}catch(e){F(`${t.deleteFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{U(null)}}}if((0,R.useLayoutEffect)(()=>{if(!r){l();return}return o({startExtra:null,main:(0,z.jsx)(`h1`,{className:`truncate text-base font-semibold text-fg`,children:t.title}),end:(0,z.jsxs)(`div`,{className:p(`flex min-w-0 items-center gap-2`,E),children:[(0,z.jsxs)(`label`,{className:`flex h-9 w-32 min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-2 sm:w-48`,children:[(0,z.jsx)(Ee,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,z.jsx)(`input`,{ref:Ne,type:`search`,value:M,onChange:e=>Ye(e.target.value),"aria-label":t.searchDialogTitle,placeholder:t.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-muted`})]}),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>void $(),disabled:I,"aria-label":n.blankNote,className:p(W,`border border-edge bg-surface-panel text-fg`),children:[I?(0,z.jsx)(u,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,z.jsx)(d,{className:`size-4`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`hidden sm:inline`,children:n.blankNote})]})]})}),()=>l()},[l,$,I,n.blankNote,t.searchDialogTitle,t.searchPlaceholder,t.title,M,o,Ye,r]),(0,R.useEffect)(()=>{let e=e=>{!(e.metaKey||e.ctrlKey)||e.altKey||e.isComposing||e.target?.closest(`input, textarea, [contenteditable="true"], [role="dialog"]`)||(e.key.toLowerCase()===`n`&&(e.preventDefault(),$()),e.key.toLowerCase()===`f`&&(e.preventDefault(),Ne.current?.focus()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[$]),!r)return(0,z.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-sm text-fg-muted`,children:t.needToken});let et=[{id:`all`,label:n.homeNav,Icon:fe},{id:`favorites`,label:n.favorites,Icon:ge},{id:`unassigned`,label:n.unassigned,Icon:oe},{id:`archived`,label:t.filterArchived,Icon:de}],tt=k?`project:${k}`:j?`unassigned`:`all`;return(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-panel`,children:[(0,z.jsxs)(`aside`,{className:`hidden w-44 shrink-0 flex-col gap-1 overflow-y-auto px-3 py-6 xl:flex`,"aria-label":n.homeNav,children:[et.map(({id:e,label:t,Icon:n})=>(0,z.jsxs)(`button`,{type:`button`,onClick:()=>Xe(``,e),"aria-current":!k&&(e===`unassigned`?j:!j&&A===e)?`page`:void 0,className:p(W,`justify-start px-2 text-left text-xs`,!k&&(e===`unassigned`?j:!j&&A===e)&&`bg-surface-hover font-medium text-fg`),children:[(0,z.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":!0}),t]},e)),(0,z.jsx)(`span`,{className:`mb-1 mt-7 px-2 text-xs text-fg-muted`,children:n.projects}),Y?[0,1,2].map(e=>(0,z.jsx)(y,{className:`mb-2 h-8 w-full`},e)):X.slice(0,8).map(e=>(0,z.jsxs)(`button`,{type:`button`,onClick:()=>Xe(e.id),"aria-current":k===e.id?`page`:void 0,className:p(W,`justify-start px-2 text-left text-xs`,k===e.id&&`bg-surface-hover font-medium text-fg`),children:[(0,z.jsx)(te,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)),(0,z.jsxs)(`button`,{type:`button`,onClick:()=>f(`/projects`),className:p(W,`mt-2 justify-start px-2 text-xs`),children:[n.allProjects,(0,z.jsx)(ue,{className:`ml-auto size-3`,"aria-hidden":!0})]})]}),(0,z.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,z.jsxs)(`div`,{className:`mx-auto flex w-full max-w-6xl flex-col px-4 py-4 sm:py-7 sm:px-8 lg:px-10 lg:py-9`,children:[(0,z.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-start justify-between gap-4`,children:[(0,z.jsx)(`h2`,{className:`min-w-0 break-words text-2xl font-semibold tracking-tight text-fg`,children:k?He:j?n.unassigned:n.homeTitle}),k?(0,z.jsxs)(`button`,{type:`button`,onClick:()=>f(`/projects/${encodeURIComponent(k)}`),className:p(W,`text-xs`),children:[n.openProject,(0,z.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0})]}):null]}),xe?(0,z.jsx)(`p`,{className:`mb-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:xe}):null,(0,z.jsx)(`div`,{className:`order-3 mt-6 sm:order-none sm:mt-0`,children:(0,z.jsx)(Ae,{projects:X,projectId:N,onProjectChange:P,onCreated:Q,labels:t,projectsLoading:Y,projectsError:!!Be})}),Be?(0,z.jsxs)(`div`,{role:`alert`,className:`mt-4 flex items-center gap-3 text-xs text-danger`,children:[(0,z.jsx)(`span`,{children:n.projectsLoadFailed}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>void Ve().catch(()=>void 0),className:`underline`,children:n.retry})]}):null,!k&&!j&&(Y||X.length>0)?(0,z.jsxs)(`section`,{className:`order-4 mt-8 sm:order-none`,"aria-label":n.continueProjects,children:[(0,z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.continueProjects}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>f(`/projects`),className:`text-xs text-fg-muted hover:text-fg`,children:n.allProjects})]}),(0,z.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:Y?[0,1,2].map(e=>(0,z.jsx)(y,{className:`h-28 w-full`},e)):X.slice(0,3).map(e=>(0,z.jsxs)(`button`,{type:`button`,onClick:()=>Xe(e.id),className:`min-w-0 rounded-lg border border-edge bg-surface-panel p-3 text-left transition-colors sm:p-4 hover:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,z.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,z.jsx)(te,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.description?(0,z.jsx)(`p`,{className:`mt-2 hidden line-clamp-1 text-xs text-fg-muted sm:block`,children:e.description}):null,(0,z.jsxs)(`span`,{className:`mt-2 flex flex-wrap items-center justify-between gap-1 text-xs text-fg-muted sm:mt-3`,children:[(0,z.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(e.noteCount))}),(0,z.jsx)(`span`,{children:e.updatedAt?Oe(e.updatedAt,Ke,Ge):n.emptyProject})]})]},e.id))})]}):null,(0,z.jsxs)(`section`,{className:`order-2 mt-2 pb-6 sm:order-none sm:mt-8`,"aria-label":n.recentNotes,children:[(0,z.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:k?n.projectNotes:n.recentNotes}),(0,z.jsx)(`div`,{className:`w-48 max-w-full`,children:(0,z.jsx)(c,{value:tt,allowEmpty:!1,ariaLabel:n.projects,placeholder:n.allNotes,options:[{value:`all`,label:n.allNotes},{value:`unassigned`,label:n.unassigned},...X.filter(e=>e.name.toLowerCase().includes(he.toLowerCase())).map(e=>({value:`project:${e.id}`,label:e.name}))],selectedLabel:k?He:j?n.unassigned:n.allNotes,triggerClassName:`h-8 bg-surface-panel text-xs`,loading:Y,searchPlaceholder:n.projectSearch,searchValue:he,onSearchChange:_e,onChange:e=>Xe(e.startsWith(`project:`)?e.slice(8):``,e===`unassigned`?e:`all`)})})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-5 border-b border-edge`,"aria-label":t.libraryTitle,children:[[{id:`all`,label:t.filterAll},{id:`agent`,label:n.agentEdited},{id:`favorites`,label:n.favorites},{id:`archived`,label:t.filterArchived}].map(({id:e,label:t})=>(0,z.jsx)(`button`,{type:`button`,"aria-pressed":A===e||e===`all`&&A===`unassigned`,onClick:()=>Ze(e),className:p(`touch-target border-b-2 border-transparent py-3 text-xs text-fg-muted hover:text-fg`,(A===e||e===`all`&&A===`unassigned`)&&`border-fg font-medium text-fg`),children:t},e)),(0,z.jsx)(`span`,{className:`ml-auto py-3 text-xs text-fg-muted`,children:n.sortUpdated})]}),Ie?(0,z.jsxs)(`div`,{className:`py-10 text-center`,role:`alert`,children:[(0,z.jsx)(`p`,{className:`text-sm text-danger`,children:n.loadFailed}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>void Re().catch(()=>void 0),className:p(W,`mt-2`),children:n.retry})]}):We?(0,z.jsx)(`div`,{"aria-busy":`true`,className:`divide-y divide-edge`,children:[0,1,2,3].map(e=>(0,z.jsxs)(`div`,{className:`flex items-center gap-3 py-4`,children:[(0,z.jsx)(y,{className:`h-10 w-8 shrink-0`}),(0,z.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,z.jsx)(y,{className:`h-4 w-2/3`}),(0,z.jsx)(y,{className:`h-3 w-1/2`})]})]},e))}):Ue.length===0?(0,z.jsxs)(`div`,{className:`flex flex-col items-center px-4 py-12 text-center`,children:[(0,z.jsx)(fe,{className:`mb-4 size-8 text-fg-muted`,strokeWidth:1.3,"aria-hidden":!0}),(0,z.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:M||A!==`all`&&A!==`unassigned`?n.noMatches:k?n.projectEmpty:n.emptyTitle}),(0,z.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:M||A!==`all`&&A!==`unassigned`?n.noMatchesHint:k?n.projectEmptyHint:n.emptyDescription})]}):(0,z.jsx)(`ul`,{className:`divide-y divide-edge`,children:Ue.map(e=>{let r=e.voiceAttachmentId||e.kind===`voice`?le:e.kind===`bookmark`?D:Ce,i=Me(e)||(e.coverAttachmentId?t.imageNote:t.noText);return(0,z.jsxs)(`li`,{className:`group flex min-w-0 items-center gap-3 py-4`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>Je(e.id),className:`touch-target flex min-w-0 flex-1 items-center gap-3 rounded-md text-left focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,z.jsx)(`span`,{className:`flex h-10 w-8 shrink-0 items-center justify-center rounded-md border border-edge text-fg-muted`,children:(0,z.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block truncate text-base font-medium text-fg sm:text-sm group-hover:text-accent-fg`,children:e.title||i.slice(0,48)||t.titlePlaceholder}),(0,z.jsxs)(`span`,{className:`mt-1 flex min-w-0 items-center gap-1.5 text-xs text-fg-muted`,children:[e.lastEditTrigger===`ai_edit`?(0,z.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-accent-fg`,children:[(0,z.jsx)(Se,{className:`size-3`,"aria-hidden":!0}),n.agentEditLabel,(0,z.jsx)(`span`,{"aria-hidden":!0,children:`·`})]}):null,(0,z.jsx)(`span`,{className:`truncate`,children:i})]}),(0,z.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`mt-1.5 block text-xs text-fg-muted sm:hidden`,children:Oe(e.updatedAt,Ke,Ge)})]})]}),(0,z.jsx)(`span`,{className:`hidden max-w-32 truncate text-xs text-fg-muted md:block`,title:e.projects?.map(e=>e.name).join(` · `),children:e.projects?.map(e=>e.name).join(` · `)||n.unassigned}),(0,z.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`hidden w-24 shrink-0 text-right text-xs text-fg-muted sm:block`,children:Oe(e.updatedAt,Ke,Ge)}),(0,z.jsx)(`button`,{type:`button`,onClick:()=>void Qe(e.id,!e.pinned),disabled:ke.has(e.id),"aria-label":`${e.pinned?n.unfavorite:n.favorite}: ${e.title||t.titlePlaceholder}`,"aria-pressed":!!e.pinned,className:`touch-target inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-accent`,children:(0,z.jsx)(ge,{className:p(`size-4`,e.pinned&&`fill-current text-fg`),"aria-hidden":!0})}),(0,z.jsxs)(be,{children:[(0,z.jsx)(ye,{asChild:!0,children:(0,z.jsx)(`button`,{type:`button`,disabled:H===e.id,"aria-label":`${t.noteActions}: ${e.title||t.titlePlaceholder}`,className:`touch-target inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-accent`,children:H===e.id?(0,z.jsx)(u,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,z.jsx)(b,{className:`size-4`,"aria-hidden":!0})})}),(0,z.jsx)(se,{children:(0,z.jsx)(ne,{align:`end`,sideOffset:4,className:`z-50 min-w-36 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,z.jsxs)(S,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft`,onSelect:()=>V(e),children:[(0,z.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),t.delete]})})})]})]},e.id)})}),!We&&!Ie&&Z>0?(0,z.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 text-xs text-fg-muted`,"aria-live":`polite`,children:[(0,z.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(Z))}),Z>12||J>0?(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`button`,{type:`button`,"aria-label":n.previousPage,disabled:J===0,className:W,onClick:()=>O(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(J-1)),t}),children:(0,z.jsx)(w,{className:`size-4`,"aria-hidden":!0})}),(0,z.jsxs)(`span`,{children:[J+1,` / `,Math.max(1,Math.ceil(Z/12))]}),(0,z.jsx)(`button`,{type:`button`,"aria-label":n.nextPage,disabled:(J+1)*12>=Z,className:W,onClick:()=>O(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(J+1)),t}),children:(0,z.jsx)(ue,{className:`size-4`,"aria-hidden":!0})})]}):null]}):null]})]})}),(0,z.jsx)(me,{open:B!==null,title:t.deleteConfirmTitle,description:t.deleteConfirmDescription.replace(`{{title}}`,B?.title||t.titlePlaceholder),confirmLabel:t.deleteConfirmLabel,cancelLabel:t.deleteCancelLabel,destructive:!0,onConfirm:()=>void $e(),onCancel:()=>V(null)})]})}function K(){let e=(0,L.c)(12),{noteId:t}=o(),n=i(),[r]=a(),s;e[0]===r?s=e[1]:(s=l(r.get(`returnTo`),`/notes`,[`/chat`,`/projects`,`/notes`,`/tasks`]),e[0]=r,e[1]=s);let c=s,u;e[2]!==n||e[3]!==c?(u=()=>{n(c)},e[2]=n,e[3]=c,e[4]=u):u=e[4];let d=u;if(!t)return null;let f=r.get(`edit`)===`1`?`wysiwyg`:`preview`,p;e[5]===r?p=e[6]:(p=r.get(`edit`),e[5]=r,e[6]=p);let m=p===`1`,h;return e[7]!==d||e[8]!==t||e[9]!==f||e[10]!==m?(h=(0,z.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-6xl flex-1 flex-col`,children:(0,z.jsx)(ke,{noteId:t,onBack:d,initialMode:f,autoFocus:m},t)}),e[7]=d,e[8]=t,e[9]=f,e[10]=m,e[11]=h):h=e[11],h}function q(){let e=(0,L.c)(2),{noteId:t}=o(),n;return e[0]===t?n=e[1]:(n=t?(0,z.jsx)(K,{}):(0,z.jsx)(G,{}),e[0]=t,e[1]=n),n}export{q as NotesPage};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{vs as a}from"./index-B7EieIE4.js";var o=n(),s=e(t(),1),c=r();function l(e){let t=(0,o.c)(40),{items:n,activeTab:r,onChange:l,ariaLabel:u,tabIdPrefix:d,panelIdPrefix:f,className:p,buttonClassName:m,selectedClassName:h,unselectedClassName:g,countClassName:_,onReorder:v}=e,y=h===void 0?`bg-surface-active text-fg`:h,b=g===void 0?`text-fg-muted hover:bg-surface-hover hover:text-fg`:g,[x,S]=(0,s.useState)(null),[C,w]=(0,s.useState)(null),T;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{S(null),w(null)},t[0]=T):T=t[0];let E=T,D;t[1]===p?D=t[2]:(D=i(`-mx-1 flex gap-1 overflow-x-auto overscroll-x-contain px-1 pb-1`,p),t[1]=p,t[2]=D);let O;t[3]===v?O=t[4]:(O=e=>{if(!v)return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||w(null)},t[3]=v,t[4]=O);let k;t[5]!==r||t[6]!==n||t[7]!==l?(k=e=>{if(![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key)||!n.length)return;e.preventDefault();let t=n.findIndex(e=>e.id===r),i=e.key===`Home`?0:e.key===`End`?n.length-1:(Math.max(0,t)+(e.key===`ArrowRight`?1:-1)+n.length)%n.length;l(n[i].id);let a=e.currentTarget.querySelectorAll(`[role="tab"]`)[i];a?.focus(),a?.scrollIntoView({block:`nearest`,inline:`nearest`})},t[5]=r,t[6]=n,t[7]=l,t[8]=k):k=t[8];let A;if(t[9]!==r||t[10]!==m||t[11]!==_||t[12]!==x||t[13]!==C||t[14]!==n||t[15]!==l||t[16]!==v||t[17]!==f||t[18]!==y||t[19]!==d||t[20]!==b){let e;t[22]!==r||t[23]!==m||t[24]!==_||t[25]!==x||t[26]!==C||t[27]!==l||t[28]!==v||t[29]!==f||t[30]!==y||t[31]!==d||t[32]!==b?(e=e=>{let{id:t,icon:n,label:o,count:s,suffix:u,title:p}=e,h=t===r,g=x===t,T=C?.id===t&&C.position===`before`,D=C?.id===t&&C.position===`after`;return(0,c.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":h,tabIndex:h?0:-1,id:d?`${d}-${t}`:void 0,"aria-controls":f?`${f}-${t}`:void 0,"aria-grabbed":v?g:void 0,draggable:!!v,title:p,className:i(`touch-target relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,a.press,h?y:b,v&&`cursor-grab active:cursor-grabbing`,g&&`scale-[0.98] border border-edge bg-surface-active/60 opacity-55 shadow-surface`,(T||D)&&!g&&`bg-surface-hover text-fg`,m),onClick:()=>l(t),onDragStart:e=>{v&&(S(t),w(null),e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t))},onDragOver:e=>{if(!v||!x)return;if(x===t){w(null);return}e.preventDefault(),e.dataTransfer.dropEffect=`move`;let n=e.currentTarget.getBoundingClientRect(),r=e.clientX<n.left+n.width/2?`before`:`after`;w(e=>e?.id===t&&e.position===r?e:{id:t,position:r})},onDrop:e=>{!v||!x||x===t||(e.preventDefault(),v(x,t,C?.id===t?C.position:`before`),E())},onDragEnd:E,children:[T?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -left-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null,n?(0,c.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}):null,(0,c.jsx)(`span`,{children:o}),s==null?null:(0,c.jsx)(`span`,{className:i(`rounded-full bg-surface-hover px-1.5 py-0.5 text-xs tabular-nums text-fg-muted`,_),children:s}),u,D?(0,c.jsx)(`span`,{className:`pointer-events-none absolute -right-0.5 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-accent shadow-[0_0_0_2px_var(--color-surface-panel)]`,"aria-hidden":!0}):null]},t)},t[22]=r,t[23]=m,t[24]=_,t[25]=x,t[26]=C,t[27]=l,t[28]=v,t[29]=f,t[30]=y,t[31]=d,t[32]=b,t[33]=e):e=t[33],A=n.map(e),t[9]=r,t[10]=m,t[11]=_,t[12]=x,t[13]=C,t[14]=n,t[15]=l,t[16]=v,t[17]=f,t[18]=y,t[19]=d,t[20]=b,t[21]=A}else A=t[21];let j;return t[34]!==u||t[35]!==D||t[36]!==O||t[37]!==k||t[38]!==A?(j=(0,c.jsx)(`nav`,{"aria-label":u,className:D,role:`tablist`,onDragLeave:O,onKeyDown:k,children:A}),t[34]=u,t[35]=D,t[36]=O,t[37]=k,t[38]=A,t[39]=j):j=t[39],j}export{l as t};
@@ -0,0 +1 @@
1
+ import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{t as a}from"./createLucideIcon-DPHK1VkS.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{a as c,f as l,g as u,h as d,i as f,n as p,o as m,p as h,r as g,s as _,t as v,u as y}from"./es2015-DBLcMg5B.js";import{i as b,n as x}from"./dist-CxGUk8J-.js";import{a as S,i as C,n as w,r as T,t as E}from"./dist-CI_fqRk-.js";import{t as D}from"./skeleton-BwbyijEw.js";import{a as O,s as k,t as A}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as ee,r as j}from"./settings-shell-layer-context-DCp6ykjQ.js";var M=a(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),N=r(),P=t({Anchor:()=>me,Arrow:()=>_e,Close:()=>ge,Content:()=>he,Popover:()=>V,PopoverAnchor:()=>H,PopoverArrow:()=>Y,PopoverClose:()=>J,PopoverContent:()=>q,PopoverPortal:()=>G,PopoverTrigger:()=>U,Portal:()=>Q,Root:()=>X,Trigger:()=>Z,createPopoverScope:()=>te}),F=e(n(),1),I=i(),L=`Popover`,[R,te]=d(L,[S]),z=S(),[ne,B]=R(L),V=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=z(t),c=F.useRef(null),[u,d]=F.useState(!1),[f,p]=l({prop:r,defaultProp:i??!1,onChange:a,caller:L});return(0,I.jsx)(C,{...s,children:(0,I.jsx)(ne,{scope:t,contentId:h(),triggerRef:c,open:f,onOpenChange:p,onOpenToggle:F.useCallback(()=>p(e=>!e),[p]),hasCustomAnchor:u,onCustomAnchorAdd:F.useCallback(()=>d(!0),[]),onCustomAnchorRemove:F.useCallback(()=>d(!1),[]),modal:o,children:n})})};V.displayName=L;var re=`PopoverAnchor`,H=F.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=B(re,n),a=z(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return F.useEffect(()=>(o(),()=>s()),[o,s]),(0,I.jsx)(E,{...a,...r,ref:t})});H.displayName=re;var ie=`PopoverTrigger`,U=F.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=B(ie,n),a=z(n),o=b(t,i.triggerRef),s=(0,I.jsx)(y.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":pe(i.open),...r,ref:o,onClick:u(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,I.jsx)(E,{asChild:!0,...a,children:s})});U.displayName=ie;var W=`PopoverPortal`,[ae,oe]=R(W,{forceMount:void 0}),G=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=B(W,t);return(0,I.jsx)(ae,{scope:t,forceMount:n,children:(0,I.jsx)(f,{present:n||a.open,children:(0,I.jsx)(c,{asChild:!0,container:i,children:r})})})};G.displayName=W;var K=`PopoverContent`,q=F.forwardRef((e,t)=>{let n=oe(K,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=B(K,e.__scopePopover);return(0,I.jsx)(f,{present:r||a.open,children:a.modal?(0,I.jsx)(ce,{...i,ref:t}):(0,I.jsx)(le,{...i,ref:t})})});q.displayName=K;var se=x(`PopoverContent.RemoveScroll`),ce=F.forwardRef((e,t)=>{let n=B(K,e.__scopePopover),r=F.useRef(null),i=b(t,r),a=F.useRef(!1);return F.useEffect(()=>{let e=r.current;if(e)return v(e)},[]),(0,I.jsx)(p,{as:se,allowPinchZoom:!0,children:(0,I.jsx)(ue,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:u(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:u(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:u(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),le=F.forwardRef((e,t)=>{let n=B(K,e.__scopePopover),r=F.useRef(!1),i=F.useRef(!1);return(0,I.jsx)(ue,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),ue=F.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=B(K,n),p=z(n);return g(),(0,I.jsx)(m,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,I.jsx)(_,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,I.jsx)(T,{"data-state":pe(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),de=`PopoverClose`,J=F.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=B(de,n);return(0,I.jsx)(y.button,{type:`button`,...r,ref:t,onClick:u(e.onClick,()=>i.onOpenChange(!1))})});J.displayName=de;var fe=`PopoverArrow`,Y=F.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=z(n);return(0,I.jsx)(w,{...i,...r,ref:t})});Y.displayName=fe;function pe(e){return e?`open`:`closed`}var X=V,me=H,Z=U,Q=G,he=q,ge=J,_e=Y;function ve(e,t=!1){if(!t)return A;switch(e){case`modal`:return O;case`page`:return k;default:return`z-50`}}function ye(e){let t=(0,N.c)(14),{options:n,values:r,multiple:i,onChange:a,ariaLabel:o}=e,c=i===void 0?!1:i,l=(0,F.useId)(),u;if(t[0]!==c||t[1]!==l||t[2]!==a||t[3]!==n||t[4]!==r){let e;t[6]!==c||t[7]!==l||t[8]!==a||t[9]!==r?(e=e=>(0,I.jsxs)(`label`,{className:s(`touch-target flex min-h-10 min-w-0 items-center gap-3 rounded-md px-2 py-2 text-sm text-fg has-focus-visible:ring-2 has-focus-visible:ring-accent`,e.disabled?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-surface-hover`),children:[(0,I.jsx)(`input`,{type:c?`checkbox`:`radio`,name:l,value:e.value,checked:r.includes(e.value),disabled:e.disabled,className:`shrink-0 accent-accent`,onChange:t=>a(c?t.target.checked?[...r,e.value]:r.filter(t=>t!==e.value):[e.value])}),e.icon,(0,I.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:e.label})]},e.value),t[6]=c,t[7]=l,t[8]=a,t[9]=r,t[10]=e):e=t[10],u=n.map(e),t[0]=c,t[1]=l,t[2]=a,t[3]=n,t[4]=r,t[5]=u}else u=t[5];let d;return t[11]!==o||t[12]!==u?(d=(0,I.jsx)(`fieldset`,{"aria-label":o,className:`min-w-0 space-y-0.5`,children:u}),t[11]=o,t[12]=u,t[13]=d):d=t[13],d}var be=`flex max-h-[min(20rem,var(--radix-popover-content-available-height))] flex-col overflow-hidden`,xe=`min-h-0 flex-1 overflow-y-auto overscroll-y-contain touch-pan-y [scrollbar-gutter:stable]`;function Se({value:e,options:t,placeholder:n,allowEmpty:r=!0,emptyLabel:i=n,emptyDisabled:a=!1,disabledValues:c,disabled:l,id:u,ariaLabel:d,ariaLabelledBy:f,title:p,triggerClassName:m,triggerIcon:h,contentClassName:g,side:_=`bottom`,align:v=`start`,onChange:y,searchPlaceholder:b,searchValue:x,onSearchChange:S,loading:C=!1,statusMessage:w,selectedLabel:T}){let[E,O]=(0,F.useState)(!1),k=ee(),A=j(),N=ve(k,A!==null),P=t.find(t=>t.value===e),L=T??P?.label??(e?`${e} · unavailable`:n),R;return(0,I.jsxs)(X,{open:E,onOpenChange:O,children:[(0,I.jsx)(Z,{asChild:!0,children:(0,I.jsxs)(`button`,{id:u,type:`button`,"aria-label":d,"aria-labelledby":f,title:p,disabled:l,className:s(`touch-target box-border flex h-10 w-full min-w-0 items-center justify-between gap-2 rounded-lg border border-edge bg-surface-subtle px-3 text-left text-sm font-normal text-fg`,`hover:border-edge-strong focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,l&&`cursor-not-allowed opacity-50 hover:border-edge`,m),children:[h,(0,I.jsx)(`span`,{className:s(`min-w-0 truncate`,!e&&`text-fg-subtle`),children:L}),(0,I.jsx)(M,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`})]})}),(0,I.jsx)(Q,{container:A??void 0,children:(0,I.jsxs)(he,{side:_,align:v,sideOffset:4,collisionPadding:8,className:s(N,be,`w-[var(--radix-popover-trigger-width)] min-w-[16rem] rounded-lg border border-edge bg-surface-panel p-1 shadow-popover outline-none`,g),children:[b?(0,I.jsx)(`input`,{type:`search`,"aria-label":b,placeholder:b,value:x,onChange:e=>S?.(e.target.value),className:`mb-1 w-full shrink-0 rounded-md bg-surface-base px-3 py-2 text-base text-fg placeholder:text-fg-subtle sm:text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}):null,(0,I.jsxs)(`div`,{"data-select-scroll-region":!0,className:s(xe,`max-h-64`),children:[r?(0,I.jsxs)(`button`,{type:`button`,disabled:a,className:s(`touch-target flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,e===``&&`bg-surface-active font-medium`,a&&`cursor-not-allowed opacity-45 hover:bg-transparent`),onClick:()=>{a||(y(``),O(!1))},children:[(0,I.jsx)(o,{className:s(`size-4 shrink-0`,e!==``&&`invisible`),"aria-hidden":`true`}),(0,I.jsx)(`span`,{className:`min-w-0 truncate text-fg-subtle`,children:i})]}):null,C?(0,I.jsx)(`div`,{className:`space-y-2 p-2`,"aria-busy":`true`,children:[0,1,2].map(e=>(0,I.jsx)(D,{className:`h-8 w-full`},e))}):null,w&&!C?(0,I.jsx)(`p`,{role:`status`,className:`px-3 py-2 text-xs text-fg-muted`,children:w}):null,(C?[]:t).map(t=>{let n=t.disabled===!0||c?.has(t.value)===!0&&t.value!==e,r=t.group&&t.group!==R;return R=t.group,(0,I.jsxs)(F.Fragment,{children:[r?(0,I.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wide text-fg-subtle`,children:t.group}):null,(0,I.jsxs)(`button`,{type:`button`,disabled:n,className:s(`touch-target flex h-9 w-full items-center gap-2 rounded-md px-2 text-left text-sm text-fg hover:bg-surface-hover`,t.value===e&&`bg-surface-active font-medium`,n&&`cursor-not-allowed opacity-45 hover:bg-transparent`),onClick:()=>{n||(y(t.value),O(!1))},children:[t.icon??(0,I.jsx)(o,{className:s(`size-4 shrink-0`,t.value!==e&&`invisible`),"aria-hidden":`true`}),(0,I.jsx)(`span`,{className:`min-w-0 truncate`,children:t.label}),t.icon?(0,I.jsx)(o,{className:s(`ml-auto size-4 shrink-0`,t.value!==e&&`invisible`),"aria-hidden":!0}):null]})]},`${t.group??``}:${t.value}`)})]})]})})]})}function $(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map($).join(``):(0,F.isValidElement)(e)?$(e.props.children):``}function Ce(e,t){let n=[];return F.Children.forEach(e,e=>{if(!(0,F.isValidElement)(e))return;if(e.type===F.Fragment){n.push(...Ce(e.props.children,t));return}if(e.type===Te){let t=e.props;n.push(...Ce(t.children,$(t.label)));return}if(e.type!==we)return;let r=e.props,i=$(r.children).trim(),a=r.value==null?i:String(r.value);n.push({value:a,label:i,disabled:r.disabled,group:t})}),n}function we(e){return null}function Te(e){return null}function Ee(e){if(!e)return;let t=e.split(/\s+/).filter(Boolean).filter(e=>{let t=e.includes(`:`)?e.slice(e.lastIndexOf(`:`)+1):e;return t===`block`||t===`inline-block`||t===`inline-flex`||t===`flex`||t===`flex-1`||t===`flex-auto`||t===`flex-initial`||t===`flex-none`||t===`grow`||t===`shrink`||t===`min-w-0`||t===`min-h-0`||t.startsWith(`w-`)||t.startsWith(`min-w-`)||t.startsWith(`max-w-`)||t.startsWith(`basis-`)||t.startsWith(`grow-`)||t.startsWith(`shrink-`)||t.startsWith(`self-`)||t.startsWith(`order-`)||t.startsWith(`col-`)||t.startsWith(`row-`)});return t.length===0?void 0:t.join(` `)}function De(e){let t=(0,N.c)(66),n,r,i,a,o,c,l,u,d,f,p,m;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12]):({align:n,children:r,className:i,contentClassName:a,disabled:o,id:c,onChange:l,placeholder:u,side:f,triggerClassName:p,value:m,...d}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m);let h=(0,F.useId)(),g=m==null?``:String(m),_,v,y,b,x,S,C,w,T,E;if(t[13]!==r||t[14]!==i||t[15]!==o||t[16]!==h||t[17]!==c||t[18]!==u||t[19]!==d.name||t[20]!==g){let e=Ce(r);b=e.find(ke),v=b!==void 0,y=b?.label||u||``,w=o||void 0,t[31]===i?T=t[32]:(T=Ee(i),t[31]=i,t[32]=T),E=d.name,_=Se,x=c??h,S=g,C=e.filter(Oe),t[13]=r,t[14]=i,t[15]=o,t[16]=h,t[17]=c,t[18]=u,t[19]=d.name,t[20]=g,t[21]=_,t[22]=v,t[23]=y,t[24]=b,t[25]=x,t[26]=S,t[27]=C,t[28]=w,t[29]=T,t[30]=E}else _=t[21],v=t[22],y=t[23],b=t[24],x=t[25],S=t[26],C=t[27],w=t[28],T=t[29],E=t[30];let D=u??y,O=b?.disabled===!0,k=d[`aria-label`],A=d[`aria-labelledby`],ee=d.title,j;t[33]!==i||t[34]!==p?(j=s(i,p),t[33]=i,t[34]=p,t[35]=j):j=t[35];let M;t[36]===l?M=t[37]:(M=e=>l?.({target:{value:e},currentTarget:{value:e}}),t[36]=l,t[37]=M);let P;t[38]!==_||t[39]!==n||t[40]!==v||t[41]!==a||t[42]!==o||t[43]!==y||t[44]!==d.title||t[45]!==f||t[46]!==x||t[47]!==A||t[48]!==j||t[49]!==M||t[50]!==S||t[51]!==C||t[52]!==D||t[53]!==O||t[54]!==k?(P=(0,I.jsx)(_,{id:x,value:S,options:C,placeholder:D,allowEmpty:v,emptyLabel:y,emptyDisabled:O,disabled:o,ariaLabel:k,ariaLabelledBy:A,title:ee,side:f,align:n,triggerClassName:j,contentClassName:a,onChange:M}),t[38]=_,t[39]=n,t[40]=v,t[41]=a,t[42]=o,t[43]=y,t[44]=d.title,t[45]=f,t[46]=x,t[47]=A,t[48]=j,t[49]=M,t[50]=S,t[51]=C,t[52]=D,t[53]=O,t[54]=k,t[55]=P):P=t[55];let L;t[56]!==o||t[57]!==d.name||t[58]!==g?(L=(0,I.jsx)(`input`,{name:d.name,value:g,readOnly:!0,hidden:!0,disabled:o}),t[56]=o,t[57]=d.name,t[58]=g,t[59]=L):L=t[59];let R;return t[60]!==P||t[61]!==L||t[62]!==w||t[63]!==T||t[64]!==E?(R=(0,I.jsxs)(`div`,{"aria-disabled":w,className:T,"data-select-name":E,children:[P,L]}),t[60]=P,t[61]=L,t[62]=w,t[63]=T,t[64]=E,t[65]=R):R=t[65],R}function Oe(e){return e.value!==``}function ke(e){return e.value===``}export{be as a,_e as c,Q as d,X as f,M as h,ye as i,ge as l,P as m,De as n,xe as o,Z as p,we as r,ve as s,Se as t,he as u};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./download-Dk-ZjtO6.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./electron-env-DH5wF8X8.js";import{gs as o}from"./index-ChIrvv3t.js";var s=e(),c=t();function l(e){let t=(0,s.c)(31),{message:l,downloadLabel:u,onDownload:d,openSystemLabel:f,onOpenWithSystemApp:p,chooseAppLabel:m,onChooseOpenWithApp:h,canOpenWithSystemApp:g,canChooseOpenWithApp:_}=e,v=g===void 0?!0:g,y=_===void 0?!0:_,b;t[0]!==v||t[1]!==p||t[2]!==f?(b=a()&&v&&typeof p==`function`&&typeof f==`string`&&f.length>0,t[0]=v,t[1]=p,t[2]=f,t[3]=b):b=t[3];let x=b,S;t[4]!==y||t[5]!==m||t[6]!==h?(S=a()&&y&&typeof h==`function`&&typeof m==`string`&&m.length>0,t[4]=y,t[5]=m,t[6]=h,t[7]=S):S=t[7];let C=S,w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=i(`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-hover/60 p-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge`),t[8]=w):w=t[8];let T;t[9]===l?T=t[10]:(T=(0,c.jsx)(`p`,{className:`min-w-0 text-xs leading-relaxed text-fg-muted`,children:l}),t[9]=l,t[10]=T);let E;t[11]!==p||t[12]!==f||t[13]!==x?(E=x?(0,c.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,o.transition,o.press,o.focusRingPanel),onClick:()=>void p?.(),children:[(0,c.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),f]}):null,t[11]=p,t[12]=f,t[13]=x,t[14]=E):E=t[14];let D;t[15]!==m||t[16]!==h||t[17]!==C?(D=C?(0,c.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,o.transition,o.press,o.focusRingPanel),onClick:()=>void h?.(),children:[(0,c.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),m]}):null,t[15]=m,t[16]=h,t[17]=C,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=i(`inline-flex items-center gap-1.5 rounded-md border border-accent bg-accent px-3 py-1.5 text-xs font-medium text-white shadow-sm`,o.transition,o.press,o.focusRingPanel),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,c.jsx)(n,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[20]=k):k=t[20];let A;t[21]!==u||t[22]!==d?(A=(0,c.jsxs)(`button`,{type:`button`,className:O,onClick:d,children:[k,u]}),t[21]=u,t[22]=d,t[23]=A):A=t[23];let j;t[24]!==A||t[25]!==E||t[26]!==D?(j=(0,c.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[E,D,A]}),t[24]=A,t[25]=E,t[26]=D,t[27]=j):j=t[27];let M;return t[28]!==j||t[29]!==T?(M=(0,c.jsxs)(`div`,{className:w,children:[T,j]}),t[28]=j,t[29]=T,t[30]=M):M=t[30],M}export{l as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./download-Dk-ZjtO6.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./electron-env-DH5wF8X8.js";import{vs as o}from"./index-B7EieIE4.js";var s=e(),c=t();function l(e){let t=(0,s.c)(31),{message:l,downloadLabel:u,onDownload:d,openSystemLabel:f,onOpenWithSystemApp:p,chooseAppLabel:m,onChooseOpenWithApp:h,canOpenWithSystemApp:g,canChooseOpenWithApp:_}=e,v=g===void 0?!0:g,y=_===void 0?!0:_,b;t[0]!==v||t[1]!==p||t[2]!==f?(b=a()&&v&&typeof p==`function`&&typeof f==`string`&&f.length>0,t[0]=v,t[1]=p,t[2]=f,t[3]=b):b=t[3];let x=b,S;t[4]!==y||t[5]!==m||t[6]!==h?(S=a()&&y&&typeof h==`function`&&typeof m==`string`&&m.length>0,t[4]=y,t[5]=m,t[6]=h,t[7]=S):S=t[7];let C=S,w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=i(`flex flex-col gap-2 rounded-lg border border-edge-subtle bg-surface-hover/60 p-3 sm:flex-row sm:items-center sm:justify-between dark:border-edge`),t[8]=w):w=t[8];let T;t[9]===l?T=t[10]:(T=(0,c.jsx)(`p`,{className:`min-w-0 text-xs leading-relaxed text-fg-muted`,children:l}),t[9]=l,t[10]=T);let E;t[11]!==p||t[12]!==f||t[13]!==x?(E=x?(0,c.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,o.transition,o.press,o.focusRingPanel),onClick:()=>void p?.(),children:[(0,c.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),f]}):null,t[11]=p,t[12]=f,t[13]=x,t[14]=E):E=t[14];let D;t[15]!==m||t[16]!==h||t[17]!==C?(D=C?(0,c.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md border border-edge bg-surface-panel px-3 py-1.5 text-xs font-medium text-fg shadow-sm dark:border-edge`,o.transition,o.press,o.focusRingPanel),onClick:()=>void h?.(),children:[(0,c.jsx)(r,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),m]}):null,t[15]=m,t[16]=h,t[17]=C,t[18]=D):D=t[18];let O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=i(`inline-flex items-center gap-1.5 rounded-md border border-accent bg-accent px-3 py-1.5 text-xs font-medium text-white shadow-sm`,o.transition,o.press,o.focusRingPanel),t[19]=O):O=t[19];let k;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,c.jsx)(n,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[20]=k):k=t[20];let A;t[21]!==u||t[22]!==d?(A=(0,c.jsxs)(`button`,{type:`button`,className:O,onClick:d,children:[k,u]}),t[21]=u,t[22]=d,t[23]=A):A=t[23];let j;t[24]!==A||t[25]!==E||t[26]!==D?(j=(0,c.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[E,D,A]}),t[24]=A,t[25]=E,t[26]=D,t[27]=j):j=t[27];let M;return t[28]!==j||t[29]!==T?(M=(0,c.jsxs)(`div`,{className:w,children:[T,j]}),t[28]=j,t[29]=T,t[30]=M):M=t[30],M}export{l as t};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{h as i,t as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{n as o,r as s}from"./popover-select-DldSX8GX.js";import{t as c}from"./markdown-view-BIg7cei7.js";import{n as l}from"./locale-store-eliqUnBr.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{t as d}from"./button-CGlRPNzi.js";import{t as f}from"./skeleton-BwbyijEw.js";import{t as p}from"./electron-env-DH5wF8X8.js";import{Hu as m,Jt as h,Ua as g,ho as _,qt as v,sa as y}from"./index-B7EieIE4.js";import{n as b,t as x}from"./api-Dnfnl1Gd.js";var S=e(t(),1),C=n();function w(e){return e?{locale:`zh`,levels:{quiet:`尽量安静`,balanced:`重要时找我`,active:`及时跟进`},save:`保存`,saved:`已保存`,level:`什么时候找你`,quietStart:`免打扰开始(小时)`,quietEnd:`免打扰结束(小时)`,timezone:`时区`,limit:`每日通知上限`,pause:`暂停一小时`,resume:`结束暂停`,privacy:`提醒频率不会改变助理可以查看或执行的范围;这些范围仍按每件事的授权执行。`,whyNow:`为什么现在`,evidence:`依据`,snooze:`一小时后`,retry:`重试`,kinds:{briefing:`简报`,reminder:`提醒`,risk:`风险`,recommendation:`建议`,decision:`待决定`,receipt:`执行回执`}}:{locale:`en`,levels:{quiet:`Keep it quiet`,balanced:`When it matters`,active:`Keep me updated`},save:`Save`,saved:`Saved`,level:`When should the assistant notify you?`,quietStart:`Quiet hours start`,quietEnd:`Quiet hours end`,timezone:`Timezone`,limit:`Daily notification limit`,pause:`Pause for one hour`,resume:`Resume`,privacy:`Notification frequency does not change what the assistant can read or do. Each delegated item keeps its own permissions.`,whyNow:`Why now`,evidence:`Evidence`,snooze:`In one hour`,retry:`Retry`,kinds:{briefing:`Briefing`,reminder:`Reminder`,risk:`Risk`,recommendation:`Recommendation`,decision:`Decision`,receipt:`Receipt`}}}function T(e,t,n){if(n!==`zh`)return t;let r={communication_follow_up:[`邮件跟进`,`关注已委托的邮件往来,准备跟进草稿并持续等待回复。`],meeting_preparation:[`会议准备`,`在会议前检查议程与资料,提示需要提前准备的事项。`],project_delivery_risk:[`项目交付风险`,`关注项目任务、依赖与承诺,发现可能影响交付的变化。`],automation_failure_impact:[`自动化失败影响`,`分析自动化故障的实际影响,提醒需要你处理的问题。`],blocked_work:[`工作阻塞`,`检查受阻任务及依赖,指出下一步可以推进的工作。`],discussion_follow_up:[`讨论后续`,`关注讨论中的结论与未完成事项,提示需要跟进的行动。`]}[e];return r?{title:r[0],description:r[1]}:t}function E(e,t){return(t===`zh`?{unread:`待查看`,read:`已查看`,snoozed:`稍后提醒`,resolved:`已收起`,expired:`已过期`,withdrawn:`来源已撤回`}:{unread:`Ready to review`,read:`Reviewed`,snoozed:`Remind later`,resolved:`Dismissed`,expired:`Expired`,withdrawn:`Source withdrawn`})[e]??e}function D(e,t){return e.project?.name??T(e.scenarioKey,{title:e.scenarioKey.replaceAll(`_`,` `),description:``},t?`zh`:`en`).title}function O(e){return e.completedAt?`completed`:e.effectiveEnabled?`active`:`paused`}function k(e){return e.status===`completed`?`completed`:e.status===`watching`&&e.enabled?`active`:`paused`}function A(e,t,n){return e.completedAt?t?`这件事已结束`:`This work has ended`:e.effectiveEnabled?e.checkStatus?.health===`blocked`?t?`最近检查未完成,需要处理`:`The latest check needs attention`:e.checkStatus?.health===`retrying`?t?`检查暂时失败,准备重试`:`Preparing to retry the check`:e.checking?t?`助理正在查看最新情况`:`Your assistant is reviewing the latest context`:n?.decision?t?`有一项决定等你处理`:`A decision needs your attention`:n?.artifact?t?`助理准备好了新内容`:`Your assistant prepared something new`:n?t?`有一项变化值得你看`:`A change is worth your attention`:t?`已记住,等待相关变化`:`Remembered and waiting for a relevant change`:t?`已暂停,恢复后继续跟进`:`Paused until you resume it`}function j(e,t){return e.completedAt?t?`不会再跟进`:`No more follow-up`:e.effectiveEnabled?e.checkStatus?.nextCheckAt?`${t?`下次检查`:`Next check`}:${F(e.checkStatus.nextCheckAt,t)}`:e.scopeKind===`project`?t?`项目出现重要变化时回来`:`Returns when the project meaningfully changes`:e.scenarioKey===`meeting_preparation`?t?`相关会议临近或资料变化时回来`:`Returns when a meeting approaches or its context changes`:t?`相关沟通需要下一步时回来`:`Returns when the conversation needs a next step`:t?`恢复后继续`:`Continues when resumed`}function M(e,t){return e.filter(e=>e.subscriptionId===t).sort((e,t)=>Date.parse(t.updatedAt)-Date.parse(e.updatedAt))[0]}function N(e,t){return e?e.decision?`${t?`等你决定`:`Waiting for your decision`}:${e.title}`:e.artifact?`${t?`最新成果`:`Latest result`}:${e.artifact.title}`:`${t?`最新变化`:`Latest update`}:${e.title}`:t?`还没有需要交付的新成果`:`No new result needs delivery yet`}function P(e,t){return e.status===`completed`?t?`这件事已结束`:`This work has ended`:e.status===`paused`||!e.enabled?t?`已暂停,恢复后继续跟进`:`Paused until you resume it`:e.sourceAvailable?e.syncFailed?t?`最近一次邮箱同步未完成`:`The latest email sync did not finish`:e.sourceFresh?e.latestDirection===`sent`?t?`已同步发件,继续等待回复`:`Sent message found; waiting for a reply`:t?`正在等待回复或约定时间`:`Waiting for a reply or the agreed time`:t?`等待最新邮箱资料,暂时无法确认是否有回复`:`Waiting for fresh mail data to check for replies`:t?`需要重新连接邮箱`:`Reconnect the email account`}function F(e,t){return e?new Date(e).toLocaleString(t?`zh-CN`:`en-US`):t?`暂无记录`:`No record yet`}function I(e,t,n){return{insight:[`已准备新成果`,`New result prepared`],unchanged:[`没有新变化`,`No changes`],routine:[`无需跟进的新活动`,`Routine activity`],duplicate:[`已有相同成果`,`Result already available`],below_threshold:[`没有需要提醒的新发现`,`No actionable finding`],insufficient_evidence:[`资料不足`,`Insufficient evidence`],source_unavailable:[`来源不可用`,`Source unavailable`],source_stale:[`等待最新资料`,`Waiting for fresh sources`],source_changed:[`资料已变化,等待重新检查`,`Source changed`],disabled:[`检查已暂停`,`Checks paused`],policy_changed:[`要求已变化`,`Instructions changed`],completed:[`检查完成`,`Check completed`],retryable:[`等待重试`,`Waiting to retry`],failed:[`检查失败`,`Check failed`],running:[`检查中`,`Checking`]}[e??t]?.[+!n]??(n?`本次检查未产生新成果`:`No new result from this check`)}var L=r();function ee(e){let t=(0,C.c)(20),{value:n,zh:r}=e,i;if(t[0]!==n.checksAllowed||t[1]!==n.enabled||t[2]!==n.nextCheckAt||t[3]!==n.recent||t[4]!==r){let e={running:[`检查中`,`Checking`],prepared:[`有新的巡查结果`,`Result prepared`],no_change:[`没有需要提醒的新变化`,`No actionable changes`],empty_checklist:[`尚未安排巡查内容`,`Checklist is empty`],blocked:[`清单不可用,请检查设置`,`Check the checklist settings`],failed:[`检查失败,请查看日志`,`Check failed; see logs`],cancelled:[`本次检查已停止`,`Check stopped`],interrupted:[`检查被中断`,`Check interrupted`],pending:[`等待提醒时段或额度`,`Waiting for delivery window or budget`],queued:[`已加入渠道发送队列`,`Queued to the channel`],unknown:[`投递状态待核对,不会自动重发`,`Delivery unknown; will not resend automatically`],duplicate:[`已存在相同提醒`,`Duplicate suppressed`],no_target:[`结果已保存,未配置外部提醒`,`Saved here; no external destination`],expired:[`提醒已过期`,`Notification expired`]},o=t=>e[t]?.[+!r]??t,s=r?`日常巡查`:`Heartbeat checks`,c;t[6]===s?c=t[7]:(c=(0,L.jsx)(`h2`,{className:`font-semibold`,children:s}),t[6]=s,t[7]=c);let l=r?`清单与设置`:`Checklist and settings`,u;t[8]===l?u=t[9]:(u=(0,L.jsx)(a,{to:`/settings/heartbeat`,className:`text-sm text-accent`,children:l}),t[8]=l,t[9]=u);let d;t[10]!==c||t[11]!==u?(d=(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[c,u]}),t[10]=c,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==n.checksAllowed||t[14]!==n.enabled||t[15]!==n.nextCheckAt||t[16]!==r?(f=n.enabled?n.checksAllowed?n.nextCheckAt?`${r?`下次计划(活动时段内执行)`:`Next scheduled check (during active hours)`}:${F(n.nextCheckAt,r)}`:r?`等待检查`:`Waiting`:r?`自动检查已暂停`:`Checks paused`:r?`未启用`:`Disabled`,t[13]=n.checksAllowed,t[14]=n.enabled,t[15]=n.nextCheckAt,t[16]=r,t[17]=f):f=t[17];let p;t[18]===f?p=t[19]:(p=(0,L.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:f}),t[18]=f,t[19]=p),i=(0,L.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[d,p,n.recent.length>0&&(0,L.jsxs)(`details`,{className:`mt-3 text-sm`,children:[(0,L.jsxs)(`summary`,{className:`cursor-pointer`,children:[o(n.recent[0].status),` · `,F(n.recent[0].startedAt,r)]}),(0,L.jsx)(`div`,{className:`mt-3 max-h-96 space-y-4 overflow-y-auto`,children:n.recent.map(e=>(0,L.jsxs)(`div`,{className:`border-t border-edge pt-3`,children:[(0,L.jsxs)(`p`,{children:[F(e.startedAt,r),` · `,o(e.status)]}),e.deliveryStatus!==`none`&&(0,L.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:o(e.deliveryStatus)}),e.target&&(0,L.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[e.target,` · `,e.chatId]}),e.content&&(0,L.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap`,children:e.content})]},e.id))})]})]}),t[0]=n.checksAllowed,t[1]=n.enabled,t[2]=n.nextCheckAt,t[3]=n.recent,t[4]=r,t[5]=i}else i=t[5];return i}function R({zh:e}){let[t,n]=(0,S.useState)(v),[r,i]=(0,S.useState)(!1),[a,o]=(0,S.useState)(``),s=u(t?`/api/proactive/web-push/probes`:null,x,{refreshInterval:1e4});async function c(){i(!0),o(``);try{let e=localStorage.getItem(h());if(!e)throw Error(`Enable this browser first`);await b(`/api/proactive/web-push/subscriptions/${encodeURIComponent(e)}/test`,`POST`,{}),await s.mutate()}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}let l=!p()&&window.isSecureContext&&`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window;async function f(){i(!0),o(``);try{if(t){let e=localStorage.getItem(h());e&&await b(`/api/proactive/web-push/subscriptions/${encodeURIComponent(e)}`,`DELETE`,{}),await(await(await navigator.serviceWorker.getRegistration(`/`))?.pushManager.getSubscription())?.unsubscribe(),localStorage.removeItem(h()),n(!1);return}if(await Notification.requestPermission()!==`granted`)throw Error(e?`浏览器未允许通知。`:`Browser notification permission was not granted.`);let{publicKey:r}=await b(`/api/proactive/web-push/prepare`,`POST`,{});await navigator.serviceWorker.register(`/notification-sw.js`);let i=await navigator.serviceWorker.ready,{id:a}=await b(`/api/proactive/web-push/subscriptions`,`POST`,{subscription:(await i.pushManager.getSubscription()??await i.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:r})).toJSON(),language:e?`zh`:`en`});localStorage.setItem(h(),a),n(!0)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}return(0,L.jsxs)(`section`,{className:`max-w-2xl rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,L.jsx)(`h2`,{className:`font-medium`,children:e?`网页关闭后也接收提醒`:`Receive alerts when this page is closed`}),(0,L.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:e?`应用在线时可将重要变化送到这台设备。锁屏只显示通用提示,详情在应用内查看。`:`When the app is online, important changes can reach this device. Lock-screen alerts stay generic; open the app for details.`}),(0,L.jsx)(d,{className:`mt-4`,disabled:r||!l,onClick:()=>void f(),children:l?t?e?`关闭这台设备的提醒`:`Disable alerts on this device`:e?`在这台设备上提醒我`:`Notify me on this device`:e?`当前设备不支持系统提醒`:`System notifications are unavailable here`}),t&&(0,L.jsx)(d,{className:`ml-2 mt-4`,disabled:r,onClick:()=>void c(),children:e?`向此浏览器发送测试通知`:`Send a test to this browser`}),s.data?.probes.slice(0,3).map(t=>(0,L.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[new Date(t.createdAt).toLocaleString(),` · `,t.status===`opened`?e?`已点击打开`:`Opened`:t.status===`accepted`?e?`提供方已接受,等待点击确认`:`Provider accepted; awaiting open confirmation`:t.status,t.error&&` · ${t.error}`]},t.id)),a&&(0,L.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:a})]})}function z({card:e,copy:t,refresh:n,detail:r=!1}){let i=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(!r||!i.current||typeof IntersectionObserver>`u`)return;let t=crypto.randomUUID(),n=!1,a=()=>{b(`/api/proactive/presence`,`POST`,{clientId:t,surface:`web`,active:n&&document.visibilityState===`visible`&&document.hasFocus(),inboxItemId:e.id,notificationRevision:e.notificationRevision}).catch(()=>{})},o=new IntersectionObserver(e=>{n=e.some(e=>e.isIntersecting),a()});o.observe(i.current);let s=window.setInterval(a,25e3);return document.addEventListener(`visibilitychange`,a),window.addEventListener(`focus`,a),window.addEventListener(`blur`,a),()=>{o.disconnect(),window.clearInterval(s),document.removeEventListener(`visibilitychange`,a),window.removeEventListener(`focus`,a),window.removeEventListener(`blur`,a),n=!1,a()}},[r,e.id,e.notificationRevision]);let o=t.locale===`zh`,s=(0,S.useRef)(null),[l,u]=(0,S.useState)(null),[f,p]=(0,S.useState)(!1),[m,h]=(0,S.useState)(``),[g,_]=(0,S.useState)(!1),[v,x]=(0,S.useState)(``),[C,w]=(0,S.useState)(``),[T,D]=(0,S.useState)(e.artifact?.content??``),[O,k]=(0,S.useState)(e.taskDraft),[A,j]=(0,S.useState)(e.id),[M,N]=(0,S.useState)(e.revision),P=A!==e.id||M!==e.revision,F=l!==`${e.id}:${e.revision}`&&![`withdrawn`,`expired`,`resolved`].includes(e.status),I=`${e.communication?o?`继续办理这件事。请读取最新卡片、成果和邮件往来,展示完整草稿与收件人让我确认后再发送:`:`Read the latest card, artifact and email thread. Show the full draft and recipients for my approval before sending: `:o?`继续讨论这件事,请先读取最新卡片和成果:`:`Continue this work. First read the latest card and artifact: `}xopc_use mode=proactive command=${e.communication?`continue_card`:`get_card`} args={"id":"${e.id}"}`,ee=e.communication?.conversationId?`/chat/${encodeURIComponent(e.communication.conversationId)}?${new URLSearchParams({draft:I,autoSend:`1`})}`:y(I,void 0,{projectScope:`none`}),R=`mt-2 w-full rounded-lg border border-edge bg-surface-base p-3 text-sm text-fg`;async function z(t,r={}){if(f||P)return;let i=JSON.stringify([e.id,e.revision,t,r]);s.current?.signature!==i&&(s.current={signature:i,key:crypto.randomUUID()}),p(!0),h(``);try{let i=await b(`/api/inbox/judgments/${encodeURIComponent(e.id)}/actions`,`POST`,{...r,actionId:t,expectedRevision:e.revision,idempotencyKey:s.current.key});i.card&&(j(i.card.id),N(i.card.revision),k(i.card.taskDraft),D(i.card.artifact?.content??``)),s.current=null,t===`decide`&&u(`${e.id}:${e.revision}`),(t===`useful`||t===`not_useful`)&&x(t),t===`refine`&&(x(`refined`),w(``)),_(!1),n()}catch(e){h(e instanceof Error?e.message:String(e))}finally{p(!1)}}return(0,L.jsxs)(`article`,{ref:i,className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,L.jsxs)(`div`,{className:`mb-2 flex flex-wrap justify-between gap-2 text-xs text-fg-muted`,children:[(0,L.jsx)(`span`,{children:e.artifact?o?`已为你准备`:`Prepared for you`:t.kinds[e.kind]}),(0,L.jsx)(`time`,{dateTime:e.updatedAt,children:new Date(e.updatedAt).toLocaleString()})]}),(0,L.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:e.title}),(0,L.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm text-fg-muted`,children:e.summary}),!r&&(0,L.jsx)(a,{className:`mt-4 inline-block text-sm font-medium text-accent`,to:`/assistant-work?item=${encodeURIComponent(e.id)}`,children:e.decision?o?`查看并决定`:`Review decision`:e.artifact?o?`打开准备好的成果`:`Open prepared work`:o?`查看变化`:`View update`}),r&&e.status===`unread`&&(0,L.jsx)(d,{variant:`ghost`,disabled:f,onClick:()=>void z(`read`),children:o?`标为已读`:`Mark as read`}),r&&e.artifact&&(0,L.jsxs)(`section`,{className:`mt-5 border-t border-edge pt-5`,children:[(0,L.jsx)(`h3`,{className:`mb-3 font-medium text-fg`,children:e.artifact.title}),g?(0,L.jsxs)(`label`,{className:`text-sm`,children:[o?`编辑成果`:`Edit prepared work`,(0,L.jsx)(`textarea`,{rows:12,maxLength:12e3,className:R,value:T,onChange:e=>D(e.target.value)})]}):(0,L.jsx)(c,{content:e.artifact.content}),F&&!g&&(0,L.jsx)(d,{className:`mt-3`,variant:`ghost`,onClick:()=>{navigator.clipboard.writeText(e.artifact.content).catch(e=>h(String(e)))},children:o?`复制成果`:`Copy`}),F&&(0,L.jsx)(`div`,{className:`mt-3 flex gap-2`,children:g?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(d,{disabled:f||P||!T.trim(),onClick:()=>void z(`edit_artifact`,{artifact:{...e.artifact,content:T}}),children:t.save}),(0,L.jsx)(d,{variant:`ghost`,onClick:()=>{_(!1),D(e.artifact.content)},children:o?`取消`:`Cancel`})]}):(0,L.jsx)(d,{variant:`ghost`,onClick:()=>_(!0),children:o?`修改成果`:`Edit`})})]}),e.decision&&F&&(0,L.jsxs)(`section`,{className:`mt-5 rounded-xl border border-edge p-4`,children:[(0,L.jsx)(`h3`,{className:`text-sm font-medium`,children:e.decision.question}),O&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:o?`确认后创建项目待办,不会自动启动执行。`:`Creates a project task without starting execution.`}),(0,L.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[o?`待办标题`:`Task title`,(0,L.jsx)(`input`,{className:R,maxLength:160,value:O.title,onChange:e=>k({...O,title:e.target.value})})]}),(0,L.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[o?`具体内容`:`Task objective`,(0,L.jsx)(`textarea`,{className:R,maxLength:1200,rows:4,value:O.objective,onChange:e=>k({...O,objective:e.target.value})})]})]}),(0,L.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:e.decision.options.map((e,t)=>(0,L.jsx)(d,{variant:t===0?`primary`:`ghost`,disabled:f||P||e.id===`approve`&&O!==void 0&&(!O.title.trim()||!O.objective.trim()),onClick:()=>void z(`decide`,{choice:e.id,...e.id===`approve`&&O?{taskDraft:O}:{}}),children:e.label},e.id))})]}),e.followUp&&(0,L.jsxs)(`div`,{className:`mt-4 rounded-lg border border-edge p-3 text-sm`,children:[(0,L.jsx)(a,{className:`text-accent`,to:`/tasks/${encodeURIComponent(e.followUp.taskId)}`,children:e.followUp.title}),(0,L.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:e.followUp.phase===`closed`?o?`任务已结束:${e.followUp.resolution??`—`}`:`Task closed: ${e.followUp.resolution??`—`}`:o?`待办已创建,仍在跟进实际进展。`:`Task created; following its progress.`})]}),e.actionStatus===`failed`&&![`expired`,`withdrawn`].includes(e.status)&&(0,L.jsxs)(`div`,{className:`mt-3 text-sm text-danger`,children:[e.actionError,(0,L.jsx)(d,{disabled:f||P,onClick:()=>void z(`retry`),children:t.retry})]}),r&&(0,L.jsxs)(`details`,{className:`mt-4 text-sm text-fg-muted`,children:[(0,L.jsxs)(`summary`,{className:`cursor-pointer`,children:[t.whyNow,` · `,t.evidence]}),(0,L.jsx)(`p`,{className:`mt-2`,children:e.whyNow}),(0,L.jsx)(`ul`,{className:`mt-2 space-y-2`,children:e.evidence.map(e=>(0,L.jsxs)(`li`,{children:[e.route?(0,L.jsx)(a,{className:`text-accent`,to:e.route,children:e.label}):e.label,e.excerpt&&(0,L.jsx)(`p`,{className:`whitespace-pre-wrap`,children:e.excerpt})]},e.id))})]}),r&&F&&(0,L.jsx)(a,{className:`mt-4 inline-block text-sm text-accent`,to:ee,children:e.communication?o?`审阅草稿并继续办理`:`Review draft and continue`:o?`接着聊这件事`:`Continue in chat`}),r&&![`withdrawn`,`expired`].includes(e.status)&&(0,L.jsxs)(`section`,{className:`mt-5 border-t border-edge pt-4`,children:[(0,L.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:o?`这次帮助合适吗?`:`Was this help right for you?`}),(0,L.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:[(0,L.jsx)(d,{variant:`ghost`,disabled:f||!!v,onClick:()=>void z(`useful`),children:o?`有帮助`:`Helpful`}),(0,L.jsx)(d,{variant:`ghost`,disabled:f||!!v,onClick:()=>void z(`not_useful`),children:o?`不适合这个场景`:`Not right for this scene`})]}),v&&(0,L.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-fg-muted`,children:v===`refined`?o?`助理会把这条要求用于当前跟进。`:`The assistant will use this instruction for this follow-up.`:o?`已记录反馈。`:`Feedback recorded.`}),!v&&(0,L.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1`,children:[[`irrelevant`,`不相关`,`Irrelevant`],[`bad_timing`,`时机不对`,`Bad timing`],[`outdated`,`信息已过时`,`Outdated`],[`too_frequent`,`提醒太多`,`Too frequent`]].map(([e,t,n])=>(0,L.jsx)(d,{variant:`ghost`,disabled:f,onClick:()=>void z(`not_useful`,{feedbackReason:e}),children:o?t:n},e))}),(0,L.jsxs)(`details`,{className:`mt-3`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer text-sm text-fg-muted`,children:o?`告诉助理下次怎么做`:`Tell the assistant what to do next time`}),(0,L.jsx)(`label`,{className:`mt-3 block text-sm`,children:(0,L.jsx)(`textarea`,{rows:3,maxLength:2e3,className:R,value:C,onChange:e=>w(e.target.value),placeholder:o?`例如:下次先给结论,技术细节放到最后。`:`For example: lead with the conclusion and put technical detail last.`})}),(0,L.jsx)(d,{className:`mt-2`,disabled:f||!C.trim(),onClick:()=>void z(`refine`,{instruction:C}),children:o?`用于这个场景`:`Use for this scene`})]})]}),r&&F&&(0,L.jsxs)(`details`,{className:`mt-4 text-sm`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:o?`调整或收起`:`Adjust or dismiss`}),(0,L.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,L.jsx)(d,{disabled:f||P,onClick:()=>void z(`handled`),children:o?`我已处理`:`Already handled`}),(0,L.jsx)(d,{disabled:f||P,onClick:()=>void z(`resolve`),children:o?`这条不用`:`Dismiss`}),(0,L.jsx)(d,{disabled:f||P,onClick:()=>void z(`snooze`),children:t.snooze}),(0,L.jsx)(a,{className:`p-2 text-accent`,to:e.communication?`/assistant-work?follow-up=${encodeURIComponent(e.communication.id)}`:`/assistant-work?delegation=${encodeURIComponent(e.subscriptionId)}`,children:o?`修改关注要求`:`Adjust instructions`})]})]}),!F&&(0,L.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:e.status===`resolved`?o?`已收起;事项进度以实际结果为准。`:`Dismissed; work progress is tracked separately.`:e.status===`expired`?o?`资料已变化或有效期已过,旧成果仅供参考。`:`Sources changed or this work expired. Review current context before acting.`:E(e.status,t.locale)}),l===`${e.id}:${e.revision}`&&(0,L.jsx)(`p`,{role:`status`,className:`mt-3 text-sm text-fg-muted`,children:o?`决定已提交,正在同步处理结果。`:`Decision submitted. Updating the result.`}),P&&l!==`${e.id}:${e.revision}`&&(0,L.jsxs)(`p`,{role:`alert`,className:`mt-3 text-sm text-warning`,children:[o?`卡片已更新。请载入最新版本再决定;重新载入会替换未提交的编辑。`:`This card changed. Load the latest version before deciding; this replaces unsaved edits.`,(0,L.jsx)(d,{variant:`ghost`,disabled:f,onClick:()=>{j(e.id),N(e.revision),k(e.taskDraft),D(e.artifact?.content??``),u(null),h(``)},children:o?`载入最新版本`:`Load latest version`})]}),m&&(0,L.jsxs)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:[m,(0,L.jsx)(d,{variant:`ghost`,onClick:n,children:o?`刷新最新内容`:`Refresh latest version`})]})]})}var B=`mt-2 w-full rounded-lg border border-edge bg-surface-base p-3 text-sm text-fg`;function te(e){let t=(0,C.c)(43),{sub:n,card:r,zh:i}=e,o;t[0]!==n||t[1]!==i?(o=D(n,i),t[0]=n,t[1]=i,t[2]=o):o=t[2];let s;t[3]===o?s=t[4]:(s=(0,L.jsx)(`h2`,{className:`font-semibold text-fg`,children:o}),t[3]=o,t[4]=s);let c;t[5]===n.userInstructions?c=t[6]:(c=(0,L.jsx)(`p`,{className:`mt-1 line-clamp-2 whitespace-pre-wrap text-sm text-fg-muted`,children:n.userInstructions}),t[5]=n.userInstructions,t[6]=c);let l;t[7]!==s||t[8]!==c?(l=(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9];let u=`/assistant-work?delegation=${encodeURIComponent(n.id)}`,d=i?`调整`:`Adjust`,f;t[10]!==u||t[11]!==d?(f=(0,L.jsx)(a,{className:`shrink-0 text-sm font-medium text-accent`,to:u,children:d}),t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]!==l||t[14]!==f?(p=(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[l,f]}),t[13]=l,t[14]=f,t[15]=p):p=t[15];let m;t[16]!==r||t[17]!==n||t[18]!==i?(m=A(n,i,r),t[16]=r,t[17]=n,t[18]=i,t[19]=m):m=t[19];let h;t[20]===m?h=t[21]:(h=(0,L.jsx)(`p`,{className:`font-medium text-fg`,children:m}),t[20]=m,t[21]=h);let g;t[22]!==r||t[23]!==i?(g=N(r,i),t[22]=r,t[23]=i,t[24]=g):g=t[24];let _;t[25]===g?_=t[26]:(_=(0,L.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:g}),t[25]=g,t[26]=_);let v;t[27]!==n.checkStatus.lastCheckedAt||t[28]!==i?(v=n.checkStatus.lastCheckedAt&&`${i?`最近检查`:`Last checked`}:${F(n.checkStatus.lastCheckedAt,i)} · `,t[27]=n.checkStatus.lastCheckedAt,t[28]=i,t[29]=v):v=t[29];let y;t[30]!==n||t[31]!==i?(y=j(n,i),t[30]=n,t[31]=i,t[32]=y):y=t[32];let b;t[33]!==v||t[34]!==y?(b=(0,L.jsxs)(`p`,{className:`mt-1 text-fg-muted`,children:[v,y]}),t[33]=v,t[34]=y,t[35]=b):b=t[35];let x;t[36]!==h||t[37]!==_||t[38]!==b?(x=(0,L.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-hover px-4 py-3 text-sm`,children:[h,_,b]}),t[36]=h,t[37]=_,t[38]=b,t[39]=x):x=t[39];let S;return t[40]!==x||t[41]!==p?(S=(0,L.jsxs)(`article`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[p,x]}),t[40]=x,t[41]=p,t[42]=S):S=t[42],S}function ne({sub:e,card:t,zh:n,refresh:r}){let[i,c]=(0,S.useState)(e.userInstructions),[l,u]=(0,S.useState)(e.delivery),[f,p]=(0,S.useState)(e.scanIntervalMinutes),[m,h]=(0,S.useState)(e.revision),[_,v]=(0,S.useState)(!1),[y,x]=(0,S.useState)(!1),[C,T]=(0,S.useState)(``),[E,O]=(0,S.useState)(``),[k,M]=(0,S.useState)(!1);async function N(t,i=!1){if(!y){x(!0),T(``),O(``);try{await b(`/api/proactive/subscriptions/${encodeURIComponent(e.id)}${i?`/check`:``}`,i?`POST`:`PATCH`,i?{}:{...t,expectedRevision:_?m:e.revision}),v(!1),O(i?n?`助理正在重新看看这个项目。`:`Your assistant is checking the project again.`:n?`助理跟进已更新。`:`Assistant follow-up updated.`),r()}catch(e){T(String(e)),r()}finally{x(!1)}}}async function P(t){if(!(k||!e.project)){M(!0),T(``),O(``);try{await g(e.scopeId,{mode:t,allowedActions:t===`auto_low_risk`?[`create_project_task`]:[]}),O(n?`行动边界已更新。`:`Action boundary updated.`),r()}catch(e){T(String(e)),r()}finally{M(!1)}}}let ee=e.scopeKind===`project`?n?`项目目标、承诺或交付风险出现有意义的变化时`:`When the project goal, commitments, or delivery risk meaningfully changes`:e.scenarioKey===`meeting_preparation`?n?`相关会议临近,或会议资料发生变化时`:`When a relevant meeting approaches or its context changes`:n?`相关沟通出现值得你接手的变化时`:`When a conversation changes in a way that needs you`;return(0,L.jsxs)(`div`,{className:`space-y-5`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h1`,{className:`text-2xl font-semibold text-fg`,children:D(e,n)}),(0,L.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:A(e,n,t)})]}),!e.completedAt&&(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(d,{disabled:y,onClick:()=>void N({enabled:!e.enabled}),children:e.enabled?n?`暂停`:`Pause`:n?`恢复`:`Resume`}),e.scopeKind===`project`&&(0,L.jsx)(d,{variant:`ghost`,disabled:y||e.checking||!e.effectiveEnabled,onClick:()=>void N({},!0),children:n?`现在再看看`:`Check again now`})]}),E&&(0,L.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:E}),(0,L.jsxs)(`section`,{className:`rounded-2xl border border-edge p-5`,children:[(0,L.jsx)(`h2`,{className:`font-semibold`,children:n?`最近检查`:`Recent checks`}),e.checkStatus.recent.length===0?(0,L.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:n?`尚无分析记录`:`No analysis yet`}):e.checkStatus.recent.map(e=>(0,L.jsxs)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:[F(e.startedAt,n),` · `,I(e.outcome,e.status,n),e.retryAt&&` · ${n?`重试`:`Retry`} ${F(e.retryAt,n)}`]},e.id))]}),t&&(0,L.jsx)(z,{card:t,copy:w(n),refresh:r,detail:!0}),(0,L.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,L.jsx)(`h2`,{className:`font-semibold text-fg`,children:n?`跟进要求`:`What your assistant remembers`}),(0,L.jsxs)(`dl`,{className:`mt-4 space-y-4 text-sm`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:n?`要帮你守住什么`:`What to protect`}),(0,L.jsx)(`dd`,{className:`mt-1 whitespace-pre-wrap text-fg`,children:e.userInstructions})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:n?`什么时候回来找你`:`When to come back`}),(0,L.jsx)(`dd`,{className:`mt-1 text-fg`,children:ee})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:n?`接下来`:`Next`}),(0,L.jsx)(`dd`,{className:`mt-1 text-fg`,children:j(e,n)})]})]}),e.projectMonitoring&&!e.completedAt&&(0,L.jsxs)(`label`,{className:`mt-5 block border-t border-edge pt-5 text-sm`,children:[(0,L.jsx)(`span`,{className:`font-medium text-fg`,children:n?`助理可以做到哪里`:`How far the assistant can go`}),(0,L.jsxs)(o,{disabled:k,value:e.projectMonitoring.mode,onChange:e=>void P(e.target.value),children:[(0,L.jsx)(s,{value:`observe`,children:n?`只观察和整理`:`Observe and organize only`}),(0,L.jsx)(s,{value:`ask_before_action`,children:n?`先准备,行动前问我`:`Prepare first, ask before acting`}),(0,L.jsx)(s,{value:`auto_low_risk`,children:n?`自动完成明确的低风险动作`:`Complete explicit low-risk actions`})]}),(0,L.jsx)(`span`,{className:`mt-2 block text-xs text-fg-muted`,children:e.projectMonitoring.mode===`auto_low_risk`?n?`目前只包括在当前项目中创建可撤销的待办。`:`Currently limited to creating reversible tasks in this project.`:n?`涉及外部发送或不可逆操作时仍会询问你。`:`External sends and irreversible actions still require you.`})]}),_&&(0,L.jsxs)(`div`,{className:`mt-5 border-t border-edge pt-5`,children:[e.scopeKind===`project`&&(0,L.jsxs)(`label`,{className:`block text-sm`,children:[n?`检查间隔(分钟)`:`Check interval (minutes)`,(0,L.jsx)(`input`,{className:B,type:`number`,min:15,max:10080,value:f,onChange:e=>p(Number(e.target.value))})]}),(0,L.jsxs)(`label`,{className:`block text-sm`,children:[n?`希望助理关注什么,忽略什么?`:`What should the assistant follow or ignore?`,(0,L.jsx)(`textarea`,{rows:5,maxLength:12e3,className:B,value:i,onChange:e=>c(e.target.value)})]}),(0,L.jsxs)(`label`,{className:`mt-4 block text-sm`,children:[n?`什么时候提醒我`:`When to notify me`,(0,L.jsxs)(o,{value:l,onChange:e=>u(e.target.value),children:[(0,L.jsx)(s,{value:`inbox`,children:n?`回到工作台时告诉我`:`Tell me in the Workbench`}),(0,L.jsx)(s,{value:`important`,children:n?`重要变化立即告诉我`:`Tell me right away for important changes`}),(0,L.jsx)(s,{value:`digest`,children:n?`放进每日汇总`:`Include it in my daily digest`})]})]})]}),!e.completedAt&&(0,L.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[_?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(d,{disabled:y||!i.trim()||m!==e.revision||e.scopeKind===`project`&&(!Number.isInteger(f)||f<15||f>10080),onClick:()=>void N({userInstructions:i,delivery:l,...e.scopeKind===`project`?{scanIntervalMinutes:f}:{}}),children:n?`保存安排`:`Save arrangement`}),(0,L.jsx)(d,{variant:`ghost`,onClick:()=>v(!1),children:n?`取消`:`Cancel`})]}):(0,L.jsx)(d,{variant:`ghost`,onClick:()=>{c(e.userInstructions),u(e.delivery),p(e.scanIntervalMinutes),h(e.revision),v(!0)},children:n?`调整安排`:`Adjust arrangement`}),(0,L.jsx)(d,{variant:`ghost`,disabled:y,onClick:()=>void N({enabled:!1,completedAt:new Date().toISOString()}),children:n?`结束安排`:`End arrangement`})]}),e.project&&(0,L.jsx)(a,{className:`mt-4 inline-block text-sm text-accent`,to:`/projects/${encodeURIComponent(e.scopeId)}`,children:n?`回到项目`:`Back to project`})]}),_&&m!==e.revision&&(0,L.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:n?`安排已更新,请取消编辑后重新载入。`:`This arrangement changed. Cancel editing and reload.`}),C&&(0,L.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:C})]})}var re=`mt-2 w-full rounded-lg border border-edge bg-surface-base p-3 text-sm text-fg`,V=e=>{let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16)};function ie(e){let t=(0,C.c)(30),{follow:n,zh:r}=e,i=n.subject??(r?`邮件跟进`:`Email follow-up`),o;t[0]===i?o=t[1]:(o=(0,L.jsx)(`h2`,{className:`font-semibold text-fg`,children:i}),t[0]=i,t[1]=o);let s;t[2]===n.instructions?s=t[3]:(s=(0,L.jsx)(`p`,{className:`mt-1 line-clamp-2 whitespace-pre-wrap text-sm text-fg-muted`,children:n.instructions}),t[2]=n.instructions,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l=`/assistant-work?follow-up=${encodeURIComponent(n.id)}`,u=r?`调整`:`Adjust`,d;t[7]!==l||t[8]!==u?(d=(0,L.jsx)(a,{className:`shrink-0 text-sm font-medium text-accent`,to:l,children:u}),t[7]=l,t[8]=u,t[9]=d):d=t[9];let f;t[10]!==c||t[11]!==d?(f=(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[c,d]}),t[10]=c,t[11]=d,t[12]=f):f=t[12];let p;t[13]!==n||t[14]!==r?(p=P(n,r),t[13]=n,t[14]=r,t[15]=p):p=t[15];let m;t[16]===p?m=t[17]:(m=(0,L.jsx)(`p`,{className:`font-medium text-fg`,children:p}),t[16]=p,t[17]=m);let h;t[18]!==n.dueAt||t[19]!==n.status||t[20]!==r?(h=n.status===`completed`?r?`这项安排已经结束`:`This arrangement has ended`:`${r?`约定时间`:`Follow up by`} ${F(n.dueAt,r)}`,t[18]=n.dueAt,t[19]=n.status,t[20]=r,t[21]=h):h=t[21];let g;t[22]===h?g=t[23]:(g=(0,L.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:h}),t[22]=h,t[23]=g);let _;t[24]!==m||t[25]!==g?(_=(0,L.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-hover px-4 py-3 text-sm`,children:[m,g]}),t[24]=m,t[25]=g,t[26]=_):_=t[26];let v;return t[27]!==_||t[28]!==f?(v=(0,L.jsxs)(`article`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[f,_]}),t[27]=_,t[28]=f,t[29]=v):v=t[29],v}function ae({follow:e,zh:t,refresh:n}){let[r,i]=(0,S.useState)(!1),[o,s]=(0,S.useState)(e.instructions),[c,l]=(0,S.useState)(V(e.dueAt)),[u,f]=(0,S.useState)(e.revision),[p,m]=(0,S.useState)(!1),[h,g]=(0,S.useState)(``);async function _(t){m(!0),g(``);try{await b(`/api/proactive/follow-ups/${encodeURIComponent(e.id)}`,`PATCH`,{expectedRevision:r?u:e.revision,...t}),i(!1),n()}catch(e){g(String(e))}finally{m(!1)}}return(0,L.jsxs)(`article`,{className:`rounded-2xl border border-edge bg-surface-panel p-5`,children:[(0,L.jsx)(`h2`,{className:`font-medium`,children:e.subject??(t?`邮件跟进`:`Email follow-up`)}),(0,L.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:P(e,t)}),(0,L.jsxs)(`dl`,{className:`mt-4 space-y-4 text-sm`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t?`助理在等什么`:`What the assistant is waiting for`}),(0,L.jsx)(`dd`,{className:`mt-1 whitespace-pre-wrap text-fg`,children:e.instructions})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t?`什么时候回来找你`:`When to come back`}),(0,L.jsx)(`dd`,{className:`mt-1 text-fg`,children:F(e.dueAt,t)})]})]}),(0,L.jsxs)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:[t?`最近成功同步`:`Last successful sync`,`:`,F(e.lastSyncedAt,t),` · `,t?`最近检查`:`Last checked`,`:`,F(e.lastCheckedAt,t)]}),e.syncFailed&&(0,L.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:t?`助理暂时看不到最新回复,请检查邮箱连接。`:`The assistant cannot see the latest replies right now. Check the email connection.`}),(!e.sourceAvailable||!e.sourceFresh)&&(0,L.jsx)(a,{className:`mt-3 block text-sm text-accent`,to:`/connectors`,children:t?`检查邮箱连接`:`Check email connection`}),e.conversationId&&(0,L.jsx)(a,{className:`mt-3 block text-sm text-accent`,to:`/chat/${encodeURIComponent(e.conversationId)}`,children:t?`继续原来的对话`:`Continue the conversation`}),r&&(0,L.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,L.jsx)(`textarea`,{"aria-label":t?`跟进要求`:`Instructions`,className:re,rows:3,maxLength:12e3,value:o,onChange:e=>s(e.target.value)}),(0,L.jsx)(`input`,{"aria-label":t?`跟进时间`:`Follow-up time`,type:`datetime-local`,className:re,value:c,onChange:e=>l(e.target.value)}),(0,L.jsx)(d,{disabled:p||u!==e.revision||!o.trim()||!c,onClick:()=>void _({instructions:o,...V(e.dueAt)===c?{}:{dueAt:new Date(c).toISOString()}}),children:t?`保存安排`:`Save arrangement`})]}),(0,L.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,L.jsx)(d,{variant:`ghost`,disabled:p,onClick:()=>{f(e.revision),s(e.instructions),l(V(e.dueAt)),i(!r)},children:r?t?`取消修改`:`Cancel edit`:t?`调整安排`:`Adjust arrangement`}),(0,L.jsx)(d,{variant:`ghost`,disabled:p,onClick:()=>void _({status:e.status===`watching`?`paused`:`watching`}),children:e.status===`watching`?t?`暂停`:`Pause`:t?`恢复`:`Resume`}),e.status!==`completed`&&(0,L.jsx)(d,{variant:`ghost`,disabled:p,onClick:()=>void _({status:`completed`}),children:t?`结束安排`:`End arrangement`})]}),r&&u!==e.revision&&(0,L.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:t?`安排已更新,请取消修改后重新编辑。`:`This follow-up changed. Cancel and reopen the editor.`}),h&&(0,L.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:h})]})}var H=`mt-1 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`;function U(e){let t=(0,C.c)(58),{value:n,onChange:r,zh:i}=e,a;t[0]===i?a=t[1]:(a=i?{all:`所有已启用设备`,auto:`自动选择一台设备`,browser:`浏览器 / 桌面`,mobile:`手机`,telegram:`Telegram`}:{all:`All enabled devices`,auto:`Choose one device`,browser:`Browser / desktop`,mobile:`Mobile`,telegram:`Telegram`},t[0]=i,t[1]=a);let s=a,c;t[2]!==r||t[3]!==n?(c=e=>r({...n,digestEnabled:e.target.checked}),t[2]=r,t[3]=n,t[4]=c):c=t[4];let l;t[5]!==c||t[6]!==n.digestEnabled?(l=(0,L.jsx)(`input`,{type:`checkbox`,checked:n.digestEnabled,onChange:c}),t[5]=c,t[6]=n.digestEnabled,t[7]=l):l=t[7];let u=i?`将提醒合并为每日摘要`:`Combine alerts into a daily digest`,d;t[8]!==l||t[9]!==u?(d=(0,L.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f=i?`摘要时间(使用上方时区)`:`Digest time (in your selected timezone)`,p=String(n.digestHour),m;t[11]===p?m=t[12]:(m=p.padStart(2,`0`),t[11]=p,t[12]=m);let h=String(n.digestMinute),g;t[13]===h?g=t[14]:(g=h.padStart(2,`0`),t[13]=h,t[14]=g);let _=`${m}:${g}`,v;t[15]!==r||t[16]!==n?(v=e=>{let[t,i]=e.target.value.split(`:`).map(Number);r({...n,digestHour:t,digestMinute:i})},t[15]=r,t[16]=n,t[17]=v):v=t[17];let y;t[18]!==_||t[19]!==v?(y=(0,L.jsx)(`input`,{className:H,type:`time`,required:!0,value:_,onChange:v}),t[18]=_,t[19]=v,t[20]=y):y=t[20];let b;t[21]!==y||t[22]!==f?(b=(0,L.jsxs)(`label`,{className:`block text-sm`,children:[f,y]}),t[21]=y,t[22]=f,t[23]=b):b=t[23];let x=i?`提醒渠道`:`Notification channel`,S=n.preferredChannel,w;t[24]!==r||t[25]!==n?(w=e=>r({...n,preferredChannel:e.target.value}),t[24]=r,t[25]=n,t[26]=w):w=t[26];let T;t[27]===s?T=t[28]:(T=Object.entries(s).map(W),t[27]=s,t[28]=T);let E;t[29]!==w||t[30]!==T||t[31]!==n.preferredChannel?(E=(0,L.jsx)(o,{value:S,onChange:w,children:T}),t[29]=w,t[30]=T,t[31]=n.preferredChannel,t[32]=E):E=t[32];let D;t[33]!==x||t[34]!==E?(D=(0,L.jsxs)(`label`,{className:`block text-sm`,children:[x,E]}),t[33]=x,t[34]=E,t[35]=D):D=t[35];let O=i?`自动选择优先使用最近注册的浏览器,否则选择一台手机。免打扰期间的重要提醒会合并为一份摘要。`:`Automatic selection prefers the most recently registered browser, then one mobile device. Important alerts during quiet hours are combined into one digest.`,k;t[36]===O?k=t[37]:(k=(0,L.jsx)(`p`,{className:`text-xs text-fg-muted`,children:O}),t[36]=O,t[37]=k);let A;t[38]!==r||t[39]!==n?(A=e=>r({...n,suppressWhileViewing:e.target.checked}),t[38]=r,t[39]=n,t[40]=A):A=t[40];let j;t[41]!==A||t[42]!==n.suppressWhileViewing?(j=(0,L.jsx)(`input`,{type:`checkbox`,checked:n.suppressWhileViewing,onChange:A}),t[41]=A,t[42]=n.suppressWhileViewing,t[43]=j):j=t[43];let M=i?`查看对应动态时延后系统提醒`:`Delay system alerts while viewing the corresponding card`,N;t[44]!==j||t[45]!==M?(N=(0,L.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[j,M]}),t[44]=j,t[45]=M,t[46]=N):N=t[46];let P;t[47]!==r||t[48]!==n||t[49]!==i?(P=n.preferredChannel===`telegram`&&(0,L.jsxs)(`fieldset`,{className:`space-y-3 rounded-xl border border-edge p-3`,children:[(0,L.jsx)(`legend`,{className:`px-1 text-sm`,children:`Telegram`}),[`chatId`,`accountId`,`publicUrl`].map(e=>(0,L.jsxs)(`label`,{className:`block text-sm`,children:[e===`chatId`?i?`接收对话 ID`:`Destination chat ID`:e===`accountId`?i?`账号 ID(可选)`:`Account ID (optional)`:i?`可从外部访问的控制台 HTTPS 地址`:`Public HTTPS console URL`,(0,L.jsx)(`input`,{className:H,required:e!==`accountId`,value:n.telegram?.[e]??``,onChange:t=>r({...n,telegram:{chatId:n.telegram?.chatId??``,publicUrl:n.telegram?.publicUrl??``,...n.telegram?.accountId?{accountId:n.telegram.accountId}:{},[e]:e===`accountId`?t.target.value||void 0:t.target.value}})})]},e)),(0,L.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i?`需要已连接 Telegram 渠道。发送通用摘要和卡片链接;链接中不要填写访问令牌。`:`Connect the Telegram channel first. Alerts contain a generic summary and a card link. Do not put access tokens in the URL.`})]}),t[47]=r,t[48]=n,t[49]=i,t[50]=P):P=t[50];let F;return t[51]!==b||t[52]!==D||t[53]!==k||t[54]!==N||t[55]!==P||t[56]!==d?(F=(0,L.jsxs)(`div`,{className:`space-y-4 border-t border-edge pt-4`,children:[d,b,D,k,N,P]}),t[51]=b,t[52]=D,t[53]=k,t[54]=N,t[55]=P,t[56]=d,t[57]=F):F=t[57],F}function W(e){let[t,n]=e;return(0,L.jsx)(s,{value:t,children:n},t)}var G=`mt-1 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`;function oe({preferences:e,copy:t,refresh:n}){let[r,i]=(0,S.useState)(e),[a,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(``);async function f(e=r){c(!0),u(``);try{let{revision:a,...o}={...r,...e};i((await b(`/api/proactive/preferences`,`PATCH`,{...o,expectedRevision:r.revision})).preferences),u(t.saved),n()}catch(e){u(e instanceof Error?e.message:String(e))}finally{c(!1)}}return(0,L.jsxs)(`form`,{className:`max-w-2xl space-y-5 rounded-2xl border border-edge bg-surface-panel p-5`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,L.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.locale===`zh`?`控制助理跟进与日常巡查;巡查结果也遵循这里的每日额度和免打扰时段。独立自动化和你主动发起的对话不受影响。静音仅控制系统提醒。`:`Controls follow-ups and heartbeat checks, including shared daily limits and quiet hours. Independent automations and your conversations are unaffected. Muting controls system notifications.`}),(0,L.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:r.checksPaused,onChange:e=>i({...r,checksPaused:e.target.checked})}),t.locale===`zh`?`暂停自动检查`:`Pause automatic checks`]}),(0,L.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:r.notificationsMuted,onChange:e=>i({...r,notificationsMuted:e.target.checked})}),t.locale===`zh`?`暂不推送提醒(成果仍可查看)`:`Mute notifications (results remain available)`]}),(0,L.jsxs)(`label`,{className:`block text-sm`,children:[t.level,(0,L.jsx)(o,{value:r.level,onChange:e=>i({...r,level:e.target.value}),children:Object.entries(t.levels).map(([e,t])=>(0,L.jsx)(s,{value:e,children:t},e))})]}),(0,L.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,L.jsxs)(`label`,{className:`text-sm`,children:[t.timezone,(0,L.jsx)(`input`,{required:!0,className:G,value:r.timezone,onChange:e=>i({...r,timezone:e.target.value})})]}),(0,L.jsxs)(`label`,{className:`text-sm`,children:[t.limit,(0,L.jsx)(`input`,{required:!0,type:`number`,min:0,max:30,className:G,value:r.dailyNotificationLimit,onChange:e=>i({...r,dailyNotificationLimit:Number(e.target.value)})})]}),(0,L.jsxs)(`label`,{className:`text-sm`,children:[t.quietStart,(0,L.jsx)(`input`,{required:!0,type:`number`,min:0,max:23,className:G,value:r.quietStartHour,onChange:e=>i({...r,quietStartHour:Number(e.target.value)})})]}),(0,L.jsxs)(`label`,{className:`text-sm`,children:[t.quietEnd,(0,L.jsx)(`input`,{required:!0,type:`number`,min:0,max:23,className:G,value:r.quietEndHour,onChange:e=>i({...r,quietEndHour:Number(e.target.value)})})]})]}),(0,L.jsx)(U,{value:r,onChange:i,zh:t.locale===`zh`}),(0,L.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.privacy}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,L.jsx)(d,{type:`submit`,variant:`primary`,disabled:a,children:t.save}),(0,L.jsx)(d,{disabled:a,onClick:()=>void f({checksPausedUntil:new Date(Date.now()+36e5).toISOString()}),children:t.pause}),e.checksPausedUntil&&(0,L.jsx)(d,{disabled:a,onClick:()=>void f({checksPausedUntil:null}),children:t.resume})]}),l&&(0,L.jsx)(`p`,{role:`status`,className:`text-sm`,children:l})]})}function K(){let e=(0,C.c)(44),t=l(fe)===`zh`,n;e[0]===t?n=e[1]:(n=w(t),e[0]=t,e[1]=n);let r=n,o=_(de),s=_(ue),[c,p]=i(),h;e[2]===c?h=e[3]:(h=c.get(`view`),e[2]=c,e[3]=h);let g=h,v=g===`settings`?g:`list`,y;e[4]===c?y=e[5]:(y=c.get(`state`),e[4]=c,e[5]=y);let T=y,E=T===`paused`||T===`completed`?T:`active`,D;e[6]===c?D=e[7]:(D=c.get(`item`),e[6]=c,e[7]=D);let A=D,j;e[8]===c?j=e[9]:(j=c.get(`digest`),e[8]=c,e[9]=j);let N=j,P;e[10]===c?P=e[11]:(P=c.get(`delegation`),e[10]=c,e[11]=P);let F=P,I;e[12]===c?I=e[13]:(I=c.get(`follow-up`),e[12]=c,e[13]=I);let B=I,re=v===`list`||!!(F||B),V=u(v===`settings`?`/api/proactive/preferences`:null,x),H;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(H={refreshInterval:15e3},e[14]=H):H=e[14];let U=u(re?`/api/proactive/overview`:null,x,H),W;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(W={revalidateOnFocus:!1},e[15]=W):W=e[15];let G=u(A?`/api/inbox/judgments/${encodeURIComponent(A)}`:null,x,W),K=u(N?`/api/proactive/digests/${encodeURIComponent(N)}`:null,x),q;e[16]===c?q=e[17]:(q=c.get(`probe`),e[16]=c,e[17]=q);let J=q,Y,X;e[18]===J?(Y=e[19],X=e[20]):(Y=()=>{J&&b(`/api/proactive/web-push/probes/${encodeURIComponent(J)}/opened`,`POST`,{}).catch(le)},X=[J],e[18]=J,e[19]=Y,e[20]=X),(0,S.useEffect)(Y,X);let pe=G.error??U.error??V.error??K.error,me=G.isLoading||U.isLoading||V.isLoading||K.isLoading,he=U.data?.scenes.flatMap(ce)??[],ge=U.data?.delegations.filter(se)??[],_e;e[21]===E?_e=e[22]:(_e=e=>O(e)===E,e[21]=E,e[22]=_e);let ve=ge.filter(_e),ye=U.data?.followUps.filter(e=>k(e)===E)??[],be;e[23]===F?be=e[24]:(be=e=>e.id===F,e[23]=F,e[24]=be);let xe=ge.find(be),Se;e[25]!==B||e[26]!==U.data?.followUps?(Se=U.data?.followUps.find(e=>e.id===B),e[25]=B,e[26]=U.data?.followUps,e[27]=Se):Se=e[27];let Ce=Se,we=e=>p(e),Z=!!(A||N||F||B),Te=A?t?`跟进动态`:`Follow-up update`:N?t?`跟进摘要`:`Follow-up summary`:Z?t?`跟进详情`:`Follow-up details`:v===`settings`?t?`提醒偏好`:`Notification preferences`:t?`助理跟进`:`Assistant follow-ups`,Ee=A||N?`/`:`/assistant-work`,Q=A||N?t?`返回工作台`:`Back to Workbench`:t?`返回助理跟进`:`Back to assistant follow-ups`,De,Oe;if(e[28]!==Q||e[29]!==Ee||e[30]!==s||e[31]!==Z||e[32]!==o||e[33]!==Te||e[34]!==v||e[35]!==t?(De=()=>(o({startExtra:Z||v===`settings`?(0,L.jsx)(d,{asChild:!0,variant:`ghost`,className:`size-8 rounded-lg p-0`,children:(0,L.jsx)(a,{to:Ee,"aria-label":Q,title:Q,children:(0,L.jsx)(m,{className:`size-4`,"aria-hidden":!0})})}):null,main:(0,L.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:Te}),end:!Z&&v===`list`?(0,L.jsx)(d,{asChild:!0,variant:`ghost`,className:`h-9 rounded-lg`,children:(0,L.jsx)(a,{to:`/assistant-work?view=settings`,children:t?`提醒偏好`:`Notification preferences`})}):null}),()=>s()),Oe=[Q,Ee,s,Z,o,Te,v,t],e[28]=Q,e[29]=Ee,e[30]=s,e[31]=Z,e[32]=o,e[33]=Te,e[34]=v,e[35]=t,e[36]=De,e[37]=Oe):(De=e[36],Oe=e[37]),(0,S.useLayoutEffect)(De,Oe),me){let t;return e[38]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-base`,children:(0,L.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-5 px-4 py-7 sm:px-6`,children:[(0,L.jsx)(f,{className:`h-8 w-48`}),(0,L.jsx)(f,{className:`h-56 rounded-2xl`}),(0,L.jsx)(f,{className:`h-40 rounded-2xl`})]})}),e[38]=t):t=e[38],t}let $;e[39]===pe?$=e[40]:($=pe&&(0,L.jsx)(`p`,{role:`alert`,className:`rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:String(pe)}),e[39]=pe,e[40]=$);let ke=A?(0,L.jsx)(L.Fragment,{children:G.data&&(0,L.jsx)(z,{card:G.data.card,copy:r,refresh:()=>void G.mutate(),detail:!0},`${G.data.card.id}:${G.data.card.revision}`)}):N?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h2`,{className:`text-xl font-semibold text-fg`,children:t?`助理为你整理的变化`:`Updates prepared by your assistant`}),K.data?.cards.map(e=>(0,L.jsx)(z,{card:e,copy:r,refresh:()=>void K.mutate()},e.id)),K.data?.cards.length===0&&(0,L.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`这些事项已处理或不再需要关注。`:`These items have been handled or are no longer relevant.`})]}):xe?(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(ne,{sub:xe,card:M(he,xe.id),zh:t,refresh:()=>void U.mutate()},xe.id)}):Ce?(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(ae,{follow:Ce,zh:t,refresh:()=>void U.mutate()})}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:v===`settings`?t?`决定助理什么时候提醒你,以及通过什么方式送达。`:`Choose when and how your assistant should notify you.`:t?`查看和管理交给助理持续跟进的事项。可以从项目、会议或对话中发起新的跟进。`:`Review and manage work your assistant is following. Start a follow-up from a project, meeting, or conversation.`}),v===`settings`&&V.data?(0,L.jsxs)(`div`,{className:`space-y-5`,children:[(0,L.jsx)(oe,{preferences:V.data.preferences,copy:r,refresh:()=>void V.mutate()},V.data.preferences.revision),(0,L.jsx)(R,{zh:t})]}):(0,L.jsxs)(`div`,{className:`space-y-5`,children:[U.data?.heartbeat&&(0,L.jsx)(ee,{value:U.data.heartbeat,zh:t}),(0,L.jsx)(`nav`,{className:`flex gap-2`,"aria-label":t?`跟进状态`:`Follow-up status`,children:[[`active`,t?`跟进中`:`Active`],[`paused`,t?`已暂停`:`Paused`],[`completed`,t?`已结束`:`Ended`]].map(e=>{let[t,n]=e;return(0,L.jsx)(d,{variant:E===t?`secondary`:`ghost`,onClick:()=>we(t===`active`?{}:{state:t}),children:n},t)})}),(0,L.jsxs)(`div`,{className:`space-y-3`,children:[ve.map(e=>(0,L.jsx)(te,{sub:e,card:M(he,e.id),zh:t},`${e.id}:${e.revision}`)),ye.map(e=>(0,L.jsx)(ie,{follow:e,zh:t},`${e.id}:${e.revision}`)),ve.length+ye.length===0&&(0,L.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-6`,children:[(0,L.jsx)(`h2`,{className:`font-medium text-fg`,children:E===`active`?t?`还没有正在跟进的事项`:`No active follow-ups`:E===`paused`?t?`没有已暂停的跟进`:`No paused follow-ups`:t?`没有已结束的跟进`:`No ended follow-ups`}),E===`active`&&(0,L.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:t?`打开一个项目,或在会议和沟通场景中告诉助理,需要它持续帮你守住什么。`:`Open a project, meeting, or conversation and tell the assistant what it should keep watching for you.`})]})]})]})]}),Ae;return e[41]!==$||e[42]!==ke?(Ae=(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-base`,children:(0,L.jsxs)(`div`,{className:`mx-auto max-w-4xl space-y-6 px-4 py-7 sm:px-6`,children:[$,ke]})}),e[41]=$,e[42]=ke,e[43]=Ae):Ae=e[43],Ae}function se(e){return e.scenarioKey!==`communication_follow_up`}function ce(e){return e.card?[e.card]:[]}function le(){}function ue(e){return e.clearPageHeader}function de(e){return e.setPageHeader}function fe(e){return e.language}export{K as ProactivePage};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{r as n,t as r,u as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{n as a}from"./locale-store-DlOv7896.js";import{a as o,r as s}from"./product-delivery-CCC4FJ3Y.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{t as l}from"./skeleton-BwbyijEw.js";import{n as u}from"./api-Coly9ab6.js";var d=e();function f(e){return e.installationState===`installed`&&e.enabled&&e.status===`installed`?`/extensions/${encodeURIComponent(e.extensionId)}`:`/local-apps/${encodeURIComponent(e.id)}`}var p=t();function m(){let e=(0,d.c)(14),t=i(),r=a(h)===`zh`,m=s(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=c(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=r?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==r?(n=(0,p.jsx)(g,{message:t,zh:r}),e[0]=t,e[1]=r,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=o({...m,title:m.id,capabilities:[`open`]}),i;return e[3]!==t||e[4]!==r?(i=t?(0,p.jsx)(n,{to:t,replace:!0}):(0,p.jsx)(g,{message:r?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:r}),e[3]=t,e[4]=r,e[5]=i):i=e[5],i}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?r?`找不到这个本地应用,它可能已被删除。`:`This local app was not found and may have been deleted.`:y instanceof Error?y.message:r?`无法打开这个本地应用。`:`Unable to open this local app.`,n;return e[6]!==t||e[7]!==r?(n=(0,p.jsx)(g,{message:t,zh:r}),e[6]=t,e[7]=r,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=f(v),e[9]=v,e[10]=t);let r;return e[11]===t?r=e[12]:(r=(0,p.jsx)(n,{to:t,replace:!0}),e[11]=t,e[12]=r),r}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(l,{className:`h-6 w-48`}),(0,p.jsx)(l,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,d.c)(7),{message:n,zh:i}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=i?`查看本地应用`:`View local apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(r,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{r as n,t as r,u as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{n as a}from"./locale-store-eliqUnBr.js";import{a as o,r as s}from"./product-delivery-CCC4FJ3Y.js";import{i as c}from"./vendor-swr-BIWyz7Rc.js";import{t as l}from"./skeleton-BwbyijEw.js";import{n as u}from"./api-D6yepxBp.js";var d=e();function f(e){return e.installationState===`installed`&&e.enabled&&e.status===`installed`?`/extensions/${encodeURIComponent(e.extensionId)}`:`/local-apps/${encodeURIComponent(e.id)}`}var p=t();function m(){let e=(0,d.c)(14),t=i(),r=a(h)===`zh`,m=s(`xopc://open${t.search}`),_=m?.kind===`local_app`?m.id:null,{data:v,error:y}=c(_?[`local-app-open`,_]:null,()=>u(_));if(!m){let t=r?`这个打开链接无效。`:`This open link is invalid.`,n;return e[0]!==t||e[1]!==r?(n=(0,p.jsx)(g,{message:t,zh:r}),e[0]=t,e[1]=r,e[2]=n):n=e[2],n}if(m.kind!==`local_app`){let t=o({...m,title:m.id,capabilities:[`open`]}),i;return e[3]!==t||e[4]!==r?(i=t?(0,p.jsx)(n,{to:t,replace:!0}):(0,p.jsx)(g,{message:r?`这个内容无法在应用中打开。`:`This content cannot be opened in the app.`,zh:r}),e[3]=t,e[4]=r,e[5]=i):i=e[5],i}if(y){let t=typeof y==`object`&&y&&`status`in y&&y.status===404?r?`找不到这个本地应用,它可能已被删除。`:`This local app was not found and may have been deleted.`:y instanceof Error?y.message:r?`无法打开这个本地应用。`:`Unable to open this local app.`,n;return e[6]!==t||e[7]!==r?(n=(0,p.jsx)(g,{message:t,zh:r}),e[6]=t,e[7]=r,e[8]=n):n=e[8],n}if(v){let t;e[9]===v?t=e[10]:(t=f(v),e[9]=v,e[10]=t);let r;return e[11]===t?r=e[12]:(r=(0,p.jsx)(n,{to:t,replace:!0}),e[11]=t,e[12]=r),r}let b;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,p.jsxs)(`div`,{className:`flex w-full flex-col gap-4 px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,p.jsx)(l,{className:`h-6 w-48`}),(0,p.jsx)(l,{className:`h-32 rounded-xl`})]}),e[13]=b):b=e[13],b}function h(e){return e.language}function g(e){let t=(0,d.c)(7),{message:n,zh:i}=e,a;t[0]===n?a=t[1]:(a=(0,p.jsx)(`p`,{children:n}),t[0]=n,t[1]=a);let o=i?`查看本地应用`:`View local apps`,s;t[2]===o?s=t[3]:(s=(0,p.jsx)(r,{className:`mt-3 inline-flex font-medium text-accent hover:underline`,to:`/local-apps`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,p.jsxs)(`div`,{className:`m-6 rounded-xl border border-danger/30 bg-danger-soft p-4 text-sm text-danger`,role:`alert`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}export{m as ProductOpenPage};