@xopcai/xopc 0.0.205 → 0.0.206
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.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-DJBadfSX.js → activity-store-URW-e_me.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Br6C32BX.js → agent-avatar-dicebear-BLK6kRCJ.js} +1 -1
- package/dist/gateway/static/root/assets/agents-D5HVmdNx.js +68 -0
- package/dist/gateway/static/root/assets/{api-B5O7fKXa.js → api-C_MS4arC.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-Le1vJ1OO.js → app-management-settings-panel-CnUN6BJk.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CZlAU60t.js → appearance-settings-C8Nx8hZE.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DKCA_LFY.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CRzXRXPE.js → archive-plugin-C7FqeJZD.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CYAAQ6Qi.js → attachment-load-DCYQgsYE.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-BEOE4ZKM.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CVR5cUmS.js → binary-plugins-Bf1WROsh.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CFe74rWi.js → block-editor-BPK08Pjv.js} +46 -46
- package/dist/gateway/static/root/assets/browser-settings-page-CLRmMdU9.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-Bd68yluo.js → browser-workflow-inputs-cqVoDHyp.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-B0uiDLga.js → browser-workflows-page-Des1UTsS.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BNcVi4ar.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-BerPMp6f.js → capability-presets-api-D4MjqV2a.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-DJjVOCJY.js → capability-presets-settings-panel-uFwW2ah5.js} +2 -2
- package/dist/gateway/static/root/assets/{channel-recipient-api-D2d21_XA.js → channel-recipient-api-CcimZduy.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-DSLP8OjS.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-D0OR6Ylw.js +1 -0
- package/dist/gateway/static/root/assets/chat-terminal-dock-B1njb2Cr.css +1 -0
- package/dist/gateway/static/root/assets/chat-terminal-dock-wpi7abPg.js +38 -0
- package/dist/gateway/static/root/assets/{connectors-api-Bq_vUzxP.js → connectors-api-CUvFu8jh.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-BJoHjWnu.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-DZBxmKGR.js → cron-expression-hFSZZpvM.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-BNHd7HT7.js → date-picker-CKZ0gc-Y.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-D1kJBknt.js → dependency-picker-zv1oHtg4.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Di75oHkC.js → desktop-pet-DY9ykMtD.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-D6tD1uym.js → desktop-pet-settings-XiSmmt26.js} +1 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-CZkgk15r.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-D91_S7NQ.js → extension-debug-page-CTppsTEi.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DHzmmr_N.js → extension-page-CHRTUvAa.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BpJNtePi.js → extension-settings-page-z2UBx25A.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-BAzLYTKZ.js → gateway-config-api-DzFPJTnm.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-VVcfd3sG.js → gateway-config-swr-CGpoH1gU.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-C5-aKkTp.js → gateway-settings-DBa2I6VM.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-qAX_T2t2.js → gateway-startup-retry-Te-TREBt.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DyQGGdBu.js +1 -0
- package/dist/gateway/static/root/assets/home-page-EkT4eGeP.js +3 -0
- package/dist/gateway/static/root/assets/index-BpLqHdfz.css +2 -0
- package/dist/gateway/static/root/assets/index-CrwXzRpA.js +85 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-fpNjXnJK.js → keyboard-shortcuts-settings-fb0zS8pk.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CCC3Cvb8.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DBpQIfNd.js → local-apps-page-DFdheruU.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CbPVxonP.js → locale-store-CieddUjx.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-BmXcJCKz.js → logs-page-B6jfkNDF.js} +2 -2
- package/dist/gateway/static/root/assets/{management-settings-CiK7Xkvi.js → management-settings-D3PsQ612.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-DVgpcOze.js → markdown-split-x5K52Thz.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-Dl-0_9JR.js → markdown-view-Cjjey5Y6.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DMj1lW-n.js → media-plugins-DNtEkRAh.js} +1 -1
- package/dist/gateway/static/root/assets/messages-CySMn8WL.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-DvX1sTlf.js → notes-page-nWEqlwDw.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-QstkgWsW.js +4 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DvsLigha.js → preview-open-alternatives-CXcIKVi9.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-DbCraAI3.js → product-open-page-CZLJudPk.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Cf1v94LO.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BRMZkNht.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-D55FTXZw.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DzuUglQo.js → runtime-tools-settings-panel-RYjduQV6.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-plDnazVj.js → schema-form--1ZXg4qC.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-C5Yy6eIn.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BqO_8bUh.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BwAxX_7e.js → settings-form-section-71-8j3zt.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-B3OiTnF9.js → settings-loading-skeleton-C5Jn1l0q.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DvIWXBvp.js → settings-page-TYYGe6kZ.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DThKKjLV.js → setup-status-panel-jA5I-17g.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CFnoGHJb.js → share-preview-page-BMUQIGfk.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Dru1a2rZ.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-C8iqS6kF.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-B38fY22S.js → skills-page-BzZT1SKg.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-vLIlk1c3.js → skills-page.utils-DnaBw5Ji.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DRV2wljT.js → system-settings-panel-DqiPQgVI.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-DQP5vDr-.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-Bc_eRUev.js → theme-store-BP3_RpaY.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-DTu23D9J.js → use-autosave-BJkQ-vpu.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-DCwqzN03.js → user-context-page-BP8-sOPi.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-CVDMesWc.js → voice-api-key-field-C6c8e7Mx.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-cyt93k0V.js → work-discovery-overlay-CCNjWKql.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-DL_Ie0s2.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DrdcfX_N.js → workflow-run-setup-panel-DLO-dMSN.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-B4-k2FHB.js +5 -0
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-CYWdZUJ5.js → working-directory-picker-modal-vWi33CZJ.js} +1 -1
- package/dist/gateway/static/root/index.html +10 -10
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +11 -0
- package/dist/src/agent/agent-manager.js +36 -6
- package/dist/src/agent/service.d.ts +4 -1
- package/dist/src/agent/service.js +12 -0
- package/dist/src/agent/tools/xopc-use-tool.js +6 -2
- package/dist/src/automations/api/routes.js +8 -0
- package/dist/src/automations/domain/index.js +2 -2
- package/dist/src/automations/domain/types.d.ts +17 -12
- package/dist/src/automations/domain/validation.d.ts +30 -32
- package/dist/src/automations/domain/validation.js +8 -10
- package/dist/src/automations/draft/automation-draft-prompt.js +9 -5
- package/dist/src/automations/draft/automation-draft-validator.d.ts +3 -8
- package/dist/src/automations/draft/automation-draft-validator.js +3 -3
- package/dist/src/automations/index.js +2 -2
- package/dist/src/automations/service/action-executor.js +13 -4
- package/dist/src/automations/service/automation-service.d.ts +5 -1
- package/dist/src/automations/service/automation-service.js +19 -12
- package/dist/src/automations/storage/automation-repository.js +8 -4
- package/dist/src/automations/storage/automation-run-repository.d.ts +5 -0
- package/dist/src/automations/storage/automation-run-repository.js +24 -8
- package/dist/src/automations/storage/index.js +2 -2
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/gateway/automation-agent-session.d.ts +4 -0
- package/dist/src/gateway/automation-agent-session.js +40 -0
- package/dist/src/gateway/dreaming-automation-reconciler.js +3 -2
- package/dist/src/gateway/hono/routes/commands-skills.js +36 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -0
- package/dist/src/gateway/service/marketplace-service.d.ts +4 -1
- package/dist/src/gateway/service/marketplace-service.js +9 -0
- package/dist/src/gateway/service.js +19 -2
- package/dist/src/mobile/notification-service.js +7 -4
- package/dist/src/storage/sqlite/migrations/121_automation_inbox.sql +24 -0
- package/dist/src/storage/sqlite/migrations/122_automation_session_projects.sql +18 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/package.json +3 -2
- package/dist/gateway/static/root/assets/agents-DnFIy8Ye.js +0 -68
- package/dist/gateway/static/root/assets/apps-page-CONlVc-f.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-DuG69tIj.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-Cvt-8fqE.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-yk3QkGBP.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-CaNnYUQo.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-CZ5P9jbB.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DTpCnOsQ.js +0 -2
- package/dist/gateway/static/root/assets/directory-picker-path-field-Ly0TUflq.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CMZr1_Op.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CBG9Bk-1.js +0 -3
- package/dist/gateway/static/root/assets/index-BBw9QL0p.js +0 -85
- package/dist/gateway/static/root/assets/index-Dm-cvIpl.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-Bi_0Sknt.js +0 -2
- package/dist/gateway/static/root/assets/messages-9zCa8KkW.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-CMyosgjY.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-DkS-kbpj.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B3NxP6S4.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DwhrMhjl.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BOfXXmBL.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-sPrZfZVR.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Dvl13Udt.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-D9elkZOz.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Xd8PlB24.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page--DTi90d5.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DXyButkm.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"./plus-Q2yW6OE7.js";import{t as u}from"./x-B_N4OPjy.js";import{t as d}from"./cn-JdwAhgNB.js";import{t as f}from"./button-CSEbl4zT.js";import{t as p}from"./messages-CySMn8WL.js";import{n as m,o as h,r as g}from"./locale-store-CieddUjx.js";import{a as _,i as v,n as y,o as b,r as x,s as S,t as C}from"./dist-BPoKqzeH.js";import{n as w}from"./activity-store-URW-e_me.js";import{Aa as T,B as E,Cl as D,Dl as O,I as k,N as A,P as j,Sl as M,Tc as N,U as P,V as F,Va as I,as as L,bl as ee,is as te,j as ne,ll as R,q as re,ql as z,rn as ie,sc as ae,si as oe,tn as se,vs as ce,z as le}from"./index-CrwXzRpA.js";var B=e(t(),1),V=n();function H(e){try{return decodeURIComponent(e).trim()||null}catch{return null}}function U(e){if(!e)return null;let t=e.split(/[?#]/,1)[0],n=/^\/chat\/([^/]+)\/?$/.exec(t);if(n){let e=H(n[1]);return!e||e===`new`?null:{kind:`session`,id:e}}return null}async function W(e,t){let n=`/api/sessions/${encodeURIComponent(e.id)}?limit=1`;try{return(await h(g(n),{signal:t})).status===404?`missing`:`available`}catch(e){if(t?.aborted)throw e;return`available`}}var G=r(),K=3,q={info:{Icon:N,className:`text-accent-fg bg-accent-soft`},success:{Icon:ee,className:`text-success bg-success-soft`},warning:{Icon:te,className:`text-warning bg-warning-soft`},error:{Icon:M,className:`text-danger bg-danger-soft`}};function ue(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,V.c)(55),{item:n,targetAvailability:r}=e,i=m(fe),a;t[0]===i?a=t[1]:(a=p(i),t[0]=i,t[1]=a);let s=a.projectsPage.home,l=w(de),{Icon:f,className:h}=q[n.tone],g;t[2]===h?g=t[3]:(g=d(`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg`,h),t[2]=h,t[3]=g);let _;t[4]!==f||t[5]!==n.status?(_=n.status===`running`?(0,G.jsx)(c,{className:`size-3.5 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,G.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),t[4]=f,t[5]=n.status,t[6]=_):_=t[6];let v;t[7]!==g||t[8]!==_?(v=(0,G.jsx)(`div`,{className:g,children:_}),t[7]=g,t[8]=_,t[9]=v):v=t[9];let y;t[10]===n.title?y=t[11]:(y=(0,G.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]=y);let b;t[12]!==s.activityUnread||t[13]!==n.read?(b=n.read?null:(0,G.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]=b):b=t[14];let x;t[15]!==y||t[16]!==b?(x=(0,G.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[y,b]}),t[15]=y,t[16]=b,t[17]=x):x=t[17];let S;t[18]===n.message?S=t[19]:(S=n.message?(0,G.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]=S);let C;t[20]===n.source?C=t[21]:(C=n.source?(0,G.jsx)(`span`,{className:`max-w-48 truncate`,children:n.source}):null,t[20]=n.source,t[21]=C);let E;t[22]!==n.updatedAt||t[23]!==i?(E=ue(n.updatedAt,i),t[22]=n.updatedAt,t[23]=i,t[24]=E):E=t[24];let O;t[25]===E?O=t[26]:(O=(0,G.jsx)(`span`,{children:E}),t[25]=E,t[26]=O);let k;t[27]===n.occurrences?k=t[28]:(k=n.occurrences>1?(0,G.jsxs)(`span`,{children:[`×`,n.occurrences]}):null,t[27]=n.occurrences,t[28]=k);let A;t[29]!==s.activityCheckingRelated||t[30]!==s.activityRelatedMissing||t[31]!==s.activityViewRelated||t[32]!==n.href||t[33]!==r?(A=n.href&&r===`available`?(0,G.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,G.jsx)(D,{className:`size-3`,"aria-hidden":!0})]}):n.href&&r===`checking`?(0,G.jsx)(T,{className:`h-3 w-20 rounded`,"aria-label":s.activityCheckingRelated}):n.href&&r===`missing`?(0,G.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]=A):A=t[34];let j;t[35]!==O||t[36]!==k||t[37]!==A||t[38]!==C?(j=(0,G.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] text-fg-subtle`,children:[C,O,k,A]}),t[35]=O,t[36]=k,t[37]=A,t[38]=C,t[39]=j):j=t[39];let M;t[40]!==j||t[41]!==x||t[42]!==S?(M=(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,S,j]}),t[40]=j,t[41]=x,t[42]=S,t[43]=M):M=t[43];let N;t[44]!==n.id||t[45]!==l?(N=()=>l(n.id),t[44]=n.id,t[45]=l,t[46]=N):N=t[46];let P;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,G.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),t[47]=P):P=t[47];let F;t[48]!==s.activityRemove||t[49]!==N?(F=(0,G.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:N,children:P}),t[48]=s.activityRemove,t[49]=N,t[50]=F):F=t[50];let I;return t[51]!==M||t[52]!==F||t[53]!==v?(I=(0,G.jsxs)(`article`,{className:`group flex items-start gap-3 border-t border-edge-subtle px-1 py-3 first:border-t-0`,children:[v,M,F]}),t[51]=M,t[52]=F,t[53]=v,t[54]=I):I=t[54],I}function de(e){return e.remove}function fe(e){return e.language}function pe(){let e=(0,V.c)(14),t=p(m(be)).projectsPage.home,n=w(ye),r=w(ve),i=w(_e),[a,o]=(0,B.useState)(!1),l;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={},e[0]=l):l=e[0];let[u,d]=(0,B.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,K),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 S=x,C,T;e[10]===S?(C=e[11],T=e[12]):(C=()=>{let e=new AbortController,t=new Map((S?S.split(`
|
|
3
|
+
`):[]).flatMap(he));return d(Object.fromEntries([...t.keys()].map(me))),Promise.all([...t].map(async t=>{let[n,r]=t,i=await W(r,e.signal);e.signal.aborted||d(e=>({...e,[n]:i}))})).catch(Z),()=>e.abort()},T=[S],e[10]=S,e[11]=C,e[12]=T),(0,B.useEffect)(C,T);let E;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,G.jsx)(z,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),e[13]=E):E=e[13],(0,G.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,"aria-labelledby":`workbench-activity-title`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,G.jsx)(`div`,{children:(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[E,(0,G.jsx)(`h2`,{id:`workbench-activity-title`,className:`text-sm font-semibold text-fg`,children:t.activityTitle}),g>0?(0,G.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,G.jsx)(c,{className:`size-3 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),g,` `,t.running]}):v>0?(0,G.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,G.jsxs)(`div`,{className:`flex items-center gap-1`,children:[v>0?(0,G.jsxs)(f,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:r,children:[(0,G.jsx)(s,{className:`size-3.5`,"aria-hidden":!0}),t.activityMarkRead]}):null,n.some(X)?(0,G.jsxs)(f,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-fg-muted`,onClick:i,children:[(0,G.jsx)(L,{className:`size-3.5`,"aria-hidden":!0}),t.activityClearFinished]}):null]}):null]}),n.length>0?(0,G.jsxs)(`div`,{className:`mt-3 px-1`,children:[b.map(e=>(0,G.jsx)(J,{item:e,targetAvailability:e.href&&U(e.href)?u[e.href]??`checking`:`available`},e.id)),n.length>K?(0,G.jsx)(`div`,{className:`border-t border-edge-subtle py-2 text-center`,children:(0,G.jsx)(f,{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,G.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-sm text-fg-muted`,children:[(0,G.jsx)(R,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,G.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=U(e);return t?[[e,t]]:[]}function ge(e){return e.href&&U(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:oe(n)}function Ce(e){let t=(0,V.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,G.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,V.c)(18),{task:n,statusLabel:r,backgroundPath:i}=e,a;t[0]!==i||t[1]!==n.id?(a=ie(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,G.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,G.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,G.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,G.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,G.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,V.c)(12),{receipt:n,evidenceLabel:r,remainingLabel:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsx)(ee,{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,G.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:n.summary}),s=(0,G.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,G.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,G.jsx)(`div`,{className:`block rounded-xl border border-edge-subtle px-3 py-3`,children:(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[a,(0,G.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,V.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,G.jsx)(T,{className:`h-20 rounded-2xl`}),(0,G.jsx)(T,{className:`h-72 rounded-2xl`}),(0,G.jsx)(T,{className:`h-44 rounded-2xl`})]}),e[0]=t):t=e[0],t}function De(e){let t=(0,V.c)(15),{chat:n,statusLabel:r}=e,i=`/chat/${encodeURIComponent(n.key)}`,a;t[0]===n.name?a=t[1]:(a=(0,G.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,G.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,G.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,G.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,G.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,V.c)(27),{item:n,href:r,kindLabel:i,reasonLabel:a,approveLabel:s,denyLabel:c,busy:l,onRespond:u}=e,d;t[0]===n.title?d=t[1]:(d=(0,G.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=d);let p=n.projectName||i,m;t[2]===p?m=t[3]:(m=(0,G.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:p}),t[2]=p,t[3]=m);let h;t[4]!==d||t[5]!==m?(h=(0,G.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),t[4]=d,t[5]=m,t[6]=h):h=t[6];let g;t[7]===a?g=t[8]:(g=(0,G.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,G.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,G.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,G.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]!==u?(b=n.response?(0,G.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t border-warning/20 pt-3`,children:[(0,G.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:l,onClick:()=>u(`deny`),children:c}),(0,G.jsx)(f,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:l,onClick:()=>u(`approve`),children:s})]}):null,t[18]=s,t[19]=l,t[20]=c,t[21]=n.response,t[22]=u,t[23]=b):b=t[23];let x;return t[24]!==y||t[25]!==b?(x=(0,G.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,V.c)(74),{item:n,labels:r,busy:i,onDecide:a,onSnooze:o,onDismiss:s,onInstruct:c}=e,[l,u]=(0,B.useState)(``),d=n.judgment,p;t[0]===n.title?p=t[1]:(p=(0,G.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,G.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,G.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,G.jsx)(ce,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=g):g=t[7];let _;t[8]===h?_=t[9]:(_=(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[h,g]}),t[8]=h,t[9]=_);let v;t[10]!==d.whyNow||t[11]!==r.whyNow?(v=[r.whyNow,d.whyNow],t[10]=d.whyNow,t[11]=r.whyNow,t[12]=v):v=t[12];let y;t[13]!==d.impact||t[14]!==r.impact?(y=[r.impact,d.impact],t[13]=d.impact,t[14]=r.impact,t[15]=y):y=t[15];let b;t[16]!==d.workDone||t[17]!==r.workDone?(b=[r.workDone,d.workDone],t[16]=d.workDone,t[17]=r.workDone,t[18]=b):b=t[18];let x;t[19]!==d.recommendation||t[20]!==r.recommendation?(x=[r.recommendation,d.recommendation],t[19]=d.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,G.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]!==d.actionError||t[28]!==d.actionStatus||t[29]!==d.dispositionReason||t[30]!==d.proposedActionTitle||t[31]!==r.actionStates||t[32]!==r.policyReason||t[33]!==r.proposedAction?(C=d.dispositionReason?(0,G.jsxs)(`div`,{className:`mt-3 rounded-lg border border-edge-subtle bg-surface-panel/70 p-3 text-xs leading-5`,children:[(0,G.jsx)(`p`,{className:`font-medium text-fg-subtle`,children:r.policyReason}),(0,G.jsx)(`p`,{className:`mt-1 text-fg-muted`,children:d.dispositionReason}),d.proposedActionTitle?(0,G.jsxs)(`p`,{className:`mt-2 text-fg`,children:[(0,G.jsxs)(`span`,{className:`font-medium`,children:[r.proposedAction,`:`]}),d.proposedActionTitle,d.actionStatus?` · ${r.actionStates[d.actionStatus]}`:``]}):null,d.actionError?(0,G.jsx)(`p`,{className:`mt-1 text-danger`,children:d.actionError}):null]}):null,t[27]=d.actionError,t[28]=d.actionStatus,t[29]=d.dispositionReason,t[30]=d.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]!==d.decision||t[37]!==a?(w=d.decision?(0,G.jsxs)(`div`,{className:`mt-4`,children:[(0,G.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:d.decision.question}),(0,G.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:d.decision.options.map(e=>(0,G.jsxs)(f,{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,G.jsx)(`span`,{children:e.label}),(0,G.jsx)(`span`,{className:`text-[10px] font-normal text-fg-muted`,children:e.consequence})]},e.id))})]}):null,t[35]=i,t[36]=d.decision,t[37]=a,t[38]=w):w=t[38];let T;t[39]!==i||t[40]!==r.snooze||t[41]!==o?(T=(0,G.jsx)(f,{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,G.jsx)(f,{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,G.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),u(``))},t[50]=l,t[51]=c,t[52]=O):O=t[52];let k;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>u(e.target.value),t[53]=k):k=t[53];let A;t[54]!==l||t[55]!==r.feedbackPlaceholder?(A=(0,G.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,G.jsx)(f,{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,G.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 P;return t[67]!==S||t[68]!==C||t[69]!==w||t[70]!==D||t[71]!==N||t[72]!==_?(P=(0,G.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]=P):P=t[73],P}function Ae(e){let[t,n]=e;return(0,G.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 p-3`,children:[(0,G.jsx)(`p`,{className:`text-[11px] font-medium text-fg-subtle`,children:t}),(0,G.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg`,children:n})]},t)}function je(e){let t=(0,V.c)(32),{item:n,href:r,statusLabel:i,retryLabel:a,viewLabel:s,acknowledgeLabel:c,busy:l,onView:u,onRetry:d,onAcknowledge:p}=e,m;t[0]===n.title?m=t[1]:(m=(0,G.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,G.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,G.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,G.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,G.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,G.jsx)(f,{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]!==u||t[19]!==s?(b=(0,G.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:l,onClick:u,children:s}),t[17]=l,t[18]=u,t[19]=s,t[20]=b):b=t[20];let x;t[21]!==l||t[22]!==d||t[23]!==a?(x=(0,G.jsx)(f,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:l,onClick:d,children:a}),t[21]=l,t[22]=d,t[23]=a,t[24]=x):x=t[24];let S;t[25]!==y||t[26]!==b||t[27]!==x?(S=(0,G.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,G.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=m(e=>e.language),t=p(e).projectsPage,n=re(e),r=a(),s=i(),c=`${s.pathname}${s.search}`,d=I(e=>e.setPageHeader),h=I(e=>e.clearPageHeader),[g,w]=(0,B.useState)(null),[T,D]=(0,B.useState)(!0),[N,L]=(0,B.useState)(null),[te,R]=(0,B.useState)(!1),[z,oe]=(0,B.useState)(``),[V,H]=(0,B.useState)(()=>crypto.randomUUID()),[U,W]=(0,B.useState)(!1),[K,q]=(0,B.useState)(null),[ue,J]=(0,B.useState)(null),[de,fe]=(0,B.useState)(null),Y=(0,B.useCallback)(async(t=!1)=>{t&&D(!0),L(null);try{w(await k(e))}catch(e){L(e instanceof Error?e.message:String(e))}finally{D(!1)}},[e]);(0,B.useEffect)(()=>{Y(!0)},[Y]),(0,B.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,B.useMemo)(()=>g?.decisions??[],[g]),Z=(0,B.useMemo)(()=>g?.attention??[],[g]),me=(0,B.useCallback)(async t=>{t.preventDefault();let n=z.trim();if(!(!n||U)){W(!0),q(null);try{let t=await A({idempotencyKey:V,title:n,locale:e,priority:`normal`,contract:{objective:n,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:[],context:[],authorityGrants:[],activation:{mode:`start`}});R(!1),oe(``),H(crypto.randomUUID()),r(ie(c,t.task.id))}catch(e){q(e instanceof Error?e.message:String(e))}finally{W(!1)}}},[c,V,U,e,r,z]),he=(0,B.useMemo)(()=>(0,G.jsxs)(f,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>R(!0),children:[(0,G.jsx)(l,{className:`size-4`,"aria-hidden":!0}),n.newWork]}),[n.newWork]),ge=(0,B.useCallback)(async(e,t)=>{if(e.response){J(e.id),L(null);try{await E(e.response,t),await Y()}catch(e){L(e instanceof Error?e.message:String(e))}finally{J(null)}}},[Y]),Q=(0,B.useCallback)(async(e,t)=>{J(e.id),L(null);try{await t(),await Y()}catch(e){L(e instanceof Error?e.message:String(e))}finally{J(null)}},[Y]),$=(0,B.useCallback)(async(e,t)=>{fe(e.id),L(null);try{await t({kind:e.kind,runId:e.runId}),await Y()}catch(e){L(e instanceof Error?e.message:String(e))}finally{fe(null)}},[Y]);return(0,B.useLayoutEffect)(()=>(d({startExtra:null,main:(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),(0,G.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:t.home.subtitle})]}),end:he}),()=>h()),[h,he,d,t.title,t.home.subtitle]),(0,G.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,G.jsx)(C,{open:te,onOpenChange:e=>{U||R(e),e&&(q(null),H(crypto.randomUUID()))},children:(0,G.jsxs)(b,{children:[(0,G.jsx)(_,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,G.jsxs)(x,{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,G.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(S,{className:`text-base font-semibold text-fg`,children:n.dialogTitle}),(0,G.jsx)(v,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:n.dialogDescription})]}),(0,G.jsx)(y,{asChild:!0,children:(0,G.jsx)(f,{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,G.jsx)(u,{className:`size-4`,"aria-hidden":!0})})})]}),(0,G.jsxs)(`form`,{onSubmit:me,className:`flex min-h-0 flex-1 flex-col`,children:[(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,children:[(0,G.jsx)(`label`,{htmlFor:`new-work-task`,className:`mb-2 shrink-0 text-sm font-medium text-fg`,children:n.intentLabel}),(0,G.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:z,onChange:e=>{oe(e.target.value),H(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,G.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,G.jsx)(`span`,{children:t.home.submitShortcut}),(0,G.jsxs)(`span`,{className:`tabular-nums`,children:[z.length.toLocaleString(),` / `,12e3.toLocaleString()]})]}),K?(0,G.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:K}):null]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,G.jsx)(y,{asChild:!0,children:(0,G.jsx)(f,{type:`button`,variant:`ghost`,disabled:U,children:t.cancel})}),(0,G.jsxs)(f,{type:`submit`,variant:`primary`,className:`min-w-32`,disabled:!z.trim()||U,children:[(0,G.jsx)(ce,{className:`size-4`,"aria-hidden":!0}),U?n.starting:n.submit]})]})]})]})]})}),N?(0,G.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,G.jsx)(`span`,{children:N}),(0,G.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Y(),children:t.home.retry})]}):null,T?(0,G.jsx)(Ee,{}):g?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`section`,{className:`border-b border-edge-subtle pb-5`,children:[(0,G.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:t.home.briefingTitle}),(0,G.jsx)(`h2`,{className:`mt-1 text-xl font-semibold tracking-tight text-fg`,children:g.decisions.length+g.attention.length>0?xe(t.home.todaySummary,{attention:g.decisions.length+g.attention.length,moving:g.briefing.progress.movingCount+g.chats.running.length}):xe(t.home.todaySummaryClear,{moving:g.briefing.progress.movingCount+g.chats.running.length})}),g.briefing.summary?(0,G.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-fg-muted`,children:g.briefing.summary}):null]}),g.tasks.running.length===0&&g.workflowRuns.active.length===0&&g.decisions.length===0&&g.attention.length===0&&g.chats.running.length===0&&g.chats.recent.length===0&&g.upcomingAutomations.length===0?(0,G.jsxs)(`section`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,G.jsx)(ae,{className:`mx-auto size-6 text-accent`,"aria-hidden":!0}),(0,G.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:t.home.emptyTitle}),(0,G.jsx)(`p`,{className:`mx-auto mt-1 max-w-lg text-sm leading-6 text-fg-muted`,children:t.home.emptyBody}),(0,G.jsxs)(`div`,{className:`mt-4 flex justify-center gap-2`,children:[(0,G.jsx)(f,{type:`button`,variant:`primary`,onClick:()=>r(`/chat/new`),children:t.home.startChat}),(0,G.jsx)(f,{type:`button`,variant:`secondary`,onClick:()=>R(!0),children:n.newWork})]})]}):null,(0,G.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 space-y-6`,children:[Z.length>0?(0,G.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(M,{className:`size-4 text-danger`,"aria-hidden":!0}),(0,G.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.runAttention}),(0,G.jsx)(Ce,{children:Z.length.toLocaleString()})]}),(0,G.jsx)(`div`,{className:`mt-4 space-y-2`,children:Z.map(e=>(0,G.jsx)(je,{item:e,href:se(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(se(c,e.href)),onRetry:()=>void $(e,F),onAcknowledge:()=>void $(e,ne)},e.id))})]}):null,X.length>0?(0,G.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(M,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,G.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.needsAttention}),(0,G.jsx)(Ce,{children:X.length.toLocaleString()})]}),(0,G.jsx)(`div`,{className:`mt-4 space-y-2`,children:X.map(e=>e.kind===`agent_judgment`&&e.judgment?(0,G.jsx)(ke,{item:e,labels:n,busy:ue===e.id,onDecide:t=>void Q(e,()=>j(e.judgment.inboxItemId,t)),onSnooze:()=>void Q(e,()=>P(e.judgment.inboxItemId,`snoozed`)),onDismiss:()=>void Q(e,()=>P(e.judgment.inboxItemId,`resolved`)),onInstruct:t=>void Q(e,()=>le(e.judgment.inboxItemId,t))},e.id):(0,G.jsx)(Oe,{item:e,href:se(c,e.href),kindLabel:t.home.decisionKinds[e.kind],reasonLabel:t.home.decisionReasons[e.reason],approveLabel:t.home.approve,denyLabel:t.home.deny,busy:ue===e.id,onRespond:t=>void ge(e,t)},e.id))})]}):(0,G.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,G.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,G.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ce,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,G.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.running}),(0,G.jsx)(Ce,{children:g.tasks.running.length.toLocaleString()})]}),(0,G.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[g.tasks.running.map(e=>(0,G.jsx)(we,{task:e,statusLabel:n.taskStatuses.running,backgroundPath:c},e.id)),g.tasks.running.length===0?(0,G.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:n.emptyRunning}):null]})]}),g.chats.recent.length>0?(0,G.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,G.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.recent})}),(0,G.jsx)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:g.chats.recent.slice(0,6).map(e=>(0,G.jsx)(De,{chat:e,statusLabel:n.openChat},e.key))})]}):null]}),(0,G.jsxs)(`aside`,{className:`min-w-0 space-y-4`,"aria-label":t.home.nowTitle,children:[(0,G.jsx)(`div`,{className:`px-1`,children:(0,G.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.home.nowTitle})}),g.upcomingAutomations.length>0?(0,G.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(O,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.home.scheduled})]}),(0,G.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle`,children:g.upcomingAutomations.slice(0,3).map(e=>(0,G.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,G.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.name||e.action}),(0,G.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:Se(e.nextRunAt,t.never)})]},e.id))})]}):null,g.recentTasks.length>0?(0,G.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(ee,{className:`size-4 text-success`,"aria-hidden":!0}),(0,G.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.recentTasks})]}),(0,G.jsx)(`div`,{className:`mt-3 space-y-2`,children:g.recentTasks.slice(0,3).map(e=>(0,G.jsx)(Te,{receipt:e,evidenceLabel:n.evidenceCount,remainingLabel:n.remainingCount},e.runId))})]}):null,(0,G.jsx)(pe,{}),g.briefing.wins.length>0?(0,G.jsxs)(o,{to:g.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,G.jsx)(`span`,{children:xe(t.home.completedSummary,{count:g.briefing.wins.length})}),(0,G.jsxs)(`span`,{className:`shrink-0 text-xs font-medium text-accent`,children:[t.home.viewLatestResult,` →`]})]}):null]})]})]}):null]})}export{Me as HomePage};
|