@xopcai/xopc 0.0.457 → 0.0.459

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 (42) 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/automation-display-DaVDNZz8.js +2 -0
  4. package/dist/gateway/static/root/assets/automation-task-card-CiJmJ7_h.js +2 -0
  5. package/dist/gateway/static/root/assets/{automations-page-BSnPWyYd.js → automations-page-CVjgENMO.js} +1 -1
  6. package/dist/gateway/static/root/assets/automations-workspace-CGPWyL0P.js +9 -0
  7. package/dist/gateway/static/root/assets/capabilities-page-D2hq4cgE.js +2 -0
  8. package/dist/gateway/static/root/assets/{chat-page-Bx_A__qB.js → chat-page-BhPw56Vc.js} +5 -5
  9. package/dist/gateway/static/root/assets/connectors-page-DyzDVVfz.js +1 -0
  10. package/dist/gateway/static/root/assets/home-page-BPPe4JXB.js +7 -0
  11. package/dist/gateway/static/root/assets/index-D0_qnBzh.css +1 -0
  12. package/dist/gateway/static/root/assets/index-Hv71yddc.js +11 -0
  13. package/dist/gateway/static/root/assets/{note-detail-panel-B1cq9sU2.js → note-detail-panel-DLPwJGh0.js} +2 -2
  14. package/dist/gateway/static/root/assets/{notes-page-Do0l5Ddr.js → notes-page-DpfN5bZZ.js} +1 -1
  15. package/dist/gateway/static/root/assets/{personal-page-DrYh0NPE.js → personal-page-BBGjwkAC.js} +1 -1
  16. package/dist/gateway/static/root/assets/product-preview-content-WkF2j_c-.js +1 -0
  17. package/dist/gateway/static/root/assets/{product-preview-modal-BUeyRD5W.js → product-preview-modal-DMHOKocl.js} +2 -2
  18. package/dist/gateway/static/root/assets/{project-detail-page-D3k1NzXQ.js → project-detail-page-Dj_PuT7k.js} +1 -1
  19. package/dist/gateway/static/root/assets/route-preload-gas8e1we.js +2 -0
  20. package/dist/gateway/static/root/assets/routine-panel-CXs4PjW0.js +2 -0
  21. package/dist/gateway/static/root/assets/service-recommendation-list-DDlMyPvC.js +1 -0
  22. package/dist/gateway/static/root/assets/{settings-page-CGiZCF8z.js → settings-page-D2qkIrUg.js} +1 -1
  23. package/dist/gateway/static/root/assets/task-detail-page-_5TEldtl.js +3 -0
  24. package/dist/gateway/static/root/assets/{work-discovery-overlay-BNZK4hQ4.js → work-discovery-overlay-UvWbDUXi.js} +1 -1
  25. package/dist/gateway/static/root/assets/{work-discovery-page-KwSPhukU.js → work-discovery-page-BM1HsYz6.js} +1 -1
  26. package/dist/gateway/static/root/index.html +10 -10
  27. package/dist/package.js +1 -1
  28. package/dist/src/storage/sqlite/conversation-repository.js +4 -1
  29. package/package.json +2 -2
  30. package/dist/gateway/static/root/assets/automation-task-card-BjqxvYqc.js +0 -3
  31. package/dist/gateway/static/root/assets/automations-workspace-DIaCdxtX.js +0 -9
  32. package/dist/gateway/static/root/assets/calendar-clock-D-quYVPe.js +0 -1
  33. package/dist/gateway/static/root/assets/capabilities-page-dXDa0i5o.js +0 -2
  34. package/dist/gateway/static/root/assets/connectors-page-BwJHhyRb.js +0 -1
  35. package/dist/gateway/static/root/assets/home-page-D1sTZYAY.js +0 -3
  36. package/dist/gateway/static/root/assets/index-CHAVhyVb.js +0 -11
  37. package/dist/gateway/static/root/assets/index-CQABygtM.css +0 -1
  38. package/dist/gateway/static/root/assets/product-preview-content-CUaHxyiE.js +0 -1
  39. package/dist/gateway/static/root/assets/route-preload-CTuS4GFj.js +0 -2
  40. package/dist/gateway/static/root/assets/routine-panel-9UC3NU5V.js +0 -2
  41. package/dist/gateway/static/root/assets/service-recommendation-list-8mVIWB38.js +0 -1
  42. package/dist/gateway/static/root/assets/task-detail-page-CWwwumsy.js +0 -3
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a,u as o}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as s,n as c,o as l}from"./locale-store-Dy1EByeG.js";import{t as u}from"./messages-BAnhwALN.js";import{t as d}from"./chat-page-Bx_A__qB.js";import{t as f}from"./arrow-left-D880xG-P.js";import{t as p}from"./arrow-right-DSSvoX71.js";import{t as m}from"./arrow-up-right-T72JbQ1Q.js";import{t as h}from"./check-DUBLcKHA.js";import{t as g}from"./list-todo-CTVRto8O.js";import{F as ee}from"./markdown-view-BlxIaCCQ.js";import{n as _,s as v,t as y}from"./install-connector-dialog-DxSv1wS2.js";import{t as b}from"./phone-DdhTnt6X.js";import{t as x}from"./play-kxZvpBg8.js";import{t as te}from"./settings-2-D-csvaET.js";import{t as ne}from"./upload-rrb46c3c.js";import{t as re}from"./x-B_N4OPjy.js";import{t as S}from"./skeleton-DzdOeGYz.js";import{a as C,i as w,o as T,r as E,s as ie,t as D}from"./dist-GJ8-1PAx.js";import{a as O,r as k}from"./connectors-api-CTuVWwBf.js";import{u as ae}from"./use-realtime-voice-C7iWQuUv.js";import{n as oe}from"./voice-call-context-BM2A4bLz.js";import{t as se}from"./page-header-store-Bm8oxpFR.js";import{s as A}from"./agent-avatar-display-loBdGw_i.js";import{t as j}from"./personal-avatar-BMRVyTrE.js";import{d as ce,i as le,r as M}from"./voice-config-api-DhJ3l8fk.js";import{t as N}from"./date-formatters-DukWSVwc.js";import{t as ue}from"./personal-profile-settings-HMQY9lz9.js";var P=n(),F=e(t(),1),I=r(),L=[`intro`,`identity`,`voice`,`connections`],R=[{id:`loopi`,zh:`Loopi`,en:`Loopi`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`},{id:`loopi-care`,zh:`温和`,en:`Gentle`}];function de(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}async function z(e,t){let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(t)});await l(s(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:n.slice(n.indexOf(`,`)+1),mimeType:t.type})}),A(e)}function B({modelsAvailable:e,onCreated:t}){let n=c(e=>e.language)===`zh`,r=c(e=>e.language),[i,o]=(0,F.useState)(`intro`),[d,m]=(0,F.useState)({displayName:`Ada`,appearance:`loopi`,voice:null}),[g,ee]=(0,F.useState)(!1),[b,te]=(0,F.useState)(!1),[re,C]=(0,F.useState)(null),[w,T]=(0,F.useState)(null),[E,ie]=(0,F.useState)(null),[D,oe]=(0,F.useState)(null),[se,A]=(0,F.useState)(!0),[N,ue]=(0,F.useState)([]),[P,B]=(0,F.useState)(null),V=(0,F.useRef)(null),H=(0,F.useRef)(null),[U,fe]=(0,F.useState)([]),[W,G]=(0,F.useState)(!0),[K,q]=(0,F.useState)([]),[J,Y]=(0,F.useState)(null);(0,F.useEffect)(()=>{let e=!1;return l(s(`/api/personal-agent/onboarding`)).then(t=>{e||(o(t.payload.step),m(t.payload.draft))}).catch(t=>{e||C(t instanceof Error?t.message:String(t))}).finally(()=>{e||ee(!0)}),()=>{e=!0}},[]),(0,F.useEffect)(()=>{if(!g)return;let e=window.setTimeout(()=>{l(s(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:i,draft:d})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[d,g,i]),(0,F.useEffect)(()=>{let e=!1;return M().then(t=>{e||(t.tts&&t.enabled?oe({provider:t.tts.provider,model:t.tts.model,enabled:!0}):A(!1))}).catch(()=>{e||A(!1)}),()=>{e=!0}},[]),(0,F.useEffect)(()=>{if(!D?.enabled)return;let e=!1;return le(D.provider,D.model,`realtime`).then(t=>{e||ue(t.slice(0,12))}).catch(()=>{}).finally(()=>{e||A(!1)}),()=>{e=!0}},[D]),(0,F.useEffect)(()=>{if(i!==`connections`)return;let e=!1;return G(!0),Promise.allSettled([k({page:1,pageSize:24,verification:`verified`}),O()]).then(([t,n])=>{if(!e){if(t.status===`fulfilled`){let e=[`gmail`,`googlecalendar`,`googledrive`,`github`,`linear`];fe(t.value.connectors.filter(t=>t.runtime.type===`composio`&&e.includes(t.runtime.toolkit)).sort((t,n)=>e.indexOf(t.runtime.type===`composio`?t.runtime.toolkit:``)-e.indexOf(n.runtime.type===`composio`?n.runtime.toolkit:``)))}n.status===`fulfilled`&&q(n.value),G(!1)}}),()=>{e=!0}},[i]),(0,F.useEffect)(()=>()=>{H.current?.abort(),V.current?.close()},[]),(0,F.useEffect)(()=>()=>{E&&URL.revokeObjectURL(E)},[E]);let X=async(e,t=d)=>{await l(s(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:e,draft:t})}),o(e)},Z=async e=>{C(null);let t=L[Math.max(0,Math.min(L.length-1,L.indexOf(i)+e))];try{await X(t)}catch(e){C(e instanceof Error?e.message:String(e))}},Q=async(n=!1)=>{if(!(!e||b)){te(!0),C(null);try{let e=n?{displayName:`Ada`,appearance:`loopi`,voice:null}:d,r=e.voice&&D?.enabled&&N.some(t=>t.id===e.voice)?{provider:D.provider,model:D.model,voice:e.voice}:void 0,i=(await l(s(`/api/personal-agent`),{method:`POST`,body:JSON.stringify({displayName:e.displayName.trim()||`Ada`,appearance:e.appearance,...r?{voicePreference:r}:{}})})).payload,a=!1;if(!n&&w)try{await z(i.agentId,w),i=(await l(s(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:i.revision,displayName:i.displayName,appearance:`custom`})})).payload}catch{a=!0}t(i,a)}catch(e){C(e instanceof Error?e.message:String(e))}finally{te(!1)}}},pe=(0,F.useCallback)(async e=>{H.current?.abort(),V.current?.close();let t=new AbortController;H.current=t,B(e),C(null);try{let n=new ae;V.current=n,await n.start();let r=await ce(t.signal,e);if(t.signal.aborted)return;n.enqueue(r,()=>B(null))}catch(e){t.signal.aborted||C(e instanceof Error?e.message:String(e)),B(null)}},[]);if(!g)return(0,I.jsxs)(`div`,{className:`mx-auto w-full max-w-xl space-y-4 px-6 py-14`,children:[(0,I.jsx)(S,{className:`h-10 w-2/3`}),(0,I.jsx)(S,{className:`h-64 w-full rounded-2xl`}),(0,I.jsx)(S,{className:`h-12 w-full rounded-xl`})]});let $=L.indexOf(i),me={intro:n?`创建一个和你一起做事的助手`:`Create an assistant to work with you`,identity:n?`先给它一个形象和名字`:`Choose a look and a name`,voice:n?`想让我用什么声音回应?`:`How should your assistant sound?`,connections:n?`要让我了解哪些信息?`:`What information can your assistant use?`}[i];return(0,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-surface-base`,children:[(0,I.jsx)(`header`,{className:`shrink-0 px-5 pt-5 sm:px-8 sm:pt-7`,children:(0,I.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl`,children:[(0,I.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-4`,children:[$>0?(0,I.jsxs)(`button`,{type:`button`,disabled:b,onClick:()=>void Z(-1),className:`-ml-2 inline-flex min-h-10 items-center gap-1.5 rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:[(0,I.jsx)(f,{className:`size-4`}),n?`上一步`:`Back`]}):(0,I.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n?`设置我的助手`:`Set up my assistant`}),(0,I.jsx)(a,{to:`/chat`,className:`-mr-2 inline-flex min-h-10 items-center rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`稍后继续`:`Finish later`})]}),(0,I.jsx)(`div`,{className:`mt-4 grid grid-cols-4 gap-1.5`,role:`progressbar`,"aria-label":n?`设置进度`:`Setup progress`,"aria-valuenow":$+1,"aria-valuemin":1,"aria-valuemax":L.length,children:L.map((e,t)=>(0,I.jsx)(`span`,{className:`h-1 rounded-full transition-colors duration-200 ${t<=$?`bg-accent`:`bg-surface-active`}`},e))})]})}),(0,I.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-8 sm:px-8`,children:(0,I.jsxs)(`div`,{className:`mx-auto my-auto w-full max-w-2xl py-6 motion-safe:animate-[page-enter_220ms_ease-out]`,children:[(0,I.jsxs)(`div`,{className:`mb-8 flex items-center gap-4`,children:[(0,I.jsx)(`span`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-surface-hover`,children:E?(0,I.jsx)(`img`,{src:E,alt:``,className:`size-14 rounded-xl object-cover`}):(0,I.jsx)(j,{appearance:d.appearance,className:`size-14`})}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`我的助手`:`My assistant`}),(0,I.jsx)(`p`,{className:`mt-1 text-lg font-semibold text-fg`,children:d.displayName||`Ada`})]})]}),(0,I.jsx)(`p`,{className:`mb-3 text-xs font-medium tracking-wide text-fg-subtle`,children:n?`第 ${$+1} 步 · 共 ${L.length} 步`:`Step ${$+1} of ${L.length}`}),(0,I.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:me}),i===`intro`&&(0,I.jsxs)(`div`,{className:`mt-6 max-w-xl space-y-3 text-base leading-8 text-fg-muted`,children:[(0,I.jsx)(`p`,{children:n?`你可以找它讨论问题,也可以交给它一件要推进的事。`:`Talk through a question or give it something to move forward.`}),(0,I.jsx)(`p`,{children:n?`需要深入处理时,它会找合适的 Agent,并把进展带回对话。`:`It can ask a suitable Agent for deeper work and bring the progress back.`}),(0,I.jsx)(`p`,{children:n?`它能使用哪些数据和设备,由你决定。`:`You choose which data and devices it can use.`})]}),i===`identity`&&(0,I.jsxs)(`div`,{className:`mt-7 space-y-7`,children:[(0,I.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[n?`助手名字`:`Assistant name`,(0,I.jsx)(`input`,{value:d.displayName,maxLength:60,onChange:e=>m(t=>({...t,displayName:e.target.value})),onBlur:()=>m(e=>({...e,displayName:e.displayName.trim()||`Ada`})),className:`mt-2 block w-full rounded-xl border border-edge bg-surface-panel px-4 py-3 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`p`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`选择头像`:`Choose an avatar`}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[R.map(e=>(0,I.jsxs)(`button`,{type:`button`,"aria-pressed":!w&&d.appearance===e.id,onClick:()=>{T(null),ie(null),m(t=>({...t,appearance:e.id}))},className:`flex min-h-28 flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${!w&&d.appearance===e.id?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,I.jsx)(j,{appearance:e.id,className:`size-14`}),n?e.zh:e.en]},e.id)),(0,I.jsxs)(`label`,{className:`flex min-h-28 cursor-pointer flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-within:ring-2 focus-within:ring-accent ${w?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,I.jsx)(ne,{className:`size-6`}),n?`上传图片`:`Upload image`,(0,I.jsx)(`input`,{className:`sr-only`,type:`file`,accept:`image/png,image/jpeg,image/webp`,onChange:e=>{let t=e.target.files?.[0];if(t){if(t.size>512*1024||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){C(n?`请选择不超过 512 KB 的 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image under 512 KB.`);return}T(t),ie(URL.createObjectURL(t))}}})]})]}),(0,I.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n?`自定义图片在创建助手时上传;刷新后需要重新选择。`:`Custom images upload when you create the assistant; select again after a refresh.`})]})]}),i===`voice`&&(0,I.jsxs)(`div`,{className:`mt-5`,children:[(0,I.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`用于这个助手的语音通话;文字回答不受影响。试听不会使用麦克风。`:`This affects calls with this assistant. Text stays the same. Preview does not use your microphone.`}),se?(0,I.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,I.jsx)(S,{className:`h-20 rounded-xl`}),(0,I.jsx)(S,{className:`h-20 rounded-xl`})]}):D?.enabled&&N.length>0?(0,I.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,I.jsx)(`button`,{type:`button`,"aria-pressed":!d.voice,onClick:()=>m(e=>({...e,voice:null})),className:`rounded-xl p-4 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${d.voice?`bg-surface-panel text-fg-muted hover:bg-surface-hover`:`bg-accent/10 text-fg ring-1 ring-accent/40`}`,children:n?`使用默认声音`:`Use the default voice`}),N.map(e=>(0,I.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl p-3 transition-colors ${d.voice===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 rounded-lg text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-pressed":d.voice===e.id,onClick:()=>m(t=>({...t,voice:e.id})),children:[(0,I.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),(0,I.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description||e.style||(n?`点击选择`:`Select this voice`)})]}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>void pe(e.id),className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-surface-hover text-fg hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`试听${e.name}`:`Preview ${e.name}`,children:(0,I.jsx)(x,{className:`size-4 ${P===e.id?`text-accent`:``}`})})]},e.id))]}):(0,I.jsxs)(`div`,{className:`mt-5 rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:[(0,I.jsx)(`p`,{children:n?`当前没有可试听的语音。你可以先用文字对话,稍后再设置。`:`No voice is ready to preview. You can start with text and set it up later.`}),(0,I.jsx)(a,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),i===`connections`&&(0,I.jsxs)(`div`,{className:`mt-5`,children:[(0,I.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`现在连接,或进入对话后再添加。连接不会自动读取历史数据或创建持续关注。`:`Connect now or add sources later. Connecting does not automatically scan history or create ongoing monitoring.`}),W?(0,I.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,I.jsx)(S,{className:`h-18 rounded-xl`}),(0,I.jsx)(S,{className:`h-18 rounded-xl`})]}):(0,I.jsx)(`div`,{className:`mt-5 space-y-2`,children:U.length?U.map(e=>{let t=de(K.find(t=>t.connectorId===e.id));return(0,I.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel p-4`,children:[(0,I.jsx)(_,{connector:e,size:`sm`}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,I.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),t?(0,I.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-success`,children:[(0,I.jsx)(h,{className:`size-4`}),n?`已连接`:`Connected`]}):(0,I.jsx)(`button`,{type:`button`,onClick:()=>Y(v(e)),className:`rounded-lg bg-surface-hover px-3 py-2 text-xs text-fg transition-colors hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`连接`:`Connect`})]},e.id)}):(0,I.jsx)(`p`,{className:`rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:n?`暂无可用的推荐服务;你仍可直接进入对话。`:`No suggested services are available. You can continue to chat.`})})]}),!e&&(0,I.jsxs)(`p`,{className:`mt-5 rounded-xl bg-warning/5 p-4 text-sm text-fg-muted`,children:[n?`开始前需要一个可用模型。`:`A compatible model is required before you start.`,` `,(0,I.jsx)(a,{to:`/settings/capabilities/models`,className:`text-accent underline`,children:n?`配置模型`:`Set up a model`})]}),re&&(0,I.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:re})]},i)}),(0,I.jsx)(`footer`,{className:`shrink-0 px-5 pb-6 pt-3 sm:px-8 sm:pb-9`,children:(0,I.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,I.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n?`这些选择以后都能调整`:`You can change these choices later`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[i===`intro`&&(0,I.jsx)(`button`,{type:`button`,disabled:!e||b,onClick:()=>void Q(!0),className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:n?`用默认设置开始`:`Use defaults`}),i===`voice`&&(0,I.jsx)(`button`,{type:`button`,onClick:()=>{let e={...d,voice:null};m(e),C(null),X(`connections`,e).catch(e=>C(e instanceof Error?e.message:String(e)))},className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`跳过`:`Skip`}),(0,I.jsxs)(`button`,{type:`button`,disabled:b||i===`connections`&&!e,onClick:()=>i===`connections`?void Q():void Z(1),className:`flex min-h-11 items-center gap-2 rounded-xl bg-accent px-5 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:opacity-40`,children:[b?n?`正在创建…`:`Creating…`:i===`connections`?n?`进入对话`:`Start chatting`:n?`继续`:`Continue`,` `,!b&&(0,I.jsx)(p,{className:`size-4`})]})]})]})}),J&&(0,I.jsx)(y,{draft:J,onChange:Y,onClose:()=>Y(null),t:u(r).connectorsSettings,onInstalled:async()=>{q(await O()),Y(null)}})]})}var V=5;function H(e){let t=e.replace(/\s+/g,` `).trim();if(t.length<=58)return t;let n=t.replace(/([^)]{1,80})|\([^)]{1,80}\)/g,``).replace(/([A-Za-z0-9])(?=[\u4e00-\u9fff])/g,`$1 `).replace(/\s+/g,` `).trim(),r=n.split(/[。!?;;,]/,1)[0]?.trim()||n;return r.length>58?`${r.slice(0,57).trimEnd()}…`:r}function U(e,t){if(e.phase===`closed`)return{label:t?`已结束`:`Finished`,tone:`bg-fg-subtle`};let n=e.operationalState??e.runStatus;return n===`running`?{label:t?`正在执行`:`Working`,tone:`bg-accent`}:n===`queued`?{label:t?`等待开始`:`Queued`,tone:`bg-fg-subtle`}:n===`failed`?{label:t?`执行失败`:`Failed`,tone:`bg-danger`}:n===`waiting`?{label:t?`等待继续`:`Waiting`,tone:`bg-warning`}:n===`blocked`?{label:t?`已阻塞`:`Blocked`,tone:`bg-warning`}:n===`verifying`?{label:t?`正在验证`:`Verifying`,tone:`bg-accent`}:n===`cancelled`?{label:t?`执行已取消`:`Cancelled`,tone:`bg-fg-subtle`}:e.phase===`review`?{label:t?`等待验收`:`In review`,tone:`bg-warning`}:e.phase===`active`?{label:t?`正在推进`:`In progress`,tone:`bg-accent`}:e.phase===`ready`?{label:t?`准备开始`:`Ready`,tone:`bg-fg-subtle`}:{label:t?`待处理`:`Planned`,tone:`bg-fg-subtle`}}function fe(e){let t=(0,P.c)(30),{item:n,zh:r}=e,i;t[0]!==n||t[1]!==r?(i=U(n,r),t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===n.id?s=t[4]:(s=ee(`/personal`,n.id),t[3]=n.id,t[4]=s);let c=`mt-2 size-1.5 shrink-0 rounded-full ${o.tone}`,l;t[5]===c?l=t[6]:(l=(0,I.jsx)(`span`,{className:c,"aria-hidden":!0}),t[5]=c,t[6]=l);let u;t[7]===n.title?u=t[8]:(u=H(n.title),t[7]=n.title,t[8]=u);let d;t[9]===u?d=t[10]:(d=(0,I.jsx)(`span`,{className:`line-clamp-2 break-words text-sm font-medium leading-5 text-fg`,children:u}),t[9]=u,t[10]=d);let f;t[11]===o.label?f=t[12]:(f=(0,I.jsx)(`span`,{children:o.label}),t[11]=o.label,t[12]=f);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,I.jsx)(`span`,{className:`text-fg-subtle`,"aria-hidden":!0,children:`·`}),t[13]=p):p=t[13];let h=r?`zh`:`en`,g;t[14]!==n.updatedAt||t[15]!==h?(g=N(n.updatedAt,h),t[14]=n.updatedAt,t[15]=h,t[16]=g):g=t[16];let _;t[17]===g?_=t[18]:(_=(0,I.jsx)(`span`,{children:g}),t[17]=g,t[18]=_);let v;t[19]!==_||t[20]!==f?(v=(0,I.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-2 text-xs text-fg-muted`,children:[f,p,_]}),t[19]=_,t[20]=f,t[21]=v):v=t[21];let y;t[22]!==v||t[23]!==d?(y=(0,I.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,v]}),t[22]=v,t[23]=d,t[24]=y):y=t[24];let b;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,I.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100`,"aria-hidden":!0}),t[25]=b):b=t[25];let x;return t[26]!==y||t[27]!==s||t[28]!==l?(x=(0,I.jsxs)(a,{to:s,className:`group flex min-w-0 items-start gap-3 rounded-2xl bg-surface-panel px-4 py-4 transition-colors duration-150 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[l,y,b]}),t[26]=y,t[27]=s,t[28]=l,t[29]=x):x=t[29],x}function W(){let e=o(),t=i(),n=oe(),r=(0,F.useRef)(n);r.current=n;let a=c(e=>e.language)===`zh`,u=se(e=>e.setPageHeader),f=se(e=>e.clearPageHeader),[p,m]=(0,F.useState)(null),[h,ee]=(0,F.useState)([]),[_,v]=(0,F.useState)(!0),[y,x]=(0,F.useState)(null),[ne,O]=(0,F.useState)(!1),[k,ae]=(0,F.useState)(!1),A=(0,F.useRef)(null),ce=(0,F.useRef)(null),le=(0,F.useRef)(null),[M,N]=(0,F.useState)(!1),[P,L]=(0,F.useState)(null),[R,de]=(0,F.useState)(!1),[z,H]=(0,F.useState)(!1),[U,W]=(0,F.useState)(!1),[G,K]=(0,F.useState)(0),q=(0,F.useRef)(0),J=(0,F.useCallback)(()=>e(`/settings/personal`,{state:{settingsBackPath:`${t.pathname}${t.search}${t.hash}`}}),[t.pathname,t.search,t.hash,e]),Y=(0,F.useCallback)(()=>{N(!1),ae(e=>!e)},[]);(0,F.useEffect)(()=>{let e=e=>{let t=e.detail;t&&m(t)};return window.addEventListener(`personal-agent-updated`,e),()=>window.removeEventListener(`personal-agent-updated`,e)},[]);let X=(0,F.useCallback)(async()=>{try{let[e,t]=await Promise.all([l(s(`/api/personal-agent`)),l(s(`/api/personal-agent/models`))]);m(e.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e.payload})),e.payload&&window.dispatchEvent(new Event(`session-updated`)),ee(t.payload)}catch(e){x(e instanceof Error?e.message:String(e))}finally{v(!1)}},[]);(0,F.useEffect)(()=>{X()},[X]);let Z=(0,F.useCallback)(async()=>{let e=++q.current;N(!0),L(null),de(!1),H(!1),W(!1),K(0);try{let t=await l(s(`/api/personal-agent/activity?limit=${V}&offset=0`));if(e!==q.current)return;L(t.payload),K(t.payload.items.length)}catch{e===q.current&&de(!0)}},[]),Q=(0,F.useCallback)(async()=>{if(!P||z||G>=P.total)return;let e=q.current;H(!0),W(!1);try{let t=await l(s(`/api/personal-agent/activity?limit=${V}&offset=${G}`));if(e!==q.current)return;L(e=>e?{total:t.payload.total,items:[...e.items,...t.payload.items.filter(t=>!e.items.some(e=>e.id===t.id))]}:t.payload),K(e=>e+t.payload.items.length)}catch{e===q.current&&W(!0)}finally{e===q.current&&H(!1)}},[P,G,z]);return(0,F.useEffect)(()=>{if(!M||!P||z)return;let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(async()=>{let e=q.current;try{let t=await l(s(`/api/personal-agent/activity?limit=${Math.max(V,Math.min(100,G))}&offset=0`));if(e!==q.current)return;L(t.payload),K(t.payload.items.length)}catch{}},120)},n=window.setInterval(t,5e3);return window.addEventListener(`task-changed-v2`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.clearTimeout(e),window.clearInterval(n),window.removeEventListener(`task-changed-v2`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[P,G,z,M]),(0,F.useLayoutEffect)(()=>{let e=p?.state===`ready`,t=a?`语音通话`:`Voice call`,i=()=>{e&&r.current.open({conversationId:p.conversationId,name:p.displayName})},o=e?p.appearance:`loopi`,s=e?p.displayName:`Ada`;return u({startExtra:null,main:(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[e?(0,I.jsx)(`button`,{ref:ce,type:`button`,onClick:Y,"aria-expanded":k,className:`touch-target -m-1 shrink-0 rounded-full p-1 transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a?`编辑${s}的资料`:`Edit ${s}'s profile`,title:a?`设置`:`Settings`,children:(0,I.jsx)(`span`,{className:`flex size-8 items-center justify-center`,children:(0,I.jsx)(j,{appearance:o,agentId:p?.agentId,className:`size-8`})})}):(0,I.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center`,children:(0,I.jsx)(j,{appearance:o,agentId:p?.agentId,className:`size-8`})}),(0,I.jsx)(`h1`,{className:`min-w-0 truncate text-sm font-semibold text-fg sm:text-base`,children:s})]}),end:e?(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,I.jsx)(`button`,{type:`button`,disabled:n.active,onClick:i,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,"aria-label":t,title:t,children:(0,I.jsx)(b,{className:`size-5`})}),(0,I.jsxs)(T,{open:M,onOpenChange:e=>{e?Z():N(!1)},children:[(0,I.jsx)(ie,{asChild:!0,children:(0,I.jsx)(`button`,{type:`button`,"aria-pressed":M,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a?`正在做的事`:`Activity`,children:(0,I.jsx)(g,{className:`size-5`})})}),(0,I.jsx)(C,{children:(0,I.jsxs)(w,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":a?`派发的任务`:`Delegated tasks`,className:`xopc-session-context-popover data-[state=closed]:pointer-events-none z-50 flex h-[min(34rem,calc(100dvh-6rem))] w-[min(22rem,calc(100vw-1rem))] min-h-0 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-xl focus:outline-none`,children:[(0,I.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 px-6 pb-3 pt-6`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:a?`交给我推进的事`:`Delegated work`}),(0,I.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:P?a?`最近更新 · 共 ${P.total} 项`:`Recently updated · ${P.total} total`:a?`查看任务进展与结果`:`Follow progress and results`})]}),(0,I.jsx)(E,{className:`touch-target -mr-2 -mt-1 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a?`关闭活动`:`Close activity`,children:(0,I.jsx)(re,{className:`size-4`})})]}),(0,I.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-5 pt-3`,children:[!P&&!R&&(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(S,{className:`h-18 rounded-2xl`}),(0,I.jsx)(S,{className:`h-18 rounded-2xl`}),(0,I.jsx)(S,{className:`h-18 rounded-2xl`})]}),R&&(0,I.jsxs)(`div`,{className:`px-5 py-12 text-center`,children:[(0,I.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`暂时无法读取任务`:`Could not load tasks`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>void Z(),className:`mt-3 rounded-lg px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:a?`重试`:`Try again`})]}),P?.items.length===0&&(0,I.jsxs)(`div`,{className:`px-5 py-16 text-center`,children:[(0,I.jsx)(g,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,I.jsx)(`p`,{className:`mt-4 text-sm font-medium text-fg`,children:a?`还没有派发的任务`:`No delegated work yet`}),(0,I.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?`你可以在对话里直接告诉我想推进的事。`:`Tell me what you would like to move forward in chat.`})]}),P&&P.items.length>0&&(0,I.jsx)(`div`,{className:`space-y-2`,children:P.items.map(e=>(0,I.jsx)(fe,{item:e,zh:a},e.id))}),P&&G<P.total&&(0,I.jsxs)(`div`,{className:`pt-4 text-center`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:()=>void Q(),disabled:z,className:`min-h-10 rounded-xl bg-surface-panel px-5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-50`,children:z?a?`正在加载…`:`Loading…`:a?`加载更多`:`Load more`}),U&&(0,I.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:a?`加载失败,请重试`:`Could not load more. Try again.`})]})]})]})})]}),(0,I.jsx)(`button`,{ref:A,type:`button`,onClick:Y,"aria-expanded":k,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a?`Ada 设置`:`Ada settings`,children:(0,I.jsx)(te,{className:`size-5`})})]}):null}),()=>f()},[P,R,G,z,U,f,Q,Z,p,u,M,k,Y,n.active,a]),_?(0,I.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,I.jsx)(S,{className:`h-20 w-20 rounded-full`}),(0,I.jsx)(S,{className:`h-9 w-72`}),(0,I.jsx)(S,{className:`h-44 w-full rounded-2xl`})]}):y&&!p?(0,I.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-6 text-sm text-danger`,children:[(0,I.jsx)(`p`,{children:y}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>void X(),className:`text-accent hover:underline`,children:a?`重试`:`Retry`})]}):p?.state===`ready`?(0,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[ne&&(0,I.jsxs)(`div`,{role:`alert`,className:`flex shrink-0 items-center justify-between gap-3 border-b border-warning/30 bg-warning/5 px-5 py-3 text-sm text-fg-muted`,children:[(0,I.jsx)(`span`,{children:a?`助手已创建,头像上传未完成。可在资料设置中重新上传。`:`Your assistant is ready. Upload the avatar again in profile settings.`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>{O(!1),J()},className:`shrink-0 text-accent hover:underline`,children:a?`打开设置`:`Open settings`})]}),(0,I.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,I.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,I.jsx)(d,{embedded:!0,personal:!0,personalWelcome:{name:p.displayName,addressAs:p.userCallName??void 0,avatar:(0,I.jsx)(j,{appearance:p.appearance,agentId:p.agentId,className:`size-14`}),opening:a?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`},conversationId:p.conversationId})})}),(0,I.jsxs)(T,{open:k,onOpenChange:ae,children:[(0,I.jsx)(D,{virtualRef:A}),(0,I.jsx)(C,{children:(0,I.jsxs)(w,{ref:le,side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":a?`Ada 快捷设置`:`Ada quick settings`,onInteractOutside:e=>{e.target instanceof Node&&(A.current?.contains(e.target)||ce.current?.contains(e.target)||le.current?.contains(e.target))&&e.preventDefault()},className:`xopc-session-context-popover data-[state=closed]:pointer-events-none z-50 flex max-h-[calc(100dvh-5rem)] w-[min(22rem,calc(100vw-1rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-xl outline-none`,children:[(0,I.jsx)(`div`,{className:`min-h-0 overflow-y-auto p-4`,children:(0,I.jsx)(ue,{zh:a,onOpenVoiceServices:J})}),(0,I.jsx)(`button`,{type:`button`,onClick:J,className:`shrink-0 border-t border-edge px-4 py-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,children:a?`更多设置`:`More settings`})]})})]})]}):(0,I.jsx)(B,{modelsAvailable:h.length>0,onCreated:(e,t)=>{m(e),O(t),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e})),window.dispatchEvent(new Event(`session-updated`))}})}export{W as PersonalPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a,u as o}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as s,n as c,o as l}from"./locale-store-Dy1EByeG.js";import{t as u}from"./messages-BAnhwALN.js";import{t as d}from"./chat-page-BhPw56Vc.js";import{t as f}from"./arrow-left-D880xG-P.js";import{t as p}from"./arrow-right-DSSvoX71.js";import{t as m}from"./arrow-up-right-T72JbQ1Q.js";import{t as h}from"./check-DUBLcKHA.js";import{t as g}from"./list-todo-CTVRto8O.js";import{F as ee}from"./markdown-view-BlxIaCCQ.js";import{n as _,s as v,t as y}from"./install-connector-dialog-DxSv1wS2.js";import{t as b}from"./phone-DdhTnt6X.js";import{t as x}from"./play-kxZvpBg8.js";import{t as te}from"./settings-2-D-csvaET.js";import{t as ne}from"./upload-rrb46c3c.js";import{t as re}from"./x-B_N4OPjy.js";import{t as S}from"./skeleton-DzdOeGYz.js";import{a as C,i as w,o as T,r as E,s as ie,t as D}from"./dist-GJ8-1PAx.js";import{a as O,r as k}from"./connectors-api-CTuVWwBf.js";import{u as ae}from"./use-realtime-voice-C7iWQuUv.js";import{n as oe}from"./voice-call-context-BM2A4bLz.js";import{t as se}from"./page-header-store-Bm8oxpFR.js";import{s as A}from"./agent-avatar-display-loBdGw_i.js";import{t as j}from"./personal-avatar-BMRVyTrE.js";import{d as ce,i as le,r as M}from"./voice-config-api-DhJ3l8fk.js";import{t as N}from"./date-formatters-DukWSVwc.js";import{t as ue}from"./personal-profile-settings-HMQY9lz9.js";var P=n(),F=e(t(),1),I=r(),L=[`intro`,`identity`,`voice`,`connections`],R=[{id:`loopi`,zh:`Loopi`,en:`Loopi`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`},{id:`loopi-care`,zh:`温和`,en:`Gentle`}];function de(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}async function z(e,t){let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(t)});await l(s(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:n.slice(n.indexOf(`,`)+1),mimeType:t.type})}),A(e)}function B({modelsAvailable:e,onCreated:t}){let n=c(e=>e.language)===`zh`,r=c(e=>e.language),[i,o]=(0,F.useState)(`intro`),[d,m]=(0,F.useState)({displayName:`Ada`,appearance:`loopi`,voice:null}),[g,ee]=(0,F.useState)(!1),[b,te]=(0,F.useState)(!1),[re,C]=(0,F.useState)(null),[w,T]=(0,F.useState)(null),[E,ie]=(0,F.useState)(null),[D,oe]=(0,F.useState)(null),[se,A]=(0,F.useState)(!0),[N,ue]=(0,F.useState)([]),[P,B]=(0,F.useState)(null),V=(0,F.useRef)(null),H=(0,F.useRef)(null),[U,fe]=(0,F.useState)([]),[W,G]=(0,F.useState)(!0),[K,q]=(0,F.useState)([]),[J,Y]=(0,F.useState)(null);(0,F.useEffect)(()=>{let e=!1;return l(s(`/api/personal-agent/onboarding`)).then(t=>{e||(o(t.payload.step),m(t.payload.draft))}).catch(t=>{e||C(t instanceof Error?t.message:String(t))}).finally(()=>{e||ee(!0)}),()=>{e=!0}},[]),(0,F.useEffect)(()=>{if(!g)return;let e=window.setTimeout(()=>{l(s(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:i,draft:d})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[d,g,i]),(0,F.useEffect)(()=>{let e=!1;return M().then(t=>{e||(t.tts&&t.enabled?oe({provider:t.tts.provider,model:t.tts.model,enabled:!0}):A(!1))}).catch(()=>{e||A(!1)}),()=>{e=!0}},[]),(0,F.useEffect)(()=>{if(!D?.enabled)return;let e=!1;return le(D.provider,D.model,`realtime`).then(t=>{e||ue(t.slice(0,12))}).catch(()=>{}).finally(()=>{e||A(!1)}),()=>{e=!0}},[D]),(0,F.useEffect)(()=>{if(i!==`connections`)return;let e=!1;return G(!0),Promise.allSettled([k({page:1,pageSize:24,verification:`verified`}),O()]).then(([t,n])=>{if(!e){if(t.status===`fulfilled`){let e=[`gmail`,`googlecalendar`,`googledrive`,`github`,`linear`];fe(t.value.connectors.filter(t=>t.runtime.type===`composio`&&e.includes(t.runtime.toolkit)).sort((t,n)=>e.indexOf(t.runtime.type===`composio`?t.runtime.toolkit:``)-e.indexOf(n.runtime.type===`composio`?n.runtime.toolkit:``)))}n.status===`fulfilled`&&q(n.value),G(!1)}}),()=>{e=!0}},[i]),(0,F.useEffect)(()=>()=>{H.current?.abort(),V.current?.close()},[]),(0,F.useEffect)(()=>()=>{E&&URL.revokeObjectURL(E)},[E]);let X=async(e,t=d)=>{await l(s(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:e,draft:t})}),o(e)},Z=async e=>{C(null);let t=L[Math.max(0,Math.min(L.length-1,L.indexOf(i)+e))];try{await X(t)}catch(e){C(e instanceof Error?e.message:String(e))}},Q=async(n=!1)=>{if(!(!e||b)){te(!0),C(null);try{let e=n?{displayName:`Ada`,appearance:`loopi`,voice:null}:d,r=e.voice&&D?.enabled&&N.some(t=>t.id===e.voice)?{provider:D.provider,model:D.model,voice:e.voice}:void 0,i=(await l(s(`/api/personal-agent`),{method:`POST`,body:JSON.stringify({displayName:e.displayName.trim()||`Ada`,appearance:e.appearance,...r?{voicePreference:r}:{}})})).payload,a=!1;if(!n&&w)try{await z(i.agentId,w),i=(await l(s(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:i.revision,displayName:i.displayName,appearance:`custom`})})).payload}catch{a=!0}t(i,a)}catch(e){C(e instanceof Error?e.message:String(e))}finally{te(!1)}}},pe=(0,F.useCallback)(async e=>{H.current?.abort(),V.current?.close();let t=new AbortController;H.current=t,B(e),C(null);try{let n=new ae;V.current=n,await n.start();let r=await ce(t.signal,e);if(t.signal.aborted)return;n.enqueue(r,()=>B(null))}catch(e){t.signal.aborted||C(e instanceof Error?e.message:String(e)),B(null)}},[]);if(!g)return(0,I.jsxs)(`div`,{className:`mx-auto w-full max-w-xl space-y-4 px-6 py-14`,children:[(0,I.jsx)(S,{className:`h-10 w-2/3`}),(0,I.jsx)(S,{className:`h-64 w-full rounded-2xl`}),(0,I.jsx)(S,{className:`h-12 w-full rounded-xl`})]});let $=L.indexOf(i),me={intro:n?`创建一个和你一起做事的助手`:`Create an assistant to work with you`,identity:n?`先给它一个形象和名字`:`Choose a look and a name`,voice:n?`想让我用什么声音回应?`:`How should your assistant sound?`,connections:n?`要让我了解哪些信息?`:`What information can your assistant use?`}[i];return(0,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-surface-base`,children:[(0,I.jsx)(`header`,{className:`shrink-0 px-5 pt-5 sm:px-8 sm:pt-7`,children:(0,I.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl`,children:[(0,I.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-4`,children:[$>0?(0,I.jsxs)(`button`,{type:`button`,disabled:b,onClick:()=>void Z(-1),className:`-ml-2 inline-flex min-h-10 items-center gap-1.5 rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:[(0,I.jsx)(f,{className:`size-4`}),n?`上一步`:`Back`]}):(0,I.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n?`设置我的助手`:`Set up my assistant`}),(0,I.jsx)(a,{to:`/chat`,className:`-mr-2 inline-flex min-h-10 items-center rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`稍后继续`:`Finish later`})]}),(0,I.jsx)(`div`,{className:`mt-4 grid grid-cols-4 gap-1.5`,role:`progressbar`,"aria-label":n?`设置进度`:`Setup progress`,"aria-valuenow":$+1,"aria-valuemin":1,"aria-valuemax":L.length,children:L.map((e,t)=>(0,I.jsx)(`span`,{className:`h-1 rounded-full transition-colors duration-200 ${t<=$?`bg-accent`:`bg-surface-active`}`},e))})]})}),(0,I.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-8 sm:px-8`,children:(0,I.jsxs)(`div`,{className:`mx-auto my-auto w-full max-w-2xl py-6 motion-safe:animate-[page-enter_220ms_ease-out]`,children:[(0,I.jsxs)(`div`,{className:`mb-8 flex items-center gap-4`,children:[(0,I.jsx)(`span`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-surface-hover`,children:E?(0,I.jsx)(`img`,{src:E,alt:``,className:`size-14 rounded-xl object-cover`}):(0,I.jsx)(j,{appearance:d.appearance,className:`size-14`})}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`我的助手`:`My assistant`}),(0,I.jsx)(`p`,{className:`mt-1 text-lg font-semibold text-fg`,children:d.displayName||`Ada`})]})]}),(0,I.jsx)(`p`,{className:`mb-3 text-xs font-medium tracking-wide text-fg-subtle`,children:n?`第 ${$+1} 步 · 共 ${L.length} 步`:`Step ${$+1} of ${L.length}`}),(0,I.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:me}),i===`intro`&&(0,I.jsxs)(`div`,{className:`mt-6 max-w-xl space-y-3 text-base leading-8 text-fg-muted`,children:[(0,I.jsx)(`p`,{children:n?`你可以找它讨论问题,也可以交给它一件要推进的事。`:`Talk through a question or give it something to move forward.`}),(0,I.jsx)(`p`,{children:n?`需要深入处理时,它会找合适的 Agent,并把进展带回对话。`:`It can ask a suitable Agent for deeper work and bring the progress back.`}),(0,I.jsx)(`p`,{children:n?`它能使用哪些数据和设备,由你决定。`:`You choose which data and devices it can use.`})]}),i===`identity`&&(0,I.jsxs)(`div`,{className:`mt-7 space-y-7`,children:[(0,I.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[n?`助手名字`:`Assistant name`,(0,I.jsx)(`input`,{value:d.displayName,maxLength:60,onChange:e=>m(t=>({...t,displayName:e.target.value})),onBlur:()=>m(e=>({...e,displayName:e.displayName.trim()||`Ada`})),className:`mt-2 block w-full rounded-xl border border-edge bg-surface-panel px-4 py-3 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`})]}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`p`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`选择头像`:`Choose an avatar`}),(0,I.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[R.map(e=>(0,I.jsxs)(`button`,{type:`button`,"aria-pressed":!w&&d.appearance===e.id,onClick:()=>{T(null),ie(null),m(t=>({...t,appearance:e.id}))},className:`flex min-h-28 flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${!w&&d.appearance===e.id?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,I.jsx)(j,{appearance:e.id,className:`size-14`}),n?e.zh:e.en]},e.id)),(0,I.jsxs)(`label`,{className:`flex min-h-28 cursor-pointer flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-within:ring-2 focus-within:ring-accent ${w?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,I.jsx)(ne,{className:`size-6`}),n?`上传图片`:`Upload image`,(0,I.jsx)(`input`,{className:`sr-only`,type:`file`,accept:`image/png,image/jpeg,image/webp`,onChange:e=>{let t=e.target.files?.[0];if(t){if(t.size>512*1024||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){C(n?`请选择不超过 512 KB 的 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image under 512 KB.`);return}T(t),ie(URL.createObjectURL(t))}}})]})]}),(0,I.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n?`自定义图片在创建助手时上传;刷新后需要重新选择。`:`Custom images upload when you create the assistant; select again after a refresh.`})]})]}),i===`voice`&&(0,I.jsxs)(`div`,{className:`mt-5`,children:[(0,I.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`用于这个助手的语音通话;文字回答不受影响。试听不会使用麦克风。`:`This affects calls with this assistant. Text stays the same. Preview does not use your microphone.`}),se?(0,I.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,I.jsx)(S,{className:`h-20 rounded-xl`}),(0,I.jsx)(S,{className:`h-20 rounded-xl`})]}):D?.enabled&&N.length>0?(0,I.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,I.jsx)(`button`,{type:`button`,"aria-pressed":!d.voice,onClick:()=>m(e=>({...e,voice:null})),className:`rounded-xl p-4 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${d.voice?`bg-surface-panel text-fg-muted hover:bg-surface-hover`:`bg-accent/10 text-fg ring-1 ring-accent/40`}`,children:n?`使用默认声音`:`Use the default voice`}),N.map(e=>(0,I.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl p-3 transition-colors ${d.voice===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 rounded-lg text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-pressed":d.voice===e.id,onClick:()=>m(t=>({...t,voice:e.id})),children:[(0,I.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),(0,I.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description||e.style||(n?`点击选择`:`Select this voice`)})]}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>void pe(e.id),className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-surface-hover text-fg hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`试听${e.name}`:`Preview ${e.name}`,children:(0,I.jsx)(x,{className:`size-4 ${P===e.id?`text-accent`:``}`})})]},e.id))]}):(0,I.jsxs)(`div`,{className:`mt-5 rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:[(0,I.jsx)(`p`,{children:n?`当前没有可试听的语音。你可以先用文字对话,稍后再设置。`:`No voice is ready to preview. You can start with text and set it up later.`}),(0,I.jsx)(a,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),i===`connections`&&(0,I.jsxs)(`div`,{className:`mt-5`,children:[(0,I.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`现在连接,或进入对话后再添加。连接不会自动读取历史数据或创建持续关注。`:`Connect now or add sources later. Connecting does not automatically scan history or create ongoing monitoring.`}),W?(0,I.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,I.jsx)(S,{className:`h-18 rounded-xl`}),(0,I.jsx)(S,{className:`h-18 rounded-xl`})]}):(0,I.jsx)(`div`,{className:`mt-5 space-y-2`,children:U.length?U.map(e=>{let t=de(K.find(t=>t.connectorId===e.id));return(0,I.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel p-4`,children:[(0,I.jsx)(_,{connector:e,size:`sm`}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,I.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),t?(0,I.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-success`,children:[(0,I.jsx)(h,{className:`size-4`}),n?`已连接`:`Connected`]}):(0,I.jsx)(`button`,{type:`button`,onClick:()=>Y(v(e)),className:`rounded-lg bg-surface-hover px-3 py-2 text-xs text-fg transition-colors hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`连接`:`Connect`})]},e.id)}):(0,I.jsx)(`p`,{className:`rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:n?`暂无可用的推荐服务;你仍可直接进入对话。`:`No suggested services are available. You can continue to chat.`})})]}),!e&&(0,I.jsxs)(`p`,{className:`mt-5 rounded-xl bg-warning/5 p-4 text-sm text-fg-muted`,children:[n?`开始前需要一个可用模型。`:`A compatible model is required before you start.`,` `,(0,I.jsx)(a,{to:`/settings/capabilities/models`,className:`text-accent underline`,children:n?`配置模型`:`Set up a model`})]}),re&&(0,I.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:re})]},i)}),(0,I.jsx)(`footer`,{className:`shrink-0 px-5 pb-6 pt-3 sm:px-8 sm:pb-9`,children:(0,I.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,I.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n?`这些选择以后都能调整`:`You can change these choices later`}),(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[i===`intro`&&(0,I.jsx)(`button`,{type:`button`,disabled:!e||b,onClick:()=>void Q(!0),className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:n?`用默认设置开始`:`Use defaults`}),i===`voice`&&(0,I.jsx)(`button`,{type:`button`,onClick:()=>{let e={...d,voice:null};m(e),C(null),X(`connections`,e).catch(e=>C(e instanceof Error?e.message:String(e)))},className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`跳过`:`Skip`}),(0,I.jsxs)(`button`,{type:`button`,disabled:b||i===`connections`&&!e,onClick:()=>i===`connections`?void Q():void Z(1),className:`flex min-h-11 items-center gap-2 rounded-xl bg-accent px-5 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:opacity-40`,children:[b?n?`正在创建…`:`Creating…`:i===`connections`?n?`进入对话`:`Start chatting`:n?`继续`:`Continue`,` `,!b&&(0,I.jsx)(p,{className:`size-4`})]})]})]})}),J&&(0,I.jsx)(y,{draft:J,onChange:Y,onClose:()=>Y(null),t:u(r).connectorsSettings,onInstalled:async()=>{q(await O()),Y(null)}})]})}var V=5;function H(e){let t=e.replace(/\s+/g,` `).trim();if(t.length<=58)return t;let n=t.replace(/([^)]{1,80})|\([^)]{1,80}\)/g,``).replace(/([A-Za-z0-9])(?=[\u4e00-\u9fff])/g,`$1 `).replace(/\s+/g,` `).trim(),r=n.split(/[。!?;;,]/,1)[0]?.trim()||n;return r.length>58?`${r.slice(0,57).trimEnd()}…`:r}function U(e,t){if(e.phase===`closed`)return{label:t?`已结束`:`Finished`,tone:`bg-fg-subtle`};let n=e.operationalState??e.runStatus;return n===`running`?{label:t?`正在执行`:`Working`,tone:`bg-accent`}:n===`queued`?{label:t?`等待开始`:`Queued`,tone:`bg-fg-subtle`}:n===`failed`?{label:t?`执行失败`:`Failed`,tone:`bg-danger`}:n===`waiting`?{label:t?`等待继续`:`Waiting`,tone:`bg-warning`}:n===`blocked`?{label:t?`已阻塞`:`Blocked`,tone:`bg-warning`}:n===`verifying`?{label:t?`正在验证`:`Verifying`,tone:`bg-accent`}:n===`cancelled`?{label:t?`执行已取消`:`Cancelled`,tone:`bg-fg-subtle`}:e.phase===`review`?{label:t?`等待验收`:`In review`,tone:`bg-warning`}:e.phase===`active`?{label:t?`正在推进`:`In progress`,tone:`bg-accent`}:e.phase===`ready`?{label:t?`准备开始`:`Ready`,tone:`bg-fg-subtle`}:{label:t?`待处理`:`Planned`,tone:`bg-fg-subtle`}}function fe(e){let t=(0,P.c)(30),{item:n,zh:r}=e,i;t[0]!==n||t[1]!==r?(i=U(n,r),t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===n.id?s=t[4]:(s=ee(`/personal`,n.id),t[3]=n.id,t[4]=s);let c=`mt-2 size-1.5 shrink-0 rounded-full ${o.tone}`,l;t[5]===c?l=t[6]:(l=(0,I.jsx)(`span`,{className:c,"aria-hidden":!0}),t[5]=c,t[6]=l);let u;t[7]===n.title?u=t[8]:(u=H(n.title),t[7]=n.title,t[8]=u);let d;t[9]===u?d=t[10]:(d=(0,I.jsx)(`span`,{className:`line-clamp-2 break-words text-sm font-medium leading-5 text-fg`,children:u}),t[9]=u,t[10]=d);let f;t[11]===o.label?f=t[12]:(f=(0,I.jsx)(`span`,{children:o.label}),t[11]=o.label,t[12]=f);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,I.jsx)(`span`,{className:`text-fg-subtle`,"aria-hidden":!0,children:`·`}),t[13]=p):p=t[13];let h=r?`zh`:`en`,g;t[14]!==n.updatedAt||t[15]!==h?(g=N(n.updatedAt,h),t[14]=n.updatedAt,t[15]=h,t[16]=g):g=t[16];let _;t[17]===g?_=t[18]:(_=(0,I.jsx)(`span`,{children:g}),t[17]=g,t[18]=_);let v;t[19]!==_||t[20]!==f?(v=(0,I.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-2 text-xs text-fg-muted`,children:[f,p,_]}),t[19]=_,t[20]=f,t[21]=v):v=t[21];let y;t[22]!==v||t[23]!==d?(y=(0,I.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,v]}),t[22]=v,t[23]=d,t[24]=y):y=t[24];let b;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,I.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100`,"aria-hidden":!0}),t[25]=b):b=t[25];let x;return t[26]!==y||t[27]!==s||t[28]!==l?(x=(0,I.jsxs)(a,{to:s,className:`group flex min-w-0 items-start gap-3 rounded-2xl bg-surface-panel px-4 py-4 transition-colors duration-150 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[l,y,b]}),t[26]=y,t[27]=s,t[28]=l,t[29]=x):x=t[29],x}function W(){let e=o(),t=i(),n=oe(),r=(0,F.useRef)(n);r.current=n;let a=c(e=>e.language)===`zh`,u=se(e=>e.setPageHeader),f=se(e=>e.clearPageHeader),[p,m]=(0,F.useState)(null),[h,ee]=(0,F.useState)([]),[_,v]=(0,F.useState)(!0),[y,x]=(0,F.useState)(null),[ne,O]=(0,F.useState)(!1),[k,ae]=(0,F.useState)(!1),A=(0,F.useRef)(null),ce=(0,F.useRef)(null),le=(0,F.useRef)(null),[M,N]=(0,F.useState)(!1),[P,L]=(0,F.useState)(null),[R,de]=(0,F.useState)(!1),[z,H]=(0,F.useState)(!1),[U,W]=(0,F.useState)(!1),[G,K]=(0,F.useState)(0),q=(0,F.useRef)(0),J=(0,F.useCallback)(()=>e(`/settings/personal`,{state:{settingsBackPath:`${t.pathname}${t.search}${t.hash}`}}),[t.pathname,t.search,t.hash,e]),Y=(0,F.useCallback)(()=>{N(!1),ae(e=>!e)},[]);(0,F.useEffect)(()=>{let e=e=>{let t=e.detail;t&&m(t)};return window.addEventListener(`personal-agent-updated`,e),()=>window.removeEventListener(`personal-agent-updated`,e)},[]);let X=(0,F.useCallback)(async()=>{try{let[e,t]=await Promise.all([l(s(`/api/personal-agent`)),l(s(`/api/personal-agent/models`))]);m(e.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e.payload})),e.payload&&window.dispatchEvent(new Event(`session-updated`)),ee(t.payload)}catch(e){x(e instanceof Error?e.message:String(e))}finally{v(!1)}},[]);(0,F.useEffect)(()=>{X()},[X]);let Z=(0,F.useCallback)(async()=>{let e=++q.current;N(!0),L(null),de(!1),H(!1),W(!1),K(0);try{let t=await l(s(`/api/personal-agent/activity?limit=${V}&offset=0`));if(e!==q.current)return;L(t.payload),K(t.payload.items.length)}catch{e===q.current&&de(!0)}},[]),Q=(0,F.useCallback)(async()=>{if(!P||z||G>=P.total)return;let e=q.current;H(!0),W(!1);try{let t=await l(s(`/api/personal-agent/activity?limit=${V}&offset=${G}`));if(e!==q.current)return;L(e=>e?{total:t.payload.total,items:[...e.items,...t.payload.items.filter(t=>!e.items.some(e=>e.id===t.id))]}:t.payload),K(e=>e+t.payload.items.length)}catch{e===q.current&&W(!0)}finally{e===q.current&&H(!1)}},[P,G,z]);return(0,F.useEffect)(()=>{if(!M||!P||z)return;let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(async()=>{let e=q.current;try{let t=await l(s(`/api/personal-agent/activity?limit=${Math.max(V,Math.min(100,G))}&offset=0`));if(e!==q.current)return;L(t.payload),K(t.payload.items.length)}catch{}},120)},n=window.setInterval(t,5e3);return window.addEventListener(`task-changed-v2`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.clearTimeout(e),window.clearInterval(n),window.removeEventListener(`task-changed-v2`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[P,G,z,M]),(0,F.useLayoutEffect)(()=>{let e=p?.state===`ready`,t=a?`语音通话`:`Voice call`,i=()=>{e&&r.current.open({conversationId:p.conversationId,name:p.displayName})},o=e?p.appearance:`loopi`,s=e?p.displayName:`Ada`;return u({startExtra:null,main:(0,I.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[e?(0,I.jsx)(`button`,{ref:ce,type:`button`,onClick:Y,"aria-expanded":k,className:`touch-target -m-1 shrink-0 rounded-full p-1 transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a?`编辑${s}的资料`:`Edit ${s}'s profile`,title:a?`设置`:`Settings`,children:(0,I.jsx)(`span`,{className:`flex size-8 items-center justify-center`,children:(0,I.jsx)(j,{appearance:o,agentId:p?.agentId,className:`size-8`})})}):(0,I.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center`,children:(0,I.jsx)(j,{appearance:o,agentId:p?.agentId,className:`size-8`})}),(0,I.jsx)(`h1`,{className:`min-w-0 truncate text-sm font-semibold text-fg sm:text-base`,children:s})]}),end:e?(0,I.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,I.jsx)(`button`,{type:`button`,disabled:n.active,onClick:i,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,"aria-label":t,title:t,children:(0,I.jsx)(b,{className:`size-5`})}),(0,I.jsxs)(T,{open:M,onOpenChange:e=>{e?Z():N(!1)},children:[(0,I.jsx)(ie,{asChild:!0,children:(0,I.jsx)(`button`,{type:`button`,"aria-pressed":M,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a?`正在做的事`:`Activity`,children:(0,I.jsx)(g,{className:`size-5`})})}),(0,I.jsx)(C,{children:(0,I.jsxs)(w,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":a?`派发的任务`:`Delegated tasks`,className:`xopc-session-context-popover data-[state=closed]:pointer-events-none z-50 flex h-[min(34rem,calc(100dvh-6rem))] w-[min(22rem,calc(100vw-1rem))] min-h-0 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-xl focus:outline-none`,children:[(0,I.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 px-6 pb-3 pt-6`,children:[(0,I.jsxs)(`div`,{className:`min-w-0`,children:[(0,I.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:a?`交给我推进的事`:`Delegated work`}),(0,I.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:P?a?`最近更新 · 共 ${P.total} 项`:`Recently updated · ${P.total} total`:a?`查看任务进展与结果`:`Follow progress and results`})]}),(0,I.jsx)(E,{className:`touch-target -mr-2 -mt-1 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":a?`关闭活动`:`Close activity`,children:(0,I.jsx)(re,{className:`size-4`})})]}),(0,I.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-5 pt-3`,children:[!P&&!R&&(0,I.jsxs)(`div`,{className:`space-y-2`,children:[(0,I.jsx)(S,{className:`h-18 rounded-2xl`}),(0,I.jsx)(S,{className:`h-18 rounded-2xl`}),(0,I.jsx)(S,{className:`h-18 rounded-2xl`})]}),R&&(0,I.jsxs)(`div`,{className:`px-5 py-12 text-center`,children:[(0,I.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`暂时无法读取任务`:`Could not load tasks`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>void Z(),className:`mt-3 rounded-lg px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:a?`重试`:`Try again`})]}),P?.items.length===0&&(0,I.jsxs)(`div`,{className:`px-5 py-16 text-center`,children:[(0,I.jsx)(g,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,I.jsx)(`p`,{className:`mt-4 text-sm font-medium text-fg`,children:a?`还没有派发的任务`:`No delegated work yet`}),(0,I.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?`你可以在对话里直接告诉我想推进的事。`:`Tell me what you would like to move forward in chat.`})]}),P&&P.items.length>0&&(0,I.jsx)(`div`,{className:`space-y-2`,children:P.items.map(e=>(0,I.jsx)(fe,{item:e,zh:a},e.id))}),P&&G<P.total&&(0,I.jsxs)(`div`,{className:`pt-4 text-center`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:()=>void Q(),disabled:z,className:`min-h-10 rounded-xl bg-surface-panel px-5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-50`,children:z?a?`正在加载…`:`Loading…`:a?`加载更多`:`Load more`}),U&&(0,I.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:a?`加载失败,请重试`:`Could not load more. Try again.`})]})]})]})})]}),(0,I.jsx)(`button`,{ref:A,type:`button`,onClick:Y,"aria-expanded":k,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a?`Ada 设置`:`Ada settings`,children:(0,I.jsx)(te,{className:`size-5`})})]}):null}),()=>f()},[P,R,G,z,U,f,Q,Z,p,u,M,k,Y,n.active,a]),_?(0,I.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,I.jsx)(S,{className:`h-20 w-20 rounded-full`}),(0,I.jsx)(S,{className:`h-9 w-72`}),(0,I.jsx)(S,{className:`h-44 w-full rounded-2xl`})]}):y&&!p?(0,I.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-6 text-sm text-danger`,children:[(0,I.jsx)(`p`,{children:y}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>void X(),className:`text-accent hover:underline`,children:a?`重试`:`Retry`})]}):p?.state===`ready`?(0,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[ne&&(0,I.jsxs)(`div`,{role:`alert`,className:`flex shrink-0 items-center justify-between gap-3 border-b border-warning/30 bg-warning/5 px-5 py-3 text-sm text-fg-muted`,children:[(0,I.jsx)(`span`,{children:a?`助手已创建,头像上传未完成。可在资料设置中重新上传。`:`Your assistant is ready. Upload the avatar again in profile settings.`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>{O(!1),J()},className:`shrink-0 text-accent hover:underline`,children:a?`打开设置`:`Open settings`})]}),(0,I.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,I.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,I.jsx)(d,{embedded:!0,personal:!0,personalWelcome:{name:p.displayName,addressAs:p.userCallName??void 0,avatar:(0,I.jsx)(j,{appearance:p.appearance,agentId:p.agentId,className:`size-14`}),opening:a?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`},conversationId:p.conversationId})})}),(0,I.jsxs)(T,{open:k,onOpenChange:ae,children:[(0,I.jsx)(D,{virtualRef:A}),(0,I.jsx)(C,{children:(0,I.jsxs)(w,{ref:le,side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":a?`Ada 快捷设置`:`Ada quick settings`,onInteractOutside:e=>{e.target instanceof Node&&(A.current?.contains(e.target)||ce.current?.contains(e.target)||le.current?.contains(e.target))&&e.preventDefault()},className:`xopc-session-context-popover data-[state=closed]:pointer-events-none z-50 flex max-h-[calc(100dvh-5rem)] w-[min(22rem,calc(100vw-1rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-xl outline-none`,children:[(0,I.jsx)(`div`,{className:`min-h-0 overflow-y-auto p-4`,children:(0,I.jsx)(ue,{zh:a,onOpenVoiceServices:J})}),(0,I.jsx)(`button`,{type:`button`,onClick:J,className:`shrink-0 border-t border-edge px-4 py-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,children:a?`更多设置`:`More settings`})]})})]})]}):(0,I.jsx)(B,{modelsAvailable:h.length>0,onCreated:(e,t)=>{m(e),O(t),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e})),window.dispatchEvent(new Event(`session-updated`))}})}export{W as PersonalPage};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{l as n,t as r}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i,l as a,n as o}from"./locale-store-Dy1EByeG.js";import{t as s}from"./messages-BAnhwALN.js";import{i as c,u as l}from"./automation-display-DaVDNZz8.js";import{F as u,V as d,t as f}from"./markdown-view-BlxIaCCQ.js";import{t as p}from"./skeleton-DzdOeGYz.js";import{a as m,c as h}from"./api-B4FJ51EC.js";import{i as g}from"./vendor-swr-CdRzEUwF.js";import{t as _}from"./button-Cc4hUNTt.js";import{t as v}from"./automation-api-DxBmyzp0.js";import{n as y}from"./automation-task-card-CiJmJ7_h.js";import{i as b,n as x}from"./api-B1J5ajiP.js";import{n as S}from"./product-preview-modal-DMHOKocl.js";import{t as C}from"./open-route-MyZ2sB9C.js";import{i as w,r as T}from"./automation-result-state-CAsqgMNR.js";import{t as E}from"./project-overview-model-DrLXaO-t.js";var D=e(),O=t(),k=new Set([`queued`,`running`,`cancelling`]);function A(e){let t=(0,D.c)(60),{automationId:n,runId:r}=e,i=o(N),a=i===`zh`,c,l;t[0]!==n||t[1]!==r?(c=[`automation-run-preview`,n,r],l=async()=>{let[e,t]=await Promise.all([v.get(n),r?v.getRun(r).then(M):Promise.resolve(void 0)]);if(t&&t.automationId!==n)throw Error(`Run does not belong to this task`);return{task:e.automation,run:t}},t[0]=n,t[1]=r,t[2]=c,t[3]=l):(c=t[2],l=t[3]);let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u={shouldRetryOnError:!1,refreshInterval:j},t[4]=u):u=t[4];let{data:d,error:m,mutate:h}=g(c,l,u);if(m){let e=a?`暂时无法读取这次运行,请重试。`:`Could not load this run. Try again.`,n;t[5]===e?n=t[6]:(n=(0,O.jsx)(`p`,{children:e}),t[5]=e,t[6]=n);let r;t[7]===h?r=t[8]:(r=()=>void h(),t[7]=h,t[8]=r);let i=a?`重试`:`Retry`,o;t[9]!==r||t[10]!==i?(o=(0,O.jsx)(_,{variant:`secondary`,onClick:r,children:i}),t[9]=r,t[10]=i,t[11]=o):o=t[11];let s;return t[12]!==n||t[13]!==o?(s=(0,O.jsxs)(`div`,{role:`alert`,className:`space-y-3 text-sm text-fg-muted`,children:[n,o]}),t[12]=n,t[13]=o,t[14]=s):s=t[14],s}if(!d){let e;return t[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,O.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,O.jsx)(p,{className:`h-6 w-2/3`}),(0,O.jsx)(p,{className:`h-4 w-1/3`}),(0,O.jsx)(p,{className:`h-32`})]}),t[15]=e):e=t[15],e}let b=d.run;if(!b){let e;t[16]===d.task.name?e=t[17]:(e=(0,O.jsx)(`h2`,{className:`text-lg font-medium text-fg`,children:d.task.name}),t[16]=d.task.name,t[17]=e);let n=a?`这条旧链接没有关联具体执行,请从任务的运行记录查看。`:`This older link does not identify an execution. Choose one from the task history.`,r;t[18]===n?r=t[19]:(r=(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n}),t[18]=n,t[19]=r);let i;return t[20]!==e||t[21]!==r?(i=(0,O.jsxs)(`div`,{className:`space-y-3`,children:[e,r]}),t[20]=e,t[21]=r,t[22]=i):i=t[22],i}let x;t[23]===d.task.name?x=t[24]:(x=(0,O.jsx)(`h2`,{className:`text-lg font-medium text-fg`,children:d.task.name}),t[23]=d.task.name,t[24]=x);let S;t[25]===i?S=t[26]:(S=s(i),t[25]=i,t[26]=S);let C=S.automations.status[b.status],E;t[27]!==b.createdAtMs||t[28]!==a?(E=new Date(b.createdAtMs).toLocaleString(a?`zh-CN`:`en-US`),t[27]=b.createdAtMs,t[28]=a,t[29]=E):E=t[29];let A;t[30]!==C||t[31]!==E?(A=(0,O.jsxs)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:[C,` · `,E]}),t[30]=C,t[31]=E,t[32]=A):A=t[32];let P;t[33]!==x||t[34]!==A?(P=(0,O.jsxs)(`div`,{className:`space-y-2`,children:[x,A]}),t[33]=x,t[34]=A,t[35]=P):P=t[35];let F;t[36]!==b.status||t[37]!==a?(F=b.status===`queued`?(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`任务正在排队,开始后会自动更新。`:`Queued. This view updates when execution starts.`}):b.status===`running`?(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a?`正在执行,结果会自动显示在这里。`:`Running. The result will appear here automatically.`}):null,t[36]=b.status,t[37]=a,t[38]=F):F=t[38];let I;t[39]===b.summary?I=t[40]:(I=b.summary?(0,O.jsx)(f,{content:b.summary}):null,t[39]=b.summary,t[40]=I);let L;t[41]!==i||t[42]!==b?(L=b.error?(0,O.jsx)(`p`,{className:`text-sm leading-6 text-danger`,children:T(b,i)}):null,t[41]=i,t[42]=b,t[43]=L):L=t[43];let R;t[44]!==n||t[45]!==i||t[46]!==b.id||t[47]!==b.status?(R=b.status===`failed`||b.status===`timeout`?(0,O.jsx)(y,{automationId:n,runId:b.id,language:i,variant:`secondary`}):null,t[44]=n,t[45]=i,t[46]=b.id,t[47]=b.status,t[48]=R):R=t[48];let z;t[49]!==i||t[50]!==b.id||t[51]!==b.status?(z=k.has(b.status)?null:(0,O.jsx)(w,{runId:b.id,language:i}),t[49]=i,t[50]=b.id,t[51]=b.status,t[52]=z):z=t[52];let ee;return t[53]!==F||t[54]!==I||t[55]!==L||t[56]!==R||t[57]!==z||t[58]!==P?(ee=(0,O.jsxs)(`div`,{className:`space-y-5`,children:[P,F,I,L,R,z]}),t[53]=F,t[54]=I,t[55]=L,t[56]=R,t[57]=z,t[58]=P,t[59]=ee):ee=t[59],ee}function j(e){return e&&(e.task.state.runningRunId||e.run&&k.has(e.run.status))?3e3:0}function M(e){return e.run}function N(e){return e.language}var P=`rounded text-sm text-accent-fg hover:underline focus-visible:ring-2 focus-visible:ring-accent`,F=e=>e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`);function I(e){let t=(0,D.c)(83),{project:i,target:c}=e,l=o(re),m=a(B),_=n(),v=l===`zh`,y;t[0]===l?y=t[1]:(y=s(l),t[0]=l,t[1]=y);let b=y.projectDetailPage,x;t[2]!==c.id||t[3]!==m?(x=[`chat-project-operating-view`,c.id,m],t[2]=c.id,t[3]=m,t[4]=x):x=t[4];let S;t[5]===c.id?S=t[6]:(S=()=>h(c.id),t[5]=c.id,t[6]=S);let C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C={shouldRetryOnError:!1},t[7]=C):C=t[7];let{data:w,error:T,isLoading:k,mutate:A}=g(x,S,C),j=`${_.pathname}${_.search}`,M=`/projects/${encodeURIComponent(c.id)}`,N;t[8]!==j||t[9]!==M||t[10]!==c.ownerAgentId?(N=e=>{let t=new URLSearchParams;return c.ownerAgentId&&t.set(`agentId`,c.ownerAgentId),d(`${M}/${e}${t.size?`?${t}`:``}`,j)},t[8]=j,t[9]=M,t[10]=c.ownerAgentId,t[11]=N):N=t[11];let I=N,V;t[12]===j?V=t[13]:(V=e=>u(j,e),t[12]=j,t[13]=V);let H=V,U,W,G,K,q,J,Y;if(t[14]!==T||t[15]!==k||t[16]!==A||t[17]!==b||t[18]!==i||t[19]!==I||t[20]!==H||t[21]!==w||t[22]!==v){let e=w?.tasks??[],n={moving:0,ready:0,waiting:0,needsUser:0,done:0};for(let t of e)t.phase===`closed`?t.resolution===`done`&&(n.done+=1):F(t)?n.needsUser+=1:[`queued`,`running`,`verifying`].includes(t.operationalState)?n.moving+=1:[`waiting`,`blocked`].includes(t.operationalState)?n.waiting+=1:n.ready+=1;let a={moving:v?`进行中`:`In progress`,ready:v?`待处理`:`To do`,waiting:v?`等待中`:`Waiting`,needsUser:v?`等你处理`:`Needs you`,done:v?`已完成`:`Completed`},o=new Set(e.filter(ne).map(te)),s=(w?.blockers??[]).filter(e=>o.has(e.taskId)).sort(ee),c=s.filter((e,t)=>s.findIndex(t=>t.taskId===e.taskId)===t).slice(0,2),l=E(e,e.length).sort(z).slice(0,3),u=[...(i.recentUpdates??[]).map((e,t)=>({id:`update:${e.id??t}`,source:`project`,summary:e.summary,at:e.createdAt,title:v?`项目进展`:`Project update`,href:I(`progress`)})),...(w?.recentResults??[]).map(e=>{let{taskId:t,taskTitle:n,receipt:r}=e;return{id:`receipt:${r.runId}`,source:`task:${t}`,summary:r.summary,at:r.finalizedAt,title:`${n} · ${v?{passed:`验证通过`,failed:`验证失败`,unverified:`未验证`}[r.verification.status]:r.verification.status}`,href:H(t)}})].filter(R).sort(L),d=u.filter((e,t)=>u.findIndex(t=>t.source===e.source&&t.summary.trim()===e.summary.trim())===t).slice(0,3),m;t[30]===v?m=t[31]:(m=e=>e===void 0||!Number.isFinite(new Date(e).getTime())?null:new Intl.DateTimeFormat(v?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(new Date(e)),t[30]=v,t[31]=m);let h=m,g=i.lastActiveAt||i.updatedAt,_;t[32]!==h||t[33]!==g?(_=h(g),t[32]=h,t[33]=g,t[34]=_):_=t[34];let y=_,x=i.outcome||i.description||i.brief,S=v?`项目健康度尚未评估`:`Project health not assessed`,C=v?`进展正常`:`On track`,D=v?`存在风险`:`At risk`,j=v?`偏离计划`:`Off track`,M;t[35]!==S||t[36]!==C||t[37]!==D||t[38]!==j?(M={unknown:S,on_track:C,at_risk:D,off_track:j},t[35]=S,t[36]=C,t[37]=D,t[38]=j,t[39]=M):M=t[39];let N=M;U=`space-y-5`;let B;t[40]===i.name?B=t[41]:(B=(0,O.jsx)(`h2`,{className:`min-w-0 break-words text-xl font-semibold text-fg`,children:i.name}),t[40]=i.name,t[41]=B);let re=b.statuses[i.status],V;t[42]===re?V=t[43]:(V=(0,O.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-inset px-2 py-1 text-xs text-fg-muted`,children:re}),t[42]=re,t[43]=V);let X;t[44]!==B||t[45]!==V?(X=(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[B,V]}),t[44]=B,t[45]=V,t[46]=X):X=t[46];let Z;t[47]!==x||t[48]!==v?(Z=x?(0,O.jsx)(`div`,{className:`line-clamp-3 text-sm text-fg-muted`,children:(0,O.jsx)(f,{content:x,mermaidActions:!1})}):(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:v?`尚未填写项目目标。`:`No project goal recorded yet.`}),t[47]=x,t[48]=v,t[49]=Z):Z=t[49];let ie=N[i.health],ae=y?` · ${v?`最近活动`:`Last activity`} ${y}`:``,Q;t[50]!==ie||t[51]!==ae?(Q=(0,O.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[ie,ae]}),t[50]=ie,t[51]=ae,t[52]=Q):Q=t[52],t[53]!==X||t[54]!==Z||t[55]!==Q?(W=(0,O.jsxs)(`div`,{className:`space-y-2`,children:[X,Z,Q]}),t[53]=X,t[54]=Z,t[55]=Q,t[56]=W):W=t[56];let oe=v?`当前概况`:`Overview`,se=v?`当前概况`:`Overview`,$;t[57]===se?$=t[58]:($=(0,O.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:se}),t[57]=se,t[58]=$);let ce=k?(0,O.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-3`,children:[(0,O.jsx)(p,{className:`h-4 w-3/4`}),(0,O.jsx)(p,{className:`h-14 w-full`})]}):T||!w?(0,O.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-2 text-sm text-fg-muted`,children:[(0,O.jsx)(`span`,{children:v?`任务概况暂时无法读取。`:`Task overview is temporarily unavailable.`}),(0,O.jsx)(`button`,{type:`button`,onClick:()=>void A(),className:P,children:v?`重试`:`Retry`})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.length===0?v?`尚未关联任务,可在项目中添加下一步工作。`:`No tasks linked yet. Add the next piece of work in the project.`:v?`${n.moving} 项任务正在推进,${n.needsUser} 项等你处理,${n.waiting} 项等待中。`:`${n.moving} in progress, ${n.needsUser} need your input, ${n.waiting} waiting.`}),w.digest.recommendedAction&&(0,O.jsxs)(`p`,{className:`break-words text-sm leading-6 text-fg-muted`,children:[v?`建议下一步:`:`Suggested next step: `,w.digest.recommendedAction]}),(0,O.jsx)(`dl`,{className:`grid grid-cols-3 gap-3 border-t border-edge pt-3 sm:grid-cols-5`,children:Object.keys(a).map(e=>(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`dt`,{className:`text-xs text-fg-muted`,children:a[e]}),(0,O.jsx)(`dd`,{className:`mt-1 text-xl font-semibold tabular-nums text-fg`,children:n[e]})]},e))})]});t[59]!==oe||t[60]!==$||t[61]!==ce?(G=(0,O.jsxs)(`section`,{"aria-label":oe,className:`space-y-3 rounded-xl border border-edge bg-surface-inset/50 p-4`,children:[$,ce]}),t[59]=oe,t[60]=$,t[61]=ce,t[62]=G):G=t[62],K=w&&(0,O.jsxs)(`div`,{className:`grid gap-6 sm:grid-cols-2`,children:[(0,O.jsxs)(`section`,{className:`min-w-0 space-y-3`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:v?`优先关注`:`Needs attention`}),c.length?(0,O.jsx)(`ul`,{className:`divide-y divide-edge`,children:c.map(e=>(0,O.jsx)(`li`,{className:`py-3 first:pt-0`,children:(0,O.jsxs)(r,{to:H(e.taskId),className:`block rounded-lg focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,O.jsx)(`p`,{className:`break-words text-sm font-medium text-fg`,children:e.title}),(0,O.jsx)(`p`,{className:`mt-1 line-clamp-3 break-words text-sm leading-6 text-fg-muted`,children:e.detail}),(0,O.jsx)(`span`,{className:`mt-2 inline-block ${P}`,children:v?`查看关联任务 →`:`View task →`})]})},e.taskId))}):(0,O.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:v?`暂无已记录的阻塞或待处理提醒。`:`No recorded blockers or attention items.`})]}),(0,O.jsxs)(`section`,{className:`min-w-0 space-y-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:v?`当前任务`:`Current tasks`}),(0,O.jsx)(r,{to:I(`tasks`),className:P,children:v?`查看全部`:`View all`})]}),l.length?(0,O.jsx)(`ul`,{className:`divide-y divide-edge`,children:l.map(e=>(0,O.jsx)(`li`,{children:(0,O.jsxs)(r,{to:H(e.id),className:`block rounded-lg py-3 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,O.jsx)(`p`,{className:`break-words text-sm font-medium text-fg`,children:e.title}),(0,O.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[b.board.phases[e.phase],e.operationalState===`idle`?``:` · ${b.board.operationalStates[e.operationalState]}`]})]})},e.id))}):(0,O.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:v?`暂无可推进的任务,等待中的任务可在全部任务中查看。`:`No actionable tasks. View all tasks to see any waiting work.`})]})]}),q=`space-y-3 border-t border-edge pt-5`;let le=v?`最近进展`:`Recent progress`,ue;t[63]===le?ue=t[64]:(ue=(0,O.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:le}),t[63]=le,t[64]=ue);let de;t[65]===I?de=t[66]:(de=I(`progress`),t[65]=I,t[66]=de);let fe=v?`查看记录`:`View history`,pe;t[67]!==de||t[68]!==fe?(pe=(0,O.jsx)(r,{to:de,className:P,children:fe}),t[67]=de,t[68]=fe,t[69]=pe):pe=t[69],t[70]!==ue||t[71]!==pe?(J=(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[ue,pe]}),t[70]=ue,t[71]=pe,t[72]=J):J=t[72],Y=d.length?(0,O.jsx)(`ul`,{className:`divide-y divide-edge-subtle`,children:d.map(e=>(0,O.jsxs)(`li`,{className:`space-y-2 py-3 first:pt-0`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-2`,children:[(0,O.jsxs)(`p`,{className:`min-w-0 break-words text-xs text-fg-muted`,children:[e.title,h(e.at)?` · ${h(e.at)}`:``]}),(0,O.jsx)(r,{to:e.href,className:P,children:v?`查看来源`:`View source`})]}),(0,O.jsx)(`div`,{className:`line-clamp-3 break-words text-sm text-fg`,children:(0,O.jsx)(f,{content:e.summary,mermaidActions:!1})})]},e.id))}):(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:v?`暂无项目进展或执行结果。`:`No project updates or execution results yet.`}),t[14]=T,t[15]=k,t[16]=A,t[17]=b,t[18]=i,t[19]=I,t[20]=H,t[21]=w,t[22]=v,t[23]=U,t[24]=W,t[25]=G,t[26]=K,t[27]=q,t[28]=J,t[29]=Y}else U=t[23],W=t[24],G=t[25],K=t[26],q=t[27],J=t[28],Y=t[29];let X;t[73]!==q||t[74]!==J||t[75]!==Y?(X=(0,O.jsxs)(`section`,{className:q,children:[J,Y]}),t[73]=q,t[74]=J,t[75]=Y,t[76]=X):X=t[76];let Z;return t[77]!==U||t[78]!==W||t[79]!==G||t[80]!==K||t[81]!==X?(Z=(0,O.jsxs)(`div`,{className:U,children:[W,G,K,X]}),t[77]=U,t[78]=W,t[79]=G,t[80]=K,t[81]=X,t[82]=Z):Z=t[82],Z}function L(e,t){return(t.at||0)-(e.at||0)}function R(e){return e.summary?.trim()}function z(e,t){return Number([`queued`,`running`,`verifying`].includes(t.operationalState))-Number([`queued`,`running`,`verifying`].includes(e.operationalState))}function ee(e,t){return Number([`input_required`,`approval_required`].includes(t.kind))-Number([`input_required`,`approval_required`].includes(e.kind))}function te(e){return e.id}function ne(e){return e.phase!==`closed`}function B(e){return e.conversationId}function re(e){return e.language}async function V(e){switch(e.kind){case`project`:return{kind:e.kind,value:await m(e.id)};case`automation`:{let[t,n]=await Promise.all([v.list(),v.runs(5,e.id)]);return{kind:e.kind,value:t.automations.find(t=>t.id===e.id),runs:n.runs}}case`local_app`:{let t=await x(e.id),n=e.sourceHash?await b(e.id,e.sourceHash):void 0;return{kind:e.kind,value:t,previewUrl:n?.previewUrl||t.draftPreviewUrl}}}}var H={pending:[`等待中`,`Pending`],planned:[`计划中`,`Planned`],active:[`进行中`,`Active`],paused:[`已暂停`,`Paused`],completed:[`已完成`,`Completed`],cancelled:[`已取消`,`Cancelled`],archived:[`已归档`,`Archived`],queued:[`排队中`,`Queued`],running:[`运行中`,`Running`],succeeded:[`成功`,`Succeeded`],failed:[`失败`,`Failed`],timeout:[`超时`,`Timed out`],cancelling:[`取消中`,`Cancelling`],unknown:[`尚未评估`,`Not assessed`],on_track:[`进展正常`,`On track`],at_risk:[`存在风险`,`At risk`],off_track:[`偏离计划`,`Off track`]};function U(e){let t=(0,D.c)(5),{target:n}=e;if(n.kind===`automation`&&n.view===`run`){let e;return t[0]!==n.id||t[1]!==n.runId?(e=(0,O.jsx)(A,{automationId:n.id,runId:n.runId}),t[0]=n.id,t[1]=n.runId,t[2]=e):e=t[2],e}let r;return t[3]===n?r=t[4]:(r=(0,O.jsx)(W,{target:n}),t[3]=n,t[4]=r),r}function W(e){let t=(0,D.c)(56),{target:n}=e,u=a(J),d=o(q),f=d===`zh`,p=s(d),m;t[0]===f?m=t[1]:(m=e=>H[e]?.[+!f]||e,t[0]=f,t[1]=m);let h=m,_;t[2]!==n.href||t[3]!==u?(_=[`chat-product-preview`,n.href,u],t[2]=n.href,t[3]=u,t[4]=_):_=t[4];let v;t[5]===n?v=t[6]:(v=()=>V(n),t[5]=n,t[6]=v);let y;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(y={shouldRetryOnError:!1,refreshInterval:K},t[7]=y):y=t[7];let{data:b,error:x,isLoading:w}=g(_,v,y);if(w){let e;return t[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,O.jsx)(S,{}),t[8]=e):e=t[8],e}if(x){let e=f?`无法加载内容,它可能已删除或暂时不可用。`:`Unable to load this content. It may have been deleted or be temporarily unavailable.`,n;return t[9]===e?n=t[10]:(n=(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:e}),t[9]=e,t[10]=n),n}if(!b?.value){let e=f?`内容不存在或已删除。`:`This content is unavailable or has been deleted.`,n;return t[11]===e?n=t[12]:(n=(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[11]=e,t[12]=n),n}let T=G;if(b.kind===`project`){let e;return t[13]!==b.value||t[14]!==n?(e=(0,O.jsx)(I,{project:b.value,target:n}),t[13]=b.value,t[14]=n,t[15]=e):e=t[15],e}if(b.kind===`automation`){let e=b.value,n=e.action.kind===`agent`?e.action.instruction:void 0,r;t[16]===e.name?r=t[17]:(r=(0,O.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:e.name}),t[16]=e.name,t[17]=r);let i;t[18]!==e.description||t[19]!==T?(i=T(e.description),t[18]=e.description,t[19]=T,t[20]=i):i=t[20];let a;t[21]!==n||t[22]!==T?(a=T(n),t[21]=n,t[22]=T,t[23]=a):a=t[23];let o;t[24]!==e.state.nextRunAtMs||t[25]!==f?(o=e.state.nextRunAtMs&&(0,O.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[f?`下次运行`:`Next run`,` · `,new Date(e.state.nextRunAtMs).toLocaleString(f?`zh-CN`:`en-US`)]}),t[24]=e.state.nextRunAtMs,t[25]=f,t[26]=o):o=t[26];let s;t[27]===e.state.lastError?s=t[28]:(s=e.state.lastError&&(0,O.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e.state.lastError}),t[27]=e.state.lastError,t[28]=s);let u=f?`最近运行`:`Recent runs`,m;t[29]===u?m=t[30]:(m=(0,O.jsx)(`h3`,{className:`font-medium text-fg`,children:u}),t[29]=u,t[30]=m);let g;t[31]!==b.runs||t[32]!==T||t[33]!==h||t[34]!==f?(g=b.runs.length?b.runs.map(e=>(0,O.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,O.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[h(e.status),` · `,new Date(e.createdAtMs).toLocaleString(f?`zh-CN`:`en-US`)]}),T(e.summary),e.error&&(0,O.jsx)(`p`,{className:`text-sm text-danger`,children:e.error})]},e.id)):(0,O.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f?`暂无运行记录。`:`No runs yet.`}),t[31]=b.runs,t[32]=T,t[33]=h,t[34]=f,t[35]=g):g=t[35];let _;return t[36]!==m||t[37]!==g?(_=(0,O.jsxs)(`section`,{className:`space-y-3`,children:[m,g]}),t[36]=m,t[37]=g,t[38]=_):_=t[38],(0,O.jsxs)(`div`,{className:`space-y-6`,children:[(0,O.jsxs)(`div`,{className:`space-y-3`,children:[r,(0,O.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[l(e)?f?`已完成`:`Completed`:e.enabled?f?`已启用`:`Enabled`:f?`已暂停`:`Paused`,` · `,c(e.trigger,p.automations,p.cron,d)]}),i,a,o,s]}),_]})}let E=b.value,k;t[39]===E.name?k=t[40]:(k=(0,O.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:E.name}),t[39]=E.name,t[40]=k);let A=E.description||E.idea,j;t[41]!==T||t[42]!==A?(j=T(A),t[41]=T,t[42]=A,t[43]=j):j=t[43];let M;t[44]!==E.name||t[45]!==b.previewUrl||t[46]!==f?(M=b.previewUrl&&(0,O.jsx)(`iframe`,{title:f?`${E.name} 交互预览`:`${E.name} interactive preview`,src:i(b.previewUrl),sandbox:`allow-scripts allow-forms`,className:`h-[min(30rem,55dvh)] w-full rounded-lg border border-edge bg-white`}),t[44]=E.name,t[45]=b.previewUrl,t[46]=f,t[47]=M):M=t[47];let N;t[48]!==E||t[49]!==f?(N=E.installationState===`installed`&&E.enabled&&E.status===`installed`&&(0,O.jsx)(r,{to:C(E),className:`inline-flex rounded-lg bg-accent px-3 py-2 text-sm text-white focus-visible:ring-2 focus-visible:ring-accent`,children:f?`使用应用`:`Use app`}),t[48]=E,t[49]=f,t[50]=N):N=t[50];let P;return t[51]!==k||t[52]!==j||t[53]!==M||t[54]!==N?(P=(0,O.jsxs)(`div`,{className:`space-y-5`,children:[k,j,M,N]}),t[51]=k,t[52]=j,t[53]=M,t[54]=N,t[55]=P):P=t[55],P}function G(e){return e?.trim()?(0,O.jsx)(f,{content:e,mermaidActions:!1}):null}function K(e){return e?.kind===`automation`&&e.value?.state.runningRunId?3e3:0}function q(e){return e.language}function J(e){return e.conversationId}export{U as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/product-preview-content-CUaHxyiE.js","assets/vendor-react-BOUWij0V.js","assets/rolldown-runtime-aKtaBQYM.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/preload-helper-Czpn1I53.js","assets/locale-store-Dy1EByeG.js","assets/messages-BAnhwALN.js","assets/markdown-view-BlxIaCCQ.js","assets/dist-CY7CS_D3.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/createLucideIcon-DPHK1VkS.js","assets/download-Dk-ZjtO6.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-DImAfVs5.js","assets/product-delivery-BFfqdKLe.js","assets/schemas-CCWMleym.js","assets/local-apps-DeqzkJiF.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-DG8DDkEA.css","assets/skeleton-DzdOeGYz.js","assets/api-B4FJ51EC.js","assets/tasks-BTLabOMp.js","assets/specialists-xbB3xL9e.js","assets/files-BNL4kkSB.js","assets/vendor-swr-CdRzEUwF.js","assets/button-Cc4hUNTt.js","assets/automation-api-DxBmyzp0.js","assets/automation-task-card-BjqxvYqc.js","assets/calendar-clock-D-quYVPe.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/popover-select-CLsphyzA.js","assets/check-DUBLcKHA.js","assets/dist-GJ8-1PAx.js","assets/dist-BuHnPloF.js","assets/floating-ui.dom-seOukHzT.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/message-circle-Badhj-4D.js","assets/pencil-DmIY3Oa-.js","assets/chat-agents-api-CjlzCSmC.js","assets/gateway-config-swr-1Rk0LeEM.js","assets/model-selector-C-CqPBao.js","assets/settings-2-D-csvaET.js","assets/registry-api-DuDIthjL.js","assets/gateway-startup-retry-D6WPS0RW.js","assets/open-capability-settings-DQsmJxI7.js","assets/interaction-BdhHBbYa.js","assets/form-field-width-DJw_jULe.js","assets/model-sort-_Tz8s_4N.js","assets/date-picker-XnE3iFhG.js","assets/calendar-days-hw_Y-g-s.js","assets/chevron-left-DqFhpbvK.js","assets/time-picker-C1PXAXZF.js","assets/clock-3-DnrAnuyZ.js","assets/api-B1J5ajiP.js","assets/open-route-MyZ2sB9C.js","assets/automation-result-state-CAsqgMNR.js","assets/project-overview-model-DrLXaO-t.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{t as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as o}from"./locale-store-Dy1EByeG.js";import{a as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./dist-CY7CS_D3.js";import{t as m}from"./external-link-DjqjBmc3.js";import{V as h}from"./markdown-view-BlxIaCCQ.js";import{t as g}from"./x-B_N4OPjy.js";import{t as _}from"./skeleton-DzdOeGYz.js";import{i as v}from"./vendor-swr-CdRzEUwF.js";import{t as y}from"./button-Cc4hUNTt.js";import{t as b}from"./automation-api-DxBmyzp0.js";import{r as x}from"./automation-task-card-BjqxvYqc.js";var S=n(),C=e(t(),1),w=r(),T=(0,C.lazy)(()=>i(()=>import(`./product-preview-content-CUaHxyiE.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64]))),E={project:[`项目预览`,`Project preview`],automation:[`自动化详情`,`Automation details`],local_app:[`应用预览`,`App preview`]};function D(){let e=(0,S.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,w.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,w.jsx)(_,{className:`h-7 w-2/3`}),(0,w.jsx)(_,{className:`h-4 w-full`}),(0,w.jsx)(_,{className:`h-4 w-4/5`}),(0,w.jsx)(_,{className:`h-32 w-full`})]}),e[0]=t):t=e[0],t}function O(e){let t=(0,S.c)(8),{target:n,backgroundPath:r,onClose:i}=e;if(n.kind===`automation`&&n.view!==`run`){let e;return t[0]!==r||t[1]!==i||t[2]!==n?(e=(0,w.jsx)(k,{target:n,backgroundPath:r,onClose:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=e):e=t[3],e}let a;return t[4]!==r||t[5]!==i||t[6]!==n?(a=(0,w.jsx)(j,{target:n,backgroundPath:r,onClose:i}),t[4]=r,t[5]=i,t[6]=n,t[7]=a):a=t[7],a}function k(e){let t=(0,S.c)(34),{target:n,backgroundPath:r,onClose:i}=e,a=o(A),l,m;t[0]===n.id?(l=t[1],m=t[2]):(l=[`automation-card`,n.id],m=()=>b.get(n.id),t[0]=n.id,t[1]=l,t[2]=m);let h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,shouldRetryOnError:!1},t[3]=h):h=t[3];let{data:g,error:_,mutate:C}=v(l,m,h);if(g?.automation){if(g.automation.action.kind===`agent`&&!g.automation.management){let e;return t[4]!==g.automation||t[5]!==a||t[6]!==i?(e=(0,w.jsx)(x,{automation:g.automation,language:a,onClose:i}),t[4]=g.automation,t[5]=a,t[6]=i,t[7]=e):e=t[7],e}let e;return t[8]!==r||t[9]!==i||t[10]!==n?(e=(0,w.jsx)(j,{target:n,backgroundPath:r,onClose:i}),t[8]=r,t[9]=i,t[10]=n,t[11]=e):e=t[11],e}let T=a===`zh`,E;t[12]===i?E=t[13]:(E=e=>{e||i()},t[12]=i,t[13]=E);let O;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,w.jsx)(s,{className:`fixed inset-0 z-65 bg-scrim`}),t[14]=O):O=t[14];let k=T?`定时任务详情`:`Scheduled task details`,M;t[15]===k?M=t[16]:(M=(0,w.jsx)(f,{className:`mb-5 font-medium`,children:k}),t[15]=k,t[16]=M);let N=T?`查看和编辑定时任务。`:`View and edit the scheduled task.`,P;t[17]===N?P=t[18]:(P=(0,w.jsx)(c,{className:`sr-only`,children:N}),t[17]=N,t[18]=P);let F;t[19]!==_||t[20]!==C||t[21]!==T?(F=_?(0,w.jsxs)(`div`,{role:`alert`,className:`text-sm text-fg-muted`,children:[(0,w.jsx)(`p`,{children:T?`任务已不存在或暂时无法读取。`:`This task is unavailable.`}),(0,w.jsx)(y,{variant:`secondary`,onClick:()=>void C(),children:T?`重试`:`Retry`})]}):(0,w.jsx)(D,{}),t[19]=_,t[20]=C,t[21]=T,t[22]=F):F=t[22];let I=T?`关闭`:`Close`,L;t[23]!==i||t[24]!==I?(L=(0,w.jsx)(y,{className:`mt-auto self-end`,variant:`ghost`,onClick:i,children:I}),t[23]=i,t[24]=I,t[25]=L):L=t[25];let R;t[26]!==F||t[27]!==L||t[28]!==M||t[29]!==P?(R=(0,w.jsxs)(u,{children:[O,(0,w.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-70 flex h-[min(600px,calc(100dvh-2rem))] w-[min(680px,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay p-5`,children:[M,P,F,L]})]}),t[26]=F,t[27]=L,t[28]=M,t[29]=P,t[30]=R):R=t[30];let z;return t[31]!==R||t[32]!==E?(z=(0,w.jsx)(p,{open:!0,onOpenChange:E,children:R}),t[31]=R,t[32]=E,t[33]=z):z=t[33],z}function A(e){return e.language}function j(e){let t=(0,S.c)(34),{target:n,backgroundPath:r,onClose:i}=e,_=o(M)===`zh`,v=n.kind===`project`?`w-[min(55rem,calc(100vw-2rem))]`:`w-[min(52rem,calc(100vw-2rem))]`,y=n.kind===`automation`&&n.view===`run`?_?`运行情况`:`Run progress`:E[n.kind][+!_],b;t[0]===i?b=t[1]:(b=e=>{e||i()},t[0]=i,t[1]=b);let x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,w.jsx)(s,{className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`}),t[2]=x):x=t[2];let O=`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(48rem,calc(100dvh-2rem))] ${v} -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay focus:outline-none`,k;t[3]===y?k=t[4]:(k=(0,w.jsx)(f,{className:`min-w-0 flex-1 truncate font-medium text-fg`,children:y}),t[3]=y,t[4]=k);let A=_?`查看关联内容,或打开独立页面。`:`Preview related content or open its full page.`,j;t[5]===A?j=t[6]:(j=(0,w.jsx)(c,{className:`sr-only`,children:A}),t[5]=A,t[6]=j);let N;t[7]!==r||t[8]!==n.href||t[9]!==n.view||t[10]!==_?(N=n.view!==`run`&&(0,w.jsxs)(a,{to:h(n.href,r),className:`flex shrink-0 items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm text-accent hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,w.jsx)(m,{className:`size-4`,"aria-hidden":!0}),_?`打开独立页面`:`Open full page`]}),t[7]=r,t[8]=n.href,t[9]=n.view,t[10]=_,t[11]=N):N=t[11];let P=_?`关闭预览`:`Close preview`,F=_?`关闭预览`:`Close preview`,I;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,w.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[12]=I):I=t[12];let L;t[13]!==P||t[14]!==F?(L=(0,w.jsx)(l,{title:P,"aria-label":F,className:`flex size-8 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:I}),t[13]=P,t[14]=F,t[15]=L):L=t[15];let R;t[16]!==L||t[17]!==k||t[18]!==j||t[19]!==N?(R=(0,w.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-edge bg-surface-panel px-5 py-3.5`,children:[k,j,N,L]}),t[16]=L,t[17]=k,t[18]=j,t[19]=N,t[20]=R):R=t[20];let z=`min-h-0 flex-1 overflow-y-auto overscroll-contain p-5 ${n.kind===`project`?`sm:p-6`:`sm:p-8`}`,B;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,w.jsx)(D,{}),t[21]=B):B=t[21];let V;t[22]===n?V=t[23]:(V=(0,w.jsx)(C.Suspense,{fallback:B,children:(0,w.jsx)(T,{target:n},n.href)}),t[22]=n,t[23]=V);let H;t[24]!==z||t[25]!==V?(H=(0,w.jsx)(`div`,{className:z,children:V}),t[24]=z,t[25]=V,t[26]=H):H=t[26];let U;t[27]!==R||t[28]!==H||t[29]!==O?(U=(0,w.jsxs)(u,{children:[x,(0,w.jsxs)(d,{className:O,children:[R,H]})]}),t[27]=R,t[28]=H,t[29]=O,t[30]=U):U=t[30];let W;return t[31]!==b||t[32]!==U?(W=(0,w.jsx)(p,{open:!0,onOpenChange:b,children:U}),t[31]=b,t[32]=U,t[33]=W):W=t[33],W}function M(e){return e.language}export{D as n,O as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/product-preview-content-WkF2j_c-.js","assets/vendor-react-BOUWij0V.js","assets/rolldown-runtime-aKtaBQYM.js","assets/chunk-KS7C4IRE-CiwuuyV8.js","assets/preload-helper-Czpn1I53.js","assets/locale-store-Dy1EByeG.js","assets/messages-BAnhwALN.js","assets/automation-display-DaVDNZz8.js","assets/createLucideIcon-DPHK1VkS.js","assets/markdown-view-BlxIaCCQ.js","assets/dist-CY7CS_D3.js","assets/es2015-DBLcMg5B.js","assets/dist-CxGUk8J-.js","assets/download-Dk-ZjtO6.js","assets/file-image-CDUPkZvG.js","assets/plus-Q2yW6OE7.js","assets/x-B_N4OPjy.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/app-link-DImAfVs5.js","assets/product-delivery-BFfqdKLe.js","assets/schemas-CCWMleym.js","assets/local-apps-DeqzkJiF.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/xml-_d7dTN2Q.js","assets/mermaid-render-oOellPHt.js","assets/markdown-view-DG8DDkEA.css","assets/skeleton-DzdOeGYz.js","assets/api-B4FJ51EC.js","assets/tasks-BTLabOMp.js","assets/specialists-xbB3xL9e.js","assets/files-BNL4kkSB.js","assets/vendor-swr-CdRzEUwF.js","assets/button-Cc4hUNTt.js","assets/automation-api-DxBmyzp0.js","assets/automation-task-card-CiJmJ7_h.js","assets/chevron-down-ccbiQQz_.js","assets/chevron-right-BweFrslA.js","assets/popover-select-CLsphyzA.js","assets/check-DUBLcKHA.js","assets/dist-GJ8-1PAx.js","assets/dist-BuHnPloF.js","assets/floating-ui.dom-seOukHzT.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/message-circle-Badhj-4D.js","assets/pencil-DmIY3Oa-.js","assets/chat-agents-api-CjlzCSmC.js","assets/gateway-config-swr-1Rk0LeEM.js","assets/model-selector-C-CqPBao.js","assets/settings-2-D-csvaET.js","assets/registry-api-DuDIthjL.js","assets/gateway-startup-retry-D6WPS0RW.js","assets/open-capability-settings-DQsmJxI7.js","assets/interaction-BdhHBbYa.js","assets/form-field-width-DJw_jULe.js","assets/model-sort-_Tz8s_4N.js","assets/date-picker-XnE3iFhG.js","assets/calendar-days-hw_Y-g-s.js","assets/chevron-left-DqFhpbvK.js","assets/time-picker-C1PXAXZF.js","assets/clock-3-DnrAnuyZ.js","assets/api-B1J5ajiP.js","assets/open-route-MyZ2sB9C.js","assets/automation-result-state-CAsqgMNR.js","assets/project-overview-model-DrLXaO-t.js"])))=>i.map(i=>d[i]);
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{t as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{n as o}from"./locale-store-Dy1EByeG.js";import{a as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./dist-CY7CS_D3.js";import{t as m}from"./external-link-DjqjBmc3.js";import{V as h}from"./markdown-view-BlxIaCCQ.js";import{t as g}from"./x-B_N4OPjy.js";import{t as _}from"./skeleton-DzdOeGYz.js";import{i as v}from"./vendor-swr-CdRzEUwF.js";import{t as y}from"./button-Cc4hUNTt.js";import{t as b}from"./automation-api-DxBmyzp0.js";import{r as x}from"./automation-task-card-CiJmJ7_h.js";var S=n(),C=e(t(),1),w=r(),T=(0,C.lazy)(()=>i(()=>import(`./product-preview-content-WkF2j_c-.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64]))),E={project:[`项目预览`,`Project preview`],automation:[`自动化详情`,`Automation details`],local_app:[`应用预览`,`App preview`]};function D(){let e=(0,S.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,w.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,w.jsx)(_,{className:`h-7 w-2/3`}),(0,w.jsx)(_,{className:`h-4 w-full`}),(0,w.jsx)(_,{className:`h-4 w-4/5`}),(0,w.jsx)(_,{className:`h-32 w-full`})]}),e[0]=t):t=e[0],t}function O(e){let t=(0,S.c)(8),{target:n,backgroundPath:r,onClose:i}=e;if(n.kind===`automation`&&n.view!==`run`){let e;return t[0]!==r||t[1]!==i||t[2]!==n?(e=(0,w.jsx)(k,{target:n,backgroundPath:r,onClose:i}),t[0]=r,t[1]=i,t[2]=n,t[3]=e):e=t[3],e}let a;return t[4]!==r||t[5]!==i||t[6]!==n?(a=(0,w.jsx)(j,{target:n,backgroundPath:r,onClose:i}),t[4]=r,t[5]=i,t[6]=n,t[7]=a):a=t[7],a}function k(e){let t=(0,S.c)(34),{target:n,backgroundPath:r,onClose:i}=e,a=o(A),l,m;t[0]===n.id?(l=t[1],m=t[2]):(l=[`automation-card`,n.id],m=()=>b.get(n.id),t[0]=n.id,t[1]=l,t[2]=m);let h;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1,shouldRetryOnError:!1},t[3]=h):h=t[3];let{data:g,error:_,mutate:C}=v(l,m,h);if(g?.automation){if(g.automation.action.kind===`agent`&&!g.automation.management){let e;return t[4]!==g.automation||t[5]!==a||t[6]!==i?(e=(0,w.jsx)(x,{automation:g.automation,language:a,onClose:i}),t[4]=g.automation,t[5]=a,t[6]=i,t[7]=e):e=t[7],e}let e;return t[8]!==r||t[9]!==i||t[10]!==n?(e=(0,w.jsx)(j,{target:n,backgroundPath:r,onClose:i}),t[8]=r,t[9]=i,t[10]=n,t[11]=e):e=t[11],e}let T=a===`zh`,E;t[12]===i?E=t[13]:(E=e=>{e||i()},t[12]=i,t[13]=E);let O;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,w.jsx)(s,{className:`fixed inset-0 z-65 bg-scrim`}),t[14]=O):O=t[14];let k=T?`定时任务详情`:`Scheduled task details`,M;t[15]===k?M=t[16]:(M=(0,w.jsx)(f,{className:`mb-5 font-medium`,children:k}),t[15]=k,t[16]=M);let N=T?`查看和编辑定时任务。`:`View and edit the scheduled task.`,P;t[17]===N?P=t[18]:(P=(0,w.jsx)(c,{className:`sr-only`,children:N}),t[17]=N,t[18]=P);let F;t[19]!==_||t[20]!==C||t[21]!==T?(F=_?(0,w.jsxs)(`div`,{role:`alert`,className:`text-sm text-fg-muted`,children:[(0,w.jsx)(`p`,{children:T?`任务已不存在或暂时无法读取。`:`This task is unavailable.`}),(0,w.jsx)(y,{variant:`secondary`,onClick:()=>void C(),children:T?`重试`:`Retry`})]}):(0,w.jsx)(D,{}),t[19]=_,t[20]=C,t[21]=T,t[22]=F):F=t[22];let I=T?`关闭`:`Close`,L;t[23]!==i||t[24]!==I?(L=(0,w.jsx)(y,{className:`mt-auto self-end`,variant:`ghost`,onClick:i,children:I}),t[23]=i,t[24]=I,t[25]=L):L=t[25];let R;t[26]!==F||t[27]!==L||t[28]!==M||t[29]!==P?(R=(0,w.jsxs)(u,{children:[O,(0,w.jsxs)(d,{className:`fixed left-1/2 top-1/2 z-70 flex h-[min(600px,calc(100dvh-2rem))] w-[min(680px,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay p-5`,children:[M,P,F,L]})]}),t[26]=F,t[27]=L,t[28]=M,t[29]=P,t[30]=R):R=t[30];let z;return t[31]!==R||t[32]!==E?(z=(0,w.jsx)(p,{open:!0,onOpenChange:E,children:R}),t[31]=R,t[32]=E,t[33]=z):z=t[33],z}function A(e){return e.language}function j(e){let t=(0,S.c)(34),{target:n,backgroundPath:r,onClose:i}=e,_=o(M)===`zh`,v=n.kind===`project`?`w-[min(55rem,calc(100vw-2rem))]`:`w-[min(52rem,calc(100vw-2rem))]`,y=n.kind===`automation`&&n.view===`run`?_?`运行情况`:`Run progress`:E[n.kind][+!_],b;t[0]===i?b=t[1]:(b=e=>{e||i()},t[0]=i,t[1]=b);let x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,w.jsx)(s,{className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`}),t[2]=x):x=t[2];let O=`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(48rem,calc(100dvh-2rem))] ${v} -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay focus:outline-none`,k;t[3]===y?k=t[4]:(k=(0,w.jsx)(f,{className:`min-w-0 flex-1 truncate font-medium text-fg`,children:y}),t[3]=y,t[4]=k);let A=_?`查看关联内容,或打开独立页面。`:`Preview related content or open its full page.`,j;t[5]===A?j=t[6]:(j=(0,w.jsx)(c,{className:`sr-only`,children:A}),t[5]=A,t[6]=j);let N;t[7]!==r||t[8]!==n.href||t[9]!==n.view||t[10]!==_?(N=n.view!==`run`&&(0,w.jsxs)(a,{to:h(n.href,r),className:`flex shrink-0 items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm text-accent hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,w.jsx)(m,{className:`size-4`,"aria-hidden":!0}),_?`打开独立页面`:`Open full page`]}),t[7]=r,t[8]=n.href,t[9]=n.view,t[10]=_,t[11]=N):N=t[11];let P=_?`关闭预览`:`Close preview`,F=_?`关闭预览`:`Close preview`,I;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,w.jsx)(g,{className:`size-4`,"aria-hidden":!0}),t[12]=I):I=t[12];let L;t[13]!==P||t[14]!==F?(L=(0,w.jsx)(l,{title:P,"aria-label":F,className:`flex size-8 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,children:I}),t[13]=P,t[14]=F,t[15]=L):L=t[15];let R;t[16]!==L||t[17]!==k||t[18]!==j||t[19]!==N?(R=(0,w.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-edge bg-surface-panel px-5 py-3.5`,children:[k,j,N,L]}),t[16]=L,t[17]=k,t[18]=j,t[19]=N,t[20]=R):R=t[20];let z=`min-h-0 flex-1 overflow-y-auto overscroll-contain p-5 ${n.kind===`project`?`sm:p-6`:`sm:p-8`}`,B;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,w.jsx)(D,{}),t[21]=B):B=t[21];let V;t[22]===n?V=t[23]:(V=(0,w.jsx)(C.Suspense,{fallback:B,children:(0,w.jsx)(T,{target:n},n.href)}),t[22]=n,t[23]=V);let H;t[24]!==z||t[25]!==V?(H=(0,w.jsx)(`div`,{className:z,children:V}),t[24]=z,t[25]=V,t[26]=H):H=t[26];let U;t[27]!==R||t[28]!==H||t[29]!==O?(U=(0,w.jsxs)(u,{children:[x,(0,w.jsxs)(d,{className:O,children:[R,H]})]}),t[27]=R,t[28]=H,t[29]=O,t[30]=U):U=t[30];let W;return t[31]!==b||t[32]!==U?(W=(0,w.jsx)(p,{open:!0,onOpenChange:b,children:U}),t[31]=b,t[32]=U,t[33]=W):W=t[33],W}function M(e){return e.language}export{D as n,O as t};