@xopcai/xopc 0.0.293 → 0.0.295

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 (108) hide show
  1. package/dist/browser-ext/dist/assets/{auth-C8gJZEsn.js → auth-B_9ZuGDx.js} +2 -1
  2. package/dist/browser-ext/dist/background.js +1 -1
  3. package/dist/browser-ext/dist/sidepanel.html +1 -1
  4. package/dist/browser-ext/dist/sidepanel.js +1 -1
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/extensions/telegram/xopc.extension.json +1 -1
  7. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DBoiUaYJ.js → agent-avatar-dicebear-CdaEBfdU.js} +1 -1
  8. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BBBTq1DQ.js → agent-defaults-settings-panel-CVunPl7p.js} +1 -1
  9. package/dist/gateway/static/root/assets/{agents-DLyyYg6o.js → agents-DessO-kK.js} +1 -1
  10. package/dist/gateway/static/root/assets/{app-management-settings-panel-Dt33QQO_.js → app-management-settings-panel-BeucVbqM.js} +1 -1
  11. package/dist/gateway/static/root/assets/{appearance-settings-TbZePT0h.js → appearance-settings-D9QdN7OM.js} +1 -1
  12. package/dist/gateway/static/root/assets/{apps-page-D1xQLM8o.js → apps-page-CbawVYBT.js} +1 -1
  13. package/dist/gateway/static/root/assets/{archive-plugin-BlhqSDGJ.js → archive-plugin-fRMLP9dL.js} +1 -1
  14. package/dist/gateway/static/root/assets/{attachment-load-DYN6uTdY.js → attachment-load-DVYW2whr.js} +1 -1
  15. package/dist/gateway/static/root/assets/{automations-page-vR2Ox-54.js → automations-page-iS1Wmdlc.js} +1 -1
  16. package/dist/gateway/static/root/assets/{automations-workspace-Bq2HWxpx.js → automations-workspace-ClZiIDCC.js} +1 -1
  17. package/dist/gateway/static/root/assets/{binary-plugins-BwJI5t0J.js → binary-plugins-Bj3KFtIt.js} +1 -1
  18. package/dist/gateway/static/root/assets/{block-editor-CSVyQoll.js → block-editor-BLs4IKoH.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-automations-page-BZ3-XyQW.js → browser-automations-page-BntIB4a1.js} +1 -1
  20. package/dist/gateway/static/root/assets/{browser-settings-page-BIJNmJgx.js → browser-settings-page-BMd_-Dq1.js} +1 -1
  21. package/dist/gateway/static/root/assets/{capabilities-settings-panel-B9gmXaV6.js → capabilities-settings-panel-Cpb0KBZc.js} +1 -1
  22. package/dist/gateway/static/root/assets/{channels-settings-CVbrTHRw.js → channels-settings-DoRAjGiN.js} +1 -1
  23. package/dist/gateway/static/root/assets/{chat-terminal-dock-BraLmomg.js → chat-terminal-dock-DH36RVtb.js} +1 -1
  24. package/dist/gateway/static/root/assets/{computer-model-settings-DgLCyFBM.js → computer-model-settings-CH8z1kz0.js} +1 -1
  25. package/dist/gateway/static/root/assets/{computer-settings-page-BnbrU0bt.js → computer-settings-page-D8oeOhou.js} +1 -1
  26. package/dist/gateway/static/root/assets/{connectors-page-D1fqQ8a3.js → connectors-page-BpEEyOGa.js} +1 -1
  27. package/dist/gateway/static/root/assets/{date-picker-C2z8-QnA.js → date-picker-BEZDMNzZ.js} +1 -1
  28. package/dist/gateway/static/root/assets/{dependency-picker-BsC_4LIh.js → dependency-picker-DC8V8-Zp.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-Dk0QTgXU.js → desktop-pet-CJloB255.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-Dj7bIWMk.js → desktop-pet-settings-B97XYYYn.js} +1 -1
  31. package/dist/gateway/static/root/assets/{device-pairing-wizard-BpJkOK07.js → device-pairing-wizard-Cci5K_bT.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-debug-page-C-A8q7eR.js → extension-debug-page-BTrK__r7.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-page-BQitxYaL.js → extension-page-DgvpFyGJ.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-settings-page-C1TqQn1x.js → extension-settings-page-DjfuFesA.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-settings-B6zLZO7B.js → gateway-settings-BsbofCP6.js} +1 -1
  36. package/dist/gateway/static/root/assets/{heartbeat-settings-CB9zJjx1.js → heartbeat-settings-BXxtbvha.js} +1 -1
  37. package/dist/gateway/static/root/assets/{home-page-C5CwdYuu.js → home-page-DErKqiEK.js} +1 -1
  38. package/dist/gateway/static/root/assets/{index-im9qTn_e.js → index-CEkw-fGy.js} +8 -8
  39. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DpmGojOS.js → keyboard-shortcuts-settings-B7E6CgtA.js} +1 -1
  40. package/dist/gateway/static/root/assets/{local-app-workbench-page-BAnnVjV6.js → local-app-workbench-page-CQsTUpog.js} +1 -1
  41. package/dist/gateway/static/root/assets/{local-apps-page-DVWnUNKI.js → local-apps-page-C10gURTO.js} +1 -1
  42. package/dist/gateway/static/root/assets/{logs-page-BuuEU9H4.js → logs-page-Dg9Ma1sl.js} +1 -1
  43. package/dist/gateway/static/root/assets/{management-settings-DuPqqO2p.js → management-settings-Bx1sNion.js} +1 -1
  44. package/dist/gateway/static/root/assets/{media-plugins-C1mHdgxN.js → media-plugins-BNoJCDvT.js} +1 -1
  45. package/dist/gateway/static/root/assets/{note-detail-panel-CqJWQqLq.js → note-detail-panel-Bsiuk-2U.js} +3 -3
  46. package/dist/gateway/static/root/assets/{notes-page-Dx4LmFQv.js → notes-page-BvAj-wx0.js} +1 -1
  47. package/dist/gateway/static/root/assets/{page-tabs-3VB72Q2A.js → page-tabs-B604dteb.js} +1 -1
  48. package/dist/gateway/static/root/assets/{preview-open-alternatives-C3gIPd87.js → preview-open-alternatives-Cp8vT7M-.js} +1 -1
  49. package/dist/gateway/static/root/assets/{proactive-page-BoXPVmE5.js → proactive-page-afUn4Km7.js} +1 -1
  50. package/dist/gateway/static/root/assets/{project-detail-page-tD7h3hb1.js → project-detail-page-D6DLiVAL.js} +1 -1
  51. package/dist/gateway/static/root/assets/{projects-page-COURhAyP.js → projects-page-Cq9hR-e_.js} +1 -1
  52. package/dist/gateway/static/root/assets/{remote-access-hub-DW0sfbOM.js → remote-access-hub-rAPyndf3.js} +1 -1
  53. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Clq1U2Bs.js → runtime-tools-settings-panel-B5EkdFYg.js} +1 -1
  54. package/dist/gateway/static/root/assets/{schema-form-D29HClcq.js → schema-form-BGMXczAd.js} +1 -1
  55. package/dist/gateway/static/root/assets/{sessions-page-CN9mE6lf.js → sessions-page-DwLbo0cX.js} +1 -1
  56. package/dist/gateway/static/root/assets/settings-advanced-gate-XmB-Qb44.js +1 -0
  57. package/dist/gateway/static/root/assets/{settings-form-section-BLX6yLkO.js → settings-form-section-Dzhqip3r.js} +1 -1
  58. package/dist/gateway/static/root/assets/{settings-page-BVrp_njx.js → settings-page-DduNxMxn.js} +1 -1
  59. package/dist/gateway/static/root/assets/{setup-status-panel-BT8UzHXg.js → setup-status-panel-ClmdhFhE.js} +1 -1
  60. package/dist/gateway/static/root/assets/{share-preview-page-DSooDmlI.js → share-preview-page-CpreOM1V.js} +1 -1
  61. package/dist/gateway/static/root/assets/{shares-settings-BQvk7HB9.js → shares-settings-CHkRyFET.js} +1 -1
  62. package/dist/gateway/static/root/assets/{skill-reload-api-DPhl0o2K.js → skill-reload-api-DWVyUbv4.js} +1 -1
  63. package/dist/gateway/static/root/assets/{skills-page-BTZgqlu5.js → skills-page-ClFiDnDu.js} +1 -1
  64. package/dist/gateway/static/root/assets/{skills-page.utils-DUL2MSIF.js → skills-page.utils-BR4q22o3.js} +1 -1
  65. package/dist/gateway/static/root/assets/{system-settings-panel-CLQ0kUhx.js → system-settings-panel-BaXq-D5z.js} +1 -1
  66. package/dist/gateway/static/root/assets/{task-detail-page-D-mE7_Y9.js → task-detail-page-CJnZCq6v.js} +1 -1
  67. package/dist/gateway/static/root/assets/{tunnel-api-Ct6uU5aE.js → tunnel-api-Dl9H37se.js} +1 -1
  68. package/dist/gateway/static/root/assets/{use-autosave-BM4VIISj.js → use-autosave-CTEqUAxS.js} +1 -1
  69. package/dist/gateway/static/root/assets/{user-model-page-BeF3xmRU.js → user-model-page-DOA5rAgd.js} +1 -1
  70. package/dist/gateway/static/root/assets/{voice-api-key-field-Di5bEpbR.js → voice-api-key-field-CVCnJKQC.js} +1 -1
  71. package/dist/gateway/static/root/assets/{work-discovery-overlay-BvUDSW1e.js → work-discovery-overlay-C8pcp5_j.js} +1 -1
  72. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-4_qbvODo.js → workflow-run-setup-panel-CvayjHzR.js} +1 -1
  73. package/dist/gateway/static/root/assets/{workflows-page-Dn15wZnh.js → workflows-page-D7pBtuZt.js} +1 -1
  74. package/dist/gateway/static/root/index.html +1 -1
  75. package/dist/package.js +1 -1
  76. package/dist/packages/gateway-contract/src/device-pairing.js +9 -7
  77. package/dist/packages/gateway-contract/src/sessions.js +1 -0
  78. package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
  79. package/dist/src/agent/tool-manuals/computer.js +1 -1
  80. package/dist/src/agent/tools/computer-use-tool.js +24 -14
  81. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  82. package/dist/src/computer/errors.d.ts +20 -0
  83. package/dist/src/computer/errors.js +24 -1
  84. package/dist/src/computer/model-adapter.d.ts +6 -0
  85. package/dist/src/computer/model-adapter.js +115 -24
  86. package/dist/src/computer/runtime.d.ts +26 -0
  87. package/dist/src/computer/runtime.js +5 -4
  88. package/dist/src/computer/task-state.d.ts +5 -1
  89. package/dist/src/computer/task-state.js +26 -11
  90. package/dist/src/config/schema.js +1 -1
  91. package/dist/src/gateway/hono/routes/device-push.js +11 -1
  92. package/dist/src/gateway/hono/routes/notes.js +1 -1
  93. package/dist/src/notes/types.d.ts +1 -1
  94. package/dist/src/notifications/device-store.js +1 -1
  95. package/dist/src/notifications/harmony-push.d.ts +26 -0
  96. package/dist/src/notifications/harmony-push.js +94 -0
  97. package/dist/src/notifications/service.d.ts +2 -0
  98. package/dist/src/notifications/service.js +15 -1
  99. package/dist/src/notifications/store.d.ts +2 -0
  100. package/dist/src/notifications/store.js +2 -1
  101. package/dist/src/notifications/types.d.ts +1 -1
  102. package/dist/src/storage/sqlite/device-access-repository.d.ts +1 -1
  103. package/dist/src/storage/sqlite/migrations/179_harmonyos_devices.sql +41 -0
  104. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  105. package/dist/src/storage/sqlite/migrations/runner.js +13 -5
  106. package/dist/src/storage/sqlite/schema.js +1 -1
  107. package/package.json +3 -1
  108. package/dist/gateway/static/root/assets/settings-advanced-gate-BAkTtjLG.js +0 -1
@@ -1 +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-im9qTn_e.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
+ 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-CEkw-fGy.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};