@jyork0828/pi-pilot 0.0.6 → 0.1.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jyork0828/pi-pilot",
3
- "version": "0.0.6",
3
+ "version": "0.1.0",
4
4
  "private": false,
5
5
  "description": "Browser UI for the pi coding agent.",
6
6
  "type": "module",
@@ -14,9 +14,10 @@
14
14
  "README.md"
15
15
  ],
16
16
  "dependencies": {
17
- "@earendil-works/pi-coding-agent": "0.75.4",
17
+ "@earendil-works/pi-coding-agent": "0.78.0",
18
18
  "@hono/node-server": "^1.13.7",
19
19
  "hono": "^4.6.14",
20
+ "node-pty": "^1.1.0",
20
21
  "typebox": "1.1.38",
21
22
  "undici": "8.3.0",
22
23
  "ws": "^8.18.0"
@@ -0,0 +1 @@
1
+ import{j as e,r as c}from"./markdown-CY-Rm0E5.js";import{a as I,A as T,b as k,_ as E,Z as h,N as _,U as P,Y as B,B as y,O as R,av as F,au as H,J as N,l as S,E as L,g as D,I as W,X as K,e as M,f as O,a6 as U,C as V,h as Y,c as z,H as b,p as G}from"./index-DfuMmOel.js";import{R as J}from"./ResizablePanelShell-Cbkq9Bs-.js";import"./shiki-BZ0sbaMe.js";function se({open:t,onClose:o}){return t?e.jsx(J,{storageKey:k,defaultWidth:T,min:I,children:e.jsx(X,{onClose:o})}):null}function X({onClose:t}){const o=E(r=>r.items),n=h(r=>r.selectedToolCallId),a=h(r=>r.select),i=c.useMemo(()=>_(o),[o]),s=P(i,n)??B(i),[d,x]=c.useState("preview"),C=s==null?void 0:s.toolCallId;if(c.useEffect(()=>{x("preview")},[C]),!s)return e.jsxs(e.Fragment,{children:[e.jsx(g,{title:"Artifacts",onClose:t}),e.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-8 text-center",children:[e.jsx(y,{className:"h-6 w-6 text-muted-foreground/50"}),e.jsxs("p",{className:"text-[12.5px] leading-relaxed text-muted-foreground",children:["No artifacts yet. When the agent publishes one with"," ",e.jsx("span",{className:"font-mono text-[11.5px]",children:"create_artifact"}),", it shows up here."]})]})]});const u=R(i),p=F(i,s.id),l=H(i,s),f=r=>{const w=p.findIndex(A=>A.toolCallId===s.toolCallId),m=p[w+r];m&&a(m.toolCallId)};return e.jsxs(e.Fragment,{children:[e.jsx(g,{title:s.title,onClose:t}),u.length>1&&e.jsx("div",{className:"flex gap-1 overflow-x-auto border-b border-border-soft px-2 py-1.5",children:u.map(r=>e.jsx("button",{type:"button",onClick:()=>a(r.toolCallId),title:r.title,className:N("max-w-[160px] shrink-0 truncate rounded-md px-2 py-0.5 text-[11.5px] font-medium transition-colors",r.id===s.id?"bg-brand-ghost text-brand-strong":"text-muted-foreground hover:bg-accent/60 hover:text-foreground"),children:r.title},r.id))}),e.jsxs("div",{className:"flex items-center gap-2 border-b border-border-soft px-3 py-1.5",children:[e.jsx(S,{tone:"ghost",children:s.type}),l.count>1&&e.jsxs("div",{className:"flex items-center gap-0.5 text-muted-foreground",children:[e.jsx(v,{dir:"prev",disabled:l.index<=1,onClick:()=>f(-1)}),e.jsxs("span",{className:"font-mono text-[11px] tabular-nums",children:["v",l.index,"/",l.count]}),e.jsx(v,{dir:"next",disabled:l.index>=l.count,onClick:()=>f(1)})]}),e.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[(s.type==="html"||s.type==="svg")&&e.jsxs("div",{className:"flex items-center gap-0.5 rounded-md border border-border-soft bg-card p-0.5 text-[11px] font-medium",children:[e.jsx(j,{active:d==="preview",onClick:()=>x("preview"),icon:e.jsx(L,{className:"h-3 w-3"}),label:"Preview"}),e.jsx(j,{active:d==="code",onClick:()=>x("code"),icon:e.jsx(D,{className:"h-3 w-3"}),label:"Code"})]}),e.jsx($,{content:s.content})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:e.jsx(Z,{record:s,view:d})})]})}function Z({record:t,view:o}){const{type:n,content:a,language:i}=t;return n==="markdown"?e.jsx("div",{className:"px-4 py-3",children:e.jsx(z,{text:a})}):n==="code"?e.jsx(b,{code:a,lang:i,className:"px-4 py-3"}):o==="code"?e.jsx(b,{code:a,lang:n,className:"px-4 py-3"}):e.jsx(G,{code:a,lang:n})}function g({title:t,onClose:o}){return e.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[e.jsx(y,{className:"h-3.5 w-3.5 shrink-0 text-brand"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium text-foreground",title:t,children:t}),e.jsx(W,{title:"Close",onClick:o,"aria-label":"Close artifacts panel",children:e.jsx(K,{className:"h-3.5 w-3.5"})})]})}function j({active:t,onClick:o,icon:n,label:a}){return e.jsxs("button",{type:"button",onClick:o,"aria-pressed":t,className:N("flex items-center gap-1 rounded-[5px] px-1.5 py-0.5 transition-colors",t?"bg-brand-ghost text-brand-strong":"text-muted-foreground hover:text-foreground"),children:[n,a]})}function v({dir:t,disabled:o,onClick:n}){return e.jsx("button",{type:"button",onClick:n,disabled:o,"aria-label":t==="prev"?"Previous version":"Next version",className:"rounded p-0.5 transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-30",children:t==="prev"?e.jsx(M,{className:"h-3.5 w-3.5"}):e.jsx(O,{className:"h-3.5 w-3.5"})})}function $({content:t}){const o=U(s=>s.pushToast),[n,a]=c.useState(!1),i=async()=>{try{await navigator.clipboard.writeText(t),a(!0),setTimeout(()=>a(!1),1200)}catch{o({id:`copy-${Date.now()}`,workspaceId:"",message:"Copy failed — clipboard not available",notifyType:"warning"})}};return e.jsx("button",{type:"button",onClick:i,title:"Copy content","aria-label":"Copy artifact content",className:"rounded-md border border-border-soft bg-card p-1 text-muted-foreground transition-colors hover:text-foreground",children:n?e.jsx(V,{className:"h-3 w-3 text-signal-ok"}):e.jsx(Y,{className:"h-3 w-3"})})}export{se as ArtifactsPanel};
@@ -0,0 +1,56 @@
1
+ import{j as t,r as x}from"./markdown-CY-Rm0E5.js";import{M as g,q as K,J as w,K as O,j as B,F as W,a0 as $,at as Q,i as D,X as I,I as L,a7 as Y,r as _,W as Z,a8 as G,ah as J,n as P,Q as U,V as X,f as ee}from"./index-DfuMmOel.js";import{R as te}from"./ResizablePanelShell-Cbkq9Bs-.js";import"./shiki-BZ0sbaMe.js";/**
2
+ * @license lucide-react v0.468.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const se=g("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
7
+ * @license lucide-react v0.468.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const ne=g("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
12
+ * @license lucide-react v0.468.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const ae=g("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/**
17
+ * @license lucide-react v0.468.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const re=g("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/**
22
+ * @license lucide-react v0.468.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const oe=g("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
27
+ * @license lucide-react v0.468.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const ce=g("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);/**
32
+ * @license lucide-react v0.468.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const ie=g("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
37
+ * @license lucide-react v0.468.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const le=g("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
42
+ * @license lucide-react v0.468.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */const de=g("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/**
47
+ * @license lucide-react v0.468.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */const fe=g("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
52
+ * @license lucide-react v0.468.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */const ue=g("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]),me={".env":"lock",".env.example":"lock",".env.local":"lock",".gitignore":"config",".npmrc":"config",".prettierrc":"config",".eslintrc":"config","cargo.lock":"lock","composer.lock":"lock",dockerfile:"terminal",gnumakefile:"terminal",makefile:"terminal","package-lock.json":"lock","pnpm-lock.yaml":"lock","yarn.lock":"lock"},he={"7z":"archive",aac:"audio",ai:"image",avif:"image",avi:"video",bash:"terminal",bmp:"image",c:"code",cc:"code",cfg:"config",conf:"config",cpp:"code",cs:"code",css:"code",csv:"sheet",cts:"code",cxx:"code",dart:"code",diff:"code",doc:"document",docx:"document",env:"lock",ex:"code",exs:"code",fish:"terminal",gif:"image",go:"code",gql:"code",graphql:"code",gz:"archive",h:"code",hh:"code",hpp:"code",hs:"code",htm:"code",html:"code",ini:"config",java:"code",jpeg:"image",jpg:"image",js:"code",json:"database",jsonc:"database",jsx:"code",kt:"code",kts:"code",less:"code",lock:"lock",log:"document",lua:"code",m:"code",md:"document",mdx:"document",mjs:"code",mov:"video",mp3:"audio",mp4:"video",mts:"code",ogg:"audio",patch:"code",pdf:"document",php:"code",plist:"config",png:"image",ppt:"document",pptx:"document",ps1:"terminal",psd:"image",py:"code",pyi:"code",r:"code",rar:"archive",rb:"code",rs:"code",rtf:"document",scala:"code",scss:"code",sh:"terminal",sql:"database",srt:"document",svelte:"code",svg:"image",swift:"code",tar:"archive",tgz:"archive",toml:"config",ts:"code",tsv:"sheet",tsx:"code",txt:"document",vue:"code",wav:"audio",webm:"video",webp:"image",xls:"sheet",xlsx:"sheet",xml:"code",yaml:"config",yml:"config",zip:"archive",zsh:"terminal"};function xe(s){if(!s)return"document";const e=s.lastIndexOf("/"),n=(e>=0?s.slice(e+1):s).toLowerCase();if(!n)return"document";const a=me[n];if(a)return a;const o=n.lastIndexOf(".");return o<=0?"document":he[n.slice(o+1)]??"document"}const pe={code:{Icon:ae,className:"text-brand opacity-90"},config:{Icon:K,className:"text-signal-warn opacity-90"},database:{Icon:ne,className:"text-signal-ok opacity-90"},document:{Icon:oe,className:"text-muted-foreground"},image:{Icon:ie,className:"text-signal-violet opacity-90"},lock:{Icon:le,className:"text-signal-warn opacity-80"},sheet:{Icon:re,className:"text-signal-ok opacity-85"},terminal:{Icon:ue,className:"text-muted-foreground opacity-90"},archive:{Icon:se,className:"text-muted-foreground opacity-85"},audio:{Icon:de,className:"text-signal-azure opacity-90"},video:{Icon:ce,className:"text-signal-azure opacity-90"}};function A({path:s,className:e}){const{Icon:n,className:a}=pe[xe(s)];return t.jsx(n,{className:w("h-3.5 w-3.5 shrink-0",a,e),"aria-hidden":!0})}function ge(s){const e={children:[]},n=new Map;for(const a of s){const o=a.split("/").filter(Boolean);if(o.length===0)continue;let l=e,i="";for(let c=0;c<o.length;c++){const f=o[c];i=i?`${i}/${f}`:f;const d=c===o.length-1;let u=n.get(i);u||(u={name:f,path:i,type:d?"file":"dir",children:[]},l.children.push(u),n.set(i,u)),l=u}}return V(e.children),e.children}function V(s){s.sort((e,n)=>e.type!==n.type?e.type==="dir"?-1:1:e.name.localeCompare(n.name,void 0,{sensitivity:"base"}));for(const e of s)e.children.length>0&&V(e.children)}const R=new Set,h=O(s=>({workspaceId:null,openFiles:[],active:null,bases:{},drafts:{},expanded:R,sync:e=>s(n=>n.workspaceId===e?n:{workspaceId:e,openFiles:[],active:null,bases:{},drafts:{},expanded:R}),openFile:e=>s(n=>({openFiles:n.openFiles.includes(e)?n.openFiles:[...n.openFiles,e],active:e})),showTree:()=>s({active:null}),activateFile:e=>s(n=>({active:n.openFiles.includes(e)?e:n.active})),closeFile:e=>s(n=>{const a=n.openFiles.indexOf(e);if(a<0)return n;const o=n.openFiles.filter(u=>u!==e),{[e]:l,...i}=n.bases,{[e]:c,...f}=n.drafts;let d=n.active;return d===e&&(d=o[a-1]??o[a]??null),{openFiles:o,active:d,bases:i,drafts:f}}),seedFile:(e,n)=>s(a=>{const o=a.bases[e],l=a.drafts[e],i=l!==void 0&&l===o;return{bases:{...a.bases,[e]:n},drafts:l===void 0||i?{...a.drafts,[e]:n}:a.drafts}}),markSaved:(e,n)=>s(a=>({bases:{...a.bases,[e]:n},drafts:{...a.drafts,[e]:n}})),setDraft:(e,n)=>s(a=>({drafts:{...a.drafts,[e]:n}})),toggleDir:e=>s(n=>{const a=new Set(n.expanded);return a.has(e)?a.delete(e):a.add(e),{expanded:a}})})),ye=[];function Le({workspaceId:s,open:e,onClose:n}){return e?t.jsx(te,{storageKey:W,defaultWidth:B,children:t.jsx(be,{workspaceId:s,onClose:n})}):null}function be({workspaceId:s,onClose:e}){var y;const n=h(r=>r.workspaceId===s),a=h(r=>n?r.active:null),o=h(r=>n?r.openFiles:ye),l=h(r=>r.expanded),i=h(r=>r.bases),c=h(r=>r.drafts),f=h(r=>r.openFile),d=h(r=>r.showTree),u=h(r=>r.activateFile),k=h(r=>r.closeFile),m=h(r=>r.markSaved),p=h(r=>r.toggleDir),F=$(),b=Q(s);x.useEffect(()=>{n||h.getState().sync(s)},[n,s]),x.useEffect(()=>{b.reset()},[a]);const j=x.useMemo(()=>{const r={};for(const v of o){const E=c[v],z=i[v];r[v]=E!==void 0&&z!==void 0&&E!==z}return r},[i,c,o]),M=async r=>{j[r]&&!await F({title:"Discard changes?",message:`${r} has unsaved changes. Close this file without saving?`,confirmLabel:"Discard",variant:"danger"})||k(r)},C=a?!!j[a]:!1,S=()=>{if(!a||!C||b.isPending)return;const r=c[a];if(r===void 0)return;const v=a;b.mutate({path:v,content:r},{onSuccess:()=>m(v,r)})},N=o.length>0?t.jsx(ve,{openFiles:o,active:a,dirtyByPath:j,onTree:d,onActivate:u,onCloseFile:M,onClosePanel:e}):null;return a?t.jsxs(t.Fragment,{children:[N,t.jsx(Ne,{workspaceId:s,relPath:a,onSave:S,saveError:(y=b.error)==null?void 0:y.message},a)]}):t.jsxs(t.Fragment,{children:[N,t.jsx(ke,{workspaceId:s,onOpen:f,onClose:e,expanded:l,onToggleDir:p,hasTabs:o.length>0})]})}function ve({openFiles:s,active:e,dirtyByPath:n,onTree:a,onActivate:o,onCloseFile:l,onClosePanel:i}){return t.jsxs("header",{className:"flex h-[40px] shrink-0 items-center gap-1 border-b border-border-soft px-2",children:[t.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:[t.jsxs("button",{type:"button",onClick:a,title:"Files",className:w("flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-[11.5px] transition-colors ring-brand-focus",e===null?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/60 hover:text-foreground"),children:[t.jsx(D,{className:"h-3.5 w-3.5"}),t.jsx("span",{children:"Files"})]}),s.map(c=>t.jsxs("div",{className:w("flex h-7 min-w-[92px] max-w-[170px] shrink-0 items-center rounded-md border transition-colors",e===c?"border-border bg-card text-foreground":"border-transparent text-muted-foreground hover:bg-accent/60 hover:text-foreground"),children:[t.jsxs("button",{type:"button",onClick:()=>o(c),title:c,className:"min-w-0 flex-1 truncate px-2 text-left text-[11.5px] ring-brand-focus",children:[T(c),n[c]&&t.jsx("span",{className:"ml-1 text-brand",children:"•"})]}),t.jsx("button",{type:"button",onClick:()=>l(c),title:`Close ${T(c)}`,"aria-label":`Close ${c}`,className:"mr-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground ring-brand-focus",children:t.jsx(I,{className:"h-3 w-3"})})]},c))]}),t.jsx(L,{onClick:i,title:"Close","aria-label":"Close files panel",children:t.jsx(I,{className:"h-3.5 w-3.5"})})]})}function ke({workspaceId:s,onOpen:e,onClose:n,expanded:a,onToggleDir:o,hasTabs:l}){var b,j,M,C,S,N;const[i,c]=x.useState(""),f=i.trim()!=="",d=G(s,!f),u=J(s,i,f,100),k=x.useMemo(()=>{var y;return ge(((y=d.data)==null?void 0:y.entries)??[])},[d.data]),m=f?u:d,p=f?((b=u.data)==null?void 0:b.entries.length)??0:((j=d.data)==null?void 0:j.entries.length)??0,F=f?!!((M=u.data)!=null&&M.truncated):!!((C=d.data)!=null&&C.truncated);return t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"flex h-[44px] items-center gap-1 border-b border-border-soft px-4",children:[t.jsxs("span",{className:"text-[13px] font-medium tracking-[-0.005em] text-foreground",children:["Files",m.data&&t.jsxs("span",{className:"ml-1.5 text-muted-foreground/60",children:[p,F?"+":""]})]}),t.jsx("span",{className:"flex-1"}),t.jsx(L,{onClick:()=>m.refetch(),disabled:m.isFetching,title:"Refresh","aria-label":"Refresh file list",children:t.jsx(P,{className:w("h-3.5 w-3.5",m.isFetching&&"animate-spin")})}),!l&&t.jsx(L,{onClick:n,title:"Close","aria-label":"Close files panel",children:t.jsx(I,{className:"h-3.5 w-3.5"})})]}),t.jsx("div",{className:"border-b border-border-soft p-2",children:t.jsxs("div",{className:"flex items-center gap-1.5 rounded-md border border-border-soft bg-card px-2",children:[t.jsx(fe,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),t.jsx("input",{type:"text",value:i,onChange:y=>c(y.target.value),placeholder:"Filter files…",className:"h-8 w-full bg-transparent text-[12.5px] text-foreground outline-none placeholder:text-muted-foreground"})]})}),t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:m.isLoading?t.jsx("div",{className:"space-y-1.5",children:Array.from({length:8}).map((y,r)=>t.jsx(_,{className:"h-7 w-full rounded-md"},r))}):m.error?t.jsx("p",{className:"px-2 py-4 text-center text-[12.5px] text-signal-error",children:m.error.message}):f?t.jsx(je,{entries:((S=u.data)==null?void 0:S.entries)??[],truncated:!!((N=u.data)!=null&&N.truncated),onOpen:e}):t.jsx(we,{nodes:k,expanded:a,onToggleDir:o,onOpen:e,truncated:F})})]})}function je({entries:s,truncated:e,onOpen:n}){return s.length===0?t.jsx("p",{className:"px-2 py-8 text-center text-[12.5px] text-muted-foreground",children:"No matching files."}):t.jsxs(t.Fragment,{children:[t.jsx("ul",{className:"flex flex-col gap-px",children:s.map(a=>t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>n(a.relPath),title:a.relPath,className:"group flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent/60 ring-brand-focus",children:[t.jsx(A,{path:a.relPath}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-[12.5px] text-foreground",children:T(a.relPath)}),q(a.relPath)&&t.jsx("span",{className:"max-w-[42%] shrink-0 truncate font-mono text-[10px] text-muted-foreground/60",children:q(a.relPath)})]})},a.relPath))}),e&&t.jsx("p",{className:"px-2 pt-2 text-center text-[11px] text-muted-foreground/70",children:"More matches — refine the filter."})]})}function we({nodes:s,expanded:e,onToggleDir:n,onOpen:a,truncated:o}){return s.length===0?t.jsx("p",{className:"px-2 py-8 text-center text-[12.5px] text-muted-foreground",children:"No files."}):t.jsxs("div",{className:"flex flex-col",children:[s.map(l=>t.jsx(H,{node:l,depth:0,expanded:e,onToggleDir:n,onOpen:a},l.path)),o&&t.jsx("p",{className:"px-2 pt-2 text-center text-[11px] text-muted-foreground/70",children:"Large repo — showing the first slice. Use the filter to find a file."})]})}function H({node:s,depth:e,expanded:n,onToggleDir:a,onOpen:o}){const l={paddingLeft:8+e*13},i="flex w-full items-center gap-1.5 rounded-md py-1 pr-2 text-left transition-colors hover:bg-accent/60 ring-brand-focus";if(s.type==="dir"){const c=n.has(s.path);return t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",onClick:()=>a(s.path),style:l,title:s.path,className:i,children:[t.jsx(ee,{className:w("h-3 w-3 shrink-0 text-muted-foreground transition-transform",c&&"rotate-90")}),t.jsx(D,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground/80"}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-[12.5px] text-foreground",children:s.name})]}),c&&s.children.map(f=>t.jsx(H,{node:f,depth:e+1,expanded:n,onToggleDir:a,onOpen:o},f.path))]})}return t.jsxs("button",{type:"button",onClick:()=>o(s.path),style:l,title:s.path,className:i,children:[t.jsx("span",{className:"h-3 w-3 shrink-0"}),t.jsx(A,{path:s.path}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-[12.5px] text-foreground",children:s.name})]})}function Ne({workspaceId:s,relPath:e,onSave:n,saveError:a}){const{data:o,isFetching:l,isLoading:i,error:c}=Y(s,e),f=h(m=>m.drafts[e]),d=h(m=>m.seedFile),u=h(m=>m.setDraft);x.useEffect(()=>{o&&!l&&d(e,o.content)},[o,l,e,d]);const k=x.useRef(n);return k.current=n,x.useEffect(()=>{const m=p=>{(p.metaKey||p.ctrlKey)&&(p.key==="s"||p.key==="S")&&(p.preventDefault(),k.current())};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[]),t.jsxs(t.Fragment,{children:[a&&t.jsx("p",{className:"border-b border-error-ghost bg-error-ghost px-3 py-1.5 text-[11.5px] text-signal-error",children:a}),t.jsx("div",{className:"min-h-0 flex-1 overflow-hidden p-2",children:f===void 0&&(i||l)?t.jsx("div",{className:"space-y-2 p-1",children:Array.from({length:12}).map((m,p)=>t.jsx(_,{className:"h-3.5 w-full"},p))}):c?t.jsx("p",{className:"px-2 py-4 text-center text-[12.5px] text-signal-error",children:c.message}):t.jsx(Fe,{value:f??"",lang:Z(e),onChange:m=>u(e,m)})}),t.jsx("p",{className:"truncate border-t border-border-soft px-3 py-1.5 font-mono text-[10px] text-muted-foreground/60",title:e,children:e})]})}function Fe({value:s,lang:e,onChange:n}){const a=x.useRef(null),o=x.useRef(null),[l,i]=x.useState(!1);x.useEffect(()=>{let d=!1;return i(!1),U(e).then(u=>{d||i(u)}).catch(()=>{d||i(!1)}),()=>{d=!0}},[e]);const c=x.useMemo(()=>l?X(s,e):null,[l,s,e]),f=()=>{const d=a.current,u=o.current;d&&u&&(u.scrollTop=d.scrollTop)};return x.useEffect(f,[s,c]),t.jsxs("div",{className:"relative h-full w-full overflow-hidden rounded-md border border-border-soft bg-card focus-within:border-brand/40",children:[c!=null&&t.jsx("div",{ref:o,"aria-hidden":!0,className:"shiki-mount code-underlay code-edit-metrics pointer-events-none absolute inset-0 overflow-hidden p-2.5",dangerouslySetInnerHTML:{__html:c}}),t.jsx("textarea",{ref:a,value:s,onChange:d=>n(d.target.value),onScroll:f,spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",className:w("code-edit-metrics absolute inset-0 h-full w-full resize-none overflow-auto whitespace-pre-wrap break-words bg-transparent p-2.5 caret-foreground outline-none",c!=null?"text-transparent":"text-foreground")})]})}function T(s){const e=s.lastIndexOf("/");return e>=0?s.slice(e+1):s}function q(s){const e=s.lastIndexOf("/");return e>=0?s.slice(0,e):""}export{Le as FilesPanel};
@@ -0,0 +1 @@
1
+ import{j as e}from"./markdown-CY-Rm0E5.js";import{af as b,J as c,P as h}from"./index-DfuMmOel.js";const u=()=>Math.min(window.innerWidth*.7,960);function x({storageKey:s,defaultWidth:i,min:l=h,max:r=u,children:t}){const{width:o,isResizing:a,onMouseDown:n,onDoubleClick:d}=b({storageKey:s,defaultWidth:i,min:l,max:r,side:"left"});return e.jsxs("aside",{className:"relative flex h-full shrink-0 flex-col border-l border-border bg-popover",style:{width:`${o}px`},children:[e.jsx("div",{onMouseDown:n,onDoubleClick:d,className:c("absolute left-0 top-0 z-30 h-full w-px cursor-col-resize","bg-transparent hover:bg-brand/60 transition-colors",a&&"bg-brand"),"aria-label":"Resize panel",title:"Drag to resize · double-click to reset",children:e.jsx("div",{className:"absolute inset-y-0 -left-2 -right-2"})}),t]})}export{x as R};
@@ -0,0 +1,24 @@
1
+ import{j as e,r as m}from"./markdown-CY-Rm0E5.js";import{M as _,D as te,X as O,a2 as se,a1 as re,ao as ne,ab as oe,ar as ae,aq as le,L,J as S,j as ie,R as de,ag as ce,ae as xe,r as N,s as me,I as F,n as ue,a4 as pe,a9 as ge,a0 as G,a3 as he,m as fe,l as be,k as je,y as Ne,aj as ye,x as ve,as as ke,an as we}from"./index-DfuMmOel.js";import{R as Se}from"./ResizablePanelShell-Cbkq9Bs-.js";import"./shiki-BZ0sbaMe.js";/**
2
+ * @license lucide-react v0.468.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Pe=_("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
7
+ * @license lucide-react v0.468.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const Ce=_("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);function Ee({workspaceId:t,request:r,onClose:s}){return e.jsxs(te,{open:!0,onClose:s,className:"m-4 h-full max-h-[90vh] w-full max-w-3xl",children:[e.jsx(De,{kind:r.kind,mode:r.mode,onClose:s}),r.mode==="create"?e.jsx(Le,{workspaceId:t,kind:r.kind,defaultScope:r.defaultScope,onDone:s}):e.jsx(Te,{workspaceId:t,kind:r.kind,filePath:r.filePath,onDone:s})]})}function De({kind:t,mode:r,onClose:s}){const a=r==="create"?t==="skill"?"New skill":"New prompt template":t==="skill"?"Edit skill":"Edit prompt template";return e.jsxs("header",{className:"flex items-center justify-between border-b border-border px-4 py-2",children:[e.jsx("h2",{className:"text-sm font-semibold text-foreground",children:a}),e.jsx("button",{type:"button",onClick:s,className:"rounded-md p-1 text-muted-foreground hover:bg-accent hover:text-accent-foreground","aria-label":"Close editor",children:e.jsx(O,{className:"h-4 w-4"})})]})}function Le({workspaceId:t,kind:r,defaultScope:s,onDone:a}){var v,k;const[n,o]=m.useState(s),[d,l]=m.useState(""),[c,p]=m.useState(""),[h,f]=m.useState(""),[i,u]=m.useState(!1),[x,g]=m.useState(r==="skill"?Re:""),b=se(t),j=re(t),P=b.isPending||j.isPending,C=((v=b.error)==null?void 0:v.message)??((k=j.error)==null?void 0:k.message),y=async()=>{try{r==="skill"?await b.mutateAsync({scope:n,name:d.trim(),description:c.trim(),body:x,disableModelInvocation:i||void 0}):await j.mutateAsync({scope:n,name:d.trim(),description:c.trim(),argumentHint:h.trim()||void 0,body:x}),a()}catch{}},E=!P&&d.trim().length>0&&c.trim().length>0&&x.length>0;return e.jsx(K,{kind:r,scope:n,onScopeChange:o,scopeLocked:!1,name:d,onNameChange:l,description:c,onDescriptionChange:p,argumentHint:h,onArgumentHintChange:f,disableModelInvocation:i,onDisableModelInvocationChange:u,body:x,onBodyChange:g,submitLabel:"Create",canSubmit:E,pending:P,error:C,onSubmit:y,onCancel:a})}function Te({workspaceId:t,kind:r,filePath:s,onDone:a}){var $,I,U;const n=ne(t,r==="skill"?s:void 0),o=oe(t,r==="prompt"?s:void 0),d=r==="skill"?n.data:o.data,l=($=r==="skill"?n.error:o.error)==null?void 0:$.message,c=r==="skill"?n.isLoading:o.isLoading,[p,h]=m.useState(!1),[f]=m.useState(void 0),[i,u]=m.useState(""),[x,g]=m.useState(""),[b,j]=m.useState(""),[P,C]=m.useState(!1),[y,E]=m.useState("");m.useEffect(()=>{!d||p||(u(d.name),g(d.description),j(d.argumentHint??""),C(!!d.disableModelInvocation),E(d.body),h(!0))},[d,p]);const v=ae(t),k=le(t),H=v.isPending||k.isPending,Z=((I=v.error)==null?void 0:I.message)??((U=k.error)==null?void 0:U.message),q=async()=>{try{r==="skill"?await v.mutateAsync({filePath:s,name:i.trim(),description:x.trim(),body:y,disableModelInvocation:P||void 0}):await k.mutateAsync({filePath:s,name:i.trim(),description:x.trim(),argumentHint:b.trim()||void 0,body:y}),a()}catch{}};if(c)return e.jsxs("div",{className:"flex flex-1 items-center justify-center text-muted-foreground",children:[e.jsx(L,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"ml-2 text-xs",children:"Loading file\\u2026"})]});if(l||!d)return e.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-4 text-xs text-signal-error",children:[e.jsx("p",{children:l??"Failed to load file"}),e.jsx("button",{type:"button",onClick:a,className:"rounded-md border border-input bg-background px-3 py-1.5 text-foreground",children:"Close"})]});const ee=p&&!H&&i.trim().length>0&&x.trim().length>0&&y.length>0;return e.jsx(K,{kind:r,scope:f??d.scope,onScopeChange:()=>{},scopeLocked:!0,scopeLockedReason:"Move the file on disk to change scope.",name:i,onNameChange:u,description:x,onDescriptionChange:g,argumentHint:b,onArgumentHintChange:j,disableModelInvocation:P,onDisableModelInvocationChange:C,body:y,onBodyChange:E,filePath:d.filePath,submitLabel:"Save",canSubmit:ee,pending:H,error:Z,onSubmit:q,onCancel:a})}function K(t){return e.jsxs("form",{className:"flex min-h-0 flex-1 flex-col",onSubmit:r=>{r.preventDefault(),t.canSubmit&&t.onSubmit()},children:[e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto p-4",children:[t.filePath&&e.jsx("p",{className:"truncate font-mono text-[10px] text-muted-foreground",title:t.filePath,children:t.filePath}),e.jsxs(w,{label:"Scope",children:[e.jsxs("div",{className:"flex gap-1",children:[e.jsx(z,{active:t.scope==="project",onClick:()=>t.onScopeChange("project"),disabled:t.scopeLocked,children:"Project"}),e.jsx(z,{active:t.scope==="user",onClick:()=>t.onScopeChange("user"),disabled:t.scopeLocked,children:"User"})]}),e.jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:t.scopeLocked?t.scopeLockedReason??"Scope is fixed for existing files.":t.scope==="project"?`Lives in <workspace>/.pi/${t.kind==="skill"?"skills":"prompts"}/`:`Lives in ~/.pi/agent/${t.kind==="skill"?"skills":"prompts"}/`})]}),e.jsxs(w,{label:t.kind==="skill"?"Name":"Name (becomes /name)",children:[e.jsx("input",{type:"text",value:t.name,onChange:r=>t.onNameChange(r.target.value),placeholder:t.kind==="skill"?"pdf-tools":"review-pr",className:"w-full rounded-md border border-input bg-background px-3 py-1.5 text-sm font-mono outline-none focus:ring-1 focus:ring-ring"}),e.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground",children:["Lowercase a-z, 0-9, hyphens",t.kind==="prompt"?" or underscores":"","; 1\\u201364 chars."]})]}),e.jsx(w,{label:"Description",children:e.jsx("textarea",{value:t.description,onChange:r=>t.onDescriptionChange(r.target.value),rows:2,placeholder:t.kind==="skill"?"What this skill does and when to use it. Be specific.":"What this prompt template does.",className:"w-full resize-y rounded-md border border-input bg-background px-3 py-1.5 text-sm outline-none focus:ring-1 focus:ring-ring"})}),t.kind==="skill"?e.jsx(w,{label:"",children:e.jsxs("label",{className:"flex cursor-pointer items-start gap-2 text-xs",children:[e.jsx("input",{type:"checkbox",checked:t.disableModelInvocation,onChange:r=>t.onDisableModelInvocationChange(r.target.checked),className:"mt-0.5 accent-primary"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-medium text-foreground",children:"Manual invocation only"}),e.jsxs("span",{className:"block text-muted-foreground",children:["Hide from the system prompt. Users must explicitly run /skill:",t.name||"name","."]})]})]})}):e.jsxs(w,{label:"Argument hint (optional)",children:[e.jsx("input",{type:"text",value:t.argumentHint,onChange:r=>t.onArgumentHintChange(r.target.value),placeholder:"<file> [--flag]",className:"w-full rounded-md border border-input bg-background px-3 py-1.5 text-sm font-mono outline-none focus:ring-1 focus:ring-ring"}),e.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground",children:["Shown in autocomplete, e.g. ",e.jsx("code",{className:"font-mono",children:"<PR-URL>"}),"."]})]}),e.jsxs(w,{label:"Body (markdown)",children:[e.jsx("textarea",{value:t.body,onChange:r=>t.onBodyChange(r.target.value),rows:14,spellCheck:!1,className:"w-full resize-y rounded-md border border-input bg-background px-3 py-1.5 text-sm font-mono outline-none focus:ring-1 focus:ring-ring"}),t.kind==="prompt"&&e.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground",children:["Use ",e.jsx("code",{className:"font-mono",children:"$1"}),", ",e.jsx("code",{className:"font-mono",children:"$2"}),", ",e.jsx("code",{className:"font-mono",children:"$@"}),", ",e.jsxs("code",{className:"font-mono",children:["$","{@:N}"]}),", ",e.jsxs("code",{className:"font-mono",children:["$","{@:N:L}"]})," for arguments."]})]}),t.error&&e.jsx("p",{className:"rounded-md border border-error-ghost bg-error-ghost px-3 py-1.5 text-xs text-signal-error",children:t.error})]}),e.jsxs("footer",{className:"flex items-center justify-end gap-2 border-t border-border px-4 py-2",children:[e.jsx("button",{type:"button",onClick:t.onCancel,disabled:t.pending,className:"rounded-md border border-input bg-background px-3 py-1.5 text-sm text-foreground hover:bg-accent disabled:opacity-50",children:"Cancel"}),e.jsxs("button",{type:"submit",disabled:!t.canSubmit,className:"inline-flex items-center gap-1 rounded-md bg-primary px-3 py-1.5 text-sm text-primary-foreground disabled:opacity-50",children:[t.pending&&e.jsx(L,{className:"h-3.5 w-3.5 animate-spin"}),t.submitLabel]})]})]})}function w({label:t,children:r}){return e.jsxs("div",{children:[t&&e.jsx("label",{className:"mb-1 block text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:t}),r]})}function z({active:t,disabled:r,onClick:s,children:a}){return e.jsx("button",{type:"button",onClick:s,disabled:r,className:S("rounded-md border px-3 py-1 text-xs transition-colors",t?"border-primary bg-primary text-primary-foreground":"border-input bg-background text-foreground hover:bg-accent",r&&"cursor-not-allowed opacity-60 hover:bg-background"),children:a})}const Re=`# Skill name
12
+
13
+ Describe what the skill does, when to use it, and any setup steps.
14
+
15
+ ## Usage
16
+
17
+ \`\`\`bash
18
+ ./scripts/example.sh <input>
19
+ \`\`\`
20
+ `;function Ke({workspaceId:t,open:r,onClose:s}){return r?e.jsx(Se,{storageKey:de,defaultWidth:ie,children:e.jsx(Be,{workspaceId:t,onClose:s})}):null}function Be({workspaceId:t,onClose:r}){const{data:s,isLoading:a,error:n}=ce(t),o=xe(t),[d,l]=m.useState("skills"),[c,p]=m.useState(null),h=x=>p({kind:x,mode:"create",defaultScope:"project"}),f=(x,g)=>p({kind:x,mode:"edit",filePath:g}),i={skills:(s==null?void 0:s.skills.length)??0,prompts:(s==null?void 0:s.prompts.length)??0,extensions:((s==null?void 0:s.builtinExtensions.length)??0)+((s==null?void 0:s.extensions.filter(x=>x.source.label!=="inline").length)??0)},u=i.skills+i.prompts+i.extensions;return a?e.jsxs(e.Fragment,{children:[e.jsx(T,{total:0,onReload:()=>o.mutate(),reloading:o.isPending,onClose:r}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsxs("div",{className:"flex gap-1 border-b border-border-soft px-3 pb-1 pt-2",children:[e.jsx(N,{className:"h-6 w-20 rounded-md"}),e.jsx(N,{className:"h-6 w-24 rounded-md"}),e.jsx(N,{className:"h-6 w-28 rounded-md"})]}),e.jsxs("div",{className:"flex-1 space-y-2 p-3",children:[e.jsx(N,{className:"h-7 w-24 rounded-md"}),Array.from({length:4}).map((x,g)=>e.jsxs("div",{className:"rounded-[10px] border border-border-soft bg-card px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[e.jsx(N,{className:"h-3.5 w-32"}),e.jsx(N,{className:"h-3 w-12 rounded-full"})]}),e.jsx(me,{className:"mt-2",rows:2}),e.jsx(N,{className:"mt-2 h-2.5 w-40"})]},g))]})]})]}):n||!s?e.jsxs(e.Fragment,{children:[e.jsx(T,{total:0,onReload:()=>o.mutate(),reloading:o.isPending,onClose:r}),e.jsx("p",{className:"px-4 py-4 text-center text-[12.5px] text-signal-error",children:(n==null?void 0:n.message)??"Failed to load resources"})]}):e.jsxs(e.Fragment,{children:[e.jsx(T,{total:u,onReload:()=>o.mutate(),reloading:o.isPending,onClose:r}),o.isError&&e.jsx("p",{className:"border-b border-error-ghost bg-error-ghost px-4 py-1.5 text-[11.5px] text-signal-error",children:o.error.message}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[e.jsxs("div",{className:"flex gap-1 border-b border-border-soft px-3 pb-1 pt-2",children:[e.jsx(R,{active:d==="skills",onClick:()=>l("skills"),label:"Skills",count:i.skills}),e.jsx(R,{active:d==="prompts",onClick:()=>l("prompts"),label:"Prompts",count:i.prompts}),e.jsx(R,{active:d==="extensions",onClick:()=>l("extensions"),label:"Extensions",count:i.extensions})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-3",children:[d==="skills"&&e.jsx(Ae,{workspaceId:t,skills:s.skills,onNew:()=>h("skill"),onEdit:x=>f("skill",x.filePath)}),d==="prompts"&&e.jsx(Me,{workspaceId:t,prompts:s.prompts,onNew:()=>h("prompt"),onEdit:x=>f("prompt",x.filePath)}),d==="extensions"&&e.jsx(He,{workspaceId:t,builtinExtensions:s.builtinExtensions,extensionsEnabled:s.extensionsEnabled,extensions:s.extensions,errors:s.extensionErrors,disabledExtensions:s.disabledExtensions})]})]}),c&&e.jsx(Ee,{workspaceId:t,request:c,onClose:()=>p(null)})]})}function T({total:t,onReload:r,reloading:s,onClose:a}){return e.jsxs("header",{className:"flex h-[44px] items-center gap-1 border-b border-border-soft px-4",children:[e.jsxs("span",{className:"text-[13px] font-medium tracking-[-0.005em] text-foreground",children:["Resources",t>0&&e.jsx("span",{className:"ml-1.5 text-muted-foreground/60",children:t})]}),e.jsx("span",{className:"flex-1"}),e.jsx(F,{onClick:r,disabled:s,title:"Reload resources","aria-label":"Reload resources",children:e.jsx(ue,{className:S("h-3.5 w-3.5",s&&"animate-spin")})}),e.jsx(F,{onClick:a,title:"Close","aria-label":"Close resources panel",children:e.jsx(O,{className:"h-3.5 w-3.5"})})]})}function R({active:t,onClick:r,label:s,count:a}){return e.jsxs("button",{type:"button",onClick:r,className:S("inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-[12px] font-medium transition-colors ring-brand-focus",t?"bg-brand-ghost text-brand-strong":"text-muted-foreground hover:bg-accent/60 hover:text-foreground"),children:[e.jsx("span",{children:s}),e.jsx("span",{className:"font-mono text-[10.5px] tabular-nums opacity-70",children:a})]})}function Ae({workspaceId:t,skills:r,onNew:s,onEdit:a}){const n=pe(t),o=ge(t),d=G(),l=m.useRef(null),[c,p]=m.useState("user"),h=async i=>{await d({title:"Delete skill",message:`Delete skill "${i.name}"?
21
+
22
+ This removes ${i.filePath} and any sibling files in its directory.`,confirmLabel:"Delete",variant:"danger"})&&n.mutate({filePath:i.filePath})},f=async i=>{var x;const u=(x=i.target.files)==null?void 0:x[0];if(i.target.value="",!!u)try{await o.mutateAsync({file:u,scope:c})}catch(g){const b=g instanceof Error?g.message:"";/already exists/i.test(b)&&await d({title:"Skill already exists",message:"A skill with this name is already installed. Overwrite it with the uploaded archive?",confirmLabel:"Overwrite",variant:"danger"})&&o.mutate({file:u,scope:c,overwrite:!0})}};return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(B,{label:"New skill",onClick:s}),e.jsx(B,{label:"Install",disabled:o.isPending,icon:o.isPending?e.jsx(L,{className:"h-3 w-3 animate-spin"}):e.jsx(Ce,{className:"h-3 w-3"}),onClick:()=>{var i;return(i=l.current)==null?void 0:i.click()}})]}),e.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Install to"}),e.jsx(ze,{value:c,onChange:p})]}),e.jsx("input",{ref:l,type:"file",accept:".zip,.tgz,.gz,application/zip,application/gzip",className:"hidden",onChange:f}),o.isError&&e.jsx("p",{className:"rounded-md border border-error-ghost bg-error-ghost px-2.5 py-1.5 text-[11.5px] text-signal-error",children:o.error.message}),n.isError&&e.jsx("p",{className:"rounded-md border border-error-ghost bg-error-ghost px-2.5 py-1.5 text-[11.5px] text-signal-error",children:n.error.message}),r.length===0?e.jsx(Q,{text:"No skills discovered."}):e.jsx("ul",{className:"flex flex-col gap-2",children:r.map(i=>{var u;return e.jsxs("li",{className:"rounded-[10px] border border-border-soft bg-card px-3 py-2.5 transition-colors hover:border-border",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[e.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:i.name}),e.jsx(A,{source:i.source})]}),i.description&&e.jsx("p",{className:"mt-1 text-[12px] text-muted-foreground",children:i.description}),i.disableModelInvocation&&e.jsxs("p",{className:"mt-1 text-[11.5px] italic text-muted-foreground",children:["Manual invocation only (/skill:",i.name,")"]}),e.jsx(M,{path:i.filePath}),i.managed?e.jsx(Y,{onEdit:()=>a(i),onDelete:()=>h(i),deleting:n.isPending&&((u=n.variables)==null?void 0:u.filePath)===i.filePath}):e.jsx(V,{kind:"skill",source:i.source})]},i.filePath)})})]})}function Me({workspaceId:t,prompts:r,onNew:s,onEdit:a}){const n=he(t),o=G(),d=async l=>{await o({title:"Delete prompt",message:`Delete prompt template /${l.name}?
23
+
24
+ ${l.filePath}`,confirmLabel:"Delete",variant:"danger"})&&n.mutate({filePath:l.filePath})};return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(B,{label:"New prompt",onClick:s}),n.isError&&e.jsx("p",{className:"rounded-md border border-error-ghost bg-error-ghost px-2.5 py-1.5 text-[11.5px] text-signal-error",children:n.error.message}),r.length===0?e.jsx(Q,{text:"No prompt templates discovered."}):e.jsx("ul",{className:"flex flex-col gap-2",children:r.map(l=>{var c;return e.jsxs("li",{className:"rounded-[10px] border border-border-soft bg-card px-3 py-2.5 transition-colors hover:border-border",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[e.jsxs("span",{className:"truncate text-[13px] font-medium text-foreground",children:["/",l.name,l.argumentHint&&e.jsx("span",{className:"ml-1 font-normal text-muted-foreground",children:l.argumentHint})]}),e.jsx(A,{source:l.source})]}),l.description&&e.jsx("p",{className:"mt-1 text-[12px] text-muted-foreground",children:l.description}),e.jsxs("details",{className:"mt-1.5 text-[12px]",children:[e.jsx("summary",{className:"cursor-pointer select-none rounded px-1 -mx-1 text-muted-foreground hover:text-foreground",children:"View template"}),e.jsx("pre",{className:"mt-1 max-h-64 overflow-auto rounded-md border border-border-soft bg-muted p-2 font-mono text-[11.5px] leading-relaxed text-foreground",children:l.content})]}),e.jsx(M,{path:l.filePath}),l.managed?e.jsx(Y,{onEdit:()=>a(l),onDelete:()=>d(l),deleting:n.isPending&&((c=n.variables)==null?void 0:c.filePath)===l.filePath}):e.jsx(V,{kind:"prompt",source:l.source})]},l.filePath)})})]})}function He({workspaceId:t,builtinExtensions:r,extensionsEnabled:s,extensions:a,errors:n,disabledExtensions:o}){const d=a.filter(l=>l.source.label!=="inline");return e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsx(Ie,{workspaceId:t,builtins:r}),e.jsx($e,{workspaceId:t}),e.jsx(Ue,{extensionsEnabled:s,extensions:d,errors:n,disabledExtensions:o})]})}function $e({workspaceId:t}){var d,l;const{data:r}=ke(),s=we(),a=r==null?void 0:r.find(c=>c.id===t);if(!a)return null;const n=s.isPending&&((d=s.variables)==null?void 0:d.id)===a.id,o=n?((l=s.variables)==null?void 0:l.trustProjectAgents)??a.trustProjectAgents:a.trustProjectAgents;return e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(D,{children:"Project agents"}),s.isError&&e.jsx("p",{className:"rounded-md border border-error-ghost bg-error-ghost px-2.5 py-1.5 text-[11.5px] text-signal-error",children:s.error.message}),e.jsxs("div",{className:"rounded-[10px] border border-border-soft bg-card px-3 py-2.5 transition-colors hover:border-border",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("span",{className:"truncate text-[13px] font-medium text-foreground",children:["Trust ",e.jsx("span",{className:"font-mono text-[12px]",children:".pi/agents/"})," in this workspace"]}),e.jsx(X,{checked:o,disabled:n,onChange:c=>s.mutate({id:a.id,trustProjectAgents:c}),label:`${o?"Distrust":"Trust"} project agents`})]}),e.jsxs("p",{className:"mt-1 text-[12px] leading-relaxed text-muted-foreground",children:["When on, the subagent roster also loads agent definitions from this repo's ",e.jsx("span",{className:"font-mono text-[11px]",children:".pi/agents/*.md"})," ","(highest precedence). Off by default: repo files define subagent system prompts, so only enable this for repositories you trust."]})]})]})}function Ie({workspaceId:t,builtins:r}){var n;const s=ye(t),a=s.isPending?(n=s.variables)==null?void 0:n.id:void 0;return e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(D,{children:"Built-in"}),e.jsx("p",{className:"text-[11.5px] leading-relaxed text-muted-foreground/80",children:"Master switches that apply to every conversation — turning one off removes its tools and commands everywhere. To keep an extension on but hide individual tools in a single conversation, use Settings → Session → Tools."}),s.isError&&e.jsx("p",{className:"rounded-md border border-error-ghost bg-error-ghost px-2.5 py-1.5 text-[11.5px] text-signal-error",children:s.error.message}),e.jsx("ul",{className:"flex flex-col gap-2",children:r.map(o=>{const d=a===o.id,l=d&&s.variables?s.variables.enabled:o.enabled;return e.jsxs("li",{className:"rounded-[10px] border border-border-soft bg-card px-3 py-2.5 transition-colors hover:border-border",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(ve,{tool:o.id,className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:o.name})]}),e.jsx(X,{checked:l,disabled:d,onChange:c=>s.mutate({id:o.id,enabled:c}),label:`${l?"Disable":"Enable"} ${o.name}`})]}),e.jsx("p",{className:"mt-1 text-[12px] leading-relaxed text-muted-foreground",children:o.description}),e.jsx(J,{facets:[{label:"tools",items:o.tools},{label:"commands",items:o.commands.map(c=>`/${c}`)}].filter(c=>c.items.length>0)})]},o.id)})})]})}function X({checked:t,disabled:r,onChange:s,label:a}){return e.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":a,title:a,disabled:r,onClick:()=>s(!t),className:S("relative inline-flex h-[18px] w-[32px] shrink-0 items-center rounded-full border transition-colors ring-brand-focus disabled:cursor-not-allowed disabled:opacity-60",t?"border-brand-subtle bg-brand":"border-border bg-muted"),children:e.jsx("span",{className:S("inline-block h-3 w-3 rounded-full bg-white shadow-sm transition-transform",t?"translate-x-[15px]":"translate-x-[2px]")})})}function Ue({extensionsEnabled:t,extensions:r,errors:s,disabledExtensions:a}){return t?e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(D,{children:"Third-party"}),r.length===0&&s.length===0&&e.jsxs("div",{className:"rounded-[10px] border border-border-soft bg-card px-3 py-3",children:[e.jsx("p",{className:"text-[13px] font-medium text-foreground",children:"Extensions enabled, none installed"}),e.jsxs("p",{className:"mt-1.5 text-[12px] leading-relaxed text-muted-foreground",children:[e.jsx("code",{className:"rounded bg-muted px-1 font-mono",children:"PI_PILOT_ENABLE_EXTENSIONS=1"})," is set but no extension modules were discovered under"," ",e.jsx("code",{className:"rounded bg-muted px-1 font-mono",children:"~/.pi/agent/extensions/"})," or"," ",e.jsx("code",{className:"rounded bg-muted px-1 font-mono",children:".pi/extensions/"}),"."]})]}),s.map(n=>e.jsxs("div",{className:"rounded-[10px] border border-error-ghost bg-error-ghost px-3 py-2.5 text-[12px] text-signal-error",children:[e.jsx("p",{className:"text-[11.5px] font-medium",children:"Failed to load"}),e.jsx("p",{className:"mt-1 break-all font-mono text-[11px] text-signal-error/80",children:n.path}),e.jsx("p",{className:"mt-1 break-words",children:n.error})]},n.path)),r.map(n=>e.jsxs("div",{className:"rounded-[10px] border border-border-soft bg-card px-3 py-2.5 transition-colors hover:border-border",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[e.jsx("span",{className:"truncate text-[13px] font-medium text-foreground",children:W(n.path)}),e.jsx(A,{source:n.source})]}),e.jsx(Fe,{ext:n}),e.jsx(M,{path:n.resolvedPath})]},n.resolvedPath))]}):e.jsxs("section",{className:"flex flex-col gap-3",children:[e.jsx(D,{children:"Third-party"}),e.jsxs("div",{className:"rounded-[10px] border border-border-soft bg-card px-3 py-3",children:[e.jsx("p",{className:"text-[13px] font-medium text-foreground",children:"Third-party extensions are not supported"}),e.jsx("p",{className:"mt-1.5 text-[12px] leading-relaxed text-muted-foreground",children:"The pi extension system is built for a terminal UI (custom renderers, ANSI themes, keyboard overlays). These APIs cannot be bridged to the Web in any meaningful way, so pi-pilot does not load extensions from disk by default."}),e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-muted-foreground",children:"Skills, prompts, and the built-in extensions above work as usual; only third-party extension modules are skipped."})]}),a.length>0&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("p",{className:"px-1 text-[12px] font-medium text-muted-foreground",children:"Detected but disabled"}),a.map(n=>e.jsxs("div",{className:"flex items-center gap-2 rounded-[8px] border border-border-soft bg-muted/50 px-2.5 py-1.5",title:n,children:[e.jsx(Pe,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:W(n)})]},n))]})]})}function D({children:t}){return e.jsx("h3",{className:"text-[11.5px] font-medium text-muted-foreground",children:t})}function Fe({ext:t}){const r=[{label:"tools",items:t.tools},{label:"commands",items:t.commands.map(s=>`/${s}`)},{label:"flags",items:t.flags.map(s=>`--${s}`)},{label:"shortcuts",items:t.shortcuts}].filter(s=>s.items.length>0);return r.length===0?e.jsx("p",{className:"mt-1.5 text-[11.5px] italic text-muted-foreground",children:"No registrations."}):e.jsx(J,{facets:r})}function J({facets:t}){return e.jsx("dl",{className:"mt-1.5 flex flex-col gap-1 text-[11.5px]",children:t.map(r=>e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsxs("dt",{className:"shrink-0 text-muted-foreground",children:[r.label,":"]}),e.jsx("dd",{className:"flex flex-wrap gap-1",children:r.items.map(s=>e.jsx("span",{className:"rounded border border-border-soft bg-muted px-1.5 py-px font-mono text-[10.5px] text-foreground",children:s},s))})]},r.label))})}function B({label:t,onClick:r,icon:s,disabled:a}){return e.jsxs("button",{type:"button",onClick:r,disabled:a,className:"group inline-flex items-center justify-center gap-1.5 rounded-md border border-dashed border-border bg-transparent px-2 py-2 text-[12px] font-medium text-muted-foreground transition-colors hover:border-brand-subtle hover:text-brand ring-brand-focus disabled:pointer-events-none disabled:opacity-60",children:[s??e.jsx(fe,{className:"h-3 w-3 transition-transform group-hover:rotate-90"}),t]})}function ze({value:t,onChange:r}){return e.jsx("div",{className:"inline-flex items-center rounded-md border border-border-soft bg-muted p-0.5 text-[11px] font-medium",children:["user","project"].map(s=>e.jsx("button",{type:"button",onClick:()=>r(s),className:S("rounded px-2 py-0.5 capitalize transition-colors ring-brand-focus",t===s?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:s},s))})}function V({kind:t,source:r}){return e.jsxs("p",{className:"mt-1.5 text-[11px] text-muted-foreground",children:["Read-only · ",t," from ",r.label]})}function Y({onEdit:t,onDelete:r,deleting:s}){return e.jsxs("div",{className:"mt-2 flex justify-end gap-1.5",children:[e.jsxs("button",{type:"button",onClick:t,className:"inline-flex items-center gap-1.5 rounded-md border border-border bg-card px-2.5 py-1 text-[11.5px] font-medium text-foreground transition-colors hover:border-brand-subtle hover:text-brand ring-brand-focus",children:[e.jsx(je,{className:"h-3 w-3"})," Edit"]}),e.jsxs("button",{type:"button",onClick:r,disabled:s,className:"inline-flex items-center gap-1.5 rounded-md border border-error-ghost bg-card px-2.5 py-1 text-[11.5px] font-medium text-signal-error transition-colors hover:bg-error-ghost disabled:opacity-50 ring-brand-focus",children:[s?e.jsx(L,{className:"h-3 w-3 animate-spin"}):e.jsx(Ne,{className:"h-3 w-3"})," ","Delete"]})]})}function A({source:t}){const r=t.scope==="user"?"default":t.scope==="project"?"brand":"warn";return e.jsx(be,{tone:r,className:"shrink-0",children:e.jsx("span",{title:t.label,children:t.scope})})}function M({path:t}){return e.jsx("p",{className:"mt-1.5 truncate font-mono text-[10.5px] tracking-[-0.005em] text-muted-foreground",title:t,children:t})}function Q({text:t}){return e.jsx("p",{className:"py-8 text-center text-[12.5px] text-muted-foreground",children:t})}function W(t){return t.replace(/\/+$/,"").split("/").at(-1)||t}export{Ke as ResourcesPanel};
@@ -0,0 +1,16 @@
1
+ import{r as l,j as n}from"./markdown-CY-Rm0E5.js";import{M as A,_ as L,ai as Q,aw as U,a6 as Z,j as ee,w as te,G as H,L as J,I as G,X as ne,f as se,d as re,J as j}from"./index-DfuMmOel.js";import{R as ae}from"./ResizablePanelShell-Cbkq9Bs-.js";import"./shiki-BZ0sbaMe.js";/**
2
+ * @license lucide-react v0.468.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ie=A("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]);/**
7
+ * @license lucide-react v0.468.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const oe=A("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
12
+ * @license lucide-react v0.468.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const le=A("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);function ce(e,a,o=null){if(a==="all")return e.slice();const s=new Set;for(const c of e)(ue(c,a)||c.id===o)&&s.add(c.id);const i=new Map;for(const c of e)i.set(c.id,c);const u=a==="labeled",r=new Set(s);for(const c of s){let d=i.get(c);for(;d!=null&&d.parentId;){const p=i.get(d.parentId);if(!p)break;(u||p.childCount>1)&&r.add(p.id),d=p}}return e.filter(c=>r.has(c.id))}function ue(e,a){switch(a){case"default":return V(e)||de(e)&&pe(e)||e.entryType==="compaction"||e.entryType==="branch_summary"||e.label!=null;case"user-only":return V(e);case"labeled":return e.label!=null;case"all":return!0}}function V(e){return e.entryType==="message"&&e.messageRole==="user"}function de(e){return e.entryType==="message"&&e.messageRole==="assistant"}function pe(e){return e.preview.trim().length>0}function I(e){const a=new Map;for(const o of e)a.set(o.id,o);return a}function me(e,a=I(e)){const o=new Map;for(const s of e){if(!s.parentId){o.set(s.id,0);continue}const i=a.get(s.parentId);if(!i){o.set(s.id,0);continue}const u=o.get(i.id)??0;i.childCount>1&&!s.active?o.set(s.id,u+1):o.set(s.id,u)}return o}function fe(e,a,o=I(e)){const s=new Map;for(const i of e){if(!i.parentId){s.set(i.id,!0);continue}const u=o.get(i.parentId);if(!u){s.set(i.id,!0);continue}const r=s.get(u.id)??!0,d=!(u.childCount>1&&!i.active)||a.has(u.id);s.set(i.id,r&&d)}return s}function xe(e,a=I(e)){const o=new Map;for(const s of e){if(!s.parentId||s.active)continue;const i=a.get(s.parentId);!i||i.childCount<=1||o.set(s.parentId,(o.get(s.parentId)??0)+1)}return o}function he(e,a){if(e==="message")switch(a){case"user":return"User";case"assistant":return"Assistant";case"toolResult":return"Tool result";case"bashExecution":return"Bash";case"custom":return"Extension";case"branchSummary":return"Branch summary";case"compactionSummary":return"Compaction summary";default:return"Message"}switch(e){case"compaction":return"Compaction";case"branch_summary":return"Branch summary";case"model_change":return"Model change";case"thinking_level_change":return"Thinking";case"custom":return"Custom";case"custom_message":return"Extension";case"label":return"Label";case"session_info":return"Session info";default:return e}}function ge(e,a,o){const s=o?"":" opacity-50";if(e==="message")switch(a){case"user":return"text-brand"+s;case"assistant":return"text-foreground"+s;default:return"text-muted-foreground"+s}switch(e){case"compaction":return"text-signal-warn"+s;case"branch_summary":return"text-signal-ok"+s;default:return"text-muted-foreground"+s}}const be=[{value:"default",label:"Default"},{value:"user-only",label:"User only"},{value:"all",label:"All entries"},{value:"labeled",label:"Labeled"}];function ke({workspaceId:e,open:a,onClose:o}){const s=L(t=>t.running),i=L(t=>t.switching),u=L(t=>t.setSwitching),{data:r,isFetching:c}=Q(e,a),[d,p]=l.useState("user-only"),[h,x]=l.useState(null),[g,v]=l.useState(()=>new Set),m=l.useRef(null),C=l.useRef(0);l.useEffect(()=>()=>{var t;(t=m.current)==null||t.call(m),m.current=null},[]);const k=l.useMemo(()=>r?ce(r.nodes,d,r.leafId):[],[r,d]),b=l.useMemo(()=>r?I(r.nodes):new Map,[r]),K=l.useMemo(()=>r?me(r.nodes,b):new Map,[r,b]),W=l.useMemo(()=>r?xe(r.nodes,b):new Map,[r,b]),T=l.useMemo(()=>r?r.nodes.filter(t=>t.childCount>1).map(t=>t.id):[],[r]),E=T.some(t=>g.has(t)),F=l.useMemo(()=>r?fe(r.nodes,g,b):new Map,[r,g,b]),S=l.useMemo(()=>k.filter(t=>F.get(t.id)??!0),[k,F]),w=l.useMemo(()=>{let t=null;for(const f of(r==null?void 0:r.nodes)??[])(!t||f.timestamp>t.timestamp)&&(t=f);return t},[r]),X=l.useCallback(t=>{v(f=>{const y=new Set(f);return y.has(t)?y.delete(t):y.add(t),y})},[]),D=l.useCallback(()=>v(new Set(T)),[T]),q=l.useCallback(()=>v(new Set),[]),P=l.useCallback(t=>{var O;if(s||i||h)return;const f=++C.current;x(t.id),u(!0),U.send({type:"navigate_tree",workspaceId:e,targetId:t.id}),(O=m.current)==null||O.call(m);const y=setTimeout(()=>{f===C.current&&(x(null),u(!1),N())},3e4),Y=U.on(M=>{if(M.type==="navigate_tree_result"){if(f!==C.current)return;x(null),M.cancelled&&Z.getState().pushToast({id:`nav-cancelled-${Date.now()}`,workspaceId:e,message:"Tree navigation was cancelled.",notifyType:"info"}),N();return}if(M.type==="error"&&M.command==="navigate_tree"){if(f!==C.current)return;x(null),u(!1),N()}}),N=()=>{clearTimeout(y),Y(),m.current===N&&(m.current=null)};m.current=N},[e,s,i,h,u]);if(!a)return null;const $=s||i||!!h,B=!w||w.id===(r==null?void 0:r.leafId),_=!!r&&r.nodes.some(t=>t.entryType==="message");return n.jsxs(ae,{storageKey:te,defaultWidth:ee,children:[n.jsxs("header",{className:"flex h-[44px] items-center justify-between border-b border-border-soft px-4",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[13px] font-medium tracking-[-0.005em] text-foreground",children:[n.jsx(H,{className:"h-4 w-4 text-muted-foreground"}),n.jsx("span",{children:"Session Tree"}),c&&n.jsx(J,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),n.jsxs("div",{className:"flex items-center gap-0.5",children:[w&&n.jsx(G,{onClick:()=>{w&&P(w)},disabled:$||B,title:B?"Already at the latest":"Jump to latest",children:n.jsx(ie,{className:"h-3.5 w-3.5"})}),n.jsx(G,{onClick:o,title:"Close",children:n.jsx(ne,{className:"h-3.5 w-3.5"})})]})]}),n.jsxs("div",{className:"flex items-center gap-2 border-b border-border-soft px-3 py-1.5",children:[n.jsx(oe,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),n.jsx("select",{value:d,onChange:t=>p(t.target.value),className:"flex-1 bg-transparent text-[11.5px] text-foreground outline-none",children:be.map(t=>n.jsx("option",{value:t.value,children:t.label},t.value))}),T.length>0&&n.jsx("button",{type:"button",onClick:E?q:D,title:E?"Collapse all branches":"Expand all branches",className:"shrink-0 rounded px-1.5 py-0.5 text-[10.5px] font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground ring-brand-focus",children:E?"Collapse all":"Expand all"}),r&&n.jsxs("span",{className:"shrink-0 font-mono text-[10.5px] tabular-nums text-muted-foreground",children:[S.length,"/",r.nodes.length]})]}),n.jsxs("div",{className:"flex-1 overflow-y-auto py-1",children:[!r&&!c&&n.jsx(R,{children:"No session tree available."}),r&&!_&&n.jsx(R,{children:"No conversation yet — send a message and it’ll appear here."}),_&&k.length===0&&n.jsx(R,{children:"Nothing matches this filter — try “All entries”."}),_&&k.length>0&&S.length===0&&n.jsxs("div",{className:"px-4 py-6 text-center text-[11.5px] leading-relaxed text-muted-foreground",children:["Matching entries are inside collapsed branches."," ",n.jsx("button",{type:"button",onClick:D,className:"rounded font-medium text-brand transition-colors hover:underline ring-brand-focus",children:"Expand all"})]}),S.map(t=>n.jsx(ye,{node:t,indent:K.get(t.id)??0,isFork:t.childCount>1,collapsed:t.childCount>1&&!g.has(t.id),hiddenCount:W.get(t.id)??0,onToggle:X,isNavigating:h===t.id,disabled:$,onNavigate:P},t.id))]}),(s||i)&&n.jsx("div",{className:"border-t border-border-soft px-3 py-2 text-[10.5px] text-muted-foreground",children:s?"Navigation disabled while agent is running.":"Navigating…"})]})}function R({children:e}){return n.jsx("div",{className:"px-4 py-6 text-center text-[11.5px] leading-relaxed text-muted-foreground",children:e})}const z=14;function ye({node:e,indent:a,isFork:o,collapsed:s,hiddenCount:i,onToggle:u,isNavigating:r,disabled:c,onNavigate:d}){const p=e.isLeaf,h=ge(e.entryType,e.messageRole,e.active),x=he(e.entryType,e.messageRole),g=10+a*z,v=c||p;return n.jsxs("div",{className:j("group/tree-row relative flex w-full items-center text-left transition-colors","hover:bg-accent/60",p&&"bg-brand-ghost hover:bg-brand-subtle"),style:{paddingLeft:`${g}px`},children:[a>0&&n.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-y-0 w-px bg-border-soft",style:{left:`${10+(a-1)*z+5}px`}}),o?n.jsx("button",{type:"button",onClick:()=>u(e.id),"aria-expanded":!s,title:s?`Expand ${i} branch${i===1?"":"es"}`:"Collapse branches",className:"flex w-[18px] shrink-0 items-center justify-center self-stretch text-muted-foreground transition-colors hover:text-foreground ring-brand-focus",children:s?n.jsx(se,{className:"h-3 w-3"}):n.jsx(re,{className:"h-3 w-3"})}):n.jsx("span",{"aria-hidden":!0,className:"w-[18px] shrink-0"}),n.jsxs("button",{type:"button",onClick:()=>d(e),disabled:v,"aria-current":p?"location":void 0,title:p?"Current position":c?"Navigation unavailable right now":`Navigate to this ${x.toLowerCase()}`,className:j("flex min-w-0 flex-1 items-center gap-2 py-[5px] pr-2.5 text-left","focus:outline-none focus-visible:bg-accent/60","disabled:cursor-default"),children:[n.jsx("span",{className:j("h-[7px] w-[7px] shrink-0 rounded-full bg-current",h)}),n.jsx("span",{className:j("shrink-0 text-[9.5px] font-medium uppercase tracking-wide",e.active?"text-muted-foreground":"text-muted-foreground/60"),children:x}),o&&n.jsxs("span",{title:`${i} alternate branch${i===1?"":"es"}`,className:"inline-flex shrink-0 items-center gap-0.5 text-[9px] font-medium text-muted-foreground tabular-nums",children:[n.jsx(H,{className:"h-2.5 w-2.5"}),i]}),n.jsx("span",{className:j("min-w-0 flex-1 truncate text-[11px]",e.active?"text-foreground/90":"text-muted-foreground"),children:e.preview||"—"}),e.label&&n.jsx("span",{className:"shrink-0 rounded bg-brand-tint px-1 py-px text-[9px] font-medium text-brand",children:e.label}),p&&n.jsx(le,{className:"h-3 w-3 shrink-0 text-brand"}),r&&n.jsx(J,{className:"h-3 w-3 shrink-0 animate-spin text-brand"}),n.jsx("span",{className:"shrink-0 font-mono text-[9.5px] tabular-nums text-muted-foreground opacity-0 transition-opacity group-hover/tree-row:opacity-100",children:ve(e.timestamp)})]})]})}function ve(e){const a=new Date(e);return Number.isNaN(a.getTime())?"":a.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1})}export{ke as SessionTree};
@@ -0,0 +1,51 @@
1
+ import{r as x,j as e}from"./markdown-CY-Rm0E5.js";import{M as v,ac as le,ad as N,aa as k,z as y,L as $,m as ie,a0 as fe,k as te,y as se,J as u,D as ve,o as ye,S as je,ap as Ne,a5 as re,_ as ne,$ as ke,ak as Se,d as we,C as Ce,al as Ee,am as Te}from"./index-DfuMmOel.js";import"./shiki-BZ0sbaMe.js";/**
2
+ * @license lucide-react v0.468.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Le=v("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
7
+ * @license lucide-react v0.468.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const Pe=v("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
12
+ * @license lucide-react v0.468.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const Ae=v("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
17
+ * @license lucide-react v0.468.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const De=v("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
22
+ * @license lucide-react v0.468.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const Ie=v("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
27
+ * @license lucide-react v0.468.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const _e=v("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
32
+ * @license lucide-react v0.468.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const qe=v("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
37
+ * @license lucide-react v0.468.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const Ke=v("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
42
+ * @license lucide-react v0.468.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */const Re=v("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
47
+ * @license lucide-react v0.468.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */const Fe=v("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]),xe=["web-search"];function ue(s){s.invalidateQueries({queryKey:xe})}function Oe(){return le({queryKey:xe,queryFn:()=>y("/api/web-search")})}function Ue(){const s=N();return k({mutationFn:t=>y("/api/web-search",{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>ue(s)})}function We(){const s=N();return k({mutationFn:()=>y("/api/web-search",{method:"DELETE"}),onSuccess:()=>ue(s)})}const me=["model-configs"];function P(s){s.invalidateQueries({queryKey:me}),s.invalidateQueries({queryKey:["config"]})}function $e(){return le({queryKey:me,queryFn:()=>y("/api/model-configs")})}function ze(){const s=N();return k({mutationFn:t=>y("/api/model-configs/providers",{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>P(s)})}function He(){const s=N();return k({mutationFn:t=>y(`/api/model-configs/providers?name=${encodeURIComponent(t)}`,{method:"DELETE"}),onSuccess:()=>P(s)})}function Je(){const s=N();return k({mutationFn:({provider:t,model:n})=>y(`/api/model-configs/providers/${encodeURIComponent(t)}/models`,{method:"POST",body:JSON.stringify({model:n})}),onSuccess:()=>P(s)})}function Be(){const s=N();return k({mutationFn:({provider:t,modelId:n,model:r})=>y(`/api/model-configs/providers/${encodeURIComponent(t)}/models/${encodeURIComponent(n)}`,{method:"PUT",body:JSON.stringify({model:r})}),onSuccess:()=>P(s)})}function Ge(){const s=N();return k({mutationFn:({provider:t,modelId:n})=>y(`/api/model-configs/providers/${encodeURIComponent(t)}/models/${encodeURIComponent(n)}`,{method:"DELETE"}),onSuccess:()=>P(s)})}const oe=["anthropic-messages","openai-completions","openai-responses","azure-openai-responses","openai-codex-responses","mistral-conversations","bedrock-converse-stream","google-generative-ai","google-vertex"],b="h-8 w-full rounded-lg border border-border-soft bg-background px-2.5 text-[13px] text-foreground outline-none transition-colors focus:border-brand-subtle disabled:opacity-50",K="rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground";function Ye(){const{data:s,isLoading:t,error:n}=$e(),[r,o]=x.useState(null),[a,c]=x.useState(null);if(t)return e.jsxs("div",{className:"flex items-center justify-center py-12 text-[12px] text-muted-foreground",children:[e.jsx($,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"ml-2",children:"Loading…"})]});if(n||!s)return e.jsx("p",{className:"rounded-lg border border-error-ghost bg-error-ghost px-4 py-3 text-center text-[12px] text-signal-error",children:(n==null?void 0:n.message)??"Failed to load model config"});const d=Object.entries(s.config.providers);return e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-[12px] font-semibold uppercase tracking-[0.08em] text-muted-foreground",children:["Providers · ",d.length]}),e.jsxs("button",{type:"button",onClick:()=>o({mode:"add"}),className:"flex h-8 items-center gap-1.5 rounded-lg bg-brand px-3 text-[13px] font-medium text-brand-foreground transition-colors hover:bg-brand-strong",children:[e.jsx(ie,{className:"h-3.5 w-3.5"})," Add provider"]})]}),d.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-border bg-card/40 px-4 py-10 text-center",children:[e.jsx("p",{className:"text-[13px] text-muted-foreground",children:"No providers yet."}),e.jsx("button",{type:"button",onClick:()=>o({mode:"add"}),className:"mt-1.5 text-[13px] font-medium text-brand hover:underline",children:"Add your first provider"})]}):d.map(([l,i])=>e.jsx(Ve,{name:l,config:i,onEdit:()=>o({mode:"edit",name:l,config:i}),onAddModel:()=>c({provider:l,model:null}),onEditModel:p=>c({provider:l,model:p})},l)),r&&e.jsx(Qe,{initialName:r.mode==="edit"?r.name:"",initialConfig:r.mode==="edit"?r.config:null,onClose:()=>o(null)}),a&&e.jsx(Xe,{provider:a.provider,initialModel:a.model,onClose:()=>c(null)})]})}function Ve({name:s,config:t,onEdit:n,onAddModel:r,onEditModel:o}){const a=He(),c=Ge(),d=fe();return e.jsxs("div",{className:"overflow-hidden rounded-xl border border-border-soft bg-card",children:[e.jsxs("div",{className:"flex items-start gap-2.5 px-4 py-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-[13.5px] font-semibold text-foreground",children:s}),e.jsx("span",{className:"shrink-0 rounded-md bg-muted px-1.5 py-0.5 font-mono text-[10.5px] text-muted-foreground",children:t.api})]}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[11.5px] text-muted-foreground",children:[e.jsx("span",{className:"truncate font-mono",children:t.baseUrl}),t.apiKey&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ae,{className:"h-3 w-3"}),e.jsx("span",{className:"font-mono",children:t.apiKey})]})]})]}),e.jsx("button",{type:"button",onClick:n,className:K,title:"Edit provider",children:e.jsx(te,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:async()=>{await d({title:"Delete provider",message:`Delete provider "${s}" and all its models?`,confirmLabel:"Delete",variant:"danger"})&&a.mutate(s)},className:u(K,"hover:bg-error-subtle hover:text-signal-error"),title:"Delete provider",children:e.jsx(se,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"border-t border-border-soft",children:[t.models.length===0?e.jsx("p",{className:"px-4 py-3 text-[12px] text-muted-foreground",children:"No models yet."}):t.models.map(l=>e.jsxs("div",{className:"group flex items-center gap-2.5 border-b border-border-soft/60 px-4 py-2 last:border-b-0 hover:bg-muted/40",children:[e.jsx("span",{className:"truncate text-[13px] text-foreground",children:l.name}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",children:l.id}),l.reasoning&&e.jsx("span",{className:"shrink-0 rounded-md bg-brand-tint px-1.5 py-0.5 text-[10px] font-medium text-brand",children:"Reasoning"}),e.jsxs("div",{className:"flex shrink-0 items-center opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",children:[e.jsx("button",{type:"button",onClick:()=>o(l),className:u(K,"p-1"),title:"Edit model",children:e.jsx(te,{className:"h-3 w-3"})}),e.jsx("button",{type:"button",onClick:async()=>{await d({title:"Delete model",message:`Delete model "${l.name}"?`,confirmLabel:"Delete",variant:"danger"})&&c.mutate({provider:s,modelId:l.id})},className:u(K,"p-1 hover:bg-error-subtle hover:text-signal-error"),title:"Delete model",children:e.jsx(se,{className:"h-3 w-3"})})]})]},l.id)),e.jsxs("button",{type:"button",onClick:r,className:"flex w-full items-center gap-1.5 border-t border-border-soft px-4 py-2 text-[12px] font-medium text-brand/80 transition-colors hover:bg-brand-whisper hover:text-brand",children:[e.jsx(ie,{className:"h-3 w-3"})," Add model"]})]})]})}function Qe({initialName:s,initialConfig:t,onClose:n}){var T,_;const r=!!t,[o,a]=x.useState(s),[c,d]=x.useState((t==null?void 0:t.baseUrl)??""),l=!!(t!=null&&t.api)&&!oe.includes(t.api),[i,p]=x.useState(l?"__custom__":(t==null?void 0:t.api)??"anthropic-messages"),[f,A]=x.useState(l?t.api:""),[C,D]=x.useState(""),I=t==null?void 0:t.apiKey,[E,R]=x.useState(((T=t==null?void 0:t.compat)==null?void 0:T.forceAdaptiveThinking)===!0),S=ze(),[F,w]=x.useState(null),O=h=>{h.preventDefault(),w(null);const q=i==="__custom__"?f:i;if(!q)return w("API type is required.");if(!r&&!C.trim())return w("API key is required.");const j={...t==null?void 0:t.compat};E?j.forceAdaptiveThinking=!0:delete j.forceAdaptiveThinking;const U={baseUrl:c,api:q,apiKey:C.trim(),...Object.keys(j).length?{compat:j}:{},models:(t==null?void 0:t.models)??[]};S.mutate({name:o,provider:U},{onSuccess:n})};return e.jsxs(pe,{title:r?"Edit provider":"New provider",onClose:n,onSubmit:O,submitLabel:r?"Update":"Create",pending:S.isPending,error:F??((_=S.error)==null?void 0:_.message),children:[e.jsx(g,{label:"Name",required:!0,children:e.jsx("input",{value:o,onChange:h=>a(h.target.value),placeholder:"e.g. my-provider",disabled:r,className:u(b,"font-mono"),required:!0})}),e.jsx(g,{label:"Base URL",required:!0,children:e.jsx("input",{value:c,onChange:h=>d(h.target.value),placeholder:"https://api.example.com",className:u(b,"font-mono"),required:!0})}),e.jsxs(g,{label:"API type",required:!0,children:[e.jsxs("select",{value:i,onChange:h=>p(h.target.value),className:b,children:[oe.map(h=>e.jsx("option",{value:h,children:h},h)),e.jsx("option",{value:"__custom__",children:"Custom…"})]}),i==="__custom__"&&e.jsx("input",{value:f,onChange:h=>A(h.target.value),placeholder:"custom-api-type",className:u(b,"mt-2 font-mono"),required:!0})]}),e.jsx(g,{label:"API key",required:!r,children:e.jsx("input",{type:"password",value:C,onChange:h=>D(h.target.value),placeholder:r&&I?`Leave blank to keep ${I}`:"sk-…",className:u(b,"font-mono"),required:!r})}),e.jsx(he,{checked:E,onChange:R,label:"Force adaptive thinking"})]})}function Xe({provider:s,initialModel:t,onClose:n}){var G,Y,V,Q,X,Z,M;const r=!!t,[o,a]=x.useState((t==null?void 0:t.id)??""),[c,d]=x.useState((t==null?void 0:t.name)??""),[l,i]=x.useState((t==null?void 0:t.reasoning)??!0),[p,f]=x.useState(String((t==null?void 0:t.contextWindow)??2e5)),[A,C]=x.useState(String((t==null?void 0:t.maxTokens)??32e3)),[D,I]=x.useState(String(((G=t==null?void 0:t.cost)==null?void 0:G.input)??0)),[E,R]=x.useState(String(((Y=t==null?void 0:t.cost)==null?void 0:Y.output)??0)),[S,F]=x.useState(String(((V=t==null?void 0:t.cost)==null?void 0:V.cacheRead)??0)),[w,O]=x.useState(String(((Q=t==null?void 0:t.cost)==null?void 0:Q.cacheWrite)??0)),[T,_]=x.useState(((X=t==null?void 0:t.thinkingLevelMap)==null?void 0:X.high)??"high"),[h,q]=x.useState(((Z=t==null?void 0:t.thinkingLevelMap)==null?void 0:Z.xhigh)??"max"),[j,U]=x.useState(t!=null&&t.headers?JSON.stringify(t.headers,null,2):""),z=Je(),H=Be(),J=r?H:z,[ge,B]=x.useState(null),be=m=>{m.preventDefault(),B(null);let W;if(j.trim())try{W=JSON.parse(j)}catch{return B("Headers must be valid JSON.")}const ee={id:o,name:c,reasoning:l,input:["text"],contextWindow:Number(p),maxTokens:Number(A),cost:{input:Number(D),output:Number(E),cacheRead:Number(S),cacheWrite:Number(w)},...l?{thinkingLevelMap:{high:T,xhigh:h}}:{},...W?{headers:W}:{}};r?H.mutate({provider:s,modelId:t.id,model:ee},{onSuccess:n}):z.mutate({provider:s,model:ee},{onSuccess:n})};return e.jsxs(pe,{title:r?"Edit model":"New model",subtitle:s,onClose:n,onSubmit:be,submitLabel:r?"Update":"Create",pending:J.isPending,error:ge??((M=J.error)==null?void 0:M.message),children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(g,{label:"Model ID",required:!0,children:e.jsx("input",{value:o,onChange:m=>a(m.target.value),placeholder:"claude-opus-4-8",disabled:r,className:u(b,"font-mono"),required:!0})}),e.jsx(g,{label:"Display name",required:!0,children:e.jsx("input",{value:c,onChange:m=>d(m.target.value),placeholder:"Claude Opus 4.8",className:b,required:!0})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(g,{label:"Context window",children:e.jsx("input",{type:"number",value:p,onChange:m=>f(m.target.value),className:u(b,"font-mono")})}),e.jsx(g,{label:"Max tokens",children:e.jsx("input",{type:"number",value:A,onChange:m=>C(m.target.value),className:u(b,"font-mono")})})]}),e.jsx(he,{checked:l,onChange:i,label:"Supports reasoning"}),l&&e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(g,{label:"Thinking High maps to",children:e.jsx("input",{value:T,onChange:m=>_(m.target.value),placeholder:"high",className:b})}),e.jsx(g,{label:"Thinking XHigh maps to",children:e.jsx("input",{value:h,onChange:m=>q(m.target.value),placeholder:"max",className:b})})]}),e.jsxs("div",{className:"rounded-lg border border-border-soft p-3",children:[e.jsx("span",{className:"mb-2.5 block text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground",children:"Cost · per million tokens"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(g,{label:"Input",children:e.jsx("input",{type:"number",step:"0.01",value:D,onChange:m=>I(m.target.value),className:u(b,"font-mono")})}),e.jsx(g,{label:"Output",children:e.jsx("input",{type:"number",step:"0.01",value:E,onChange:m=>R(m.target.value),className:u(b,"font-mono")})}),e.jsx(g,{label:"Cache read",children:e.jsx("input",{type:"number",step:"0.01",value:S,onChange:m=>F(m.target.value),className:u(b,"font-mono")})}),e.jsx(g,{label:"Cache write",children:e.jsx("input",{type:"number",step:"0.01",value:w,onChange:m=>O(m.target.value),className:u(b,"font-mono")})})]})]}),e.jsx(g,{label:"Custom headers (JSON)",children:e.jsx("textarea",{value:j,onChange:m=>U(m.target.value),placeholder:'{"User-Agent": "…"}',rows:3,className:"w-full resize-none rounded-lg border border-border-soft bg-background px-2.5 py-2 font-mono text-[13px] text-foreground outline-none transition-colors focus:border-brand-subtle"})})]})}function pe({title:s,subtitle:t,onClose:n,onSubmit:r,submitLabel:o,pending:a,error:c,children:d}){return e.jsx(ve,{open:!0,onClose:n,className:"max-h-[85vh] w-[520px] max-w-[92vw]",children:e.jsxs("form",{onSubmit:r,className:"flex max-h-[85vh] flex-col",children:[e.jsxs("header",{className:"flex shrink-0 items-baseline gap-2 border-b border-border-soft px-5 py-3.5",children:[e.jsx("span",{className:"text-[14px] font-semibold text-foreground",children:s}),t&&e.jsxs("span",{className:"font-mono text-[12px] text-muted-foreground",children:["· ",t]})]}),e.jsx("div",{className:"flex flex-col gap-3.5 overflow-y-auto px-5 py-4",children:d}),c&&e.jsx("p",{className:"mx-5 mb-1 shrink-0 rounded-md border border-error-ghost bg-error-ghost px-3 py-1.5 text-[12px] text-signal-error",children:c}),e.jsxs("footer",{className:"flex shrink-0 justify-end gap-2 border-t border-border-soft px-5 py-3",children:[e.jsx("button",{type:"button",onClick:n,className:"h-8 rounded-lg border border-border-soft px-4 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:a,className:"h-8 rounded-lg bg-brand px-4 text-[13px] font-medium text-brand-foreground transition-colors hover:bg-brand-strong disabled:opacity-50",children:a?"Saving…":o})]})]})})}function g({label:s,required:t,children:n}){return e.jsxs("div",{children:[e.jsxs("label",{className:"mb-1.5 block text-[12px] font-medium text-muted-foreground",children:[s,t&&e.jsx("span",{className:"text-signal-error",children:" *"})]}),n]})}function he({checked:s,onChange:t,label:n}){return e.jsxs("label",{className:"flex cursor-pointer items-center gap-2.5",children:[e.jsx("input",{type:"checkbox",checked:s,onChange:r=>t(r.target.checked),className:"h-3.5 w-3.5 accent-[hsl(var(--brand))]"}),e.jsx("span",{className:"text-[13px] text-foreground",children:n})]})}const ae=[{id:"general",label:"General",icon:_e},{id:"session",label:"Session",icon:Fe},{id:"models",label:"Models",icon:qe},{id:"web-search",label:"Web search",icon:Pe}];function pt({workspaceId:s,onBack:t}){var a;const[n,r]=x.useState("general"),[o]=x.useState(()=>{try{const c=localStorage.getItem(ye);if(c){const d=parseInt(c,10);if(!isNaN(d)&&d>=200)return d}}catch{}return je});return e.jsxs("div",{className:"flex h-full w-full bg-background",children:[e.jsxs("nav",{className:"flex shrink-0 flex-col border-r border-border bg-popover",style:{width:`${o}px`},children:[e.jsx("header",{className:"flex h-[60px] shrink-0 items-center gap-2 px-3",children:e.jsxs("button",{type:"button",onClick:t,className:"flex items-center gap-1.5 rounded-md px-2 py-1.5 text-[13px] font-medium text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground",children:[e.jsx(Le,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Back"})]})}),e.jsx("div",{className:"flex flex-1 flex-col gap-0.5 px-2 py-1",children:ae.map(c=>e.jsxs("button",{type:"button",onClick:()=>r(c.id),className:u("flex items-center gap-2.5 rounded-lg px-3 py-2 text-[13px] font-medium transition-colors",n===c.id?"bg-brand-ghost text-brand-strong":"text-muted-foreground hover:bg-accent/60 hover:text-foreground"),children:[e.jsx(c.icon,{className:"h-4 w-4"}),c.label]},c.id))})]}),e.jsxs("main",{className:"flex min-w-0 flex-1 flex-col overflow-y-auto",children:[e.jsx("header",{className:"flex h-[60px] shrink-0 items-center border-b border-border-soft px-8",children:e.jsx("h1",{className:"text-[17px] font-semibold tracking-[-0.015em] text-foreground",children:((a=ae.find(c=>c.id===n))==null?void 0:a.label)??"Settings"})}),e.jsxs("div",{className:"mx-auto w-full max-w-2xl px-8 py-8",children:[n==="general"&&e.jsx(et,{}),n==="session"&&e.jsx(tt,{workspaceId:s}),n==="models"&&e.jsx(dt,{}),n==="web-search"&&e.jsx(ct,{})]})]})]})}const Ze=[{value:"system",label:"System",icon:De},{value:"light",label:"Light",icon:Re},{value:"dark",label:"Dark",icon:Ie}],Me=[{value:"comfortable",label:"Comfortable"},{value:"compact",label:"Compact"}];function et(){const{choice:s,setTheme:t}=Ne(),n=re(o=>o.density),r=re(o=>o.setDensity);return e.jsx("div",{className:"flex flex-col gap-5",children:e.jsx(L,{title:"Appearance",description:"How pi-pilot looks on this device. Stored locally — it doesn't sync.",children:e.jsxs(it,{children:[e.jsx(de,{label:"Theme",description:"Follow the system, or lock to light or dark.",children:e.jsx(ce,{options:Ze.map(o=>({value:o.value,label:e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(o.icon,{className:"h-3 w-3"}),e.jsx("span",{children:o.label})]})})),value:s,onChange:o=>t(o)})}),e.jsx(de,{label:"Density",description:"Comfortable spacing, or denser rows that fit more on screen.",children:e.jsx(ce,{options:Me.map(o=>({value:o.value,label:o.label})),value:n,onChange:o=>r(o)})})]})})})}function tt({workspaceId:s}){const t=ne(r=>r.sessionPath),n=ne(r=>r.running);return s?e.jsx(st,{workspaceId:s,sessionPath:t,running:n}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx(Ke,{className:"mb-3 h-8 w-8 text-muted-foreground/40"}),e.jsx("p",{className:"text-[13px] text-muted-foreground",children:"Select a workspace first to configure the active session."})]})}function st({workspaceId:s,sessionPath:t,running:n}){const{data:r,isLoading:o,error:a}=ke(s,t);return o?e.jsxs("div",{className:"flex items-center justify-center py-16 text-[12px] text-muted-foreground",children:[e.jsx($,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"ml-2",children:"Loading config…"})]}):a||!r?e.jsx("p",{className:"rounded-md border border-error-ghost bg-error-ghost px-4 py-3 text-center text-[12px] text-signal-error",children:(a==null?void 0:a.message)??"Failed to load config"}):e.jsxs("div",{className:"flex flex-col gap-5",children:[n&&e.jsx("p",{className:"rounded-md border border-brand-ghost bg-brand-ghost px-4 py-2 text-center text-[12px] text-brand",children:"Read-only while the agent is running"}),e.jsx(L,{title:"Model",children:e.jsx(rt,{workspaceId:s,currentModel:r.currentModel,availableModels:r.availableModels,disabled:n})}),e.jsx(L,{title:"Thinking level",children:e.jsx(ot,{workspaceId:s,level:r.thinkingLevel,availableLevels:r.availableThinkingLevels,disabled:n})}),e.jsx(L,{title:"Tools",children:e.jsx(at,{workspaceId:s,activeTools:r.activeTools,allTools:r.allTools,disabled:n})})]})}function rt({workspaceId:s,currentModel:t,availableModels:n,disabled:r}){const o=Se(s),[a,c]=x.useState(!1),d=x.useRef(null),l=t?`${t.provider}/${t.modelId}`:"";return x.useEffect(()=>{if(!a)return;const i=f=>{d.current&&!d.current.contains(f.target)&&c(!1)},p=f=>{f.key==="Escape"&&c(!1)};return document.addEventListener("mousedown",i),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",p)}},[a]),e.jsxs("div",{ref:d,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>c(i=>!i),disabled:r||o.isPending,className:u("flex h-9 w-full items-center gap-2 rounded-lg border bg-card px-3.5 text-[13px] text-foreground transition-colors","disabled:cursor-not-allowed disabled:opacity-50",a?"border-brand-subtle":"border-border-soft hover:border-border"),children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:(t==null?void 0:t.name)??"Select model"}),e.jsx(we,{className:u("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform",a&&"rotate-180")})]}),a&&e.jsx("div",{className:"absolute left-0 right-0 top-full z-50 mt-1 max-h-72 overflow-y-auto rounded-lg border border-border bg-popover shadow-panel",children:n.map(i=>{const p=`${i.provider}/${i.modelId}`,f=p===l;return e.jsxs("button",{type:"button",onClick:()=>{c(!1),f||o.mutate({provider:i.provider,modelId:i.modelId})},title:`${i.provider}/${i.modelId}`,className:u("flex w-full items-center gap-2.5 px-4 py-2 text-left text-[13px] transition-colors",f?"bg-brand-ghost text-brand-strong":"text-foreground hover:bg-accent/60"),children:[e.jsx(Ce,{className:u("h-3 w-3 shrink-0",f?"opacity-100":"opacity-0")}),e.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("span",{className:"truncate",children:i.name}),e.jsxs("span",{className:u("truncate font-mono text-[11px]",f?"text-brand":"text-muted-foreground"),children:[i.provider,"/",i.modelId]})]})]},p)})}),o.isError&&e.jsx("p",{className:"mt-1.5 text-[11.5px] text-signal-error",children:o.error.message})]})}const nt={off:"Off",minimal:"Min",low:"Low",medium:"Med",high:"High",xhigh:"Max"};function ot({workspaceId:s,level:t,availableLevels:n,disabled:r}){const o=Ee(s);return n.length===0?e.jsx("p",{className:"text-[13px] text-muted-foreground",children:"Current model has no thinking support."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex gap-0.5 rounded-lg border border-border bg-card p-1",children:n.map(a=>e.jsx("button",{type:"button",onClick:()=>o.mutate({level:a}),disabled:r||o.isPending,className:u("min-w-0 flex-1 truncate rounded-md px-2 py-2 text-[12.5px] font-medium transition-colors",a===t?"bg-brand-ghost text-brand-strong":"text-muted-foreground hover:text-foreground",(r||o.isPending)&&"opacity-50"),children:nt[a]??a},a))}),o.isError&&e.jsx("p",{className:"mt-1.5 text-[11.5px] text-signal-error",children:o.error.message})]})}function at({workspaceId:s,activeTools:t,allTools:n,disabled:r}){const o=Te(s),a=new Set(t),c=(d,l)=>{const i=l?[...t,d]:t.filter(p=>p!==d);o.mutate({tools:i})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-2 flex flex-col gap-1",children:[e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[t.length," of ",n.length," enabled"]}),e.jsx("p",{className:"text-[11.5px] leading-relaxed text-muted-foreground/80",children:"Applies to this conversation only. To turn an entire built-in extension and all its tools on or off across every conversation, use Resources → Extensions."})]}),e.jsx("ul",{className:"flex flex-col gap-1.5",children:n.map(d=>e.jsx("li",{children:e.jsxs("label",{className:u("flex cursor-pointer items-start gap-3 rounded-lg border border-border-soft bg-card px-4 py-2.5 transition-colors hover:border-border",a.has(d.name)&&"border-brand-whisper bg-brand-whisper",(r||o.isPending)&&"pointer-events-none opacity-50"),children:[e.jsx("input",{type:"checkbox",checked:a.has(d.name),onChange:l=>c(d.name,l.target.checked),disabled:r||o.isPending,className:"mt-[3px] h-3.5 w-3.5 shrink-0 accent-[hsl(var(--brand))]"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"font-mono text-[12.5px] text-foreground",children:d.name}),d.builtinExtension&&e.jsx("span",{className:"rounded-full border border-border-soft bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground",children:d.builtinExtension})]}),d.description&&e.jsx("span",{className:"mt-0.5 block text-[12px] text-muted-foreground",children:d.description})]})]})},d.name))}),o.isError&&e.jsx("p",{className:"mt-1.5 text-[11.5px] text-signal-error",children:o.error.message})]})}function dt(){return e.jsx(Ye,{})}function ct(){const{data:s,isLoading:t,error:n}=Oe(),r=Ue(),o=We(),[a,c]=x.useState(""),d=a.trim(),l=()=>{d&&r.mutate({apiKey:d},{onSuccess:()=>c("")})},i=r.error??o.error;return e.jsx("div",{className:"flex flex-col gap-5",children:e.jsx(L,{title:"Tavily API key",children:t?e.jsxs("div",{className:"flex items-center justify-center py-8 text-[12px] text-muted-foreground",children:[e.jsx($,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"ml-2",children:"Loading…"})]}):n?e.jsx("p",{className:"rounded-md border border-error-ghost bg-error-ghost px-4 py-3 text-center text-[12px] text-signal-error",children:n.message}):e.jsxs(e.Fragment,{children:[e.jsx(lt,{status:s}),e.jsxs("div",{className:"flex flex-col gap-2.5 rounded-lg border border-border-soft bg-card px-4 py-3",children:[e.jsx("label",{className:"text-[12px] font-medium text-muted-foreground",children:(s==null?void 0:s.source)==="settings"?"Replace key":"Add key"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"password",value:a,onChange:p=>c(p.target.value),onKeyDown:p=>{p.key==="Enter"&&l()},placeholder:"tvly-…",autoComplete:"off",spellCheck:!1,className:"h-8 min-w-0 flex-1 rounded-lg border border-border-soft bg-background px-3 font-mono text-[13px] leading-none text-foreground outline-none transition-colors focus:border-brand-subtle"}),e.jsx("button",{type:"button",onClick:l,disabled:!d||r.isPending,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-lg bg-brand px-4 text-[13px] font-medium text-white transition-opacity hover:opacity-90 disabled:opacity-40",children:r.isPending?"Saving…":"Save"})]}),(s==null?void 0:s.source)==="settings"&&e.jsx("button",{type:"button",onClick:()=>o.mutate(),disabled:o.isPending,className:"self-start text-[12px] font-medium text-muted-foreground transition-colors hover:text-signal-error disabled:opacity-50",children:o.isPending?"Removing…":"Remove saved key"}),i&&e.jsx("p",{className:"text-[11.5px] text-signal-error",children:i.message})]}),e.jsxs("p",{className:"text-[12px] leading-relaxed text-muted-foreground",children:["Powers the ",e.jsx("span",{className:"font-mono text-foreground",children:"web_search"})," and"," ",e.jsx("span",{className:"font-mono text-foreground",children:"web_fetch"})," tools. Get a free key at"," ",e.jsx("a",{href:"https://app.tavily.com",target:"_blank",rel:"noreferrer noopener",className:"text-brand hover:underline",children:"app.tavily.com"}),". A key saved here overrides the"," ",e.jsx("span",{className:"font-mono text-foreground",children:"TAVILY_API_KEY"})," environment variable."]})]})})})}function lt({status:s}){const t=(s==null?void 0:s.configured)??!1,n=(s==null?void 0:s.source)??"none",r=n==="settings"?"saved in settings":n==="env"?"from TAVILY_API_KEY env":"";return e.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-border-soft bg-card px-4 py-3",children:[e.jsx("span",{className:u("h-1.5 w-1.5 shrink-0 rounded-full",t?"bg-signal-ok":"bg-muted-foreground/40")}),t?e.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-[13px]",children:[e.jsx("span",{className:"text-foreground",children:"Configured"}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:r}),(s==null?void 0:s.hint)&&e.jsx("span",{className:"font-mono text-[12px] text-muted-foreground/70",children:s.hint})]}):e.jsx("span",{className:"text-[13px] text-muted-foreground",children:"Not configured"})]})}function L({title:s,description:t,children:n}){return e.jsxs("section",{children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("h3",{className:"text-[12px] font-semibold uppercase tracking-[0.08em] text-muted-foreground",children:s}),t&&e.jsx("p",{className:"mt-1 text-[12.5px] leading-relaxed text-muted-foreground/80",children:t})]}),e.jsx("div",{className:"flex flex-col gap-3",children:n})]})}function it({children:s}){return e.jsx("div",{className:"divide-y divide-border-soft overflow-hidden rounded-xl border border-border-soft bg-card",children:s})}function de({label:s,description:t,children:n}){return e.jsxs("div",{className:"flex items-center justify-between gap-4 px-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[13px] text-foreground",children:s}),t&&e.jsx("div",{className:"mt-0.5 text-[12px] leading-snug text-muted-foreground",children:t})]}),n]})}function ce({options:s,value:t,onChange:n}){return e.jsx("div",{className:"flex gap-0.5 rounded-md border border-border bg-card p-0.5",children:s.map(r=>e.jsx("button",{type:"button",onClick:()=>n(r.value),className:u("rounded-[5px] px-2.5 py-1 text-[12px] font-medium transition-colors",r.value===t?"bg-brand-ghost text-brand-strong":"text-muted-foreground hover:text-foreground"),children:r.label},r.value))})}export{pt as SettingsPage};
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright (c) 2014 The xterm.js authors. All rights reserved.
3
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
4
+ * https://github.com/chjj/term.js
5
+ * @license MIT
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ * Originally forked from (with the author's permission):
26
+ * Fabrice Bellard's javascript vt100 for jslinux:
27
+ * http://bellard.org/jslinux/
28
+ * Copyright (c) 2011 Fabrice Bellard
29
+ * The original design remains. The terminal itself
30
+ * has been extended to include xterm CSI codes, among
31
+ * other features.
32
+ */.xterm{cursor:text;position:relative;-moz-user-select:none;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::-moz-selection{color:transparent}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{font-family:monospace;-webkit-user-select:text;-moz-user-select:text;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:-moz-fit-content;width:fit-content}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:double underline;text-decoration:double underline}.xterm-underline-3{-webkit-text-decoration:wavy underline;text-decoration:wavy underline}.xterm-underline-4{-webkit-text-decoration:dotted underline;text-decoration:dotted underline}.xterm-underline-5{-webkit-text-decoration:dashed underline;text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:#0000;transition:opacity .1s linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}