@rubytech/create-maxy-code 0.1.291 → 0.1.292
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 +1 -1
- package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +2 -2
- package/payload/platform/plugins/docs/references/platform.md +1 -1
- package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.d.ts +1 -1
- package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.d.ts.map +1 -1
- package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.js +1 -1
- package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.js.map +1 -1
- package/payload/server/{chunk-EAJMRICW.js → chunk-QDCBAHPI.js} +1 -1
- package/payload/server/maxy-edge.js +1 -1
- package/payload/server/public/assets/AdminShell-CpRQprdb.js +1 -0
- package/payload/server/public/assets/{Checkbox-DWx2NcU9.js → Checkbox-hYA5LjZ5.js} +1 -1
- package/payload/server/public/assets/{SidebarSplitter-CidskiAr.js → SidebarSplitter-D0mErwLL.js} +1 -1
- package/payload/server/public/assets/{Transcript-iuM5b4JT.js → Transcript-BaC574J0.js} +1 -1
- package/payload/server/public/assets/{admin-Cdz561nK.js → admin-BVasculM.js} +1 -1
- package/payload/server/public/assets/{architectureDiagram-Q4EWVU46-AtvCAoKj.js → architectureDiagram-Q4EWVU46-d4iT6VnY.js} +1 -1
- package/payload/server/public/assets/{blockDiagram-DXYQGD6D-CwUSTR3t.js → blockDiagram-DXYQGD6D-o5Tjd8VR.js} +1 -1
- package/payload/server/public/assets/{browser-Bwd_rYu9.js → browser-CwU2ReNI.js} +1 -1
- package/payload/server/public/assets/{c4Diagram-AHTNJAMY-Btkecaf-.js → c4Diagram-AHTNJAMY-B8IQ2a83.js} +1 -1
- package/payload/server/public/assets/channel-CizJU0ud.js +1 -0
- package/payload/server/public/assets/chat-NxS8JsVQ.js +1 -0
- package/payload/server/public/assets/{chunk-336JU56O-fJXOXFRr.js → chunk-336JU56O-1-fVU2_7.js} +2 -2
- package/payload/server/public/assets/{chunk-426QAEUC-28Pgly06.js → chunk-426QAEUC-CAPR5ZG1.js} +1 -1
- package/payload/server/public/assets/{chunk-4TB4RGXK-IFvQOpiF.js → chunk-4TB4RGXK-k-V-xUC9.js} +1 -1
- package/payload/server/public/assets/{chunk-5FUZZQ4R-DD-XOAcm.js → chunk-5FUZZQ4R-DMLY3acx.js} +1 -1
- package/payload/server/public/assets/{chunk-5PVQY5BW-Ck-5mL2A.js → chunk-5PVQY5BW-Dw-Sd9tl.js} +1 -1
- package/payload/server/public/assets/{chunk-EDXVE4YY-BPqvO0TO.js → chunk-EDXVE4YY-DtpX8vYJ.js} +1 -1
- package/payload/server/public/assets/{chunk-ENJZ2VHE-PN6Hbw2D.js → chunk-ENJZ2VHE-TxT7_-ER.js} +1 -1
- package/payload/server/public/assets/{chunk-ICPOFSXX-DkmwqyfQ.js → chunk-ICPOFSXX-CPrjaFl6.js} +1 -1
- package/payload/server/public/assets/{chunk-OYMX7WX6-CWyihoif.js → chunk-OYMX7WX6-CmoWgYtj.js} +1 -1
- package/payload/server/public/assets/{chunk-U2HBQHQK-BCWQB0k9.js → chunk-U2HBQHQK-stvjyyuR.js} +1 -1
- package/payload/server/public/assets/{chunk-X2U36JSP-CcaCMsL0.js → chunk-X2U36JSP-qAuy5Y44.js} +1 -1
- package/payload/server/public/assets/{chunk-YZCP3GAM-BUTzrAoG.js → chunk-YZCP3GAM-Vk12yILs.js} +1 -1
- package/payload/server/public/assets/{chunk-ZZ45TVLE-BD9UGg96.js → chunk-ZZ45TVLE-WJVrlWz_.js} +1 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-kzz9ab1y.js +1 -0
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-NFfOmc0C.js +1 -0
- package/payload/server/public/assets/clone-C15qvnbX.js +1 -0
- package/payload/server/public/assets/{dagre-dnTAouT6.js → dagre--B-g8MLT.js} +1 -1
- package/payload/server/public/assets/{dagre-KV5264BT-DcOMoMzF.js → dagre-KV5264BT-BHFfoLq0.js} +1 -1
- package/payload/server/public/assets/data-CebDWao6.js +1 -0
- package/payload/server/public/assets/{diagram-5BDNPKRD-BuQUC75n.js → diagram-5BDNPKRD-TvCFSaXd.js} +1 -1
- package/payload/server/public/assets/{diagram-G4DWMVQ6-DHiu9U7B.js → diagram-G4DWMVQ6-8flGaFB_.js} +1 -1
- package/payload/server/public/assets/{diagram-MMDJMWI5-ypu7YJGF.js → diagram-MMDJMWI5-Dag0WBhV.js} +1 -1
- package/payload/server/public/assets/{diagram-TYMM5635-DIwuWuqN.js → diagram-TYMM5635-u7wh2Nwj.js} +1 -1
- package/payload/server/public/assets/{erDiagram-SMLLAGMA-CKxGMQZW.js → erDiagram-SMLLAGMA-DBTHDFh_.js} +1 -1
- package/payload/server/public/assets/{flowDiagram-DWJPFMVM-CqH2RE7a.js → flowDiagram-DWJPFMVM-C4bd2cb-.js} +1 -1
- package/payload/server/public/assets/{ganttDiagram-T4ZO3ILL-BfuGXUUh.js → ganttDiagram-T4ZO3ILL-DrfpI4Gl.js} +1 -1
- package/payload/server/public/assets/{gitGraphDiagram-UUTBAWPF-BlpUYLLd.js → gitGraphDiagram-UUTBAWPF-a_WyzWRQ.js} +1 -1
- package/payload/server/public/assets/{graph-labels-DvO7i7Ez.js → graph-labels-DznU92XA.js} +1 -1
- package/payload/server/public/assets/{graph-BEu_XQMZ.js → graph-qR6IbCv1.js} +1 -1
- package/payload/server/public/assets/{graphlib-O_QsiopN.js → graphlib-B85zmy3s.js} +1 -1
- package/payload/server/public/assets/{infoDiagram-42DDH7IO-tHUu3AX-.js → infoDiagram-42DDH7IO-g9Re1Ubl.js} +1 -1
- package/payload/server/public/assets/{ishikawaDiagram-UXIWVN3A-CVMbR1ZD.js → ishikawaDiagram-UXIWVN3A-3jXIqGtb.js} +1 -1
- package/payload/server/public/assets/{journeyDiagram-VCZTEJTY-7pbwsn7f.js → journeyDiagram-VCZTEJTY-BXrBb8KE.js} +1 -1
- package/payload/server/public/assets/{kanban-definition-6JOO6SKY-CWFMjHiJ.js → kanban-definition-6JOO6SKY-Dc5vZnuT.js} +1 -1
- package/payload/server/public/assets/{line-B4V-vQdN.js → line-x0RuVReA.js} +1 -1
- package/payload/server/public/assets/{mermaid-parser.core-Ba5Re-_1.js → mermaid-parser.core-CBRGDK2w.js} +1 -1
- package/payload/server/public/assets/{mermaid.core-C39ZL-9e.js → mermaid.core-DeYYeYyM.js} +3 -3
- package/payload/server/public/assets/{mindmap-definition-QFDTVHPH-BrREiATP.js → mindmap-definition-QFDTVHPH-Bw-hRp-Y.js} +1 -1
- package/payload/server/public/assets/{pieDiagram-DEJITSTG-sJOzKUIf.js → pieDiagram-DEJITSTG-C2DTjmdf.js} +1 -1
- package/payload/server/public/assets/{public-927mDSLH.js → public-tk3PfPWF.js} +3 -3
- package/payload/server/public/assets/{quadrantDiagram-34T5L4WZ-bxoGUruT.js → quadrantDiagram-34T5L4WZ-Ffhnv5Ih.js} +1 -1
- package/payload/server/public/assets/{requirementDiagram-MS252O5E-C8_uEDnp.js → requirementDiagram-MS252O5E-y7-gOSmI.js} +1 -1
- package/payload/server/public/assets/{sankeyDiagram-XADWPNL6-CKpSBj6p.js → sankeyDiagram-XADWPNL6-CMwArh7T.js} +1 -1
- package/payload/server/public/assets/{sequenceDiagram-FGHM5R23-BbVOmtji.js → sequenceDiagram-FGHM5R23-C8obTGl1.js} +1 -1
- package/payload/server/public/assets/{stateDiagram-FHFEXIEX-CLiLypPX.js → stateDiagram-FHFEXIEX-BZHsj7kJ.js} +1 -1
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-fK1TrvKX.js +1 -0
- package/payload/server/public/assets/{timeline-definition-GMOUNBTQ-Dzzc-pnB.js → timeline-definition-GMOUNBTQ-D-fo_L7-.js} +1 -1
- package/payload/server/public/assets/{useSelectionMode-CzWzToaM.css → useSelectionMode-CQBRZjvc.css} +1 -1
- package/payload/server/public/assets/{vennDiagram-DHZGUBPP-CEj_ctTP.js → vennDiagram-DHZGUBPP--aEWsS70.js} +1 -1
- package/payload/server/public/assets/{wardleyDiagram-NUSXRM2D-Cnbz79qd.js → wardleyDiagram-NUSXRM2D-DFWrB0Kk.js} +1 -1
- package/payload/server/public/assets/{xychartDiagram-5P7HB3ND-MTjLweae.js → xychartDiagram-5P7HB3ND-DZsTZHC6.js} +1 -1
- package/payload/server/public/browser.html +5 -5
- package/payload/server/public/chat.html +5 -5
- package/payload/server/public/data.html +6 -6
- package/payload/server/public/graph.html +7 -7
- package/payload/server/public/index.html +7 -7
- package/payload/server/public/public.html +4 -4
- package/payload/server/server.js +2 -2
- package/payload/server/public/assets/AdminShell-BgPlhiCM.js +0 -1
- package/payload/server/public/assets/channel-1MEkxMOf.js +0 -1
- package/payload/server/public/assets/chat-wbKqew6m.js +0 -1
- package/payload/server/public/assets/classDiagram-6PBFFD2Q-BcD2DnVi.js +0 -1
- package/payload/server/public/assets/classDiagram-v2-HSJHXN6E-ChvbGJh0.js +0 -1
- package/payload/server/public/assets/clone-DPfDeykW.js +0 -1
- package/payload/server/public/assets/data-BSt0roMQ.js +0 -1
- package/payload/server/public/assets/stateDiagram-v2-QKLJ7IA2-Cn6OBfIT.js +0 -1
- /package/payload/server/public/assets/{useSelectionMode-BBvWzgtz.js → useSelectionMode-CJ2UADOe.js} +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: platform-architecture
|
|
3
3
|
description: Use when grounding any documented-surface claim about what Maxy ships — plugins, skills, specialists, install/deploy flows, internals. This is the install catalogue, not evidence of what is enabled on the current account. For install state on this account, call `capabilities-here`; for documented surface, cite the `Source:` URL inline.
|
|
4
|
-
content-hash: sha256:
|
|
4
|
+
content-hash: sha256:edae39c038e88d2b4f86c7bfb6f9710a825515ef8ddbc1fd24ea501f38dd0dbe
|
|
5
5
|
brand: maxy-code
|
|
6
6
|
product-name: Maxy
|
|
7
7
|
---
|
|
@@ -196,7 +196,7 @@ There is no dashboard, no settings panel, no menus. Everything is done through c
|
|
|
196
196
|
|
|
197
197
|
The chat input auto-grows as you type — it expands to fit your message and shrinks back when you delete text. You can also drag the resize handle above the input to set a custom height.
|
|
198
198
|
|
|
199
|
-
The admin interface is a three-pane layout: a sidebar on the left with navigation (Sessions, People, Agents, Projects, Tasks, Artefacts) and your recent conversations; the chat in the middle; and an artefact pane on the right that opens when you select a document, click a project, or open Browser, Data, or Graph from the menu, holding the surface side-by-side with the conversation so the chat stays live while you work in it. At the very top of the sidebar — above the nav rows — a borderless row holds two controls: a "+ New session" button on the left that spawns a fresh Claude Code session, and a Mode trigger on the right showing the current permission mode (Ask, Accept edits, Plan, or Auto). The sidebar's vertical order is: new-session strip first, then the nav (Sessions, People, Agents, Projects, Tasks, Artefacts), then the sessions list, then the footer. Both controls render as plain text-plus-icon affordances with no surrounding rectangle. The "+ New session" button is a text-width hit target — its clickable area is exactly the icon plus label, not the whole row — and shows no hover fill; the only hover feedback is the pointer cursor. The Mode trigger is pushed flush to the right edge of the row. Clicking the Mode trigger opens a popover downward from the row whose header reads "Mode" and lists the four permission modes with the current selection check-marked. The sidebar's nav rows swap the list view in place: Sessions shows recent conversations, Projects shows your active work projects, and Artefacts lists every KnowledgeDocument plus this account's agent templates (your admin agent's IDENTITY, SOUL, and KNOWLEDGE files plus one entry per enabled specialist). Each recent session row carries a three-state indicator: three pulsing dots when the session is busy (currently processing a turn), a solid sage dot when it is idle (live PTY waiting for input), and a hollow ring when it is archived (PTY exited, JSONL on disk for audit). The list itself splits into three views via a segmented control above the rows: **Active** shows every live session, **Archived** shows every JSONL on disk whose PTY has exited, and **All** shows both. The view choice persists across reloads. An "Include subagents" toggle inside the Active view surfaces specialist spawns (database-operator, premium-plugin agents, anything spawned with a `--agent` flag) which are hidden by default so the list reflects what you started directly. Each row also carries a small uppercase badge — `admin` for operator-driven sessions, the specialist name (for example `db-op`) for background work — so the source of any row is unambiguous at a glance. The People, Agents, and Tasks rows are graph shortcuts: clicking each opens the artefact-pane Graph filtered to every Person, every public Agent, or every Task in your account respectively, with no side-list, because the graph itself is the result. Public agents become first-class graph entities the moment you create them, with edges to their IDENTITY/SOUL/KNOWLEDGE files, edges to every knowledge document they have access to, and edges from every conversation they have handled, so a single Agents click reveals the whole shape of who knows what and who has been talking to whom. Click an artefact row to open the document. KnowledgeDocuments and your admin agent's templates are editable: type in the document and changes save automatically; specialist agent templates are read-only because they ship with Maxy and your edits would be overwritten on the next install. PDF artefacts render inline so you can read them without leaving the pane. If your browser doesn't have a built-in PDF viewer, a Download button appears instead. Artefacts that have no readable file backing them (orphan rows, files removed from disk, unsupported content types) show a one-line banner explaining the skip instead of opening to a blank pane. Click a project row to open the Graph view focused on that project's neighbourhood; clicking a second project swaps the focus rather than stacking on top. The sidebar's right edge is drag-resizable on every admin page (Sessions root, Graph, and Data): drag the handle to widen or narrow the sidebar, and your chosen width is remembered across reloads and shared across all three pages. The drag handle is mounted by each AdminShell consumer rather than by AdminShell itself, so any new admin route must include `<SidebarSplitter />` as a direct child of its `<AdminShell>` to pick up the shared width. The chat and artefact divider is also drag-resizable: drag the line between the columns to make either side wider; double-click it to reset to half of the available width (viewport minus sidebar), clamped to the chat and artefact min-width floors. Your chosen width is remembered across reloads. On wider screens (>1280px) all three panes are visible. The sidebar narrows at 1280px, the artefact pane hides at 1080px (Browser, Data, and Graph then open as full-window pages instead), and the sidebar collapses to a 56px icon rail at 820px. On every viewport the chat header reads left to right as a triptych: a dedicated sidebar toggle (the panel-right icon, which swaps to panel-right-open when the sidebar is showing), the brand mark next to the title in the centre, and the menu burger on the right. This header toggle is the sole sidebar-toggle button; the sidebar itself no longer carries a duplicate. Tap the sidebar toggle to show or hide the sidebar: on phones (<720px) it slides the drawer in or out, on wider screens it collapses or expands the sidebar column. The brand mark in the centre is decorative; clicks go through the dedicated toggle so the affordance is unambiguous. The drawer animation only fires on tap (220ms slide in or out); resizing your window across the 720px boundary snaps the layout without animation, so you never see a half-open flash. At ≤640px the session metadata pane stacks each label above its value instead of the desktop two-column grid, and the row of action buttons (Open in new tab / Download JSONL / View JSONL / Rename / Pin / Archive / End or Purge) collapses behind a single Actions trigger that opens a popover upward from the foot of the pane. Breakpoint summary: >1280px = full sidebar + chat + artefact pane (drag-resizable divider); 1280px→1080px = sidebar narrows; 1080px→820px = artefact pane hides (Browser/Data/Graph open as full-window pages instead); 820px→720px = sidebar collapses to 56px icon rail; ≤720px = sidebar becomes off-canvas drawer (vertical stack of nav, recents list, foot, the same shape as the desktop sidebar, just on top of the chat instead of beside it).
|
|
199
|
+
The admin interface is a three-pane layout: a sidebar on the left with navigation (Sessions, People, Agents, Projects, Tasks, Artefacts) and your recent conversations; the chat in the middle; and an artefact pane on the right that opens when you select a document, click a project, or open Browser, Data, or Graph from the menu, holding the surface side-by-side with the conversation so the chat stays live while you work in it. At the very top of the sidebar — above the nav rows — a borderless row holds two controls: a "+ New session" button on the left that spawns a fresh Claude Code session, and a Mode trigger on the right showing the current permission mode (Ask, Accept edits, Plan, or Auto). The sidebar's vertical order is: new-session strip first, then the nav (Sessions, People, Agents, Projects, Tasks, Artefacts), then the sessions list, then the footer. Both controls render as plain text-plus-icon affordances with no surrounding rectangle. The "+ New session" button is a text-width hit target — its clickable area is exactly the icon plus label, not the whole row — and shows no hover fill; the only hover feedback is the pointer cursor. The Mode trigger is pushed flush to the right edge of the row. Clicking the Mode trigger opens a popover downward from the row whose header reads "Mode" and lists the four permission modes with the current selection check-marked. The sidebar's nav rows swap the list view in place: Sessions shows recent conversations, Projects shows your active work projects, and Artefacts lists every KnowledgeDocument plus this account's agent templates (your admin agent's IDENTITY, SOUL, and KNOWLEDGE files plus one entry per enabled specialist). Each recent session row carries a three-state indicator: three pulsing dots when the session is busy (currently processing a turn), a solid sage dot when it is idle (live PTY waiting for input), and a hollow ring when it is archived (PTY exited, JSONL on disk for audit). The list itself splits into three views via a segmented control above the rows: **Active** shows every live session, **Archived** shows every JSONL on disk whose PTY has exited, and **All** shows both. The view choice persists across reloads. An "Include subagents" toggle inside the Active view surfaces specialist spawns (database-operator, premium-plugin agents, anything spawned with a `--agent` flag) which are hidden by default so the list reflects what you started directly. Each row also carries a small uppercase badge — `admin` for operator-driven sessions, the specialist name (for example `db-op`) for background work — so the source of any row is unambiguous at a glance. The People, Agents, and Tasks rows are graph shortcuts: clicking each opens the artefact-pane Graph filtered to every Person, every public Agent, or every Task in your account respectively, with no side-list, because the graph itself is the result. Public agents become first-class graph entities the moment you create them, with edges to their IDENTITY/SOUL/KNOWLEDGE files, edges to every knowledge document they have access to, and edges from every conversation they have handled, so a single Agents click reveals the whole shape of who knows what and who has been talking to whom. Click an artefact row to open the document. KnowledgeDocuments and your admin agent's templates are editable: type in the document and changes save automatically; specialist agent templates are read-only because they ship with Maxy and your edits would be overwritten on the next install. PDF artefacts render inline so you can read them without leaving the pane. If your browser doesn't have a built-in PDF viewer, a Download button appears instead. Artefacts that have no readable file backing them (orphan rows, files removed from disk, unsupported content types) show a one-line banner explaining the skip instead of opening to a blank pane. Click a project row to open the Graph view focused on that project's neighbourhood; clicking a second project swaps the focus rather than stacking on top. The sidebar's right edge is drag-resizable on every admin page (Sessions root, Graph, and Data): drag the handle to widen or narrow the sidebar, and your chosen width is remembered across reloads and shared across all three pages. The drag handle is mounted by each AdminShell consumer rather than by AdminShell itself, so any new admin route must include `<SidebarSplitter />` as a direct child of its `<AdminShell>` to pick up the shared width. The chat and artefact divider is also drag-resizable: drag the line between the columns to make either side wider; double-click it to reset to half of the available width (viewport minus sidebar), clamped to the chat and artefact min-width floors. Your chosen width is remembered across reloads. On wider screens (>1280px) all three panes are visible. The sidebar narrows at 1280px, the artefact pane hides at 1080px (Browser, Data, and Graph then open as full-window pages instead), and the sidebar collapses to a 56px icon rail at 820px. On every viewport the chat header reads left to right as a triptych: a dedicated sidebar toggle (the panel-right icon, which swaps to panel-right-open when the sidebar is showing), the brand mark next to the title in the centre, and the menu burger on the right. This header toggle is the sole sidebar-toggle button; the sidebar itself no longer carries a duplicate. The burger opens the navigation flyout: Dashboard, Data, Graph, Browser, and Chat at the top — Dashboard routes back to `/`, so every satellite page keeps a one-click way home, and the Chat item carries the Claude mark rather than a generic icon — then Public (the agents list) between the two dividers, and below the second divider the version row, Disconnect Claude account, and Log out. Tap the sidebar toggle to show or hide the sidebar: on phones (<720px) it slides the drawer in or out, on wider screens it collapses or expands the sidebar column. The brand mark in the centre is decorative; clicks go through the dedicated toggle so the affordance is unambiguous. The drawer animation only fires on tap (220ms slide in or out); resizing your window across the 720px boundary snaps the layout without animation, so you never see a half-open flash. At ≤640px the session metadata pane stacks each label above its value instead of the desktop two-column grid, and the row of action buttons (Open in new tab / Download JSONL / View JSONL / Rename / Pin / Archive / End or Purge) collapses behind a single Actions trigger that opens a popover upward from the foot of the pane. Breakpoint summary: >1280px = full sidebar + chat + artefact pane (drag-resizable divider); 1280px→1080px = sidebar narrows; 1080px→820px = artefact pane hides (Browser/Data/Graph open as full-window pages instead); 820px→720px = sidebar collapses to 56px icon rail; ≤720px = sidebar becomes off-canvas drawer (vertical stack of nav, recents list, foot, the same shape as the desktop sidebar, just on top of the chat instead of beside it).
|
|
200
200
|
|
|
201
201
|
Page titles are brand-aware: the browser tab shows your product name (e.g. `Real Agent` instead of `Maxy`) on every shell — chat, graph, and data — so a non-default brand never leaks the default name in tab strips or browser history.
|
|
202
202
|
|
|
@@ -82,7 +82,7 @@ There is no dashboard, no settings panel, no menus. Everything is done through c
|
|
|
82
82
|
|
|
83
83
|
The chat input auto-grows as you type — it expands to fit your message and shrinks back when you delete text. You can also drag the resize handle above the input to set a custom height.
|
|
84
84
|
|
|
85
|
-
The admin interface is a three-pane layout: a sidebar on the left with navigation (Sessions, People, Agents, Projects, Tasks, Artefacts) and your recent conversations; the chat in the middle; and an artefact pane on the right that opens when you select a document, click a project, or open Browser, Data, or Graph from the menu, holding the surface side-by-side with the conversation so the chat stays live while you work in it. At the very top of the sidebar — above the nav rows — a borderless row holds two controls: a "+ New session" button on the left that spawns a fresh Claude Code session, and a Mode trigger on the right showing the current permission mode (Ask, Accept edits, Plan, or Auto). The sidebar's vertical order is: new-session strip first, then the nav (Sessions, People, Agents, Projects, Tasks, Artefacts), then the sessions list, then the footer. Both controls render as plain text-plus-icon affordances with no surrounding rectangle. The "+ New session" button is a text-width hit target — its clickable area is exactly the icon plus label, not the whole row — and shows no hover fill; the only hover feedback is the pointer cursor. The Mode trigger is pushed flush to the right edge of the row. Clicking the Mode trigger opens a popover downward from the row whose header reads "Mode" and lists the four permission modes with the current selection check-marked. The sidebar's nav rows swap the list view in place: Sessions shows recent conversations, Projects shows your active work projects, and Artefacts lists every KnowledgeDocument plus this account's agent templates (your admin agent's IDENTITY, SOUL, and KNOWLEDGE files plus one entry per enabled specialist). Each recent session row carries a three-state indicator: three pulsing dots when the session is busy (currently processing a turn), a solid sage dot when it is idle (live PTY waiting for input), and a hollow ring when it is archived (PTY exited, JSONL on disk for audit). The list itself splits into three views via a segmented control above the rows: **Active** shows every live session, **Archived** shows every JSONL on disk whose PTY has exited, and **All** shows both. The view choice persists across reloads. An "Include subagents" toggle inside the Active view surfaces specialist spawns (database-operator, premium-plugin agents, anything spawned with a `--agent` flag) which are hidden by default so the list reflects what you started directly. Each row also carries a small uppercase badge — `admin` for operator-driven sessions, the specialist name (for example `db-op`) for background work — so the source of any row is unambiguous at a glance. The People, Agents, and Tasks rows are graph shortcuts: clicking each opens the artefact-pane Graph filtered to every Person, every public Agent, or every Task in your account respectively, with no side-list, because the graph itself is the result. Public agents become first-class graph entities the moment you create them, with edges to their IDENTITY/SOUL/KNOWLEDGE files, edges to every knowledge document they have access to, and edges from every conversation they have handled, so a single Agents click reveals the whole shape of who knows what and who has been talking to whom. Click an artefact row to open the document. KnowledgeDocuments and your admin agent's templates are editable: type in the document and changes save automatically; specialist agent templates are read-only because they ship with Maxy and your edits would be overwritten on the next install. PDF artefacts render inline so you can read them without leaving the pane. If your browser doesn't have a built-in PDF viewer, a Download button appears instead. Artefacts that have no readable file backing them (orphan rows, files removed from disk, unsupported content types) show a one-line banner explaining the skip instead of opening to a blank pane. Click a project row to open the Graph view focused on that project's neighbourhood; clicking a second project swaps the focus rather than stacking on top. The sidebar's right edge is drag-resizable on every admin page (Sessions root, Graph, and Data): drag the handle to widen or narrow the sidebar, and your chosen width is remembered across reloads and shared across all three pages. The drag handle is mounted by each AdminShell consumer rather than by AdminShell itself, so any new admin route must include `<SidebarSplitter />` as a direct child of its `<AdminShell>` to pick up the shared width. The chat and artefact divider is also drag-resizable: drag the line between the columns to make either side wider; double-click it to reset to half of the available width (viewport minus sidebar), clamped to the chat and artefact min-width floors. Your chosen width is remembered across reloads. On wider screens (>1280px) all three panes are visible. The sidebar narrows at 1280px, the artefact pane hides at 1080px (Browser, Data, and Graph then open as full-window pages instead), and the sidebar collapses to a 56px icon rail at 820px. On every viewport the chat header reads left to right as a triptych: a dedicated sidebar toggle (the panel-right icon, which swaps to panel-right-open when the sidebar is showing), the brand mark next to the title in the centre, and the menu burger on the right. This header toggle is the sole sidebar-toggle button; the sidebar itself no longer carries a duplicate. Tap the sidebar toggle to show or hide the sidebar: on phones (<720px) it slides the drawer in or out, on wider screens it collapses or expands the sidebar column. The brand mark in the centre is decorative; clicks go through the dedicated toggle so the affordance is unambiguous. The drawer animation only fires on tap (220ms slide in or out); resizing your window across the 720px boundary snaps the layout without animation, so you never see a half-open flash. At ≤640px the session metadata pane stacks each label above its value instead of the desktop two-column grid, and the row of action buttons (Open in new tab / Download JSONL / View JSONL / Rename / Pin / Archive / End or Purge) collapses behind a single Actions trigger that opens a popover upward from the foot of the pane. Breakpoint summary: >1280px = full sidebar + chat + artefact pane (drag-resizable divider); 1280px→1080px = sidebar narrows; 1080px→820px = artefact pane hides (Browser/Data/Graph open as full-window pages instead); 820px→720px = sidebar collapses to 56px icon rail; ≤720px = sidebar becomes off-canvas drawer (vertical stack of nav, recents list, foot, the same shape as the desktop sidebar, just on top of the chat instead of beside it).
|
|
85
|
+
The admin interface is a three-pane layout: a sidebar on the left with navigation (Sessions, People, Agents, Projects, Tasks, Artefacts) and your recent conversations; the chat in the middle; and an artefact pane on the right that opens when you select a document, click a project, or open Browser, Data, or Graph from the menu, holding the surface side-by-side with the conversation so the chat stays live while you work in it. At the very top of the sidebar — above the nav rows — a borderless row holds two controls: a "+ New session" button on the left that spawns a fresh Claude Code session, and a Mode trigger on the right showing the current permission mode (Ask, Accept edits, Plan, or Auto). The sidebar's vertical order is: new-session strip first, then the nav (Sessions, People, Agents, Projects, Tasks, Artefacts), then the sessions list, then the footer. Both controls render as plain text-plus-icon affordances with no surrounding rectangle. The "+ New session" button is a text-width hit target — its clickable area is exactly the icon plus label, not the whole row — and shows no hover fill; the only hover feedback is the pointer cursor. The Mode trigger is pushed flush to the right edge of the row. Clicking the Mode trigger opens a popover downward from the row whose header reads "Mode" and lists the four permission modes with the current selection check-marked. The sidebar's nav rows swap the list view in place: Sessions shows recent conversations, Projects shows your active work projects, and Artefacts lists every KnowledgeDocument plus this account's agent templates (your admin agent's IDENTITY, SOUL, and KNOWLEDGE files plus one entry per enabled specialist). Each recent session row carries a three-state indicator: three pulsing dots when the session is busy (currently processing a turn), a solid sage dot when it is idle (live PTY waiting for input), and a hollow ring when it is archived (PTY exited, JSONL on disk for audit). The list itself splits into three views via a segmented control above the rows: **Active** shows every live session, **Archived** shows every JSONL on disk whose PTY has exited, and **All** shows both. The view choice persists across reloads. An "Include subagents" toggle inside the Active view surfaces specialist spawns (database-operator, premium-plugin agents, anything spawned with a `--agent` flag) which are hidden by default so the list reflects what you started directly. Each row also carries a small uppercase badge — `admin` for operator-driven sessions, the specialist name (for example `db-op`) for background work — so the source of any row is unambiguous at a glance. The People, Agents, and Tasks rows are graph shortcuts: clicking each opens the artefact-pane Graph filtered to every Person, every public Agent, or every Task in your account respectively, with no side-list, because the graph itself is the result. Public agents become first-class graph entities the moment you create them, with edges to their IDENTITY/SOUL/KNOWLEDGE files, edges to every knowledge document they have access to, and edges from every conversation they have handled, so a single Agents click reveals the whole shape of who knows what and who has been talking to whom. Click an artefact row to open the document. KnowledgeDocuments and your admin agent's templates are editable: type in the document and changes save automatically; specialist agent templates are read-only because they ship with Maxy and your edits would be overwritten on the next install. PDF artefacts render inline so you can read them without leaving the pane. If your browser doesn't have a built-in PDF viewer, a Download button appears instead. Artefacts that have no readable file backing them (orphan rows, files removed from disk, unsupported content types) show a one-line banner explaining the skip instead of opening to a blank pane. Click a project row to open the Graph view focused on that project's neighbourhood; clicking a second project swaps the focus rather than stacking on top. The sidebar's right edge is drag-resizable on every admin page (Sessions root, Graph, and Data): drag the handle to widen or narrow the sidebar, and your chosen width is remembered across reloads and shared across all three pages. The drag handle is mounted by each AdminShell consumer rather than by AdminShell itself, so any new admin route must include `<SidebarSplitter />` as a direct child of its `<AdminShell>` to pick up the shared width. The chat and artefact divider is also drag-resizable: drag the line between the columns to make either side wider; double-click it to reset to half of the available width (viewport minus sidebar), clamped to the chat and artefact min-width floors. Your chosen width is remembered across reloads. On wider screens (>1280px) all three panes are visible. The sidebar narrows at 1280px, the artefact pane hides at 1080px (Browser, Data, and Graph then open as full-window pages instead), and the sidebar collapses to a 56px icon rail at 820px. On every viewport the chat header reads left to right as a triptych: a dedicated sidebar toggle (the panel-right icon, which swaps to panel-right-open when the sidebar is showing), the brand mark next to the title in the centre, and the menu burger on the right. This header toggle is the sole sidebar-toggle button; the sidebar itself no longer carries a duplicate. The burger opens the navigation flyout: Dashboard, Data, Graph, Browser, and Chat at the top — Dashboard routes back to `/`, so every satellite page keeps a one-click way home, and the Chat item carries the Claude mark rather than a generic icon — then Public (the agents list) between the two dividers, and below the second divider the version row, Disconnect Claude account, and Log out. Tap the sidebar toggle to show or hide the sidebar: on phones (<720px) it slides the drawer in or out, on wider screens it collapses or expands the sidebar column. The brand mark in the centre is decorative; clicks go through the dedicated toggle so the affordance is unambiguous. The drawer animation only fires on tap (220ms slide in or out); resizing your window across the 720px boundary snaps the layout without animation, so you never see a half-open flash. At ≤640px the session metadata pane stacks each label above its value instead of the desktop two-column grid, and the row of action buttons (Open in new tab / Download JSONL / View JSONL / Rename / Pin / Archive / End or Purge) collapses behind a single Actions trigger that opens a popover upward from the foot of the pane. Breakpoint summary: >1280px = full sidebar + chat + artefact pane (drag-resizable divider); 1280px→1080px = sidebar narrows; 1080px→820px = artefact pane hides (Browser/Data/Graph open as full-window pages instead); 820px→720px = sidebar collapses to 56px icon rail; ≤720px = sidebar becomes off-canvas drawer (vertical stack of nav, recents list, foot, the same shape as the desktop sidebar, just on top of the chat instead of beside it).
|
|
86
86
|
|
|
87
87
|
Page titles are brand-aware: the browser tab shows your product name (e.g. `Real Agent` instead of `Maxy`) on every shell — chat, graph, and data — so a non-default brand never leaks the default name in tab strips or browser history.
|
|
88
88
|
|
package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type IdentityFilesVerdict } from './agent-identity-locator.js';
|
|
2
|
-
export declare const MANAGER_SHADOWED_SLUGS: readonly ["public", "chat", "graph", "sessions", "data"];
|
|
2
|
+
export declare const MANAGER_SHADOWED_SLUGS: readonly ["public", "public-chat", "chat", "graph", "sessions", "data"];
|
|
3
3
|
export type ReachReason = 'ok' | 'shadowed' | 'no-default-and-unrouted' | 'files-missing';
|
|
4
4
|
export interface ReachVerdict {
|
|
5
5
|
reachable: boolean;
|
package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-agent-reachability.d.ts","sourceRoot":"","sources":["../src/public-agent-reachability.ts"],"names":[],"mappings":"AAcA,OAAO,EAAuD,KAAK,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAE5H,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"public-agent-reachability.d.ts","sourceRoot":"","sources":["../src/public-agent-reachability.ts"],"names":[],"mappings":"AAcA,OAAO,EAAuD,KAAK,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAE5H,eAAO,MAAM,sBAAsB,yEAA0E,CAAA;AAI7G,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,UAAU,GAAG,yBAAyB,GAAG,eAAe,CAAA;AACzF,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,OAAO,CAAA;IAClB,MAAM,EAAE,WAAW,CAAA;IACnB;iEAC6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAID,MAAM,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;AAE3C;;;qCAGqC;AACrC,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,GAAG,IAAI,EAC3B,aAAa,EAAE,SAAS,MAAM,EAAE,GAC/B,YAAY,CAKd;AAED;;;;;;yDAMyD;AACzD,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,GAAG,IAAI,EAC3B,aAAa,EAAE,SAAS,MAAM,EAAE,EAChC,KAAK,EAAE,oBAAoB,GAC1B,YAAY,CAKd;AAsBD,MAAM,WAAW,qBAAqB;IACpC,8DAA8D;IAC9D,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,IAAI,IAAI,CAAA;IACb,IAAI,IAAI,IAAI,CAAA;IACZ,QAAQ,IAAI;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAA;CACrD;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,qBAAqB,GAAG,iBAAiB,CAuDtF"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
13
13
|
import { join } from 'node:path';
|
|
14
14
|
import { resolveAgentIdentityDir, publicIdentityFilesPresent } from './agent-identity-locator.js';
|
|
15
|
-
export const MANAGER_SHADOWED_SLUGS = ['public', 'chat', 'graph', 'sessions', 'data'];
|
|
15
|
+
export const MANAGER_SHADOWED_SLUGS = ['public', 'public-chat', 'chat', 'graph', 'sessions', 'data'];
|
|
16
16
|
const SLUG_PATTERN = /^[a-z][a-z0-9-]{2,49}$/;
|
|
17
17
|
const TAG = '[public-agent-reachability]';
|
|
18
18
|
/** Pure verdict. Default-first: a slug that is the default is reachable at the
|
package/payload/platform/services/claude-session-manager/dist/public-agent-reachability.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-agent-reachability.js","sourceRoot":"","sources":["../src/public-agent-reachability.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,8EAA8E;AAC9E,iFAAiF;AACjF,8EAA8E;AAC9E,8EAA8E;AAC9E,mEAAmE;AACnE,EAAE;AACF,uEAAuE;AACvE,sEAAsE;AACtE,oEAAoE;AACpE,6DAA6D;AAE7D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAA6B,MAAM,6BAA6B,CAAA;AAE5H,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,CAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"public-agent-reachability.js","sourceRoot":"","sources":["../src/public-agent-reachability.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,8EAA8E;AAC9E,iFAAiF;AACjF,8EAA8E;AAC9E,8EAA8E;AAC9E,mEAAmE;AACnE,EAAE;AACF,uEAAuE;AACvE,sEAAsE;AACtE,oEAAoE;AACpE,6DAA6D;AAE7D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAA6B,MAAM,6BAA6B,CAAA;AAE5H,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,CAAU,CAAA;AAE7G,MAAM,YAAY,GAAG,wBAAwB,CAAA;AAW7C,MAAM,GAAG,GAAG,6BAA6B,CAAA;AAIzC;;;qCAGqC;AACrC,MAAM,UAAU,mBAAmB,CACjC,IAAY,EACZ,YAA2B,EAC3B,aAAgC;IAEhC,IAAI,IAAI,KAAK,YAAY;QAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;IACnE,IAAI,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAA;IACjF,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,yBAAyB,EAAE,CAAA;IAC5F,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AAC1C,CAAC;AAED;;;;;;yDAMyD;AACzD,MAAM,UAAU,qBAAqB,CACnC,IAAY,EACZ,YAA2B,EAC3B,aAAgC,EAChC,KAA2B;IAE3B,MAAM,OAAO,GAAG,mBAAmB,CAAC,IAAI,EAAE,YAAY,EAAE,aAAa,CAAC,CAAA;IACtE,IAAI,CAAC,OAAO,CAAC,SAAS;QAAE,OAAO,OAAO,CAAA;IACtC,IAAI,CAAC,KAAK,CAAC,OAAO;QAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAA;IAC9F,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AAC1C,CAAC;AAED,SAAS,gBAAgB,CAAC,UAAkB;IAC1C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAA8B,CAAA;QAC3G,OAAO,GAAG,CAAC,YAAY,IAAI,GAAG,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAA;IAClF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,QAAgB;IACrC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAA;IAC7C,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,KAAK,CAAA;IACtC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAwB,CAAA;QAC5E,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,CAAA;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC;AAeD,MAAM,UAAU,uBAAuB,CAAC,IAA2B;IACjE,IAAI,KAAK,GAA0B,IAAI,CAAA;IAEvC,SAAS,QAAQ;QACf,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;QAClD,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;YAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,CAAA;QAClE,MAAM,YAAY,GAAG,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QACtD,IAAI,OAAO,GAAG,CAAC,CAAA;QACf,IAAI,WAAW,GAAG,CAAC,CAAA;QACnB,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,UAAU,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;YACrE,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO;gBAAE,SAAQ;YAC5D,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;YAC7C,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC;gBAAE,SAAQ;YACtC,OAAO,EAAE,CAAA;YACT,yEAAyE;YACzE,mEAAmE;YACnE,uEAAuE;YACvE,0EAA0E;YAC1E,oEAAoE;YACpE,kDAAkD;YAClD,MAAM,WAAW,GAAG,uBAAuB,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;YAClF,MAAM,CAAC,GAAG,qBAAqB,CAC7B,KAAK,CAAC,IAAI,EACV,YAAY,EACZ,sBAAsB,EACtB,0BAA0B,CAAC,WAAW,CAAC,CACxC,CAAA;YACD,IAAI,CAAC,CAAC,CAAC,SAAS;gBAAE,WAAW,EAAE,CAAA;YAC/B,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;YACxE,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,kBAAkB,KAAK,CAAC,IAAI,cAAc,CAAC,CAAC,SAAS,WAAW,CAAC,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC,CAAA;QAC3G,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,CAAA;IACjC,CAAC;IAED,OAAO;QACL,QAAQ;QACR,KAAK;YACH,IAAI,KAAK;gBAAE,OAAM;YACjB,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE;gBACvB,IAAI,CAAC;oBACH,QAAQ,EAAE,CAAA;gBACZ,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,iCAAiC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;gBACxG,CAAC;YACH,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;YACnB,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,UAAU;gBAAE,KAAK,CAAC,KAAK,EAAE,CAAA;YACpD,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,gCAAgC,IAAI,CAAC,UAAU,eAAe,IAAI,CAAC,UAAU,EAAE,CAAC,CAAA;QACpG,CAAC;QACD,IAAI;YACF,IAAI,KAAK,EAAE,CAAC;gBACV,aAAa,CAAC,KAAK,CAAC,CAAA;gBACpB,KAAK,GAAG,IAAI,CAAA;YACd,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -3430,7 +3430,7 @@ function parseCookieValue(cookieHeader, name) {
|
|
|
3430
3430
|
}
|
|
3431
3431
|
|
|
3432
3432
|
// app/lib/system-path-slugs.ts
|
|
3433
|
-
var SYSTEM_PATH_SLUGS = ["public", "chat", "graph", "sessions", "data"];
|
|
3433
|
+
var SYSTEM_PATH_SLUGS = ["public", "public-chat", "chat", "graph", "sessions", "data"];
|
|
3434
3434
|
|
|
3435
3435
|
// app/lib/claude-agent/account.ts
|
|
3436
3436
|
import { resolve as resolve3 } from "path";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-CWOGyPgy.js";import{d as t,f as n,l as r,m as i,o as a,r as o,t as s,u as c}from"./useSelectionMode-CJ2UADOe.js";async function l(){try{let e=await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`logout`})});return e.ok?(await e.json().catch(()=>({})))?.logged_out===!0:(console.error(`[admin-ui] claude-logout http-status=${e.status}`),!1)}catch(e){return console.error(`[admin-ui] claude-logout fetch failed: ${e instanceof Error?e.message:String(e)}`),!1}}var u=n(`archive-restore`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h2`,key:`tvwodi`}],[`path`,{d:`M20 8v11a2 2 0 0 1-2 2h-2`,key:`1gkqxj`}],[`path`,{d:`m9 15 3-3 3 3`,key:`1pd0qc`}],[`path`,{d:`M12 12v9`,key:`192myk`}]]),d=n(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),f=n(`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`}]]),p=n(`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`}]]),m=n(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),h=n(`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`}]]),g=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`}]]),_=n(`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`}]]),v=n(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),y=n(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),b=n(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),x=n(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),S=n(`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`}]]),C=n(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),w=n(`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`}]]),T=n(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),ee=n(`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`}]]),E=n(`panel-right`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),D=n(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),O=n(`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`}]]),te=n(`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`}]]),ne=n(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),k=n(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),A=n(`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`}]]),j=n(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),M=`maxy-admin-session`,re=typeof BroadcastChannel<`u`;function N(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 ie(e){if(!re)return()=>{};let t=new BroadcastChannel(M),n=t=>{if(!N(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 P=e(i(),1),F=`maxy-admin-session-key`;function I(e,t){return`${e}${e.includes(`?`)?`&`:`?`}session_key=${encodeURIComponent(t)}`}async function L(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 R(){try{return sessionStorage.getItem(F)}catch{return null}}function z(e){let{initialCacheKey:t,surface:n}=e,[r,i]=(0,P.useState)(t),a=(0,P.useRef)(t);(0,P.useEffect)(()=>{a.current=r},[r]),(0,P.useEffect)(()=>{t!==a.current&&(i(t),a.current=t,s(e=>e+1))},[t]);let[o,s]=(0,P.useState)(0);(0,P.useEffect)(()=>ie(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))}),[n]);let c=(0,P.useCallback)(()=>{try{sessionStorage.removeItem(F)}catch{}window.location.href=`/`},[]);return{adminFetch:(0,P.useCallback)(async(e,t)=>{let r=a.current,o=I(e,r),l=await fetch(o,t);if(l.status!==401)return l;let u=await L(l);if(u===`session-missing`||u!==`session-not-registered`)return console.warn(`[useAdminFetch] outcome=session-expired-redirect reason=${u} surface=${n} path=${e}`),c(),l;let d=R();if(!d||d===r)return console.warn(`[useAdminFetch] outcome=session-expired-redirect reason=session-not-registered-no-fresh-key surface=${n} path=${e}`),c(),l;i(d),a.current=d,s(e=>e+1),console.log(`[useAdminFetch] outcome=retry-after-rotation oldKey=${r.slice(0,8)} newKey=${d.slice(0,8)} surface=${n} path=${e}`);let f=I(e,d),p=await fetch(f,t);return p.status===401&&(console.warn(`[useAdminFetch] outcome=session-expired-redirect reason=second-401-after-retry surface=${n} path=${e}`),c()),p},[c,n]),cacheKey:r,sessionRefetchNonce:o}}var B=r(),V=(0,P.createContext)(null);function H({cacheKey:e,onSessionExpired:t,surface:n,children:r}){let i=(0,P.useCallback)(async(r,i)=>{if(!e)return fetch(r,i);let a=I(r,e),o=await fetch(a,i);if(o.status!==401)return o;let s=await L(o),c=e.slice(-8);if(s===`session-not-registered`){let a=R();if(a&&a!==e){let e=I(r,a),o=await fetch(e,i);return o.status===401?(console.warn(`[admin-auth] outcome=session-expired-redirect code=second-401-after-retry path=${r} cacheKey=${c} surface=${n}`),t({code:`second-401-after-retry`,path:r}),o):o}}return console.warn(`[admin-auth] outcome=session-expired-redirect code=${s} path=${r} cacheKey=${c} surface=${n}`),t({code:s,path:r}),o},[e,t,n]);return(0,B.jsx)(V.Provider,{value:i,children:r})}function U(){return(0,P.useContext)(V)}function ae(e){let t=U();return(0,P.useMemo)(()=>t||(async(t,n)=>fetch(e?I(t,e):t,n)),[t,e])}function W(e){let{businessName:t,onNavigate:n,onToggleSidebar:r,sidebarOpen:i,onLogout:s,onDisconnect:l,disconnecting:u}=e,[d,f]=(0,P.useState)(!1),p=(0,P.useRef)(null),g=(0,P.useRef)(null),y=ae(null),[S,D]=(0,P.useState)(null),[O,ne]=(0,P.useState)(!1),[A,M]=(0,P.useState)(null),[re,N]=(0,P.useState)(null),[ie,F]=(0,P.useState)(!1),[I,L]=(0,P.useState)(null),[R,z]=(0,P.useState)(null),[V,H]=(0,P.useState)(``);(0,P.useEffect)(()=>{H(window.location.hostname.startsWith(`admin.`)?window.location.origin.replace(`admin.`,`public.`):window.location.origin)},[]),(0,P.useEffect)(()=>{if(!d)return;let e=e=>{p.current&&!p.current.contains(e.target)&&f(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[d]),(0,P.useEffect)(()=>{if(!d)return;let e=e=>{e.key===`Escape`&&f(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[d]),(0,P.useEffect)(()=>{d&&g.current?.focus()},[d]),(0,P.useEffect)(()=>{if(!d)return;let e=!1;return y(`/api/admin/version`).then(e=>e.json()).then(t=>{e||z(t)}).catch(e=>{console.error(`[admin/version] menu-open client fetch failed:`,e)}),()=>{e=!0}},[d,y]);let U=(0,P.useCallback)(()=>{f(e=>{let t=!e;return t&&console.info(`[admin-ui] header-menu-open`),t})},[]),W=(0,P.useCallback)(e=>{f(!1),n(e)},[n]),G=(0,P.useCallback)(async()=>{if(S!==null){D(null),N(null);return}ne(!0),M(null);try{let e=await y(`/api/admin/agents`);if(!e.ok)throw Error(`Failed to load agents`);D((await e.json()).agents??[])}catch(e){console.error(`[admin/agents] list failed:`,e),M(e instanceof Error?e.message:String(e)),D([])}finally{ne(!1)}},[S,y]),oe=(0,P.useCallback)(e=>{N(null),D(t=>t?.filter(t=>t.slug!==e)??null),y(`/api/admin/agents/${encodeURIComponent(e)}`,{method:`DELETE`}).catch(e=>console.error(`[admin/agents] delete failed:`,e))},[y]),K=(0,P.useCallback)(()=>{f(!1),s()},[s]),se=(0,P.useCallback)(async()=>{L(null),await l()?(F(!1),f(!1)):L(`Disconnect failed — credentials still present. Try again.`)},[l]),q=t||o.productName;return(0,B.jsxs)(`header`,{className:`admin-header`,children:[(0,B.jsx)(`button`,{type:`button`,className:`admin-sidebar-toggle`,"aria-label":i?`Hide sidebar`:`Show sidebar`,title:i?`Hide sidebar`:`Show sidebar`,"aria-expanded":i,onClick:r,children:i?(0,B.jsx)(ee,{size:20,strokeWidth:1.5}):(0,B.jsx)(E,{size:20,strokeWidth:1.5})}),(0,B.jsxs)(`div`,{className:`chat-header-label`,children:[(0,B.jsx)(`span`,{className:`chat-logo-btn`,"aria-hidden":`true`,children:(0,B.jsx)(`img`,{src:a,alt:``,className:`chat-logo`})}),(0,B.jsx)(`h1`,{className:`chat-tagline`,children:q})]}),(0,B.jsxs)(`div`,{className:`chat-burger-wrap`,ref:p,children:[(0,B.jsx)(`button`,{type:`button`,className:`admin-burger`,onClick:U,"aria-label":`Menu`,"aria-haspopup":`true`,"aria-expanded":d,children:(0,B.jsx)(T,{size:20})}),d&&(0,B.jsxs)(`div`,{className:`admin-menu`,role:`menu`,children:[(0,B.jsxs)(`button`,{ref:g,type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>W(`dashboard`),children:[(0,B.jsx)(x,{size:14}),` Dashboard`]}),(0,B.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>W(`data`),children:[(0,B.jsx)(h,{size:14}),` Data`]}),(0,B.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>W(`graph`),children:[(0,B.jsx)(te,{size:14}),` Graph`]}),(0,B.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>W(`browser`),children:[(0,B.jsx)(v,{size:14}),` Browser`]}),(0,B.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:()=>W(`chat`),children:[(0,B.jsx)(`img`,{src:`/brand/claude.png`,alt:``,className:`chat-menu-claude-icon`}),` Chat`]}),(0,B.jsx)(`div`,{className:`chat-menu-divider`}),(0,B.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:G,children:[(0,B.jsx)(_,{size:14}),` Public`,O&&(0,B.jsx)(C,{size:12,className:`spin`})]}),S!==null&&(0,B.jsxs)(`div`,{className:`chat-menu-agents`,children:[A&&(0,B.jsx)(`span`,{className:`chat-menu-agent-error`,children:A}),S.length===0&&!A&&(0,B.jsx)(`span`,{className:`chat-menu-agent-empty`,children:`No public agents configured`}),S.map(e=>(0,B.jsxs)(`div`,{className:`chat-menu-item chat-menu-agent-item`,children:[(0,B.jsx)(`span`,{className:`agent-status-dot ${e.status}`}),(0,B.jsxs)(`span`,{className:`agent-text`,children:[(0,B.jsx)(`span`,{className:`agent-display-name`,children:e.displayName}),(0,B.jsxs)(`span`,{className:`agent-slug`,children:[`/`,e.slug]})]}),re===e.slug?(0,B.jsxs)(`span`,{className:`agent-actions agent-confirm`,children:[(0,B.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-yes`,title:`Confirm delete`,onClick:()=>oe(e.slug),children:(0,B.jsx)(m,{size:12})}),(0,B.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-no`,title:`Cancel`,onClick:()=>N(null),children:(0,B.jsx)(j,{size:12})})]}):(0,B.jsxs)(`span`,{className:`agent-actions`,children:[(0,B.jsx)(`a`,{href:`${V}/${e.slug}`,target:`_blank`,rel:`noopener noreferrer`,className:`agent-action-btn`,title:`Open agent`,onClick:()=>f(!1),children:(0,B.jsx)(_,{size:12})}),(0,B.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-delete-btn`,title:`Delete agent`,onClick:()=>N(e.slug),children:(0,B.jsx)(c,{size:12})})]})]},e.slug))]}),(0,B.jsx)(`div`,{className:`chat-menu-divider`}),(0,B.jsxs)(`div`,{className:`chat-menu-version chat-menu-version-passive`,children:[(0,B.jsx)(b,{size:14}),(0,B.jsxs)(`span`,{className:`version-installed`,children:[R?`v${R.installed}`:`…`,R&&!R.updateAvailable&&(0,B.jsx)(`span`,{className:`version-uptodate-dot`}),R?.updateAvailable&&(0,B.jsx)(`span`,{className:`version-update-dot`})]})]}),ie?(0,B.jsxs)(`div`,{className:`chat-menu-item chat-menu-disconnect`,children:[(0,B.jsx)(`span`,{children:`Disconnect Claude account?`}),(0,B.jsxs)(`span`,{className:`agent-actions agent-confirm`,children:[(0,B.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-yes`,title:`Confirm disconnect`,disabled:u,onClick:se,children:u?(0,B.jsx)(C,{size:12,className:`spin`}):(0,B.jsx)(m,{size:12})}),(0,B.jsx)(`button`,{type:`button`,className:`agent-action-btn agent-confirm-no`,title:`Cancel disconnect`,disabled:u,onClick:()=>{F(!1),L(null)},children:(0,B.jsx)(j,{size:12})})]})]}):(0,B.jsxs)(`button`,{type:`button`,className:`chat-menu-item chat-menu-disconnect`,role:`menuitem`,onClick:()=>{L(null),F(!0)},children:[(0,B.jsx)(k,{size:14}),` Disconnect Claude account`]}),I&&(0,B.jsx)(`span`,{className:`chat-menu-agent-error`,children:I}),(0,B.jsxs)(`button`,{type:`button`,className:`chat-menu-item`,role:`menuitem`,onClick:K,children:[(0,B.jsx)(w,{size:14}),` Log out`]})]})]})]})}var G={whatsapp:{fill:`#25D366`,label:`WhatsApp`,path:`M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.71.306 1.263.489 1.694.625.712.227 1.36.195 1.872.118.571-.085 1.758-.719 2.006-1.413.247-.694.247-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.885-9.885 9.885M20.52 3.449C18.24 1.245 15.24.044 12.045.044 5.463.044.103 5.404.1 11.99c0 2.096.546 4.142 1.588 5.945L0 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.585 0 11.946-5.36 11.949-11.946 0-3.193-1.24-6.19-3.495-8.445`},telegram:{fill:`#229ED9`,label:`Telegram`,path:`M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z`}};function oe({channel:e,size:t=16}){let n=G[e];return(0,B.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:n.fill,role:`img`,"aria-label":n.label,className:`channel-icon`,children:(0,B.jsx)(`path`,{d:n.path})})}var K=[`whatsapp`,`telegram`];function se(e,t,n=`data`){let r=`/api/admin/files/download?session_key=${encodeURIComponent(e)}&path=${encodeURIComponent(t)}`+(n===`data`?``:`&root=${encodeURIComponent(n)}`),i=document.createElement(`a`);i.href=r,i.rel=`noopener noreferrer`,document.body.appendChild(i),i.click(),i.remove()}function q(e){if(e<60)return`${e}s`;let t=Math.floor(e/60),n=e%60;return n>0?`${t}m ${n}s`:`${t}m`}function ce(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}var J=`auth-refresh-failed`;function le({error:e,onClose:t}){if(!e)return null;let n=e.reason===J,r=n?`Claude sign-in expired`:`Session didn’t open`,i=n?`Your claude.ai login has expired. Re-authenticate to resume sessions.`:`The session did not bind within 60 seconds, so there is no live conversation to open.`;return(0,B.jsx)(`div`,{className:`claude-info-overlay`,onClick:t,children:(0,B.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),role:`alertdialog`,"aria-label":`Session could not be opened`,children:[(0,B.jsxs)(`div`,{className:`claude-info-header`,children:[(0,B.jsx)(`span`,{children:r}),(0,B.jsx)(`button`,{className:`claude-info-close`,onClick:t,"aria-label":`Close`,children:`✕`})]}),(0,B.jsxs)(`div`,{className:`claude-info-section`,style:{padding:`12px 14px`,fontSize:`11px`,color:`var(--text-secondary)`},children:[i,(0,B.jsxs)(`div`,{className:`claude-info-row`,style:{marginTop:`8px`},children:[(0,B.jsx)(`span`,{className:`claude-info-label`,children:`Reason`}),(0,B.jsx)(`span`,{className:`claude-info-value`,children:e.reason})]}),e.sessionId&&(0,B.jsxs)(`div`,{className:`claude-info-row`,children:[(0,B.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,B.jsxs)(`span`,{className:`claude-info-value`,children:[e.sessionId.slice(0,8),`…`]})]})]})]})})}function ue(e){let{show:t,onClose:n,claudeInfo:r,messages:i,sessionElapsed:a,sessionId:o,cacheKey:c}=e,[l,u]=(0,P.useState)(null);if(!t)return null;let d=i.flatMap(e=>e.events?.filter(e=>e.type===`usage`)??[]),f=d.at(-1),p=f?.peak_request_pct==null?f?.context_window?Math.round((f.input_tokens+f.cache_creation_tokens+f.cache_read_tokens)/f.context_window*100):0:Math.round(f.peak_request_pct*100),m=d.reduce((e,t)=>e+t.input_tokens+t.cache_creation_tokens+t.cache_read_tokens+t.output_tokens,0),h=i.flatMap(e=>e.events?.filter(e=>e.type===`rate_limit`)??[]).at(-1),g=d.reduce((e,t)=>e+(t.total_cost_usd??0),0),_=r?.account?.subscriptionType,v=e=>{let t=e*1e3-Date.now();if(t<=0)return`now`;let n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return n>0?`${n}h ${r}m`:`${r}m`};return(0,B.jsx)(`div`,{className:`claude-info-overlay`,onClick:n,children:(0,B.jsxs)(`div`,{className:`claude-info-modal`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`div`,{className:`claude-info-header`,children:[(0,B.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`claude-info-icon`}),(0,B.jsx)(`span`,{children:`Claude Code`}),(0,B.jsx)(`button`,{className:`claude-info-close`,onClick:n,"aria-label":`Close`,children:`✕`})]}),(0,B.jsxs)(`div`,{className:`claude-info-section`,children:[(0,B.jsxs)(`div`,{className:`claude-info-row`,children:[(0,B.jsx)(`span`,{className:`claude-info-label`,children:`Version`}),(0,B.jsx)(`span`,{className:`claude-info-value`,children:r?r.version:`…`})]}),(0,B.jsxs)(`div`,{className:`claude-info-row`,children:[(0,B.jsx)(`span`,{className:`claude-info-label`,children:`Email`}),(0,B.jsx)(`span`,{className:`claude-info-value`,children:r?.account?.email??`…`})]})]}),(_||h||g>0)&&(0,B.jsxs)(`div`,{className:`claude-info-section`,children:[_&&(0,B.jsxs)(`div`,{className:`claude-info-row`,children:[(0,B.jsx)(`span`,{className:`claude-info-label`,children:`Plan`}),(0,B.jsx)(`span`,{className:`claude-info-value`,style:{textTransform:`capitalize`},children:_})]}),h&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`claude-info-row`,children:[(0,B.jsx)(`span`,{className:`claude-info-label`,children:`Usage`}),(0,B.jsxs)(`span`,{className:`claude-info-value`,children:[Math.round(h.utilization*100),`%`]})]}),(0,B.jsxs)(`div`,{className:`claude-info-row`,children:[(0,B.jsx)(`span`,{className:`claude-info-label`,children:`Resets in`}),(0,B.jsx)(`span`,{className:`claude-info-value`,children:v(h.resetsAt)})]}),h.isUsingOverage&&(0,B.jsxs)(`div`,{className:`claude-info-row`,children:[(0,B.jsx)(`span`,{className:`claude-info-label`,children:`Overage`}),(0,B.jsx)(`span`,{className:`claude-info-value`,children:`Active`})]})]}),g>0&&(0,B.jsxs)(`div`,{className:`claude-info-row`,children:[(0,B.jsx)(`span`,{className:`claude-info-label`,children:`Session cost`}),(0,B.jsxs)(`span`,{className:`claude-info-value`,children:[`$`,g<.01?g.toFixed(4):g.toFixed(2)]})]})]}),(0,B.jsxs)(`div`,{className:`claude-info-section`,children:[(0,B.jsxs)(`div`,{className:`claude-info-row`,children:[(0,B.jsx)(`span`,{className:`claude-info-label`,children:`Model`}),(0,B.jsx)(`span`,{className:`claude-info-value`,children:r?.model??`…`})]}),(0,B.jsxs)(`div`,{className:`claude-info-row`,children:[(0,B.jsx)(`span`,{className:`claude-info-label`,children:`Context used`}),(0,B.jsx)(`span`,{className:`claude-info-value`,children:p>0?`${p}%`:`—`})]}),(0,B.jsxs)(`div`,{className:`claude-info-row`,children:[(0,B.jsx)(`span`,{className:`claude-info-label`,children:`Tokens`}),(0,B.jsx)(`span`,{className:`claude-info-value`,children:m>0?ce(m):`—`})]}),(0,B.jsxs)(`div`,{className:`claude-info-row`,children:[(0,B.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,B.jsx)(`span`,{className:`claude-info-value`,children:q(a)})]}),(o||c)&&(()=>{let e=o??c??``;return(0,B.jsxs)(`div`,{className:`claude-info-row`,children:[(0,B.jsx)(`span`,{className:`claude-info-label`,children:`Session`}),(0,B.jsx)(`button`,{type:`button`,className:`claude-info-value claude-info-id-copy`,title:`${e} (${o?`flushed`:`pre-flush`}) — click to copy`,onClick:async()=>{u(await s(e)?`copied`:`failed`),setTimeout(()=>u(null),1200)},children:l===`copied`?`copied ✓`:l===`failed`?`copy failed ✕`:`${e.slice(0,8)}…`})]})})()]})]})})}var de=`https://claude.ai/code`,fe=[500,1e3,1500,2e3,2500,3e3,3e3];function pe(e,t,n){let r=n.slug??n.bridgeSessionId??null;if(e&&r)return{kind:`navigate`,url:`${de}/${r}`};let i=n.reason||n.error||`status ${t}`;return{kind:`error`,sessionId:n.sessionId??null,reason:i}}function me(e){if(!e)return``;let t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`}):``}function he(e){let{businessName:n,cacheKey:r,role:i,userName:a,userAvatar:s,onSelectProjects:l,onSelectPeople:m,onSelectTasks:h,onSelectAgents:v,onCloseMobileDrawer:b,collapsed:x,selectedWhatsappId:C,onSelectWhatsappConversation:w}=e,T=ae(r),ee=o.productName,E=typeof a==`string`?a:a===null?`name unavailable`:n||ee,te=(E.trim().charAt(0)||`?`).toUpperCase(),[k,j]=(0,P.useState)(`sessions`),[M,re]=(0,P.useState)([]),[N,ie]=(0,P.useState)(!1),[F,I]=(0,P.useState)(null),[L,R]=(0,P.useState)(!1),[z,V]=(0,P.useState)(`file`),[H,U]=(0,P.useState)(null),[W,G]=(0,P.useState)(null),[q,ce]=(0,P.useState)([]),[J,ue]=(0,P.useState)(!1),[de,he]=(0,P.useState)(null),[ge,Y]=(0,P.useState)(!1),[X,ve]=(0,P.useState)(!1),[ye,be]=(0,P.useState)(!1),[xe,Se]=(0,P.useState)(null),[Ce,we]=(0,P.useState)(new Set),[Te,Ee]=(0,P.useState)(new Set),[De,Oe]=(0,P.useState)(new Set),[ke,Ae]=(0,P.useState)(new Set),[Z,je]=(0,P.useState)(!1),[Me,Ne]=(0,P.useState)([]),[Pe,Fe]=(0,P.useState)(!1),[Ie,Le]=(0,P.useState)(null),[Re,ze]=(0,P.useState)(`whatsapp`),Be=(0,P.useCallback)(e=>{if(b(),!r){console.error(`[admin-ui] artefact-download-blocked id=${e.id} reason=no-cache-key`),U({message:`Session not ready — try again`,failed:!0});return}if(!e.downloadPath){console.error(`[admin-ui] artefact-download-blocked id=${e.id} reason=not-downloadable`),U({message:`${e.name} can’t be downloaded`,failed:!0});return}console.info(`[admin-ui] artefact-download id=${e.id} root=${e.downloadRoot??`data`} path=${e.downloadPath}`),se(r,e.downloadPath,e.downloadRoot??`data`),U({message:`Downloading ${e.name}`,failed:!1})},[r,b]);(0,P.useEffect)(()=>{if(!H)return;let e=setTimeout(()=>U(null),2500);return()=>clearTimeout(e)},[H]);let Ve=(0,P.useCallback)(async()=>{if(r){R(!0),I(null);try{let e=await T(`/api/admin/sidebar-artefacts`);if(!e.ok)throw Error(`status ${e.status}`);re((await e.json()).artefacts??[]),ie(!0)}catch(e){let t=e instanceof Error?e.message:String(e);I(`Failed to load artefacts: ${t}`),console.error(`[admin-ui] sidebar-artefacts fetch failed: ${t}`)}finally{R(!1)}}},[r,T]),Q=(0,P.useCallback)(async()=>{if(!r)return null;Y(!0),he(null);try{let e=await T(`/api/admin/sidebar-sessions`);if(!e.ok)throw Error(`status ${e.status}`);let t=await e.json(),n=t.sessions??[];return ce(n),Se(t.accountId??null),ue(!0),n}catch(e){let t=e instanceof Error?e.message:String(e);return he(`Failed to load sessions: ${t}`),console.error(`[admin-ui] sidebar-sessions fetch failed: ${t}`),null}finally{Y(!1)}},[r,T]),He=(0,P.useCallback)(async()=>{if(r){Le(null);try{let e=await T(`/api/whatsapp-reader/conversations`);if(!e.ok)throw Error(`status ${e.status}`);Ne((await e.json()).conversations??[]),Fe(!0)}catch(e){let t=e instanceof Error?e.message:String(e);Le(`Couldn't load conversations: ${t}`),console.error(`[admin-ui] channel-convos fetch failed: ${t}`)}}},[r,T]);(0,P.useEffect)(()=>{!r||J||Q()},[r,J,Q]),(0,P.useEffect)(()=>{r&&He()},[r,He]);let Ue=(0,P.useMemo)(()=>{let e=new Map;for(let t of K)e.set(t,[]);for(let t of Me)e.get(t.channel)?.push(t);for(let t of K)console.info(`[admin-ui] sidebar-nav surface=${t} count=${e.get(t).length}`);return e},[Me]),We={whatsapp:`WhatsApp`,telegram:`Telegram`},Ge=()=>{w(null),j(`artefacts`),console.info(`[admin-ui] sidebar-nav surface=artefacts count=${N?M.length:0} collapsed=${x}`),Ve()},$=1.5,Ke=()=>{console.info(`[admin-ui] sidebar-refresh surface=artefacts`),Ve()},qe=()=>{w(null),j(`sessions`),console.info(`[admin-ui] sidebar-nav surface=sessions count=${J?q.length:0} collapsed=${x}`),J||Q()},Je=()=>{console.info(`[admin-ui] sidebar-refresh surface=sessions`),Q()},Ye=e=>{j(`whatsapp`),ze(e),console.info(`[admin-ui] sidebar-nav surface=${e} count=${Ue.get(e)?.length??0} collapsed=${x}`)},Xe=(0,P.useCallback)(async e=>{if(e.resumable===!1||Te.has(e.sessionId))return;Ee(t=>{let n=new Set(t);return n.add(e.sessionId),n});let t=window.open(``,`_blank`);try{let n=await T(`/api/admin/session-rc-spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:e.sessionId,name:e.title||e.sessionId})}),r=await n.json().catch(()=>({})),i=pe(n.ok,n.status,{...r,sessionId:r.sessionId??e.sessionId});console.info(`[admin-ui] sidebar-session-resume sessionId=${e.sessionId} status=${n.status} outcome=${i.kind} slug=${r.slug??r.bridgeSessionId??`none`}`),i.kind===`navigate`?(b(),t?t.location.href=i.url:window.open(i.url,`_blank`)):(t?.close(),console.error(`[admin-ui] sidebar-session-resume-failed sessionId=${e.sessionId} status=${n.status} reason=${i.reason}`),G(i))}catch(n){t?.close();let r=n instanceof Error?n.message:String(n);console.error(`[admin-ui] sidebar-session-resume-failed sessionId=${e.sessionId} error=${r}`),G({sessionId:e.sessionId,reason:r})}finally{Ee(t=>{let n=new Set(t);return n.delete(e.sessionId),n})}},[T,b,Te]),Ze=(0,P.useCallback)(async e=>{let t=e.slice(0,8);for(let n=1;n<=fe.length;n++){await new Promise(e=>setTimeout(e,fe[n-1]));let r=await Q();if(r&&r.some(t=>t.sessionId===e)){console.info(`[admin-ui] sidebar-new-session-converged sessionId=${t} via=retry attempts=${n}`);return}}console.error(`[admin-ui] sidebar-new-session-converge-timeout sessionId=${t}`)},[Q]),Qe=(0,P.useCallback)(async()=>{if(Z)return;je(!0);let e=window.open(``,`_blank`);try{let t=await T(`/api/admin/session-rc-spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({})}),n=await t.json().catch(()=>({})),r=pe(t.ok,t.status,n);console.info(`[admin-ui] sidebar-new-session-spawned status=${t.status} outcome=${r.kind} slug=${n.slug??n.bridgeSessionId??`none`}`),r.kind===`navigate`?(e?e.location.href=r.url:window.open(r.url,`_blank`),n.sessionId?Ze(n.sessionId):console.error(`[admin-ui] sidebar-new-session-converge-skipped reason=no-session-id`)):(e?.close(),console.error(`[admin-ui] sidebar-new-session-failed status=${t.status} reason=${r.reason}`),G(r))}catch(t){e?.close();let n=t instanceof Error?t.message:String(t);console.error(`[admin-ui] sidebar-new-session-failed error=${n}`),G({sessionId:null,reason:n})}finally{je(!1)}},[T,Z,Ze]),$e=(0,P.useCallback)(async(e,t)=>{if(e.stopPropagation(),!Ce.has(t.sessionId)){we(e=>{let n=new Set(e);return n.add(t.sessionId),n});try{let e=await T(`/api/admin/session-delete`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:t.sessionId})});if(!e.ok){let n=await e.json().catch(()=>({}));console.error(`[admin-ui] sidebar-session-delete-failed sessionId=${t.sessionId} status=${e.status} error=${n.error??`unknown`}`),U({message:`Delete failed: ${n.error??`status ${e.status}`}`,failed:!0});return}let n=await e.json();console.info(`[admin-ui] sidebar-session-delete sessionId=${t.sessionId} pidKilled=${n.pidKilled??`?`} deleted=${n.deleted??`?`}`),ce(e=>e.filter(e=>e.sessionId!==t.sessionId)),Q()}catch(e){let n=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-session-delete-failed sessionId=${t.sessionId} error=${n}`),U({message:`Delete failed: ${n}`,failed:!0})}finally{we(e=>{let n=new Set(e);return n.delete(t.sessionId),n})}}},[T,Ce,Q]),et=(0,P.useCallback)(async(e,t)=>{if(e.stopPropagation(),!De.has(t.sessionId)){Oe(e=>{let n=new Set(e);return n.add(t.sessionId),n});try{let e=await T(`/api/admin/session-stop`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:t.sessionId})});if(!e.ok){let n=await e.json().catch(()=>({}));console.error(`[admin-ui] sidebar-session-stop-failed sessionId=${t.sessionId} status=${e.status} error=${n.error??`unknown`}`),U({message:`Stop failed: ${n.error??`status ${e.status}`}`,failed:!0});return}console.info(`[admin-ui] sidebar-session-stop sessionId=${t.sessionId}`),Q()}catch(e){let n=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-session-stop-failed sessionId=${t.sessionId} error=${n}`),U({message:`Stop failed: ${n}`,failed:!0})}finally{Oe(e=>{let n=new Set(e);return n.delete(t.sessionId),n})}}},[T,De,Q]),tt=(0,P.useCallback)(async(e,t,n)=>{if(e.stopPropagation(),!ke.has(t.sessionId)){Ae(e=>{let n=new Set(e);return n.add(t.sessionId),n});try{let e=await T(`/api/admin/session-archive`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({sessionId:t.sessionId,mode:n})});if(!e.ok){let r=await e.json().catch(()=>({})),i=r.detail??r.error??`status ${e.status}`;console.error(`[admin-ui] sidebar-session-archive-failed sessionId=${t.sessionId} mode=${n} status=${e.status} error=${r.error??`unknown`}`),U({message:`${n===`archive`?`Archive`:`Unarchive`} failed: ${i}`,failed:!0});return}console.info(`[admin-ui] sidebar-session-archive sessionId=${t.sessionId} mode=${n}`),Q()}catch(e){let r=e instanceof Error?e.message:String(e);console.error(`[admin-ui] sidebar-session-archive-failed sessionId=${t.sessionId} mode=${n} error=${r}`),U({message:`${n===`archive`?`Archive`:`Unarchive`} failed: ${r}`,failed:!0})}finally{Ae(e=>{let n=new Set(e);return n.delete(t.sessionId),n})}}},[T,ke,Q]);return(0,B.jsxs)(`aside`,{className:`side`,children:[(0,B.jsx)(`div`,{className:`side-new-session-row`,children:(0,B.jsxs)(`button`,{type:`button`,className:`side-new-session`,onClick:Qe,disabled:Z,"aria-busy":Z,children:[(0,B.jsx)(D,{size:14}),(0,B.jsx)(`span`,{children:Z?`Spawning…`:`New session`})]})}),(0,B.jsxs)(`nav`,{className:`side-nav`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=people`),m(),b()},children:[(0,B.jsx)(A,{size:20,strokeWidth:$}),(0,B.jsx)(`span`,{className:`label`,children:`People`}),(0,B.jsx)(`span`,{className:`kbd`})]}),(0,B.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=agents`),v(),b()},children:[(0,B.jsx)(f,{size:20,strokeWidth:$}),(0,B.jsx)(`span`,{className:`label`,children:`Agents`}),(0,B.jsx)(`span`,{className:`kbd`})]}),(0,B.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=projects`),l(),b()},children:[(0,B.jsx)(p,{size:20,strokeWidth:$}),(0,B.jsx)(`span`,{className:`label`,children:`Projects`}),(0,B.jsx)(`span`,{className:`kbd`})]}),(0,B.jsxs)(`button`,{type:`button`,className:`nav-row`,onClick:()=>{console.info(`[admin-ui] sidebar-nav surface=tasks`),h(),b()},children:[(0,B.jsx)(S,{size:20,strokeWidth:$}),(0,B.jsx)(`span`,{className:`label`,children:`Tasks`}),(0,B.jsx)(`span`,{className:`kbd`})]}),(0,B.jsxs)(`button`,{type:`button`,className:`nav-row${k===`artefacts`?` active`:``}`,onClick:Ge,children:[(0,B.jsx)(t,{size:20,strokeWidth:$}),(0,B.jsx)(`span`,{className:`label`,children:`Artefacts`}),(0,B.jsx)(`span`,{className:`kbd`})]}),(0,B.jsxs)(`button`,{type:`button`,className:`nav-row${k===`sessions`?` active`:``}`,onClick:qe,children:[(0,B.jsx)(y,{size:20,strokeWidth:$}),(0,B.jsx)(`span`,{className:`label`,children:`Sessions`}),(0,B.jsx)(`span`,{className:`kbd`})]}),Pe&&K.filter(e=>Ue.get(e).length>0).map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`nav-row${k===`whatsapp`&&Re===e?` active`:``}`,onClick:()=>Ye(e),children:[(0,B.jsx)(oe,{channel:e,size:16}),(0,B.jsx)(`span`,{className:`label`,children:We[e]}),(0,B.jsx)(`span`,{className:`kbd`})]},e)),Ie&&(0,B.jsx)(`div`,{className:`nav-row`,style:{color:`var(--text-tertiary)`,cursor:`default`},"aria-disabled":`true`,children:(0,B.jsx)(`span`,{className:`label`,children:Ie})})]}),k===`artefacts`&&(0,B.jsxs)(`div`,{className:`side-list`,children:[(0,B.jsxs)(`div`,{className:`group-head`,children:[(0,B.jsx)(`span`,{children:`Artefacts`}),(0,B.jsxs)(`span`,{className:`group-head-meta`,children:[(0,B.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh artefacts`,"aria-label":`Refresh artefacts`,onClick:Ke,disabled:L,children:(0,B.jsx)(O,{size:12,className:L?`spinning`:void 0})}),(0,B.jsx)(`span`,{children:L?`…`:String(M.length)})]})]}),F&&(0,B.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:F}),N&&!F&&M.length>0&&(()=>{let e=M.filter(e=>e.kind===`agent-template`).length,t=M.length-e;return(0,B.jsx)(`div`,{className:`artefact-filter-chips`,children:[{key:`all`,label:`All`,count:M.length},{key:`agent`,label:`Agents`,count:e},{key:`file`,label:`Files`,count:t}].map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`artefact-filter-chip${z===e.key?` active`:``}`,onClick:()=>V(e.key),disabled:e.count===0&&e.key!==`all`,children:[e.label,(0,B.jsx)(`span`,{className:`artefact-filter-chip-count`,children:e.count})]},e.key))})})(),N&&!F&&M.length===0&&(0,B.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No artefacts yet`}),M.filter(e=>z===`all`?!0:z===`agent`?e.kind===`agent-template`:e.kind!==`agent-template`).map(e=>{let n=e.kind===`agent-template`,r=n?f:t,i=me(e.updatedAt),a=e.downloadPath!==null;return(0,B.jsxs)(`button`,{type:`button`,className:`conv`,onClick:()=>Be(e),disabled:!a,style:a?void 0:{cursor:`default`},title:a?`Download ${e.name}`:`${e.name} can’t be downloaded`,children:[(0,B.jsx)(r,{size:14,className:`conv-icon`,"data-kind":n?`agent`:`file`,"aria-label":n?`agent template`:`file`}),(0,B.jsxs)(`span`,{className:`conv-stack`,children:[(0,B.jsx)(`span`,{className:`conv-name-line`,children:(0,B.jsx)(`span`,{className:`conv-name`,children:e.name})}),i&&(0,B.jsx)(`span`,{className:`conv-timestamp`,children:i})]}),a&&(0,B.jsx)(g,{size:12,className:`conv-rc-icon`,"aria-hidden":`true`})]},e.id)})]}),k===`sessions`&&(()=>{let e=q.filter(e=>X?!0:!e.isSubagent).filter(e=>ye?!0:!e.archived),t=q.some(e=>e.isSubagent),n=q.some(e=>e.archived);return(0,B.jsxs)(`div`,{className:`side-list`,children:[(0,B.jsxs)(`div`,{className:`group-head`,children:[(0,B.jsx)(`span`,{children:`Sessions`}),(0,B.jsxs)(`span`,{className:`group-head-meta`,children:[(0,B.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh sessions`,"aria-label":`Refresh sessions`,onClick:Je,disabled:ge,children:(0,B.jsx)(O,{size:12,className:ge?`spinning`:void 0})}),(0,B.jsx)(`span`,{children:ge?`…`:String(e.length)})]})]}),xe&&(0,B.jsx)(`div`,{className:`side-account-id`,title:`This install's accountId. The first 8 characters match the truncated UUID label on the live Remote Control daemon entry in claude.ai/code.`,children:(0,B.jsx)(`code`,{children:xe})}),(t||n)&&(0,B.jsxs)(`div`,{className:`artefact-filter-chips`,children:[t&&(0,B.jsx)(`button`,{type:`button`,className:`artefact-filter-chip${X?` active`:``}`,onClick:()=>ve(e=>!e),title:X?`Hide subagent sessions`:`Show subagent sessions`,children:`Subagents`}),n&&(0,B.jsx)(`button`,{type:`button`,className:`artefact-filter-chip${ye?` active`:``}`,onClick:()=>be(e=>!e),title:ye?`Hide archived sessions`:`Show archived sessions`,children:`Archived`})]}),de&&(0,B.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:de}),J&&!de&&e.length===0&&(0,B.jsx)(`div`,{className:`conv`,style:{color:`var(--text-tertiary)`,cursor:`default`},children:`No sessions yet`}),e.map(e=>{let t=me(e.startedAt),n=Te.has(e.sessionId),r=Ce.has(e.sessionId),i=De.has(e.sessionId),a=ke.has(e.sessionId);return(0,B.jsxs)(`div`,{className:`conv conv-with-actions`,children:[(0,B.jsxs)(`div`,{className:`conv-main-static`,children:[(0,B.jsx)(`span`,{className:`conv-live-dot`,"data-live":e.live?`1`:`0`,"aria-label":e.live?`live session`:`ended session`}),(0,B.jsxs)(`span`,{className:`conv-stack`,children:[(0,B.jsx)(`span`,{className:`conv-name-line`,children:(0,B.jsx)(`span`,{className:`conv-name`,title:e.title,children:e.title})}),(0,B.jsxs)(`span`,{className:`conv-timestamp`,children:[(0,B.jsx)(`code`,{className:`conv-session-id`,title:`First 8 characters of this session's id — distinguishes rows with identical auto-titles. The resume/delete buttons act on the full id.`,children:e.sessionId.slice(0,8)}),t&&(0,B.jsxs)(`span`,{children:[` · `,t]})]})]})]}),(0,B.jsxs)(`div`,{className:`conv-actions`,children:[e.resumable===!1?(0,B.jsx)(`span`,{className:`conv-ephemeral`,title:`Public webchat session — ephemeral, not resumable`,"aria-label":`Ephemeral public session (not resumable)`,children:(0,B.jsx)(y,{size:12})}):(0,B.jsx)(`button`,{type:`button`,className:`conv-action`,onClick:()=>{Xe(e)},disabled:n||r||i||a,"aria-busy":n,"aria-label":`Resume session ${e.title} in claude.ai/code`,title:`Resume in a fresh local Remote Control PTY`,children:(0,B.jsx)(_,{size:12})}),e.live?(0,B.jsx)(`button`,{type:`button`,className:`conv-action`,onClick:t=>{et(t,e)},disabled:n||r||i||a,"aria-busy":i,"aria-label":`Stop session ${e.title}`,title:`Stop session process (keeps the conversation, can resume later)`,children:(0,B.jsx)(ne,{size:12})}):null,e.archived?(0,B.jsx)(`button`,{type:`button`,className:`conv-action`,onClick:t=>{tt(t,e,`unarchive`)},disabled:n||r||i||a,"aria-busy":a,"aria-label":`Unarchive session ${e.title}`,title:`Unarchive (move back to the active list)`,children:(0,B.jsx)(u,{size:12})}):(0,B.jsx)(`button`,{type:`button`,className:`conv-action`,onClick:t=>{tt(t,e,`archive`)},disabled:n||r||i||a,"aria-busy":a,"aria-label":`Archive session ${e.title}`,title:`Archive (hide from the list, keeps the conversation resumable)`,children:(0,B.jsx)(d,{size:12})}),(0,B.jsx)(`button`,{type:`button`,className:`conv-action conv-action-danger`,onClick:t=>{$e(t,e)},disabled:n||r||i||a,"aria-busy":r,"aria-label":`Delete session ${e.title}`,title:`Delete session (stops the process, removes the conversation)`,children:(0,B.jsx)(c,{size:12})})]})]},e.sessionId)})]})})(),k===`whatsapp`&&(0,B.jsxs)(`div`,{className:`side-list`,children:[(0,B.jsxs)(`div`,{className:`group-head`,children:[(0,B.jsx)(`span`,{children:We[Re]}),(0,B.jsxs)(`span`,{className:`group-head-meta`,children:[(0,B.jsx)(`button`,{type:`button`,className:`group-head-refresh`,title:`Refresh conversations`,"aria-label":`Refresh conversations`,onClick:()=>{He()},children:(0,B.jsx)(O,{size:12})}),(0,B.jsx)(`span`,{children:String(Ue.get(Re).length)})]})]}),Ue.get(Re).map(e=>{let t=me(e.lastMessageAt);return(0,B.jsxs)(`button`,{type:`button`,className:`conv${C===e.sessionId?` active`:``}`,onClick:()=>{w(e),b()},title:e.title,children:[(0,B.jsx)(oe,{channel:e.channel,size:14}),(0,B.jsxs)(`span`,{className:`conv-stack`,children:[(0,B.jsx)(`span`,{className:`conv-name-line`,children:(0,B.jsx)(`span`,{className:`conv-name`,children:e.operatorName??e.whatsappName??e.senderId??e.title})}),t&&(0,B.jsx)(`span`,{className:`conv-timestamp`,children:t})]})]},e.sessionId)})]}),(0,B.jsx)(_e,{}),(0,B.jsxs)(`div`,{className:`side-foot`,children:[(0,B.jsx)(`div`,{className:`avatar`,children:s?(0,B.jsx)(`img`,{src:s,alt:E}):te}),(0,B.jsxs)(`div`,{className:`who`,children:[(0,B.jsx)(`span`,{className:`name`,children:E}),(0,B.jsx)(`span`,{className:`role`,children:i??`operator`})]})]}),H&&(0,B.jsx)(`div`,{className:`copy-toast${H.failed?` copy-toast-failed`:``}`,role:`status`,children:H.message}),(0,B.jsx)(le,{error:W,onClose:()=>G(null)})]})}var ge=5e3;function _e(){let[e,t]=(0,P.useState)(null);if((0,P.useEffect)(()=>{let e=!1,n=null;async function r(){try{let n=await fetch(`/api/admin/system-stats`);if(!n.ok){console.error(`[admin-ui] system-stats-fetch-failed status=${n.status}`);return}let r=await n.json();e||t(r)}catch(e){console.error(`[admin-ui] system-stats-fetch-failed reason=${e instanceof Error?e.message:String(e)}`)}}function i(){n===null&&(r(),n=setInterval(()=>{r()},ge))}function a(){n!==null&&(clearInterval(n),n=null)}function o(){document.hidden?a():i()}return document.hidden||i(),document.addEventListener(`visibilitychange`,o),()=>{e=!0,a(),document.removeEventListener(`visibilitychange`,o)}},[]),!e||e.platform===`darwin`)return null;let n=e.cpuPct,r=e.memUsedPct,i=n!==null&&n>=.9,a=n!==null&&n>=.98,o=r!==null&&r>=.9,s=r!==null&&r>=.98,c=i||o,l=a||s,u=e=>e===null?`—`:`${Math.round(e*100)}%`,d=e=>{if(e===null)return{width:`0%`,background:`var(--text-tertiary)`};let t=Math.min(1,Math.max(0,e)),n=Math.round(140*(1-t));return{width:`${Math.round(t*100)}%`,background:`hsl(${n}, 65%, 45%)`}},f=[`system-stats`];return c&&f.push(`system-stats--warn`),l&&f.push(`system-stats--crit`),(0,B.jsxs)(`div`,{className:f.join(` `),role:`status`,"aria-label":`host CPU and RAM`,children:[(0,B.jsxs)(`div`,{className:`system-stats__metric`,children:[(0,B.jsxs)(`span`,{className:i?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`CPU `,u(n)]}),(0,B.jsx)(`div`,{className:`system-stats__bar`,children:(0,B.jsx)(`div`,{className:`system-stats__bar-fill`,style:d(n)})})]}),(0,B.jsxs)(`div`,{className:`system-stats__metric`,children:[(0,B.jsxs)(`span`,{className:o?`system-stats__fig system-stats__fig--warn`:`system-stats__fig`,children:[`RAM `,u(r)]}),(0,B.jsx)(`div`,{className:`system-stats__bar`,children:(0,B.jsx)(`div`,{className:`system-stats__bar-fill`,style:d(r)})})]})]})}var Y=`admin-sidebar-collapsed`,X=`admin-sidebar-drawer-open`;function ve(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(Y)===`1`}catch{return!1}}function ye(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(Y,`1`):window.sessionStorage.removeItem(Y)}catch{}}function be(){if(typeof window>`u`)return!1;try{return window.sessionStorage.getItem(X)===`1`}catch{return!1}}function xe(e){if(!(typeof window>`u`))try{e?window.sessionStorage.setItem(X,`1`):window.sessionStorage.removeItem(X)}catch{}}var Se=720;function Ce(e,t){return e===`/`?{via:`in-place`}:{via:`navigate`,href:`/?wa=${encodeURIComponent(t.sessionId)}&projectDir=${encodeURIComponent(t.projectDir)}`}}function we(e,t){if(e!==`/`)return null;let n=new URLSearchParams(t),r=n.get(`wa`),i=n.get(`projectDir`);return!r||!i?null:{sessionId:r,projectDir:i,title:``,senderId:null,startedAt:``,channel:`whatsapp`,operatorName:null,whatsappName:null,lastMessageAt:null}}function Te(e){let{cacheKey:t,businessName:n,onLogout:r,onDisconnect:i,disconnecting:a,userName:o,userAvatar:s,role:c,children:l,footer:u}=e,[d,f]=(0,P.useState)(()=>ve()),[p,m]=(0,P.useState)(()=>be()),[h,g]=(0,P.useState)(()=>typeof window<`u`&&window.matchMedia(`(max-width: ${Se}px)`).matches),[_,v]=(0,P.useState)(null);(0,P.useEffect)(()=>{if(typeof window>`u`)return;let e=window.matchMedia(`(max-width: ${Se}px)`),t=e=>g(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let y=(0,P.useCallback)(e=>{ye(e),f(e)},[]),b=(0,P.useCallback)(e=>{xe(e),m(e)},[]);(0,P.useEffect)(()=>{if(typeof window>`u`)return;let e=window.location?.pathname??``;console.info(`[admin-ui] shell-mount route=${e} collapsed=${d} drawer=${p}`)},[]),(0,P.useEffect)(()=>{if(typeof window>`u`)return;let e=we(window.location.pathname,window.location.search);e&&(v(e),console.info(`[admin-ui] wa-hydrate route=/ sessionId=${e.sessionId.slice(0,8)}`),window.history.replaceState(null,``,`/`))},[]);let x=(0,P.useCallback)(e=>{if(e===null){v(null);return}let t=typeof window<`u`?window.location.pathname:`/`,n=Ce(t,e);console.info(`[admin-ui] wa-open route=${t} via=${n.via} sessionId=${e.sessionId.slice(0,8)}`),n.via===`in-place`?v(e):window.location.href=n.href},[]),S=h?p:!d,C=(0,P.useCallback)(()=>{if(!(typeof window>`u`))if(window.matchMedia(`(max-width: ${Se}px)`).matches){let e=p;console.info(`[admin-ui] header-sidebar-toggle from=${e?`open`:`closed`} mode=drawer`),b(!e)}else{let e=d;console.info(`[admin-ui] header-sidebar-toggle from=${e?`closed`:`open`} mode=collapse`),y(!e)}},[d,p,y,b]),w=(0,P.useCallback)(e=>{console.info(`[admin-ui] header-menu-nav target=${e}`);let t=e===`dashboard`?`/`:e===`data`?`/data`:e===`graph`?`/graph`:e===`chat`?`/chat`:`/browser`;window.location.href=t},[]),T={collapsed:d,mobileDrawerOpen:p,sidebarOpen:S,onToggleSidebar:C,setMobileDrawerOpen:b,selectedWhatsapp:_,onClearWhatsapp:()=>v(null)};return(0,B.jsxs)(`div`,{className:`admin-shell admin-page admin-shell-root`,children:[(0,B.jsx)(W,{businessName:n,onNavigate:w,onToggleSidebar:C,sidebarOpen:S,onLogout:r,onDisconnect:i,disconnecting:a}),(0,B.jsxs)(`div`,{className:`platform${p?` menu-open`:``}${d?` sidebar-collapsed`:``}`,"data-artefact":`closed`,children:[(0,B.jsx)(he,{businessName:n,cacheKey:t,role:c??null,userName:o,userAvatar:s??null,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:()=>b(!1),collapsed:d,mobileDrawerOpen:p,selectedWhatsappId:_?.sessionId??null,onSelectWhatsappConversation:x}),typeof l==`function`?l(T):l]}),p&&(0,B.jsx)(`div`,{className:`sidebar-backdrop menu-open`,"aria-hidden":`true`,onClick:()=>b(!1)}),u]})}export{ae as a,te as c,C as d,v as f,l as h,H as i,O as l,g as m,ue as n,z as o,_ as p,se as r,j as s,Te as t,D as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as e}from"./useSelectionMode-
|
|
1
|
+
import{l as e}from"./useSelectionMode-CJ2UADOe.js";var t=e();function n({checked:e,onChange:n,label:r,disabled:i}){return(0,t.jsxs)(`label`,{className:`maxy-checkbox${i?` maxy-checkbox--disabled`:``}`,children:[(0,t.jsx)(`input`,{type:`checkbox`,checked:e,onChange:e=>n(e.target.checked),disabled:i}),(0,t.jsx)(`span`,{className:`maxy-checkbox__box`,children:`✱`}),r&&(0,t.jsx)(`span`,{className:`maxy-checkbox__label`,children:r})]})}export{n as t};
|
package/payload/server/public/assets/{SidebarSplitter-CidskiAr.js → SidebarSplitter-D0mErwLL.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CWOGyPgy.js";import{l as t,m as n}from"./useSelectionMode-
|
|
1
|
+
import{o as e}from"./chunk-CWOGyPgy.js";import{l as t,m as n}from"./useSelectionMode-CJ2UADOe.js";var r=e(n(),1),i=t(),a=`maxy-shell-side-px`;function o(){if(typeof window>`u`)return 0;let e=document.querySelector(`.platform > .artefact`)?.getBoundingClientRect();return e&&e.width>0?Math.round(e.width):0}function s(e){if(typeof window>`u`)return e;let t=window.innerWidth,n=Math.max(248,t-480-o());return Math.min(Math.max(e,248),n)}function c(){if(typeof window>`u`)return 264;try{let e=window.localStorage.getItem(a);if(!e)return 264;let t=parseInt(e,10);if(Number.isFinite(t)&&t>=248)return s(t)}catch{}return 264}function l({targetSelector:e=`.platform`}){let t=(0,r.useRef)(null),[n,o]=(0,r.useState)(()=>c()),l=(0,r.useRef)(n);(0,r.useEffect)(()=>{let t=document.querySelector(e);!t||!(t instanceof HTMLElement)||(t.style.setProperty(`--side-px`,`${n}px`),l.current=n)},[n,e]);let u=(0,r.useCallback)(()=>{o(e=>{let t=s(e);return t===e?e:t})},[]);(0,r.useEffect)(()=>{u(),window.addEventListener(`resize`,u);let t=document.querySelector(e),n=null;return t instanceof HTMLElement&&(n=new MutationObserver(u),n.observe(t,{attributes:!0,attributeFilter:[`data-artefact`,`class`]})),()=>{window.removeEventListener(`resize`,u),n?.disconnect()}},[u,e]);let d=e=>{e.preventDefault();let n=t.current;if(!n)return;n.setPointerCapture(e.pointerId),n.classList.add(`dragging`);let r=!1,i=e=>{r=!0,o(s(Math.round(e.clientX)))},c=()=>{if(n.releasePointerCapture(e.pointerId),n.classList.remove(`dragging`),window.removeEventListener(`pointermove`,i),window.removeEventListener(`pointerup`,c),!r)return;let t=l.current;try{window.localStorage.setItem(a,String(t))}catch{}console.info(`[admin-ui] sidebar-resize px=${t}`)};window.addEventListener(`pointermove`,i),window.addEventListener(`pointerup`,c)},f=()=>{let e=s(264);o(e);try{window.localStorage.removeItem(a)}catch{}console.info(`[admin-ui] sidebar-resize px=${e}`)};return(0,i.jsx)(`div`,{ref:t,className:`side-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,onPointerDown:d,onDoubleClick:f})}export{l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CWOGyPgy.js";import{l as t,m as n}from"./useSelectionMode-
|
|
1
|
+
import{o as e}from"./chunk-CWOGyPgy.js";import{l as t,m as n}from"./useSelectionMode-CJ2UADOe.js";var r=e(n(),1);function i(e,t,n){let[i,a]=(0,r.useState)([]),[o,s]=(0,r.useState)(`open`);return(0,r.useEffect)(()=>{a([]),s(`open`);let r=`/api/whatsapp-reader/stream?sessionId=${encodeURIComponent(e)}&projectDir=${encodeURIComponent(t)}&session_key=${encodeURIComponent(n)}`,i=new EventSource(r);return i.onopen=()=>{console.info(`[admin-ui] wa-stream onopen sessionId=${e}`),s(`open`)},i.onmessage=e=>{try{a(t=>[...t,JSON.parse(e.data)])}catch{}},i.onerror=()=>{i.readyState===2&&(console.error(`[admin-ui] wa-stream onerror readyState=${i.readyState}`),s(`error`))},()=>i.close()},[e,t,n]),{turns:i,status:o}}var a=e=>{if(!e)return 1/0;let t=new Date(e).getTime();return Number.isNaN(t)?1/0:t};function o(e,t){let n=[],r=0;return e.forEach((e,t)=>n.push({sort:a(e.ts),sub:1,ins:r++,item:{kind:`turn`,turn:e,idx:t}})),t.forEach(e=>n.push({sort:a(e.ts),sub:0,ins:r++,item:{kind:`directive`,entry:e}})),n.sort((e,t)=>e.sort===t.sort?e.sort===1/0?e.ins-t.ins:e.sub-t.sub||e.ins-t.ins:e.sort<t.sort?-1:1).map(e=>e.item)}function s(e,t){let[n,i]=(0,r.useState)([]);return(0,r.useEffect)(()=>{if(typeof fetch!=`function`)return;let n=!0,r=`/api/whatsapp-reader/directives?sessionId=${encodeURIComponent(e)}&session_key=${encodeURIComponent(t)}`;return fetch(r).then(e=>e.ok?e.json():{entries:[]}).then(e=>{n&&i(Array.isArray(e.entries)?e.entries:[])}).catch(()=>{n&&i([])}),()=>{n=!1}},[e,t]),n}var c=t();function l(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`})}function u(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function d({label:e,ts:t}){return(0,c.jsxs)(`div`,{className:`wa-turn-head`,children:[(0,c.jsx)(`span`,{className:`wa-who`,children:e}),(0,c.jsx)(`time`,{className:`wa-time`,children:l(t)})]})}function f({turn:e}){let[t,n]=(0,r.useState)(!1),i=e.kind===`tool-result`,a=i?`wa-turn wa-turn-result${e.isError?` is-error`:``}`:`wa-turn wa-turn-tool`,o=i?e.isError?`result (error)`:`result`:`↳ ${e.name}`,s=i?e.text:JSON.stringify(e.input,null,2);return(0,c.jsxs)(`div`,{className:a,children:[(0,c.jsxs)(`button`,{type:`button`,className:`wa-tool-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,c.jsx)(`span`,{className:`wa-chevron`,children:t?`▾`:`▸`}),(0,c.jsx)(`span`,{className:`wa-who`,children:o}),(0,c.jsx)(`time`,{className:`wa-time`,children:l(e.ts)})]}),t&&(0,c.jsx)(`pre`,{className:`wa-code`,children:s})]})}function p({entry:e,sessionId:t,sessionKey:n}){let[i,a]=(0,r.useState)(!1),[o,s]=(0,r.useState)(null),u=()=>{let r=!i;if(a(r),r&&o===null&&typeof fetch==`function`){let r=`/api/whatsapp-reader/directive?sessionId=${encodeURIComponent(t)}&name=${encodeURIComponent(e.name)}&session_key=${encodeURIComponent(n)}`;fetch(r).then(e=>e.ok?e.text():`(directive unavailable)`).then(s).catch(()=>s(`(directive unavailable)`))}};return(0,c.jsxs)(`div`,{className:`wa-turn wa-turn-directive`,children:[(0,c.jsxs)(`button`,{type:`button`,className:`wa-tool-toggle`,"aria-expanded":i,onClick:u,children:[(0,c.jsx)(`span`,{className:`wa-chevron`,children:i?`▾`:`▸`}),(0,c.jsxs)(`span`,{className:`wa-who`,children:[`⚙ directive injected (`,e.len,` B)`]}),(0,c.jsx)(`time`,{className:`wa-time`,children:l(e.ts)})]}),i&&(0,c.jsx)(`pre`,{className:`wa-code`,children:o??`Loading…`})]})}function m(e,t){switch(e.kind){case`operator-inbound`:return(0,c.jsxs)(`div`,{className:`wa-turn wa-turn-in`,children:[(0,c.jsx)(d,{label:`Operator`,ts:e.ts}),(0,c.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`operator-typed`:return(0,c.jsxs)(`div`,{className:`wa-turn wa-turn-in wa-turn-typed`,children:[(0,c.jsx)(d,{label:`Operator (web)`,ts:e.ts}),(0,c.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-text`:return(0,c.jsxs)(`div`,{className:`wa-turn wa-turn-think`,children:[(0,c.jsx)(d,{label:`Agent`,ts:e.ts}),(0,c.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-reply`:return(0,c.jsxs)(`div`,{className:`wa-turn wa-turn-out`,children:[(0,c.jsx)(d,{label:`Agent`,ts:e.ts}),(0,c.jsx)(`p`,{className:`wa-body`,children:e.text})]},t);case`agent-reply-document`:return(0,c.jsxs)(`div`,{className:`wa-turn wa-turn-out`,children:[(0,c.jsx)(d,{label:`Agent`,ts:e.ts}),(0,c.jsxs)(`p`,{className:`wa-doc`,children:[`📎 sent document(s): `,e.files.map(u).join(`, `)]}),e.caption&&(0,c.jsx)(`p`,{className:`wa-body`,children:e.caption})]},t);case`tool-call`:case`tool-result`:return(0,c.jsx)(f,{turn:e},t)}}function h(e,t,n){return e.map((e,r)=>e.kind===`turn`?m(e.turn,r):(0,c.jsx)(p,{entry:e.entry,sessionId:t,sessionKey:n},r))}function g({sessionId:e,projectDir:t,sessionKey:n}){let{turns:a,status:l}=i(e,t,n),u=o(a,s(e,n)),d=(0,r.useRef)(null),f=(0,r.useRef)(!0),[p,m]=(0,r.useState)(!0),g=e=>{let t=e.scrollHeight-e.scrollTop-e.clientHeight<=32;f.current=t,m(e=>e===t?e:t)};return(0,r.useLayoutEffect)(()=>{let e=d.current;e&&f.current&&(e.scrollTop=e.scrollHeight)},[a]),(0,c.jsxs)(`div`,{className:`wa-reader`,children:[(0,c.jsx)(`div`,{className:`wa-reader-thread`,ref:d,onScroll:()=>{let e=d.current;e&&g(e)},children:(0,c.jsxs)(`div`,{className:`wa-thread-scroll`,children:[l===`error`&&(0,c.jsx)(`div`,{className:`wa-reader-error`,children:`Stream disconnected.`}),a.length===0&&l===`open`&&(0,c.jsx)(`div`,{className:`wa-reader-placeholder`,children:`No messages in this conversation yet.`}),h(u,e,n)]})}),!p&&(0,c.jsx)(`button`,{type:`button`,className:`wa-jump`,onClick:()=>{let e=d.current;e&&(e.scrollTop=e.scrollHeight,f.current=!0,m(!0))},"aria-label":`Jump to latest message`,title:`Jump to latest message`,children:`↓`})]})}export{g as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CWOGyPgy.js";import{c as t,l as n,m as r,p as i,r as a,s as o}from"./useSelectionMode-BBvWzgtz.js";import{f as s,g as c,i as l,n as u,t as d}from"./AdminShell-BgPlhiCM.js";import{t as f}from"./Checkbox-DWx2NcU9.js";import{t as p}from"./SidebarSplitter-CidskiAr.js";import{t as m}from"./Transcript-iuM5b4JT.js";var h=i(),g=e(r(),1);new Set(`image/jpeg,image/png,image/gif,image/webp,application/pdf,text/plain,text/markdown,text/csv,text/html,text/calendar,application/zip,application/x-zip-compressed,audio/ogg,audio/opus,audio/mp4,audio/mpeg,audio/webm,audio/wav,.opus,.ogg,.m4a,.mp3,.wav,.webm`.split(`,`).filter(e=>!e.startsWith(`.`)));function _(e){switch(e){case`expanded`:return!0;case`collapsed`:return!1;default:return}}var v=`admin-landing-redirected`,y=`/graph`;function b(e){return e.appState===`chat`&&!e.alreadyRedirected}function x(){let[e,t]=(0,g.useState)(`loading`),[n,r]=(0,g.useState)(``),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(``),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(!1),[p,m]=(0,g.useState)(!1),[h,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)(!1),[w,T]=(0,g.useState)(null),[E,D]=(0,g.useState)(null),[O,k]=(0,g.useState)(void 0),[A,j]=(0,g.useState)(null),[M,N]=(0,g.useState)(void 0),[ee,P]=(0,g.useState)(null),[F,I]=(0,g.useState)(null),[L,R]=(0,g.useState)([]),[z,B]=(0,g.useState)(!1),[V,H]=(0,g.useState)(void 0),U=(0,g.useRef)(void 0),[W,G]=(0,g.useState)(!1);(0,g.useEffect)(()=>{typeof window>`u`||fetch(`/api/remote-auth/status`).then(e=>e.ok?e.json():null).then(e=>{e?.configured&&G(!0)}).catch(()=>{})},[]);let K=(0,g.useRef)(null),q=(0,g.useRef)(null);(0,g.useEffect)(()=>{async function e(){let e=null;try{e=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!e)return!1;try{let n=await fetch(`/api/admin/session?session_key=${encodeURIComponent(e)}`);if(n.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}return!1}if(!n.ok)return!1;let r=await n.json();T(r.session_key),I(r.sessionId??null),k(r.businessName),j(r.role??null),N(r.userName===void 0?null:r.userName),P(r.avatar??null);let i=_(r.thinkingView);return U.current=i,H(i),t(`chat`),!0}catch(e){return console.error(`[admin] session restore failed:`,e),!1}}async function n(r=2){try{let i=await fetch(`/api/health`);if(!i.ok){if(r>0)return await new Promise(e=>setTimeout(e,1500)),n(r-1);console.error(`[admin] health check returned ${i.status} after retries`),t(`set-pin`);return}let a=await i.json();if(!a.pin_configured){t(`set-pin`);return}if(!a.claude_authenticated){t(`connect-claude`);return}if(await e())return;t(`enter-pin`)}catch(e){if(r>0)return await new Promise(e=>setTimeout(e,1500)),n(r-1);console.error(`[admin] health check failed:`,e),t(`set-pin`)}}n()},[]),(0,g.useEffect)(()=>{e===`chat`&&fetch(`/api/admin/claude-info`).then(e=>{if(e.ok)return e.json()}).then(e=>{e&&D(e)}).catch(()=>{})},[e]),(0,g.useEffect)(()=>{if(typeof window>`u`)return;let t=!1;try{t=sessionStorage.getItem(v)===`1`}catch{}if(b({appState:e,alreadyRedirected:t})){try{sessionStorage.setItem(v,`1`)}catch{}console.info(`[admin-ui] landing-redirect target=${y}`),window.location.replace(y)}},[e]);let J=(0,g.useRef)(null);(0,g.useEffect)(()=>{if(e!==`chat`)return;let n=setInterval(async()=>{try{let e=await fetch(`/api/health`);if(e.ok){let n=await e.json();if(n.auth_status===`dead`||n.auth_status===`missing`){t(`connect-claude`);return}}}catch{}if(w)try{let e=await fetch(`/api/admin/session?session_key=${encodeURIComponent(w)}`);if(e.status!==401)return;let t=(await e.clone().json().catch(()=>null))?.code??`unknown-401`;console.warn(`[admin-auth] outcome=heartbeat-detected-expiry code=${t}`),J.current?.()}catch{}},300*1e3);return()=>clearInterval(n)},[e,w]),(0,g.useEffect)(()=>{e===`connect-claude`&&fetch(`/api/health`).then(e=>e.ok?e.json():null).then(e=>{e?.claude_authenticated&&t(`enter-pin`)}).catch(()=>{})},[e]);async function Y(e,n){f(!0);try{let i=await fetch(`/api/admin/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pin:e,...n?{accountId:n}:{}})});if(!i.ok){s((await i.json().catch(()=>({}))).error||`Invalid PIN`);return}let a=await i.json();if(a.accounts&&!a.session_key){console.log(`[admin] account picker shown: userId=${a.userId} accountCount=${a.accounts.length}`),R(a.accounts),t(`account-picker`);return}T(a.session_key),I(a.sessionId??null),k(a.businessName),j(a.role??null),N(a.userName===void 0?null:a.userName),P(a.avatar??null);let o=_(a.thinkingView);if(U.current=o,H(o),n)try{sessionStorage.setItem(`maxy-account-id`,n)}catch{}try{sessionStorage.setItem(`maxy-admin-session-key`,a.session_key)}catch{}r(``),t(`chat`)}catch(e){console.error(`[admin] connection error:`,e),s(`Could not connect.`)}finally{f(!1),B(!1)}}let X=(0,g.useCallback)(async e=>{if(e.preventDefault(),d)return;s(``);let a=i.trim();if(!a){s(`Please enter your name.`);return}if(n.length<4){s(`PIN must be at least 4 characters.`);return}let o=n;f(!0);try{let e=await fetch(`/api/onboarding/set-pin`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pin:o,name:a})});if(!e.ok){let n=await e.json().catch(()=>({}));if(e.status===409){console.log(`[admin] PIN already configured — re-checking health`);try{let e=await fetch(`/api/health`);if(e.ok){let r=await e.json();r.pin_configured&&r.claude_authenticated?t(`enter-pin`):r.pin_configured?t(`connect-claude`):s(n.error||`Failed to set PIN.`)}else t(`enter-pin`)}catch{t(`enter-pin`)}return}s(n.error||`Failed to set PIN.`);return}let n=await fetch(`/api/health`);if((n.ok?await n.json():null)?.claude_authenticated){await Y(o);return}r(``),t(`connect-claude`)}catch(e){console.error(`[admin] connection error:`,e),s(`Could not connect.`)}finally{f(!1)}},[n,d,i]),Z=(0,g.useCallback)(async e=>{e.preventDefault(),s(``),await Y(n)},[n]),Q=(0,g.useCallback)(async()=>{C(!0);try{if(!await c())return console.warn(`[admin-ui] claude-disconnect not verified — credentials may persist; staying put`),!1;T(null),j(null),N(void 0),P(null);try{sessionStorage.removeItem(`maxy-admin-session-key`),sessionStorage.removeItem(`maxy-account-id`),sessionStorage.removeItem(v)}catch{}return t(`connect-claude`),!0}finally{C(!1)}},[]),$=(0,g.useCallback)(()=>{T(null),j(null),N(void 0),P(null);try{sessionStorage.removeItem(`maxy-admin-session-key`),sessionStorage.removeItem(`maxy-account-id`),sessionStorage.removeItem(v)}catch{}r(``),s(``),t(`enter-pin`)},[]);return(0,g.useEffect)(()=>{J.current=$},[$]),{appState:e,setAppState:t,pin:n,setPin:r,operatorName:i,setOperatorName:a,pinError:o,setPinError:s,showPin:l,setShowPin:u,pinLoading:d,authPolling:p,setAuthPolling:m,authLoading:h,setAuthLoading:x,disconnecting:S,cacheKey:w,setCacheKey:T,claudeInfo:E,setClaudeInfo:D,businessName:O,role:A,userName:M,userAvatar:ee,sessionId:F,setSessionId:I,accounts:L,accountPickerLoading:z,expandAll:V,setExpandAll:H,expandAllDefaultRef:U,remoteAuthEnabled:W,pinInputRef:K,setPinFormRef:q,handleSetPin:X,handleLogin:Z,handleAccountSelect:(0,g.useCallback)(async e=>{B(!0),s(``),await Y(n,e)},[n]),handleDisconnect:Q,handleLogout:$,handleChangePin:(0,g.useCallback)(async()=>{if(!n){s(`Enter your current PIN first.`);return}f(!0),s(``);try{let e=await fetch(`/api/onboarding/set-pin`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPin:n})});if(!e.ok){s((await e.json().catch(()=>({error:`Incorrect PIN.`}))).error||`Incorrect PIN.`);return}r(``),s(``),t(`set-pin`)}catch(e){console.error(`[admin-auth] change pin failed:`,e),s(e instanceof Error?e.message:String(e))}finally{f(!1)}},[n])}}var S=n();function C({inputRef:e,value:t,onChange:n,onComplete:r,showPin:i,autoFocus:a}){let o=(0,g.useRef)([]);function s(e,r){r.key===`Backspace`?(r.preventDefault(),t[e]?n(t.slice(0,e)+t.slice(e+1)):e>0&&(n(t.slice(0,e-1)+t.slice(e)),o.current[e-1]?.focus())):r.key===`ArrowLeft`&&e>0?o.current[e-1]?.focus():r.key===`ArrowRight`&&e<5?o.current[e+1]?.focus():r.key===`Enter`&&(r.preventDefault(),r.currentTarget.form?.requestSubmit())}function c(e,i){let a=i.nativeEvent.data;if(!a||!/^\d$/.test(a))return;let s=t.split(``);for(s[e]=a;s.length<e;)s.push(``);let c=s.join(``).replace(/\D/g,``).slice(0,6);n(c),c.length===6?r?.(c):e<5&&o.current[e+1]?.focus()}function l(e){e.preventDefault();let t=e.clipboardData.getData(`text`).replace(/\D/g,``).slice(0,6);t&&(n(t),t.length===6?r?.(t):o.current[t.length]?.focus())}return(0,S.jsx)(`div`,{className:`pin-field`,children:Array.from({length:6}).map((n,r)=>(0,S.jsx)(`input`,{ref:t=>{o.current[r]=t,r===0&&e&&(e.current=t)},type:`text`,inputMode:`numeric`,className:`pin-box${t[r]?` pin-box-filled`:``}`,value:t[r]?i?t[r]:`•`:``,onKeyDown:e=>s(r,e),onInput:e=>c(r,e),onPaste:l,onFocus:e=>e.target.select(),autoFocus:a&&r===0,autoComplete:`off`,maxLength:1,"aria-label":`PIN digit ${r+1}`},r))})}function w(e){let{pin:n,setPin:r,showPin:i,setShowPin:s,pinLoading:c,pinError:l,pinInputRef:u,setPinFormRef:d,onSubmit:p,operatorName:m,setOperatorName:h}=e;return(0,S.jsx)(`div`,{className:`connect-page`,children:(0,S.jsxs)(`div`,{className:`connect-content`,children:[(0,S.jsx)(`img`,{src:o,alt:a.productName,className:`connect-logo connect-logo--maxy`}),!a.logoContainsName&&(0,S.jsxs)(`h1`,{className:`connect-title`,children:[`Welcome to `,a.productName]}),(0,S.jsxs)(`p`,{className:`connect-subtitle`,children:[`Tell `,a.productName,` who you are, then choose a PIN.`]}),(0,S.jsxs)(`form`,{ref:d,onSubmit:p,className:`connect-pin-form`,children:[(0,S.jsxs)(`div`,{className:`pin-input-row`,children:[(0,S.jsx)(`input`,{type:`text`,className:`connect-name-input`,placeholder:`Your full name`,value:m,onChange:e=>h(e.target.value),autoComplete:`name`,autoFocus:!0,required:!0,"aria-label":`Your full name`}),(0,S.jsx)(`div`,{style:{width:38,flexShrink:0},"aria-hidden":`true`})]}),(0,S.jsxs)(`div`,{className:`pin-input-row`,children:[(0,S.jsx)(C,{inputRef:u,value:n,onChange:r,onComplete:()=>{},showPin:i}),(0,S.jsx)(t,{variant:`send`,type:`submit`,disabled:!n||!m.trim(),loading:c,"aria-label":`Set PIN`,children:(0,S.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,S.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,S.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]}),(0,S.jsx)(f,{checked:i,onChange:()=>s(e=>!e),label:`Show PIN`})]}),l&&(0,S.jsx)(`p`,{className:`admin-pin-error`,children:l})]})})}function T(e){let{pin:n,setPin:r,showPin:i,setShowPin:s,pinLoading:c,pinError:l,pinInputRef:u,onSubmit:d,onChangePin:p,remoteAuthEnabled:m,onSignOutRemote:h}=e;return(0,S.jsxs)(`div`,{className:`connect-page`,children:[m&&h&&(0,S.jsx)(`button`,{type:`button`,className:`connect-signout`,onClick:h,children:`Sign out`}),(0,S.jsxs)(`div`,{className:`connect-content`,children:[(0,S.jsx)(`img`,{src:o,alt:a.productName,className:`connect-logo connect-logo--maxy`}),!a.logoContainsName&&(0,S.jsx)(`h1`,{className:`connect-title`,children:a.productName}),(0,S.jsxs)(`form`,{onSubmit:d,className:`connect-pin-form`,children:[(0,S.jsxs)(`div`,{className:`pin-input-row`,children:[(0,S.jsx)(C,{inputRef:u,value:n,onChange:r,onComplete:()=>{},showPin:i,autoFocus:!0}),(0,S.jsx)(t,{variant:`send`,type:`submit`,disabled:!n,loading:c,children:(0,S.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,S.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,S.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]}),(0,S.jsxs)(`div`,{className:`pin-options`,children:[(0,S.jsx)(f,{checked:i,onChange:()=>s(e=>!e),label:`Show PIN`}),(0,S.jsx)(t,{type:`button`,variant:`ghost`,onClick:p,children:`Change PIN`})]})]}),l&&(0,S.jsx)(`p`,{className:`admin-pin-error`,children:l})]})]})}function E(e){let{accounts:t,loading:n,error:r,onSelect:i}=e;return(0,S.jsx)(`div`,{className:`connect-page`,children:(0,S.jsxs)(`div`,{className:`connect-content`,children:[(0,S.jsx)(`img`,{src:o,alt:a.productName,className:`connect-logo connect-logo--maxy`}),!a.logoContainsName&&(0,S.jsx)(`h1`,{className:`connect-title`,children:a.productName}),(0,S.jsx)(`p`,{className:`connect-subtitle`,children:`Select an account`}),(0,S.jsx)(`div`,{className:`account-picker-list`,children:t.map(e=>(0,S.jsxs)(`button`,{className:`account-picker-card`,onClick:()=>i(e.accountId),disabled:n,type:`button`,children:[(0,S.jsx)(`span`,{className:`account-picker-name`,children:e.businessName||e.accountId}),(0,S.jsx)(`span`,{className:`account-picker-role`,children:e.role}),n&&(0,S.jsx)(s,{className:`account-picker-spinner`,size:16})]},e.accountId))}),r&&(0,S.jsx)(`p`,{className:`admin-pin-error`,children:r})]})})}function D(e){let{authPolling:n,setAuthPolling:r,authLoading:i,setAuthLoading:s,pinError:c,setPinError:l,setAppState:u}=e,[d,f]=(0,g.useState)(!1),[p,m]=(0,g.useState)(!1);async function h(){m(!0),l(``);try{let e=await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`launch-browser`})})).json();e.launched?f(!0):e.error&&l(e.error)}catch(e){console.error(`[admin] browser launch error:`,e),l(`Could not launch browser.`)}m(!1)}async function _(){s(!0),l(``);try{let e=await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`})).json();if(e.started){r(!0),f(!0),s(!1);for(let e=0;e<120;e++)if(await new Promise(e=>setTimeout(e,2e3)),(await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`wait`})})).json()).authenticated){await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`stop`})}),u(`enter-pin`);return}l(`Timed out waiting for sign-in. Try again.`),r(!1)}else e.error&&l(e.error)}catch(e){console.error(`[admin] auth flow error:`,e),l(`Could not start auth flow.`)}s(!1)}async function v(){await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`stop`})}),r(!1),l(``)}return n||d?(0,S.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100dvh`,overflow:`auto`},children:[(0,S.jsxs)(`header`,{className:`chat-header`,style:{paddingBottom:`12px`,flexShrink:0,position:`relative`,maxWidth:`680px`,width:`100%`,margin:`0 auto`,padding:`24px 20px 12px`},children:[n?(0,S.jsx)(`button`,{onClick:v,style:{position:`absolute`,top:`12px`,right:`12px`,background:`none`,border:`none`,color:`#999`,fontSize:`13px`,cursor:`pointer`,padding:`4px 8px`},"aria-label":`Cancel`,children:`✕`}):(0,S.jsx)(`button`,{onClick:()=>f(!1),style:{position:`absolute`,top:`12px`,right:`12px`,background:`none`,border:`none`,color:`#999`,fontSize:`13px`,cursor:`pointer`,padding:`4px 8px`},"aria-label":`Close browser`,children:`✕`}),(0,S.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`chat-logo`}),(0,S.jsx)(`h1`,{className:`chat-tagline`,children:`Connect Claude`}),(0,S.jsx)(`p`,{className:`chat-intro`,children:n?`Sign in and authorize in the browser below.`:`Open your email or prepare your accounts, then sign in.`}),!n&&(0,S.jsx)(`div`,{style:{marginTop:`12px`},children:(0,S.jsx)(t,{variant:`primary`,onClick:_,disabled:i,children:i?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`spin`,style:{display:`inline-block`},children:`✱`}),` Connecting…`]}):`Sign in to Claude`})})]}),(0,S.jsx)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minHeight:0,gap:`10px`,padding:`0 0 16px`},children:(0,S.jsx)(`iframe`,{src:`/vnc-viewer.html`,style:{flex:1,width:`100%`,minHeight:0,border:`none`,background:`#111`,display:`block`},title:`Claude Sign-in`})}),c&&(0,S.jsx)(`p`,{className:`admin-pin-error`,style:{textAlign:`center`,padding:`0 20px 16px`},children:c})]}):(0,S.jsx)(`div`,{className:`connect-page`,children:(0,S.jsxs)(`div`,{className:`connect-content`,children:[(0,S.jsxs)(`div`,{className:`connect-logos`,children:[(0,S.jsx)(`div`,{className:`connect-logo-wrap`,children:(0,S.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`connect-logo`})}),(0,S.jsx)(`svg`,{className:`connect-arrow`,viewBox:`0 0 48 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,S.jsx)(`path`,{d:`M0 12h44m0 0l-8-8m8 8l-8 8`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,S.jsxs)(`div`,{className:`connect-logo-wrap`,children:[(0,S.jsx)(`img`,{src:o,alt:a.productName,className:`connect-logo connect-logo--maxy`}),!a.logoContainsName&&(0,S.jsx)(`span`,{className:`connect-logo-label`,children:a.productName})]})]}),(0,S.jsxs)(`h1`,{className:`connect-title`,children:[`Connect Claude to power `,a.productName]}),(0,S.jsx)(`p`,{className:`connect-subtitle`,children:`Sign in with your Anthropic account to get started.`}),(0,S.jsx)(t,{variant:`primary`,onClick:_,disabled:i,children:i?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`spin`,style:{display:`inline-block`},children:`✱`}),` Connecting…`]}):`Sign in to Claude`}),(0,S.jsx)(`p`,{style:{marginTop:`6px`,fontSize:`11px`,color:`#999`,maxWidth:`300px`,textAlign:`center`,lineHeight:`1.4`},children:`First time? You may need to sign into your email and Anthropic account in the browser before connecting.`}),(0,S.jsx)(`button`,{onClick:h,disabled:p,style:{marginTop:`12px`,background:`none`,border:`none`,color:`var(--color-primary, #666)`,fontSize:`13px`,cursor:`pointer`,textDecoration:`underline`,textUnderlineOffset:`3px`},children:p?`Launching…`:`Open browser first`}),c&&(0,S.jsx)(`p`,{className:`admin-pin-error`,children:c})]})})}function O({onOpen:e}){return(0,S.jsx)(`footer`,{className:`admin-footer`,children:(0,S.jsxs)(`div`,{className:`powered-by`,role:`button`,tabIndex:0,onClick:e,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e())},"aria-label":`Powered by Claude Code — show details`,children:[(0,S.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`powered-by-icon`}),(0,S.jsx)(`span`,{children:`Powered by Claude Code`})]})})}function k(){let e=x(),[t,n]=(0,g.useState)(!1);(0,g.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&n(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);let r=(0,g.useCallback)(async()=>{let t=e.claudeInfo!=null;if(n(!0),t){console.info(`[admin-ui] claude-info-open cached=true ms=0`);return}let r=Date.now();try{let t=await fetch(`/api/admin/claude-info`);if(t.ok){let n=await t.json();e.setClaudeInfo(n)}console.info(`[admin-ui] claude-info-open cached=false ms=${Date.now()-r}`)}catch(e){console.error(`[admin-ui] claude-info-fetch-failed ms=${Date.now()-r} error="${e instanceof Error?e.message:String(e)}"`)}},[e]),i=(0,g.useCallback)(({code:t,path:n})=>{console.warn(`[admin-auth] outcome=chat-tab-logout-on-401 code=${t} path=${n}`),e.handleLogout()},[e]);return e.appState===`loading`?(0,S.jsx)(`div`,{className:`connect-page`}):e.appState===`set-pin`?(0,S.jsx)(w,{pin:e.pin,setPin:e.setPin,showPin:e.showPin,setShowPin:e.setShowPin,pinLoading:e.pinLoading,pinError:e.pinError,pinInputRef:e.pinInputRef,setPinFormRef:e.setPinFormRef,onSubmit:e.handleSetPin,operatorName:e.operatorName,setOperatorName:e.setOperatorName}):e.appState===`connect-claude`?(0,S.jsx)(D,{authPolling:e.authPolling,setAuthPolling:e.setAuthPolling,authLoading:e.authLoading,setAuthLoading:e.setAuthLoading,pinError:e.pinError,setPinError:e.setPinError,setAppState:e.setAppState}):e.appState===`enter-pin`?(0,S.jsx)(T,{pin:e.pin,setPin:e.setPin,showPin:e.showPin,setShowPin:e.setShowPin,pinLoading:e.pinLoading,pinError:e.pinError,pinInputRef:e.pinInputRef,onSubmit:e.handleLogin,onChangePin:e.handleChangePin,remoteAuthEnabled:e.remoteAuthEnabled,onSignOutRemote:()=>{console.info(`[admin-ui] remote-auth sign-out → /__remote-auth/logout`),window.location.href=`/__remote-auth/logout`}}):e.appState===`account-picker`?(0,S.jsx)(E,{accounts:e.accounts,loading:e.accountPickerLoading,error:e.pinError,onSelect:e.handleAccountSelect}):(0,S.jsx)(l,{cacheKey:e.cacheKey,onSessionExpired:i,surface:`chat`,children:(0,S.jsx)(d,{cacheKey:e.cacheKey,businessName:e.businessName,sessionId:e.sessionId,onLogout:e.handleLogout,onDisconnect:e.handleDisconnect,disconnecting:e.disconnecting,userName:e.userName,userAvatar:e.userAvatar,role:e.role,footer:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O,{onOpen:r}),(0,S.jsx)(u,{show:t,onClose:()=>n(!1),claudeInfo:e.claudeInfo,messages:[],sessionElapsed:0,sessionId:e.sessionId,cacheKey:e.cacheKey})]}),children:t=>(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(p,{}),t.selectedWhatsapp&&e.cacheKey?(0,S.jsx)(m,{sessionId:t.selectedWhatsapp.sessionId,projectDir:t.selectedWhatsapp.projectDir,sessionKey:e.cacheKey},t.selectedWhatsapp.sessionId):(0,S.jsx)(`main`,{})]})})})}(0,h.createRoot)(document.getElementById(`root`)).render((0,S.jsx)(k,{}));
|
|
1
|
+
import{o as e}from"./chunk-CWOGyPgy.js";import{c as t,l as n,m as r,p as i,r as a,s as o}from"./useSelectionMode-CJ2UADOe.js";import{d as s,h as c,i as l,n as u,t as d}from"./AdminShell-CpRQprdb.js";import{t as f}from"./Checkbox-hYA5LjZ5.js";import{t as p}from"./SidebarSplitter-D0mErwLL.js";import{t as m}from"./Transcript-BaC574J0.js";var h=i(),g=e(r(),1);new Set(`image/jpeg,image/png,image/gif,image/webp,application/pdf,text/plain,text/markdown,text/csv,text/html,text/calendar,application/zip,application/x-zip-compressed,audio/ogg,audio/opus,audio/mp4,audio/mpeg,audio/webm,audio/wav,.opus,.ogg,.m4a,.mp3,.wav,.webm`.split(`,`).filter(e=>!e.startsWith(`.`)));function _(e){switch(e){case`expanded`:return!0;case`collapsed`:return!1;default:return}}var v=`admin-landing-redirected`,y=`/graph`;function b(e){return e.appState===`chat`&&!e.alreadyRedirected}function x(){let[e,t]=(0,g.useState)(`loading`),[n,r]=(0,g.useState)(``),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(``),[l,u]=(0,g.useState)(!1),[d,f]=(0,g.useState)(!1),[p,m]=(0,g.useState)(!1),[h,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)(!1),[w,T]=(0,g.useState)(null),[E,D]=(0,g.useState)(null),[O,k]=(0,g.useState)(void 0),[A,j]=(0,g.useState)(null),[M,N]=(0,g.useState)(void 0),[ee,P]=(0,g.useState)(null),[F,I]=(0,g.useState)(null),[L,R]=(0,g.useState)([]),[z,B]=(0,g.useState)(!1),[V,H]=(0,g.useState)(void 0),U=(0,g.useRef)(void 0),[W,G]=(0,g.useState)(!1);(0,g.useEffect)(()=>{typeof window>`u`||fetch(`/api/remote-auth/status`).then(e=>e.ok?e.json():null).then(e=>{e?.configured&&G(!0)}).catch(()=>{})},[]);let K=(0,g.useRef)(null),q=(0,g.useRef)(null);(0,g.useEffect)(()=>{async function e(){let e=null;try{e=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!e)return!1;try{let n=await fetch(`/api/admin/session?session_key=${encodeURIComponent(e)}`);if(n.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}return!1}if(!n.ok)return!1;let r=await n.json();T(r.session_key),I(r.sessionId??null),k(r.businessName),j(r.role??null),N(r.userName===void 0?null:r.userName),P(r.avatar??null);let i=_(r.thinkingView);return U.current=i,H(i),t(`chat`),!0}catch(e){return console.error(`[admin] session restore failed:`,e),!1}}async function n(r=2){try{let i=await fetch(`/api/health`);if(!i.ok){if(r>0)return await new Promise(e=>setTimeout(e,1500)),n(r-1);console.error(`[admin] health check returned ${i.status} after retries`),t(`set-pin`);return}let a=await i.json();if(!a.pin_configured){t(`set-pin`);return}if(!a.claude_authenticated){t(`connect-claude`);return}if(await e())return;t(`enter-pin`)}catch(e){if(r>0)return await new Promise(e=>setTimeout(e,1500)),n(r-1);console.error(`[admin] health check failed:`,e),t(`set-pin`)}}n()},[]),(0,g.useEffect)(()=>{e===`chat`&&fetch(`/api/admin/claude-info`).then(e=>{if(e.ok)return e.json()}).then(e=>{e&&D(e)}).catch(()=>{})},[e]),(0,g.useEffect)(()=>{if(typeof window>`u`)return;let t=!1;try{t=sessionStorage.getItem(v)===`1`}catch{}if(b({appState:e,alreadyRedirected:t})){try{sessionStorage.setItem(v,`1`)}catch{}console.info(`[admin-ui] landing-redirect target=${y}`),window.location.replace(y)}},[e]);let J=(0,g.useRef)(null);(0,g.useEffect)(()=>{if(e!==`chat`)return;let n=setInterval(async()=>{try{let e=await fetch(`/api/health`);if(e.ok){let n=await e.json();if(n.auth_status===`dead`||n.auth_status===`missing`){t(`connect-claude`);return}}}catch{}if(w)try{let e=await fetch(`/api/admin/session?session_key=${encodeURIComponent(w)}`);if(e.status!==401)return;let t=(await e.clone().json().catch(()=>null))?.code??`unknown-401`;console.warn(`[admin-auth] outcome=heartbeat-detected-expiry code=${t}`),J.current?.()}catch{}},300*1e3);return()=>clearInterval(n)},[e,w]),(0,g.useEffect)(()=>{e===`connect-claude`&&fetch(`/api/health`).then(e=>e.ok?e.json():null).then(e=>{e?.claude_authenticated&&t(`enter-pin`)}).catch(()=>{})},[e]);async function Y(e,n){f(!0);try{let i=await fetch(`/api/admin/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pin:e,...n?{accountId:n}:{}})});if(!i.ok){s((await i.json().catch(()=>({}))).error||`Invalid PIN`);return}let a=await i.json();if(a.accounts&&!a.session_key){console.log(`[admin] account picker shown: userId=${a.userId} accountCount=${a.accounts.length}`),R(a.accounts),t(`account-picker`);return}T(a.session_key),I(a.sessionId??null),k(a.businessName),j(a.role??null),N(a.userName===void 0?null:a.userName),P(a.avatar??null);let o=_(a.thinkingView);if(U.current=o,H(o),n)try{sessionStorage.setItem(`maxy-account-id`,n)}catch{}try{sessionStorage.setItem(`maxy-admin-session-key`,a.session_key)}catch{}r(``),t(`chat`)}catch(e){console.error(`[admin] connection error:`,e),s(`Could not connect.`)}finally{f(!1),B(!1)}}let X=(0,g.useCallback)(async e=>{if(e.preventDefault(),d)return;s(``);let a=i.trim();if(!a){s(`Please enter your name.`);return}if(n.length<4){s(`PIN must be at least 4 characters.`);return}let o=n;f(!0);try{let e=await fetch(`/api/onboarding/set-pin`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({pin:o,name:a})});if(!e.ok){let n=await e.json().catch(()=>({}));if(e.status===409){console.log(`[admin] PIN already configured — re-checking health`);try{let e=await fetch(`/api/health`);if(e.ok){let r=await e.json();r.pin_configured&&r.claude_authenticated?t(`enter-pin`):r.pin_configured?t(`connect-claude`):s(n.error||`Failed to set PIN.`)}else t(`enter-pin`)}catch{t(`enter-pin`)}return}s(n.error||`Failed to set PIN.`);return}let n=await fetch(`/api/health`);if((n.ok?await n.json():null)?.claude_authenticated){await Y(o);return}r(``),t(`connect-claude`)}catch(e){console.error(`[admin] connection error:`,e),s(`Could not connect.`)}finally{f(!1)}},[n,d,i]),Z=(0,g.useCallback)(async e=>{e.preventDefault(),s(``),await Y(n)},[n]),Q=(0,g.useCallback)(async()=>{C(!0);try{if(!await c())return console.warn(`[admin-ui] claude-disconnect not verified — credentials may persist; staying put`),!1;T(null),j(null),N(void 0),P(null);try{sessionStorage.removeItem(`maxy-admin-session-key`),sessionStorage.removeItem(`maxy-account-id`),sessionStorage.removeItem(v)}catch{}return t(`connect-claude`),!0}finally{C(!1)}},[]),$=(0,g.useCallback)(()=>{T(null),j(null),N(void 0),P(null);try{sessionStorage.removeItem(`maxy-admin-session-key`),sessionStorage.removeItem(`maxy-account-id`),sessionStorage.removeItem(v)}catch{}r(``),s(``),t(`enter-pin`)},[]);return(0,g.useEffect)(()=>{J.current=$},[$]),{appState:e,setAppState:t,pin:n,setPin:r,operatorName:i,setOperatorName:a,pinError:o,setPinError:s,showPin:l,setShowPin:u,pinLoading:d,authPolling:p,setAuthPolling:m,authLoading:h,setAuthLoading:x,disconnecting:S,cacheKey:w,setCacheKey:T,claudeInfo:E,setClaudeInfo:D,businessName:O,role:A,userName:M,userAvatar:ee,sessionId:F,setSessionId:I,accounts:L,accountPickerLoading:z,expandAll:V,setExpandAll:H,expandAllDefaultRef:U,remoteAuthEnabled:W,pinInputRef:K,setPinFormRef:q,handleSetPin:X,handleLogin:Z,handleAccountSelect:(0,g.useCallback)(async e=>{B(!0),s(``),await Y(n,e)},[n]),handleDisconnect:Q,handleLogout:$,handleChangePin:(0,g.useCallback)(async()=>{if(!n){s(`Enter your current PIN first.`);return}f(!0),s(``);try{let e=await fetch(`/api/onboarding/set-pin`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPin:n})});if(!e.ok){s((await e.json().catch(()=>({error:`Incorrect PIN.`}))).error||`Incorrect PIN.`);return}r(``),s(``),t(`set-pin`)}catch(e){console.error(`[admin-auth] change pin failed:`,e),s(e instanceof Error?e.message:String(e))}finally{f(!1)}},[n])}}var S=n();function C({inputRef:e,value:t,onChange:n,onComplete:r,showPin:i,autoFocus:a}){let o=(0,g.useRef)([]);function s(e,r){r.key===`Backspace`?(r.preventDefault(),t[e]?n(t.slice(0,e)+t.slice(e+1)):e>0&&(n(t.slice(0,e-1)+t.slice(e)),o.current[e-1]?.focus())):r.key===`ArrowLeft`&&e>0?o.current[e-1]?.focus():r.key===`ArrowRight`&&e<5?o.current[e+1]?.focus():r.key===`Enter`&&(r.preventDefault(),r.currentTarget.form?.requestSubmit())}function c(e,i){let a=i.nativeEvent.data;if(!a||!/^\d$/.test(a))return;let s=t.split(``);for(s[e]=a;s.length<e;)s.push(``);let c=s.join(``).replace(/\D/g,``).slice(0,6);n(c),c.length===6?r?.(c):e<5&&o.current[e+1]?.focus()}function l(e){e.preventDefault();let t=e.clipboardData.getData(`text`).replace(/\D/g,``).slice(0,6);t&&(n(t),t.length===6?r?.(t):o.current[t.length]?.focus())}return(0,S.jsx)(`div`,{className:`pin-field`,children:Array.from({length:6}).map((n,r)=>(0,S.jsx)(`input`,{ref:t=>{o.current[r]=t,r===0&&e&&(e.current=t)},type:`text`,inputMode:`numeric`,className:`pin-box${t[r]?` pin-box-filled`:``}`,value:t[r]?i?t[r]:`•`:``,onKeyDown:e=>s(r,e),onInput:e=>c(r,e),onPaste:l,onFocus:e=>e.target.select(),autoFocus:a&&r===0,autoComplete:`off`,maxLength:1,"aria-label":`PIN digit ${r+1}`},r))})}function w(e){let{pin:n,setPin:r,showPin:i,setShowPin:s,pinLoading:c,pinError:l,pinInputRef:u,setPinFormRef:d,onSubmit:p,operatorName:m,setOperatorName:h}=e;return(0,S.jsx)(`div`,{className:`connect-page`,children:(0,S.jsxs)(`div`,{className:`connect-content`,children:[(0,S.jsx)(`img`,{src:o,alt:a.productName,className:`connect-logo connect-logo--maxy`}),!a.logoContainsName&&(0,S.jsxs)(`h1`,{className:`connect-title`,children:[`Welcome to `,a.productName]}),(0,S.jsxs)(`p`,{className:`connect-subtitle`,children:[`Tell `,a.productName,` who you are, then choose a PIN.`]}),(0,S.jsxs)(`form`,{ref:d,onSubmit:p,className:`connect-pin-form`,children:[(0,S.jsxs)(`div`,{className:`pin-input-row`,children:[(0,S.jsx)(`input`,{type:`text`,className:`connect-name-input`,placeholder:`Your full name`,value:m,onChange:e=>h(e.target.value),autoComplete:`name`,autoFocus:!0,required:!0,"aria-label":`Your full name`}),(0,S.jsx)(`div`,{style:{width:38,flexShrink:0},"aria-hidden":`true`})]}),(0,S.jsxs)(`div`,{className:`pin-input-row`,children:[(0,S.jsx)(C,{inputRef:u,value:n,onChange:r,onComplete:()=>{},showPin:i}),(0,S.jsx)(t,{variant:`send`,type:`submit`,disabled:!n||!m.trim(),loading:c,"aria-label":`Set PIN`,children:(0,S.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,S.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,S.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]}),(0,S.jsx)(f,{checked:i,onChange:()=>s(e=>!e),label:`Show PIN`})]}),l&&(0,S.jsx)(`p`,{className:`admin-pin-error`,children:l})]})})}function T(e){let{pin:n,setPin:r,showPin:i,setShowPin:s,pinLoading:c,pinError:l,pinInputRef:u,onSubmit:d,onChangePin:p,remoteAuthEnabled:m,onSignOutRemote:h}=e;return(0,S.jsxs)(`div`,{className:`connect-page`,children:[m&&h&&(0,S.jsx)(`button`,{type:`button`,className:`connect-signout`,onClick:h,children:`Sign out`}),(0,S.jsxs)(`div`,{className:`connect-content`,children:[(0,S.jsx)(`img`,{src:o,alt:a.productName,className:`connect-logo connect-logo--maxy`}),!a.logoContainsName&&(0,S.jsx)(`h1`,{className:`connect-title`,children:a.productName}),(0,S.jsxs)(`form`,{onSubmit:d,className:`connect-pin-form`,children:[(0,S.jsxs)(`div`,{className:`pin-input-row`,children:[(0,S.jsx)(C,{inputRef:u,value:n,onChange:r,onComplete:()=>{},showPin:i,autoFocus:!0}),(0,S.jsx)(t,{variant:`send`,type:`submit`,disabled:!n,loading:c,children:(0,S.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,S.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,S.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]})})]}),(0,S.jsxs)(`div`,{className:`pin-options`,children:[(0,S.jsx)(f,{checked:i,onChange:()=>s(e=>!e),label:`Show PIN`}),(0,S.jsx)(t,{type:`button`,variant:`ghost`,onClick:p,children:`Change PIN`})]})]}),l&&(0,S.jsx)(`p`,{className:`admin-pin-error`,children:l})]})]})}function E(e){let{accounts:t,loading:n,error:r,onSelect:i}=e;return(0,S.jsx)(`div`,{className:`connect-page`,children:(0,S.jsxs)(`div`,{className:`connect-content`,children:[(0,S.jsx)(`img`,{src:o,alt:a.productName,className:`connect-logo connect-logo--maxy`}),!a.logoContainsName&&(0,S.jsx)(`h1`,{className:`connect-title`,children:a.productName}),(0,S.jsx)(`p`,{className:`connect-subtitle`,children:`Select an account`}),(0,S.jsx)(`div`,{className:`account-picker-list`,children:t.map(e=>(0,S.jsxs)(`button`,{className:`account-picker-card`,onClick:()=>i(e.accountId),disabled:n,type:`button`,children:[(0,S.jsx)(`span`,{className:`account-picker-name`,children:e.businessName||e.accountId}),(0,S.jsx)(`span`,{className:`account-picker-role`,children:e.role}),n&&(0,S.jsx)(s,{className:`account-picker-spinner`,size:16})]},e.accountId))}),r&&(0,S.jsx)(`p`,{className:`admin-pin-error`,children:r})]})})}function D(e){let{authPolling:n,setAuthPolling:r,authLoading:i,setAuthLoading:s,pinError:c,setPinError:l,setAppState:u}=e,[d,f]=(0,g.useState)(!1),[p,m]=(0,g.useState)(!1);async function h(){m(!0),l(``);try{let e=await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`launch-browser`})})).json();e.launched?f(!0):e.error&&l(e.error)}catch(e){console.error(`[admin] browser launch error:`,e),l(`Could not launch browser.`)}m(!1)}async function _(){s(!0),l(``);try{let e=await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`})).json();if(e.started){r(!0),f(!0),s(!1);for(let e=0;e<120;e++)if(await new Promise(e=>setTimeout(e,2e3)),(await(await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`wait`})})).json()).authenticated){await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`stop`})}),u(`enter-pin`);return}l(`Timed out waiting for sign-in. Try again.`),r(!1)}else e.error&&l(e.error)}catch(e){console.error(`[admin] auth flow error:`,e),l(`Could not start auth flow.`)}s(!1)}async function v(){await fetch(`/api/onboarding/claude-auth`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:`stop`})}),r(!1),l(``)}return n||d?(0,S.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,height:`100dvh`,overflow:`auto`},children:[(0,S.jsxs)(`header`,{className:`chat-header`,style:{paddingBottom:`12px`,flexShrink:0,position:`relative`,maxWidth:`680px`,width:`100%`,margin:`0 auto`,padding:`24px 20px 12px`},children:[n?(0,S.jsx)(`button`,{onClick:v,style:{position:`absolute`,top:`12px`,right:`12px`,background:`none`,border:`none`,color:`#999`,fontSize:`13px`,cursor:`pointer`,padding:`4px 8px`},"aria-label":`Cancel`,children:`✕`}):(0,S.jsx)(`button`,{onClick:()=>f(!1),style:{position:`absolute`,top:`12px`,right:`12px`,background:`none`,border:`none`,color:`#999`,fontSize:`13px`,cursor:`pointer`,padding:`4px 8px`},"aria-label":`Close browser`,children:`✕`}),(0,S.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`chat-logo`}),(0,S.jsx)(`h1`,{className:`chat-tagline`,children:`Connect Claude`}),(0,S.jsx)(`p`,{className:`chat-intro`,children:n?`Sign in and authorize in the browser below.`:`Open your email or prepare your accounts, then sign in.`}),!n&&(0,S.jsx)(`div`,{style:{marginTop:`12px`},children:(0,S.jsx)(t,{variant:`primary`,onClick:_,disabled:i,children:i?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`spin`,style:{display:`inline-block`},children:`✱`}),` Connecting…`]}):`Sign in to Claude`})})]}),(0,S.jsx)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`,minHeight:0,gap:`10px`,padding:`0 0 16px`},children:(0,S.jsx)(`iframe`,{src:`/vnc-viewer.html`,style:{flex:1,width:`100%`,minHeight:0,border:`none`,background:`#111`,display:`block`},title:`Claude Sign-in`})}),c&&(0,S.jsx)(`p`,{className:`admin-pin-error`,style:{textAlign:`center`,padding:`0 20px 16px`},children:c})]}):(0,S.jsx)(`div`,{className:`connect-page`,children:(0,S.jsxs)(`div`,{className:`connect-content`,children:[(0,S.jsxs)(`div`,{className:`connect-logos`,children:[(0,S.jsx)(`div`,{className:`connect-logo-wrap`,children:(0,S.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`connect-logo`})}),(0,S.jsx)(`svg`,{className:`connect-arrow`,viewBox:`0 0 48 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,S.jsx)(`path`,{d:`M0 12h44m0 0l-8-8m8 8l-8 8`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,S.jsxs)(`div`,{className:`connect-logo-wrap`,children:[(0,S.jsx)(`img`,{src:o,alt:a.productName,className:`connect-logo connect-logo--maxy`}),!a.logoContainsName&&(0,S.jsx)(`span`,{className:`connect-logo-label`,children:a.productName})]})]}),(0,S.jsxs)(`h1`,{className:`connect-title`,children:[`Connect Claude to power `,a.productName]}),(0,S.jsx)(`p`,{className:`connect-subtitle`,children:`Sign in with your Anthropic account to get started.`}),(0,S.jsx)(t,{variant:`primary`,onClick:_,disabled:i,children:i?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`span`,{className:`spin`,style:{display:`inline-block`},children:`✱`}),` Connecting…`]}):`Sign in to Claude`}),(0,S.jsx)(`p`,{style:{marginTop:`6px`,fontSize:`11px`,color:`#999`,maxWidth:`300px`,textAlign:`center`,lineHeight:`1.4`},children:`First time? You may need to sign into your email and Anthropic account in the browser before connecting.`}),(0,S.jsx)(`button`,{onClick:h,disabled:p,style:{marginTop:`12px`,background:`none`,border:`none`,color:`var(--color-primary, #666)`,fontSize:`13px`,cursor:`pointer`,textDecoration:`underline`,textUnderlineOffset:`3px`},children:p?`Launching…`:`Open browser first`}),c&&(0,S.jsx)(`p`,{className:`admin-pin-error`,children:c})]})})}function O({onOpen:e}){return(0,S.jsx)(`footer`,{className:`admin-footer`,children:(0,S.jsxs)(`div`,{className:`powered-by`,role:`button`,tabIndex:0,onClick:e,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e())},"aria-label":`Powered by Claude Code — show details`,children:[(0,S.jsx)(`img`,{src:`/brand/claude.png`,alt:`Claude`,className:`powered-by-icon`}),(0,S.jsx)(`span`,{children:`Powered by Claude Code`})]})})}function k(){let e=x(),[t,n]=(0,g.useState)(!1);(0,g.useEffect)(()=>{if(!t)return;let e=e=>{e.key===`Escape`&&n(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);let r=(0,g.useCallback)(async()=>{let t=e.claudeInfo!=null;if(n(!0),t){console.info(`[admin-ui] claude-info-open cached=true ms=0`);return}let r=Date.now();try{let t=await fetch(`/api/admin/claude-info`);if(t.ok){let n=await t.json();e.setClaudeInfo(n)}console.info(`[admin-ui] claude-info-open cached=false ms=${Date.now()-r}`)}catch(e){console.error(`[admin-ui] claude-info-fetch-failed ms=${Date.now()-r} error="${e instanceof Error?e.message:String(e)}"`)}},[e]),i=(0,g.useCallback)(({code:t,path:n})=>{console.warn(`[admin-auth] outcome=chat-tab-logout-on-401 code=${t} path=${n}`),e.handleLogout()},[e]);return e.appState===`loading`?(0,S.jsx)(`div`,{className:`connect-page`}):e.appState===`set-pin`?(0,S.jsx)(w,{pin:e.pin,setPin:e.setPin,showPin:e.showPin,setShowPin:e.setShowPin,pinLoading:e.pinLoading,pinError:e.pinError,pinInputRef:e.pinInputRef,setPinFormRef:e.setPinFormRef,onSubmit:e.handleSetPin,operatorName:e.operatorName,setOperatorName:e.setOperatorName}):e.appState===`connect-claude`?(0,S.jsx)(D,{authPolling:e.authPolling,setAuthPolling:e.setAuthPolling,authLoading:e.authLoading,setAuthLoading:e.setAuthLoading,pinError:e.pinError,setPinError:e.setPinError,setAppState:e.setAppState}):e.appState===`enter-pin`?(0,S.jsx)(T,{pin:e.pin,setPin:e.setPin,showPin:e.showPin,setShowPin:e.setShowPin,pinLoading:e.pinLoading,pinError:e.pinError,pinInputRef:e.pinInputRef,onSubmit:e.handleLogin,onChangePin:e.handleChangePin,remoteAuthEnabled:e.remoteAuthEnabled,onSignOutRemote:()=>{console.info(`[admin-ui] remote-auth sign-out → /__remote-auth/logout`),window.location.href=`/__remote-auth/logout`}}):e.appState===`account-picker`?(0,S.jsx)(E,{accounts:e.accounts,loading:e.accountPickerLoading,error:e.pinError,onSelect:e.handleAccountSelect}):(0,S.jsx)(l,{cacheKey:e.cacheKey,onSessionExpired:i,surface:`chat`,children:(0,S.jsx)(d,{cacheKey:e.cacheKey,businessName:e.businessName,sessionId:e.sessionId,onLogout:e.handleLogout,onDisconnect:e.handleDisconnect,disconnecting:e.disconnecting,userName:e.userName,userAvatar:e.userAvatar,role:e.role,footer:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(O,{onOpen:r}),(0,S.jsx)(u,{show:t,onClose:()=>n(!1),claudeInfo:e.claudeInfo,messages:[],sessionElapsed:0,sessionId:e.sessionId,cacheKey:e.cacheKey})]}),children:t=>(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(p,{}),t.selectedWhatsapp&&e.cacheKey?(0,S.jsx)(m,{sessionId:t.selectedWhatsapp.sessionId,projectDir:t.selectedWhatsapp.projectDir,sessionKey:e.cacheKey},t.selectedWhatsapp.sessionId):(0,S.jsx)(`main`,{})]})})})}(0,h.createRoot)(document.getElementById(`root`)).render((0,S.jsx)(k,{}));
|