@teammy/server 0.2.22 → 0.2.23

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.
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./TerminalPane-5Gw9ZNxq.js","./Dropdown-DGFI68Vd.js","./Dropdown-ktgqMqAD.css","./index-BZEKT27U.js","./index-CeKzFsxV.css","./Markdown-gPLWRWEJ.js","./task-links-DTqf18C2.js","./TerminalPane-BrSy-0jI.css"])))=>i.map(i=>d[i]);
2
- import{A as e,At as t,Ct as n,I as r,L as i,M as a,N as o,O as s,S as c,T as l,Tt as u,at as d,bt as f,c as p,d as m,gt as h,ht as g,j as _,jt as v,l as y,mt as b,p as x,pt as S,t as C,vt as w,w as T,x as E,y as D,yt as O}from"./Dropdown-DGFI68Vd.js";import{C as k,D as A,F as j,H as ee,L as te,O as M,S as ne,T as N,U as re,W as ie,_ as ae,a as oe,b as se,c as ce,d as le,f as ue,g as de,h as fe,i as pe,l as me,m as he,p as ge,s as _e,t as ve,u as ye,v as be,w as xe,x as Se,y as P,z as Ce}from"./index-BZEKT27U.js";import{a as we,i as Te,t as Ee}from"./Markdown-gPLWRWEJ.js";import{a as De,i as Oe,n as ke,t as Ae}from"./Conversation-ClLZZ3fG.js";import{n as je,t as Me}from"./MessageComposer-BoOgfyPA.js";import{l as Ne,r as Pe}from"./WorkspaceTree-DZ6DN_OX.js";var F=t(),I=a();function Fe({title:e,busy:t,onSave:n}){let[r,i]=(0,F.useState)(!1),[a,o]=(0,F.useState)(e);return r?(0,I.jsx)(`form`,{className:`session-title-form`,onSubmit:t=>{t.preventDefault(),a.trim()&&a.trim()!==e&&n(a.trim()),i(!1)},children:(0,I.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,I.jsx)(`h2`,{children:(0,I.jsx)(`button`,{type:`button`,className:`session-rename`,title:`重命名会话`,"aria-label":`重命名会话:${e}`,onClick:()=>{o(e),i(!0)},children:e})})}var Ie=f({id:n().uuid(),directory:n(),title:n(),cwd:n(),createdAt:n(),state:S([`running`,`exited`]),exitCode:O().nullable()}),L={id:n().uuid(),directory:n().min(1).max(200)},Le={cols:O().int().min(2).max(500),rows:O().int().min(1).max(300)};h(`type`,[f({type:w(`create`),...L,...Le,title:n().trim().min(1).max(160)}),f({type:w(`attach`),...L}),f({type:w(`detach`),...L}),f({type:w(`input`),...L,data:n().max(65536)}),f({type:w(`resize`),...L,...Le}),f({type:w(`rename`),...L,title:n().trim().min(1).max(160)}),f({type:w(`close`),...L})]);var Re=h(`type`,[f({type:w(`size`),id:n(),...Le}),f({type:w(`inventory`),directories:b(n()),terminals:b(Ie)}),f({type:w(`snapshot`),id:n(),data:n(),cols:O(),rows:O(),seq:O()}),f({type:w(`output`),id:n(),data:n(),seq:O()}),f({type:w(`result`),id:n(),operation:n(),error:n().optional()})]);function ze(e,t){let n=(0,F.useRef)(null),r=(0,F.useRef)(new Set),[i,a]=(0,F.useState)(!1),[o,s]=(0,F.useState)([]),[c,l]=(0,F.useState)([]);(0,F.useEffect)(()=>{if(!t)return;let i=!1,o,c,u=()=>{let t=new URL(v(`/api/v1/projects/${encodeURIComponent(e)}/web/terminals`),location.origin);t.protocol=t.protocol===`https:`?`wss:`:`ws:`,c=new WebSocket(t),n.current=c,c.onmessage=e=>{let t=Re.safeParse(JSON.parse(e.data));if(!t.success||i)return;let n=t.data;n.type===`inventory`&&(l(n.terminals),s(n.directories),a(!0));for(let e of r.current)e(n)},c.onclose=()=>{a(!1),s([]),i||(o=setTimeout(u,2e3))}};return u(),()=>{i=!0,clearTimeout(o),c?.close(),n.current=null}},[e,t]);let u=(0,F.useCallback)(e=>(r.current.add(e),()=>{r.current.delete(e)}),[]),d=(0,F.useCallback)(e=>{if(n.current?.readyState!==WebSocket.OPEN)throw Error(`终端连接已断开,输入未发送。`);n.current.send(JSON.stringify(e))},[]);return{connected:i,directories:o,terminals:c,subscribe:u,send:d,request:(0,F.useCallback)(e=>new Promise((t,n)=>{let r=setTimeout(()=>{i(),n(Error(`暂未收到结果,请检查连接;操作不会自动重发。`))},15e3),i=u(a=>{a.type===`result`&&a.id===e.id&&a.operation===e.type&&(clearTimeout(r),i(),a.error?n(Error(a.error)):t())});try{d(e)}catch(e){clearTimeout(r),i(),n(e)}}),[d,u])}}f({provider:he,cursor:n().optional(),session:be.optional()});var R=f({id:be,title:n(),cwd:n(),updatedAt:n().datetime().nullable(),active:g().default(!1)}),z=f({sessions:b(R),nextCursor:n().nullable()}),Be=f({command:P,history:z.nullable()});function Ve(e,t=Date.now()){if(!e)return``;let n=new Date(e),r=Math.max(0,t-n.getTime());return Number.isFinite(r)?r<36e5?`${Math.floor(r/6e4)}min`:r<864e5?`${Math.floor(r/36e5)}h`:r<=6048e5?`${Math.floor(r/864e5)}day`:`${String(n.getFullYear()).slice(-2)}/${String(n.getMonth()+1).padStart(2,`0`)}/${String(n.getDate()).padStart(2,`0`)}`:``}function He({id:e,label:t,value:n,onChange:r,options:i,placeholder:a,loading:o=!1,disabled:s=!1,empty:c=`没有匹配的选项。`,footer:l}){let[u,d]=(0,F.useState)(!1),[f,p]=(0,F.useState)(``),[m,h]=(0,F.useState)(),g=(0,F.useRef)(null),_=(0,F.useRef)(null),v=(0,F.useRef)(null),b=i.find(e=>e.value===n),x=b?``:n.trim().toLocaleLowerCase(),S=i.filter(e=>`${e.label} ${e.value}`.toLocaleLowerCase().includes(x)),C=S.filter(e=>!e.disabled),w=S.findIndex(e=>e.value===f);(0,F.useEffect)(()=>p(``),[n]),(0,F.useEffect)(()=>{if(!u)return;let e=e=>{g.current?.contains(e.target)||d(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[u]),(0,F.useLayoutEffect)(()=>{if(!u)return;let e=()=>{let e=_.current?.getBoundingClientRect();if(!e)return;let t=innerHeight-e.bottom-16,n=e.top-16,r=t<220&&n>t;h({left:e.left,width:e.width,top:r?void 0:e.bottom+6,bottom:r?innerHeight-e.top+6:void 0,maxHeight:Math.min(320,r?n:t)})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[u]),(0,F.useEffect)(()=>{u&&w>=0&&document.getElementById(`${e}-option-${w}`)?.scrollIntoView({block:`nearest`})},[u,w,e]);function T(e){e.disabled||(r(e.value),d(!1),v.current?.focus())}return(0,I.jsxs)(`div`,{className:`combobox`,ref:g,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||d(!1)},onKeyDown:e=>{e.key===`Escape`&&u&&(e.preventDefault(),e.stopPropagation(),d(!1),v.current?.focus())},children:[(0,I.jsxs)(`div`,{className:`combobox-field`,ref:_,children:[(0,I.jsx)(`input`,{id:e,ref:v,role:`combobox`,"aria-label":t,"aria-autocomplete":`list`,"aria-expanded":u,"aria-controls":`${e}-list`,"aria-activedescendant":u&&w>=0?`${e}-option-${w}`:void 0,autoComplete:`off`,disabled:s,value:b?.label??n,title:b?.value,placeholder:a,onClick:()=>d(!0),onChange:e=>{r(e.target.value),d(!0)},onKeyDown:e=>{if([`ArrowDown`,`ArrowUp`].includes(e.key)){e.preventDefault(),d(!0);let t=C.findIndex(e=>e.value===f),n=t<0?e.key===`ArrowDown`?0:C.length-1:(t+(e.key===`ArrowDown`?1:-1)+C.length)%C.length;p(C[n]?.value??``)}else e.key===`Enter`&&u&&w>=0?(e.preventDefault(),T(S[w])):e.key===`Tab`&&d(!1)}}),(0,I.jsx)(y,{icon:u?`chevronUp`:`chevronDown`,label:`${u?`收起`:`展开`}${t}`,disabled:s,"aria-expanded":u,"aria-controls":`${e}-list`,onClick:()=>{d(!u),v.current?.focus()}})]}),u&&(0,I.jsxs)(`div`,{className:`combobox-popup`,style:m,children:[(0,I.jsxs)(`div`,{id:`${e}-list`,role:`listbox`,"aria-label":t,"aria-busy":o,children:[S.map((t,r)=>(0,I.jsxs)(`button`,{id:`${e}-option-${r}`,type:`button`,role:`option`,"aria-selected":t.value===n,disabled:t.disabled,tabIndex:-1,className:`combobox-option ${t.value===f?`active`:``}`,title:`${t.label} · ${t.value}`,onMouseDown:e=>e.preventDefault(),onClick:()=>T(t),children:[(0,I.jsxs)(`span`,{className:`combobox-option-copy`,children:[(0,I.jsx)(`span`,{children:t.label}),t.description&&(0,I.jsx)(`small`,{children:t.description})]}),t.detail&&(0,I.jsx)(`span`,{className:`combobox-option-detail`,children:t.detail})]},t.value)),o&&(0,I.jsx)(`p`,{className:`combobox-message`,role:`status`,children:`正在读取…`}),!o&&!S.length&&(0,I.jsx)(`p`,{className:`combobox-message`,children:c})]}),l&&(0,I.jsx)(`div`,{className:`combobox-footer`,children:l})]})]})}function Ue({directory:e,provider:t,providers:n,sessions:a,request:o,onClose:s,onImport:c}){let[l,u]=(0,F.useState)(t),[d,f]=(0,F.useState)([]),[p,h]=(0,F.useState)(null),[g,_]=(0,F.useState)(``),[v,b]=(0,F.useState)(null),x=T(),S=(0,F.useRef)(null),C=e=>a.find(t=>!t.hidden&&t.provider===l&&(t.nativeSession??t.resumeSession)===e);async function w(t,n){let r=i();for(await o(`web/local-agents/${e}/history`,P,{method:`POST`,signal:n,body:{id:r,argument:JSON.stringify({provider:l,...t})}});!n.aborted;){let t=await o(`web/local-agents/${e}/history/${r}`,Be,{signal:n});if(t.command.state===`succeeded`&&t.history)return{...t.history,id:r};if(![`queued`,`running`].includes(t.command.state))throw Error(t.command.error||`读取历史会话失败。`);await new Promise(e=>{let t=()=>{clearTimeout(r),n.removeEventListener(`abort`,t),e()},r=setTimeout(t,1e3);n.addEventListener(`abort`,t,{once:!0})})}throw new DOMException(`Aborted`,`AbortError`)}async function E(t,n,r){let a=C(t.id)??await o(`web/local-agents/${e}/sessions`,ae,{method:`POST`,signal:r,body:{id:i(),title:t.title,provider:l,resumeSession:t.id,historyRequest:n}});r.aborted||c(a)}async function D(e,t){S.current?.abort();let n=new AbortController;S.current=n,b(e),x(``);try{await t(n.signal)}catch(e){n.signal.aborted||x(r(e))}finally{n.signal.aborted||b(null)}}let O=e=>D(`list`,async t=>{let n=await w(e?{cursor:e}:{},t);t.aborted||(f(t=>{let r=[...e?t:[],...n.sessions.map(e=>({...e,requestId:n.id}))];return[...new Map(r.map(e=>[e.id,e])).values()].sort((e,t)=>(t.updatedAt??``).localeCompare(e.updatedAt??``))}),h(n.nextCursor))});(0,F.useEffect)(()=>(f([]),h(null),_(``),O(),()=>S.current?.abort()),[l,e,o]);let k=d.find(e=>e.id===g),A=v===`import`;return(0,I.jsx)(m,{id:`computer-import-session`,title:`导入历史会话`,onClose:s,children:(0,I.jsxs)(`form`,{className:`native-history`,onSubmit:e=>{e.preventDefault(),D(`import`,async e=>{let t=g.trim(),n=C(t);if(n)return c(n);if(k)return E(k,k.requestId,e);let r=await w({session:t},e),i=r.sessions.find(e=>e.id===t);if(!i)throw Error(`找不到此目录中的会话。`);await E(i,r.id,e)})},children:[(0,I.jsx)(ce,{label:`历史会话 Agent`,value:l,onChange:u,providers:[t,...n],disabled:A}),(0,I.jsxs)(`div`,{className:`field`,children:[(0,I.jsx)(`label`,{htmlFor:`native-history-session`,children:`Session`}),(0,I.jsxs)(`div`,{className:`native-history-input-row`,children:[(0,I.jsx)(He,{id:`native-history-session`,label:`历史会话`,value:g,onChange:_,placeholder:`选择会话或输入 ID`,disabled:A,loading:v===`list`,empty:g?`未找到匹配会话,可直接输入 Session ID。`:`此目录暂无历史会话,可输入 Session ID。`,options:d.map(e=>({value:e.id,label:e.title,description:e.id,detail:C(e.id)?`已接入`:e.active?`工作中`:Ve(e.updatedAt),disabled:e.active&&!C(e.id)})),footer:(0,I.jsxs)(I.Fragment,{children:[p&&(0,I.jsx)(`button`,{className:`native-history-more`,type:`button`,disabled:!!v,onClick:()=>void O(p),children:`加载更多`}),(0,I.jsx)(y,{icon:`refresh`,label:`刷新历史会话`,disabled:!!v,onClick:()=>void O()})]})},l),(0,I.jsx)(`button`,{type:`submit`,disabled:A||!be.safeParse(g.trim()).success||!!k?.active&&!C(k.id),children:A?`正在导入…`:C(g.trim())?`打开`:`导入`})]})]}),(0,I.jsx)(`small`,{className:`muted`,children:`请先退出原终端会话。`})]})})}var We={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,webp:`image/webp`,gif:`image/gif`,avif:`image/avif`,bmp:`image/bmp`,ico:`image/x-icon`,svg:`image/svg+xml`};function Ge(e,t){let n=e.toLowerCase().split(`.`).at(-1)??``;return t&&Object.values(We).includes(t)?t:Object.hasOwn(We,n)?We[n]:n===`pdf`?`application/pdf`:/^(md|markdown|mdown)$/.test(n)?`text/markdown`:/^html?$/.test(n)?`text/html`:/^(txt|log|csv|tsv|jsonl?|ndjson|ya?ml|toml|ini|cfg|conf|xml|sql|diff|patch|sh|bash|zsh|fish|py|js|jsx|mjs|cjs|ts|tsx|css|scss|vue|svelte|go|rs|c|cc|cpp|h|hpp|java|kt|swift|rb|lua|r|tex|rst|properties|env|lock)$/.test(n)||/^(readme|license|makefile|dockerfile|cmakelists\.txt|\.gitignore)$/i.test(e)?`text/plain`:``}async function Ke(e,t){let n=e.body.getReader(),r=[],i=0,a=(t??0)>M;try{for(;;){let{done:e,value:t}=await n.read();if(e)break;let o=Math.min(t.length,M-i);if(r.push(t.slice(0,o)),i+=o,o<t.length||a&&i===524288){a=!0;break}}}finally{await n.cancel(),n.releaseLock()}return{blob:new Blob(r),truncated:a}}async function qe(e,t,n,r){let i=e.previewUrl??e.url;if(i.startsWith(`data:`)&&t.startsWith(`image/`))return{format:t,preview:i,download:i};if(!t&&!e.previewUrl)return{format:``};let a=await fetch(i,{credentials:`same-origin`,cache:`no-store`,signal:n});if(!a.ok)throw Error((await a.json().catch(()=>null))?.error?.message??`文件暂不可用。`);if(!t)return await a.body?.cancel(),{format:``};if(t.startsWith(`text/`)){let n=a.headers.get(`X-Teammy-File-Size`)??a.headers.get(`Content-Length`),{blob:i,truncated:o}=await Ke(a,n===null?e.size:Number(n)),s=o?void 0:r(i.slice(0,i.size,`application/octet-stream`)),c;try{c=new TextDecoder(`utf-8`,{fatal:!0}).decode(await i.arrayBuffer(),{stream:o})}catch{return{format:``,download:s}}return c.includes(`\0`)?{format:``,download:s}:{format:t,text:c,truncated:o,download:s}}let o=await a.blob();if(t===`image/svg+xml`)return{format:t,preview:`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(await o.text()),download:r(o.slice(0,o.size,`application/octet-stream`))};if(t===`application/pdf`&&(navigator.pdfViewerEnabled===!1||await o.slice(0,5).text()!==`%PDF-`))return{format:``,download:r(o.slice(0,o.size,`application/octet-stream`))};let s=r(o.slice(0,o.size,t));return{format:t,preview:s,download:s}}function Je({file:e,onClose:t,gallery:n}){let[i,a]=(0,F.useState)(),[o,s]=(0,F.useState)(``),[c,l]=(0,F.useState)(0),[u,d]=(0,F.useState)(!1),f=(0,F.useRef)(null),h=(0,F.useRef)(null),g=Ge(e.name,e.mimeType),{name:_,url:v,previewUrl:b,size:x}=e;(0,F.useEffect)(()=>{let e=new AbortController,t;return a(void 0),s(``),d(!1),qe({name:_,url:v,previewUrl:b,size:x},g,e.signal,n=>(e.signal.throwIfAborted(),t=URL.createObjectURL(n),t)).then(t=>{e.signal.aborted||a(t)}).catch(t=>{e.signal.aborted||s(r(t))}),f.current?.focus(),()=>{e.abort(),t&&URL.revokeObjectURL(t)}},[v,x,b,_,g,c]),(0,F.useEffect)(()=>{h.current?.scrollIntoView({block:`center`})},[i,e.line]);let S=e.line&&i?.text!==void 0?i.text.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./TerminalPane-BTRM-36z.js","./Dropdown-DGFI68Vd.js","./Dropdown-ktgqMqAD.css","./index-mhJ33-bH.js","./index-CeKzFsxV.css","./Markdown-CXnZDm5J.js","./task-links-BE36-8mc.js","./TerminalPane-BrSy-0jI.css"])))=>i.map(i=>d[i]);
2
+ import{A as e,At as t,Ct as n,I as r,L as i,M as a,N as o,O as s,S as c,T as l,Tt as u,at as d,bt as f,c as p,d as m,gt as h,ht as g,j as _,jt as v,l as y,mt as b,p as x,pt as S,t as C,vt as w,w as T,x as E,y as D,yt as O}from"./Dropdown-DGFI68Vd.js";import{C as k,D as A,F as j,H as ee,L as te,O as M,S as ne,T as N,U as re,W as ie,_ as ae,a as oe,b as se,c as ce,d as le,f as ue,g as de,h as fe,i as pe,l as me,m as he,p as ge,s as _e,t as ve,u as ye,v as be,w as xe,x as Se,y as P,z as Ce}from"./index-mhJ33-bH.js";import{a as we,i as Te,t as Ee}from"./Markdown-CXnZDm5J.js";import{a as De,i as Oe,n as ke,t as Ae}from"./Conversation-kAMzKADw.js";import{n as je,t as Me}from"./MessageComposer-BoOgfyPA.js";import{l as Ne,r as Pe}from"./WorkspaceTree-Co7XG2RG.js";var F=t(),I=a();function Fe({title:e,busy:t,onSave:n}){let[r,i]=(0,F.useState)(!1),[a,o]=(0,F.useState)(e);return r?(0,I.jsx)(`form`,{className:`session-title-form`,onSubmit:t=>{t.preventDefault(),a.trim()&&a.trim()!==e&&n(a.trim()),i(!1)},children:(0,I.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,I.jsx)(`h2`,{children:(0,I.jsx)(`button`,{type:`button`,className:`session-rename`,title:`重命名会话`,"aria-label":`重命名会话:${e}`,onClick:()=>{o(e),i(!0)},children:e})})}var Ie=f({id:n().uuid(),directory:n(),title:n(),cwd:n(),createdAt:n(),state:S([`running`,`exited`]),exitCode:O().nullable()}),L={id:n().uuid(),directory:n().min(1).max(200)},Le={cols:O().int().min(2).max(500),rows:O().int().min(1).max(300)};h(`type`,[f({type:w(`create`),...L,...Le,title:n().trim().min(1).max(160)}),f({type:w(`attach`),...L}),f({type:w(`detach`),...L}),f({type:w(`input`),...L,data:n().max(65536)}),f({type:w(`resize`),...L,...Le}),f({type:w(`rename`),...L,title:n().trim().min(1).max(160)}),f({type:w(`close`),...L})]);var Re=h(`type`,[f({type:w(`size`),id:n(),...Le}),f({type:w(`inventory`),directories:b(n()),terminals:b(Ie)}),f({type:w(`snapshot`),id:n(),data:n(),cols:O(),rows:O(),seq:O()}),f({type:w(`output`),id:n(),data:n(),seq:O()}),f({type:w(`result`),id:n(),operation:n(),error:n().optional()})]);function ze(e,t){let n=(0,F.useRef)(null),r=(0,F.useRef)(new Set),[i,a]=(0,F.useState)(!1),[o,s]=(0,F.useState)([]),[c,l]=(0,F.useState)([]);(0,F.useEffect)(()=>{if(!t)return;let i=!1,o,c,u=()=>{let t=new URL(v(`/api/v1/projects/${encodeURIComponent(e)}/web/terminals`),location.origin);t.protocol=t.protocol===`https:`?`wss:`:`ws:`,c=new WebSocket(t),n.current=c,c.onmessage=e=>{let t=Re.safeParse(JSON.parse(e.data));if(!t.success||i)return;let n=t.data;n.type===`inventory`&&(l(n.terminals),s(n.directories),a(!0));for(let e of r.current)e(n)},c.onclose=()=>{a(!1),s([]),i||(o=setTimeout(u,2e3))}};return u(),()=>{i=!0,clearTimeout(o),c?.close(),n.current=null}},[e,t]);let u=(0,F.useCallback)(e=>(r.current.add(e),()=>{r.current.delete(e)}),[]),d=(0,F.useCallback)(e=>{if(n.current?.readyState!==WebSocket.OPEN)throw Error(`终端连接已断开,输入未发送。`);n.current.send(JSON.stringify(e))},[]);return{connected:i,directories:o,terminals:c,subscribe:u,send:d,request:(0,F.useCallback)(e=>new Promise((t,n)=>{let r=setTimeout(()=>{i(),n(Error(`暂未收到结果,请检查连接;操作不会自动重发。`))},15e3),i=u(a=>{a.type===`result`&&a.id===e.id&&a.operation===e.type&&(clearTimeout(r),i(),a.error?n(Error(a.error)):t())});try{d(e)}catch(e){clearTimeout(r),i(),n(e)}}),[d,u])}}f({provider:he,cursor:n().optional(),session:be.optional()});var R=f({id:be,title:n(),cwd:n(),updatedAt:n().datetime().nullable(),active:g().default(!1)}),z=f({sessions:b(R),nextCursor:n().nullable()}),Be=f({command:P,history:z.nullable()});function Ve(e,t=Date.now()){if(!e)return``;let n=new Date(e),r=Math.max(0,t-n.getTime());return Number.isFinite(r)?r<36e5?`${Math.floor(r/6e4)}min`:r<864e5?`${Math.floor(r/36e5)}h`:r<=6048e5?`${Math.floor(r/864e5)}day`:`${String(n.getFullYear()).slice(-2)}/${String(n.getMonth()+1).padStart(2,`0`)}/${String(n.getDate()).padStart(2,`0`)}`:``}function He({id:e,label:t,value:n,onChange:r,options:i,placeholder:a,loading:o=!1,disabled:s=!1,empty:c=`没有匹配的选项。`,footer:l}){let[u,d]=(0,F.useState)(!1),[f,p]=(0,F.useState)(``),[m,h]=(0,F.useState)(),g=(0,F.useRef)(null),_=(0,F.useRef)(null),v=(0,F.useRef)(null),b=i.find(e=>e.value===n),x=b?``:n.trim().toLocaleLowerCase(),S=i.filter(e=>`${e.label} ${e.value}`.toLocaleLowerCase().includes(x)),C=S.filter(e=>!e.disabled),w=S.findIndex(e=>e.value===f);(0,F.useEffect)(()=>p(``),[n]),(0,F.useEffect)(()=>{if(!u)return;let e=e=>{g.current?.contains(e.target)||d(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[u]),(0,F.useLayoutEffect)(()=>{if(!u)return;let e=()=>{let e=_.current?.getBoundingClientRect();if(!e)return;let t=innerHeight-e.bottom-16,n=e.top-16,r=t<220&&n>t;h({left:e.left,width:e.width,top:r?void 0:e.bottom+6,bottom:r?innerHeight-e.top+6:void 0,maxHeight:Math.min(320,r?n:t)})};return e(),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[u]),(0,F.useEffect)(()=>{u&&w>=0&&document.getElementById(`${e}-option-${w}`)?.scrollIntoView({block:`nearest`})},[u,w,e]);function T(e){e.disabled||(r(e.value),d(!1),v.current?.focus())}return(0,I.jsxs)(`div`,{className:`combobox`,ref:g,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||d(!1)},onKeyDown:e=>{e.key===`Escape`&&u&&(e.preventDefault(),e.stopPropagation(),d(!1),v.current?.focus())},children:[(0,I.jsxs)(`div`,{className:`combobox-field`,ref:_,children:[(0,I.jsx)(`input`,{id:e,ref:v,role:`combobox`,"aria-label":t,"aria-autocomplete":`list`,"aria-expanded":u,"aria-controls":`${e}-list`,"aria-activedescendant":u&&w>=0?`${e}-option-${w}`:void 0,autoComplete:`off`,disabled:s,value:b?.label??n,title:b?.value,placeholder:a,onClick:()=>d(!0),onChange:e=>{r(e.target.value),d(!0)},onKeyDown:e=>{if([`ArrowDown`,`ArrowUp`].includes(e.key)){e.preventDefault(),d(!0);let t=C.findIndex(e=>e.value===f),n=t<0?e.key===`ArrowDown`?0:C.length-1:(t+(e.key===`ArrowDown`?1:-1)+C.length)%C.length;p(C[n]?.value??``)}else e.key===`Enter`&&u&&w>=0?(e.preventDefault(),T(S[w])):e.key===`Tab`&&d(!1)}}),(0,I.jsx)(y,{icon:u?`chevronUp`:`chevronDown`,label:`${u?`收起`:`展开`}${t}`,disabled:s,"aria-expanded":u,"aria-controls":`${e}-list`,onClick:()=>{d(!u),v.current?.focus()}})]}),u&&(0,I.jsxs)(`div`,{className:`combobox-popup`,style:m,children:[(0,I.jsxs)(`div`,{id:`${e}-list`,role:`listbox`,"aria-label":t,"aria-busy":o,children:[S.map((t,r)=>(0,I.jsxs)(`button`,{id:`${e}-option-${r}`,type:`button`,role:`option`,"aria-selected":t.value===n,disabled:t.disabled,tabIndex:-1,className:`combobox-option ${t.value===f?`active`:``}`,title:`${t.label} · ${t.value}`,onMouseDown:e=>e.preventDefault(),onClick:()=>T(t),children:[(0,I.jsxs)(`span`,{className:`combobox-option-copy`,children:[(0,I.jsx)(`span`,{children:t.label}),t.description&&(0,I.jsx)(`small`,{children:t.description})]}),t.detail&&(0,I.jsx)(`span`,{className:`combobox-option-detail`,children:t.detail})]},t.value)),o&&(0,I.jsx)(`p`,{className:`combobox-message`,role:`status`,children:`正在读取…`}),!o&&!S.length&&(0,I.jsx)(`p`,{className:`combobox-message`,children:c})]}),l&&(0,I.jsx)(`div`,{className:`combobox-footer`,children:l})]})]})}function Ue({directory:e,provider:t,providers:n,sessions:a,request:o,onClose:s,onImport:c}){let[l,u]=(0,F.useState)(t),[d,f]=(0,F.useState)([]),[p,h]=(0,F.useState)(null),[g,_]=(0,F.useState)(``),[v,b]=(0,F.useState)(null),x=T(),S=(0,F.useRef)(null),C=e=>a.find(t=>!t.hidden&&t.provider===l&&(t.nativeSession??t.resumeSession)===e);async function w(t,n){let r=i();for(await o(`web/local-agents/${e}/history`,P,{method:`POST`,signal:n,body:{id:r,argument:JSON.stringify({provider:l,...t})}});!n.aborted;){let t=await o(`web/local-agents/${e}/history/${r}`,Be,{signal:n});if(t.command.state===`succeeded`&&t.history)return{...t.history,id:r};if(![`queued`,`running`].includes(t.command.state))throw Error(t.command.error||`读取历史会话失败。`);await new Promise(e=>{let t=()=>{clearTimeout(r),n.removeEventListener(`abort`,t),e()},r=setTimeout(t,1e3);n.addEventListener(`abort`,t,{once:!0})})}throw new DOMException(`Aborted`,`AbortError`)}async function E(t,n,r){let a=C(t.id)??await o(`web/local-agents/${e}/sessions`,ae,{method:`POST`,signal:r,body:{id:i(),title:t.title,provider:l,resumeSession:t.id,historyRequest:n}});r.aborted||c(a)}async function D(e,t){S.current?.abort();let n=new AbortController;S.current=n,b(e),x(``);try{await t(n.signal)}catch(e){n.signal.aborted||x(r(e))}finally{n.signal.aborted||b(null)}}let O=e=>D(`list`,async t=>{let n=await w(e?{cursor:e}:{},t);t.aborted||(f(t=>{let r=[...e?t:[],...n.sessions.map(e=>({...e,requestId:n.id}))];return[...new Map(r.map(e=>[e.id,e])).values()].sort((e,t)=>(t.updatedAt??``).localeCompare(e.updatedAt??``))}),h(n.nextCursor))});(0,F.useEffect)(()=>(f([]),h(null),_(``),O(),()=>S.current?.abort()),[l,e,o]);let k=d.find(e=>e.id===g),A=v===`import`;return(0,I.jsx)(m,{id:`computer-import-session`,title:`导入历史会话`,onClose:s,children:(0,I.jsxs)(`form`,{className:`native-history`,onSubmit:e=>{e.preventDefault(),D(`import`,async e=>{let t=g.trim(),n=C(t);if(n)return c(n);if(k)return E(k,k.requestId,e);let r=await w({session:t},e),i=r.sessions.find(e=>e.id===t);if(!i)throw Error(`找不到此目录中的会话。`);await E(i,r.id,e)})},children:[(0,I.jsx)(ce,{label:`历史会话 Agent`,value:l,onChange:u,providers:[t,...n],disabled:A}),(0,I.jsxs)(`div`,{className:`field`,children:[(0,I.jsx)(`label`,{htmlFor:`native-history-session`,children:`Session`}),(0,I.jsxs)(`div`,{className:`native-history-input-row`,children:[(0,I.jsx)(He,{id:`native-history-session`,label:`历史会话`,value:g,onChange:_,placeholder:`选择会话或输入 ID`,disabled:A,loading:v===`list`,empty:g?`未找到匹配会话,可直接输入 Session ID。`:`此目录暂无历史会话,可输入 Session ID。`,options:d.map(e=>({value:e.id,label:e.title,description:e.id,detail:C(e.id)?`已接入`:e.active?`工作中`:Ve(e.updatedAt),disabled:e.active&&!C(e.id)})),footer:(0,I.jsxs)(I.Fragment,{children:[p&&(0,I.jsx)(`button`,{className:`native-history-more`,type:`button`,disabled:!!v,onClick:()=>void O(p),children:`加载更多`}),(0,I.jsx)(y,{icon:`refresh`,label:`刷新历史会话`,disabled:!!v,onClick:()=>void O()})]})},l),(0,I.jsx)(`button`,{type:`submit`,disabled:A||!be.safeParse(g.trim()).success||!!k?.active&&!C(k.id),children:A?`正在导入…`:C(g.trim())?`打开`:`导入`})]})]}),(0,I.jsx)(`small`,{className:`muted`,children:`请先退出原终端会话。`})]})})}var We={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,webp:`image/webp`,gif:`image/gif`,avif:`image/avif`,bmp:`image/bmp`,ico:`image/x-icon`,svg:`image/svg+xml`};function Ge(e,t){let n=e.toLowerCase().split(`.`).at(-1)??``;return t&&Object.values(We).includes(t)?t:Object.hasOwn(We,n)?We[n]:n===`pdf`?`application/pdf`:/^(md|markdown|mdown)$/.test(n)?`text/markdown`:/^html?$/.test(n)?`text/html`:/^(txt|log|csv|tsv|jsonl?|ndjson|ya?ml|toml|ini|cfg|conf|xml|sql|diff|patch|sh|bash|zsh|fish|py|js|jsx|mjs|cjs|ts|tsx|css|scss|vue|svelte|go|rs|c|cc|cpp|h|hpp|java|kt|swift|rb|lua|r|tex|rst|properties|env|lock)$/.test(n)||/^(readme|license|makefile|dockerfile|cmakelists\.txt|\.gitignore)$/i.test(e)?`text/plain`:``}async function Ke(e,t){let n=e.body.getReader(),r=[],i=0,a=(t??0)>M;try{for(;;){let{done:e,value:t}=await n.read();if(e)break;let o=Math.min(t.length,M-i);if(r.push(t.slice(0,o)),i+=o,o<t.length||a&&i===524288){a=!0;break}}}finally{await n.cancel(),n.releaseLock()}return{blob:new Blob(r),truncated:a}}async function qe(e,t,n,r){let i=e.previewUrl??e.url;if(i.startsWith(`data:`)&&t.startsWith(`image/`))return{format:t,preview:i,download:i};if(!t&&!e.previewUrl)return{format:``};let a=await fetch(i,{credentials:`same-origin`,cache:`no-store`,signal:n});if(!a.ok)throw Error((await a.json().catch(()=>null))?.error?.message??`文件暂不可用。`);if(!t)return await a.body?.cancel(),{format:``};if(t.startsWith(`text/`)){let n=a.headers.get(`X-Teammy-File-Size`)??a.headers.get(`Content-Length`),{blob:i,truncated:o}=await Ke(a,n===null?e.size:Number(n)),s=o?void 0:r(i.slice(0,i.size,`application/octet-stream`)),c;try{c=new TextDecoder(`utf-8`,{fatal:!0}).decode(await i.arrayBuffer(),{stream:o})}catch{return{format:``,download:s}}return c.includes(`\0`)?{format:``,download:s}:{format:t,text:c,truncated:o,download:s}}let o=await a.blob();if(t===`image/svg+xml`)return{format:t,preview:`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(await o.text()),download:r(o.slice(0,o.size,`application/octet-stream`))};if(t===`application/pdf`&&(navigator.pdfViewerEnabled===!1||await o.slice(0,5).text()!==`%PDF-`))return{format:``,download:r(o.slice(0,o.size,`application/octet-stream`))};let s=r(o.slice(0,o.size,t));return{format:t,preview:s,download:s}}function Je({file:e,onClose:t,gallery:n}){let[i,a]=(0,F.useState)(),[o,s]=(0,F.useState)(``),[c,l]=(0,F.useState)(0),[u,d]=(0,F.useState)(!1),f=(0,F.useRef)(null),h=(0,F.useRef)(null),g=Ge(e.name,e.mimeType),{name:_,url:v,previewUrl:b,size:x}=e;(0,F.useEffect)(()=>{let e=new AbortController,t;return a(void 0),s(``),d(!1),qe({name:_,url:v,previewUrl:b,size:x},g,e.signal,n=>(e.signal.throwIfAborted(),t=URL.createObjectURL(n),t)).then(t=>{e.signal.aborted||a(t)}).catch(t=>{e.signal.aborted||s(r(t))}),f.current?.focus(),()=>{e.abort(),t&&URL.revokeObjectURL(t)}},[v,x,b,_,g,c]),(0,F.useEffect)(()=>{h.current?.scrollIntoView({block:`center`})},[i,e.line]);let S=e.line&&i?.text!==void 0?i.text.split(`
3
3
  `):null,C=(e.line??1)-1,w=g.startsWith(`image/`);return(0,I.jsx)(m,{id:`session-image-lightbox`,title:e.name,label:w?`图片预览`:`文件预览`,onClose:t,onKeyDown:e=>{n&&[`ArrowLeft`,`ArrowRight`].includes(e.key)&&(e.preventDefault(),n.move(e.key===`ArrowLeft`?-1:1))},actions:(0,I.jsxs)(I.Fragment,{children:[n&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(y,{icon:`chevron`,className:`session-image-previous`,label:`上一张图片`,onClick:()=>n.move(-1)}),(0,I.jsxs)(`small`,{children:[n.index+1,` / `,n.count]}),(0,I.jsx)(y,{icon:`chevron`,label:`下一张图片`,onClick:()=>n.move(1)})]}),w&&i?.format&&(0,I.jsx)(y,{icon:u?`zoomOut`:`zoomIn`,label:u?`适合窗口`:`原始尺寸`,"aria-pressed":u,onClick:()=>d(!u)}),(0,I.jsx)(`a`,{className:`icon-button`,href:o?void 0:i?.download??e.url,"aria-disabled":!!o,download:e.name,"aria-label":`下载文件`,title:`下载文件`,children:(0,I.jsx)(p,{name:`download`})})]}),children:(0,I.jsx)(`div`,{ref:f,tabIndex:-1,className:`session-image-viewer`,children:o?(0,I.jsx)(D,{announce:!0,retry:()=>l(e=>e+1),children:o}):i?i.format?w?(0,I.jsx)(`div`,{className:`session-image-stage`+(u?` original-size`:``),children:(0,I.jsx)(`img`,{src:i.preview,alt:e.name,onError:()=>a({format:``,download:i.download})})}):i.format===`application/pdf`?(0,I.jsx)(`iframe`,{className:`file-preview-document`,src:i.preview,title:e.name+` 预览`}):i.format===`text/html`&&!e.line?(0,I.jsx)(Ne,{name:e.name,url:e.url}):(0,I.jsxs)(`div`,{className:`file-preview-text`,children:[i.format===`text/markdown`&&!e.line?(0,I.jsx)(`article`,{className:`markdown`,children:(0,I.jsx)(Ee,{children:i.text??``})}):(0,I.jsx)(`pre`,{className:`raw`,children:S&&C<S.length?(0,I.jsxs)(I.Fragment,{children:[C>0&&S.slice(0,C).join(`
4
4
  `)+`
5
5
  `,(0,I.jsx)(`mark`,{ref:h,children:S[C]||` `}),S.length>C+1?`
@@ -10,4 +10,4 @@ import{A as e,At as t,Ct as n,I as r,L as i,M as a,N as o,O as s,S as c,T as l,T
10
10
  `).filter(Boolean).slice(0,2).join(` · `)).join(` · `),children:(0,I.jsx)(`pre`,{children:e.questions.map(e=>e.text).join(`
11
11
 
12
12
  `)})}),M?(0,I.jsxs)(`div`,{className:`native-approval-options`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`primary`,disabled:m,"aria-label":`允许`,title:O===null?void 0:`倒计时结束后自动允许本次操作`,onClick:()=>void w({body:`允许`,decision:!0}),children:[`允许`,O!==null&&(0,I.jsxs)(`span`,{"aria-hidden":`true`,children:[`(`,O,`s)`]})]}),(0,I.jsx)(`button`,{type:`button`,disabled:m,onClick:()=>void w({body:`拒绝`,decision:!1}),children:`拒绝`})]}):re&&(0,I.jsxs)(`small`,{className:`question-result`,children:[(0,I.jsx)(p,{name:ie,size:`small`}),re]})]}):(0,I.jsxs)(I.Fragment,{children:[e.questions.map(t=>(0,I.jsxs)(`div`,{className:`native-question-part`,children:[(0,I.jsx)(`p`,{children:t.text}),M&&(0,I.jsx)(`div`,{className:`question-options ${Object.values(t.descriptions??{}).some(Boolean)?`question-options-described`:``}`,children:t.options.map(e=>(0,I.jsxs)(`button`,{type:`button`,disabled:m,"aria-pressed":t.multiSelect?c[t.id]?.includes(e)??!1:o[t.id]===e,onClick:()=>{if(t.multiSelect){l(n=>({...n,[t.id]:n[t.id]?.includes(e)?n[t.id].filter(t=>t!==e):[...n[t.id]??[],e]}));return}let n={...o,[t.id]:e};s(n),ae||oe(n)},children:[(0,I.jsxs)(`span`,{className:`question-option-label`,children:[t.multiSelect&&(0,I.jsx)(`span`,{"aria-hidden":`true`,className:`question-check`,children:c[t.id]?.includes(e)&&(0,I.jsx)(p,{name:`check`,size:`small`})}),e]}),t.descriptions?.[e]&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`question-option-separator`,"aria-hidden":`true`,children:`|`}),(0,I.jsx)(`span`,{className:`question-option-description`,title:t.descriptions[e],children:t.descriptions[e]})]})]},e))}),t.freeText&&M&&(0,I.jsx)(Y,{initialValue:t.initialValue,placeholder:t.placeholder,disabled:m,onSend:async e=>{let n={...o,[t.id]:e};return s(n),ae?!0:oe(n)}}),M&&ae&&o[t.id]&&!t.options.includes(o[t.id])&&(0,I.jsx)(`small`,{children:o[t.id]}),!M&&!e.approval&&(A?.answers[t.id]||A?.selections?.[t.id]?.length)&&(0,I.jsxs)(`div`,{className:`question-response`,children:[(0,I.jsx)(p,{name:j?`check`:`clock`,size:`small`}),(0,I.jsx)(`span`,{children:[...A.selections?.[t.id]??[],A.answers[t.id]].filter(Boolean).join(`、`)})]})]},t.id)),M&&e.actions?.length&&(0,I.jsx)(`div`,{className:`question-actions`,children:e.actions.map(e=>(0,I.jsx)(`button`,{disabled:m,onClick:()=>void w({body:e.label,actionId:e.id}),children:e.label},e.id))}),M&&ae&&(0,I.jsx)(`div`,{className:`question-actions`,children:(0,I.jsx)(`button`,{disabled:m||e.questions.some(e=>!o[e.id]?.trim()&&!c[e.id]?.length),onClick:()=>void oe(),children:`回答`})})]}),re&&(!e.approval||ne)&&(0,I.jsxs)(`small`,{className:`question-result`,children:[(0,I.jsx)(p,{name:ie,size:`small`}),re]})]})}function ut({session:e,active:t,commands:n,request:a,refresh:o,onError:s}){let[c,l]=(0,F.useState)(!1),[u,d]=(0,F.useState)(),f=(0,F.useRef)(void 0),m=n.find(e=>e.id===u?.id)??u,h=c||m&&[`queued`,`running`].includes(m.state)||n.some(e=>e.kind===`stop`&&[`queued`,`running`].includes(e.state));if(!t&&!h)return null;async function g(){if(!h){f.current??=i(),l(!0),s(``);try{let t=await a(`web/local-agent-sessions/${e}/commands`,P,{method:`POST`,body:{id:f.current,kind:`stop`}});d(t),f.current=void 0,o()}catch(e){s(r(e))}finally{l(!1)}}}return(0,I.jsxs)(`button`,{type:`button`,className:`message-stop`,"aria-label":h?`正在停止`:`停止当前轮`,title:h?`正在停止`:`停止当前轮`,disabled:!!h,onClick:()=>void g(),children:[(0,I.jsx)(`span`,{className:`message-stop-ring`,"aria-hidden":`true`}),(0,I.jsx)(p,{name:`stop`,size:`small`})]})}var X={minimal:`极低`,low:`低`,medium:`中`,high:`高`,xhigh:`极高`,max:`最高`,ultra:`极致`,none:`无`,off:`关闭`};function dt({id:e,label:t,current:n,options:r,disabled:i,onSelect:a}){let o=r.find(e=>e.value===n);return(0,I.jsx)(C,{id:`${e}-menu`,triggerId:e,placement:`top`,className:`composer-menu composer-choice`,label:`选择${t}`,disabled:i,routeKey:n,trigger:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{title:`${t}:${o?.label??n}`,children:o?.shortLabel??o?.label??n}),(0,I.jsx)(p,{name:`chevronDown`,size:`small`})]}),children:e=>(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`composer-menu-heading`,children:t}),r.map(t=>(0,I.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-label":t.label,onClick:()=>{e(),a(t.value)},children:[(0,I.jsxs)(`span`,{className:`composer-option-copy`,children:[(0,I.jsx)(`span`,{children:t.label}),t.description&&(0,I.jsx)(`small`,{children:t.description})]}),t.value===n&&(0,I.jsx)(p,{name:`check`,size:`small`})]},t.value))]})})}function ft({session:e,models:t,busy:n,available:r,online:i,commands:a,controls:o,draft:s,onInsert:c,onConfig:l}){let[u,d]=(0,F.useState)(!1);(0,F.useEffect)(()=>{/^[/$]([^\s]*)$/.exec(s)?d(!0):d(!1)},[s]);let f=e.config.model??e.effectiveConfig?.model,m=t.find(e=>e.id===f||e.resolvedModel===f)??(e.config.model?void 0:t.find(e=>e.isDefault)),h=n||!r,g=e.provider===`claude`,_=e.provider===`cursor`,v=o??Se(e.provider),y=m?.effortLabel??`思考强度`,b=e=>m?.effortLabel?e:X[e]??e,x=e.appliedRevision===e.revision?e.effectiveConfig?.mode:void 0,S=t.find(e=>e.isDefault)?.id??(e.config.model?null:e.effectiveConfig?.model),w=t.find(e=>e.id===S)?.name??S,T=e=>g?e.replace(/^Claude\s+/,``):e,E=[{value:``,label:w?`默认 · ${w}`:t.length?`默认模型`:`模型未获取`,shortLabel:w?T(w):t.length?`默认模型`:`模型`},...t.map(e=>({value:e.id,label:e.name,shortLabel:T(e.name)}))];e.config.model&&!t.some(t=>t.id===e.config.model)&&E.push({value:e.config.model,label:e.config.model,shortLabel:T(e.config.model)});let D=m?.id===e.effectiveConfig?.model?e.effectiveConfig?.effort:m?.defaultEffort,O=[{value:``,label:D?`默认 · ${b(D)}`:`默认${y}`,shortLabel:D?b(D):m?.effortLabel??`强度`},...(m?.efforts??[]).map(e=>({value:e,label:b(e)}))];return e.config.effort&&!O.some(t=>t.value===e.config.effort)&&O.push({value:e.config.effort,label:b(e.config.effort)}),(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(C,{id:`session-commands`,triggerId:`session-command-trigger`,label:`命令与 Skills`,placement:`top`,className:`composer-menu composer-commands`,routeKey:e.id,trigger:(0,I.jsx)(p,{name:`command`,size:`small`}),open:u,onOpenChange:d,focusFirst:!1,disabled:h||!i,children:e=>(0,I.jsxs)(I.Fragment,{children:[[...a].sort((e,t)=>e.name.localeCompare(t.name,`en`)).map(t=>(0,I.jsx)(`button`,{type:`button`,role:`menuitem`,title:[t.description,t.path].filter(Boolean).join(`
13
- `),onClick:()=>{e(),c(t)},children:(0,I.jsxs)(`span`,{className:`composer-command-row`,children:[(0,I.jsxs)(`span`,{className:`composer-command-name`,children:[t.prefix??(t.kind===`skill`?`$`:`/`),t.name]}),(0,I.jsx)(`small`,{children:t.description})]})},`${t.kind}:${t.path??t.name}`)),!a.length&&(0,I.jsx)(`div`,{className:`composer-menu-heading`,children:`尚未获取命令`})]})}),(0,I.jsx)(dt,{id:`session-model`,label:`模型`,current:e.config.model??``,options:E,disabled:h,onSelect:n=>{let r=t.find(e=>e.id===n);l({...e.config,model:n||null,..._?{options:{}}:{},effort:e.config.effort&&r?.efforts.includes(e.config.effort)?e.config.effort:null})}}),(e.provider===`codex`||g||(m?.efforts.length??0)>0||!!e.config.effort)&&(0,I.jsx)(dt,{id:`session-effort`,label:y,current:e.config.effort??``,options:O,disabled:h,onSelect:t=>l({...e.config,effort:t||null})}),m?.options?.map(t=>(0,I.jsx)(dt,{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:h,onSelect:n=>{let r={...e.config.options};n?r[t.id]=n:delete r[t.id],l({...e.config,options:r})}},t.id)),v.map(t=>(0,I.jsx)(dt,{id:t.key===`mode`&&!g?`session-mode`:`session-permission`,label:t.label,current:t.key===`mode`?x??e.config.mode??t.defaultValue:e.config.permission,options:t.choices,disabled:h,onSelect:n=>l(t.key===`mode`?{...e.config,mode:n||void 0}:{...e.config,permission:n})},t.key))]})}var pt=(0,F.lazy)(()=>ve(()=>import(`./TerminalPane-5Gw9ZNxq.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url)),mt={idle:`空闲`,working:`工作中`,waiting:`等待回答`,queued:`等待执行`,uncertain:`需要核对`,human:`人工处理`,offered:`待本地接收`,accepted:`本地已接手`,human_routed:`未送达本地`,pending:`待投递`,sent:`已发送`,succeeded:`已完成`,running:`进行中`,failed:`失败`};function ht(e){return{width:e.clientWidth,height:e.clientHeight,top:e.scrollHeight-e.clientHeight}}function Z({navigate:e,memberId:t}){let{request:n,projectId:r}=re(),i=(0,F.useCallback)(e=>n(`web/local-agent-settings`,ge,{signal:e}),[n]),a=s(i,3e4);return(0,F.useEffect)(()=>{let e=()=>void a.reload();return window.addEventListener(`teammy:local-access`,e),()=>window.removeEventListener(`teammy:local-access`,e)},[a.reload]),!a.data&&a.error?(0,I.jsx)(c,{resource:a}):a.data?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(E,{message:a.error}),(0,I.jsx)(Q,{localAvailable:a.data.accessible,navigate:e,memberId:t},`${r}/${t}`)]}):null}function Q({localAvailable:t,navigate:n,memberId:a}){let o=re(),l=_(),d=e(o.projectId,a,`computer-selection`),f=e(o.projectId,a,`computer-drafts`),h=l?.get(d),[g,b]=(0,F.useState)(()=>new Set),[S,w]=(0,F.useState)(()=>({project:o.projectId,directory:new URLSearchParams(location.search).get(`directory`)??h?.directory??``,session:new URLSearchParams(location.search).get(`session`)??(new URLSearchParams(location.search).has(`terminal`)?``:h?.session??``),terminal:new URLSearchParams(location.search).get(`terminal`)??(new URLSearchParams(location.search).has(`session`)?``:h?.terminal??``)})),E=T(),[O,A]=(0,F.useState)(!1),[M,N]=(0,F.useState)(!1),[ce,de]=(0,F.useState)(()=>l?.get(f)??{}),fe=ce[S.session]??``,ge=e=>de(t=>({...t,[S.session]:typeof e==`function`?e(t[S.session]??``):e}));(0,F.useEffect)(()=>{l?.set(f,ce)},[l,f,ce]);let[ve,be]=(0,F.useState)(``),[xe,Se]=(0,F.useState)(!1),[P,we]=(0,F.useState)(`codex`),[Ee,Ae]=(0,F.useState)(!1),[je,Ne]=(0,F.useState)(``),[Ie,L]=(0,F.useState)(),[Le,Re]=(0,F.useState)(Date.now);(0,F.useEffect)(()=>{let e=setInterval(()=>Re(Date.now()),6e4);return()=>clearInterval(e)},[]);let R=(0,F.useRef)(null),z=(0,F.useRef)(!0),Be=(0,F.useRef)(null),He=(0,F.useCallback)(e=>{let t=ht(e),n=Be.current,r=n&&(t.width!==n.width||t.height!==n.height);return(z.current&&r?Math.min(n.top,t.top):t.top)-e.scrollTop<96},[]),We=(0,F.useCallback)(e=>{e.scrollTop=e.scrollHeight,Be.current=ht(e)},[]),Ke=(0,F.useRef)(null),qe=(0,F.useCallback)(e=>{let t=R.current;if(!t)return!0;if(He(t)||(z.current=!1),!e||z.current)return z.current;let n=t.getBoundingClientRect().top,r=Array.from(t.querySelectorAll(`.computer-messages > :not(.computer-tool-group), .computer-tool-group > .tool-summary, .computer-tool-group .computer-tool`)).find(e=>{let t=e.getBoundingClientRect();return t.height>0&&t.bottom>n});return Ke.current={...r?{node:r}:{},offset:r?.getBoundingClientRect().top??0,top:t.scrollTop,height:t.scrollHeight},!1},[He]),B=(0,F.useRef)(new URLSearchParams(location.search).get(`question`)),V=(0,F.useRef)(Number(new URLSearchParams(location.search).get(`message`))||null),Ye=(0,F.useRef)(null),Ze=(0,F.useRef)(void 0),Qe=(0,F.useRef)(i()),et=(0,F.useCallback)(async e=>t?(await o.request(`web/local-agent-computers`,le,{signal:e})).computers.map(e=>({...e,project:o.projectId})):[],[o,t]),H=s(et,3e3),rt=(H.data??[]).flatMap(e=>e.directories.map(t=>({c:e,d:t,label:ue(H.data??[],e,t)}))).sort((e,t)=>e.label.localeCompare(t.label)),U=H.data?.find(e=>e.project===S.project&&e.directories.some(e=>e.id===S.directory)),W=ze(o.projectId,t),it=W.terminals.find(e=>e.id===S.terminal),at=(0,F.useRef)(it);it&&(at.current=it);let G=it??(at.current?.id===S.terminal?at.current:void 0),ot=U?.directories.find(e=>e.id===S.directory),K=H.data?.find(e=>e.directories.some(e=>e.id===je))??U,q=K?.directories.find(e=>e.id===je)??ot;ee(S.project);let J=(0,F.useCallback)((e,t,n)=>ee(S.project).request(e,t,n),[S.project]),Y=$e(S.session,S.project,J),X=nt(S.project,t?S.session:``,J,qe);function dt(e){let t=He(e);return t&&!z.current&&(Be.current=ht(e)),z.current=t,X.follow(t),t}let Z=X.data;(0,F.useLayoutEffect)(()=>{z.current=!0,Be.current=null,Ye.current=null,Ke.current=null},[S.project,S.session]);let Q=Z?.session;oe(S.project,Q?.id??``);let gt=X.attention,_t=gt?.title??Q?.title,vt=gt?.question?{question:`待回答`,approval:`待授权`,plan:`待确认`}[gt.question]:gt?.completion?`完成`:``;pe(S.session&&_t?`${vt?`[${vt}] `:``}${_t}`:void 0);let yt=Z?.pendingQuestions??Z?.messages.flatMap(({question:e,seq:t})=>e?.delivery===`async`&&k(e)?[{id:e.id,seq:t}]:[])??[];function bt(e){let t=R.current,n=document.getElementById(`computer-question-${e}`);return!t||!n||!t.contains(n)||!n.getClientRects().length?!1:(z.current=!1,Ye.current=e,t.scrollTop+=n.getBoundingClientRect().top-t.getBoundingClientRect().top-16,n.focus({preventScroll:!0}),!0)}function xt(e){let t=R.current,n=t?.querySelector(`[data-message-seq="${e}"], [data-completion-seq="${e}"]`);return!t||!n||!n.getClientRects().length?!1:(z.current=!1,t.scrollTop+=n.getBoundingClientRect().top-t.getBoundingClientRect().top-16,!0)}(0,F.useEffect)(()=>{let e=e=>{let t=e.detail;if(t.project!==S.project||t.session!==S.session)return;let n=new URL(location.href);n.searchParams.delete(`question`),n.searchParams.delete(`message`),B.current=t.question??null,V.current=t.question?null:t.sequence,n.searchParams.set(`directory`,S.directory),n.searchParams.set(`session`,S.session),n.searchParams.set(t.question?`question`:`message`,t.question??String(t.sequence)),history.replaceState(null,``,n),(t.question?bt(t.question):xt(t.sequence))?(B.current=null,V.current=null):X.reveal(t.sequence)};return window.addEventListener(`teammy:notification-open`,e),()=>window.removeEventListener(`teammy:notification-open`,e)},[S.project,S.session,S.directory,X.reveal]),(0,F.useLayoutEffect)(()=>{if(!Q||!R.current)return;let e=R.current;if(B.current){let e=B.current;if(bt(e)){B.current=null,Ke.current=null;return}}if(V.current&&xt(V.current)){V.current=null,Ke.current=null;return}let t=Ke.current;Ke.current=null,t&&!z.current?t.node&&e.contains(t.node)?e.scrollTop+=t.node.getBoundingClientRect().top-t.offset:e.scrollTop=t.top+e.scrollHeight-t.height:z.current&&We(e)},[Q?.id,ot?.id,Z,We]),(0,F.useLayoutEffect)(()=>{let e=R.current;if(!e||!Q)return;let t=new ResizeObserver(()=>{z.current&&He(e)&&We(e)});return t.observe(e),()=>t.disconnect()},[Q?.id,ot?.id,He,We]),(0,F.useEffect)(()=>{U?.online===!1&&X.reload()},[U?.online,X.reload]);let St=(0,F.useRef)(Z?.messages);(0,F.useLayoutEffect)(()=>{St.current=Z?.messages},[Z?.messages]);let Ct=(0,F.useCallback)(({path:e,line:t})=>{let n=Te(e,S.terminal?G?.cwd:Q?.cwd);if(!n)return;let r=n.split(`/`).at(-1),i=/\/\.workspace\/\.teammy-attachments\/([0-9a-f-]{36})\/[^/]+$/i.exec(n);if(!S.terminal&&Q&&i){let e=St.current?.flatMap(e=>e.attachments??[]).find(e=>e.id===i[1]);L({...e,name:e?.name??r,line:t,url:Xe(S.project,Q.id,i[1],!0)});return}let a=S.terminal?G?.directory:Q?.executionDirectory??Q?.directory;if(!a)return;let o=v(`/api/v1/projects/${encodeURIComponent(S.project)}/web/local-agents/${encodeURIComponent(a)}/file?${new URLSearchParams({path:n})}`),s=Ge(r);L({name:r,line:t,url:o,previewUrl:o+(s.startsWith(`text/`)?`&view=text`:s?``:`&view=info`)})},[S.project,S.terminal,Q?.directory,Q?.executionDirectory,Q?.id,Q?.cwd,G?.directory,G?.cwd]),wt=U?.capabilities.includes(`local-sessions-v1`),$=(e,t,n=``,r=``)=>{L(void 0),w({project:e,directory:t,session:n,terminal:r}),l?.set(d,{directory:t,session:n,terminal:r}),Se(!1),Ae(!1),E(``);let i=new URL(location.href);(S.session!==n||r)&&(i.searchParams.delete(`question`),i.searchParams.delete(`message`),B.current=null,V.current=null),i.searchParams.delete(`view`),i.searchParams.delete(`section`),i.searchParams.set(`directory`,t),r?i.searchParams.set(`terminal`,r):i.searchParams.delete(`terminal`),n?i.searchParams.set(`session`,n):i.searchParams.delete(`session`),e===o.projectId&&history.replaceState(null,``,i)};(0,F.useEffect)(()=>{let e=H.data?.find(e=>e.sessions.some(e=>e.id===S.session))??H.data?.find(e=>e.directories.length);if(!S.directory&&e?.directories.length){let t=e.directories[0],n=e.sessions.find(e=>e.id===S.session);$(e.project,n?.directory??t.id,n?.id??t.defaultSession??e.sessions.find(e=>e.directory===t.id)?.id)}},[H.data]),(0,F.useEffect)(()=>{if(Q&&R.current)return ct([...R.current.querySelectorAll(`[data-completion-seq]`)],e=>void X.markRead(Number(e.getAttribute(`data-completion-seq`))))},[Q?.id,Z?.messages,X.markRead]);async function Tt(e){A(!0),E(``);try{await e(),await Promise.all([X.reload(),H.reload()])}catch(e){E(r(e))}finally{A(!1)}}function Et(e,t){return Tt(async()=>{if(await o.request(`web/local-agent-sessions/${e.id}/metadata`,ae,{method:`PUT`,body:{expectedRevision:e.metadataRevision,...t}}),t.hidden&&S.session===e.id){let t=U?.sessions.find(t=>t.directory===e.directory&&t.id!==e.id&&!t.hidden);$(S.project,e.directory,t?.id)}})}function Dt(e){let t=new URLSearchParams({tab:`connect`,directory:e,session:S.session});n(`/projects/${o.projectId}/settings?${t}`)}function Ot(e){let t=rt.find(({d:t})=>t.id===e),n=t?.d.provider??`codex`;return se(n)&&!t?.c.providers.some(e=>e.id===n&&e.available)?`codex`:n}function kt(e=S.directory){let t=H.data?.find(t=>t.directories.some(t=>t.id===e))??U,n=t?.directories.find(t=>t.id===e)??t?.directories[0];!n||!t?N(!0):(Qe.current=i(),Ne(n.id),Se(!0),we(Ot(n.id)),E(``))}let[At,jt]=(0,F.useState)(null);(0,F.useEffect)(()=>jt(null),[Q?.id]);let Mt=U?.catalogs.find(e=>e.provider===(Q?.provider??`codex`)&&(Q?.cwd?e.cwd===Q.cwd:e.directory===(Q?.executionDirectory??Q?.directory))),Nt=Mt?.commands??[],Pt=Mt?.models??U?.providers.find(e=>e.id===Q?.provider)?.models??(Q?.provider===`codex`?U?.models??[]:[]),Ft=Pt.find(e=>e.id===(Q?.config.model??Q?.effectiveConfig?.model)||!!e.resolvedModel&&e.resolvedModel===(Q?.config.model??Q?.effectiveConfig?.model))??(Q?.config.model?void 0:Pt.find(e=>e.isDefault)),It=!!U?.capabilities.includes(`local-agent-attachments-v1`),Lt=!!(Ft?.images??(!Q?.config.model&&U?.providers.find(e=>e.id===Q?.provider)?.defaultImages))&&!!U?.capabilities.includes(`local-agent-images-v1`),Rt=Q?.state===`working`&&!Z?.commands.some(e=>e.kind===`stop`&&[`queued`,`running`].includes(e.state)),zt=(Q?.provider===`cursor`||se(Q?.provider))&&U?.capabilities.includes(`local-agent-steer-v1`),Bt=!U?.capabilities.includes(`local-agent-steer-v1`)&&(Q?.provider===`cursor`||Q?.provider===`claude`);function Vt(e){let t=fe.trim();if(!Q||!t&&!Y.files.length)return;let n=Y.files.map(e=>e.id),r=Lt?Y.files.filter(e=>e.mimeType!==`application/octet-stream`).map(e=>e.id):[],a=At?.path&&t.startsWith(`$${At.name}`)?[{name:At.name,path:At.path}]:void 0,o=JSON.stringify({session:Q.id,body:t,skills:a,attachments:n,images:r,delivery:e});Ze.current?.fingerprint!==o&&(Ze.current={fingerprint:o,id:i()});let s=Ze.current;Tt(async()=>{await J(`web/local-agent-sessions/${Q.id}/messages`,u(),{method:`POST`,body:{id:s.id,body:t,delivery:e,...r.length?{images:r}:{},...n.length?{attachments:n}:{},...a?{skills:a}:{}}}),ge(e=>e.trim()===t?``:e),jt(null),Y.clear(),Ze.current===s&&(Ze.current=void 0)})}let Ht=(0,F.useMemo)(()=>(0,I.jsx)(st,{onFile:Ct,messages:Q?Z.messages:[],rewind:Q?{session:Q.id,available:!!Z?.canRewind&&Q.state===`idle`&&!Q.archived,expectedLastMessage:Z?.messages.at(-1)?.id??``,commands:Z?.commands??[],request:J,refresh:X.reload}:void 0,imageUrl:(e,t)=>Xe(S.project,Q.id,e,t),renderQueue:e=>(0,I.jsx)(tt,{message:e}),renderQuestion:e=>(0,I.jsx)(lt,{question:e,session:Q.id,request:J,refresh:X.reload})}),[Q,Z,J,X.reload,S.project,Ct]);return(0,I.jsxs)(ke,{className:`computers-layout`,testId:`computers-page`,label:`本地会话`,tree:!0,navigation:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(te,{title:`电脑`}),(0,I.jsx)(`div`,{className:`assistant-message-scroll computer-tree`,role:`tree`,"aria-label":`目录与会话`,onKeyDown:Pe,children:rt.map(({c:e,d:t,label:n})=>{let r=`${e.project}/${t.id}`,i=!g.has(r);return(0,I.jsxs)(`div`,{role:`none`,children:[(0,I.jsxs)(`div`,{className:`computer-tree-row`,role:`none`,children:[(0,I.jsxs)(Ce,{className:`tree-item tree-folder`,role:`treeitem`,"aria-level":1,"aria-expanded":i,style:{"--tree-level":1},leading:(0,I.jsx)(`span`,{className:`tree-chevron ${i?`expanded`:``}`,children:(0,I.jsx)(p,{name:`chevron`,size:`small`})}),onClick:()=>{S.directory!==t.id&&$(e.project,t.id,t.defaultSession??e.sessions.find(e=>e.directory===t.id)?.id),b(e=>{let t=new Set(e);return i?t.add(r):t.delete(r),t})},children:[(0,I.jsx)(p,{name:`files`}),(0,I.jsx)(`span`,{className:`tree-name`,title:n,children:n})]}),(0,I.jsx)(y,{icon:`plus`,label:`新建会话:${n}`,className:`computer-tree-action`,onClick:()=>kt(t.id)})]}),i&&(0,I.jsxs)(`div`,{role:`group`,children:[W.terminals.filter(e=>e.directory===t.id).map(n=>(0,I.jsx)(`div`,{className:`computer-tree-row computer-session-row computer-terminal-row`,role:`none`,children:(0,I.jsxs)(Ce,{className:`tree-item`,role:`treeitem`,"aria-level":2,"aria-selected":S.terminal===n.id,style:{"--tree-level":2},leading:(0,I.jsx)(`span`,{className:`tree-chevron`}),onClick:()=>$(e.project,t.id,``,n.id),children:[(0,I.jsx)(p,{name:`command`}),(0,I.jsxs)(`span`,{className:`computer-session-copy`,children:[(0,I.jsx)(`span`,{className:`tree-name`,children:n.title}),(0,I.jsx)(`time`,{dateTime:n.createdAt,children:n.state===`exited`?`已退出`:Ve(n.createdAt,Le)})]})]})},n.id)),e.sessions.filter(e=>e.directory===t.id).map(n=>(0,I.jsxs)(`div`,{className:`computer-tree-row computer-session-row`,role:`none`,children:[(0,I.jsxs)(Ce,{className:`tree-item`,role:`treeitem`,"aria-level":2,"aria-selected":S.session===n.id&&S.project===e.project,style:{"--tree-level":2},leading:(0,I.jsx)(`span`,{className:`tree-chevron`,children:(0,I.jsx)(`span`,{className:`assistant-message-dot ${n.unread?`unread`:``}`})}),title:`${n.title} · ${ne[n.provider]}`,onClick:()=>$(e.project,t.id,n.id),children:[(0,I.jsx)(ye,{provider:n.provider}),(0,I.jsxs)(`span`,{className:`computer-session-copy`,children:[(0,I.jsx)(`span`,{className:`tree-name`,children:n.title}),(0,I.jsx)(`time`,{dateTime:n.updatedAt,title:new Date(n.updatedAt).toLocaleString(),children:Ve(n.updatedAt,Le)})]})]}),(0,I.jsx)(y,{icon:`link`,className:`computer-tree-action computer-session-pin${n.pinned?` pinned`:``}`,label:`${n.pinned?`取消自动接单`:`开启自动接单`}:${n.title}`,"aria-pressed":n.pinned,tooltip:n.pinned?`取消自动接单`:`开启自动接单`,disabled:O||n.archived,onClick:()=>void Et(n,{pinned:!n.pinned})}),n.archived?(0,I.jsx)(`span`,{title:`已归档`,role:`img`,"aria-label":`已归档`,children:(0,I.jsx)(p,{name:`archive`,size:`small`})}):n.state!==`idle`&&(0,I.jsx)(De,{state:n.state,label:mt[n.state]??n.state})]},n.id))]})]},t.id)})}),(0,I.jsx)(c,{resource:H})]}),children:[M&&(0,I.jsx)(_e,{onClose:()=>N(!1)}),Ee&&K&&q&&(0,I.jsx)(Ue,{directory:q.id,provider:P===`terminal`?q.provider:P,providers:K.providers.filter(e=>!se(e.id)||e.available).map(e=>e.id),sessions:K.sessions,request:J,onClose:()=>Ae(!1),onImport:e=>{$(S.project,e.directory,e.id),H.reload()}}),xe&&q&&(0,I.jsx)(m,{id:`computer-new-session`,title:`新建会话`,onClose:()=>Se(!1),children:(0,I.jsxs)(`form`,{className:`computer-panel stack`,onSubmit:e=>{e.preventDefault(),Tt(async()=>{if(P===`terminal`){let e=Qe.current;await W.request({type:`create`,id:e,directory:q.id,title:ve.trim(),cols:100,rows:28}),Qe.current=i(),be(``),$(S.project,q.id,``,e);return}let e=await J(`web/local-agents/${q.id}/sessions`,ae,{method:`POST`,body:{id:Qe.current,title:ve,provider:P}});Qe.current=i(),Se(!1),be(``),$(S.project,q.id,e.id)})},children:[rt.length>1?(0,I.jsx)(ie,{title:`执行目录`,children:(0,I.jsx)(`select`,{"aria-label":`执行目录`,disabled:O,value:q.id,onChange:e=>{Ne(e.target.value),we(Ot(e.target.value))},children:rt.map(({d:e,label:t})=>(0,I.jsx)(`option`,{value:e.id,children:t},e.id))})}):(0,I.jsxs)(`p`,{className:`muted computer-create-scope`,children:[`目录:`,q.name]}),(0,I.jsxs)(`label`,{children:[`会话名称`,(0,I.jsx)(`input`,{autoFocus:!0,required:!0,disabled:O,placeholder:`会话名称`,value:ve,onChange:e=>be(e.target.value)})]}),(0,I.jsx)(me,{label:`会话类型`,value:P,onChange:we,disabled:O,providers:he.options.filter(e=>e===`codex`||(e===`claude`?K?.capabilities.includes(`local-agent-providers-v1`):K?.providers.some(t=>t.id===e&&(!se(e)||t.available)))),terminal:W.directories.includes(q.id)}),P===`terminal`&&(0,I.jsx)(`p`,{className:`muted computer-create-scope`,children:`在此目录启动本机 Shell,使用本机用户权限。`}),(0,I.jsx)(D,{children:K?.providers.find(e=>e.id===P)?.error}),(0,I.jsxs)(`div`,{className:`computer-create-options`,children:[P!==`terminal`&&(0,I.jsx)(`button`,{type:`button`,disabled:!K?.online||!K.capabilities.includes(`local-agent-history-v1`),onClick:()=>{Se(!1),Ae(!0)},children:`导入历史会话`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>{Se(!1),N(!0)},children:`接入目录`}),(0,I.jsx)(`button`,{className:`primary`,disabled:O||!ve.trim()||(P===`terminal`?!W.directories.includes(q.id):!wt),children:`创建`})]})]})}),Ie&&(0,I.jsx)(Je,{file:Ie,onClose:()=>L(void 0)},Ie.url),S.terminal?G?(0,I.jsx)(F.Suspense,{fallback:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(j,{title:G.title}),(0,I.jsx)(`div`,{className:`assistant-empty`,children:`正在打开终端…`})]}),children:(0,I.jsx)(pt,{terminal:G,onFile:Ct,connection:W,onClosed:()=>$(S.project,S.directory)},G.id)}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(j,{title:`终端`}),(0,I.jsx)(`div`,{className:`assistant-empty`,children:W.connected?`终端已结束或电脑已重启,请新建终端。`:`正在连接终端…`})]}):ot?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(j,{title:Q?(0,I.jsx)(Fe,{title:Q.title,busy:O,onSave:e=>Et(Q,{title:e})},Q.id):(0,I.jsx)(`h2`,{children:ot.name}),actions:(0,I.jsx)(I.Fragment,{children:(0,I.jsx)(C,{id:`computer-session-menu`,triggerId:`computer-session-actions`,label:`会话操作`,trigger:(0,I.jsx)(p,{name:`more`}),className:`computer-create-menu`,routeKey:Q?.id??``,disabled:!Q,children:e=>(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{role:`menuitem`,disabled:O,onClick:()=>{e(),Q&&Et(Q,{hidden:!0})},children:`隐藏会话`}),(0,I.jsx)(`button`,{role:`menuitem`,onClick:()=>{e(),Dt(ot.id)},children:`连接专用群`}),(0,I.jsx)(`button`,{role:`menuitem`,onClick:()=>{e(),Dt(ot.id)},children:`执行位置`})]})})})}),!wt&&(0,I.jsx)(x,{children:`升级客户端后可使用多个会话和网页对话。`}),(0,I.jsxs)(Oe,{ref:R,onClickCapture:({target:e,currentTarget:t})=>{e instanceof Element&&e.closest(`.tool-summary`)&&(z.current=!1,requestAnimationFrame(()=>{t===R.current&&t.contains(e)&&dt(t)}))},onWheel:e=>{e.deltaY<0&&e.currentTarget.scrollTop<=0&&Z?.olderBefore&&(z.current=!1,X.older())},onScroll:e=>{let t=e.currentTarget;!dt(t)&&t.scrollTop<100&&Z?.olderBefore&&X.older()},"aria-label":`本地会话记录`,children:[Z?.olderBefore&&(0,I.jsx)(`button`,{type:`button`,className:`computer-older`,disabled:X.loadingOlder,onClick:()=>{z.current=!1,X.older()},children:X.loadingOlder?`正在加载…`:`加载更早消息`}),(0,I.jsx)(c,{resource:X}),Ht,(0,I.jsx)(D,{children:Q?.error}),Z&&!Z.messages.length&&!Z.olderBefore&&(0,I.jsx)(`div`,{className:`assistant-empty`,children:Q?.resumeSession?`已接入原生会话,发送消息继续。`:`在当前目录开始一段对话。`})]}),Z?.commands.filter(e=>e.state!==`succeeded`&&![`diff`,`history`,`rewind`].includes(e.kind)&&!(e.kind===`stop`&&[`queued`,`running`].includes(e.state))).slice(-3).map(e=>(0,I.jsxs)(`p`,{className:`computer-control-status`,role:`status`,children:[e.kind===`stop`?`停止`:e.kind,` · `,mt[e.state]??e.state,e.error?`:${e.error}`:``]},e.id)),yt.length>0&&(0,I.jsx)(`div`,{className:`computer-question-shortcut`,children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>{let e=(yt.findIndex(e=>e.id===Ye.current)+1)%yt.length,t=yt[e];bt(t.id)||(z.current=!1,B.current=t.id,X.reveal(t.seq))},children:[(0,I.jsx)(p,{name:`question`,size:`small`}),`有 `,yt.length,` 个问题等待你的确认`]})}),Q&&(0,I.jsx)(Me,{value:fe,onChange:ge,label:`向本地 Agent 发送消息`,sendLabel:Rt?zt?`中断并发送`:Bt?`加入队列`:`插话`:`发送`,onQueue:[`working`,`waiting`].includes(Q.state)&&U?.capabilities.includes(`local-agent-queue-v1`)?()=>Vt(`queue`):void 0,placeholder:Q.archived?`会话已归档`:`输入消息…`,disabled:Q.archived||!wt,sendDisabled:O||Y.busy||Y.failed||Y.count>0&&!It||Z?.commands.some(e=>e.kind===`rewind`&&[`queued`,`running`,`uncertain`].includes(e.state)),attachments:(0,I.jsxs)(I.Fragment,{children:[Y.preview(O),Y.files.some(e=>e.mimeType!==`application/octet-stream`)&&!Lt&&(0,I.jsx)(x,{children:`当前模型将通过本地文件路径接收图片。`})]}),hasAttachments:Y.count>0,onFiles:It&&!O?e=>void Y.add(e):void 0,beforeSend:(0,I.jsx)(ut,{session:Q.id,active:[`working`,`waiting`].includes(Q.state),commands:Z?.commands??[],request:J,refresh:X.reload,onError:E},Q.id),actions:(0,I.jsxs)(I.Fragment,{children:[It?Y.picker(O||!wt,Lt):Lt?(0,I.jsx)(`span`,{title:`更新开发机客户端后可添加附件`,children:(0,I.jsx)(`button`,{type:`button`,className:`icon-button`,disabled:!0,"aria-label":`更新开发机客户端后可添加附件`,children:(0,I.jsx)(p,{name:`attachment`,size:`small`})})}):null,(0,I.jsx)(ft,{session:Q,models:Pt,busy:O,available:!!wt,online:!!U?.online,commands:Nt,controls:Mt?.controls,draft:fe,onInsert:e=>{jt(e.kind===`skill`?e:null),ge(`${e.prefix??(e.kind===`skill`?`$`:`/`)}${e.name} `),requestAnimationFrame(()=>document.querySelector(`.message-composer textarea`)?.focus())},onConfig:e=>{Tt(()=>J(`web/local-agent-sessions/${Q.id}/settings`,ae,{method:`PUT`,body:{expectedRevision:Q.revision,config:e}}))}})]}),onSubmit:()=>Vt(`auto`)})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(j,{title:`本地会话`}),(0,I.jsxs)(`div`,{className:`assistant-empty`,children:[`尚未登记本地执行目录。`,(0,I.jsx)(`button`,{onClick:()=>N(!0),children:`接入目录`})]})]})]})}export{Z as Computers,Fe as t};
13
+ `),onClick:()=>{e(),c(t)},children:(0,I.jsxs)(`span`,{className:`composer-command-row`,children:[(0,I.jsxs)(`span`,{className:`composer-command-name`,children:[t.prefix??(t.kind===`skill`?`$`:`/`),t.name]}),(0,I.jsx)(`small`,{children:t.description})]})},`${t.kind}:${t.path??t.name}`)),!a.length&&(0,I.jsx)(`div`,{className:`composer-menu-heading`,children:`尚未获取命令`})]})}),(0,I.jsx)(dt,{id:`session-model`,label:`模型`,current:e.config.model??``,options:E,disabled:h,onSelect:n=>{let r=t.find(e=>e.id===n);l({...e.config,model:n||null,..._?{options:{}}:{},effort:e.config.effort&&r?.efforts.includes(e.config.effort)?e.config.effort:null})}}),(e.provider===`codex`||g||(m?.efforts.length??0)>0||!!e.config.effort)&&(0,I.jsx)(dt,{id:`session-effort`,label:y,current:e.config.effort??``,options:O,disabled:h,onSelect:t=>l({...e.config,effort:t||null})}),m?.options?.map(t=>(0,I.jsx)(dt,{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:h,onSelect:n=>{let r={...e.config.options};n?r[t.id]=n:delete r[t.id],l({...e.config,options:r})}},t.id)),v.map(t=>(0,I.jsx)(dt,{id:t.key===`mode`&&!g?`session-mode`:`session-permission`,label:t.label,current:t.key===`mode`?x??e.config.mode??t.defaultValue:e.config.permission,options:t.choices,disabled:h,onSelect:n=>l(t.key===`mode`?{...e.config,mode:n||void 0}:{...e.config,permission:n})},t.key))]})}var pt=(0,F.lazy)(()=>ve(()=>import(`./TerminalPane-BTRM-36z.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url)),mt={idle:`空闲`,working:`工作中`,waiting:`等待回答`,queued:`等待执行`,uncertain:`需要核对`,human:`人工处理`,offered:`待本地接收`,accepted:`本地已接手`,human_routed:`未送达本地`,pending:`待投递`,sent:`已发送`,succeeded:`已完成`,running:`进行中`,failed:`失败`};function ht(e){return{width:e.clientWidth,height:e.clientHeight,top:e.scrollHeight-e.clientHeight}}function Z({navigate:e,memberId:t}){let{request:n,projectId:r}=re(),i=(0,F.useCallback)(e=>n(`web/local-agent-settings`,ge,{signal:e}),[n]),a=s(i,3e4);return(0,F.useEffect)(()=>{let e=()=>void a.reload();return window.addEventListener(`teammy:local-access`,e),()=>window.removeEventListener(`teammy:local-access`,e)},[a.reload]),!a.data&&a.error?(0,I.jsx)(c,{resource:a}):a.data?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(E,{message:a.error}),(0,I.jsx)(Q,{localAvailable:a.data.accessible,navigate:e,memberId:t},`${r}/${t}`)]}):null}function Q({localAvailable:t,navigate:n,memberId:a}){let o=re(),l=_(),d=e(o.projectId,a,`computer-selection`),f=e(o.projectId,a,`computer-drafts`),h=l?.get(d),[g,b]=(0,F.useState)(()=>new Set),[S,w]=(0,F.useState)(()=>({project:o.projectId,directory:new URLSearchParams(location.search).get(`directory`)??h?.directory??``,session:new URLSearchParams(location.search).get(`session`)??(new URLSearchParams(location.search).has(`terminal`)?``:h?.session??``),terminal:new URLSearchParams(location.search).get(`terminal`)??(new URLSearchParams(location.search).has(`session`)?``:h?.terminal??``)})),E=T(),[O,A]=(0,F.useState)(!1),[M,N]=(0,F.useState)(!1),[ce,de]=(0,F.useState)(()=>l?.get(f)??{}),fe=ce[S.session]??``,ge=e=>de(t=>({...t,[S.session]:typeof e==`function`?e(t[S.session]??``):e}));(0,F.useEffect)(()=>{l?.set(f,ce)},[l,f,ce]);let[ve,be]=(0,F.useState)(``),[xe,Se]=(0,F.useState)(!1),[P,we]=(0,F.useState)(`codex`),[Ee,Ae]=(0,F.useState)(!1),[je,Ne]=(0,F.useState)(``),[Ie,L]=(0,F.useState)(),[Le,Re]=(0,F.useState)(Date.now);(0,F.useEffect)(()=>{let e=setInterval(()=>Re(Date.now()),6e4);return()=>clearInterval(e)},[]);let R=(0,F.useRef)(null),z=(0,F.useRef)(!0),Be=(0,F.useRef)(null),He=(0,F.useCallback)(e=>{let t=ht(e),n=Be.current,r=n&&(t.width!==n.width||t.height!==n.height);return(z.current&&r?Math.min(n.top,t.top):t.top)-e.scrollTop<96},[]),We=(0,F.useCallback)(e=>{e.scrollTop=e.scrollHeight,Be.current=ht(e)},[]),Ke=(0,F.useRef)(null),qe=(0,F.useCallback)(e=>{let t=R.current;if(!t)return!0;if(He(t)||(z.current=!1),!e||z.current)return z.current;let n=t.getBoundingClientRect().top,r=Array.from(t.querySelectorAll(`.computer-messages > :not(.computer-tool-group), .computer-tool-group > .tool-summary, .computer-tool-group .computer-tool`)).find(e=>{let t=e.getBoundingClientRect();return t.height>0&&t.bottom>n});return Ke.current={...r?{node:r}:{},offset:r?.getBoundingClientRect().top??0,top:t.scrollTop,height:t.scrollHeight},!1},[He]),B=(0,F.useRef)(new URLSearchParams(location.search).get(`question`)),V=(0,F.useRef)(Number(new URLSearchParams(location.search).get(`message`))||null),Ye=(0,F.useRef)(null),Ze=(0,F.useRef)(void 0),Qe=(0,F.useRef)(i()),et=(0,F.useCallback)(async e=>t?(await o.request(`web/local-agent-computers`,le,{signal:e})).computers.map(e=>({...e,project:o.projectId})):[],[o,t]),H=s(et,3e3),rt=(H.data??[]).flatMap(e=>e.directories.map(t=>({c:e,d:t,label:ue(H.data??[],e,t)}))).sort((e,t)=>e.label.localeCompare(t.label)),U=H.data?.find(e=>e.project===S.project&&e.directories.some(e=>e.id===S.directory)),W=ze(o.projectId,t),it=W.terminals.find(e=>e.id===S.terminal),at=(0,F.useRef)(it);it&&(at.current=it);let G=it??(at.current?.id===S.terminal?at.current:void 0),ot=U?.directories.find(e=>e.id===S.directory),K=H.data?.find(e=>e.directories.some(e=>e.id===je))??U,q=K?.directories.find(e=>e.id===je)??ot;ee(S.project);let J=(0,F.useCallback)((e,t,n)=>ee(S.project).request(e,t,n),[S.project]),Y=$e(S.session,S.project,J),X=nt(S.project,t?S.session:``,J,qe);function dt(e){let t=He(e);return t&&!z.current&&(Be.current=ht(e)),z.current=t,X.follow(t),t}let Z=X.data;(0,F.useLayoutEffect)(()=>{z.current=!0,Be.current=null,Ye.current=null,Ke.current=null},[S.project,S.session]);let Q=Z?.session;oe(S.project,Q?.id??``);let gt=X.attention,_t=gt?.title??Q?.title,vt=gt?.question?{question:`待回答`,approval:`待授权`,plan:`待确认`}[gt.question]:gt?.completion?`完成`:``;pe(S.session&&_t?`${vt?`[${vt}] `:``}${_t}`:void 0);let yt=Z?.pendingQuestions??Z?.messages.flatMap(({question:e,seq:t})=>e?.delivery===`async`&&k(e)?[{id:e.id,seq:t}]:[])??[];function bt(e){let t=R.current,n=document.getElementById(`computer-question-${e}`);return!t||!n||!t.contains(n)||!n.getClientRects().length?!1:(z.current=!1,Ye.current=e,t.scrollTop+=n.getBoundingClientRect().top-t.getBoundingClientRect().top-16,n.focus({preventScroll:!0}),!0)}function xt(e){let t=R.current,n=t?.querySelector(`[data-message-seq="${e}"], [data-completion-seq="${e}"]`);return!t||!n||!n.getClientRects().length?!1:(z.current=!1,t.scrollTop+=n.getBoundingClientRect().top-t.getBoundingClientRect().top-16,!0)}(0,F.useEffect)(()=>{let e=e=>{let t=e.detail;if(t.project!==S.project||t.session!==S.session)return;let n=new URL(location.href);n.searchParams.delete(`question`),n.searchParams.delete(`message`),B.current=t.question??null,V.current=t.question?null:t.sequence,n.searchParams.set(`directory`,S.directory),n.searchParams.set(`session`,S.session),n.searchParams.set(t.question?`question`:`message`,t.question??String(t.sequence)),history.replaceState(null,``,n),(t.question?bt(t.question):xt(t.sequence))?(B.current=null,V.current=null):X.reveal(t.sequence)};return window.addEventListener(`teammy:notification-open`,e),()=>window.removeEventListener(`teammy:notification-open`,e)},[S.project,S.session,S.directory,X.reveal]),(0,F.useLayoutEffect)(()=>{if(!Q||!R.current)return;let e=R.current;if(B.current){let e=B.current;if(bt(e)){B.current=null,Ke.current=null;return}}if(V.current&&xt(V.current)){V.current=null,Ke.current=null;return}let t=Ke.current;Ke.current=null,t&&!z.current?t.node&&e.contains(t.node)?e.scrollTop+=t.node.getBoundingClientRect().top-t.offset:e.scrollTop=t.top+e.scrollHeight-t.height:z.current&&We(e)},[Q?.id,ot?.id,Z,We]),(0,F.useLayoutEffect)(()=>{let e=R.current;if(!e||!Q)return;let t=new ResizeObserver(()=>{z.current&&He(e)&&We(e)});return t.observe(e),()=>t.disconnect()},[Q?.id,ot?.id,He,We]),(0,F.useEffect)(()=>{U?.online===!1&&X.reload()},[U?.online,X.reload]);let St=(0,F.useRef)(Z?.messages);(0,F.useLayoutEffect)(()=>{St.current=Z?.messages},[Z?.messages]);let Ct=(0,F.useCallback)(({path:e,line:t})=>{let n=Te(e,S.terminal?G?.cwd:Q?.cwd);if(!n)return;let r=n.split(`/`).at(-1),i=/\/\.workspace\/\.teammy-attachments\/([0-9a-f-]{36})\/[^/]+$/i.exec(n);if(!S.terminal&&Q&&i){let e=St.current?.flatMap(e=>e.attachments??[]).find(e=>e.id===i[1]);L({...e,name:e?.name??r,line:t,url:Xe(S.project,Q.id,i[1],!0)});return}let a=S.terminal?G?.directory:Q?.executionDirectory??Q?.directory;if(!a)return;let o=v(`/api/v1/projects/${encodeURIComponent(S.project)}/web/local-agents/${encodeURIComponent(a)}/file?${new URLSearchParams({path:n})}`),s=Ge(r);L({name:r,line:t,url:o,previewUrl:o+(s.startsWith(`text/`)?`&view=text`:s?``:`&view=info`)})},[S.project,S.terminal,Q?.directory,Q?.executionDirectory,Q?.id,Q?.cwd,G?.directory,G?.cwd]),wt=U?.capabilities.includes(`local-sessions-v1`),$=(e,t,n=``,r=``)=>{L(void 0),w({project:e,directory:t,session:n,terminal:r}),l?.set(d,{directory:t,session:n,terminal:r}),Se(!1),Ae(!1),E(``);let i=new URL(location.href);(S.session!==n||r)&&(i.searchParams.delete(`question`),i.searchParams.delete(`message`),B.current=null,V.current=null),i.searchParams.delete(`view`),i.searchParams.delete(`section`),i.searchParams.set(`directory`,t),r?i.searchParams.set(`terminal`,r):i.searchParams.delete(`terminal`),n?i.searchParams.set(`session`,n):i.searchParams.delete(`session`),e===o.projectId&&history.replaceState(null,``,i)};(0,F.useEffect)(()=>{let e=H.data?.find(e=>e.sessions.some(e=>e.id===S.session))??H.data?.find(e=>e.directories.length);if(!S.directory&&e?.directories.length){let t=e.directories[0],n=e.sessions.find(e=>e.id===S.session);$(e.project,n?.directory??t.id,n?.id??t.defaultSession??e.sessions.find(e=>e.directory===t.id)?.id)}},[H.data]),(0,F.useEffect)(()=>{if(Q&&R.current)return ct([...R.current.querySelectorAll(`[data-completion-seq]`)],e=>void X.markRead(Number(e.getAttribute(`data-completion-seq`))))},[Q?.id,Z?.messages,X.markRead]);async function Tt(e){A(!0),E(``);try{await e(),await Promise.all([X.reload(),H.reload()])}catch(e){E(r(e))}finally{A(!1)}}function Et(e,t){return Tt(async()=>{if(await o.request(`web/local-agent-sessions/${e.id}/metadata`,ae,{method:`PUT`,body:{expectedRevision:e.metadataRevision,...t}}),t.hidden&&S.session===e.id){let t=U?.sessions.find(t=>t.directory===e.directory&&t.id!==e.id&&!t.hidden);$(S.project,e.directory,t?.id)}})}function Dt(e){let t=new URLSearchParams({tab:`connect`,directory:e,session:S.session});n(`/projects/${o.projectId}/settings?${t}`)}function Ot(e){let t=rt.find(({d:t})=>t.id===e),n=t?.d.provider??`codex`;return se(n)&&!t?.c.providers.some(e=>e.id===n&&e.available)?`codex`:n}function kt(e=S.directory){let t=H.data?.find(t=>t.directories.some(t=>t.id===e))??U,n=t?.directories.find(t=>t.id===e)??t?.directories[0];!n||!t?N(!0):(Qe.current=i(),Ne(n.id),Se(!0),we(Ot(n.id)),E(``))}let[At,jt]=(0,F.useState)(null);(0,F.useEffect)(()=>jt(null),[Q?.id]);let Mt=U?.catalogs.find(e=>e.provider===(Q?.provider??`codex`)&&(Q?.cwd?e.cwd===Q.cwd:e.directory===(Q?.executionDirectory??Q?.directory))),Nt=Mt?.commands??[],Pt=Mt?.models??U?.providers.find(e=>e.id===Q?.provider)?.models??(Q?.provider===`codex`?U?.models??[]:[]),Ft=Pt.find(e=>e.id===(Q?.config.model??Q?.effectiveConfig?.model)||!!e.resolvedModel&&e.resolvedModel===(Q?.config.model??Q?.effectiveConfig?.model))??(Q?.config.model?void 0:Pt.find(e=>e.isDefault)),It=!!U?.capabilities.includes(`local-agent-attachments-v1`),Lt=!!(Ft?.images??(!Q?.config.model&&U?.providers.find(e=>e.id===Q?.provider)?.defaultImages))&&!!U?.capabilities.includes(`local-agent-images-v1`),Rt=Q?.state===`working`&&!Z?.commands.some(e=>e.kind===`stop`&&[`queued`,`running`].includes(e.state)),zt=(Q?.provider===`cursor`||se(Q?.provider))&&U?.capabilities.includes(`local-agent-steer-v1`),Bt=!U?.capabilities.includes(`local-agent-steer-v1`)&&(Q?.provider===`cursor`||Q?.provider===`claude`);function Vt(e){let t=fe.trim();if(!Q||!t&&!Y.files.length)return;let n=Y.files.map(e=>e.id),r=Lt?Y.files.filter(e=>e.mimeType!==`application/octet-stream`).map(e=>e.id):[],a=At?.path&&t.startsWith(`$${At.name}`)?[{name:At.name,path:At.path}]:void 0,o=JSON.stringify({session:Q.id,body:t,skills:a,attachments:n,images:r,delivery:e});Ze.current?.fingerprint!==o&&(Ze.current={fingerprint:o,id:i()});let s=Ze.current;Tt(async()=>{await J(`web/local-agent-sessions/${Q.id}/messages`,u(),{method:`POST`,body:{id:s.id,body:t,delivery:e,...r.length?{images:r}:{},...n.length?{attachments:n}:{},...a?{skills:a}:{}}}),ge(e=>e.trim()===t?``:e),jt(null),Y.clear(),Ze.current===s&&(Ze.current=void 0)})}let Ht=(0,F.useMemo)(()=>(0,I.jsx)(st,{onFile:Ct,messages:Q?Z.messages:[],rewind:Q?{session:Q.id,available:!!Z?.canRewind&&Q.state===`idle`&&!Q.archived,expectedLastMessage:Z?.messages.at(-1)?.id??``,commands:Z?.commands??[],request:J,refresh:X.reload}:void 0,imageUrl:(e,t)=>Xe(S.project,Q.id,e,t),renderQueue:e=>(0,I.jsx)(tt,{message:e}),renderQuestion:e=>(0,I.jsx)(lt,{question:e,session:Q.id,request:J,refresh:X.reload})}),[Q,Z,J,X.reload,S.project,Ct]);return(0,I.jsxs)(ke,{className:`computers-layout`,testId:`computers-page`,label:`本地会话`,tree:!0,navigation:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(te,{title:`电脑`}),(0,I.jsx)(`div`,{className:`assistant-message-scroll computer-tree`,role:`tree`,"aria-label":`目录与会话`,onKeyDown:Pe,children:rt.map(({c:e,d:t,label:n})=>{let r=`${e.project}/${t.id}`,i=!g.has(r);return(0,I.jsxs)(`div`,{role:`none`,children:[(0,I.jsxs)(`div`,{className:`computer-tree-row`,role:`none`,children:[(0,I.jsxs)(Ce,{className:`tree-item tree-folder`,role:`treeitem`,"aria-level":1,"aria-expanded":i,style:{"--tree-level":1},leading:(0,I.jsx)(`span`,{className:`tree-chevron ${i?`expanded`:``}`,children:(0,I.jsx)(p,{name:`chevron`,size:`small`})}),onClick:()=>{S.directory!==t.id&&$(e.project,t.id,t.defaultSession??e.sessions.find(e=>e.directory===t.id)?.id),b(e=>{let t=new Set(e);return i?t.add(r):t.delete(r),t})},children:[(0,I.jsx)(p,{name:`files`}),(0,I.jsx)(`span`,{className:`tree-name`,title:n,children:n})]}),(0,I.jsx)(y,{icon:`plus`,label:`新建会话:${n}`,className:`computer-tree-action`,onClick:()=>kt(t.id)})]}),i&&(0,I.jsxs)(`div`,{role:`group`,children:[W.terminals.filter(e=>e.directory===t.id).map(n=>(0,I.jsx)(`div`,{className:`computer-tree-row computer-session-row computer-terminal-row`,role:`none`,children:(0,I.jsxs)(Ce,{className:`tree-item`,role:`treeitem`,"aria-level":2,"aria-selected":S.terminal===n.id,style:{"--tree-level":2},leading:(0,I.jsx)(`span`,{className:`tree-chevron`}),onClick:()=>$(e.project,t.id,``,n.id),children:[(0,I.jsx)(p,{name:`command`}),(0,I.jsxs)(`span`,{className:`computer-session-copy`,children:[(0,I.jsx)(`span`,{className:`tree-name`,children:n.title}),(0,I.jsx)(`time`,{dateTime:n.createdAt,children:n.state===`exited`?`已退出`:Ve(n.createdAt,Le)})]})]})},n.id)),e.sessions.filter(e=>e.directory===t.id).map(n=>(0,I.jsxs)(`div`,{className:`computer-tree-row computer-session-row`,role:`none`,children:[(0,I.jsxs)(Ce,{className:`tree-item`,role:`treeitem`,"aria-level":2,"aria-selected":S.session===n.id&&S.project===e.project,style:{"--tree-level":2},leading:(0,I.jsx)(`span`,{className:`tree-chevron`,children:(0,I.jsx)(`span`,{className:`assistant-message-dot ${n.unread?`unread`:``}`})}),title:`${n.title} · ${ne[n.provider]}`,onClick:()=>$(e.project,t.id,n.id),children:[(0,I.jsx)(ye,{provider:n.provider}),(0,I.jsxs)(`span`,{className:`computer-session-copy`,children:[(0,I.jsx)(`span`,{className:`tree-name`,children:n.title}),(0,I.jsx)(`time`,{dateTime:n.updatedAt,title:new Date(n.updatedAt).toLocaleString(),children:Ve(n.updatedAt,Le)})]})]}),(0,I.jsx)(y,{icon:`link`,className:`computer-tree-action computer-session-pin${n.pinned?` pinned`:``}`,label:`${n.pinned?`取消自动接单`:`开启自动接单`}:${n.title}`,"aria-pressed":n.pinned,tooltip:n.pinned?`取消自动接单`:`开启自动接单`,disabled:O||n.archived,onClick:()=>void Et(n,{pinned:!n.pinned})}),n.archived?(0,I.jsx)(`span`,{title:`已归档`,role:`img`,"aria-label":`已归档`,children:(0,I.jsx)(p,{name:`archive`,size:`small`})}):n.state!==`idle`&&(0,I.jsx)(De,{state:n.state,label:mt[n.state]??n.state})]},n.id))]})]},t.id)})}),(0,I.jsx)(c,{resource:H})]}),children:[M&&(0,I.jsx)(_e,{onClose:()=>N(!1)}),Ee&&K&&q&&(0,I.jsx)(Ue,{directory:q.id,provider:P===`terminal`?q.provider:P,providers:K.providers.filter(e=>!se(e.id)||e.available).map(e=>e.id),sessions:K.sessions,request:J,onClose:()=>Ae(!1),onImport:e=>{$(S.project,e.directory,e.id),H.reload()}}),xe&&q&&(0,I.jsx)(m,{id:`computer-new-session`,title:`新建会话`,onClose:()=>Se(!1),children:(0,I.jsxs)(`form`,{className:`computer-panel stack`,onSubmit:e=>{e.preventDefault(),Tt(async()=>{if(P===`terminal`){let e=Qe.current;await W.request({type:`create`,id:e,directory:q.id,title:ve.trim(),cols:100,rows:28}),Qe.current=i(),be(``),$(S.project,q.id,``,e);return}let e=await J(`web/local-agents/${q.id}/sessions`,ae,{method:`POST`,body:{id:Qe.current,title:ve,provider:P}});Qe.current=i(),Se(!1),be(``),$(S.project,q.id,e.id)})},children:[rt.length>1?(0,I.jsx)(ie,{title:`执行目录`,children:(0,I.jsx)(`select`,{"aria-label":`执行目录`,disabled:O,value:q.id,onChange:e=>{Ne(e.target.value),we(Ot(e.target.value))},children:rt.map(({d:e,label:t})=>(0,I.jsx)(`option`,{value:e.id,children:t},e.id))})}):(0,I.jsxs)(`p`,{className:`muted computer-create-scope`,children:[`目录:`,q.name]}),(0,I.jsxs)(`label`,{children:[`会话名称`,(0,I.jsx)(`input`,{autoFocus:!0,required:!0,disabled:O,placeholder:`会话名称`,value:ve,onChange:e=>be(e.target.value)})]}),(0,I.jsx)(me,{label:`会话类型`,value:P,onChange:we,disabled:O,providers:he.options.filter(e=>e===`codex`||(e===`claude`?K?.capabilities.includes(`local-agent-providers-v1`):K?.providers.some(t=>t.id===e&&(!se(e)||t.available)))),terminal:W.directories.includes(q.id)}),P===`terminal`&&(0,I.jsx)(`p`,{className:`muted computer-create-scope`,children:`在此目录启动本机 Shell,使用本机用户权限。`}),(0,I.jsx)(D,{children:K?.providers.find(e=>e.id===P)?.error}),(0,I.jsxs)(`div`,{className:`computer-create-options`,children:[P!==`terminal`&&(0,I.jsx)(`button`,{type:`button`,disabled:!K?.online||!K.capabilities.includes(`local-agent-history-v1`),onClick:()=>{Se(!1),Ae(!0)},children:`导入历史会话`}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>{Se(!1),N(!0)},children:`接入目录`}),(0,I.jsx)(`button`,{className:`primary`,disabled:O||!ve.trim()||(P===`terminal`?!W.directories.includes(q.id):!wt),children:`创建`})]})]})}),Ie&&(0,I.jsx)(Je,{file:Ie,onClose:()=>L(void 0)},Ie.url),S.terminal?G?(0,I.jsx)(F.Suspense,{fallback:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(j,{title:G.title}),(0,I.jsx)(`div`,{className:`assistant-empty`,children:`正在打开终端…`})]}),children:(0,I.jsx)(pt,{terminal:G,onFile:Ct,connection:W,onClosed:()=>$(S.project,S.directory)},G.id)}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(j,{title:`终端`}),(0,I.jsx)(`div`,{className:`assistant-empty`,children:W.connected?`终端已结束或电脑已重启,请新建终端。`:`正在连接终端…`})]}):ot?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(j,{title:Q?(0,I.jsx)(Fe,{title:Q.title,busy:O,onSave:e=>Et(Q,{title:e})},Q.id):(0,I.jsx)(`h2`,{children:ot.name}),actions:(0,I.jsx)(I.Fragment,{children:(0,I.jsx)(C,{id:`computer-session-menu`,triggerId:`computer-session-actions`,label:`会话操作`,trigger:(0,I.jsx)(p,{name:`more`}),className:`computer-create-menu`,routeKey:Q?.id??``,disabled:!Q,children:e=>(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{role:`menuitem`,disabled:O,onClick:()=>{e(),Q&&Et(Q,{hidden:!0})},children:`隐藏会话`}),(0,I.jsx)(`button`,{role:`menuitem`,onClick:()=>{e(),Dt(ot.id)},children:`连接专用群`}),(0,I.jsx)(`button`,{role:`menuitem`,onClick:()=>{e(),Dt(ot.id)},children:`执行位置`})]})})})}),!wt&&(0,I.jsx)(x,{children:`升级客户端后可使用多个会话和网页对话。`}),(0,I.jsxs)(Oe,{ref:R,onClickCapture:({target:e,currentTarget:t})=>{e instanceof Element&&e.closest(`.tool-summary`)&&(z.current=!1,requestAnimationFrame(()=>{t===R.current&&t.contains(e)&&dt(t)}))},onWheel:e=>{e.deltaY<0&&e.currentTarget.scrollTop<=0&&Z?.olderBefore&&(z.current=!1,X.older())},onScroll:e=>{let t=e.currentTarget;!dt(t)&&t.scrollTop<100&&Z?.olderBefore&&X.older()},"aria-label":`本地会话记录`,children:[Z?.olderBefore&&(0,I.jsx)(`button`,{type:`button`,className:`computer-older`,disabled:X.loadingOlder,onClick:()=>{z.current=!1,X.older()},children:X.loadingOlder?`正在加载…`:`加载更早消息`}),(0,I.jsx)(c,{resource:X}),Ht,(0,I.jsx)(D,{children:Q?.error}),Z&&!Z.messages.length&&!Z.olderBefore&&(0,I.jsx)(`div`,{className:`assistant-empty`,children:Q?.resumeSession?`已接入原生会话,发送消息继续。`:`在当前目录开始一段对话。`})]}),Z?.commands.filter(e=>e.state!==`succeeded`&&![`diff`,`history`,`rewind`].includes(e.kind)&&!(e.kind===`stop`&&[`queued`,`running`].includes(e.state))).slice(-3).map(e=>(0,I.jsxs)(`p`,{className:`computer-control-status`,role:`status`,children:[e.kind===`stop`?`停止`:e.kind,` · `,mt[e.state]??e.state,e.error?`:${e.error}`:``]},e.id)),yt.length>0&&(0,I.jsx)(`div`,{className:`computer-question-shortcut`,children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>{let e=(yt.findIndex(e=>e.id===Ye.current)+1)%yt.length,t=yt[e];bt(t.id)||(z.current=!1,B.current=t.id,X.reveal(t.seq))},children:[(0,I.jsx)(p,{name:`question`,size:`small`}),`有 `,yt.length,` 个问题等待你的确认`]})}),Q&&(0,I.jsx)(Me,{value:fe,onChange:ge,label:`向本地 Agent 发送消息`,sendLabel:Rt?zt?`中断并发送`:Bt?`加入队列`:`插话`:`发送`,onQueue:[`working`,`waiting`].includes(Q.state)&&U?.capabilities.includes(`local-agent-queue-v1`)?()=>Vt(`queue`):void 0,placeholder:Q.archived?`会话已归档`:`输入消息…`,disabled:Q.archived||!wt,sendDisabled:O||Y.busy||Y.failed||Y.count>0&&!It||Z?.commands.some(e=>e.kind===`rewind`&&[`queued`,`running`,`uncertain`].includes(e.state)),attachments:(0,I.jsxs)(I.Fragment,{children:[Y.preview(O),Y.files.some(e=>e.mimeType!==`application/octet-stream`)&&!Lt&&(0,I.jsx)(x,{children:`当前模型将通过本地文件路径接收图片。`})]}),hasAttachments:Y.count>0,onFiles:It&&!O?e=>void Y.add(e):void 0,beforeSend:(0,I.jsx)(ut,{session:Q.id,active:[`working`,`waiting`].includes(Q.state),commands:Z?.commands??[],request:J,refresh:X.reload,onError:E},Q.id),actions:(0,I.jsxs)(I.Fragment,{children:[It?Y.picker(O||!wt,Lt):Lt?(0,I.jsx)(`span`,{title:`更新开发机客户端后可添加附件`,children:(0,I.jsx)(`button`,{type:`button`,className:`icon-button`,disabled:!0,"aria-label":`更新开发机客户端后可添加附件`,children:(0,I.jsx)(p,{name:`attachment`,size:`small`})})}):null,(0,I.jsx)(ft,{session:Q,models:Pt,busy:O,available:!!wt,online:!!U?.online,commands:Nt,controls:Mt?.controls,draft:fe,onInsert:e=>{jt(e.kind===`skill`?e:null),ge(`${e.prefix??(e.kind===`skill`?`$`:`/`)}${e.name} `),requestAnimationFrame(()=>document.querySelector(`.message-composer textarea`)?.focus())},onConfig:e=>{Tt(()=>J(`web/local-agent-sessions/${Q.id}/settings`,ae,{method:`PUT`,body:{expectedRevision:Q.revision,config:e}}))}})]}),onSubmit:()=>Vt(`auto`)})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(j,{title:`本地会话`}),(0,I.jsxs)(`div`,{className:`assistant-empty`,children:[`尚未登记本地执行目录。`,(0,I.jsx)(`button`,{onClick:()=>N(!0),children:`接入目录`})]})]})]})}export{Z as Computers,Fe as t};
@@ -1 +1 @@
1
- import{M as e}from"./Dropdown-DGFI68Vd.js";import{R as t}from"./index-BZEKT27U.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({ref:e,...t}){return(0,n.jsx)(`div`,{role:`log`,"aria-live":`polite`,...t,ref:e,className:`assistant-transcript`})}export{a,s as i,r as n,o as r,i as t};
1
+ import{M as e}from"./Dropdown-DGFI68Vd.js";import{R as t}from"./index-mhJ33-bH.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({ref:e,...t}){return(0,n.jsx)(`div`,{role:`log`,"aria-live":`polite`,...t,ref:e,className:`assistant-transcript`})}export{a,s as i,r as n,o as r,i as t};
@@ -1 +1 @@
1
- import{A as e,At as t,D as n,E as r,Ft as i,I as a,It as o,M as s,O as c,Rt as l,S as u,T as d,_ as f,a as p,c as m,d as h,jt as g,l as _,m as v,r as y,s as b,t as x,w as S}from"./Dropdown-DGFI68Vd.js";import{G as C,K as w,U as T}from"./index-BZEKT27U.js";import{n as E,o as D,r as O,t as k}from"./task-links-DTqf18C2.js";import"./file-links-CoVqmrXg.js";var A=o(((e,t)=>{t.exports=typeof process==`object`&&{}.NODE_DEBUG&&/\bsemver\b/i.test({}.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),j=o(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),M=o(((e,t)=>{var{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=j(),a=A();e=t.exports={};var o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),N=o(((e,t)=>{var n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),P=o(((e,t)=>{var n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),F=o(((e,t)=>{var n=A(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=j(),{safeRe:a,t:o}=M(),s=N(),{compareIdentifiers:c}=P(),l=(e,t)=>{let n=t.split(`.`);if(n.length>e.length)return!1;for(let t=0;t<n.length;t++)if(c(e[t],n[t])!==0)return!1;return!0};t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);this.prerelease=l[4]?l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:+(this.patch>t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e!==i)return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e!==i)return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=+!!Number(n);if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];if(n===!1&&(r=[t]),l(this.prerelease,t)){let e=this.prerelease[t.split(`.`).length];isNaN(e)&&(this.prerelease=r)}else this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),I=o(((e,t)=>{var n=F();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),L=t(),R=l(I(),1),z=s();function B({className:e=``,...t}){return(0,z.jsx)(`button`,{type:`button`,...t,className:`pill-control ${e}`})}function V({className:e=``,...t}){return(0,z.jsx)(x,{...t,className:`pill-menu ${e}`})}var H=[{value:`time`,label:`按时间`,icon:`clock`},{value:`owner`,label:`按用户`,icon:`members`}];function U(e){e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),history.pushState(null,``,e.currentTarget.href),window.dispatchEvent(new PopStateEvent(`popstate`)))}var W=[{status:`planned`,label:`计划`},{status:`in_progress`,label:`进行中`},{status:`in_review`,label:`待验收`},{status:`completed`,label:`已完成`},{status:null,label:`未明确`}];function G({members:t,project:n,memberId:r}){let{request:i,projectId:a}=T(),o=`teammy-board-mine:${r}:${a}`,[s,l]=(0,L.useState)(()=>{try{return localStorage.getItem(o)===`true`}catch{return!1}}),d=`teammy-board-order:${r}:${a}`,[f,h]=(0,L.useState)(()=>{try{return localStorage.getItem(d)===`owner`?`owner`:`time`}catch{return`time`}}),_=H.find(e=>e.value===f),b=(0,L.useCallback)(e=>i(`tasks`,C,{signal:e}),[i]),x=c(b,3e3,e(a,`tasks`)),[S,w]=(0,L.useState)(),[E,D]=(0,L.useState)(!1),[O,A]=(0,L.useState)(Date.now);(0,L.useEffect)(()=>{let e=setInterval(()=>A(Date.now()),6e4);return()=>clearInterval(e)},[]);let j=x.data,M=k(location.href),N=j?.tasks.filter(e=>!s||e.owner===r)??[],P=new Set(t.map(e=>e.id));return(0,z.jsxs)(`div`,{className:`task-board`,children:[(0,z.jsx)(v,{title:n?.projectName.trim()?`${n.projectName.trim()}|工作看板`:`工作看板`,description:n?.description.trim()||``,children:(0,z.jsxs)(`div`,{className:`task-board-brand`,children:[(0,z.jsx)(`a`,{className:`task-board-home`,"data-testid":`home-link`,href:g(`/projects`),onClick:U,"aria-label":`项目主页`,"data-tooltip":`项目主页`,children:(0,z.jsx)(y,{})}),t.some(e=>e.id===r&&e.bound)&&(0,z.jsx)(K,{memberId:r})]})}),(0,z.jsxs)(`div`,{className:`task-board-toolbar`,role:`group`,"aria-label":`看板筛选与排序`,children:[(0,z.jsxs)(B,{"aria-pressed":s,"data-testid":`task-board-mine`,onClick:()=>{let e=!s;l(e),D(!1);try{localStorage.setItem(o,String(e))}catch{}},children:[(0,z.jsx)(m,{name:s?`enable`:`account`,size:`small`}),`只看我的`]}),(0,z.jsx)(V,{id:`task-board-sort-menu`,triggerId:`task-board-sort`,label:`任务排序:${_.label}`,routeKey:f,trigger:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(m,{name:_.icon,size:`small`}),(0,z.jsx)(`span`,{children:_.label}),(0,z.jsx)(m,{name:`chevronDown`,size:`small`})]}),children:e=>H.map(t=>(0,z.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-label":t.label,onClick:()=>{e(),h(t.value),D(!1);try{localStorage.setItem(d,t.value)}catch{}},children:[(0,z.jsx)(m,{name:t.icon,size:`small`}),(0,z.jsx)(`span`,{children:t.label}),f===t.value&&(0,z.jsx)(m,{name:`check`,size:`small`})]},t.value))})]}),(0,z.jsx)(u,{resource:x}),(0,z.jsx)(`section`,{className:`task-board-lanes`,"aria-label":`任务进度`,"data-testid":`progress-board`,children:W.filter(e=>e.status!==null||N.some(e=>e.status===null)).map(e=>{let t=N.filter(t=>t.status===e.status);t.sort((t,n)=>(f===`owner`?t.owner.localeCompare(n.owner,`en`,{numeric:!0}):0)||(e.status===`completed`?n.statusSince.localeCompare(t.statusSince):t.statusSince.localeCompare(n.statusSince))||t.id.localeCompare(n.id));let n=e.status===`completed`&&!E?t.slice(0,5):t;return(0,z.jsxs)(`section`,{className:`task-lane`,"aria-label":e.label,"data-stage":e.status??`unknown`,children:[(0,z.jsxs)(`h2`,{children:[(0,z.jsx)(`span`,{className:`lane-dot`}),e.label,(0,z.jsx)(p,{children:j?t.length:`—`})]}),(0,z.jsxs)(`div`,{className:`task-lane-content`,children:[t.length?n.map(e=>(0,z.jsx)(q,{task:e,number:j?.taskNumbers[e.id],memberIds:P,now:O,onEdit:()=>w(e),onSaved:()=>void x.reload()},e.id)):(0,z.jsx)(`p`,{className:`task-lane-empty`,children:x.error&&!j?`读取失败`:j?`暂无任务`:`读取中…`}),e.status===`completed`&&t.length>5&&(0,z.jsxs)(`button`,{type:`button`,className:`task-lane-expand`,"aria-expanded":E,onClick:()=>D(!E),children:[(0,z.jsx)(m,{name:E?`chevronUp`:`chevronDown`,size:`small`}),E?`收起`:`展开其余 ${t.length-5} 项`]})]})]},e.label)})}),M&&(0,z.jsx)(Y,{project:a,id:M.id,memberIds:P,onClose:()=>{let e=new URL(location.href);e.searchParams.delete(`task`),history.replaceState(history.state,``,e),window.dispatchEvent(new PopStateEvent(`popstate`))}}),S&&(0,z.jsx)(Q,{task:S,onClose:()=>w(void 0),onSaved:()=>{w(void 0),x.reload()}},S.id)]})}function K({memberId:e}){let{api:t,projectId:n}=T(),a=c(t.devices,!0),o=r();if(!a.data||!o.data||a.error||o.error)return null;let s=(0,R.default)(o.data.version),[l]=a.data.devices.filter(t=>t.memberId===e&&t.bound).map(e=>(0,R.default)(e.status?.clientVersion)).filter(e=>e!==null).sort((e,t)=>e.compare(t));if(!l||!s||l.compare(s)>=0)return null;let u=o.data.versions.filter(e=>{let t=(0,R.default)(e);return t&&(!t.prerelease.length||e===s.raw)&&t.compare(l)>0&&t.compare(s)<=0}).length;return(0,z.jsx)(`p`,{className:`task-board-update${u>5?` overdue`:``}`,children:(0,z.jsxs)(`a`,{href:i(n,`settings/client-maintenance.md`,`#升级与修复`),onClick:U,children:[(0,z.jsx)(m,{name:`attention`,size:`small`}),(0,z.jsxs)(`span`,{children:[`客户端待更新 `,l.raw,` → `,s.raw]})]})})}function q({task:e,number:t,memberIds:r,onEdit:i,onSaved:o,now:s}){let{request:c}=T(),l=n(),[u,d]=(0,L.useState)(!1),f=S();async function p(){if(!u){d(!0),f(``);try{await c(`tasks/${e.id}/correction`,w,{method:`PATCH`,signal:l,body:{needsConfirmation:!1,expectedRevision:e.revision}}),l.aborted||o()}catch(e){l.aborted||f(a(e))}finally{d(!1)}}}return(0,z.jsxs)(`details`,{className:`task-card`,"data-testid":`task-card`,"data-task-id":e.id,"data-owner":e.owner,"data-status":e.status??`unknown`,children:[(0,z.jsxs)(`summary`,{className:`task-card-heading`,"data-testid":`task-toggle`,children:[(0,z.jsxs)(`h3`,{children:[t!==void 0&&(0,z.jsxs)(`span`,{className:`task-card-number`,children:[`#`,t]}),(0,z.jsx)(`span`,{className:`task-card-title`,children:e.title})]}),(0,z.jsxs)(`span`,{className:`task-card-meta`,children:[(0,z.jsx)(`small`,{title:e.owner,children:e.owner}),e.needsConfirmation&&(0,z.jsxs)(`span`,{className:`task-confirmation`,"data-testid":`task-confirmation`,children:[(0,z.jsx)(m,{name:`attention`,size:`small`}),`需要确认`]}),e.status!==`completed`&&(0,z.jsx)(X,{since:e.statusSince,now:s})]})]}),(0,z.jsx)(_,{icon:`edit`,className:`task-card-edit`,label:`纠正任务:${e.title}`,"data-testid":`task-correct`,disabled:u,onClick:i}),(0,z.jsxs)(`div`,{className:`task-card-details`,children:[(0,z.jsx)(J,{task:e,memberIds:r}),e.needsConfirmation&&(0,z.jsx)(`div`,{className:`task-card-confirm`,children:(0,z.jsx)(`button`,{className:`primary`,"data-testid":`task-confirm-save`,disabled:u,onClick:()=>void p(),children:u?`正在保存…`:`保存`})})]})]})}function J({task:e,memberIds:t}){let{projectId:n}=T(),[r,i]=(0,L.useState)(``),a=S();return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h4`,{children:`目标`}),(0,z.jsx)(`p`,{children:e.goal?(0,z.jsx)(Z,{value:e.goal,memberIds:t}):`目标未明确`}),(0,z.jsx)(`h4`,{children:`当前进展`}),(0,z.jsx)(`p`,{className:`task-progress`,children:(0,z.jsx)(Z,{value:e.progress,memberIds:t})}),(0,z.jsx)(`div`,{className:`task-card-sources`,children:e.sources.map(t=>(0,z.jsxs)(`a`,{"data-testid":`task-source`,href:g(t.kind===`material`?`/projects/${n}/materials?id=${t.materialId}&revision=${t.revision}`:O(n,e.owner,t.path)),children:[(0,z.jsx)(m,{name:`file`,size:`small`}),(0,z.jsx)(`span`,{children:t.path})]},t.path))}),(0,z.jsxs)(`div`,{className:`task-card-footer`,children:[e.syncedAt&&(0,z.jsxs)(`small`,{children:[`资料同步于 `,(0,z.jsx)(f,{value:e.syncedAt})]}),(0,z.jsx)(`span`,{role:`status`,children:r}),(0,z.jsx)(_,{icon:`link`,label:`复制任务链接`,onBlur:()=>i(``),onClick:async()=>{a(``);try{await d(new URL(g(D(n,e.id)),location.origin).href),i(`已复制`)}catch{i(``),a(`未能复制任务链接,请重试。`)}}})]})]})}function Y({project:e,id:t,memberIds:n,onClose:r}){let i=E(e,t,!0),{data:a,error:o}=i;return(0,z.jsxs)(h,{id:`shared-task`,title:a?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`span`,{className:`task-card-number`,children:[`#`,a.number]}),` `,a.task.title]}):`任务`,onClose:r,children:[(0,z.jsx)(u,{resource:i}),a?(0,z.jsxs)(`div`,{className:`task-card-details`,children:[(0,z.jsxs)(`small`,{children:[a.task.owner,` · `,W.find(e=>e.status===a.task.status)?.label,!a.active&&` · 已归档`]}),(0,z.jsx)(J,{task:a.task,memberIds:n},t)]}):!o&&(0,z.jsx)(`p`,{role:`status`,children:`读取中…`})]})}function X({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,z.jsxs)(`span`,{className:`task-age${n>6048e5?` stale`:``}`,"data-testid":`task-age`,title:`进入当前状态:${new Date(e).toLocaleString(`zh-CN`)}`,"aria-label":`当前状态停留 ${i}`,children:[(0,z.jsx)(m,{name:`clock`,size:`small`}),i]})}function Z({value:e,memberIds:t}){return e.split(/(@[a-z][a-z0-9_-]*)/gi).map((e,n)=>e.startsWith(`@`)&&t.has(e.slice(1))?(0,z.jsx)(`mark`,{className:`task-mention`,children:e},n):e)}function Q({task:e,onClose:t,onSaved:r}){let{request:i}=T(),o=n(),[s,c]=(0,L.useState)(e.title),[l,u]=(0,L.useState)(e.status??``),[d,f]=(0,L.useState)(e.goal??``),[p,m]=(0,L.useState)(e.progress),[g,_]=(0,L.useState)(!1),v=S(),y={...s===e.title?{}:{title:s},...l===(e.status??``)?{}:{status:l||null},...d===(e.goal??``)?{}:{goal:d||null},...p===e.progress?{}:{progress:p},...e.needsConfirmation?{needsConfirmation:!1}:{}};async function x(){if(!g&&Object.keys(y).length){_(!0),v(``);try{await i(`tasks/${e.id}/correction`,w,{method:`PATCH`,signal:o,body:{...y,expectedRevision:e.revision}}),o.aborted||r()}catch(e){o.aborted||v(a(e))}finally{_(!1)}}}return(0,z.jsx)(h,{id:`task-correction`,title:`纠正任务`,onClose:t,children:(0,z.jsxs)(`form`,{className:`stack`,"aria-busy":g,onSubmit:e=>{e.preventDefault(),x()},children:[(0,z.jsx)(b,{id:`task-title`,label:`标题`,children:(0,z.jsx)(`input`,{value:s,required:!0,onChange:e=>c(e.target.value)})}),(0,z.jsxs)(`fieldset`,{className:`task-status-field`,disabled:g,children:[(0,z.jsx)(`legend`,{children:`状态`}),(0,z.jsx)(`div`,{className:`task-status-options`,"data-testid":`task-status`,children:W.filter(e=>e.status!==null).map(e=>(0,z.jsxs)(`label`,{className:`task-status-choice`,children:[(0,z.jsx)(`input`,{type:`radio`,name:`task-status`,value:e.status,checked:l===e.status,onChange:()=>u(e.status)}),(0,z.jsx)(`span`,{children:e.label})]},e.status))}),(0,z.jsx)(`small`,{children:`待验收:任务成果已提交,等待验收或最终确认。`})]}),(0,z.jsx)(b,{id:`task-goal`,label:`目标`,children:(0,z.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value)})}),(0,z.jsx)(b,{id:`task-progress`,label:`当前进展`,children:(0,z.jsx)(`textarea`,{value:p,onChange:e=>m(e.target.value)})}),(0,z.jsx)(`div`,{className:`row wrap`,children:(0,z.jsx)(`button`,{type:`submit`,className:`primary`,disabled:g||!Object.keys(y).length,"data-testid":`task-correction-save`,children:`保存`})})]})})}function $({members:e,config:t,memberId:n}){return(0,z.jsx)(G,{members:e,project:t,memberId:n})}export{$ as Dashboard};
1
+ import{A as e,At as t,D as n,E as r,Ft as i,I as a,It as o,M as s,O as c,Rt as l,S as u,T as d,_ as f,a as p,c as m,d as h,jt as g,l as _,m as v,r as y,s as b,t as x,w as S}from"./Dropdown-DGFI68Vd.js";import{G as C,K as w,U as T}from"./index-mhJ33-bH.js";import{n as E,o as D,r as O,t as k}from"./task-links-BE36-8mc.js";import"./file-links-CoVqmrXg.js";var A=o(((e,t)=>{t.exports=typeof process==`object`&&{}.NODE_DEBUG&&/\bsemver\b/i.test({}.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),j=o(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),M=o(((e,t)=>{var{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=j(),a=A();e=t.exports={};var o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),N=o(((e,t)=>{var n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),P=o(((e,t)=>{var n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),F=o(((e,t)=>{var n=A(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=j(),{safeRe:a,t:o}=M(),s=N(),{compareIdentifiers:c}=P(),l=(e,t)=>{let n=t.split(`.`);if(n.length>e.length)return!1;for(let t=0;t<n.length;t++)if(c(e[t],n[t])!==0)return!1;return!0};t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);this.prerelease=l[4]?l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:+(this.patch>t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e!==i)return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e!==i)return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=+!!Number(n);if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];if(n===!1&&(r=[t]),l(this.prerelease,t)){let e=this.prerelease[t.split(`.`).length];isNaN(e)&&(this.prerelease=r)}else this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),I=o(((e,t)=>{var n=F();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),L=t(),R=l(I(),1),z=s();function B({className:e=``,...t}){return(0,z.jsx)(`button`,{type:`button`,...t,className:`pill-control ${e}`})}function V({className:e=``,...t}){return(0,z.jsx)(x,{...t,className:`pill-menu ${e}`})}var H=[{value:`time`,label:`按时间`,icon:`clock`},{value:`owner`,label:`按用户`,icon:`members`}];function U(e){e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),history.pushState(null,``,e.currentTarget.href),window.dispatchEvent(new PopStateEvent(`popstate`)))}var W=[{status:`planned`,label:`计划`},{status:`in_progress`,label:`进行中`},{status:`in_review`,label:`待验收`},{status:`completed`,label:`已完成`},{status:null,label:`未明确`}];function G({members:t,project:n,memberId:r}){let{request:i,projectId:a}=T(),o=`teammy-board-mine:${r}:${a}`,[s,l]=(0,L.useState)(()=>{try{return localStorage.getItem(o)===`true`}catch{return!1}}),d=`teammy-board-order:${r}:${a}`,[f,h]=(0,L.useState)(()=>{try{return localStorage.getItem(d)===`owner`?`owner`:`time`}catch{return`time`}}),_=H.find(e=>e.value===f),b=(0,L.useCallback)(e=>i(`tasks`,C,{signal:e}),[i]),x=c(b,3e3,e(a,`tasks`)),[S,w]=(0,L.useState)(),[E,D]=(0,L.useState)(!1),[O,A]=(0,L.useState)(Date.now);(0,L.useEffect)(()=>{let e=setInterval(()=>A(Date.now()),6e4);return()=>clearInterval(e)},[]);let j=x.data,M=k(location.href),N=j?.tasks.filter(e=>!s||e.owner===r)??[],P=new Set(t.map(e=>e.id));return(0,z.jsxs)(`div`,{className:`task-board`,children:[(0,z.jsx)(v,{title:n?.projectName.trim()?`${n.projectName.trim()}|工作看板`:`工作看板`,description:n?.description.trim()||``,children:(0,z.jsxs)(`div`,{className:`task-board-brand`,children:[(0,z.jsx)(`a`,{className:`task-board-home`,"data-testid":`home-link`,href:g(`/projects`),onClick:U,"aria-label":`项目主页`,"data-tooltip":`项目主页`,children:(0,z.jsx)(y,{})}),t.some(e=>e.id===r&&e.bound)&&(0,z.jsx)(K,{memberId:r})]})}),(0,z.jsxs)(`div`,{className:`task-board-toolbar`,role:`group`,"aria-label":`看板筛选与排序`,children:[(0,z.jsxs)(B,{"aria-pressed":s,"data-testid":`task-board-mine`,onClick:()=>{let e=!s;l(e),D(!1);try{localStorage.setItem(o,String(e))}catch{}},children:[(0,z.jsx)(m,{name:s?`enable`:`account`,size:`small`}),`只看我的`]}),(0,z.jsx)(V,{id:`task-board-sort-menu`,triggerId:`task-board-sort`,label:`任务排序:${_.label}`,routeKey:f,trigger:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(m,{name:_.icon,size:`small`}),(0,z.jsx)(`span`,{children:_.label}),(0,z.jsx)(m,{name:`chevronDown`,size:`small`})]}),children:e=>H.map(t=>(0,z.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-label":t.label,onClick:()=>{e(),h(t.value),D(!1);try{localStorage.setItem(d,t.value)}catch{}},children:[(0,z.jsx)(m,{name:t.icon,size:`small`}),(0,z.jsx)(`span`,{children:t.label}),f===t.value&&(0,z.jsx)(m,{name:`check`,size:`small`})]},t.value))})]}),(0,z.jsx)(u,{resource:x}),(0,z.jsx)(`section`,{className:`task-board-lanes`,"aria-label":`任务进度`,"data-testid":`progress-board`,children:W.filter(e=>e.status!==null||N.some(e=>e.status===null)).map(e=>{let t=N.filter(t=>t.status===e.status);t.sort((t,n)=>(f===`owner`?t.owner.localeCompare(n.owner,`en`,{numeric:!0}):0)||(e.status===`completed`?n.statusSince.localeCompare(t.statusSince):t.statusSince.localeCompare(n.statusSince))||t.id.localeCompare(n.id));let n=e.status===`completed`&&!E?t.slice(0,5):t;return(0,z.jsxs)(`section`,{className:`task-lane`,"aria-label":e.label,"data-stage":e.status??`unknown`,children:[(0,z.jsxs)(`h2`,{children:[(0,z.jsx)(`span`,{className:`lane-dot`}),e.label,(0,z.jsx)(p,{children:j?t.length:`—`})]}),(0,z.jsxs)(`div`,{className:`task-lane-content`,children:[t.length?n.map(e=>(0,z.jsx)(q,{task:e,number:j?.taskNumbers[e.id],memberIds:P,now:O,onEdit:()=>w(e),onSaved:()=>void x.reload()},e.id)):(0,z.jsx)(`p`,{className:`task-lane-empty`,children:x.error&&!j?`读取失败`:j?`暂无任务`:`读取中…`}),e.status===`completed`&&t.length>5&&(0,z.jsxs)(`button`,{type:`button`,className:`task-lane-expand`,"aria-expanded":E,onClick:()=>D(!E),children:[(0,z.jsx)(m,{name:E?`chevronUp`:`chevronDown`,size:`small`}),E?`收起`:`展开其余 ${t.length-5} 项`]})]})]},e.label)})}),M&&(0,z.jsx)(Y,{project:a,id:M.id,memberIds:P,onClose:()=>{let e=new URL(location.href);e.searchParams.delete(`task`),history.replaceState(history.state,``,e),window.dispatchEvent(new PopStateEvent(`popstate`))}}),S&&(0,z.jsx)(Q,{task:S,onClose:()=>w(void 0),onSaved:()=>{w(void 0),x.reload()}},S.id)]})}function K({memberId:e}){let{api:t,projectId:n}=T(),a=c(t.devices,!0),o=r();if(!a.data||!o.data||a.error||o.error)return null;let s=(0,R.default)(o.data.version),[l]=a.data.devices.filter(t=>t.memberId===e&&t.bound).map(e=>(0,R.default)(e.status?.clientVersion)).filter(e=>e!==null).sort((e,t)=>e.compare(t));if(!l||!s||l.compare(s)>=0)return null;let u=o.data.versions.filter(e=>{let t=(0,R.default)(e);return t&&(!t.prerelease.length||e===s.raw)&&t.compare(l)>0&&t.compare(s)<=0}).length;return(0,z.jsx)(`p`,{className:`task-board-update${u>5?` overdue`:``}`,children:(0,z.jsxs)(`a`,{href:i(n,`settings/client-maintenance.md`,`#升级与修复`),onClick:U,children:[(0,z.jsx)(m,{name:`attention`,size:`small`}),(0,z.jsxs)(`span`,{children:[`客户端待更新 `,l.raw,` → `,s.raw]})]})})}function q({task:e,number:t,memberIds:r,onEdit:i,onSaved:o,now:s}){let{request:c}=T(),l=n(),[u,d]=(0,L.useState)(!1),f=S();async function p(){if(!u){d(!0),f(``);try{await c(`tasks/${e.id}/correction`,w,{method:`PATCH`,signal:l,body:{needsConfirmation:!1,expectedRevision:e.revision}}),l.aborted||o()}catch(e){l.aborted||f(a(e))}finally{d(!1)}}}return(0,z.jsxs)(`details`,{className:`task-card`,"data-testid":`task-card`,"data-task-id":e.id,"data-owner":e.owner,"data-status":e.status??`unknown`,children:[(0,z.jsxs)(`summary`,{className:`task-card-heading`,"data-testid":`task-toggle`,children:[(0,z.jsxs)(`h3`,{children:[t!==void 0&&(0,z.jsxs)(`span`,{className:`task-card-number`,children:[`#`,t]}),(0,z.jsx)(`span`,{className:`task-card-title`,children:e.title})]}),(0,z.jsxs)(`span`,{className:`task-card-meta`,children:[(0,z.jsx)(`small`,{title:e.owner,children:e.owner}),e.needsConfirmation&&(0,z.jsxs)(`span`,{className:`task-confirmation`,"data-testid":`task-confirmation`,children:[(0,z.jsx)(m,{name:`attention`,size:`small`}),`需要确认`]}),e.status!==`completed`&&(0,z.jsx)(X,{since:e.statusSince,now:s})]})]}),(0,z.jsx)(_,{icon:`edit`,className:`task-card-edit`,label:`纠正任务:${e.title}`,"data-testid":`task-correct`,disabled:u,onClick:i}),(0,z.jsxs)(`div`,{className:`task-card-details`,children:[(0,z.jsx)(J,{task:e,memberIds:r}),e.needsConfirmation&&(0,z.jsx)(`div`,{className:`task-card-confirm`,children:(0,z.jsx)(`button`,{className:`primary`,"data-testid":`task-confirm-save`,disabled:u,onClick:()=>void p(),children:u?`正在保存…`:`保存`})})]})]})}function J({task:e,memberIds:t}){let{projectId:n}=T(),[r,i]=(0,L.useState)(``),a=S();return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h4`,{children:`目标`}),(0,z.jsx)(`p`,{children:e.goal?(0,z.jsx)(Z,{value:e.goal,memberIds:t}):`目标未明确`}),(0,z.jsx)(`h4`,{children:`当前进展`}),(0,z.jsx)(`p`,{className:`task-progress`,children:(0,z.jsx)(Z,{value:e.progress,memberIds:t})}),(0,z.jsx)(`div`,{className:`task-card-sources`,children:e.sources.map(t=>(0,z.jsxs)(`a`,{"data-testid":`task-source`,href:g(t.kind===`material`?`/projects/${n}/materials?id=${t.materialId}&revision=${t.revision}`:O(n,e.owner,t.path)),children:[(0,z.jsx)(m,{name:`file`,size:`small`}),(0,z.jsx)(`span`,{children:t.path})]},t.path))}),(0,z.jsxs)(`div`,{className:`task-card-footer`,children:[e.syncedAt&&(0,z.jsxs)(`small`,{children:[`资料同步于 `,(0,z.jsx)(f,{value:e.syncedAt})]}),(0,z.jsx)(`span`,{role:`status`,children:r}),(0,z.jsx)(_,{icon:`link`,label:`复制任务链接`,onBlur:()=>i(``),onClick:async()=>{a(``);try{await d(new URL(g(D(n,e.id)),location.origin).href),i(`已复制`)}catch{i(``),a(`未能复制任务链接,请重试。`)}}})]})]})}function Y({project:e,id:t,memberIds:n,onClose:r}){let i=E(e,t,!0),{data:a,error:o}=i;return(0,z.jsxs)(h,{id:`shared-task`,title:a?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`span`,{className:`task-card-number`,children:[`#`,a.number]}),` `,a.task.title]}):`任务`,onClose:r,children:[(0,z.jsx)(u,{resource:i}),a?(0,z.jsxs)(`div`,{className:`task-card-details`,children:[(0,z.jsxs)(`small`,{children:[a.task.owner,` · `,W.find(e=>e.status===a.task.status)?.label,!a.active&&` · 已归档`]}),(0,z.jsx)(J,{task:a.task,memberIds:n},t)]}):!o&&(0,z.jsx)(`p`,{role:`status`,children:`读取中…`})]})}function X({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,z.jsxs)(`span`,{className:`task-age${n>6048e5?` stale`:``}`,"data-testid":`task-age`,title:`进入当前状态:${new Date(e).toLocaleString(`zh-CN`)}`,"aria-label":`当前状态停留 ${i}`,children:[(0,z.jsx)(m,{name:`clock`,size:`small`}),i]})}function Z({value:e,memberIds:t}){return e.split(/(@[a-z][a-z0-9_-]*)/gi).map((e,n)=>e.startsWith(`@`)&&t.has(e.slice(1))?(0,z.jsx)(`mark`,{className:`task-mention`,children:e},n):e)}function Q({task:e,onClose:t,onSaved:r}){let{request:i}=T(),o=n(),[s,c]=(0,L.useState)(e.title),[l,u]=(0,L.useState)(e.status??``),[d,f]=(0,L.useState)(e.goal??``),[p,m]=(0,L.useState)(e.progress),[g,_]=(0,L.useState)(!1),v=S(),y={...s===e.title?{}:{title:s},...l===(e.status??``)?{}:{status:l||null},...d===(e.goal??``)?{}:{goal:d||null},...p===e.progress?{}:{progress:p},...e.needsConfirmation?{needsConfirmation:!1}:{}};async function x(){if(!g&&Object.keys(y).length){_(!0),v(``);try{await i(`tasks/${e.id}/correction`,w,{method:`PATCH`,signal:o,body:{...y,expectedRevision:e.revision}}),o.aborted||r()}catch(e){o.aborted||v(a(e))}finally{_(!1)}}}return(0,z.jsx)(h,{id:`task-correction`,title:`纠正任务`,onClose:t,children:(0,z.jsxs)(`form`,{className:`stack`,"aria-busy":g,onSubmit:e=>{e.preventDefault(),x()},children:[(0,z.jsx)(b,{id:`task-title`,label:`标题`,children:(0,z.jsx)(`input`,{value:s,required:!0,onChange:e=>c(e.target.value)})}),(0,z.jsxs)(`fieldset`,{className:`task-status-field`,disabled:g,children:[(0,z.jsx)(`legend`,{children:`状态`}),(0,z.jsx)(`div`,{className:`task-status-options`,"data-testid":`task-status`,children:W.filter(e=>e.status!==null).map(e=>(0,z.jsxs)(`label`,{className:`task-status-choice`,children:[(0,z.jsx)(`input`,{type:`radio`,name:`task-status`,value:e.status,checked:l===e.status,onChange:()=>u(e.status)}),(0,z.jsx)(`span`,{children:e.label})]},e.status))}),(0,z.jsx)(`small`,{children:`待验收:任务成果已提交,等待验收或最终确认。`})]}),(0,z.jsx)(b,{id:`task-goal`,label:`目标`,children:(0,z.jsx)(`textarea`,{value:d,onChange:e=>f(e.target.value)})}),(0,z.jsx)(b,{id:`task-progress`,label:`当前进展`,children:(0,z.jsx)(`textarea`,{value:p,onChange:e=>m(e.target.value)})}),(0,z.jsx)(`div`,{className:`row wrap`,children:(0,z.jsx)(`button`,{type:`submit`,className:`primary`,disabled:g||!Object.keys(y).length,"data-testid":`task-correction-save`,children:`保存`})})]})})}function $({members:e,config:t,memberId:n}){return(0,z.jsx)(G,{members:e,project:t,memberId:n})}export{$ as Dashboard};
@@ -1 +1 @@
1
- import{A as e,At as t,H as n,M as r,N as i,O as a,T as o,c as s,g as c,jt as l,l as u,o as d,st as f,w as p,x as m,y as h}from"./Dropdown-DGFI68Vd.js";import{F as g,I as _,L as v,U as y,i as b}from"./index-BZEKT27U.js";import{r as x}from"./task-links-DTqf18C2.js";import{t as S}from"./Markdown-gPLWRWEJ.js";import{a as C,i as w,l as T,n as E,o as D,s as O,t as k}from"./WorkspaceTree-DZ6DN_OX.js";import{t as A}from"./file-links-CoVqmrXg.js";var j=t(),M=r();function N(e,t){let n=t.split(`/`).slice(0,-1);return n.map((t,r)=>E(e,n.slice(0,r+1).join(`/`))).concat(E(e,``))}function P({members:e,onRefresh:t}){let{api:r,projectId:o}=y(),[s,c]=(0,j.useState)(()=>{let t=new URLSearchParams(location.search),n=t.get(`owner`),r=f.safeParse(t.get(`path`));return n&&(O(n)||e.some(e=>e.id===n))&&r.success&&!D(r.data)?{owner:n,path:r.data}:void 0}),[g,S]=(0,j.useState)(()=>new Set(s?N(s.owner,s.path):[])),[T,P]=(0,j.useState)(()=>s?{...s,kind:`file`}:void 0),[L,R]=(0,j.useState)(0),z=p(),[B,V]=(0,j.useState)(()=>{let e=new URLSearchParams(location.search);return!s&&(e.has(`owner`)||e.has(`path`))?`文件链接不完整或目标已不可用。`:``}),H=(0,j.useCallback)(async e=>{if(s)try{return{owner:s.owner,...await r.file(s.owner,s.path,void 0,e)}}catch(e){throw e instanceof i&&e.code===`FILE_NOT_FOUND`?new i(e.code,`找不到这个文件,可能已被删除或移动。`,e.status):e}},[r,s?.owner,s?.path]),U=a(H),W=U.data?.owner===s?.owner&&U.data?.file.path===s?.path?U.data:void 0;b(s?(O(s.owner)?s.path:`${s.owner}/${s.path}`).split(`/`).slice(-2).join(`/`):void 0);function G(e,t){let n=t.split(`/`).filter(Boolean);S(t=>{let r=new Set(t);for(let t=0;t<=n.length;t++)r.add(E(e,n.slice(0,t).join(`/`)));return r})}function K(e,t){z(``),V(``),G(e,t.split(`/`).slice(0,-1).join(`/`)),c({owner:e,path:t}),P({owner:e,path:t,kind:`file`}),history.replaceState(null,``,l(x(o,e,t)))}function q(t){if(!s)return!1;z(``);let n=A(O(s.owner)?s.path:`${s.owner}/${s.path}`,t);if(!n)return!/^[a-z][a-z0-9+.-]*:/i.test(t)&&!t.startsWith(`//`)&&(z(`该链接超出工作区,请在原仓库查看。`),!0);if(D(n.path))return z(`配置文件不在文件浏览中显示。`),!0;if(C(n.path))return location.assign(l(`/projects/${o}/memory`)),!0;let[r,...i]=n.path.split(`/`),a=e.some(e=>e.id===r),c=a?r:w,u=a?i.join(`/`):n.path;return V(``),n.directory?(G(c,u),P({owner:c,path:u,kind:`directory`})):c===s.owner&&u===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`}):K(c,u),!0}return(0,M.jsx)(_,{"data-testid":`file-browser`,label:`文件资源管理器`,navigation:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(v,{title:`工作区`,children:(0,M.jsx)(u,{icon:`refresh`,label:`刷新文件`,"data-testid":`files-refresh`,onClick:()=>{V(``),R(e=>e+1),U.reload(),t()}})}),(0,M.jsx)(k,{members:e,expanded:g,selected:T,revealed:!U.loading&&!U.error&&W?{owner:W.owner,path:W.file.path,file:W.file}:void 0,onSelect:K,onToggle:(e,t)=>{P({owner:e,path:t,kind:`directory`}),S(n=>{let r=new Set(n),i=E(e,t);return r.has(i)?r.delete(i):r.add(i),r})}},L)]}),children:(0,M.jsxs)(`section`,{className:`file-detail`,"data-testid":`file-preview`,"data-owner-id":s?.owner,"data-file-path":s?.path,"aria-label":n.filePreview,children:[W&&(0,M.jsx)(m,{message:U.error}),W?(0,M.jsx)(I,{owner:W.owner,file:W.file,onLink:q},`${W.owner}:${W.file.path}:${W.file.sha256}`):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(F,{target:s}),(0,M.jsxs)(`div`,{className:`reader-body`,children:[(0,M.jsx)(h,{announce:!0,retry:U.error?U.reload:void 0,children:B||U.error}),s&&U.loading&&(0,M.jsx)(`p`,{className:`preview-body`,role:`status`,children:n.loading}),!s&&!B&&(0,M.jsx)(d,{mascot:!0,title:`查看工作区文件`,description:n.pickFile})]})]})]})})}function F({target:e,children:t}){let r=e&&(O(e.owner)?`teamcontext`:e.owner);return(0,M.jsx)(g,{title:e?(0,M.jsxs)(`h2`,{className:`file-detail-path`,title:`${r}/${e.path}`,children:[(0,M.jsxs)(`span`,{children:[r,` / `]}),e.path]}):n.filePreview,actions:t})}function I({owner:t,file:r,onLink:i}){let{readTextBlob:l,blobUrl:d,projectId:f}=y(),[g,_]=(0,j.useState)(!1),[v,b]=(0,j.useState)(!1),x=p(),C=`teamcontext/${O(t)?``:`${t}/`}${r.path}`,w=r.size>524288,E=/\.(md|markdown)$/i.test(r.path),D=/\.html?$/i.test(r.path),k=(0,j.useCallback)(e=>w?Promise.resolve(void 0):l(r,e),[r.sha256,r.size,w]),A=a(k,!1,e(f,`file-body`,r.sha256));return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(F,{target:{owner:t,path:r.path},children:(0,M.jsxs)(c,{label:`文件操作`,children:[(E||D)&&(0,M.jsx)(u,{icon:g?`preview`:`code`,label:g?`切换为预览`:`切换为原文`,"data-testid":`file-toggle-raw`,"aria-pressed":g,onClick:()=>_(!g)}),(0,M.jsx)(`a`,{className:`icon-button`,"data-testid":`file-download`,"aria-label":n.download,title:n.download,href:d(r.sha256),download:r.path.split(`/`).at(-1),children:(0,M.jsx)(s,{name:`download`})}),(0,M.jsx)(u,{icon:v?`check`:`link`,label:v?`已复制路径`:`复制工作区相对路径`,"data-testid":`file-copy-path`,onBlur:()=>b(!1),onClick:async()=>{x(``);try{await o(C),b(!0)}catch{b(!1),x(`未能复制文件路径,请重试。`)}}})]})}),(0,M.jsxs)(`div`,{className:`reader-body`,children:[A.data!==void 0&&(0,M.jsx)(m,{message:A.error}),w?(0,M.jsx)(`div`,{className:`empty`,children:(0,M.jsx)(`p`,{children:n.previewLarge})}):A.error&&A.data===void 0?(0,M.jsx)(`div`,{className:`preview-body`,children:(0,M.jsx)(h,{announce:!0,retry:A.reload,children:A.error})}):A.loading&&A.data===void 0?(0,M.jsx)(`p`,{className:`preview-body`,role:`status`,children:n.loading}):(0,M.jsx)(`div`,{className:`preview-body${D&&!g?` preview-body-html`:``}`,children:D&&!g?(0,M.jsx)(T,{url:d(r.sha256),name:r.path.split(`/`).at(-1)}):E&&!g?(0,M.jsx)(`article`,{className:`markdown`,"data-testid":`file-content`,"data-format":`markdown`,children:(0,M.jsx)(S,{onLink:i,children:A.data??``})}):(0,M.jsx)(`pre`,{className:`raw`,"data-testid":`file-content`,"data-format":`text`,children:A.data})})]})]})}export{P as Files};
1
+ import{A as e,At as t,H as n,M as r,N as i,O as a,T as o,c as s,g as c,jt as l,l as u,o as d,st as f,w as p,x as m,y as h}from"./Dropdown-DGFI68Vd.js";import{F as g,I as _,L as v,U as y,i as b}from"./index-mhJ33-bH.js";import{r as x}from"./task-links-BE36-8mc.js";import{t as S}from"./Markdown-CXnZDm5J.js";import{a as C,i as w,l as T,n as E,o as D,s as O,t as k}from"./WorkspaceTree-Co7XG2RG.js";import{t as A}from"./file-links-CoVqmrXg.js";var j=t(),M=r();function N(e,t){let n=t.split(`/`).slice(0,-1);return n.map((t,r)=>E(e,n.slice(0,r+1).join(`/`))).concat(E(e,``))}function P({members:e,onRefresh:t}){let{api:r,projectId:o}=y(),[s,c]=(0,j.useState)(()=>{let t=new URLSearchParams(location.search),n=t.get(`owner`),r=f.safeParse(t.get(`path`));return n&&(O(n)||e.some(e=>e.id===n))&&r.success&&!D(r.data)?{owner:n,path:r.data}:void 0}),[g,S]=(0,j.useState)(()=>new Set(s?N(s.owner,s.path):[])),[T,P]=(0,j.useState)(()=>s?{...s,kind:`file`}:void 0),[L,R]=(0,j.useState)(0),z=p(),[B,V]=(0,j.useState)(()=>{let e=new URLSearchParams(location.search);return!s&&(e.has(`owner`)||e.has(`path`))?`文件链接不完整或目标已不可用。`:``}),H=(0,j.useCallback)(async e=>{if(s)try{return{owner:s.owner,...await r.file(s.owner,s.path,void 0,e)}}catch(e){throw e instanceof i&&e.code===`FILE_NOT_FOUND`?new i(e.code,`找不到这个文件,可能已被删除或移动。`,e.status):e}},[r,s?.owner,s?.path]),U=a(H),W=U.data?.owner===s?.owner&&U.data?.file.path===s?.path?U.data:void 0;b(s?(O(s.owner)?s.path:`${s.owner}/${s.path}`).split(`/`).slice(-2).join(`/`):void 0);function G(e,t){let n=t.split(`/`).filter(Boolean);S(t=>{let r=new Set(t);for(let t=0;t<=n.length;t++)r.add(E(e,n.slice(0,t).join(`/`)));return r})}function K(e,t){z(``),V(``),G(e,t.split(`/`).slice(0,-1).join(`/`)),c({owner:e,path:t}),P({owner:e,path:t,kind:`file`}),history.replaceState(null,``,l(x(o,e,t)))}function q(t){if(!s)return!1;z(``);let n=A(O(s.owner)?s.path:`${s.owner}/${s.path}`,t);if(!n)return!/^[a-z][a-z0-9+.-]*:/i.test(t)&&!t.startsWith(`//`)&&(z(`该链接超出工作区,请在原仓库查看。`),!0);if(D(n.path))return z(`配置文件不在文件浏览中显示。`),!0;if(C(n.path))return location.assign(l(`/projects/${o}/memory`)),!0;let[r,...i]=n.path.split(`/`),a=e.some(e=>e.id===r),c=a?r:w,u=a?i.join(`/`):n.path;return V(``),n.directory?(G(c,u),P({owner:c,path:u,kind:`directory`})):c===s.owner&&u===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`}):K(c,u),!0}return(0,M.jsx)(_,{"data-testid":`file-browser`,label:`文件资源管理器`,navigation:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(v,{title:`工作区`,children:(0,M.jsx)(u,{icon:`refresh`,label:`刷新文件`,"data-testid":`files-refresh`,onClick:()=>{V(``),R(e=>e+1),U.reload(),t()}})}),(0,M.jsx)(k,{members:e,expanded:g,selected:T,revealed:!U.loading&&!U.error&&W?{owner:W.owner,path:W.file.path,file:W.file}:void 0,onSelect:K,onToggle:(e,t)=>{P({owner:e,path:t,kind:`directory`}),S(n=>{let r=new Set(n),i=E(e,t);return r.has(i)?r.delete(i):r.add(i),r})}},L)]}),children:(0,M.jsxs)(`section`,{className:`file-detail`,"data-testid":`file-preview`,"data-owner-id":s?.owner,"data-file-path":s?.path,"aria-label":n.filePreview,children:[W&&(0,M.jsx)(m,{message:U.error}),W?(0,M.jsx)(I,{owner:W.owner,file:W.file,onLink:q},`${W.owner}:${W.file.path}:${W.file.sha256}`):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(F,{target:s}),(0,M.jsxs)(`div`,{className:`reader-body`,children:[(0,M.jsx)(h,{announce:!0,retry:U.error?U.reload:void 0,children:B||U.error}),s&&U.loading&&(0,M.jsx)(`p`,{className:`preview-body`,role:`status`,children:n.loading}),!s&&!B&&(0,M.jsx)(d,{mascot:!0,title:`查看工作区文件`,description:n.pickFile})]})]})]})})}function F({target:e,children:t}){let r=e&&(O(e.owner)?`teamcontext`:e.owner);return(0,M.jsx)(g,{title:e?(0,M.jsxs)(`h2`,{className:`file-detail-path`,title:`${r}/${e.path}`,children:[(0,M.jsxs)(`span`,{children:[r,` / `]}),e.path]}):n.filePreview,actions:t})}function I({owner:t,file:r,onLink:i}){let{readTextBlob:l,blobUrl:d,projectId:f}=y(),[g,_]=(0,j.useState)(!1),[v,b]=(0,j.useState)(!1),x=p(),C=`teamcontext/${O(t)?``:`${t}/`}${r.path}`,w=r.size>524288,E=/\.(md|markdown)$/i.test(r.path),D=/\.html?$/i.test(r.path),k=(0,j.useCallback)(e=>w?Promise.resolve(void 0):l(r,e),[r.sha256,r.size,w]),A=a(k,!1,e(f,`file-body`,r.sha256));return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(F,{target:{owner:t,path:r.path},children:(0,M.jsxs)(c,{label:`文件操作`,children:[(E||D)&&(0,M.jsx)(u,{icon:g?`preview`:`code`,label:g?`切换为预览`:`切换为原文`,"data-testid":`file-toggle-raw`,"aria-pressed":g,onClick:()=>_(!g)}),(0,M.jsx)(`a`,{className:`icon-button`,"data-testid":`file-download`,"aria-label":n.download,title:n.download,href:d(r.sha256),download:r.path.split(`/`).at(-1),children:(0,M.jsx)(s,{name:`download`})}),(0,M.jsx)(u,{icon:v?`check`:`link`,label:v?`已复制路径`:`复制工作区相对路径`,"data-testid":`file-copy-path`,onBlur:()=>b(!1),onClick:async()=>{x(``);try{await o(C),b(!0)}catch{b(!1),x(`未能复制文件路径,请重试。`)}}})]})}),(0,M.jsxs)(`div`,{className:`reader-body`,children:[A.data!==void 0&&(0,M.jsx)(m,{message:A.error}),w?(0,M.jsx)(`div`,{className:`empty`,children:(0,M.jsx)(`p`,{children:n.previewLarge})}):A.error&&A.data===void 0?(0,M.jsx)(`div`,{className:`preview-body`,children:(0,M.jsx)(h,{announce:!0,retry:A.reload,children:A.error})}):A.loading&&A.data===void 0?(0,M.jsx)(`p`,{className:`preview-body`,role:`status`,children:n.loading}):(0,M.jsx)(`div`,{className:`preview-body${D&&!g?` preview-body-html`:``}`,children:D&&!g?(0,M.jsx)(T,{url:d(r.sha256),name:r.path.split(`/`).at(-1)}):E&&!g?(0,M.jsx)(`article`,{className:`markdown`,"data-testid":`file-content`,"data-format":`markdown`,children:(0,M.jsx)(S,{onLink:i,children:A.data??``})}):(0,M.jsx)(`pre`,{className:`raw`,"data-testid":`file-content`,"data-format":`text`,children:A.data})})]})]})}export{P as Files};
@@ -1,4 +1,4 @@
1
- import{At as e,B as t,E as n,Ft as r,M as i,O as a,P as o,i as s,o as c}from"./Dropdown-DGFI68Vd.js";import{F as l,I as u,L as d,V as f,i as p,n as m}from"./index-BZEKT27U.js";import{t as h}from"./Markdown-gPLWRWEJ.js";var g=`# 帮助
1
+ import{At as e,B as t,E as n,Ft as r,M as i,O as a,P as o,i as s,o as c}from"./Dropdown-DGFI68Vd.js";import{F as l,I as u,L as d,V as f,i as p,n as m}from"./index-mhJ33-bH.js";import{t as h}from"./Markdown-CXnZDm5J.js";var g=`# 帮助
2
2
 
3
3
  网页目录按 [index.json](index.json) 中的分组和文章顺序展示。
4
4
 
@@ -95,7 +95,8 @@ import{At as e,B as t,E as n,Ft as r,M as i,O as a,P as o,i as s,o as c}from"./D
95
95
  | 26/11/19 | v0.2.19 | 支持自动更新;修复已知问题。 |
96
96
  | 26/11/20 | v0.2.20 | 电脑接入 CB、DSH;整合 OAR 能力;统一报错交互。 |
97
97
  | 26/11/23 | v0.2.21 | 支持定时与周期计划;文件预览修复。 |
98
- | 26/11/23 | v0.2.22 | 支持浏览器通知与会话标签页提醒;统一页面标题;简化附件上传,支持复制工作区文件路径。 |
98
+ | 26/11/23 | v0.2.22 | 支持通知提醒;交互改进。 |
99
+ | 26/11/24 | v0.2.23 | 统一成员请求与答复回执;支持 Tim 代问及本地 Agent 跨成员提问,答案自动回到原会话,支持离线恢复。 |
99
100
  `,v=`# 让开发 Agent 使用 Teammy
100
101
 
101
102
  正在使用的开发 Agent 可以通过 Teammy 查询任务、资料和历史会话。开始一项工作前,让 Agent 查找团队已有的结论,有助于减少重复摸索。
@@ -197,6 +198,14 @@ teammy agent register --provider codex --cwd .
197
198
 
198
199
  工作记录仍通过 \`teamcontext/\` 同步到[工作区和看板](../workspace/work-records.md)。
199
200
 
201
+ ### 向团队成员询问信息
202
+
203
+ 可以让当前会话中的 Agent 请 Tim 向某位成员提问,例如:“请向 bob 本人确认评测集版本,拿到答案后继续当前分析。”Agent 通过内部 \`request_team_agent\` 发起,Tim 将问题交给对应成员。需要本人决定的内容仍由本人回答。
204
+
205
+ 成员答复后,答案自动排队进入发起请求的同一个会话,不打断当前轮,也不重新选择默认会话。开发机离线时答案会保存,恢复连接后继续投递。取消自动接单不会改变这条关联;原会话已隐藏、归档或不可用时,答案保留但不改投其他会话。
206
+
207
+ 普通团队查询可读取已有咨询结果;“Tim 已经发出问题”与“成员已经回答”分别呈现。此能力属于 Teammy 托管会话,独立配置的查询 MCP 不增加向 Tim 提问入口。
208
+
200
209
  需要稍后继续或周期检查时,可直接向会话说明时间、目标和停止条件。Agent 通过工具保存计划,到期后按队列继续原会话;也可以随时要求查询、暂停或取消。见[定时与周期工作](schedules.md)。
201
210
 
202
211
  ### 导入已有会话
@@ -431,6 +440,10 @@ Tim 会结合项目中的任务、工作记录、会话和资料,帮助查阅
431
440
 
432
441
  Tim 发给你的个人通知也会出现在「对话」中,例如需要确认的问题、工作提醒或评审结论。打开通知后,可以继续回复,补充信息或说明自己的决定。
433
442
 
443
+ 需要答复的请求会在提交后显示「回复已记录」。答案会自动回到提问来源:发起人的 Tim 私聊、正在跟进的事项,或发起提问的本地 Agent 会话。每位收件人的一次答复完成对应请求;已答复的请求不会因重复提交再次触发处理,后续追问另发请求。
444
+
445
+ 例如,你可以告诉 Tim:“帮我问一下 bob,评测集是否已更新。”对方回复后,Tim 会在你原来的对话中继续反馈,无需再次催问。
446
+
434
447
  ## 群聊与频道
435
448
 
436
449
  ### 群聊
@@ -470,6 +483,8 @@ Tim 发给你的个人通知也会出现在「对话」中,例如需要确认
470
483
 
471
484
  绑定后,直接向 Tim 发送问题即可。主动私聊通知在「设置 → 消息与通知」中按类别开启;未开启时仍可在网页查看,主动提问的回复照常返回企微。收到工作通知时,引用原消息回复,可以接着处理对应事项;原消息和回复也可以在网页「对话」中查看。
472
485
 
486
+ 对于需要回答的请求,引用题面提交答案后会收到「回复已记录」。答案会自动回到原提问会话;这个回执表示答案已保存,不表示后续工作已经完成。同一个请求只接收一次有效答复。没有引用且无法确定对应问题时,请打开原消息的网页链接回复。
487
+
473
488
  发送 \`/new\` 可以开始新话题。如果连接了多个项目,发送 \`/projects\` 查看项目,再按提示用 \`/use\` 切换。其他命令可以通过 \`/help\` 查看。
474
489
 
475
490
  ## 在群聊中讨论