@rubytech/create-maxy-code 0.1.34 → 0.1.36
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 +4 -1
- package/payload/platform/plugins/docs/references/platform.md +3 -1
- package/payload/platform/services/claude-session-manager/dist/config.d.ts +0 -5
- package/payload/platform/services/claude-session-manager/dist/config.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/config.js +16 -6
- package/payload/platform/services/claude-session-manager/dist/config.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.d.ts +0 -5
- package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/http-server.js +98 -131
- package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/index.js +0 -1
- package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/jsonl-observer.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/jsonl-observer.js +38 -9
- package/payload/platform/services/claude-session-manager/dist/jsonl-observer.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts +14 -61
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js +109 -104
- package/payload/platform/services/claude-session-manager/dist/pty-spawner.js.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/session-store.d.ts +30 -36
- package/payload/platform/services/claude-session-manager/dist/session-store.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/session-store.js +65 -58
- package/payload/platform/services/claude-session-manager/dist/session-store.js.map +1 -1
- package/payload/platform/templates/agents/admin/IDENTITY.md +5 -5
- package/payload/server/public/assets/{Checkbox-C6zXApx_.js → Checkbox-C_5g1tvd.js} +1 -1
- package/payload/server/public/assets/{admin-CF2ZQvXu.js → admin-CMhAQf3x.js} +24 -24
- package/payload/server/public/assets/{architectureDiagram-Q4EWVU46-BYXgFii5.js → architectureDiagram-Q4EWVU46-PATAR9cB.js} +1 -1
- package/payload/server/public/assets/{blockDiagram-DXYQGD6D-GIQ0eO13.js → blockDiagram-DXYQGD6D-BTtUDSn8.js} +1 -1
- package/payload/server/public/assets/{brand-DdhkC994.css → brand--hRSJcTa.css} +1 -1
- package/payload/server/public/assets/{c4Diagram-AHTNJAMY-BmyWfG-l.js → c4Diagram-AHTNJAMY-DagJLqud.js} +1 -1
- package/payload/server/public/assets/channel-ad6bhEyF.js +1 -0
- package/payload/server/public/assets/{chunk-336JU56O-DcWl0MQo.js → chunk-336JU56O-r_17ZSte.js} +2 -2
- package/payload/server/public/assets/{chunk-426QAEUC-BIW6kq6y.js → chunk-426QAEUC-BeZHE5Od.js} +1 -1
- package/payload/server/public/assets/{chunk-4TB4RGXK-CdoHpV4X.js → chunk-4TB4RGXK-BOKuzFDs.js} +1 -1
- package/payload/server/public/assets/{chunk-5FUZZQ4R-bn_a4sfU.js → chunk-5FUZZQ4R-CFPql_Mb.js} +1 -1
- package/payload/server/public/assets/{chunk-5PVQY5BW-C_Rq8j_M.js → chunk-5PVQY5BW-B-ooj0Oj.js} +1 -1
- package/payload/server/public/assets/{chunk-EDXVE4YY-CWQvoVKV.js → chunk-EDXVE4YY-pfgSmAaU.js} +1 -1
- package/payload/server/public/assets/{chunk-ENJZ2VHE-DBHn1kSk.js → chunk-ENJZ2VHE-Czo3wSBG.js} +1 -1
- package/payload/server/public/assets/{chunk-ICPOFSXX-SW2Qx11O.js → chunk-ICPOFSXX-B0Kq8LNp.js} +1 -1
- package/payload/server/public/assets/{chunk-OYMX7WX6-BvIG7tVW.js → chunk-OYMX7WX6-BM97IkL3.js} +1 -1
- package/payload/server/public/assets/{chunk-U2HBQHQK-BiBUb0cF.js → chunk-U2HBQHQK-Qu1CuohC.js} +1 -1
- package/payload/server/public/assets/{chunk-X2U36JSP-Y0MKZCCh.js → chunk-X2U36JSP-uDlh8MVE.js} +1 -1
- package/payload/server/public/assets/{chunk-YZCP3GAM-DKPh06GH.js → chunk-YZCP3GAM-DUlG-OZ5.js} +1 -1
- package/payload/server/public/assets/{chunk-ZZ45TVLE-C2WNo-fK.js → chunk-ZZ45TVLE-BABivBFM.js} +1 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-D9Gycby2.js +1 -0
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-sUgm3wmz.js +1 -0
- package/payload/server/public/assets/clone-CZxh5VW0.js +1 -0
- package/payload/server/public/assets/{dagre-CrK8E9ee.js → dagre-BLaP4HDY.js} +1 -1
- package/payload/server/public/assets/{dagre-KV5264BT-_o6uXcH8.js → dagre-KV5264BT-CVL1mRVD.js} +1 -1
- package/payload/server/public/assets/data-DarDs6k1.js +1 -0
- package/payload/server/public/assets/{device-url-actions-BcHerWqJ.js → device-url-actions-Dmhh-Azv.js} +1 -1
- package/payload/server/public/assets/{diagram-5BDNPKRD-FFP9DKhc.js → diagram-5BDNPKRD-Db75sppc.js} +1 -1
- package/payload/server/public/assets/{diagram-G4DWMVQ6-DpwD1jBP.js → diagram-G4DWMVQ6-Cj8Nvgev.js} +1 -1
- package/payload/server/public/assets/{diagram-MMDJMWI5-C3K5agdK.js → diagram-MMDJMWI5-BGXJmtU0.js} +1 -1
- package/payload/server/public/assets/{diagram-TYMM5635-CbeDipbC.js → diagram-TYMM5635-FALU804i.js} +1 -1
- package/payload/server/public/assets/{erDiagram-SMLLAGMA-XBIFndNy.js → erDiagram-SMLLAGMA-Dny5IMgt.js} +1 -1
- package/payload/server/public/assets/{flowDiagram-DWJPFMVM-BvEgySyn.js → flowDiagram-DWJPFMVM-CvKuRNSd.js} +1 -1
- package/payload/server/public/assets/{ganttDiagram-T4ZO3ILL-D7gIRKJf.js → ganttDiagram-T4ZO3ILL-CMMNRVGJ.js} +1 -1
- package/payload/server/public/assets/{gitGraphDiagram-UUTBAWPF-vJu_hcri.js → gitGraphDiagram-UUTBAWPF-GNp7o9CH.js} +1 -1
- package/payload/server/public/assets/graph-CG9KcTMy.js +1 -0
- package/payload/server/public/assets/graph-labels-DnFPoPy9.js +1 -0
- package/payload/server/public/assets/{graphlib-Dp0mN6JW.js → graphlib-Bbf4iSQ9.js} +1 -1
- package/payload/server/public/assets/{infoDiagram-42DDH7IO-g4Dlc5Cr.js → infoDiagram-42DDH7IO-CKnsQ4zf.js} +1 -1
- package/payload/server/public/assets/{ishikawaDiagram-UXIWVN3A-D_45LXOe.js → ishikawaDiagram-UXIWVN3A-7iiLy5h7.js} +1 -1
- package/payload/server/public/assets/{journeyDiagram-VCZTEJTY-CggbHl6N.js → journeyDiagram-VCZTEJTY-BqbrYu64.js} +1 -1
- package/payload/server/public/assets/{kanban-definition-6JOO6SKY-CysAe-Ab.js → kanban-definition-6JOO6SKY-B4xrW1HU.js} +1 -1
- package/payload/server/public/assets/{line-BAxq_DSY.js → line-VuY4jgLe.js} +1 -1
- package/payload/server/public/assets/{mermaid-parser.core-DbFuvkjL.js → mermaid-parser.core-BaqOkGpC.js} +1 -1
- package/payload/server/public/assets/{mermaid.core-CehvJn5b.js → mermaid.core-CCQHCJiH.js} +3 -3
- package/payload/server/public/assets/{mindmap-definition-QFDTVHPH-DbPbBJ9h.js → mindmap-definition-QFDTVHPH-CD7_gX12.js} +1 -1
- package/payload/server/public/assets/page-BbunxlG3.js +1 -0
- package/payload/server/public/assets/{page-Co7KCRV8.js → page-CDFsJW62.js} +1 -1
- package/payload/server/public/assets/{pieDiagram-DEJITSTG-cagLL9ng.js → pieDiagram-DEJITSTG-DYv6IDvS.js} +1 -1
- package/payload/server/public/assets/{public-B6TEcDLx.js → public-vZ5OE_BJ.js} +3 -3
- package/payload/server/public/assets/{quadrantDiagram-34T5L4WZ-Keaa1jDh.js → quadrantDiagram-34T5L4WZ-Djjgb1kX.js} +1 -1
- package/payload/server/public/assets/{requirementDiagram-MS252O5E-BcYRyn5z.js → requirementDiagram-MS252O5E-D1jpw_fu.js} +1 -1
- package/payload/server/public/assets/{sankeyDiagram-XADWPNL6--fKoG9NR.js → sankeyDiagram-XADWPNL6-CiWmspyf.js} +1 -1
- package/payload/server/public/assets/{sequenceDiagram-FGHM5R23-lKG36-Di.js → sequenceDiagram-FGHM5R23-B1GXIeQe.js} +1 -1
- package/payload/server/public/assets/{stateDiagram-FHFEXIEX-BuVsrlig.js → stateDiagram-FHFEXIEX-DX7QZrhc.js} +1 -1
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-CekuC-ks.js +1 -0
- package/payload/server/public/assets/{timeline-definition-GMOUNBTQ-D6X6uq17.js → timeline-definition-GMOUNBTQ-BxiwnKFu.js} +1 -1
- package/payload/server/public/assets/{vennDiagram-DHZGUBPP-BgvcfRVf.js → vennDiagram-DHZGUBPP-RxZA_K0W.js} +1 -1
- package/payload/server/public/assets/{wardleyDiagram-NUSXRM2D-Cpd1xsrt.js → wardleyDiagram-NUSXRM2D-b2tVWjtB.js} +1 -1
- package/payload/server/public/assets/{xychartDiagram-5P7HB3ND-CDF5ZVFv.js → xychartDiagram-5P7HB3ND-D55tkJH1.js} +1 -1
- package/payload/server/public/data.html +5 -5
- package/payload/server/public/graph.html +6 -6
- package/payload/server/public/index.html +8 -8
- package/payload/server/public/public.html +5 -5
- package/payload/server/server.js +149 -129
- package/payload/docs/desktop-code-controls.md +0 -63
- package/payload/server/public/assets/channel-C76knBRO.js +0 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-Bohexn7P.js +0 -1
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-DVsmsAu7.js +0 -1
- package/payload/server/public/assets/clone-DUrXF4sO.js +0 -1
- package/payload/server/public/assets/data-j1WNhF8t.js +0 -1
- package/payload/server/public/assets/graph-C_f_9L_7.js +0 -1
- package/payload/server/public/assets/graph-labels-BSQJHlgf.js +0 -1
- package/payload/server/public/assets/page-B0BPrSE3.js +0 -1
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-DSt88_xL.js +0 -1
- /package/payload/server/public/assets/{brand-B-bNrpwc.js → brand-B62OQoRC.js} +0 -0
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# Claude Code Desktop — Code-tab controls
|
|
2
|
-
|
|
3
|
-
The maxy-code session list at `maxy.bot/sessions` spawns Claude Code PTY sessions on the device. Every spawned session is also reachable from Anthropic's Claude Code Desktop app on the same machine, under the Code tab, with the full GUI affordances around it. This page catalogues those affordances so the operator knows what is available without leaving the IDE.
|
|
4
|
-
|
|
5
|
-
Canonical source: [https://code.claude.com/docs/en/desktop](https://code.claude.com/docs/en/desktop). This page is a maxy-code-side index, not a replacement.
|
|
6
|
-
|
|
7
|
-
## Permission modes
|
|
8
|
-
|
|
9
|
-
The session's permission mode controls how Claude requests approval before edits or shell commands. Pick the mode at spawn time from the maxy-code sessions sidebar, or change it inside the Desktop app with `Shift+Cmd+M` (macOS) / `Shift+Ctrl+M` (Windows / Linux).
|
|
10
|
-
|
|
11
|
-
- **Ask permissions** (default). Prompts before every edit and shell command.
|
|
12
|
-
- **Accept edits**. Approves edits to files automatically; still prompts for shell commands.
|
|
13
|
-
- **Plan mode**. Read-only; produces a plan without touching the working tree.
|
|
14
|
-
- **Auto mode**. Approves edits and tools automatically inside the working directory.
|
|
15
|
-
- **Bypass permissions**. Opt-in only via Claude Code settings (`--dangerously-skip-permissions`). Not exposed in the maxy-code picker.
|
|
16
|
-
|
|
17
|
-
The maxy-code sidebar passes the chosen mode to the session-manager, which appends `--permission-mode <mode>` to the spawn argv. The picker default `default` produces no flag, matching today's argv byte-for-byte.
|
|
18
|
-
|
|
19
|
-
## Diff review pane
|
|
20
|
-
|
|
21
|
-
When Claude proposes an edit, the Desktop app's diff pane shows the proposed change inline with accept / reject controls. Operators in Ask-permissions mode review every diff here; Accept-edits and Auto modes still surface the diff but auto-approve.
|
|
22
|
-
|
|
23
|
-
## Session sidebar
|
|
24
|
-
|
|
25
|
-
The Desktop app's left sidebar lists every Code-tab session on the device, including parallel ones. Each session has its own working directory; the sidebar exposes worktree controls so the operator can fork a session onto a new branch without touching the main checkout.
|
|
26
|
-
|
|
27
|
-
## Integrated terminal (Ctrl+`)
|
|
28
|
-
|
|
29
|
-
Opens a shell scoped to the session's working directory. Useful for running tests, inspecting state, or running ad-hoc commands without leaving the IDE.
|
|
30
|
-
|
|
31
|
-
## File pane
|
|
32
|
-
|
|
33
|
-
Standard file explorer scoped to the session's working directory. Opens files in the Desktop app's editor; edits are picked up by Claude on the next turn.
|
|
34
|
-
|
|
35
|
-
## Live app preview
|
|
36
|
-
|
|
37
|
-
When the session is running a dev server, the preview pane renders the running app inside the Desktop window. Refreshes on save.
|
|
38
|
-
|
|
39
|
-
## PR monitoring panel
|
|
40
|
-
|
|
41
|
-
Lists open pull requests touching the session's repo and surfaces review state (CI, comments, approvals). Click to open the PR in the Desktop app's review surface.
|
|
42
|
-
|
|
43
|
-
## Plugins
|
|
44
|
-
|
|
45
|
-
The session inherits the brand's plugin set. The plugins menu in the Desktop app lists every active plugin and its tools; disabling a plugin here scopes the change to the current session only.
|
|
46
|
-
|
|
47
|
-
## Side chats
|
|
48
|
-
|
|
49
|
-
Spawn a parallel Claude conversation against the same working directory without disturbing the main session. Side-chat output is local to the Desktop app and does not appear in the maxy.bot sessions list.
|
|
50
|
-
|
|
51
|
-
## Scheduled tasks
|
|
52
|
-
|
|
53
|
-
The Desktop app exposes Claude Code's `/schedule` surface: a list of cron-style recurring agents the operator can edit or pause. Maxy-code does not currently surface scheduled tasks in the sidebar; manage them from the Desktop app.
|
|
54
|
-
|
|
55
|
-
## Model selector
|
|
56
|
-
|
|
57
|
-
Per-session model override. The session can be pinned to a specific Claude model regardless of the global default; useful for cost-sensitive or capability-sensitive work.
|
|
58
|
-
|
|
59
|
-
## Keyboard reference
|
|
60
|
-
|
|
61
|
-
- `Shift+Cmd+M` / `Shift+Ctrl+M` — open the permission-mode picker.
|
|
62
|
-
- `Ctrl+\`` — toggle the integrated terminal.
|
|
63
|
-
- See Anthropic's reference for the complete list.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{it as e,rt as t}from"./chunk-ICPOFSXX-SW2Qx11O.js";var n=(n,r)=>e.lang.round(t.parse(n)[r]);export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e}from"./src-B6XdH6xq.js";import"./chunk-ICPOFSXX-SW2Qx11O.js";import"./dist-Bd4S37oi.js";import"./chunk-5PVQY5BW-C_Rq8j_M.js";import"./chunk-U2HBQHQK-BiBUb0cF.js";import"./chunk-FMBD7UC4-w-yBZsN2.js";import"./chunk-BSJP7CBP-DP7LTBll.js";import"./chunk-ZZ45TVLE-C2WNo-fK.js";import"./chunk-YZCP3GAM-DKPh06GH.js";import"./chunk-55IACEB6-BRJOZLpU.js";import"./chunk-EDXVE4YY-CWQvoVKV.js";import"./chunk-X2U36JSP-Y0MKZCCh.js";import"./chunk-5FUZZQ4R-bn_a4sfU.js";import"./chunk-ENJZ2VHE-DBHn1kSk.js";import"./chunk-336JU56O-DcWl0MQo.js";import{i as t,n,r,t as i}from"./chunk-4TB4RGXK-CdoHpV4X.js";var a={parser:n,get db(){return new i},renderer:r,styles:t,init:e(e=>{e.class||={},e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e}from"./src-B6XdH6xq.js";import"./chunk-ICPOFSXX-SW2Qx11O.js";import"./dist-Bd4S37oi.js";import"./chunk-5PVQY5BW-C_Rq8j_M.js";import"./chunk-U2HBQHQK-BiBUb0cF.js";import"./chunk-FMBD7UC4-w-yBZsN2.js";import"./chunk-BSJP7CBP-DP7LTBll.js";import"./chunk-ZZ45TVLE-C2WNo-fK.js";import"./chunk-YZCP3GAM-DKPh06GH.js";import"./chunk-55IACEB6-BRJOZLpU.js";import"./chunk-EDXVE4YY-CWQvoVKV.js";import"./chunk-X2U36JSP-Y0MKZCCh.js";import"./chunk-5FUZZQ4R-bn_a4sfU.js";import"./chunk-ENJZ2VHE-DBHn1kSk.js";import"./chunk-336JU56O-DcWl0MQo.js";import{i as t,n,r,t as i}from"./chunk-4TB4RGXK-CdoHpV4X.js";var a={parser:n,get db(){return new i},renderer:r,styles:t,init:e(e=>{e.class||={},e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./graphlib-Dp0mN6JW.js";var t=4;function n(n){return e(n,t)}export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,f as t}from"./brand-B-bNrpwc.js";import"./graph-labels-BSQJHlgf.js";import{t as n}from"./page-B0BPrSE3.js";var r=t(),i=e();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,f as t}from"./brand-B-bNrpwc.js";import"./graph-labels-BSQJHlgf.js";import{n}from"./page-Co7KCRV8.js";import"./Checkbox-C6zXApx_.js";var r=t(),i=e();(0,r.createRoot)(document.getElementById(`root`)).render((0,i.jsx)(n,{}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-DD-I1_y5.js";import{a as t,c as n,d as r,l as i,m as a,o,r as s,s as c,t as l,u}from"./brand-B-bNrpwc.js";var d=r(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),f=r(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),p=r(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),m=r(`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`}]]),h=r(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),g=r(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),_=r(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),v=r(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),y=r(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),b=r(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),x=r(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),S=r(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),C=r(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),w=r(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),T=r(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),E=r(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),D=r(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),O=r(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),ee=r(`share-2`,[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]),te=r(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),k=r(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),A=r(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),ne=r(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),j=e(a(),1);function M(e,t,n,r){let i=e===`pane`?`pane-action`:`sidebar-${t}`;console.info(`[admin-ui] ${i} sessionId=${n.slice(0,8)} action=${t} outcome=${r}`)}var N=/session_([A-Za-z0-9_-]+)/;function P(e){if(!e)return null;let t=e.match(N);return t?t[1]:null}async function F(e,t,n,r,i){let a=P(r)??`unknown`,o=e=>e.slice(0,8),s=t===`pane`?`pane-action action=resume-archive`:`sidebar-resume-archive`,c;try{let t=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(n)}/archive?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({mode:`archive`})});c=t.ok?`ok`:t.status===409?`409`:`error`;let r=`[admin-ui] ${s} sourceSessionId=${o(n)} newSessionId=${o(a)} result=${c}`;c===`error`?console.error(r):console.info(r)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[admin-ui] ${s} sourceSessionId=${o(n)} newSessionId=${o(a)} result=error detail=${t}`)}finally{i.refetch()}}function re(e,t,n=`pane`){let[r,i]=(0,j.useState)(null),a=(0,j.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`resume`);try{let i=await fetch(`/api/admin/claude-sessions/resume?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({claudeSessionId:r,channel:`browser`})}),a=await i.json();if(!i.ok||!(`sessionId`in a)){let e=a.error??`POST returned ${i.status}`;return M(n,`resume`,r,String(i.status)),{ok:!1,error:e}}return t.setSessions(e=>[a,...e.filter(e=>e.sessionId!==r)]),M(n,`resume`,r,`200`),F(e,n,r,a.url,t),{ok:!0}}catch(e){let i=e instanceof Error?e.message:String(e);return M(n,`resume`,r,`threw`),t.refetch(),{ok:!1,error:i}}finally{i(null)}},[e,t,n]),o=(0,j.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`end`);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}?session_key=${encodeURIComponent(e)}`,{method:`DELETE`});if(!i.ok){let e=await i.text().catch(()=>``);return M(n,`end`,r,String(i.status)),t.refetch(),{ok:!1,error:`DELETE ${i.status} ${e.slice(0,200)}`}}return M(n,`end`,r,`200`),t.refetch(),{ok:!0}}catch(e){let i=e instanceof Error?e.message:String(e);return M(n,`end`,r,`threw`),t.refetch(),{ok:!1,error:i}}finally{i(null)}},[e,t,n]),s=(0,j.useCallback)(async r=>{if(!e)return{ok:!1,error:`no-cache-key`};i(`purge`);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}?purge=1&session_key=${encodeURIComponent(e)}`,{method:`DELETE`});if(!i.ok){let e=await i.json().catch(()=>({})),t=e.detail||e.error||`DELETE ?purge=1 ${i.status}`;return M(n,`purge`,r,String(i.status)),{ok:!1,error:t}}return t.setSessions(e=>e.filter(e=>e.sessionId!==r)),M(n,`purge`,r,`200`),t.refetch(),{ok:!0}}catch(e){let t=e instanceof Error?e.message:String(e);return M(n,`purge`,r,`threw`),{ok:!1,error:t}}finally{i(null)}},[e,t,n]),c=(0,j.useCallback)(async(r,a)=>{if(!e)return{ok:!1,error:`no-cache-key`};i(a);try{let i=await fetch(`/api/admin/claude-sessions/${encodeURIComponent(r)}/archive?session_key=${encodeURIComponent(e)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({mode:a})});if(!i.ok){let e=await i.json().catch(()=>({})),t=e.detail||e.error||`POST /archive ${i.status}`;return M(n,a,r,String(i.status)),{ok:!1,error:t}}return a===`archive`&&t.setSessions(e=>e.filter(e=>e.sessionId!==r)),t.refetch(),M(n,a,r,`200`),{ok:!0}}catch(e){let t=e instanceof Error?e.message:String(e);return M(n,a,r,`threw`),{ok:!1,error:t}}finally{i(null)}},[e,t,n]);return{inFlight:r,resume:a,end:o,purge:s,archive:(0,j.useCallback)(e=>c(e,`archive`),[c]),unarchive:(0,j.useCallback)(e=>c(e,`unarchive`),[c])}}function I(e){return`code.session.pinned.${e}`}function L(e){if(typeof window>`u`)return new Set;try{let t=window.localStorage.getItem(I(e));if(!t)return new Set;let n=JSON.parse(t);return Array.isArray(n)?new Set(n.filter(e=>typeof e==`string`)):new Set}catch{return new Set}}function R(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(I(e),JSON.stringify([...t]))}catch{}}function ie(e){let[t,n]=(0,j.useState)(()=>L(e));(0,j.useEffect)(()=>{n(L(e))},[e]);let r=(0,j.useCallback)(t=>{n(n=>{let r=new Set(n);return r.has(t)?r.delete(t):r.add(t),R(e,r),r})},[e]);return{pinned:t,isPinned:(0,j.useCallback)(e=>t.has(e),[t]),togglePin:r}}var z=t();function ae(e){let{businessName:t,cacheKey:r,conversationId:i,onLaunchBrowser:a,onNavigate:c,onToggleSidebar:d,sidebarOpen:f,onLogout:p,browserLaunching:h}=e,[v,S]=(0,j.useState)(!1),C=(0,j.useRef)(null),E=(0,j.useRef)(null),[D,O]=(0,j.useState)(null),[te,k]=(0,j.useState)(!1),[A,M]=(0,j.useState)(null),[N,P]=(0,j.useState)(null),[F,re]=(0,j.useState)(null),[I,L]=(0,j.useState)(``);(0,j.useEffect)(()=>{L(window.location.hostname.startsWith(`admin.`)?window.location.origin.replace(`admin.`,`public.`):window.location.origin)},[]),(0,j.useEffect)(()=>{if(!v)return;let e=e=>{C.current&&!C.current.contains(e.target)&&S(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[v]),(0,j.useEffect)(()=>{if(!v)return;let e=e=>{e.key===`Escape`&&S(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[v]),(0,j.useEffect)(()=>{v&&E.current?.focus()},[v]),(0,j.useEffect)(()=>{if(!v)return;let e=!1;return fetch(`/api/admin/version`).then(e=>e.json()).then(t=>{e||re(t)}).catch(e=>{console.error(`[admin/version] menu-open client fetch failed:`,e)}),()=>{e=!0}},[v]);let R=(0,j.useCallback)(()=>{S(e=>{let t=!e;return t&&console.info(`[admin-ui] header-menu-open`),t})},[]),ie=(0,j.useCallback)(()=>{S(!1),a()},[a]),ae=(0,j.useCallback)(e=>{S(!1),c(e)},[c]),oe=(0,j.useCallback)(async()=>{if(D!==null){O(null),P(null);return}k(!0),M(null);try{let e=await fetch(`/api/admin/agents`);if(!e.ok)throw Error(`Failed to load agents`);O((await e.json()).agents??[])}catch(e){console.error(`[admin/agents] list failed:`,e),M(e instanceof Error?e.message:String(e)),O([])}finally{k(!1)}},[D]),B=(0,j.useCallback)(e=>{P(null),O(t=>t?.filter(t=>t.slug!==e)??null),fetch(`/api/admin/agents/${encodeURIComponent(e)}`,{method:`DELETE`}).catch(e=>console.error(`[admin/agents] delete failed:`,e))},[]),V=(0,j.useCallback)(async()=>{if(S(!1),!r){console.warn(`[admin-ui] header-menu-report-turn cacheKey=null — skipping POST`);return}try{let e=await fetch(`/api/admin/failure-report`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionKey:r,conversationId:i??``,lastUserMessageId:``,lastAssistantMessageId:``,clickTs:new Date().toISOString(),clientSnapshot:{sseReadyState:``,lastEventType:``,lastAppliedMessageId:``}})});console.info(`[admin-ui] header-menu-report-turn ok=${e.ok} status=${e.status}`)}catch(e){console.error(`[admin-ui] header-menu-report-turn failed:`,e)}},[r,i]),H=(0,j.useCallback)(()=>{S(!1),p()},[p]),se=t||l.productName;return(0,z.jsxs)(`header`,{className:`admin-header`,children:[(0,z.jsx)(`button`,{type:`button`,className:`admin-sidebar-toggle`,"aria-label":f?`Hide sidebar`:`Show sidebar`,title:f?`Hide sidebar`:`Show sidebar`,"aria-expanded":f,onClick:d,children:f?(0,z.jsx)(w,{size:20}):(0,z.jsx)(T,{size:20})}),(0,z.jsxs)(`div`,{className:`chat-header-label`,children:[(0,z.jsx)(`span`,{className:`chat-logo-btn`,"aria-hidden":`true`,children:(0,z.jsx)(`img`,{src:s,alt:``,className:`chat-logo`})}),(0,z.jsx)(`h1`,{className:`chat-tagline`,children:se})]}),(0,z.jsxs)(`div`,{className:`chat-burger-wrap`,ref:C,children:[(0,z.jsx)(`button`,{type:`button`,className:`admin-burger`,onClick:R,"aria-label":`Menu`,"aria-haspopup":`true`,"aria-expanded":v,children:(0,z.jsx)(x,{size:20})}),v&&(0,z.jsxs)(`div`,{className:`admin-menu`,role:`menu`,children:[(0,z.jsxs)(`button`,{ref:E,type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:ie,disabled:h,children:[(0,z.jsx)(n,{size:14}),` Browser`,h&&(0,z.jsx)(y,{size:12,className:`spin`})]}),(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>ae(`data`),children:[(0,z.jsx)(m,{size:14}),` Data`]}),(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>ae(`graph`),children:[(0,z.jsx)(ee,{size:14}),` Graph`]}),(0,z.jsx)(`div`,{className:`chat-menu-divider`}),(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:oe,children:[(0,z.jsx)(g,{size:14}),` Public`,te&&(0,z.jsx)(y,{size:12,className:`spin`})]}),D!==null&&(0,z.jsxs)(`div`,{className:`chat-menu-agents`,children:[A&&(0,z.jsx)(`span`,{className:`chat-menu-agent-error`,children:A}),D.length===0&&!A&&(0,z.jsx)(`span`,{className:`chat-menu-agent-empty`,children:`No public agents configured`}),D.map(e=>(0,z.jsxs)(`div`,{className:`chat-menu-item chat-menu-agent-item`,children:[(0,z.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),(0,z.jsxs)(`span`,{className:`agent-text`,children:[(0,z.jsx)(`span`,{className:`agent-display-name`,children:e.displayName}),(0,z.jsxs)(`span`,{className:`agent-slug`,children:[`/`,e.slug]})]}),N===e.slug?(0,z.jsxs)(`span`,{className:`agent-actions agent-confirm`,children:[(0,z.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-yes`,title:`Confirm delete`,onClick:()=>B(e.slug),children:(0,z.jsx)(u,{size:12})}),(0,z.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-no`,title:`Cancel`,onClick:()=>P(null),children:(0,z.jsx)(ne,{size:12})})]}):(0,z.jsxs)(`span`,{className:`agent-actions`,children:[(0,z.jsx)(`a`,{href:`${I}/${e.slug}`,target:`_blank`,rel:`noopener noreferrer`,className:`agent-action-btn`,title:`Open agent`,onClick:()=>S(!1),children:(0,z.jsx)(g,{size:12})}),(0,z.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-delete-btn`,title:`Delete agent`,onClick:()=>P(e.slug),children:(0,z.jsx)(o,{size:12})})]})]},e.slug))]}),(0,z.jsx)(`div`,{className:`chat-menu-divider`}),(0,z.jsxs)(`div`,{className:`chat-menu-version chat-menu-version-passive`,children:[(0,z.jsx)(_,{size:14}),(0,z.jsxs)(`span`,{className:`version-installed`,children:[F?`v${F.installed}`:`…`,F&&!F.updateAvailable&&(0,z.jsx)(`span`,{className:`version-uptodate-dot`}),F?.updateAvailable&&(0,z.jsx)(`span`,{className:`version-update-dot`})]})]}),(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,"data-testid":`report-turn`,onClick:V,children:[(0,z.jsx)(_,{size:14}),` Report this turn`]}),(0,z.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:H,children:[(0,z.jsx)(b,{size:14}),` Log out`]})]})]})]})}var oe=(()=>null),B=(0,j.forwardRef)(function(e,t){let{businessName:n,cacheKey:r,role:a,userName:s,userAvatar:u,sessions:m,sessionsLoading:_,sessionsError:b,ensureSessionsLoaded:x,refetchSessions:w,onSelectArtefact:T,onSelectProjects:O,onSelectPeople:ee,onSelectTasks:ne,onSelectAgents:M,onCloseMobileDrawer:N,onSelectSession:P,selectedSessionId:F,collapsed:I,onToggleCollapsed:L,mobileDrawerOpen:R,actions:ae,recentsActions:B}=e,[V,H]=(0,j.useState)(null),[se,U]=(0,j.useState)(null),[W,ce]=(0,j.useState)(!1);(0,j.useEffect)(()=>{x()},[x]);let le=(0,j.useRef)(null),[G,ue]=(0,j.useState)(!1),[K,de]=(0,j.useState)(`default`),[fe,pe]=(0,j.useState)(null),me=l.productName,he=typeof s==`string`?s:s===null?`name unavailable`:n||me,ge=(he.trim().charAt(0)||`?`).toUpperCase(),q=ie(l.hostname),_e=(0,j.useMemo)(()=>{let e=m;if(q.pinned.size===0)return e;let t=[],n=[];for(let r of e)(q.pinned.has(r.sessionId)?t:n).push(r);return[...t,...n]},[m,q.pinned]),ve=_e.length,[J,Y]=(0,j.useState)(`chat`),[X,ye]=(0,j.useState)([]),[Z,be]=(0,j.useState)(!1),[xe,Se]=(0,j.useState)(null),[Ce,we]=(0,j.useState)(!1);(0,j.useImperativeHandle)(t,()=>({patchArtefact(e,t){ye(n=>n.map(n=>n.id===e?{...n,...t}:n))}}),[]);let[Te,Ee]=(0,j.useState)(!1),De=(0,j.useRef)(null);(0,j.useEffect)(()=>{if(!Te)return;function e(e){De.current&&!De.current.contains(e.target)&&Ee(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[Te]);let Oe=(0,j.useCallback)(async()=>{if(r){we(!0),Se(null);try{let e=await fetch(`/api/admin/sidebar-artefacts?session_key=${encodeURIComponent(r)}`);if(!e.ok)throw Error(`status ${e.status}`);ye((await e.json()).artefacts??[]),be(!0)}catch(e){let t=e instanceof Error?e.message:String(e);Se(`Failed to load artefacts: ${t}`),console.error(`[admin-ui] sidebar-artefacts fetch failed: ${t}`)}finally{we(!1)}}},[r]),ke=()=>{Y(`chat`),console.info(`[admin-ui] sidebar-nav surface=sessions count=${ve}`)},Ae=()=>{Y(`artefacts`),console.info(`[admin-ui] sidebar-nav surface=artefacts count=${Z?X.length:0} collapsed=${I}`),I&&L(),Z||Oe()},Q=I?24:16,je=J===`chat`?`Sessions`:`Artefacts`,Me=J===`chat`?_?`…`:String(ve):Ce?`…`:String(X.length),Ne=J===`chat`?_:Ce,Pe=()=>{J===`chat`?w():Oe(),console.info(`[admin-ui] sidebar-refresh surface=${J}`)},Fe=(0,j.useCallback)(async()=>{if(!(G||!r)){ue(!0),pe(null);try{let e=await fetch(`/api/admin/claude-sessions?session_key=${encodeURIComponent(r)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({channel:`browser`,permissionMode:K})}),t=await e.json();if(!e.ok||!(`sessionId`in t)){pe(t.error??`POST returned ${e.status}`);return}console.info(`[admin-ui] sidebar-new-session pid=${t.pid} sessionId=${t.sessionId} permissionMode=${K}`),B.setSessions(e=>[t,...e])}catch(e){let t=e instanceof Error?e.message:String(e);pe(t),console.error(`[admin-ui] sidebar-new-session failed:`,t)}finally{ue(!1)}}},[r,G,B,K]),$=re(r,B,`sidebar`),Ie=(0,j.useCallback)(async e=>{let t=await $.resume(e);t.ok||console.error(`[admin-ui] sidebar-resume failed: ${t.error}`)},[$]),Le=(0,j.useCallback)(async e=>{ce(!0),U(null);let t=await $.purge(e);t.ok?H(null):U(t.error??`purge failed`),ce(!1)},[$]),Re=(0,j.useCallback)(async e=>{let t=await $.end(e);t.ok||console.error(`[admin-ui] sidebar-end-session failed: ${t.error}`)},[$]);return(0,z.jsxs)(`aside`,{className:`side`,children:[(0,z.jsx)(`div`,{className:`side-head`,children:(0,z.jsx)(`button`,{className:`icon-btn side-head-toggle`,title:R?`Close sidebar`:I?`Expand sidebar`:`Collapse sidebar`,type:`button`,"aria-label":R?`Close sidebar`:I?`Expand sidebar`:`Collapse sidebar`,onClick:()=>{R?(console.info(`[admin-ui] sidebar-head-toggle action=close-drawer state=closed`),N()):(console.info(`[admin-ui] sidebar-head-toggle action=toggle-collapsed state=${I?`expanded`:`collapsed`}`),L())},children:I?(0,z.jsx)(C,{size:28}):(0,z.jsx)(S,{size:28})})}),(0,z.jsxs)(`nav`,{className:`side-nav`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`nav-row${J===`chat`?` active`:``}`,onClick:ke,children:[(0,z.jsx)(k,{size:Q}),(0,z.jsx)(`span`,{className:`label`,children:`Sessions`}),(0,z.jsx)(`span`,{className:`kbd`})]}),(0,z.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=people`),ee(),N()},children:[(0,z.jsx)(A,{size:Q}),(0,z.jsx)(`span`,{className:`label`,children:`People`}),(0,z.jsx)(`span`,{className:`kbd`})]}),(0,z.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=agents`),M(),N()},children:[(0,z.jsx)(d,{size:Q}),(0,z.jsx)(`span`,{className:`label`,children:`Agents`}),(0,z.jsx)(`span`,{className:`kbd`})]}),(0,z.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=projects`),O(),N()},children:[(0,z.jsx)(f,{size:Q}),(0,z.jsx)(`span`,{className:`label`,children:`Projects`}),(0,z.jsx)(`span`,{className:`kbd`})]}),(0,z.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=tasks`),ne(),N()},children:[(0,z.jsx)(v,{size:Q}),(0,z.jsx)(`span`,{className:`label`,children:`Tasks`}),(0,z.jsx)(`span`,{className:`kbd`})]}),(0,z.jsxs)(`button`,{type:`button`,className:`nav-row${J===`artefacts`?` active`:``}`,onClick:Ae,children:[(0,z.jsx)(i,{size:Q}),(0,z.jsx)(`span`,{className:`label`,children:`Artefacts`}),(0,z.jsx)(`span`,{className:`kbd`})]})]}),(0,z.jsxs)(`div`,{className:`side-list`,ref:le,children:[(0,z.jsxs)(`div`,{className:`group-head`,children:[(0,z.jsx)(`span`,{children:je}),(0,z.jsxs)(`span`,{className:`group-head-meta`,children:[J===`chat`&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`select`,{className:`group-head-permission-mode`,value:K,onChange:e=>de(e.target.value),title:`Permission mode for the next session`,"aria-label":`Permission mode for the next session`,disabled:G,children:[(0,z.jsx)(`option`,{value:`default`,children:`Ask`}),(0,z.jsx)(`option`,{value:`acceptEdits`,children:`Accept edits`}),(0,z.jsx)(`option`,{value:`plan`,children:`Plan`}),(0,z.jsx)(`option`,{value:`auto`,children:`Auto`})]}),(0,z.jsx)(`a`,{className:`group-head-refresh`,href:`/docs/desktop-code-controls`,target:`_blank`,rel:`noopener noreferrer`,title:`Desktop Code-tab controls reference`,"aria-label":`Desktop Code-tab controls reference`,children:(0,z.jsx)(p,{size:12})}),(0,z.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`New session`,"aria-label":`New session`,onClick:()=>void Fe(),disabled:G||!r,children:G?(0,z.jsx)(y,{size:12,className:`spinning`}):(0,z.jsx)(E,{size:12})})]}),(0,z.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh ${je.toLowerCase()}`,"aria-label":`Refresh ${je.toLowerCase()}`,onClick:Pe,disabled:Ne,children:(0,z.jsx)(D,{size:12,className:Ne?`spinning`:void 0})}),(0,z.jsx)(`span`,{children:Me})]})]}),fe&&J===`chat`&&(0,z.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:fe}),J===`chat`&&(0,z.jsxs)(z.Fragment,{children:[b&&(0,z.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:b}),_e.map(e=>{let t=e.status===`ended`,n=t?`${e.turnCount}${e.capped?`+`:``} turns · ended`:`pid ${e.pid??`?`}`;return(0,z.jsxs)(`div`,{className:`conv${F===e.sessionId?` active`:``}`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`conv-name-button`,onClick:()=>{P(e.sessionId),N()},title:`Show metadata`,children:[(0,z.jsx)(k,{size:12,className:`conv-channel-icon`,"aria-label":`claude session`}),(0,z.jsxs)(`span`,{className:`conv-name`,children:[e.displayName,` · `,n]})]}),t?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Resume session`,"aria-label":`Resume session`,onClick:()=>void Ie(e.sessionId),children:(0,z.jsx)(c,{size:13})}),(0,z.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Purge JSONL`,"aria-label":`Purge JSONL`,onClick:()=>{U(null),H({sessionId:e.sessionId,displayName:e.displayName})},children:(0,z.jsx)(o,{size:13})})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`Open in new tab`,"aria-label":`Open in new tab`,onClick:()=>{console.info(`[admin-ui] sidebar-open-session sessionId=${e.sessionId}`),e.url&&window.open(e.url,`_blank`,`noopener,noreferrer`)},children:(0,z.jsx)(g,{size:13})}),(0,z.jsx)(`button`,{type:`button`,className:`conversations-action`,title:`End session`,"aria-label":`End session`,onClick:()=>void Re(e.sessionId),children:(0,z.jsx)(te,{size:13})})]})]},e.sessionId)})]}),J===`artefacts`&&(0,z.jsxs)(z.Fragment,{children:[xe&&(0,z.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:xe}),Z&&!xe&&X.length===0&&(0,z.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No artefacts yet`}),X.map(e=>(0,z.jsxs)(`button`,{type:`button`,className:`conv`,onClick:()=>{T({docId:e.id,name:e.name,content:e.content,editable:e.editable,mimeType:e.mimeType,skipReason:e.skipReason},`sidebar-artefacts`),N()},children:[(0,z.jsx)(`span`,{className:`conv-name`,children:e.name}),(0,z.jsx)(`span`,{className:`conv-kind`,"data-kind":e.kind===`agent-template`?`agent`:`doc`,children:e.kind===`agent-template`?`agent`:`doc`})]},e.id))]})]}),(0,z.jsxs)(`div`,{className:`side-foot`,ref:De,children:[(0,z.jsx)(`div`,{className:`avatar`,children:u?(0,z.jsx)(`img`,{src:u,alt:he}):ge}),(0,z.jsxs)(`div`,{className:`who`,children:[(0,z.jsx)(`span`,{className:`name`,children:he}),(0,z.jsx)(`span`,{className:`role`,children:a??`operator`})]}),(0,z.jsx)(`button`,{className:`icon-btn side-foot-actions-trigger`,title:`Conversation actions`,type:`button`,"aria-label":`Conversation actions`,"aria-haspopup":`true`,"aria-expanded":Te,onClick:()=>Ee(e=>!e),children:(0,z.jsx)(h,{size:Q})}),Te&&(0,z.jsx)(`div`,{className:`side-foot-actions-popover`,children:(0,z.jsx)(oe,{...ae,onAfterAction:()=>Ee(!1)})})]}),V&&(0,z.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`purge-confirm-title`,className:`modal-overlay`,onClick:e=>{e.target===e.currentTarget&&!W&&H(null)},children:(0,z.jsxs)(`div`,{className:`modal-card`,children:[(0,z.jsx)(`h3`,{id:`purge-confirm-title`,style:{margin:0,marginBottom:8,fontSize:16,fontWeight:600},children:`Purge session JSONL?`}),(0,z.jsxs)(`p`,{style:{margin:0,marginBottom:8,fontSize:13},children:[`This hard-deletes the transcript and sidecar for `,(0,z.jsx)(`strong`,{children:V.displayName}),`. The action cannot be undone.`]}),se&&(0,z.jsx)(`p`,{style:{margin:0,marginBottom:8,fontSize:12,color:`var(--text-tertiary)`},children:se}),(0,z.jsxs)(`div`,{className:`modal-action-row`,children:[(0,z.jsx)(`button`,{type:`button`,className:`modal-action-btn`,disabled:W,onClick:()=>H(null),children:`Cancel`}),(0,z.jsx)(`button`,{type:`button`,className:`modal-action-btn`,"data-variant":`danger`,disabled:W,onClick:()=>void Le(V.sessionId),children:W?(0,z.jsx)(y,{size:13,className:`spinning`}):`Purge`})]})]})})]})});function V(e){return e.map(e=>[e.sessionId,e.displayName,e.lastMessageAt,e.status])}function H(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r[0]!==i[0]||r[1]!==i[1]||r[2]!==i[2]||r[3]!==i[3])return!1}return!0}function se(e){let[t,n]=(0,j.useState)([]),[r,i]=(0,j.useState)(!1),[a,o]=(0,j.useState)(null),[s,c]=(0,j.useState)(null),l=(0,j.useRef)([]),u=(0,j.useCallback)(async t=>{if(e&&!(!t&&s===e)){i(!0),o(null);try{let t=await fetch(`/api/admin/claude-sessions?session_key=${encodeURIComponent(e)}`);if(!t.ok)throw Error(`claude-sessions fetch returned ${t.status}`);let r=await t.json(),i=Array.isArray(r)?r:r.sessions??[],a=V(i),o=H(l.current,a);o||(n(i),l.current=a),c(e),console.info(`[admin-ui] sessions-poll outcome=${o?`unchanged`:`changed`} count=${i.length} cacheKey=${e.slice(0,8)}`)}catch(t){console.info(`[admin-ui] sessions-poll outcome=error count=0 cacheKey=${e.slice(0,8)}`),console.error(`[admin/claude-sessions] fetch failed:`,t),o(t instanceof Error?t.message:String(t))}finally{i(!1)}}},[e,s]);(0,j.useEffect)(()=>{e||(c(null),n([]),o(null),l.current=[])},[e]);let d=(0,j.useCallback)(()=>u(!1),[u]),f=(0,j.useCallback)(()=>u(!0),[u]);return{sessions:t,setSessions:n,loading:r,loaded:s!==null&&s===e,error:a,ensureLoaded:d,refetch:f}}var U=`admin-sidebar-collapsed`,W=`admin-sidebar-drawer-open`;function ce(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(U)===`1`}catch{return!1}}function le(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(U,`1`):window.sessionStorage.removeItem(U)}catch{}}function G(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(W)===`1`}catch{return!1}}function ue(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(W,`1`):window.sessionStorage.removeItem(W)}catch{}}var K=720;function de(e){let{cacheKey:t,businessName:n,conversationId:r,onLaunchBrowser:i,onLogout:a,browserLaunching:o=!1,userName:s,userAvatar:c,role:l,selectedSessionId:u,onSelectSession:d,onSelectArtefact:f,dataArtefact:p=`closed`,children:m,footer:h}=e,[g,_]=(0,j.useState)(()=>ce()),[v,y]=(0,j.useState)(()=>G()),[b,x]=(0,j.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: ${K}px)`).matches);(0,j.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(max-width: ${K}px)`),t=e=>x(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let S=(0,j.useCallback)(e=>{le(e),_(e)},[]),C=(0,j.useCallback)(e=>{ue(e),y(e)},[]);(0,j.useEffect)(()=>{if(typeof window>`u`)return;let e=window.location?.pathname??``;console.info(`[admin-ui] shell-mount route=${e} collapsed=${g} drawer=${v}`)},[]);let w=b?v:!g,T=(0,j.useCallback)(()=>{if(!(typeof window>`u`))if(window.matchMedia(`(max-width: ${K}px)`).matches){let e=v;console.info(`[admin-ui] header-sidebar-toggle from=${e?`open`:`closed`} mode=drawer`),C(!e)}else{let e=g;console.info(`[admin-ui] header-sidebar-toggle from=${e?`closed`:`open`} mode=collapse`),S(!e)}},[g,v,S,C]),E=(0,j.useCallback)(e=>{console.info(`[admin-ui] header-menu-nav target=${e}`),window.location.href=e===`data`?`/data`:`/graph`},[]),D=(0,j.useCallback)(()=>{},[]),O=se(t),ee=(0,j.useCallback)(e=>{if(d){d(e);return}window.location.assign(`/?sessionId=${encodeURIComponent(e)}`)},[d]),te=(0,j.useCallback)(e=>{f&&f(e)},[f]),k={collapsed:g,mobileDrawerOpen:v,sidebarOpen:w,onToggleSidebar:T,setMobileDrawerOpen:C,sessionsState:O};return(0,z.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[(0,z.jsx)(ae,{businessName:n,cacheKey:t,conversationId:r,onLaunchBrowser:i??D,onNavigate:E,onToggleSidebar:T,sidebarOpen:w,onLogout:a,browserLaunching:o}),(0,z.jsxs)(`div`,{className:`platform${v?` menu-open`:``}${g?` sidebar-collapsed`:``}`,"data-artefact":p,children:[(0,z.jsx)(B,{businessName:n,cacheKey:t,role:l??null,userName:s,userAvatar:c??null,sessions:O.sessions,sessionsLoading:O.loading,sessionsError:O.error,ensureSessionsLoaded:O.ensureLoaded,refetchSessions:O.refetch,onSelectArtefact:te,onSelectProjects:()=>{window.location.href=`/graph?label=Project`},onSelectPeople:()=>{window.location.href=`/graph?label=Person`},onSelectTasks:()=>{window.location.href=`/graph?label=Task`},onSelectAgents:()=>{window.location.href=`/graph?label=Agent`},onCloseMobileDrawer:()=>C(!1),onSelectSession:ee,selectedSessionId:u??null,collapsed:g,onToggleCollapsed:()=>{},mobileDrawerOpen:v,actions:{},recentsActions:{setSessions:O.setSessions,refetch:O.refetch}}),typeof m==`function`?m(k):m]}),v&&(0,z.jsx)(`div`,{className:`sidebar-backdrop menu-open`,"aria-hidden":`true`,onClick:()=>C(!1)}),h]})}var fe=`maxy-admin-session`,pe=typeof BroadcastChannel<`u`;function me(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.type===`rotation`&&typeof t.newKey==`string`&&t.newKey.length>0&&(t.surface===`chat`||t.surface===`graph`||t.surface===`data`||t.surface===`sessions`)&&typeof t.ts==`number`}function he(e){if(!pe)return()=>{};let t=new BroadcastChannel(fe),n=t=>{if(!me(t.data)){console.warn(`[admin-session-broadcast] outcome=received-malformed payload=${JSON.stringify(t.data)}`);return}e(t.data)};return t.addEventListener(`message`,n),()=>{t.removeEventListener(`message`,n),t.close()}}var ge=`maxy-admin-session-key`;function q(e,t){return`${e}${e.includes(`?`)?`&`:`?`}session_key=${encodeURIComponent(t)}`}async function _e(e){let t;try{t=await e.clone().json()}catch{return`parse-failed`}if(typeof t!=`object`||!t)return`unknown-401`;let n=t.code;return n===`session-missing`||n===`session-not-registered`||n===`session-expired-age`||n===`grant-expired`?n:`unknown-401`}function ve(){try{return sessionStorage.getItem(ge)}catch{return null}}function J(e){let{initialCacheKey:t,surface:n}=e,[r,i]=(0,j.useState)(t),a=(0,j.useRef)(t);(0,j.useEffect)(()=>{a.current=r},[r]),(0,j.useEffect)(()=>{t!==a.current&&(i(t),a.current=t,s(e=>e+1))},[t]);let[o,s]=(0,j.useState)(0),[c,l]=(0,j.useState)(null);(0,j.useEffect)(()=>he(e=>{let t=a.current.slice(0,8),r=e.newKey.slice(0,8);e.newKey!==a.current&&(console.log(`[admin-session-broadcast] outcome=received oldKey=${t} newKey=${r} surface=${n} senderSurface=${e.surface}`),i(e.newKey),s(e=>e+1),l(null))}),[n]);let u=(0,j.useCallback)(()=>{try{sessionStorage.removeItem(ge)}catch{}window.location.href=`/`},[]);return{adminFetch:(0,j.useCallback)(async(e,t)=>{let r=a.current,o=q(e,r),c=await fetch(o,t);if(c.status!==401)return c;let d=await _e(c);if(d===`session-missing`)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=${d} surface=${n} path=${e}`),u(),c;if(d!==`session-not-registered`)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=${d} surface=${n} path=${e}`),l({message:`Your admin session has expired. Click to reload and sign in.`,reason:d}),c;let f=ve();if(!f||f===r)return console.warn(`[useAdminFetch] outcome=redirect-to-login reason=session-not-registered-no-fresh-key surface=${n} path=${e}`),l({message:`Your admin session was renewed in another tab. Click to reload.`,reason:`session-not-registered`}),c;i(f),a.current=f,s(e=>e+1),console.log(`[useAdminFetch] outcome=retry-after-rotation oldKey=${r.slice(0,8)} newKey=${f.slice(0,8)} surface=${n} path=${e}`);let p=q(e,f),m=await fetch(p,t);return m.status===401&&(console.warn(`[useAdminFetch] outcome=redirect-to-login reason=second-401-after-retry surface=${n} path=${e}`),l({message:`Your admin session has expired. Click to reload and sign in.`,reason:`session-not-registered`})),m},[u,n]),cacheKey:r,sessionRefetchNonce:o,banner:c,reloadToLogin:u}}var Y={LocalBusiness:`#4F6B8A`,Service:`#6B85A0`,PriceSpecification:`#8AA0B8`,OpeningHoursSpecification:`#A8BACE`,Organization:`#8A6B47`,Person:`#B86E4A`,UserProfile:`#D08960`,Preference:`#DFA67A`,AdminUser:`#8C5230`,AccessGrant:`#66381F`,KnowledgeDocument:`#6E8A5A`,ConversationArchive:`#82A06A`,Section:`#8AA876`,Chunk:`#A6C194`,DigitalDocument:`#5A7548`,CreativeWork:`#B5C9A2`,Question:`#C7D6B5`,FAQPage:`#95B385`,DefinedTerm:`#76906A`,Review:`#3F5A2E`,ImageObject:`#A0BB8C`,Conversation:`#6B5A85`,AdminConversation:`#4F4070`,PublicConversation:`#8A75A8`,Message:`#6B7280`,UserMessage:`#DFA67A`,AssistantMessage:`#C9A876`,ToolCall:`#B5ABCB`,Task:`#B0617A`,Project:`#8E4A60`,Event:`#C68095`,Workflow:`#3A6F77`,WorkflowStep:`#5A8E96`,WorkflowRun:`#7AAAB2`,StepResult:`#9CC4CB`,Email:`#6F7F4A`,EmailAccount:`#91A063`,Agent:`#B8893D`},X=`#94A3B8`;Object.freeze(Object.keys(Y)),Object.freeze(new Set([`Chunk`,`GraphPreference`]));var ye=Object.freeze(new Set(`LocalBusiness.Service.PriceSpecification.OpeningHoursSpecification.Organization.Person.UserProfile.Preference.AdminUser.AccessGrant.KnowledgeDocument.DigitalDocument.CreativeWork.Question.FAQPage.DefinedTerm.Review.ImageObject.AdminConversation.PublicConversation.Task.Project.Event.Workflow.Email.EmailAccount.Agent`.split(`.`)));Object.freeze(new Set([`ToolCall`,`StepResult`,`WorkflowStep`,`WorkflowRun`])),Object.freeze(new Set([`HAS_TOOL_CALL`,`RUN_OF`,`HAS_STEP`,`HAS_RESULT`]));function Z(e){for(let t=1;t<e.length;t++)if(Object.prototype.hasOwnProperty.call(Y,e[t]))return e[t];return e[0]??null}function be(e){return Y[e]??`#94A3B8`}function xe(e){let t=Z(e),n=t?be(t):X,r=0;for(let t=1;t<e.length;t++)Object.prototype.hasOwnProperty.call(Y,e[t])&&r++;return{displayLabel:t,colour:n,driftCandidates:r}}export{m as _,J as a,re as c,O as d,D as f,h as g,g as h,xe as i,ne as l,y as m,be as n,de as o,E as p,Z as r,ie as s,ye as t,ee as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-DD-I1_y5.js";import{a as t,d as n,m as r,o as i}from"./brand-B-bNrpwc.js";import{_ as a,a as o,d as s,m as c,o as l,t as u}from"./graph-labels-BSQJHlgf.js";var d=n(`circle-arrow-up`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]]),f=n(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),p=n(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),m=n(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),h=n(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]);function g(e){let t=new Set,n=[];for(let r of e)for(let e of r.labels)e&&(t.has(e)||u.has(e)&&(t.add(e),n.push(e)));return n}var _=80;function v(e){let t=y(e.properties)??e.labels[0]??``,n=t.length>_?t.slice(0,_):t;return`/graph?${new URLSearchParams({nodeId:e.nodeId,label:n}).toString()}`}function y(e){for(let t of[`title`,`name`,`summary`,`headline`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}var b=e(r(),1),x=t();function S(){let[e,t]=(0,b.useState)(null),[n,r]=(0,b.useState)(!1),[i,o]=(0,b.useState)(void 0),[s,u]=(0,b.useState)(null),[d,f]=(0,b.useState)(void 0),[p,m]=(0,b.useState)(null),[h,g]=(0,b.useState)(null);(0,b.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!n){t(null),r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(async i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}if(i.ok)try{let e=await i.json();typeof e.businessName==`string`&&o(e.businessName),e.conversationId!==void 0&&u(e.conversationId??null),g(e.role??null),f(e.userName===void 0?null:e.userName),m(e.avatar??null)}catch{}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]);let _=(0,b.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]);return n?e?(0,x.jsx)(l,{cacheKey:e,businessName:i,conversationId:s,onLogout:_,userName:d,userAvatar:p,role:h,children:(0,x.jsxs)(`div`,{className:`data-page`,children:[(0,x.jsx)(`header`,{className:`data-header`,children:(0,x.jsxs)(`h1`,{className:`data-title`,children:[(0,x.jsx)(a,{size:18}),` Data`]})}),(0,x.jsx)(C,{cacheKey:e})]})}):(0,x.jsxs)(`div`,{className:`data-page`,children:[(0,x.jsx)(`header`,{className:`data-header`,children:(0,x.jsxs)(`h1`,{className:`data-title`,children:[(0,x.jsx)(a,{size:18}),` Data`]})}),(0,x.jsxs)(`div`,{className:`data-empty`,children:[(0,x.jsx)(`p`,{children:`You are not signed in.`}),(0,x.jsxs)(`p`,{children:[`Open the `,(0,x.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})]}):(0,x.jsx)(`div`,{className:`data-page`,children:(0,x.jsxs)(`div`,{className:`data-loading`,children:[(0,x.jsx)(c,{size:18,className:`spin`}),` Loading…`]})})}function C({cacheKey:e,onOpenInGraph:t}){let{adminFetch:n,cacheKey:r,sessionRefetchNonce:i,banner:a,reloadToLogin:s}=o({initialCacheKey:e,surface:`data`});return(0,x.jsxs)(`main`,{className:`data-main`,children:[a&&(0,x.jsx)(`button`,{type:`button`,className:`data-session-banner`,onClick:s,"data-reason":a.reason,children:a.message}),(0,x.jsx)(w,{adminFetch:n,sessionRefetchNonce:i,onOpenInGraph:t}),(0,x.jsx)(k,{adminFetch:n,cacheKey:r,sessionRefetchNonce:i})]})}function w({adminFetch:e,sessionRefetchNonce:t,onOpenInGraph:n}){let[r,i]=(0,b.useState)(``),[a,o]=(0,b.useState)(``),[l,u]=(0,b.useState)(null),[d,f]=(0,b.useState)(`hybrid`),[p,m]=(0,b.useState)(!1),[h,_]=(0,b.useState)(null),[y,S]=(0,b.useState)(null),[C,w]=(0,b.useState)(0),[D,O]=(0,b.useState)(!1);(0,b.useEffect)(()=>{let e=r.trim();if(!e){o(``),u(null);return}O(!1);let t=setTimeout(()=>o(e),300);return()=>clearTimeout(t)},[r]),(0,b.useEffect)(()=>{if(!a)return;let t=!1;return m(!0),_(null),e(`/api/admin/graph-search?q=${encodeURIComponent(a)}&labels=*&limit=20${D?`&threshold=0`:``}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(u(e.results),f(e.mode??`hybrid`),w(typeof e.suppressed==`number`?e.suppressed:0))}).catch(e=>{t||_(e instanceof Error?e.message:String(e))}).finally(()=>{t||m(!1)}),()=>{t=!0}},[a,e,t,D]);let k=(0,b.useMemo)(()=>l?g(l):[],[l]),A=y&&k.includes(y)?y:null,j=(0,b.useMemo)(()=>l?A?l.filter(e=>e.labels.includes(A)):l:null,[l,A]),M=(0,b.useCallback)(e=>{if(n){n(e);return}window.location.href=v(e)},[n]);return(0,x.jsxs)(`section`,{className:`data-panel`,children:[(0,x.jsx)(`h2`,{className:`data-panel-title`,children:`Search`}),(0,x.jsx)(`p`,{className:`data-panel-subtitle`,children:`Find anything in your knowledge base by keyword.`}),(0,x.jsxs)(`div`,{className:`data-search-input`,children:[(0,x.jsx)(s,{size:14}),(0,x.jsx)(`input`,{type:`text`,placeholder:`Search your knowledge…`,value:r,onChange:e=>i(e.target.value),autoFocus:!0,autoComplete:`off`,spellCheck:!1}),p&&(0,x.jsx)(c,{size:14,className:`spin`})]}),h&&(0,x.jsxs)(`div`,{className:`data-error`,children:[`Search failed: `,h]}),k.length>0&&(0,x.jsx)(`div`,{className:`data-chip-row`,role:`group`,"aria-label":`Filter by type`,children:k.map(e=>{let t=e===A;return(0,x.jsx)(`button`,{type:`button`,className:`data-chip`,"data-active":t,onClick:()=>S(t?null:e),children:E([e])??e},e)})}),l&&!p&&(0,x.jsxs)(`div`,{className:`data-results-meta`,children:[j.length,` of `,l.length,` result`,l.length===1?``:`s`]}),l&&!p&&!A&&C>0&&!D&&(0,x.jsxs)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>O(!0),children:[C,` low-confidence result`,C===1?``:`s`,` hidden — show all`]}),l&&!p&&!A&&D&&(0,x.jsx)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>O(!1),children:`Showing all results — hide low-confidence`}),l&&l.length===0&&!p&&(0,x.jsx)(`div`,{className:`data-empty-results`,children:`No matches. Try a different keyword.`}),j&&j.length>0&&(0,x.jsx)(`ul`,{className:`data-results`,children:j.map(e=>(0,x.jsx)(T,{hit:e,mode:d,onOpenInGraph:M},e.nodeId))})]})}function T({hit:e,mode:t,onOpenInGraph:n}){let r=D(e.properties),i=O(e.properties),a=E(e.labels),[o,s]=(0,b.useState)(!1),c=i&&i.length>280,l=o||!c?i:i?.slice(0,280)+`…`,u=t===`bm25`?`bm25 ${e.bm25Score.toFixed(2)}`:`vector ${e.vectorScore.toFixed(2)} · bm25 ${e.bm25Score.toFixed(2)} · combined ${e.score.toFixed(2)}`;return(0,x.jsxs)(`li`,{className:`data-result`,children:[(0,x.jsxs)(`div`,{role:`button`,tabIndex:0,className:`data-result-open`,onClick:()=>n(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))},"aria-label":`Open ${r??a??`node`} in graph`,children:[a&&(0,x.jsx)(`div`,{className:`data-result-header`,children:(0,x.jsx)(`span`,{className:`data-result-labels`,children:a})}),r&&(0,x.jsx)(`div`,{className:`data-result-title`,children:r}),i&&(0,x.jsx)(`pre`,{className:`data-result-body`,children:l}),(0,x.jsx)(`div`,{className:`data-result-scores`,children:u})]}),c&&(0,x.jsx)(`button`,{type:`button`,className:`data-result-toggle`,onClick:()=>s(e=>!e),children:o?`Show less`:`Show more`})]})}function E(e){if(e.length===0)return null;let t=e[0].replace(/([a-z])([A-Z])/g,`$1 $2`);return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function D(e){for(let t of[`title`,`name`,`summary`,`headline`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n.length>140?n.slice(0,140)+`…`:n}return null}function O(e){for(let t of[`content`,`summary`,`body`,`description`,`text`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function k({adminFetch:e,cacheKey:t,sessionRefetchNonce:n}){let[r,a]=(0,b.useState)(`.`),[o,s]=(0,b.useState)(null),[l,u]=(0,b.useState)([]),[g,_]=(0,b.useState)(!1),[v,y]=(0,b.useState)(null),[S,C]=(0,b.useState)(!1),[w,T]=(0,b.useState)(null),[E,D]=(0,b.useState)(null),[O,k]=(0,b.useState)(null),[M,N]=(0,b.useState)(null),P=(0,b.useRef)(null),[F,I]=(0,b.useState)(0);(0,b.useEffect)(()=>{let t=!1;return _(!0),y(null),e(`/api/admin/files?path=${encodeURIComponent(r===`.`?``:r)}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(s(e.entries),u(e.displayPath??[]))}).catch(e=>{t||(s([]),u([]),y(e instanceof Error?e.message:String(e)))}).finally(()=>{t||_(!1)}),()=>{t=!0}},[e,r,F,n]);let L=(0,b.useCallback)(e=>{a(e)},[]),R=(0,b.useCallback)(()=>{if(r===`.`||r===``)return;let e=r.split(`/`).filter(Boolean);e.pop(),a(e.length===0?`.`:e.join(`/`))},[r]),z=(0,b.useCallback)(e=>{let n=r===`.`?e.name:`${r}/${e.name}`,i=`/api/admin/files/download?session_key=${encodeURIComponent(t)}&path=${encodeURIComponent(n)}`,a=document.createElement(`a`);a.href=i,a.rel=`noopener noreferrer`,document.body.appendChild(a),a.click(),a.remove()},[r,t]),B=(0,b.useCallback)(()=>{P.current?.click()},[]),V=(0,b.useCallback)(e=>{D(null),N(e.name)},[]),H=(0,b.useCallback)(()=>{N(null)},[]),U=(0,b.useCallback)(async t=>{let n=r===`.`?t.name:`${r}/${t.name}`;D(null),N(null),k(t.name);try{let t=await e(`/api/admin/files?path=${encodeURIComponent(n)}`,{method:`DELETE`}),r=await t.json().catch(()=>({error:`HTTP ${t.status}`}));if(!t.ok)throw Error(r.error??`HTTP ${t.status}`);I(e=>e+1)}catch(e){D(e instanceof Error?e.message:String(e))}finally{k(null)}},[r,e]);(0,b.useEffect)(()=>{if(!M)return;let e=e=>{e.key===`Escape`&&N(null)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[M]);let W=(0,b.useCallback)(async e=>{T(null),C(!0);try{let n=new FormData;n.append(`session_key`,t),n.append(`file`,e);let r=await fetch(`/api/admin/files/upload`,{method:`POST`,body:n}),i=await r.json().catch(()=>({error:`HTTP ${r.status}`}));if(!r.ok)throw Error(i.error??`HTTP ${r.status}`);a(i.path.split(`/`).slice(0,-1).join(`/`)||`.`),I(e=>e+1)}catch(e){T(e instanceof Error?e.message:String(e))}finally{C(!1),P.current&&(P.current.value=``)}},[t]);return(0,x.jsxs)(`section`,{className:`data-panel`,children:[(0,x.jsxs)(`div`,{className:`data-panel-heading`,children:[(0,x.jsx)(`h2`,{className:`data-panel-title`,children:`Files`}),(0,x.jsxs)(`div`,{className:`data-file-actions`,children:[(0,x.jsxs)(`button`,{type:`button`,className:`data-btn`,onClick:B,disabled:S,children:[S?(0,x.jsx)(c,{size:14,className:`spin`}):(0,x.jsx)(h,{size:14}),` Upload`]}),(0,x.jsx)(`input`,{type:`file`,ref:P,hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&W(t)}})]})]}),(0,x.jsxs)(`p`,{className:`data-panel-subtitle`,children:[`Everything under your install's `,(0,x.jsx)(`code`,{children:`data/`}),` directory. Click a folder to open it, a file to download it. Uploads go to `,(0,x.jsx)(`code`,{children:`data/uploads/`}),`.`]}),(0,x.jsxs)(`div`,{className:`data-breadcrumbs`,children:[(0,x.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>L(`.`),children:`data`}),l.map((e,t)=>{let n=l.slice(0,t+1).map(e=>e.name).join(`/`);return(0,x.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,x.jsx)(`span`,{className:`data-crumb-sep`,children:`/`}),(0,x.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>L(n),title:e.name,children:e.displayName??e.name})]},n)}),r!==`.`&&(0,x.jsxs)(`button`,{type:`button`,className:`data-btn data-btn-ghost data-up-btn`,onClick:R,children:[(0,x.jsx)(d,{size:14}),` Up`]})]}),w&&(0,x.jsxs)(`div`,{className:`data-error`,children:[`Upload failed: `,w]}),E&&(0,x.jsxs)(`div`,{className:`data-error`,children:[`Delete failed: `,E]}),v&&(0,x.jsx)(`div`,{className:`data-error`,children:v}),g&&(0,x.jsxs)(`div`,{className:`data-loading`,children:[(0,x.jsx)(c,{size:14,className:`spin`}),` Loading…`]}),!g&&o&&o.length===0&&!v&&(0,x.jsx)(`div`,{className:`data-empty-results`,children:`Empty directory.`}),!g&&o&&o.length>0&&(0,x.jsx)(`ul`,{className:`data-entries`,children:o.map(e=>{let t=e.displayName??e.name,n=O===e.name,a=M===e.name;return(0,x.jsx)(`li`,{className:`data-entry`,children:e.kind===`directory`?(0,x.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onClick:()=>L(r===`.`?e.name:`${r}/${e.name}`),children:[(0,x.jsx)(m,{size:14}),(0,x.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t})]}):e.kind===`file`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onClick:()=>z(e),title:`Download ${t}`,disabled:a,children:[(0,x.jsx)(p,{size:14}),(0,x.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t}),(0,x.jsxs)(`span`,{className:`data-entry-meta`,title:`Modified ${j(e.modifiedAt)}`,children:[A(e.sizeBytes),` · `,j(e.modifiedAt)]}),(0,x.jsx)(f,{size:12,className:`data-entry-download-icon`})]}),a?(0,x.jsxs)(`div`,{className:`data-entry-confirm`,role:`group`,"aria-label":`Confirm delete ${t}`,children:[(0,x.jsx)(`span`,{className:`data-entry-confirm-label`,children:`Delete?`}),(0,x.jsx)(`button`,{type:`button`,className:`data-entry-confirm-yes`,onClick:()=>U(e),autoFocus:!0,children:`Yes`}),(0,x.jsx)(`button`,{type:`button`,className:`data-entry-confirm-no`,onClick:H,children:`No`})]}):(0,x.jsx)(`button`,{type:`button`,className:`data-entry-delete`,onClick:()=>V(e),disabled:n,title:`Delete ${t}`,"aria-label":`Delete ${t}`,children:n?(0,x.jsx)(c,{size:14,className:`spin`}):(0,x.jsx)(i,{size:14})})]}):(0,x.jsxs)(`div`,{className:`data-entry-btn data-entry-disabled`,children:[(0,x.jsx)(p,{size:14}),(0,x.jsx)(`span`,{className:`data-entry-name`,children:t}),(0,x.jsx)(`span`,{className:`data-entry-meta`,children:`special`})]})},e.name)})})]})}function A(e){return e==null?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(1)} GB`}function j(e){try{let t=new Date(e);if(isNaN(t.getTime()))return`—`;let n=typeof navigator<`u`?navigator.languages&&navigator.languages.length>0?[...navigator.languages]:[navigator.language]:void 0;return t.toLocaleString(n,{dateStyle:`medium`,timeStyle:`short`})}catch{return`—`}}export{f as i,C as n,y as r,S as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e}from"./src-B6XdH6xq.js";import"./chunk-ICPOFSXX-SW2Qx11O.js";import"./dist-Bd4S37oi.js";import"./chunk-5PVQY5BW-C_Rq8j_M.js";import"./chunk-U2HBQHQK-BiBUb0cF.js";import"./chunk-BSJP7CBP-DP7LTBll.js";import"./chunk-ZZ45TVLE-C2WNo-fK.js";import"./chunk-55IACEB6-BRJOZLpU.js";import"./chunk-EDXVE4YY-CWQvoVKV.js";import"./chunk-X2U36JSP-Y0MKZCCh.js";import"./chunk-5FUZZQ4R-bn_a4sfU.js";import"./chunk-ENJZ2VHE-DBHn1kSk.js";import"./chunk-336JU56O-DcWl0MQo.js";import{i as t,n,r,t as i}from"./chunk-OYMX7WX6-BvIG7tVW.js";var a={parser:n,get db(){return new i(2)},renderer:r,styles:t,init:e(e=>{e.state||={},e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};
|
|
File without changes
|