linkshell-cli 0.5.40 → 0.5.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/src/commands/doctor.js +9 -3
- package/dist/cli/src/commands/doctor.js.map +1 -1
- package/dist/cli/src/runtime/acp/agent-workspace.d.ts +5 -0
- package/dist/cli/src/runtime/acp/agent-workspace.js +318 -119
- package/dist/cli/src/runtime/acp/agent-workspace.js.map +1 -1
- package/dist/cli/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/commands/doctor.ts +12 -3
- package/src/runtime/acp/agent-workspace.ts +311 -116
- package/web/assets/{FileBrowser-Daeji5i-.js → FileBrowser-wOAfY-xj.js} +1 -1
- package/web/assets/{PortPreview-6-Cj-cKd.js → PortPreview-Cbvv7yzA.js} +1 -1
- package/web/assets/{TerminalPanel-C3hvv9KU.js → TerminalPanel-CTSklkct.js} +1 -1
- package/web/assets/{UsageDashboard-D9Xlpl3d.js → UsageDashboard-CJ1AsNmd.js} +1 -1
- package/web/assets/index-q85psYZ5.js +36 -0
- package/web/index.html +1 -1
- package/web/assets/index-BahdI_WD.js +0 -36
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,r as T}from"./vendor-react-M7xG3qiw.js";import{a as $}from"./index-
|
|
1
|
+
import{j as e,r as T}from"./vendor-react-M7xG3qiw.js";import{a as $}from"./index-q85psYZ5.js";import"./vendor-highlight-NXWAAyIv.js";function h(t){return t>=1e8?(t/1e8).toFixed(1)+"亿":t>=1e4?(t/1e4).toFixed(1)+"万":String(Math.round(t))}function S(t){const a=Math.round(t/6e4),n=Math.floor(a/60),l=a%60;return n>0?`${n}小时${l}分`:`${l}分`}const C=53,j=864e5;function k(t){return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function E(t,a){const n=new Map;for(const o of t)n.set(o.key,o.totalTokens);const l=new Date;l.setHours(12,0,0,0);const s=new Date(l.getTime()-(C*7-1)*j);s.setDate(s.getDate()-s.getDay());const r=new Map;if(a==="weekly")for(const[o,d]of n){const i=new Date(o+"T12:00:00");i.setDate(i.getDate()-i.getDay());const x=k(i);r.set(x,(r.get(x)??0)+d)}const c=[],u=[];let N=0,w=0,D=-1;for(let o=new Date(s);o<=l;w++){const d=[];for(let x=0;x<7;x++){const p=new Date(o.getTime()+x*j),M=k(p),y=n.get(M)??0;a==="cumulative"&&(N+=y);let g=y;if(a==="weekly"){const f=new Date(p);f.setDate(f.getDate()-f.getDay()),g=r.get(k(f))??0}else a==="cumulative"&&(g=N);d.push({date:p,key:M,value:g,daily:y})}const i=d[0].date.getMonth();i!==D&&(u.push({col:w,label:`${i+1}月`}),D=i),c.push(d),o=new Date(o.getTime()+7*j)}let b=0;for(const o of c)for(const d of o)b=Math.max(b,d.value);return{weeks:c,max:b,monthLabels:u}}function F(t,a){if(t<=0||a<=0)return{className:"bg-surface-raised"};const n=t/a;return{className:"",style:{backgroundColor:`rgba(96,165,250,${n>.66?1:n>.33?.72:n>.1?.48:.28})`}}}function m({value:t,label:a}){return e.jsxs("div",{className:"flex flex-col items-center justify-center gap-1 px-4 py-3",children:[e.jsx("span",{className:"whitespace-nowrap font-mono text-xl font-semibold text-content-primary tabular-nums",children:t}),e.jsx("span",{className:"text-2xs text-content-muted",children:a})]})}function v({title:t,buckets:a}){const n=a.slice(0,6),l=n.reduce((s,r)=>Math.max(s,r.totalTokens),0);return n.length===0?null:e.jsxs("div",{className:"rounded-xl border border-border bg-surface p-4",children:[e.jsx("p",{className:"mb-3 text-2xs font-semibold uppercase tracking-wider text-content-faint",children:t}),e.jsx("div",{className:"space-y-2",children:n.map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-28 shrink-0 truncate text-xs text-content-secondary",title:s.key,children:s.key}),e.jsx("div",{className:"relative h-2 flex-1 overflow-hidden rounded-full bg-surface-raised",children:e.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${l>0?s.totalTokens/l*100:0}%`,backgroundColor:"rgba(96,165,250,0.7)"}})}),e.jsx("span",{className:"w-14 shrink-0 text-right font-mono text-2xs tabular-nums text-content-muted",children:h(s.totalTokens)})]},s.key))})]})}function z({report:t}){const[a,n]=T.useState("daily"),l=T.useMemo(()=>t?E(t.byDay,a):null,[t,a]);return t?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border rounded-2xl border border-border bg-surface sm:grid-cols-5",children:[e.jsx(m,{value:h(t.totals.totalTokens),label:"累计 Token 数"}),e.jsx(m,{value:h(t.peakDayTokens),label:"峰值 Token 数"}),e.jsx(m,{value:S(t.longestTaskMs),label:"最长任务时长"}),e.jsx(m,{value:`${t.currentStreakDays} 天`,label:"当前连续天数"}),e.jsx(m,{value:`${t.longestStreakDays} 天`,label:"最长连续天数"})]}),e.jsxs("div",{className:"rounded-2xl border border-border bg-surface p-5",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-semibold text-content-primary",children:"Token 活动"}),e.jsx("div",{className:"flex items-center gap-1 text-2xs",children:[["daily","每日"],["weekly","每周"],["cumulative","累计"]].map(([s,r])=>e.jsx("button",{onClick:()=>n(s),className:`rounded-md px-2 py-1 transition-colors ${a===s?"bg-surface-overlay text-content-primary":"text-content-muted hover:text-content-secondary"}`,children:r},s))})]}),l&&e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("div",{className:"inline-flex flex-col gap-1",children:[e.jsx("div",{className:"flex gap-1",children:l.weeks.map((s,r)=>e.jsx("div",{className:"flex flex-col gap-1",children:s.map(c=>{const u=F(c.value,l.max);return e.jsx("div",{className:`h-3 w-3 rounded-[3px] ${u.className}`,style:u.style,title:`${c.key} · ${h(c.daily)} tokens`},c.key)})},r))}),e.jsx("div",{className:"relative mt-1.5 h-4 text-2xs text-content-faint",children:l.monthLabels.map(s=>e.jsx("span",{className:"absolute",style:{left:`${s.col*16}px`},children:s.label},s.col))})]})})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[e.jsx(v,{title:"工具分布",buckets:t.byTool}),e.jsx(v,{title:"模型分布",buckets:t.byModel}),e.jsx(v,{title:"项目分布",buckets:t.byProject})]})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12 text-content-muted",children:[e.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-content-faint border-t-accent"}),e.jsx("p",{className:"text-sm",children:"正在扫描本机会话记录…"})]})}function L({report:t,onClose:a}){return e.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-canvas/95 backdrop-blur-sm",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-5 py-3",children:[e.jsx("h2",{className:"text-base font-semibold text-content-primary",children:"用量统计"}),e.jsx("button",{onClick:a,className:"codex-btn-ghost px-2 py-1.5","aria-label":"关闭",children:e.jsx($,{size:16})})]}),e.jsx("div",{className:"mx-auto w-full max-w-5xl flex-1 overflow-y-auto px-5 py-6",children:e.jsx(z,{report:t})})]})}export{L as UsageDashboard,z as UsageDashboardContent};
|