@teammy/server 0.2.3 → 0.2.5
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/README.md +8 -2
- package/dist/main.js +3290 -1855
- package/dist/runtime/shared/tools.json +1 -1
- package/dist/runtime/workflows/task-bootstrap/prompt.md +3 -3
- package/dist/web/assets/Assistant-BrMufoYN.js +1 -0
- package/dist/web/assets/Computers-CB9SLaYP.js +3 -0
- package/dist/web/assets/Computers-Dc45R6Gl.css +1 -0
- package/dist/web/assets/{Conversation-B-uSxDxY.css → Conversation-CNmGkVy7.css} +1 -1
- package/dist/web/assets/{Conversation-1APTn0kq.js → Conversation-CdMTU0mi.js} +1 -1
- package/dist/web/assets/Dashboard-CtRoyvoA.js +1 -0
- package/dist/web/assets/Files-BboTc1OK.js +1 -0
- package/dist/web/assets/{Help-BXvLax7h.js → Help-ZZt_jcMP.js} +104 -110
- package/dist/web/assets/{HtmlPreview-BcspnVI6.js → HtmlPreview-BqdWQIwJ.js} +1 -1
- package/dist/web/assets/{Markdown-Bb9dy2Sh.js → Markdown-BLjhoJ3a.js} +4 -4
- package/dist/web/assets/{MessageComposer-B6iTInqD.js → MessageComposer-CDCDk1ln.js} +1 -1
- package/dist/web/assets/ResourceLibrary-EGh5jEzv.js +6 -0
- package/dist/web/assets/WorkspaceTree-DsBwLN6M.js +1 -0
- package/dist/web/assets/{file-links-B0q73ekI.js → file-links-CFRxCzdx.js} +1 -1
- package/dist/web/assets/index-CujCZTsK.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-Ceif-ARy.js +0 -1
- package/dist/web/assets/Computers-B9XbkIvb.css +0 -1
- package/dist/web/assets/Computers-B_8KVFSv.js +0 -3
- package/dist/web/assets/Dashboard-B-LuQT0a.js +0 -1
- package/dist/web/assets/Files-BdfIlw8b.js +0 -1
- package/dist/web/assets/ResourceLibrary-CXqTEv7V.js +0 -6
- package/dist/web/assets/WorkspaceTree-D0UUUBtF.js +0 -1
- package/dist/web/assets/index-C5-iSe99.js +0 -66
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
},
|
|
18
18
|
"query_tasks": {
|
|
19
19
|
"label": "查询当前成员任务",
|
|
20
|
-
"description": "Read-only query of tasks belonging ONLY to the member assigned to this maintenance run; never queries other members or changes ownership. Filter by id, source (
|
|
20
|
+
"description": "Read-only query of tasks belonging ONLY to the member assigned to this maintenance run; never queries other members or changes ownership. Filter by id, source (file or directory prefix relative to teamcontext), or query (title/goal/progress/source substring). visibility=active (default), archived or all; an exact id defaults to all. Returns taskId (use in the final upsert/archive result), current task fields, revision, lastEdit (latest human/delegated edit, nullable time and actor), sources and active flag. Continue from these current values, including user edits, using new evidence; do not reconstruct a separate automatic version from old files. Long results are abbreviated with an omitted count; narrow the query as needed."
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
...成员的工作记录
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
公共 README
|
|
18
|
+
公共 README 说明工作区用途与共同约定;新建任务遵循模板,一项独立任务一个文件夹。历史记录保持原有组织方式;成员及其子目录的 README 说明个人组织方式,也可能直接记录任务。文件可以缺失,成员不必遵循模板,按实际正文理解工作。
|
|
19
19
|
|
|
20
20
|
输入说明当前成员、整理模式及简要变化。增量时 `/baseline/teamcontext` 保存上次成功应用的资料;变化列表可缩略,行号只用于定位。通过原生文件工具和 Bash 自主探索,通过 `query_tasks` 查询已有任务。
|
|
21
21
|
|
|
22
22
|
## 任务与字段
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
按实际工作目标识别任务。项目通常将一项任务放在一个目录,README 说明目标,log、results 等补充过程与结论;目录结构是关联线索,不决定任务数量。结合正文与已有任务判断是延续进展还是独立工作,允许跨文件归并或从综合记录中提取多个任务。明确提出的工作即使尚未正式建档也可纳入;讨论中的可能性、组织说明、模板和支撑数据不自动成为任务。
|
|
25
25
|
|
|
26
26
|
结合原始目标与后续进展判断现状,形成结论前检查相关记录中的验收、修订和遗留事项,避免局部摘录遗漏影响判断的信息。判断应与证据范围一致:局部修复不代表整体验收完成,未记录进展不代表尚未开始。
|
|
27
27
|
|
|
@@ -48,7 +48,7 @@ query_tasks 返回任务的当前内容,已经包含用户保存的修改,
|
|
|
48
48
|
|
|
49
49
|
## 任务文件与补充记录
|
|
50
50
|
|
|
51
|
-
成员目录也可能包含 Tim
|
|
51
|
+
成员目录也可能包含 Tim 按用户委托新建或修订的工作文件,与用户本地文件按实际内容共同理解;创建文件不代表已经创建卡片。可用 query_tasks 的 source 按目录前缀查询已有任务,结合其来源和本轮文件变化判断关联;仅因标题或引用文件变化,不必重新建卡。query_tasks 的 movedSources 说明系统为避让同名文件而迁移的来源路径,可沿新路径继续核对原任务,不把换名本身当成新增工作。
|
|
52
52
|
|
|
53
53
|
任务目录内的 `_task_update/` 保存关联已有任务的进展和人工修正。query_tasks 的 updates 给出对应的当前文件及版本,可按需读取;这些记录用于维护原任务,不单独生成新任务,其 README 只是目录说明。网页人工修正已即时进入当前任务,补充文件用于保留依据;仅重新读到旧内容不得撤销当前判断,后续有新的实质证据仍可更新。Agent 新增的补充记录只表达文件中的事实,需本轮分析后才更新卡片。不要根据记录日期机械判断状态优先级。
|
|
54
54
|
|
|
@@ -0,0 +1 @@
|
|
|
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-CujCZTsK.js";import{t as ce}from"./Markdown-BLjhoJ3a.js";import{a as le,i as ue,n as de,r as fe,t as pe}from"./Conversation-CdMTU0mi.js";import{t as me}from"./MessageComposer-CDCDk1ln.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};
|
|
@@ -0,0 +1,3 @@
|
|
|
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-CujCZTsK.js";import{t as M}from"./Markdown-BLjhoJ3a.js";import{a as ne,n as re,o as N,r as P,t as ie}from"./Conversation-CdMTU0mi.js";import{n as F,t as ae}from"./MessageComposer-CDCDk1ln.js";import{r as oe}from"./WorkspaceTree-DsBwLN6M.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};
|
|
@@ -0,0 +1 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
main#main:has(.conversation-layout){height:100dvh;padding:0;overflow:hidden}.assistant-layout{grid-template-columns:var(--pane-width) minmax(0, 1fr);height:100%;min-height:0;overflow:hidden}.assistant-list{border-right:1px solid var(--color-line);background:var(--color-surface);flex-direction:column;min-height:0;display:flex}.assistant-list-heading,.assistant-thread-heading{border-bottom:1px solid var(--color-line);flex:0 0 76px;justify-content:space-between;align-items:center;padding:0 24px;display:flex}.assistant-list-heading h1{margin:0;font-size:20px}.assistant-thread-heading h2{text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:17px;overflow:hidden}.assistant-message-scroll{flex:1;min-height:0;overflow-y:auto}.assistant-list-status{color:var(--color-muted);font-size:var(--text-sm);margin:20px 24px}.assistant-message-item{border:0;border-bottom:1px solid var(--color-line);text-align:left;width:100%;color:var(--color-text);background:0 0;border-radius:0;align-items:center;gap:12px;padding:20px 24px;display:flex}.assistant-message-item:hover{background:var(--color-hover)}.assistant-message-item.selected{background:var(--color-soft)}.assistant-message-item.archived{color:var(--color-muted)}.assistant-message-item.archived strong{font-weight:400}.assistant-new-chat{width:32px;height:32px;min-height:32px;color:var(--brand-orange);background:var(--color-accent-soft);padding:6px}.assistant-new-chat .icon{width:20px;height:20px}.assistant-new-chat:after{top:calc(100% + 6px);bottom:auto}.assistant-message-copy{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}.assistant-message-copy>.selection-content{width:fit-content;max-width:100%;color:var(--color-text);margin:-5px -8px;padding:5px 8px;display:block;overflow:visible}.assistant-message-item.archived .selection-content{color:inherit}.assistant-message-copy .selection-inner{min-width:0;display:block}.assistant-message-copy .selection-inner strong{display:block}.assistant-message-copy strong,.assistant-message-copy>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.assistant-message-copy strong{font-size:var(--text-base);font-weight:600}.assistant-message-copy>span,.assistant-message-copy time{font-size:var(--text-xs);color:var(--color-muted)}.assistant-message-dot{border-radius:50%;flex:0 0 7px;width:7px;height:7px}.assistant-message-dot.unread{background:var(--brand-orange)}.assistant-thread{background:var(--color-canvas);flex-direction:column;min-width:0;min-height:0;display:flex;overflow:hidden}.assistant-transcript{flex:1;min-height:0;padding:28px clamp(20px,4vw,64px);overflow-y:auto}.assistant-matter-state{border-bottom:1px solid var(--color-line);color:var(--color-muted);font-size:var(--text-xs);overflow-wrap:anywhere;padding:10px 28px;line-height:1.6}.assistant-bubble-row{margin:0 0 24px;display:flex}.assistant-bubble-row.mine{justify-content:flex-end}.assistant-bubble{border-radius:4px var(--radius-lg) var(--radius-lg);background:var(--color-soft);overflow-wrap:anywhere;min-width:100px;max-width:min(88%,800px);padding:14px 18px}.assistant-bubble-row.mine .assistant-bubble{background:var(--color-accent-soft);border-radius:var(--radius-lg) 4px var(--radius-lg) var(--radius-lg)}.assistant-bubble-meta{font-size:var(--text-xs);color:var(--color-muted);align-items:baseline;gap:16px;margin-bottom:8px;display:flex}.assistant-debug-reply{font-size:var(--text-xs);background:var(--color-surface);margin-top:12px;padding:4px 10px}.assistant-bubble .markdown>:first-child{margin-top:0}.assistant-bubble .markdown>:last-child{margin-bottom:0}.assistant-bubble .markdown{font-size:var(--text-base);line-height:1.75}.assistant-bubble .markdown h1,.assistant-bubble .markdown h2{font-size:18px}.assistant-bubble .markdown h3,.assistant-bubble .markdown h4,.assistant-bubble .markdown h5,.assistant-bubble .markdown h6{font-size:var(--text-base)}.assistant-bubble .markdown :is(h1,h2,h3,h4,h5,h6){margin:18px 0 8px;line-height:1.5}.assistant-bubble .markdown :is(p,ul,ol){margin:10px 0}.assistant-bubble .markdown :is(ul,ol){padding-left:1.5em}.assistant-bubble .markdown li+li{margin-top:4px}.assistant-bubble .markdown li>:is(ul,ol){margin:4px 0}.assistant-bubble pre{max-width:100%;overflow-x:auto}.assistant-reply-hint{font-size:var(--text-xs);color:var(--color-muted);margin:0 28px 10px;line-height:1.7}.assistant-empty{height:100%;min-height:240px;color:var(--color-muted);flex-direction:column;justify-content:center;align-items:center;gap:20px;display:flex}.assistant-empty .mascot{width:96px;height:144px}.assistant-empty p{margin:0}.assistant-archived{color:var(--color-muted);font-size:var(--text-sm);justify-content:center;align-items:center;gap:8px;padding:24px;display:flex}.assistant-thread>.notice{margin:0 28px 12px}.assistant-typing{gap:5px;padding:8px 0;display:inline-flex}.assistant-typing i{background:var(--color-muted);border-radius:50%;width:5px;height:5px;animation:1.4s infinite assistant-pulse}.assistant-typing i:nth-child(2){animation-delay:.15s}.assistant-typing i:nth-child(3){animation-delay:.3s}@keyframes assistant-pulse{0%,70%,to{opacity:.35}35%{opacity:1}}@media (prefers-reduced-motion:reduce){.assistant-typing i{animation:none}}@media (width<=900px){.assistant-layout{grid-template-columns:240px minmax(0,1fr)}.assistant-message-item{padding:16px}.assistant-reply-hint{margin:0 16px 10px}.assistant-bubble{max-width:96%}}@media (width<=600px){.assistant-layout{grid-template-columns:150px minmax(0,1fr)}.assistant-list-heading,.assistant-thread-heading{padding:0 12px}.assistant-transcript{padding:16px 10px}.assistant-reply-hint{margin:0 8px 10px}}.assistant-participants{text-overflow:ellipsis;white-space:nowrap;min-width:0;max-width:45%;color:var(--color-muted);font-size:var(--text-sm);margin-left:16px;overflow:hidden}.assistant-thread-heading>div{min-width:0}.assistant-list.file-tree-pane{overflow:hidden}@media (width<=600px){.conversation-layout{grid-template-rows:minmax(130px,26dvh) minmax(0,1fr);grid-template-columns:minmax(0,1fr)}.conversation-layout .assistant-list{border-right:0;border-bottom:1px solid var(--color-line)}.conversation-layout .assistant-list-heading{flex-basis:52px}.conversation-layout .assistant-thread-heading{flex-basis:56px}.conversation-layout .assistant-list.file-tree-pane{padding:12px 16px}.conversation-layout .explorer-heading{min-height:32px;margin-bottom:12px}.conversation-layout .explorer-heading h1{font-size:20px}.conversation-layout .assistant-list.file-tree-pane{grid-template-rows:36px minmax(0,1fr);grid-template-columns:minmax(0,1fr);gap:8px;display:grid}.conversation-layout .assistant-list.file-tree-pane .explorer-heading{margin:0}.conversation-layout .computer-tree{grid-column:1/-1}.conversation-layout .computer-device{margin-top:0}}.conversation-status{background:var(--color-muted);vertical-align:middle;border-radius:50%;flex:0 0 6px;width:6px;height:6px;display:inline-block}.conversation-status.state-online,.conversation-status:is(.state-working,.state-running,.state-waiting,.state-queued,.state-offered,.state-pending){background:var(--brand-orange)}.conversation-status:is(.state-failed,.state-human_routed,.state-uncertain){background:var(--color-danger)}.conversation-status.state-offline{opacity:.45}.conversation-title{flex:1;min-width:0}.topic-preview{font-size:var(--text-xs);color:var(--color-muted);display:block;overflow:hidden}.conversation-system-message{text-align:center;color:var(--color-muted);font-size:var(--text-xs);margin:16px 0;line-height:1.6}.conversation-post.assistant-bubble{border:1px solid var(--color-line);border-radius:var(--radius-md);background:var(--color-surface);width:100%;max-width:none;margin:0 0 16px;padding:20px 24px}.conversation-post .assistant-bubble-meta{justify-content:space-between}.channel-layout .assistant-message-item{gap:8px;padding:12px 18px}.channel-layout .assistant-message-copy{gap:4px}.channel-layout .assistant-message-copy>span{font-size:var(--text-xs)}@media (width<=600px){.conversation-post.assistant-bubble{padding:14px}}
|
|
1
|
+
main#main:has(.conversation-layout){height:100dvh;padding:0;overflow:hidden}.assistant-layout{grid-template-columns:var(--pane-width) minmax(0, 1fr);height:100%;min-height:0;overflow:hidden}.assistant-list{border-right:1px solid var(--color-line);background:var(--color-surface);flex-direction:column;min-height:0;display:flex}.assistant-list-heading,.assistant-thread-heading{border-bottom:1px solid var(--color-line);flex:0 0 76px;justify-content:space-between;align-items:center;padding:0 24px;display:flex}.assistant-list-heading h1{margin:0;font-size:20px}.assistant-thread-heading h2{text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:17px;overflow:hidden}.assistant-message-scroll{flex:1;min-height:0;overflow-y:auto}.assistant-list-status{color:var(--color-muted);font-size:var(--text-sm);margin:20px 24px}.assistant-message-item{border:0;border-bottom:1px solid var(--color-line);text-align:left;width:100%;color:var(--color-text);background:0 0;border-radius:0;align-items:center;gap:12px;padding:20px 24px;display:flex}.assistant-message-item:hover{background:var(--color-hover)}.assistant-message-item.selected{background:var(--color-soft)}.assistant-message-item.archived{color:var(--color-muted)}.assistant-message-item.archived strong{font-weight:400}.assistant-list-actions{align-items:center;gap:6px;display:flex}.assistant-new-chat{width:32px;height:32px;min-height:32px;color:var(--brand-orange);background:var(--color-accent-soft);padding:6px}.assistant-new-chat .icon{width:20px;height:20px}.assistant-new-chat:after{top:calc(100% + 6px);bottom:auto}.assistant-message-copy{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}.assistant-message-copy>.selection-content{width:fit-content;max-width:100%;color:var(--color-text);margin:-5px -8px;padding:5px 8px;display:block;overflow:visible}.assistant-message-item.archived .selection-content{color:inherit}.assistant-message-copy .selection-inner{min-width:0;display:block}.assistant-message-copy .selection-inner strong{display:block}.assistant-message-copy strong,.assistant-message-copy>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.assistant-message-copy strong{font-size:var(--text-base);font-weight:600}.assistant-message-copy>span,.assistant-message-copy time{font-size:var(--text-xs);color:var(--color-muted)}.assistant-message-dot{border-radius:50%;flex:0 0 7px;width:7px;height:7px}.assistant-message-dot.unread{background:var(--brand-orange)}.assistant-thread{background:var(--color-canvas);flex-direction:column;min-width:0;min-height:0;display:flex;overflow:hidden}.assistant-transcript{flex:1;min-height:0;padding:28px clamp(20px,4vw,64px);overflow-y:auto}.assistant-matter-state{border-bottom:1px solid var(--color-line);color:var(--color-muted);font-size:var(--text-xs);overflow-wrap:anywhere;padding:10px 28px;line-height:1.6}.assistant-bubble-row{margin:0 0 24px;display:flex}.assistant-bubble-row.mine{justify-content:flex-end}.assistant-bubble{border-radius:4px var(--radius-lg) var(--radius-lg);background:var(--color-soft);overflow-wrap:anywhere;min-width:100px;max-width:min(88%,800px);padding:14px 18px}.assistant-bubble-row.mine .assistant-bubble{background:var(--color-accent-soft);border-radius:var(--radius-lg) 4px var(--radius-lg) var(--radius-lg)}.assistant-bubble-meta{font-size:var(--text-xs);color:var(--color-muted);align-items:baseline;gap:16px;margin-bottom:8px;display:flex}.assistant-debug-reply{font-size:var(--text-xs);background:var(--color-surface);margin-top:12px;padding:4px 10px}.assistant-bubble .markdown>:first-child{margin-top:0}.assistant-bubble .markdown>:last-child{margin-bottom:0}.assistant-bubble .markdown{font-size:var(--text-base);line-height:1.75}.assistant-bubble .markdown h1,.assistant-bubble .markdown h2{font-size:18px}.assistant-bubble .markdown h3,.assistant-bubble .markdown h4,.assistant-bubble .markdown h5,.assistant-bubble .markdown h6{font-size:var(--text-base)}.assistant-bubble .markdown :is(h1,h2,h3,h4,h5,h6){margin:18px 0 8px;line-height:1.5}.assistant-bubble .markdown :is(p,ul,ol){margin:10px 0}.assistant-bubble .markdown :is(ul,ol){padding-left:1.5em}.assistant-bubble .markdown li+li{margin-top:4px}.assistant-bubble .markdown li>:is(ul,ol){margin:4px 0}.assistant-bubble pre{max-width:100%;overflow-x:auto}.assistant-reply-hint{font-size:var(--text-xs);color:var(--color-muted);margin:0 28px 10px;line-height:1.7}.assistant-empty{height:100%;min-height:240px;color:var(--color-muted);flex-direction:column;justify-content:center;align-items:center;gap:20px;display:flex}.assistant-empty .mascot{width:96px;height:144px}.assistant-empty p{margin:0}.assistant-archived{color:var(--color-muted);font-size:var(--text-sm);justify-content:center;align-items:center;gap:8px;padding:24px;display:flex}.assistant-thread>.notice{margin:0 28px 12px}.assistant-typing{gap:5px;padding:8px 0;display:inline-flex}.assistant-typing i{background:var(--color-muted);border-radius:50%;width:5px;height:5px;animation:1.4s infinite assistant-pulse}.assistant-typing i:nth-child(2){animation-delay:.15s}.assistant-typing i:nth-child(3){animation-delay:.3s}@keyframes assistant-pulse{0%,70%,to{opacity:.35}35%{opacity:1}}@media (prefers-reduced-motion:reduce){.assistant-typing i{animation:none}}@media (width<=900px){.assistant-layout{grid-template-columns:240px minmax(0,1fr)}.assistant-message-item{padding:16px}.assistant-reply-hint{margin:0 16px 10px}.assistant-bubble{max-width:96%}}@media (width<=600px){.assistant-layout{grid-template-columns:150px minmax(0,1fr)}.assistant-list-heading,.assistant-thread-heading{padding:0 12px}.assistant-transcript{padding:16px 10px}.assistant-reply-hint{margin:0 8px 10px}}.assistant-participants{text-overflow:ellipsis;white-space:nowrap;min-width:0;max-width:45%;color:var(--color-muted);font-size:var(--text-sm);margin-left:16px;overflow:hidden}.assistant-thread-heading>div{min-width:0}.assistant-list.file-tree-pane{overflow:hidden}@media (width<=600px){.conversation-layout{grid-template-rows:minmax(130px,26dvh) minmax(0,1fr);grid-template-columns:minmax(0,1fr)}.conversation-layout .assistant-list{border-right:0;border-bottom:1px solid var(--color-line)}.conversation-layout .assistant-list-heading{flex-basis:52px}.conversation-layout .assistant-thread-heading{flex-basis:56px}.conversation-layout .assistant-list.file-tree-pane{padding:12px 16px}.conversation-layout .explorer-heading{min-height:32px;margin-bottom:12px}.conversation-layout .explorer-heading h1{font-size:20px}.conversation-layout .assistant-list.file-tree-pane{grid-template-rows:36px minmax(0,1fr);grid-template-columns:minmax(0,1fr);gap:8px;display:grid}.conversation-layout .assistant-list.file-tree-pane .explorer-heading{margin:0}.conversation-layout .computer-tree{grid-column:1/-1}.conversation-layout .computer-device{margin-top:0}}.conversation-status{background:var(--color-muted);vertical-align:middle;border-radius:50%;flex:0 0 6px;width:6px;height:6px;display:inline-block}.conversation-status.state-online,.conversation-status:is(.state-working,.state-running,.state-waiting,.state-queued,.state-offered,.state-pending){background:var(--brand-orange)}.conversation-status:is(.state-failed,.state-human_routed,.state-uncertain){background:var(--color-danger)}.conversation-status.state-offline{opacity:.45}.conversation-title{flex:1;min-width:0}.topic-preview{font-size:var(--text-xs);color:var(--color-muted);display:block;overflow:hidden}.conversation-system-message{text-align:center;color:var(--color-muted);font-size:var(--text-xs);margin:16px 0;line-height:1.6}.conversation-post.assistant-bubble{border:1px solid var(--color-line);border-radius:var(--radius-md);background:var(--color-surface);width:100%;max-width:none;margin:0 0 16px;padding:20px 24px}.conversation-post .assistant-bubble-meta{justify-content:space-between}.channel-layout .assistant-message-item{gap:8px;padding:12px 18px}.channel-layout .assistant-message-copy{gap:4px}.channel-layout .assistant-message-copy>span{font-size:var(--text-xs)}@media (width<=600px){.conversation-post.assistant-bubble{padding:14px}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{X as e,p as t}from"./index-CujCZTsK.js";var n=e();function r({navigation:e,children:r,className:i=``,tree:a=!1,label:o,testId:s}){return(0,n.jsx)(t,{className:`assistant-layout conversation-layout ${i}`,"data-testid":s,navigation:(0,n.jsx)(`aside`,{className:`assistant-list ${a?`file-tree-pane`:``}`,"aria-label":`${o}列表`,children:e}),children:(0,n.jsx)(`section`,{className:`assistant-thread`,"aria-label":o,children:r})})}function i({mine:e=!1,author:t,time:r,children:i,className:a=``,ref:o,...s}){return(0,n.jsx)(`div`,{...s,ref:o,className:`assistant-bubble-row ${e?`mine`:``} ${a}`,children:(0,n.jsxs)(`div`,{className:`assistant-bubble`,children:[(0,n.jsxs)(`div`,{className:`assistant-bubble-meta`,children:[(0,n.jsx)(`span`,{children:t}),r&&(0,n.jsx)(`time`,{dateTime:r,children:new Date(r).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})})]}),i]})})}function a({label:e,state:t=`idle`}){return(0,n.jsx)(`span`,{className:`conversation-status state-${t}`,role:`img`,"aria-label":e,title:e})}function o({author:e,time:t,children:r}){return(0,n.jsxs)(`article`,{className:`conversation-post assistant-bubble`,children:[(0,n.jsxs)(`header`,{className:`assistant-bubble-meta`,children:[(0,n.jsx)(`strong`,{children:e}),t&&(0,n.jsx)(`time`,{dateTime:t,children:new Date(t).toLocaleString(`zh-CN`,{month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})})]}),r]})}function s({title:e,actions:t}){return(0,n.jsxs)(`header`,{className:`assistant-thread-heading`,children:[(0,n.jsx)(`div`,{className:`conversation-title`,children:e}),t]})}function c({ref:e,...t}){return(0,n.jsx)(`div`,{role:`log`,"aria-live":`polite`,...t,ref:e,className:`assistant-transcript`})}export{c as a,o as i,s as n,a as o,r,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
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-CujCZTsK.js";import{t as v}from"./project-links-Dy6-B89_.js";import"./file-links-CFRxCzdx.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};
|
|
@@ -0,0 +1 @@
|
|
|
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-CujCZTsK.js";import{t as b}from"./Markdown-BLjhoJ3a.js";import{n as x,t as S}from"./WorkspaceTree-DsBwLN6M.js";import{t as C}from"./project-links-Dy6-B89_.js";import{t as w}from"./file-links-CFRxCzdx.js";import{t as T}from"./HtmlPreview-BqdWQIwJ.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};
|