blade-code 0.8.0 → 0.8.2
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/blade.js +2 -2
- package/dist/{chunk-hjx5n3dw.js → chunk-0g9cb41d.js} +2 -2
- package/dist/{chunk-ctqf59q1.js → chunk-0z5qe4m2.js} +1 -1
- package/dist/{chunk-d4ex0qvs.js → chunk-11s7t9dp.js} +2 -2
- package/dist/{chunk-nned222j.js → chunk-1evg2hdd.js} +2 -2
- package/dist/{chunk-xhnyy54e.js → chunk-1x3846v7.js} +1 -1
- package/dist/chunk-3wghk9bp.js +1 -0
- package/dist/{chunk-twem6p0g.js → chunk-4fye39a8.js} +2 -2
- package/dist/chunk-510rwhx6.js +1 -0
- package/dist/{chunk-kawv31m3.js → chunk-5ad4qmfj.js} +1 -1
- package/dist/{chunk-0dj326ms.js → chunk-5fw9k1ff.js} +2 -2
- package/dist/{chunk-1pt090dg.js → chunk-6avkjdjc.js} +3 -3
- package/dist/{chunk-e4a240t7.js → chunk-6jq8h5s9.js} +2 -2
- package/dist/{chunk-1smf2dj3.js → chunk-6x6zqjcs.js} +1 -1
- package/dist/{chunk-jt62ctz7.js → chunk-81p4kz0b.js} +1 -1
- package/dist/chunk-83dkggbx.js +1 -0
- package/dist/{chunk-6es6av6j.js → chunk-887qxhn5.js} +2 -2
- package/dist/{chunk-syj3anec.js → chunk-8epvwyg8.js} +2 -2
- package/dist/{chunk-tv4r86ez.js → chunk-8fp3q919.js} +2 -2
- package/dist/{chunk-yhpm9azy.js → chunk-9b297mzh.js} +1 -1
- package/dist/chunk-9jkbykwq.js +1 -0
- package/dist/{chunk-34pdtz4q.js → chunk-9xvnrq7m.js} +2 -2
- package/dist/chunk-a83s9mww.js +1 -0
- package/dist/{chunk-06h100e2.js → chunk-a90mfxv9.js} +1 -1
- package/dist/chunk-btst30by.js +6 -0
- package/dist/chunk-e9t5ga1b.js +1 -0
- package/dist/chunk-eycs00af.js +1577 -0
- package/dist/{chunk-49g067ek.js → chunk-f3pvwxp8.js} +3 -3
- package/dist/{chunk-ychj0e5q.js → chunk-fkaebj8c.js} +1 -1
- package/dist/{chunk-bm8vwfez.js → chunk-fpdqvnmq.js} +2 -2
- package/dist/chunk-gvf4gff0.js +9 -0
- package/dist/{chunk-qwdbqjh7.js → chunk-j14rn2dx.js} +2 -2
- package/dist/{chunk-ydb9myhe.js → chunk-j77gyhpf.js} +1 -1
- package/dist/chunk-kcjgbbec.js +1 -0
- package/dist/{chunk-9ad7tt9s.js → chunk-kne7h7p5.js} +1 -1
- package/dist/{chunk-9xkjb87h.js → chunk-p4yrmzyr.js} +1 -1
- package/dist/chunk-q223bq79.js +1 -0
- package/dist/chunk-qwfqp465.js +2 -0
- package/dist/{chunk-gsfkrr25.js → chunk-rxjt7ma7.js} +1 -1
- package/dist/{chunk-wmes2tt9.js → chunk-s1y8w68s.js} +1 -1
- package/dist/{chunk-yqxw7zz4.js → chunk-w11ht6f9.js} +2 -2
- package/dist/{chunk-dr06x0cw.js → chunk-w4xcmzjm.js} +1 -1
- package/dist/chunk-x83a97eh.js +1 -0
- package/dist/{chunk-jqr2pknb.js → chunk-y08szyf9.js} +32 -32
- package/dist/chunk-yfcfx0zk.js +6 -0
- package/dist/chunk-zns65xsy.js +2 -0
- package/dist/web/assets/{CodeBlockHighlighter-C1cp8dDv.js → CodeBlockHighlighter-D8_cOYpG.js} +1 -1
- package/dist/web/assets/FilePreview-60E51igH.js +7 -0
- package/dist/web/assets/{MarkdownRenderer-e1ZUy6jV.js → MarkdownRenderer-DU7jPn9K.js} +1 -1
- package/dist/web/assets/{McpModal-Raois2g1.js → McpModal-CAMU6yrS.js} +2 -2
- package/dist/web/assets/{SettingsModal-Dzuatoea.js → SettingsModal-Cjj8NUQy.js} +1 -1
- package/dist/web/assets/{SettingsStore-BxDA0Usw.js → SettingsStore-CjvkbtuZ.js} +1 -1
- package/dist/web/assets/{SkillsModal-Cg2-befH.js → SkillsModal-Cyc2JAFj.js} +1 -1
- package/dist/web/assets/{TerminalPanel-CEoQI9Lu.js → TerminalPanel-DI-Ls-U8.js} +1 -1
- package/dist/web/assets/index-BC0ssrep.js +16 -0
- package/dist/web/assets/index-Ci6gCUjf.css +1 -0
- package/dist/web/assets/{useRequest-DITGl55G.js → useRequest-B4kP-cmG.js} +1 -1
- package/dist/web/assets/{vendor-icons-BuFpOlRn.js → vendor-icons-DBM55KTG.js} +71 -41
- package/dist/web/assets/{vendor-markdown-Bo4W9Tae.js → vendor-markdown-b9iCqZWK.js} +1 -1
- package/dist/web/assets/vendor-radix-DyP_DOwV.js +45 -0
- package/dist/web/assets/{vendor-react-BalntB5F.js → vendor-react-FPIC4Czm.js} +2 -2
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunk-07jvw0kn.js +0 -1
- package/dist/chunk-14erxdhd.js +0 -1
- package/dist/chunk-3gw66r7a.js +0 -2
- package/dist/chunk-a12tmmfr.js +0 -1
- package/dist/chunk-bggvft3z.js +0 -1
- package/dist/chunk-bxbagv76.js +0 -9
- package/dist/chunk-d08wbxjr.js +0 -1
- package/dist/chunk-gytwh5y1.js +0 -6
- package/dist/chunk-hrnd3wjg.js +0 -6
- package/dist/chunk-j39q2kx7.js +0 -1
- package/dist/chunk-jakzknh3.js +0 -1570
- package/dist/chunk-n8ymp6nd.js +0 -1
- package/dist/chunk-v3ctg84r.js +0 -1
- package/dist/chunk-v5rn5r1h.js +0 -1
- package/dist/web/assets/FilePreview-DvgnEspB.js +0 -7
- package/dist/web/assets/index-BvGeIa_-.js +0 -16
- package/dist/web/assets/index-DDJnZJcp.css +0 -1
- package/dist/web/assets/vendor-radix-CESj0OOY.js +0 -45
package/dist/chunk-n8ymp6nd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as a,u as b}from"./chunk-nned222j.js";import"./chunk-6es6av6j.js";import"./chunk-dr06x0cw.js";export{a as globalOptions,b as cliConfig};
|
package/dist/chunk-v3ctg84r.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as a,h as b,i as c,j as d,k as e}from"./chunk-1smf2dj3.js";import"./chunk-dr06x0cw.js";export{b as setSkipUntilVersion,d as performUpgrade,c as getUpgradeCommand,e as checkVersionOnStartup,a as checkVersion};
|
package/dist/chunk-v5rn5r1h.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Pb as a}from"./chunk-0dj326ms.js";import"./chunk-34pdtz4q.js";import"./chunk-hjx5n3dw.js";import"./chunk-dr06x0cw.js";export{a as createChatServiceAsync};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{_ as ue}from"./vendor-markdown-Bo4W9Tae.js";import{r as i,j as e}from"./vendor-react-BalntB5F.js";import{c as F,u as Fe,e as $,s as re,B as Ce,f as ae}from"./index-BvGeIa_-.js";import{n as Be,L as xe,o as me,p as pe}from"./vendor-radix-CESj0OOY.js";import{u as Se}from"./SettingsStore-BxDA0Usw.js";import{X as Le,k as ne,n as se,i as be,x as Re,y as De}from"./vendor-icons-BuFpOlRn.js";import"./vendor-monaco-w6PwaWGP.js";const Te=Be,ge=i.forwardRef(({className:t,...a},r)=>e.jsx(xe,{ref:r,className:F("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...a}));ge.displayName=xe.displayName;const z=i.forwardRef(({className:t,...a},r)=>e.jsx(me,{ref:r,className:F("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...a}));z.displayName=me.displayName;const W=i.forwardRef(({className:t,...a},r)=>e.jsx(pe,{ref:r,className:F("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...a}));W.displayName=pe.displayName;const Ae={"ayu-dark":{background:{primary:"#0f1419",secondary:"#14191f"},text:{primary:"#e6e1cf",secondary:"#bae67e",muted:"#5c6773"},border:{light:"#2d323b"},syntax:{comment:"#5c6773",string:"#bae67e",number:"#ffcc66",keyword:"#ff8f40",function:"#73d0ff",variable:"#e6e1cf",operator:"#f29e74",type:"#73d0ff",tag:"#ff8f40",attr:"#ffd580",default:"#e6e1cf"}},dracula:{background:{primary:"#282a36",secondary:"#44475a"},text:{primary:"#f8f8f2",secondary:"#f1fa8c",muted:"#6272a4"},border:{light:"#44475a"},syntax:{comment:"#6272a4",string:"#f1fa8c",number:"#bd93f9",keyword:"#ff79c6",function:"#50fa7b",variable:"#f8f8f2",operator:"#ff79c6",type:"#8be9fd",tag:"#ff79c6",attr:"#50fa7b",default:"#f8f8f2"}},monokai:{background:{primary:"#272822",secondary:"#3e3d32"},text:{primary:"#f8f8f2",secondary:"#e6db74",muted:"#75715e"},border:{light:"#3e3d32"},syntax:{comment:"#75715e",string:"#e6db74",number:"#ae81ff",keyword:"#f92672",function:"#a6e22e",variable:"#f8f8f2",operator:"#f92672",type:"#66d9ef",tag:"#f92672",attr:"#a6e22e",default:"#f8f8f2"}},nord:{background:{primary:"#2e3440",secondary:"#3b4252"},text:{primary:"#eceff4",secondary:"#d8dee9",muted:"#4c566a"},border:{light:"#434c5e"},syntax:{comment:"#616e88",string:"#a3be8c",number:"#b48ead",keyword:"#81a1c1",function:"#88c0d0",variable:"#d8dee9",operator:"#81a1c1",type:"#8fbcbb",tag:"#81a1c1",attr:"#8fbcbb",default:"#eceff4"}},"solarized-light":{background:{primary:"#fdf6e3",secondary:"#eee8d5"},text:{primary:"#586e75",secondary:"#657b83",muted:"#93a1a1"},border:{light:"#eee8d5"},syntax:{comment:"#93a1a1",string:"#2aa198",number:"#d33682",keyword:"#859900",function:"#268bd2",variable:"#657b83",operator:"#859900",type:"#b58900",tag:"#268bd2",attr:"#93a1a1",default:"#657b83"}},"solarized-dark":{background:{primary:"#002b36",secondary:"#073642"},text:{primary:"#839496",secondary:"#93a1a1",muted:"#586e75"},border:{light:"#073642"},syntax:{comment:"#586e75",string:"#2aa198",number:"#d33682",keyword:"#859900",function:"#268bd2",variable:"#839496",operator:"#859900",type:"#b58900",tag:"#268bd2",attr:"#93a1a1",default:"#839496"}},"tokyo-night":{background:{primary:"#1a1b26",secondary:"#292e42"},text:{primary:"#a9b1d6",secondary:"#c0caf5",muted:"#565f89"},border:{light:"#292e42"},syntax:{comment:"#565f89",string:"#9ece6a",number:"#ff9e64",keyword:"#bb9af7",function:"#7aa2f7",variable:"#c0caf5",operator:"#89ddff",type:"#7dcfff",tag:"#f7768e",attr:"#7aa2f7",default:"#a9b1d6"}},github:{background:{primary:"#ffffff",secondary:"#f6f8fa"},text:{primary:"#24292f",secondary:"#57606a",muted:"#6e7781"},border:{light:"#d0d7de"},syntax:{comment:"#6e7781",string:"#0a3069",number:"#0550ae",keyword:"#cf222e",function:"#8250df",variable:"#24292f",operator:"#cf222e",type:"#0550ae",tag:"#116329",attr:"#0550ae",default:"#24292f"}},gruvbox:{background:{primary:"#282828",secondary:"#3c3836"},text:{primary:"#ebdbb2",secondary:"#d5c4a1",muted:"#928374"},border:{light:"#3c3836"},syntax:{comment:"#928374",string:"#b8bb26",number:"#d3869b",keyword:"#fb4934",function:"#b8bb26",variable:"#ebdbb2",operator:"#fe8019",type:"#fabd2f",tag:"#fb4934",attr:"#fabd2f",default:"#ebdbb2"}},"one-dark":{background:{primary:"#282c34",secondary:"#21252b"},text:{primary:"#abb2bf",secondary:"#e5c07b",muted:"#5c6370"},border:{light:"#3e4451"},syntax:{comment:"#5c6370",string:"#98c379",number:"#d19a66",keyword:"#c678dd",function:"#61afef",variable:"#e06c75",operator:"#56b6c2",type:"#e5c07b",tag:"#e06c75",attr:"#d19a66",default:"#abb2bf"}},catppuccin:{background:{primary:"#1e1e2e",secondary:"#313244"},text:{primary:"#cdd6f4",secondary:"#f5e0dc",muted:"#6c7086"},border:{light:"#313244"},syntax:{comment:"#6c7086",string:"#a6e3a1",number:"#fab387",keyword:"#cba6f7",function:"#89b4fa",variable:"#f5e0dc",operator:"#89dceb",type:"#f9e2af",tag:"#f38ba8",attr:"#f9e2af",default:"#cdd6f4"}},"rose-pine":{background:{primary:"#191724",secondary:"#1f1d2e"},text:{primary:"#e0def4",secondary:"#908caa",muted:"#6e6a86"},border:{light:"#26233a"},syntax:{comment:"#6e6a86",string:"#f6c177",number:"#ebbcba",keyword:"#c4a7e7",function:"#9ccfd8",variable:"#e0def4",operator:"#31748f",type:"#eb6f92",tag:"#eb6f92",attr:"#c4a7e7",default:"#e0def4"}},kanagawa:{background:{primary:"#1f1f28",secondary:"#2a2a37"},text:{primary:"#dcd7ba",secondary:"#c8c093",muted:"#727169"},border:{light:"#2a2a37"},syntax:{comment:"#727169",string:"#98bb6c",number:"#d27e99",keyword:"#957fb8",function:"#7e9cd8",variable:"#dcd7ba",operator:"#c0a36e",type:"#7aa89f",tag:"#e46876",attr:"#ffa066",default:"#dcd7ba"}}};function _e(t){const a=t.replace("#",""),r=parseInt(a.substring(0,2),16),s=parseInt(a.substring(2,4),16),o=parseInt(a.substring(4,6),16);return(.299*r+.587*s+.114*o)/255<.5}function $e(t){return{base:_e(t.background.primary)?"vs-dark":"vs",inherit:!0,rules:[{token:"",foreground:t.text.primary.replace("#",""),background:t.background.primary.replace("#","")},{token:"comment",foreground:t.syntax.comment.replace("#",""),fontStyle:"italic"},{token:"string",foreground:t.syntax.string.replace("#","")},{token:"number",foreground:t.syntax.number.replace("#","")},{token:"keyword",foreground:t.syntax.keyword.replace("#","")},{token:"type",foreground:t.syntax.type.replace("#","")},{token:"identifier",foreground:t.syntax.variable.replace("#","")},{token:"function",foreground:t.syntax.function.replace("#","")},{token:"variable",foreground:t.syntax.variable.replace("#","")},{token:"operator",foreground:t.syntax.operator.replace("#","")},{token:"delimiter",foreground:t.syntax.operator.replace("#","")},{token:"tag",foreground:t.syntax.tag.replace("#","")},{token:"attribute.name",foreground:t.syntax.attr.replace("#","")},{token:"attribute.value",foreground:t.syntax.string.replace("#","")}],colors:{"editor.background":t.background.primary,"editor.foreground":t.text.primary,"editor.lineHighlightBackground":t.background.secondary,"editor.selectionBackground":`${t.syntax.function}40`,"editorLineNumber.foreground":t.text.muted,"editorLineNumber.activeForeground":t.text.secondary,"editorCursor.foreground":t.text.primary,"editorIndentGuide.background":t.border.light,"editorWidget.background":t.background.secondary,"editorWidget.border":t.border.light,"scrollbarSlider.background":`${t.text.muted}40`,"scrollbarSlider.hoverBackground":`${t.text.muted}60`}}}const oe=new Set;function de(t,a){const r=a.toLowerCase().replace(/\s+/g,"-"),s=Ae[r];if(!s)return"vs-dark";if(!oe.has(r)){const o=$e(s);t.editor.defineTheme(r,o),oe.add(r)}return r}i.lazy(async()=>({default:(await ue(()=>import("./vendor-react-BalntB5F.js").then(a=>a.k),[])).DiffEditor}));const ze=i.lazy(async()=>({default:(await ue(()=>import("./vendor-react-BalntB5F.js").then(a=>a.k),[])).Editor}));function ie(t,a){return t instanceof Error?t.message:a}function Ye(){const{toggleFilePreview:t}=Fe(),{messages:a,currentSessionRef:r}=$(),[s,o]=i.useState("diff"),[l,c]=i.useState([]),[d,u]=i.useState({}),[x,m]=i.useState(!1),[b,p]=i.useState(null),[q,E]=i.useState({}),[C,I]=i.useState({}),[v,Q]=i.useState(null),[ye,P]=i.useState(""),[G,O]=i.useState(!1),[V,J]=i.useState(null),[Y,H]=i.useState(!1),Z=i.useRef(r),B=i.useRef(0),D=i.useRef(0),T=i.useRef({}),K=i.useRef(0),S=i.useRef({}),j=i.useRef({}),U=i.useRef(null);i.useLayoutEffect(()=>{re(Z.current,r)||(B.current+=1),Z.current=r},[r]);const X=(n,f)=>f===B.current&&re($.getState().currentSessionRef,n),M=async(n,f="")=>{const g=f?`/suggestions/files/tree?path=${encodeURIComponent(f)}`:"/suggestions/files/tree",h=await fetch(g,{headers:ae(n)});if(!h.ok)throw new Error("Failed to load tree");return(await h.json()).map(y=>({...y,children:y.type==="dir"?[]:void 0}))};i.useEffect(()=>{const n=++D.current;return(async()=>{if(!r){c([]),m(!1),p(null);return}const g={...r},h=B.current,k=()=>n===D.current&&X(g,h);if(k()){c([]),m(!0),p(null);try{const y=await M(g);k()&&c(y)}catch(y){k()&&p(ie(y,"Failed to load tree"))}finally{k()&&m(!1)}}})(),()=>{D.current===n&&(D.current+=1)}},[r==null?void 0:r.projectPath,r==null?void 0:r.sessionId]),i.useEffect(()=>{U.current=null,S.current={},j.current={},T.current={},K.current+=1,Q(null),P(""),O(!1),J(null),H(!1),E({}),u({})},[r==null?void 0:r.projectPath,r==null?void 0:r.sessionId]);const A=i.useMemo(()=>Ie(a),[a]),ee=i.useMemo(()=>qe(a),[a]),[ke,ve]=i.useState({}),Ee=n=>{ve(f=>({...f,[n]:!f[n]}))},je=async n=>{const f=$.getState().currentSessionRef;if(!f)return;const g=B.current,h=++K.current,k=()=>h===K.current&&U.current===n&&X(f,g);U.current=n,Q(n),P(""),O(!0),J(null),H(!1);try{const y=await fetch(`/suggestions/files/content?path=${encodeURIComponent(n)}`,{headers:ae(f)});if(!y.ok)throw new Error("Failed to load file");const L=await y.json();k()&&(P(L.content||""),H(!!L.truncated))}catch(y){k()&&J(ie(y,"Failed to load file"))}finally{k()&&O(!1)}},we=async n=>{const f=(T.current[n]??0)+1;T.current[n]=f;const g=!S.current[n],h={...S.current,[n]:g};if(S.current=h,E(h),!g||j.current[n])return;const k=$.getState().currentSessionRef;if(!k)return;const y=B.current,L=()=>T.current[n]===f&&S.current[n]===!0&&X(k,y);try{const _=await M(k,n);if(L()){const te={...j.current,[n]:_};j.current=te,u(te)}}catch{if(L()){const _={...j.current,[n]:[]};j.current=_,u(_)}}},Ne=n=>{I(f=>({...f,[n]:!f[n]}))};return e.jsxs("div",{className:"w-[55%] min-w-[420px] max-w-[860px] border-l border-[#E5E7EB] dark:border-zinc-800 bg-white dark:bg-[#09090b] flex flex-col h-full shadow-xl shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 h-12 border-b border-[#E5E7EB] dark:border-zinc-800 shrink-0",children:[e.jsx("span",{className:"font-normal text-[13px] text-[#6B7280] dark:text-zinc-400 font-mono",children:"Preview"}),e.jsx(Ce,{variant:"ghost",size:"icon",onClick:t,className:"h-8 w-8 text-[#9CA3AF] hover:text-[#111827] hover:bg-[#E5E7EB]/60 dark:text-zinc-500 dark:hover:text-zinc-300 dark:hover:bg-zinc-800/50",children:e.jsx(Le,{className:"w-4 h-4"})})]}),e.jsxs(Te,{value:s,onValueChange:n=>o(n),className:"flex flex-col flex-1 min-h-0",children:[e.jsx("div",{className:"px-4 py-3 border-b border-[#E5E7EB] dark:border-zinc-800",children:e.jsxs(ge,{className:"bg-white dark:bg-[#111113] border border-[#E5E7EB] dark:border-[#27272a] h-9 p-1 rounded-md w-full justify-start",children:[e.jsx(z,{value:"diff",className:"text-[12px] font-mono px-3 text-[#6B7280] dark:text-[#a1a1aa] data-[state=active]:bg-[#E5E7EB] data-[state=active]:text-[#111827] dark:data-[state=active]:bg-[#27272a] dark:data-[state=active]:text-white",children:"Diff"}),e.jsx(z,{value:"files",className:"text-[12px] font-mono px-3 text-[#6B7280] dark:text-[#a1a1aa] data-[state=active]:bg-[#E5E7EB] data-[state=active]:text-[#111827] dark:data-[state=active]:bg-[#27272a] dark:data-[state=active]:text-white",children:"Files"}),e.jsx(z,{value:"logs",className:"text-[12px] font-mono px-3 text-[#6B7280] dark:text-[#a1a1aa] data-[state=active]:bg-[#E5E7EB] data-[state=active]:text-[#111827] dark:data-[state=active]:bg-[#27272a] dark:data-[state=active]:text-white",children:"Logs"})]})}),e.jsx(W,{value:"diff",className:"overflow-hidden flex-1 mt-0",children:e.jsx("div",{className:"overflow-y-auto px-4 py-4 space-y-3 h-full",children:A.length===0?e.jsx(R,{title:"No patch yet",subtitle:"Run a tool that changes files to see diffs here."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-[12px] text-[#6B7280] dark:text-[#71717a] font-mono mb-2",children:[A.length," changed file",A.length>1?"s":""]}),A.map(n=>{var h;const f=((h=n.filePath)==null?void 0:h.split("/").pop())||"unknown",g=ke[n.filePath||""]!==!1;return e.jsxs("div",{className:"border border-[#E5E7EB] dark:border-[#27272a] rounded-lg overflow-hidden",children:[e.jsxs("button",{onClick:()=>Ee(n.filePath||""),className:"w-full flex items-center gap-2 px-3 py-2 bg-[#F9FAFB] dark:bg-[#111113] hover:bg-[#F3F4F6] dark:hover:bg-[#18181b] transition-colors",children:[g?e.jsx(ne,{className:"w-4 h-4 text-[#6B7280] dark:text-[#71717a]"}):e.jsx(se,{className:"w-4 h-4 text-[#6B7280] dark:text-[#71717a]"}),e.jsx(be,{className:"w-4 h-4 text-[#6B7280] dark:text-[#71717a]"}),e.jsx("span",{className:"text-[13px] text-[#111827] dark:text-[#E5E5E5] font-mono flex-1 text-left truncate",children:f}),n.summary&&e.jsx("span",{className:"text-[11px] text-[#6B7280] dark:text-[#a1a1aa] font-mono",children:n.summary})]}),g&&e.jsxs("div",{className:"border-t border-[#E5E7EB] dark:border-[#27272a]",children:[e.jsx("div",{className:"px-3 py-1 text-[11px] text-[#9CA3AF] dark:text-[#52525b] font-mono truncate",children:n.filePath}),e.jsx(Oe,{diff:n.diff})]})]},n.filePath)})]})})}),e.jsx(W,{value:"files",className:"overflow-hidden flex-1 mt-0",children:e.jsxs("div",{className:"px-4 py-4 h-full",children:[x&&e.jsx(R,{title:"Loading files…",subtitle:"Fetching workspace tree."}),!x&&b&&e.jsx(R,{title:"Failed to load files",subtitle:b}),!x&&!b&&l.length===0&&e.jsx(R,{title:"No files yet",subtitle:"Start a session to load the workspace tree."}),!x&&!b&&l.length>0&&e.jsxs("div",{className:"h-full grid grid-cols-[220px_1fr] gap-4 min-h-0",children:[e.jsx("div",{className:"border border-[#E5E7EB] dark:border-[#27272a] rounded-lg p-2 overflow-y-auto min-h-0",children:l.map(n=>e.jsx(he,{node:n,depth:0,expandedDirs:q,childrenCache:d,toggleDir:we,selectedPath:v,onSelectFile:je},n.path))}),e.jsxs("div",{className:"border border-[#E5E7EB] dark:border-[#27272a] rounded-lg overflow-hidden flex flex-col min-h-0",children:[e.jsxs("div",{className:"px-3 py-2 bg-[#F9FAFB] dark:bg-[#111113] border-b border-[#E5E7EB] dark:border-[#27272a] text-[12px] text-[#6B7280] dark:text-[#71717a] font-mono flex items-center justify-between",children:[e.jsx("span",{children:v||"Select a file to preview"}),v&&e.jsx("span",{className:"text-[11px] text-[#9CA3AF] dark:text-[#a1a1aa] font-mono",children:G?"Loading…":Y?"Truncated":"Ready"})]}),Y&&!G&&e.jsx("div",{className:"px-3 py-2 bg-[#FEF3C7] dark:bg-[#111113] border-b border-[#E5E7EB] dark:border-[#27272a] text-[11px] text-[#b45309] dark:text-[#facc15] font-mono",children:"Preview truncated to 200k characters."}),e.jsxs("div",{className:"flex-1 min-h-0",children:[!v&&e.jsx("div",{className:"h-full flex items-center justify-center text-[12px] text-[#6B7280] dark:text-[#71717a] font-mono",children:"Pick a file from the tree to preview."}),v&&V&&e.jsx("div",{className:"h-full flex items-center justify-center text-[12px] text-[#DC2626] dark:text-[#fca5a5] font-mono",children:V}),v&&!V&&e.jsx("div",{className:"h-full",children:G?e.jsx(fe,{}):e.jsx(i.Suspense,{fallback:e.jsx(fe,{}),children:e.jsx(Pe,{content:ye,filename:v})})})]})]})]})]})}),e.jsx(W,{value:"logs",className:"overflow-hidden flex-1 mt-0",children:e.jsx("div",{className:"overflow-y-auto px-4 py-4 space-y-3 h-full",children:ee.length===0?e.jsx(R,{title:"No logs yet",subtitle:"Tool runs will appear here."}):ee.map(n=>{var y;const f=C[n.id],g=(n.content||"").split(`
|
|
2
|
-
`),h=g.length>10||(((y=n.content)==null?void 0:y.length)||0)>800,k=f||!h?g:g.slice(0,8);return e.jsxs("div",{className:"border border-[#E5E7EB] dark:border-[#27272a] rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 bg-[#F9FAFB] dark:bg-[#111113] border-b border-[#E5E7EB] dark:border-[#27272a]",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("div",{className:"text-[12px] text-[#111827] dark:text-[#E5E5E5] font-mono",children:n.title}),n.subtitle&&e.jsx("div",{className:"text-[11px] text-[#6B7280] dark:text-[#71717a] font-mono",children:n.subtitle})]}),e.jsx(We,{status:n.status})]}),n.content&&e.jsxs("div",{className:"px-3 py-3 space-y-2",children:[e.jsxs("pre",{className:"text-[12px] text-[#374151] dark:text-[#d4d4d8] bg-[#F3F4F6] dark:bg-[#09090b] border border-[#E5E7EB] dark:border-[#27272a] rounded-md p-3 overflow-x-auto whitespace-pre-wrap font-mono",children:[k.join(`
|
|
3
|
-
`),!f&&h&&`
|
|
4
|
-
…`]}),h&&e.jsxs("button",{onClick:()=>Ne(n.id),className:"flex items-center gap-1 text-[12px] text-[#6B7280] dark:text-[#a1a1aa] font-mono hover:text-[#111827] dark:hover:text-[#E5E5E5] transition-colors",children:[f?e.jsx(ne,{className:"w-3 h-3"}):e.jsx(se,{className:"w-3 h-3"}),f?"Collapse":"Expand"]})]})]},n.id)})})})]})]})}function R({title:t,subtitle:a}){return e.jsxs("div",{className:"border border-dashed border-[#E5E7EB] dark:border-[#27272a] rounded-lg p-6 text-center",children:[e.jsx("div",{className:"text-[13px] text-[#111827] dark:text-[#E5E5E5] font-mono",children:t}),e.jsx("div",{className:"text-[12px] text-[#6B7280] dark:text-[#71717a] font-mono mt-1",children:a})]})}function We({status:t}){const a=t==="success"?"Success":t==="error"?"Failed":"Running",r=t==="success"?"bg-[#22C55E] text-white":t==="error"?"bg-[#FEE2E2] text-[#b91c1c] dark:bg-[#EF4444]/20 dark:text-[#fca5a5]":"bg-[#E5E7EB] text-[#6B7280] dark:bg-[#27272a] dark:text-[#a1a1aa]";return e.jsx("span",{className:F("text-[11px] px-2 py-0.5 rounded-full font-mono",r),children:a})}function he({node:t,depth:a,expandedDirs:r,childrenCache:s,toggleDir:o,onSelectFile:l,selectedPath:c}){const d=t.type==="dir",u=r[t.path],x=!d&&c===t.path,m=s[t.path]||[];return e.jsxs("div",{children:[e.jsx("button",{onClick:()=>{d?o(t.path):l(t.path)},className:F("flex items-center gap-2 w-full text-left text-[12px] font-mono px-2 py-1 rounded-md transition-colors",x?"bg-[#16A34A]/10 text-[#111827] dark:bg-[#22C55E]/10 dark:text-[#E5E5E5]":"hover:bg-[#F3F4F6] text-[#6B7280] dark:hover:bg-[#111113] dark:text-[#a1a1aa]",d&&"cursor-pointer",x&&"border border-[#16A34A]/30 dark:border-[#22C55E]/30"),style:{paddingLeft:a*14+8},children:d?e.jsxs(e.Fragment,{children:[u?e.jsx(Re,{className:"h-3.5 w-3.5 shrink-0 text-[#111827] dark:text-[#E5E5E5]"}):e.jsx(De,{className:"h-3.5 w-3.5 shrink-0 text-[#6B7280] dark:text-[#a1a1aa]"}),e.jsx("span",{className:"text-[#111827] dark:text-[#E5E5E5] truncate",children:t.name})]}):e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"h-3.5 w-3.5 shrink-0 text-[#9CA3AF] dark:text-[#71717a]"}),e.jsx("span",{className:"text-[#111827] dark:text-[#E5E5E5] truncate",children:t.name})]})}),d&&u&&e.jsx("div",{children:m.map(b=>e.jsx(he,{node:b,depth:a+1,expandedDirs:r,childrenCache:s,toggleDir:o,onSelectFile:l,selectedPath:c},b.path))})]})}function qe(t){return t.flatMap(a=>{var o,l,c;const r=[];if((o=a.agentContent)!=null&&o.toolCalls)for(const d of a.agentContent.toolCalls){const u=le(d.arguments),x=d.output,m=x?(l=N(x))!=null&&l.diff?ce(x):x:void 0;r.push({id:`${a.id}-${d.toolCallId}`,title:d.toolName||"Tool",subtitle:d.summary,status:d.status==="success"?"success":d.status==="error"?"error":"running",content:m||(u?`Arguments:
|
|
5
|
-
${u}`:void 0),timestamp:a.timestamp})}const s=a.metadata;if(s){if(s.kind==="tool_call"){const d=s.toolName||"Tool",u=le(s.arguments);r.push({id:a.id,title:`Tool Call · ${d}`,subtitle:s.toolKind?String(s.toolKind):void 0,status:s.status==="success"?"success":s.status==="error"?"error":"running",content:u?`Arguments:
|
|
6
|
-
${u}`:void 0,timestamp:a.timestamp})}if(s.kind==="tool_result"){const d=s.toolName||"Tool",u=s.success,x=s.summary,m=s.output,b=m?(c=N(m))!=null&&c.diff?ce(m):m:void 0;r.push({id:a.id,title:`Tool Result · ${d}`,subtitle:x,status:u===void 0?"running":u?"success":"error",content:b,timestamp:a.timestamp})}}return r})}function Ie(t){var s;const a=[],r=new Set;for(let o=t.length-1;o>=0;o-=1){const l=t[o];if((s=l.agentContent)!=null&&s.toolCalls)for(let m=l.agentContent.toolCalls.length-1;m>=0;m-=1){const b=l.agentContent.toolCalls[m],p=b.metadata,q=b.output||"",E=N(q)||N((p==null?void 0:p.diff_snippet)||"");if(E!=null&&E.diff){const C=(p==null?void 0:p.file_path)||b.toolName||"unknown";if(!r.has(C)){r.add(C);const I=typeof(p==null?void 0:p.oldContent)=="string"?p.oldContent:void 0,v=typeof(p==null?void 0:p.newContent)=="string"?p.newContent:void 0;a.push({diff:E.diff,filePath:C,summary:b.summary,oldContent:I,newContent:v})}}}const c=l.metadata;if(!c||c.kind!=="tool_result")continue;const d=c.metadata,u=c.output||(typeof l.content=="string"?l.content:"")||"",x=N(u)||N((d==null?void 0:d.diff_snippet)||"");if(x!=null&&x.diff){const m=(d==null?void 0:d.file_path)||c.toolName||"unknown";if(!r.has(m)){r.add(m);const b=typeof(d==null?void 0:d.oldContent)=="string"?d.oldContent:void 0,p=typeof(d==null?void 0:d.newContent)=="string"?d.newContent:void 0;a.push({diff:x.diff,filePath:m,summary:c.summary,oldContent:b,newContent:p})}}}return a.reverse()}function N(t){if(!t)return null;const a=/<<<DIFF>>>\s*([\s\S]*?)\s*<<<\/DIFF>>>/m,r=t.match(a);if(!r)return null;try{return{diff:JSON.parse(r[1])}}catch{return null}}function ce(t){return t?t.replace(/<<<DIFF>>>[\s\S]*?<<<\/DIFF>>>/m,"").trim():""}function le(t){if(!t)return"";if(typeof t=="string")try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}return JSON.stringify(t,null,2)}function fe(){return e.jsx("div",{className:"h-full flex items-center justify-center text-[12px] text-[#6B7280] dark:text-[#71717a] font-mono",children:"Loading editor…"})}function Pe({content:t,filename:a}){const{theme:r}=Se(),s=i.useRef(null),[o,l]=i.useState("vs-dark"),c=Ge(a),d=u=>{s.current=u;const x=de(u,r);l(x)};return i.useEffect(()=>{if(s.current){const u=de(s.current,r);l(u)}},[r]),e.jsx(ze,{value:t,language:c,theme:o,height:"100%",beforeMount:d,options:{readOnly:!0,minimap:{enabled:!1},fontSize:12,lineNumbers:"on",wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0}},a)}function Ge(t){var s;const a=((s=t.split(".").pop())==null?void 0:s.toLowerCase())||"";return{ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",json:"json",md:"markdown",css:"css",scss:"scss",html:"html",yml:"yaml",yaml:"yaml",go:"go",rs:"rust",py:"python",java:"java",c:"c",cpp:"cpp",h:"cpp",hpp:"cpp",sh:"shell",zsh:"shell",toml:"toml",xml:"xml"}[a]||"plaintext"}function Oe({diff:t}){const a=t.patch.split(`
|
|
7
|
-
`);let r=0,s=0;return e.jsxs("div",{className:"border border-[#E5E7EB] dark:border-[#27272a] rounded-md overflow-hidden bg-white dark:bg-[#111113]",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-[#E5E7EB] dark:border-[#27272a] bg-[#F9FAFB] dark:bg-[#111113] text-[12px] text-[#6B7280] dark:text-[#71717a] font-mono",children:[e.jsx("span",{children:"Patch"}),t.matchLine&&e.jsxs("span",{children:["Line ",t.matchLine]})]}),e.jsx("div",{className:"text-[12px] font-mono",children:a.map((o,l)=>{if(o.startsWith("@@")){const c=/@@ -(?<old>\d+),?(?<oldCount>\d*) \+(?<new>\d+),?(?<newCount>\d*) @@/.exec(o);return c!=null&&c.groups&&(r=parseInt(c.groups.old,10),s=parseInt(c.groups.new,10)),e.jsx(w,{line:o},`${o}-${l}`)}if(o.startsWith("---")||o.startsWith("+++")||o.startsWith("Index:")||o.startsWith("==="))return e.jsx(w,{line:o},`${o}-${l}`);if(o.startsWith("+")){const c=s;return s+=1,e.jsx(w,{line:o,oldLine:null,newLine:c},`${o}-${l}`)}if(o.startsWith("-")){const c=r;return r+=1,e.jsx(w,{line:o,oldLine:c,newLine:null},`${o}-${l}`)}if(o.startsWith(" ")){const c=r,d=s;return r+=1,s+=1,e.jsx(w,{line:o,oldLine:c,newLine:d},`${o}-${l}`)}return e.jsx(w,{line:o},`${o}-${l}`)})})]})}function w({line:t,oldLine:a,newLine:r}){const s=t.startsWith("---")||t.startsWith("+++")||t.startsWith("Index:")||t.startsWith("==="),o=t.startsWith("@@"),l=t[0],c=s||o?t:t.slice(1),d=s?"text-[#6B7280] dark:text-[#a1a1aa]":l==="+"?"text-[#166534] bg-[#22C55E]/10 dark:text-[#86efac] dark:bg-[#22C55E]/10":l==="-"?"text-[#b91c1c] bg-[#EF4444]/10 dark:text-[#fca5a5] dark:bg-[#EF4444]/10":o?"text-[#1d4ed8] bg-[#DBEAFE] dark:text-[#93c5fd] dark:bg-[#1e3a8a]/30":"text-[#374151] dark:text-[#d4d4d8]";return e.jsxs("div",{className:F("grid grid-cols-[40px_40px_1fr] gap-2 px-3 py-0.5",d),children:[e.jsx("span",{className:"text-right text-[#9CA3AF] dark:text-[#71717a]",children:a?String(a).padStart(2," "):""}),e.jsx("span",{className:"text-right text-[#9CA3AF] dark:text-[#71717a]",children:r?String(r).padStart(2," "):""}),e.jsx("span",{className:"whitespace-pre",children:c})]})}export{Ye as FilePreview};
|