ompchamber 0.4.0 → 0.5.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/README.md +10 -6
- package/dist/client/index.html +1 -1
- package/dist/client/static/js/async/dc.6dc4b0a04b.js +2 -0
- package/dist/client/static/js/{index.bf1b1fe988.js → index.0ac93ee878.js} +3 -3
- package/package.json +1 -2
- package/src/cli/lib/args.js +1 -0
- package/src/cli/lib/commands/serve.js +7 -0
- package/src/client/components/workspace/file-explorer/TreeItem.tsx +8 -2
- package/src/client/components/workspace/file-explorer/index.tsx +6 -0
- package/src/client/data/models/catalog.ts +8 -0
- package/src/client/data/samples/dialogue-session.ts +1 -1
- package/src/client/data/samples/sample-tools/other.ts +1 -1
- package/src/client/hooks/chat/timeline/send.ts +1 -1
- package/src/server/index.ts +53 -0
- package/src/server/lib/models/provider-registry.server.ts +44 -20
- package/src/server/lib/omp/core/cli.ts +3 -2
- package/src/server/lib/omp/core/startup.ts +64 -0
- package/src/server/lib/omp/rpc/process.ts +1 -1
- package/src/server/mock.server.ts +6 -12
- package/src/server/routes/chat/stream.ts +13 -30
- package/src/server/routes/models/root.ts +5 -1
- package/src/shared/lib/chat/stream-service.ts +0 -76
- package/src/shared/lib/fs/paths.ts +19 -0
- package/dist/client/static/js/async/art.62139ed479.js +0 -2
- /package/dist/client/static/js/async/{art.62139ed479.js.LICENSE.txt → dc.6dc4b0a04b.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/{index.bf1b1fe988.js.LICENSE.txt → index.0ac93ee878.js.LICENSE.txt} +0 -0
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<a href="https://elysiajs.com"><img alt="Server: Elysia 1.4" src="https://img.shields.io/badge/server-Elysia%201.4-6f42c1"></a>
|
|
15
15
|
<a href="https://preactjs.com"><img alt="UI: Preact 10" src="https://img.shields.io/badge/UI-Preact%2010-673ab7?logo=preact&logoColor=white"></a>
|
|
16
16
|
<a href="https://rsbuild.dev"><img alt="Build: Rsbuild 2" src="https://img.shields.io/badge/build-Rsbuild%202-eab308"></a>
|
|
17
|
-
<a href="package.json"><img alt="Version: 0.
|
|
17
|
+
<a href="package.json"><img alt="Version: 0.5.0" src="https://img.shields.io/badge/version-0.5.0-3f3f46"></a>
|
|
18
18
|
</p>
|
|
19
19
|
|
|
20
20
|
<p align="center">
|
|
@@ -67,8 +67,8 @@ ompchamber logs -f -n 200 # follow the server log
|
|
|
67
67
|
- **Full omp settings surface** — OMP Engine config keys, providers, agents, behavior
|
|
68
68
|
(`AGENTS.md` / `RULES.md`), slash commands, MCP servers with live connection tests, skills and
|
|
69
69
|
the skills catalog, token usage and notifications.
|
|
70
|
-
- **Two data modes** — `MOCK=
|
|
71
|
-
|
|
70
|
+
- **Two data modes** — `MOCK=false` (the default, also when unset) runs purely on the real SQLite
|
|
71
|
+
database and real workspace files; `MOCK=true` opts into demo datasets for previews.
|
|
72
72
|
- **Self-update** — `ompchamber update` installs the latest GitHub release (bun global or git
|
|
73
73
|
checkout) and restarts a running instance; **About → Updates** does the same from the console.
|
|
74
74
|
|
|
@@ -79,6 +79,10 @@ OMPChamber is published to npm. It needs a Bun runtime, not Node:
|
|
|
79
79
|
> **Bun only** — the server imports `bun:sqlite` and `Bun.YAML`, both of which Node cannot load.
|
|
80
80
|
> `bun` 1.4 or newer is required.
|
|
81
81
|
|
|
82
|
+
> **omp required** — every live capability (agent sessions, omp config, session state, updates)
|
|
83
|
+
> shells out to the `omp` binary, so `serve` refuses to start when it cannot be resolved on `PATH`
|
|
84
|
+
> (or via `OMPCHAMBER_OMP_BIN`). `MOCK=true` is the only mode that runs without a real omp install.
|
|
85
|
+
|
|
82
86
|
```bash
|
|
83
87
|
bun add -g ompchamber # puts the `ompchamber` command on your PATH
|
|
84
88
|
ompchamber serve --prod # start the server on :3000
|
|
@@ -159,7 +163,7 @@ Environment variables, read from `.env` (see [`.env.example`](.env.example)):
|
|
|
159
163
|
|---|---|---|
|
|
160
164
|
| `PORT` | `3000` | Server port |
|
|
161
165
|
| `HOST` | `localhost` | Server bind address |
|
|
162
|
-
| `MOCK` | `
|
|
166
|
+
| `MOCK` | `false` | `true` = demo datasets, `false` = real SQLite + workspace only |
|
|
163
167
|
| `SYNC_WORKSPACE` | `true` | Keep the workspace index in sync with disk |
|
|
164
168
|
| `OMPCHAMBER_DATA_DIR` | `~/.ompchamber` | CLI registry, logs and database root |
|
|
165
169
|
| `OMPCHAMBER_PORT` / `OMPCHAMBER_HOST` | — | Defaults for the CLI when no flag is passed |
|
|
@@ -167,7 +171,7 @@ Environment variables, read from `.env` (see [`.env.example`](.env.example)):
|
|
|
167
171
|
| `OMPCHAMBER_DEV_SERVER` | `http://localhost:3100` | Rsbuild asset origin used in dev |
|
|
168
172
|
| `OMPCHAMBER_BUN` | — | Explicit Bun binary for the CLI to spawn |
|
|
169
173
|
| `PI_CONFIG_DIR` / `PI_CODING_AGENT_DIR` | `~/.omp` | Oh-My-Pi config root overrides |
|
|
170
|
-
| `
|
|
174
|
+
| `OMPCHAMBER_OMP_BIN` | — | Explicit `omp` binary path |
|
|
171
175
|
| `SKILLS_API_URL` | `https://skills.sh` | Skills catalog source |
|
|
172
176
|
| `GITHUB_TOKEN` / `GH_TOKEN` | — | Raise the GitHub API rate limit for update checks |
|
|
173
177
|
|
|
@@ -230,7 +234,7 @@ Publishing is driven by **GitHub releases**, never by a push
|
|
|
230
234
|
([`.github/workflows/publish.yml`](.github/workflows/publish.yml)):
|
|
231
235
|
|
|
232
236
|
```bash
|
|
233
|
-
bun pm version minor -m "chore(release): v%s" # bump + commit + tag v0.
|
|
237
|
+
bun pm version minor -m "chore(release): v%s" # bump + commit + tag v0.5.0
|
|
234
238
|
git push origin main --tags
|
|
235
239
|
# then publish the release on GitHub → the workflow publishes to npm
|
|
236
240
|
```
|
package/dist/client/index.html
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap"
|
|
25
25
|
/>
|
|
26
26
|
<!--app-head-->
|
|
27
|
-
<script defer src="/static/js/markdown-vendor.71e43278b3.js"></script><script defer src="/static/js/shiki-vendor.cb8452ddcd.js"></script><script defer src="/static/js/uy.5f791144ce.js"></script><script defer src="/static/js/index.
|
|
27
|
+
<script defer src="/static/js/markdown-vendor.71e43278b3.js"></script><script defer src="/static/js/shiki-vendor.cb8452ddcd.js"></script><script defer src="/static/js/uy.5f791144ce.js"></script><script defer src="/static/js/index.0ac93ee878.js"></script><link href="/static/css/index.5291f58223.css" rel="stylesheet"></head>
|
|
28
28
|
<body>
|
|
29
29
|
<div id="app"></div>
|
|
30
30
|
<!--app-bootstrap-->
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! LICENSE: dc.6dc4b0a04b.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["dc"],{wA(e,t,n){var a=n("j"),r=n("H"),l=n("rm"),i=n("Go"),s=n("t3"),o=n("Ir"),c=n("z"),d=n("oj");function p(e){let{rootPath:t,activeRepo:n,onSelectRepo:p}=e,[h,x]=(0,r.J0)(!1),[m,f]=(0,r.J0)(["."]),[u,b]=(0,r.J0)(!1),[k,y]=(0,r.J0)(""),g=(0,r.li)(null),v=function(e){if(!e)return"workspace root";let t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t.length>0?t[t.length-1]:"workspace root"}(t),N=e=>"."===e?v:e,Y=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=new URLSearchParams({reposOnly:"1"});t&&n.set("root",t),e&&n.set("rescan","1"),n.set("t",String(Date.now()));let a=await fetch(`/api/fs/git?${n.toString()}`).then(e=>e.json()).catch(()=>null);a&&Array.isArray(a.repos)&&(f(a.repos),a.reposPending?b(!0):b(!1))};(0,r.vJ)(()=>{h&&Y()},[h,t]),(0,r.vJ)(()=>{if(!u)return;let e=new URLSearchParams({reposOnly:"1"});t&&e.set("root",t);let n=setInterval(async()=>{let t=await fetch(`/api/fs/git?${e.toString()}`).then(e=>e.json()).catch(()=>null);t&&!t.reposPending&&Array.isArray(t.repos)&&(f(t.repos),b(!1))},1500);return()=>clearInterval(n)},[u,t]),(0,d.W)(g,()=>x(!1));let w=m.filter(e=>!k.trim()||N(e).toLowerCase().includes(k.toLowerCase()));return(0,a.FD)("div",{className:"relative",ref:g,children:[(0,a.FD)("button",{type:"button",onClick:()=>x(!h),title:"Switch git project",className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 rounded transition-colors text-xs text-ink/80 font-medium",children:[(0,a.Y)(l.A,{size:12,className:"text-ink/60"}),(0,a.Y)("span",{className:"truncate max-w-[110px]",children:"."===n?v:n.split("/").pop()}),(0,a.Y)(i.A,{size:12,className:"text-ink/40"})]}),h&&(0,a.FD)("div",{className:"absolute top-full left-0 mt-1 w-52 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:[(0,a.FD)("div",{className:"px-2 py-1.5 border-b border-ink/10 flex items-center space-x-1.5",children:[(0,a.Y)(s.A,{size:11,className:"text-ink/40 flex-shrink-0"}),(0,a.Y)("input",{type:"text",value:k,onChange:e=>y(e.currentTarget.value),placeholder:"Search repos...",title:"Search repositories",className:"w-full bg-transparent outline-none text-xs text-ink placeholder-ink/40",autoFocus:!0}),k&&(0,a.Y)("button",{type:"button",onClick:()=>y(""),title:"Clear search",className:"text-ink/40 hover:text-ink flex-shrink-0",children:"×"}),(0,a.Y)("button",{type:"button",onClick:()=>void Y(!0),title:"Refresh nested repos",disabled:u,className:"text-ink/40 hover:text-ink flex-shrink-0 transition-colors disabled:opacity-40 disabled:hover:text-ink/40",children:(0,a.Y)(o.A,{size:11,className:u?"animate-spin":""})})]}),(0,a.Y)("div",{className:"max-h-48 scrollbar-overlay-container scrollbar-overlay-static py-1",children:0===w.length?(0,a.Y)("div",{className:"px-3 py-2 text-ink/40 italic",children:"No repos found"}):w.map(e=>(0,a.FD)("button",{type:"button",onClick:()=>{p(e),x(!1),y("")},title:N(e),className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[(0,a.Y)("span",{className:"truncate",children:N(e)}),n===e&&(0,a.Y)(c.A,{size:12,className:"text-ink"})]},e))})]})]})}n.d(t,{I:()=>p})},fy(e,t,n){n.d(t,{FileExplorer:()=>j});var a=n("j"),r=n("H"),l=n("n"),i=n("t3"),s=n("wA"),o=n("Go"),c=n("Nf"),d=n("X"),p=n("ob"),h=n("G"),x=n("bH"),m=n("YOg"),f=n("q"),u=n("b0"),b=n("hw");let k=(0,n("y").A)({name:"pen",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],aliases:["edit-2"]});var y=n("mO"),g=n("S");function v(e){let{x:t,y:n,isFolder:r,hasGitStatus:l,onAction:i,menuRef:s}=e,o=r?220:l?285:255,c="u">typeof window?Math.max(10,Math.min(t,window.innerWidth-190-12)):t,d="u">typeof window?Math.max(10,Math.min(n,window.innerHeight-o-12)):n;return(0,h.d5)((0,a.Y)("div",{className:"fixed inset-0 z-50 bg-ink/20",onClick:()=>i("close"),onContextMenu:e=>{e.preventDefault(),i("close")},children:(0,a.FD)("div",{ref:s,className:"fixed z-50 bg-paper border border-ink/15 shadow-2xl rounded-lg py-1 min-w-[185px] text-xs text-ink font-sans",style:{top:d,left:c},onClick:e=>e.stopPropagation(),children:[!r&&(0,a.FD)(a.FK,{children:[(0,a.FD)("button",{onClick:()=>i("view"),className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 flex items-center space-x-2 transition-colors",children:[(0,a.Y)(x.A,{size:13,className:"text-ink/60"}),(0,a.Y)("span",{children:"View"})]}),l&&(0,a.FD)("button",{onClick:()=>i("diff"),className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 flex items-center space-x-2 transition-colors text-ink",children:[(0,a.Y)(m.A,{size:13,className:"text-warning"}),(0,a.Y)("span",{className:"font-medium",children:"Open in Diff Panel"})]})]}),(0,a.FD)("button",{onClick:()=>i("explorer"),className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 flex items-center space-x-2 transition-colors",children:[(0,a.Y)(f.A,{size:13,className:"text-ink/60"}),(0,a.Y)("span",{children:"Go to Explorer"})]}),(0,a.Y)("div",{className:"my-1 border-t border-ink/10"}),(0,a.FD)("button",{onClick:()=>i("copy_path"),className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 flex items-center space-x-2 transition-colors",children:[(0,a.Y)(u.A,{size:13,className:"text-ink/60"}),(0,a.Y)("span",{children:"Copy Path"})]}),(0,a.FD)("button",{onClick:()=>i("copy_relative"),className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 flex items-center space-x-2 transition-colors",children:[(0,a.Y)(u.A,{size:13,className:"text-ink/60"}),(0,a.Y)("span",{children:"Copy Relative Path"})]}),(0,a.Y)("div",{className:"my-1 border-t border-ink/10"}),(0,a.FD)("button",{onClick:()=>i("history"),className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 flex items-center space-x-2 transition-colors",children:[(0,a.Y)(b.A,{size:13,className:"text-ink/60"}),(0,a.Y)("span",{children:"Show Git History"})]}),(0,a.Y)("div",{className:"my-1 border-t border-ink/10"}),(0,a.FD)("button",{onClick:()=>i("rename"),className:"w-full text-left px-3 py-1.5 hover:bg-ink/5 flex items-center space-x-2 transition-colors",children:[(0,a.Y)(k,{size:13,className:"text-ink/60"}),(0,a.Y)("span",{children:"Rename"})]}),(0,a.FD)("button",{onClick:()=>i("delete"),className:"w-full text-left px-3 py-1.5 hover:bg-error/10 text-error flex items-center space-x-2 transition-colors",children:[(0,a.Y)(y.A,{size:13,className:"text-error"}),(0,a.Y)("span",{children:"Delete"})]})]})}),document.body)}function N(e){let{fileName:t,isFolder:n,isLoading:r,onCancel:l,onConfirm:i}=e;return(0,h.d5)((0,a.Y)("div",{className:"fixed inset-0 bg-ink/20 z-[100] flex items-center justify-center p-4 backdrop-blur-sm",children:(0,a.FD)("div",{className:"bg-paper rounded shadow-xl p-4 w-full max-w-sm border border-ink/10 font-sans",children:[(0,a.FD)("h3",{className:"font-semibold text-ink mb-2 text-sm",children:["Delete ",n?"Folder":"File"]}),(0,a.FD)("p",{className:"text-xs text-ink/70 mb-4",children:["Are you sure you want to delete ",(0,a.Y)("span",{className:"font-mono bg-canvas px-1 rounded",children:t}),"? This action cannot be undone."]}),(0,a.FD)("div",{className:"flex justify-end space-x-2",children:[(0,a.Y)("button",{onClick:l,className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",disabled:r,children:"Cancel"}),(0,a.Y)("button",{onClick:i,className:"px-3 py-1.5 text-xs bg-error text-white rounded hover:bg-error/90 transition-colors flex items-center",disabled:r,children:r?"Deleting...":"Delete"})]})]})}),document.body)}function Y(e){let{isFolder:t,renameValue:n,originalPath:r,isLoading:l,onChange:i,onCancel:s,onSubmit:o}=e;return(0,h.d5)((0,a.Y)("div",{className:"fixed inset-0 bg-ink/20 z-[100] flex items-center justify-center p-4 backdrop-blur-sm",children:(0,a.FD)("form",{onSubmit:o,className:"bg-paper rounded shadow-xl p-4 w-full max-w-sm border border-ink/10 font-sans",children:[(0,a.FD)("h3",{className:"font-semibold text-ink mb-3 text-sm",children:["Rename ",t?"Folder":"File"]}),(0,a.Y)("input",{autoFocus:!0,type:"text",value:n,onChange:e=>i(e.currentTarget.value),className:"w-full bg-paper border border-ink/20 rounded px-2 py-1.5 text-xs font-mono focus:outline-none focus:border-ink mb-4"}),(0,a.FD)("div",{className:"flex justify-end space-x-2",children:[(0,a.Y)("button",{type:"button",onClick:s,className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",disabled:l,children:"Cancel"}),(0,a.Y)("button",{type:"submit",className:"px-3 py-1.5 text-xs bg-ink text-canvas rounded hover:bg-ink/90 transition-colors flex items-center",disabled:l||!n.trim()||n===r,children:l?"Renaming...":"Rename"})]})]})}),document.body)}function w(e){let{filePath:t,fetcherState:n,fetcherData:r,onClose:i}=e;return(0,h.d5)((0,a.Y)("div",{className:"fixed inset-0 bg-ink/20 z-[100] flex items-center justify-center p-4 backdrop-blur-sm",children:(0,a.FD)("div",{className:"bg-paper rounded-lg shadow-xl w-full max-w-4xl border border-ink/10 flex flex-col max-h-[85vh]",children:[(0,a.FD)("div",{className:"flex items-center justify-between p-4 border-b border-ink/10",children:[(0,a.FD)("h3",{className:"text-sm font-semibold text-ink flex items-center space-x-2",children:[(0,a.Y)(b.A,{size:16,className:"text-ink/60"}),(0,a.FD)("span",{children:["Git History: ",(0,a.Y)("span",{className:"font-mono font-normal opacity-80",children:t})]})]}),(0,a.Y)("button",{onClick:i,className:"p-1 hover:bg-ink/5 rounded text-ink/60 transition-colors",children:(0,a.Y)(g.A,{size:14})})]}),(0,a.Y)("div",{className:"flex-1 scrollbar-overlay-container scrollbar-overlay-static bg-paper p-2",children:"idle"===n?r?.type==="history"?r.data.length>0?(0,a.FD)("table",{className:"w-full text-left border-collapse text-[11px]",children:[(0,a.Y)("thead",{className:"bg-canvas sticky top-0 z-10 border-b border-ink/10",children:(0,a.FD)("tr",{children:[(0,a.Y)("th",{className:"px-3 py-2 font-semibold text-ink/70 rounded-tl",children:"Description"}),(0,a.Y)("th",{className:"px-3 py-2 font-semibold text-ink/70 w-32",children:"Date"}),(0,a.Y)("th",{className:"px-3 py-2 font-semibold text-ink/70 w-32",children:"Author"}),(0,a.Y)("th",{className:"px-3 py-2 font-semibold text-ink/70 w-24 text-right rounded-tr",children:"Commit"})]})}),(0,a.Y)("tbody",{className:"divide-y divide-ink/5",children:r.data.map((e,t)=>(0,a.FD)("tr",{className:"hover:bg-ink/[0.03] transition-colors group bg-paper",children:[(0,a.Y)("td",{className:"px-3 py-2 text-ink",children:e.message?(0,a.Y)("span",{className:"font-medium text-ink/90 group-hover:text-ink",children:e.message}):null}),(0,a.Y)("td",{className:"px-3 py-2 text-ink/60 whitespace-nowrap font-mono text-[10.5px]",children:e.time}),(0,a.Y)("td",{className:"px-3 py-2 text-ink/70 whitespace-nowrap truncate max-w-[120px]",children:e.author}),(0,a.Y)("td",{className:"px-3 py-2 text-right",children:e.hash?(0,a.Y)("span",{className:"font-mono text-ink/50 group-hover:text-ink font-semibold transition-colors bg-canvas px-1.5 py-0.5 rounded border border-ink/10",children:e.hash}):null})]},t))})]}):(0,a.Y)("div",{className:"p-8 text-center text-ink/40 font-mono text-xs",children:"No commit history found for this file."}):r?.error?(0,a.Y)("div",{className:"p-8 text-center text-error font-mono text-xs",children:r.error}):(0,a.Y)("div",{className:"p-8 text-center text-ink/40 font-mono text-xs",children:"Loading history..."}):(0,a.FD)("div",{className:"p-8 text-center text-ink/40 font-mono text-xs flex items-center justify-center space-x-2",children:[(0,a.Y)(l.A,{size:14,className:"animate-spin"}),(0,a.Y)("span",{children:"Loading history..."})]})})]})}),document.body)}var F=n("LQ"),D=n("pH"),C=n("oj");function A(e){let{file:t,rootPath:n,basePath:l,repo:i,onLoadChildren:s,onOpenFile:h,onActionComplete:x,expandedPaths:m,onToggleFolder:f,gitFileMap:u,gitFolderMap:b}=e,k="folder"===t.type,[y,g]=(0,r.J0)(!1),[z,S]=(0,r.J0)(!1),J=(0,d.L)(),[P,j]=(0,r.J0)(!1),[L,M]=(0,r.J0)(null),$=(0,r.li)(null),[R,H]=(0,r.J0)(!1),[T,E]=(0,r.J0)(!1),[O,G]=(0,r.J0)(!1),[_,I]=(0,r.J0)(t.path),V=Array.isArray(t.children)?t.children:[],B=(t.path||"").replace(/^\/+/,""),U=k?void 0:u?.get(B)||u?.get(t.path),W=U?(0,F.R)(U.status,U.staged):null,K=k?b?.get(B)||b?.get(t.path):null,Q=!!W,X=!0===t.ignored,q=m?m.has(t.path):y,Z=void 0!==t.forceExpanded?t.forceExpanded:q;(0,r.vJ)(()=>{j(!0)},[]),(0,r.vJ)(()=>{k&&m&&g(m.has(t.path))},[m,t.path,k]),(0,r.vJ)(()=>{k&&Z&&(!t.children||0===t.children.length)&&s&&!z&&(S(!0),Promise.resolve(s(t.path)).finally(()=>S(!1)))},[k,Z,t.children,t.path,s]),(0,C.W)($,()=>M(null)),(0,r.vJ)(()=>{"idle"===J.state&&J.data&&J.data.success&&!J.data.type&&(H(!1),E(!1),x())},[J.state,J.data]);let ee=e=>{i&&"."!==i&&e.append("repo",i),n&&e.append("root",n),J.submit(e,{method:"post",action:"/api/fs/action"})};return(0,a.FD)("div",{children:[(0,a.FD)("div",{className:"flex items-center space-x-1.5 py-1 px-2 hover:bg-ink/5 cursor-pointer rounded group",onClick:e=>{if(e.stopPropagation(),k){let e=!Z;g(e),void 0!==t.forceExpanded&&(t.forceExpanded=void 0),f?.(t.path,e),e&&s&&(!t.children||0===t.children.length)&&(S(!0),Promise.resolve(s(t.path)).finally(()=>S(!1)))}else h&&h({...t,root:n,repo:i||"."})},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),M({x:e.clientX,y:e.clientY})},children:[k?Z?(0,a.Y)(o.A,{size:12,className:"flex-shrink-0 text-ink/40"}):(0,a.Y)(c.A,{size:12,className:"flex-shrink-0 text-ink/40"}):(0,a.Y)("span",{className:"w-3 flex-shrink-0"}),(0,a.Y)(p.o,{name:t.name,isFolder:k,isOpen:Z,size:12,className:`flex-shrink-0${X?" opacity-40":""}`}),(0,a.Y)("span",{className:`truncate min-w-0 flex-1 ${W?W.colorClass:K?K.colorClass:X?"text-ink/40":""}`,title:X?`${t.path} — git-ignored`:void 0,children:t.name}),W&&(0,a.Y)("span",{className:`font-mono text-[9px] font-bold px-1 rounded flex-shrink-0 ${W.colorClass}`,title:`Git: ${W.label}`,children:W.charStatus}),K&&(0,a.Y)("span",{className:`w-1.5 h-1.5 rounded-full flex-shrink-0 ${K.hasDeleted?"bg-error":K.hasModified||K.hasStaged?"bg-info":"bg-success"}`,title:`${K.count} changed file${K.count>1?"s":""}`})]}),Z&&z&&(0,a.Y)("div",{className:"ml-3 border-l border-ink/10 pl-3 py-0.5 text-[10px] text-ink/30",children:"Loading…"}),Z&&!z&&V.length>0&&(0,a.Y)("div",{className:"ml-3 border-l border-ink/10 pl-1",children:V.map(e=>(0,a.Y)(A,{file:e,rootPath:n,basePath:l,repo:i,onLoadChildren:s,onOpenFile:h,onActionComplete:x,expandedPaths:m,onToggleFolder:f,gitFileMap:u,gitFolderMap:b},e.id))}),P&&L&&(0,a.Y)(v,{x:L.x,y:L.y,isFolder:k,hasGitStatus:Q,onAction:e=>{if(M(null),"view"===e)h&&h({...t,root:n,repo:i||"."});else if("diff"===e)window.dispatchEvent(new CustomEvent("omp:open-diff",{detail:{file:t.path,staged:U?.staged||U?.status&&" "!==U.status[0]&&"?"!==U.status[0],status:W?.charStatus||"M",repo:i||".",root:n}}));else if("explorer"===e){let e=new FormData;e.append("actionType","open_explorer"),e.append("path",t.path),ee(e)}else if("copy_path"===e){let e,n;(0,D.l)((e=t.path.replace(/^(?:\.?[/\\])+/,"").replace(/[/\\]+$/,""),(n=(l??"").replace(/[/\\]+$/,""))?e?`${n}${n.includes("\\")&&!n.includes("/")?"\\":"/"}${e}`:n:e))}else if("copy_relative"===e)(0,D.l)(t.path);else if("history"===e){G(!0);let e=new FormData;e.append("actionType","git_history"),e.append("path",t.path),ee(e)}else"rename"===e?(I(t.path),H(!0)):"delete"===e&&E(!0)}}),P&&T&&(0,a.Y)(N,{fileName:t.name,isFolder:k,isLoading:"idle"!==J.state,onCancel:()=>E(!1),onConfirm:()=>{let e=new FormData;e.append("actionType","delete"),e.append("path",t.path),ee(e)}}),P&&R&&(0,a.Y)(Y,{isFolder:k,renameValue:_,originalPath:t.path,isLoading:"idle"!==J.state,onChange:I,onCancel:()=>H(!1),onSubmit:e=>{e.preventDefault();let n=new FormData;n.append("actionType","rename"),n.append("path",t.path),n.append("newPath",_),ee(n)}}),P&&O&&(0,a.Y)(w,{filePath:t.path,fetcherState:J.state,fetcherData:J.data,onClose:()=>G(!1)})]})}var z=n("jo"),S=n("FL"),J=n("so"),P=n("Af");function j(e){let{className:t="",enabled:n=!0,rootPath:o,onOpenFile:c,refreshKey:d=0,onRefresh:p}=e,[h,x]=(0,r.J0)([]),[m,f]=(0,r.J0)(""),[u,b]=(0,S.bL)("files.searchQuery",""),[k,y]=(0,r.J0)(!1),[g,v,N]=(0,S.bL)("files.expandedPaths",[]),[Y,w]=(0,r.J0)(()=>new Set(g)),F=(0,r.li)({}),[D,C]=(0,S.bL)("files.activeRepo","."),{isScrolling:j,handleScroll:L}=(0,z.K)(),{fileMap:M,folderMap:$,refreshGitStatus:R}=(0,J.e)(o,D,d,n);(0,r.vJ)(()=>{N&&w(e=>{let t=new Set(g);return e.size===t.size&&Array.from(t).every(t=>e.has(t))?e:t})},[N,g]);let H=e=>{let t=new URLSearchParams;return o&&t.set("root",o),D&&"."!==D&&t.set("repo",D),e&&t.set("path",e),t.set("t",String(Date.now())),`/api/fs/dir?${t.toString()}`},T=e=>{n&&(e?.silent||y(!0),fetch(H()).then(e=>e.json()).then(e=>{"string"==typeof e.root&&f(e.root),Array.isArray(e.files)&&x(function e(t,n,a){return t.map(t=>{if("folder"!==t.type)return t;let r=n[t.path],l=a.has(t.path);return r?{...t,children:e(r,n,a),is_expanded:+!!l}:t})}(e.files,F.current,Y))}).catch(()=>{}).finally(()=>{e?.silent||y(!1)}))};(0,r.vJ)(()=>{N&&T()},[d,o,n,D,N]),(0,P.n)(()=>T({silent:!0}),n&&N),(0,P.w)(()=>T({silent:!0}),n&&N);let E=e=>fetch(H(e)).then(e=>e.json()).then(t=>{Array.isArray(t.files)&&(F.current[e]=t.files,x(n=>(function e(t,n,a){return t.map(t=>{if(t.path===n)return{...t,children:a,is_expanded:1};if(Array.isArray(t.children)){let r=e(t.children,n,a);if(r!==t.children)return{...t,children:r}}return t})})(n,e,t.files)))}).catch(()=>{}),O=(e,t)=>{let n=new Set(Y);t?n.add(e):n.delete(e),w(n),v(Array.from(n))};if(!n)return(0,a.Y)("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${t}`,children:(0,a.Y)("span",{className:"text-xs font-mono",children:"No session selected"})});let G=(()=>{if(!u.trim())return h;let e=u.toLowerCase(),t=n=>{let a=n.name.toLowerCase().includes(e);if("folder"===n.type){let e=(n.children||[]).map(t).filter(Boolean);return a||e.length>0?{...n,children:a&&0===e.length?n.children:e,forceExpanded:!0}:null}return a?n:null};return h.map(t).filter(Boolean)})(),_=()=>{R(),p?p():T()};return(0,a.FD)("div",{className:`flex flex-col h-full bg-paper ${t}`,children:[(0,a.FD)("div",{className:"p-3 border-b border-ink/10 flex flex-col space-y-2",children:[(0,a.FD)("div",{className:"flex items-center justify-between",children:[(0,a.Y)(s.I,{rootPath:o,activeRepo:D,onSelectRepo:e=>{e!==D&&(F.current={},w(new Set),v([]),C(e))}}),(0,a.Y)("button",{onClick:_,className:"p-1.5 text-ink/40 hover:text-ink hover:bg-ink/5 rounded transition-colors",title:"Refresh",children:(0,a.Y)(l.A,{size:14,className:k?"animate-spin":""})})]}),(0,a.FD)("div",{className:"relative",children:[(0,a.Y)(i.A,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-ink/40"}),(0,a.Y)("input",{type:"text",placeholder:"Search files...",value:u,onChange:e=>b(e.currentTarget.value),className:"w-full bg-canvas border border-ink/20 rounded pl-8 pr-3 py-1.5 text-xs focus:outline-none focus:border-ink transition-colors text-ink placeholder-ink/40"})]})]}),(0,a.Y)("div",{className:`flex-1 scrollbar-overlay-container p-2 font-mono text-[11px] text-ink/80 ${(0,z.p)(j)}`,onContextMenu:e=>e.preventDefault(),onScroll:L,children:k&&0===G.length?(0,a.Y)("div",{className:"p-4 text-center text-ink/40",children:"Loading files..."}):0===G.length?(0,a.Y)("div",{className:"p-4 text-center text-ink/40",children:"No files found"}):G.map(e=>(0,a.Y)(A,{file:e,rootPath:o,basePath:m,repo:D,onLoadChildren:E,onOpenFile:c,onActionComplete:_,expandedPaths:Y,onToggleFolder:O,gitFileMap:M,gitFolderMap:$},e.id))})]})}},rm(e,t,n){let a=(0,n("y").A)({name:"folder-git-2",size:24,node:[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]});n.d(t,{},{A:a})},YOg(e,t,n){let a=(0,n("y").A)({name:"git-compare",size:24,node:[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]});n.d(t,{},{A:a})}}]);
|