@xopcai/xopc 0.0.199 → 0.0.201

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 (152) 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/{activity-store-DYVN1hRp.js → activity-store-DOhnAQOQ.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Bt70bZjv.js → agent-avatar-dicebear-D8Cw0Mve.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-ANavi648.js +68 -0
  6. package/dist/gateway/static/root/assets/{api-B8mzbAle.js → api-E9Bk-Idp.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-B4x7JfL8.js → app-management-settings-panel-BubrReXg.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-Dwdagf-Q.js → appearance-settings-BY5Az2p4.js} +1 -1
  9. package/dist/gateway/static/root/assets/{apps-page-DkTiesxe.js → apps-page-CFh9MBxc.js} +1 -1
  10. package/dist/gateway/static/root/assets/{archive-plugin-Cv0VXKLm.js → archive-plugin-BY8843mB.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-CgidKrXn.js → attachment-load-DG45KScf.js} +1 -1
  12. package/dist/gateway/static/root/assets/automations-page-751CeNI3.js +6 -0
  13. package/dist/gateway/static/root/assets/{binary-plugins-DN3CQgIq.js → binary-plugins-DGIF2ZAv.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-BwkSl1F_.js → block-editor-C1Qktr1g.js} +5 -5
  15. package/dist/gateway/static/root/assets/browser-settings-page-CGAWs-TT.js +8 -0
  16. package/dist/gateway/static/root/assets/{browser-workflow-inputs-_ndaecsf.js → browser-workflow-inputs-D_jnndyz.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-workflows-page-C_I31wLm.js → browser-workflows-page-DyIRvPaq.js} +2 -2
  18. package/dist/gateway/static/root/assets/capabilities-settings-panel-CghUK68J.js +7 -0
  19. package/dist/gateway/static/root/assets/{capability-presets-api-Dy1jZJKs.js → capability-presets-api--tz0mGLY.js} +1 -1
  20. package/dist/gateway/static/root/assets/capability-presets-settings-panel-XsTfkvUn.js +3 -0
  21. package/dist/gateway/static/root/assets/{channel-recipient-api-D-9qiuio.js → channel-recipient-api-CkOKF9nc.js} +1 -1
  22. package/dist/gateway/static/root/assets/{channels-settings-DV5BhAeu.js → channels-settings-DkoAZZMe.js} +1 -1
  23. package/dist/gateway/static/root/assets/channels-status-swr-DNDvMWpl.js +1 -0
  24. package/dist/gateway/static/root/assets/{connectors-api-5FEBYguL.js → connectors-api-FBOe9SWC.js} +1 -1
  25. package/dist/gateway/static/root/assets/connectors-page-e4vekkAu.js +2 -0
  26. package/dist/gateway/static/root/assets/{cron-expression-SEFx5rnr.js → cron-expression-Q4QaYjpI.js} +1 -1
  27. package/dist/gateway/static/root/assets/{date-picker-D4zCUQJL.js → date-picker-Dtn7e6TW.js} +1 -1
  28. package/dist/gateway/static/root/assets/{dependency-picker-DpQAxS2k.js → dependency-picker-Br6nPaM6.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-B_5G3lQl.js → desktop-pet-DzTM6aH8.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-ClEyoUJe.js → desktop-pet-settings-FDmaty3P.js} +1 -1
  31. package/dist/gateway/static/root/assets/{directory-picker-path-field-AsFWmOjG.js → directory-picker-path-field-X2e8xn8j.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-debug-page-C22Y2o5l.js → extension-debug-page-Dx4MBfga.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-page-C61Ikawk.js → extension-page-Bf_FEDhM.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-settings-page-WlWWcDFr.js → extension-settings-page-CrOgZxkf.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-config-api-ByIOMQdc.js → gateway-config-api-CZ4r-7qT.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-config-swr-jB0hAhWO.js → gateway-config-swr-Cv2ywpdb.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-settings-CzzS9A17.js → gateway-settings-DpWmVi0w.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-startup-retry-C-fRlHCL.js → gateway-startup-retry-undf-k5g.js} +1 -1
  39. package/dist/gateway/static/root/assets/heartbeat-settings-DSQZhSvT.js +1 -0
  40. package/dist/gateway/static/root/assets/home-page-L0uHiu0T.js +3 -0
  41. package/dist/gateway/static/root/assets/{index-CR233S0Q.css → index-Bp8I_eX4.css} +1 -1
  42. package/dist/gateway/static/root/assets/index-DRrjYYzZ.js +152 -0
  43. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BD_TFz0_.js → keyboard-shortcuts-settings-Bc3Quw42.js} +1 -1
  44. package/dist/gateway/static/root/assets/local-app-workbench-page-Copi3sdP.js +2 -0
  45. package/dist/gateway/static/root/assets/{local-apps-page-BwbUeLfm.js → local-apps-page-CP9X_vtz.js} +1 -1
  46. package/dist/gateway/static/root/assets/{locale-store-xULEcFVs.js → locale-store-CnamlR07.js} +1 -1
  47. package/dist/gateway/static/root/assets/logs-page-DMKq6e29.js +2 -0
  48. package/dist/gateway/static/root/assets/{management-settings-CW2VpqtT.js → management-settings-CJmcaVje.js} +1 -1
  49. package/dist/gateway/static/root/assets/{markdown-split-B1M9KO16.js → markdown-split-AcuFp0TH.js} +1 -1
  50. package/dist/gateway/static/root/assets/{media-plugins-B_QlNdqZ.js → media-plugins-BvFgsiJL.js} +1 -1
  51. package/dist/gateway/static/root/assets/messages-D7kOD_o_.js +3 -0
  52. package/dist/gateway/static/root/assets/{notes-page-BTbD4GmH.js → notes-page-IW7IQ9nJ.js} +1 -1
  53. package/dist/gateway/static/root/assets/notes-workbench-Zb8U0anO.js +4 -0
  54. package/dist/gateway/static/root/assets/{preview-open-alternatives-CeqtArlZ.js → preview-open-alternatives-C-b34dgQ.js} +1 -1
  55. package/dist/gateway/static/root/assets/{product-open-page-DnalBZZs.js → product-open-page-CWEzLykF.js} +1 -1
  56. package/dist/gateway/static/root/assets/project-detail-page-BuIbLnan.js +1 -0
  57. package/dist/gateway/static/root/assets/projects-page-BwUfRqNV.js +1 -0
  58. package/dist/gateway/static/root/assets/remote-access-hub-BTaXxcEi.js +1 -0
  59. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-cGkBEfg4.js → runtime-tools-settings-panel-DAohEZrX.js} +2 -2
  60. package/dist/gateway/static/root/assets/{schema-form-CmsrLlxu.js → schema-form-C_OBW8A5.js} +1 -1
  61. package/dist/gateway/static/root/assets/sessions-page-BnHoTCD3.js +1 -0
  62. package/dist/gateway/static/root/assets/settings-advanced-gate-BTB_fxjt.js +1 -0
  63. package/dist/gateway/static/root/assets/{settings-form-section-DUWCbaMJ.js → settings-form-section-C7w2WS-A.js} +1 -1
  64. package/dist/gateway/static/root/assets/{settings-loading-skeleton-Bvy5rdMY.js → settings-loading-skeleton-zwibve4m.js} +1 -1
  65. package/dist/gateway/static/root/assets/{settings-page-cZSAwsRR.js → settings-page-B9W03dSW.js} +1 -1
  66. package/dist/gateway/static/root/assets/setup-status-panel-C8Hec2Af.js +1 -0
  67. package/dist/gateway/static/root/assets/{share-preview-page-BzA2NCAH.js → share-preview-page-6e3ks2be.js} +1 -1
  68. package/dist/gateway/static/root/assets/shares-settings-Bwc5HfLI.js +1 -0
  69. package/dist/gateway/static/root/assets/skill-reload-api-D7kunhqy.js +1 -0
  70. package/dist/gateway/static/root/assets/{skills-page-Bvde7_i5.js → skills-page-WgkaNzpc.js} +1 -1
  71. package/dist/gateway/static/root/assets/{skills-page.utils-vXSqHR7g.js → skills-page.utils-D9QT5cxj.js} +1 -1
  72. package/dist/gateway/static/root/assets/{system-settings-panel-9cQGOGCK.js → system-settings-panel-c1HVtv1Y.js} +1 -1
  73. package/dist/gateway/static/root/assets/task-detail-page-CjP-6WVU.js +1 -0
  74. package/dist/gateway/static/root/assets/{theme-store-CHQRiuCF.js → theme-store-BDyUTObE.js} +1 -1
  75. package/dist/gateway/static/root/assets/{use-autosave-7XfKULPI.js → use-autosave-D6UkH_Ga.js} +1 -1
  76. package/dist/gateway/static/root/assets/{user-context-page-CZ9m9aC_.js → user-context-page-D8ZhPDNF.js} +1 -1
  77. package/dist/gateway/static/root/assets/{voice-api-key-field-DXr21v-3.js → voice-api-key-field-BOxkKbGh.js} +1 -1
  78. package/dist/gateway/static/root/assets/{work-discovery-overlay-CeG7g_DZ.js → work-discovery-overlay-Dd19yK9t.js} +1 -1
  79. package/dist/gateway/static/root/assets/work-discovery-page-DUkdJl1e.js +1 -0
  80. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DSQQZP9T.js → workflow-run-setup-panel-ZA3bP65I.js} +2 -2
  81. package/dist/gateway/static/root/assets/workflows-page-C2b5W5bw.js +5 -0
  82. package/dist/gateway/static/root/assets/{working-directory-picker-modal-D-IgcHPp.js → working-directory-picker-modal-BcyiDXU3.js} +1 -1
  83. package/dist/gateway/static/root/index.html +9 -9
  84. package/dist/package.js +1 -1
  85. package/dist/packages/gateway-contract/src/tasks.js +51 -9
  86. package/dist/src/agent/context/execution-scope.js +3 -1
  87. package/dist/src/agent/tasks/task-judge-service.d.ts +1 -1
  88. package/dist/src/agent/tasks/task-judge-service.js +3 -2
  89. package/dist/src/agent/tools/xopc-use-tool.js +13 -3
  90. package/dist/src/auth/oauth/types.d.ts +2 -0
  91. package/dist/src/auth/oauth/xopc-cloud.js +24 -2
  92. package/dist/src/automations/domain/validation.d.ts +0 -12
  93. package/dist/src/automations/draft/automation-draft-validator.d.ts +0 -3
  94. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  95. package/dist/src/gateway/hono/app.js +1 -1
  96. package/dist/src/gateway/hono/oauth-async.js +2 -0
  97. package/dist/src/gateway/hono/routes/agent-stream.js +2 -74
  98. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +62 -0
  99. package/dist/src/gateway/hono/routes/session-input-handler.js +82 -0
  100. package/dist/src/gateway/hono/routes/tasks.js +161 -2
  101. package/dist/src/gateway/service/task-conversation-query-service.d.ts +58 -0
  102. package/dist/src/gateway/service/task-conversation-query-service.js +84 -0
  103. package/dist/src/gateway/service.d.ts +10 -0
  104. package/dist/src/gateway/service.js +75 -42
  105. package/dist/src/projects/project-agent.js +1 -1
  106. package/dist/src/storage/sqlite/migrations/120_task_conversation.sql +112 -0
  107. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  108. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  109. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  110. package/dist/src/storage/sqlite/schema.js +1 -1
  111. package/dist/src/tasks/execution-context.js +8 -4
  112. package/dist/src/tasks/index.d.ts +2 -0
  113. package/dist/src/tasks/index.js +3 -1
  114. package/dist/src/tasks/task-application-service.js +10 -17
  115. package/dist/src/tasks/task-context-assembler.js +9 -4
  116. package/dist/src/tasks/task-context-repository.d.ts +0 -6
  117. package/dist/src/tasks/task-context-repository.js +0 -4
  118. package/dist/src/tasks/task-conversation-repository.d.ts +71 -0
  119. package/dist/src/tasks/task-conversation-repository.js +194 -0
  120. package/dist/src/tasks/task-handoff-service.d.ts +31 -0
  121. package/dist/src/tasks/task-handoff-service.js +143 -0
  122. package/dist/src/tasks/task-read-model-projector.js +1 -5
  123. package/dist/src/tasks/task-repository.d.ts +0 -2
  124. package/dist/src/tasks/task-repository.js +2 -9
  125. package/dist/src/tasks/task-run-coordinator.js +3 -1
  126. package/dist/src/workflows/service/workflow-run-service.js +4 -2
  127. package/package.json +2 -2
  128. package/dist/gateway/static/root/assets/agents-D19uNmJf.js +0 -68
  129. package/dist/gateway/static/root/assets/automations-page-BR6qMOVr.js +0 -6
  130. package/dist/gateway/static/root/assets/browser-settings-page-CDFQWAxI.js +0 -8
  131. package/dist/gateway/static/root/assets/capabilities-settings-panel-D41mssOq.js +0 -7
  132. package/dist/gateway/static/root/assets/capability-presets-settings-panel-BXgCyuu2.js +0 -3
  133. package/dist/gateway/static/root/assets/channels-status-swr-B4Rbh3bM.js +0 -1
  134. package/dist/gateway/static/root/assets/connectors-page-C_qkEN0T.js +0 -2
  135. package/dist/gateway/static/root/assets/heartbeat-settings-B4A_CXUL.js +0 -1
  136. package/dist/gateway/static/root/assets/home-page-FVGYYPWo.js +0 -3
  137. package/dist/gateway/static/root/assets/index-CGbKTCST.js +0 -152
  138. package/dist/gateway/static/root/assets/local-app-workbench-page-BNpkigNb.js +0 -2
  139. package/dist/gateway/static/root/assets/logs-page-DXP9OQQt.js +0 -2
  140. package/dist/gateway/static/root/assets/messages-3qRsLZuX.js +0 -3
  141. package/dist/gateway/static/root/assets/notes-workbench-JRiq7QDW.js +0 -4
  142. package/dist/gateway/static/root/assets/project-detail-page-CjWA13aE.js +0 -1
  143. package/dist/gateway/static/root/assets/projects-page-jsCkScbG.js +0 -1
  144. package/dist/gateway/static/root/assets/remote-access-hub-CGPJTEkM.js +0 -1
  145. package/dist/gateway/static/root/assets/sessions-page-BBHzziMd.js +0 -1
  146. package/dist/gateway/static/root/assets/settings-advanced-gate-2cGg8-9h.js +0 -1
  147. package/dist/gateway/static/root/assets/setup-status-panel-Cf06b66-.js +0 -1
  148. package/dist/gateway/static/root/assets/shares-settings-xlNKydYY.js +0 -1
  149. package/dist/gateway/static/root/assets/skill-reload-api-C5Xu93c_.js +0 -1
  150. package/dist/gateway/static/root/assets/task-detail-page-Bkno4tTe.js +0 -1
  151. package/dist/gateway/static/root/assets/work-discovery-page-CQWZD03N.js +0 -1
  152. package/dist/gateway/static/root/assets/workflows-page-Cs-MXFJ1.js +0 -5
@@ -0,0 +1,3 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{c as i,l as a,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as s}from"./check-DUBLcKHA.js";import{t as c}from"./loader-circle-CifKLtgG.js";import{t as l}from"./cn-JdwAhgNB.js";import{t as u}from"./button-CSEbl4zT.js";import{t as d}from"./messages-D7kOD_o_.js";import{n as f,o as p,r as m}from"./locale-store-CnamlR07.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dist-BPoKqzeH.js";import{n as S}from"./activity-store-DOhnAQOQ.js";import{Ac as C,B as w,Dl as T,I as E,Kt as D,Ml as O,N as k,Na as A,Ol as j,P as M,Ql as N,Ss as P,Tl as F,U as ee,V as te,Wa as ne,Ws as re,Wt as I,Yo as ie,Zr as ae,cs as L,fc as oe,j as se,ls as R,ml as ce,q as le,z as ue}from"./index-DRrjYYzZ.js";var z=e(t(),1),B=n();function V(e){try{return decodeURIComponent(e).trim()||null}catch{return null}}function H(e){if(!e)return null;let t=e.split(/[?#]/,1)[0],n=/^\/chat\/([^/]+)\/?$/.exec(t);if(n){let e=V(n[1]);return!e||e===`new`?null:{kind:`session`,id:e}}return null}async function U(e,t){let n=`/api/sessions/${encodeURIComponent(e.id)}?limit=1`;try{return(await p(m(n),{signal:t})).status===404?`missing`:`available`}catch(e){if(t?.aborted)throw e;return`available`}}var W=r(),G=3,K={info:{Icon:C,className:`text-accent-fg bg-accent-soft`},success:{Icon:F,className:`text-success bg-success-soft`},warning:{Icon:L,className:`text-warning bg-warning-soft`},error:{Icon:T,className:`text-danger bg-danger-soft`}};function q(e,t){let n=Math.max(0,Math.round((Date.now()-e)/1e3));if(n<60)return t===`zh`?`刚刚`:`Just now`;let r=Math.round(n/60);if(r<60)return t===`zh`?`${r} 分钟前`:`${r}m ago`;let i=Math.round(r/60);if(i<24)return t===`zh`?`${i} 小时前`:`${i}h ago`;let a=Math.round(i/24);return t===`zh`?`${a} 天前`:`${a}d ago`}function J(e){let t=(0,B.c)(55),{item:n,targetAvailability:r}=e,i=f(fe),a;t[0]===i?a=t[1]:(a=d(i),t[0]=i,t[1]=a);let s=a.projectsPage.home,u=S(de),{Icon:p,className:m}=K[n.tone],h;t[2]===m?h=t[3]:(h=l(`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg`,m),t[2]=m,t[3]=h);let g;t[4]!==p||t[5]!==n.status?(g=n.status===`running`?(0,W.jsx)(c,{className:`size-3.5 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,W.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),t[4]=p,t[5]=n.status,t[6]=g):g=t[6];let _;t[7]!==h||t[8]!==g?(_=(0,W.jsx)(`div`,{className:h,children:g}),t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]===n.title?v=t[11]:(v=(0,W.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-medium leading-5 text-fg`,children:n.title}),t[10]=n.title,t[11]=v);let y;t[12]!==s.activityUnread||t[13]!==n.read?(y=n.read?null:(0,W.jsx)(`span`,{className:`mt-1.5 size-1.5 shrink-0 rounded-full bg-accent`,"aria-label":s.activityUnread}),t[12]=s.activityUnread,t[13]=n.read,t[14]=y):y=t[14];let b;t[15]!==v||t[16]!==y?(b=(0,W.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[v,y]}),t[15]=v,t[16]=y,t[17]=b):b=t[17];let x;t[18]===n.message?x=t[19]:(x=n.message?(0,W.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.message}):null,t[18]=n.message,t[19]=x);let C;t[20]===n.source?C=t[21]:(C=n.source?(0,W.jsx)(`span`,{className:`max-w-48 truncate`,children:n.source}):null,t[20]=n.source,t[21]=C);let w;t[22]!==n.updatedAt||t[23]!==i?(w=q(n.updatedAt,i),t[22]=n.updatedAt,t[23]=i,t[24]=w):w=t[24];let T;t[25]===w?T=t[26]:(T=(0,W.jsx)(`span`,{children:w}),t[25]=w,t[26]=T);let E;t[27]===n.occurrences?E=t[28]:(E=n.occurrences>1?(0,W.jsxs)(`span`,{children:[`×`,n.occurrences]}):null,t[27]=n.occurrences,t[28]=E);let D;t[29]!==s.activityCheckingRelated||t[30]!==s.activityRelatedMissing||t[31]!==s.activityViewRelated||t[32]!==n.href||t[33]!==r?(D=n.href&&r===`available`?(0,W.jsxs)(o,{to:n.href,className:`inline-flex items-center gap-0.5 font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[s.activityViewRelated,(0,W.jsx)(j,{className:`size-3`,"aria-hidden":!0})]}):n.href&&r===`checking`?(0,W.jsx)(A,{className:`h-3 w-20 rounded`,"aria-label":s.activityCheckingRelated}):n.href&&r===`missing`?(0,W.jsx)(`span`,{className:`font-medium text-fg-subtle`,role:`status`,children:s.activityRelatedMissing}):null,t[29]=s.activityCheckingRelated,t[30]=s.activityRelatedMissing,t[31]=s.activityViewRelated,t[32]=n.href,t[33]=r,t[34]=D):D=t[34];let O;t[35]!==T||t[36]!==E||t[37]!==D||t[38]!==C?(O=(0,W.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] text-fg-subtle`,children:[C,T,E,D]}),t[35]=T,t[36]=E,t[37]=D,t[38]=C,t[39]=O):O=t[39];let k;t[40]!==O||t[41]!==b||t[42]!==x?(k=(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,x,O]}),t[40]=O,t[41]=b,t[42]=x,t[43]=k):k=t[43];let M;t[44]!==n.id||t[45]!==u?(M=()=>u(n.id),t[44]=n.id,t[45]=u,t[46]=M):M=t[46];let N;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,W.jsx)(ie,{className:`size-3.5`,"aria-hidden":!0}),t[47]=N):N=t[47];let P;t[48]!==s.activityRemove||t[49]!==M?(P=(0,W.jsx)(`button`,{type:`button`,className:`rounded-md p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-hover hover:text-fg group-hover:opacity-100 focus:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":s.activityRemove,onClick:M,children:N}),t[48]=s.activityRemove,t[49]=M,t[50]=P):P=t[50];let F;return t[51]!==k||t[52]!==P||t[53]!==_?(F=(0,W.jsxs)(`article`,{className:`group flex items-start gap-3 border-t border-edge-subtle px-1 py-3 first:border-t-0`,children:[_,k,P]}),t[51]=k,t[52]=P,t[53]=_,t[54]=F):F=t[54],F}function de(e){return e.remove}function fe(e){return e.language}function pe(){let e=(0,B.c)(14),t=d(f(be)).projectsPage.home,n=S(ye),r=S(ve),i=S(_e),[a,o]=(0,z.useState)(!1),l;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={},e[0]=l):l=e[0];let[p,m]=(0,z.useState)(l),h;e[1]===n?h=e[2]:(h=n.filter($),e[1]=n,e[2]=h);let g=h.length,_;e[3]===n?_=e[4]:(_=n.filter(Q),e[3]=n,e[4]=_);let v=_.length,y;e[5]!==a||e[6]!==n?(y=a?n:n.slice(0,G),e[5]=a,e[6]=n,e[7]=y):y=e[7];let b=y,x;e[8]===n?x=e[9]:(x=[...new Set(n.flatMap(ge))].sort().join(`
2
+ `),e[8]=n,e[9]=x);let C=x,w,T;e[10]===C?(w=e[11],T=e[12]):(w=()=>{let e=new AbortController,t=new Map((C?C.split(`
3
+ `):[]).flatMap(he));return m(Object.fromEntries([...t.keys()].map(me))),Promise.all([...t].map(async t=>{let[n,r]=t,i=await U(r,e.signal);e.signal.aborted||m(e=>({...e,[n]:i}))})).catch(Z),()=>e.abort()},T=[C],e[10]=C,e[11]=w,e[12]=T),(0,z.useEffect)(w,T);let E;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,W.jsx)(N,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),e[13]=E):E=e[13],(0,W.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,"aria-labelledby":`workbench-activity-title`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,W.jsx)(`div`,{children:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[E,(0,W.jsx)(`h2`,{id:`workbench-activity-title`,className:`text-sm font-semibold text-fg`,children:t.activityTitle}),g>0?(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:[(0,W.jsx)(c,{className:`size-3 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),g,` `,t.running]}):v>0?(0,W.jsxs)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[v,` `,t.activityNew]}):null]})}),a&&n.length>0?(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[v>0?(0,W.jsxs)(u,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:r,children:[(0,W.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),t.activityMarkRead]}):null,n.some(X)?(0,W.jsxs)(u,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-fg-muted`,onClick:i,children:[(0,W.jsx)(R,{className:`size-3.5`,"aria-hidden":!0}),t.activityClearFinished]}):null]}):null]}),n.length>0?(0,W.jsxs)(`div`,{className:`mt-3 px-1`,children:[b.map(e=>(0,W.jsx)(J,{item:e,targetAvailability:e.href&&H(e.href)?p[e.href]??`checking`:`available`},e.id)),n.length>G?(0,W.jsx)(`div`,{className:`border-t border-edge-subtle py-2 text-center`,children:(0,W.jsx)(u,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>o(Y),children:a?t.activityShowLess:t.activityShowAll.replace(`{{count}}`,String(n.length))})}):null]}):(0,W.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-sm text-fg-muted`,children:[(0,W.jsx)(ce,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,W.jsx)(`p`,{children:t.activityEmpty})]})]})}function Y(e){return!e}function X(e){return e.status===`done`}function Z(){}function me(e){return[e,`checking`]}function he(e){let t=H(e);return t?[[e,t]]:[]}function ge(e){return e.href&&H(e.href)?[e.href]:[]}function Q(e){return!e.read}function $(e){return e.status===`running`}function _e(e){return e.clearFinished}function ve(e){return e.markAllRead}function ye(e){return e.items}function be(e){return e.language}function xe(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Se(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:ae(n)}function Ce(e){let t=(0,B.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,W.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function we(e){let t=(0,B.c)(18),{task:n,statusLabel:r,backgroundPath:i}=e,a;t[0]!==i||t[1]!==n.id?(a=D(i,n.id),t[0]=i,t[1]=n.id,t[2]=a):a=t[2];let s;t[3]===n.title?s=t[4]:(s=(0,W.jsx)(`h3`,{className:`line-clamp-2 text-sm font-semibold text-fg`,children:n.title}),t[3]=n.title,t[4]=s);let c;t[5]===n.updatedAt?c=t[6]:(c=Se(n.updatedAt,``),t[5]=n.updatedAt,t[6]=c);let l;t[7]===c?l=t[8]:(l=(0,W.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:c}),t[7]=c,t[8]=l);let u;t[9]!==s||t[10]!==l?(u=(0,W.jsxs)(`div`,{className:`min-w-0`,children:[s,l]}),t[9]=s,t[10]=l,t[11]=u):u=t[11];let d;t[12]===r?d=t[13]:(d=(0,W.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:r}),t[12]=r,t[13]=d);let f;return t[14]!==a||t[15]!==u||t[16]!==d?(f=(0,W.jsxs)(o,{to:a,className:`group flex items-start justify-between gap-3 rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,d]}),t[14]=a,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function Te(e){let t=(0,B.c)(12),{receipt:n,evidenceLabel:r,remainingLabel:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,W.jsx)(F,{className:`mt-0.5 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[0]=a):a=t[0];let o,s;t[1]===n.summary?(o=t[2],s=t[3]):(o=(0,W.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:n.summary}),s=(0,W.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.summary}),t[1]=n.summary,t[2]=o,t[3]=s);let c=n.remainingWork.length>0?` · ${n.remainingWork.length} ${i}`:``,l;t[4]!==r||t[5]!==n.evidence.length||t[6]!==c?(l=(0,W.jsxs)(`p`,{className:`mt-2 text-[11px] text-fg-subtle`,children:[n.evidence.length,` `,r,c]}),t[4]=r,t[5]=n.evidence.length,t[6]=c,t[7]=l):l=t[7];let u;return t[8]!==o||t[9]!==s||t[10]!==l?(u=(0,W.jsx)(`div`,{className:`block rounded-xl border border-edge-subtle px-3 py-3`,children:(0,W.jsxs)(`div`,{className:`flex items-start gap-2`,children:[a,(0,W.jsxs)(`div`,{className:`min-w-0`,children:[o,s,l]})]})}),t[8]=o,t[9]=s,t[10]=l,t[11]=u):u=t[11],u}function Ee(){let e=(0,B.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,W.jsx)(A,{className:`h-20 rounded-2xl`}),(0,W.jsx)(A,{className:`h-72 rounded-2xl`}),(0,W.jsx)(A,{className:`h-44 rounded-2xl`})]}),e[0]=t):t=e[0],t}function De(e){let t=(0,B.c)(15),{chat:n,statusLabel:r}=e,i=`/chat/${encodeURIComponent(n.key)}`,a;t[0]===n.name?a=t[1]:(a=(0,W.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:n.name}),t[0]=n.name,t[1]=a);let s;t[2]===r?s=t[3]:(s=(0,W.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:r}),t[2]=r,t[3]=s);let c;t[4]!==a||t[5]!==s?(c=(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[a,s]}),t[4]=a,t[5]=s,t[6]=c):c=t[6];let l;t[7]===n.updatedAt?l=t[8]:(l=Se(n.updatedAt,``),t[7]=n.updatedAt,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,W.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:l}),t[9]=l,t[10]=u);let d;return t[11]!==i||t[12]!==c||t[13]!==u?(d=(0,W.jsxs)(o,{to:i,className:`group block rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[c,u]}),t[11]=i,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function Oe(e){let t=(0,B.c)(27),{item:n,href:r,kindLabel:i,reasonLabel:a,approveLabel:s,denyLabel:c,busy:l,onRespond:d}=e,f;t[0]===n.title?f=t[1]:(f=(0,W.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=f);let p=n.projectName||i,m;t[2]===p?m=t[3]:(m=(0,W.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:p}),t[2]=p,t[3]=m);let h;t[4]!==f||t[5]!==m?(h=(0,W.jsxs)(`div`,{className:`min-w-0`,children:[f,m]}),t[4]=f,t[5]=m,t[6]=h):h=t[6];let g;t[7]===a?g=t[8]:(g=(0,W.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel/80 px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[7]=a,t[8]=g);let _;t[9]!==h||t[10]!==g?(_=(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[h,g]}),t[9]=h,t[10]=g,t[11]=_):_=t[11];let v;t[12]===n.detail?v=t[13]:(v=n.detail?(0,W.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.detail}):null,t[12]=n.detail,t[13]=v);let y;t[14]!==r||t[15]!==_||t[16]!==v?(y=(0,W.jsxs)(o,{to:r,className:`group block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[_,v]}),t[14]=r,t[15]=_,t[16]=v,t[17]=y):y=t[17];let b;t[18]!==s||t[19]!==l||t[20]!==c||t[21]!==n.response||t[22]!==d?(b=n.response?(0,W.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t border-warning/20 pt-3`,children:[(0,W.jsx)(u,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:l,onClick:()=>d(`deny`),children:c}),(0,W.jsx)(u,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:l,onClick:()=>d(`approve`),children:s})]}):null,t[18]=s,t[19]=l,t[20]=c,t[21]=n.response,t[22]=d,t[23]=b):b=t[23];let x;return t[24]!==y||t[25]!==b?(x=(0,W.jsxs)(`article`,{className:`rounded-xl border border-warning/35 bg-warning-soft/25 p-3.5 transition-colors hover:bg-warning-soft/40`,children:[y,b]}),t[24]=y,t[25]=b,t[26]=x):x=t[26],x}function ke(e){let t=(0,B.c)(74),{item:n,labels:r,busy:i,onDecide:a,onSnooze:o,onDismiss:s,onInstruct:c}=e,[l,d]=(0,z.useState)(``),f=n.judgment,p;t[0]===n.title?p=t[1]:(p=(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=p);let m;t[2]===n.detail?m=t[3]:(m=(0,W.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:n.detail}),t[2]=n.detail,t[3]=m);let h;t[4]!==p||t[5]!==m?(h=(0,W.jsxs)(`div`,{className:`min-w-0`,children:[p,m]}),t[4]=p,t[5]=m,t[6]=h):h=t[6];let g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,W.jsx)(P,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=g):g=t[7];let _;t[8]===h?_=t[9]:(_=(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[h,g]}),t[8]=h,t[9]=_);let v;t[10]!==f.whyNow||t[11]!==r.whyNow?(v=[r.whyNow,f.whyNow],t[10]=f.whyNow,t[11]=r.whyNow,t[12]=v):v=t[12];let y;t[13]!==f.impact||t[14]!==r.impact?(y=[r.impact,f.impact],t[13]=f.impact,t[14]=r.impact,t[15]=y):y=t[15];let b;t[16]!==f.workDone||t[17]!==r.workDone?(b=[r.workDone,f.workDone],t[16]=f.workDone,t[17]=r.workDone,t[18]=b):b=t[18];let x;t[19]!==f.recommendation||t[20]!==r.recommendation?(x=[r.recommendation,f.recommendation],t[19]=f.recommendation,t[20]=r.recommendation,t[21]=x):x=t[21];let S;t[22]!==v||t[23]!==y||t[24]!==b||t[25]!==x?(S=(0,W.jsx)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[v,y,b,x].map(Ae)}),t[22]=v,t[23]=y,t[24]=b,t[25]=x,t[26]=S):S=t[26];let C;t[27]!==f.actionError||t[28]!==f.actionStatus||t[29]!==f.dispositionReason||t[30]!==f.proposedActionTitle||t[31]!==r.actionStates||t[32]!==r.policyReason||t[33]!==r.proposedAction?(C=f.dispositionReason?(0,W.jsxs)(`div`,{className:`mt-3 rounded-lg border border-edge-subtle bg-surface-panel/70 p-3 text-xs leading-5`,children:[(0,W.jsx)(`p`,{className:`font-medium text-fg-subtle`,children:r.policyReason}),(0,W.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:f.dispositionReason}),f.proposedActionTitle?(0,W.jsxs)(`p`,{className:`mt-2 text-fg`,children:[(0,W.jsxs)(`span`,{className:`font-medium`,children:[r.proposedAction,`:`]}),f.proposedActionTitle,f.actionStatus?` · ${r.actionStates[f.actionStatus]}`:``]}):null,f.actionError?(0,W.jsx)(`p`,{className:`mt-1 text-danger`,children:f.actionError}):null]}):null,t[27]=f.actionError,t[28]=f.actionStatus,t[29]=f.dispositionReason,t[30]=f.proposedActionTitle,t[31]=r.actionStates,t[32]=r.policyReason,t[33]=r.proposedAction,t[34]=C):C=t[34];let w;t[35]!==i||t[36]!==f.decision||t[37]!==a?(w=f.decision?(0,W.jsxs)(`div`,{className:`mt-4`,children:[(0,W.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f.decision.question}),(0,W.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:f.decision.options.map(e=>(0,W.jsxs)(u,{type:`button`,variant:`secondary`,className:`h-auto min-h-9 flex-col items-start px-3 py-2 text-left`,disabled:i,title:e.consequence,onClick:()=>a(e.id),children:[(0,W.jsx)(`span`,{children:e.label}),(0,W.jsx)(`span`,{className:`text-[10px] font-normal text-fg-muted`,children:e.consequence})]},e.id))})]}):null,t[35]=i,t[36]=f.decision,t[37]=a,t[38]=w):w=t[38];let T;t[39]!==i||t[40]!==r.snooze||t[41]!==o?(T=(0,W.jsx)(u,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:i,onClick:o,children:r.snooze}),t[39]=i,t[40]=r.snooze,t[41]=o,t[42]=T):T=t[42];let E;t[43]!==i||t[44]!==r.dismiss||t[45]!==s?(E=(0,W.jsx)(u,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:i,onClick:s,children:r.dismiss}),t[43]=i,t[44]=r.dismiss,t[45]=s,t[46]=E):E=t[46];let D;t[47]!==T||t[48]!==E?(D=(0,W.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 border-t border-edge-subtle pt-3`,children:[T,E]}),t[47]=T,t[48]=E,t[49]=D):D=t[49];let O;t[50]!==l||t[51]!==c?(O=e=>{e.preventDefault();let t=l.trim();t&&(c(t),d(``))},t[50]=l,t[51]=c,t[52]=O):O=t[52];let k;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>d(e.target.value),t[53]=k):k=t[53];let A;t[54]!==l||t[55]!==r.feedbackPlaceholder?(A=(0,W.jsx)(`input`,{className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-base px-3 py-2 text-xs text-fg outline-none focus:border-accent`,value:l,onChange:k,placeholder:r.feedbackPlaceholder}),t[54]=l,t[55]=r.feedbackPlaceholder,t[56]=A):A=t[56];let j;t[57]!==i||t[58]!==l?(j=i||!l.trim(),t[57]=i,t[58]=l,t[59]=j):j=t[59];let M;t[60]!==r.applyFeedback||t[61]!==j?(M=(0,W.jsx)(u,{type:`submit`,variant:`secondary`,className:`h-9 px-3`,disabled:j,children:r.applyFeedback}),t[60]=r.applyFeedback,t[61]=j,t[62]=M):M=t[62];let N;t[63]!==O||t[64]!==A||t[65]!==M?(N=(0,W.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:O,children:[A,M]}),t[63]=O,t[64]=A,t[65]=M,t[66]=N):N=t[66];let F;return t[67]!==S||t[68]!==C||t[69]!==w||t[70]!==D||t[71]!==N||t[72]!==_?(F=(0,W.jsxs)(`article`,{className:`rounded-xl border border-accent/25 bg-accent-soft/15 p-4`,children:[_,S,C,w,D,N]}),t[67]=S,t[68]=C,t[69]=w,t[70]=D,t[71]=N,t[72]=_,t[73]=F):F=t[73],F}function Ae(e){let[t,n]=e;return(0,W.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 p-3`,children:[(0,W.jsx)(`p`,{className:`text-[11px] font-medium text-fg-subtle`,children:t}),(0,W.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg`,children:n})]},t)}function je(e){let t=(0,B.c)(32),{item:n,href:r,statusLabel:i,retryLabel:a,viewLabel:s,acknowledgeLabel:c,busy:l,onView:d,onRetry:f,onAcknowledge:p}=e,m;t[0]===n.title?m=t[1]:(m=(0,W.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=m);let h;t[2]===i?h=t[3]:(h=(0,W.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel/80 px-2 py-0.5 text-[11px] font-medium text-danger`,children:i}),t[2]=i,t[3]=h);let g;t[4]!==m||t[5]!==h?(g=(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[m,h]}),t[4]=m,t[5]=h,t[6]=g):g=t[6];let _;t[7]===n.detail?_=t[8]:(_=(0,W.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:n.detail}),t[7]=n.detail,t[8]=_);let v;t[9]!==r||t[10]!==g||t[11]!==_?(v=(0,W.jsxs)(o,{to:r,className:`block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[g,_]}),t[9]=r,t[10]=g,t[11]=_,t[12]=v):v=t[12];let y;t[13]!==c||t[14]!==l||t[15]!==p?(y=(0,W.jsx)(u,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:l,onClick:p,children:c}),t[13]=c,t[14]=l,t[15]=p,t[16]=y):y=t[16];let b;t[17]!==l||t[18]!==d||t[19]!==s?(b=(0,W.jsx)(u,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:l,onClick:d,children:s}),t[17]=l,t[18]=d,t[19]=s,t[20]=b):b=t[20];let x;t[21]!==l||t[22]!==f||t[23]!==a?(x=(0,W.jsx)(u,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:l,onClick:f,children:a}),t[21]=l,t[22]=f,t[23]=a,t[24]=x):x=t[24];let S;t[25]!==y||t[26]!==b||t[27]!==x?(S=(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2 border-t border-danger/15 pt-3`,children:[y,b,x]}),t[25]=y,t[26]=b,t[27]=x,t[28]=S):S=t[28];let C;return t[29]!==v||t[30]!==S?(C=(0,W.jsxs)(`article`,{className:`rounded-xl border border-danger/25 bg-danger-soft/35 p-3.5`,children:[v,S]}),t[29]=v,t[30]=S,t[31]=C):C=t[31],C}function Me(){let e=f(e=>e.language),t=d(e).projectsPage,n=le(e),r=a(),s=i(),c=`${s.pathname}${s.search}`,l=ne(e=>e.setPageHeader),p=ne(e=>e.clearPageHeader),[m,S]=(0,z.useState)(null),[C,A]=(0,z.useState)(!0),[j,N]=(0,z.useState)(null),[ae,L]=(0,z.useState)(!1),[R,ce]=(0,z.useState)(``),[B,V]=(0,z.useState)(()=>crypto.randomUUID()),[H,U]=(0,z.useState)(!1),[G,K]=(0,z.useState)(null),[q,J]=(0,z.useState)(null),[de,fe]=(0,z.useState)(null),Y=(0,z.useCallback)(async(t=!1)=>{t&&A(!0),N(null);try{S(await E(e))}catch(e){N(e instanceof Error?e.message:String(e))}finally{A(!1)}},[e]);(0,z.useEffect)(()=>{Y(!0)},[Y]),(0,z.useEffect)(()=>{let e,t=t=>{e!==void 0&&window.clearTimeout(e),e=window.setTimeout(()=>{e=void 0,Y()},t)},n=()=>t(100),r=()=>t(750),i=[`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`workflow-run-updated`,`workflow-run-error`],a=[`session-updated`,`session-transcript-updated`];return i.forEach(e=>window.addEventListener(e,n)),a.forEach(e=>window.addEventListener(e,r)),()=>{i.forEach(e=>window.removeEventListener(e,n)),a.forEach(e=>window.removeEventListener(e,r)),e!==void 0&&window.clearTimeout(e)}},[Y]);let X=(0,z.useMemo)(()=>m?.decisions??[],[m]),Z=(0,z.useMemo)(()=>m?.attention??[],[m]),me=(0,z.useCallback)(async t=>{t.preventDefault();let n=R.trim();if(!(!n||H)){U(!0),K(null);try{let t=await k({idempotencyKey:B,title:n,locale:e,priority:`normal`,contract:{objective:n,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:[],context:[],authorityGrants:[],activation:{mode:`start`}});L(!1),ce(``),V(crypto.randomUUID()),r(D(c,t.task.id))}catch(e){K(e instanceof Error?e.message:String(e))}finally{U(!1)}}},[c,B,H,e,r,R]),he=(0,z.useMemo)(()=>(0,W.jsxs)(u,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>L(!0),children:[(0,W.jsx)(re,{className:`size-4`,"aria-hidden":!0}),n.newWork]}),[n.newWork]),ge=(0,z.useCallback)(async(e,t)=>{if(e.response){J(e.id),N(null);try{await w(e.response,t),await Y()}catch(e){N(e instanceof Error?e.message:String(e))}finally{J(null)}}},[Y]),Q=(0,z.useCallback)(async(e,t)=>{J(e.id),N(null);try{await t(),await Y()}catch(e){N(e instanceof Error?e.message:String(e))}finally{J(null)}},[Y]),$=(0,z.useCallback)(async(e,t)=>{fe(e.id),N(null);try{await t({kind:e.kind,runId:e.runId}),await Y()}catch(e){N(e instanceof Error?e.message:String(e))}finally{fe(null)}},[Y]);return(0,z.useLayoutEffect)(()=>(l({startExtra:null,main:(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),(0,W.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:t.home.subtitle})]}),end:he}),()=>p()),[p,he,l,t.title,t.home.subtitle]),(0,W.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[1200px] flex-1 flex-col gap-7 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,W.jsx)(x,{open:ae,onOpenChange:e=>{H||L(e),e&&(K(null),V(crypto.randomUUID()))},children:(0,W.jsxs)(v,{children:[(0,W.jsx)(h,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,W.jsxs)(y,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,W.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(b,{className:`text-base font-semibold text-fg`,children:n.dialogTitle}),(0,W.jsx)(g,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:n.dialogDescription})]}),(0,W.jsx)(_,{asChild:!0,children:(0,W.jsx)(u,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:t.cancel,"aria-label":t.cancel,children:(0,W.jsx)(ie,{className:`size-4`,"aria-hidden":!0})})})]}),(0,W.jsxs)(`form`,{onSubmit:me,className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,children:[(0,W.jsx)(`label`,{htmlFor:`new-work-task`,className:`mb-2 shrink-0 text-sm font-medium text-fg`,children:n.intentLabel}),(0,W.jsx)(`textarea`,{id:`new-work-task`,className:`min-h-32 w-full flex-1 resize-none rounded-xl border border-edge bg-surface-base p-3 text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,value:R,onChange:e=>{ce(e.target.value),V(crypto.randomUUID())},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},placeholder:n.intentPlaceholder,maxLength:12e3,autoFocus:!0}),(0,W.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,W.jsx)(`span`,{children:t.home.submitShortcut}),(0,W.jsxs)(`span`,{className:`tabular-nums`,children:[R.length.toLocaleString(),` / `,12e3.toLocaleString()]})]}),G?(0,W.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:G}):null]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,W.jsx)(_,{asChild:!0,children:(0,W.jsx)(u,{type:`button`,variant:`ghost`,disabled:H,children:t.cancel})}),(0,W.jsxs)(u,{type:`submit`,variant:`primary`,className:`min-w-32`,disabled:!R.trim()||H,children:[(0,W.jsx)(P,{className:`size-4`,"aria-hidden":!0}),H?n.starting:n.submit]})]})]})]})]})}),j?(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,W.jsx)(`span`,{children:j}),(0,W.jsx)(u,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Y(),children:t.home.retry})]}):null,C?(0,W.jsx)(Ee,{}):m?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`section`,{className:`border-b border-edge-subtle pb-5`,children:[(0,W.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:t.home.briefingTitle}),(0,W.jsx)(`h2`,{className:`mt-1 text-xl font-semibold tracking-tight text-fg`,children:m.decisions.length+m.attention.length>0?xe(t.home.todaySummary,{attention:m.decisions.length+m.attention.length,moving:m.briefing.progress.movingCount+m.chats.running.length}):xe(t.home.todaySummaryClear,{moving:m.briefing.progress.movingCount+m.chats.running.length})}),m.briefing.summary?(0,W.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-fg-muted`,children:m.briefing.summary}):null]}),m.tasks.running.length===0&&m.workflowRuns.active.length===0&&m.decisions.length===0&&m.attention.length===0&&m.chats.running.length===0&&m.chats.recent.length===0&&m.upcomingAutomations.length===0?(0,W.jsxs)(`section`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,W.jsx)(oe,{className:`mx-auto size-6 text-accent`,"aria-hidden":!0}),(0,W.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:t.home.emptyTitle}),(0,W.jsx)(`p`,{className:`mx-auto mt-1 max-w-lg text-sm leading-6 text-fg-muted`,children:t.home.emptyBody}),(0,W.jsxs)(`div`,{className:`mt-4 flex justify-center gap-2`,children:[(0,W.jsx)(u,{type:`button`,variant:`primary`,onClick:()=>r(`/chat/new`),children:t.home.startChat}),(0,W.jsx)(u,{type:`button`,variant:`secondary`,onClick:()=>L(!0),children:n.newWork})]})]}):null,(0,W.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 space-y-6`,children:[Z.length>0?(0,W.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(T,{className:`size-4 text-danger`,"aria-hidden":!0}),(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.runAttention}),(0,W.jsx)(Ce,{children:Z.length.toLocaleString()})]}),(0,W.jsx)(`div`,{className:`mt-4 space-y-2`,children:Z.map(e=>(0,W.jsx)(je,{item:e,href:I(c,e.href),statusLabel:e.reason===`run_timeout`?t.home.attentionTimeout:t.home.attentionFailed,retryLabel:t.home.attentionRetry,viewLabel:t.home.attentionView,acknowledgeLabel:t.home.attentionAcknowledge,busy:de===e.id,onView:()=>r(I(c,e.href)),onRetry:()=>void $(e,te),onAcknowledge:()=>void $(e,se)},e.id))})]}):null,X.length>0?(0,W.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(T,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.needsAttention}),(0,W.jsx)(Ce,{children:X.length.toLocaleString()})]}),(0,W.jsx)(`div`,{className:`mt-4 space-y-2`,children:X.map(e=>e.kind===`agent_judgment`&&e.judgment?(0,W.jsx)(ke,{item:e,labels:n,busy:q===e.id,onDecide:t=>void Q(e,()=>M(e.judgment.inboxItemId,t)),onSnooze:()=>void Q(e,()=>ee(e.judgment.inboxItemId,`snoozed`)),onDismiss:()=>void Q(e,()=>ee(e.judgment.inboxItemId,`resolved`)),onInstruct:t=>void Q(e,()=>ue(e.judgment.inboxItemId,t))},e.id):(0,W.jsx)(Oe,{item:e,href:I(c,e.href),kindLabel:t.home.decisionKinds[e.kind],reasonLabel:t.home.decisionReasons[e.reason],approveLabel:t.home.approve,denyLabel:t.home.deny,busy:q===e.id,onRespond:t=>void ge(e,t)},e.id))})]}):(0,W.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,W.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full bg-success-soft text-xs text-success`,"aria-hidden":!0,children:`✓`}),t.home.nothingNeedsYou]}),(0,W.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(P,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.running}),(0,W.jsx)(Ce,{children:m.tasks.running.length.toLocaleString()})]}),(0,W.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[m.tasks.running.map(e=>(0,W.jsx)(we,{task:e,statusLabel:n.taskStatuses.running,backgroundPath:c},e.id)),m.tasks.running.length===0?(0,W.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:n.emptyRunning}):null]})]}),m.chats.recent.length>0?(0,W.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,W.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.recent})}),(0,W.jsx)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:m.chats.recent.slice(0,6).map(e=>(0,W.jsx)(De,{chat:e,statusLabel:n.openChat},e.key))})]}):null]}),(0,W.jsxs)(`aside`,{className:`min-w-0 space-y-4`,"aria-label":t.home.nowTitle,children:[(0,W.jsx)(`div`,{className:`px-1`,children:(0,W.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.home.nowTitle})}),m.upcomingAutomations.length>0?(0,W.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(O,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.home.scheduled})]}),(0,W.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle`,children:m.upcomingAutomations.slice(0,3).map(e=>(0,W.jsxs)(o,{to:`/automations`,className:`flex items-center justify-between gap-3 rounded-lg px-1 py-3 text-sm hover:bg-surface-hover/55`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.name||e.action}),(0,W.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:Se(e.nextRunAt,t.never)})]},e.id))})]}):null,m.recentTasks.length>0?(0,W.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(F,{className:`size-4 text-success`,"aria-hidden":!0}),(0,W.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.recentTasks})]}),(0,W.jsx)(`div`,{className:`mt-3 space-y-2`,children:m.recentTasks.slice(0,3).map(e=>(0,W.jsx)(Te,{receipt:e,evidenceLabel:n.evidenceCount,remainingLabel:n.remainingCount},e.runId))})]}):null,(0,W.jsx)(pe,{}),m.briefing.wins.length>0?(0,W.jsxs)(o,{to:m.briefing.wins[0].href,className:`flex items-center justify-between gap-3 rounded-xl px-2 py-2 text-sm text-fg-muted hover:bg-surface-hover/55 hover:text-fg`,children:[(0,W.jsx)(`span`,{children:xe(t.home.completedSummary,{count:m.briefing.wins.length})}),(0,W.jsxs)(`span`,{className:`shrink-0 text-xs font-medium text-accent`,children:[t.home.viewLatestResult,` →`]})]}):null]})]})]}):null]})}export{Me as HomePage};