@linkshell/gateway 0.6.13 → 0.6.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/web-client/assets/{Prototype-eb7Zpb4l.js → Prototype-2sjMQmtf.js} +1 -1
- package/web-client/assets/index-CKNp7spc.js +508 -0
- package/web-client/assets/index-D01jQZm1.css +1 -0
- package/web-client/assets/{qr-scanner.min-tTey7ktN.js → qr-scanner.min-DDHQck1h.js} +1 -1
- package/web-client/index.html +2 -2
- package/web-client/assets/index-Bt90ODyr.js +0 -498
- package/web-client/assets/index-UH0_druW.css +0 -1
package/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as c,j as s}from"./markdown-SZOrMO_3.js";import{d as W,i as ks,B as l,a as Cs,I as a,C as _,L as A,b as M,T as ps,c as ws,M as zs,o as xs,v as ys}from"./index-
|
|
1
|
+
import{a as c,j as s}from"./markdown-SZOrMO_3.js";import{d as W,i as ks,B as l,a as Cs,I as a,C as _,L as A,b as M,T as ps,c as ws,M as zs,o as xs,v as ys}from"./index-CKNp7spc.js";import"./account-R7yD1rZE.js";import"./terminal-DWFexEE4.js";const Ss=[{id:"auth",title:"完善登录续期与断线恢复",project:"linkshell",agent:"Claude",status:"waiting",detail:"等待确认 · 执行连接恢复测试",time:"刚刚"},{id:"web",title:"搭建网页端的会话工作区",project:"linkshell",agent:"Codex",status:"running",detail:"正在调整会话布局与响应式样式",time:"2 分钟前"},{id:"search",title:"优化文档搜索的键盘导航",project:"itool",agent:"Claude",status:"running",detail:"正在检查焦点切换与快捷键",time:"8 分钟前"},{id:"billing",title:"修复订阅页面的状态显示",project:"itool",agent:"Codex",status:"done",detail:"已完成 · 3 个文件变更",time:"32 分钟前"},{id:"docs",title:"补充自托管网关部署说明",project:"linkshell",agent:"Claude",status:"done",detail:"已完成 · 1 个文件变更",time:"1 小时前"}],J={waiting:"需要你",running:"进行中",done:"已完成"},ms=["src/auth/session.ts","src/connection/retry.ts","test/session.test.ts"];function Ts({status:r}){return s.jsxs("span",{className:`badge ${r}`,children:[s.jsx("span",{className:"status-dot"}),J[r]]})}function K({agent:r}){const p=ws[r.toLowerCase()];return s.jsx("span",{className:`agent-mark ${r.toLowerCase()} ${p.full?"full-mark":""}`,children:s.jsx("img",{src:`data:image/svg+xml,${encodeURIComponent(p.svg)}`,alt:r})})}function us({title:r,subtitle:p,children:j,close:C}){return s.jsxs(zs,{title:r,close:C,children:[p&&s.jsx("p",{className:"muted modal-subtitle",children:p}),j]})}function $s({source:r,gateway:p,onConnect:j,close:C}){const[h,z]=c.useState(r),[u,y]=c.useState(r==="self-hosted"?p:""),[t,D]=c.useState(""),[N,g]=c.useState("");function S(f){if(f.preventDefault(),h==="official")return j(h,xs);try{const k=ys(u);if(k===xs)throw new Error("这是官方网关,请选择官方服务;私有部署请填写自己的网关地址");if(!/^\d{6}$/.test(t))throw new Error("请输入 6 位配对码;原型中可填写任意 6 位数字");j(h,k)}catch(k){g(k instanceof Error?k.message:"请检查网关设置")}}return s.jsxs(us,{title:"连接你的电脑",subtitle:"选择连接方式,工作台始终属于你。",close:C,children:[W==="official"?s.jsxs("div",{className:"source-options",children:[s.jsxs(l,{variant:"ghost",size:"plain",className:h==="official"?"source-option selected":"source-option",onClick:()=>{z("official"),g("")},"aria-pressed":h==="official",children:[s.jsx(a,{name:"globe",size:23}),s.jsx("strong",{children:"官方服务"}),s.jsx("span",{children:"登录账号,发现你的电脑"}),s.jsx("span",{className:"selection-dot"})]}),s.jsxs(l,{variant:"ghost",size:"plain",className:h==="self-hosted"?"source-option selected":"source-option",onClick:()=>{z("self-hosted"),g("")},"aria-pressed":h==="self-hosted",children:[s.jsx(a,{name:"server",size:23}),s.jsx("strong",{children:"自托管网关"}),s.jsx("span",{children:"使用自己的服务器与配对码"}),s.jsx("span",{className:"selection-dot"})]})]}):s.jsxs("div",{className:"private-note",children:[s.jsx(a,{name:"server"}),s.jsxs("div",{children:[s.jsx("strong",{children:"私有部署"}),s.jsx("p",{children:"此站点使用你配置的网关,无需 iTool 账号或官方订阅。"})]})]}),s.jsxs("form",{onSubmit:S,children:[h==="official"?s.jsxs("div",{className:"official-entry",children:[s.jsx("div",{className:"entry-symbol",children:s.jsx(a,{name:"computer",size:32})}),s.jsx("h3",{children:"你的电脑,登录后就在这里"}),s.jsxs("p",{children:["电脑端运行 ",s.jsx("code",{children:"linkshell login"}),",网页使用同一 iTool 账号。电脑接入官方网关需要有效的 Pro 订阅。"]}),s.jsxs("div",{className:"endpoint",children:[s.jsx("span",{className:"status-dot"}),"gateway.itool.tech ",s.jsx("span",{children:"官方网关"})]})]}):s.jsxs("div",{className:"pairing-form",children:[s.jsx(A,{htmlFor:"gateway",children:"网关地址"}),s.jsx(M,{id:"gateway",placeholder:"wss://gateway.example.com",value:u,onChange:f=>{y(f.target.value),g("")},autoComplete:"off",spellCheck:!1,required:!0}),s.jsx("p",{className:"field-hint",children:"填写部署网关的地址,不是当前网页的地址。"}),s.jsx(A,{htmlFor:"pairing-code",children:"电脑上的配对码"}),s.jsx(M,{id:"pairing-code",className:"code-input",inputMode:"numeric",placeholder:"000000",maxLength:6,value:t,onChange:f=>{D(f.target.value.replace(/\D/g,"")),g("")},required:!0}),s.jsxs("p",{className:"field-hint",children:["电脑连接该网关后运行 ",s.jsx("code",{children:"linkshell pair"})," 获取。真实配对码 10 分钟内有效。"]}),s.jsxs("div",{className:"private-note",children:[s.jsx(a,{name:"shield"}),s.jsx("span",{children:"无需官方账号与订阅。正式版仅与指定网关交换配对信息,不向它发送 iTool 登录凭证。"})]})]}),N&&s.jsx("p",{role:"alert",className:"form-error",children:N}),s.jsxs(l,{variant:"default",className:"w-full",type:"submit",children:[h==="official"?"预览账号登录后的工作台":"预览配对后的工作台",s.jsx(a,{name:"arrow"})]}),s.jsx("p",{className:"prototype-note",children:"交互原型 · 不发起真实登录、配对或网络连接"})]})]})}function As({close:r,create:p}){const[j,C]=c.useState(""),[h,z]=c.useState("linkshell"),[u,y]=c.useState("Claude");return s.jsx(us,{title:"开始一个新任务",subtitle:"告诉 Agent 你想完成什么。",close:r,children:s.jsxs("form",{className:"new-form",onSubmit:t=>{t.preventDefault(),j.trim()&&p(j.trim(),h,u)},children:[s.jsx(A,{htmlFor:"task-prompt",children:"任务描述"}),s.jsx(ps,{id:"task-prompt",autoFocus:!0,value:j,onChange:t=>C(t.target.value),placeholder:"例如:帮我检查这个项目的登录流程…",required:!0,rows:4}),s.jsxs("div",{className:"form-columns",children:[s.jsxs(A,{children:["项目",s.jsx(_,{label:"项目",value:h,onValueChange:z,options:[{value:"linkshell",label:"linkshell"},{value:"itool",label:"itool"}]})]}),s.jsxs(A,{children:["Agent",s.jsx(_,{label:"Agent",value:u,onValueChange:t=>y(t),options:[{value:"Claude",label:"Claude"},{value:"Codex",label:"Codex"}]})]})]}),s.jsxs("div",{className:"computer-inline",children:[s.jsx(a,{name:"computer"}),s.jsx("span",{children:"Studio Mac"}),s.jsx("span",{className:"online-dot"}),"演示电脑"]}),s.jsxs(l,{variant:"default",className:"w-full",disabled:!j.trim(),children:["创建演示任务",s.jsx(a,{name:"arrow"})]}),s.jsx("p",{className:"prototype-note",children:"任务仅保存在本页,不会启动真实 Agent"})]})})}function Fs(){const[r,p]=c.useState(W),[j,C]=c.useState(()=>window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");c.useEffect(()=>{document.documentElement.dataset.theme=j},[j]);const[h,z]=c.useState(ks),[u,y]=c.useState(Ss),[t,D]=c.useState("home"),[N,g]=c.useState(null),[S,f]=c.useState("all"),[k,Q]=c.useState(""),[X,m]=c.useState(W==="self-hosted"?"connect":null),[b,O]=c.useState("online"),[d,E]=c.useState(null),[F,Z]=c.useState(!1),[B,ss]=c.useState(""),[es,gs]=c.useState([]),[R,as]=c.useState({}),[fs,vs]=c.useState({}),[Ns,H]=c.useState({}),[P,T]=c.useState(""),[ns,I]=c.useState(!1),[G,ls]=c.useState(!1),[V,bs]=c.useState(ms[0]),is=c.useRef(null),cs=c.useRef(null),ts=c.useRef(null),U=c.useRef(null),o=u.find(e=>e.id===t),x=b==="online",rs=fs[t]??[],$=Ns[t]??[],os=u.filter(e=>e.status==="waiting"),ds=u.filter(e=>(!N||e.project===N)&&(S==="all"||e.status===S)&&`${e.title} ${e.project} ${e.agent}`.toLowerCase().includes(k.toLowerCase()));c.useEffect(()=>{const e=n=>{(n.metaKey||n.ctrlKey)&&n.key==="k"&&!document.querySelector("dialog[open]")&&(n.preventDefault(),D("home"),I(!1),requestAnimationFrame(()=>is.current?.focus()))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),c.useEffect(()=>{if(!P)return;const e=setTimeout(()=>T(""),3500);return()=>clearTimeout(e)},[P]),c.useEffect(()=>{U.current?.scrollTo({top:U.current.scrollHeight,behavior:"smooth"})},[t,rs.length]);function v(e){D(e),I(!1),ls(!1)}function hs(e,n,i){y(L=>L.map(w=>w.id===e?{...w,status:n,detail:i,time:"刚刚"}:w))}function Y(e,n){vs(i=>({...i,[e]:[...i[e]??[],n]}))}function q(e,n){x&&(hs(e,n?"running":"done",n?"已允许测试 · 演示运行中":"已拒绝本次测试 · 等待新指令"),Y(e,{role:"assistant",text:n?"已记录允许执行。在正式连接中,这一步会交给电脑上的 Agent 继续处理。":"已记录拒绝执行。你可以补充要求,让 Agent 调整下一步计划。"}),T(n?"演示审批已通过":"演示审批已拒绝"))}function js(){if(!o||!x||!R[t]?.trim()&&!$.length)return;const e=[R[t]?.trim(),...$.map(n=>`附件:${n}(未上传)`)].filter(Boolean).join(`
|
|
2
2
|
`);Y(t,{role:"user",text:e}),Y(t,{role:"assistant",text:"消息已添加到本地演示会话。接入真实 Host 后,这里会显示 Agent 的实时回复。"}),as(n=>({...n,[t]:""})),H(n=>({...n,[t]:[]})),cs.current?.focus()}return s.jsxs("div",{className:`app-shell ${ns?"nav-open":""}`,children:[ns&&s.jsx(l,{variant:"ghost",size:"plain",className:"nav-backdrop","aria-label":"关闭导航",onClick:()=>I(!1)}),s.jsxs("aside",{className:"sidebar",children:[s.jsxs("a",{className:"brand",href:"#",onClick:e=>{e.preventDefault(),g(null),v("home")},children:[s.jsx("img",{className:"brand-symbol",src:Cs,alt:""}),"LinkShell",s.jsx("span",{className:"brand-web",children:"web"})]}),s.jsxs(l,{variant:"ghost",size:"plain",className:"connection-switch",onClick:()=>m("connect"),children:[s.jsx("span",{className:`source-icon ${r}`,children:s.jsx(a,{name:r==="official"?"globe":"server"})}),s.jsxs("span",{children:[s.jsx("strong",{children:r==="official"?"官方工作空间":"自托管工作空间"}),s.jsx("small",{children:r==="official"?"iTool 账号 · 演示":"设备配对 · 演示"})]}),s.jsx(a,{name:"down",size:15})]}),s.jsxs(l,{variant:"ghost",className:"new-task",onClick:()=>m("new"),children:[s.jsx(a,{name:"plus"}),"新建任务",s.jsx("span",{className:"new-task-corner",children:"↗"})]}),s.jsxs("nav",{"aria-label":"主导航",children:[s.jsxs(l,{variant:"ghost",size:"plain",className:`nav-item ${t==="home"&&!N?"active":""}`,onClick:()=>{g(null),f("all"),v("home")},children:[s.jsx(a,{name:"grid"}),"首页",s.jsx("span",{className:"nav-count",children:u.length})]}),s.jsxs(l,{variant:"ghost",size:"plain",className:`nav-item ${t==="computers"?"active":""}`,onClick:()=>v("computers"),children:[s.jsx(a,{name:"computer"}),"我的电脑",s.jsx("span",{className:"online-dot"})]})]}),s.jsxs("div",{className:"nav-section-label",children:["项目",s.jsx("span",{children:"2"})]}),["linkshell","itool"].map(e=>s.jsxs("div",{children:[s.jsxs(l,{variant:"ghost",size:"plain",className:`nav-item project-nav ${N===e&&t==="home"?"active":""}`,onClick:()=>{g(e),f("all"),v("home")},children:[s.jsx(a,{name:"folder"}),e,s.jsx(a,{name:"down",size:13})]}),s.jsx("div",{className:"recent-list",children:u.filter(n=>n.project===e).slice(0,2).map(n=>s.jsxs(l,{variant:"ghost",size:"plain",className:`recent-task ${t===n.id?"selected":""}`,onClick:()=>v(n.id),children:[s.jsx("span",{className:`tiny-status ${n.status}`}),s.jsx("span",{children:n.title})]},n.id))})]},e)),s.jsxs("div",{className:"sidebar-bottom",children:[s.jsxs("div",{className:"host-presence",children:[s.jsx("span",{className:x?"online-dot":"offline-dot"}),s.jsx("span",{children:"Studio Mac"}),s.jsx("small",{children:x?"演示在线":"连接待恢复"})]}),s.jsxs(l,{variant:"ghost",size:"plain",className:"profile-button",onClick:()=>m("connect"),children:[s.jsx("span",{className:"avatar",children:r==="official"?"L":s.jsx(a,{name:"server"})}),s.jsxs("span",{children:[s.jsx("strong",{children:r==="official"?"LinkShell 演示账号":"本浏览器"}),s.jsx("small",{children:r==="official"?"官方服务 · Pro":"自托管 · 无需官方订阅"})]}),s.jsx(a,{name:"settings",size:17})]})]})]}),s.jsxs("main",{className:"main",children:[s.jsxs("header",{className:"topbar",children:[s.jsxs("div",{className:"breadcrumbs",children:[s.jsx(l,{variant:"ghost",size:"icon",className:"mobile-menu",onClick:()=>I(!0),"aria-label":"打开导航",children:s.jsx(a,{name:"menu"})}),s.jsx("span",{children:"工作空间"}),s.jsx("span",{className:"breadcrumb-slash",children:"/"}),s.jsx("strong",{children:o?o.project:t==="computers"?"我的电脑":N??"概览"}),o&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"breadcrumb-slash",children:"/"}),s.jsx("span",{className:"breadcrumb-task",children:"会话"})]})]}),s.jsxs("div",{className:"topbar-right",children:[s.jsx(l,{variant:"ghost",size:"icon",className:"theme-switch","aria-label":j==="light"?"切换深色外观":"切换浅色外观",onClick:()=>C(j==="light"?"dark":"light"),children:s.jsx(a,{name:"moon"})}),s.jsxs("span",{className:"demo-tag",children:[s.jsx("span",{}),"交互原型"]}),s.jsx(_,{label:"预览连接状态",value:b,onValueChange:e=>O(e),options:[{value:"online",label:"正常连接"},{value:"offline",label:"网络中断"},{value:"expired",label:r==="official"?"登录失效":"配对失效"},...r==="official"?[{value:"subscription",label:"Pro 到期"}]:[]]}),s.jsx(l,{variant:"ghost",size:"icon","aria-label":"连接设置",onClick:()=>m("connect"),children:s.jsx(a,{name:"settings"})})]})]}),b!=="online"&&s.jsxs("div",{className:`connection-banner ${b}`,role:"status",children:[s.jsx(a,{name:b==="offline"?"globe":"shield"}),s.jsx("span",{children:b==="offline"?"连接暂时中断,草稿已保留。正式版恢复连接后会自动补齐会话。":b==="subscription"?"演示:电脑的 Pro 订阅已到期,重新接入官方网关需要续订;已有记录仍可查看。":r==="official"?"演示:登录凭证已失效,需要重新登录。":"演示:此浏览器的配对已被撤销,需要重新配对。"}),s.jsx(l,{variant:"ghost",size:"plain",onClick:()=>b==="offline"?(O("online"),T("已恢复演示连接")):m("connect"),children:b==="offline"?"模拟恢复":"查看连接设置"})]}),!o&&t!=="computers"&&s.jsxs("div",{className:"overview page-enter",children:[s.jsxs("div",{className:"page-heading",children:[s.jsxs("div",{children:[s.jsx("h1",{children:N??"首页"}),s.jsxs("p",{className:"host-summary",children:[s.jsx("span",{className:x?"online-dot":"offline-dot"}),"Studio Mac",os.length>0&&s.jsxs("span",{className:"waiting-copy",children:["· ",os.length," 项需要你"]})]})]}),s.jsxs(l,{variant:"default",onClick:()=>m("new"),children:[s.jsx(a,{name:"plus"}),"新建任务"]})]}),s.jsxs("div",{className:"home-controls",children:[s.jsxs(A,{className:"search-box",children:[s.jsx(a,{name:"search",size:18}),s.jsx(M,{ref:is,"aria-label":"搜索任务",placeholder:"搜索会话、项目或 Agent",value:k,onChange:e=>Q(e.target.value)}),s.jsx("kbd",{children:"⌘ K"})]}),s.jsx("div",{className:"filters",role:"group","aria-label":"任务状态筛选",children:["all","running","waiting","done"].map(e=>s.jsx(l,{variant:"ghost",size:"plain","aria-pressed":S===e,className:S===e?"selected":"",onClick:()=>f(e),children:e==="all"?"全部":J[e]},e))})]}),["waiting","running","done"].map(e=>{const n=ds.filter(i=>i.status===e);return n.length?s.jsxs("section",{className:"session-group",children:[s.jsxs("div",{className:`section-heading ${e==="waiting"?"waiting-heading":""}`,children:[s.jsxs("h2",{children:[e==="done"?"今天":J[e],s.jsx("span",{children:n.length})]}),e==="running"&&s.jsx("span",{className:"section-note",children:"Agent 正在电脑上工作"})]}),e==="waiting"?n.map(i=>s.jsxs("article",{className:"attention-card",children:[s.jsxs(l,{variant:"ghost",size:"plain",className:"attention-title",onClick:()=>v(i.id),children:[s.jsx(K,{agent:i.agent}),s.jsxs("span",{children:[s.jsx("strong",{children:i.title}),s.jsxs("small",{children:[i.project," · ",i.agent]})]}),s.jsx("time",{children:i.time}),s.jsx(a,{name:"chevron",size:16})]}),s.jsxs("div",{className:"permission-preview",children:[s.jsxs("div",{children:[s.jsx(a,{name:"shield",size:17}),s.jsx("strong",{children:"需要你的确认"})]}),s.jsx("code",{children:"pnpm --filter @linkshell/client-core test"})]}),s.jsxs("div",{className:"attention-actions",children:[s.jsxs(l,{variant:"link",size:"sm",onClick:()=>v(i.id),children:["查看会话",s.jsx(a,{name:"chevron",size:13})]}),s.jsx(l,{variant:"outline",disabled:!x,onClick:()=>q(i.id,!1),children:"拒绝"}),s.jsx(l,{variant:"default",disabled:!x,onClick:()=>q(i.id,!0),children:"允许本次"})]})]},i.id)):s.jsx("div",{className:"task-list",children:n.map(i=>s.jsxs(l,{variant:"ghost",size:"plain",className:"task-row",onClick:()=>v(i.id),children:[s.jsxs("span",{className:"row-avatar",children:[s.jsx(K,{agent:i.agent}),s.jsx("span",{className:`tiny-status ${i.status}`})]}),s.jsxs("span",{className:"task-info",children:[s.jsx("strong",{children:i.title}),s.jsxs("span",{children:[s.jsx("span",{className:"project-label",children:i.project}),s.jsx("span",{className:"separator",children:"·"}),s.jsx("span",{className:i.status==="running"?"running-copy":"",children:i.detail})]})]}),s.jsxs("span",{className:"task-meta",children:[s.jsx("small",{children:i.time}),s.jsx("span",{children:i.agent})]}),s.jsx(a,{name:"chevron",size:14})]},i.id))})]},e):null}),!ds.length&&s.jsxs("div",{className:"empty-state",children:[s.jsx(a,{name:"search",size:28}),s.jsx("h3",{children:"没有找到会话"}),s.jsx("p",{children:"试试其他关键词或筛选条件。"}),s.jsx(l,{variant:"link",size:"sm",onClick:()=>{f("all"),Q("")},children:"清除筛选"})]}),s.jsxs("footer",{className:"page-footer",children:[s.jsx(a,{name:"shield",size:13}),s.jsx("span",{children:r==="official"?"官方网关 · 账号连接":"自托管网关 · 设备配对"}),s.jsx("span",{children:"演示数据"})]})]}),t==="computers"&&s.jsxs("div",{className:"overview page-enter",children:[s.jsxs("div",{className:"page-heading",children:[s.jsxs("div",{children:[s.jsx("h1",{children:"我的电脑"}),s.jsx("p",{className:"muted",children:"管理你的电脑与连接方式。"})]}),s.jsxs(l,{variant:"default",onClick:()=>m("connect"),children:[s.jsx(a,{name:"plus"}),"连接电脑"]})]}),s.jsxs("div",{className:"connection-detail-card",children:[s.jsx("span",{className:"large-source-icon",children:s.jsx(a,{name:r==="official"?"globe":"server",size:28})}),s.jsxs("div",{children:[s.jsx("span",{className:"eyebrow",children:r==="official"?"OFFICIAL GATEWAY":"SELF-HOSTED GATEWAY"}),s.jsx("h2",{children:r==="official"?"LinkShell 官方服务":"你自己的网关"}),s.jsx("code",{children:h||"尚未设置网关"}),s.jsx("p",{className:"muted",children:r==="official"?"通过同一 iTool 账号发现电脑。电脑接入需要有效的 Pro 订阅。":"通过设备配对授权,无需官方账号或订阅。网关与数据由你管理。"})]}),s.jsx(l,{variant:"outline",onClick:()=>m("connect"),children:"连接设置"})]}),s.jsx("div",{className:"computer-table",children:s.jsxs("div",{children:[s.jsx(a,{name:"computer",size:28}),s.jsxs("span",{children:[s.jsx("strong",{children:"Studio Mac"}),s.jsx("small",{children:"macOS · 演示电脑"})]}),s.jsxs("span",{className:`badge ${x?"running":"waiting"}`,children:[s.jsx("span",{className:"status-dot"}),x?"在线":"待恢复"]}),s.jsx("span",{className:"muted",children:r==="official"?"账号关联":"已配对(演示)"}),s.jsxs(l,{variant:"outline",onClick:()=>{g(null),v("home")},children:["查看任务",s.jsx(a,{name:"arrow",size:16})]})]})}),s.jsxs("div",{className:"deployment-note",children:[s.jsx(a,{name:"shield"}),s.jsxs("div",{children:[s.jsx("strong",{children:"网页部署位置与网关地址是两个独立设置"}),s.jsx("p",{children:"官方网页可以连接自托管网关。私有部署默认只显示配对入口,并从公开配置读取网关地址;不依赖官方登录服务。正式版不会把官方账号凭证发送给自定义网关。"})]})]})]}),o&&s.jsxs("div",{className:"session-page page-enter",children:[s.jsxs("div",{className:"session-heading",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"session-title",children:[s.jsx("h1",{children:o.title}),s.jsx(Ts,{status:o.status})]}),s.jsxs("div",{className:"session-subtitle",children:[s.jsx(K,{agent:o.agent}),s.jsx("span",{children:o.agent}),s.jsx("span",{className:"separator",children:"/"}),s.jsx(a,{name:"computer",size:13}),s.jsx("span",{children:"Studio Mac"}),s.jsx("span",{className:"separator",children:"/"}),s.jsx(a,{name:"branch",size:13}),s.jsx("span",{children:"codex/session-recovery"})]})]}),s.jsxs("div",{className:"session-actions",children:[s.jsx(l,{variant:"ghost",size:"plain",className:F?"pressed":"","aria-label":"切换终端","aria-pressed":F,onClick:()=>Z(!F),children:s.jsx(a,{name:"terminal"})}),s.jsx(l,{variant:"ghost",size:"plain",className:d?"pressed":"","aria-label":"切换文件面板","aria-pressed":!!d,onClick:()=>E(d?null:"changes"),children:s.jsx(a,{name:"panel"})})]})]}),s.jsxs("div",{className:`session-layout ${d?"with-panel":""}`,children:[s.jsxs("div",{className:"conversation-column",children:[s.jsxs("div",{className:"conversation",ref:U,children:[s.jsx("div",{className:"date-divider",children:s.jsx("span",{children:"今天 · 演示会话"})}),s.jsxs("div",{className:"user-message",children:[s.jsxs("span",{className:"message-label",children:["你 ",s.jsx("small",{children:"14:28"})]}),s.jsx("p",{children:o.id==="auth"?"帮我完善登录续期和断线恢复。希望登录一次之后能长期使用,临时网络失败也不要丢掉登录状态。":o.title})]}),s.jsxs("div",{className:"assistant-message",children:[s.jsxs("div",{className:"message-author",children:[s.jsx(K,{agent:o.agent}),s.jsx("strong",{children:o.agent}),s.jsx("span",{children:"14:29"})]}),o.id==="auth"?s.jsxs(s.Fragment,{children:[s.jsx("p",{children:o.id==="auth"?"我检查了当前的连接流程。问题出在刷新失败之后:临时网络错误被当成未登录处理,导致账号下的电脑暂时不可见。":"我会先梳理相关实现,确定改动范围,再逐步完成并验证。以下内容用于展示网页端的工具调用和文件变更布局。"}),s.jsx("p",{children:"这次会把登录状态和连接状态分开处理:"}),s.jsxs("ol",{className:"plan-list",children:[s.jsx("li",{children:"保留本地凭证,区分网络错误与凭证失效。"}),s.jsx("li",{children:"恢复连接时自动续期,重新订阅会话。"}),s.jsx("li",{children:"补齐断线期间的事件,避免消息重复。"})]}),s.jsxs(l,{variant:"ghost",size:"plain",className:"tool-call",onClick:()=>ls(!G),"aria-expanded":G,children:[s.jsx("span",{className:"tool-check",children:s.jsx(a,{name:"check",size:14})}),s.jsx("span",{children:"已检查连接与会话逻辑"}),s.jsx("small",{children:"3 个文件"}),s.jsx(a,{name:G?"down":"chevron",size:14})]}),G&&s.jsxs("div",{className:"tool-output",children:[s.jsxs("code",{children:["read src/auth/session.ts",s.jsx("br",{}),"read src/connection/retry.ts",s.jsx("br",{}),"read test/session.test.ts"]}),s.jsx("p",{children:"演示工具记录,未读取或修改真实文件。"})]}),s.jsxs("div",{className:"change-summary",children:[s.jsx(a,{name:"file",size:16}),s.jsx(l,{variant:"ghost",size:"plain",onClick:()=>E("changes"),children:"查看 3 个文件变更"}),s.jsx("span",{className:"added",children:"+42"}),s.jsx("span",{className:"removed",children:"−12"})]}),s.jsx("p",{children:"改动已整理好,接下来需要执行测试来验证恢复流程。"}),o.status==="waiting"&&s.jsxs("div",{className:"approval-card",children:[s.jsxs("div",{className:"approval-heading",children:[s.jsx("span",{className:"approval-icon",children:s.jsx(a,{name:"shield",size:19})}),s.jsxs("div",{children:[s.jsx("strong",{children:"允许执行这条命令吗?"}),s.jsx("span",{children:"将在 Studio Mac 的 linkshell 项目中执行"})]}),s.jsx("span",{className:"badge waiting",children:"等待确认"})]}),s.jsx("pre",{children:"pnpm --filter @linkshell/client-core test"}),s.jsxs("div",{className:"approval-footer",children:[s.jsx("span",{children:"仅允许本次操作"}),s.jsx(l,{variant:"outline",onClick:()=>q(o.id,!1),disabled:!x,children:"拒绝"}),s.jsxs(l,{variant:"default",onClick:()=>q(o.id,!0),disabled:!x,children:[s.jsx(a,{name:"check",size:15}),"允许执行"]})]})]})]}):s.jsxs("p",{children:["这是一个本地演示会话。你可以在下方补充消息、切换文件面板或展开终端,体验工作区布局。接入 Host 后,这里会显示 ",o.agent," 的真实执行过程。"]})]}),rs.map((e,n)=>s.jsxs("div",{className:e.role==="user"?"user-message":"assistant-message reply",children:[s.jsxs("span",{className:"message-label",children:[e.role==="user"?"你":o.agent,s.jsx("small",{children:"刚刚 · 本地演示"})]}),s.jsx("p",{children:e.text})]},`${t}-${n}`))]}),F&&s.jsxs("section",{className:"terminal-panel","aria-label":"演示终端",children:[s.jsxs("div",{className:"terminal-heading",children:[s.jsxs("span",{children:[s.jsx(a,{name:"terminal",size:14}),"终端",s.jsx("span",{className:"terminal-demo",children:"只演示 · 不执行命令"})]}),s.jsx(l,{variant:"ghost",size:"icon","aria-label":"关闭终端",onClick:()=>Z(!1),children:s.jsx(a,{name:"close",size:15})})]}),s.jsxs("div",{className:"terminal-output",children:[s.jsxs("p",{children:[s.jsxs("span",{className:"terminal-green",children:["~/projects/",o.project]})," ","on"," ",s.jsx("span",{className:"terminal-blue",children:"codex/session-recovery"})]}),es.map((e,n)=>s.jsx("p",{children:e},n)),s.jsxs("form",{onSubmit:e=>{e.preventDefault(),B.trim()&&(gs([...es,`❯ ${B}`,"原型不执行命令。正式版将连接电脑上的 PTY 终端。"]),ss(""))},children:[s.jsx("span",{children:"❯"}),s.jsx(M,{"aria-label":"演示终端命令",value:B,onChange:e=>ss(e.target.value),spellCheck:!1,placeholder:"试着输入一条命令"})]})]})]}),s.jsxs("div",{className:"composer-wrap",children:[s.jsxs("div",{className:"composer",children:[$.length>0&&s.jsx("div",{className:"attachment-list",children:$.map((e,n)=>s.jsxs("span",{children:[s.jsx(a,{name:"file",size:13}),e,s.jsx(l,{variant:"ghost",size:"plain","aria-label":`移除附件 ${e}`,onClick:()=>H(i=>({...i,[t]:$.filter((L,w)=>w!==n)})),children:s.jsx(a,{name:"close",size:12})})]},`${e}-${n}`))}),s.jsx(ps,{ref:cs,"aria-label":"发送消息",value:R[t]??"",onChange:e=>as(n=>({...n,[t]:e.target.value})),onKeyDown:e=>{e.key==="Enter"&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),js())},placeholder:x?"补充你的想法,或告诉 Agent 下一步做什么…":"连接中断也可以继续写,草稿会保留…",rows:2}),s.jsxs("div",{className:"composer-toolbar",children:[s.jsxs("div",{children:[s.jsx(M,{ref:ts,type:"file",multiple:!0,hidden:!0,onChange:e=>{const n=Array.from(e.target.files??[]).map(i=>i.name);H(i=>({...i,[t]:[...i[t]??[],...n]})),e.target.value=""}}),s.jsx(l,{variant:"ghost",size:"icon","aria-label":"添加演示附件",onClick:()=>ts.current?.click(),children:s.jsx(a,{name:"attach",size:17})}),s.jsxs("span",{className:"composer-agent",children:[o.agent,s.jsx("span",{className:"separator",children:"·"}),"默认模型"]})]}),s.jsxs("div",{children:[o.status==="running"&&s.jsx(l,{variant:"ghost",size:"icon","aria-label":"停止演示任务",disabled:!x,onClick:()=>{hs(o.id,"done","已停止 · 演示任务"),T("已停止演示任务")},children:s.jsx(a,{name:"stop",size:16})}),s.jsx(l,{variant:"ghost",size:"plain",className:"send-button","aria-label":"发送演示消息",disabled:!x||!R[t]?.trim()&&!$.length,onClick:js,children:s.jsx(a,{name:"send",size:19})})]})]})]}),s.jsxs("div",{className:"composer-caption",children:[s.jsx("span",{children:"Enter 发送 · Shift Enter 换行"}),s.jsx("span",{children:"演示消息不会发送到电脑"})]})]})]}),d&&s.jsxs("aside",{className:"file-panel",children:[s.jsxs("div",{className:"panel-tabs",children:[s.jsxs(l,{variant:"ghost",size:"plain",className:d==="changes"?"selected":"",onClick:()=>E("changes"),children:["变更",s.jsx("span",{children:"3"})]}),s.jsx(l,{variant:"ghost",size:"plain",className:d==="files"?"selected":"",onClick:()=>E("files"),children:"文件"}),s.jsx(l,{variant:"ghost",size:"icon","aria-label":"关闭文件面板",onClick:()=>E(null),children:s.jsx(a,{name:"close",size:15})})]}),s.jsxs("div",{className:"panel-project",children:[s.jsx(a,{name:"folder",size:15}),o.project,s.jsx("span",{children:"示例文件"})]}),s.jsx("div",{className:"file-list",children:ms.map((e,n)=>s.jsxs(l,{variant:"ghost",size:"plain",className:V===e?"selected":"",onClick:()=>bs(e),children:[s.jsx(a,{name:"file",size:14}),s.jsx("span",{children:e}),d==="changes"&&s.jsxs("small",{className:"added",children:["+",[18,16,8][n]]})]},e))}),s.jsxs("div",{className:"diff-heading",children:[s.jsx("span",{children:V.split("/").pop()}),s.jsx("span",{children:d==="changes"?"+18 −4":"TypeScript"})]}),s.jsxs("div",{className:"code-preview",children:[s.jsxs("div",{children:[s.jsx("span",{children:"01"}),s.jsx("code",{children:V.includes("test")?"it('retains the session', () => {":"async function reconnect() {"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"02"}),s.jsx("code",{children:" const session = loadSession();"})]}),d==="changes"&&s.jsxs("div",{className:"diff-remove",children:[s.jsx("span",{children:"−"}),s.jsx("code",{children:" if (!token) signOut();"})]}),s.jsxs("div",{className:d==="changes"?"diff-add":"",children:[s.jsx("span",{children:"03"}),s.jsx("code",{children:" if (!session) return;"})]}),s.jsxs("div",{className:d==="changes"?"diff-add":"",children:[s.jsx("span",{children:"04"}),s.jsx("code",{children:" try {"})]}),s.jsxs("div",{className:d==="changes"?"diff-add":"",children:[s.jsx("span",{children:"05"}),s.jsx("code",{children:" await refreshSession();"})]}),s.jsxs("div",{className:d==="changes"?"diff-add":"",children:[s.jsx("span",{children:"06"}),s.jsx("code",{children:" await resumeConnection();"})]}),s.jsxs("div",{className:d==="changes"?"diff-add":"",children:[s.jsx("span",{children:"07"}),s.jsx("code",{children:" } catch (error) {"})]}),s.jsxs("div",{className:d==="changes"?"diff-add":"",children:[s.jsx("span",{children:"08"}),s.jsx("code",{children:" scheduleRetry(error);"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"09"}),s.jsx("code",{children:" }"})]}),s.jsxs("div",{children:[s.jsx("span",{children:"10"}),s.jsx("code",{children:"}"})]})]}),s.jsxs("div",{className:"panel-bottom",children:[s.jsx(a,{name:"branch",size:14}),s.jsx("span",{children:"codex/session-recovery"}),s.jsx("span",{className:"added",children:"+42"}),s.jsx("span",{className:"removed",children:"−12"})]})]})]})]})]}),P&&s.jsxs("div",{className:"toast",role:"status",children:[s.jsx(a,{name:"check",size:16}),P]}),X==="connect"&&s.jsx($s,{source:r,gateway:h,close:()=>m(null),onConnect:(e,n)=>{p(e),z(n),O("online"),m(null),T(e==="official"?"已切换到官方服务演示":"已切换到自托管演示,未发起真实配对")}}),X==="new"&&s.jsx(As,{close:()=>m(null),create:(e,n,i)=>{const L=crypto.randomUUID();y(w=>[{id:L,title:e,project:n,agent:i,status:"running",detail:"新建演示任务",time:"刚刚"},...w]),m(null),v(L),T("已创建本地演示任务")}})]})}export{Fs as Prototype};
|