@teammy/server 0.2.8 → 0.2.9
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/main.js +1206 -765
- package/dist/web/assets/Assistant-CkKCs2G4.js +1 -0
- package/dist/web/assets/Computers-B9wEqpMc.js +4 -0
- package/dist/web/assets/Computers-DBnXVk7q.css +1 -0
- package/dist/web/assets/Conversation-DK5-Q1RB.js +1 -0
- package/dist/web/assets/{Conversation-CNmGkVy7.css → Conversation-Dc460fhC.css} +1 -1
- package/dist/web/assets/Dashboard-B2HGjI4a.js +1 -0
- package/dist/web/assets/Dashboard-wDiUg0LB.css +1 -0
- package/dist/web/assets/Files-Du-7z96D.js +1 -0
- package/dist/web/assets/{Help-DwUoT8ZM.js → Help-G99-LK4-.js} +33 -10
- package/dist/web/assets/HtmlPreview-Bi3u6-l3.js +1 -0
- package/dist/web/assets/{Markdown-DorC2YjE.js → Markdown-BgEXVy4-.js} +4 -4
- package/dist/web/assets/MessageComposer-6eJAo_e7.js +1 -0
- package/dist/web/assets/MessageComposer-CJGxkvML.css +1 -0
- package/dist/web/assets/PillControl-BRPhbHQm.js +1 -0
- package/dist/web/assets/PillControl-CqVA7kIQ.css +1 -0
- package/dist/web/assets/ResourceLibrary-DJ9cxDoc.js +6 -0
- package/dist/web/assets/WorkspaceTree-DUFGMLRi.js +1 -0
- package/dist/web/assets/{file-links-DnngiTbC.js → file-links-Dl1S0Tt0.js} +1 -1
- package/dist/web/assets/index-C4EXuXVY.css +1 -0
- package/dist/web/assets/index-xjf37um4.js +66 -0
- package/dist/web/assets/teammy-logo-dark-GROHRRMa.svg +6 -0
- package/dist/web/assets/teammy-logo-light-B6BoNVcp.svg +6 -0
- package/dist/web/assets/teammy-y-standard-dark-C4LRaRpE.svg +6 -0
- package/dist/web/assets/teammy-y-standard-light-Bl5D78Uj.svg +6 -0
- package/dist/web/downloads/teammy-skill.zip +0 -0
- package/dist/web/index.html +9 -3
- package/package.json +1 -1
- package/dist/web/assets/Assistant-CYSa4zNi.js +0 -1
- package/dist/web/assets/Computers-4L48XuFg.js +0 -4
- package/dist/web/assets/Computers-_ugR447I.css +0 -1
- package/dist/web/assets/Conversation-BBWm5w-C.js +0 -1
- package/dist/web/assets/Dashboard-Bdh00JcC.css +0 -1
- package/dist/web/assets/Dashboard-Ck2NsAbX.js +0 -1
- package/dist/web/assets/Files-CjNjoKS3.js +0 -1
- package/dist/web/assets/HtmlPreview-B6aQIaMB.js +0 -1
- package/dist/web/assets/MessageComposer-DQBDG5yF.js +0 -1
- package/dist/web/assets/MessageComposer-DavJdQPa.css +0 -1
- package/dist/web/assets/ResourceLibrary-104NuVRn.js +0 -6
- package/dist/web/assets/WorkspaceTree-B4FMRlCw.js +0 -1
- package/dist/web/assets/index-6PvvMCD7.css +0 -1
- package/dist/web/assets/index-DiR0ePCJ.js +0 -66
- package/dist/web/assets/teammy-calm-DVuoOK0F.png +0 -0
- package/dist/web/assets/teammy-favicon-BiDvlPj2.png +0 -0
- package/dist/web/assets/teammy-mark-CxBtF1-X.png +0 -0
- package/dist/web/assets/teammy-wave-CVTgecuC.png +0 -0
- package/dist/web/assets/teammy-wordmark-ZFwxG0yl.png +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$ as e,Ct as t,Dt as n,G as r,K as i,Ot as a,Q as o,U as s,W as c,_t as l,a as ee,at as u,bt as d,c as f,et as te,gt as p,i as m,it as h,nt as ne,o as re,q as g,r as ie,s as ae,tt as _,v,vt as oe,x as se,xt as y,yt as b}from"./index-xjf37um4.js";import{t as ce}from"./Markdown-BgEXVy4-.js";import{a as le,i as ue,n as de,r as fe,t as pe}from"./Conversation-DK5-Q1RB.js";import{t as me}from"./MessageComposer-6eJAo_e7.js";var x=n(),S=_(),he=d({topics:p(d({id:y(),title:y(),summary:y(),author:y(),replies:b(),unread:l(),createdAt:y(),updatedAt:y(),delivery:d({available:l(),connected:l(),state:y(),error:y().nullable()})}))}),ge=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),C=e=>e.replace(/[#*_`>]/g,``).replace(/\s+/g,` `).trim();function w({me:n,mode:p=`messages`}){let{projectId:_,request:b}=se(),w=te(),ve=e(_,n,`${p}-selection`),T=e(_,n,`${p}-drafts`),ye=(0,x.useCallback)(e=>b(`agents/outbox`,ae,{signal:e}),[b]),E=o(ye,3e3,e(_,n,`outbox`)),be=(0,x.useCallback)(async e=>p===`messages`?b(`agents/chats`,ie,{signal:e}):{chats:(await b(`channels/topics`,he,{signal:e})).topics.map(e=>({...e,kind:`matter`,state:null}))},[b,p]),D=o(be,3e3,e(_,n,p,`chats`)),[O,xe]=(0,x.useState)(()=>{let e=new URLSearchParams(location.search),t=e.get(`chat`);return t?`chat:${t}`:e.get(`message`)??w?.get(ve)??``}),k=O.startsWith(`chat:`)?O.slice(5):``,A=!O||!!k,[j,M]=(0,x.useState)(()=>w?.get(e(_,n,`chat`,k))),N=j?.id===k?j:w?.get(e(_,n,`chat`,k)),P=D.data?.chats.find(e=>e.id===k),F=P&&`delivery`in P?P.delivery:void 0,[Se,I]=(0,x.useState)(),[L,R]=(0,x.useState)(()=>w?.get(T)??{}),Ce=L[O]??``,we=e=>R(t=>({...t,[O]:e})),[z,B]=(0,x.useState)(!1),[V,Te]=(0,x.useState)(!1),[Ee,De]=(0,x.useState)(!1),[Oe,H]=(0,x.useState)(!1),[U,ke]=(0,x.useState)(``),[Ae,je]=(0,x.useState)(``),Me=(0,x.useRef)(u()),[Ne,W]=(0,x.useState)(``),[Pe,G]=(0,x.useState)(``),K=(0,x.useRef)(new Map),Fe=(0,x.useRef)(null),q=(0,x.useRef)(!0),J=(0,x.useRef)(O);J.current=O,(0,x.useEffect)(()=>{j&&w?.set(e(_,n,`chat`,j.id),j)},[w,_,n,j]),(0,x.useEffect)(()=>{w?.set(T,L)},[w,T,L]);function Y(e){J.current=e,xe(e),w?.set(ve,e);let t=new URL(location.href);e.startsWith(`chat:`)?t.searchParams.set(`chat`,e.slice(5)):t.searchParams.delete(`chat`),e&&!e.startsWith(`chat:`)&&e!==`debug`?t.searchParams.set(`message`,e):t.searchParams.delete(`message`),history.replaceState(history.state,``,t)}(0,x.useEffect)(()=>{!O&&D.data?.chats.length&&Y(`chat:${D.data.chats[0].id}`)},[O,D.data]);let X=(E.data?.messages??[]).filter(e=>p===`messages`&&e.box===`debug`).reverse(),Z=E.data?.messages.find(e=>e.id===(O===`debug`?Se:O));(0,x.useEffect)(()=>{O!==`debug`&&Z?.conversationId&&Y(`chat:${Z.conversationId}`)},[O,Z?.conversationId]);let Q=X.filter(e=>!e.readAt).map(e=>e.id).join(`,`);(0,x.useEffect)(()=>{Z&&!Z.readAt&&O!==`debug`&&b(`agents/outbox/${Z.id}/read`,f,{method:`POST`}).then(()=>{window.dispatchEvent(new Event(`teammy:outbox`)),E.reload()}).catch(e=>W(h(e)))},[Z?.id,Z?.readAt,O,b,E.reload]),(0,x.useEffect)(()=>{O===`debug`&&Q&&Promise.all(Q.split(`,`).map(e=>b(`agents/outbox/${e}/read`,f,{method:`POST`}))).then(()=>{window.dispatchEvent(new Event(`teammy:outbox`)),E.reload()}).catch(e=>W(h(e)))},[O,Q,b,E.reload]),(0,x.useEffect)(()=>{if(G(``),!k)return;let t=!0,r=-1,i=!1,o=new AbortController,s=e=>{!t||e.id!==k||e.cursor<r||(r=e.cursor,i=!0,e.redirect?Y(`chat:${e.redirect}`):e.entry===`channel`&&p!==`channels`?location.replace(a(`/projects/${_}/channels?chat=${e.id}`)):(M(e),G(``)))};b(`agents/chats/${k}`,m,{signal:o.signal}).then(s).catch(r=>{t&&!o.signal.aborted&&(r instanceof ne&&[401,403,404].includes(r.status)&&(w?.delete(e(_,n,`chat`,k)),M(e=>e?.id===k?void 0:e)),i||G(h(r)))});let c=e=>{let n=Number(e.lastEventId);return!t||!Number.isSafeInteger(n)||n<=r?!1:(r=n,!0)},l=new EventSource(a(`/api/v1/projects/${encodeURIComponent(_)}/agents/chats/${encodeURIComponent(k)}/events`));l.addEventListener(`snapshot`,e=>{if(t)try{s(m.parse(JSON.parse(e.data)))}catch(e){G(h(e))}}),l.onerror=()=>{t&&G(`对话连接中断,正在重新连接…`)},l.addEventListener(`context`,e=>{if(!c(e))return;let t=m.pick({kind:!0,title:!0,status:!0,visibility:!0,participants:!0,pending:!0,hold:!0,redirect:!0}).parse(JSON.parse(e.data));t.redirect?Y(`chat:${t.redirect}`):M(e=>e?.id===k?{...e,...t,cursor:r}:e)}),l.addEventListener(`message`,e=>{if(!c(e))return;let t=ee.parse(JSON.parse(e.data));M(n=>n?.id===k?{...n,readCursor:Math.max(n.readCursor,t.seq),cursor:Math.max(n.cursor,Number(e.lastEventId)||0),messages:[...n.messages.filter(e=>e.id!==t.id),t].sort((e,t)=>e.seq-t.seq)}:n)}),l.addEventListener(`message_removed`,e=>{if(!c(e))return;let{id:t}=d({id:y()}).parse(JSON.parse(e.data));M(e=>e?.id===k?{...e,cursor:r,messages:e.messages.filter(e=>e.id!==t)}:e)}),l.addEventListener(`run`,e=>{if(!c(e))return;let t=re.parse(JSON.parse(e.data));M(n=>n?.id===k?{...n,cursor:Math.max(n.cursor,Number(e.lastEventId)||0),runs:n.runs.some(e=>e.id===t.id)?n.runs:[...n.runs,t]}:n)});for(let e of[`delta`,`reset`,`state`])l.addEventListener(e,t=>{if(!c(t))return;let n=JSON.parse(t.data);M(r=>r?.id===k?{...r,cursor:Math.max(r.cursor,Number(t.lastEventId)||0),messages:r.messages.map(t=>t.runId!==n.id||t.role!==`assistant`?t:{...t,body:e===`delta`?t.body+(n.text??``):e===`reset`?``:n.answer??t.body,state:n.state??t.state}),runs:r.runs.map(t=>t.id===n.id?{...t,answer:e===`delta`?t.answer+(n.text??``):e===`reset`?``:n.answer??t.answer,state:n.state??t.state,error:n.error===void 0?t.error:n.error}:t)}:r)});return()=>{t=!1,o.abort(),l.close()}},[_,k,n,b,w]),(0,x.useEffect)(()=>{if(!N||N.id!==k)return;let e=()=>{document.visibilityState===`visible`&&b(`agents/chats/${k}/read`,d({ok:l()}),{method:`POST`,body:{cursor:N.readCursor}}).then(()=>{D.reload(),window.dispatchEvent(new Event(`teammy:outbox`))}).catch(e=>W(h(e)))},t=setTimeout(e,300);return document.addEventListener(`visibilitychange`,e),()=>{clearTimeout(t),document.removeEventListener(`visibilitychange`,e)}},[k,N?.readCursor,N?.kind,b]),(0,x.useEffect)(()=>{q.current&&Fe.current?.scrollIntoView({block:`end`})},[O,j?.messages,Z?.recipients,X.length]);function Ie(){window.dispatchEvent(new Event(`teammy:outbox`)),E.reload()}async function $(e){if(q.current=!0,Y(e),W(``),I(void 0),e.startsWith(`chat:`)||e===`debug`)return;let t=E.data?.messages.find(t=>t.id===e)?.conversationId;if(t)Y(`chat:${t}`);else try{await b(`agents/outbox/${e}/read`,f,{method:`POST`}),Ie()}catch(e){W(h(e))}}async function Le(){if(!V){Te(!0),W(``);try{let e=await b(`agents/chats`,m,{method:`POST`});M(e),await $(`chat:${e.id}`),D.reload()}catch(e){W(h(e))}finally{Te(!1)}}}async function Re(e){e.preventDefault();let t=Ce.trim();if(!t||z||V)return;B(!0),W(``);let n=K.current.get(O);n&&n.text===t||(n={text:t,id:u()},K.current.set(O,n));try{if(A){let e=n.target??k;if(!e){let r=await b(`agents/chats`,m,{method:`POST`});e=r.id,n.target=e,K.current.set(`chat:${e}`,n),R(n=>({...n,[`chat:${e}`]:t})),J.current===O&&(M(r),Y(`chat:${e}`))}let r=await b(`agents/chats/${e}`,re.extend({conversationId:y().optional()}),{method:`POST`,body:{text:t,requestId:n.id}});r.conversationId&&r.conversationId!==e&&(J.current===O||J.current===`chat:${e}`)&&Y(`chat:${r.conversationId}`),M(t=>t?.id===e?{...t,runs:t.runs.some(e=>e.id===r.id)?t.runs:[...t.runs,r]}:t),D.reload()}else{let e=await b(`agents/outbox/${Z.id}/reply`,d({conversationId:y()}),{method:`POST`,body:{body:t,requestId:n.id}});Ie(),J.current===O&&Y(`chat:${e.conversationId}`),D.reload(),I(void 0)}K.current.delete(O),n.target&&K.current.delete(`chat:${n.target}`),R(e=>({...e,[O]:``,...n.target?{[`chat:${n.target}`]:``}:{}}))}catch(e){W(h(e))}finally{B(!1)}}let ze=p===`channels`?ue:pe,Be=A&&!N?.closed&&(p!==`channels`||!!k)||!!Z&&!Z.archivedAt,Ve=A&&!N&&(!!k||!D.data);return(0,S.jsxs)(fe,{className:p===`channels`?`channel-layout`:``,testId:`assistant-page`,label:A?`Tim对话`:`消息内容`,navigation:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`header`,{className:`assistant-list-heading`,children:[(0,S.jsx)(`h1`,{children:p===`channels`?`频道`:`对话`}),(0,S.jsxs)(`div`,{className:`assistant-list-actions`,children:[(0,S.jsx)(c,{className:`assistant-new-chat`,icon:`clear`,label:`清除未读`,disabled:Ee,onClick:()=>{De(!0),W(``),b(`communication/read`,d({ok:oe(!0)}),{method:`POST`,body:{scope:p}}).then(async()=>{window.dispatchEvent(new Event(`teammy:outbox`)),await Promise.all([D.reload(),E.reload()])}).catch(e=>W(h(e))).finally(()=>De(!1))}}),(0,S.jsx)(c,{className:`assistant-new-chat`,icon:`plus`,label:p===`channels`?`发表话题`:`新建对话`,disabled:V,onClick:()=>p===`channels`?H(!0):void Le(),"data-testid":`assistant-launcher`})]})]}),(0,S.jsxs)(`div`,{className:`assistant-message-scroll`,children:[D.loading&&!D.data&&(0,S.jsx)(`p`,{className:`assistant-list-status`,role:`status`,children:`加载中…`}),D.data?.chats.map(e=>(0,S.jsxs)(`button`,{type:`button`,"data-testid":`assistant-chat-${e.id}`,className:`assistant-message-item assistant-chat-item ${k===e.id?`selected`:``}`,"aria-pressed":k===e.id,onClick:()=>void $(`chat:${e.id}`),children:[(0,S.jsx)(`span`,{className:`assistant-message-dot ${e.unread||p!==`channels`&&(e.state===`running`||e.state===`queued`)?`unread`:``}`}),(0,S.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,S.jsx)(v,{selected:k===e.id,children:(0,S.jsx)(`strong`,{children:e.title})}),p===`channels`&&`summary`in e&&(0,S.jsx)(`span`,{className:`topic-preview`,children:C(String(e.summary)).slice(0,140)}),(0,S.jsxs)(`time`,{dateTime:e.updatedAt,children:[new Date(e.updatedAt).toLocaleDateString([],{month:`numeric`,day:`numeric`}),` `,ge(e.updatedAt)]})]})]},e.id)),!!X.length&&(0,S.jsxs)(`button`,{type:`button`,"data-testid":`debug-outbox`,className:`assistant-message-item ${O===`debug`?`selected`:``}`,onClick:()=>void $(`debug`),children:[(0,S.jsx)(`span`,{className:`assistant-message-dot ${Q?`unread`:``}`}),(0,S.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,S.jsx)(v,{selected:O===`debug`,children:(0,S.jsx)(`strong`,{children:`运行提醒`})}),(0,S.jsx)(`span`,{children:C(X.at(-1).body)})]})]}),E.data?.messages.filter(e=>p===`messages`&&e.box!==`debug`&&!e.conversationId).sort((e,t)=>Number(!!e.archivedAt)-Number(!!t.archivedAt)).map(e=>(0,S.jsxs)(`button`,{type:`button`,"data-testid":`outbox-${e.id}`,className:`assistant-message-item ${e.archivedAt?`archived`:``} ${O===e.id?`selected`:``}`,onClick:()=>void $(e.id),children:[(0,S.jsx)(`span`,{className:`assistant-message-dot ${e.readAt?``:`unread`}`}),(0,S.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,S.jsx)(v,{selected:O===e.id,children:(0,S.jsx)(`strong`,{children:C(e.body)})}),(0,S.jsxs)(`time`,{dateTime:e.createdAt,children:[new Date(e.createdAt).toLocaleDateString([],{month:`numeric`,day:`numeric`}),` `,ge(e.createdAt)]})]})]},e.id))]}),(0,S.jsx)(g,{error:!0,children:E.error||D.error})]}),children:[Oe&&(0,S.jsxs)(i,{id:`new-topic`,title:`发表话题`,onClose:()=>H(!1),children:[(0,S.jsx)(me,{inset:!0,plain:!0,value:Ae,onChange:je,label:`正文`,placeholder:`开始一个话题…`,sendLabel:`发表话题`,sendDisabled:z||!U.trim(),heading:(0,S.jsx)(`input`,{className:`topic-title`,"aria-label":`标题`,placeholder:`标题`,required:!0,value:U,onChange:e=>ke(e.target.value)}),onSubmit:e=>{e.preventDefault(),B(!0),W(``),b(`channels/topics`,m,{method:`POST`,body:{id:Me.current,title:U,body:Ae}}).then(e=>{M(e),Y(`chat:${e.id}`),H(!1),ke(``),je(``),Me.current=u(),D.reload()}).catch(e=>W(h(e))).finally(()=>B(!1))}}),(0,S.jsx)(g,{error:!0,children:Ne})]}),(0,S.jsx)(de,{title:(0,S.jsx)(`h2`,{children:A?P?.title??N?.title??(k?`无标题`:`Tim`):O===`debug`?`运行提醒`:`项目消息`}),actions:(0,S.jsxs)(S.Fragment,{children:[p!==`channels`&&N?.kind===`matter`&&(0,S.jsxs)(`span`,{className:`assistant-participants`,title:N.participants?.join(`、`),children:[N.visibility===`project`?`项目共享 · `:``,N.participants?.join(`、`)]}),p===`channels`&&F?.available&&(F.state===`web`||F.state===`cancelled`||!F.connected)&&(0,S.jsx)(c,{icon:`send`,label:`发布到企业微信频道`,disabled:z,onClick:()=>{B(!0),b(`channels/topics/${k}/publish`,t(),{method:`POST`}).then(()=>D.reload()).catch(e=>W(h(e))).finally(()=>B(!1))}})]})}),p===`channels`&&(0,S.jsx)(g,{error:!0,children:F?.error}),p!==`channels`&&N?.kind===`matter`&&(N.hold||N.pending||N.status===`completed`)&&(0,S.jsx)(`div`,{className:`assistant-matter-state`,role:`status`,children:N.hold?`${N.hold.scope===`all`?`已暂停`:`暂缓修改`} · ${N.hold.reason}`:N.pending?`待确认 · ${N.pending.members.join(`、`)}:${N.pending.question}`:`已完成`}),(0,S.jsxs)(le,{"data-testid":`assistant-transcript`,onScroll:e=>{let t=e.currentTarget;q.current=t.scrollHeight-t.scrollTop-t.clientHeight<100},children:[A?Ve?(0,S.jsxs)(`div`,{className:`assistant-empty`,"data-testid":`assistant-loading`,children:[(0,S.jsx)(r,{}),(0,S.jsx)(`p`,{role:`status`,children:Pe||D.error?`暂时无法加载对话`:`加载中…`})]}):N?.messages.length?N.messages.filter(e=>e.body||[`queued`,`running`,`failed`].includes(e.state)).map(e=>(0,S.jsx)(`div`,{className:`assistant-turn`,children:(0,S.jsxs)(ze,{mine:e.role===`user`&&e.author===n,author:`${e.role===`assistant`?`Tim`:e.author}${e.source===`wecom`?` · 企业微信`:``}`,time:e.createdAt,children:[e.body&&(0,S.jsx)(`div`,{className:`markdown`,children:(0,S.jsx)(ce,{children:e.body})}),e.role===`assistant`&&[`queued`,`running`].includes(e.state)&&(0,S.jsxs)(`span`,{className:`assistant-typing`,"aria-label":`正在回答`,children:[(0,S.jsx)(`i`,{}),(0,S.jsx)(`i`,{}),(0,S.jsx)(`i`,{})]}),e.state===`failed`&&(0,S.jsx)(g,{error:!0,children:N.runs.find(t=>t.id===e.runId)?.error||`本次回答未完成。`})]})},e.id)):(0,S.jsxs)(`div`,{className:`assistant-empty`,children:[(0,S.jsx)(r,{}),(0,S.jsx)(`p`,{children:`有什么项目问题想聊聊?`})]}):!E.data&&E.loading?(0,S.jsx)(`div`,{className:`assistant-empty`,children:(0,S.jsx)(`p`,{role:`status`,children:`加载中…`})}):O===`debug`?X.map(e=>(0,S.jsx)(_e,{item:e,onReply:e.archivedAt?void 0:()=>{I(e.id),we(``),W(``)}},e.id)):Z&&(0,S.jsx)(_e,{item:Z}),(0,S.jsx)(`div`,{ref:Fe})]}),(0,S.jsx)(g,{error:!0,children:Ne||(A?Pe:``)}),Be?(0,S.jsx)(me,{value:Ce,onChange:we,onSubmit:e=>void Re(e),disabled:V,sendDisabled:z||Ve,label:A?`向Tim提问`:`回复消息`}):O!==`debug`&&Z&&(0,S.jsxs)(`div`,{className:`assistant-archived`,children:[(0,S.jsx)(s,{name:`archive`}),`已归档`]})]})}function _e({item:e,onReply:t}){return(0,S.jsx)(`div`,{"data-testid":`outbox-thread-${e.id}`,children:(0,S.jsxs)(pe,{author:e.box===`debug`?`运行提醒`:`Tim`,time:e.createdAt,children:[(0,S.jsx)(`div`,{className:`markdown`,children:(0,S.jsx)(ce,{children:e.body})}),t&&(0,S.jsx)(`button`,{type:`button`,className:`assistant-debug-reply`,onClick:t,children:`回复`})]})})}export{w as Assistant};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{A as e,C as t,Ct as n,D as r,Dt as i,E as a,F as o,K as s,M as c,N as l,O as u,Ot as d,Q as f,S as p,T as m,U as h,V as g,W as _,_ as v,_t as y,at as b,b as x,bt as S,g as C,gt as w,ht as T,it as E,j as D,k as O,p as k,q as A,tt as j,w as M,x as N,xt as P,z as ee}from"./index-xjf37um4.js";import{t as F}from"./Markdown-BgEXVy4-.js";import{a as I,n as te,o as ne,r as re,t as ie}from"./Conversation-DK5-Q1RB.js";import{n as ae,t as oe}from"./MessageComposer-6eJAo_e7.js";import{r as L}from"./PillControl-BRPhbHQm.js";import{r as se}from"./WorkspaceTree-DUFGMLRi.js";var R=i(),z=j();function B({value:e,label:t,placeholder:n,multiline:r=!1,maxLength:i,disabled:a=!1,onSave:o}){let[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(e),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)(``);async function h(){if(!(d||a||!r&&!l.trim())){if(l.trim()===e)c(!1);else{f(!0),m(``);try{await o(l.trim()),c(!1)}catch(e){m(E(e))}finally{f(!1)}}}}let g={autoFocus:!0,value:l,"aria-label":t,maxLength:i,disabled:d||a,onChange:e=>u(e.target.value),onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),d||c(!1)),e.key===`Enter`&&(!r||e.ctrlKey||e.metaKey)&&(e.preventDefault(),h()))}};return(0,z.jsx)(`span`,{className:`inline-edit${r?` multiline`:``}`,children:s?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`span`,{className:`inline-edit-fields`,children:[r?(0,z.jsx)(`textarea`,{...g,rows:3}):(0,z.jsx)(`input`,{...g}),(0,z.jsxs)(`span`,{className:`inline-edit-actions`,children:[(0,z.jsx)(_,{icon:`check`,label:`保存${t}`,disabled:d||a||!r&&!l.trim(),onClick:()=>void h()}),(0,z.jsx)(_,{icon:`close`,label:`取消编辑${t}`,disabled:d,onClick:()=>c(!1)})]})]}),p&&(0,z.jsx)(`span`,{className:`inline-edit-error`,role:`alert`,children:p})]}):(0,z.jsx)(`button`,{type:`button`,className:`inline-edit-value${e?``:` empty`}`,"aria-label":`编辑${t}:${e||n||``}`,disabled:a,onClick:()=>{u(e),m(``),c(!0)},children:e||n})})}var ce={codex:{name:`Codex`,logo:`data:image/svg+xml,%3csvg%20fill='currentColor'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmetadata%3eMIT%20License%20Copyright%20(c)%202023%20LobeHub%20Permission%20is%20hereby%20granted,%20free%20of%20charge,%20to%20any%20person%20obtaining%20a%20copy%20of%20this%20software%20and%20associated%20documentation%20files%20(the%20'Software'),%20to%20deal%20in%20the%20Software%20without%20restriction,%20including%20without%20limitation%20the%20rights%20to%20use,%20copy,%20modify,%20merge,%20publish,%20distribute,%20sublicense,%20and/or%20sell%20copies%20of%20the%20Software,%20and%20to%20permit%20persons%20to%20whom%20the%20Software%20is%20furnished%20to%20do%20so,%20subject%20to%20the%20following%20conditions:%20The%20above%20copyright%20notice%20and%20this%20permission%20notice%20shall%20be%20included%20in%20all%20copies%20or%20substantial%20portions%20of%20the%20Software.%20THE%20SOFTWARE%20IS%20PROVIDED%20'AS%20IS',%20WITHOUT%20WARRANTY%20OF%20ANY%20KIND,%20EXPRESS%20OR%20IMPLIED,%20INCLUDING%20BUT%20NOT%20LIMITED%20TO%20THE%20WARRANTIES%20OF%20MERCHANTABILITY,%20FITNESS%20FOR%20A%20PARTICULAR%20PURPOSE%20AND%20NONINFRINGEMENT.%20IN%20NO%20EVENT%20SHALL%20THE%20AUTHORS%20OR%20COPYRIGHT%20HOLDERS%20BE%20LIABLE%20FOR%20ANY%20CLAIM,%20DAMAGES%20OR%20OTHER%20LIABILITY,%20WHETHER%20IN%20AN%20ACTION%20OF%20CONTRACT,%20TORT%20OR%20OTHERWISE,%20ARISING%20FROM,%20OUT%20OF%20OR%20IN%20CONNECTION%20WITH%20THE%20SOFTWARE%20OR%20THE%20USE%20OR%20OTHER%20DEALINGS%20IN%20THE%20SOFTWARE.%20Source:%20https://raw.githubusercontent.com/lobehub/lobe-icons/ea434b96e75813517b377825e01c0df61dee8836/packages/static-svg/icons/openai.svg%20Teammy:%20added%20license%20metadata;%20geometry%20unchanged.%3c/metadata%3e%3ctitle%3eOpenAI%3c/title%3e%3cpath%20d='M9.205%208.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357%201.356-.523%202.117-.523%202.854%200%204.662%202.212%204.662%204.566%200%20.167%200%20.357-.024.547l-4.71-2.759a.797.797%200%2000-.856%200l-5.97%203.473zm10.609%208.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473%201.95-1.118a.433.433%200%2001.476%200l4.543%202.617c1.309.76%202.189%202.378%202.189%203.948%200%201.808-1.07%203.473-2.76%204.163zM7.802%2012.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545%201.95-4.472%204.591-4.472%201%200%201.927.333%202.712.928L8.23%205.067c-.285.166-.428.404-.428.737v6.898zM12%2015.128l-2.795-1.57v-3.33L12%208.658l2.795%201.57v3.33L12%2015.128zm1.796%207.23c-1%200-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974%201.142c.167.095.238.238.238.428v5.233c0%202.545-1.974%204.472-4.614%204.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482%204.482%200%20014.21%206.327v5.423c0%20.333.143.571.428.738l5.947%203.449-1.95%201.118a.432.432%200%2001-.476%200zm-.262%203.9c-2.688%200-4.662-2.021-4.662-4.519%200-.19.024-.38.047-.57l4.686%202.71c.286.167.571.167.856%200l5.97-3.448v2.26c0%20.19-.07.333-.237.428l-4.543%202.616c-.619.357-1.356.523-2.117.523zm5.899%202.83a5.947%205.947%200%20005.827-4.756C22.287%2018.339%2024%2015.84%2024%2013.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498%200-3.401-2.759-5.947-5.946-5.947-.642%200-1.26.095-1.88.31A5.962%205.962%200%200010.205%200a5.947%205.947%200%2000-5.827%204.757C1.713%205.447%200%207.945%200%2010.49c0%201.666.713%203.283%201.998%204.448-.119.5-.19%201-.19%201.499%200%203.401%202.759%205.946%205.946%205.946.642%200%201.26-.095%201.88-.309a5.96%205.96%200%20004.162%201.713z'%3e%3c/path%3e%3c/svg%3e`},claude:{name:`Claude Code`,logo:`data:image/svg+xml,%3csvg%20fill='currentColor'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmetadata%3eMIT%20License%20Copyright%20(c)%202023%20LobeHub%20Permission%20is%20hereby%20granted,%20free%20of%20charge,%20to%20any%20person%20obtaining%20a%20copy%20of%20this%20software%20and%20associated%20documentation%20files%20(the%20'Software'),%20to%20deal%20in%20the%20Software%20without%20restriction,%20including%20without%20limitation%20the%20rights%20to%20use,%20copy,%20modify,%20merge,%20publish,%20distribute,%20sublicense,%20and/or%20sell%20copies%20of%20the%20Software,%20and%20to%20permit%20persons%20to%20whom%20the%20Software%20is%20furnished%20to%20do%20so,%20subject%20to%20the%20following%20conditions:%20The%20above%20copyright%20notice%20and%20this%20permission%20notice%20shall%20be%20included%20in%20all%20copies%20or%20substantial%20portions%20of%20the%20Software.%20THE%20SOFTWARE%20IS%20PROVIDED%20'AS%20IS',%20WITHOUT%20WARRANTY%20OF%20ANY%20KIND,%20EXPRESS%20OR%20IMPLIED,%20INCLUDING%20BUT%20NOT%20LIMITED%20TO%20THE%20WARRANTIES%20OF%20MERCHANTABILITY,%20FITNESS%20FOR%20A%20PARTICULAR%20PURPOSE%20AND%20NONINFRINGEMENT.%20IN%20NO%20EVENT%20SHALL%20THE%20AUTHORS%20OR%20COPYRIGHT%20HOLDERS%20BE%20LIABLE%20FOR%20ANY%20CLAIM,%20DAMAGES%20OR%20OTHER%20LIABILITY,%20WHETHER%20IN%20AN%20ACTION%20OF%20CONTRACT,%20TORT%20OR%20OTHERWISE,%20ARISING%20FROM,%20OUT%20OF%20OR%20IN%20CONNECTION%20WITH%20THE%20SOFTWARE%20OR%20THE%20USE%20OR%20OTHER%20DEALINGS%20IN%20THE%20SOFTWARE.%20Source:%20https://raw.githubusercontent.com/lobehub/lobe-icons/ea434b96e75813517b377825e01c0df61dee8836/packages/static-svg/icons/claude.svg%20Teammy:%20added%20license%20metadata;%20geometry%20unchanged.%3c/metadata%3e%3ctitle%3eClaude%3c/title%3e%3cpath%20d='M4.709%2015.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0%2011.784l.055-.352.48-.321.686.06%201.52.103%202.278.158%201.652.097%202.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686%201.908%201.476%202.491%201.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97%202.97%200%2001-.104-.729L6.283.134%206.696%200l.996.134.42.364.62%201.414%201.002%202.229%201.555%203.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286%201.851-.559%202.903-.364%201.942h.212l.243-.242.985-1.306%201.652-2.064.73-.82.85-.904.547-.431h1.033l.76%201.129-.34%201.166-1.064%201.347-.881%201.142-1.264%201.7-.79%201.36.073.11.188-.02%202.856-.606%201.543-.28%201.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061%201.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093%201.068%202.006%201.81%202.509%202.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649%202.345%203.521.122%201.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674%207.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434%201.967-2.18%202.945-1.726%201.845-.414.164-.717-.37.067-.662.401-.589%202.388-3.036%201.44-1.882.93-1.086-.006-.158h-.055L4.132%2018.56l-1.13.146-.487-.456.061-.746.231-.243%201.908-1.312-.006.006z'%3e%3c/path%3e%3c/svg%3e`},cursor:{name:`Cursor`,logo:`data:image/svg+xml,%3csvg%20fill='currentColor'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3cmetadata%3eMIT%20License%20Copyright%20(c)%202023%20LobeHub%20Permission%20is%20hereby%20granted,%20free%20of%20charge,%20to%20any%20person%20obtaining%20a%20copy%20of%20this%20software%20and%20associated%20documentation%20files%20(the%20'Software'),%20to%20deal%20in%20the%20Software%20without%20restriction,%20including%20without%20limitation%20the%20rights%20to%20use,%20copy,%20modify,%20merge,%20publish,%20distribute,%20sublicense,%20and/or%20sell%20copies%20of%20the%20Software,%20and%20to%20permit%20persons%20to%20whom%20the%20Software%20is%20furnished%20to%20do%20so,%20subject%20to%20the%20following%20conditions:%20The%20above%20copyright%20notice%20and%20this%20permission%20notice%20shall%20be%20included%20in%20all%20copies%20or%20substantial%20portions%20of%20the%20Software.%20THE%20SOFTWARE%20IS%20PROVIDED%20'AS%20IS',%20WITHOUT%20WARRANTY%20OF%20ANY%20KIND,%20EXPRESS%20OR%20IMPLIED,%20INCLUDING%20BUT%20NOT%20LIMITED%20TO%20THE%20WARRANTIES%20OF%20MERCHANTABILITY,%20FITNESS%20FOR%20A%20PARTICULAR%20PURPOSE%20AND%20NONINFRINGEMENT.%20IN%20NO%20EVENT%20SHALL%20THE%20AUTHORS%20OR%20COPYRIGHT%20HOLDERS%20BE%20LIABLE%20FOR%20ANY%20CLAIM,%20DAMAGES%20OR%20OTHER%20LIABILITY,%20WHETHER%20IN%20AN%20ACTION%20OF%20CONTRACT,%20TORT%20OR%20OTHERWISE,%20ARISING%20FROM,%20OUT%20OF%20OR%20IN%20CONNECTION%20WITH%20THE%20SOFTWARE%20OR%20THE%20USE%20OR%20OTHER%20DEALINGS%20IN%20THE%20SOFTWARE.%20Source:%20https://raw.githubusercontent.com/lobehub/lobe-icons/ea434b96e75813517b377825e01c0df61dee8836/packages/static-svg/icons/claude.svg%20Teammy:%20added%20license%20metadata;%20geometry%20unchanged.%3c/metadata%3e%3ctitle%3eCursor%3c/title%3e%3cpath%20d='M22.106%205.68L12.5.135a.998.998%200%2000-.998%200L1.893%205.68a.84.84%200%2000-.419.726v11.186c0%20.3.16.577.42.727l9.607%205.547a.999.999%200%2000.998%200l9.608-5.547a.84.84%200%2000.42-.727V6.407a.84.84%200%2000-.42-.726zm-.603%201.176L12.228%2022.92c-.063.108-.228.064-.228-.061V12.34a.59.59%200%2000-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264%200%20.428.286.296.514z'%3e%3c/path%3e%3c/svg%3e`},pi:{name:`Pi`,logo:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpath%20fill='currentColor'%20d='M3%205h18v3h-3v9c0%201%20.5%201.5%201.5%201.5H21V21h-2c-3%200-4-1.5-4-4V8H9v6c0%204-1.5%206.5-5%207l-1-2.5C5.5%2018%206%2016.5%206%2014V8H3z'/%3e%3c/svg%3e`},opencode:{name:`OpenCode`,logo:`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='96%2064%20288%20384'%20fill='%23393936'%3e%3cpath%20d='M320%20224V352H192V224H320Z'%20opacity='.4'/%3e%3cpath%20fill-rule='evenodd'%20d='M384%20416H128V96H384V416ZM320%20160H192V352H320V160Z'/%3e%3c/svg%3e`}};function le({provider:e}){let{name:t,logo:n}=ce[e];return(0,z.jsx)(`img`,{className:`agent-logo`,src:n,alt:t,title:t,"data-provider":e,width:24,height:24})}function ue({value:e,onChange:t,providers:n=M.options,disabledProviders:r=[],disabled:i=!1,label:a=`Agent`}){return(0,z.jsxs)(`div`,{className:`field`,children:[(0,z.jsx)(`span`,{children:`Agent`}),(0,z.jsx)(L,{label:a,value:e,onChange:t,disabled:i,options:M.options.filter(e=>n.includes(e)).map(e=>({value:e,label:l[e],icon:(0,z.jsx)(le,{provider:e}),disabled:r.includes(e)}))})]})}S({provider:M,cursor:P().optional(),session:r.optional()});var de=S({id:r,title:P(),cwd:P(),updatedAt:P().datetime().nullable(),active:y().default(!1)}),fe=S({sessions:w(de),nextCursor:P().nullable()}),pe=S({command:D,history:fe.nullable()});function me(e,t=Date.now()){if(!e)return``;let n=new Date(e),r=Math.max(0,t-n.getTime());return Number.isFinite(r)?r<36e5?`${Math.floor(r/6e4)}min`:r<864e5?`${Math.floor(r/36e5)}h`:r<=6048e5?`${Math.floor(r/864e5)}day`:`${String(n.getFullYear()).slice(-2)}/${String(n.getMonth()+1).padStart(2,`0`)}/${String(n.getDate()).padStart(2,`0`)}`:``}function he({id:e,label:t,value:n,onChange:r,options:i,placeholder:a,loading:o=!1,disabled:s=!1,empty:c=`没有匹配的选项。`,footer:l}){let[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(``),[m,h]=(0,R.useState)(),g=(0,R.useRef)(null),v=(0,R.useRef)(null),y=(0,R.useRef)(null),b=i.find(e=>e.value===n),x=b?``:n.trim().toLocaleLowerCase(),S=i.filter(e=>`${e.label} ${e.value}`.toLocaleLowerCase().includes(x)),C=S.filter(e=>!e.disabled),w=S.findIndex(e=>e.value===f);(0,R.useEffect)(()=>p(``),[n]),(0,R.useEffect)(()=>{if(!u)return;let e=e=>{g.current?.contains(e.target)||d(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[u]),(0,R.useLayoutEffect)(()=>{if(!u)return;let e=()=>{let e=v.current?.getBoundingClientRect();if(!e)return;let t=innerHeight-e.bottom-16,n=e.top-16,r=t<220&&n>t;h({left:e.left,width:e.width,top:r?void 0:e.bottom+6,bottom:r?innerHeight-e.top+6:void 0,maxHeight:Math.min(320,r?n:t)})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[u]),(0,R.useEffect)(()=>{u&&w>=0&&document.getElementById(`${e}-option-${w}`)?.scrollIntoView({block:`nearest`})},[u,w,e]);function T(e){e.disabled||(r(e.value),d(!1),y.current?.focus())}return(0,z.jsxs)(`div`,{className:`combobox`,ref:g,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||d(!1)},onKeyDown:e=>{e.key===`Escape`&&u&&(e.preventDefault(),e.stopPropagation(),d(!1),y.current?.focus())},children:[(0,z.jsxs)(`div`,{className:`combobox-field`,ref:v,children:[(0,z.jsx)(`input`,{id:e,ref:y,role:`combobox`,"aria-label":t,"aria-autocomplete":`list`,"aria-expanded":u,"aria-controls":`${e}-list`,"aria-activedescendant":u&&w>=0?`${e}-option-${w}`:void 0,autoComplete:`off`,disabled:s,value:b?.label??n,title:b?.value,placeholder:a,onClick:()=>d(!0),onChange:e=>{r(e.target.value),d(!0)},onKeyDown:e=>{if([`ArrowDown`,`ArrowUp`].includes(e.key)){e.preventDefault(),d(!0);let t=C.findIndex(e=>e.value===f),n=t<0?e.key===`ArrowDown`?0:C.length-1:(t+(e.key===`ArrowDown`?1:-1)+C.length)%C.length;p(C[n]?.value??``)}else e.key===`Enter`&&u&&w>=0?(e.preventDefault(),T(S[w])):e.key===`Tab`&&d(!1)}}),(0,z.jsx)(_,{icon:u?`chevronUp`:`chevronDown`,label:`${u?`收起`:`展开`}${t}`,disabled:s,"aria-expanded":u,"aria-controls":`${e}-list`,onClick:()=>{d(!u),y.current?.focus()}})]}),u&&(0,z.jsxs)(`div`,{className:`combobox-popup`,style:m,children:[(0,z.jsxs)(`div`,{id:`${e}-list`,role:`listbox`,"aria-label":t,"aria-busy":o,children:[S.map((t,r)=>(0,z.jsxs)(`button`,{id:`${e}-option-${r}`,type:`button`,role:`option`,"aria-selected":t.value===n,disabled:t.disabled,tabIndex:-1,className:`combobox-option ${t.value===f?`active`:``}`,title:`${t.label} · ${t.value}`,onMouseDown:e=>e.preventDefault(),onClick:()=>T(t),children:[(0,z.jsxs)(`span`,{className:`combobox-option-copy`,children:[(0,z.jsx)(`span`,{children:t.label}),t.description&&(0,z.jsx)(`small`,{children:t.description})]}),t.detail&&(0,z.jsx)(`span`,{className:`combobox-option-detail`,children:t.detail})]},t.value)),o&&(0,z.jsx)(`p`,{className:`combobox-message`,role:`status`,children:`正在读取…`}),!o&&!S.length&&(0,z.jsx)(`p`,{className:`combobox-message`,children:c})]}),l&&(0,z.jsx)(`div`,{className:`combobox-footer`,children:l})]})]})}function ge({directory:e,provider:t,providers:n,sessions:i,request:o,onClose:c,onImport:l}){let[u,d]=(0,R.useState)(t),[f,p]=(0,R.useState)([]),[m,h]=(0,R.useState)(null),[g,v]=(0,R.useState)(``),[y,x]=(0,R.useState)(null),[S,C]=(0,R.useState)(``),w=(0,R.useRef)(null),T=e=>i.find(t=>t.provider===u&&(t.nativeSession??t.resumeSession)===e);async function O(t,n){let r=b();for(await o(`web/local-agents/${e}/history`,D,{method:`POST`,signal:n,body:{id:r,argument:JSON.stringify({provider:u,...t})}});!n.aborted;){let t=await o(`web/local-agents/${e}/history/${r}`,pe,{signal:n});if(t.command.state===`succeeded`&&t.history)return{...t.history,id:r};if(![`queued`,`running`].includes(t.command.state))throw Error(t.command.error||`读取历史会话失败。`);await new Promise(e=>{let t=()=>{clearTimeout(r),n.removeEventListener(`abort`,t),e()},r=setTimeout(t,1e3);n.addEventListener(`abort`,t,{once:!0})})}throw new DOMException(`Aborted`,`AbortError`)}async function k(t,n,r){let i=T(t.id)??await o(`web/local-agents/${e}/sessions`,a,{method:`POST`,signal:r,body:{id:b(),title:t.title,provider:u,resumeSession:t.id,historyRequest:n}});r.aborted||l(i)}async function j(e,t){w.current?.abort();let n=new AbortController;w.current=n,x(e),C(``);try{await t(n.signal)}catch(e){n.signal.aborted||C(E(e))}finally{n.signal.aborted||x(null)}}let M=e=>j(`list`,async t=>{let n=await O(e?{cursor:e}:{},t);t.aborted||(p(t=>{let r=[...e?t:[],...n.sessions.map(e=>({...e,requestId:n.id}))];return[...new Map(r.map(e=>[e.id,e])).values()].sort((e,t)=>(t.updatedAt??``).localeCompare(e.updatedAt??``))}),h(n.nextCursor))});(0,R.useEffect)(()=>(p([]),h(null),v(``),M(),()=>w.current?.abort()),[u,e,o]);let N=f.find(e=>e.id===g),P=y===`import`;return(0,z.jsx)(s,{id:`computer-import-session`,title:`导入历史会话`,onClose:c,children:(0,z.jsxs)(`form`,{className:`native-history`,onSubmit:e=>{e.preventDefault(),j(`import`,async e=>{let t=g.trim(),n=T(t);if(n)return l(n);if(N)return k(N,N.requestId,e);let r=await O({session:t},e),i=r.sessions.find(e=>e.id===t);if(!i)throw Error(`找不到此目录中的会话。`);await k(i,r.id,e)})},children:[(0,z.jsx)(ue,{label:`历史会话 Agent`,value:u,onChange:d,providers:[t,...n],disabled:P}),(0,z.jsxs)(`div`,{className:`field`,children:[(0,z.jsx)(`label`,{htmlFor:`native-history-session`,children:`Session`}),(0,z.jsxs)(`div`,{className:`native-history-input-row`,children:[(0,z.jsx)(he,{id:`native-history-session`,label:`历史会话`,value:g,onChange:v,placeholder:`选择会话或输入 ID`,disabled:P,loading:y===`list`,empty:g?`未找到匹配会话,可直接输入 Session ID。`:`此目录暂无历史会话,可输入 Session ID。`,options:f.map(e=>({value:e.id,label:e.title,description:e.id,detail:T(e.id)?`已接入`:e.active?`工作中`:me(e.updatedAt),disabled:e.active&&!T(e.id)})),footer:(0,z.jsxs)(z.Fragment,{children:[m&&(0,z.jsx)(`button`,{className:`native-history-more`,type:`button`,disabled:!!y,onClick:()=>void M(m),children:`加载更多`}),(0,z.jsx)(_,{icon:`refresh`,label:`刷新历史会话`,disabled:!!y,onClick:()=>void M()})]})},u),(0,z.jsx)(`button`,{type:`submit`,disabled:P||!r.safeParse(g.trim()).success||!!N?.active&&!T(N.id),children:P?`正在导入…`:T(g.trim())?`打开`:`导入`})]})]}),(0,z.jsx)(A,{error:!0,children:S}),(0,z.jsx)(`small`,{className:`muted`,children:`请先退出原终端会话。`})]})})}var _e=S({cwd:P(),repository:P().nullable(),capturedAt:P(),truncated:y(),files:w(S({path:P(),section:T([`staged`,`working`,`untracked`]),patch:P().max(5e4),binary:y(),truncated:y()})).max(100)}),ve=S({command:D,diff:_e.nullable()});function ye({session:e,request:t,onClose:n}){let[r,i]=(0,R.useState)(b),[a,o]=(0,R.useState)(),[c,l]=(0,R.useState)(``);(0,R.useEffect)(()=>{let n=new AbortController,i;o(void 0),l(``);let a=async()=>{try{let s=await t(`web/local-agent-sessions/${e}/diff/${r}`,ve,{signal:n.signal});if(n.signal.aborted)return;o(s),[`queued`,`running`].includes(s.command.state)&&(i=setTimeout(()=>void a(),1e3))}catch(e){n.signal.aborted||l(E(e))}};return t(`web/local-agent-sessions/${e}/commands`,D,{method:`POST`,signal:n.signal,body:{id:r,kind:`diff`}}).then(a).catch(e=>{n.signal.aborted||l(E(e))}),()=>{n.abort(),clearTimeout(i)}},[e,t,r]);let u=a?.diff,d=!c&&(!a||[`queued`,`running`].includes(a.command.state));return(0,z.jsx)(s,{id:`workspace-diff`,title:`工作目录改动`,onClose:n,children:(0,z.jsxs)(`div`,{className:`workspace-diff`,children:[(0,z.jsx)(`p`,{className:`muted`,children:`包含此目录内所有未提交改动,也可能包含其他会话或工具的修改。`}),(0,z.jsxs)(`div`,{className:`workspace-diff-toolbar`,children:[(0,z.jsx)(`span`,{className:`muted`,children:u?`读取于 ${new Date(u.capturedAt).toLocaleTimeString()}`:d?`正在从开发机读取…`:``}),(0,z.jsx)(`button`,{type:`button`,disabled:d,onClick:()=>i(b()),children:`刷新`})]}),(0,z.jsx)(A,{error:!0,children:c||a?.command.error}),u&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`code`,{className:`workspace-diff-path`,children:u.cwd}),u.repository?u.files.length?null:(0,z.jsx)(`p`,{children:`当前目录没有未提交改动。`}):(0,z.jsx)(`p`,{children:`此目录不在 Git 仓库中。`}),u.truncated&&(0,z.jsx)(A,{children:`部分内容较大或无法预览,已限制显示范围。完整内容请在开发机查看。`}),u.files.map((e,t)=>(0,z.jsxs)(`details`,{open:t===0,children:[(0,z.jsxs)(`summary`,{children:[(0,z.jsx)(`span`,{children:e.path}),(0,z.jsx)(`small`,{children:{staged:`已暂存`,working:`未暂存`,untracked:`未跟踪`}[e.section]})]}),e.binary?(0,z.jsx)(`p`,{className:`muted`,children:`二进制文件`}):e.patch?(0,z.jsx)(`pre`,{"aria-label":`${e.path} 差异`,children:(0,z.jsx)(`code`,{children:e.patch.split(`
|
|
2
|
+
`).map((e,t)=>(0,z.jsxs)(`span`,{className:e.startsWith(`+`)?`diff-added`:e.startsWith(`-`)?`diff-removed`:e.startsWith(`@@`)?`diff-hunk`:``,children:[e,e?null:`\xA0`]},t))})}):(0,z.jsx)(`p`,{className:`muted`,children:`无可预览的文本差异。`}),e.truncated&&(0,z.jsx)(`small`,{className:`muted`,children:`此文件内容已截断或未展开。`})]},`${e.section}:${e.path}`))]})]})})}var be=(e,t,n)=>d(`/api/v1/projects/${encodeURIComponent(e)}/local-agent/sessions/${encodeURIComponent(t)}/images/${encodeURIComponent(n)}`);function xe({images:e,url:t,remove:n,disabled:r=!1}){return e.length?(0,z.jsx)(`div`,{className:`session-images`,children:e.map(e=>(0,z.jsxs)(`div`,{className:`session-image`,children:[(0,z.jsx)(`a`,{href:t(e.id),target:`_blank`,rel:`noreferrer`,title:e.name,children:(0,z.jsx)(`img`,{src:t(e.id),alt:e.name,loading:`lazy`})}),n&&(0,z.jsx)(`button`,{type:`button`,"aria-label":`移除图片 ${e.name}`,disabled:r,onClick:()=>n(e.id),children:(0,z.jsx)(h,{name:`close`,size:`small`})})]},e.id))}):null}function Se(e,t,n){let[r,i]=(0,R.useState)([]),[a,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(``),u=`${t}:${e}`,d=(0,R.useRef)(u),f=(0,R.useRef)(!1),p=(0,R.useRef)(null);d.current=u,(0,R.useEffect)(()=>{i([]),l(``)},[u]);async function m(t){if(!f.current&&e){if(t.length+r.length>4)l(`每条消息最多添加 4 张图片。`);else{f.current=!0,s(!0),l(``);try{for(let r of Array.from(t)){if(![`image/png`,`image/jpeg`,`image/webp`].includes(r.type)||r.size>5242880||!r.size)throw Error(`请选择不超过 5 MB 的 PNG、JPEG 或 WebP 图片。`);let t=await new Promise((e,t)=>{let n=new FileReader;n.onload=()=>e(String(n.result).split(`,`,2)[1]),n.onerror=()=>t(Error(`图片读取失败。`)),n.readAsDataURL(r)}),a=await n(`web/local-agent-sessions/${e}/images`,o,{method:`POST`,body:{id:b(),name:r.name.slice(0,200),data:t}});if(d.current!==u)return;i(e=>[...e,a])}}catch(e){d.current===u&&l(E(e))}finally{f.current=!1,s(!1)}}}}let g=n=>be(t,e,n);return{images:r,busy:a,add:m,clear:()=>{d.current===u&&i([])},picker:e=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`input`,{ref:p,type:`file`,className:`session-image-file`,accept:`image/png,image/jpeg,image/webp`,multiple:!0,"aria-label":`选择图片`,disabled:e||a,onChange:e=>{e.target.files&&m(e.target.files),e.target.value=``}}),(0,z.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":`添加图片`,title:`添加图片,也可粘贴或拖入`,disabled:e||a,onClick:()=>p.current?.click(),children:(0,z.jsx)(h,{name:`attachment`,size:`small`})})]}),preview:e=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(xe,{images:r,url:g,disabled:e||a,remove:e=>i(t=>t.filter(t=>t.id!==e))}),a&&(0,z.jsx)(`small`,{className:`muted`,children:`正在上传图片…`}),(0,z.jsx)(A,{error:!0,children:c})]})}}function Ce({message:e,session:t,request:n,refresh:r}){let[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(e.body),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(``),f=(0,R.useRef)(void 0),p=e.queue;if(!p)return null;let m={offered:`待本地接收`,received:`待本地接收`,queued:`排队中`,dispatching:`正在发送`,running:`执行中`,cancelled:`已撤回`,uncertain:`需要核对`};async function h(i){let s=JSON.stringify({inputId:e.id.replace(/^input:/,``),expectedRevision:p.revision,...i===`queue-edit`?{body:o}:{}}),c=`${i}:${s}`;f.current?.fingerprint!==c&&(f.current={fingerprint:c,id:b()}),l(!0),d(``);try{await n(`web/local-agent-sessions/${t}/commands`,D,{method:`POST`,body:{id:f.current.id,kind:i,argument:s}}),a(!1),f.current=void 0,r()}catch(e){d(E(e))}finally{l(!1)}}return(0,z.jsxs)(`div`,{className:`queued-message`,children:[m[p.state]&&(0,z.jsx)(`small`,{className:`muted`,children:m[p.state]}),i?(0,z.jsxs)(`div`,{className:`queued-message-editor`,children:[(0,z.jsx)(`textarea`,{"aria-label":`编辑待发送消息`,value:o,onChange:e=>s(e.target.value),disabled:c||!p.editable,autoFocus:!0}),(0,z.jsxs)(`div`,{className:`queued-message-actions`,children:[(0,z.jsx)(`button`,{type:`button`,disabled:c||!p.editable||!o.trim(),onClick:()=>void h(`queue-edit`),children:`保存修改`}),(0,z.jsx)(`button`,{type:`button`,disabled:c,onClick:()=>a(!1),children:`取消编辑`})]})]}):p.editable&&(0,z.jsxs)(`div`,{className:`queued-message-actions`,children:[(0,z.jsx)(`button`,{type:`button`,disabled:c,onClick:()=>{s(e.body),a(!0)},children:`编辑`}),(0,z.jsx)(`button`,{type:`button`,disabled:c,onClick:()=>void h(`queue-cancel`),children:`撤回`})]}),(0,z.jsx)(A,{error:!0,children:u})]})}function we(e){if(e<1e3)return`不到 1 秒`;let t=Math.floor(e/1e3),n=Math.floor(t/60),r=Math.floor(n/60);return[r?`${r} 小时`:``,n%60?`${n%60} 分`:``,t%60?`${t%60} 秒`:``].filter(Boolean).join(` `)}function Te({children:e}){return(0,z.jsx)(`div`,{className:`computer-divider`,children:(0,z.jsx)(`span`,{children:e})})}function Ee({message:e}){let t=e.state===`succeeded`?`已工作`:e.state===`interrupted`?`已停止`:e.state===`failed`?`执行失败`:`需要核对`;return(0,z.jsxs)(Te,{children:[t,e.activity?.durationMs===void 0?``:` · ${we(e.activity.durationMs)}`]})}var V={offered:`待本地接收`,pending:`待投递`,human_routed:`未送达本地`,failed:`失败`,uncertain:`需要核对`};function De({messages:e,renderQuestion:t,imageUrl:n,renderQueue:r}){let i=new Map(e.filter(e=>e.activity?.kind===`turn`).map(e=>[e.activity.turnId,e])),a=new Map,o=new Set(e.flatMap(e=>{let t=e.question?.planSource;return t?[JSON.stringify([t.turnId,t.itemId])]:[]})),s=new Set(e.flatMap(e=>{let t=e.activity;return t?.kind===`commentary`&&o.has(JSON.stringify([t.turnId,t.itemId]))?[JSON.stringify([t.turnId,e.body])]:[]}));for(let t of e)t.activity?.kind===`answer`&&!a.has(t.activity.turnId)&&a.set(t.activity.turnId,t.id);return(0,z.jsx)(`div`,{className:`computer-messages`,children:e.map(e=>{let c=e.activity;if(c?.kind===`commentary`&&(o.has(JSON.stringify([c.turnId,c.itemId]))||s.has(JSON.stringify([c.turnId,e.body]))))return null;if(e.role===`system`)return(0,z.jsx)(Te,{children:e.body},e.id);if(c?.kind===`turn`)return a.has(c.turnId)?null:(0,z.jsx)(Ee,{message:e},e.id);if(e.role===`user`)return(0,z.jsxs)(ie,{mine:!0,author:`你`,time:e.createdAt,children:[n&&e.images?.length?(0,z.jsx)(xe,{images:e.images,url:n}):null,(0,z.jsx)(`div`,{className:`markdown`,children:(0,z.jsx)(F,{children:e.body})}),e.queue&&r?r(e):V[e.state]&&(0,z.jsx)(ne,{label:V[e.state],state:e.state})]},e.id);if(c?.kind===`tool`)return(0,z.jsxs)(`details`,{className:`computer-tool`,children:[(0,z.jsxs)(`summary`,{title:c.label,children:[(0,z.jsx)(h,{name:`chevron`,size:`small`}),(0,z.jsx)(`span`,{className:`computer-tool-label`,children:c.label??`工具调用`}),(0,z.jsxs)(`span`,{className:`computer-tool-status`,children:[e.state===`running`?`进行中`:e.state===`failed`?`失败`:e.state===`interrupted`?`已停止`:e.state===`uncertain`?`需核对`:``,c.durationMs!==void 0&&(0,z.jsx)(`span`,{children:we(c.durationMs)})]})]}),(0,z.jsx)(`pre`,{children:e.body})]},e.id);let l=c?.kind===`answer`&&a.get(c.turnId)===e.id?i.get(c.turnId):void 0;return(0,z.jsxs)(R.Fragment,{children:[l&&(0,z.jsx)(Ee,{message:l}),(0,z.jsx)(`article`,{className:`computer-agent-message ${c?.kind===`commentary`?`computer-commentary`:``} ${e.question?`question-bubble`:``}`,children:e.question?t(e.question):(0,z.jsx)(`div`,{className:`markdown`,children:(0,z.jsx)(F,{children:e.body})})})]},e.id)})})}function Oe({disabled:e,onSend:t,initialValue:n=``,placeholder:r}){let[i,a]=(0,R.useState)(n),[o,s]=(0,R.useState)(!!n),c=`其他回答`,l=(0,R.useRef)(null),u=(0,R.useCallback)(e=>{if(!l.current)return;let t=document.createElement(`canvas`).getContext(`2d`);if(!t)return;t.font=getComputedStyle(e).font;let n=Math.max(...(i||`${c}…`).split(`
|
|
3
|
+
`).map(e=>t.measureText(e).width));l.current.style.setProperty(`--reply-width`,`${Math.ceil(n+(o?52:26))}px`)},[i,o,c]),d=ae(i,u);return(0,z.jsxs)(`form`,{ref:l,className:`inline-reply${o?` active`:``}`,onFocus:()=>s(!0),onBlur:e=>{!i&&!e.currentTarget.contains(e.relatedTarget)&&s(!1)},onSubmit:n=>{n.preventDefault(),!e&&i.trim()&&t(i.trim()).then(e=>{e&&a(``)})},children:[(0,z.jsx)(`textarea`,{ref:d,rows:1,"aria-label":`自定义回答`,placeholder:r??`${c}…`,value:i,disabled:e,onChange:e=>a(e.target.value),onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&!t.nativeEvent.isComposing&&(t.preventDefault(),!e&&i.trim()&&t.currentTarget.form?.requestSubmit())}}),o&&(0,z.jsx)(`button`,{className:`inline-reply-send`,type:`submit`,disabled:e||!i.trim(),"aria-label":`发送${c}`,title:`发送${c}`,children:(0,z.jsx)(h,{name:`send`,size:`small`})})]})}function ke({question:e,session:t,request:r,refresh:i}){let[a,o]=(0,R.useState)({}),[s,c]=(0,R.useState)({}),[l,u]=(0,R.useState)(``),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)(!1),[g,_]=(0,R.useState)(``),v=(0,R.useRef)(null),x=(0,R.useRef)(!1),C=(0,R.useRef)(void 0);(0,R.useEffect)(()=>{if(e.state!==`pending`||x.current||!v.current)return;let n=!1,i=()=>{if(!n||document.visibilityState!==`visible`||!v.current)return;let i=v.current.getBoundingClientRect();i.bottom>0&&i.top<innerHeight&&r(`web/local-agent-sessions/${t}/questions/${e.id}/presented`,S({ok:y()}),{method:`POST`}).then(()=>{x.current=!0}).catch(e=>u(E(e)))},a=new IntersectionObserver(e=>{n=e.some(e=>e.isIntersecting),i()});return a.observe(v.current),document.addEventListener(`visibilitychange`,i),()=>{a.disconnect(),document.removeEventListener(`visibilitychange`,i)}},[e.id,e.state,t,r]);async function w(a){let o=JSON.stringify(a);C.current?.fingerprint!==o&&(C.current={fingerprint:o,value:{...a,id:b()}}),f(!0),u(``);try{return await r(`web/local-agent-sessions/${t}/questions/${e.id}/answers`,n(),{method:`POST`,body:C.current.value}),C.current=void 0,i(),!0}catch(e){return u(E(e)),!1}finally{f(!1)}}let T=e.response,D=e.state===`answered`,O=[`expired`,`cancelled`].includes(e.state),k=[`human_routed`,`failed`,`handled`].includes(e.submissionState??``)&&!D,j=e.state===`pending`&&(!T||k),M=e.kind===`plan`,N=e.actions?.find(e=>e.id===T?.actionId),P=O?`已过期`:e.state===`uncertain`||e.submissionState===`uncertain`?`需核对`:D?M?N?.label??`已处理`:e.approval?T?.decision===!0?`已允许`:T?.decision===!1?`已拒绝`:`已处理`:N?N.label:T?``:`已回答`:k?`请重新提交`:T?`正在提交`:``,ee=O||T?.decision===!1||k?`close`:D?`check`:`clock`,I=e.questions.length>1||e.questions.some(e=>e.multiSelect),te=(t=a)=>w({body:e.questions.length===1?t[e.questions[0].id]||(s[e.questions[0].id]??[]).join(`、`):JSON.stringify(t),...e.kind||e.questions.some(e=>e.multiSelect)?{answers:t}:{},...e.questions.some(e=>e.multiSelect)?{selections:s}:{}});return(0,z.jsxs)(`div`,{className:`native-question ${M?`native-plan`:``}`,ref:v,children:[M?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`native-plan-heading`,children:[(0,z.jsx)(h,{name:`file`,size:`small`}),(0,z.jsx)(`span`,{children:`实施计划`})]}),j?(0,z.jsx)(`div`,{className:`native-plan-content markdown`,children:(0,z.jsx)(F,{children:e.plan??``})}):(0,z.jsxs)(`details`,{className:`native-plan-history markdown`,children:[(0,z.jsx)(`summary`,{children:`查看计划`}),(0,z.jsx)(F,{children:e.plan??``})]}),j&&(0,z.jsxs)(z.Fragment,{children:[!p&&(0,z.jsx)(`div`,{className:`question-actions native-plan-actions ${e.actions&&e.actions.length>3?`native-plan-actions-expanded`:``}`,children:e.actions?.map(e=>(0,z.jsx)(`button`,{type:`button`,disabled:d,title:e.description,className:e.id===`implement`?`primary`:``,onClick:()=>e.id===`revise`?m(!0):void w({body:e.label,actionId:e.id}),children:e.label},e.id))}),!p&&e.actions?.find(e=>e.id===`implement`)?.description&&(0,z.jsxs)(`small`,{className:`native-plan-note muted`,children:[`开始实施:`,e.actions.find(e=>e.id===`implement`).description]}),p&&(0,z.jsxs)(`form`,{className:`native-plan-feedback`,onSubmit:e=>{e.preventDefault(),w({body:g,actionId:`revise`})},children:[(0,z.jsxs)(`label`,{children:[`修改意见`,(0,z.jsx)(`textarea`,{autoFocus:!0,value:g,onChange:e=>_(e.target.value),placeholder:`说明希望调整的部分,Agent 将修改后再次请求确认`})]}),(0,z.jsxs)(`div`,{className:`question-actions native-plan-feedback-actions`,children:[(0,z.jsx)(`button`,{className:`primary`,disabled:d||!g.trim(),children:`提交修改意见`}),(0,z.jsx)(`button`,{type:`button`,disabled:d,onClick:()=>m(!1),children:`返回计划`})]})]})]}),!j&&T?.actionId===`revise`&&T.answers.feedback&&(0,z.jsx)(`div`,{className:`question-response`,children:T.answers.feedback})]}):(0,z.jsxs)(z.Fragment,{children:[e.questions.map(t=>(0,z.jsxs)(`div`,{className:`native-question-part`,children:[(0,z.jsx)(`p`,{className:e.approval?`native-approval-detail`:``,children:t.text}),j&&(0,z.jsx)(`div`,{className:`question-options ${e.approval?`native-approval-options`:Object.values(t.descriptions??{}).some(Boolean)?`question-options-described`:``}`,children:(e.approval?[`允许`,`拒绝`]:t.options).map(n=>(0,z.jsxs)(`button`,{type:`button`,disabled:d,"aria-pressed":t.multiSelect?s[t.id]?.includes(n)??!1:a[t.id]===n,onClick:()=>{if(t.multiSelect){c(e=>({...e,[t.id]:e[t.id]?.includes(n)?e[t.id].filter(e=>e!==n):[...e[t.id]??[],n]}));return}let r={...a,[t.id]:n};o(r),e.approval?w({body:n,decision:n===`允许`}):I||te(r)},children:[(0,z.jsxs)(`span`,{className:`question-option-label`,children:[t.multiSelect&&(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`question-check`,children:s[t.id]?.includes(n)&&(0,z.jsx)(h,{name:`check`,size:`small`})}),n]}),t.descriptions?.[n]&&(0,z.jsx)(`small`,{children:t.descriptions[n]})]},n))}),!e.approval&&t.freeText&&j&&(0,z.jsx)(Oe,{initialValue:t.initialValue,placeholder:t.placeholder,disabled:d,onSend:async e=>{let n={...a,[t.id]:e};return o(n),I?!0:te(n)}}),j&&I&&a[t.id]&&!t.options.includes(a[t.id])&&(0,z.jsx)(`small`,{children:a[t.id]}),!j&&!e.approval&&(T?.answers[t.id]||T?.selections?.[t.id]?.length)&&(0,z.jsxs)(`div`,{className:`question-response`,children:[(0,z.jsx)(h,{name:D?`check`:`clock`,size:`small`}),(0,z.jsx)(`span`,{children:[...T.selections?.[t.id]??[],T.answers[t.id]].filter(Boolean).join(`、`)})]})]},t.id)),j&&!e.approval&&e.actions?.length&&(0,z.jsx)(`div`,{className:`question-actions`,children:e.actions.map(e=>(0,z.jsx)(`button`,{disabled:d,onClick:()=>void w({body:e.label,actionId:e.id}),children:e.label},e.id))}),j&&!e.approval&&I&&(0,z.jsx)(`div`,{className:`question-actions`,children:(0,z.jsx)(`button`,{disabled:d||e.questions.some(e=>!a[e.id]?.trim()&&!s[e.id]?.length),onClick:()=>void te(),children:`回答`})}),j&&e.approval&&e.autoApprove!==!1&&(0,z.jsx)(`small`,{className:`muted`,children:`60 秒后自动允许`})]}),P&&(0,z.jsxs)(`small`,{className:`question-result`,children:[(0,z.jsx)(h,{name:ee,size:`small`}),P]}),(0,z.jsx)(A,{error:!0,children:l})]})}var H={minimal:`极低`,low:`低`,medium:`中`,high:`高`,xhigh:`极高`,max:`最高`,ultra:`极致`,none:`无`,off:`关闭`};function U({id:e,label:t,current:n,options:r,disabled:i,onSelect:a}){let o=r.find(e=>e.value===n);return(0,z.jsx)(C,{id:`${e}-menu`,triggerId:e,placement:`top`,className:`composer-menu composer-choice`,label:`选择${t}`,disabled:i,routeKey:n,trigger:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{title:`${t}:${o?.label??n}`,children:o?.shortLabel??o?.label??n}),(0,z.jsx)(h,{name:`chevronDown`,size:`small`})]}),children:e=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`composer-menu-heading`,children:t}),r.map(t=>(0,z.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-label":t.label,onClick:()=>{e(),a(t.value)},children:[(0,z.jsxs)(`span`,{className:`composer-option-copy`,children:[(0,z.jsx)(`span`,{children:t.label}),t.description&&(0,z.jsx)(`small`,{children:t.description})]}),t.value===n&&(0,z.jsx)(h,{name:`check`,size:`small`})]},t.value))]})})}function Ae({session:e,models:t,busy:n,available:r,online:i,commands:a,controls:o,draft:s,onInsert:l,onConfig:u}){let[d,f]=(0,R.useState)(!1);(0,R.useEffect)(()=>{/^[/$]([^\s]*)$/.exec(s)?f(!0):f(!1)},[s]);let p=e.config.model??e.effectiveConfig?.model,m=t.find(e=>e.id===p||e.resolvedModel===p)??(e.config.model?void 0:t.find(e=>e.isDefault)),g=n||!r,_=e.provider===`claude`,v=e.provider===`cursor`,y=e.provider===`pi`,b=o??c(e.provider),x=m?.effortLabel??`思考强度`,S=e=>m?.effortLabel?e:H[e]??e,w=e.appliedRevision===e.revision?e.effectiveConfig?.mode:void 0,T=t.find(e=>e.isDefault)?.id??(e.config.model?null:e.effectiveConfig?.model),E=t.find(e=>e.id===T)?.name??T,D=e=>_?e.replace(/^Claude\s+/,``):e,O=[{value:``,label:E?`默认 · ${E}`:t.length?`默认模型`:`模型未获取`,shortLabel:E?D(E):t.length?`默认模型`:`模型`},...t.map(e=>({value:e.id,label:e.name,shortLabel:D(e.name)}))];e.config.model&&!t.some(t=>t.id===e.config.model)&&O.push({value:e.config.model,label:e.config.model,shortLabel:D(e.config.model)});let k=m?.id===e.effectiveConfig?.model?e.effectiveConfig?.effort:m?.defaultEffort,A=[{value:``,label:k?`默认 · ${S(k)}`:`默认${x}`,shortLabel:k?S(k):m?.effortLabel??`强度`},...(m?.efforts??[]).map(e=>({value:e,label:S(e)}))];return e.config.effort&&!A.some(t=>t.value===e.config.effort)&&A.push({value:e.config.effort,label:S(e.config.effort)}),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(C,{id:`session-commands`,triggerId:`session-command-trigger`,label:`命令与 Skills`,placement:`top`,className:`composer-menu composer-commands`,routeKey:e.id,trigger:(0,z.jsx)(h,{name:`command`,size:`small`}),open:d,onOpenChange:f,focusFirst:!1,disabled:g||!i,children:e=>(0,z.jsxs)(z.Fragment,{children:[[...a].sort((e,t)=>e.name.localeCompare(t.name,`en`)).map(t=>(0,z.jsx)(`button`,{type:`button`,role:`menuitem`,title:[t.description,t.path].filter(Boolean).join(`
|
|
4
|
+
`),onClick:()=>{e(),l(t)},children:(0,z.jsxs)(`span`,{className:`composer-command-row`,children:[(0,z.jsxs)(`span`,{className:`composer-command-name`,children:[t.prefix??(t.kind===`skill`?`$`:`/`),t.name]}),(0,z.jsx)(`small`,{children:t.description})]})},`${t.kind}:${t.path??t.name}`)),!a.length&&(0,z.jsx)(`div`,{className:`composer-menu-heading`,children:`尚未获取命令`})]})}),(0,z.jsx)(U,{id:`session-model`,label:`模型`,current:e.config.model??``,options:O,disabled:g,onSelect:n=>{let r=t.find(e=>e.id===n);u({...e.config,model:n||null,...v?{options:{}}:{},effort:e.config.effort&&r?.efforts.includes(e.config.effort)?e.config.effort:null})}}),(!v&&!y&&e.provider!==`opencode`||(m?.efforts.length??0)>0||!!e.config.effort)&&(0,z.jsx)(U,{id:`session-effort`,label:x,current:e.config.effort??``,options:A,disabled:g,onSelect:t=>u({...e.config,effort:t||null})}),m?.options?.map(t=>(0,z.jsx)(U,{id:`session-option-${t.id}`,label:t.name,current:e.config.options?.[t.id]??``,options:[{value:``,label:`默认 · ${t.choices.find(e=>e.value===t.defaultValue)?.label??t.defaultValue}`},...t.choices],disabled:g,onSelect:n=>{let r={...e.config.options};n?r[t.id]=n:delete r[t.id],u({...e.config,options:r})}},t.id)),b.map(t=>(0,z.jsx)(U,{id:t.key===`mode`&&!_?`session-mode`:`session-permission`,label:t.label,current:t.key===`mode`?w??e.config.mode??t.defaultValue:e.config.permission,options:t.choices,disabled:g,onSelect:n=>u(t.key===`mode`?{...e.config,mode:n||void 0}:{...e.config,permission:n})},t.key))]})}var je=S({taskRoot:P().nullable().default(null),online:y(),computer:S({id:P(),name:P(),platform:P()}).nullable(),capabilities:w(P()),models:w(O),providers:w(e).default([]),catalogs:w(u).default([]),directories:w(p),sessions:w(a)}),Me=S({ok:y()}),Ne={idle:`空闲`,working:`工作中`,waiting:`等待回答`,queued:`等待执行`,uncertain:`需要核对`,human:`人工处理`,offered:`待本地接收`,accepted:`本地已接手`,human_routed:`未送达本地`,pending:`待投递`,sent:`已发送`,succeeded:`已完成`,running:`进行中`,failed:`失败`};function Pe(){let{request:e}=N(),n=(0,R.useCallback)(n=>e(`web/local-agent-settings`,t,{signal:n}),[e]),r=f(n,3e4);return r.error?(0,z.jsx)(A,{error:!0,children:r.error}):r.data?r.data.accessible?(0,z.jsx)(W,{}):(0,z.jsx)(g,{title:`本项目暂未向你开放本地 Agent 功能`}):null}function W(){let e=N(),[t,r]=(0,R.useState)(()=>new Set),[i,o]=(0,R.useState)(()=>({project:e.projectId,directory:new URLSearchParams(location.search).get(`directory`)??``,session:new URLSearchParams(location.search).get(`session`)??``})),[c,u]=(0,R.useState)(``),[p,g]=(0,R.useState)(!1),[y,S]=(0,R.useState)(!1),[w,T]=(0,R.useState)(!1),[D,O]=(0,R.useState)(!1),[j,P]=(0,R.useState)(``),[F,ie]=(0,R.useState)(``),[ae,L]=(0,R.useState)(!1),[B,ce]=(0,R.useState)(`codex`),[de,fe]=(0,R.useState)(`codex`),[pe,he]=(0,R.useState)(!1),[_e,ve]=(0,R.useState)(``),[xe,we]=(0,R.useState)(null),[Te,Ee]=(0,R.useState)(Date.now);(0,R.useEffect)(()=>{let e=setInterval(()=>Ee(Date.now()),6e4);return()=>clearInterval(e)},[]);let V=(0,R.useRef)(null),Oe=(0,R.useRef)(!0),H=(0,R.useRef)(void 0),U=(0,R.useRef)(b()),Pe=(0,R.useCallback)(async t=>[{...await e.request(`web/local-agent-computer`,je,{signal:t}),project:e.projectId}],[e]),W=f(Pe,3e3),G=W.data?.find(e=>e.project===i.project),K=G?.directories.find(e=>e.id===i.directory);x(i.project);let q=(0,R.useCallback)((e,t,n)=>x(i.project).request(e,t,n),[i.project]),J=Se(i.session,i.project,q),Re=(0,R.useCallback)(e=>i.session?q(`web/local-agent-sessions/${i.session}`,m,{signal:e}):Promise.resolve(null),[q,i.session]),Y=f(Re,15e3),[ze,Be]=(0,R.useState)(),X=ze?.session.id===i.session&&(!Y.data||ze.cursor>=Y.data.cursor)?ze:Y.data;(0,R.useEffect)(()=>{if(!i.session)return;let e=new EventSource(d(`/api/v1/projects/${encodeURIComponent(i.project)}/web/local-agent-sessions/${encodeURIComponent(i.session)}/events`)),t=!0;return e.addEventListener(`snapshot`,e=>{try{let n=m.parse(JSON.parse(e.data));t&&Be(e=>e?.session.id===n.session.id&&e.cursor>n.cursor?e:n)}catch(e){u(E(e))}}),()=>{t=!1,e.close()}},[i.project,i.session]),(0,R.useEffect)(()=>{Oe.current=!0},[i.project,i.session]),(0,R.useEffect)(()=>{Oe.current&&V.current&&(V.current.scrollTop=V.current.scrollHeight)},[X?.cursor,X?.messages.length]);let Z=X?.session,Q=G?.capabilities.includes(`local-sessions-v1`),Ve=(t,n,r=``)=>{o({project:t,directory:n,session:r}),T(!1),L(!1),he(!1),ve(``),P(``),u(``);let i=new URL(location.href);i.searchParams.set(`directory`,n),r?i.searchParams.set(`session`,r):i.searchParams.delete(`session`),t===e.projectId&&history.replaceState(null,``,i)};(0,R.useEffect)(()=>{if(!i.directory&&W.data?.[0]?.directories[0]){let e=W.data[0],t=e.directories[0],n=e.sessions.find(e=>e.id===i.session);Ve(e.project,n?.directory??t.id,n?.id??t.defaultSession??e.sessions.find(e=>e.directory===t.id)?.id)}},[W.data]),(0,R.useEffect)(()=>{if(!Z)return;let e=()=>{document.visibilityState===`visible`&&q(`web/local-agent-sessions/${Z.id}/read`,Me,{method:`POST`}).catch(e=>u(E(e)))};return e(),document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[Z?.id,X?.messages.at(-1)?.seq,q]);async function $(e){g(!0),u(``);try{await e(),await Promise.all([Y.reload(),W.reload()])}catch(e){u(E(e))}finally{g(!1)}}function He(t,n){return $(()=>e.request(`web/local-agent-sessions/${t.id}/metadata`,a,{method:`PUT`,body:{expectedRevision:t.metadataRevision,...n}}))}let Ue=W.data?.find(e=>e.directories.some(e=>e.id===xe)),We=Ue?.directories.find(e=>e.id===xe),[Ge,Ke]=(0,R.useState)(null);(0,R.useEffect)(()=>Ke(null),[Z?.id]);let qe=G?.catalogs.find(e=>e.provider===(Z?.provider??`codex`)&&(Z?.cwd?e.cwd===Z.cwd:e.directory===(Z?.executionDirectory??Z?.directory))),Je=qe?.commands??[],Ye=qe?.models??G?.providers.find(e=>e.id===Z?.provider)?.models??(Z?.provider===`codex`?G?.models??[]:[]),Xe=!!(Ye.find(e=>e.id===(Z?.config.model??Z?.effectiveConfig?.model))??(Z?.config.model?void 0:Ye.find(e=>e.isDefault)))?.images&&!!G?.capabilities.includes(`local-agent-images-v1`),Ze=new Map;for(let e of W.data??[]){let t=e.computer?.id??`unknown:${e.project}`;Ze.set(t,[...Ze.get(t)??[],e])}return(0,z.jsxs)(re,{className:`computers-layout`,testId:`computers-page`,label:`本地会话`,tree:!0,navigation:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(k,{title:`电脑`,icon:`computers`,children:(0,z.jsx)(C,{id:`computer-create-menu`,triggerId:`computer-create`,label:`新建`,trigger:(0,z.jsx)(h,{name:`plus`}),className:`computer-create-menu`,routeKey:i.directory,children:e=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,role:`menuitem`,disabled:!K||!Q,onClick:()=>{e(),L(!0),ce(K?.provider??`codex`),S(!1),T(!1),u(``)},children:`新建会话`}),(0,z.jsx)(`button`,{type:`button`,role:`menuitem`,disabled:!K||!G?.online||!G.capabilities.includes(`local-agent-history-v1`),onClick:()=>{e(),he(!0),L(!1),T(!1),u(``)},children:`导入历史会话`}),(0,z.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{e(),S(!0),L(!1),T(!1)},children:`接入目录`})]})})}),(0,z.jsx)(`div`,{className:`assistant-message-scroll computer-tree`,role:`tree`,"aria-label":`电脑与会话`,onKeyDown:se,children:[...Ze.entries()].map(([e,n])=>(0,z.jsxs)(`div`,{role:`none`,children:[(0,z.jsxs)(`div`,{className:`computer-device`,children:[(0,z.jsx)(`span`,{className:`computer-connection ${n.some(e=>e.online)?`online`:``}`,role:`img`,"aria-label":n.some(e=>e.online)?`在线`:`离线`,title:n.some(e=>e.online)?`在线`:`离线`,children:(0,z.jsx)(h,{name:`device`,size:`small`})}),(0,z.jsx)(`span`,{title:n[0].computer?.name,children:n[0].computer?.name??`已连接客户端`})]}),n.map(e=>(0,z.jsx)(`div`,{role:`none`,children:e.directories.map(n=>{let a=`${e.project}/${n.id}`,o=!t.has(a);return(0,z.jsxs)(`div`,{role:`none`,children:[(0,z.jsxs)(`div`,{className:`computer-tree-row`,role:`none`,children:[(0,z.jsxs)(v,{className:`tree-item tree-folder`,role:`treeitem`,"aria-level":1,"aria-expanded":o,style:{"--tree-level":1},leading:(0,z.jsx)(`span`,{className:`tree-chevron ${o?`expanded`:``}`,children:(0,z.jsx)(h,{name:`chevron`,size:`small`})}),onClick:()=>{i.directory!==n.id&&Ve(e.project,n.id,n.defaultSession??e.sessions.find(e=>e.directory===n.id)?.id),r(e=>{let t=new Set(e);return o?t.add(a):t.delete(a),t})},children:[(0,z.jsx)(h,{name:`files`}),(0,z.jsx)(`span`,{className:`tree-name`,title:n.name,children:n.name})]}),(0,z.jsx)(_,{className:`computer-tree-action`,icon:`settings`,label:`目录设置:${n.name}`,onClick:()=>we(n.id)})]}),o&&(0,z.jsx)(`div`,{role:`group`,children:e.sessions.filter(e=>e.directory===n.id).map(t=>(0,z.jsxs)(`div`,{className:`computer-tree-row computer-session-row`,role:`none`,children:[(0,z.jsxs)(v,{className:`tree-item`,role:`treeitem`,"aria-level":2,"aria-selected":i.session===t.id&&i.project===e.project,style:{"--tree-level":2},leading:(0,z.jsx)(`span`,{className:`tree-chevron`,children:(0,z.jsx)(`span`,{className:`assistant-message-dot ${t.unread?`unread`:``}`})}),title:`${t.title} · ${l[t.provider]}`,onClick:()=>Ve(e.project,n.id,t.id),children:[(0,z.jsx)(le,{provider:t.provider}),(0,z.jsxs)(`span`,{className:`computer-session-copy`,children:[(0,z.jsx)(`span`,{className:`tree-name`,children:t.title}),(0,z.jsx)(`time`,{dateTime:t.updatedAt,title:new Date(t.updatedAt).toLocaleString(),children:me(t.updatedAt,Te)})]})]}),(0,z.jsx)(_,{icon:`pin`,className:`computer-tree-action computer-session-pin${t.pinned?` pinned`:``}`,label:`${t.pinned?`取消置顶`:`置顶`}:${t.title}`,"aria-pressed":t.pinned,title:t.pinned?`取消置顶,不再分配新工作`:`置顶,允许 Tim 分配工作`,disabled:p||t.archived,onClick:()=>void He(t,{pinned:!t.pinned})}),t.archived?(0,z.jsx)(`span`,{title:`已归档`,role:`img`,"aria-label":`已归档`,children:(0,z.jsx)(h,{name:`archive`,size:`small`})}):t.state!==`idle`&&(0,z.jsx)(ne,{state:t.state,label:Ne[t.state]??t.state})]},t.id))})]},n.id)})},e.project))]},e))}),(0,z.jsx)(A,{error:!0,children:W.error})]}),children:[We&&Ue&&(0,z.jsx)(Ie,{directory:We,entry:Ue,request:e.request,onSaved:W.reload,onClose:()=>we(null)},We.id),y&&(0,z.jsx)(s,{id:`computer-attach`,title:`接入目录`,onClose:()=>S(!1),children:(0,z.jsxs)(`div`,{className:`stack computer-panel`,children:[(0,z.jsx)(ee,{id:`computer-connect`,label:`在目标电脑连接项目`,value:`teammy connect`}),(0,z.jsx)(ue,{value:de,onChange:fe}),(0,z.jsx)(ee,{id:`computer-register`,label:`在该电脑登记执行目录`,value:`teammy agent register --provider ${de} --cwd .`}),(0,z.jsx)(`p`,{className:`muted`,children:`完成登记后自动显示。会话可直接在网页使用,也可连接专用群。`})]})}),K?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(te,{title:Z?(0,z.jsx)(Le,{title:Z.title,busy:p,onSave:e=>He(Z,{title:e})},Z.id):(0,z.jsx)(`h2`,{children:K.name}),actions:(0,z.jsxs)(z.Fragment,{children:[G?.capabilities.includes(`local-agent-diff-v1`)&&(0,z.jsx)(_,{icon:`files`,label:`查看工作目录改动`,disabled:!Z||!G.online,onClick:()=>O(!0)}),(0,z.jsx)(C,{id:`computer-session-menu`,triggerId:`computer-session-actions`,label:`会话操作`,trigger:(0,z.jsx)(h,{name:`more`}),className:`computer-create-menu`,routeKey:Z?.id??``,disabled:!Z,children:e=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{role:`menuitem`,disabled:p||Z?.archived,onClick:()=>{e(),Z&&He(Z,{default:K.defaultSession!==Z.id})},children:K.defaultSession===Z?.id?`取消默认会话`:`设为默认会话`}),(0,z.jsx)(`button`,{role:`menuitem`,onClick:()=>{e(),T(`group`)},children:`连接专用群`}),(0,z.jsx)(`button`,{role:`menuitem`,onClick:()=>{e(),T(`location`)},children:`执行位置`})]})})]})}),D&&Z&&(0,z.jsx)(ye,{session:Z.id,request:q,onClose:()=>O(!1)},Z.id),!Q&&(0,z.jsx)(A,{children:`升级客户端后可使用多个会话和网页对话。`}),pe&&G&&(0,z.jsx)(ge,{directory:K.id,provider:K.provider,providers:G.providers.map(e=>e.id),sessions:G.sessions,request:q,onClose:()=>he(!1),onImport:e=>{Ve(i.project,e.directory,e.id),W.reload()}}),ae&&(0,z.jsx)(s,{id:`computer-new-session`,title:`新建会话`,onClose:()=>L(!1),children:(0,z.jsxs)(`form`,{className:`computer-panel stack`,onSubmit:e=>{e.preventDefault(),$(async()=>{let e=await q(`web/local-agents/${K.id}/sessions`,a,{method:`POST`,body:{id:U.current,title:F,provider:B}});U.current=b(),L(!1),ie(``),Ve(i.project,K.id,e.id)})},children:[(0,z.jsxs)(`label`,{children:[`会话名称`,(0,z.jsx)(`input`,{autoFocus:!0,required:!0,placeholder:`会话名称`,value:F,onChange:e=>ie(e.target.value)})]}),(0,z.jsx)(ue,{value:B,onChange:ce,disabled:p,disabledProviders:M.options.filter(e=>e===`codex`?!1:e===`claude`?!G?.capabilities.includes(`local-agent-providers-v1`):!G?.providers.some(t=>t.id===e))}),G?.providers.find(e=>e.id===B)?.error&&(0,z.jsx)(A,{children:G.providers.find(e=>e.id===B).error}),(0,z.jsx)(A,{error:!0,children:c}),(0,z.jsx)(`button`,{disabled:p||!F.trim(),children:`创建`})]})}),w&&Z&&G&&(0,z.jsx)(s,{id:`computer-settings`,title:w===`location`?`执行位置`:`连接专用群`,onClose:()=>T(!1),children:(0,z.jsx)(Fe,{section:w,session:Z,directory:K,entry:G,request:q,busy:p,save:$,code:_e,setCode:ve},`${Z.id}:${Z.revision}`)}),(0,z.jsxs)(I,{ref:V,onScroll:e=>{let t=e.currentTarget;Oe.current=t.scrollHeight-t.scrollTop-t.clientHeight<96},"aria-label":`本地会话记录`,children:[(0,z.jsx)(De,{messages:X?.messages??[],imageUrl:e=>be(i.project,Z.id,e),renderQueue:e=>(0,z.jsx)(Ce,{message:e,session:Z.id,request:q,refresh:Y.reload}),renderQuestion:e=>(0,z.jsx)(ke,{question:e,session:Z.id,request:q,refresh:Y.reload})}),!X?.messages.length&&(0,z.jsx)(`div`,{className:`assistant-empty`,children:Z?.resumeSession?`已接入原生会话,发送消息继续。`:`在当前目录开始一段对话。`})]}),X?.commands.filter(e=>e.state!==`succeeded`&&![`diff`,`history`].includes(e.kind)).slice(-3).map(e=>(0,z.jsxs)(`p`,{className:`computer-control-status`,role:`status`,children:[e.kind,` · `,Ne[e.state]??e.state,e.error?`:${e.error}`:``]},e.id)),(0,z.jsx)(A,{error:!0,children:c||Y.error||Z?.error}),Z&&(0,z.jsx)(oe,{value:j,onChange:P,label:`向本地 Agent 发送消息`,sendLabel:G?.capabilities.includes(`local-agent-queue-v1`)&&[`working`,`waiting`].includes(Z.state)?`加入队列`:`发送`,placeholder:Z.archived?`会话已归档`:`输入消息…`,disabled:Z.archived||!Q,sendDisabled:p||J.busy||J.images.length>0&&!Xe,attachments:(0,z.jsxs)(z.Fragment,{children:[J.preview(p),J.images.length>0&&!Xe&&(0,z.jsx)(A,{children:`当前模型不支持图片,请切换模型或移除图片。`})]}),hasAttachments:J.images.length>0,onFiles:Xe&&!p?e=>void J.add(e):void 0,actions:(0,z.jsxs)(z.Fragment,{children:[Xe&&J.picker(p||!Q),(0,z.jsx)(Ae,{session:Z,models:Ye,busy:p,available:!!Q,online:!!G?.online,commands:Je,controls:qe?.controls,draft:j,onInsert:e=>{Ke(e.kind===`skill`?e:null),P(`${e.prefix??(e.kind===`skill`?`$`:`/`)}${e.name} `),requestAnimationFrame(()=>document.querySelector(`.message-composer textarea`)?.focus())},onConfig:e=>{T(!1),$(()=>q(`web/local-agent-sessions/${Z.id}/settings`,a,{method:`PUT`,body:{expectedRevision:Z.revision,config:e}}))}})]}),onSubmit:e=>{e.preventDefault();let t=j.trim();if(!t&&!J.images.length)return;let r=J.images.map(e=>e.id),i=Ge?.path&&t.startsWith(`$${Ge.name}`)?[{name:Ge.name,path:Ge.path}]:void 0,a=JSON.stringify({session:Z.id,body:t,skills:i,images:r});H.current?.fingerprint!==a&&(H.current={fingerprint:a,id:b()});let o=H.current;$(async()=>{await q(`web/local-agent-sessions/${Z.id}/messages`,n(),{method:`POST`,body:{id:o.id,body:t,...r.length?{images:r}:{},...i?{skills:i}:{}}}),P(e=>e.trim()===t?``:e),Ke(null),J.clear(),H.current===o&&(H.current=void 0)})}})]}):(0,z.jsxs)(`div`,{className:`assistant-empty`,children:[`尚未登记本地执行目录。`,(0,z.jsx)(`button`,{onClick:()=>S(!0),children:`接入目录`})]})]})}function Fe({session:e,section:t,directory:n,entry:r,request:i,busy:o,save:s,code:c,setCode:l}){let[u,d]=(0,R.useState)(e.executionDirectory);return(0,z.jsx)(`div`,{className:`computer-panel stack`,children:t===`location`?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`div`,{className:`config-fields`,children:(0,z.jsxs)(`label`,{children:[`执行位置`,(0,z.jsxs)(`select`,{value:u??``,onChange:e=>d(e.target.value||null),children:[(0,z.jsx)(`option`,{value:``,children:`原登记目录`}),r.directories.filter(e=>e.id!==n.id).map(e=>(0,z.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})}),e.cwd&&(0,z.jsxs)(`p`,{className:`computer-paths`,children:[`当前执行路径:`,(0,z.jsx)(`code`,{children:e.cwd})]}),(0,z.jsx)(`button`,{disabled:o,onClick:()=>void s(()=>i(`web/local-agent-sessions/${e.id}/settings`,a,{method:`PUT`,body:{expectedRevision:e.revision,config:e.config,executionDirectory:u}})),children:`保存执行位置`})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{disabled:o||e.bound,onClick:()=>void s(async()=>{l((await i(`web/local-agent-bindings/codes`,S({code:P()}),{method:`POST`,body:{directory:n.id,session:e.id,expectedRevision:e.bindingRevision}})).code)}),children:e.bound?`已连接专用群`:`连接专用群`}),c&&(0,z.jsx)(ee,{id:`session-binding`,label:`在目标群发送`,value:`/bind ${c}`})]})})}function Ie({directory:e,entry:n,request:r,onSaved:i,onClose:a}){let{projectId:o}=N(),[c,l]=(0,R.useState)(e),[u,f]=(0,R.useState)(!1),[m,h]=(0,R.useState)(``),[g,_]=(0,R.useState)();(0,R.useEffect)(()=>{l(t=>e.revision>t.revision?e:t)},[e]),(0,R.useEffect)(()=>{r(`web/local-agent-settings`,t).then(_).catch(e=>h(E(e)))},[r]);async function v(e){f(!0),h(``);try{let t=await r(`web/local-agents/${c.id}/settings`,p,{method:`PUT`,body:{...e,expectedRevision:c.revision}});l(t),await i()}finally{f(!1)}}let y=n.catalogs.find(e=>e.directory===c.id)?.cwd;return(0,z.jsx)(s,{id:`computer-directory-settings`,label:`目录设置`,title:(0,z.jsx)(B,{value:c.name,label:`目录名称`,maxLength:80,disabled:u,onSave:e=>v({name:e})}),onClose:a,children:(0,z.jsxs)(`div`,{className:`computer-directory-details`,children:[(0,z.jsxs)(`p`,{className:`computer-paths`,children:[`目录:`,y?(0,z.jsx)(`code`,{children:y}):`等待客户端提供路径`]}),(0,z.jsxs)(`section`,{className:`computer-directory-purpose`,children:[(0,z.jsx)(`span`,{className:`muted`,children:`职责`}),(0,z.jsx)(B,{value:c.responsibilities,label:`职责`,placeholder:`添加目录职责`,multiline:!0,maxLength:2e3,disabled:u,onSave:e=>v({responsibilities:e})})]}),(0,z.jsxs)(`div`,{className:`computer-directory-intake`,children:[(0,z.jsx)(`span`,{children:`接收 Tim 转交`}),(0,z.jsx)(`button`,{type:`button`,role:`switch`,"aria-label":`接收 Tim 转交`,"aria-checked":c.enabled,className:`toggle-switch`,disabled:u||!g||!c.enabled&&!g.enabled,onClick:()=>void v({enabled:!c.enabled}).catch(e=>h(E(e))),children:(0,z.jsx)(`span`,{})})]}),g&&!g.enabled&&(0,z.jsxs)(`p`,{className:`muted`,children:[`项目尚未允许转交,请在`,(0,z.jsx)(`a`,{href:d(`/projects/${o}/settings?tab=connect`),children:`项目设置`}),`中开启。`]}),g?.enabled&&!c.available&&c.enabled&&c.reason&&(0,z.jsx)(`p`,{className:`muted`,children:c.reason}),(0,z.jsx)(A,{error:!0,children:m})]})})}function Le({title:e,busy:t,onSave:n}){let[r,i]=(0,R.useState)(!1),[a,o]=(0,R.useState)(e);return r?(0,z.jsx)(`form`,{className:`session-title-form`,onSubmit:t=>{t.preventDefault(),a.trim()&&a.trim()!==e&&n(a.trim()),i(!1)},children:(0,z.jsx)(`input`,{autoFocus:!0,"aria-label":`会话标题`,value:a,disabled:t,onChange:e=>o(e.target.value),onBlur:()=>i(!1),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),i(!1))}})}):(0,z.jsx)(`h2`,{children:(0,z.jsx)(`button`,{type:`button`,className:`session-rename`,title:`重命名会话`,"aria-label":`重命名会话:${e}`,onClick:()=>{o(e),i(!0)},children:e})})}export{Pe as Computers};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.inline-edit{min-width:0;display:block}.inline-edit-value{border-radius:var(--radius-sm);min-height:0;font:inherit;color:inherit;text-align:left;overflow-wrap:anywhere;white-space:pre-wrap;background:0 0;border:0;max-width:100%;padding:0}.inline-edit-value:hover{color:var(--color-muted);background:0 0}.inline-edit-value.empty{color:var(--color-muted)}.inline-edit-fields{align-items:center;gap:6px;display:flex}.inline-edit-fields input,.inline-edit-fields textarea{min-width:0;font:inherit;flex:1}.inline-edit-actions{flex-shrink:0;display:flex}.inline-edit.multiline .inline-edit-fields{flex-direction:column;align-items:stretch}.inline-edit.multiline .inline-edit-actions{align-self:flex-end}.inline-edit-error{font-size:var(--text-sm);color:var(--color-danger);margin-top:6px;font-weight:400;display:block}.agent-logo{object-fit:contain;flex-shrink:0;width:24px;height:24px;padding:1px;display:block}.combobox-field{position:relative}.combobox-field input{text-overflow:ellipsis;padding-right:44px}.combobox-field .icon-button{color:var(--color-muted);position:absolute;top:50%;right:6px;transform:translateY(-50%)}.combobox-popup{z-index:10;border:1px solid var(--color-line);border-radius:var(--radius-md);background:var(--color-surface);box-shadow:var(--shadow-menu);flex-direction:column;padding:5px;display:flex;position:fixed}.combobox-popup [role=listbox]{min-height:0;overflow:auto}button.combobox-option{border-radius:var(--radius-sm);text-align:left;border:0;gap:12px;width:100%;min-height:42px;padding:8px 10px;font-weight:400}.combobox-option.active,.combobox-option[aria-selected=true]{background:var(--color-hover)}.combobox-option-copy{flex-direction:column;flex:1;min-width:0;display:flex}.combobox-option-copy>*{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.combobox-option-copy small,.combobox-option-detail,.combobox-message{color:var(--color-muted);font-size:var(--text-xs)}.combobox-option-detail{flex-shrink:0}.combobox-message{margin:0;padding:10px}.combobox-footer{justify-content:flex-end;align-items:center;gap:8px;padding:4px 4px 0;display:flex}.native-history{flex-direction:column;gap:20px;display:flex}.native-history-input-row{align-items:center;gap:10px;display:flex}.native-history>small{font-size:var(--text-xs)}button.native-history-more{min-height:30px;font-size:var(--text-xs);color:var(--color-muted);border:0;padding:3px 8px}.native-history-input-row .combobox{flex:1;min-width:0}#workspace-diff{width:min(900px,100vw - 32px);max-width:calc(100vw - 32px)}.workspace-diff{grid-template-columns:minmax(0,1fr);gap:12px;min-width:0;display:grid}.workspace-diff p{margin:0}.workspace-diff-toolbar,.workspace-diff summary{justify-content:space-between;align-items:center;gap:16px;display:flex}.workspace-diff summary{cursor:pointer;padding:10px 0;font-size:13px}.workspace-diff summary span,.workspace-diff-path{overflow-wrap:anywhere}.workspace-diff summary small{white-space:nowrap;color:var(--color-muted)}.workspace-diff pre{background:var(--color-surface);border:1px solid var(--color-line);border-radius:6px;max-height:50vh;margin:0;padding:10px;font-size:12px;line-height:1.6;overflow:auto}.workspace-diff pre span{min-width:100%;display:block}.diff-added{color:#247944;background:#2a91531f}.diff-removed{color:#ac3434;background:#be3a3a1a}.diff-hunk{color:#566e9a}.session-images{flex-wrap:wrap;gap:8px;padding:6px 0;display:flex}.session-image{position:relative}.session-image img{object-fit:cover;border:1px solid var(--color-line);border-radius:8px;width:112px;height:88px;display:block}.session-image button{background:var(--color-surface);border-radius:50%;width:24px;height:24px;padding:3px;position:absolute;top:4px;right:4px}.session-image-file{display:none}.queued-message{flex-wrap:wrap;align-items:center;gap:8px;margin-top:5px;display:flex}.queued-message-actions{gap:8px;display:flex}.queued-message-actions button{min-height:26px;padding:2px 8px;font-size:12px}.queued-message-editor{gap:8px;width:100%;display:grid}.queued-message-editor textarea{resize:vertical;width:100%;min-height:80px}.computer-messages{width:100%;max-width:820px;margin:0 auto}.computer-agent-message{overflow-wrap:anywhere;min-width:0;margin:24px 0}.computer-agent-message .markdown{font-size:var(--text-base);line-height:1.8}.computer-agent-message .markdown>:first-child{margin-top:0}.computer-agent-message .markdown>:last-child{margin-bottom:0}.computer-agent-message .markdown :is(h1,h2){font-size:18px}.computer-agent-message .markdown :is(h3,h4,h5,h6){font-size:var(--text-base)}.computer-agent-message .markdown pre{max-width:100%;overflow-x:auto}.computer-commentary{margin:20px 0}.computer-divider{color:var(--color-muted);font-size:var(--text-xs);text-align:center;align-items:center;gap:14px;margin:28px 0;line-height:1.6;display:flex}.computer-divider:before,.computer-divider:after{content:"";border-top:1px solid var(--color-line);flex:1;min-width:16px}.computer-divider>span{overflow-wrap:anywhere;max-width:80%}.computer-tool{min-width:0;color:var(--color-muted);font-size:var(--text-sm);margin:10px 0}.computer-tool>summary{cursor:pointer;align-items:center;gap:8px;min-height:32px;padding:6px 0;list-style:none;display:flex}.computer-tool>summary::-webkit-details-marker{display:none}.computer-tool>summary>.icon{flex-shrink:0;width:12px;height:12px}.computer-tool[open]>summary>.icon{transform:rotate(90deg)}.computer-tool-label{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.computer-tool-status{font-size:var(--text-xs);flex-shrink:0;gap:6px;display:flex}.computer-tool pre{border-left:1px solid var(--color-line);background:var(--color-soft);border-radius:0 var(--radius-sm) var(--radius-sm) 0;white-space:pre-wrap;overflow-wrap:anywhere;max-height:320px;font-size:var(--text-xs);margin:4px 0 14px 20px;padding:12px 16px;line-height:1.65;overflow:auto}.inline-reply{width:clamp(180px, var(--reply-width,180px), 600px);border:1px solid var(--color-line);border-radius:var(--radius-sm);background:0 0;align-items:flex-end;gap:4px;max-width:100%;padding:3px 6px;display:flex}.inline-reply:focus-within{border-color:var(--color-input-focus)}.inline-reply textarea{width:100%;min-width:0;min-height:28px;max-height:180px;font-size:var(--text-sm);resize:none;box-shadow:none;background:0 0;border:0;padding:3px 2px;line-height:22px}.inline-reply textarea:focus{box-shadow:none;outline:none}.inline-reply-send{background:0 0;border:0;flex:0 0 26px;place-items:center;width:26px;height:28px;min-height:28px;padding:3px;display:grid}.native-question{grid-template-columns:minmax(0,1fr);gap:12px;min-width:0;display:grid}.native-question>*{min-width:0}.native-question-part{grid-template-columns:minmax(0,1fr);justify-items:start;gap:8px;min-width:0;display:grid}.native-question-part>p{color:var(--color-text);font-size:var(--text-base);margin:0}.question-options,.question-actions{flex-wrap:wrap;align-items:stretch;gap:8px;max-width:100%;display:flex}.question-options button,.question-actions>button{min-height:var(--control-height);margin:0;line-height:20px}.question-options button{text-align:left;min-width:0;max-width:100%;font-size:var(--text-sm);flex-direction:column;flex-shrink:1;justify-content:center;align-items:flex-start;gap:4px;padding:10px 12px;font-weight:500;display:flex}.question-options button[aria-pressed=true]{border-color:var(--brand-orange);background:var(--color-accent-soft);color:var(--color-link)}.question-options button small{color:var(--color-muted);font-size:var(--text-xs);white-space:normal;font-weight:400;line-height:1.6}.question-options-described{grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr));width:100%;display:grid}.question-options-described button{justify-content:flex-start}.question-option-label{align-items:center;gap:8px;display:flex}.question-check{border:1px solid;border-radius:3px;flex:0 0 14px;justify-content:center;align-items:center;width:14px;height:14px;display:inline-flex}.question-check .icon{width:12px;height:12px}.question-response,.question-result{align-items:baseline;gap:6px;display:flex}.question-response span{white-space:pre-wrap;overflow-wrap:anywhere}.question-result{color:var(--color-muted);font-size:var(--text-xs)}.question-response .icon,.question-result .icon{width:12px;height:12px;color:var(--color-muted);flex-shrink:0}.native-approval-detail{white-space:pre-wrap;overflow-wrap:anywhere;max-height:320px;overflow:auto}.native-approval-options{grid-template-columns:repeat(2,minmax(0,1fr));width:min(100%,216px);display:grid}.native-approval-options button{text-align:center;align-items:center}.native-plan{border:1px solid var(--color-line);border-radius:12px;gap:16px;padding:18px 20px}.native-plan-heading{color:var(--color-muted);font-size:var(--text-sm);align-items:center;gap:8px;display:flex}.native-plan-content{overscroll-behavior:contain;scrollbar-width:thin;min-height:0;max-height:min(480px,50dvh);overflow:auto}.native-plan .markdown :is(h1,h2){font-size:var(--text-lg);margin:18px 0 10px}.native-plan .markdown>:first-child{margin-top:0}.native-plan-history summary{cursor:pointer;color:var(--color-muted)}.native-plan-history[open] summary{margin-bottom:16px}.native-plan-actions{grid-template-columns:repeat(3,minmax(0,1fr));grid-auto-rows:1fr;width:min(100%,360px);display:grid}.native-plan-actions-expanded{grid-template-columns:repeat(2,minmax(0,1fr))}.native-plan-actions>button{min-width:0;padding:10px 8px}.native-plan-note{font-size:var(--text-xs);margin-top:-8px;line-height:1.6}.native-plan-feedback{gap:10px;display:grid}.native-plan-feedback label{font-size:var(--text-sm);gap:6px;display:grid}.native-plan-feedback textarea{width:100%;min-height:96px;font-size:var(--text-base)}.native-plan-feedback-actions{grid-template-columns:repeat(2,minmax(0,1fr));width:min(100%,280px);display:grid}.native-plan-feedback-actions>button{min-width:0;padding:10px 8px}@media (width<=600px){.native-plan{padding:12px}.native-plan-content{max-height:240px}}.composer-menu .dropdown-trigger{height:30px;min-height:30px;font-size:var(--text-xs);color:var(--color-muted);background:var(--color-soft);border-radius:18px;align-items:center;gap:4px;max-width:min(190px,100%);padding:5px 9px;display:flex}.composer-menu .dropdown-trigger>span{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.composer-menu .dropdown-trigger:hover,.composer-menu .dropdown-trigger[aria-expanded=true]{color:var(--color-text);background:var(--color-hover)}.composer-commands .dropdown-trigger{background:var(--color-soft);border-radius:50%;justify-content:center;width:30px;padding:6px}.composer-menu .dropdown-menu{--dropdown-max-height:45dvh;width:300px;max-width:calc(100vw - var(--sidebar-width) - 32px);max-height:45dvh;top:auto;bottom:calc(100% + 12px)}.composer-menu .dropdown-menu [role=menuitem]{font-size:var(--text-sm);justify-content:space-between;gap:12px;padding:10px}.composer-option-copy{text-align:left;flex-direction:column;gap:3px;min-width:0;display:flex}.composer-option-copy small,.composer-menu-heading small{font-size:var(--text-xs);color:var(--color-muted);font-weight:400}.composer-menu code{color:var(--color-muted);background:0 0;font-size:11px}.composer-menu-heading{font-size:var(--text-sm);justify-content:space-between;gap:12px;padding:8px 10px;display:flex}@media (width<=600px){.composer-menu .dropdown-menu{width:calc(100vw - var(--sidebar-width) - 16px);max-width:none}.composer-menu .dropdown-trigger{max-width:min(140px,100%)}}.composer-choice{flex:0 auto;min-width:0}.composer-commands{flex-shrink:0}.composer-commands .icon{width:17px;height:17px}.composer-commands .dropdown-menu{width:640px}.composer-commands .dropdown-menu [role=menuitem]{padding:8px 10px}.composer-command-row{align-items:center;gap:20px;width:100%;min-width:0;display:flex}.composer-command-name{flex:0 190px;min-width:0}.composer-command-row small{min-width:0;color:var(--color-muted);font-weight:400;font-size:var(--text-xs);flex:1}.composer-command-row>*{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}@media (width<=600px){.composer-commands .dropdown-menu{width:calc(100vw - var(--sidebar-width) - 16px)}.composer-command-name{flex-basis:42%}.composer-command-row{gap:10px}}.composer-option-copy small{text-overflow:ellipsis;white-space:nowrap;max-width:260px;overflow:hidden}@media (width<=600px){.computers-layout .message-composer-actions{flex-wrap:wrap;row-gap:8px}.computers-layout .message-composer-footer{align-items:flex-end}}.computer-panel{border-bottom:1px solid var(--color-line);max-height:55vh;padding:16px 24px;overflow:auto}.config-fields{grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:12px;padding:12px 0;display:grid}.config-fields label{flex-direction:column;gap:6px;display:flex}.computer-control-status{margin:0;padding:4px 24px;font-size:12px}@media (width<=760px){.computer-panel{padding:12px}}.computer-tree{padding:4px}.computer-device{font-size:var(--text-sm);align-items:center;gap:8px;margin:0 0 14px;font-weight:600;display:flex}.computer-device>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.computer-connection{flex-shrink:0;display:inline-flex}.computer-connection.online .icon rect{fill:var(--brand-orange);fill-opacity:.85}.computer-paths{color:var(--color-muted);font-size:var(--text-xs);overflow-wrap:anywhere;margin:8px 0;display:block}.computer-tree .tree-name{flex:1}.computer-panel{flex-shrink:0}.computers-layout dialog .computer-panel{border:0;max-height:70dvh;padding:0}.computer-create-menu .dropdown-trigger{place-items:center;width:32px;height:32px;padding:4px;display:grid}.computer-create-menu .dropdown-menu{width:180px;left:auto;right:0}.session-rename{font:inherit;font-weight:inherit;text-align:left;text-overflow:ellipsis;white-space:nowrap;background:0 0;border:0;border-radius:0;max-width:100%;padding:0;overflow:hidden}.session-rename:hover{color:var(--color-muted);background:0 0}.session-title-form{flex:1;min-width:0;margin-right:16px}.session-title-form input{width:100%}.computers-layout .message-composer{align-self:center;width:calc(100% - 56px);max-width:844px}@media (width<=900px){.computers-layout .message-composer{width:calc(100% - 32px)}}@media (width<=600px){.computers-layout .message-composer{width:calc(100% - 16px)}}.computer-session-copy{flex-direction:column;flex:1;align-items:flex-start;gap:3px;min-width:0;padding:3px 0;display:flex}.computer-session-copy .tree-name{max-width:100%}.computer-session-copy time{color:var(--color-muted);font-size:var(--text-xs);font-weight:400;line-height:1.3}.computer-tree-row{align-items:center;min-width:0;display:flex}.computer-tree-row>.tree-item{flex:1;min-width:0}.computer-tree-action.icon-button{opacity:0;width:26px;height:26px;min-height:26px;color:var(--color-muted);margin-right:4px;padding:5px}.computer-tree-action.pinned,.computer-tree-row:hover>.computer-tree-action,.computer-tree-row:focus-within>.computer-tree-action{opacity:1}@media (hover:none){.computer-tree-action.icon-button{opacity:1}}.computer-session-row>.tree-item{flex:0 auto;width:auto;max-width:calc(100% - 28px)}.computer-session-pin.icon-button{align-self:flex-start;width:24px;height:24px;min-height:24px;margin:9px 0 0 -8px;padding:6px}.computer-session-pin .icon{width:12px;height:12px}.computer-session-pin:hover{color:var(--color-text)}.computer-directory-details{flex-direction:column;gap:24px;display:flex}.computer-directory-details .computer-paths{margin:0}.computer-directory-purpose{flex-direction:column;gap:8px;display:flex}.computer-directory-purpose>.muted{font-size:var(--text-xs)}.computer-directory-purpose .inline-edit-value{line-height:1.6}.computer-directory-intake{justify-content:space-between;align-items:center;gap:16px;display:flex}.computer-directory-details>.muted{font-size:var(--text-sm)}#computer-directory-settings .dialog-header h2{flex:1;min-width:0}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as e,tt as t}from"./index-xjf37um4.js";var n=t();function r({navigation:t,children:r,className:i=``,tree:a=!1,label:o,testId:s}){return(0,n.jsx)(e,{className:`assistant-layout conversation-layout ${i}`,"data-testid":s,navigation:(0,n.jsx)(`aside`,{className:`assistant-list ${a?`file-tree-pane`:``}`,"aria-label":`${o}列表`,children:t}),children:(0,n.jsx)(`section`,{className:`assistant-thread`,"aria-label":o,children:r})})}function i({mine:e=!1,author:t,time:r,children:i,className:a=``,ref:o,...s}){return(0,n.jsx)(`div`,{...s,ref:o,className:`assistant-bubble-row ${e?`mine`:``} ${a}`,children:(0,n.jsxs)(`div`,{className:`assistant-bubble`,children:[(0,n.jsxs)(`div`,{className:`assistant-bubble-meta`,children:[(0,n.jsx)(`span`,{children:t}),r&&(0,n.jsx)(`time`,{dateTime:r,children:new Date(r).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})]}),i]})})}function a({label:e,state:t=`idle`}){return(0,n.jsx)(`span`,{className:`conversation-status state-${t}`,role:`img`,"aria-label":e,title:e})}function o({author:e,time:t,children:r}){return(0,n.jsxs)(`article`,{className:`conversation-post assistant-bubble`,children:[(0,n.jsxs)(`header`,{className:`assistant-bubble-meta`,children:[(0,n.jsx)(`strong`,{children:e}),t&&(0,n.jsx)(`time`,{dateTime:t,children:new Date(t).toLocaleString(`zh-CN`,{month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})})]}),r]})}function s({title:e,actions:t}){return(0,n.jsxs)(`header`,{className:`assistant-thread-heading`,children:[(0,n.jsx)(`div`,{className:`conversation-title`,children:e}),t]})}function c({ref:e,...t}){return(0,n.jsx)(`div`,{role:`log`,"aria-live":`polite`,...t,ref:e,className:`assistant-transcript`})}export{c as a,o as i,s as n,a as o,r,i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
main#main:has(.conversation-layout){height:100dvh;padding:0;overflow:hidden}.assistant-layout{grid-template-columns:var(--pane-width) minmax(0, 1fr);height:100%;min-height:0;overflow:hidden}.assistant-list{border-right:1px solid var(--color-line);background:var(--color-surface);flex-direction:column;min-height:0;display:flex}.assistant-list-heading,.assistant-thread-heading{border-bottom:1px solid var(--color-line);flex:0 0 76px;justify-content:space-between;align-items:center;padding:0 24px;display:flex}.assistant-list-heading h1{margin:0;font-size:20px}.assistant-thread-heading h2{text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:17px;overflow:hidden}.assistant-message-scroll{flex:1;min-height:0;overflow-y:auto}.assistant-list-status{color:var(--color-muted);font-size:var(--text-sm);margin:20px 24px}.assistant-message-item{border:0;border-bottom:1px solid var(--color-line);text-align:left;width:100%;color:var(--color-text);background:0 0;border-radius:0;align-items:center;gap:12px;padding:20px 24px;display:flex}.assistant-message-item:hover{background:var(--color-hover)}.assistant-message-item.selected{background:var(--color-soft)}.assistant-message-item.archived{color:var(--color-muted)}.assistant-message-item.archived strong{font-weight:400}.assistant-list-actions{align-items:center;gap:6px;display:flex}.assistant-new-chat{width:32px;height:32px;min-height:32px;color:var(--brand-orange);background:var(--color-accent-soft);padding:6px}.assistant-new-chat .icon{width:20px;height:20px}.assistant-new-chat:after{top:calc(100% + 6px);bottom:auto}.assistant-message-copy{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}.assistant-message-copy>.selection-content{width:fit-content;max-width:100%;color:var(--color-text);margin:-5px -8px;padding:5px 8px;display:block;overflow:visible}.assistant-message-item.archived .selection-content{color:inherit}.assistant-message-copy .selection-inner{min-width:0;display:block}.assistant-message-copy .selection-inner strong{display:block}.assistant-message-copy strong,.assistant-message-copy>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.assistant-message-copy strong{font-size:var(--text-base);font-weight:600}.assistant-message-copy>span,.assistant-message-copy time{font-size:var(--text-xs);color:var(--color-muted)}.assistant-message-dot{border-radius:50%;flex:0 0 7px;width:7px;height:7px}.assistant-message-dot.unread{background:var(--brand-orange)}.assistant-thread{background:var(--color-canvas);flex-direction:column;min-width:0;min-height:0;display:flex;overflow:hidden}.assistant-transcript{flex:1;min-height:0;padding:28px clamp(20px,4vw,64px);overflow-y:auto}.assistant-matter-state{border-bottom:1px solid var(--color-line);color:var(--color-muted);font-size:var(--text-xs);overflow-wrap:anywhere;padding:10px 28px;line-height:1.6}.assistant-bubble-row{margin:0 0 24px;display:flex}.assistant-bubble-row.mine{justify-content:flex-end}.assistant-bubble{border-radius:4px var(--radius-lg) var(--radius-lg);background:var(--color-soft);overflow-wrap:anywhere;min-width:100px;max-width:min(88%,800px);padding:14px 18px}.assistant-bubble-row.mine .assistant-bubble{background:var(--color-accent-soft);border-radius:var(--radius-lg) 4px var(--radius-lg) var(--radius-lg)}.assistant-bubble-meta{font-size:var(--text-xs);color:var(--color-muted);align-items:baseline;gap:16px;margin-bottom:8px;display:flex}.assistant-debug-reply{font-size:var(--text-xs);background:var(--color-surface);margin-top:12px;padding:4px 10px}.assistant-bubble .markdown>:first-child{margin-top:0}.assistant-bubble .markdown>:last-child{margin-bottom:0}.assistant-bubble .markdown{font-size:var(--text-base);line-height:1.75}.assistant-bubble .markdown h1,.assistant-bubble .markdown h2{font-size:18px}.assistant-bubble .markdown h3,.assistant-bubble .markdown h4,.assistant-bubble .markdown h5,.assistant-bubble .markdown h6{font-size:var(--text-base)}.assistant-bubble .markdown :is(h1,h2,h3,h4,h5,h6){margin:18px 0 8px;line-height:1.5}.assistant-bubble .markdown :is(p,ul,ol){margin:10px 0}.assistant-bubble .markdown :is(ul,ol){padding-left:1.5em}.assistant-bubble .markdown li+li{margin-top:4px}.assistant-bubble .markdown li>:is(ul,ol){margin:4px 0}.assistant-bubble pre{max-width:100%;overflow-x:auto}.assistant-reply-hint{font-size:var(--text-xs);color:var(--color-muted);margin:0 28px 10px;line-height:1.7}.assistant-empty{height:100%;min-height:240px;color:var(--color-muted);flex-direction:column;justify-content:center;align-items:center;gap:20px;display:flex}.assistant-empty .mascot{width:
|
|
1
|
+
main#main:has(.conversation-layout){height:100dvh;padding:0;overflow:hidden}.assistant-layout{grid-template-columns:var(--pane-width) minmax(0, 1fr);height:100%;min-height:0;overflow:hidden}.assistant-list{border-right:1px solid var(--color-line);background:var(--color-surface);flex-direction:column;min-height:0;display:flex}.assistant-list-heading,.assistant-thread-heading{border-bottom:1px solid var(--color-line);flex:0 0 76px;justify-content:space-between;align-items:center;padding:0 24px;display:flex}.assistant-list-heading h1{margin:0;font-size:20px}.assistant-thread-heading h2{text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:17px;overflow:hidden}.assistant-message-scroll{flex:1;min-height:0;overflow-y:auto}.assistant-list-status{color:var(--color-muted);font-size:var(--text-sm);margin:20px 24px}.assistant-message-item{border:0;border-bottom:1px solid var(--color-line);text-align:left;width:100%;color:var(--color-text);background:0 0;border-radius:0;align-items:center;gap:12px;padding:20px 24px;display:flex}.assistant-message-item:hover{background:var(--color-hover)}.assistant-message-item.selected{background:var(--color-soft)}.assistant-message-item.archived{color:var(--color-muted)}.assistant-message-item.archived strong{font-weight:400}.assistant-list-actions{align-items:center;gap:6px;display:flex}.assistant-new-chat{width:32px;height:32px;min-height:32px;color:var(--brand-orange);background:var(--color-accent-soft);padding:6px}.assistant-new-chat .icon{width:20px;height:20px}.assistant-new-chat:after{top:calc(100% + 6px);bottom:auto}.assistant-message-copy{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}.assistant-message-copy>.selection-content{width:fit-content;max-width:100%;color:var(--color-text);margin:-5px -8px;padding:5px 8px;display:block;overflow:visible}.assistant-message-item.archived .selection-content{color:inherit}.assistant-message-copy .selection-inner{min-width:0;display:block}.assistant-message-copy .selection-inner strong{display:block}.assistant-message-copy strong,.assistant-message-copy>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.assistant-message-copy strong{font-size:var(--text-base);font-weight:600}.assistant-message-copy>span,.assistant-message-copy time{font-size:var(--text-xs);color:var(--color-muted)}.assistant-message-dot{border-radius:50%;flex:0 0 7px;width:7px;height:7px}.assistant-message-dot.unread{background:var(--brand-orange)}.assistant-thread{background:var(--color-canvas);flex-direction:column;min-width:0;min-height:0;display:flex;overflow:hidden}.assistant-transcript{flex:1;min-height:0;padding:28px clamp(20px,4vw,64px);overflow-y:auto}.assistant-matter-state{border-bottom:1px solid var(--color-line);color:var(--color-muted);font-size:var(--text-xs);overflow-wrap:anywhere;padding:10px 28px;line-height:1.6}.assistant-bubble-row{margin:0 0 24px;display:flex}.assistant-bubble-row.mine{justify-content:flex-end}.assistant-bubble{border-radius:4px var(--radius-lg) var(--radius-lg);background:var(--color-soft);overflow-wrap:anywhere;min-width:100px;max-width:min(88%,800px);padding:14px 18px}.assistant-bubble-row.mine .assistant-bubble{background:var(--color-accent-soft);border-radius:var(--radius-lg) 4px var(--radius-lg) var(--radius-lg)}.assistant-bubble-meta{font-size:var(--text-xs);color:var(--color-muted);align-items:baseline;gap:16px;margin-bottom:8px;display:flex}.assistant-debug-reply{font-size:var(--text-xs);background:var(--color-surface);margin-top:12px;padding:4px 10px}.assistant-bubble .markdown>:first-child{margin-top:0}.assistant-bubble .markdown>:last-child{margin-bottom:0}.assistant-bubble .markdown{font-size:var(--text-base);line-height:1.75}.assistant-bubble .markdown h1,.assistant-bubble .markdown h2{font-size:18px}.assistant-bubble .markdown h3,.assistant-bubble .markdown h4,.assistant-bubble .markdown h5,.assistant-bubble .markdown h6{font-size:var(--text-base)}.assistant-bubble .markdown :is(h1,h2,h3,h4,h5,h6){margin:18px 0 8px;line-height:1.5}.assistant-bubble .markdown :is(p,ul,ol){margin:10px 0}.assistant-bubble .markdown :is(ul,ol){padding-left:1.5em}.assistant-bubble .markdown li+li{margin-top:4px}.assistant-bubble .markdown li>:is(ul,ol){margin:4px 0}.assistant-bubble pre{max-width:100%;overflow-x:auto}.assistant-reply-hint{font-size:var(--text-xs);color:var(--color-muted);margin:0 28px 10px;line-height:1.7}.assistant-empty{height:100%;min-height:240px;color:var(--color-muted);flex-direction:column;justify-content:center;align-items:center;gap:20px;display:flex}.assistant-empty .mascot{width:176px;height:176px}.assistant-empty p{margin:0}.assistant-archived{color:var(--color-muted);font-size:var(--text-sm);justify-content:center;align-items:center;gap:8px;padding:24px;display:flex}.assistant-thread>.notice{margin:0 28px 12px}.assistant-typing{gap:5px;padding:8px 0;display:inline-flex}.assistant-typing i{background:var(--color-muted);border-radius:50%;width:5px;height:5px;animation:1.4s infinite assistant-pulse}.assistant-typing i:nth-child(2){animation-delay:.15s}.assistant-typing i:nth-child(3){animation-delay:.3s}@keyframes assistant-pulse{0%,70%,to{opacity:.35}35%{opacity:1}}@media (prefers-reduced-motion:reduce){.assistant-typing i{animation:none}}@media (width<=900px){.assistant-layout{grid-template-columns:240px minmax(0,1fr)}.assistant-message-item{padding:16px}.assistant-reply-hint{margin:0 16px 10px}.assistant-bubble{max-width:96%}}@media (width<=600px){.assistant-layout{grid-template-columns:150px minmax(0,1fr)}.assistant-list-heading,.assistant-thread-heading{padding:0 12px}.assistant-transcript{padding:16px 10px}.assistant-reply-hint{margin:0 8px 10px}}.assistant-participants{text-overflow:ellipsis;white-space:nowrap;min-width:0;max-width:45%;color:var(--color-muted);font-size:var(--text-sm);margin-left:16px;overflow:hidden}.assistant-thread-heading>div{min-width:0}.assistant-list.file-tree-pane{overflow:hidden}@media (width<=600px){.conversation-layout{grid-template-rows:minmax(130px,26dvh) minmax(0,1fr);grid-template-columns:minmax(0,1fr)}.conversation-layout .assistant-list{border-right:0;border-bottom:1px solid var(--color-line)}.conversation-layout .assistant-list-heading{flex-basis:52px}.conversation-layout .assistant-thread-heading{flex-basis:56px}.conversation-layout .assistant-list.file-tree-pane{padding:12px 16px}.conversation-layout .explorer-heading{min-height:32px;margin-bottom:12px}.conversation-layout .explorer-heading h1{font-size:20px}.conversation-layout .assistant-list.file-tree-pane{grid-template-rows:36px minmax(0,1fr);grid-template-columns:minmax(0,1fr);gap:8px;display:grid}.conversation-layout .assistant-list.file-tree-pane .explorer-heading{margin:0}.conversation-layout .computer-tree{grid-column:1/-1}.conversation-layout .computer-device{margin-top:0}}.conversation-status{background:var(--color-muted);vertical-align:middle;border-radius:50%;flex:0 0 6px;width:6px;height:6px;display:inline-block}.conversation-status.state-online,.conversation-status:is(.state-working,.state-running,.state-waiting,.state-queued,.state-offered,.state-pending){background:var(--brand-orange)}.conversation-status:is(.state-failed,.state-human_routed,.state-uncertain){background:var(--color-danger)}.conversation-status.state-offline{opacity:.45}.conversation-title{flex:1;min-width:0}.topic-preview{font-size:var(--text-xs);color:var(--color-muted);display:block;overflow:hidden}.conversation-system-message{text-align:center;color:var(--color-muted);font-size:var(--text-xs);margin:16px 0;line-height:1.6}.conversation-post.assistant-bubble{border:1px solid var(--color-line);border-radius:var(--radius-md);background:var(--color-surface);width:100%;max-width:none;margin:0 0 16px;padding:20px 24px}.conversation-post .assistant-bubble-meta{justify-content:space-between}.channel-layout .assistant-message-item{gap:8px;padding:12px 18px}.channel-layout .assistant-message-copy{gap:4px}.channel-layout .assistant-message-copy>span{font-size:var(--text-xs)}@media (width<=600px){.conversation-post.assistant-bubble{padding:14px}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$ as e,B as t,Dt as n,H as r,I as i,J as a,K as o,L as s,Ot as c,Q as l,R as u,U as d,W as f,X as p,Z as m,it as h,q as g,tt as _,x as v}from"./index-xjf37um4.js";import{n as y,t as b}from"./PillControl-BRPhbHQm.js";import{t as x}from"./project-links-Dy6-B89_.js";import"./file-links-Dl1S0Tt0.js";var S=n(),C=_(),w=[{value:`time`,label:`按时间`,icon:`clock`},{value:`owner`,label:`按用户`,icon:`members`}],T=[{status:`planned`,label:`计划`},{status:`in_progress`,label:`进行中`},{status:`in_review`,label:`待验收`},{status:`completed`,label:`已完成`},{status:null,label:`未明确`}];function E({members:n,project:r,memberId:o}){let{request:s,projectId:f}=v(),p=`teammy-board-mine:${o}:${f}`,[m,h]=(0,S.useState)(()=>{try{return localStorage.getItem(p)===`true`}catch{return!1}}),_=`teammy-board-order:${o}:${f}`,[x,E]=(0,S.useState)(()=>{try{return localStorage.getItem(_)===`owner`?`owner`:`time`}catch{return`time`}}),O=w.find(e=>e.value===x),k=(0,S.useCallback)(e=>s(`tasks`,i,{signal:e}),[s]),j=l(k,3e3,e(f,`tasks`)),[M,N]=(0,S.useState)(),[P,F]=(0,S.useState)(!1),[I,L]=(0,S.useState)(Date.now);(0,S.useEffect)(()=>{let e=setInterval(()=>L(Date.now()),6e4);return()=>clearInterval(e)},[]);let R=j.data,z=R?.tasks.filter(e=>!m||e.owner===o)??[],B=new Set(n.map(e=>e.id));return(0,C.jsxs)(`div`,{className:`task-board`,children:[(0,C.jsx)(a,{title:r?.projectName.trim()?`${r.projectName.trim()}|工作看板`:`工作看板`,description:r?.description.trim()||``,children:(0,C.jsx)(`a`,{className:`task-board-home`,"data-testid":`home-link`,href:c(`/projects`),onClick:e=>{e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),history.pushState(null,``,c(`/projects`)),window.dispatchEvent(new PopStateEvent(`popstate`)))},"aria-label":`项目主页`,"data-tooltip":`项目主页`,children:(0,C.jsx)(u,{})})}),(0,C.jsxs)(`div`,{className:`task-board-toolbar`,role:`group`,"aria-label":`看板筛选与排序`,children:[(0,C.jsxs)(b,{"aria-pressed":m,"data-testid":`task-board-mine`,onClick:()=>{let e=!m;h(e),F(!1);try{localStorage.setItem(p,String(e))}catch{}},children:[(0,C.jsx)(d,{name:m?`enable`:`account`,size:`small`}),`只看我的`]}),(0,C.jsx)(y,{id:`task-board-sort-menu`,triggerId:`task-board-sort`,label:`任务排序:${O.label}`,routeKey:x,trigger:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(d,{name:O.icon,size:`small`}),(0,C.jsx)(`span`,{children:O.label}),(0,C.jsx)(d,{name:`chevronDown`,size:`small`})]}),children:e=>w.map(t=>(0,C.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-label":t.label,onClick:()=>{e(),E(t.value),F(!1);try{localStorage.setItem(_,t.value)}catch{}},children:[(0,C.jsx)(d,{name:t.icon,size:`small`}),(0,C.jsx)(`span`,{children:t.label}),x===t.value&&(0,C.jsx)(d,{name:`check`,size:`small`})]},t.value))})]}),(0,C.jsx)(g,{error:!0,children:j.error}),(0,C.jsx)(`section`,{className:`task-board-lanes`,"aria-label":`任务进度`,"data-testid":`progress-board`,children:T.filter(e=>e.status!==null||z.some(e=>e.status===null)).map(e=>{let n=z.filter(t=>t.status===e.status);n.sort((t,n)=>(x===`owner`?t.owner.localeCompare(n.owner,`en`,{numeric:!0}):0)||(e.status===`completed`?n.statusSince.localeCompare(t.statusSince):t.statusSince.localeCompare(n.statusSince))||t.id.localeCompare(n.id));let r=e.status===`completed`&&!P?n.slice(0,5):n;return(0,C.jsxs)(`section`,{className:`task-lane`,"aria-label":e.label,"data-stage":e.status??`unknown`,children:[(0,C.jsxs)(`h2`,{children:[(0,C.jsx)(`span`,{className:`lane-dot`}),e.label,(0,C.jsx)(t,{children:R?n.length:`—`})]}),(0,C.jsxs)(`div`,{className:`task-lane-content`,children:[n.length?r.map(e=>(0,C.jsx)(D,{task:e,memberIds:B,now:I,onEdit:()=>N(e),onSaved:()=>void j.reload()},e.id)):(0,C.jsx)(`p`,{className:`task-lane-empty`,children:j.error&&!R?`读取失败`:R?`暂无任务`:`读取中…`}),e.status===`completed`&&n.length>5&&(0,C.jsxs)(`button`,{type:`button`,className:`task-lane-expand`,"aria-expanded":P,onClick:()=>F(!P),children:[(0,C.jsx)(d,{name:P?`chevronUp`:`chevronDown`,size:`small`}),P?`收起`:`展开其余 ${n.length-5} 项`]})]})]},e.label)})}),M&&(0,C.jsx)(A,{task:M,onClose:()=>N(void 0),onSaved:()=>{N(void 0),j.reload()}},M.id)]})}function D({task:e,memberIds:t,onEdit:n,onSaved:r,now:i}){let{projectId:a,request:o}=v(),l=m(),[u,_]=(0,S.useState)(!1),[y,b]=(0,S.useState)(``);async function w(){if(!u){_(!0),b(``);try{await o(`tasks/${e.id}/correction`,s,{method:`PATCH`,signal:l,body:{needsConfirmation:!1,expectedRevision:e.revision}}),l.aborted||r()}catch(e){l.aborted||b(h(e))}finally{_(!1)}}}return(0,C.jsxs)(`details`,{className:`task-card`,"data-testid":`task-card`,"data-task-id":e.id,"data-owner":e.owner,"data-status":e.status??`unknown`,children:[(0,C.jsxs)(`summary`,{className:`task-card-heading`,"data-testid":`task-toggle`,children:[(0,C.jsx)(`h3`,{children:e.title}),(0,C.jsxs)(`span`,{className:`task-card-meta`,children:[(0,C.jsx)(`small`,{title:e.owner,children:e.owner}),e.needsConfirmation&&(0,C.jsxs)(`span`,{className:`task-confirmation`,"data-testid":`task-confirmation`,children:[(0,C.jsx)(d,{name:`attention`,size:`small`}),`需要确认`]}),e.status!==`completed`&&(0,C.jsx)(O,{since:e.statusSince,now:i})]})]}),(0,C.jsx)(f,{icon:`edit`,className:`task-card-edit`,label:`纠正任务:${e.title}`,"data-testid":`task-correct`,disabled:u,onClick:n}),(0,C.jsxs)(`div`,{className:`task-card-details`,children:[(0,C.jsx)(`h4`,{children:`目标`}),(0,C.jsx)(`p`,{children:e.goal?(0,C.jsx)(k,{value:e.goal,memberIds:t}):`目标未明确`}),(0,C.jsx)(`h4`,{children:`当前进展`}),(0,C.jsx)(`p`,{className:`task-progress`,children:(0,C.jsx)(k,{value:e.progress,memberIds:t})}),(0,C.jsx)(`div`,{className:`task-card-sources`,children:e.sources.map(t=>(0,C.jsxs)(`a`,{"data-testid":`task-source`,href:c(t.kind===`material`?`/projects/${a}/materials?id=${t.materialId}&revision=${t.revision}`:x(a,e.owner,t.path)),children:[(0,C.jsx)(d,{name:`file`,size:`small`}),(0,C.jsx)(`span`,{children:t.path})]},t.path))}),e.syncedAt&&(0,C.jsxs)(`small`,{children:[`资料同步于 `,(0,C.jsx)(p,{value:e.syncedAt})]}),e.needsConfirmation&&(0,C.jsxs)(`div`,{className:`task-card-confirm`,children:[(0,C.jsx)(g,{error:!0,children:y}),(0,C.jsx)(`button`,{className:`primary`,"data-testid":`task-confirm-save`,disabled:u,onClick:()=>void w(),children:u?`正在保存…`:`保存`})]})]})]})}function O({since:e,now:t}){let n=Math.max(0,t-Date.parse(e)),r=Math.floor(n/6e4),i=r<1?`刚刚`:r<60?`${r} 分钟`:r<1440?`${Math.floor(r/60)} 小时`:`${Math.floor(r/1440)} 天`;return(0,C.jsxs)(`span`,{className:`task-age${n>6048e5?` stale`:``}`,"data-testid":`task-age`,title:`进入当前状态:${new Date(e).toLocaleString(`zh-CN`)}`,"aria-label":`当前状态停留 ${i}`,children:[(0,C.jsx)(d,{name:`clock`,size:`small`}),i]})}function k({value:e,memberIds:t}){return e.split(/(@[a-z][a-z0-9_-]*)/gi).map((e,n)=>e.startsWith(`@`)&&t.has(e.slice(1))?(0,C.jsx)(`mark`,{className:`task-mention`,children:e},n):e)}function A({task:e,onClose:t,onSaved:n}){let{request:i}=v(),a=m(),[c,l]=(0,S.useState)(e.title),[u,d]=(0,S.useState)(e.status??``),[f,p]=(0,S.useState)(e.goal??``),[_,y]=(0,S.useState)(e.progress),[b,x]=(0,S.useState)(!1),[w,E]=(0,S.useState)(``),D={...c===e.title?{}:{title:c},...u===(e.status??``)?{}:{status:u||null},...f===(e.goal??``)?{}:{goal:f||null},..._===e.progress?{}:{progress:_},...e.needsConfirmation?{needsConfirmation:!1}:{}};async function O(){if(!b&&Object.keys(D).length){x(!0),E(``);try{await i(`tasks/${e.id}/correction`,s,{method:`PATCH`,signal:a,body:{...D,expectedRevision:e.revision}}),a.aborted||n()}catch(e){a.aborted||E(h(e))}finally{x(!1)}}}return(0,C.jsx)(o,{id:`task-correction`,title:`纠正任务`,onClose:t,children:(0,C.jsxs)(`form`,{className:`stack`,"aria-busy":b,onSubmit:e=>{e.preventDefault(),O()},children:[(0,C.jsx)(r,{id:`task-title`,label:`标题`,children:(0,C.jsx)(`input`,{value:c,required:!0,onChange:e=>l(e.target.value)})}),(0,C.jsxs)(`fieldset`,{className:`task-status-field`,disabled:b,children:[(0,C.jsx)(`legend`,{children:`状态`}),(0,C.jsx)(`div`,{className:`task-status-options`,"data-testid":`task-status`,children:T.filter(e=>e.status!==null).map(e=>(0,C.jsxs)(`label`,{className:`task-status-choice`,children:[(0,C.jsx)(`input`,{type:`radio`,name:`task-status`,value:e.status,checked:u===e.status,onChange:()=>d(e.status)}),(0,C.jsx)(`span`,{children:e.label})]},e.status))}),(0,C.jsx)(`small`,{children:`待验收:任务成果已提交,等待验收或最终确认。`})]}),(0,C.jsx)(r,{id:`task-goal`,label:`目标`,children:(0,C.jsx)(`textarea`,{value:f,onChange:e=>p(e.target.value)})}),(0,C.jsx)(r,{id:`task-progress`,label:`当前进展`,children:(0,C.jsx)(`textarea`,{value:_,onChange:e=>y(e.target.value)})}),(0,C.jsx)(g,{error:!0,children:w}),(0,C.jsx)(`div`,{className:`row wrap`,children:(0,C.jsx)(`button`,{type:`submit`,className:`primary`,disabled:b||!Object.keys(D).length,"data-testid":`task-correction-save`,children:`保存`})})]})})}function j({members:e,config:t,memberId:n}){return(0,C.jsx)(E,{members:e,project:t,memberId:n})}export{j as Dashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.task-board{min-width:0}.task-board .page-header{grid-template-columns:minmax(0,1fr) auto;align-items:start;margin-bottom:24px;display:grid}.task-board .page-header>div{min-width:0}.task-board .page-header h1,.task-board .page-header p{overflow-wrap:anywhere}.task-board-home{height:calc(var(--text-title) * 1.35);border-radius:var(--radius-sm);align-items:center;display:flex}.task-board-home:hover{opacity:.75}.task-board-home .brand img{width:auto;height:calc(var(--text-title) * 1.04)}.task-board-toolbar{flex-wrap:wrap;align-items:center;gap:8px;margin-bottom:24px;display:flex}.task-board-lanes{grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr));align-items:start;gap:24px;margin-bottom:32px;display:grid}.task-lane{min-width:0}.task-lane h2{font-size:var(--text-base);border-bottom:1px solid var(--color-line);align-items:center;gap:10px;padding:0 0 16px;font-weight:600;display:flex}.task-lane .count{margin-left:auto}.task-lane-content{flex-direction:column;gap:12px;padding-top:16px;display:flex}.lane-dot{border:1.5px solid var(--color-muted);border-radius:50%;width:8px;height:8px}.task-lane[data-stage=in_progress] .lane-dot{border-color:var(--brand-orange);background:var(--brand-orange)}.task-lane[data-stage=in_review] .lane-dot{border-color:var(--brand-black);background:var(--brand-black)}.task-lane[data-stage=completed] .lane-dot{border-color:var(--color-muted);background:var(--color-muted)}.task-lane-empty{font-size:var(--text-xs);color:var(--color-muted);padding:44px 0}.task-card{border:1px solid var(--color-line);border-radius:var(--radius-md);background:var(--color-surface);overflow-wrap:anywhere;min-width:0;position:relative}.task-card>.task-card-heading{border-radius:inherit;padding:16px;list-style:none;position:static}.task-age{white-space:nowrap;color:var(--color-muted);font-size:var(--text-xs);flex-shrink:0;align-items:center;gap:4px;margin-left:auto;font-weight:400;display:inline-flex}.task-age .icon{width:13px;height:13px}.task-age.stale{color:var(--brand-orange)}.task-lane-expand{min-height:32px;color:var(--color-muted);font-size:var(--text-xs);background:0 0;border:0;justify-content:center;align-items:center;gap:6px;display:flex}.task-card-heading::-webkit-details-marker{display:none}.task-card-heading:hover{background:var(--color-soft)}.task-card[open]>.task-card-heading h3{padding-right:32px}.task-card-meta{align-items:center;gap:8px;margin-top:8px;display:flex}.task-card-meta>small{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.task-confirmation{border-radius:var(--radius-sm);background:var(--color-accent-soft);color:var(--brand-orange);font-size:calc(var(--text-xs) - 1px);flex-shrink:0;align-items:center;gap:3px;padding:0 4px;font-weight:400;line-height:18px;display:inline-flex}.task-confirmation .icon{width:12px;height:12px}.task-card-confirm{flex-direction:column;align-items:flex-end;gap:8px;margin-top:16px;display:flex}.task-card-confirm button{min-height:32px;font-size:var(--text-xs);padding:4px 12px}.task-status-field legend{font-size:var(--text-sm);margin-bottom:8px;font-weight:600}.task-status-options{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;display:grid}.task-status-choice{cursor:pointer;position:relative}.task-status-choice input{opacity:0;width:100%;height:100%;min-height:0;cursor:inherit;position:absolute;inset:0}.task-status-choice span{border:1px solid var(--color-line);border-radius:var(--radius-md);background:var(--color-surface);min-height:36px;font-size:var(--text-sm);justify-content:center;align-items:center;font-weight:550;display:flex}.task-status-choice:hover span{background:var(--color-soft)}.task-status-choice input:checked+span{border-color:var(--brand-black);background:var(--brand-black);color:var(--color-on-dark)}.task-status-choice input:focus-visible+span{border-color:var(--color-input-focus)}.task-status-choice input:disabled+span{opacity:.45;cursor:default}.task-card-heading h3{font-size:var(--text-base);font-weight:650;line-height:1.55}.task-card-edit{opacity:0;pointer-events:none;position:absolute;top:10px;right:8px}.task-card[open]:hover>.task-card-edit{opacity:1;pointer-events:auto}.task-card[open]:has(:focus-visible)>.task-card-edit{opacity:1;pointer-events:auto}.task-progress{font-size:var(--text-sm);white-space:pre-wrap;line-height:1.85}.task-card small{color:var(--color-muted);font-size:var(--text-xs)}.task-card-details{padding:0 16px 16px}.task-card-details h4{font-size:var(--text-xs);margin:16px 0 4px;font-weight:600}.task-card-details p{font-size:var(--text-sm);margin:0}.task-card-sources{flex-direction:column;align-items:flex-start;gap:8px;margin:16px 0;display:flex}.task-card-sources a{text-align:left;overflow-wrap:anywhere;max-width:100%;font-size:var(--text-xs);min-height:28px;color:var(--color-muted);justify-content:flex-start;gap:8px;padding:4px 0;text-decoration:none;display:inline-flex}.task-card-sources a:hover{color:var(--color-link);text-decoration:underline}.task-mention{border-radius:var(--radius-sm);background:var(--color-accent-soft);color:inherit;padding:0 2px}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$ as e,Dt as t,Ot as n,Q as r,U as i,V as a,W as o,Y as s,ct as c,d as l,f as u,l as d,m as f,nt as p,p as m,q as h,tt as g,u as _,ut as v,x as y}from"./index-xjf37um4.js";import{t as b}from"./Markdown-BgEXVy4-.js";import{n as x,t as S}from"./WorkspaceTree-DUFGMLRi.js";import{t as C}from"./project-links-Dy6-B89_.js";import{t as w}from"./file-links-Dl1S0Tt0.js";import{t as T}from"./HtmlPreview-Bi3u6-l3.js";var E=t(),D=g();function O(e,t){let n=t.split(`/`).slice(0,-1);return n.map((t,r)=>x(e,n.slice(0,r+1).join(`/`))).concat(x(e,``))}function k({members:e,onRefresh:t}){let{api:i,projectId:s}=y(),[g,b]=(0,E.useState)(()=>{let t=new URLSearchParams(location.search),n=t.get(`owner`),r=v.safeParse(t.get(`path`));return n&&(u(n)||e.some(e=>e.id===n))&&r.success&&!l(r.data)?{owner:n,path:r.data}:void 0}),[T,k]=(0,E.useState)(()=>new Set(g?O(g.owner,g.path):[])),[j,M]=(0,E.useState)(()=>g?{...g,kind:`file`}:void 0),[N,P]=(0,E.useState)(0),[F,I]=(0,E.useState)(()=>{let e=new URLSearchParams(location.search);return!g&&(e.has(`owner`)||e.has(`path`))?`文件链接不完整或目标已不可用。`:``}),L=(0,E.useCallback)(async e=>{if(g)try{return{owner:g.owner,...await i.file(g.owner,g.path,void 0,e)}}catch(e){throw e instanceof p&&e.code===`FILE_NOT_FOUND`?Error(`找不到这个文件,可能已被删除或移动。`):e}},[g?.owner,g?.path,N]),R=r(L),z=R.data?.owner===g?.owner&&R.data?.file.path===g?.path?R.data:void 0;function B(e,t){let n=t.split(`/`).filter(Boolean);k(t=>{let r=new Set(t);for(let t=0;t<=n.length;t++)r.add(x(e,n.slice(0,t).join(`/`)));return r})}function V(e,t){I(``),B(e,t.split(`/`).slice(0,-1).join(`/`)),b({owner:e,path:t}),M({owner:e,path:t,kind:`file`}),history.replaceState(null,``,n(C(s,e,t)))}function H(t){if(!g)return!1;let r=w(u(g.owner)?g.path:`${g.owner}/${g.path}`,t);if(!r)return!/^[a-z][a-z0-9+.-]*:/i.test(t)&&!t.startsWith(`//`)&&(I(`该链接超出工作区,请在原仓库查看。`),!0);if(l(r.path))return I(`配置文件不在文件浏览中显示。`),!0;if(_(r.path))return location.assign(n(`/projects/${s}/memory`)),!0;let[i,...a]=r.path.split(`/`),o=e.some(e=>e.id===i),c=o?i:d,f=o?a.join(`/`):r.path;return I(``),r.directory?(B(c,f),M({owner:c,path:f,kind:`directory`})):c===g.owner&&f===g.path?r.anchor&&[...document.querySelectorAll(`.markdown h1,.markdown h2,.markdown h3,.markdown h4`)].find(e=>e.textContent?.trim().toLowerCase().replace(/\s+/g,`-`)===r.anchor.toLowerCase())?.scrollIntoView({block:`center`}):V(c,f),!0}return(0,D.jsx)(f,{"data-testid":`file-browser`,label:`文件资源管理器`,navigation:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(m,{title:`工作区`,icon:`files`,children:(0,D.jsx)(o,{icon:`refresh`,label:`刷新文件`,"data-testid":`files-refresh`,onClick:()=>{I(``),P(e=>e+1),t()}})}),(0,D.jsx)(S,{members:e,expanded:T,selected:j,revealed:!R.loading&&!R.error&&z?{owner:z.owner,path:z.file.path,file:z.file}:void 0,onSelect:V,onToggle:(e,t)=>{M({owner:e,path:t,kind:`directory`}),k(n=>{let r=new Set(n),i=x(e,t);return r.has(i)?r.delete(i):r.add(i),r})}},N)]}),children:(0,D.jsx)(`section`,{className:`file-detail`,"data-testid":`file-preview`,"data-owner-id":g?.owner,"data-file-path":g?.path,"aria-label":c.filePreview,children:g?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(h,{error:!0,children:F||!R.loading&&R.error}),R.error&&(0,D.jsx)(`button`,{className:`file-entry-retry`,"data-testid":`files-retry`,onClick:()=>void R.reload(),children:c.retry}),R.loading?(0,D.jsx)(`p`,{className:`preview-body`,role:`status`,children:c.loading}):!R.error&&z&&(0,D.jsx)(A,{owner:z.owner,file:z.file,onLink:H},`${z.owner}:${z.file.path}:${z.file.sha256}`)]}):F?(0,D.jsx)(h,{error:!0,children:F}):(0,D.jsx)(a,{mascot:!0,title:`查看工作区文件`,description:c.pickFile})})})}function A({owner:t,file:n,onLink:a}){let{readTextBlob:l,blobUrl:d,projectId:f}=y(),[p,m]=(0,E.useState)(!1),g=n.size>524288,_=/\.(md|markdown)$/i.test(n.path),v=/\.html?$/i.test(n.path),x=(0,E.useCallback)(e=>g?Promise.resolve(void 0):l(n,e),[n.sha256,n.size,g]),S=r(x,!1,e(f,`file-body`,n.sha256));return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`header`,{className:`file-detail-header`,children:[(0,D.jsxs)(`span`,{className:`file-detail-path`,title:`${u(t)?`teamcontext`:t}/${n.path}`,children:[(0,D.jsxs)(`span`,{children:[u(t)?`teamcontext`:t,` / `]}),n.path]}),(0,D.jsxs)(s,{label:`文件操作`,children:[(_||v)&&(0,D.jsx)(o,{icon:p?`preview`:`code`,label:p?`切换为预览`:`切换为原文`,"data-testid":`file-toggle-raw`,"aria-pressed":p,onClick:()=>m(!p)}),(0,D.jsx)(`a`,{className:`icon-button`,"data-testid":`file-download`,"aria-label":c.download,title:c.download,href:d(n.sha256),download:n.path.split(`/`).at(-1),children:(0,D.jsx)(i,{name:`download`})})]})]}),g?(0,D.jsx)(`div`,{className:`empty`,children:(0,D.jsx)(`p`,{children:c.previewLarge})}):S.error?(0,D.jsxs)(`div`,{className:`preview-body`,children:[(0,D.jsx)(h,{error:!0,children:S.error}),(0,D.jsx)(`button`,{"data-testid":`file-preview-retry`,onClick:()=>void S.reload(),children:c.retry})]}):S.loading?(0,D.jsx)(`p`,{className:`preview-body`,role:`status`,children:c.loading}):(0,D.jsx)(`div`,{className:`preview-body${v&&!p?` preview-body-html`:``}`,children:v&&!p?(0,D.jsx)(T,{url:d(n.sha256),name:n.path.split(`/`).at(-1)}):_&&!p?(0,D.jsx)(`article`,{className:`markdown`,"data-testid":`file-content`,"data-format":`markdown`,children:(0,D.jsx)(b,{onLink:a,children:S.data??``})}):(0,D.jsx)(`pre`,{className:`raw`,"data-testid":`file-content`,"data-format":`text`,children:S.data})})]})}export{k as Files};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{Dt as e,Ot as t,Q as n,V as r,m as i,ot as a,p as o,rt as s,t as c,tt as l,y as u,z as d}from"./index-xjf37um4.js";import{t as f}from"./Markdown-BgEXVy4-.js";var p=`# 帮助
|
|
2
2
|
|
|
3
3
|
网页目录按 [index.json](index.json) 中的分组和文章顺序展示。
|
|
4
4
|
|
|
@@ -79,6 +79,7 @@ import{$ as e,Et as t,L as n,Tt as r,X as i,it as a,m as o,p as s,t as c,tt as l
|
|
|
79
79
|
| 26/11/13 | v0.2.6 | 修复已知问题。 |
|
|
80
80
|
| 26/11/13 | v0.2.7 | 修复已知问题。 |
|
|
81
81
|
| 26/11/13 | v0.2.8 | 新成员首次引导;电脑接入 Pi、OpenCode;看板支持筛选排序。 |
|
|
82
|
+
| 26/11/16 | v0.2.9 | 电脑支持历史会话导入、置顶派工;补齐 MR 合并收尾与团队查询;精简目录设置,更新视觉。 |
|
|
82
83
|
`,h=`# 让开发 Agent 使用 Teammy
|
|
83
84
|
|
|
84
85
|
正在使用的开发 Agent 可以通过 Teammy 查询任务、资料和历史会话,也可以向 Tim 提问或委托协作。开始一项工作前,让 Agent 查找团队已有的结论,有助于减少重复摸索。
|
|
@@ -139,7 +140,7 @@ teammy agent register --provider codex --cwd .
|
|
|
139
140
|
|
|
140
141
|
名称默认使用文件夹名,也可加 \`--name '项目开发'\` 自定义;重新登记时保留已有名称。登记完成后,目录会显示在「电脑」中,展开后选择会话即可开始交流。开发机器和 Teammy 后台需要保持在线。
|
|
141
142
|
|
|
142
|
-
重新登记时更换 \`--provider\`,会更新新会话的默认 Agent
|
|
143
|
+
重新登记时更换 \`--provider\`,会更新新会话的默认 Agent。已有会话继续使用各自的 Agent 和设置。
|
|
143
144
|
|
|
144
145
|
> 同一项目可以同时登记根目录和子目录。在大仓中,可将 \`--cwd .\` 改为模块路径,例如 \`--cwd ./apps/feedback\`;工作记录仍同步到大仓的 \`teamcontext/\`。
|
|
145
146
|
|
|
@@ -149,7 +150,7 @@ teammy agent register --provider codex --cwd .
|
|
|
149
150
|
|
|
150
151
|
如果希望 Tim 将私聊或项目讨论中的相关工作交给本地,先在项目「设置 → 客户端接入 → 本地 Agent」开启「允许本项目转交本地」。这是项目共用开关,只需统一开启一次。
|
|
151
152
|
|
|
152
|
-
|
|
153
|
+
然后在「电脑」点击目录行旁的设置按钮,点击职责正文编辑,打开「接收 Tim 转交」。也可在已连接的大仓根目录执行:
|
|
153
154
|
|
|
154
155
|
\`\`\`sh
|
|
155
156
|
teammy agent enable --id <目录ID>
|
|
@@ -157,6 +158,8 @@ teammy agent enable --id <目录ID>
|
|
|
157
158
|
|
|
158
159
|
在其他位置执行时,加上 \`--root /大仓路径/teamcontext\`。此命令只开启对应目录,不改变项目总开关;无需进入子目录另启服务,也不要求绑定专用群。转交结果在网页对应会话及已绑定的专用群中呈现。
|
|
159
160
|
|
|
161
|
+
Tim 只向已置顶的会话分配新工作,见下方[整理会话与接收工作](#整理会话与接收工作)。
|
|
162
|
+
|
|
160
163
|
根目录同样可以接单。首次登记时,默认职责覆盖项目整体与跨模块工作;子目录覆盖对应模块,可在网页继续编辑。明确指定目录时按指定目录转交,其余请求由协调 Agent 结合职责选择。直接发到某个会话的消息在该会话处理;根目录会话不会自动管理其他目录的 Agent。
|
|
161
164
|
|
|
162
165
|
> 开关控制 Tim 的新增转交,不会自动执行看板中的全部任务。关闭后已有工作和直接对话继续;关闭文件同步也会暂停新增转交,见[客户端维护](../settings/client-maintenance.md#暂停与恢复)。
|
|
@@ -169,6 +172,24 @@ teammy agent enable --id <目录ID>
|
|
|
169
172
|
|
|
170
173
|
工作记录仍通过 \`teamcontext/\` 同步到[工作区和看板](../workspace/work-records.md)。
|
|
171
174
|
|
|
175
|
+
### 导入已有会话
|
|
176
|
+
|
|
177
|
+
先选择开发目录,点击列表上方的加号 →「导入历史会话」,再选择 Agent。点击 Session 输入框展开当前目录的历史列表,可按标题或 ID 筛选;也可以直接粘贴原生 Session ID,点击「导入」。支持 Codex、Claude Code、Cursor、Pi 和 OpenCode;开发机器需要在线,并使用支持历史导入的新版客户端。
|
|
178
|
+
|
|
179
|
+
导入后,会话保留在左侧列表,继续发送消息时沿用原生上下文。重复选择已接入的会话会打开原入口,不创建副本,也不改变目录的默认会话。新建和导入的会话不会自动置顶。
|
|
180
|
+
|
|
181
|
+
> 导入前先退出原终端会话。本功能不接管运行中的终端,也不自动导入全部历史;网页从接入后的消息开始记录,原有上下文仍由原生 Agent 保留。
|
|
182
|
+
|
|
183
|
+
### 整理会话与接收工作
|
|
184
|
+
|
|
185
|
+
点击会话标题旁的小图钉即可置顶:会话排在列表前面,同时允许 Tim 向它分配新工作。点击顶部标题可重命名,使用能说明用途的名称,例如「导出功能」或「性能排查」。同一分组按最新活动时间排列,标题下只显示时间;置顶和重命名不刷新活动时间。
|
|
186
|
+
|
|
187
|
+
Tim 根据目录职责和置顶会话标题选择接收位置。明确指定会话时,也只能选择已置顶的会话;找不到或无法区分时,会请你补充说明。没有专项归属的工作使用该目录的默认会话。
|
|
188
|
+
|
|
189
|
+
会话右上角「…」可设为或取消默认会话。设为默认会自动置顶;取消默认仍保留置顶,取消置顶则同时清除该会话的默认设置。首次登记目录时,初始会话已置顶并设为默认,也可以取消。
|
|
190
|
+
|
|
191
|
+
取消置顶只停止向该会话分配新工作。已有工作的补充、问答、网页直接对话和专用群连接仍沿用原会话;切换默认不会迁移这些关联。未置顶的会话仍可手动打开、继续对话。
|
|
192
|
+
|
|
172
193
|
### 图片、待发送消息和目录改动
|
|
173
194
|
|
|
174
195
|
支持图片的会话会显示附件按钮,可选择、粘贴或拖入 PNG、JPEG、WebP 图片,每条消息最多 4 张、每张不超过 5 MB。可以只发送图片,也可以附上文字要求。图片能力取决于原生 Agent 和当前模型;切换到不支持图片的模型后,需要移除草稿图片或换回支持的模型才能发送。
|
|
@@ -181,7 +202,7 @@ teammy agent enable --id <目录ID>
|
|
|
181
202
|
|
|
182
203
|
输入区可以选择当前会话的模型、思考强度和权限,变更在对话中简要显示。模型列表来自开发机器,并按 Agent 分开。Codex 权限可选只读、工作区写入或完全访问,变更用于后续轮次;Claude 使用默认审批、自动接受编辑、Plan 或完全访问。Claude 的模式遵循原生权限规则,Plan 不等同于操作系统只读沙箱。
|
|
183
204
|
|
|
184
|
-
|
|
205
|
+
目录行旁的设置按钮可查看真实路径,点击名称或职责原位编辑,转交开关直接生效。新会话使用对应 Agent 的初始配置,模型、思考强度和权限在会话输入区调整;已有会话保留各自设置。会话的执行位置、默认设置及专用群连接位于会话右上角「…」菜单。
|
|
185
206
|
|
|
186
207
|
### 回答问题与审批
|
|
187
208
|
|
|
@@ -201,7 +222,7 @@ Agent 需要你作决定时,会显示问题卡片。可以选择选项;原
|
|
|
201
222
|
|
|
202
223
|
网页刷新会保留待答问题与已确认结果。客户端重启后继续使用原生会话上下文,未完成操作标记为需要核对,不会自动重跑。
|
|
203
224
|
|
|
204
|
-
|
|
225
|
+
已有终端会话可以通过[导入已有会话](#导入已有会话)继续。
|
|
205
226
|
|
|
206
227
|
## Cursor 的模式与计划
|
|
207
228
|
|
|
@@ -211,7 +232,7 @@ Cursor 的工作模式和权限分开选择:Agent 用于实施,Plan 用于
|
|
|
211
232
|
|
|
212
233
|
模型、思考强度以及 Fast 等选项来自 Cursor 实际能力,不支持的选项不显示。原生计划卡片支持「开始实施」「提出修改」「取消」;开始实施切换到 Agent 并保留审批设置。是否发起提问或计划由当前模型和 Cursor CLI 决定,普通文字问题仍在对话中回答。
|
|
213
234
|
|
|
214
|
-
|
|
235
|
+
网页刷新保留待答卡片;客户端重启后使用原生历史继续,旧进程的未决操作需先核对。
|
|
215
236
|
|
|
216
237
|
## Pi 的原生会话
|
|
217
238
|
|
|
@@ -221,7 +242,7 @@ Cursor 的工作模式和权限分开选择:Agent 用于实施,Plan 用于
|
|
|
221
242
|
|
|
222
243
|
新版网页的追加消息按待发送队列处理;其他支持即时补充的入口沿用 Pi 原生 steering。停止会先清空原生待执行输入,再取消当前工作。重试和自动压缩结束、原生会话真正空闲后才显示本轮耗时。
|
|
223
244
|
|
|
224
|
-
|
|
245
|
+
历史导入支持 Pi 的原生会话 ID,包括命名 ID。自定义历史目录沿用 \`PI_CODING_AGENT_SESSION_DIR\` 或 Pi 的 \`sessionDir\` 配置。
|
|
225
246
|
|
|
226
247
|
Teammy 工具通过会话临时扩展接入,关闭时清理,不改写用户的 MCP、Skill 或全局扩展配置。Pi 命令和 Skills 从原生目录读取,Skills 保留 \`/skill:名称\` 语法。
|
|
227
248
|
|
|
@@ -235,7 +256,7 @@ Teammy 工具通过会话临时扩展接入,关闭时清理,不改写用户
|
|
|
235
256
|
|
|
236
257
|
支持流式回复、折叠工具过程、普通及多选问答、图片、停止、\`/compact\`、项目命令和 Skills。OpenCode Skills 使用 \`/名称\`。Teammy 为各会话启动独立的本地服务,通过临时 MCP 接入工具,不写入全局配置。断线不视为完成,也不自动重发未确认的输入。
|
|
237
258
|
|
|
238
|
-
|
|
259
|
+
历史导入恢复同一目录中的原生上下文。需要切换执行目录时请新建会话。
|
|
239
260
|
|
|
240
261
|
### 使用命令
|
|
241
262
|
|
|
@@ -276,6 +297,8 @@ Teammy 工具通过会话临时扩展接入,关闭时清理,不改写用户
|
|
|
276
297
|
|
|
277
298
|
需要 Tim 执行合并时,应明确委托,并说明目标请求。Tim 会核对当前提交、目标分支和讨论结果,再调用代码平台完成操作。
|
|
278
299
|
|
|
300
|
+
确认合并后,Tim 会在已有频道帖内简短总结主要变化,并 @ 作者。在代码平台手动合并时,也会通过 Webhook 触发这条收尾提醒。
|
|
301
|
+
|
|
279
302
|
> 自动审阅只发表评论,不代表人工批准或自动合并。实际合并仍受代码平台的权限、分支保护和检查要求约束。
|
|
280
303
|
`,v=`# 与 Tim 交流
|
|
281
304
|
|
|
@@ -348,7 +371,7 @@ Tim 发给你的个人通知也会出现在「对话」中,例如需要确认
|
|
|
348
371
|
|
|
349
372
|
### 连接本地 Agent 专用群
|
|
350
373
|
|
|
351
|
-
如果希望在群内操作某个开发目录,先完成个人绑定和[本地 Agent 接入](../computers/local-agent.md)
|
|
374
|
+
如果希望在群内操作某个开发目录,先完成个人绑定和[本地 Agent 接入](../computers/local-agent.md),再到「电脑」选择会话,从右上角「…」菜单选择「连接专用群」,在目标群 @Tim 发送生成的绑定命令。
|
|
352
375
|
|
|
353
376
|
专用群对应一个本地 Agent 会话,绑定成员 @Tim 发送的消息会直接进入该会话。网页「电脑」与群内沿用同一上下文,可以从任一入口继续交流。
|
|
354
377
|
|
|
@@ -699,4 +722,4 @@ teamcontext/alice/2026-11-12-data-check/
|
|
|
699
722
|
标有「需要确认」的任务,表示记录中有影响判断的歧义。查看来源后,可以修改内容再保存;如果当前内容已经准确,直接保存即可确认。
|
|
700
723
|
|
|
701
724
|
> 网页修订保存在对应任务的 \`_task_update/\` 子目录中,作为补充记录同步,不改写原任务正文。
|
|
702
|
-
`,k=new URL(`workflow-DM6NUqoB.svg`,import.meta.url).href,A=
|
|
725
|
+
`,k=new URL(`workflow-DM6NUqoB.svg`,import.meta.url).href,A=e(),j={sections:[{title:`开始使用`,documents:[{title:`新成员接入指南`,path:`getting-started/onboarding.md`},{title:`认识 Teammy`,path:`getting-started/overview.md`},{title:`安装与首次接入`,path:`getting-started/installation.md`}]},{title:`工作区与任务`,documents:[{title:`工作记录与任务看板`,path:`workspace/work-records.md`}]},{title:`对话与协作`,documents:[{title:`与 Tim 交流`,path:`conversations/talk-to-tim.md`},{title:`在企业微信中使用 Teammy`,path:`conversations/wecom.md`},{title:`代码仓库与 PR/MR 评审`,path:`conversations/code-review.md`}]},{title:`电脑与本地执行`,documents:[{title:`使用本地 Agent`,path:`computers/local-agent.md`},{title:`让开发 Agent 使用 Teammy`,path:`computers/agent-integration.md`}]},{title:`资料与经验`,documents:[{title:`资料、记忆与会话库`,path:`resources/library.md`}]},{title:`设置与维护`,documents:[{title:`项目与成员管理`,path:`settings/project-and-members.md`},{title:`模型接入与选择`,path:`settings/models.md`},{title:`客户端维护与同步`,path:`settings/client-maintenance.md`}]},{title:`问题排查`,documents:[{title:`常见问题`,path:`troubleshooting/common-issues.md`}]},{title:`Changelog`,documents:[{title:`版本更新`,path:`changelog.md`}]}]},M=l(),N=new Map(Object.entries(Object.assign({"../../../../docs/help/README.md":p,"../../../../docs/help/changelog.md":m,"../../../../docs/help/computers/agent-integration.md":h,"../../../../docs/help/computers/local-agent.md":g,"../../../../docs/help/conversations/code-review.md":_,"../../../../docs/help/conversations/talk-to-tim.md":v,"../../../../docs/help/conversations/wecom.md":y,"../../../../docs/help/getting-started/installation.md":b,"../../../../docs/help/getting-started/onboarding.md":x,"../../../../docs/help/getting-started/overview.md":S,"../../../../docs/help/resources/library.md":C,"../../../../docs/help/settings/client-maintenance.md":w,"../../../../docs/help/settings/models.md":T,"../../../../docs/help/settings/project-and-members.md":E,"../../../../docs/help/troubleshooting/common-issues.md":D,"../../../../docs/help/workspace/work-records.md":O})).map(([e,t])=>[e.slice(22),t])),P=new Map(Object.entries(Object.assign({"../../../../docs/help/assets/workflow.svg":k})).map(([e,t])=>[e.slice(22),t])),F=j.sections.flatMap(e=>e.documents)[0]??{title:`帮助`,path:`README.md`};function I(e,t){if(!/^(?:[a-z][a-z\d+.-]*:|\/)/i.test(e))try{let n=new URL(e,`https://help.invalid/${t}`);return{path:decodeURIComponent(n.pathname.slice(1)),hash:n.hash}}catch{}}function L({config:e,navigate:l}){let p=new URLSearchParams(location.search).get(`doc`)||F.path,m=N.get(p),h=location.hash,g=(0,A.useRef)(null),_=n(s.clientLatest,3e5),v=n(s.server,!0),y=`teammy connect --url ${a(v.data?.clientUrl??e.publicServerUrl)} --project ${a(e.projectId)}`,b=(n,r=``)=>t(`/projects/${encodeURIComponent(e.projectId)}/help?${new URLSearchParams({doc:n})}${r}`);(0,A.useEffect)(()=>{let e=g.current;if(!e)return;let t=``;try{t=decodeURIComponent(h.slice(1)).toLowerCase()}catch{}((t?[...e.querySelectorAll(`h1,h2,h3,h4,h5,h6`)].find(e=>e.textContent?.trim().toLowerCase().replace(/\s+/g,`-`)===t):void 0)??e).scrollIntoView({block:`start`})},[p,h]);function x(e,t){e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),l(t))}function S(e){return({children:t,href:n=``})=>{let r=I(n,e);if(!r||!r.path.endsWith(`.md`))return(0,M.jsx)(`a`,{href:r&&P.get(r.path)||n,target:`_blank`,rel:`noreferrer noopener`,children:t});let i=b(r.path,r.hash);return(0,M.jsx)(`a`,{href:i,onClick:e=>x(e,i),children:t})}}return(0,M.jsx)(i,{reading:!0,className:`help-explorer`,label:`帮助目录`,navigation:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(o,{title:`帮助`,icon:`help`}),(0,M.jsx)(`nav`,{className:`help-navigation`,"aria-label":`帮助文档`,children:j.sections.map(e=>(0,M.jsxs)(`section`,{children:[(0,M.jsx)(`h2`,{children:e.title}),(0,M.jsx)(`ul`,{children:e.documents.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsx)(u,{href:b(e.path),"aria-current":p===e.path?`page`:void 0,onClick:t=>x(t,b(e.path)),children:e.title})},e.path))})]},e.title))})]}),children:(0,M.jsx)(`section`,{className:`session-reader`,"aria-label":`帮助内容`,ref:g,children:m?(0,M.jsxs)(`article`,{className:`session-reader-content markdown`,"data-testid":`help-content`,children:[p===`getting-started/onboarding.md`&&(0,M.jsx)(c,{}),(0,M.jsx)(f,{components:{a:S(p),img:({src:e,alt:t})=>{let n=typeof e==`string`?I(e,p):void 0;return(0,M.jsx)(`img`,{src:n&&P.get(n.path)||e,alt:t,loading:`lazy`})},p:({children:e,node:t})=>t?.children.some(e=>e.type===`element`&&e.tagName===`code`&&e.children[0]?.type===`text`&&e.children[0].value===`{{TEAMMY_CLIENT_VERSION}}`)&&(!_.data||_.error)?(0,M.jsx)(`p`,{role:`status`,children:_.error?`暂时无法获取最新版客户端版本,如出现问题,请安装更新到最新版。`:`正在查询最新版客户端版本…`}):(0,M.jsx)(`p`,{children:e}),code:({children:e,className:t})=>(0,M.jsx)(`code`,{className:t,children:e===`{{TEAMMY_CLIENT_VERSION}}`?_.data?.version:e}),pre:({children:e,node:t})=>{let n=t?.children[0];return n?.type===`element`&&n.tagName===`code`&&n.children.length===1&&n.children[0]?.type===`text`&&n.children[0].value.trim()===`{{TEAMMY_CONNECT_COMMAND}}`?(0,M.jsx)(d,{id:`help-connect-command`,label:`连接命令`,value:y},y):(0,M.jsx)(`pre`,{children:e})}},children:m})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(r,{title:`未找到这篇帮助文档`}),(0,M.jsxs)(`a`,{href:b(F.path),onClick:e=>x(e,b(F.path)),children:[`返回`,F.title]})]})})})}export{L as Help};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{tt as e}from"./index-xjf37um4.js";var t=e();function n({url:e,name:n}){return(0,t.jsx)(`iframe`,{className:`html-preview`,title:`${n} 预览`,src:`${e}${e.includes(`?`)?`&`:`?`}view=html`,sandbox:``,referrerPolicy:`no-referrer`})}export{n as t};
|