@teammy/server 0.2.6 → 0.2.8
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 +2005 -1631
- package/dist/native-pi-entry.js +4 -2
- package/dist/runtime/README.md +2 -2
- package/dist/runtime/shared/tools.json +1 -1
- package/dist/runtime/workflows/session-handoff/config.json +1 -1
- package/dist/runtime/workflows/session-handoff/prompt.md +1 -1
- package/dist/web/assets/Assistant-CYSa4zNi.js +1 -0
- package/dist/web/assets/Computers-4L48XuFg.js +4 -0
- package/dist/web/assets/Computers-_ugR447I.css +1 -0
- package/dist/web/assets/{Conversation-BY4zPO36.js → Conversation-BBWm5w-C.js} +1 -1
- package/dist/web/assets/Dashboard-Bdh00JcC.css +1 -0
- package/dist/web/assets/Dashboard-Ck2NsAbX.js +1 -0
- package/dist/web/assets/Files-CjNjoKS3.js +1 -0
- package/dist/web/assets/{Help-D_OceEX-.js → Help-DwUoT8ZM.js} +151 -60
- package/dist/web/assets/{HtmlPreview-BasLBM4N.js → HtmlPreview-B6aQIaMB.js} +1 -1
- package/dist/web/assets/{Markdown-B13Lfgpp.js → Markdown-DorC2YjE.js} +4 -4
- package/dist/web/assets/MessageComposer-DQBDG5yF.js +1 -0
- package/dist/web/assets/ResourceLibrary-104NuVRn.js +6 -0
- package/dist/web/assets/{ResourceLibrary-COmSSC8U.css → ResourceLibrary-BB5EdMby.css} +1 -1
- package/dist/web/assets/WorkspaceTree-B4FMRlCw.js +1 -0
- package/dist/web/assets/{file-links-CpTkSiiH.js → file-links-DnngiTbC.js} +1 -1
- package/dist/web/assets/index-DiR0ePCJ.js +66 -0
- package/dist/web/downloads/teammy-skill.zip +0 -0
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/Assistant-0ww2vlrH.js +0 -1
- package/dist/web/assets/Computers-Dc45R6Gl.css +0 -1
- package/dist/web/assets/Computers-yY5fO1ow.js +0 -3
- package/dist/web/assets/Dashboard-Cc8spFKR.js +0 -1
- package/dist/web/assets/Dashboard-DIunax0h.css +0 -1
- package/dist/web/assets/Files-DHGsGF_a.js +0 -1
- package/dist/web/assets/MessageComposer-8oeL6-cz.js +0 -1
- package/dist/web/assets/ResourceLibrary-BQ8s0LIx.js +0 -6
- package/dist/web/assets/WorkspaceTree-Dj0bClAO.js +0 -1
- package/dist/web/assets/index-BNGGPn0r.js +0 -66
|
Binary file
|
package/dist/web/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<meta name="theme-color" content="#161615" />
|
|
7
7
|
<title>Teammy 工作台</title>
|
|
8
8
|
<link rel="icon" type="image/png" href="./assets/teammy-favicon-BiDvlPj2.png" />
|
|
9
|
-
<script type="module" crossorigin src="./assets/index-
|
|
9
|
+
<script type="module" crossorigin src="./assets/index-DiR0ePCJ.js"></script>
|
|
10
10
|
<link rel="stylesheet" crossorigin href="./assets/index-6PvvMCD7.css">
|
|
11
11
|
</head>
|
|
12
12
|
<body>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as e,B as t,Ct as n,H as r,J as i,R as a,St as o,V as s,X as c,Y as l,Z as ee,a as u,dt as d,et as f,ft as p,g as m,gt as h,ht as g,i as te,mt as _,n as v,o as y,pt as ne,q as re,r as ie,t as ae,vt as oe,y as se,z as b}from"./index-BNGGPn0r.js";import{t as ce}from"./Markdown-B13Lfgpp.js";import{a as le,i as ue,n as de,r as fe,t as pe}from"./Conversation-BY4zPO36.js";import{t as me}from"./MessageComposer-8oeL6-cz.js";var x=o(),S=c(),he=g({topics:d(g({id:h(),title:h(),summary:h(),author:h(),replies:_(),unread:p(),createdAt:h(),updatedAt:h(),delivery:g({available:p(),connected:p(),state:h(),error:h().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:o,mode:c=`messages`}){let{projectId:d,request:_}=se(),w=l(),ve=i(d,o,`${c}-selection`),T=i(d,o,`${c}-drafts`),ye=(0,x.useCallback)(e=>_(`agents/outbox`,u,{signal:e}),[_]),E=re(ye,3e3,i(d,o,`outbox`)),be=(0,x.useCallback)(async e=>c===`messages`?_(`agents/chats`,ae,{signal:e}):{chats:(await _(`channels/topics`,he,{signal:e})).topics.map(e=>({...e,kind:`matter`,state:null}))},[_,c]),D=re(be,3e3,i(d,o,c,`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(i(d,o,`chat`,k))),N=j?.id===k?j:w?.get(i(d,o,`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)(f()),[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(i(d,o,`chat`,j.id),j)},[w,d,o,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=>c===`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`&&_(`agents/outbox/${Z.id}/read`,y,{method:`POST`}).then(()=>{window.dispatchEvent(new Event(`teammy:outbox`)),E.reload()}).catch(t=>W(e(t)))},[Z?.id,Z?.readAt,O,_,E.reload]),(0,x.useEffect)(()=>{O===`debug`&&Q&&Promise.all(Q.split(`,`).map(e=>_(`agents/outbox/${e}/read`,y,{method:`POST`}))).then(()=>{window.dispatchEvent(new Event(`teammy:outbox`)),E.reload()}).catch(t=>W(e(t)))},[O,Q,_,E.reload]),(0,x.useEffect)(()=>{if(G(``),!k)return;let t=!0,r=-1,a=!1,s=new AbortController,l=e=>{!t||e.id!==k||e.cursor<r||(r=e.cursor,a=!0,e.redirect?Y(`chat:${e.redirect}`):e.entry===`channel`&&c!==`channels`?location.replace(n(`/projects/${d}/channels?chat=${e.id}`)):(M(e),G(``)))};_(`agents/chats/${k}`,v,{signal:s.signal}).then(l).catch(n=>{t&&!s.signal.aborted&&(n instanceof ee&&[401,403,404].includes(n.status)&&(w?.delete(i(d,o,`chat`,k)),M(e=>e?.id===k?void 0:e)),a||G(e(n)))});let u=e=>{let n=Number(e.lastEventId);return!t||!Number.isSafeInteger(n)||n<=r?!1:(r=n,!0)},f=new EventSource(n(`/api/v1/projects/${encodeURIComponent(d)}/agents/chats/${encodeURIComponent(k)}/events`));f.addEventListener(`snapshot`,n=>{if(t)try{l(v.parse(JSON.parse(n.data)))}catch(t){G(e(t))}}),f.onerror=()=>{t&&G(`对话连接中断,正在重新连接…`)},f.addEventListener(`context`,e=>{if(!u(e))return;let t=v.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)}),f.addEventListener(`message`,e=>{if(!u(e))return;let t=ie.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)}),f.addEventListener(`message_removed`,e=>{if(!u(e))return;let{id:t}=g({id:h()}).parse(JSON.parse(e.data));M(e=>e?.id===k?{...e,cursor:r,messages:e.messages.filter(e=>e.id!==t)}:e)}),f.addEventListener(`run`,e=>{if(!u(e))return;let t=te.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`])f.addEventListener(e,t=>{if(!u(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,s.abort(),f.close()}},[d,k,o,_,w]),(0,x.useEffect)(()=>{if(!N||N.id!==k)return;let t=()=>{document.visibilityState===`visible`&&_(`agents/chats/${k}/read`,g({ok:p()}),{method:`POST`,body:{cursor:N.readCursor}}).then(()=>{D.reload(),window.dispatchEvent(new Event(`teammy:outbox`))}).catch(t=>W(e(t)))},n=setTimeout(t,300);return document.addEventListener(`visibilitychange`,t),()=>{clearTimeout(n),document.removeEventListener(`visibilitychange`,t)}},[k,N?.readCursor,N?.kind,_]),(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 $(t){if(q.current=!0,Y(t),W(``),I(void 0),t.startsWith(`chat:`)||t===`debug`)return;let n=E.data?.messages.find(e=>e.id===t)?.conversationId;if(n)Y(`chat:${n}`);else try{await _(`agents/outbox/${t}/read`,y,{method:`POST`}),Ie()}catch(t){W(e(t))}}async function Le(){if(!V){Te(!0),W(``);try{let e=await _(`agents/chats`,v,{method:`POST`});M(e),await $(`chat:${e.id}`),D.reload()}catch(t){W(e(t))}finally{Te(!1)}}}async function Re(t){t.preventDefault();let n=Ce.trim();if(!n||z||V)return;B(!0),W(``);let r=K.current.get(O);r&&r.text===n||(r={text:n,id:f()},K.current.set(O,r));try{if(A){let e=r.target??k;if(!e){let t=await _(`agents/chats`,v,{method:`POST`});e=t.id,r.target=e,K.current.set(`chat:${e}`,r),R(t=>({...t,[`chat:${e}`]:n})),J.current===O&&(M(t),Y(`chat:${e}`))}let t=await _(`agents/chats/${e}`,te.extend({conversationId:h().optional()}),{method:`POST`,body:{text:n,requestId:r.id}});t.conversationId&&t.conversationId!==e&&(J.current===O||J.current===`chat:${e}`)&&Y(`chat:${t.conversationId}`),M(n=>n?.id===e?{...n,runs:n.runs.some(e=>e.id===t.id)?n.runs:[...n.runs,t]}:n),D.reload()}else{let e=await _(`agents/outbox/${Z.id}/reply`,g({conversationId:h()}),{method:`POST`,body:{body:n,requestId:r.id}});Ie(),J.current===O&&Y(`chat:${e.conversationId}`),D.reload(),I(void 0)}K.current.delete(O),r.target&&K.current.delete(`chat:${r.target}`),R(e=>({...e,[O]:``,...r.target?{[`chat:${r.target}`]:``}:{}}))}catch(t){W(e(t))}finally{B(!1)}}let ze=c===`channels`?ue:pe,Be=A&&!N?.closed&&(c!==`channels`||!!k)||!!Z&&!Z.archivedAt,Ve=A&&!N&&(!!k||!D.data);return(0,S.jsxs)(fe,{className:c===`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:c===`channels`?`频道`:`对话`}),(0,S.jsxs)(`div`,{className:`assistant-list-actions`,children:[(0,S.jsx)(b,{className:`assistant-new-chat`,icon:`clear`,label:`清除未读`,disabled:Ee,onClick:()=>{De(!0),W(``),_(`communication/read`,g({ok:ne(!0)}),{method:`POST`,body:{scope:c}}).then(async()=>{window.dispatchEvent(new Event(`teammy:outbox`)),await Promise.all([D.reload(),E.reload()])}).catch(t=>W(e(t))).finally(()=>De(!1))}}),(0,S.jsx)(b,{className:`assistant-new-chat`,icon:`plus`,label:c===`channels`?`发表话题`:`新建对话`,disabled:V,onClick:()=>c===`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||c!==`channels`&&(e.state===`running`||e.state===`queued`)?`unread`:``}`}),(0,S.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,S.jsx)(m,{selected:k===e.id,children:(0,S.jsx)(`strong`,{children:e.title})}),c===`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)(m,{selected:O===`debug`,children:(0,S.jsx)(`strong`,{children:`运行提醒`})}),(0,S.jsx)(`span`,{children:C(X.at(-1).body)})]})]}),E.data?.messages.filter(e=>c===`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)(m,{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)(r,{error:!0,children:E.error||D.error})]}),children:[Oe&&(0,S.jsxs)(s,{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:t=>{t.preventDefault(),B(!0),W(``),_(`channels/topics`,v,{method:`POST`,body:{id:Me.current,title:U,body:Ae}}).then(e=>{M(e),Y(`chat:${e.id}`),H(!1),ke(``),je(``),Me.current=f(),D.reload()}).catch(t=>W(e(t))).finally(()=>B(!1))}}),(0,S.jsx)(r,{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:[c!==`channels`&&N?.kind===`matter`&&(0,S.jsxs)(`span`,{className:`assistant-participants`,title:N.participants?.join(`、`),children:[N.visibility===`project`?`项目共享 · `:``,N.participants?.join(`、`)]}),c===`channels`&&F?.available&&(F.state===`web`||F.state===`cancelled`||!F.connected)&&(0,S.jsx)(b,{icon:`send`,label:`发布到企业微信频道`,disabled:z,onClick:()=>{B(!0),_(`channels/topics/${k}/publish`,oe(),{method:`POST`}).then(()=>D.reload()).catch(t=>W(e(t))).finally(()=>B(!1))}})]})}),c===`channels`&&(0,S.jsx)(r,{error:!0,children:F?.error}),c!==`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)(t,{}),(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===o,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)(r,{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)(t,{}),(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)(r,{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)(a,{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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.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}.agent-logo{object-fit:contain;flex-shrink:0;width:24px;height:24px;padding:1px;display:block}.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-muted)}.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)}}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{$ as e,A as t,C as n,Ct as r,D as i,E as a,H as o,I as s,O as c,P as l,R as u,S as d,St as f,T as p,V as m,X as h,b as g,d as _,dt as v,et as y,ft as b,gt as x,h as S,ht as C,j as w,k as T,m as E,q as D,v as O,vt as ee,w as k,x as A,y as j,z as te}from"./index-BNGGPn0r.js";import{t as M}from"./Markdown-B13Lfgpp.js";import{a as ne,n as re,o as N,r as P,t as ie}from"./Conversation-BY4zPO36.js";import{n as F,t as ae}from"./MessageComposer-8oeL6-cz.js";import{r as oe}from"./WorkspaceTree-Dj0bClAO.js";var I=f(),L=h();function R(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 z({children:e}){return(0,L.jsx)(`div`,{className:`computer-divider`,children:(0,L.jsx)(`span`,{children:e})})}function B({message:e}){let t=e.state===`succeeded`?`已工作`:e.state===`interrupted`?`已停止`:e.state===`failed`?`执行失败`:`需要核对`;return(0,L.jsxs)(z,{children:[t,e.activity?.durationMs===void 0?``:` · ${R(e.activity.durationMs)}`]})}var V={offered:`待本地接收`,pending:`待投递`,human_routed:`未送达本地`,failed:`失败`,uncertain:`需要核对`};function se({messages:e,renderQuestion:t}){let n=new Map(e.filter(e=>e.activity?.kind===`turn`).map(e=>[e.activity.turnId,e])),r=new Map,i=new Set(e.flatMap(e=>{let t=e.question?.planSource;return t?[JSON.stringify([t.turnId,t.itemId])]:[]})),a=new Set(e.flatMap(e=>{let t=e.activity;return t?.kind===`commentary`&&i.has(JSON.stringify([t.turnId,t.itemId]))?[JSON.stringify([t.turnId,e.body])]:[]}));for(let t of e)t.activity?.kind===`answer`&&!r.has(t.activity.turnId)&&r.set(t.activity.turnId,t.id);return(0,L.jsx)(`div`,{className:`computer-messages`,children:e.map(e=>{let o=e.activity;if(o?.kind===`commentary`&&(i.has(JSON.stringify([o.turnId,o.itemId]))||a.has(JSON.stringify([o.turnId,e.body]))))return null;if(e.role===`system`)return(0,L.jsx)(z,{children:e.body},e.id);if(o?.kind===`turn`)return r.has(o.turnId)?null:(0,L.jsx)(B,{message:e},e.id);if(e.role===`user`)return(0,L.jsxs)(ie,{mine:!0,author:`你`,time:e.createdAt,children:[(0,L.jsx)(`div`,{className:`markdown`,children:(0,L.jsx)(M,{children:e.body})}),V[e.state]&&(0,L.jsx)(N,{label:V[e.state],state:e.state})]},e.id);if(o?.kind===`tool`)return(0,L.jsxs)(`details`,{className:`computer-tool`,children:[(0,L.jsxs)(`summary`,{title:o.label,children:[(0,L.jsx)(u,{name:`chevron`,size:`small`}),(0,L.jsx)(`span`,{className:`computer-tool-label`,children:o.label??`工具调用`}),(0,L.jsxs)(`span`,{className:`computer-tool-status`,children:[e.state===`running`?`进行中`:e.state===`failed`?`失败`:e.state===`interrupted`?`已停止`:e.state===`uncertain`?`需核对`:``,o.durationMs!==void 0&&(0,L.jsx)(`span`,{children:R(o.durationMs)})]})]}),(0,L.jsx)(`pre`,{children:e.body})]},e.id);let s=o?.kind===`answer`&&r.get(o.turnId)===e.id?n.get(o.turnId):void 0;return(0,L.jsxs)(I.Fragment,{children:[s&&(0,L.jsx)(B,{message:s}),(0,L.jsx)(`article`,{className:`computer-agent-message ${o?.kind===`commentary`?`computer-commentary`:``} ${e.question?`question-bubble`:``}`,children:e.question?t(e.question):(0,L.jsx)(`div`,{className:`markdown`,children:(0,L.jsx)(M,{children:e.body})})})]},e.id)})})}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`}};function le({provider:e}){let{name:t,logo:n}=ce[e];return(0,L.jsx)(`img`,{className:`agent-logo`,src:n,alt:t,title:t,"data-provider":e,width:24,height:24})}function ue({disabled:e,onSend:t}){let[n,r]=(0,I.useState)(``),[i,a]=(0,I.useState)(!1),o=`其他回答`,s=(0,I.useRef)(null),c=(0,I.useCallback)(e=>{if(!s.current)return;let t=document.createElement(`canvas`).getContext(`2d`);if(!t)return;t.font=getComputedStyle(e).font;let r=Math.max(...(n||`${o}…`).split(`
|
|
2
|
-
`).map(e=>t.measureText(e).width));s.current.style.setProperty(`--reply-width`,`${Math.ceil(r+(i?52:26))}px`)},[n,i,o]),l=F(n,c);return(0,L.jsxs)(`form`,{ref:s,className:`inline-reply${i?` active`:``}`,onFocus:()=>a(!0),onBlur:e=>{!n&&!e.currentTarget.contains(e.relatedTarget)&&a(!1)},onSubmit:i=>{i.preventDefault(),!e&&n.trim()&&t(n.trim()).then(e=>{e&&r(``)})},children:[(0,L.jsx)(`textarea`,{ref:l,rows:1,"aria-label":`自定义回答`,placeholder:`${o}…`,value:n,disabled:e,onChange:e=>r(e.target.value),onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&!t.nativeEvent.isComposing&&(t.preventDefault(),!e&&n.trim()&&t.currentTarget.form?.requestSubmit())}}),i&&(0,L.jsx)(`button`,{className:`inline-reply-send`,type:`submit`,disabled:e||!n.trim(),"aria-label":`发送${o}`,title:`发送${o}`,children:(0,L.jsx)(u,{name:`send`,size:`small`})})]})}function de({question:t,session:n,request:r,refresh:i}){let[a,s]=(0,I.useState)({}),[c,l]=(0,I.useState)({}),[d,f]=(0,I.useState)(``),[p,m]=(0,I.useState)(!1),[h,g]=(0,I.useState)(!1),[_,v]=(0,I.useState)(``),x=(0,I.useRef)(null),S=(0,I.useRef)(!1),w=(0,I.useRef)(void 0);(0,I.useEffect)(()=>{if(t.state!==`pending`||S.current||!x.current)return;let i=!1,a=()=>{if(!i||document.visibilityState!==`visible`||!x.current)return;let a=x.current.getBoundingClientRect();a.bottom>0&&a.top<innerHeight&&r(`web/local-agent-sessions/${n}/questions/${t.id}/presented`,C({ok:b()}),{method:`POST`}).then(()=>{S.current=!0}).catch(t=>f(e(t)))},o=new IntersectionObserver(e=>{i=e.some(e=>e.isIntersecting),a()});return o.observe(x.current),document.addEventListener(`visibilitychange`,a),()=>{o.disconnect(),document.removeEventListener(`visibilitychange`,a)}},[t.id,t.state,n,r]);async function T(a){let o=JSON.stringify(a);w.current?.fingerprint!==o&&(w.current={fingerprint:o,value:{...a,id:y()}}),m(!0),f(``);try{return await r(`web/local-agent-sessions/${n}/questions/${t.id}/answers`,ee(),{method:`POST`,body:w.current.value}),w.current=void 0,i(),!0}catch(t){return f(e(t)),!1}finally{m(!1)}}let E=t.response,D=t.state===`answered`,O=[`expired`,`cancelled`].includes(t.state),k=[`human_routed`,`failed`,`handled`].includes(t.submissionState??``)&&!D,A=t.state===`pending`&&(!E||k),j=t.kind===`plan`,te=t.actions?.find(e=>e.id===E?.actionId),ne=O?`已过期`:t.state===`uncertain`||t.submissionState===`uncertain`?`需核对`:D?j?te?.label??`已处理`:t.approval?E?.decision===!0?`已允许`:E?.decision===!1?`已拒绝`:`已处理`:E?``:`已回答`:k?`请重新提交`:E?`正在提交`:``,re=O||E?.decision===!1||k?`close`:D?`check`:`clock`,N=t.questions.length>1||t.questions.some(e=>e.multiSelect),P=(e=a)=>T({body:t.questions.length===1?e[t.questions[0].id]||(c[t.questions[0].id]??[]).join(`、`):JSON.stringify(e),...t.kind||t.questions.some(e=>e.multiSelect)?{answers:e}:{},...t.questions.some(e=>e.multiSelect)?{selections:c}:{}});return(0,L.jsxs)(`div`,{className:`native-question ${j?`native-plan`:``}`,ref:x,children:[j?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`native-plan-heading`,children:[(0,L.jsx)(u,{name:`file`,size:`small`}),(0,L.jsx)(`span`,{children:`实施计划`})]}),A?(0,L.jsx)(`div`,{className:`native-plan-content markdown`,children:(0,L.jsx)(M,{children:t.plan??``})}):(0,L.jsxs)(`details`,{className:`native-plan-history markdown`,children:[(0,L.jsx)(`summary`,{children:`查看计划`}),(0,L.jsx)(M,{children:t.plan??``})]}),A&&(0,L.jsxs)(L.Fragment,{children:[!h&&(0,L.jsx)(`div`,{className:`question-actions native-plan-actions ${t.actions&&t.actions.length>3?`native-plan-actions-expanded`:``}`,children:t.actions?.map(e=>(0,L.jsx)(`button`,{type:`button`,disabled:p,title:e.description,className:e.id===`implement`?`primary`:``,onClick:()=>e.id===`revise`?g(!0):void T({body:e.label,actionId:e.id}),children:e.label},e.id))}),!h&&t.actions?.find(e=>e.id===`implement`)?.description&&(0,L.jsxs)(`small`,{className:`native-plan-note muted`,children:[`开始实施:`,t.actions.find(e=>e.id===`implement`).description]}),h&&(0,L.jsxs)(`form`,{className:`native-plan-feedback`,onSubmit:e=>{e.preventDefault(),T({body:_,actionId:`revise`})},children:[(0,L.jsxs)(`label`,{children:[`修改意见`,(0,L.jsx)(`textarea`,{autoFocus:!0,value:_,onChange:e=>v(e.target.value),placeholder:`说明希望调整的部分,Agent 将修改后再次请求确认`})]}),(0,L.jsxs)(`div`,{className:`question-actions native-plan-feedback-actions`,children:[(0,L.jsx)(`button`,{className:`primary`,disabled:p||!_.trim(),children:`提交修改意见`}),(0,L.jsx)(`button`,{type:`button`,disabled:p,onClick:()=>g(!1),children:`返回计划`})]})]})]}),!A&&E?.actionId===`revise`&&E.answers.feedback&&(0,L.jsx)(`div`,{className:`question-response`,children:E.answers.feedback})]}):(0,L.jsxs)(L.Fragment,{children:[t.questions.map(e=>(0,L.jsxs)(`div`,{className:`native-question-part`,children:[(0,L.jsx)(`p`,{className:t.approval?`native-approval-detail`:``,children:e.text}),A&&(0,L.jsx)(`div`,{className:`question-options ${t.approval?`native-approval-options`:Object.values(e.descriptions??{}).some(Boolean)?`question-options-described`:``}`,children:(t.approval?[`允许`,`拒绝`]:e.options).map(n=>(0,L.jsxs)(`button`,{type:`button`,disabled:p,"aria-pressed":e.multiSelect?c[e.id]?.includes(n)??!1:a[e.id]===n,onClick:()=>{if(e.multiSelect){l(t=>({...t,[e.id]:t[e.id]?.includes(n)?t[e.id].filter(e=>e!==n):[...t[e.id]??[],n]}));return}let r={...a,[e.id]:n};s(r),t.approval?T({body:n,decision:n===`允许`}):N||P(r)},children:[(0,L.jsxs)(`span`,{className:`question-option-label`,children:[e.multiSelect&&(0,L.jsx)(`span`,{"aria-hidden":`true`,className:`question-check`,children:c[e.id]?.includes(n)&&(0,L.jsx)(u,{name:`check`,size:`small`})}),n]}),e.descriptions?.[n]&&(0,L.jsx)(`small`,{children:e.descriptions[n]})]},n))}),!t.approval&&e.freeText&&A&&(0,L.jsx)(ue,{disabled:p,onSend:async t=>{let n={...a,[e.id]:t};return s(n),N?!0:P(n)}}),A&&N&&a[e.id]&&!e.options.includes(a[e.id])&&(0,L.jsx)(`small`,{children:a[e.id]}),!A&&!t.approval&&(E?.answers[e.id]||E?.selections?.[e.id]?.length)&&(0,L.jsxs)(`div`,{className:`question-response`,children:[(0,L.jsx)(u,{name:D?`check`:`clock`,size:`small`}),(0,L.jsx)(`span`,{children:[...E.selections?.[e.id]??[],E.answers[e.id]].filter(Boolean).join(`、`)})]})]},e.id)),A&&!t.approval&&N&&(0,L.jsx)(`div`,{className:`question-actions`,children:(0,L.jsx)(`button`,{disabled:p||t.questions.some(e=>!a[e.id]?.trim()&&!c[e.id]?.length),onClick:()=>void P(),children:`回答`})}),A&&t.approval&&t.autoApprove!==!1&&(0,L.jsx)(`small`,{className:`muted`,children:`60 秒后自动允许`})]}),ne&&(0,L.jsxs)(`small`,{className:`question-result`,children:[(0,L.jsx)(u,{name:re,size:`small`}),ne]}),(0,L.jsx)(o,{error:!0,children:d})]})}var H={minimal:`极低`,low:`低`,medium:`中`,high:`高`,xhigh:`极高`,max:`最高`,ultra:`极致`,none:`无`},U=[{value:`read-only`,label:`只读`,description:`读取文件,不修改代码`},{value:`workspace-write`,label:`工作区写入`,shortLabel:`工作区`,description:`可修改工作区,额外权限按需审批`},{value:`full-access`,label:`完全访问`,description:`允许全部访问,执行时无需审批`}];function W({id:e,label:t,current:n,options:r,disabled:i,onSelect:a}){let o=r.find(e=>e.value===n);return(0,L.jsx)(E,{id:`${e}-menu`,triggerId:e,placement:`top`,className:`composer-menu composer-choice`,label:`选择${t}`,disabled:i,routeKey:n,trigger:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{title:`${t}:${o?.label??n}`,children:o?.shortLabel??o?.label??n}),(0,L.jsx)(u,{name:`chevronDown`,size:`small`})]}),children:e=>(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`composer-menu-heading`,children:t}),r.map(t=>(0,L.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-label":t.label,onClick:()=>{e(),a(t.value)},children:[(0,L.jsxs)(`span`,{className:`composer-option-copy`,children:[(0,L.jsx)(`span`,{children:t.label}),t.description&&(0,L.jsx)(`small`,{children:t.description})]}),t.value===n&&(0,L.jsx)(u,{name:`check`,size:`small`})]},t.value))]})})}function fe({session:e,models:n,busy:r,available:i,online:a,commands:o,draft:s,onInsert:l,onConfig:d}){let[f,p]=(0,I.useState)(!1);(0,I.useEffect)(()=>{/^[/$]([^\s]*)$/.exec(s)?p(!0):p(!1)},[s]);let m=e.config.model??e.effectiveConfig?.model,h=n.find(e=>e.id===m||e.resolvedModel===m)??(e.config.model?void 0:n.find(e=>e.isDefault)),g=r||!i,_=e.provider===`claude`,v=e.provider===`cursor`,y=e.appliedRevision===e.revision?e.effectiveConfig?.mode:void 0,b=n.find(e=>e.isDefault)?.id??(e.config.model?null:e.effectiveConfig?.model),x=n.find(e=>e.id===b)?.name??b,S=e=>_?e.replace(/^Claude\s+/,``):e,C=[{value:``,label:x?`默认 · ${x}`:n.length?`默认模型`:`模型未获取`,shortLabel:x?S(x):n.length?`默认模型`:`模型`},...n.map(e=>({value:e.id,label:e.name,shortLabel:S(e.name)}))];e.config.model&&!n.some(t=>t.id===e.config.model)&&C.push({value:e.config.model,label:e.config.model,shortLabel:S(e.config.model)});let w=h?.id===e.effectiveConfig?.model?e.effectiveConfig?.effort:h?.defaultEffort,D=[{value:``,label:w?`默认 · ${H[w]??w}`:`默认强度`,shortLabel:w?H[w]??w:`强度`},...(h?.efforts??[]).map(e=>({value:e,label:H[e]??e}))];return e.config.effort&&!D.some(t=>t.value===e.config.effort)&&D.push({value:e.config.effort,label:H[e.config.effort]??e.config.effort}),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(E,{id:`session-commands`,triggerId:`session-command-trigger`,label:`命令与 Skills`,placement:`top`,className:`composer-menu composer-commands`,routeKey:e.id,trigger:(0,L.jsx)(u,{name:`command`,size:`small`}),open:f,onOpenChange:p,focusFirst:!1,disabled:g||!a,children:e=>(0,L.jsxs)(L.Fragment,{children:[[...o].sort((e,t)=>e.name.localeCompare(t.name,`en`)).map(t=>(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,title:[t.description,t.path].filter(Boolean).join(`
|
|
3
|
-
`),onClick:()=>{e(),l(t)},children:(0,L.jsxs)(`span`,{className:`composer-command-row`,children:[(0,L.jsxs)(`span`,{className:`composer-command-name`,children:[t.kind===`skill`?`$`:`/`,t.name]}),(0,L.jsx)(`small`,{children:t.description})]})},`${t.kind}:${t.path??t.name}`)),!o.length&&(0,L.jsx)(`div`,{className:`composer-menu-heading`,children:`尚未获取命令`})]})}),(0,L.jsx)(W,{id:`session-model`,label:`模型`,current:e.config.model??``,options:C,disabled:g,onSelect:t=>{let r=n.find(e=>e.id===t);d({...e.config,model:t||null,...v?{options:{}}:{},effort:e.config.effort&&r?.efforts.includes(e.config.effort)?e.config.effort:null})}}),(!v||(h?.efforts.length??0)>0)&&(0,L.jsx)(W,{id:`session-effort`,label:`思考强度`,current:e.config.effort??``,options:D,disabled:g,onSelect:t=>d({...e.config,effort:t||null})}),v&&h?.options?.map(t=>(0,L.jsx)(W,{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],d({...e.config,options:r})}},t.id)),v&&(0,L.jsx)(W,{id:`session-mode`,label:`工作模式`,current:y??e.config.mode??`agent`,options:[...T],disabled:g,onSelect:t=>d({...e.config,mode:t})}),(0,L.jsx)(W,{id:`session-permission`,label:_?`模式`:`权限`,current:_?y??e.config.mode??`default`:e.config.permission,options:_?[...c]:v?[...t]:U,disabled:g,onSelect:t=>d(_?{...e.config,mode:t}:{...e.config,permission:t})})]})}var pe=C({taskRoot:x().nullable().default(null),online:b(),computer:C({id:x(),name:x(),platform:x()}).nullable(),capabilities:v(x()),models:v(p),providers:v(a).default([]),catalogs:v(k).default([]),directories:v(g),sessions:v(n)}),me=C({ok:b()}),he={idle:`空闲`,working:`工作中`,waiting:`等待回答`,queued:`等待执行`,uncertain:`需要核对`,human:`人工处理`,offered:`待本地接收`,accepted:`本地已接手`,human_routed:`未送达本地`,pending:`待投递`,sent:`已发送`,succeeded:`已完成`,running:`进行中`,failed:`失败`};function ge(){let{request:e}=j(),t=(0,I.useCallback)(t=>e(`web/local-agent-settings`,A,{signal:t}),[e]),n=D(t,3e4);return n.error?(0,L.jsx)(o,{error:!0,children:n.error}):n.data?n.data.accessible?(0,L.jsx)(_e,{}):(0,L.jsx)(s,{title:`本项目暂未向你开放本地 Agent 功能`}):null}function _e(){let t=j(),[i,a]=(0,I.useState)(()=>new Set),[s,c]=(0,I.useState)(()=>({project:t.projectId,directory:new URLSearchParams(location.search).get(`directory`)??``,session:new URLSearchParams(location.search).get(`session`)??``})),[f,p]=(0,I.useState)(``),[h,g]=(0,I.useState)(!1),[v,b]=(0,I.useState)(!1),[x,C]=(0,I.useState)(!1),[T,k]=(0,I.useState)(``),[A,M]=(0,I.useState)(``),[ie,F]=(0,I.useState)(!1),[R,z]=(0,I.useState)(`codex`),[B,V]=(0,I.useState)(``),[ce,ue]=(0,I.useState)(``),H=(0,I.useRef)(null),U=(0,I.useRef)(!0),W=(0,I.useRef)(void 0),ge=(0,I.useRef)(y()),_e=(0,I.useCallback)(async e=>[{...await t.request(`web/local-agent-computer`,pe,{signal:e}),project:t.projectId}],[t]),G=D(_e,3e3),K=G.data?.find(e=>e.project===s.project),q=K?.directories.find(e=>e.id===s.directory);O(s.project);let J=(0,I.useCallback)((e,t,n)=>O(s.project).request(e,t,n),[s.project]),be=(0,I.useCallback)(e=>s.session?J(`web/local-agent-sessions/${s.session}`,d,{signal:e}):Promise.resolve(null),[J,s.session]),Y=D(be,15e3),[xe,Se]=(0,I.useState)(),X=xe?.session.id===s.session&&(!Y.data||xe.cursor>=Y.data.cursor)?xe:Y.data;(0,I.useEffect)(()=>{if(!s.session)return;let t=new EventSource(r(`/api/v1/projects/${encodeURIComponent(s.project)}/web/local-agent-sessions/${encodeURIComponent(s.session)}/events`)),n=!0;return t.addEventListener(`snapshot`,t=>{try{let e=d.parse(JSON.parse(t.data));n&&Se(t=>t?.session.id===e.session.id&&t.cursor>e.cursor?t:e)}catch(t){p(e(t))}}),()=>{n=!1,t.close()}},[s.project,s.session]),(0,I.useEffect)(()=>{U.current=!0},[s.project,s.session]),(0,I.useEffect)(()=>{U.current&&H.current&&(H.current.scrollTop=H.current.scrollHeight)},[X?.cursor,X?.messages.length]);let Z=X?.session,Q=K?.capabilities.includes(`local-sessions-v1`),Ce=(e,n,r=``)=>{c({project:e,directory:n,session:r}),C(!1),F(!1),ue(``),k(``),p(``);let i=new URL(location.href);i.searchParams.set(`directory`,n),r?i.searchParams.set(`session`,r):i.searchParams.delete(`session`),e===t.projectId&&history.replaceState(null,``,i)};(0,I.useEffect)(()=>{if(!s.directory&&G.data?.[0]?.directories[0]){let e=G.data[0],t=e.directories[0],n=e.sessions.find(e=>e.id===s.session);Ce(e.project,n?.directory??t.id,n?.id??t.defaultSession)}},[G.data]),(0,I.useEffect)(()=>{if(!Z)return;let t=()=>{document.visibilityState===`visible`&&J(`web/local-agent-sessions/${Z.id}/read`,me,{method:`POST`}).catch(t=>p(e(t)))};return t(),document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[Z?.id,X?.messages.at(-1)?.seq,J]);async function $(t){g(!0),p(``);try{await t(),await Promise.all([Y.reload(),G.reload()])}catch(t){p(e(t))}finally{g(!1)}}let[we,Te]=(0,I.useState)(null);(0,I.useEffect)(()=>Te(null),[Z?.id]);let Ee=K?.catalogs.find(e=>e.provider===(Z?.provider??`codex`)&&(Z?.cwd?e.cwd===Z.cwd:e.directory===(Z?.executionDirectory??Z?.directory)))?.commands??[],De=K?.providers.find(e=>e.id===Z?.provider)?.models??(Z?.provider===`codex`?K?.models??[]:[]),Oe=new Map;for(let e of G.data??[]){let t=e.computer?.id??`unknown:${e.project}`;Oe.set(t,[...Oe.get(t)??[],e])}return(0,L.jsxs)(P,{className:`computers-layout`,testId:`computers-page`,label:`本地会话`,tree:!0,navigation:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(_,{title:`电脑`,icon:`computers`,children:(0,L.jsx)(E,{id:`computer-create-menu`,triggerId:`computer-create`,label:`新建`,trigger:(0,L.jsx)(u,{name:`plus`}),className:`computer-create-menu`,routeKey:s.directory,children:e=>(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,disabled:!q||!Q,onClick:()=>{e(),F(!0),z(q?.provider??`codex`),V(``),b(!1),C(!1),p(``)},children:`新建会话`}),(0,L.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{e(),b(!0),F(!1),C(!1)},children:`接入目录`})]})})}),(0,L.jsx)(`div`,{className:`assistant-message-scroll computer-tree`,role:`tree`,"aria-label":`电脑与会话`,onKeyDown:oe,children:[...Oe.entries()].map(([e,t])=>(0,L.jsxs)(`div`,{role:`none`,children:[(0,L.jsxs)(`div`,{className:`computer-device`,children:[(0,L.jsx)(`span`,{className:`computer-connection ${t.some(e=>e.online)?`online`:``}`,role:`img`,"aria-label":t.some(e=>e.online)?`在线`:`离线`,title:t.some(e=>e.online)?`在线`:`离线`,children:(0,L.jsx)(u,{name:`device`,size:`small`})}),(0,L.jsx)(`span`,{title:t[0].computer?.name,children:t[0].computer?.name??`已连接客户端`})]}),t.map(e=>(0,L.jsx)(`div`,{role:`none`,children:e.directories.map(t=>{let n=`${e.project}/${t.id}`,r=!i.has(n);return(0,L.jsxs)(`div`,{role:`none`,children:[(0,L.jsxs)(S,{className:`tree-item tree-folder`,role:`treeitem`,"aria-level":1,"aria-expanded":r,style:{"--tree-level":1},leading:(0,L.jsx)(`span`,{className:`tree-chevron ${r?`expanded`:``}`,children:(0,L.jsx)(u,{name:`chevron`,size:`small`})}),onClick:()=>a(e=>{let t=new Set(e);return r?t.add(n):t.delete(n),t}),children:[(0,L.jsx)(u,{name:`files`}),(0,L.jsx)(`span`,{className:`tree-name`,title:t.name,children:t.name})]}),r&&(0,L.jsx)(`div`,{role:`group`,children:e.sessions.filter(e=>e.directory===t.id).map(n=>(0,L.jsxs)(S,{className:`tree-item`,role:`treeitem`,"aria-level":2,"aria-selected":s.session===n.id&&s.project===e.project,style:{"--tree-level":2},leading:(0,L.jsx)(`span`,{className:`tree-chevron`,children:(0,L.jsx)(`span`,{className:`assistant-message-dot ${n.unread?`unread`:``}`})}),title:`${n.title} · ${w[n.provider]}`,onClick:()=>Ce(e.project,t.id,n.id),children:[(0,L.jsx)(le,{provider:n.provider}),(0,L.jsx)(`span`,{className:`tree-name`,children:n.title}),n.archived?(0,L.jsx)(`span`,{title:`已归档`,role:`img`,"aria-label":`已归档`,children:(0,L.jsx)(u,{name:`archive`,size:`small`})}):n.state!==`idle`&&(0,L.jsx)(N,{state:n.state,label:he[n.state]??n.state})]},n.id))})]},t.id)})},e.project))]},e))}),(0,L.jsx)(o,{error:!0,children:G.error})]}),children:[v&&(0,L.jsx)(m,{id:`computer-attach`,title:`接入目录`,onClose:()=>b(!1),children:(0,L.jsxs)(`div`,{className:`stack computer-panel`,children:[(0,L.jsx)(l,{id:`computer-connect`,label:`在目标电脑连接项目`,value:`teammy connect`}),(0,L.jsx)(l,{id:`computer-register`,label:`在该电脑登记执行目录`,value:`teammy agent register --cwd .`}),(0,L.jsx)(`p`,{className:`muted`,children:`完成登记后自动显示。会话可直接在网页使用,也可连接专用群。`})]})}),q?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(re,{title:Z?(0,L.jsx)(ye,{title:Z.title,busy:h,onSave:e=>$(()=>J(`web/local-agent-sessions/${Z.id}/settings`,n,{method:`PUT`,body:{expectedRevision:Z.revision,title:e,config:Z.config}}))},Z.id):(0,L.jsx)(`h2`,{children:q.name}),actions:(0,L.jsx)(te,{icon:`settings`,label:`会话与目录设置`,disabled:!Z,onClick:()=>C(!0)})}),!Q&&(0,L.jsx)(o,{children:`升级客户端后可使用多个会话和网页对话。`}),ie&&(0,L.jsx)(m,{id:`computer-new-session`,title:`新建会话`,onClose:()=>F(!1),children:(0,L.jsxs)(`form`,{className:`computer-panel stack`,onSubmit:e=>{e.preventDefault(),$(async()=>{let e=await J(`web/local-agents/${q.id}/sessions`,n,{method:`POST`,body:{id:ge.current,title:A,provider:R,...R!==`codex`&&B.trim()?{resumeSession:B.trim()}:{}}});ge.current=y(),F(!1),M(``),Ce(s.project,q.id,e.id)})},children:[(0,L.jsxs)(`label`,{children:[`会话名称`,(0,L.jsx)(`input`,{autoFocus:!0,required:!0,placeholder:`会话名称`,value:A,onChange:e=>M(e.target.value)})]}),(0,L.jsxs)(`label`,{children:[`Agent`,(0,L.jsxs)(`select`,{"aria-label":`Agent`,value:R,onChange:e=>z(e.target.value),children:[(0,L.jsx)(`option`,{value:`codex`,children:`Codex`}),(0,L.jsx)(`option`,{value:`claude`,disabled:!K?.capabilities.includes(`local-agent-providers-v1`),children:`Claude Code`}),(0,L.jsx)(`option`,{value:`cursor`,disabled:!K?.providers.some(e=>e.id===`cursor`),children:`Cursor`})]})]}),R!==`codex`&&(0,L.jsxs)(L.Fragment,{children:[K?.providers.find(e=>e.id===R)?.error&&(0,L.jsx)(o,{children:K.providers.find(e=>e.id===R).error}),(0,L.jsxs)(`details`,{children:[(0,L.jsxs)(`summary`,{children:[`继续已有 `,R===`claude`?`Claude`:w[R],` `,`会话`]}),(0,L.jsxs)(`label`,{children:[`原生会话 ID(可选)`,(0,L.jsx)(`input`,{value:B,onChange:e=>V(e.target.value),placeholder:`留空创建新会话`})]}),(0,L.jsx)(`small`,{className:`muted`,children:`仅继续此目录中已停止的会话,请先退出原终端会话。`})]})]}),(0,L.jsx)(o,{error:!0,children:f}),(0,L.jsx)(`button`,{disabled:h||!A.trim(),children:`创建`})]})}),x&&Z&&K&&(0,L.jsx)(m,{id:`computer-settings`,title:`会话与目录设置`,onClose:()=>C(!1),children:(0,L.jsx)(ve,{session:Z,directory:q,entry:K,request:J,busy:h,save:$,code:ce,setCode:ue},`${Z.id}:${Z.revision}`)}),(0,L.jsxs)(ne,{ref:H,onScroll:e=>{let t=e.currentTarget;U.current=t.scrollHeight-t.scrollTop-t.clientHeight<96},"aria-label":`本地会话记录`,children:[(0,L.jsx)(se,{messages:X?.messages??[],renderQuestion:e=>(0,L.jsx)(de,{question:e,session:Z.id,request:J,refresh:Y.reload})}),!X?.messages.length&&(0,L.jsx)(`div`,{className:`assistant-empty`,children:`在当前目录开始一段对话。`})]}),X?.commands.filter(e=>e.state!==`succeeded`).slice(-3).map(e=>(0,L.jsxs)(`p`,{className:`computer-control-status`,role:`status`,children:[e.kind,` · `,he[e.state]??e.state,e.error?`:${e.error}`:``]},e.id)),(0,L.jsx)(o,{error:!0,children:f||Y.error||Z?.error}),Z&&(0,L.jsx)(ae,{value:T,onChange:k,label:`向本地 Agent 发送消息`,placeholder:Z.archived?`会话已归档`:`输入消息…`,disabled:Z.archived||!Q,sendDisabled:h,actions:(0,L.jsx)(fe,{session:Z,models:De,busy:h,available:!!Q,online:!!K?.online,commands:Ee,draft:T,onInsert:e=>{Te(e.kind===`skill`?e:null),k(`${e.kind===`skill`?`$`:`/`}${e.name} `),requestAnimationFrame(()=>document.querySelector(`.message-composer textarea`)?.focus())},onConfig:e=>{C(!1),$(()=>J(`web/local-agent-sessions/${Z.id}/settings`,n,{method:`PUT`,body:{expectedRevision:Z.revision,title:Z.title,config:e}}))}}),onSubmit:e=>{e.preventDefault();let t=T.trim();if(!t)return;let n=we?.path&&t.startsWith(`$${we.name}`)?[{name:we.name,path:we.path}]:void 0,r=JSON.stringify({session:Z.id,body:t,skills:n});W.current?.fingerprint!==r&&(W.current={fingerprint:r,id:y()});let i=W.current;$(async()=>{await J(`web/local-agent-sessions/${Z.id}/messages`,ee(),{method:`POST`,body:{id:i.id,body:t,...n?{skills:n}:{}}}),k(e=>e.trim()===t?``:e),Te(null),W.current===i&&(W.current=void 0)})}})]}):(0,L.jsxs)(`div`,{className:`assistant-empty`,children:[`尚未登记本地执行目录。`,(0,L.jsx)(`button`,{onClick:()=>b(!0),children:`接入目录`})]})]})}function G({value:e,onChange:n,models:r,provider:i=`codex`}){let a=r.find(t=>t.id===e.model);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`label`,{children:[`模型`,(0,L.jsxs)(`select`,{value:e.model??``,onChange:t=>n({...e,model:t.target.value||null,effort:null,...i===`cursor`?{options:{}}:{}}),children:[(0,L.jsx)(`option`,{value:``,children:`本机默认`}),r.map(e=>(0,L.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,L.jsxs)(`label`,{children:[`思考强度`,(0,L.jsxs)(`select`,{value:e.effort??``,onChange:t=>n({...e,effort:t.target.value||null}),children:[(0,L.jsx)(`option`,{value:``,children:`模型默认`}),a?.efforts.map(e=>(0,L.jsx)(`option`,{children:e},e))]})]}),i!==`codex`&&(0,L.jsxs)(`label`,{children:[`模式`,(0,L.jsx)(`select`,{value:e.mode??(i===`cursor`?`agent`:`default`),onChange:t=>n({...e,mode:t.target.value}),children:(i===`cursor`?T:c).map(e=>(0,L.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),i!==`claude`&&(0,L.jsxs)(`label`,{children:[`权限`,(0,L.jsx)(`select`,{value:e.permission,onChange:t=>n({...e,permission:t.target.value}),children:i===`cursor`?t.map(e=>(0,L.jsx)(`option`,{value:e.value,children:e.label},e.value)):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`option`,{value:`read-only`,children:`只读 · 禁止提权`}),(0,L.jsx)(`option`,{value:`workspace-write`,children:`工作区写入 · 按需审批`}),(0,L.jsx)(`option`,{value:`full-access`,children:`完全访问 · 无需审批`})]})})]}),i===`cursor`&&a?.options?.map(t=>(0,L.jsxs)(`label`,{children:[t.name,(0,L.jsxs)(`select`,{value:e.options?.[t.id]??``,onChange:r=>{let i={...e.options};r.target.value?i[t.id]=r.target.value:delete i[t.id],n({...e,options:i})},children:[(0,L.jsx)(`option`,{value:``,children:`模型默认`}),t.choices.map(e=>(0,L.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]},t.id))]})}function ve({session:e,directory:t,entry:r,request:a,busy:o,save:s,code:c,setCode:u}){let[d,f]=(0,I.useState)(t.defaults??i.parse({})),[p,m]=(0,I.useState)(t.defaultSession??e.id),[h,g]=(0,I.useState)(t.name),[_,v]=(0,I.useState)(t.responsibilities),[y,b]=(0,I.useState)(t.enabled),[S,w]=(0,I.useState)(e.executionDirectory),[T,E]=(0,I.useState)();return(0,I.useEffect)(()=>{a(`web/local-agent-settings`,A).then(E).catch(()=>{})},[a]),(0,L.jsxs)(`div`,{className:`computer-panel stack`,children:[(0,L.jsxs)(`details`,{open:!0,children:[(0,L.jsx)(`summary`,{children:`执行位置与连接`}),(0,L.jsx)(`div`,{className:`config-fields`,children:(0,L.jsxs)(`label`,{children:[`执行位置`,(0,L.jsxs)(`select`,{value:S??``,onChange:e=>w(e.target.value||null),children:[(0,L.jsx)(`option`,{value:``,children:`原登记目录`}),r.directories.filter(e=>e.id!==t.id).map(e=>(0,L.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})}),e.cwd&&(0,L.jsxs)(`p`,{className:`computer-paths`,children:[`当前执行路径:`,(0,L.jsx)(`code`,{children:e.cwd})]}),(0,L.jsx)(`button`,{disabled:o,onClick:()=>void s(()=>a(`web/local-agent-sessions/${e.id}/settings`,n,{method:`PUT`,body:{expectedRevision:e.revision,title:e.title,config:e.config,executionDirectory:S}})),children:`保存执行位置`}),(0,L.jsx)(`button`,{disabled:o||e.bound,onClick:()=>void s(async()=>{u((await a(`web/local-agent-bindings/codes`,C({code:x()}),{method:`POST`,body:{directory:t.id,session:e.id,expectedRevision:e.bindingRevision}})).code)}),children:e.bound?`已连接专用群`:`连接专用群`}),c&&(0,L.jsx)(l,{id:`session-binding`,label:`在目标群发送`,value:`/bind ${c}`})]}),(0,L.jsxs)(`details`,{children:[(0,L.jsx)(`summary`,{children:`目录默认设置与接单`}),(0,L.jsxs)(`div`,{className:`config-fields`,children:[(0,L.jsxs)(`label`,{children:[`目录名称`,(0,L.jsx)(`input`,{value:h,onChange:e=>g(e.target.value)})]}),(0,L.jsxs)(`label`,{children:[`职责`,(0,L.jsx)(`textarea`,{value:_,onChange:e=>v(e.target.value)})]}),(0,L.jsxs)(`label`,{children:[`默认会话`,(0,L.jsx)(`select`,{value:p,onChange:e=>m(e.target.value),children:r.sessions.filter(e=>e.directory===t.id&&!e.archived).map(e=>(0,L.jsx)(`option`,{value:e.id,children:e.title},e.id))})]}),(0,L.jsx)(G,{value:d,onChange:f,provider:t.provider,models:r.providers.find(e=>e.id===t.provider)?.models??r.models})]}),(0,L.jsx)(`p`,{className:`muted`,children:`用于新会话与新派工。`}),(0,L.jsx)(`button`,{disabled:o,onClick:()=>void s(()=>a(`web/local-agents/${t.id}/settings`,ee(),{method:`PUT`,body:{defaultSession:p,defaults:d,name:h,responsibilities:_,enabled:y,expectedRevision:t.revision}})),children:`保存目录默认设置`}),(0,L.jsxs)(`label`,{children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:y,onChange:e=>b(e.target.checked)}),`此目录自动接单`]}),(0,L.jsx)(`p`,{children:t.available?`可自动接单`:t.reason}),(0,L.jsxs)(`label`,{children:[(0,L.jsx)(`input`,{type:`checkbox`,checked:T?.enabled??!1,disabled:!T||o,onChange:e=>void s(async()=>E(await a(`web/local-agent-settings`,A,{method:`PUT`,body:{enabled:e.target.checked,expectedRevision:T.revision}})))}),`开启本项目的本地执行`]}),(0,L.jsx)(l,{id:`directory-intake`,label:t.enabled?`暂停此目录新增接单`:`开启此目录自动接单`,value:`teammy agent ${t.enabled?`disable`:`enable`} --id ${t.id}`})]})]})}function ye({title:e,busy:t,onSave:n}){let[r,i]=(0,I.useState)(!1),[a,o]=(0,I.useState)(e);return r?(0,L.jsx)(`form`,{className:`session-title-form`,onSubmit:t=>{t.preventDefault(),a.trim()&&a.trim()!==e&&n(a.trim()),i(!1)},children:(0,L.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,L.jsx)(`h2`,{children:(0,L.jsx)(`button`,{type:`button`,className:`session-rename`,title:`重命名会话`,"aria-label":`重命名会话:${e}`,onClick:()=>{o(e),i(!0)},children:e})})}export{ge as Computers};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as e,Ct as t,F as n,G as r,H as i,J as a,K as o,L as s,M as c,N as l,R as u,St as d,U as f,V as p,X as m,q as h,y as g,z as _}from"./index-BNGGPn0r.js";import{t as v}from"./project-links-Dy6-B89_.js";import"./file-links-CpTkSiiH.js";var y=d(),b=m(),x=[{status:`planned`,label:`计划`},{status:`in_progress`,label:`进行中`},{status:`in_review`,label:`待验收`},{status:`completed`,label:`已完成`},{status:null,label:`未明确`}];function S({members:e,project:r,userName:o}){let{request:s,projectId:l}=g(),d=(0,y.useCallback)(e=>s(`tasks`,c,{signal:e}),[s]),p=h(d,3e3,a(l,`tasks`)),[m,_]=(0,y.useState)(),[v,S]=(0,y.useState)(!1),[w,T]=(0,y.useState)(Date.now);(0,y.useEffect)(()=>{let e=setInterval(()=>T(Date.now()),6e4);return()=>clearInterval(e)},[]);let D=p.data,O=new Map(e.map(e=>[e.id,e.displayName||e.id]));return(0,b.jsxs)(`div`,{className:`task-board`,children:[(0,b.jsx)(f,{title:r?.projectName.trim()?`${r.projectName.trim()}|工作看板`:`工作看板`,description:r?.description.trim()||``,children:(0,b.jsx)(`a`,{className:`account-home`,"data-testid":`home-link`,href:t(`/projects`),onClick:e=>{e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),history.pushState(null,``,t(`/projects`)),window.dispatchEvent(new PopStateEvent(`popstate`)))},"aria-label":`项目主页`,"data-tooltip":`项目主页`,children:(0,b.jsx)(`strong`,{children:o})})}),(0,b.jsx)(i,{error:!0,children:p.error}),(0,b.jsx)(`section`,{className:`task-board-lanes`,"aria-label":`任务进度`,"data-testid":`progress-board`,children:x.filter(e=>e.status!==null||D?.tasks.some(e=>e.status===null)).map(e=>{let t=D?.tasks.filter(t=>t.status===e.status)??[];t.sort((t,n)=>(e.status===`completed`?n.statusSince.localeCompare(t.statusSince):t.statusSince.localeCompare(n.statusSince))||t.id.localeCompare(n.id));let r=e.status===`completed`&&!v?t.slice(0,5):t;return(0,b.jsxs)(`section`,{className:`task-lane`,"aria-label":e.label,"data-stage":e.status??`unknown`,children:[(0,b.jsxs)(`h2`,{children:[(0,b.jsx)(`span`,{className:`lane-dot`}),e.label,(0,b.jsx)(n,{children:D?t.length:`—`})]}),(0,b.jsxs)(`div`,{className:`task-lane-content`,children:[t.length?r.map(e=>(0,b.jsx)(C,{task:e,names:O,now:w,onEdit:()=>_(e),onSaved:()=>void p.reload()},e.id)):(0,b.jsx)(`p`,{className:`task-lane-empty`,children:p.error&&!D?`读取失败`:D?`暂无任务`:`读取中…`}),e.status===`completed`&&t.length>5&&(0,b.jsxs)(`button`,{type:`button`,className:`task-lane-expand`,"aria-expanded":v,onClick:()=>S(!v),children:[(0,b.jsx)(u,{name:v?`chevronUp`:`chevronDown`,size:`small`}),v?`收起`:`展开其余 ${t.length-5} 项`]})]})]},e.label)})}),m&&(0,b.jsx)(E,{task:m,onClose:()=>_(void 0),onSaved:()=>{_(void 0),p.reload()}},m.id)]})}function C({task:n,names:a,onEdit:s,onSaved:c,now:d}){let{projectId:f,request:p}=g(),m=o(),[h,x]=(0,y.useState)(!1),[S,C]=(0,y.useState)(``);async function E(){if(!h){x(!0),C(``);try{await p(`tasks/${n.id}/correction`,l,{method:`PATCH`,signal:m,body:{needsConfirmation:!1,expectedRevision:n.revision}}),m.aborted||c()}catch(t){m.aborted||C(e(t))}finally{x(!1)}}}return(0,b.jsxs)(`details`,{className:`task-card`,"data-testid":`task-card`,"data-task-id":n.id,"data-owner":n.owner,"data-status":n.status??`unknown`,children:[(0,b.jsxs)(`summary`,{className:`task-card-heading`,"data-testid":`task-toggle`,children:[(0,b.jsx)(`h3`,{children:n.title}),(0,b.jsxs)(`span`,{className:`task-card-meta`,children:[(0,b.jsx)(`small`,{title:a.get(n.owner)??n.owner,children:a.get(n.owner)??n.owner}),n.needsConfirmation&&(0,b.jsxs)(`span`,{className:`task-confirmation`,"data-testid":`task-confirmation`,children:[(0,b.jsx)(u,{name:`attention`,size:`small`}),`需要确认`]}),n.status!==`completed`&&(0,b.jsx)(w,{since:n.statusSince,now:d})]})]}),(0,b.jsx)(_,{icon:`edit`,className:`task-card-edit`,label:`纠正任务:${n.title}`,"data-testid":`task-correct`,disabled:h,onClick:s}),(0,b.jsxs)(`div`,{className:`task-card-details`,children:[(0,b.jsx)(`h4`,{children:`目标`}),(0,b.jsx)(`p`,{children:n.goal?(0,b.jsx)(T,{value:n.goal,names:a}):`目标未明确`}),(0,b.jsx)(`h4`,{children:`当前进展`}),(0,b.jsx)(`p`,{className:`task-progress`,children:(0,b.jsx)(T,{value:n.progress,names:a})}),(0,b.jsx)(`div`,{className:`task-card-sources`,children:n.sources.map(e=>(0,b.jsxs)(`a`,{"data-testid":`task-source`,href:t(e.kind===`material`?`/projects/${f}/materials?id=${e.materialId}&revision=${e.revision}`:v(f,n.owner,e.path)),children:[(0,b.jsx)(u,{name:`file`,size:`small`}),(0,b.jsx)(`span`,{children:e.path})]},e.path))}),n.syncedAt&&(0,b.jsxs)(`small`,{children:[`资料同步于 `,(0,b.jsx)(r,{value:n.syncedAt})]}),n.needsConfirmation&&(0,b.jsxs)(`div`,{className:`task-card-confirm`,children:[(0,b.jsx)(i,{error:!0,children:S}),(0,b.jsx)(`button`,{className:`primary`,"data-testid":`task-confirm-save`,disabled:h,onClick:()=>void E(),children:h?`正在保存…`:`保存`})]})]})]})}function w({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,b.jsxs)(`span`,{className:`task-age${n>6048e5?` stale`:``}`,"data-testid":`task-age`,title:`进入当前状态:${new Date(e).toLocaleString(`zh-CN`)}`,"aria-label":`当前状态停留 ${i}`,children:[(0,b.jsx)(u,{name:`clock`,size:`small`}),i]})}function T({value:e,names:t}){return e.split(/(@[a-z][a-z0-9_-]*)/gi).map((e,n)=>e.startsWith(`@`)&&t.has(e.slice(1))?(0,b.jsx)(`mark`,{className:`task-mention`,children:e},n):e)}function E({task:t,onClose:n,onSaved:r}){let{request:a}=g(),c=o(),[u,d]=(0,y.useState)(t.title),[f,m]=(0,y.useState)(t.status??``),[h,_]=(0,y.useState)(t.goal??``),[v,S]=(0,y.useState)(t.progress),[C,w]=(0,y.useState)(!1),[T,E]=(0,y.useState)(``),D={...u===t.title?{}:{title:u},...f===(t.status??``)?{}:{status:f||null},...h===(t.goal??``)?{}:{goal:h||null},...v===t.progress?{}:{progress:v},...t.needsConfirmation?{needsConfirmation:!1}:{}};async function O(){if(!C&&Object.keys(D).length){w(!0),E(``);try{await a(`tasks/${t.id}/correction`,l,{method:`PATCH`,signal:c,body:{...D,expectedRevision:t.revision}}),c.aborted||r()}catch(t){c.aborted||E(e(t))}finally{w(!1)}}}return(0,b.jsx)(p,{id:`task-correction`,title:`纠正任务`,onClose:n,children:(0,b.jsxs)(`form`,{className:`stack`,"aria-busy":C,onSubmit:e=>{e.preventDefault(),O()},children:[(0,b.jsx)(s,{id:`task-title`,label:`标题`,children:(0,b.jsx)(`input`,{value:u,required:!0,onChange:e=>d(e.target.value)})}),(0,b.jsxs)(`fieldset`,{className:`task-status-field`,disabled:C,children:[(0,b.jsx)(`legend`,{children:`状态`}),(0,b.jsx)(`div`,{className:`task-status-options`,"data-testid":`task-status`,children:x.filter(e=>e.status!==null).map(e=>(0,b.jsxs)(`label`,{className:`task-status-choice`,children:[(0,b.jsx)(`input`,{type:`radio`,name:`task-status`,value:e.status,checked:f===e.status,onChange:()=>m(e.status)}),(0,b.jsx)(`span`,{children:e.label})]},e.status))}),(0,b.jsx)(`small`,{children:`待验收:任务成果已提交,等待验收或最终确认。`})]}),(0,b.jsx)(s,{id:`task-goal`,label:`目标`,children:(0,b.jsx)(`textarea`,{value:h,onChange:e=>_(e.target.value)})}),(0,b.jsx)(s,{id:`task-progress`,label:`当前进展`,children:(0,b.jsx)(`textarea`,{value:v,onChange:e=>S(e.target.value)})}),(0,b.jsx)(i,{error:!0,children:T}),(0,b.jsx)(`div`,{className:`row wrap`,children:(0,b.jsx)(`button`,{type:`submit`,className:`primary`,disabled:C||!Object.keys(D).length,"data-testid":`task-correction-save`,children:`保存`})})]})})}function D({members:e,config:t,userName:n}){return(0,b.jsx)(S,{members:e,project:t,userName:n})}export{D as Dashboard};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.task-board{min-width:0}.task-board .page-header{align-items:flex-start;margin-bottom:40px}.task-board .page-header>div{min-width:0}.task-board .page-header h1,.task-board .page-header p{overflow-wrap:anywhere}.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{outline:2px solid var(--brand-orange);outline-offset:3px}.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}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ct as e,H as t,I as n,J as r,R as i,St as a,W as o,X as s,Z as c,at as l,c as u,d,f,l as p,q as m,rt as h,s as g,u as _,y as v,z as y}from"./index-BNGGPn0r.js";import{t as b}from"./Markdown-B13Lfgpp.js";import{n as x,t as S}from"./WorkspaceTree-Dj0bClAO.js";import{t as C}from"./project-links-Dy6-B89_.js";import{t as w}from"./file-links-CpTkSiiH.js";import{t as T}from"./HtmlPreview-BasLBM4N.js";var E=a(),D=s();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:r,onRefresh:i}){let{api:a,projectId:o}=v(),[s,b]=(0,E.useState)(()=>{let e=new URLSearchParams(location.search),t=e.get(`owner`),n=l.safeParse(e.get(`path`));return t&&(_(t)||r.some(e=>e.id===t))&&n.success&&!p(n.data)?{owner:t,path:n.data}:void 0}),[T,k]=(0,E.useState)(()=>new Set(s?O(s.owner,s.path):[])),[j,M]=(0,E.useState)(()=>s?{...s,kind:`file`}:void 0),[N,P]=(0,E.useState)(0),[F,I]=(0,E.useState)(()=>{let e=new URLSearchParams(location.search);return!s&&(e.has(`owner`)||e.has(`path`))?`文件链接不完整或目标已不可用。`:``}),L=(0,E.useCallback)(async e=>{if(s)try{return{owner:s.owner,...await a.file(s.owner,s.path,void 0,e)}}catch(e){throw e instanceof c&&e.code===`FILE_NOT_FOUND`?Error(`找不到这个文件,可能已被删除或移动。`):e}},[s?.owner,s?.path,N]),R=m(L),z=R.data?.owner===s?.owner&&R.data?.file.path===s?.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(t,n){I(``),B(t,n.split(`/`).slice(0,-1).join(`/`)),b({owner:t,path:n}),M({owner:t,path:n,kind:`file`}),history.replaceState(null,``,e(C(o,t,n)))}function H(t){if(!s)return!1;let n=w(_(s.owner)?s.path:`${s.owner}/${s.path}`,t);if(!n)return!/^[a-z][a-z0-9+.-]*:/i.test(t)&&!t.startsWith(`//`)&&(I(`该链接超出工作区,请在原仓库查看。`),!0);if(p(n.path))return I(`配置文件不在文件浏览中显示。`),!0;if(u(n.path))return location.assign(e(`/projects/${o}/memory`)),!0;let[i,...a]=n.path.split(`/`),c=r.some(e=>e.id===i),l=c?i:g,d=c?a.join(`/`):n.path;return I(``),n.directory?(B(l,d),M({owner:l,path:d,kind:`directory`})):l===s.owner&&d===s.path?n.anchor&&[...document.querySelectorAll(`.markdown h1,.markdown h2,.markdown h3,.markdown h4`)].find(e=>e.textContent?.trim().toLowerCase().replace(/\s+/g,`-`)===n.anchor.toLowerCase())?.scrollIntoView({block:`center`}):V(l,d),!0}return(0,D.jsx)(f,{"data-testid":`file-browser`,label:`文件资源管理器`,navigation:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(d,{title:`工作区`,icon:`files`,children:(0,D.jsx)(y,{icon:`refresh`,label:`刷新文件`,"data-testid":`files-refresh`,onClick:()=>{I(``),P(e=>e+1),i()}})}),(0,D.jsx)(S,{members:r,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":s?.owner,"data-file-path":s?.path,"aria-label":h.filePreview,children:s?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(t,{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:h.retry}),R.loading?(0,D.jsx)(`p`,{className:`preview-body`,role:`status`,children:h.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)(t,{error:!0,children:F}):(0,D.jsx)(n,{mascot:!0,title:`查看工作区文件`,description:h.pickFile})})})}function A({owner:e,file:n,onLink:a}){let{readTextBlob:s,blobUrl:c,projectId:l}=v(),[u,d]=(0,E.useState)(!1),f=n.size>524288,p=/\.(md|markdown)$/i.test(n.path),g=/\.html?$/i.test(n.path),x=(0,E.useCallback)(e=>f?Promise.resolve(void 0):s(n,e),[n.sha256,n.size,f]),S=m(x,!1,r(l,`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:`${_(e)?`teamcontext`:e}/${n.path}`,children:[(0,D.jsxs)(`span`,{children:[_(e)?`teamcontext`:e,` / `]}),n.path]}),(0,D.jsxs)(o,{label:`文件操作`,children:[(p||g)&&(0,D.jsx)(y,{icon:u?`preview`:`code`,label:u?`切换为预览`:`切换为原文`,"data-testid":`file-toggle-raw`,"aria-pressed":u,onClick:()=>d(!u)}),(0,D.jsx)(`a`,{className:`icon-button`,"data-testid":`file-download`,"aria-label":h.download,title:h.download,href:c(n.sha256),download:n.path.split(`/`).at(-1),children:(0,D.jsx)(i,{name:`download`})})]})]}),f?(0,D.jsx)(`div`,{className:`empty`,children:(0,D.jsx)(`p`,{children:h.previewLarge})}):S.error?(0,D.jsxs)(`div`,{className:`preview-body`,children:[(0,D.jsx)(t,{error:!0,children:S.error}),(0,D.jsx)(`button`,{"data-testid":`file-preview-retry`,onClick:()=>void S.reload(),children:h.retry})]}):S.loading?(0,D.jsx)(`p`,{className:`preview-body`,role:`status`,children:h.loading}):(0,D.jsx)(`div`,{className:`preview-body${g&&!u?` preview-body-html`:``}`,children:g&&!u?(0,D.jsx)(T,{url:c(n.sha256),name:n.path.split(`/`).at(-1)}):p&&!u?(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 +0,0 @@
|
|
|
1
|
-
import{R as e,St as t,X as n}from"./index-BNGGPn0r.js";var r=t(),i=n();function a({value:t,onChange:n,onSubmit:r,label:a,placeholder:s=`输入消息…`,disabled:c=!1,sendDisabled:l=!1,sendLabel:u=`发送`,actions:d,heading:f,inset:p=!1,plain:m=!1}){let h=o(t),g=!c&&!l&&!!t.trim();return(0,i.jsxs)(`form`,{className:`message-composer${p?` message-composer-inset`:``}${m?` message-composer-plain`:``}`,onSubmit:e=>{e.preventDefault(),g&&r(e)},children:[f&&(0,i.jsx)(`div`,{className:`message-composer-heading`,children:f}),(0,i.jsx)(`textarea`,{ref:h,value:t,onChange:e=>n(e.target.value),"aria-label":a,placeholder:s,disabled:c,rows:1,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),g&&e.currentTarget.form?.requestSubmit())}}),(0,i.jsxs)(`div`,{className:`message-composer-footer`,children:[d&&(0,i.jsx)(`div`,{className:`message-composer-actions`,children:d}),(0,i.jsx)(`button`,{type:`submit`,className:`primary message-send`,"aria-label":u,title:u,disabled:!g,children:(0,i.jsx)(e,{name:`send`,size:`small`})})]})]})}function o(e,t){let n=(0,r.useRef)(null);return(0,r.useLayoutEffect)(()=>{let e=n.current;if(!e)return;let r=()=>{t?.(e),e.style.height=`0px`,e.style.height=`${e.scrollHeight}px`};r();let i=e.clientWidth,a=new ResizeObserver(()=>{i!==e.clientWidth&&(i=e.clientWidth,r())});return a.observe(e),()=>a.disconnect()},[e,t]),n}export{o as n,a as t};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{$ as e,Ct as t,G as n,H as r,I as i,J as a,K as o,L as s,R as c,St as l,U as u,V as d,X as f,Z as p,_t as m,bt as h,ct as g,d as _,dt as v,et as y,f as b,ft as x,gt as S,h as C,ht as w,it as T,lt as E,mt as D,nt as O,ot as k,pt as A,q as j,rt as M,st as N,ut as P,wt as ee,xt as F,y as I,yt as L,z as R}from"./index-BNGGPn0r.js";import{n as z,r as B,t as V}from"./Markdown-B13Lfgpp.js";import{t as H}from"./Conversation-BY4zPO36.js";import{i as te,r as U}from"./WorkspaceTree-Dj0bClAO.js";import{n as W}from"./project-links-Dy6-B89_.js";import{t as G}from"./HtmlPreview-BasLBM4N.js";function K(e){return F(E,e)}var q=l(),ne=S().regex(/^R\d{6,}$/),J=w({name:S().min(1),sha256:k,size:D().int().nonnegative()}),Y=L().refine(e=>/^https?:\/\//i.test(e),`Use an HTTP or HTTPS URL.`);w({operationId:h(),title:S().trim().default(``),text:S().optional(),url:Y.optional(),originals:v(J).default([])}).strict().refine(e=>!!e.text?.trim()||!!e.url||e.originals.length>0,`Provide text, a link or a file.`),w({expectedRevision:N,title:S().trim().min(1).optional(),url:Y.nullable().optional(),content:S().optional(),summary:S().optional(),sourceVersion:S().optional(),contentDate:S().optional(),originals:v(J).optional()}).strict();var X=w({id:ne,projectId:S(),title:S(),submittedBy:S(),createdAt:S(),revision:N,source:w({kind:P([`web`,`chat`,`group`]),url:S().nullable(),groupId:S().optional(),messageId:S().optional(),sourceVersion:S().optional(),contentDate:S().optional()}),originals:v(J),content:S().nullable(),summary:S().nullable(),state:P([`waiting`,`running`,`ready`,`failed`]),error:S().nullable(),url:S()}),re=w({materials:v(X),nextCursor:D().nullable()});w({query:S().trim().min(1),scope:P([`all`,`workspace`,`materials`]).default(`all`),materialId:ne.optional(),originalHash:k.optional(),after:S().default(``),limit:K().int().min(1).max(200).default(30)}).strict();var ie=w({items:v(w({key:S(),kind:P([`workspace`,`materials`]),title:S(),snippet:S(),url:S(),path:S()})),nextCursor:S().nullable()}),Z=f();function ae(e){let t=(e.content??``).trimStart().split(`
|
|
2
|
-
`);return t[0]?.replace(/^#\s+/,``).trim()===e.title.trim()&&t[0].startsWith(`# `)&&t.shift(),t.join(`
|
|
3
|
-
`).trimStart()}function oe(){let e=new URLSearchParams(location.search),t=e.get(`id`);return t?{id:t,...e.get(`original`)?{original:e.get(`original`)}:{},...e.get(`revision`)?{revision:e.get(`revision`)}:{}}:void 0}function se({active:n,onActivate:o,children:s}){let{request:l,projectId:u}=I(),[d,f]=(0,q.useState)(oe),[p,m]=(0,q.useState)(d),[h,g]=(0,q.useState)(()=>new Set(d?[d.id]:[])),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(``),[x,S]=(0,q.useState)(``),[w,T]=(0,q.useState)(``),[E,D]=(0,q.useState)([]),[O,k]=(0,q.useState)(),[A,M]=(0,q.useState)(!1),[N,P]=(0,q.useState)(``),F=(0,q.useRef)(null),L=(0,q.useCallback)(e=>l(`materials`,re,{signal:e}),[l]),z=j(L,5e3,a(u,`materials`)),B=(0,q.useCallback)(e=>d?l(`materials/${encodeURIComponent(d.id)}${d.revision?`?revision=${encodeURIComponent(d.revision)}`:``}`,X,{signal:e}):Promise.resolve(null),[l,d?.id,d?.revision]),H=j(B,5e3),U=H.data?.id===d?.id?H.data:null,W=[...new Map([...E,...z.data?.materials??[],...U?[U]:[]].map(e=>[e.id,e])).values()].sort((e,t)=>t.createdAt.localeCompare(e.createdAt)||t.id.localeCompare(e.id)),G=O===void 0?z.data?.nextCursor:O;function K(e,n=``){o(),f(e),m(e),S(``),T(n),v(!1),g(t=>new Set([...t,e.id])),history.replaceState(null,``,t(`/projects/${u}/materials?${new URLSearchParams({...e})}`))}(0,q.useEffect)(()=>{let e=()=>{if(!ee().endsWith(`/materials`))return;let e=oe();f(e),m(e),S(``),b(``),T(``),v(!1),e&&g(t=>new Set([...t,e.id]))};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);async function ne(){if(G&&!A){M(!0),P(``);try{let e=await l(`materials?before=${G}`,re);D(t=>[...t,...e.materials]),k(e.nextCursor)}catch(t){P(e(t))}finally{M(!1)}}}let J=W.find(e=>e.id===p?.id),Y=J?.originals.find(e=>e.sha256===p?.original)?.name??J?.title??`当前资料`;function ie(){m(void 0),T(``),F.current?.focus()}let se=(0,Z.jsx)(R,{icon:`plus`,label:`新增资料`,onClick:()=>{o(),v(!0),P(``)}});return s({tree:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(r,{error:!0,children:z.error||N}),z.data?W.length===0?(0,Z.jsx)(`p`,{className:`tree-status`,children:`暂无资料`}):(0,Z.jsx)(Z.Fragment,{children:W.map(e=>(0,Z.jsxs)(`div`,{role:`none`,children:[(0,Z.jsxs)(C,{role:`treeitem`,"aria-level":1,"aria-expanded":h.has(e.id),"aria-selected":n&&!_&&d?.id===e.id&&!d.original,className:`tree-item tree-folder`,style:{"--tree-level":1},"data-testid":`material-folder`,title:e.title,onClick:()=>{let t=h.has(e.id);K({id:e.id}),t&&g(t=>{let n=new Set(t);return n.delete(e.id),n})},leading:(0,Z.jsx)(`span`,{className:`tree-chevron ${h.has(e.id)?`expanded`:``}`,children:(0,Z.jsx)(c,{name:`chevron`,size:`small`})}),children:[(0,Z.jsx)(c,{name:`files`}),(0,Z.jsx)(`span`,{className:`tree-name`,children:e.title})]}),h.has(e.id)&&(0,Z.jsx)(`div`,{role:`group`,children:[...e.originals].sort((e,t)=>te(e.name,t.name)).map((t,r)=>(0,Z.jsxs)(C,{role:`treeitem`,"aria-level":2,"aria-selected":n&&!_&&d?.id===e.id&&d.original===t.sha256,className:`tree-item`,style:{"--tree-level":2},"data-testid":`material-original`,title:t.name,onClick:()=>K({id:e.id,original:t.sha256,...e.id===d?.id&&d.revision?{revision:d.revision}:{}}),leading:(0,Z.jsx)(`span`,{className:`tree-chevron`}),children:[(0,Z.jsx)(c,{name:`file`}),(0,Z.jsx)(`span`,{className:`tree-name`,children:t.name})]},`${t.sha256}:${r}`))})]},e.id))}):(0,Z.jsx)(`p`,{className:`tree-status`,children:`加载中…`}),G&&(0,Z.jsx)(`button`,{className:`tree-action`,disabled:A,onClick:()=>void ne(),children:A?`加载中…`:`加载更多`})]}),reader:(0,Z.jsxs)(`section`,{className:`session-reader`,"aria-label":`资料内容与搜索`,children:[(0,Z.jsx)(`div`,{className:`session-reader-content`,children:_?(0,Z.jsx)(fe,{onCancel:()=>v(!1),onSaved:e=>{K({id:e}),z.reload()}}):x?(0,Z.jsx)(ce,{query:x,scope:p,onSelect:e=>K(e,x)},`${x}/${p?.id}/${p?.original}`):d?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(r,{error:!0,children:H.error}),U?d.original?(0,Z.jsx)(le,{material:U,hash:d.original,highlight:w},`${U.id}:${d.original}`):(0,Z.jsxs)(`article`,{className:`material-body`,children:[(0,Z.jsx)(`h1`,{children:U.title}),d.revision&&(0,Z.jsx)(`button`,{className:`material-link`,onClick:()=>K({id:d.id}),children:`查看最新内容`}),!d.revision&&(U.state===`waiting`||U.state===`running`)?(0,Z.jsx)(`p`,{className:`muted`,role:`status`,children:`正在整理…`}):null,(0,Z.jsx)(r,{error:!0,children:U.error??``}),!d.revision&&U.state===`failed`&&(0,Z.jsx)(`button`,{onClick:()=>void l(`materials/${d.id}/retry`,X,{method:`POST`}).then(()=>H.reload()).catch(t=>P(e(t))),children:`重试整理`}),U.content?(0,Z.jsx)(`div`,{className:`markdown`,children:(0,Z.jsx)(V,{highlight:w,children:ae(U)})}):(0,Z.jsx)(`p`,{className:`muted`,children:`正文尚未整理,可以先查看左侧原件。`})]}):(0,Z.jsx)(`p`,{role:`status`,children:`加载中…`})]}):(0,Z.jsx)(i,{mascot:!0,title:`选择资料开始阅读`,description:`也可以在下方搜索资料内容。`})}),!_&&(0,Z.jsxs)(`form`,{className:`session-search-dock`,"data-testid":`material-search-form`,onSubmit:e=>{e.preventDefault(),S(y.trim()),T(``)},children:[p&&(0,Z.jsxs)(`button`,{type:`button`,className:`search-scope-chip`,title:`清除搜索范围`,"aria-label":`清除范围:${Y}`,onClick:ie,children:[(0,Z.jsxs)(`span`,{className:`scope-label`,children:[`搜索:`,Y]}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`×`})]}),(0,Z.jsxs)(`div`,{className:`session-search-input-row`,children:[(0,Z.jsx)(`input`,{ref:F,"aria-label":`搜索资料`,placeholder:`搜索资料内容`,value:y,onChange:e=>b(e.target.value),onKeyDown:e=>{e.key===`Backspace`&&!y&&p&&(e.preventDefault(),ie())}}),(x||y||w)&&(0,Z.jsx)(R,{icon:`close`,label:`清空搜索`,onClick:()=>{b(``),S(``),T(``),F.current?.focus()}}),(0,Z.jsx)(R,{icon:`search`,type:`submit`,label:`搜索`,disabled:!y.trim()})]})]})]}),actions:se,href:`/projects/${u}/materials${d&&!_?`?${new URLSearchParams({...d})}`:``}`})}function ce({query:e,scope:t,onSelect:n}){let{request:i}=I(),[a,o]=(0,q.useState)(``),s=(0,q.useCallback)(n=>i(`resources/search?${new URLSearchParams({query:e,scope:`materials`,after:a,...t?{materialId:t.id}:{},...t?.original?{originalHash:t.original}:{}})}`,ie,{signal:n}),[i,e,t?.id,t?.original,a]),c=j(s);return(0,Z.jsxs)(`section`,{className:`session-results stack`,"aria-label":`搜索结果`,children:[(0,Z.jsx)(r,{error:!0,children:c.error}),c.loading?(0,Z.jsx)(`p`,{role:`status`,children:`正在搜索…`}):c.data?.items.length===0?(0,Z.jsx)(`p`,{className:`empty`,children:`没有找到匹配的资料`}):c.data?.items.map(t=>(0,Z.jsxs)(`button`,{className:`session-item`,"data-testid":`material-match`,onClick:()=>{let e=new URL(t.url,location.origin).searchParams;n({id:e.get(`id`),...e.get(`original`)?{original:e.get(`original`)}:{},...e.get(`revision`)?{revision:e.get(`revision`)}:{}})},children:[(0,Z.jsx)(`strong`,{children:t.title.replace(/^R\d+ · /,``)}),(0,Z.jsx)(`span`,{className:`session-excerpt`,children:(0,Z.jsx)(z,{value:B(t.snippet,e),query:e})})]},t.key)),c.data?.nextCursor&&(0,Z.jsx)(`button`,{disabled:c.loading,onClick:()=>o(c.data.nextCursor),children:`下一页`})]})}function le({material:e,hash:n,highlight:i}){let{projectId:o}=I(),s=e.originals.find(e=>e.sha256===n),l=t(`/api/v1/projects/${o}/materials/${e.id}/originals/${n}?revision=${e.revision}`),[u,d]=(0,q.useState)(!1),f=(0,q.useCallback)(async e=>{let t=await fetch(l,{signal:e});if(!t.ok)throw Error(`原件暂时无法读取。`);let n=await t.arrayBuffer();try{let e=new TextDecoder(`utf8`,{fatal:!0}).decode(n);return e.includes(`\0`)?null:e}catch{return null}},[l]),p=j(f,!1,a(o,`material-original`,n));if(!s)return(0,Z.jsx)(r,{error:!0,children:`找不到此原件。`});let m=/\.(md|markdown)$/i.test(s.name),h=/\.html?$/i.test(s.name);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`header`,{className:`file-detail-header`,children:[(0,Z.jsx)(`span`,{className:`file-detail-path`,children:s.name}),(0,Z.jsxs)(`div`,{className:`toolbar-actions`,children:[(m||h)&&(0,Z.jsx)(R,{icon:u?`preview`:`code`,label:u?`切换为预览`:`切换为原文`,"aria-pressed":u,onClick:()=>d(!u)}),(0,Z.jsx)(`a`,{className:`icon-button`,"aria-label":`下载原件`,title:`下载原件`,href:l,download:s.name,children:(0,Z.jsx)(c,{name:`download`})})]})]}),(0,Z.jsx)(r,{error:!0,children:p.error}),p.loading?(0,Z.jsx)(`p`,{role:`status`,children:`加载中…`}):p.data===null?(0,Z.jsx)(`p`,{className:`muted`,children:`此格式请下载后查看。`}):p.data!==void 0&&(0,Z.jsx)(`div`,{className:`preview-body${h&&!u?` preview-body-html`:``}`,"data-testid":`material-original-content`,children:h&&!u?(0,Z.jsx)(G,{url:l,name:s.name}):m&&!u?(0,Z.jsx)(`article`,{className:`markdown`,children:(0,Z.jsx)(V,{highlight:i,children:p.data})}):(0,Z.jsx)(`pre`,{className:`raw`,children:(0,Z.jsx)(z,{value:p.data,query:i})})})]})}function ue(e){if(e.kind===`text`){try{if([`http:`,`https:`].includes(new URL(e.text.trim()).protocol))return`link`}catch{}return`text`}let{name:t,type:n}=e.file;return n.startsWith(`image/`)||/\.(png|jpe?g|gif|webp|svg|heic|avif)$/i.test(t)?`imageFile`:/\.(csv|tsv|xlsx?|ods)$/i.test(t)?`spreadsheetFile`:/\.(json|ya?ml|xml|html?|css|[cm]?[jt]sx?|py|go|rs|sh|sql)$/i.test(t)?`codeFile`:n.startsWith(`text/`)||/\.(pdf|docx?|odt|rtf|md|txt)$/i.test(t)?`file`:`attachment`}function Q(e){try{return new URL(e.trim()).hostname}catch{return e.trim().split(`
|
|
4
|
-
`)[0]?.slice(0,80)||`文本`}}function de(e){try{return new URL(e.trim()).href}catch{return e.trim().split(`
|
|
5
|
-
`).slice(1).join(`
|
|
6
|
-
`)}}function fe({onSaved:n,onCancel:i}){let{request:a,projectId:o}=I(),[l,u]=(0,q.useState)([]),[f,p]=(0,q.useState)(),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(``),v=(0,q.useRef)(null),b=(0,q.useRef)(y()),x=(0,q.useRef)(new Map);function S(e){u(e),b.current=y(),_(``)}async function C(){h(!0),_(``);try{let e=[];for(let[n,r]of l.entries()){let i=x.current.get(r.id);if(!i){let e=r.kind===`file`?r.file.name:`${Q(r.text)}.txt`,a=await fetch(t(`/api/v1/projects/${o}/materials/uploads`),{method:`POST`,headers:{"content-type":`application/octet-stream`,"x-teammy-web":`1`},body:r.kind===`file`?r.file:new Blob([r.text],{type:`text/plain`})}),s=await a.json();if(!a.ok)throw Error(s.error?.message??`第 ${n+1} 项上传失败。`);i={name:e,sha256:s.sha256,size:s.size},x.current.set(r.id,i)}e.push(i)}let r=l.length===1&&l[0]?.kind===`text`?l[0].text.trim():``,i;try{let e=new URL(r);[`http:`,`https:`].includes(e.protocol)&&(i=e.href)}catch{}n((await a(`materials`,X,{method:`POST`,body:{operationId:b.current,originals:e,...i?{url:i}:{}}})).id)}catch(t){_(e(t))}finally{h(!1)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`form`,{className:`material-form`,onSubmit:e=>{e.preventDefault(),C()},children:[(0,Z.jsx)(`h1`,{children:`新增资料`}),(0,Z.jsx)(`p`,{className:`muted`,children:`上传附件到项目,以便于Tim进行理解`}),(0,Z.jsx)(r,{error:!0,children:g}),(0,Z.jsxs)(`fieldset`,{disabled:m,children:[(0,Z.jsxs)(`div`,{className:`attachment-grid`,children:[l.map(e=>(0,Z.jsxs)(`article`,{className:`attachment-card`,"data-testid":`attachment-card`,children:[e.kind===`text`?(0,Z.jsxs)(`button`,{type:`button`,className:`attachment-content`,"aria-label":`编辑:${Q(e.text)}`,onClick:()=>p({id:e.id,text:e.text}),children:[(0,Z.jsx)(c,{name:ue(e)}),(0,Z.jsx)(`span`,{className:`attachment-name`,children:Q(e.text)}),de(e.text)&&(0,Z.jsx)(`span`,{className:`attachment-excerpt`,children:de(e.text)})]}):(0,Z.jsxs)(`div`,{className:`attachment-content`,children:[(0,Z.jsx)(c,{name:ue(e)}),(0,Z.jsx)(`span`,{className:`attachment-name`,children:e.file.name})]}),(0,Z.jsx)(R,{className:`attachment-remove`,icon:`close`,label:`移除:${e.kind===`file`?e.file.name:Q(e.text)}`,onClick:()=>{x.current.delete(e.id),S(l.filter(t=>t.id!==e.id))}})]},e.id)),(0,Z.jsxs)(`button`,{type:`button`,className:`attachment-add`,onClick:()=>p({text:``}),children:[(0,Z.jsx)(c,{name:`addText`}),(0,Z.jsx)(`span`,{children:`添加文本/链接`})]}),(0,Z.jsxs)(`button`,{type:`button`,className:`attachment-add`,onClick:()=>v.current?.click(),children:[(0,Z.jsx)(c,{name:`addFile`}),(0,Z.jsx)(`span`,{children:`添加文件`})]})]}),(0,Z.jsx)(`input`,{ref:v,type:`file`,multiple:!0,hidden:!0,"aria-label":`原始文件`,onChange:e=>{S([...l,...[...e.target.files??[]].map(e=>({id:y(),kind:`file`,file:e}))]),e.target.value=``}}),(0,Z.jsxs)(`div`,{className:`actions attachment-actions`,children:[(0,Z.jsx)(`button`,{type:`button`,onClick:i,children:`取消`}),(0,Z.jsx)(`button`,{type:`submit`,className:`primary`,disabled:!l.length,children:m?`上传中…`:`提交资料`})]})]})]}),f&&(0,Z.jsx)(d,{id:`material-text-editor`,title:`添加文本/链接`,onClose:()=>p(void 0),children:(0,Z.jsxs)(`form`,{className:`stack`,onSubmit:e=>{if(e.preventDefault(),!f.text.trim())return;let t={id:f.id??y(),kind:`text`,text:f.text};x.current.delete(t.id),S(f.id?l.map(e=>e.id===f.id?t:e):[...l,t]),p(void 0)},children:[(0,Z.jsx)(s,{id:`material-attachment-text`,label:`文本或链接`,children:(0,Z.jsx)(`textarea`,{autoFocus:!0,rows:8,value:f.text,onChange:e=>p({...f,text:e.target.value}),placeholder:`粘贴文本或网页链接`})}),(0,Z.jsx)(`div`,{className:`actions`,children:(0,Z.jsx)(`button`,{type:`submit`,className:`primary`,disabled:!f.text.trim(),children:f.id?`保存`:`添加`})})]})})]})}var pe=P([`overview`,`handoff`]),me=w({title:S().trim().min(1),summary:S().trim().min(1)}).strict(),he=w({markdown:S().trim().min(1)}).strict(),ge=me.extend({sourceRevision:N,sourceHash:k,generatedAt:S(),stale:x()}),_e=w({kind:pe,status:P([`absent`,`queued`,`running`,`succeeded`,`failed`]),available:x(),currentRevision:N,sourceRevision:N.nullable(),stale:x(),result:m([me,he]).nullable(),generatedAt:S().nullable(),error:S().nullable()}),ve=P([`claude-code`,`codex`,`cursor`,`pi`,`dsh`]),ye=w({formatVersion:A(1),adapterVersion:A(1),agent:ve,nativeId:S().min(1).max(512),cwd:S().min(1).max(4096),messages:v(w({id:S().min(1).max(1024),role:P([`user`,`assistant`]),text:S().min(1),source:S().min(1).max(1024)}).strict())}).strict().refine(e=>new Set(e.messages.map(e=>e.id)).size===e.messages.length,`Duplicate message IDs.`);w({operationId:h(),sessionKey:k,parentRevision:N,blob:T}).strict(),w({revision:N,hash:k.nullable(),cleared:x()});var be=w({owner:g,sessionKey:k,agent:ve,nativeId:S(),cwd:S(),title:S(),revision:N,updatedAt:S(),messageCount:D().int().nonnegative(),blob:T,overview:ge.optional()}),xe=w({sessions:v(be),nextCursor:N.nullable()}),Se=w({totalSessions:D().int().nonnegative(),totalMessages:D().int().nonnegative(),memberCount:D().int().nonnegative(),updatedAt:S().nullable()});w({owner:g.optional(),sessionKey:k.optional()}).strict().refine(e=>!e.sessionKey||!!e.owner,`A session scope requires an owner.`);var Ce=w({matches:v(w({owner:g,sessionKey:k,revision:N,messageId:S(),source:P([`message`,`handoff`]).default(`message`),role:P([`user`,`assistant`]),snippet:S(),title:S()})),nextCursor:N.nullable()}),we=w({owner:g,key:k,revision:N.refine(e=>e>0).optional(),messageId:S().min(1).optional(),source:P([`message`,`handoff`]).optional()});function Te(e){let t=new URLSearchParams(e);if(![`owner`,`sessionKey`,`revision`,`messageId`].some(e=>t.has(e)))return{};let n=we.safeParse({owner:t.get(`owner`),key:t.get(`sessionKey`),...t.has(`revision`)?{revision:Number(t.get(`revision`))}:{},...t.has(`messageId`)?{messageId:t.get(`messageId`)}:{},...t.has(`source`)?{source:t.get(`source`)}:{}});return n.success?{target:n.data}:{error:`对话链接不完整或已损坏。`}}function Ee({members:e,refresh:t,selected:n,onOwner:r,onSession:i,level:a=1}){let[o,s]=(0,q.useState)(()=>new Set(n?.key?[n.owner]:[])),[l,u]=(0,q.useState)(e[0]?.id??``);return(0,Z.jsx)(`div`,{role:a===1?`tree`:`group`,"aria-label":`成员对话`,"data-testid":`session-tree`,onKeyDown:a===1?U:void 0,children:[...e].sort((e,t)=>te(e.id,t.id)).map(e=>(0,Z.jsxs)(`div`,{role:`none`,children:[(0,Z.jsxs)(C,{type:`button`,role:`treeitem`,"aria-level":a,"aria-expanded":o.has(e.id),"aria-selected":n?.owner===e.id&&!n.key,className:`tree-item tree-folder`,style:{"--tree-level":a},tabIndex:l===e.id?0:-1,"data-testid":`session-owner`,"data-owner-id":e.id,onFocus:()=>u(e.id),onClick:()=>{s(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n}),r(e.id)},leading:(0,Z.jsx)(`span`,{className:`tree-chevron ${o.has(e.id)?`expanded`:``}`,children:(0,Z.jsx)(c,{name:`chevron`,size:`small`})}),children:[(0,Z.jsx)(c,{name:`files`}),(0,Z.jsx)(`span`,{className:`tree-name`,title:e.id,children:e.id})]}),o.has(e.id)&&(0,Z.jsx)(De,{level:a+1,owner:e.id,selected:n,onSession:i,focused:l,onFocus:u},`${e.id}/${t}`)]},e.id))})}function De({level:t,owner:n,selected:i,onSession:o,focused:s,onFocus:l}){let{request:u,projectId:d}=I(),f=(0,q.useCallback)(e=>u(`sessions?${new URLSearchParams({owner:n,limit:`50`,order:`updated`})}`,xe,{signal:e}),[n,u]),p=j(f,15e3,a(d,`session-tree`,n)),[m,h]=(0,q.useState)(),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(``),b=(0,q.useRef)(null);(0,q.useEffect)(()=>()=>b.current?.abort(),[]);let x=m?m.nextCursor:p.data?.nextCursor;return(0,Z.jsxs)(`div`,{role:`group`,"aria-busy":p.loading||g,children:[(0,Z.jsx)(r,{error:!0,children:p.error||v}),p.error&&(0,Z.jsx)(`button`,{onClick:()=>void p.reload(),children:`重试`}),p.loading&&!p.data&&(0,Z.jsx)(`span`,{className:`tree-status`,role:`status`,children:`正在加载…`}),[...new Map([...m?.sessions??[],...p.data?.sessions??[]].map(e=>[e.sessionKey,e])).values()].sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)||e.sessionKey.localeCompare(t.sessionKey)).map(e=>(0,Z.jsxs)(C,{type:`button`,role:`treeitem`,"aria-level":t,"aria-selected":i?.owner===n&&i.key===e.sessionKey,className:`tree-item`,style:{"--tree-level":t},tabIndex:s===`${n}/${e.sessionKey}`?0:-1,"data-testid":`session-row`,"data-owner-id":n,"data-session-key":e.sessionKey,title:O(e.title||e.nativeId),onFocus:()=>l(`${n}/${e.sessionKey}`),onClick:()=>o({owner:n,key:e.sessionKey,title:e.title||e.nativeId}),leading:(0,Z.jsx)(`span`,{className:`tree-chevron`}),children:[(0,Z.jsx)(c,{name:`sessions`}),(0,Z.jsx)(`span`,{className:`tree-name`,children:O(e.title||e.nativeId)})]},e.sessionKey)),x!=null&&(0,Z.jsx)(`button`,{className:`tree-action`,"data-testid":`session-tree-more`,disabled:g,onClick:async()=>{_(!0),y(``);let t=new AbortController;b.current=t;try{let e=await u(`sessions?${new URLSearchParams({owner:n,after:String(x),limit:`50`,order:`updated`})}`,xe,{signal:t.signal});h(t=>({sessions:[...t?.sessions??[],...e.sessions],nextCursor:e.nextCursor}))}catch(n){t.signal.aborted||y(e(n))}finally{t.signal.aborted||_(!1)}},children:`加载更多`})]})}function Oe({info:e,targeted:t=!1,highlight:n=``}){let[r,i]=(0,q.useState)(t),a=(0,q.useRef)(null);return(0,q.useEffect)(()=>{t&&a.current?.scrollIntoView({block:`center`})},[t]),(0,Z.jsxs)(`details`,{ref:a,open:r,className:`session-handoff`,onToggle:e=>i(e.currentTarget.open),children:[(0,Z.jsx)(`summary`,{children:`交接说明`}),r&&(0,Z.jsx)(ke,{info:e,revision:t?e.revision:void 0,highlight:n})]})}function ke({info:t,revision:i,highlight:a}){let{request:s}=I(),c=`sessions/${encodeURIComponent(t.owner)}/${t.sessionKey}`,l=(0,q.useCallback)(e=>s(`${c}/analysis/handoff${i===void 0?``:`?revision=${i}`}`,_e,{signal:e}),[s,c,i]),u=j(l,5e3),d=o(),[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(``),g=u.data,_=f||g?.status===`queued`||g?.status===`running`,v=g?.result&&`markdown`in g.result?g.result.markdown:void 0;return(0,Z.jsxs)(`div`,{className:`stack`,"data-testid":`session-handoff`,children:[(0,Z.jsx)(r,{error:!0,children:m||u.error}),u.loading&&!g&&(0,Z.jsx)(`small`,{role:`status`,children:`正在加载…`}),g&&(0,Z.jsxs)(`div`,{className:`inline-actions`,children:[g.status===`failed`&&i===void 0&&(0,Z.jsx)(`button`,{"data-testid":`session-handoff-generate`,disabled:_||!g.available,onClick:async()=>{p(!0),h(``);try{await s(`${c}/handoff`,_e,{method:`POST`,signal:d}),await u.reload()}catch(t){d.aborted||h(e(t))}finally{d.aborted||p(!1)}},children:_?`正在整理…`:`重试`}),!g.available&&(0,Z.jsx)(`small`,{children:`请先配置项目模型接入点`}),g.status===`failed`&&(0,Z.jsx)(`small`,{children:`整理未完成,可重试`}),g.available&&g.status!==`failed`&&(!v||g.stale||_)&&(0,Z.jsx)(`small`,{role:`status`,children:g.status===`running`||f?`正在整理…`:v?`对话已有新内容,等待自动更新…`:`等待自动整理…`}),g.currentRevision!==t.revision&&(0,Z.jsx)(`small`,{children:`交接说明使用最新对话;当前阅读的是历史原文`})]}),v&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`small`,{children:[`基于版本 `,g.sourceRevision,` · `,(0,Z.jsx)(n,{value:g.generatedAt})]}),(0,Z.jsx)(`div`,{className:`markdown`,"data-testid":`session-handoff-body`,children:(0,Z.jsx)(V,{highlight:a,children:v})})]})]})}function Ae({members:e,active:n,onActivate:o,children:s}){let{request:c,projectId:l,api:u}=I(),d=(0,q.useCallback)(async e=>{let[t,n]=await Promise.all([c(`sessions/stats`,Se,{signal:e}),u.members(e)]);return{...t,members:n.members}},[c,u]),f=j(d,!0,a(l,`session-stats`)),[p,m]=(0,q.useState)(``),[h,g]=(0,q.useState)(``),[v,y]=(0,q.useState)(0),[b]=(0,q.useState)(()=>Te(location.search)),[x,S]=(0,q.useState)(b.target),[C,w]=(0,q.useState)(b.target),[T,E]=(0,q.useState)(b.error??``),[D,k]=(0,q.useState)(``),A=(0,q.useRef)(null),N=x?.key?x.title?`搜索对话:${O(x.title)}`:`搜索当前对话`:x?`搜索:${x.owner} 的对话内容`:``,P=()=>{S(void 0),k(``),F(),A.current?.focus()};function F(){if(!C?.messageId)return;let{messageId:e,...n}=C;w(n),history.replaceState(null,``,t(W(l,n.owner,n.key,n)))}let L=(0,q.useCallback)(e=>{S(t=>t?.owner===e.owner&&t.key===e.sessionKey&&t.title!==e.title?{...t,title:e.title}:t)},[]);(0,q.useEffect)(()=>{let e=()=>{if(!ee().endsWith(`/sessions`))return;let e=Te(location.search);w(e.target),S(e.target),E(e.error??``),g(``),m(``),k(``)};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)},[]);let z=(e,n=``)=>{o(),w(e),S(e),g(``),k(n),E(``),history.replaceState(null,``,t(W(l,e.owner,e.key,e)))},B=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(r,{error:!0,children:f.error}),(0,Z.jsx)(Ee,{members:(f.data?.members??e).filter(e=>e.hasSessions),refresh:v,selected:n?x:void 0,level:2,onOwner:e=>{o(),S({owner:e}),w(void 0),g(``),k(``),E(``),history.replaceState(null,``,t(`/projects/${encodeURIComponent(l)}/sessions`))},onSession:z})]}),V=(0,Z.jsxs)(`section`,{className:`session-reader`,"aria-label":`对话内容与搜索`,children:[(0,Z.jsx)(_,{title:M.sessions,icon:`sessions`,count:(0,Z.jsx)(`span`,{"data-testid":`session-total`,children:f.data?.totalSessions??`—`}),children:(0,Z.jsx)(R,{icon:`refresh`,label:`刷新${M.sessions}`,"data-testid":`sessions-refresh`,disabled:f.loading,onClick:()=>{f.reload(),y(e=>e+1)}})}),(0,Z.jsx)(`div`,{className:`session-reader-content`,children:T?(0,Z.jsx)(r,{error:!0,children:T}):h?(0,Z.jsx)(je,{query:h,refresh:v,scope:{...x?{owner:x.owner}:{},...x?.key?{sessionKey:x.key}:{}},onSelect:e=>z(e,h)},`${h}/${x?.owner??``}/${x?.key??``}`):C?(0,Z.jsx)(Me,{selection:C,highlight:D,onLoaded:L,onLatest:()=>z({owner:C.owner,key:C.key})},`${C.owner}/${C.key}/${C.revision}/${C.source}/${v}`):(0,Z.jsx)(i,{mascot:!0,title:`选择对话开始阅读`,description:`也可以在下方搜索会话库内容。`})}),(0,Z.jsxs)(`form`,{className:`session-search-dock`,"data-testid":`session-search-form`,onSubmit:e=>{e.preventDefault(),g(p.trim()),k(``),E(``),y(e=>e+1)},children:[x&&(0,Z.jsxs)(`button`,{type:`button`,className:`search-scope-chip`,"data-testid":`session-search-scope`,title:`清除搜索范围`,"aria-label":`清除范围:${N}`,onClick:P,children:[(0,Z.jsx)(`span`,{className:`scope-label`,children:N}),(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:`×`})]}),(0,Z.jsxs)(`div`,{className:`session-search-input-row`,children:[(0,Z.jsx)(`input`,{ref:A,"aria-label":`搜索对话`,"data-testid":`session-query`,value:p,maxLength:500,placeholder:`搜索会话库内容`,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Backspace`&&!p&&x&&(e.preventDefault(),P())}}),(h||p||D)&&(0,Z.jsx)(R,{icon:`close`,label:`清空搜索`,"data-testid":`session-search-clear`,onClick:()=>{m(``),g(``),k(``),F(),A.current?.focus()}}),(0,Z.jsx)(R,{icon:`search`,type:`submit`,label:`搜索`,"data-testid":`session-search`,disabled:!p.trim()})]})]})]});return s({hasSelection:!!x,tree:B,reader:V,href:C?W(l,C.owner,C.key,C):`/projects/${l}/sessions`})}function je({query:e,refresh:t,scope:n,onSelect:i}){let{request:a}=I(),[o,s]=(0,q.useState)(0),c=(0,q.useCallback)(t=>a(`sessions/search?${new URLSearchParams({q:e,after:String(o),limit:`30`,order:`updated`,...n.owner?{owner:n.owner}:{},...n.sessionKey?{sessionKey:n.sessionKey}:{}})}`,Ce,{signal:t}),[a,e,o,t,n.owner,n.sessionKey]),l=j(c);return(0,Z.jsxs)(`section`,{className:`session-results stack`,"aria-label":`搜索结果`,"aria-busy":l.loading,children:[(0,Z.jsx)(r,{error:!0,children:l.error}),l.error&&(0,Z.jsx)(`button`,{onClick:()=>void l.reload(),children:`重试`}),l.loading&&(0,Z.jsx)(`p`,{role:`status`,children:`正在搜索…`}),!l.loading&&l.data?.matches.map(t=>(0,Z.jsxs)(`button`,{className:`session-item`,"data-testid":`session-match`,"data-message-id":t.messageId,onClick:()=>i({owner:t.owner,key:t.sessionKey,revision:t.revision,messageId:t.messageId||void 0,source:t.source,title:t.title}),children:[(0,Z.jsx)(`strong`,{children:O(t.title)}),(0,Z.jsxs)(`small`,{children:[t.owner,` ·`,` `,t.source===`handoff`?`交接说明`:t.role===`user`?`用户`:`助手`]}),(0,Z.jsx)(`span`,{className:`session-excerpt`,children:(0,Z.jsx)(z,{value:B(t.snippet,e),query:e})})]},`${t.owner}:${t.sessionKey}:${t.revision}:${t.source}:${t.messageId}`)),!l.loading&&l.data?.matches.length===0&&(0,Z.jsx)(`p`,{className:`empty`,children:`没有找到匹配的对话`}),l.data?.nextCursor!=null&&(0,Z.jsx)(`button`,{"data-testid":`sessions-next`,disabled:l.loading,onClick:()=>s(l.data.nextCursor),children:`下一页`}),o>0&&(0,Z.jsx)(`button`,{disabled:l.loading,onClick:()=>s(0),children:`返回第一页`})]})}function Me({selection:e,highlight:t,onLoaded:n,onLatest:i}){let{request:a}=I(),o=(0,q.useCallback)(async t=>{try{return await a(`sessions/${encodeURIComponent(e.owner)}/${e.key}${e.revision===void 0?``:`?revision=${e.revision}`}`,be,{signal:t})}catch(e){throw e instanceof p&&e.code===`SESSION_NOT_FOUND`?Error(`找不到这条对话或引用的版本,原链接可能已失效。`):e}},[a,e.owner,e.key,e.revision]),s=j(o,5e3);return(0,q.useEffect)(()=>{s.data&&n(s.data)},[s.data,n]),(0,Z.jsxs)(`section`,{className:`session-conversation stack`,"data-testid":`session-detail`,children:[(0,Z.jsx)(r,{error:!0,children:s.error}),s.error&&(0,Z.jsx)(`button`,{onClick:()=>void s.reload(),children:`重试`}),s.loading&&!s.data&&(0,Z.jsx)(`p`,{role:`status`,children:`正在读取对话…`}),s.data&&(0,Z.jsx)(Ne,{info:s.data,messageId:e.messageId,handoff:e.source===`handoff`,highlight:t,pinned:e.revision!==void 0,onLatest:i},s.data.blob.sha256)]})}function Ne({info:e,messageId:i,handoff:a,highlight:o,pinned:s,onLatest:c}){let{readTextBlob:l,projectId:u}=I(),d=(0,q.useCallback)(async t=>ye.parse(JSON.parse(await l(e.blob,t))),[e.blob.sha256,e.blob.size]),f=j(d),p=(0,q.useRef)(null);return(0,q.useEffect)(()=>{f.data&&i&&p.current?.scrollIntoView({block:`center`})},[f.data,i]),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`header`,{className:`conversation-header`,children:[(0,Z.jsx)(`h2`,{className:`session-title`,children:O(e.title||e.nativeId)}),(0,Z.jsxs)(`p`,{children:[e.owner,` · `,e.agent,` · `,e.messageCount,` 条消息`]}),(0,Z.jsxs)(`small`,{children:[(0,Z.jsx)(n,{value:e.updatedAt}),s&&(0,Z.jsxs)(Z.Fragment,{children:[` `,`· 引用版本 `,e.revision,` ·`,` `,(0,Z.jsx)(`a`,{href:t(W(u,e.owner,e.sessionKey)),onClick:e=>{e.preventDefault(),c()},children:`查看最新`})]})]}),e.overview&&(0,Z.jsx)(`p`,{"data-testid":`session-summary`,children:e.overview.summary}),e.overview?.stale&&(0,Z.jsx)(`small`,{children:`摘要待更新`})]}),(0,Z.jsx)(Oe,{info:e,targeted:a,highlight:a?o:``}),(0,Z.jsx)(r,{error:!0,children:f.error}),f.error&&(0,Z.jsx)(`button`,{onClick:()=>void f.reload(),children:`重新读取`}),f.loading&&(0,Z.jsx)(`p`,{role:`status`,children:`正在读取对话…`}),f.data&&(0,Z.jsxs)(Z.Fragment,{children:[i&&!f.data.messages.some(e=>e.id===i)&&(0,Z.jsx)(r,{children:`该版本中找不到引用的消息,已打开对话原文。`}),(0,Z.jsx)(`div`,{className:`session-messages`,children:f.data.messages.map(e=>(0,Z.jsx)(H,{mine:e.role===`user`,author:e.role===`user`?`用户`:`助手`,className:`session-message ${e.role} ${e.id===i?`matched`:``}`,"data-testid":`session-message`,"data-message-id":e.id,ref:e.id===i?p:void 0,children:(0,Z.jsx)(`div`,{className:`markdown`,children:(0,Z.jsx)(V,{highlight:o,children:e.text})})},e.id))})]})]})}var $=S().trim().min(1).max(120).refine(e=>!/[\r\n]/.test(e),`请使用一句简短的项目记忆。`),Pe=w({id:h(),text:$,state:P([`draft`,`kept`]),revision:D().int().positive(),createdAt:S(),updatedAt:S()}),Fe=w({cards:v(Pe)});w({id:h(),text:$}).strict(),w({expectedRevision:D().int().positive(),text:$.optional(),action:P([`keep`,`discard`,`delete`]).optional()}).strict().refine(e=>e.text!==void 0||e.action!==void 0,`没有需要保存的修改。`),w({text:$}).strict();function Ie(){let{request:e,projectId:t}=I(),n=(0,q.useCallback)(t=>e(`memory`,Fe,{signal:t}),[e]),i=j(n,5e3,a(t,`memory`)),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)({}),d=(0,q.useRef)(null),f=[...i.data?.cards??[]];for(let e of Object.values(c))f.some(t=>t.id===e.id)||f.push(e);if(i.data&&!d.current&&(d.current=[...f].sort((e,t)=>Number(t.state===`kept`)-Number(e.state===`kept`)).map(e=>e.id)),d.current){let e=new Map(d.current.map((e,t)=>[e,t]));for(let t of f)e.has(t.id)||(e.set(t.id,d.current.length),d.current.push(t.id));f.sort((t,n)=>e.get(t.id)-e.get(n.id))}return(0,Z.jsxs)(`section`,{className:`memory-page`,children:[(0,Z.jsx)(u,{title:`记忆`,children:(0,Z.jsx)(R,{icon:`plus`,label:`新增记忆`,disabled:!!o,onClick:()=>s(y())})}),(0,Z.jsx)(r,{error:!0,children:i.error}),!i.data&&i.loading&&(0,Z.jsx)(`p`,{role:`status`,children:`加载中…`}),(0,Z.jsxs)(`div`,{className:`memory-cards`,children:[o&&(0,Z.jsx)(Le,{id:o,onDone:()=>s(null),reload:i.reload},o),f.map(e=>(0,Z.jsx)(Le,{id:e.id,card:e,reload:i.reload,onEditing:t=>l(n=>{let r={...n};return t?r[e.id]=e:delete r[e.id],r})},e.id))]}),i.data&&f.length===0&&!o&&(0,Z.jsx)(`p`,{className:`memory-empty`,children:`暂无记忆`})]})}function Le({id:t,card:n,reload:i,onDone:a,onEditing:o}){let{request:s}=I(),[l,u]=(0,q.useState)(!n),[d,f]=(0,q.useState)(n?.text??``),[p,m]=(0,q.useState)(n?.revision),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(``),y=(0,q.useRef)(!1),b=(0,q.useRef)(!1);function S(){b.current=!1,o?.(!0),f(n?.text??``),m(n?.revision),v(``),u(!0)}function C(){b.current=!0,u(!1),v(``),o?.(!1),a?.()}async function T(r){if(!y.current){if(!r&&n&&d===n.text)u(!1),o?.(!1);else if((!r||r===`keep`)&&!$.safeParse(l?d:n?.text).success)v(`请填写一句记忆,最多 120 个字符。`);else{y.current=!0,g(!0),v(``);try{n?await s(`memory/${t}`,w({saved:x()}),{method:`PATCH`,body:{expectedRevision:l?p:n.revision,...r?{action:r}:{},...l&&r!==`discard`&&r!==`delete`?{text:d}:{}}}):await s(`memory`,Pe,{method:`POST`,body:{id:t,text:d}}),u(!1),await i(),o?.(!1),a?.()}catch(t){v(e(t)),await i()}finally{y.current=!1,g(!1)}}}}return(0,Z.jsxs)(`article`,{className:`memory-card`,"data-testid":`memory-card`,"data-memory-id":t,children:[(0,Z.jsx)(`span`,{className:`memory-status ${n?.state===`kept`?`is-kept`:``}`,role:`img`,"aria-label":n?.state===`kept`?`已保留`:`待确认`,children:(0,Z.jsx)(c,{name:n?.state===`kept`?`check`:`question`})}),(0,Z.jsxs)(`div`,{className:`memory-content`,children:[l?(0,Z.jsx)(`textarea`,{autoFocus:!0,"aria-label":`记忆内容`,value:d,maxLength:120,rows:2,disabled:h,onChange:e=>f(e.target.value.replace(/[\r\n]+/g,` `)),onBlur:e=>{b.current?b.current=!1:e.relatedTarget instanceof Element&&e.relatedTarget.closest(`.memory-actions`)||_||T()},onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Escape`&&(e.preventDefault(),C()),e.key===`Enter`&&(e.preventDefault(),T()))}}):(0,Z.jsx)(`button`,{type:`button`,className:`memory-text`,"aria-label":`编辑记忆:${n?.text??``}`,onClick:S,children:n?.text}),(0,Z.jsx)(r,{error:!0,children:_})]}),(0,Z.jsxs)(`div`,{className:`memory-actions`,onMouseDown:e=>{l&&e.preventDefault()},children:[(!n||n.state===`draft`)&&(0,Z.jsx)(R,{icon:`check`,label:n?`保留记忆`:`保存记忆`,disabled:h,onClick:()=>void T(n?`keep`:void 0)}),l&&n?.state===`kept`&&(0,Z.jsx)(R,{icon:`check`,label:`保存记忆`,disabled:h,onClick:()=>void T()}),(0,Z.jsx)(R,{icon:`close`,label:n?n.state===`draft`?`舍弃记忆`:`删除记忆`:`取消新增`,disabled:h,onClick:()=>{n?T(n.state===`draft`?`discard`:`delete`):C()}})]})]})}function Re({section:e,members:t,navigate:n}){let{projectId:r}=I(),[i,a]=(0,q.useState)(e===`sessions`);(0,q.useEffect)(()=>{e===`sessions`&&a(!0)},[e]);let o=t=>{e!==t&&n(`/projects/${r}/${t}`)};return(0,Z.jsx)(se,{active:e===`materials`,onActivate:()=>o(`materials`),children:r=>(0,Z.jsx)(Ae,{members:t,active:e===`sessions`,onActivate:()=>o(`sessions`),children:t=>(0,Z.jsx)(b,{reading:!0,className:`resource-library`,"data-testid":`materials-page`,label:`资料目录`,navigation:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_,{title:`资料`,icon:`materials`,children:r.actions}),(0,Z.jsxs)(`div`,{role:`tree`,"aria-label":`项目资料`,onKeyDown:U,style:{"--tree-level":1},children:[(0,Z.jsxs)(C,{role:`treeitem`,"aria-level":1,"aria-selected":e===`memory`,className:`tree-item tree-folder`,"data-testid":`library-memory`,leading:(0,Z.jsx)(`span`,{className:`tree-chevron`}),onClick:()=>o(`memory`),children:[(0,Z.jsx)(c,{name:`files`}),(0,Z.jsx)(`span`,{className:`tree-name`,children:`记忆`})]}),(0,Z.jsxs)(C,{role:`treeitem`,"aria-level":1,"aria-expanded":i,"aria-selected":e===`sessions`&&!t.hasSelection,className:`tree-item tree-folder`,"data-testid":`library-sessions`,leading:(0,Z.jsx)(`span`,{className:`tree-chevron ${i?`expanded`:``}`,children:(0,Z.jsx)(c,{name:`chevron`,size:`small`})}),onClick:()=>{a(!i),e!==`sessions`&&n(t.href)},children:[(0,Z.jsx)(c,{name:`files`}),(0,Z.jsx)(`span`,{className:`tree-name`,children:`会话库`})]}),(0,Z.jsx)(`div`,{hidden:!i,children:t.tree}),r.tree]})]}),children:e===`materials`?r.reader:e===`sessions`?t.reader:(0,Z.jsx)(`section`,{className:`session-reader`,"aria-label":`项目记忆`,children:(0,Z.jsx)(Ie,{})})})})})}export{Re as ResourceLibrary};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as e,H as t,J as n,R as r,St as i,X as a,c as o,h as s,l as c,q as l,s as u,u as d,y as f}from"./index-BNGGPn0r.js";var p=i(),m=new Intl.Collator(`zh-CN`,{numeric:!0,sensitivity:`base`});function h(e,t){return m.compare(e,t)||(e<t?-1:+(e>t))}var g=a();function _(e){let t=e.target.closest(`[role="treeitem"]`);if(!t)return;let n=[...e.currentTarget.querySelectorAll(`[role="treeitem"]`)].filter(e=>!e.closest(`[hidden]`)),r=n.indexOf(t),i=Number(t.getAttribute(`aria-level`)),a;switch(e.key){case`ArrowDown`:a=n[r+1];break;case`ArrowUp`:a=n[r-1];break;case`Home`:a=n[0];break;case`End`:a=n.at(-1);break;case`ArrowRight`:t.getAttribute(`aria-expanded`)===`false`?t.click():Number(n[r+1]?.getAttribute(`aria-level`))>i&&(a=n[r+1]);break;case`ArrowLeft`:t.getAttribute(`aria-expanded`)===`true`?t.click():a=n.slice(0,r).reverse().find(e=>Number(e.getAttribute(`aria-level`))<i);break;default:return}e.preventDefault(),a?.focus()}var v=(e,t)=>`${e}/${t}`,y=e=>({"--tree-level":e});function b({members:e,...t}){let[n,r]=(0,p.useState)(()=>`folder:${v(e.find(e=>e.hasFiles)?.id??`_project`,``)}`);return(0,g.jsx)(`div`,{role:`tree`,"aria-label":`工作区文件`,"data-testid":`workspace-tree`,onKeyDown:_,children:(0,g.jsx)(S,{owner:u,path:``,level:1,members:e.filter(e=>e.hasFiles),context:{...t,focused:n,onFocus:r}})})}function x({owner:e,path:t,level:n,context:i}){let a=i.expanded.has(v(e,t)),o=`folder:${v(e,t)}`;return(0,g.jsxs)(`div`,{role:`none`,children:[(0,g.jsxs)(s,{type:`button`,role:`treeitem`,className:`tree-item tree-folder`,style:y(n),"aria-label":t||e,"aria-level":n,"aria-expanded":a,"aria-selected":i.selected?.kind===`directory`&&i.selected.owner===e&&i.selected.path===t,tabIndex:i.focused===o?0:-1,"data-testid":`directory-row`,"data-owner-id":e,"data-directory-path":t,onFocus:()=>i.onFocus(o),onClick:()=>i.onToggle(e,t),leading:(0,g.jsx)(`span`,{className:`tree-chevron ${a?`expanded`:``}`,children:(0,g.jsx)(r,{name:`chevron`,size:`small`})}),children:[(0,g.jsx)(r,{name:`files`}),(0,g.jsx)(`span`,{className:`tree-name`,children:t.split(`/`).at(-1)||e})]}),a&&(0,g.jsx)(S,{owner:e,path:t,level:n+1,context:i})]})}function S({owner:i,path:a,level:u,context:m,members:_=[]}){let{api:b,projectId:S}=f(),C=(0,p.useCallback)(e=>b.tree(i,a,void 0,``,e),[i,a]),w=l(C,!1,n(S,`file-tree`,i,a)),[T,E]=(0,p.useState)(),[D,O]=(0,p.useState)(!1),[k,A]=(0,p.useState)(``),j=(0,p.useRef)(null);(0,p.useEffect)(()=>()=>j.current?.abort(),[]);let M=T?.revision===w.data?.revision?T:void 0,N=M?M.nextCursor:w.data?.nextCursor;async function P(){if(!N||!w.data||D)return;O(!0),A(``);let t=new AbortController;j.current=t;try{let e=await b.tree(i,a,w.data.revision,N,t.signal);t.signal.aborted||E({...e,entries:[...M?.entries??[],...e.entries]})}catch(n){t.signal.aborted||A(e(n))}finally{t.signal.aborted||O(!1)}}let F=[...(w.data?.entries??[]).filter(e=>!c(e.path)),...(M?.entries??[]).filter(e=>!c(e.path))],I=m.revealed;if(I?.owner===i&&!c(I.path)&&(!a||I.path.startsWith(a+`/`))){let e=a?I.path.slice(a.length+1):I.path,t=e.indexOf(`/`),n=t<0?I.path:[a,e.slice(0,t)].filter(Boolean).join(`/`);F.some(e=>e.path===n)||F.push(t<0?{...I.file,kind:`file`}:{kind:`directory`,path:n})}let L=[...F.filter(e=>i!==`_project`||!o(e.path)).map(e=>({...e,owner:i})),..._.map(e=>({kind:`directory`,path:``,owner:e.id}))].sort((e,t)=>e.kind===t.kind?h(e.path.split(`/`).at(-1)||e.owner,t.path.split(`/`).at(-1)||t.owner):e.kind===`directory`?-1:1);return(0,g.jsxs)(`div`,{role:`group`,"aria-label":v(d(i)?`teamcontext`:i,a),"aria-busy":w.loading||D,children:[w.loading&&(0,g.jsx)(`p`,{className:`tree-status`,role:`status`,children:`正在加载…`}),(0,g.jsx)(t,{error:!0,children:w.error||k}),w.error&&(0,g.jsx)(`button`,{className:`tree-action`,onClick:()=>void w.reload(),children:`重试`}),L.map(e=>e.kind===`directory`?(0,g.jsx)(x,{owner:e.owner,path:e.path,level:u,context:m},v(e.owner,e.path)):(0,g.jsxs)(s,{type:`button`,role:`treeitem`,className:`tree-item`,style:y(u),"aria-label":e.path,"aria-level":u,"aria-selected":m.selected?.kind===`file`&&m.selected.owner===i&&m.selected.path===e.path,tabIndex:m.focused===`file:${v(i,e.path)}`?0:-1,"data-testid":`file-row`,"data-owner-id":i,"data-file-path":e.path,onFocus:()=>m.onFocus(`file:${v(i,e.path)}`),onClick:()=>m.onSelect(i,e.path),leading:(0,g.jsx)(`span`,{className:`tree-chevron`}),children:[(0,g.jsx)(r,{name:`file`}),(0,g.jsx)(`span`,{className:`tree-name`,children:e.path.split(`/`).at(-1)})]},e.path)),N&&(0,g.jsx)(`button`,{className:`tree-action`,"data-testid":`files-load-more`,disabled:D,onClick:()=>void P(),children:D?`正在加载…`:`加载更多`})]})}export{h as i,v as n,_ as r,b as t};
|