@xopcai/xopc 0.0.228 → 0.0.229

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 (129) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CjGZBs4C.js → agent-avatar-dicebear-CsFAJTIN.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agents-B0NI4_NI.js → agents-DA4b6_0C.js} +1 -1
  5. package/dist/gateway/static/root/assets/{app-management-settings-panel--SjycrXk.js → app-management-settings-panel-7KcMWuah.js} +1 -1
  6. package/dist/gateway/static/root/assets/{appearance-settings-8G-TVUtg.js → appearance-settings-Cqlw7Fif.js} +1 -1
  7. package/dist/gateway/static/root/assets/{apps-page-2NiqD-YP.js → apps-page-CsnhdGZ2.js} +1 -1
  8. package/dist/gateway/static/root/assets/{attachment-load-Bx44zSpz.js → attachment-load-q4pDpqkF.js} +1 -1
  9. package/dist/gateway/static/root/assets/{automations-page-CrKAHqc0.js → automations-page-BuTqjKGX.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automations-workspace-Q3g9cf0h.js → automations-workspace-CD0E2ThS.js} +1 -1
  11. package/dist/gateway/static/root/assets/{binary-plugins-DjDwnHAQ.js → binary-plugins-DUce1Bsc.js} +1 -1
  12. package/dist/gateway/static/root/assets/{block-editor-7aMOKoZM.js → block-editor-D8Ejp-QR.js} +1 -1
  13. package/dist/gateway/static/root/assets/{browser-settings-page-DTwPkmAC.js → browser-settings-page-CY1k3MMd.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-workflows-page-DVLrWKz_.js → browser-workflows-page-BDvZbR9v.js} +1 -1
  15. package/dist/gateway/static/root/assets/{capabilities-settings-panel-YcP4FbN7.js → capabilities-settings-panel-D1VfotHQ.js} +1 -1
  16. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-AcPjHHia.js → capability-presets-settings-panel-DXHqRLpU.js} +1 -1
  17. package/dist/gateway/static/root/assets/{channels-settings-Ca94Q1D-.js → channels-settings-DrFL57M_.js} +1 -1
  18. package/dist/gateway/static/root/assets/{chat-terminal-dock-BR-_7KC0.js → chat-terminal-dock-h1CKexNz.js} +1 -1
  19. package/dist/gateway/static/root/assets/{connectors-page-SGxfLTd6.js → connectors-page-DUAyfFCF.js} +1 -1
  20. package/dist/gateway/static/root/assets/{cron-expression-D8-c-Tkw.js → cron-expression-DlaQQOId.js} +1 -1
  21. package/dist/gateway/static/root/assets/{date-picker-kV-Jyl9J.js → date-picker-8R1sXJKb.js} +1 -1
  22. package/dist/gateway/static/root/assets/{dependency-picker-CwKcrfGj.js → dependency-picker-CWur0821.js} +1 -1
  23. package/dist/gateway/static/root/assets/{desktop-pet-D9rnchu3.js → desktop-pet-Knl-zNDU.js} +1 -1
  24. package/dist/gateway/static/root/assets/{desktop-pet-settings-CTs5WGzk.js → desktop-pet-settings-CAQMLVtd.js} +1 -1
  25. package/dist/gateway/static/root/assets/{directory-picker-path-field-CCl0aaDm.js → directory-picker-path-field-Caaz4Rw5.js} +1 -1
  26. package/dist/gateway/static/root/assets/{extension-debug-page-Cau40SvC.js → extension-debug-page-B965Mc15.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-page-BsJXdvIL.js → extension-page-C0UnkBi5.js} +1 -1
  28. package/dist/gateway/static/root/assets/{extension-settings-page-qWqJyF7-.js → extension-settings-page-BUSIAZCR.js} +1 -1
  29. package/dist/gateway/static/root/assets/{gateway-config-api-BI0SELXm.js → gateway-config-api-DkH0eEgy.js} +1 -1
  30. package/dist/gateway/static/root/assets/{gateway-settings-6ZdOIC7F.js → gateway-settings-BBgLDm6I.js} +1 -1
  31. package/dist/gateway/static/root/assets/{heartbeat-settings-KBwhXeFD.js → heartbeat-settings-BtEHVXWD.js} +1 -1
  32. package/dist/gateway/static/root/assets/{home-page-BA2M4CLi.js → home-page-5SU2TNJj.js} +1 -1
  33. package/dist/gateway/static/root/assets/{index-BX0dz1JK.js → index-BNWhgmjs.js} +8 -8
  34. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-kHtpnyEm.js → keyboard-shortcuts-settings-CsRz8NrS.js} +1 -1
  35. package/dist/gateway/static/root/assets/{local-app-workbench-page-D2nkn09R.js → local-app-workbench-page-DYPEUgpP.js} +1 -1
  36. package/dist/gateway/static/root/assets/{local-apps-page-BCXa0oUa.js → local-apps-page-CTBNUG4a.js} +1 -1
  37. package/dist/gateway/static/root/assets/{logs-page-D3sNst0K.js → logs-page-B0P7rG2B.js} +1 -1
  38. package/dist/gateway/static/root/assets/{management-settings-tHnlfOAQ.js → management-settings-YqUAEwQo.js} +1 -1
  39. package/dist/gateway/static/root/assets/{markdown-split-BMLqHHr5.js → markdown-split-dxpSCXb8.js} +1 -1
  40. package/dist/gateway/static/root/assets/{media-plugins-DybwqTgv.js → media-plugins-CJ00i1Lg.js} +1 -1
  41. package/dist/gateway/static/root/assets/{notes-page-C24SfF6r.js → notes-page-DEnbnkIt.js} +1 -1
  42. package/dist/gateway/static/root/assets/{notes-workbench-CTdZc3ov.js → notes-workbench-DmVYu_Oc.js} +2 -2
  43. package/dist/gateway/static/root/assets/{product-open-page-DBfCVlJq.js → product-open-page-BHxo9U95.js} +1 -1
  44. package/dist/gateway/static/root/assets/{project-detail-page-COHaEpbA.js → project-detail-page-DV2nGmsq.js} +1 -1
  45. package/dist/gateway/static/root/assets/{projects-page-lMnST7D_.js → projects-page-BNIFwFfc.js} +1 -1
  46. package/dist/gateway/static/root/assets/{remote-access-hub-BIRKBvO_.js → remote-access-hub-DLXqKiA_.js} +1 -1
  47. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BPEGTip5.js → runtime-tools-settings-panel-BpQ2GI-0.js} +1 -1
  48. package/dist/gateway/static/root/assets/{schema-form-Dxlu60Td.js → schema-form-HE1G26Lx.js} +1 -1
  49. package/dist/gateway/static/root/assets/{sessions-page-CATO9G3y.js → sessions-page-DWaXf_25.js} +1 -1
  50. package/dist/gateway/static/root/assets/settings-advanced-gate-JFCbnCL2.js +1 -0
  51. package/dist/gateway/static/root/assets/{settings-form-section-ChXh3Bwk.js → settings-form-section-CXAn0Xhy.js} +1 -1
  52. package/dist/gateway/static/root/assets/{settings-loading-skeleton-BCAUqIe2.js → settings-loading-skeleton-DsFu7Bcv.js} +1 -1
  53. package/dist/gateway/static/root/assets/{settings-page-D25W9Okr.js → settings-page-C4iib9nO.js} +1 -1
  54. package/dist/gateway/static/root/assets/{setup-status-panel-DsN7Z4Fl.js → setup-status-panel-BA83Wr1d.js} +1 -1
  55. package/dist/gateway/static/root/assets/{share-preview-page-CRFnUaNb.js → share-preview-page-BOGl3s6M.js} +1 -1
  56. package/dist/gateway/static/root/assets/{shares-settings-CAX0eNaP.js → shares-settings-Q2MdGaBi.js} +1 -1
  57. package/dist/gateway/static/root/assets/{skill-reload-api-Doy1gghe.js → skill-reload-api-cFtfVeFU.js} +1 -1
  58. package/dist/gateway/static/root/assets/{skills-page-Cl7jjTK7.js → skills-page-CdaFtNw9.js} +1 -1
  59. package/dist/gateway/static/root/assets/{skills-page.utils-BiCl4nb5.js → skills-page.utils-DYaAddUL.js} +1 -1
  60. package/dist/gateway/static/root/assets/{system-settings-panel-BuESR7ZT.js → system-settings-panel-Co7gilRd.js} +1 -1
  61. package/dist/gateway/static/root/assets/{task-detail-page-BRiy8NL3.js → task-detail-page-5B1pswu8.js} +1 -1
  62. package/dist/gateway/static/root/assets/{use-autosave-Dg1mgJ_l.js → use-autosave-DnnZtMpA.js} +1 -1
  63. package/dist/gateway/static/root/assets/{user-context-page-CqoADNKu.js → user-context-page-Dr1FKjXv.js} +1 -1
  64. package/dist/gateway/static/root/assets/{voice-api-key-field-BDNexlVR.js → voice-api-key-field-wetUpi3i.js} +1 -1
  65. package/dist/gateway/static/root/assets/{work-discovery-overlay-BHTfeaWL.js → work-discovery-overlay-tbTWASJJ.js} +1 -1
  66. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Cf_w-NZy.js → workflow-run-setup-panel-Dy0fDs8w.js} +1 -1
  67. package/dist/gateway/static/root/assets/{workflows-page-j0P-uECz.js → workflows-page-IVP3GSkI.js} +1 -1
  68. package/dist/gateway/static/root/index.html +1 -1
  69. package/dist/package.js +1 -1
  70. package/dist/src/agent/agent-instance-gateway.d.ts +1 -1
  71. package/dist/src/agent/agent-manager.d.ts +1 -1
  72. package/dist/src/agent/agent-manager.js +18 -3
  73. package/dist/src/agent/background-review/prompts.d.ts +8 -2
  74. package/dist/src/agent/background-review/prompts.js +25 -12
  75. package/dist/src/agent/background-review/run-background-review.d.ts +7 -2
  76. package/dist/src/agent/background-review/run-background-review.js +175 -160
  77. package/dist/src/agent/memory/index.d.ts +1 -1
  78. package/dist/src/agent/memory/index.js +2 -2
  79. package/dist/src/agent/memory/manager.d.ts +1 -11
  80. package/dist/src/agent/memory/manager.js +0 -16
  81. package/dist/src/agent/memory/understanding/service.d.ts +0 -11
  82. package/dist/src/agent/memory/understanding/service.js +7 -173
  83. package/dist/src/agent/memory/user-context-coordinator.d.ts +1 -3
  84. package/dist/src/agent/memory/user-context-coordinator.js +3 -66
  85. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
  86. package/dist/src/agent/service/direct-turn-helpers.js +1 -1
  87. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  88. package/dist/src/config/schema.d.ts +4 -0
  89. package/dist/src/config/schema.js +1 -0
  90. package/dist/src/connectors/connected-source-understanding.js +35 -21
  91. package/dist/src/connectors/learning-coordinator.js +1 -42
  92. package/dist/src/gateway/chat-stream/mapper.d.ts +2 -0
  93. package/dist/src/gateway/chat-stream/mapper.js +5 -0
  94. package/dist/src/gateway/hono/routes/understanding-sources.js +4 -1
  95. package/dist/src/gateway/hono/routes/you.js +29 -11
  96. package/dist/src/gateway/service/run-gateway-agent.js +5 -1
  97. package/dist/src/knowledge/index.d.ts +0 -1
  98. package/dist/src/knowledge/index.js +1 -2
  99. package/dist/src/notifications/planner.js +5 -1
  100. package/dist/src/storage/sqlite/index.d.ts +1 -1
  101. package/dist/src/storage/sqlite/index.js +2 -2
  102. package/dist/src/storage/sqlite/migrations/137_understanding_status_audit.sql +71 -0
  103. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  104. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  105. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  106. package/dist/src/storage/sqlite/schema.js +1 -1
  107. package/dist/src/storage/sqlite/user-context-repository.d.ts +16 -4
  108. package/dist/src/storage/sqlite/user-context-repository.js +56 -12
  109. package/dist/src/user-context/config.d.ts +8 -0
  110. package/dist/src/user-context/config.js +3 -0
  111. package/dist/src/user-context/consolidation.js +16 -4
  112. package/dist/src/user-context/extraction/executor.d.ts +22 -0
  113. package/dist/src/user-context/extraction/executor.js +142 -0
  114. package/dist/src/user-context/extraction/registry.d.ts +1 -1
  115. package/dist/src/user-context/extraction/registry.js +5 -34
  116. package/dist/src/user-context/extraction/repair.js +4 -1
  117. package/dist/src/user-context/extraction/semantic.d.ts +18 -0
  118. package/dist/src/user-context/extraction/semantic.js +148 -0
  119. package/dist/src/user-context/understandingQuality.js +4 -0
  120. package/dist/src/work-discovery/analyzer.js +9 -4
  121. package/dist/src/work-discovery/service.d.ts +1 -0
  122. package/dist/src/work-discovery/service.js +5 -4
  123. package/dist/src/work-discovery/types.d.ts +1 -0
  124. package/package.json +14 -8
  125. package/dist/gateway/static/root/assets/settings-advanced-gate-Cco_W41x.js +0 -1
  126. package/dist/src/agent/memory/understanding/correction.d.ts +0 -3
  127. package/dist/src/agent/memory/understanding/correction.js +0 -39
  128. package/dist/src/knowledge/connected-understanding-pipeline.d.ts +0 -17
  129. package/dist/src/knowledge/connected-understanding-pipeline.js +0 -278
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{l as r,o as i,r as a}from"./locale-store-CXhjfe4q.js";import{Er as o}from"./index-BX0dz1JK.js";import"./skill-reload-api-Doy1gghe.js";async function s(e,t){let n=new FormData;n.append(`file`,e),t.skillId&&n.append(`skillId`,t.skillId),t.overwrite&&n.append(`overwrite`,`true`),n.append(`target`,t.target??`global`);let i=r.getState().token,o=new Headers;i&&o.set(`Authorization`,`Bearer ${i}`);let s=await fetch(a(`/api/skills/upload`),{method:`POST`,headers:o,body:n});s.status===401&&r.getState().onUnauthorized();let c=await s.json().catch(()=>({}));if(!s.ok)throw Error(c.error||`HTTP ${s.status}`);if(!c.payload?.skillId)throw Error(`Invalid response`);return c.payload}async function c(e,t){let n=t?`?target=${encodeURIComponent(t)}`:``,r=await i(a(`/api/skills/${encodeURIComponent(e)}${n}`),{method:`DELETE`});if(!r.ok)throw Error(await o(r))}async function l(e,t){let n=await i(a(`/api/skills/enabled`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({skillName:e,enabled:t})});if(!n.ok)throw Error(await o(n))}function u(e,t){t?.trim()&&e.set(`provider`,t.trim())}async function d(e){let t=new URLSearchParams;u(t,e?.provider),e?.locale?.trim()&&t.set(`locale`,e.locale.trim());let n=t.toString(),r=await i(a(`/api/skills/marketplace/categories${n?`?${n}`:``}`),{cache:`no-store`});if(!r.ok)throw Error(await o(r));let s=await r.json();if(!s.payload||!Array.isArray(s.payload.items))throw Error(`Invalid response`);return{items:s.payload.items}}async function f(e){let t=new URLSearchParams;e.q?.trim()&&t.set(`q`,e.q.trim()),e.page!=null&&t.set(`page`,String(e.page)),e.pageSize!=null&&t.set(`pageSize`,String(e.pageSize)),e.sort&&t.set(`sort`,e.sort),e.category?.trim()&&t.set(`category`,e.category.trim()),u(t,e.provider);let n=t.toString(),r=await i(a(`/api/skills/marketplace${n?`?${n}`:``}`),{cache:`no-store`,signal:e.signal});if(!r.ok)throw Error(await o(r));let s=await r.json();if(!s.payload?.items||!s.payload.meta)throw Error(`Invalid response`);return s.payload}async function p(e,t){let n=encodeURIComponent(e),r=new URLSearchParams;u(r,t?.provider);let s=r.toString(),c=await i(a(`/api/skills/marketplace/packages/${n}${s?`?${s}`:``}`),{cache:`no-store`});if(!c.ok)throw Error(await o(c));let l=(await c.json()).payload;if(!l?.name||!l.skillDocPreview||typeof l.skillDocPreview.name!=`string`||typeof l.skillDocPreview.description!=`string`||typeof l.skillDocPreview.bodyMarkdown!=`string`||typeof l.skillDocPreview.disableModelInvocation!=`boolean`||!l.skillDocPreview.metadata||typeof l.skillDocPreview.metadata!=`object`||typeof l.skillDocPreview.metadata.name!=`string`||typeof l.skillDocPreview.metadata.description!=`string`)throw Error(`Invalid response`);return l}async function m(e){let t=await i(a(`/api/skills/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({target:`global`,...e})});if(!t.ok)throw Error(await o(t));let n=await t.json();if(!n.payload?.skillId)throw Error(n.error||`Invalid response`);return n.payload}async function h(e){let t=await i(a(`/api/skills/${encodeURIComponent(e)}/content`),{cache:`no-store`});if(!t.ok)throw Error(await o(t));let n=(await t.json()).payload;if(!n||typeof n.name!=`string`||typeof n.description!=`string`||typeof n.bodyMarkdown!=`string`||typeof n.disableModelInvocation!=`boolean`||!n.metadata||typeof n.metadata!=`object`||typeof n.metadata.name!=`string`||typeof n.metadata.description!=`string`)throw Error(`Invalid response`);return n}async function g(){let e=await i(a(`/api/skills/marketplace/provider`),{cache:`no-store`});if(!e.ok)throw Error(await o(e));let t=await e.json();if(!t.payload?.provider)throw Error(`Invalid response`);return t.payload}async function _(){let e=await i(a(`/api/skills/marketplace/providers`),{cache:`no-store`});if(!e.ok)throw Error(await o(e));let t=await e.json();if(!t.payload?.providers)throw Error(`Invalid response`);return t.payload}var v=e(),y=t(),b=[{light:`bg-sky-100 text-sky-800`,dark:`dark:bg-sky-950/55 dark:text-sky-200`},{light:`bg-violet-100 text-violet-800`,dark:`dark:bg-violet-950/55 dark:text-violet-200`},{light:`bg-emerald-100 text-emerald-800`,dark:`dark:bg-emerald-950/55 dark:text-emerald-200`},{light:`bg-orange-100 text-orange-800`,dark:`dark:bg-orange-950/55 dark:text-orange-200`},{light:`bg-rose-100 text-rose-800`,dark:`dark:bg-rose-950/55 dark:text-rose-200`},{light:`bg-amber-100 text-amber-900`,dark:`dark:bg-amber-950/55 dark:text-amber-200`},{light:`bg-cyan-100 text-cyan-800`,dark:`dark:bg-cyan-950/55 dark:text-cyan-200`},{light:`bg-indigo-100 text-indigo-800`,dark:`dark:bg-indigo-950/55 dark:text-indigo-200`},{light:`bg-fuchsia-100 text-fuchsia-800`,dark:`dark:bg-fuchsia-950/55 dark:text-fuchsia-200`},{light:`bg-teal-100 text-teal-800`,dark:`dark:bg-teal-950/55 dark:text-teal-200`}];function x(e){let t=0;for(let n=0;n<e.length;n+=1)t=Math.imul(31,t)+e.charCodeAt(n)|0;return Math.abs(t)}function S(e){let t=e.trim();if(!t)return`?`;let n=t.match(/[\p{L}\p{N}]/u);return n?n[0].toLocaleUpperCase(`en-US`):t[0]}function C(e){let t=(0,v.c)(9),{name:r,className:i}=e,a;t[0]===r?a=t[1]:(a=S(r),t[0]=r,t[1]=a);let o=a,s=b[x(r)%b.length],c;t[2]!==i||t[3]!==s.dark||t[4]!==s.light?(c=n(`flex size-11 shrink-0 items-center justify-center rounded-xl font-semibold tracking-tight shadow-surface`,`text-[1.05rem] ring-1 ring-inset ring-black/[0.06] dark:ring-white/[0.1]`,`transition-[transform,box-shadow] duration-200 ease-out group-hover:ring-black/[0.1] dark:group-hover:ring-white/[0.14]`,`group-hover:-translate-y-px`,s.light,s.dark,i),t[2]=i,t[3]=s.dark,t[4]=s.light,t[5]=c):c=t[5];let l;return t[6]!==o||t[7]!==c?(l=(0,y.jsx)(`div`,{className:c,"aria-hidden":!0,children:o}),t[6]=o,t[7]=c,t[8]=l):l=t[8],l}var w=`https://skillhub.cn`,T=`https://clawhub.ai`;function E(e){let t=e.trim();return t?`${w}/skills/${encodeURIComponent(t)}`:null}function D(e){let t=e.trim();return t?`${T}/${encodeURIComponent(t)}`:null}function O(e,t){return e===`skillhub`?E(t):e===`clawhub`?D(t):null}function k(e,t){return t===`store`?e.name.trim()||e.id:e.id.trim()||e.name}function A(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function j(e){return e.filter(e=>e.type!==`collision`)}function M(e){let t=[e.kind];return e.label?.trim()&&t.push(e.label.trim()),e.package?.trim()&&t.push(e.package.trim()),e.formula?.trim()&&t.push(e.formula.trim()),e.module?.trim()&&t.push(e.module.trim()),e.url?.trim()&&t.push(e.url.trim()),t.join(` · `)}function N(e){return{...e,enabled:e.enabled??!0,disableModelInvocation:e.disableModelInvocation??!1}}export{s as _,O as a,c,g as d,_ as f,l as g,m as h,k as i,d as l,h as m,M as n,N as o,f as p,A as r,C as s,j as t,p as u};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{l as r,o as i,r as a}from"./locale-store-CXhjfe4q.js";import{Er as o}from"./index-BNWhgmjs.js";import"./skill-reload-api-cFtfVeFU.js";async function s(e,t){let n=new FormData;n.append(`file`,e),t.skillId&&n.append(`skillId`,t.skillId),t.overwrite&&n.append(`overwrite`,`true`),n.append(`target`,t.target??`global`);let i=r.getState().token,o=new Headers;i&&o.set(`Authorization`,`Bearer ${i}`);let s=await fetch(a(`/api/skills/upload`),{method:`POST`,headers:o,body:n});s.status===401&&r.getState().onUnauthorized();let c=await s.json().catch(()=>({}));if(!s.ok)throw Error(c.error||`HTTP ${s.status}`);if(!c.payload?.skillId)throw Error(`Invalid response`);return c.payload}async function c(e,t){let n=t?`?target=${encodeURIComponent(t)}`:``,r=await i(a(`/api/skills/${encodeURIComponent(e)}${n}`),{method:`DELETE`});if(!r.ok)throw Error(await o(r))}async function l(e,t){let n=await i(a(`/api/skills/enabled`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({skillName:e,enabled:t})});if(!n.ok)throw Error(await o(n))}function u(e,t){t?.trim()&&e.set(`provider`,t.trim())}async function d(e){let t=new URLSearchParams;u(t,e?.provider),e?.locale?.trim()&&t.set(`locale`,e.locale.trim());let n=t.toString(),r=await i(a(`/api/skills/marketplace/categories${n?`?${n}`:``}`),{cache:`no-store`});if(!r.ok)throw Error(await o(r));let s=await r.json();if(!s.payload||!Array.isArray(s.payload.items))throw Error(`Invalid response`);return{items:s.payload.items}}async function f(e){let t=new URLSearchParams;e.q?.trim()&&t.set(`q`,e.q.trim()),e.page!=null&&t.set(`page`,String(e.page)),e.pageSize!=null&&t.set(`pageSize`,String(e.pageSize)),e.sort&&t.set(`sort`,e.sort),e.category?.trim()&&t.set(`category`,e.category.trim()),u(t,e.provider);let n=t.toString(),r=await i(a(`/api/skills/marketplace${n?`?${n}`:``}`),{cache:`no-store`,signal:e.signal});if(!r.ok)throw Error(await o(r));let s=await r.json();if(!s.payload?.items||!s.payload.meta)throw Error(`Invalid response`);return s.payload}async function p(e,t){let n=encodeURIComponent(e),r=new URLSearchParams;u(r,t?.provider);let s=r.toString(),c=await i(a(`/api/skills/marketplace/packages/${n}${s?`?${s}`:``}`),{cache:`no-store`});if(!c.ok)throw Error(await o(c));let l=(await c.json()).payload;if(!l?.name||!l.skillDocPreview||typeof l.skillDocPreview.name!=`string`||typeof l.skillDocPreview.description!=`string`||typeof l.skillDocPreview.bodyMarkdown!=`string`||typeof l.skillDocPreview.disableModelInvocation!=`boolean`||!l.skillDocPreview.metadata||typeof l.skillDocPreview.metadata!=`object`||typeof l.skillDocPreview.metadata.name!=`string`||typeof l.skillDocPreview.metadata.description!=`string`)throw Error(`Invalid response`);return l}async function m(e){let t=await i(a(`/api/skills/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({target:`global`,...e})});if(!t.ok)throw Error(await o(t));let n=await t.json();if(!n.payload?.skillId)throw Error(n.error||`Invalid response`);return n.payload}async function h(e){let t=await i(a(`/api/skills/${encodeURIComponent(e)}/content`),{cache:`no-store`});if(!t.ok)throw Error(await o(t));let n=(await t.json()).payload;if(!n||typeof n.name!=`string`||typeof n.description!=`string`||typeof n.bodyMarkdown!=`string`||typeof n.disableModelInvocation!=`boolean`||!n.metadata||typeof n.metadata!=`object`||typeof n.metadata.name!=`string`||typeof n.metadata.description!=`string`)throw Error(`Invalid response`);return n}async function g(){let e=await i(a(`/api/skills/marketplace/provider`),{cache:`no-store`});if(!e.ok)throw Error(await o(e));let t=await e.json();if(!t.payload?.provider)throw Error(`Invalid response`);return t.payload}async function _(){let e=await i(a(`/api/skills/marketplace/providers`),{cache:`no-store`});if(!e.ok)throw Error(await o(e));let t=await e.json();if(!t.payload?.providers)throw Error(`Invalid response`);return t.payload}var v=e(),y=t(),b=[{light:`bg-sky-100 text-sky-800`,dark:`dark:bg-sky-950/55 dark:text-sky-200`},{light:`bg-violet-100 text-violet-800`,dark:`dark:bg-violet-950/55 dark:text-violet-200`},{light:`bg-emerald-100 text-emerald-800`,dark:`dark:bg-emerald-950/55 dark:text-emerald-200`},{light:`bg-orange-100 text-orange-800`,dark:`dark:bg-orange-950/55 dark:text-orange-200`},{light:`bg-rose-100 text-rose-800`,dark:`dark:bg-rose-950/55 dark:text-rose-200`},{light:`bg-amber-100 text-amber-900`,dark:`dark:bg-amber-950/55 dark:text-amber-200`},{light:`bg-cyan-100 text-cyan-800`,dark:`dark:bg-cyan-950/55 dark:text-cyan-200`},{light:`bg-indigo-100 text-indigo-800`,dark:`dark:bg-indigo-950/55 dark:text-indigo-200`},{light:`bg-fuchsia-100 text-fuchsia-800`,dark:`dark:bg-fuchsia-950/55 dark:text-fuchsia-200`},{light:`bg-teal-100 text-teal-800`,dark:`dark:bg-teal-950/55 dark:text-teal-200`}];function x(e){let t=0;for(let n=0;n<e.length;n+=1)t=Math.imul(31,t)+e.charCodeAt(n)|0;return Math.abs(t)}function S(e){let t=e.trim();if(!t)return`?`;let n=t.match(/[\p{L}\p{N}]/u);return n?n[0].toLocaleUpperCase(`en-US`):t[0]}function C(e){let t=(0,v.c)(9),{name:r,className:i}=e,a;t[0]===r?a=t[1]:(a=S(r),t[0]=r,t[1]=a);let o=a,s=b[x(r)%b.length],c;t[2]!==i||t[3]!==s.dark||t[4]!==s.light?(c=n(`flex size-11 shrink-0 items-center justify-center rounded-xl font-semibold tracking-tight shadow-surface`,`text-[1.05rem] ring-1 ring-inset ring-black/[0.06] dark:ring-white/[0.1]`,`transition-[transform,box-shadow] duration-200 ease-out group-hover:ring-black/[0.1] dark:group-hover:ring-white/[0.14]`,`group-hover:-translate-y-px`,s.light,s.dark,i),t[2]=i,t[3]=s.dark,t[4]=s.light,t[5]=c):c=t[5];let l;return t[6]!==o||t[7]!==c?(l=(0,y.jsx)(`div`,{className:c,"aria-hidden":!0,children:o}),t[6]=o,t[7]=c,t[8]=l):l=t[8],l}var w=`https://skillhub.cn`,T=`https://clawhub.ai`;function E(e){let t=e.trim();return t?`${w}/skills/${encodeURIComponent(t)}`:null}function D(e){let t=e.trim();return t?`${T}/${encodeURIComponent(t)}`:null}function O(e,t){return e===`skillhub`?E(t):e===`clawhub`?D(t):null}function k(e,t){return t===`store`?e.name.trim()||e.id:e.id.trim()||e.name}function A(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function j(e){return e.filter(e=>e.type!==`collision`)}function M(e){let t=[e.kind];return e.label?.trim()&&t.push(e.label.trim()),e.package?.trim()&&t.push(e.package.trim()),e.formula?.trim()&&t.push(e.formula.trim()),e.module?.trim()&&t.push(e.module.trim()),e.url?.trim()&&t.push(e.url.trim()),t.join(` · `)}function N(e){return{...e,enabled:e.enabled??!0,disableModelInvocation:e.disableModelInvocation??!1}}export{s as _,O as a,c,g as d,_ as f,l as g,m as h,k as i,d as l,h as m,M as n,N as o,f as p,A as r,C as s,j as t,p as u};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./cn-JdwAhgNB.js";import{n as a}from"./interaction-BmQogeqz.js";import{t as o}from"./messages-BMdD0LWk.js";import{n as s}from"./locale-store-CXhjfe4q.js";import{t as c}from"./electron-env-DH5wF8X8.js";import{Gn as l,Gs as u,Kn as d,Wn as f,Ya as p,nc as m,qn as h,ru as g}from"./index-BX0dz1JK.js";import{n as _,r as v}from"./settings-page-layout-BRQNel6r.js";import{r as y,t as b}from"./settings-form-section-ChXh3Bwk.js";var x=e(t(),1);async function S(e,t){let n=window.electronAPI?.system;if(!c()||!n?.requestNotifications)return`unsupported`;let r=await n.requestNotifications();if(r.status!==`granted`)return r.outcome===`opened-settings`||r.status===`denied`?`denied`:`default`;await n.setBehavior({notifyEnabled:!0});let i=await n.showEndpointNotification({title:e,body:t});return i.ok||await n.setBehavior({notifyEnabled:!1}),i.ok?`enabled`:`default`}var C=n();function w(){let e=o(s(e=>e.language)).systemSettings.browserNotify,[t,n]=(0,x.useState)(d),[r,i]=(0,x.useState)(null),[a,c]=(0,x.useState)(!1),u=async t=>{if(!t){n(h({enabled:!1})),i(null);return}c(!0);try{let t=await f();if(t!==`granted`){i(t===`unsupported`?e.unsupported:e.denied);return}n(h({enabled:!0})),i(await l(e.testTitle,e.testBody)?e.testShown:e.failed)}finally{c(!1)}},p=e=>{n(h(e))};return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:e.pageTitle}),(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(g,{className:`size-4 text-accent`,strokeWidth:1.75}),e.title]}),(0,C.jsx)(`p`,{className:`mb-4 text-sm text-fg-muted`,children:e.description}),(0,C.jsx)(`div`,{className:`space-y-2`,children:[[`enabled`,e.enabled,e.enabledDesc],[`completed`,e.completed,e.completedDesc],[`failed`,e.failedRuns,e.failedRunsDesc]].map(([e,n,r])=>(0,C.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),(0,C.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:r})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:a||e!==`enabled`&&!t.enabled,checked:t[e],onChange:t=>{e===`enabled`?u(t.target.checked):p({[e]:t.target.checked})}})]},e))}),r?(0,C.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,role:`status`,children:r}):null,(0,C.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:e.limitation})]})]})}async function T(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function E(e,t,n){return e.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function D(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function O(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function k(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var A=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function j(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||A.has(e)?t===`unknown`:!1}function M(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:A.has(e)?t===`denied`:!0}var N=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function P(e){return e===`linux`?N:N.filter(t=>!t.platforms||t.platforms.includes(e))}function F(e,t){let n=o(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function I(e,t,n){let r=o(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var L={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function R(){let e=s(e=>e.language),t=o(e).systemSettings,[n,l]=(0,x.useReducer)(p,L),{behavior:d,perms:f,loadError:h,permFeedback:g,permBusy:A,refreshing:N}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,x.useCallback)(async e=>{if(R){l({type:`patch`,patch:{loadError:null}});try{l({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){l({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[R,t.refreshDone]),B=(0,x.useCallback)(async()=>{if(!(N||A)){l({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{l({type:`patch`,patch:{refreshing:!1}})}}},[z,A,N]);if((0,x.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!g||!e.has(g))return;let n=window.setTimeout(()=>{l({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[g,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,x.useEffect)(()=>{c()&&R&&z()},[R,z]),!c()||!R)return(0,C.jsx)(w,{});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);l({type:`patch`,patch:{behavior:t}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}l({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await S(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){l({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){l({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){l({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{l({type:`patch`,patch:{permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?l({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):l({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=e.outcome===`opened-settings`||e.status===`denied`?!1:await T();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:E(e,n,t.permFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:D(e,t.accessibilityFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:O(e,t.notificationsFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:k(e,t.screenFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},J=d?d.platform===`win32`?t.permissionsHintWin:d.platform===`linux`?t.permissionsHintLinux:d.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:t.title}),h?(0,C.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:h}):null,g?(0,C.jsx)(`p`,{className:i(`text-sm`,g===t.refreshDone||g===t.openSettingsDone||g===t.permFeedback.granted||g===t.permFeedback.alreadyGranted||g===t.accessibilityFeedback.granted||g===t.accessibilityFeedback.alreadyGranted||g===t.notificationsFeedback.granted||g===t.notificationsFeedback.alreadyGranted||g===t.screenFeedback.granted||g===t.screenFeedback.alreadyGranted||g===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:g}):null,(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(u,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d,checked:!!d?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d,checked:!!d?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d||A,checked:!!d?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d,checked:!!d?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),d&&f?(0,C.jsxs)(`section`,{className:y(),children:[(0,C.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),d.platform===`darwin`&&!d.packaged?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,C.jsxs)(`button`,{type:`button`,disabled:N||A,"aria-busy":N,className:i(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,a.press),onClick:()=>void B(),children:[(0,C.jsx)(m,{className:i(`size-3.5`,N&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),N?t.refreshing:t.refresh]})]}),(0,C.jsx)(`ul`,{className:`space-y-3`,children:P(d.platform).map(({key:n,pane:o})=>{let s=F(e,f[n]),c=t.perm[n],l=f[n]===`unknown`?I(e,n,d.platform):null;return c?(0,C.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:c.title}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:c.desc}),(0,C.jsx)(`p`,{className:`mt-1 text-xs font-medium ${s.className}`,children:s.label}),l?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:l}):null]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&j(n,f[n],d.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,a.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&j(n,f[n],d.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,a.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&j(n,f[n],d.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,a.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&j(n,f[n],d.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,a.press),onClick:()=>void q(),children:t.requestAccess}):null,M(n,f[n],d.platform)?(0,C.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,a.press),onClick:()=>void U(o),children:[t.openSettings,(0,C.jsx)(r,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{R as SystemSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./cn-JdwAhgNB.js";import{n as a}from"./interaction-BmQogeqz.js";import{t as o}from"./messages-BMdD0LWk.js";import{n as s}from"./locale-store-CXhjfe4q.js";import{t as c}from"./electron-env-DH5wF8X8.js";import{Gn as l,Gs as u,Kn as d,Wn as f,Ya as p,nc as m,qn as h,ru as g}from"./index-BNWhgmjs.js";import{n as _,r as v}from"./settings-page-layout-BRQNel6r.js";import{r as y,t as b}from"./settings-form-section-CXAn0Xhy.js";var x=e(t(),1);async function S(e,t){let n=window.electronAPI?.system;if(!c()||!n?.requestNotifications)return`unsupported`;let r=await n.requestNotifications();if(r.status!==`granted`)return r.outcome===`opened-settings`||r.status===`denied`?`denied`:`default`;await n.setBehavior({notifyEnabled:!0});let i=await n.showEndpointNotification({title:e,body:t});return i.ok||await n.setBehavior({notifyEnabled:!1}),i.ok?`enabled`:`default`}var C=n();function w(){let e=o(s(e=>e.language)).systemSettings.browserNotify,[t,n]=(0,x.useState)(d),[r,i]=(0,x.useState)(null),[a,c]=(0,x.useState)(!1),u=async t=>{if(!t){n(h({enabled:!1})),i(null);return}c(!0);try{let t=await f();if(t!==`granted`){i(t===`unsupported`?e.unsupported:e.denied);return}n(h({enabled:!0})),i(await l(e.testTitle,e.testBody)?e.testShown:e.failed)}finally{c(!1)}},p=e=>{n(h(e))};return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:e.pageTitle}),(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(g,{className:`size-4 text-accent`,strokeWidth:1.75}),e.title]}),(0,C.jsx)(`p`,{className:`mb-4 text-sm text-fg-muted`,children:e.description}),(0,C.jsx)(`div`,{className:`space-y-2`,children:[[`enabled`,e.enabled,e.enabledDesc],[`completed`,e.completed,e.completedDesc],[`failed`,e.failedRuns,e.failedRunsDesc]].map(([e,n,r])=>(0,C.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),(0,C.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:r})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:a||e!==`enabled`&&!t.enabled,checked:t[e],onChange:t=>{e===`enabled`?u(t.target.checked):p({[e]:t.target.checked})}})]},e))}),r?(0,C.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,role:`status`,children:r}):null,(0,C.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:e.limitation})]})]})}async function T(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function E(e,t,n){return e.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function D(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function O(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function k(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var A=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function j(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||A.has(e)?t===`unknown`:!1}function M(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:A.has(e)?t===`denied`:!0}var N=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function P(e){return e===`linux`?N:N.filter(t=>!t.platforms||t.platforms.includes(e))}function F(e,t){let n=o(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function I(e,t,n){let r=o(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var L={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function R(){let e=s(e=>e.language),t=o(e).systemSettings,[n,l]=(0,x.useReducer)(p,L),{behavior:d,perms:f,loadError:h,permFeedback:g,permBusy:A,refreshing:N}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,x.useCallback)(async e=>{if(R){l({type:`patch`,patch:{loadError:null}});try{l({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){l({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[R,t.refreshDone]),B=(0,x.useCallback)(async()=>{if(!(N||A)){l({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{l({type:`patch`,patch:{refreshing:!1}})}}},[z,A,N]);if((0,x.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!g||!e.has(g))return;let n=window.setTimeout(()=>{l({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[g,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,x.useEffect)(()=>{c()&&R&&z()},[R,z]),!c()||!R)return(0,C.jsx)(w,{});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);l({type:`patch`,patch:{behavior:t}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}l({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await S(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){l({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){l({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){l({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{l({type:`patch`,patch:{permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?l({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):l({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=e.outcome===`opened-settings`||e.status===`denied`?!1:await T();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:E(e,n,t.permFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:D(e,t.accessibilityFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:O(e,t.notificationsFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:k(e,t.screenFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},J=d?d.platform===`win32`?t.permissionsHintWin:d.platform===`linux`?t.permissionsHintLinux:d.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:t.title}),h?(0,C.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:h}):null,g?(0,C.jsx)(`p`,{className:i(`text-sm`,g===t.refreshDone||g===t.openSettingsDone||g===t.permFeedback.granted||g===t.permFeedback.alreadyGranted||g===t.accessibilityFeedback.granted||g===t.accessibilityFeedback.alreadyGranted||g===t.notificationsFeedback.granted||g===t.notificationsFeedback.alreadyGranted||g===t.screenFeedback.granted||g===t.screenFeedback.alreadyGranted||g===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:g}):null,(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(u,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d,checked:!!d?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d,checked:!!d?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d||A,checked:!!d?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!d,checked:!!d?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),d&&f?(0,C.jsxs)(`section`,{className:y(),children:[(0,C.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),d.platform===`darwin`&&!d.packaged?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,C.jsxs)(`button`,{type:`button`,disabled:N||A,"aria-busy":N,className:i(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,a.press),onClick:()=>void B(),children:[(0,C.jsx)(m,{className:i(`size-3.5`,N&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),N?t.refreshing:t.refresh]})]}),(0,C.jsx)(`ul`,{className:`space-y-3`,children:P(d.platform).map(({key:n,pane:o})=>{let s=F(e,f[n]),c=t.perm[n],l=f[n]===`unknown`?I(e,n,d.platform):null;return c?(0,C.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:c.title}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:c.desc}),(0,C.jsx)(`p`,{className:`mt-1 text-xs font-medium ${s.className}`,children:s.label}),l?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:l}):null]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&j(n,f[n],d.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,a.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&j(n,f[n],d.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,a.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&j(n,f[n],d.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,a.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&j(n,f[n],d.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,a.press),onClick:()=>void q(),children:t.requestAccess}):null,M(n,f[n],d.platform)?(0,C.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,a.press),onClick:()=>void U(o),children:[t.openSettings,(0,C.jsx)(r,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{R as SystemSettingsPanel};
@@ -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{d as i,l as a,p as o,t as s}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as c,r as l}from"./popover-select-CccGri5Y.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./ellipsis-0k4rZLoy.js";import{t as f}from"./external-link-DjqjBmc3.js";import{d as p,p as m,t as h}from"./markdown-view-DvM5PWEH.js";import{t as g}from"./x-B_N4OPjy.js";import{t as _}from"./cn-JdwAhgNB.js";import{t as v}from"./button-CSEbl4zT.js";import{l as ee,n as te}from"./locale-store-CXhjfe4q.js";import{i as y,n as ne,o as re,r as ie,s as ae,t as oe}from"./dist-BPoKqzeH.js";import{$ as b,Ai as se,B as x,Bi as S,Bn as ce,Ec as le,Fa as ue,Hi as C,Hn as de,I as fe,J as pe,Jr as me,Kr as he,L as w,Ml as T,Nl as E,P as ge,Q as D,Qr as _e,Vi as O,Vn as ve,W as ye,X as k,Xr as A,Yr as j,Zr as M,_o as N,at as P,dl as F,gc as I,lu as be,n as xe,no as Se,qr as Ce,to as we,uc as Te,ul as Ee}from"./index-BX0dz1JK.js";import{t as De}from"./date-picker-kV-Jyl9J.js";import{t as Oe}from"./dependency-picker-CwKcrfGj.js";var L=e(t(),1),R=n();function ke(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Ae(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}var z=r();function B(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function je(){let e=(0,R.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,z.jsx)(Se,{className:`h-32 rounded-2xl`}),(0,z.jsx)(Se,{className:`h-52 rounded-2xl`}),(0,z.jsx)(Se,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Me(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Ne(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var V=[`backlog`,`ready`,`active`,`review`,`closed`],Pe=[`low`,`normal`,`high`,`critical`],Fe=(0,L.memo)(function(e){let t=(0,R.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:u,onChange:d}=e,f;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(f=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=f):f=t[4];let p=f,m;t[5]===u?m=t[6]:(m=(0,z.jsx)(`span`,{children:u}),t[5]=u,t[6]=m);let h;t[7]===d?h=t[8]:(h=e=>d(e.target.value),t[7]=d,t[8]=h);let g;t[9]!==s||t[10]!==p?(g=V.map(e=>(0,z.jsx)(l,{value:e,disabled:p(e),children:B(e,s)},e)),t[9]=s,t[10]=p,t[11]=g):g=t[11];let _;t[12]!==r||t[13]!==h||t[14]!==g||t[15]!==n?(_=(0,z.jsx)(c,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:h,children:g}),t[12]=r,t[13]=h,t[14]=g,t[15]=n,t[16]=_):_=t[16];let v;return t[17]!==m||t[18]!==_?(v=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19],v}),Ie=(0,L.memo)(function(e){let t=(0,R.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,z.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let u;t[2]===o?u=t[3]:(u=e=>o(e.target.value),t[2]=o,t[3]=u);let d;t[4]===a?d=t[5]:(d=Pe.map(e=>(0,z.jsx)(l,{value:e,children:a[e]},e)),t[4]=a,t[5]=d);let f;t[6]!==r||t[7]!==u||t[8]!==d||t[9]!==n?(f=(0,z.jsx)(c,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:u,children:d}),t[6]=r,t[7]=u,t[8]=d,t[9]=n,t[10]=f):f=t[10];let p;return t[11]!==s||t[12]!==f?(p=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,f]}),t[11]=s,t[12]=f,t[13]=p):p=t[13],p}),Le=(0,L.memo)(function(e){let t=(0,R.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,z.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,z.jsx)(De,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Re=(0,L.memo)(function(e){let t=(0,R.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:s}=e,u;t[0]===i?u=t[1]:(u=(0,z.jsx)(`span`,{children:i}),t[0]=i,t[1]=u);let d;t[2]===s?d=t[3]:(d=e=>s(e.target.value),t[2]=s,t[3]=d);let f;t[4]===a?f=t[5]:(f=(0,z.jsx)(l,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=f);let p;t[6]===o?p=t[7]:(p=o.map(tt),t[6]=o,t[7]=p);let m;t[8]!==r||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==n?(m=(0,z.jsxs)(c,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:d,children:[f,p]}),t[8]=r,t[9]=d,t[10]=f,t[11]=p,t[12]=n,t[13]=m):m=t[13];let h;return t[14]!==u||t[15]!==m?(h=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[u,m]}),t[14]=u,t[15]=m,t[16]=h):h=t[16],h}),ze=(0,L.memo)(function(e){let t=(0,R.c)(8),{candidates:n,selected:r,disabled:i,labels:a,onChange:o}=e,s;t[0]===r?s=t[1]:(s=r.map(K),t[0]=r,t[1]=s);let c;return t[2]!==n||t[3]!==i||t[4]!==a||t[5]!==o||t[6]!==s?(c=(0,z.jsx)(Oe,{borderless:!0,candidates:n,selectedIds:s,disabled:i,onChange:o,labels:a}),t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),Be=`xopc.taskDetail.chatPanelPercent`,Ve=42;function He(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?Ve:Math.min(r,Math.max(n,e))}function Ue(){try{let e=Number(window.localStorage.getItem(Be));return Number.isFinite(e)&&e>=30&&e<=60?e:Ve}catch{return Ve}}function We(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`)?`needsUser`:e.operationalState===`idle`?e.task.phase===`backlog`?`captured`:e.task.phase===`ready`?`ready`:e.task.phase===`review`?`review`:`paused`:e.operationalState}function H(e){let t=(0,R.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,z.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,z.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,z.jsx)(t===`passed`?u:t===`failed`?E:T,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,z.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,z.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function Ge({taskId:e,presentation:t,backgroundPath:n,onDeleted:r}){let[i]=o(),c=a(),l=te(e=>e.language),g=ee(e=>e.token),y=(0,L.useMemo)(()=>b(l),[l]),ne=N(e=>e.setPageHeader),re=N(e=>e.clearPageHeader),ie=C(e=>e.open),ae=C(e=>e.sessionKeyOverride),oe=C(e=>e.openForSession),de=_e(e=>e.setOpen),{data:T,error:E,mutate:O,lastChange:Se,conversationLoading:De,conversationError:Oe}=ge(e),[R,B]=(0,L.useState)(null),[V,Pe]=(0,L.useState)(()=>new Set),[Ge,Ke]=(0,L.useState)([]),[U,qe]=(0,L.useState)(null),[Je,Ye]=(0,L.useState)([]),[Xe,W]=(0,L.useState)(!1),[Ze,Qe]=(0,L.useState)(``),[$e,G]=(0,L.useState)(!1),[et,tt]=(0,L.useState)(``),[K,nt]=(0,L.useState)(Ue),[rt,it]=(0,L.useState)(!1),at=(0,L.useRef)(null),ot=(0,L.useRef)(!1),st=(0,L.useRef)(!1),ct=(0,L.useRef)(``),lt=(0,L.useRef)(null),ut=(0,L.useRef)(null),dt=(0,L.useRef)(null),ft=(0,L.useRef)(T),[pt,q]=(0,L.useState)(null),[mt,ht]=(0,L.useState)(null),[gt,_t]=(0,L.useState)(!1),vt=(0,L.useMemo)(()=>({link:y.linkDependencies,linked:y.linkedDependencies,searchPlaceholder:y.dependencySearchPlaceholder,noMatches:y.noDependencyMatches,noCandidates:y.noDependencyCandidates,remove:y.removeDependency}),[y.dependencySearchPlaceholder,y.linkDependencies,y.linkedDependencies,y.noDependencyCandidates,y.noDependencyMatches,y.removeDependency]),yt=T?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,bt=(0,L.useMemo)(()=>p(i.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[i]);ft.current=T;let J=(0,L.useCallback)((e,t)=>{Pe(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,L.useEffect)(()=>{B(null),q(null),W(!1),G(!1),ht(null),_t(!1)},[e]),(0,L.useEffect)(()=>{let e=!0;return we().then(t=>{e&&Ye(t.items)}).catch(()=>void 0),()=>{e=!1}},[g]),(0,L.useEffect)(()=>{if(!Se||Se.source===`user`)return;ht(Se);let e=window.setTimeout(()=>ht(null),3500);return()=>window.clearTimeout(e)},[Se]),(0,L.useEffect)(()=>{let t=T?.task.projectId,n=T?.dependencies??[];if(!t){dt.current=null,qe(null),Ke(n);return}dt.current!==t&&(dt.current=t,qe(null));let r=!0;return ue(t).then(t=>{if(!r)return;qe(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});Ke([...i.values()])}).catch(()=>{r&&Ke(n)}),()=>{r=!1}},[yt,T?.task.projectId,e]);let Y=(0,L.useCallback)(async(t,n=`command`)=>{let r=ft.current;if(r){J(n,!0),B(null);try{await O(await w(e,t,r.task.version),{revalidate:!1})}catch{B(y.actionFailed)}finally{J(n,!1)}}},[y.actionFailed,O,J,e]),X=(0,L.useCallback)(async(t,n)=>{let r=ft.current;if(!r)return!1;n&&J(n,!0),B(null);try{return await O(k(e,t,r.task.version),{optimisticData:Ae(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return B(y.actionFailed),!1}finally{n&&J(n,!1)}},[y.actionFailed,O,J,e]),xt=async()=>{if(!T)return;if(ot.current){ot.current=!1;return}let e=Ze.trim(),t=lt.current;if(ke(t,T.task.version,T.task.title,e)){q(`title`);return}if(!e||e===T.task.title){Qe(T.task.title),W(!1);return}await X({title:e})&&(q(null),W(!1))},St=async()=>{if(!T)return;if(st.current){st.current=!1;return}let e=et.trim(),t=ut.current;if(ke(t,T.task.version,T.task.body??``,e)){q(`description`);return}if(et===ct.current||e===(T.task.body??``).trim()){G(!1);return}await X({body:e||null})&&(q(null),G(!1))},Ct=(0,L.useCallback)(async e=>{let t=ft.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await Y({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await Y({type:`close`,resolution:`done`},`phase`);return}await Y({type:`move`,phase:e},`phase`)}},[Y]),wt=(0,L.useCallback)(e=>{X({priority:e},`priority`)},[X]),Tt=(0,L.useCallback)(e=>{X({dueAt:Ne(e)},`dueAt`)},[X]),Et=(0,L.useCallback)(e=>{nt(e);try{window.localStorage.setItem(Be,String(e))}catch{}},[]),Dt=(0,L.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=at.current?.clientWidth??0;Et(He(e.key===`Home`?Ve:K+(e.key===`ArrowLeft`?2:-2),t))},[K,Et]),Ot=(0,L.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=at.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),it(!0);let i=K,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=He((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}it(!1),Et(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[K,Et]),kt=(0,L.useCallback)(async t=>{let n=ft.current;if(n){J(`dependencies`,!0),B(null);try{await O(await D(e,t,n.task.version),{revalidate:!1})}catch{B(y.dependencyUpdateFailed)}finally{J(`dependencies`,!1)}}},[y.dependencyUpdateFailed,O,J,e]),At=(0,L.useCallback)(async t=>{let n=ft.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){J(`delegateAgentId`,!0),B(null);try{await O(await ye(e,t,n.task.version),{revalidate:!1})}catch{B(y.actionFailed)}finally{J(`delegateAgentId`,!1)}}},[y.actionFailed,O,J,e]),jt=(0,L.useCallback)(async()=>{J(`delete`,!0),B(null);try{await x(e),r?r():c(bt,{replace:!0})}catch(e){B(e instanceof Error?e.message:y.actionFailed)}finally{J(`delete`,!1)}},[y.actionFailed,c,r,bt,J,e]);if((0,L.useLayoutEffect)(()=>{if(t!==`modal`)return ne({startExtra:(0,z.jsx)(s,{to:bt,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":y.backToWork,children:(0,z.jsx)(be,{className:`size-4`})}),main:T?(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:U?`${U} / ${y.taskLabel}`:y.taskLabel}),(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:y.detailStatuses[We(T)]})]}):null,end:null}),re},[re,y.backToWork,y.detailStatuses,y.taskLabel,T,t,U,bt,ne]),E&&!T)return(0,z.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:y.taskNotFound});if(!T)return(0,z.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,z.jsx)(je,{})});let Mt=T.waits[0],Nt=Mt?.kind===`paused`?Mt:void 0,Z=T.receipts[0],Pt=y.detailStatuses[We(T)],Ft=y.detailStatusDescriptions[We(T)],It=T.task.body?.trim()||T.task.contract?.objective.trim(),Lt=new Map(Z?.verification.checks.map(e=>[e.criterion,e.status])),Rt=T.allowedCommands.includes(`mark_ready`),zt=T.allowedCommands.includes(`start`),Bt=T.allowedCommands.includes(`add_wait`),Vt=T.task.phase===`review`&&T.allowedCommands.includes(`close`),Ht=T.allowedCommands.includes(`reopen`),Ut=T.conversation.activeSessionKey,Wt=T.conversation.currentExecutorAgentId??T.task.delegateAgentId??T.task.ownerId,Gt=Je.find(e=>e.id===Wt),Kt=!!(Ut&&ie&&ae===Ut),qt=T.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Jt=T.task.contract?.acceptanceCriteria??[],Yt=Jt.filter(e=>Lt.get(e)===`passed`).length,Xt=T.task.contract?.expectedOutputs??[],Zt=T.task.contract?.constraints??[],Qt=T.task.contract?.approvalRequired??[],$t=T.task.contract?.assumptions??[],en=T.task.contract?.risks??[],Q=(...e)=>!!mt?.changedFields.some(t=>e.includes(t)),tn=e=>t===`modal`&&n?ve(n,e):m(`/tasks/${e}`,bt),nn=T.allowedCommands.includes(`move`),$=V.has(`command`),rn=V.has(`delete`),an=T.runs.find(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),on=an!==void 0,sn=(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Rt?(0,z.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void Y({type:`mark_ready`}),children:[(0,z.jsx)(Te,{className:`size-4`}),y.scheduleTask]}):null,Nt?(0,z.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void Y({type:`resolve_wait`,waitId:Nt.id}),children:[(0,z.jsx)(Te,{className:`size-4`}),y.resumeTask]}):null,!Mt&&zt&&Wt?(0,z.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void Y({type:`start`,executor:{kind:`agent`,agentId:Wt}}),children:[(0,z.jsx)(Te,{className:`size-4`}),y.runTask]}):null,Vt?(0,z.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void Y({type:`close`,resolution:`done`}),children:[(0,z.jsx)(u,{className:`size-4`}),y.approveTask]}):null,Ht?(0,z.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void Y({type:`reopen`,phase:`ready`}),children:[(0,z.jsx)(Te,{className:`size-4`}),y.reopenTask]}):null,!Mt&&Bt?(0,z.jsxs)(v,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:$,onClick:()=>void Y({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,z.jsx)(I,{className:`size-4`}),y.pauseTask]}):null,(0,z.jsxs)(j,{children:[(0,z.jsx)(M,{asChild:!0,children:(0,z.jsx)(v,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:$||rn,"aria-label":y.moreActions,children:(0,z.jsx)(d,{className:`size-4`,"aria-hidden":!0})})}),(0,z.jsx)(me,{children:(0,z.jsxs)(he,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[an?(0,z.jsx)(Ce,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{J(`command`,!0),B(null),O(fe(e,an.id,an.version),{revalidate:!1}).catch(()=>B(y.actionFailed)).finally(()=>J(`command`,!1))},children:y.cancelActiveRun}):null,an?(0,z.jsx)(A,{className:`my-1 h-px bg-edge`}):null,T.task.phase===`closed`?null:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Ce,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void Y({type:`close`,resolution:`cancelled`}),children:y.cancelTask}),(0,z.jsx)(A,{className:`my-1 h-px bg-edge`})]}),(0,z.jsx)(Ce,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{if(on){B(y.deleteActiveTaskBlocked);return}_t(!0)},children:y.deleteTask})]})})]})]});return(0,z.jsxs)(`div`,{ref:at,className:`${t===`modal`?`flex h-full min-h-0 flex-col lg:flex-row`:`flex min-h-[calc(100dvh-8rem)] flex-col overflow-hidden lg:flex-row`} ${rt?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${K}%`},children:[(0,z.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,z.jsxs)(`header`,{className:_(`px-4 pb-5`,Q(`title`)&&`task-detail-live-update`),children:[(0,z.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[U?(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,z.jsx)(F,{className:`size-3.5`,"aria-hidden":!0}),U]}):null,(0,z.jsx)(`span`,{children:`/`}),(0,z.jsx)(`span`,{children:y.taskLabel}),mt?(0,z.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:mt.source===`agent`?l===`zh`?`Agent 刚刚更新`:`Updated by Agent`:l===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),Xe?(0,z.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:Ze,onChange:e=>Qe(e.target.value),onBlur:()=>void xt(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),ot.current=!0,Qe(T.task.title),W(!1),queueMicrotask(()=>{ot.current=!1}))},className:`mt-3 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-2xl font-semibold leading-8 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,z.jsx)(`button`,{type:`button`,className:`mt-3 block max-w-3xl rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{lt.current={value:T.task.title,version:T.task.version},q(null),Qe(T.task.title),W(!0)},children:(0,z.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:T.task.title})}),pt===`title`?(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,z.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Qe(T.task.title),q(null),W(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void X({title:Ze.trim()}).then(e=>{e&&(q(null),W(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),R?(0,z.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:R}):null]}),(0,z.jsxs)(`div`,{className:`mt-5 flex flex-col gap-5`,children:[(0,z.jsxs)(`main`,{className:`order-2 min-w-0 space-y-5`,children:[(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`body`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.taskDescription}),$e?(0,z.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:et,onChange:e=>tt(e.target.value),onBlur:()=>void St(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),st.current=!0,tt(T.task.body??T.task.contract?.objective??``),G(!1),queueMicrotask(()=>{st.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,z.jsx)(`button`,{type:`button`,className:`-mx-1 mt-2 block w-[calc(100%+0.5rem)] rounded-lg px-1 py-1 text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=T.task.body??T.task.contract?.objective??``;ct.current=e,ut.current={value:T.task.body??``,version:T.task.version},q(null),tt(e),G(!0)},children:(0,z.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:It&&It!==T.task.title?It:y.noTaskDescription})}),pt===`description`?(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,z.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{tt(T.task.body??``),q(null),G(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void X({body:et.trim()||null}).then(e=>{e&&(q(null),G(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),T.attention.length>0?(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-warning/10 p-4`,Q(`attention`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h3`,{className:`font-medium text-fg`,children:qt?y.needsAttention:y.waitingStatus}),(0,z.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:T.attention.map((e,t)=>(0,z.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`contract`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.taskDefinition}),(0,z.jsxs)(`div`,{className:`mt-5`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:y.successDefinition}),Jt.length>0?(0,z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:y.criteriaProgress.replace(`{{verified}}`,String(Yt)).replace(`{{total}}`,String(Jt.length))}):null]}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:Jt,empty:y.noDefinition,verificationByCriterion:Lt})})]}),Xt.length>0?(0,z.jsxs)(`div`,{className:`mt-5 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:y.expectedOutputs}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:Xt,empty:y.noDefinition})})]}):null,Zt.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:y.constraints}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:Zt,empty:y.noDefinition})})]}):null,Qt.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:y.approvalRequired}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:Qt,empty:y.noDefinition})})]}):null,$t.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:y.contextAssumptions}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:$t,empty:y.noDefinition})})]}):null,en.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:y.contextRisks}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:en,empty:y.noDefinition})})]}):null]}),Z?(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.latestResult}),(0,z.jsx)(h,{content:Z.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`})]}),(0,z.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[y.receiptStatuses[Z.status],` · `,y.verificationStatuses[Z.verification.status]]})]}),Z.remainingWork.length>0?(0,z.jsxs)(`div`,{className:`mt-4`,children:[(0,z.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:y.remainingWork}),(0,z.jsx)(`div`,{className:`mt-2`,children:(0,z.jsx)(H,{items:Z.remainingWork,empty:y.noRemainingWork})})]}):null,Z.nextAction?(0,z.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,z.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:y.nextAction}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:Z.nextAction})]}):null,(0,z.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(v,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void pe(Z.runId,`helpful`),children:y.doneWell}),(0,z.jsx)(v,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void pe(Z.runId,`not_helpful`),children:y.needsFix}),Z.evidence.filter(e=>e.uri).map(e=>(0,z.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,z.jsx)(f,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),T.receipts.length>1?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:y.executionHistory.replace(`{{count}}`,String(T.receipts.length-1))}),(0,z.jsx)(`div`,{className:`mt-3 space-y-3`,children:T.receipts.slice(1).map(e=>(0,z.jsx)(`article`,{className:`rounded-lg bg-surface-active p-3`,children:(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,z.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:y.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,T.context.length>0?(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`context`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.contextUsed}),(0,z.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:T.context.map(e=>(0,z.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,z.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[y.contextRoleLabels[e.role],` · `,y.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,z.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,z.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,z.jsxs)(`aside`,{className:`order-1 min-w-0 space-y-4`,children:[(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-subtle p-4`,Q(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.taskProperties}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,z.jsx)(Fe,{value:T.task.phase,disabled:V.has(`phase`),canMove:nn,canApprove:Vt,canReopen:Ht,language:l,label:y.taskPhase,onChange:Ct}),(0,z.jsx)(Ie,{value:T.task.priority,disabled:V.has(`priority`),label:y.priority,labels:y.priorityLabels,onChange:wt}),(0,z.jsx)(Le,{value:Me(T.task.dueAt),disabled:V.has(`dueAt`),label:y.dueDate,onChange:Tt}),(0,z.jsx)(Re,{value:T.conversation.currentExecutorAgentId??``,disabled:V.has(`delegateAgentId`),label:y.executorLabel,unassignedLabel:y.unassigned,agents:Je,onChange:At}),U?(0,z.jsxs)(`div`,{className:`grid gap-1 text-xs text-fg-muted`,children:[(0,z.jsx)(`span`,{children:y.projectLabel}),(0,z.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-lg bg-surface-hover px-3 py-2 text-sm text-fg`,children:[(0,z.jsx)(F,{className:`size-3.5`}),U]})]}):null]}),(0,z.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3 text-xs leading-5 text-fg-subtle`,children:[(0,z.jsx)(`p`,{children:Pt}),(0,z.jsx)(`p`,{children:Ft}),(0,z.jsx)(`p`,{className:`mt-2`,children:y.updatedAt.replace(`{{date}}`,se(T.task.updatedAt,l))})]})]}),(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`dependencies`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.taskRelations}),(0,z.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:y.dependencies}),(0,z.jsx)(ze,{candidates:Ge,selected:T.dependencies,disabled:V.has(`dependencies`),labels:vt,onChange:kt})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:y.dependents}),T.dependents.length>0?(0,z.jsx)(`div`,{className:`space-y-1.5`,children:T.dependents.map(e=>(0,z.jsx)(s,{to:tn(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:e.title},e.id))}):(0,z.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:y.noDependents})]})]})]})]})]})]}),(0,z.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":l===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(K),tabIndex:0,onPointerDown:Ot,onKeyDown:Dt,onDoubleClick:()=>Et(Ve),className:`group hidden w-2 shrink-0 cursor-col-resize touch-none items-stretch justify-center bg-surface-panel outline-none transition-colors hover:bg-surface-hover focus-visible:bg-surface-hover lg:flex ${rt?`bg-surface-hover`:``}`,children:(0,z.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,z.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:shrink-0`,children:[(0,z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,z.jsx)(`div`,{className:`min-w-0`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Wt?(0,z.jsx)(P,{agentId:Wt,avatar:Gt?.avatar,size:28,className:`shrink-0`}):null,(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:l===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[Gt?.name??Wt??y.unassigned,` · `,Pt]})]})]})}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[sn,Ut&&t!==`modal`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(v,{type:`button`,variant:`ghost`,className:_(`h-8 shrink-0 px-2 text-xs`,Kt&&`bg-surface-hover text-fg`),"aria-label":l===`zh`?`项目文件`:`Project files`,"aria-pressed":Kt,onClick:()=>{de(Ut,!1),oe(Ut)},children:[(0,z.jsx)(Ee,{className:`size-3.5`,"aria-hidden":!0}),l===`zh`?`文件`:`Files`]}),(0,z.jsx)(v,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,z.jsxs)(s,{to:ce(e),children:[(0,z.jsx)(f,{className:`size-3.5`}),l===`zh`?`全屏`:`Full screen`]})})]}):null]})]}),Ut?(0,z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,z.jsx)(xe,{embedded:!0,sessionKey:Ut,taskId:e})}):De?(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(le,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):Oe?(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(le,{className:`mx-auto size-8 text-danger`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:Oe instanceof Error?Oe.message:String(Oe)})]})}):(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(le,{className:`mx-auto size-8 text-fg-subtle`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:l===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]}),(0,z.jsx)(S,{open:gt,title:y.deleteTaskTitle,description:y.deleteTaskDescription.replace(`{{title}}`,T.task.title),confirmLabel:y.confirmDeleteTask,cancelLabel:y.keepTask,destructive:!0,onConfirm:()=>{_t(!1),jt()},onCancel:()=>_t(!1)})]})}function Ke(){let e=(0,R.c)(2),{taskId:t}=i(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,z.jsx)(Ge,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function U(e){let t=(0,R.c)(58),{taskId:n,backgroundPath:r,onClose:i}=e,a=te(et),{data:o}=ge(n),c=o?.conversation.activeSessionKey??null,l=C(G),u=C($e),d=C(Qe),p=C(Ze),m=_e(W),h=O(Xe),v=O(Ye),ee=l?u:0,b;t[0]!==i||t[1]!==v?(b=e=>{e||(v(null),i())},t[0]=i,t[1]=v,t[2]=b):b=t[2];let se=a===`zh`?`关闭任务详情`:`Close task details`,x;t[3]!==i||t[4]!==v?(x=()=>{v(null),i()},t[3]=i,t[4]=v,t[5]=x):x=t[5];let S;t[6]!==se||t[7]!==x?(S=(0,z.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`,"aria-label":se,onClick:x}),t[6]=se,t[7]=x,t[8]=S):S=t[8];let le=l?`true`:`false`,ue=`${ee/2}px`,fe=`${ee}px`,pe;t[9]!==ue||t[10]!==fe?(pe={"--task-detail-workspace-offset":ue,"--task-detail-workspace-width":fe},t[9]=ue,t[10]=fe,t[11]=pe):pe=t[11];let me=pe,he=a===`zh`?`任务详情`:`Task details`,w;t[12]===he?w=t[13]:(w=(0,z.jsx)(ae,{className:`font-medium text-fg`,children:he}),t[12]=he,t[13]=w);let T=a===`zh`?`查看并操作任务详情`:`View and manage task details`,E;t[14]===T?E=t[15]:(E=(0,z.jsx)(y,{className:`sr-only`,children:T}),t[14]=T,t[15]=E);let D;t[16]!==c||t[17]!==a||t[18]!==p||t[19]!==m||t[20]!==n||t[21]!==l||t[22]!==d?(D=c?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,className:_(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,l&&d===c&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":l&&d===c,onClick:()=>{m(c,!1),p(c)},children:(0,z.jsx)(Ee,{className:`size-4`,"aria-hidden":!0})}),(0,z.jsx)(s,{to:ce(n),className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a===`zh`?`全屏打开对话`:`Open chat full screen`,title:a===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,z.jsx)(f,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=c,t[17]=a,t[18]=p,t[19]=m,t[20]=n,t[21]=l,t[22]=d,t[23]=D):D=t[23];let ve=a===`zh`?`关闭任务详情`:`Close task details`,ye;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,z.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[24]=ye):ye=t[24];let k;t[25]===ve?k=t[26]:(k=(0,z.jsx)(ne,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":ve,children:ye}),t[25]=ve,t[26]=k);let A;t[27]!==D||t[28]!==k?(A=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[D,k]}),t[27]=D,t[28]=k,t[29]=A):A=t[29];let j;t[30]!==w||t[31]!==E||t[32]!==A?(j=(0,z.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[w,E,A]}),t[30]=w,t[31]=E,t[32]=A,t[33]=j):j=t[33];let M;t[34]!==i||t[35]!==v?(M=()=>{v(null),i()},t[34]=i,t[35]=v,t[36]=M):M=t[36];let N;t[37]!==r||t[38]!==M||t[39]!==n?(N=(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,z.jsx)(Ge,{taskId:n,presentation:`modal`,backgroundPath:r,onDeleted:M})}),t[37]=r,t[38]=M,t[39]=n,t[40]=N):N=t[40];let P;t[41]!==j||t[42]!==N||t[43]!==le||t[44]!==me?(P=(0,z.jsxs)(ie,{className:`task-detail-modal-content fixed top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl bg-surface-base shadow-float focus:outline-none`,"data-workspace-panel-open":le,style:me,onEscapeKeyDown:Je,onInteractOutside:qe,children:[j,N]}),t[41]=j,t[42]=N,t[43]=le,t[44]=me,t[45]=P):P=t[45];let F;t[46]!==h||t[47]!==l||t[48]!==u||t[49]!==d?(F=h?(0,z.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:l?u:0},children:(0,z.jsx)(de,{allowOutsideChat:!0,sessionKey:d??void 0})}):null,t[46]=h,t[47]=l,t[48]=u,t[49]=d,t[50]=F):F=t[50];let I;t[51]!==P||t[52]!==F||t[53]!==S?(I=(0,z.jsxs)(re,{children:[S,P,F]}),t[51]=P,t[52]=F,t[53]=S,t[54]=I):I=t[54];let be;return t[55]!==b||t[56]!==I?(be=(0,z.jsx)(oe,{modal:!1,open:!0,onOpenChange:b,children:I}),t[55]=b,t[56]=I,t[57]=be):be=t[57],be}function qe(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function Je(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function Ye(e){return e.setPath}function Xe(e){return e.path}function W(e){return e.setOpen}function Ze(e){return e.openForSession}function Qe(e){return e.sessionKeyOverride}function $e(e){return e.widthPx}function G(e){return e.open}function et(e){return e.language}function tt(e){return(0,z.jsx)(l,{value:e.id,children:e.name||e.id},e.id)}function K(e){return e.id}export{U as TaskDetailModal,Ke as TaskDetailPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a,p as o,t as s}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as c,r as l}from"./popover-select-CccGri5Y.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./ellipsis-0k4rZLoy.js";import{t as f}from"./external-link-DjqjBmc3.js";import{d as p,p as m,t as h}from"./markdown-view-DvM5PWEH.js";import{t as g}from"./x-B_N4OPjy.js";import{t as _}from"./cn-JdwAhgNB.js";import{t as v}from"./button-CSEbl4zT.js";import{l as ee,n as te}from"./locale-store-CXhjfe4q.js";import{i as y,n as ne,o as re,r as ie,s as ae,t as oe}from"./dist-BPoKqzeH.js";import{$ as b,Ai as se,B as x,Bi as S,Bn as ce,Ec as le,Fa as ue,Hi as C,Hn as de,I as fe,J as pe,Jr as me,Kr as he,L as w,Ml as T,Nl as E,P as ge,Q as D,Qr as _e,Vi as O,Vn as ve,W as ye,X as k,Xr as A,Yr as j,Zr as M,_o as N,at as P,dl as F,gc as I,lu as be,n as xe,no as Se,qr as Ce,to as we,uc as Te,ul as Ee}from"./index-BNWhgmjs.js";import{t as De}from"./date-picker-8R1sXJKb.js";import{t as Oe}from"./dependency-picker-CWur0821.js";var L=e(t(),1),R=n();function ke(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Ae(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}var z=r();function B(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function je(){let e=(0,R.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,z.jsx)(Se,{className:`h-32 rounded-2xl`}),(0,z.jsx)(Se,{className:`h-52 rounded-2xl`}),(0,z.jsx)(Se,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Me(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Ne(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var V=[`backlog`,`ready`,`active`,`review`,`closed`],Pe=[`low`,`normal`,`high`,`critical`],Fe=(0,L.memo)(function(e){let t=(0,R.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:u,onChange:d}=e,f;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(f=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=f):f=t[4];let p=f,m;t[5]===u?m=t[6]:(m=(0,z.jsx)(`span`,{children:u}),t[5]=u,t[6]=m);let h;t[7]===d?h=t[8]:(h=e=>d(e.target.value),t[7]=d,t[8]=h);let g;t[9]!==s||t[10]!==p?(g=V.map(e=>(0,z.jsx)(l,{value:e,disabled:p(e),children:B(e,s)},e)),t[9]=s,t[10]=p,t[11]=g):g=t[11];let _;t[12]!==r||t[13]!==h||t[14]!==g||t[15]!==n?(_=(0,z.jsx)(c,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:h,children:g}),t[12]=r,t[13]=h,t[14]=g,t[15]=n,t[16]=_):_=t[16];let v;return t[17]!==m||t[18]!==_?(v=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19],v}),Ie=(0,L.memo)(function(e){let t=(0,R.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,z.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let u;t[2]===o?u=t[3]:(u=e=>o(e.target.value),t[2]=o,t[3]=u);let d;t[4]===a?d=t[5]:(d=Pe.map(e=>(0,z.jsx)(l,{value:e,children:a[e]},e)),t[4]=a,t[5]=d);let f;t[6]!==r||t[7]!==u||t[8]!==d||t[9]!==n?(f=(0,z.jsx)(c,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:u,children:d}),t[6]=r,t[7]=u,t[8]=d,t[9]=n,t[10]=f):f=t[10];let p;return t[11]!==s||t[12]!==f?(p=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,f]}),t[11]=s,t[12]=f,t[13]=p):p=t[13],p}),Le=(0,L.memo)(function(e){let t=(0,R.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,z.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,z.jsx)(De,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Re=(0,L.memo)(function(e){let t=(0,R.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:s}=e,u;t[0]===i?u=t[1]:(u=(0,z.jsx)(`span`,{children:i}),t[0]=i,t[1]=u);let d;t[2]===s?d=t[3]:(d=e=>s(e.target.value),t[2]=s,t[3]=d);let f;t[4]===a?f=t[5]:(f=(0,z.jsx)(l,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=f);let p;t[6]===o?p=t[7]:(p=o.map(tt),t[6]=o,t[7]=p);let m;t[8]!==r||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==n?(m=(0,z.jsxs)(c,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:d,children:[f,p]}),t[8]=r,t[9]=d,t[10]=f,t[11]=p,t[12]=n,t[13]=m):m=t[13];let h;return t[14]!==u||t[15]!==m?(h=(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[u,m]}),t[14]=u,t[15]=m,t[16]=h):h=t[16],h}),ze=(0,L.memo)(function(e){let t=(0,R.c)(8),{candidates:n,selected:r,disabled:i,labels:a,onChange:o}=e,s;t[0]===r?s=t[1]:(s=r.map(K),t[0]=r,t[1]=s);let c;return t[2]!==n||t[3]!==i||t[4]!==a||t[5]!==o||t[6]!==s?(c=(0,z.jsx)(Oe,{borderless:!0,candidates:n,selectedIds:s,disabled:i,onChange:o,labels:a}),t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),Be=`xopc.taskDetail.chatPanelPercent`,Ve=42;function He(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?Ve:Math.min(r,Math.max(n,e))}function Ue(){try{let e=Number(window.localStorage.getItem(Be));return Number.isFinite(e)&&e>=30&&e<=60?e:Ve}catch{return Ve}}function We(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`)?`needsUser`:e.operationalState===`idle`?e.task.phase===`backlog`?`captured`:e.task.phase===`ready`?`ready`:e.task.phase===`review`?`review`:`paused`:e.operationalState}function H(e){let t=(0,R.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,z.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,z.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,z.jsx)(t===`passed`?u:t===`failed`?E:T,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,z.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,z.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function Ge({taskId:e,presentation:t,backgroundPath:n,onDeleted:r}){let[i]=o(),c=a(),l=te(e=>e.language),g=ee(e=>e.token),y=(0,L.useMemo)(()=>b(l),[l]),ne=N(e=>e.setPageHeader),re=N(e=>e.clearPageHeader),ie=C(e=>e.open),ae=C(e=>e.sessionKeyOverride),oe=C(e=>e.openForSession),de=_e(e=>e.setOpen),{data:T,error:E,mutate:O,lastChange:Se,conversationLoading:De,conversationError:Oe}=ge(e),[R,B]=(0,L.useState)(null),[V,Pe]=(0,L.useState)(()=>new Set),[Ge,Ke]=(0,L.useState)([]),[U,qe]=(0,L.useState)(null),[Je,Ye]=(0,L.useState)([]),[Xe,W]=(0,L.useState)(!1),[Ze,Qe]=(0,L.useState)(``),[$e,G]=(0,L.useState)(!1),[et,tt]=(0,L.useState)(``),[K,nt]=(0,L.useState)(Ue),[rt,it]=(0,L.useState)(!1),at=(0,L.useRef)(null),ot=(0,L.useRef)(!1),st=(0,L.useRef)(!1),ct=(0,L.useRef)(``),lt=(0,L.useRef)(null),ut=(0,L.useRef)(null),dt=(0,L.useRef)(null),ft=(0,L.useRef)(T),[pt,q]=(0,L.useState)(null),[mt,ht]=(0,L.useState)(null),[gt,_t]=(0,L.useState)(!1),vt=(0,L.useMemo)(()=>({link:y.linkDependencies,linked:y.linkedDependencies,searchPlaceholder:y.dependencySearchPlaceholder,noMatches:y.noDependencyMatches,noCandidates:y.noDependencyCandidates,remove:y.removeDependency}),[y.dependencySearchPlaceholder,y.linkDependencies,y.linkedDependencies,y.noDependencyCandidates,y.noDependencyMatches,y.removeDependency]),yt=T?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,bt=(0,L.useMemo)(()=>p(i.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[i]);ft.current=T;let J=(0,L.useCallback)((e,t)=>{Pe(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,L.useEffect)(()=>{B(null),q(null),W(!1),G(!1),ht(null),_t(!1)},[e]),(0,L.useEffect)(()=>{let e=!0;return we().then(t=>{e&&Ye(t.items)}).catch(()=>void 0),()=>{e=!1}},[g]),(0,L.useEffect)(()=>{if(!Se||Se.source===`user`)return;ht(Se);let e=window.setTimeout(()=>ht(null),3500);return()=>window.clearTimeout(e)},[Se]),(0,L.useEffect)(()=>{let t=T?.task.projectId,n=T?.dependencies??[];if(!t){dt.current=null,qe(null),Ke(n);return}dt.current!==t&&(dt.current=t,qe(null));let r=!0;return ue(t).then(t=>{if(!r)return;qe(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});Ke([...i.values()])}).catch(()=>{r&&Ke(n)}),()=>{r=!1}},[yt,T?.task.projectId,e]);let Y=(0,L.useCallback)(async(t,n=`command`)=>{let r=ft.current;if(r){J(n,!0),B(null);try{await O(await w(e,t,r.task.version),{revalidate:!1})}catch{B(y.actionFailed)}finally{J(n,!1)}}},[y.actionFailed,O,J,e]),X=(0,L.useCallback)(async(t,n)=>{let r=ft.current;if(!r)return!1;n&&J(n,!0),B(null);try{return await O(k(e,t,r.task.version),{optimisticData:Ae(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return B(y.actionFailed),!1}finally{n&&J(n,!1)}},[y.actionFailed,O,J,e]),xt=async()=>{if(!T)return;if(ot.current){ot.current=!1;return}let e=Ze.trim(),t=lt.current;if(ke(t,T.task.version,T.task.title,e)){q(`title`);return}if(!e||e===T.task.title){Qe(T.task.title),W(!1);return}await X({title:e})&&(q(null),W(!1))},St=async()=>{if(!T)return;if(st.current){st.current=!1;return}let e=et.trim(),t=ut.current;if(ke(t,T.task.version,T.task.body??``,e)){q(`description`);return}if(et===ct.current||e===(T.task.body??``).trim()){G(!1);return}await X({body:e||null})&&(q(null),G(!1))},Ct=(0,L.useCallback)(async e=>{let t=ft.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await Y({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await Y({type:`close`,resolution:`done`},`phase`);return}await Y({type:`move`,phase:e},`phase`)}},[Y]),wt=(0,L.useCallback)(e=>{X({priority:e},`priority`)},[X]),Tt=(0,L.useCallback)(e=>{X({dueAt:Ne(e)},`dueAt`)},[X]),Et=(0,L.useCallback)(e=>{nt(e);try{window.localStorage.setItem(Be,String(e))}catch{}},[]),Dt=(0,L.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=at.current?.clientWidth??0;Et(He(e.key===`Home`?Ve:K+(e.key===`ArrowLeft`?2:-2),t))},[K,Et]),Ot=(0,L.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=at.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),it(!0);let i=K,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=He((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}it(!1),Et(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[K,Et]),kt=(0,L.useCallback)(async t=>{let n=ft.current;if(n){J(`dependencies`,!0),B(null);try{await O(await D(e,t,n.task.version),{revalidate:!1})}catch{B(y.dependencyUpdateFailed)}finally{J(`dependencies`,!1)}}},[y.dependencyUpdateFailed,O,J,e]),At=(0,L.useCallback)(async t=>{let n=ft.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){J(`delegateAgentId`,!0),B(null);try{await O(await ye(e,t,n.task.version),{revalidate:!1})}catch{B(y.actionFailed)}finally{J(`delegateAgentId`,!1)}}},[y.actionFailed,O,J,e]),jt=(0,L.useCallback)(async()=>{J(`delete`,!0),B(null);try{await x(e),r?r():c(bt,{replace:!0})}catch(e){B(e instanceof Error?e.message:y.actionFailed)}finally{J(`delete`,!1)}},[y.actionFailed,c,r,bt,J,e]);if((0,L.useLayoutEffect)(()=>{if(t!==`modal`)return ne({startExtra:(0,z.jsx)(s,{to:bt,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":y.backToWork,children:(0,z.jsx)(be,{className:`size-4`})}),main:T?(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:U?`${U} / ${y.taskLabel}`:y.taskLabel}),(0,z.jsx)(`p`,{className:`text-xs text-fg-muted`,children:y.detailStatuses[We(T)]})]}):null,end:null}),re},[re,y.backToWork,y.detailStatuses,y.taskLabel,T,t,U,bt,ne]),E&&!T)return(0,z.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:y.taskNotFound});if(!T)return(0,z.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,z.jsx)(je,{})});let Mt=T.waits[0],Nt=Mt?.kind===`paused`?Mt:void 0,Z=T.receipts[0],Pt=y.detailStatuses[We(T)],Ft=y.detailStatusDescriptions[We(T)],It=T.task.body?.trim()||T.task.contract?.objective.trim(),Lt=new Map(Z?.verification.checks.map(e=>[e.criterion,e.status])),Rt=T.allowedCommands.includes(`mark_ready`),zt=T.allowedCommands.includes(`start`),Bt=T.allowedCommands.includes(`add_wait`),Vt=T.task.phase===`review`&&T.allowedCommands.includes(`close`),Ht=T.allowedCommands.includes(`reopen`),Ut=T.conversation.activeSessionKey,Wt=T.conversation.currentExecutorAgentId??T.task.delegateAgentId??T.task.ownerId,Gt=Je.find(e=>e.id===Wt),Kt=!!(Ut&&ie&&ae===Ut),qt=T.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Jt=T.task.contract?.acceptanceCriteria??[],Yt=Jt.filter(e=>Lt.get(e)===`passed`).length,Xt=T.task.contract?.expectedOutputs??[],Zt=T.task.contract?.constraints??[],Qt=T.task.contract?.approvalRequired??[],$t=T.task.contract?.assumptions??[],en=T.task.contract?.risks??[],Q=(...e)=>!!mt?.changedFields.some(t=>e.includes(t)),tn=e=>t===`modal`&&n?ve(n,e):m(`/tasks/${e}`,bt),nn=T.allowedCommands.includes(`move`),$=V.has(`command`),rn=V.has(`delete`),an=T.runs.find(e=>[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),on=an!==void 0,sn=(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Rt?(0,z.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void Y({type:`mark_ready`}),children:[(0,z.jsx)(Te,{className:`size-4`}),y.scheduleTask]}):null,Nt?(0,z.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void Y({type:`resolve_wait`,waitId:Nt.id}),children:[(0,z.jsx)(Te,{className:`size-4`}),y.resumeTask]}):null,!Mt&&zt&&Wt?(0,z.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void Y({type:`start`,executor:{kind:`agent`,agentId:Wt}}),children:[(0,z.jsx)(Te,{className:`size-4`}),y.runTask]}):null,Vt?(0,z.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void Y({type:`close`,resolution:`done`}),children:[(0,z.jsx)(u,{className:`size-4`}),y.approveTask]}):null,Ht?(0,z.jsxs)(v,{variant:`primary`,disabled:$,onClick:()=>void Y({type:`reopen`,phase:`ready`}),children:[(0,z.jsx)(Te,{className:`size-4`}),y.reopenTask]}):null,!Mt&&Bt?(0,z.jsxs)(v,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:$,onClick:()=>void Y({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,z.jsx)(I,{className:`size-4`}),y.pauseTask]}):null,(0,z.jsxs)(j,{children:[(0,z.jsx)(M,{asChild:!0,children:(0,z.jsx)(v,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:$||rn,"aria-label":y.moreActions,children:(0,z.jsx)(d,{className:`size-4`,"aria-hidden":!0})})}),(0,z.jsx)(me,{children:(0,z.jsxs)(he,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[an?(0,z.jsx)(Ce,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{J(`command`,!0),B(null),O(fe(e,an.id,an.version),{revalidate:!1}).catch(()=>B(y.actionFailed)).finally(()=>J(`command`,!1))},children:y.cancelActiveRun}):null,an?(0,z.jsx)(A,{className:`my-1 h-px bg-edge`}):null,T.task.phase===`closed`?null:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Ce,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void Y({type:`close`,resolution:`cancelled`}),children:y.cancelTask}),(0,z.jsx)(A,{className:`my-1 h-px bg-edge`})]}),(0,z.jsx)(Ce,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{if(on){B(y.deleteActiveTaskBlocked);return}_t(!0)},children:y.deleteTask})]})})]})]});return(0,z.jsxs)(`div`,{ref:at,className:`${t===`modal`?`flex h-full min-h-0 flex-col lg:flex-row`:`flex min-h-[calc(100dvh-8rem)] flex-col overflow-hidden lg:flex-row`} ${rt?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${K}%`},children:[(0,z.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,z.jsxs)(`header`,{className:_(`px-4 pb-5`,Q(`title`)&&`task-detail-live-update`),children:[(0,z.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[U?(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,z.jsx)(F,{className:`size-3.5`,"aria-hidden":!0}),U]}):null,(0,z.jsx)(`span`,{children:`/`}),(0,z.jsx)(`span`,{children:y.taskLabel}),mt?(0,z.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:mt.source===`agent`?l===`zh`?`Agent 刚刚更新`:`Updated by Agent`:l===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),Xe?(0,z.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:Ze,onChange:e=>Qe(e.target.value),onBlur:()=>void xt(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),ot.current=!0,Qe(T.task.title),W(!1),queueMicrotask(()=>{ot.current=!1}))},className:`mt-3 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-2xl font-semibold leading-8 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,z.jsx)(`button`,{type:`button`,className:`mt-3 block max-w-3xl rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{lt.current={value:T.task.title,version:T.task.version},q(null),Qe(T.task.title),W(!0)},children:(0,z.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:T.task.title})}),pt===`title`?(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,z.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Qe(T.task.title),q(null),W(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void X({title:Ze.trim()}).then(e=>{e&&(q(null),W(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),R?(0,z.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:R}):null]}),(0,z.jsxs)(`div`,{className:`mt-5 flex flex-col gap-5`,children:[(0,z.jsxs)(`main`,{className:`order-2 min-w-0 space-y-5`,children:[(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`body`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.taskDescription}),$e?(0,z.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:et,onChange:e=>tt(e.target.value),onBlur:()=>void St(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),st.current=!0,tt(T.task.body??T.task.contract?.objective??``),G(!1),queueMicrotask(()=>{st.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,z.jsx)(`button`,{type:`button`,className:`-mx-1 mt-2 block w-[calc(100%+0.5rem)] rounded-lg px-1 py-1 text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=T.task.body??T.task.contract?.objective??``;ct.current=e,ut.current={value:T.task.body??``,version:T.task.version},q(null),tt(e),G(!0)},children:(0,z.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:It&&It!==T.task.title?It:y.noTaskDescription})}),pt===`description`?(0,z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,z.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{tt(T.task.body??``),q(null),G(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,z.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void X({body:et.trim()||null}).then(e=>{e&&(q(null),G(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),T.attention.length>0?(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-warning/10 p-4`,Q(`attention`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h3`,{className:`font-medium text-fg`,children:qt?y.needsAttention:y.waitingStatus}),(0,z.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:T.attention.map((e,t)=>(0,z.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`contract`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.taskDefinition}),(0,z.jsxs)(`div`,{className:`mt-5`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:y.successDefinition}),Jt.length>0?(0,z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:y.criteriaProgress.replace(`{{verified}}`,String(Yt)).replace(`{{total}}`,String(Jt.length))}):null]}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:Jt,empty:y.noDefinition,verificationByCriterion:Lt})})]}),Xt.length>0?(0,z.jsxs)(`div`,{className:`mt-5 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:y.expectedOutputs}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:Xt,empty:y.noDefinition})})]}):null,Zt.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:y.constraints}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:Zt,empty:y.noDefinition})})]}):null,Qt.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:y.approvalRequired}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:Qt,empty:y.noDefinition})})]}):null,$t.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:y.contextAssumptions}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:$t,empty:y.noDefinition})})]}):null,en.length>0?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:y.contextRisks}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(H,{items:en,empty:y.noDefinition})})]}):null]}),Z?(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.latestResult}),(0,z.jsx)(h,{content:Z.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`})]}),(0,z.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[y.receiptStatuses[Z.status],` · `,y.verificationStatuses[Z.verification.status]]})]}),Z.remainingWork.length>0?(0,z.jsxs)(`div`,{className:`mt-4`,children:[(0,z.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:y.remainingWork}),(0,z.jsx)(`div`,{className:`mt-2`,children:(0,z.jsx)(H,{items:Z.remainingWork,empty:y.noRemainingWork})})]}):null,Z.nextAction?(0,z.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,z.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:y.nextAction}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:Z.nextAction})]}):null,(0,z.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(v,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void pe(Z.runId,`helpful`),children:y.doneWell}),(0,z.jsx)(v,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void pe(Z.runId,`not_helpful`),children:y.needsFix}),Z.evidence.filter(e=>e.uri).map(e=>(0,z.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,z.jsx)(f,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),T.receipts.length>1?(0,z.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,z.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:y.executionHistory.replace(`{{count}}`,String(T.receipts.length-1))}),(0,z.jsx)(`div`,{className:`mt-3 space-y-3`,children:T.receipts.slice(1).map(e=>(0,z.jsx)(`article`,{className:`rounded-lg bg-surface-active p-3`,children:(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,z.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:y.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,T.context.length>0?(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`context`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.contextUsed}),(0,z.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:T.context.map(e=>(0,z.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,z.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[y.contextRoleLabels[e.role],` · `,y.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,z.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,z.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,z.jsxs)(`aside`,{className:`order-1 min-w-0 space-y-4`,children:[(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-subtle p-4`,Q(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.taskProperties}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,z.jsx)(Fe,{value:T.task.phase,disabled:V.has(`phase`),canMove:nn,canApprove:Vt,canReopen:Ht,language:l,label:y.taskPhase,onChange:Ct}),(0,z.jsx)(Ie,{value:T.task.priority,disabled:V.has(`priority`),label:y.priority,labels:y.priorityLabels,onChange:wt}),(0,z.jsx)(Le,{value:Me(T.task.dueAt),disabled:V.has(`dueAt`),label:y.dueDate,onChange:Tt}),(0,z.jsx)(Re,{value:T.conversation.currentExecutorAgentId??``,disabled:V.has(`delegateAgentId`),label:y.executorLabel,unassignedLabel:y.unassigned,agents:Je,onChange:At}),U?(0,z.jsxs)(`div`,{className:`grid gap-1 text-xs text-fg-muted`,children:[(0,z.jsx)(`span`,{children:y.projectLabel}),(0,z.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-lg bg-surface-hover px-3 py-2 text-sm text-fg`,children:[(0,z.jsx)(F,{className:`size-3.5`}),U]})]}):null]}),(0,z.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3 text-xs leading-5 text-fg-subtle`,children:[(0,z.jsx)(`p`,{children:Pt}),(0,z.jsx)(`p`,{children:Ft}),(0,z.jsx)(`p`,{className:`mt-2`,children:y.updatedAt.replace(`{{date}}`,se(T.task.updatedAt,l))})]})]}),(0,z.jsxs)(`section`,{className:_(`rounded-xl bg-surface-panel p-4`,Q(`dependencies`)&&`task-detail-live-update`),children:[(0,z.jsx)(`h2`,{className:`font-medium text-fg`,children:y.taskRelations}),(0,z.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:y.dependencies}),(0,z.jsx)(ze,{candidates:Ge,selected:T.dependencies,disabled:V.has(`dependencies`),labels:vt,onChange:kt})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:y.dependents}),T.dependents.length>0?(0,z.jsx)(`div`,{className:`space-y-1.5`,children:T.dependents.map(e=>(0,z.jsx)(s,{to:tn(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:e.title},e.id))}):(0,z.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:y.noDependents})]})]})]})]})]})]}),(0,z.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":l===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(K),tabIndex:0,onPointerDown:Ot,onKeyDown:Dt,onDoubleClick:()=>Et(Ve),className:`group hidden w-2 shrink-0 cursor-col-resize touch-none items-stretch justify-center bg-surface-panel outline-none transition-colors hover:bg-surface-hover focus-visible:bg-surface-hover lg:flex ${rt?`bg-surface-hover`:``}`,children:(0,z.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,z.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:shrink-0`,children:[(0,z.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,z.jsx)(`div`,{className:`min-w-0`,children:(0,z.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Wt?(0,z.jsx)(P,{agentId:Wt,avatar:Gt?.avatar,size:28,className:`shrink-0`}):null,(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:l===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,z.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[Gt?.name??Wt??y.unassigned,` · `,Pt]})]})]})}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[sn,Ut&&t!==`modal`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(v,{type:`button`,variant:`ghost`,className:_(`h-8 shrink-0 px-2 text-xs`,Kt&&`bg-surface-hover text-fg`),"aria-label":l===`zh`?`项目文件`:`Project files`,"aria-pressed":Kt,onClick:()=>{de(Ut,!1),oe(Ut)},children:[(0,z.jsx)(Ee,{className:`size-3.5`,"aria-hidden":!0}),l===`zh`?`文件`:`Files`]}),(0,z.jsx)(v,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,z.jsxs)(s,{to:ce(e),children:[(0,z.jsx)(f,{className:`size-3.5`}),l===`zh`?`全屏`:`Full screen`]})})]}):null]})]}),Ut?(0,z.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,z.jsx)(xe,{embedded:!0,sessionKey:Ut,taskId:e})}):De?(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(le,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):Oe?(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(le,{className:`mx-auto size-8 text-danger`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:Oe instanceof Error?Oe.message:String(Oe)})]})}):(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,z.jsxs)(`div`,{className:`max-w-xs`,children:[(0,z.jsx)(le,{className:`mx-auto size-8 text-fg-subtle`}),(0,z.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,z.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:l===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]}),(0,z.jsx)(S,{open:gt,title:y.deleteTaskTitle,description:y.deleteTaskDescription.replace(`{{title}}`,T.task.title),confirmLabel:y.confirmDeleteTask,cancelLabel:y.keepTask,destructive:!0,onConfirm:()=>{_t(!1),jt()},onCancel:()=>_t(!1)})]})}function Ke(){let e=(0,R.c)(2),{taskId:t}=i(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,z.jsx)(Ge,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function U(e){let t=(0,R.c)(58),{taskId:n,backgroundPath:r,onClose:i}=e,a=te(et),{data:o}=ge(n),c=o?.conversation.activeSessionKey??null,l=C(G),u=C($e),d=C(Qe),p=C(Ze),m=_e(W),h=O(Xe),v=O(Ye),ee=l?u:0,b;t[0]!==i||t[1]!==v?(b=e=>{e||(v(null),i())},t[0]=i,t[1]=v,t[2]=b):b=t[2];let se=a===`zh`?`关闭任务详情`:`Close task details`,x;t[3]!==i||t[4]!==v?(x=()=>{v(null),i()},t[3]=i,t[4]=v,t[5]=x):x=t[5];let S;t[6]!==se||t[7]!==x?(S=(0,z.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`,"aria-label":se,onClick:x}),t[6]=se,t[7]=x,t[8]=S):S=t[8];let le=l?`true`:`false`,ue=`${ee/2}px`,fe=`${ee}px`,pe;t[9]!==ue||t[10]!==fe?(pe={"--task-detail-workspace-offset":ue,"--task-detail-workspace-width":fe},t[9]=ue,t[10]=fe,t[11]=pe):pe=t[11];let me=pe,he=a===`zh`?`任务详情`:`Task details`,w;t[12]===he?w=t[13]:(w=(0,z.jsx)(ae,{className:`font-medium text-fg`,children:he}),t[12]=he,t[13]=w);let T=a===`zh`?`查看并操作任务详情`:`View and manage task details`,E;t[14]===T?E=t[15]:(E=(0,z.jsx)(y,{className:`sr-only`,children:T}),t[14]=T,t[15]=E);let D;t[16]!==c||t[17]!==a||t[18]!==p||t[19]!==m||t[20]!==n||t[21]!==l||t[22]!==d?(D=c?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,className:_(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,l&&d===c&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":l&&d===c,onClick:()=>{m(c,!1),p(c)},children:(0,z.jsx)(Ee,{className:`size-4`,"aria-hidden":!0})}),(0,z.jsx)(s,{to:ce(n),className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a===`zh`?`全屏打开对话`:`Open chat full screen`,title:a===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,z.jsx)(f,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=c,t[17]=a,t[18]=p,t[19]=m,t[20]=n,t[21]=l,t[22]=d,t[23]=D):D=t[23];let ve=a===`zh`?`关闭任务详情`:`Close task details`,ye;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,z.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[24]=ye):ye=t[24];let k;t[25]===ve?k=t[26]:(k=(0,z.jsx)(ne,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":ve,children:ye}),t[25]=ve,t[26]=k);let A;t[27]!==D||t[28]!==k?(A=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[D,k]}),t[27]=D,t[28]=k,t[29]=A):A=t[29];let j;t[30]!==w||t[31]!==E||t[32]!==A?(j=(0,z.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[w,E,A]}),t[30]=w,t[31]=E,t[32]=A,t[33]=j):j=t[33];let M;t[34]!==i||t[35]!==v?(M=()=>{v(null),i()},t[34]=i,t[35]=v,t[36]=M):M=t[36];let N;t[37]!==r||t[38]!==M||t[39]!==n?(N=(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,z.jsx)(Ge,{taskId:n,presentation:`modal`,backgroundPath:r,onDeleted:M})}),t[37]=r,t[38]=M,t[39]=n,t[40]=N):N=t[40];let P;t[41]!==j||t[42]!==N||t[43]!==le||t[44]!==me?(P=(0,z.jsxs)(ie,{className:`task-detail-modal-content fixed top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl bg-surface-base shadow-float focus:outline-none`,"data-workspace-panel-open":le,style:me,onEscapeKeyDown:Je,onInteractOutside:qe,children:[j,N]}),t[41]=j,t[42]=N,t[43]=le,t[44]=me,t[45]=P):P=t[45];let F;t[46]!==h||t[47]!==l||t[48]!==u||t[49]!==d?(F=h?(0,z.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:l?u:0},children:(0,z.jsx)(de,{allowOutsideChat:!0,sessionKey:d??void 0})}):null,t[46]=h,t[47]=l,t[48]=u,t[49]=d,t[50]=F):F=t[50];let I;t[51]!==P||t[52]!==F||t[53]!==S?(I=(0,z.jsxs)(re,{children:[S,P,F]}),t[51]=P,t[52]=F,t[53]=S,t[54]=I):I=t[54];let be;return t[55]!==b||t[56]!==I?(be=(0,z.jsx)(oe,{modal:!1,open:!0,onOpenChange:b,children:I}),t[55]=b,t[56]=I,t[57]=be):be=t[57],be}function qe(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function Je(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function Ye(e){return e.setPath}function Xe(e){return e.path}function W(e){return e.setOpen}function Ze(e){return e.openForSession}function Qe(e){return e.sessionKeyOverride}function $e(e){return e.widthPx}function G(e){return e.open}function et(e){return e.language}function tt(e){return(0,z.jsx)(l,{value:e.id,children:e.name||e.id},e.id)}function K(e){return e.id}export{U as TaskDetailModal,Ke as TaskDetailPage};
@@ -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{t as i}from"./check-DUBLcKHA.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./cn-JdwAhgNB.js";import{n as s}from"./locale-store-CXhjfe4q.js";import{Vl as c}from"./index-BX0dz1JK.js";var l=n(),u=r();function d(e){let t=(0,l.c)(21),{status:n,error:r,className:d}=e,p=s(f)===`zh`,m=n===`saving`?p?`正在保存…`:`Saving…`:n===`saved`?p?`已自动保存`:`Saved automatically`:n===`error`?r||(p?`自动保存失败`:`Autosave failed`):n===`dirty`?p?`编辑中,将自动保存`:`Editing — autosave pending`:p?`自动保存`:`Autosave`,h=n===`error`?`text-danger`:n===`saved`?`text-success`:`text-fg-subtle`,g;t[0]!==d||t[1]!==h?(g=o(`inline-flex min-w-0 items-center gap-1.5 text-xs`,h,d),t[0]=d,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=n===`saving`?(0,u.jsx)(a,{className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}):null,t[3]=n,t[4]=_);let v;t[5]===n?v=t[6]:(v=n===`saved`?(0,u.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[5]=n,t[6]=v);let y;t[7]===n?y=t[8]:(y=n===`error`?(0,u.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[7]=n,t[8]=y);let b;t[9]===n?b=t[10]:(b=n===`dirty`?(0,u.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}):null,t[9]=n,t[10]=b);let x;t[11]===m?x=t[12]:(x=(0,u.jsx)(`span`,{className:`truncate`,children:m}),t[11]=m,t[12]=x);let S;return t[13]!==m||t[14]!==g||t[15]!==_||t[16]!==v||t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,u.jsxs)(`span`,{className:g,role:`status`,"aria-live":`polite`,title:m,children:[_,v,y,b,x]}),t[13]=m,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20],S}function f(e){return e.language}var p=e(t(),1);function m({value:e,dirty:t,onSave:n,enabled:r=!0,delayMs:i=700,validate:a,serialize:o=JSON.stringify}){let[s,c]=(0,p.useState)(`idle`),[l,u]=(0,p.useState)(null),d=(0,p.useRef)(e),f=(0,p.useRef)(n),m=(0,p.useRef)(a),h=(0,p.useRef)(o),g=(0,p.useRef)(null),_=(0,p.useRef)(!1),v=(0,p.useRef)(null),y=(0,p.useRef)(null),b=(0,p.useRef)(null),x=(0,p.useRef)(!0);d.current=e,f.current=n,m.current=a,h.current=o;let S=(0,p.useCallback)(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),C=(0,p.useCallback)(async e=>{S();let t=h.current(e);b.current=t;let n=m.current?.(e)??null;if(n){u(n),c(`error`);return}if(_.current){v.current=e;return}_.current=!0,u(null),c(`saving`);try{await f.current(e),y.current=t,x.current&&c(`saved`)}catch(e){x.current&&(u(e instanceof Error?e.message:String(e)),c(`error`))}finally{_.current=!1;let e=v.current;v.current=null,e&&h.current(e)!==y.current&&C(e)}},[S]),w=(0,p.useCallback)(()=>{let e=d.current;!r||!t||e===null||C(e)},[t,r,C]),T=(0,p.useCallback)(e=>{let t=e??d.current;!r||t===null||C(t)},[r,C]);return(0,p.useEffect)(()=>{if(!r||!t||e===null){S(),!t&&s===`dirty`&&c(`idle`);return}let n=o(e);if(n!==y.current&&!(s===`error`&&n===b.current))return c(e=>e===`saving`?e:`dirty`),S(),g.current=window.setTimeout(()=>void C(e),i),S},[S,i,t,r,C,o,s,e]),(0,p.useEffect)(()=>(x.current=!0,()=>{x.current=!1,S()}),[S]),{status:s,error:l,flush:w,saveNow:T,retry:w,onBlurCapture:w}}export{d as n,m as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./check-DUBLcKHA.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./cn-JdwAhgNB.js";import{n as s}from"./locale-store-CXhjfe4q.js";import{Vl as c}from"./index-BNWhgmjs.js";var l=n(),u=r();function d(e){let t=(0,l.c)(21),{status:n,error:r,className:d}=e,p=s(f)===`zh`,m=n===`saving`?p?`正在保存…`:`Saving…`:n===`saved`?p?`已自动保存`:`Saved automatically`:n===`error`?r||(p?`自动保存失败`:`Autosave failed`):n===`dirty`?p?`编辑中,将自动保存`:`Editing — autosave pending`:p?`自动保存`:`Autosave`,h=n===`error`?`text-danger`:n===`saved`?`text-success`:`text-fg-subtle`,g;t[0]!==d||t[1]!==h?(g=o(`inline-flex min-w-0 items-center gap-1.5 text-xs`,h,d),t[0]=d,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=n===`saving`?(0,u.jsx)(a,{className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}):null,t[3]=n,t[4]=_);let v;t[5]===n?v=t[6]:(v=n===`saved`?(0,u.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[5]=n,t[6]=v);let y;t[7]===n?y=t[8]:(y=n===`error`?(0,u.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[7]=n,t[8]=y);let b;t[9]===n?b=t[10]:(b=n===`dirty`?(0,u.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}):null,t[9]=n,t[10]=b);let x;t[11]===m?x=t[12]:(x=(0,u.jsx)(`span`,{className:`truncate`,children:m}),t[11]=m,t[12]=x);let S;return t[13]!==m||t[14]!==g||t[15]!==_||t[16]!==v||t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,u.jsxs)(`span`,{className:g,role:`status`,"aria-live":`polite`,title:m,children:[_,v,y,b,x]}),t[13]=m,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20],S}function f(e){return e.language}var p=e(t(),1);function m({value:e,dirty:t,onSave:n,enabled:r=!0,delayMs:i=700,validate:a,serialize:o=JSON.stringify}){let[s,c]=(0,p.useState)(`idle`),[l,u]=(0,p.useState)(null),d=(0,p.useRef)(e),f=(0,p.useRef)(n),m=(0,p.useRef)(a),h=(0,p.useRef)(o),g=(0,p.useRef)(null),_=(0,p.useRef)(!1),v=(0,p.useRef)(null),y=(0,p.useRef)(null),b=(0,p.useRef)(null),x=(0,p.useRef)(!0);d.current=e,f.current=n,m.current=a,h.current=o;let S=(0,p.useCallback)(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),C=(0,p.useCallback)(async e=>{S();let t=h.current(e);b.current=t;let n=m.current?.(e)??null;if(n){u(n),c(`error`);return}if(_.current){v.current=e;return}_.current=!0,u(null),c(`saving`);try{await f.current(e),y.current=t,x.current&&c(`saved`)}catch(e){x.current&&(u(e instanceof Error?e.message:String(e)),c(`error`))}finally{_.current=!1;let e=v.current;v.current=null,e&&h.current(e)!==y.current&&C(e)}},[S]),w=(0,p.useCallback)(()=>{let e=d.current;!r||!t||e===null||C(e)},[t,r,C]),T=(0,p.useCallback)(e=>{let t=e??d.current;!r||t===null||C(t)},[r,C]);return(0,p.useEffect)(()=>{if(!r||!t||e===null){S(),!t&&s===`dirty`&&c(`idle`);return}let n=o(e);if(n!==y.current&&!(s===`error`&&n===b.current))return c(e=>e===`saving`?e:`dirty`),S(),g.current=window.setTimeout(()=>void C(e),i),S},[S,i,t,r,C,o,s,e]),(0,p.useEffect)(()=>(x.current=!0,()=>{x.current=!1,S()}),[S]),{status:s,error:l,flush:w,saveNow:T,retry:w,onBlurCapture:w}}export{d as n,m as t};