@pi-chamber/web 1.0.6-rc.5 → 1.0.6

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.
Files changed (63) hide show
  1. package/dist/assets/{DiagramView--XO16VPB.js → DiagramView-DsCdfDOP.js} +1 -1
  2. package/dist/assets/{DiffView-Duy2_7Gp.js → DiffView-BWo7yT-P.js} +6 -6
  3. package/dist/assets/{FileSaveConflictDialog-B1DvL9zy.js → FileSaveConflictDialog-IFbuQCcP.js} +1 -1
  4. package/dist/assets/{FilesView-CjjPpE4c.js → FilesView-DLIQkVep.js} +4 -4
  5. package/dist/assets/{GitHubDetailScaffold-DqxAKqCT.js → GitHubDetailScaffold-CxGg6x7R.js} +1 -1
  6. package/dist/assets/{GitHubLinkPicker-ELF_chia.js → GitHubLinkPicker-BmqbTUpE.js} +1 -1
  7. package/dist/assets/{GitHubListPrimitives-C2nGTntk.js → GitHubListPrimitives-a1DxU6Zp.js} +1 -1
  8. package/dist/assets/{GitView-5fIq2nzM.js → GitView-DbqM8Qi1.js} +5 -5
  9. package/dist/assets/{IssuesSurface-Dq5A_bWq.js → IssuesSurface-B2EfICtZ.js} +3 -3
  10. package/dist/assets/{JsonTreeView-BjFFSUwi.js → JsonTreeView-DzVqgwz-.js} +1 -1
  11. package/dist/assets/{MarkdownRendererImpl-B9Cu4TCh.js → MarkdownRendererImpl-7yTzCIEI.js} +3 -3
  12. package/dist/assets/PatchDiff-Dvfm6eOV.js +1 -0
  13. package/dist/assets/{PierreDiffViewer-H2f4pJ1k.js → PierreDiffViewer-ByYaUifK.js} +2 -2
  14. package/dist/assets/{PullRequestsSurface-DPpb2RW_.js → PullRequestsSurface-1IP_dDn8.js} +2 -2
  15. package/dist/assets/{SessionSwitcherContent-B5DaBWZU.js → SessionSwitcherContent-DVxWhG4x.js} +1 -1
  16. package/dist/assets/{SessionSwitcherDropdown-D86FaZg_.js → SessionSwitcherDropdown-DiBGmmtD.js} +2 -2
  17. package/dist/assets/{SessionUnreadDot-CY9-1iV2.js → SessionUnreadDot-qw67HcBO.js} +1 -1
  18. package/dist/assets/SettingsView-CMTIIpWD.js +6 -0
  19. package/dist/assets/{SettingsWindow-Bw1dUoJ1.js → SettingsWindow-DZUSs5Is.js} +1 -1
  20. package/dist/assets/{ToolOutputDialog-aR4kcgKL.js → ToolOutputDialog-pgTNzNPN.js} +5 -5
  21. package/dist/assets/{ToolPartDiffPreview-B_wWmhtE.js → ToolPartDiffPreview-Cvnr4JkU.js} +1 -1
  22. package/dist/assets/{VirtualizedFileDiff-BYby097w.js → VirtualizedFileDiff-D8dSHI_H.js} +3 -3
  23. package/dist/assets/{collapsible-Dz0bPrJ_.js → collapsible-ZT74WYMA.js} +1 -1
  24. package/dist/assets/{computeVirtualFileMetrics-8MuwxSC6.js → computeVirtualFileMetrics-g1aOl5nF.js} +1 -1
  25. package/dist/assets/{contextFileOpenGuard-fZ2NIQMQ.js → contextFileOpenGuard-IWdho_6z.js} +1 -1
  26. package/dist/assets/{fileTreeStatus-BzhMMLA9.js → fileTreeStatus-trDHgX4B.js} +2 -2
  27. package/dist/assets/{gitStatusPredicates-Cyh9UhYX.js → gitStatusPredicates-CfBh9Rne.js} +1 -1
  28. package/dist/assets/{githubLink-D2PznPcI.js → githubLink-CuQ2WFBa.js} +1 -1
  29. package/dist/assets/index-BaLCg7tL.css +1 -0
  30. package/dist/assets/{index-BX5pAOQX.js → index-CK9t5Znh.js} +1 -1
  31. package/dist/assets/{index-Cs2nBW_t.js → index-fmzQmSSv.js} +3 -3
  32. package/dist/assets/{main-BI6qe8pz.js → main-DOlk_lfi.js} +2 -2
  33. package/dist/assets/{main-7vBNPBMb.js → main-UnRe9F68.js} +4 -4
  34. package/dist/assets/{markdownCore-D5jiabKe.js → markdownCore-DuZmdypZ.js} +2 -2
  35. package/dist/assets/{miniChat-B3up4Bnz.js → miniChat-Dy9h0B6G.js} +2 -2
  36. package/dist/assets/{mobile-B4vLFgBc.js → mobile-CWrtn0Si.js} +2 -2
  37. package/dist/assets/{nativeFileSave-DpBH1Sa3.js → nativeFileSave-B4Rg6n8u.js} +1 -1
  38. package/dist/assets/{pi-session-focus-preference-BrB72skF.js → pi-session-focus-preference-q-s-Bhf0.js} +1 -1
  39. package/dist/assets/{renderDiffWithHighlighter-B6T04JGG.js → renderDiffWithHighlighter-HRnE6vfE.js} +1 -1
  40. package/dist/assets/{renderElectronMiniChatApp-CX10w321.js → renderElectronMiniChatApp-OZ2fG5eY.js} +2 -2
  41. package/dist/assets/{renderFileWithHighlighter-DtAcGyJr.js → renderFileWithHighlighter-tJRUQWjE.js} +1 -1
  42. package/dist/assets/{renderMobileApp-C9n-BhPZ.js → renderMobileApp-D1nkBJLP.js} +3 -3
  43. package/dist/assets/runtimeEndpointReset-Bby2E_Je.js +62 -0
  44. package/dist/assets/{runtimeSurface-DiP2a57a.js → runtimeSurface-X62LLBLv.js} +1 -1
  45. package/dist/assets/{useAppFontEffects-Oyin3dgQ.js → useAppFontEffects-BFgKpDYT.js} +86 -86
  46. package/dist/assets/{useGitHubRemoteSearch-CZ9Hauw0.js → useGitHubRemoteSearch-MxC4J-VO.js} +1 -1
  47. package/dist/assets/{useSwitcherItems-BSqDA1IF.js → useSwitcherItems-D5TsQEbM.js} +1 -1
  48. package/dist/assets/{web-components-CkTNGkJ2.js → web-components-B_NMC-2c.js} +4 -4
  49. package/dist/index.html +4 -4
  50. package/dist/mini-chat.html +3 -3
  51. package/dist/mobile.html +3 -3
  52. package/package.json +1 -1
  53. package/server/lib/pi/routes.js +5 -1
  54. package/server/lib/pi/routes.test.js +3 -0
  55. package/server/lib/pi/session-daemon/DOCUMENTATION.md +1 -1
  56. package/server/lib/pi/session-daemon/session-daemon-list-live.test.js +60 -1
  57. package/server/lib/pi/session-daemon/session-daemon.js +34 -10
  58. package/server/lib/pi/session-daemon/session-engine-router.js +5 -1
  59. package/server/lib/pi/session-daemon/session-engine-router.test.js +21 -0
  60. package/dist/assets/PatchDiff-CTqTTcg7.js +0 -1
  61. package/dist/assets/SettingsView-CiIuOi_E.js +0 -6
  62. package/dist/assets/index-tmO0fZa4.css +0 -1
  63. package/dist/assets/runtimeEndpointReset-aGyXPXPs.js +0 -62
@@ -1,7 +1,7 @@
1
- import{R as g}from"./vendor-react-Bz1tRBxM.js";import{t as w,bL as P,cQ as M}from"./useAppFontEffects-Oyin3dgQ.js";import{as as _,f as R}from"./index-Cs2nBW_t.js";import{j as u}from"./vendor-boot-3SaHYVb1.js";const q=e=>{const t=h(e);if(!t)return"";if(t==="/"||/^[A-Za-z]:\/$/.test(t))return t;const s=t.lastIndexOf("/");if(s<0)return t;if(s===0)return"/";const n=t.slice(0,s);return/^[A-Za-z]:$/.test(n)?`${n}/`:n},J=e=>e.slice().sort((t,s)=>t.type!==s.type?t.type==="directory"?-1:1:t.name.localeCompare(s.name)),h=e=>{if(!e)return"";const t=e.replace(/\\/g,"/"),s=t.startsWith("//");let n=t.replace(/\/+/g,"/");s&&!n.startsWith("//")&&(n=`/${n}`);const o=n==="/",i=/^[A-Za-z]:\/$/.test(n);return!o&&!i&&(n=n.replace(/\/+$/,"")),n},X=e=>e.startsWith("/")||e.startsWith("//")||/^[A-Za-z]:\//.test(e),$=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,A=(e,t)=>{const s=h(t),n=h(e);if(!s||!n)return!1;const o=$(s),i=$(n);return i===o||i.startsWith(`${o}/`)},Y=(e,t)=>{const s=h(t),n=h(e);if(!A(n,s))return[];const i=n.slice(s.length).replace(/^\//,"").split("/"),c=[];let r=s;for(let f=0;f<i.length-1;f++)r=r?`${r}/${i[f]}`:i[f],c.push(r);return c},K=(e,t)=>{if(!t)return"";const s=h(t);if(!e||!A(s,e))return s;const n=s.slice(e.length);return n.startsWith("/")?n.slice(1):n},D=new Set(["node_modules"]),ee=e=>D.has(e),te=e=>e===".git",L=/(^|\/)\.git(\/|$)/,W=e=>L.test(h(e)),I=e=>{const t=h(e);return t==="node_modules"||t.endsWith("/node_modules")||t.includes("/node_modules/")},se=e=>{const s=(e instanceof Error?e.message:String(e??"")).toLowerCase();return s.includes("is a directory")||s.includes("eisdir")},ne=e=>{const s=(e instanceof Error?e.message:String(e??"")).toLowerCase();return s.includes("file not found")||s.includes("enoent")||s.includes("no such file")||s.includes("does not exist")},re=2e5,ae=e=>{let t=0,s=0;for(let n=0;n<e.length;n+=1)e.charCodeAt(n)===10&&(n>0&&e.charCodeAt(n-1)===13?t+=1:s+=1);return t>s?`\r
1
+ import{R as g}from"./vendor-react-Bz1tRBxM.js";import{t as w,bL as P,cT as M}from"./useAppFontEffects-BFgKpDYT.js";import{as as _,f as R}from"./index-fmzQmSSv.js";import{j as u}from"./vendor-boot-3SaHYVb1.js";const Q=e=>{const t=h(e);if(!t)return"";if(t==="/"||/^[A-Za-z]:\/$/.test(t))return t;const s=t.lastIndexOf("/");if(s<0)return t;if(s===0)return"/";const n=t.slice(0,s);return/^[A-Za-z]:$/.test(n)?`${n}/`:n},J=e=>e.slice().sort((t,s)=>t.type!==s.type?t.type==="directory"?-1:1:t.name.localeCompare(s.name)),h=e=>{if(!e)return"";const t=e.replace(/\\/g,"/"),s=t.startsWith("//");let n=t.replace(/\/+/g,"/");s&&!n.startsWith("//")&&(n=`/${n}`);const o=n==="/",i=/^[A-Za-z]:\/$/.test(n);return!o&&!i&&(n=n.replace(/\/+$/,"")),n},X=e=>e.startsWith("/")||e.startsWith("//")||/^[A-Za-z]:\//.test(e),$=e=>/^[A-Za-z]:\//.test(e)?e.toLowerCase():e,A=(e,t)=>{const s=h(t),n=h(e);if(!s||!n)return!1;const o=$(s),i=$(n);return i===o||i.startsWith(`${o}/`)},Y=(e,t)=>{const s=h(t),n=h(e);if(!A(n,s))return[];const i=n.slice(s.length).replace(/^\//,"").split("/"),c=[];let r=s;for(let f=0;f<i.length-1;f++)r=r?`${r}/${i[f]}`:i[f],c.push(r);return c},K=(e,t)=>{if(!t)return"";const s=h(t);if(!e||!A(s,e))return s;const n=s.slice(e.length);return n.startsWith("/")?n.slice(1):n},D=new Set(["node_modules"]),ee=e=>D.has(e),te=e=>e===".git",L=/(^|\/)\.git(\/|$)/,W=e=>L.test(h(e)),I=e=>{const t=h(e);return t==="node_modules"||t.endsWith("/node_modules")||t.includes("/node_modules/")},se=e=>{const s=(e instanceof Error?e.message:String(e??"")).toLowerCase();return s.includes("is a directory")||s.includes("eisdir")},ne=e=>{const s=(e instanceof Error?e.message:String(e??"")).toLowerCase();return s.includes("file not found")||s.includes("enoent")||s.includes("no such file")||s.includes("does not exist")},re=2e5,ae=e=>{let t=0,s=0;for(let n=0;n<e.length;n+=1)e.charCodeAt(n)===10&&(n>0&&e.charCodeAt(n-1)===13?t+=1:s+=1);return t>s?`\r
2
2
  `:`
3
3
  `},B=e=>e.replace(/\r\n/g,`
4
4
  `).replace(/\r/g,`
5
5
  `),ie=(e,t)=>{const s=B(e);return t===`\r
6
6
  `?s.replace(/\n/g,`\r
7
- `):s},oe=e=>{if(!e)return!1;const t=e.toLowerCase().split(".").pop();return t==="md"||t==="markdown"},le=e=>{if(!e)return!1;const t=e.toLowerCase().split(".").pop();return t==="json"||t==="jsonc"||t==="json5"||t==="geojson"},ce=e=>{if(!e)return!1;const t=e.toLowerCase().split(".").pop();return t==="html"||t==="htm"};function de({files:e,root:t,selectedPath:s,refreshDirectory:n,removeOpenPathsByPrefix:o,clearSelectedPath:i}){const c=g.useRef(null),[r,f]=g.useState(null),[a,m]=g.useState(null),[l,C]=g.useState(""),[F,p]=g.useState(!1),b=g.useCallback((v,y)=>{f(v),m(y),C(v==="rename"&&y.name||""),p(!1)},[]),x=g.useCallback(()=>f(null),[]),N=g.useCallback(async v=>{if(v?.preventDefault(),!r||!a)return;const y=l.trim();if(r==="createFile"&&!y){w.error("Filename is required");return}if(r==="createFolder"&&!y){w.error("Folder name is required");return}if(r==="rename"&&!y){w.error("Name is required");return}if(r==="createFile"&&!e.writeFile){w.error("Write not supported");return}if(r==="rename"&&!e.rename){w.error("Rename not supported");return}if(r==="delete"&&!e.delete){w.error("Delete not supported");return}p(!0);try{if(r==="createFile"){const d=a.path,S=h(`${d?`${d}/`:""}${y}`);try{(await e.writeFile(S,"",{expectedRevision:null})).success&&(w.success("File created"),await n(d))}catch(j){if(j?.reason==="file-revision-conflict"||j?.name==="FileRevisionConflictError")w.error("File already exists");else throw j}}else if(r==="createFolder"){const d=a.path,S=h(`${d?`${d}/`:""}${y}`);(await e.createDirectory(S)).success&&(w.success("Folder created"),await n(d))}else{const d=a.path,S=d.split("/").slice(0,-1).join("/"),j=s===d||s.startsWith(`${d}/`);(r==="rename"?await e.rename(d,h(`${S?`${S}/`:""}${y}`)):await e.delete(d)).success&&(w.success(r==="rename"?"Renamed successfully":"Deleted successfully"),await n(S),t&&o(t,d),j&&i())}f(null)}catch{w.error("Operation failed")}finally{p(!1)}},[i,e,l,r,n,o,t,s,a]);return{operation:r,target:a,inputValue:l,setInputValue:C,submitting:F,inputRef:c,open:b,close:x,submit:N,capabilities:{canCreateFile:!!e.writeFile,canCreateFolder:!!e.createDirectory,canRename:!!e.rename,canDelete:!!e.delete}}}function ue({directory:e,query:t,chrome:s,showGitignored:n}){const o=_(F=>F.searchFiles),i=P(t,200),[c,r]=g.useState([]),[f,a]=g.useState(!1),[m,l]=g.useState(!1);g.useEffect(()=>{const F=i.trim();if(!e||!F){r([]),a(!1),l(!1);return}let p=!1;return a(!0),l(!1),o(e,F,s==="mobile"?40:150,{includeHidden:!0,respectGitignore:s==="desktop"&&!n,type:"file"}).then(b=>{p||r(b.filter(x=>!W(x.relativePath??x.path)).filter(x=>n||!I(x.path)).map(x=>({name:x.name,path:h(x.path),type:"file",extension:x.extension,relativePath:x.relativePath})))}).catch(()=>{p||(r([]),l(!0))}).finally(()=>{p||a(!1)}),()=>{p=!0}},[s,i,e,o,n]);const C=t.trim()!==""&&t.trim()!==i.trim();return{results:c,searching:f||C,failed:m&&!C}}const E={"git-modified":{letter:"M",label:"Modified",textClass:"text-[var(--status-warning)]"},"git-added":{letter:"A",label:"New file",textClass:"text-[var(--status-success)]"},"git-deleted":{letter:"D",label:"Deleted",textClass:"text-[var(--status-error)]"}},H=e=>e in E,O=({status:e,className:t})=>{if(H(e)){const n=E[e];return u.jsx("span",{className:R("w-3 shrink-0 text-center font-mono typography-micro font-semibold",n.textClass,t),title:n.label,"aria-label":n.label,children:n.letter})}const s=e==="open"?"Open in a tab":"Unsaved changes";return u.jsx("span",{className:R("flex w-3 shrink-0 justify-center",t),title:s,"aria-label":s,children:u.jsx("span",{className:R("size-1.5 rounded-full",e==="open"?"bg-[var(--status-info)]":"bg-[var(--status-warning)]")})})},fe=({badge:e,className:t})=>{const s=[e.modified>0?`${e.modified} modified`:null,e.added>0?e.added===1?"1 new file":`${e.added} new files`:null].filter(Boolean);if(s.length===0)return null;const n=s.join(", ");return u.jsx("span",{className:R("flex w-3 shrink-0 justify-center",t),title:n,"aria-label":n,children:u.jsx("span",{className:R("size-1.5 rounded-full",e.modified>0?"bg-[var(--status-warning)]":"bg-[var(--status-success)]")})})},T=(e,t)=>{const s=t?.trim().toLowerCase();if(!s)return e;const n=e.toLowerCase().indexOf(s);return n<0?e:u.jsxs(u.Fragment,{children:[e.slice(0,n),u.jsx("mark",{className:"bg-transparent font-semibold text-foreground",children:e.slice(n,n+s.length)}),e.slice(n+s.length)]})},me=({path:e,status:t,active:s=!1,onClick:n,onDragStart:o,match:i})=>{const c=e.lastIndexOf("/"),r=e.slice(c+1),f=c>=0?e.slice(0,c):"";return u.jsxs("button",{type:"button",onClick:n,draggable:!!o,onDragStart:o,className:R("flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-left transition-colors",s?"bg-interactive-selection/70":"hover:bg-interactive-hover/40",o&&"cursor-grab active:cursor-grabbing"),title:e,children:[u.jsx(M,{filePath:e}),u.jsx("span",{className:"min-w-0 truncate typography-meta text-foreground",children:T(r,i)}),u.jsx("span",{className:"min-w-0 flex-1 truncate pl-1 typography-meta text-muted-foreground [direction:rtl] [text-align:left]",children:u.jsx("bdi",{children:f})}),t?u.jsx(O,{status:t}):null]})},z=(e,t)=>e.startsWith(`${t}/`)?e.slice(t.length+1):e,V=e=>e.index==="A"||e.working_dir==="?"?"git-added":e.index==="D"?"git-deleted":e.index==="M"||e.working_dir==="M"?"git-modified":null,pe=({root:e,openPaths:t,gitFiles:s})=>{const n=new Set(t),o=new Map,i=new Map,c={modified:0,added:0};for(const a of s??[]){o.has(a.path)||o.set(a.path,a);const m=+(a.index==="M"||a.working_dir==="M"),l=+(a.index==="A"||a.working_dir==="?");if(m===0&&l===0)continue;c.modified+=m,c.added+=l;const C=a.path.split("/");for(let F=1;F<C.length;F+=1){const p=C.slice(0,F).join("/");if(!p)continue;let b=i.get(p);b||(b={modified:0,added:0},i.set(p,b)),b.modified+=m,b.added+=l}}return{getFileStatus:a=>{const m=o.size>0?o.get(z(a,e)):void 0,l=m?V(m):null;return l||(n.has(a)?"open":null)},getFolderBadge:a=>{if(!s)return null;const m=z(a,e);if(!m)return c.modified+c.added>0?{...c}:null;const l=i.get(m);return l?{...l}:null}}},ge=e=>new Set(e);export{O as F,re as M,fe as a,X as b,J as c,de as d,Y as e,me as f,K as g,V as h,te as i,le as j,oe as k,ce as l,ae as m,B as n,h as o,ie as p,ge as q,A as r,ee as s,$ as t,ue as u,q as v,ne as w,se as x,pe as y};
7
+ `):s},oe=e=>{if(!e)return!1;const t=e.toLowerCase().split(".").pop();return t==="md"||t==="markdown"},le=e=>{if(!e)return!1;const t=e.toLowerCase().split(".").pop();return t==="json"||t==="jsonc"||t==="json5"||t==="geojson"},ce=e=>{if(!e)return!1;const t=e.toLowerCase().split(".").pop();return t==="html"||t==="htm"};function de({files:e,root:t,selectedPath:s,refreshDirectory:n,removeOpenPathsByPrefix:o,clearSelectedPath:i}){const c=g.useRef(null),[r,f]=g.useState(null),[a,m]=g.useState(null),[l,C]=g.useState(""),[F,p]=g.useState(!1),b=g.useCallback((v,y)=>{f(v),m(y),C(v==="rename"&&y.name||""),p(!1)},[]),x=g.useCallback(()=>f(null),[]),N=g.useCallback(async v=>{if(v?.preventDefault(),!r||!a)return;const y=l.trim();if(r==="createFile"&&!y){w.error("Filename is required");return}if(r==="createFolder"&&!y){w.error("Folder name is required");return}if(r==="rename"&&!y){w.error("Name is required");return}if(r==="createFile"&&!e.writeFile){w.error("Write not supported");return}if(r==="rename"&&!e.rename){w.error("Rename not supported");return}if(r==="delete"&&!e.delete){w.error("Delete not supported");return}p(!0);try{if(r==="createFile"){const d=a.path,S=h(`${d?`${d}/`:""}${y}`);try{(await e.writeFile(S,"",{expectedRevision:null})).success&&(w.success("File created"),await n(d))}catch(j){if(j?.reason==="file-revision-conflict"||j?.name==="FileRevisionConflictError")w.error("File already exists");else throw j}}else if(r==="createFolder"){const d=a.path,S=h(`${d?`${d}/`:""}${y}`);(await e.createDirectory(S)).success&&(w.success("Folder created"),await n(d))}else{const d=a.path,S=d.split("/").slice(0,-1).join("/"),j=s===d||s.startsWith(`${d}/`);(r==="rename"?await e.rename(d,h(`${S?`${S}/`:""}${y}`)):await e.delete(d)).success&&(w.success(r==="rename"?"Renamed successfully":"Deleted successfully"),await n(S),t&&o(t,d),j&&i())}f(null)}catch{w.error("Operation failed")}finally{p(!1)}},[i,e,l,r,n,o,t,s,a]);return{operation:r,target:a,inputValue:l,setInputValue:C,submitting:F,inputRef:c,open:b,close:x,submit:N,capabilities:{canCreateFile:!!e.writeFile,canCreateFolder:!!e.createDirectory,canRename:!!e.rename,canDelete:!!e.delete}}}function ue({directory:e,query:t,chrome:s,showGitignored:n}){const o=_(F=>F.searchFiles),i=P(t,200),[c,r]=g.useState([]),[f,a]=g.useState(!1),[m,l]=g.useState(!1);g.useEffect(()=>{const F=i.trim();if(!e||!F){r([]),a(!1),l(!1);return}let p=!1;return a(!0),l(!1),o(e,F,s==="mobile"?40:150,{includeHidden:!0,respectGitignore:s==="desktop"&&!n,type:"file"}).then(b=>{p||r(b.filter(x=>!W(x.relativePath??x.path)).filter(x=>n||!I(x.path)).map(x=>({name:x.name,path:h(x.path),type:"file",extension:x.extension,relativePath:x.relativePath})))}).catch(()=>{p||(r([]),l(!0))}).finally(()=>{p||a(!1)}),()=>{p=!0}},[s,i,e,o,n]);const C=t.trim()!==""&&t.trim()!==i.trim();return{results:c,searching:f||C,failed:m&&!C}}const E={"git-modified":{letter:"M",label:"Modified",textClass:"text-[var(--status-warning)]"},"git-added":{letter:"A",label:"New file",textClass:"text-[var(--status-success)]"},"git-deleted":{letter:"D",label:"Deleted",textClass:"text-[var(--status-error)]"}},H=e=>e in E,O=({status:e,className:t})=>{if(H(e)){const n=E[e];return u.jsx("span",{className:R("w-3 shrink-0 text-center font-mono typography-micro font-semibold",n.textClass,t),title:n.label,"aria-label":n.label,children:n.letter})}const s=e==="open"?"Open in a tab":"Unsaved changes";return u.jsx("span",{className:R("flex w-3 shrink-0 justify-center",t),title:s,"aria-label":s,children:u.jsx("span",{className:R("size-1.5 rounded-full",e==="open"?"bg-[var(--status-info)]":"bg-[var(--status-warning)]")})})},fe=({badge:e,className:t})=>{const s=[e.modified>0?`${e.modified} modified`:null,e.added>0?e.added===1?"1 new file":`${e.added} new files`:null].filter(Boolean);if(s.length===0)return null;const n=s.join(", ");return u.jsx("span",{className:R("flex w-3 shrink-0 justify-center",t),title:n,"aria-label":n,children:u.jsx("span",{className:R("size-1.5 rounded-full",e.modified>0?"bg-[var(--status-warning)]":"bg-[var(--status-success)]")})})},T=(e,t)=>{const s=t?.trim().toLowerCase();if(!s)return e;const n=e.toLowerCase().indexOf(s);return n<0?e:u.jsxs(u.Fragment,{children:[e.slice(0,n),u.jsx("mark",{className:"bg-transparent font-semibold text-foreground",children:e.slice(n,n+s.length)}),e.slice(n+s.length)]})},me=({path:e,status:t,active:s=!1,onClick:n,onDragStart:o,match:i})=>{const c=e.lastIndexOf("/"),r=e.slice(c+1),f=c>=0?e.slice(0,c):"";return u.jsxs("button",{type:"button",onClick:n,draggable:!!o,onDragStart:o,className:R("flex w-full items-center gap-1.5 rounded-md px-2 py-1 text-left transition-colors",s?"bg-interactive-selection/70":"hover:bg-interactive-hover/40",o&&"cursor-grab active:cursor-grabbing"),title:e,children:[u.jsx(M,{filePath:e}),u.jsx("span",{className:"min-w-0 truncate typography-meta text-foreground",children:T(r,i)}),u.jsx("span",{className:"min-w-0 flex-1 truncate pl-1 typography-meta text-muted-foreground [direction:rtl] [text-align:left]",children:u.jsx("bdi",{children:f})}),t?u.jsx(O,{status:t}):null]})},z=(e,t)=>e.startsWith(`${t}/`)?e.slice(t.length+1):e,V=e=>e.index==="A"||e.working_dir==="?"?"git-added":e.index==="D"?"git-deleted":e.index==="M"||e.working_dir==="M"?"git-modified":null,pe=({root:e,openPaths:t,gitFiles:s})=>{const n=new Set(t),o=new Map,i=new Map,c={modified:0,added:0};for(const a of s??[]){o.has(a.path)||o.set(a.path,a);const m=+(a.index==="M"||a.working_dir==="M"),l=+(a.index==="A"||a.working_dir==="?");if(m===0&&l===0)continue;c.modified+=m,c.added+=l;const C=a.path.split("/");for(let F=1;F<C.length;F+=1){const p=C.slice(0,F).join("/");if(!p)continue;let b=i.get(p);b||(b={modified:0,added:0},i.set(p,b)),b.modified+=m,b.added+=l}}return{getFileStatus:a=>{const m=o.size>0?o.get(z(a,e)):void 0,l=m?V(m):null;return l||(n.has(a)?"open":null)},getFolderBadge:a=>{if(!s)return null;const m=z(a,e);if(!m)return c.modified+c.added>0?{...c}:null;const l=i.get(m);return l?{...l}:null}}},ge=e=>new Set(e);export{O as F,re as M,fe as a,X as b,J as c,de as d,Y as e,me as f,K as g,V as h,te as i,le as j,oe as k,ce as l,ae as m,B as n,h as o,ie as p,ge as q,A as r,ee as s,$ as t,ue as u,Q as v,ne as w,se as x,pe as y};
@@ -1 +1 @@
1
- import{j as e}from"./vendor-boot-3SaHYVb1.js";import{R as h}from"./vendor-react-Bz1tRBxM.js";import{a$ as y,b0 as N,B as b,I as S,b1 as C,d_ as k,d$ as r}from"./useAppFontEffects-Oyin3dgQ.js";const _=h.memo(function({scope:n,isGitRepo:a,branchAvailable:i,allCount:o,workingCount:c,stagedCount:d,turnCount:m,branchCount:u,focusedFilePath:l=null,onScopeChange:g}){const[j,x]=h.useState(!1),p=n==="all"?o:n==="staged"?d:n==="turn"?m:n==="branch"?u:c,w=n==="staged"?"Staged":n==="turn"?"Last turn":n==="branch"?"Branch":n==="all"?"All":"Changed";return e.jsxs(y,{open:j,onOpenChange:x,children:[e.jsx(N,{asChild:!0,children:e.jsxs(b,{type:"button",variant:"ghost",size:"sm",className:"h-8 flex-shrink-0 gap-1.5 px-2 py-1 normal-case","aria-label":"Select change mode",children:[e.jsxs("span",{className:"whitespace-nowrap font-medium",children:[w," ",e.jsx("span",{className:"diff-toolbar__scope-count font-normal text-muted-foreground",children:l?`· ${l.split("/").pop()??l}`:p===1?"1 file":`${p} files`})]}),e.jsx(S,{name:"arrow-down-s",className:"size-4 flex-shrink-0 opacity-70"})]})}),e.jsx(C,{align:"start",className:"w-40",children:e.jsxs(k,{value:n,onValueChange:t=>{(t==="all"||t==="working"||t==="staged"||t==="turn"||t==="branch")&&(g?.(t),x(!1))},children:[a!==!1?e.jsx(r,{value:"all",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"All"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:o})]})}):null,a!==!1?e.jsx(r,{value:"working",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Changed"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:c})]})}):null,a!==!1?e.jsx(r,{value:"staged",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Staged"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:d})]})}):null,e.jsx(r,{value:"turn",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Last turn"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:m})]})}),i?e.jsx(r,{value:"branch",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Branch"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:u})]})}):null]})})]})}),f={"?":{code:"?",color:"var(--status-info)",description:"Untracked file"},A:{code:"A",color:"var(--status-success)",description:"New file"},D:{code:"D",color:"var(--status-error)",description:"Deleted file"},R:{code:"R",color:"var(--status-info)",description:"Renamed file"},C:{code:"C",color:"var(--status-info)",description:"Copied file"},M:{code:"M",color:"var(--status-warning)",description:"Modified file"}};function B(s){const n=s.index?.trim(),a=s.working_dir?.trim(),i=n&&n!=="?"?n.charAt(0):a?.charAt(0)||n?.charAt(0)||"M";return f[i]??f.M}function A(s){const n=s.index?.trim();return!!(n&&n!=="?")}function M(s){return!!s.working_dir?.trim()||s.index?.trim()==="?"}function I(s){return A(s)&&!M(s)}function O(s){const n=s.index?.trim(),a=s.working_dir?.trim();return n==="A"||a==="A"||n==="?"||a==="?"}export{_ as C,M as a,I as b,O as c,B as d,A as i};
1
+ import{j as e}from"./vendor-boot-3SaHYVb1.js";import{R as h}from"./vendor-react-Bz1tRBxM.js";import{a$ as y,b0 as N,B as b,I as S,b1 as C,e1 as k,e2 as r}from"./useAppFontEffects-BFgKpDYT.js";const B=h.memo(function({scope:n,isGitRepo:a,branchAvailable:i,allCount:o,workingCount:c,stagedCount:d,turnCount:m,branchCount:u,focusedFilePath:l=null,onScopeChange:g}){const[j,x]=h.useState(!1),p=n==="all"?o:n==="staged"?d:n==="turn"?m:n==="branch"?u:c,w=n==="staged"?"Staged":n==="turn"?"Last turn":n==="branch"?"Branch":n==="all"?"All":"Changed";return e.jsxs(y,{open:j,onOpenChange:x,children:[e.jsx(N,{asChild:!0,children:e.jsxs(b,{type:"button",variant:"ghost",size:"sm",className:"h-8 flex-shrink-0 gap-1.5 px-2 py-1 normal-case","aria-label":"Select change mode",children:[e.jsxs("span",{className:"whitespace-nowrap font-medium",children:[w," ",e.jsx("span",{className:"diff-toolbar__scope-count font-normal text-muted-foreground",children:l?`· ${l.split("/").pop()??l}`:p===1?"1 file":`${p} files`})]}),e.jsx(S,{name:"arrow-down-s",className:"size-4 flex-shrink-0 opacity-70"})]})}),e.jsx(C,{align:"start",className:"w-40",children:e.jsxs(k,{value:n,onValueChange:t=>{(t==="all"||t==="working"||t==="staged"||t==="turn"||t==="branch")&&(g?.(t),x(!1))},children:[a!==!1?e.jsx(r,{value:"all",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"All"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:o})]})}):null,a!==!1?e.jsx(r,{value:"working",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Changed"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:c})]})}):null,a!==!1?e.jsx(r,{value:"staged",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Staged"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:d})]})}):null,e.jsx(r,{value:"turn",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Last turn"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:m})]})}),i?e.jsx(r,{value:"branch",children:e.jsxs("span",{className:"flex min-w-0 flex-1 items-center justify-between gap-3",children:[e.jsx("span",{children:"Branch"}),e.jsx("span",{className:"typography-meta text-muted-foreground",children:u})]})}):null]})})]})}),f={"?":{code:"?",color:"var(--status-info)",description:"Untracked file"},A:{code:"A",color:"var(--status-success)",description:"New file"},D:{code:"D",color:"var(--status-error)",description:"Deleted file"},R:{code:"R",color:"var(--status-info)",description:"Renamed file"},C:{code:"C",color:"var(--status-info)",description:"Copied file"},M:{code:"M",color:"var(--status-warning)",description:"Modified file"}};function _(s){const n=s.index?.trim(),a=s.working_dir?.trim(),i=n&&n!=="?"?n.charAt(0):a?.charAt(0)||n?.charAt(0)||"M";return f[i]??f.M}function A(s){const n=s.index?.trim();return!!(n&&n!=="?")}function M(s){return!!s.working_dir?.trim()||s.index?.trim()==="?"}function I(s){return A(s)&&!M(s)}function O(s){const n=s.index?.trim(),a=s.working_dir?.trim();return n==="A"||a==="A"||n==="?"||a==="?"}export{B as C,M as a,I as b,O as c,_ as d,A as i};
@@ -1,4 +1,4 @@
1
- import{U as m,V as p,W as u,X as w}from"./GitHubDetailScaffold-DqxAKqCT.js";import{c6 as f}from"./useAppFontEffects-Oyin3dgQ.js";const x=[{id:"open",label:"Open"},{id:"closed",label:"Closed"},{id:"all",label:"All"}],k=[{id:"all",label:"All"},{id:"mine",label:"Created by me"},{id:"assigned",label:"Assigned to me"},{id:"mentioned",label:"Mentioned"}],y=[{id:"updated",label:"Recently updated"},{id:"newest",label:"Newest"},{id:"oldest",label:"Oldest"}],N=[{id:"completed",label:"Completed"},{id:"not_planned",label:"Not planned"}],_=(e,t,s)=>{if(!t&&e!=="comment")return{allowed:!1,reason:"Issue is still loading"};switch(e){case"close":return t?.state==="closed"?{allowed:!1,reason:"Already closed"}:u(s)?{allowed:!1,reason:"You need write access or be the author to close"}:{allowed:!0,reason:null};case"reopen":return t?.state!=="closed"?{allowed:!1,reason:"Already open"}:u(s)?{allowed:!1,reason:"You need write access or be the author to reopen"}:{allowed:!0,reason:null};case"edit":return u(s)?{allowed:!1,reason:"You need write access or be the author to edit"}:{allowed:!0,reason:null};case"labels":return p(s)?{allowed:!1,reason:"You need write access to change labels"}:{allowed:!0,reason:null};case"assignees":return p(s)?{allowed:!1,reason:"You need write access to change assignees"}:{allowed:!0,reason:null};case"comment":return m(s);default:return{allowed:!0,reason:null}}},E=(e,t)=>{switch(e){case"close-not-planned":return{title:`Close issue #${t} as not planned?`,detail:"The issue will close without being completed. You can reopen it later.",confirm:"Close as not planned",progress:"Closing…"};case"reopen":return{title:`Reopen issue #${t}?`,detail:"The issue will return to its previous open state.",confirm:"Reopen issue",progress:"Reopening…"};default:return{title:`Close issue #${t} as completed?`,detail:"The issue will be recorded as completed. You can reopen it later.",confirm:"Close as completed",progress:"Closing…"}}},L=e=>e==="reopen"?{state:"open"}:{state:"closed",stateReason:e==="close-not-planned"?"not_planned":"completed"},P=e=>{const t={},s=w(e.title,300);return s&&(t.title=s),e.body!==void 0&&e.body.length>2e5&&(t.body="Body is too long"),{ok:Object.keys(t).length===0,errors:t}},A=(e,t)=>e.trim()?t.trim()?`${e.replace(/\s+$/,"")}
1
+ import{U as m,V as p,W as u,X as w}from"./GitHubDetailScaffold-CxGg6x7R.js";import{c6 as f}from"./useAppFontEffects-BFgKpDYT.js";const x=[{id:"open",label:"Open"},{id:"closed",label:"Closed"},{id:"all",label:"All"}],k=[{id:"all",label:"All"},{id:"mine",label:"Created by me"},{id:"assigned",label:"Assigned to me"},{id:"mentioned",label:"Mentioned"}],y=[{id:"updated",label:"Recently updated"},{id:"newest",label:"Newest"},{id:"oldest",label:"Oldest"}],N=[{id:"completed",label:"Completed"},{id:"not_planned",label:"Not planned"}],_=(e,t,s)=>{if(!t&&e!=="comment")return{allowed:!1,reason:"Issue is still loading"};switch(e){case"close":return t?.state==="closed"?{allowed:!1,reason:"Already closed"}:u(s)?{allowed:!1,reason:"You need write access or be the author to close"}:{allowed:!0,reason:null};case"reopen":return t?.state!=="closed"?{allowed:!1,reason:"Already open"}:u(s)?{allowed:!1,reason:"You need write access or be the author to reopen"}:{allowed:!0,reason:null};case"edit":return u(s)?{allowed:!1,reason:"You need write access or be the author to edit"}:{allowed:!0,reason:null};case"labels":return p(s)?{allowed:!1,reason:"You need write access to change labels"}:{allowed:!0,reason:null};case"assignees":return p(s)?{allowed:!1,reason:"You need write access to change assignees"}:{allowed:!0,reason:null};case"comment":return m(s);default:return{allowed:!0,reason:null}}},E=(e,t)=>{switch(e){case"close-not-planned":return{title:`Close issue #${t} as not planned?`,detail:"The issue will close without being completed. You can reopen it later.",confirm:"Close as not planned",progress:"Closing…"};case"reopen":return{title:`Reopen issue #${t}?`,detail:"The issue will return to its previous open state.",confirm:"Reopen issue",progress:"Reopening…"};default:return{title:`Close issue #${t} as completed?`,detail:"The issue will be recorded as completed. You can reopen it later.",confirm:"Close as completed",progress:"Closing…"}}},L=e=>e==="reopen"?{state:"open"}:{state:"closed",stateReason:e==="close-not-planned"?"not_planned":"completed"},P=e=>{const t={},s=w(e.title,300);return s&&(t.title=s),e.body!==void 0&&e.body.length>2e5&&(t.body="Body is too long"),{ok:Object.keys(t).length===0,errors:t}},A=(e,t)=>e.trim()?t.trim()?`${e.replace(/\s+$/,"")}
2
2
 
3
3
  ${t}`:e:t,h=e=>e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"issue",R=(e,t)=>`issue-${e}-${h(t)}`,G=(e,t)=>{const s=e.trim();if(!s)return{link:null,outOfScope:!1};const c=s.match(/^#(\d{1,7})$/);if(c)return{link:{kind:"issue",number:Number(c[1]),owner:"",repo:""},outOfScope:!1};const r=s.match(/^([\w.-]+)\/([\w.-]+)#(\d{1,7})$/);if(r){const l=r[1].toLowerCase(),n=r[2].toLowerCase(),a=Number(r[3]);return t.some(i=>i.owner?.toLowerCase()===l&&i.repo?.toLowerCase()===n)?{link:{kind:"issue",number:a,owner:l,repo:n},outOfScope:!1}:{link:null,outOfScope:!0}}const o=s.match(/^https?:\/\/([^/]+)\/([\w.-]+)\/([\w.-]+)\/(issues|pull)\/(\d{1,7})(?:[/?#].*)?$/i);if(o){const l=o[1].toLowerCase(),n=o[2].toLowerCase(),a=o[3].toLowerCase().replace(/\.git$/,""),d=o[4].toLowerCase()==="pull"?"pr":"issue",i=Number(o[5]);return t.some(b=>b.ref.toLowerCase()===`${l}/${n}/${a}`)?{link:{kind:d,number:i,owner:n,repo:a},outOfScope:!1}:{link:null,outOfScope:!0}}return{link:null,outOfScope:!1}},H=e=>`Work on this GitHub issue. Read the quoted context below, then propose a plan and wait for confirmation before changing code.
4
4