@teammy/server 0.1.1 → 0.1.3

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.
@@ -0,0 +1 @@
1
+ main#main[data-page=assistant]{height:100dvh;padding:0}.assistant-layout{grid-template-columns:var(--pane-width) minmax(0, 1fr);height:100%;min-height:0}.assistant-list{border-right:1px solid var(--color-line);background:var(--color-surface);flex-direction:column;min-height:0;display:flex}.assistant-list-heading,.assistant-thread-heading{border-bottom:1px solid var(--color-line);flex:0 0 76px;justify-content:space-between;align-items:center;padding:0 24px;display:flex}.assistant-list-heading h1{margin:0;font-size:20px}.assistant-thread-heading h2{text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:17px;overflow:hidden}.assistant-message-scroll{flex:1;min-height:0;overflow-y:auto}.assistant-list-status{color:var(--color-muted);font-size:var(--text-sm);margin:20px 24px}.assistant-message-item{border:0;border-bottom:1px solid var(--color-line);text-align:left;width:100%;color:var(--color-text);background:0 0;border-radius:0;align-items:center;gap:12px;padding:20px 24px;display:flex}.assistant-message-item:hover{background:var(--color-hover)}.assistant-message-item.selected{background:var(--color-soft)}.assistant-message-item.archived{color:var(--color-muted)}.assistant-message-item.archived strong{font-weight:400}.assistant-entry-footer{border-top:1px solid var(--color-line);background:var(--color-surface);flex-shrink:0}.assistant-launcher{width:100%;min-height:76px;color:var(--color-text);text-align:center;background:0 0;border:0;border-radius:0;justify-content:center;align-items:center;margin:0;padding:0 24px;display:flex}.assistant-launcher:hover{background:var(--color-hover)}.assistant-launcher:focus-visible{outline-offset:-4px}.assistant-launcher .selection-content{padding:12px 18px}.assistant-launcher .mascot{flex-shrink:0;width:31.5px;height:47.7px}.assistant-launcher-copy{white-space:nowrap;font-size:16px}.assistant-message-copy{flex-direction:column;flex:1;gap:6px;min-width:0;display:flex}.assistant-message-copy>.selection-content{width:fit-content;max-width:100%;color:var(--color-text);margin:-5px -8px;padding:5px 8px;display:block;overflow:visible}.assistant-message-item.archived .selection-content{color:inherit}.assistant-message-copy .selection-inner{min-width:0;display:block}.assistant-message-copy .selection-inner strong{display:block}.assistant-message-copy strong,.assistant-message-copy>span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.assistant-message-copy strong{font-size:var(--text-base);font-weight:600}.assistant-message-copy>span,.assistant-message-copy time{font-size:var(--text-xs);color:var(--color-muted)}.assistant-message-dot{border-radius:50%;flex:0 0 7px;width:7px;height:7px}.assistant-message-dot.unread{background:var(--brand-orange)}.assistant-thread{background:var(--color-canvas);flex-direction:column;min-width:0;min-height:0;display:flex}.assistant-transcript{flex:1;min-height:0;padding:28px clamp(20px,4vw,64px);overflow-y:auto}.assistant-bubble-row{margin:0 0 24px;display:flex}.assistant-bubble-row.mine{justify-content:flex-end}.assistant-bubble{border-radius:4px var(--radius-lg) var(--radius-lg);background:var(--color-soft);overflow-wrap:anywhere;min-width:100px;max-width:min(88%,800px);padding:14px 18px}.assistant-bubble-row.mine .assistant-bubble{background:var(--color-accent-soft);border-radius:var(--radius-lg) 4px var(--radius-lg) var(--radius-lg)}.assistant-bubble-meta{font-size:var(--text-xs);color:var(--color-muted);align-items:baseline;gap:16px;margin-bottom:8px;display:flex}.assistant-debug-reply{font-size:var(--text-xs);background:var(--color-surface);margin-top:12px;padding:4px 10px}.assistant-bubble .markdown>:first-child{margin-top:0}.assistant-bubble .markdown>:last-child{margin-bottom:0}.assistant-bubble .markdown{font-size:var(--text-base);line-height:1.75}.assistant-bubble pre{max-width:100%;overflow-x:auto}.assistant-composer{background:var(--color-surface);border:1px solid var(--color-line);border-radius:var(--radius-lg);align-items:flex-end;gap:12px;margin:0 28px 28px;padding:12px;display:flex}.assistant-reply-hint{font-size:var(--text-xs);color:var(--color-muted);margin:0 28px 10px;line-height:1.7}.assistant-composer:focus-within{border-color:var(--color-muted)}.assistant-composer textarea{box-shadow:none;resize:vertical;background:0 0;border:0;flex:1;min-height:56px;max-height:220px;padding:8px}.assistant-composer textarea:focus{box-shadow:none;outline:none}.assistant-send{flex:0 0 40px;place-items:center;width:40px;height:40px;padding:0;display:grid}.assistant-empty{height:100%;min-height:240px;color:var(--color-muted);flex-direction:column;justify-content:center;align-items:center;gap:20px;display:flex}.assistant-empty .mascot{width:96px;height:144px}.assistant-empty p{margin:0}.assistant-archived{color:var(--color-muted);font-size:var(--text-sm);justify-content:center;align-items:center;gap:8px;padding:24px;display:flex}.assistant-thread>.notice{margin:0 28px 12px}.assistant-typing{gap:5px;padding:8px 0;display:inline-flex}.assistant-typing i{background:var(--color-muted);border-radius:50%;width:5px;height:5px;animation:1.4s infinite assistant-pulse}.assistant-typing i:nth-child(2){animation-delay:.15s}.assistant-typing i:nth-child(3){animation-delay:.3s}@keyframes assistant-pulse{0%,70%,to{opacity:.35}35%{opacity:1}}@media (prefers-reduced-motion:reduce){.assistant-typing i{animation:none}}@media (width<=900px){.assistant-layout{grid-template-columns:240px minmax(0,1fr)}.assistant-message-item{padding:16px}.assistant-composer{margin:0 16px 16px}.assistant-reply-hint{margin:0 16px 10px}.assistant-launcher{padding:0 12px}.assistant-bubble{max-width:96%}}@media (width<=600px){.assistant-layout{grid-template-columns:150px minmax(0,1fr)}.assistant-list-heading,.assistant-thread-heading{padding:0 12px}.assistant-launcher{padding:0 4px}.assistant-launcher .selection-content{padding:12px 6px}.assistant-launcher .selection-inner{gap:4px}.assistant-launcher-copy{font-size:12px}.assistant-transcript{padding:16px 10px}.assistant-composer{gap:4px;margin:0 8px 12px;padding:6px}.assistant-reply-hint{margin:0 8px 10px}}
@@ -0,0 +1 @@
1
+ import{D as e,E as t,J as n,O as r,U as ee,W as te,Y as ne,_ as i,a,d as o,i as re,j as s,k as c,l as ie,n as l,r as u,t as ae,u as oe,x as d,y as f}from"./index-DC8a4uzu.js";import{t as p}from"./Markdown-DD5hV21X.js";var m=n(),h=c(),g=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),_=e=>e.replace(/[#*_`>]/g,``).replace(/\s+/g,` `).trim();function v({mine:e=!1,author:t,time:n,children:r}){return(0,h.jsx)(`div`,{className:`assistant-bubble-row ${e?`mine`:``}`,children:(0,h.jsxs)(`div`,{className:`assistant-bubble`,children:[(0,h.jsxs)(`div`,{className:`assistant-bubble-meta`,children:[(0,h.jsx)(`span`,{children:t}),(0,h.jsx)(`time`,{dateTime:n,children:g(n)})]}),r]})})}function y({me:n}){let{projectId:c,request:y}=ie(),x=r(),S=e(c,n,`assistant-selection`),C=e(c,n,`assistant-drafts`),se=(0,m.useCallback)(e=>y(`agents/outbox`,re,{signal:e}),[y]),w=t(se,3e3,e(c,n,`outbox`)),ce=(0,m.useCallback)(e=>y(`agents/chats`,ae,{signal:e}),[y]),T=t(ce,3e3,e(c,n,`chats`)),[E,le]=(0,m.useState)(()=>{let e=new URLSearchParams(location.search).get(`chat`);return e?`chat:${e}`:x?.get(S)??``}),D=E.startsWith(`chat:`)?E.slice(5):``,O=!E||!!D,[k,A]=(0,m.useState)(()=>x?.get(e(c,n,`chat`,D))),j=k?.id===D?k:x?.get(e(c,n,`chat`,D)),ue=T.data?.chats.find(e=>e.id===D),[de,M]=(0,m.useState)(),[N,fe]=(0,m.useState)(()=>x?.get(C)??{}),P=N[E]??``,F=e=>fe(t=>({...t,[E]:e})),[I,L]=(0,m.useState)(!1),[R,z]=(0,m.useState)(!1),[pe,B]=(0,m.useState)(``),[V,H]=(0,m.useState)(``),U=(0,m.useRef)(null),W=(0,m.useRef)(!0),G=(0,m.useRef)(E);G.current=E,(0,m.useEffect)(()=>{k&&x?.set(e(c,n,`chat`,k.id),k)},[x,c,n,k]),(0,m.useEffect)(()=>{x?.set(C,N)},[x,C,N]);function K(e){G.current=e,le(e),x?.set(S,e);let t=new URL(location.href);e.startsWith(`chat:`)?t.searchParams.set(`chat`,e.slice(5)):t.searchParams.delete(`chat`),history.replaceState(history.state,``,t)}(0,m.useEffect)(()=>{!E&&T.data?.chats.length&&K(`chat:${T.data.chats[0].id}`)},[E,T.data]);let q=(w.data?.messages??[]).filter(e=>e.box===`debug`).reverse(),J=w.data?.messages.find(e=>e.id===(E===`debug`?de:E)),Y=q.filter(e=>!e.readAt).map(e=>e.id).join(`,`);(0,m.useEffect)(()=>{E===`debug`&&Y&&Promise.all(Y.split(`,`).map(e=>y(`agents/outbox/${e}/read`,a,{method:`POST`}))).then(()=>{window.dispatchEvent(new Event(`teammy:outbox`)),w.reload()}).catch(e=>B(s(e)))},[E,Y,y,w.reload]),(0,m.useEffect)(()=>{if(H(``),!D)return;let e=!0,t=new EventSource(ne(`/api/v1/projects/${encodeURIComponent(c)}/agents/chats/${encodeURIComponent(D)}/events`));t.addEventListener(`snapshot`,t=>{if(e)try{A(l.parse(JSON.parse(t.data))),H(``)}catch(e){H(s(e))}}),t.onerror=()=>{e&&H(`对话连接中断,正在重新连接…`)},t.addEventListener(`run`,t=>{if(!e)return;let n=u.parse(JSON.parse(t.data));A(e=>e&&{...e,runs:e.runs.some(e=>e.id===n.id)?e.runs:[...e.runs,n]})});for(let n of[`delta`,`reset`,`state`])t.addEventListener(n,t=>{if(!e)return;let r=JSON.parse(t.data);A(e=>e&&{...e,runs:e.runs.map(e=>e.id===r.id?{...e,answer:n===`delta`?e.answer+(r.text??``):n===`reset`?``:r.answer??e.answer,state:r.state??e.state,error:r.error===void 0?e.error:r.error}:e)})});return()=>{e=!1,t.close()}},[c,D]),(0,m.useEffect)(()=>{W.current&&U.current?.scrollIntoView({block:`end`})},[E,k?.runs,J?.recipients,q.length]);function X(){window.dispatchEvent(new Event(`teammy:outbox`)),w.reload()}async function Z(e){if(W.current=!0,K(e),B(``),M(void 0),!(e.startsWith(`chat:`)||e===`debug`))try{await y(`agents/outbox/${e}/read`,a,{method:`POST`}),X()}catch(e){B(s(e))}}async function me(){if(!R){z(!0),B(``);try{let e=await y(`agents/chats`,l,{method:`POST`});A(e),await Z(`chat:${e.id}`),T.reload()}catch(e){B(s(e))}finally{z(!1)}}}async function he(e){e.preventDefault();let t=P.trim();if(t&&!I){L(!0),B(``);try{if(O){let e=D;if(!e){let t=await y(`agents/chats`,l,{method:`POST`});e=t.id,G.current===E&&(A(t),K(`chat:${e}`))}let n=await y(`agents/chats/${e}`,u,{method:`POST`,body:{text:t}});A(t=>t?.id===e?{...t,runs:t.runs.some(e=>e.id===n.id)?t.runs:[...t.runs,n]}:t),T.reload()}else await y(`agents/outbox/${J.id}/reply`,te({taskId:ee()}),{method:`POST`,body:{body:t}}),X(),M(void 0);F(``)}catch(e){B(s(e))}finally{L(!1)}}}let Q=O||!!J&&!J.archivedAt&&!J.recipients.find(e=>e.userId===n)?.reply,$=O&&!j&&(!!D||!T.data);return(0,h.jsxs)(`div`,{className:`split-layout assistant-layout`,"data-testid":`assistant-page`,children:[(0,h.jsxs)(`aside`,{className:`assistant-list`,"aria-label":`消息列表`,children:[(0,h.jsx)(`header`,{className:`assistant-list-heading`,children:(0,h.jsx)(`h1`,{children:`消息`})}),(0,h.jsxs)(`div`,{className:`assistant-message-scroll`,children:[T.loading&&!T.data&&(0,h.jsx)(`p`,{className:`assistant-list-status`,role:`status`,children:`加载中…`}),T.data?.chats.map(e=>(0,h.jsxs)(`button`,{type:`button`,"data-testid":`assistant-chat-${e.id}`,className:`assistant-message-item assistant-chat-item ${D===e.id?`selected`:``}`,"aria-pressed":D===e.id,onClick:()=>void Z(`chat:${e.id}`),children:[(0,h.jsx)(`span`,{className:`assistant-message-dot ${e.state===`running`||e.state===`queued`?`unread`:``}`}),(0,h.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,h.jsx)(o,{selected:D===e.id,children:(0,h.jsx)(`strong`,{children:e.title})}),(0,h.jsxs)(`time`,{dateTime:e.updatedAt,children:[new Date(e.updatedAt).toLocaleDateString([],{month:`numeric`,day:`numeric`}),` `,g(e.updatedAt)]})]})]},e.id)),!!q.length&&(0,h.jsxs)(`button`,{type:`button`,"data-testid":`debug-outbox`,className:`assistant-message-item ${E===`debug`?`selected`:``}`,onClick:()=>void Z(`debug`),children:[(0,h.jsx)(`span`,{className:`assistant-message-dot ${Y?`unread`:``}`}),(0,h.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,h.jsx)(o,{selected:E===`debug`,children:(0,h.jsx)(`strong`,{children:`运行提醒`})}),(0,h.jsx)(`span`,{children:_(q.at(-1).body)})]})]}),w.data?.messages.filter(e=>e.box!==`debug`).sort((e,t)=>Number(!!e.archivedAt)-Number(!!t.archivedAt)).map(e=>(0,h.jsxs)(`button`,{type:`button`,"data-testid":`outbox-${e.id}`,className:`assistant-message-item ${e.archivedAt?`archived`:``} ${E===e.id?`selected`:``}`,onClick:()=>void Z(e.id),children:[(0,h.jsx)(`span`,{className:`assistant-message-dot ${e.readAt?``:`unread`}`}),(0,h.jsxs)(`span`,{className:`assistant-message-copy`,children:[(0,h.jsx)(o,{selected:E===e.id,children:(0,h.jsx)(`strong`,{children:_(e.body)})}),(0,h.jsxs)(`time`,{dateTime:e.createdAt,children:[new Date(e.createdAt).toLocaleDateString([],{month:`numeric`,day:`numeric`}),` `,g(e.createdAt)]})]})]},e.id))]}),(0,h.jsx)(d,{error:!0,children:w.error||T.error}),(0,h.jsx)(`footer`,{className:`assistant-entry-footer`,children:(0,h.jsxs)(oe,{className:`assistant-launcher`,disabled:R,onClick:()=>void me(),"data-testid":`assistant-launcher`,children:[(0,h.jsx)(f,{}),(0,h.jsx)(`strong`,{className:`assistant-launcher-copy`,children:`与提百事聊聊`})]})})]}),(0,h.jsxs)(`section`,{className:`assistant-thread`,"aria-label":O?`提百事对话`:`消息内容`,children:[(0,h.jsx)(`header`,{className:`assistant-thread-heading`,children:(0,h.jsx)(`h2`,{children:O?ue?.title??(D?`无标题`:`提百事`):E===`debug`?`运行提醒`:`项目消息`})}),(0,h.jsxs)(`div`,{className:`assistant-transcript`,role:`log`,"aria-live":`polite`,"data-testid":`assistant-transcript`,onScroll:e=>{let t=e.currentTarget;W.current=t.scrollHeight-t.scrollTop-t.clientHeight<100},children:[O?$?(0,h.jsxs)(`div`,{className:`assistant-empty`,"data-testid":`assistant-loading`,children:[(0,h.jsx)(f,{}),(0,h.jsx)(`p`,{role:`status`,children:V||T.error?`暂时无法加载对话`:`加载中…`})]}):j?.runs.length?j.runs.map(e=>(0,h.jsxs)(`div`,{className:`assistant-turn`,children:[(0,h.jsx)(v,{mine:!0,author:n,time:e.createdAt,children:(0,h.jsx)(`div`,{className:`markdown`,children:(0,h.jsx)(p,{children:e.text})})}),(0,h.jsxs)(v,{author:`提百事`,time:e.createdAt,children:[e.answer&&(0,h.jsx)(`div`,{className:`markdown`,children:(0,h.jsx)(p,{children:e.answer})}),[`queued`,`running`].includes(e.state)&&(0,h.jsxs)(`span`,{className:`assistant-typing`,"aria-label":`正在回答`,children:[(0,h.jsx)(`i`,{}),(0,h.jsx)(`i`,{}),(0,h.jsx)(`i`,{})]}),e.state===`failed`&&(0,h.jsx)(d,{error:!0,children:e.error||`本次回答未完成。`})]})]},e.id)):(0,h.jsxs)(`div`,{className:`assistant-empty`,children:[(0,h.jsx)(f,{}),(0,h.jsx)(`p`,{children:`有什么项目问题想聊聊?`})]}):!w.data&&w.loading?(0,h.jsx)(`div`,{className:`assistant-empty`,children:(0,h.jsx)(`p`,{role:`status`,children:`加载中…`})}):E===`debug`?q.map(e=>(0,h.jsx)(b,{item:e,me:n,onReply:!e.archivedAt&&!e.recipients.find(e=>e.userId===n)?.reply?()=>{M(e.id),F(``),B(``)}:void 0},e.id)):J&&(0,h.jsx)(b,{item:J,me:n}),(0,h.jsx)(`div`,{ref:U})]}),(0,h.jsx)(d,{error:!0,children:pe||(O?V:``)}),Q&&!O&&(0,h.jsx)(`p`,{className:`assistant-reply-hint`,id:`assistant-reply-hint`,children:E===`debug`?`回复运行提醒:${_(J.body).split(`诊断码`)[0]}。发送后将作为新的后台输入。`:`回应「提百事」的问题。注意:只能发送一条消息,「提百事」收到后会继续工作。如果有新的问题,「提百事」会继续发消息来问你。`}),Q?(0,h.jsxs)(`form`,{className:`assistant-composer`,onSubmit:e=>void he(e),children:[(0,h.jsx)(`textarea`,{value:P,onChange:e=>F(e.target.value),"aria-label":O?`向提百事提问`:`回复消息`,"aria-describedby":O?void 0:`assistant-reply-hint`,placeholder:O?`问问提百事…`:`回复…`,rows:2,onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,h.jsx)(`button`,{className:`primary assistant-send`,type:`submit`,disabled:I||$||!P.trim(),"aria-label":`发送`,children:(0,h.jsx)(i,{name:`send`})})]}):E!==`debug`&&J&&(0,h.jsxs)(`div`,{className:`assistant-archived`,children:[(0,h.jsx)(i,{name:`archive`}),`已归档`]})]})]})}function b({item:e,me:t,onReply:n}){return(0,h.jsxs)(`div`,{"data-testid":`outbox-thread-${e.id}`,children:[(0,h.jsxs)(v,{author:e.box===`debug`?`运行提醒`:`提百事`,time:e.createdAt,children:[(0,h.jsx)(`div`,{className:`markdown`,children:(0,h.jsx)(p,{children:e.body})}),n&&(0,h.jsx)(`button`,{type:`button`,className:`assistant-debug-reply`,onClick:n,children:`回复`})]}),[...e.recipients].filter(e=>e.reply).sort((e,t)=>e.reply.createdAt.localeCompare(t.reply.createdAt)).map(e=>(0,h.jsx)(v,{mine:e.userId===t,author:e.userId,time:e.reply.createdAt,children:(0,h.jsx)(`div`,{className:`markdown`,children:(0,h.jsx)(p,{children:e.reply.body})})},e.userId))]})}export{y as Assistant};
@@ -0,0 +1 @@
1
+ .task-board{min-width:0}.task-board .page-header{align-items:flex-start;margin-bottom:40px}.task-board .page-header>div{min-width:0}.task-board .page-header h1,.task-board .page-header p{overflow-wrap:anywhere}.task-board-lanes{grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr));align-items:start;gap:24px;margin-bottom:32px;display:grid}.task-lane{min-width:0}.task-lane h2{font-size:var(--text-base);border-bottom:1px solid var(--color-line);align-items:center;gap:10px;padding:0 0 16px;font-weight:600;display:flex}.task-lane .count{margin-left:auto}.task-lane-content{flex-direction:column;gap:12px;padding-top:16px;display:flex}.lane-dot{border:1.5px solid var(--color-muted);border-radius:50%;width:8px;height:8px}.task-lane[data-stage=in_progress] .lane-dot{border-color:var(--brand-orange);background:var(--brand-orange)}.task-lane[data-stage=in_review] .lane-dot{border-color:var(--brand-black);background:var(--brand-black)}.task-lane[data-stage=completed] .lane-dot{border-color:var(--color-muted);background:var(--color-muted)}.task-lane-empty{font-size:var(--text-xs);color:var(--color-muted);padding:44px 0}.task-card{border:1px solid var(--color-line);border-radius:var(--radius-md);background:var(--color-surface);overflow-wrap:anywhere;min-width:0;position:relative}.task-card>.task-card-heading{border-radius:inherit;padding:16px;list-style:none;position:relative}.task-card-heading::-webkit-details-marker{display:none}.task-card-heading:hover{background:var(--color-soft)}.task-card[open]>.task-card-heading{padding-right:48px}.task-card-meta{flex-wrap:wrap;align-items:center;gap:8px;margin-top:8px;display:flex}.task-confirmation{border-radius:var(--radius-sm);background:var(--color-accent-soft);color:var(--brand-orange);font-size:calc(var(--text-xs) - 1px);align-items:center;gap:3px;padding:0 4px;font-weight:400;line-height:18px;display:inline-flex}.task-confirmation .icon{width:12px;height:12px}.task-card-confirm{flex-direction:column;align-items:flex-end;gap:8px;margin-top:16px;display:flex}.task-card-confirm button{min-height:32px;font-size:var(--text-xs);padding:4px 12px}.task-status-field legend{font-size:var(--text-sm);margin-bottom:8px;font-weight:600}.task-status-options{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;display:grid}.task-status-choice{cursor:pointer;position:relative}.task-status-choice input{opacity:0;width:100%;height:100%;min-height:0;cursor:inherit;position:absolute;inset:0}.task-status-choice span{border:1px solid var(--color-line);border-radius:var(--radius-md);background:var(--color-surface);min-height:36px;font-size:var(--text-sm);justify-content:center;align-items:center;font-weight:550;display:flex}.task-status-choice:hover span{background:var(--color-soft)}.task-status-choice input:checked+span{border-color:var(--brand-black);background:var(--brand-black);color:var(--color-on-dark)}.task-status-choice input:focus-visible+span{outline:2px solid var(--brand-orange);outline-offset:3px}.task-status-choice input:disabled+span{opacity:.45;cursor:default}.task-card-heading h3{font-size:var(--text-base);font-weight:650;line-height:1.55}.task-card-edit{opacity:0;pointer-events:none;position:absolute;top:10px;right:8px}.task-card[open]:hover>.task-card-edit{opacity:1;pointer-events:auto}.task-card[open]:has(:focus-visible)>.task-card-edit{opacity:1;pointer-events:auto}.task-progress{font-size:var(--text-sm);white-space:pre-wrap;line-height:1.85}.task-card small{color:var(--color-muted);font-size:var(--text-xs)}.task-card-details{padding:0 16px 16px}.task-card-details h4{font-size:var(--text-xs);margin:16px 0 4px;font-weight:600}.task-card-details p{font-size:var(--text-sm);margin:0}.task-card-sources{flex-direction:column;align-items:flex-start;gap:8px;margin:16px 0;display:flex}.task-card-sources a{text-align:left;overflow-wrap:anywhere;max-width:100%;font-size:var(--text-xs);min-height:28px;color:var(--color-muted);justify-content:flex-start;gap:8px;padding:4px 0;text-decoration:none;display:inline-flex}.task-card-sources a:hover{color:var(--color-link);text-decoration:underline}.task-mention{border-radius:var(--radius-sm);background:var(--color-accent-soft);color:inherit;padding:0 2px}
@@ -0,0 +1 @@
1
+ import{D as e,E as t,J as n,S as r,T as i,Y as a,_ as o,b as s,f as c,g as l,j as u,k as d,l as f,m as p,p as m,v as h,w as g,x as _}from"./index-DC8a4uzu.js";import{t as v}from"./project-links-XbF78Bal.js";import"./file-links-Qi15HqFr.js";var y=n(),b=d(),x=[{status:`planned`,label:`计划`},{status:`in_progress`,label:`进行中`},{status:`in_review`,label:`待验收`},{status:`completed`,label:`已完成`},{status:null,label:`未明确`}];function S({members:n,project:i}){let{request:a,projectId:o}=f(),s=(0,y.useCallback)(e=>a(`tasks`,c,{signal:e}),[a]),l=t(s,3e3,e(o,`tasks`)),[u,d]=(0,y.useState)(),m=l.data,h=new Map(n.map(e=>[e.id,e.displayName||e.id]));return(0,b.jsxs)(`div`,{className:`task-board`,children:[(0,b.jsx)(r,{title:i?.projectName.trim()?`${i.projectName.trim()}|工作看板`:`工作看板`,description:i?.description.trim()||``}),(0,b.jsx)(_,{error:!0,children:l.error}),(0,b.jsx)(`section`,{className:`task-board-lanes`,"aria-label":`任务进度`,"data-testid":`progress-board`,children:x.filter(e=>e.status!==null||m?.tasks.some(e=>e.status===null)).map(e=>{let t=m?.tasks.filter(t=>t.status===e.status)??[];return(0,b.jsxs)(`section`,{className:`task-lane`,"aria-label":e.label,"data-stage":e.status??`unknown`,children:[(0,b.jsxs)(`h2`,{children:[(0,b.jsx)(`span`,{className:`lane-dot`}),e.label,(0,b.jsx)(p,{children:m?t.length:`—`})]}),(0,b.jsx)(`div`,{className:`task-lane-content`,children:t.length?t.map(e=>(0,b.jsx)(C,{task:e,names:h,onEdit:()=>d(e),onSaved:()=>void l.reload()},e.id)):(0,b.jsx)(`p`,{className:`task-lane-empty`,children:l.error&&!m?`读取失败`:m?`暂无任务`:`读取中…`})})]},e.label)})}),u&&(0,b.jsx)(T,{task:u,onClose:()=>d(void 0),onSaved:()=>{d(void 0),l.reload()}},u.id)]})}function C({task:e,names:t,onEdit:n,onSaved:r}){let{projectId:s,request:c}=f(),l=i(),[d,p]=(0,y.useState)(!1),[x,S]=(0,y.useState)(``);async function C(){if(!d){p(!0),S(``);try{await c(`tasks/${e.id}/correction`,m,{method:`PATCH`,signal:l,body:{needsConfirmation:!1}}),l.aborted||r()}catch(e){l.aborted||S(u(e))}finally{p(!1)}}}return(0,b.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,b.jsxs)(`summary`,{className:`task-card-heading`,"data-testid":`task-toggle`,children:[(0,b.jsx)(`h3`,{children:e.title}),(0,b.jsxs)(`span`,{className:`task-card-meta`,children:[(0,b.jsx)(`small`,{children:t.get(e.owner)??e.owner}),e.needsConfirmation&&(0,b.jsxs)(`span`,{className:`task-confirmation`,"data-testid":`task-confirmation`,children:[(0,b.jsx)(o,{name:`attention`,size:`small`}),`需要确认`]})]})]}),(0,b.jsx)(h,{icon:`edit`,className:`task-card-edit`,label:`纠正任务:${e.title}`,"data-testid":`task-correct`,disabled:d,onClick:n}),(0,b.jsxs)(`div`,{className:`task-card-details`,children:[e.corrected&&!e.needsConfirmation&&(0,b.jsx)(`small`,{children:`已确认`}),e.needsReview&&(0,b.jsx)(`p`,{children:`本次整理未能明确对应,请核对来源。`}),(0,b.jsx)(`h4`,{children:`目标`}),(0,b.jsx)(`p`,{children:e.goal?(0,b.jsx)(w,{value:e.goal,names:t}):`目标未明确`}),(0,b.jsx)(`h4`,{children:`当前进展`}),(0,b.jsx)(`p`,{className:`task-progress`,children:(0,b.jsx)(w,{value:e.progress,names:t})}),(0,b.jsx)(`div`,{className:`task-card-sources`,children:e.sources.map(t=>(0,b.jsxs)(`a`,{"data-testid":`task-source`,href:a(v(s,e.owner,t.path)),children:[(0,b.jsx)(o,{name:`file`,size:`small`}),(0,b.jsx)(`span`,{children:t.path})]},t.path))}),e.syncedAt&&(0,b.jsxs)(`small`,{children:[`资料同步于 `,(0,b.jsx)(g,{value:e.syncedAt})]}),e.needsConfirmation&&(0,b.jsxs)(`div`,{className:`task-card-confirm`,children:[(0,b.jsx)(_,{error:!0,children:x}),(0,b.jsx)(`button`,{className:`primary`,"data-testid":`task-confirm-save`,disabled:d,onClick:()=>void C(),children:d?`正在保存…`:`保存`})]})]})]})}function w({value:e,names:t}){return e.split(/(@[a-z][a-z0-9_-]*)/gi).map((e,n)=>e.startsWith(`@`)&&t.has(e.slice(1))?(0,b.jsx)(`mark`,{className:`task-mention`,children:e},n):e)}function T({task:e,onClose:t,onSaved:n}){let{request:r}=f(),a=i(),[o,c]=(0,y.useState)(e.title),[d,p]=(0,y.useState)(e.status??``),[h,g]=(0,y.useState)(e.goal??``),[v,S]=(0,y.useState)(e.progress),[C,w]=(0,y.useState)(!1),[T,E]=(0,y.useState)(``),D={...o===e.title?{}:{title:o},...d===(e.status??``)?{}:{status:d||null},...h===(e.goal??``)?{}:{goal:h||null},...v===e.progress?{}:{progress:v},...e.needsConfirmation?{needsConfirmation:!1}:{}};async function O(t=!1){if(!(C||!t&&!Object.keys(D).length)){w(!0),E(``);try{await r(`tasks/${e.id}/correction`,m,{method:t?`DELETE`:`PATCH`,signal:a,...t?{}:{body:D}}),a.aborted||n()}catch(e){a.aborted||E(u(e))}finally{w(!1)}}}return(0,b.jsx)(s,{id:`task-correction`,title:`纠正任务`,onClose:t,children:(0,b.jsxs)(`form`,{className:`stack`,"aria-busy":C,onSubmit:e=>{e.preventDefault(),O()},children:[(0,b.jsx)(l,{id:`task-title`,label:`标题`,children:(0,b.jsx)(`input`,{value:o,required:!0,onChange:e=>c(e.target.value)})}),(0,b.jsxs)(`fieldset`,{className:`task-status-field`,disabled:C,children:[(0,b.jsx)(`legend`,{children:`状态`}),(0,b.jsx)(`div`,{className:`task-status-options`,"data-testid":`task-status`,children:x.filter(e=>e.status!==null).map(e=>(0,b.jsxs)(`label`,{className:`task-status-choice`,children:[(0,b.jsx)(`input`,{type:`radio`,name:`task-status`,value:e.status,checked:d===e.status,onChange:()=>p(e.status)}),(0,b.jsx)(`span`,{children:e.label})]},e.status))})]}),(0,b.jsx)(l,{id:`task-goal`,label:`目标`,children:(0,b.jsx)(`textarea`,{value:h,onChange:e=>g(e.target.value)})}),(0,b.jsx)(l,{id:`task-progress`,label:`当前进展`,children:(0,b.jsx)(`textarea`,{value:v,onChange:e=>S(e.target.value)})}),(0,b.jsx)(_,{error:!0,children:T}),(0,b.jsxs)(`div`,{className:`row wrap`,children:[(0,b.jsx)(`button`,{type:`submit`,className:`primary`,disabled:C||!Object.keys(D).length,"data-testid":`task-correction-save`,children:`保存`}),e.corrected&&(0,b.jsx)(`button`,{type:`button`,disabled:C,"data-testid":`task-correction-reset`,onClick:()=>void O(!0),children:`恢复自动结果`})]})]})})}function E({members:e,config:t}){return(0,b.jsx)(S,{members:e,project:t})}export{E as Dashboard};
@@ -0,0 +1 @@
1
+ import{A as e,C as t,D as n,E as r,F as i,J as a,N as o,Y as s,_ as c,c as l,h as u,k as d,l as f,o as p,s as m,v as h,x as g}from"./index-DC8a4uzu.js";import{t as _}from"./Markdown-DD5hV21X.js";import{t as v}from"./project-links-XbF78Bal.js";import{t as y}from"./file-links-Qi15HqFr.js";import{n as b,t as x}from"./WorkspaceTree-CeHWFFYr.js";var S=a(),C=d();function w(e,t){let n=t.split(`/`).slice(0,-1);return n.map((t,r)=>b(e,n.slice(0,r+1).join(`/`))).concat(b(e,``))}function T({members:t,me:n,onRefresh:a}){let{api:c,projectId:d}=f(),[_,T]=(0,S.useState)(()=>{let e=new URLSearchParams(location.search),n=e.get(`owner`),r=i.safeParse(e.get(`path`));return n&&(n===`_project`||t.some(e=>e.id===n))&&r.success&&!m(r.data)?{owner:n,path:r.data}:void 0}),[D,O]=(0,S.useState)(()=>new Set(_?w(_.owner,_.path):[b(n,``)])),[k,A]=(0,S.useState)(()=>_?{..._,kind:`file`}:void 0),[j,M]=(0,S.useState)(0),[N,P]=(0,S.useState)(()=>{let e=new URLSearchParams(location.search);return!_&&(e.has(`owner`)||e.has(`path`))?`文件链接不完整或目标已不可用。`:``}),F=(0,S.useCallback)(async t=>{if(_)try{return{owner:_.owner,...await c.file(_.owner,_.path,void 0,t)}}catch(t){throw t instanceof e&&t.code===`FILE_NOT_FOUND`?Error(`找不到这个文件,可能已被删除或移动。`):t}},[_?.owner,_?.path,j]),I=r(F),L=I.data?.owner===_?.owner&&I.data?.file.path===_?.path?I.data:void 0;function R(e,t){let n=t.split(`/`).filter(Boolean);O(t=>{let r=new Set(t);for(let t=0;t<=n.length;t++)r.add(b(e,n.slice(0,t).join(`/`)));return r})}function z(e,t){P(``),R(e,t.split(`/`).slice(0,-1).join(`/`)),T({owner:e,path:t}),A({owner:e,path:t,kind:`file`}),history.replaceState(null,``,s(v(d,e,t)))}function B(e){if(!_)return!1;let n=y(_.owner===`_project`?_.path:`${_.owner}/${_.path}`,e);if(!n)return!/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith(`//`)&&(P(`该链接超出工作区,请在原仓库查看。`),!0);if(m(n.path))return P(`配置文件不在文件浏览中显示。`),!0;let[r,...i]=n.path.split(`/`),a=t.some(e=>e.id===r),o=a?r:p,s=a?i.join(`/`):n.path;return P(``),n.directory?(R(o,s),A({owner:o,path:s,kind:`directory`})):o===_.owner&&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`}):z(o,s),!0}return(0,C.jsxs)(`div`,{className:`split-layout file-explorer`,"data-testid":`file-browser`,children:[(0,C.jsxs)(`aside`,{className:`file-tree-pane`,"aria-label":`文件资源管理器`,children:[(0,C.jsx)(l,{title:`文件`,icon:`files`,children:(0,C.jsx)(h,{icon:`refresh`,label:`刷新文件`,"data-testid":`files-refresh`,onClick:()=>{P(``),M(e=>e+1),a()}})}),(0,C.jsx)(x,{members:t,expanded:D,selected:k,revealed:!I.loading&&!I.error&&L?{owner:L.owner,path:L.file.path,file:L.file}:void 0,onSelect:z,onToggle:(e,t)=>{A({owner:e,path:t,kind:`directory`}),O(n=>{let r=new Set(n),i=b(e,t);return r.has(i)?r.delete(i):r.add(i),r})}},j)]}),(0,C.jsx)(`section`,{className:`file-detail`,"data-testid":`file-preview`,"data-owner-id":_?.owner,"data-file-path":_?.path,"aria-label":o.filePreview,children:_?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(g,{error:!0,children:N||!I.loading&&I.error}),I.error&&(0,C.jsx)(`button`,{className:`file-entry-retry`,"data-testid":`files-retry`,onClick:()=>void I.reload(),children:o.retry}),I.loading?(0,C.jsx)(`p`,{className:`preview-body`,role:`status`,children:o.loading}):!I.error&&L&&(0,C.jsx)(E,{owner:L.owner,file:L.file,onLink:B},`${L.owner}:${L.file.path}:${L.file.sha256}`)]}):N?(0,C.jsx)(g,{error:!0,children:N}):(0,C.jsx)(u,{mascot:!0,title:`从一份资料开始`,description:o.pickFile})})]})}function E({owner:e,file:i,onLink:a}){let{readTextBlob:s,blobUrl:l,projectId:u}=f(),[d,p]=(0,S.useState)(!1),m=i.size>524288,v=/\.(md|markdown)$/i.test(i.path),y=(0,S.useCallback)(e=>m?Promise.resolve(void 0):s(i,e),[i.sha256,i.size,m]),b=r(y,!1,n(u,`file-body`,i.sha256));return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`header`,{className:`file-detail-header`,children:[(0,C.jsxs)(`span`,{className:`file-detail-path`,title:`${e===`_project`?`workspaces`:e}/${i.path}`,children:[(0,C.jsxs)(`span`,{children:[e===`_project`?`workspaces`:e,` / `]}),i.path]}),(0,C.jsxs)(t,{label:`文件操作`,children:[v&&(0,C.jsx)(h,{icon:d?`preview`:`code`,label:d?`切换为预览`:`切换为原文`,"data-testid":`file-toggle-raw`,"aria-pressed":d,onClick:()=>p(!d)}),(0,C.jsx)(`a`,{className:`icon-button`,"data-testid":`file-download`,"aria-label":o.download,title:o.download,href:l(i.sha256),download:i.path.split(`/`).at(-1),children:(0,C.jsx)(c,{name:`download`})})]})]}),m?(0,C.jsx)(`div`,{className:`empty`,children:(0,C.jsx)(`p`,{children:o.previewLarge})}):b.error?(0,C.jsxs)(`div`,{className:`preview-body`,children:[(0,C.jsx)(g,{error:!0,children:b.error}),(0,C.jsx)(`button`,{"data-testid":`file-preview-retry`,onClick:()=>void b.reload(),children:o.retry})]}):b.loading?(0,C.jsx)(`p`,{className:`preview-body`,role:`status`,children:o.loading}):(0,C.jsx)(`div`,{className:`preview-body`,children:v&&!d?(0,C.jsx)(`article`,{className:`markdown`,"data-testid":`file-content`,"data-format":`markdown`,children:(0,C.jsx)(_,{onLink:a,children:b.data??``})}):(0,C.jsx)(`pre`,{className:`raw`,"data-testid":`file-content`,"data-format":`text`,children:b.data})})]})}export{T as Files};