@xopcai/xopc 0.0.472 → 0.0.473
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/discord/src/index.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{automations-page-36Dx_eLZ.js → automations-page-BoYv4mr2.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-BY3P8w5G.js → automations-workspace-DdHpajzk.js} +2 -2
- package/dist/gateway/static/root/assets/{chat-page-D_8adelp.js → chat-page-4Agzfc_0.js} +2 -2
- package/dist/gateway/static/root/assets/{index-Jbmr3G0d.js → index-Ek2aSUt6.js} +5 -5
- package/dist/gateway/static/root/assets/{note-detail-panel-DFR9Fc16.js → note-detail-panel-C8o-hv5U.js} +2 -2
- package/dist/gateway/static/root/assets/{notes-page-Y6jTwZhu.js → notes-page-VWv-Q26S.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-CNAaIQe_.js → personal-page-CweKnHPY.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-CdIhsx42.js → project-detail-page-CR9prGyI.js} +1 -1
- package/dist/gateway/static/root/assets/{route-preload-DAyaQF0B.js → route-preload-D3c2DaKJ.js} +2 -2
- package/dist/gateway/static/root/assets/{settings-page-C2DiHQf_.js → settings-page-De1H4SjW.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-DE3BWEBP.js → task-detail-page-DqVRV32Y.js} +2 -2
- package/dist/gateway/static/root/assets/task-header-title-D3zA4Ho1.js +1 -0
- package/dist/gateway/static/root/assets/{use-personal-work-CwZNBF3F.js → use-personal-work-BJ1yKsau.js} +1 -1
- package/dist/gateway/static/root/index.html +5 -5
- package/dist/package.js +1 -1
- package/dist/src/agent/context/connection-objective-context.js +5 -1
- package/dist/src/agent/tools/factory.js +1 -1
- package/dist/src/agent/tools/personal-request-tool.d.ts +24 -1
- package/dist/src/agent/tools/personal-request-tool.js +180 -261
- package/dist/src/agent/tools/personal-task-tool.d.ts +8 -0
- package/dist/src/agent/tools/personal-task-tool.js +108 -46
- package/dist/src/channels/enterprise/plugin.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +52 -17
- package/dist/src/cli/commands/doctor/checks/tool-runtimes.js +12 -1
- package/dist/src/cli/commands/doctor/flow.js +11 -6
- package/dist/src/cli/index.js +8 -2
- package/dist/src/connectors/connection-candidates.d.ts +1 -0
- package/dist/src/connectors/connection-candidates.js +20 -1
- package/dist/src/gateway/hono/routes/home.js +1 -1
- package/dist/src/gateway/service.js +4 -4
- package/dist/src/home-intelligence/host.js +5 -5
- package/dist/src/personal-agent/prompts.js +29 -6
- package/dist/src/personal-agent/request-repository.d.ts +4 -0
- package/dist/src/personal-agent/request-repository.js +17 -1
- package/dist/src/tasks/task-context-assembler.js +5 -2
- package/dist/src/tasks/task-deliverables.js +73 -38
- package/dist/src/tasks/task-main-update-delivery.js +1 -1
- package/dist/src/tasks/task-origin-repository.d.ts +2 -0
- package/dist/src/tasks/task-origin-repository.js +15 -6
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/task-header-title-BTCuRQKx.js +0 -1
package/dist/gateway/static/root/assets/{personal-page-CNAaIQe_.js → personal-page-CweKnHPY.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{l as r,t as i,u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as o,n as s,o as c}from"./locale-store-Cit_aHqC.js";import{t as l}from"./messages-DQveK9sk.js";import{t as u}from"./chat-page-D_8adelp.js";import{t as d}from"./arrow-left-D880xG-P.js";import{t as f}from"./arrow-right-DSSvoX71.js";import{t as p}from"./check-DUBLcKHA.js";import{n as m,s as ee,t as te}from"./install-connector-dialog-BZjodnUC.js";import{c as h,o as g,s as _}from"./use-personal-work-CwZNBF3F.js";import{t as ne}from"./play-kxZvpBg8.js";import{t as v}from"./settings-2-D-csvaET.js";import{t as re}from"./upload-rrb46c3c.js";import{t as y}from"./x-B_N4OPjy.js";import{t as b}from"./skeleton-DzdOeGYz.js";import{r as x}from"./right-workspace-store-NXMrEuwH.js";import{a as S,i as C,o as w,r as T,t as E}from"./dist-GJ8-1PAx.js";import{a as D,r as ie}from"./connectors-api-BUdH4tZQ.js";import{u as ae}from"./use-realtime-voice-D5-XzM7H.js";import{n as O}from"./voice-call-context-BM2A4bLz.js";import{t as k}from"./page-header-store-1-lflHAx.js";import{s as A}from"./agent-avatar-display-CIsejg_E.js";import{t as j}from"./personal-avatar-CM3vUGhL.js";import{d as M,i as N,r as P}from"./voice-config-api-BLGbUq3v.js";import{t as oe}from"./personal-profile-settings-OoFMAniP.js";var F=e(t(),1),I=n(),L=[`intro`,`identity`,`voice`,`connections`],se=[{id:`loopi`,zh:`Loopi`,en:`Loopi`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`},{id:`loopi-care`,zh:`温和`,en:`Gentle`}];function ce(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}async function R(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 c(o(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:n.slice(n.indexOf(`,`)+1),mimeType:t.type})}),A(e)}function z({modelsAvailable:e,onCreated:t}){let n=s(e=>e.language)===`zh`,r=s(e=>e.language),[a,u]=(0,F.useState)(`intro`),[h,g]=(0,F.useState)({displayName:`Ada`,appearance:`loopi`,voice:null}),[_,v]=(0,F.useState)(!1),[y,x]=(0,F.useState)(!1),[S,C]=(0,F.useState)(null),[w,T]=(0,F.useState)(null),[E,O]=(0,F.useState)(null),[k,A]=(0,F.useState)(null),[oe,z]=(0,F.useState)(!0),[B,V]=(0,F.useState)([]),[H,U]=(0,F.useState)(null),W=(0,F.useRef)(null),G=(0,F.useRef)(null),[K,le]=(0,F.useState)([]),[q,J]=(0,F.useState)(!0),[Y,X]=(0,F.useState)([]),[Z,Q]=(0,F.useState)(null);(0,F.useEffect)(()=>{let e=!1;return c(o(`/api/personal-agent/onboarding`)).then(t=>{e||(u(t.payload.step),g(t.payload.draft))}).catch(t=>{e||C(t instanceof Error?t.message:String(t))}).finally(()=>{e||v(!0)}),()=>{e=!0}},[]),(0,F.useEffect)(()=>{if(!_)return;let e=window.setTimeout(()=>{c(o(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:a,draft:h})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[h,_,a]),(0,F.useEffect)(()=>{let e=!1;return P().then(t=>{e||(t.tts&&t.enabled?A({provider:t.tts.provider,model:t.tts.model,enabled:!0}):z(!1))}).catch(()=>{e||z(!1)}),()=>{e=!0}},[]),(0,F.useEffect)(()=>{if(!k?.enabled)return;let e=!1;return N(k.provider,k.model,`realtime`).then(t=>{e||V(t.slice(0,12))}).catch(()=>{}).finally(()=>{e||z(!1)}),()=>{e=!0}},[k]),(0,F.useEffect)(()=>{if(a!==`connections`)return;let e=!1;return J(!0),Promise.allSettled([ie({page:1,pageSize:24,verification:`verified`}),D()]).then(([t,n])=>{if(!e){if(t.status===`fulfilled`){let e=[`gmail`,`googlecalendar`,`googledrive`,`github`,`linear`];le(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`&&X(n.value),J(!1)}}),()=>{e=!0}},[a]),(0,F.useEffect)(()=>()=>{G.current?.abort(),W.current?.close()},[]),(0,F.useEffect)(()=>()=>{E&&URL.revokeObjectURL(E)},[E]);let ue=async(e,t=h)=>{await c(o(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:e,draft:t})}),u(e)},de=async e=>{C(null);let t=L[Math.max(0,Math.min(L.length-1,L.indexOf(a)+e))];try{await ue(t)}catch(e){C(e instanceof Error?e.message:String(e))}},fe=async(n=!1)=>{if(!(!e||y)){x(!0),C(null);try{let e=n?{displayName:`Ada`,appearance:`loopi`,voice:null}:h,r=e.voice&&k?.enabled&&B.some(t=>t.id===e.voice)?{provider:k.provider,model:k.model,voice:e.voice}:void 0,i=(await c(o(`/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 R(i.agentId,w),i=(await c(o(`/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{x(!1)}}},pe=(0,F.useCallback)(async e=>{G.current?.abort(),W.current?.close();let t=new AbortController;G.current=t,U(e),C(null);try{let n=new ae;W.current=n,await n.start();let r=await M(t.signal,e);if(t.signal.aborted)return;n.enqueue(r,()=>U(null))}catch(e){t.signal.aborted||C(e instanceof Error?e.message:String(e)),U(null)}},[]);if(!_)return(0,I.jsxs)(`div`,{className:`mx-auto w-full max-w-xl space-y-4 px-6 py-14`,children:[(0,I.jsx)(b,{className:`h-10 w-2/3`}),(0,I.jsx)(b,{className:`h-64 w-full rounded-2xl`}),(0,I.jsx)(b,{className:`h-12 w-full rounded-xl`})]});let $=L.indexOf(a),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?`}[a];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:y,onClick:()=>void de(-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)(d,{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)(i,{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:h.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:h.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}),a===`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.`})]}),a===`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:h.displayName,maxLength:60,onChange:e=>g(t=>({...t,displayName:e.target.value})),onBlur:()=>g(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:[se.map(e=>(0,I.jsxs)(`button`,{type:`button`,"aria-pressed":!w&&h.appearance===e.id,onClick:()=>{T(null),O(null),g(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&&h.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)(re,{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),O(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.`})]})]}),a===`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.`}),oe?(0,I.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,I.jsx)(b,{className:`h-20 rounded-xl`}),(0,I.jsx)(b,{className:`h-20 rounded-xl`})]}):k?.enabled&&B.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":!h.voice,onClick:()=>g(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 ${h.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`}),B.map(e=>(0,I.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl p-3 transition-colors ${h.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":h.voice===e.id,onClick:()=>g(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)(ne,{className:`size-4 ${H===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)(i,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),a===`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.`}),q?(0,I.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,I.jsx)(b,{className:`h-18 rounded-xl`}),(0,I.jsx)(b,{className:`h-18 rounded-xl`})]}):(0,I.jsx)(`div`,{className:`mt-5 space-y-2`,children:K.length?K.map(e=>{let t=ce(Y.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)(m,{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)(p,{className:`size-4`}),n?`已连接`:`Connected`]}):(0,I.jsx)(`button`,{type:`button`,onClick:()=>Q(ee(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)(i,{to:`/settings/capabilities/models`,className:`text-accent underline`,children:n?`配置模型`:`Set up a model`})]}),S&&(0,I.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:S})]},a)}),(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:[a===`intro`&&(0,I.jsx)(`button`,{type:`button`,disabled:!e||y,onClick:()=>void fe(!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`}),a===`voice`&&(0,I.jsx)(`button`,{type:`button`,onClick:()=>{let e={...h,voice:null};g(e),C(null),ue(`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:y||a===`connections`&&!e,onClick:()=>a===`connections`?void fe():void de(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:[y?n?`正在创建…`:`Creating…`:a===`connections`?n?`进入对话`:`Start chatting`:n?`继续`:`Continue`,` `,!y&&(0,I.jsx)(f,{className:`size-4`})]})]})]})}),Z&&(0,I.jsx)(te,{draft:Z,onChange:Q,onClose:()=>Q(null),t:l(r).connectorsSettings,onInstalled:async()=>{X(await D()),Q(null)}})]})}function B(){let e=a(),t=r(),n=O(),i=(0,F.useRef)(n);i.current=n;let l=s(e=>e.language)===`zh`,d=k(e=>e.setPageHeader),f=k(e=>e.clearPageHeader),[p,m]=(0,F.useState)(null),[ee,te]=(0,F.useState)([]),[ne,re]=(0,F.useState)(!0),[D,ie]=(0,F.useState)(null),[ae,A]=(0,F.useState)(!1),[M,N]=(0,F.useState)(!1),P=(0,F.useRef)(null),L=(0,F.useRef)(null),[se,ce]=(0,F.useState)(null),R=(0,F.useCallback)(e=>{L.current=e,ce(e?.closest(`[data-app-chat-shell]`)??null)},[]),B=(0,F.useRef)(null),V=(0,F.useRef)(null),H=p?.state===`ready`?p.conversationId:void 0,U=x(e=>{let t=H?e.panes[H]:void 0,n=t?.tabs.find(e=>e.id===t.activeId);return t?.open===!0&&(t.activeId===`personal-tasks`||t.personalDetailsOpen===!0&&(n?.kind===`file`||n?.kind===`browser`))}),{avatarState:W,summary:G,refreshWork:K,refreshPrompt:le}=g(H,l);_(H,K,le);let q=(0,F.useCallback)(()=>e(`/settings/personal`,{state:{settingsBackPath:`${t.pathname}${t.search}${t.hash}`}}),[t.pathname,t.search,t.hash,e]),J=(0,F.useCallback)(e=>{V.current=e,i.current.setMiniAnchor(e)},[]),Y=(0,F.useCallback)(()=>{H&&U&&x.getState().closePersonalTasks(H)},[H,U]),X=(0,F.useCallback)(()=>{i.current.minimize(),N(e=>!e)},[]),Z=(0,F.useCallback)(()=>{H&&(i.current.minimize(),N(!1),U?Y():x.getState().openPersonalTasks(H))},[Y,H,U]);(0,F.useEffect)(()=>{n.expanded&&N(!1)},[n.expanded]),(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 Q=(0,F.useCallback)(async()=>{try{let[e,t]=await Promise.all([c(o(`/api/personal-agent`)),c(o(`/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`)),te(t.payload)}catch(e){ie(e instanceof Error?e.message:String(e))}finally{re(!1)}},[]);return(0,F.useEffect)(()=>{Q()},[Q]),(0,F.useLayoutEffect)(()=>{let e=p?.state===`ready`,t=l?`语音通话`:`Voice call`,r=`touch-target inline-flex min-h-10 shrink-0 items-center justify-center gap-2 rounded-full bg-surface-hover/90 px-3.5 text-sm font-medium text-fg transition-colors hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent aria-expanded:bg-surface-active`,a=()=>{if(N(!1),!e)return;if(i.current.expanded){i.current.minimize();return}let t=L.current;i.current.open({conversationId:p.conversationId,name:p.displayName},t?{anchor:t,avatar:(0,I.jsx)(j,{appearance:p.appearance,agentId:p.agentId,className:`size-full`})}:void 0)},o=e?p.appearance:`loopi`,s=e?p.displayName:`Ada`;return d({startExtra:null,personalChat:e?U?`controls`:`identity`:void 0,main:(0,I.jsxs)(`div`,{className:`flex min-w-0 justify-center`,children:[(0,I.jsx)(`h1`,{className:`sr-only`,children:s}),U?null:e?(0,I.jsxs)(`button`,{ref:B,type:`button`,"data-personal-tasks-trigger":!0,"aria-controls":`app-workspace-panel`,"aria-expanded":U,"aria-describedby":G?`personal-work-status`:void 0,"aria-label":l?`${s} 的任务`:`${s}'s tasks`,title:G||s,onClick:Z,className:`group/identity flex min-w-0 max-w-full flex-col items-center gap-1 rounded-2xl px-1.5 pb-0.5 text-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:gap-1.5`,children:[(0,I.jsx)(`span`,{className:`relative grid size-16 shrink-0 place-items-center rounded-full border border-edge-subtle bg-surface-base transition-colors group-hover/identity:border-edge sm:size-20 @max-[26rem]/personal-chat:size-14`,children:(0,I.jsx)(j,{appearance:o,agentId:p.agentId,activity:W,className:`size-full`})}),(0,I.jsxs)(`span`,{className:`personal-identity-label max-w-full min-w-0 rounded-2xl px-3 py-1`,children:[(0,I.jsx)(`span`,{className:`block truncate text-[0.9375rem] leading-5 font-semibold text-fg sm:text-base`,children:s}),G?(0,I.jsxs)(`span`,{id:`personal-work-status`,role:`status`,className:`flex min-w-0 items-center justify-center gap-1.5 text-xs leading-4 text-fg-muted`,children:[W===`idle`?null:(0,I.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full ${W===`waiting`?`bg-warning`:`bg-accent`}`,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`truncate`,children:G})]}):null]})]}):(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(j,{appearance:o,className:`size-8`}),(0,I.jsx)(`span`,{className:`text-sm font-semibold`,children:s})]})]}),end:e?(0,I.jsxs)(`div`,{ref:R,className:`flex items-center gap-1.5 sm:gap-2`,children:[(0,I.jsxs)(`button`,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":n.expanded,onClick:a,className:r,"aria-label":t,title:t,children:[(0,I.jsx)(h,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`hidden @min-[32rem]/personal-header:inline`,children:l?`通话`:`Call`})]}),(0,I.jsxs)(`button`,{ref:P,type:`button`,onClick:X,"aria-haspopup":`dialog`,"aria-expanded":M,className:r,"aria-label":l?`${s} 设置`:`${s} settings`,children:[(0,I.jsx)(v,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`hidden @min-[32rem]/personal-header:inline`,children:l?`设置`:`Settings`})]})]}):null}),()=>f()},[W,f,p,R,d,M,G,U,X,Z,n.expanded,l]),ne?(0,I.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,I.jsx)(b,{className:`h-20 w-20 rounded-full`}),(0,I.jsx)(b,{className:`h-9 w-72`}),(0,I.jsx)(b,{className:`h-44 w-full rounded-2xl`})]}):D&&!p?(0,I.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-6 text-sm text-danger`,children:[(0,I.jsx)(`p`,{children:D}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>void Q(),className:`text-accent hover:underline`,children:l?`重试`:`Retry`})]}):p?.state===`ready`?(0,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[ae&&(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:l?`助手已创建,头像上传未完成。可在资料设置中重新上传。`:`Your assistant is ready. Upload the avatar again in profile settings.`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>{A(!1),q()},className:`shrink-0 text-accent hover:underline`,children:l?`打开设置`:`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)(u,{embedded:!0,personal:!0,personalWelcome:{name:p.displayName,addressAs:p.userCallName??void 0,opening:l?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`},conversationId:p.conversationId})})}),(0,I.jsxs)(w,{open:M,onOpenChange:N,children:[(0,I.jsx)(E,{virtualRef:L}),(0,I.jsx)(S,{children:(0,I.jsxs)(C,{ref:J,side:`bottom`,align:`end`,sideOffset:12,collisionPadding:12,collisionBoundary:se??void 0,"aria-label":l?`${p.displayName} 快捷设置`:`${p.displayName} quick settings`,onInteractOutside:e=>{e.target instanceof Node&&(P.current?.contains(e.target)||B.current?.contains(e.target)||V.current?.contains(e.target)||e.target instanceof Element&&e.target.closest(`[data-voice-call-mini]`))&&e.preventDefault()},className:`xopc-session-context-popover data-[state=closed]:pointer-events-none z-50 flex h-[min(34rem,calc(100dvh-6rem))] ${n.active?`max-h-[min(var(--radix-popover-content-available-height),calc(100dvh-12rem))]`:`max-h-[var(--radix-popover-content-available-height)]`} min-h-0 w-[min(27rem,calc(100vw-1.5rem))] max-w-[var(--radix-popover-content-available-width)] flex-col overflow-hidden rounded-[1.75rem] border border-edge-subtle bg-surface-overlay shadow-float outline-none`,children:[(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 px-5 pb-2 pt-4`,children:[(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:l?`快捷设置`:`Quick settings`}),(0,I.jsx)(T,{className:`touch-target -mr-2 rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":l?`关闭设置`:`Close settings`,children:(0,I.jsx)(y,{className:`size-4`})})]}),(0,I.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 pb-4 pt-2`,children:(0,I.jsx)(oe,{zh:l,onOpenVoiceServices:q})}),(0,I.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,I.jsx)(`button`,{type:`button`,onClick:q,className:`w-full rounded-full bg-surface-hover px-4 py-2.5 text-center text-sm font-medium text-fg hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:l?`更多设置`:`More settings`})})]})})]})]}):(0,I.jsx)(z,{modelsAvailable:ee.length>0,onCreated:(e,t)=>{m(e),A(t),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e})),window.dispatchEvent(new Event(`session-updated`))}})}export{B as PersonalPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{l as r,t as i,u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as o,n as s,o as c}from"./locale-store-Cit_aHqC.js";import{t as l}from"./messages-DQveK9sk.js";import{t as u}from"./chat-page-4Agzfc_0.js";import{t as d}from"./arrow-left-D880xG-P.js";import{t as f}from"./arrow-right-DSSvoX71.js";import{t as p}from"./check-DUBLcKHA.js";import{n as m,s as ee,t as te}from"./install-connector-dialog-BZjodnUC.js";import{c as h,o as g,s as _}from"./use-personal-work-BJ1yKsau.js";import{t as ne}from"./play-kxZvpBg8.js";import{t as v}from"./settings-2-D-csvaET.js";import{t as re}from"./upload-rrb46c3c.js";import{t as y}from"./x-B_N4OPjy.js";import{t as b}from"./skeleton-DzdOeGYz.js";import{r as x}from"./right-workspace-store-NXMrEuwH.js";import{a as S,i as C,o as w,r as T,t as E}from"./dist-GJ8-1PAx.js";import{a as D,r as ie}from"./connectors-api-BUdH4tZQ.js";import{u as ae}from"./use-realtime-voice-D5-XzM7H.js";import{n as O}from"./voice-call-context-BM2A4bLz.js";import{t as k}from"./page-header-store-1-lflHAx.js";import{s as A}from"./agent-avatar-display-CIsejg_E.js";import{t as j}from"./personal-avatar-CM3vUGhL.js";import{d as M,i as N,r as P}from"./voice-config-api-BLGbUq3v.js";import{t as oe}from"./personal-profile-settings-OoFMAniP.js";var F=e(t(),1),I=n(),L=[`intro`,`identity`,`voice`,`connections`],se=[{id:`loopi`,zh:`Loopi`,en:`Loopi`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`},{id:`loopi-care`,zh:`温和`,en:`Gentle`}];function ce(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}async function R(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 c(o(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:n.slice(n.indexOf(`,`)+1),mimeType:t.type})}),A(e)}function z({modelsAvailable:e,onCreated:t}){let n=s(e=>e.language)===`zh`,r=s(e=>e.language),[a,u]=(0,F.useState)(`intro`),[h,g]=(0,F.useState)({displayName:`Ada`,appearance:`loopi`,voice:null}),[_,v]=(0,F.useState)(!1),[y,x]=(0,F.useState)(!1),[S,C]=(0,F.useState)(null),[w,T]=(0,F.useState)(null),[E,O]=(0,F.useState)(null),[k,A]=(0,F.useState)(null),[oe,z]=(0,F.useState)(!0),[B,V]=(0,F.useState)([]),[H,U]=(0,F.useState)(null),W=(0,F.useRef)(null),G=(0,F.useRef)(null),[K,le]=(0,F.useState)([]),[q,J]=(0,F.useState)(!0),[Y,X]=(0,F.useState)([]),[Z,Q]=(0,F.useState)(null);(0,F.useEffect)(()=>{let e=!1;return c(o(`/api/personal-agent/onboarding`)).then(t=>{e||(u(t.payload.step),g(t.payload.draft))}).catch(t=>{e||C(t instanceof Error?t.message:String(t))}).finally(()=>{e||v(!0)}),()=>{e=!0}},[]),(0,F.useEffect)(()=>{if(!_)return;let e=window.setTimeout(()=>{c(o(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:a,draft:h})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[h,_,a]),(0,F.useEffect)(()=>{let e=!1;return P().then(t=>{e||(t.tts&&t.enabled?A({provider:t.tts.provider,model:t.tts.model,enabled:!0}):z(!1))}).catch(()=>{e||z(!1)}),()=>{e=!0}},[]),(0,F.useEffect)(()=>{if(!k?.enabled)return;let e=!1;return N(k.provider,k.model,`realtime`).then(t=>{e||V(t.slice(0,12))}).catch(()=>{}).finally(()=>{e||z(!1)}),()=>{e=!0}},[k]),(0,F.useEffect)(()=>{if(a!==`connections`)return;let e=!1;return J(!0),Promise.allSettled([ie({page:1,pageSize:24,verification:`verified`}),D()]).then(([t,n])=>{if(!e){if(t.status===`fulfilled`){let e=[`gmail`,`googlecalendar`,`googledrive`,`github`,`linear`];le(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`&&X(n.value),J(!1)}}),()=>{e=!0}},[a]),(0,F.useEffect)(()=>()=>{G.current?.abort(),W.current?.close()},[]),(0,F.useEffect)(()=>()=>{E&&URL.revokeObjectURL(E)},[E]);let ue=async(e,t=h)=>{await c(o(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:e,draft:t})}),u(e)},de=async e=>{C(null);let t=L[Math.max(0,Math.min(L.length-1,L.indexOf(a)+e))];try{await ue(t)}catch(e){C(e instanceof Error?e.message:String(e))}},fe=async(n=!1)=>{if(!(!e||y)){x(!0),C(null);try{let e=n?{displayName:`Ada`,appearance:`loopi`,voice:null}:h,r=e.voice&&k?.enabled&&B.some(t=>t.id===e.voice)?{provider:k.provider,model:k.model,voice:e.voice}:void 0,i=(await c(o(`/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 R(i.agentId,w),i=(await c(o(`/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{x(!1)}}},pe=(0,F.useCallback)(async e=>{G.current?.abort(),W.current?.close();let t=new AbortController;G.current=t,U(e),C(null);try{let n=new ae;W.current=n,await n.start();let r=await M(t.signal,e);if(t.signal.aborted)return;n.enqueue(r,()=>U(null))}catch(e){t.signal.aborted||C(e instanceof Error?e.message:String(e)),U(null)}},[]);if(!_)return(0,I.jsxs)(`div`,{className:`mx-auto w-full max-w-xl space-y-4 px-6 py-14`,children:[(0,I.jsx)(b,{className:`h-10 w-2/3`}),(0,I.jsx)(b,{className:`h-64 w-full rounded-2xl`}),(0,I.jsx)(b,{className:`h-12 w-full rounded-xl`})]});let $=L.indexOf(a),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?`}[a];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:y,onClick:()=>void de(-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)(d,{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)(i,{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:h.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:h.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}),a===`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.`})]}),a===`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:h.displayName,maxLength:60,onChange:e=>g(t=>({...t,displayName:e.target.value})),onBlur:()=>g(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:[se.map(e=>(0,I.jsxs)(`button`,{type:`button`,"aria-pressed":!w&&h.appearance===e.id,onClick:()=>{T(null),O(null),g(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&&h.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)(re,{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),O(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.`})]})]}),a===`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.`}),oe?(0,I.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,I.jsx)(b,{className:`h-20 rounded-xl`}),(0,I.jsx)(b,{className:`h-20 rounded-xl`})]}):k?.enabled&&B.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":!h.voice,onClick:()=>g(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 ${h.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`}),B.map(e=>(0,I.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl p-3 transition-colors ${h.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":h.voice===e.id,onClick:()=>g(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)(ne,{className:`size-4 ${H===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)(i,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),a===`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.`}),q?(0,I.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,I.jsx)(b,{className:`h-18 rounded-xl`}),(0,I.jsx)(b,{className:`h-18 rounded-xl`})]}):(0,I.jsx)(`div`,{className:`mt-5 space-y-2`,children:K.length?K.map(e=>{let t=ce(Y.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)(m,{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)(p,{className:`size-4`}),n?`已连接`:`Connected`]}):(0,I.jsx)(`button`,{type:`button`,onClick:()=>Q(ee(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)(i,{to:`/settings/capabilities/models`,className:`text-accent underline`,children:n?`配置模型`:`Set up a model`})]}),S&&(0,I.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:S})]},a)}),(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:[a===`intro`&&(0,I.jsx)(`button`,{type:`button`,disabled:!e||y,onClick:()=>void fe(!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`}),a===`voice`&&(0,I.jsx)(`button`,{type:`button`,onClick:()=>{let e={...h,voice:null};g(e),C(null),ue(`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:y||a===`connections`&&!e,onClick:()=>a===`connections`?void fe():void de(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:[y?n?`正在创建…`:`Creating…`:a===`connections`?n?`进入对话`:`Start chatting`:n?`继续`:`Continue`,` `,!y&&(0,I.jsx)(f,{className:`size-4`})]})]})]})}),Z&&(0,I.jsx)(te,{draft:Z,onChange:Q,onClose:()=>Q(null),t:l(r).connectorsSettings,onInstalled:async()=>{X(await D()),Q(null)}})]})}function B(){let e=a(),t=r(),n=O(),i=(0,F.useRef)(n);i.current=n;let l=s(e=>e.language)===`zh`,d=k(e=>e.setPageHeader),f=k(e=>e.clearPageHeader),[p,m]=(0,F.useState)(null),[ee,te]=(0,F.useState)([]),[ne,re]=(0,F.useState)(!0),[D,ie]=(0,F.useState)(null),[ae,A]=(0,F.useState)(!1),[M,N]=(0,F.useState)(!1),P=(0,F.useRef)(null),L=(0,F.useRef)(null),[se,ce]=(0,F.useState)(null),R=(0,F.useCallback)(e=>{L.current=e,ce(e?.closest(`[data-app-chat-shell]`)??null)},[]),B=(0,F.useRef)(null),V=(0,F.useRef)(null),H=p?.state===`ready`?p.conversationId:void 0,U=x(e=>{let t=H?e.panes[H]:void 0,n=t?.tabs.find(e=>e.id===t.activeId);return t?.open===!0&&(t.activeId===`personal-tasks`||t.personalDetailsOpen===!0&&(n?.kind===`file`||n?.kind===`browser`))}),{avatarState:W,summary:G,refreshWork:K,refreshPrompt:le}=g(H,l);_(H,K,le);let q=(0,F.useCallback)(()=>e(`/settings/personal`,{state:{settingsBackPath:`${t.pathname}${t.search}${t.hash}`}}),[t.pathname,t.search,t.hash,e]),J=(0,F.useCallback)(e=>{V.current=e,i.current.setMiniAnchor(e)},[]),Y=(0,F.useCallback)(()=>{H&&U&&x.getState().closePersonalTasks(H)},[H,U]),X=(0,F.useCallback)(()=>{i.current.minimize(),N(e=>!e)},[]),Z=(0,F.useCallback)(()=>{H&&(i.current.minimize(),N(!1),U?Y():x.getState().openPersonalTasks(H))},[Y,H,U]);(0,F.useEffect)(()=>{n.expanded&&N(!1)},[n.expanded]),(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 Q=(0,F.useCallback)(async()=>{try{let[e,t]=await Promise.all([c(o(`/api/personal-agent`)),c(o(`/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`)),te(t.payload)}catch(e){ie(e instanceof Error?e.message:String(e))}finally{re(!1)}},[]);return(0,F.useEffect)(()=>{Q()},[Q]),(0,F.useLayoutEffect)(()=>{let e=p?.state===`ready`,t=l?`语音通话`:`Voice call`,r=`touch-target inline-flex min-h-10 shrink-0 items-center justify-center gap-2 rounded-full bg-surface-hover/90 px-3.5 text-sm font-medium text-fg transition-colors hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent aria-expanded:bg-surface-active`,a=()=>{if(N(!1),!e)return;if(i.current.expanded){i.current.minimize();return}let t=L.current;i.current.open({conversationId:p.conversationId,name:p.displayName},t?{anchor:t,avatar:(0,I.jsx)(j,{appearance:p.appearance,agentId:p.agentId,className:`size-full`})}:void 0)},o=e?p.appearance:`loopi`,s=e?p.displayName:`Ada`;return d({startExtra:null,personalChat:e?U?`controls`:`identity`:void 0,main:(0,I.jsxs)(`div`,{className:`flex min-w-0 justify-center`,children:[(0,I.jsx)(`h1`,{className:`sr-only`,children:s}),U?null:e?(0,I.jsxs)(`button`,{ref:B,type:`button`,"data-personal-tasks-trigger":!0,"aria-controls":`app-workspace-panel`,"aria-expanded":U,"aria-describedby":G?`personal-work-status`:void 0,"aria-label":l?`${s} 的任务`:`${s}'s tasks`,title:G||s,onClick:Z,className:`group/identity flex min-w-0 max-w-full flex-col items-center gap-1 rounded-2xl px-1.5 pb-0.5 text-center focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:gap-1.5`,children:[(0,I.jsx)(`span`,{className:`relative grid size-16 shrink-0 place-items-center rounded-full border border-edge-subtle bg-surface-base transition-colors group-hover/identity:border-edge sm:size-20 @max-[26rem]/personal-chat:size-14`,children:(0,I.jsx)(j,{appearance:o,agentId:p.agentId,activity:W,className:`size-full`})}),(0,I.jsxs)(`span`,{className:`personal-identity-label max-w-full min-w-0 rounded-2xl px-3 py-1`,children:[(0,I.jsx)(`span`,{className:`block truncate text-[0.9375rem] leading-5 font-semibold text-fg sm:text-base`,children:s}),G?(0,I.jsxs)(`span`,{id:`personal-work-status`,role:`status`,className:`flex min-w-0 items-center justify-center gap-1.5 text-xs leading-4 text-fg-muted`,children:[W===`idle`?null:(0,I.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full ${W===`waiting`?`bg-warning`:`bg-accent`}`,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`truncate`,children:G})]}):null]})]}):(0,I.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,I.jsx)(j,{appearance:o,className:`size-8`}),(0,I.jsx)(`span`,{className:`text-sm font-semibold`,children:s})]})]}),end:e?(0,I.jsxs)(`div`,{ref:R,className:`flex items-center gap-1.5 sm:gap-2`,children:[(0,I.jsxs)(`button`,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":n.expanded,onClick:a,className:r,"aria-label":t,title:t,children:[(0,I.jsx)(h,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`hidden @min-[32rem]/personal-header:inline`,children:l?`通话`:`Call`})]}),(0,I.jsxs)(`button`,{ref:P,type:`button`,onClick:X,"aria-haspopup":`dialog`,"aria-expanded":M,className:r,"aria-label":l?`${s} 设置`:`${s} settings`,children:[(0,I.jsx)(v,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`hidden @min-[32rem]/personal-header:inline`,children:l?`设置`:`Settings`})]})]}):null}),()=>f()},[W,f,p,R,d,M,G,U,X,Z,n.expanded,l]),ne?(0,I.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,I.jsx)(b,{className:`h-20 w-20 rounded-full`}),(0,I.jsx)(b,{className:`h-9 w-72`}),(0,I.jsx)(b,{className:`h-44 w-full rounded-2xl`})]}):D&&!p?(0,I.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-6 text-sm text-danger`,children:[(0,I.jsx)(`p`,{children:D}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>void Q(),className:`text-accent hover:underline`,children:l?`重试`:`Retry`})]}):p?.state===`ready`?(0,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[ae&&(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:l?`助手已创建,头像上传未完成。可在资料设置中重新上传。`:`Your assistant is ready. Upload the avatar again in profile settings.`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>{A(!1),q()},className:`shrink-0 text-accent hover:underline`,children:l?`打开设置`:`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)(u,{embedded:!0,personal:!0,personalWelcome:{name:p.displayName,addressAs:p.userCallName??void 0,opening:l?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`},conversationId:p.conversationId})})}),(0,I.jsxs)(w,{open:M,onOpenChange:N,children:[(0,I.jsx)(E,{virtualRef:L}),(0,I.jsx)(S,{children:(0,I.jsxs)(C,{ref:J,side:`bottom`,align:`end`,sideOffset:12,collisionPadding:12,collisionBoundary:se??void 0,"aria-label":l?`${p.displayName} 快捷设置`:`${p.displayName} quick settings`,onInteractOutside:e=>{e.target instanceof Node&&(P.current?.contains(e.target)||B.current?.contains(e.target)||V.current?.contains(e.target)||e.target instanceof Element&&e.target.closest(`[data-voice-call-mini]`))&&e.preventDefault()},className:`xopc-session-context-popover data-[state=closed]:pointer-events-none z-50 flex h-[min(34rem,calc(100dvh-6rem))] ${n.active?`max-h-[min(var(--radix-popover-content-available-height),calc(100dvh-12rem))]`:`max-h-[var(--radix-popover-content-available-height)]`} min-h-0 w-[min(27rem,calc(100vw-1.5rem))] max-w-[var(--radix-popover-content-available-width)] flex-col overflow-hidden rounded-[1.75rem] border border-edge-subtle bg-surface-overlay shadow-float outline-none`,children:[(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 px-5 pb-2 pt-4`,children:[(0,I.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:l?`快捷设置`:`Quick settings`}),(0,I.jsx)(T,{className:`touch-target -mr-2 rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":l?`关闭设置`:`Close settings`,children:(0,I.jsx)(y,{className:`size-4`})})]}),(0,I.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 pb-4 pt-2`,children:(0,I.jsx)(oe,{zh:l,onOpenVoiceServices:q})}),(0,I.jsx)(`div`,{className:`shrink-0 border-t border-edge-subtle p-3`,children:(0,I.jsx)(`button`,{type:`button`,onClick:q,className:`w-full rounded-full bg-surface-hover px-4 py-2.5 text-center text-sm font-medium text-fg hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:l?`更多设置`:`More settings`})})]})})]})]}):(0,I.jsx)(z,{modelsAvailable:ee.length>0,onCreated:(e,t)=>{m(e),A(t),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e})),window.dispatchEvent(new Event(`session-updated`))}})}export{B as PersonalPage};
|