@vellumai/web 0.8.12-staging.1 → 0.8.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/assets/{BundleConfirmPage-jkqaLCJa.js → BundleConfirmPage-YJRCo0Hn.js} +1 -1
  2. package/dist/assets/{account-page-CnPPGmfm.js → account-page-Dj92GjiR.js} +1 -1
  3. package/dist/assets/{add-credits-modal-BxO-aOIt.js → add-credits-modal-CsP4udDc.js} +1 -1
  4. package/dist/assets/{advanced-page-B-9YunGO.js → advanced-page-BCnHb6oY.js} +1 -1
  5. package/dist/assets/{ai-page-Ccq4dwgh.js → ai-page-DcBsmsTv.js} +1 -1
  6. package/dist/assets/ai-utils-NK8I8SN2.js +1 -0
  7. package/dist/assets/{api-OKSSIP8W.js → api-DiLLlhgt.js} +1 -1
  8. package/dist/assets/{api-key-screen-BdonZw0y.js → api-key-screen-Nxq7EclW.js} +1 -1
  9. package/dist/assets/{app-html-cache-D7jkI5-i.js → app-html-cache-DuUq2_RD.js} +1 -1
  10. package/dist/assets/{archive-page-D-lt2ew2.js → archive-page-DGVZ9qUU.js} +1 -1
  11. package/dist/assets/{assistant-status-panel-DXNBZech.js → assistant-status-panel-B-yM7DE5.js} +1 -1
  12. package/dist/assets/{auth-store-BDBEYGBC.js → auth-store-C4gcHOWH.js} +1 -1
  13. package/dist/assets/{avatar-api-DbhDkml8.js → avatar-api-CLSAZR4o.js} +1 -1
  14. package/dist/assets/billing-page-C_pAWHkv.js +3 -0
  15. package/dist/assets/{command-palette-oEhmGGJ_.js → command-palette-CmihDJi0.js} +1 -1
  16. package/dist/assets/{command-palette-window-page-CDLfRYDZ.js → command-palette-window-page-CHxcr6A6.js} +1 -1
  17. package/dist/assets/{community-page-BwBAzLWc.js → community-page-BgwEi2WM.js} +1 -1
  18. package/dist/assets/{connect-page-BmHjyuVm.js → connect-page-DKR1ECD0.js} +1 -1
  19. package/dist/assets/contacts-page-route-ALOLGdXW.js +1 -0
  20. package/dist/assets/{debug-page-DIjs01B3.js → debug-page-DwWy2v03.js} +1 -1
  21. package/dist/assets/{deploy-dialogs-K3jkgI2T.js → deploy-dialogs-DrOvG0Ma.js} +1 -1
  22. package/dist/assets/{developer-page-DFhuZ_hl.js → developer-page-CNY0EBWx.js} +1 -1
  23. package/dist/assets/{devices-page-DdDILkUC.js → devices-page-DyJCd4s2.js} +1 -1
  24. package/dist/assets/{dictation-overlay-page-CxBuw-hP.js → dictation-overlay-page-bAy1yMeW.js} +1 -1
  25. package/dist/assets/{document-viewer-page-Y69T82fT.js → document-viewer-page-B1YXPDXM.js} +1 -1
  26. package/dist/assets/{earn-credits-modal-CYjyqSQ0.js → earn-credits-modal-BVhrVwKQ.js} +1 -1
  27. package/dist/assets/{emails-page-DBN4Tl5W.js → emails-page-xMdxei56.js} +1 -1
  28. package/dist/assets/{general-page-Bp5ucjKX.js → general-page-CzxX_ytO.js} +1 -1
  29. package/dist/assets/{hatching-screen-CzrL6chE.js → hatching-screen-BvaGi8x7.js} +1 -1
  30. package/dist/assets/{home-page-route-CaqhLSrL.js → home-page-route-Bxgs4dcd.js} +1 -1
  31. package/dist/assets/{hosting-screen-WK7sHIGI.js → hosting-screen-Jp346VHw.js} +1 -1
  32. package/dist/assets/{identity-page-route-B3RBccXw.js → identity-page-route-DHz3LOu0.js} +1 -1
  33. package/dist/assets/{index-Ue-r3LET.js → index-87hTkD_v.js} +20 -20
  34. package/dist/assets/inspect-page-B9wa3RHM.js +3 -0
  35. package/dist/assets/{install-DKeB-cXi.js → install-BlwjvAKk.js} +1 -1
  36. package/dist/assets/integrations-page-2soaHaLH.js +1 -0
  37. package/dist/assets/{intelligence-layout-CmazwWMA.js → intelligence-layout-DRGbJocy.js} +1 -1
  38. package/dist/assets/{keyboard-shortcuts-page-jZLFffHe.js → keyboard-shortcuts-page-DqPqhIaF.js} +1 -1
  39. package/dist/assets/{library-detail-page-arp0ms3i.js → library-detail-page-DLekVuPD.js} +1 -1
  40. package/dist/assets/{library-page-B_Um_0PB.js → library-page-DFBGqpq4.js} +1 -1
  41. package/dist/assets/{login-flow-BbNFfr7k.js → login-flow-DmfVD3r_.js} +1 -1
  42. package/dist/assets/{login-page-C1onXPvg.js → login-page-CaI9s3W4.js} +1 -1
  43. package/dist/assets/{logout-page-CZh6Uq_T.js → logout-page-DMO7Ro8q.js} +1 -1
  44. package/dist/assets/{logs-layout-DH3tK8BL.js → logs-layout-XvmAJO6n.js} +1 -1
  45. package/dist/assets/{memory-router-playground-page-BWcZZNFJ.js → memory-router-playground-page-DbSrBXJN.js} +1 -1
  46. package/dist/assets/{mobile-sidebar-drawer-BRnz4Jvz.js → mobile-sidebar-drawer-CBYUCY4b.js} +1 -1
  47. package/dist/assets/{notifications-page-BdpIL_Je.js → notifications-page-BWn1NfeD.js} +1 -1
  48. package/dist/assets/{oauth-complete-page-CYJsWX1G.js → oauth-complete-page-qd6rU5o-.js} +1 -1
  49. package/dist/assets/{oauth-popup-complete-page-B4P5UDKV.js → oauth-popup-complete-page-EU9BzQqV.js} +1 -1
  50. package/dist/assets/{platform-loopback-page-C1Kd436W.js → platform-loopback-page-ZNZz8YUX.js} +1 -1
  51. package/dist/assets/plugin-detail-page-D7tzIKVl.js +1 -0
  52. package/dist/assets/plugins-page-D-kijwJP.js +1 -0
  53. package/dist/assets/{pre-chat-flow-CpevOsrA.js → pre-chat-flow-BSXfD6S0.js} +1 -1
  54. package/dist/assets/{privacy-page-DbFKqGg4.js → privacy-page-BiyTmDHN.js} +1 -1
  55. package/dist/assets/{privacy-screen-CpDWfUis.js → privacy-screen-mhJ5CnV4.js} +1 -1
  56. package/dist/assets/{provider-callback-page-CQuLD5No.js → provider-callback-page-BuPFhW7i.js} +1 -1
  57. package/dist/assets/{provider-key-BYLNbH9o.js → provider-key-Clqsm-h7.js} +1 -1
  58. package/dist/assets/{provider-signup-page-C6xTOqI6.js → provider-signup-page-DhOuxnxY.js} +1 -1
  59. package/dist/assets/{query-tags-D58uls0S.js → query-tags-DPKpdc1_.js} +1 -1
  60. package/dist/assets/react-query.gen-B_oGDSP8.js +1 -0
  61. package/dist/assets/{review-terms-screen-itzeD0QH.js → review-terms-screen-BgLGEzR9.js} +1 -1
  62. package/dist/assets/{schedules-CULDXQU7.js → schedules-Cxb9otxN.js} +1 -1
  63. package/dist/assets/schedules-page-SwCpd9Y6.js +1 -0
  64. package/dist/assets/{sdk.gen-18Tp6Ee_.js → sdk.gen-DgqwY_WN.js} +1 -1
  65. package/dist/assets/{select-assistant-screen-DXbNAlGe.js → select-assistant-screen-CIVt4gg2.js} +1 -1
  66. package/dist/assets/{settings-layout-N_A_6E3u.js → settings-layout-L6c6Zaje.js} +1 -1
  67. package/dist/assets/{share-feedback-modal-B9w8RmIj.js → share-feedback-modal-BlMDGejV.js} +1 -1
  68. package/dist/assets/{sidebar-tree-CivI4sXe.js → sidebar-tree-KVdXcht-.js} +1 -1
  69. package/dist/assets/{signup-page-COvQK9fm.js → signup-page-FdYQKUli.js} +1 -1
  70. package/dist/assets/{skills-page-BoipXRsU.js → skills-page-Cs1mTTpA.js} +1 -1
  71. package/dist/assets/{sounds-page-2GDbwQsL.js → sounds-page-BtPyTbtD.js} +1 -1
  72. package/dist/assets/{step-indicator-dots-BusA89ya.js → step-indicator-dots-C_x0ZHGS.js} +1 -1
  73. package/dist/assets/{subagent-detail-panel-CN_sN89F.js → subagent-detail-panel-C6FfdUDE.js} +1 -1
  74. package/dist/assets/{system-events-page-DJIYOd5W.js → system-events-page-D9gAK-2s.js} +1 -1
  75. package/dist/assets/{tiptap-document-editor-B5IBRg7q.js → tiptap-document-editor-Cl8KJbb0.js} +1 -1
  76. package/dist/assets/{tool-detail-panel-CAZdGcvz.js → tool-detail-panel-DP9ZUGgW.js} +1 -1
  77. package/dist/assets/{trace-page-Db3S2Hsr.js → trace-page-ClDbcKcm.js} +1 -1
  78. package/dist/assets/{upgrade-cancel-page-mjlsJGp8.js → upgrade-cancel-page-BXZOicV3.js} +1 -1
  79. package/dist/assets/{upgrade-success-page-BHISIP3f.js → upgrade-success-page-CeM_gFIj.js} +1 -1
  80. package/dist/assets/{usage-page-BlvccKgv.js → usage-page-DHofU58j.js} +1 -1
  81. package/dist/assets/{use-daemon-config-DBKbFpqu.js → use-daemon-config-BLCgqB8a.js} +1 -1
  82. package/dist/assets/use-is-org-ready-BgB6QXom.js +1 -0
  83. package/dist/assets/{use-oauth-complete-deep-link-listener-Bteh0USx.js → use-oauth-complete-deep-link-listener-DnDBZsXG.js} +1 -1
  84. package/dist/assets/{use-onboarding-login-ByZGkreO.js → use-onboarding-login-CYb9P9G7.js} +1 -1
  85. package/dist/assets/use-plugin-drift-uJRE3xTx.js +1 -0
  86. package/dist/assets/{viewer-store-cX7oqdcL.js → viewer-store-o5byTOZU.js} +1 -1
  87. package/dist/assets/{voice-page-DOpV3VSS.js → voice-page-sB7S0uAp.js} +1 -1
  88. package/dist/assets/{weather-forecast-display-ByPBvVhv.js → weather-forecast-display-C5PORkTk.js} +1 -1
  89. package/dist/assets/{welcome-screen-3d2lXMb8.js → welcome-screen-Rm6Zm5dD.js} +1 -1
  90. package/dist/assets/{workspace-page-JSb7VYXM.js → workspace-page-zV0pbQfl.js} +1 -1
  91. package/dist/index.html +11 -11
  92. package/package.json +1 -1
  93. package/dist/assets/ai-utils-C-JayVoL.js +0 -1
  94. package/dist/assets/billing-page-BJ__Ep9o.js +0 -3
  95. package/dist/assets/contacts-page-route-CcDLyEf6.js +0 -1
  96. package/dist/assets/inspect-page-B3_pcn__.js +0 -3
  97. package/dist/assets/integrations-page-BaDzdFWK.js +0 -1
  98. package/dist/assets/plugin-detail-page-BEjyf-Ux.js +0 -1
  99. package/dist/assets/plugins-page-B6qln-fF.js +0 -1
  100. package/dist/assets/react-query.gen-Bp_whSkG.js +0 -1
  101. package/dist/assets/schedules-page-LaB58sYQ.js +0 -1
  102. package/dist/assets/use-is-org-ready-7bL7PowO.js +0 -1
  103. /package/dist/assets/{avatar-bundled-components-CL39cwfR.js → avatar-bundled-components-D1Q_IPFc.js} +0 -0
  104. /package/dist/assets/{danger-zone-redirect-page-KLttOmNm.js → danger-zone-redirect-page-B7We5zLz.js} +0 -0
  105. /package/dist/assets/{environment-store-BFK2MIjF.js → environment-store-D3R6E-cP.js} +0 -0
  106. /package/dist/assets/{format-CCVadvyp.js → format-Bx7lme44.js} +0 -0
  107. /package/dist/assets/{format-date-Pw0m-fQ8.js → format-date-6MJxjyy6.js} +0 -0
  108. /package/dist/assets/{format-file-size-DRikIrHj.js → format-file-size-DkWrZmJq.js} +0 -0
  109. /package/dist/assets/{llm-dimension-CN3sxcTZ.js → llm-dimension-v8X-KTEz.js} +0 -0
  110. /package/dist/assets/{onboarding-layout-40CHAFT0.js → onboarding-layout-BAx3atHc.js} +0 -0
  111. /package/dist/assets/{system-events-redirect-page-BAb2LAAA.js → system-events-redirect-page-De2HLo0x.js} +0 -0
  112. /package/dist/assets/{usage-window-BZdZL5mo.js → usage-window-DIaL-FoL.js} +0 -0
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as r}from"./QueryClientProvider-DKhXIxGb.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./button-C68o-wep.js";import{t as s}from"./menu-B79-l6IU.js";import"./src-Bnn6algv.js";import{t as c}from"./confirm-dialog-94QFOD8a.js";import{n as l,t as u}from"./panel-item-FzMfzMJA.js";import{t as d}from"./input-Cu3PPVCq.js";import{n as f}from"./toast-BL8OPiip.js";import{t as p}from"./arrow-up-BLnb2N1m.js";import{t as m}from"./globe-CMrMrZef.js";import{s as h,t as g}from"./sdk.gen-18Tp6Ee_.js";import{f as _,n as v,t as y}from"./react-query.gen-Bp_whSkG.js";import{i as b}from"./routes-VcLWbBmh.js";import{n as x}from"./use-is-mobile-CgLpEUW2.js";import{n as S,t as C}from"./app-html-cache-D7jkI5-i.js";import{t as w}from"./misc-Dml34IDG.js";import{Cn as T,Ji as E,Li as D,V as O,et as k,fa as A,ka as j,qi as M,tt as N,vi as P,wa as F,xi as I}from"./index-Ue-r3LET.js";import{t as L}from"./deploy-dialogs-K3jkgI2T.js";import{t as R}from"./use-active-assistant-id-B2Zd0B4I.js";import{t as z}from"./page-shell-C37pkmXT.js";import{t as B}from"./format-date-Pw0m-fQ8.js";var V=e(t(),1),H=a();function U({app:e,isDeleting:t,onConfirm:n,onCancel:r}){return(0,H.jsx)(c,{open:e!==null,title:`Delete app`,message:e?`"${e.name}" will be permanently removed.`:``,confirmLabel:t?`Deleting…`:`Delete`,destructive:!0,onConfirm:n,onCancel:r})}function W(e){return e===1?`1 word`:`${e} words`}function G({document:e,onOpen:t}){return(0,H.jsxs)(`div`,{className:`group relative flex flex-col gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:w(`relative flex w-full cursor-pointer flex-col items-center justify-center gap-2 overflow-hidden rounded-xl border border-[var(--border-base)] bg-[var(--surface-base)]`,`aspect-[16/10]`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:[(0,H.jsx)(F,{size:34,className:`text-[var(--content-tertiary)]`}),(0,H.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:W(e.wordCount)})]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:`flex cursor-pointer flex-col gap-0.5 px-0.5 text-left outline-none`,children:[(0,H.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)]`,children:e.title}),(0,H.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:B(new Date(e.updatedAt))})]})]})}function K({fileInputRef:e,isImporting:t,onImportBundle:n,onNewConversation:r}){return(0,H.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4 py-24`,children:[(0,H.jsx)(`input`,{ref:e,type:`file`,accept:`.vellum`,className:`hidden`,onChange:n}),(0,H.jsx)(`div`,{className:`flex h-16 w-16 items-center justify-center rounded-xl bg-[var(--surface-base)]`,children:(0,H.jsx)(A,{size:32,className:`text-[var(--content-tertiary)]`})}),(0,H.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Your library is empty`}),(0,H.jsx)(`p`,{className:`max-w-md text-center text-body-medium-lighter text-[color:var(--content-tertiary)]`,children:`Ask your assistant to build something, or import a shared app`}),(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[r?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(o,{variant:`primary`,size:`regular`,onClick:r,children:`New Conversation`}),(0,H.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:`or`})]}):null,(0,H.jsxs)(o,{variant:`outlined`,size:`regular`,onClick:()=>e.current?.click(),disabled:t,children:[t?(0,H.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}):(0,H.jsx)(P,{size:14}),(0,H.jsx)(`span`,{className:`ml-1.5`,children:`Import .vellum File`})]})]})]})}function q({app:e,assistantId:t,isPinned:n,onOpen:r,onPin:i,onDelete:a,onDeploy:o,justImported:s,onAnimationEnd:c}){let[l,u]=(0,V.useState)(!1),d=(0,V.useCallback)(()=>S(t,e.id),[t,e.id]),p=(0,V.useCallback)(async()=>{if(!l){u(!0);try{await N(t,e.id,e.name),f.success(`App exported`,{description:`${e.name}.vellum`})}catch(e){f.error(`Failed to share app`,{description:e instanceof Error?e.message:void 0})}finally{u(!1)}}},[t,e.id,e.name,l]),[m,h]=(0,V.useState)(!1),g=x();return(0,H.jsxs)(`div`,{className:w(`group relative flex flex-col gap-2`,s&&`animate-[card-entrance_400ms_ease-out]`),onAnimationEnd:s?c:void 0,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:w(`relative w-full cursor-pointer overflow-hidden rounded-xl`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:(0,H.jsx)(O,{name:e.name,icon:e.icon,loadHtml:d})}),(0,H.jsx)(`div`,{className:w(`absolute right-2 top-2 z-20 transition-opacity`,`max-md:opacity-100`,`md:group-hover:opacity-100 md:group-focus-within:opacity-100`,m?`opacity-100`:`md:opacity-0`),children:(0,H.jsx)(J,{appName:e.name,isPinned:n,open:m,onOpenChange:h,onPin:()=>i(e),onDelete:a?()=>a(e):void 0,onShare:p,onDeploy:o,isMobile:g})}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`flex cursor-pointer flex-col gap-0.5 px-0.5 text-left outline-none`,children:[(0,H.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)]`,children:e.name}),(0,H.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:B(new Date(e.createdAt))})]})]})}function J({appName:e,isPinned:t,open:n,onOpenChange:r,onPin:i,onDelete:a,onShare:c,onDeploy:d,isMobile:f}){return f?(0,H.jsxs)(l.Root,{open:n,onOpenChange:r,children:[(0,H.jsx)(l.Trigger,{asChild:!0,children:(0,H.jsx)(o,{variant:`primary`,size:`compact`,iconOnly:(0,H.jsx)(j,{}),"aria-label":`App actions`,onClick:e=>e.stopPropagation()})}),(0,H.jsxs)(l.Content,{children:[(0,H.jsx)(l.Header,{className:`sr-only`,children:(0,H.jsx)(l.Title,{children:e})}),(0,H.jsxs)(l.Body,{className:`pt-0`,children:[(0,H.jsx)(u,{icon:t?E:M,label:t?`Unpin`:`Pin`,onSelect:()=>{r(!1),i()}}),c?(0,H.jsx)(u,{icon:p,label:(0,H.jsxs)(`span`,{className:`flex flex-col gap-0.5 overflow-visible whitespace-normal`,children:[(0,H.jsx)(`span`,{children:`Share`}),(0,H.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Export as .vellum file`})]}),onSelect:()=>{r(!1),c()}}):null,d?(0,H.jsx)(u,{icon:m,label:(0,H.jsxs)(`span`,{className:`flex flex-col gap-0.5 overflow-visible whitespace-normal`,children:[(0,H.jsx)(`span`,{children:`Deploy to Vercel`}),(0,H.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Publish as a static page`})]}),onSelect:()=>{r(!1),d()}}):null,a?(0,H.jsx)(u,{icon:I,label:`Delete`,onSelect:()=>{r(!1),a()}}):null]})]})]}):(0,H.jsxs)(s.Root,{open:n,onOpenChange:r,children:[(0,H.jsx)(s.Trigger,{asChild:!0,children:(0,H.jsx)(o,{variant:`primary`,size:`compact`,iconOnly:(0,H.jsx)(j,{}),"aria-label":`App actions`,onClick:e=>e.stopPropagation()})}),(0,H.jsxs)(s.Content,{align:`end`,sideOffset:4,children:[(0,H.jsx)(s.Item,{leftIcon:t?(0,H.jsx)(E,{size:14}):(0,H.jsx)(M,{size:14}),onSelect:()=>i(),className:`whitespace-nowrap`,children:t?`Unpin`:`Pin`}),c?(0,H.jsx)(s.Item,{leftIcon:(0,H.jsx)(p,{size:14}),onSelect:()=>c(),className:`whitespace-nowrap`,children:`Share`}):null,d?(0,H.jsx)(s.Item,{leftIcon:(0,H.jsx)(m,{size:14}),onSelect:()=>d(),className:`whitespace-nowrap`,children:`Deploy to Vercel`}):null,a?(0,H.jsx)(s.Item,{leftIcon:(0,H.jsx)(I,{size:14,className:`text-red-600`}),onSelect:()=>a(),className:`whitespace-nowrap text-red-600 data-[highlighted]:text-red-700`,children:`Delete`}):null]})]})}function Y({title:e,apps:t,assistantId:n,pinnedAppIds:r,lastImportedAppId:i,onOpen:a,onPin:o,onDelete:s,onDeploy:c,onAnimationEnd:l}){return t.length===0?null:(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)]`,children:e}),(0,H.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6`,children:t.map(e=>(0,H.jsx)(q,{app:e,assistantId:n,isPinned:r.has(e.id),onOpen:a,onPin:o,onDelete:s,justImported:e.id===i,onAnimationEnd:l,onDeploy:c?()=>c(e.id):void 0},e.id))})]})}var X=(e,t)=>t.updatedAt-e.updatedAt||t.createdAt-e.createdAt;function Z(e){let t=T.use.pinnedAppIds(),{data:n=[],isLoading:r,error:a}=i({...y({path:{assistant_id:e}}),select:e=>e.apps}),{data:o=[],isLoading:s,error:c}=i({..._({path:{assistant_id:e}}),select:e=>e.documents}),l=r||s,u=a&&c?a instanceof Error?a.message:`Failed to load library`:null,[d,f]=(0,V.useState)(``),p=(0,V.useMemo)(()=>{if(!d.trim())return n;let e=d.toLowerCase();return n.filter(t=>t.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))},[n,d]);return{apps:n,documents:o,filteredApps:p,pinnedApps:(0,V.useMemo)(()=>p.filter(e=>t.has(e.id)).sort(X),[p,t]),recentApps:(0,V.useMemo)(()=>p.filter(e=>!t.has(e.id)).sort(X),[p,t]),filteredDocuments:(0,V.useMemo)(()=>{if(!d.trim())return o;let e=d.toLowerCase();return o.filter(t=>t.title.toLowerCase().includes(e))},[o,d]),searchText:d,setSearchText:f,loading:l,error:u}}async function Q(e,t){let{data:n,error:r,response:i}=await h({path:{assistant_id:e},body:t,bodySerializer:e=>e,headers:{"Content-Type":`application/octet-stream`},throwOnError:!1});if(!i||!i.ok){let e=(r&&typeof r==`object`&&`message`in r?r.message:null)??`Failed to import app.`;throw Error(e)}return n}function $({assistantId:e,assistantName:t,title:n,onNewConversation:i,onOpenDocument:a,onOpenApp:s}){let c=r(),l=T.use.togglePin(),u=T.use.pinnedAppIds(),p=k.use.isDeploying(),{apps:m,documents:h,filteredApps:_,pinnedApps:y,recentApps:b,filteredDocuments:x,searchText:w,setSearchText:E,loading:O,error:A}=Z(e),[j,M]=(0,V.useState)(null),[N,F]=(0,V.useState)(!1),I=(0,V.useCallback)(async()=>{let t=j;if(!(!t||N)){F(!0);try{await g({path:{assistant_id:e,id:t.id},throwOnError:!0}),C(e,t.id),c.invalidateQueries({queryKey:v({path:{assistant_id:e}})}),u.has(t.id)&&l(t),M(null)}catch(e){f.error(e instanceof Error?e.message:`Failed to delete app`)}finally{F(!1)}}},[j,N,e,u,l,c]),R=(0,V.useCallback)(()=>{N||M(null)},[N]),z=(0,V.useRef)(null),[B,W]=(0,V.useState)(!1),q=(0,V.useCallback)(async t=>{let n=t.target.files?.[0];if(!(!n||B)){W(!0);try{let t=await Q(e,n);await c.invalidateQueries({queryKey:v({path:{assistant_id:e}})}),f.success(t.name+` imported`),s(t.appId)}catch(e){f.error(e instanceof Error?e.message:`Failed to import app`)}finally{W(!1),z.current&&(z.current.value=``)}}},[e,B,c,s]),J=(0,V.useCallback)(async t=>{if(p)return;let n=m.find(e=>e.id===t)?.name??`this app`;try{let r=await S(e,t);k.getState().deployApp(e,t,n,r)}catch{k.getState().deployApp(e,t,n,``)}},[e,p,m]),X=(0,V.useCallback)(e=>l(e),[l]);return O?(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,H.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-[var(--border-base)] border-t-[var(--primary-base)]`,role:`status`,"aria-label":`Loading apps`})}):A?(0,H.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4`,children:[(0,H.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:A}),(0,H.jsx)(`button`,{type:`button`,className:`rounded-lg bg-[var(--primary-base)] px-4 py-2 text-body-medium-default text-[var(--content-inset)] transition-colors hover:bg-[var(--primary-hover)]`,onClick:()=>window.location.reload(),children:`Retry`})]}):m.length===0&&h.length===0?(0,H.jsx)(K,{fileInputRef:z,isImporting:B,onImportBundle:q,onNewConversation:i?()=>i():void 0}):(0,H.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[(0,H.jsxs)(`div`,{className:`mb-4 flex shrink-0 items-center justify-between gap-4`,children:[n?(0,H.jsx)(`h1`,{className:`text-title-large text-[var(--content-default)]`,children:n}):(0,H.jsx)(`span`,{}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{ref:z,type:`file`,accept:`.vellum`,className:`hidden`,onChange:q}),(0,H.jsxs)(o,{variant:`outlined`,size:`regular`,onClick:()=>z.current?.click(),disabled:B,children:[B?(0,H.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}):(0,H.jsx)(P,{size:14}),(0,H.jsx)(`span`,{className:`ml-1.5`,children:`Import`})]})]})]}),(0,H.jsx)(`div`,{className:`mb-6 shrink-0`,children:(0,H.jsx)(d,{fullWidth:!0,type:`text`,placeholder:`Search your library`,value:w,onChange:e=>E(e.target.value),leftIcon:(0,H.jsx)(D,{size:16})})}),(0,H.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:_.length===0&&x.length===0?(0,H.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16`,children:[(0,H.jsx)(D,{size:32,className:`mb-4 text-[var(--content-tertiary)]`}),(0,H.jsxs)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:[`No apps or documents matched “`,w,`”`]})]}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,H.jsx)(Y,{title:`Pinned`,apps:y,assistantId:e,pinnedAppIds:u,onOpen:s,onPin:X,onDelete:M,onDeploy:J}),(0,H.jsx)(Y,{title:`Recents`,apps:b,assistantId:e,pinnedAppIds:u,onOpen:s,onPin:X,onDelete:M,onDeploy:J}),x.length>0?(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)]`,children:`Documents`}),(0,H.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6`,children:x.map(e=>(0,H.jsx)(G,{document:e,onOpen:e=>{a&&a(e)}},e.surfaceId))})]}):null]})}),(0,H.jsx)(L,{assistantId:e,assistantName:t,onStartConversation:i}),(0,H.jsx)(U,{app:j,isDeleting:N,onConfirm:I,onCancel:R})]})}function ee(){let e=R(),t=n();return(0,H.jsx)(z,{children:(0,H.jsx)($,{assistantId:e,title:`Library`,onNewConversation:(0,V.useCallback)(e=>{t(b.assistant)},[t]),onOpenDocument:(0,V.useCallback)(e=>{t(b.document(e))},[t]),onOpenApp:(0,V.useCallback)(e=>{t(b.library.app(e))},[t])})})}export{ee as LibraryPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as r}from"./QueryClientProvider-DKhXIxGb.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./button-C68o-wep.js";import{t as s}from"./menu-B79-l6IU.js";import"./src-Bnn6algv.js";import{t as c}from"./confirm-dialog-94QFOD8a.js";import{n as l,t as u}from"./panel-item-FzMfzMJA.js";import{t as d}from"./input-Cu3PPVCq.js";import{n as f}from"./toast-BL8OPiip.js";import{t as p}from"./arrow-up-BLnb2N1m.js";import{t as m}from"./globe-CMrMrZef.js";import{s as h,t as g}from"./sdk.gen-DgqwY_WN.js";import{f as _,n as v,t as y}from"./react-query.gen-B_oGDSP8.js";import{i as b}from"./routes-VcLWbBmh.js";import{n as x}from"./use-is-mobile-CgLpEUW2.js";import{n as S,t as C}from"./app-html-cache-DuUq2_RD.js";import{t as w}from"./misc-Dml34IDG.js";import{Cn as T,Ji as E,Li as D,V as O,et as k,fa as A,ka as j,qi as M,tt as N,vi as P,wa as F,xi as I}from"./index-87hTkD_v.js";import{t as L}from"./deploy-dialogs-DrOvG0Ma.js";import{t as R}from"./use-active-assistant-id-B2Zd0B4I.js";import{t as z}from"./page-shell-C37pkmXT.js";import{t as B}from"./format-date-6MJxjyy6.js";var V=e(t(),1),H=a();function U({app:e,isDeleting:t,onConfirm:n,onCancel:r}){return(0,H.jsx)(c,{open:e!==null,title:`Delete app`,message:e?`"${e.name}" will be permanently removed.`:``,confirmLabel:t?`Deleting…`:`Delete`,destructive:!0,onConfirm:n,onCancel:r})}function W(e){return e===1?`1 word`:`${e} words`}function G({document:e,onOpen:t}){return(0,H.jsxs)(`div`,{className:`group relative flex flex-col gap-2`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:w(`relative flex w-full cursor-pointer flex-col items-center justify-center gap-2 overflow-hidden rounded-xl border border-[var(--border-base)] bg-[var(--surface-base)]`,`aspect-[16/10]`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:[(0,H.jsx)(F,{size:34,className:`text-[var(--content-tertiary)]`}),(0,H.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:W(e.wordCount)})]}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>t(e.surfaceId),className:`flex cursor-pointer flex-col gap-0.5 px-0.5 text-left outline-none`,children:[(0,H.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)]`,children:e.title}),(0,H.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:B(new Date(e.updatedAt))})]})]})}function K({fileInputRef:e,isImporting:t,onImportBundle:n,onNewConversation:r}){return(0,H.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4 py-24`,children:[(0,H.jsx)(`input`,{ref:e,type:`file`,accept:`.vellum`,className:`hidden`,onChange:n}),(0,H.jsx)(`div`,{className:`flex h-16 w-16 items-center justify-center rounded-xl bg-[var(--surface-base)]`,children:(0,H.jsx)(A,{size:32,className:`text-[var(--content-tertiary)]`})}),(0,H.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Your library is empty`}),(0,H.jsx)(`p`,{className:`max-w-md text-center text-body-medium-lighter text-[color:var(--content-tertiary)]`,children:`Ask your assistant to build something, or import a shared app`}),(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[r?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(o,{variant:`primary`,size:`regular`,onClick:r,children:`New Conversation`}),(0,H.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:`or`})]}):null,(0,H.jsxs)(o,{variant:`outlined`,size:`regular`,onClick:()=>e.current?.click(),disabled:t,children:[t?(0,H.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}):(0,H.jsx)(P,{size:14}),(0,H.jsx)(`span`,{className:`ml-1.5`,children:`Import .vellum File`})]})]})]})}function q({app:e,assistantId:t,isPinned:n,onOpen:r,onPin:i,onDelete:a,onDeploy:o,justImported:s,onAnimationEnd:c}){let[l,u]=(0,V.useState)(!1),d=(0,V.useCallback)(()=>S(t,e.id),[t,e.id]),p=(0,V.useCallback)(async()=>{if(!l){u(!0);try{await N(t,e.id,e.name),f.success(`App exported`,{description:`${e.name}.vellum`})}catch(e){f.error(`Failed to share app`,{description:e instanceof Error?e.message:void 0})}finally{u(!1)}}},[t,e.id,e.name,l]),[m,h]=(0,V.useState)(!1),g=x();return(0,H.jsxs)(`div`,{className:w(`group relative flex flex-col gap-2`,s&&`animate-[card-entrance_400ms_ease-out]`),onAnimationEnd:s?c:void 0,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>r(e.id),className:w(`relative w-full cursor-pointer overflow-hidden rounded-xl`,`outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`),children:(0,H.jsx)(O,{name:e.name,icon:e.icon,loadHtml:d})}),(0,H.jsx)(`div`,{className:w(`absolute right-2 top-2 z-20 transition-opacity`,`max-md:opacity-100`,`md:group-hover:opacity-100 md:group-focus-within:opacity-100`,m?`opacity-100`:`md:opacity-0`),children:(0,H.jsx)(J,{appName:e.name,isPinned:n,open:m,onOpenChange:h,onPin:()=>i(e),onDelete:a?()=>a(e):void 0,onShare:p,onDeploy:o,isMobile:g})}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>r(e.id),className:`flex cursor-pointer flex-col gap-0.5 px-0.5 text-left outline-none`,children:[(0,H.jsx)(`span`,{className:`truncate text-body-large-default text-[color:var(--content-emphasised)]`,children:e.name}),(0,H.jsx)(`span`,{className:`text-body-small-default text-[color:var(--content-tertiary)]`,children:B(new Date(e.createdAt))})]})]})}function J({appName:e,isPinned:t,open:n,onOpenChange:r,onPin:i,onDelete:a,onShare:c,onDeploy:d,isMobile:f}){return f?(0,H.jsxs)(l.Root,{open:n,onOpenChange:r,children:[(0,H.jsx)(l.Trigger,{asChild:!0,children:(0,H.jsx)(o,{variant:`primary`,size:`compact`,iconOnly:(0,H.jsx)(j,{}),"aria-label":`App actions`,onClick:e=>e.stopPropagation()})}),(0,H.jsxs)(l.Content,{children:[(0,H.jsx)(l.Header,{className:`sr-only`,children:(0,H.jsx)(l.Title,{children:e})}),(0,H.jsxs)(l.Body,{className:`pt-0`,children:[(0,H.jsx)(u,{icon:t?E:M,label:t?`Unpin`:`Pin`,onSelect:()=>{r(!1),i()}}),c?(0,H.jsx)(u,{icon:p,label:(0,H.jsxs)(`span`,{className:`flex flex-col gap-0.5 overflow-visible whitespace-normal`,children:[(0,H.jsx)(`span`,{children:`Share`}),(0,H.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Export as .vellum file`})]}),onSelect:()=>{r(!1),c()}}):null,d?(0,H.jsx)(u,{icon:m,label:(0,H.jsxs)(`span`,{className:`flex flex-col gap-0.5 overflow-visible whitespace-normal`,children:[(0,H.jsx)(`span`,{children:`Deploy to Vercel`}),(0,H.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Publish as a static page`})]}),onSelect:()=>{r(!1),d()}}):null,a?(0,H.jsx)(u,{icon:I,label:`Delete`,onSelect:()=>{r(!1),a()}}):null]})]})]}):(0,H.jsxs)(s.Root,{open:n,onOpenChange:r,children:[(0,H.jsx)(s.Trigger,{asChild:!0,children:(0,H.jsx)(o,{variant:`primary`,size:`compact`,iconOnly:(0,H.jsx)(j,{}),"aria-label":`App actions`,onClick:e=>e.stopPropagation()})}),(0,H.jsxs)(s.Content,{align:`end`,sideOffset:4,children:[(0,H.jsx)(s.Item,{leftIcon:t?(0,H.jsx)(E,{size:14}):(0,H.jsx)(M,{size:14}),onSelect:()=>i(),className:`whitespace-nowrap`,children:t?`Unpin`:`Pin`}),c?(0,H.jsx)(s.Item,{leftIcon:(0,H.jsx)(p,{size:14}),onSelect:()=>c(),className:`whitespace-nowrap`,children:`Share`}):null,d?(0,H.jsx)(s.Item,{leftIcon:(0,H.jsx)(m,{size:14}),onSelect:()=>d(),className:`whitespace-nowrap`,children:`Deploy to Vercel`}):null,a?(0,H.jsx)(s.Item,{leftIcon:(0,H.jsx)(I,{size:14,className:`text-red-600`}),onSelect:()=>a(),className:`whitespace-nowrap text-red-600 data-[highlighted]:text-red-700`,children:`Delete`}):null]})]})}function Y({title:e,apps:t,assistantId:n,pinnedAppIds:r,lastImportedAppId:i,onOpen:a,onPin:o,onDelete:s,onDeploy:c,onAnimationEnd:l}){return t.length===0?null:(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)]`,children:e}),(0,H.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6`,children:t.map(e=>(0,H.jsx)(q,{app:e,assistantId:n,isPinned:r.has(e.id),onOpen:a,onPin:o,onDelete:s,justImported:e.id===i,onAnimationEnd:l,onDeploy:c?()=>c(e.id):void 0},e.id))})]})}var X=(e,t)=>t.updatedAt-e.updatedAt||t.createdAt-e.createdAt;function Z(e){let t=T.use.pinnedAppIds(),{data:n=[],isLoading:r,error:a}=i({...y({path:{assistant_id:e}}),select:e=>e.apps}),{data:o=[],isLoading:s,error:c}=i({..._({path:{assistant_id:e}}),select:e=>e.documents}),l=r||s,u=a&&c?a instanceof Error?a.message:`Failed to load library`:null,[d,f]=(0,V.useState)(``),p=(0,V.useMemo)(()=>{if(!d.trim())return n;let e=d.toLowerCase();return n.filter(t=>t.name.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e))},[n,d]);return{apps:n,documents:o,filteredApps:p,pinnedApps:(0,V.useMemo)(()=>p.filter(e=>t.has(e.id)).sort(X),[p,t]),recentApps:(0,V.useMemo)(()=>p.filter(e=>!t.has(e.id)).sort(X),[p,t]),filteredDocuments:(0,V.useMemo)(()=>{if(!d.trim())return o;let e=d.toLowerCase();return o.filter(t=>t.title.toLowerCase().includes(e))},[o,d]),searchText:d,setSearchText:f,loading:l,error:u}}async function Q(e,t){let{data:n,error:r,response:i}=await h({path:{assistant_id:e},body:t,bodySerializer:e=>e,headers:{"Content-Type":`application/octet-stream`},throwOnError:!1});if(!i||!i.ok){let e=(r&&typeof r==`object`&&`message`in r?r.message:null)??`Failed to import app.`;throw Error(e)}return n}function $({assistantId:e,assistantName:t,title:n,onNewConversation:i,onOpenDocument:a,onOpenApp:s}){let c=r(),l=T.use.togglePin(),u=T.use.pinnedAppIds(),p=k.use.isDeploying(),{apps:m,documents:h,filteredApps:_,pinnedApps:y,recentApps:b,filteredDocuments:x,searchText:w,setSearchText:E,loading:O,error:A}=Z(e),[j,M]=(0,V.useState)(null),[N,F]=(0,V.useState)(!1),I=(0,V.useCallback)(async()=>{let t=j;if(!(!t||N)){F(!0);try{await g({path:{assistant_id:e,id:t.id},throwOnError:!0}),C(e,t.id),c.invalidateQueries({queryKey:v({path:{assistant_id:e}})}),u.has(t.id)&&l(t),M(null)}catch(e){f.error(e instanceof Error?e.message:`Failed to delete app`)}finally{F(!1)}}},[j,N,e,u,l,c]),R=(0,V.useCallback)(()=>{N||M(null)},[N]),z=(0,V.useRef)(null),[B,W]=(0,V.useState)(!1),q=(0,V.useCallback)(async t=>{let n=t.target.files?.[0];if(!(!n||B)){W(!0);try{let t=await Q(e,n);await c.invalidateQueries({queryKey:v({path:{assistant_id:e}})}),f.success(t.name+` imported`),s(t.appId)}catch(e){f.error(e instanceof Error?e.message:`Failed to import app`)}finally{W(!1),z.current&&(z.current.value=``)}}},[e,B,c,s]),J=(0,V.useCallback)(async t=>{if(p)return;let n=m.find(e=>e.id===t)?.name??`this app`;try{let r=await S(e,t);k.getState().deployApp(e,t,n,r)}catch{k.getState().deployApp(e,t,n,``)}},[e,p,m]),X=(0,V.useCallback)(e=>l(e),[l]);return O?(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,H.jsx)(`div`,{className:`h-6 w-6 animate-spin rounded-full border-2 border-[var(--border-base)] border-t-[var(--primary-base)]`,role:`status`,"aria-label":`Loading apps`})}):A?(0,H.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 px-4`,children:[(0,H.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:A}),(0,H.jsx)(`button`,{type:`button`,className:`rounded-lg bg-[var(--primary-base)] px-4 py-2 text-body-medium-default text-[var(--content-inset)] transition-colors hover:bg-[var(--primary-hover)]`,onClick:()=>window.location.reload(),children:`Retry`})]}):m.length===0&&h.length===0?(0,H.jsx)(K,{fileInputRef:z,isImporting:B,onImportBundle:q,onNewConversation:i?()=>i():void 0}):(0,H.jsxs)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:[(0,H.jsxs)(`div`,{className:`mb-4 flex shrink-0 items-center justify-between gap-4`,children:[n?(0,H.jsx)(`h1`,{className:`text-title-large text-[var(--content-default)]`,children:n}):(0,H.jsx)(`span`,{}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`input`,{ref:z,type:`file`,accept:`.vellum`,className:`hidden`,onChange:q}),(0,H.jsxs)(o,{variant:`outlined`,size:`regular`,onClick:()=>z.current?.click(),disabled:B,children:[B?(0,H.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent`}):(0,H.jsx)(P,{size:14}),(0,H.jsx)(`span`,{className:`ml-1.5`,children:`Import`})]})]})]}),(0,H.jsx)(`div`,{className:`mb-6 shrink-0`,children:(0,H.jsx)(d,{fullWidth:!0,type:`text`,placeholder:`Search your library`,value:w,onChange:e=>E(e.target.value),leftIcon:(0,H.jsx)(D,{size:16})})}),(0,H.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:_.length===0&&x.length===0?(0,H.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16`,children:[(0,H.jsx)(D,{size:32,className:`mb-4 text-[var(--content-tertiary)]`}),(0,H.jsxs)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:[`No apps or documents matched “`,w,`”`]})]}):(0,H.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,H.jsx)(Y,{title:`Pinned`,apps:y,assistantId:e,pinnedAppIds:u,onOpen:s,onPin:X,onDelete:M,onDeploy:J}),(0,H.jsx)(Y,{title:`Recents`,apps:b,assistantId:e,pinnedAppIds:u,onOpen:s,onPin:X,onDelete:M,onDeploy:J}),x.length>0?(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:`mb-4 text-body-small-emphasised text-[color:var(--content-secondary)]`,children:`Documents`}),(0,H.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(max(220px,calc((100%-6rem)/5)),1fr))] gap-6`,children:x.map(e=>(0,H.jsx)(G,{document:e,onOpen:e=>{a&&a(e)}},e.surfaceId))})]}):null]})}),(0,H.jsx)(L,{assistantId:e,assistantName:t,onStartConversation:i}),(0,H.jsx)(U,{app:j,isDeleting:N,onConfirm:I,onCancel:R})]})}function ee(){let e=R(),t=n();return(0,H.jsx)(z,{children:(0,H.jsx)($,{assistantId:e,title:`Library`,onNewConversation:(0,V.useCallback)(e=>{t(b.assistant)},[t]),onOpenDocument:(0,V.useCallback)(e=>{t(b.document(e))},[t]),onOpenApp:(0,V.useCallback)(e=>{t(b.library.app(e))},[t])})})}export{ee as LibraryPage};
@@ -1 +1 @@
1
- import{i as e}from"./routes-VcLWbBmh.js";import{Nr as t,Wr as n}from"./index-Ue-r3LET.js";var r=`workos`,i=e.account.providerCallback,a=`authIntent`;function o(e,t={}){let n=new URLSearchParams;e&&n.set(`returnTo`,e),t.authIntent&&n.set(a,t.authIntent);let r=n.toString();return r?`${i}?${r}`:i}function s(e){return e.get(a)===`signup`?`signup`:`login`}function c(e){return e.startsWith(`http`)||e.startsWith(`/accounts/`)||e.startsWith(`/v1/`)||e.startsWith(`/_allauth/`)}function l(e,t){return u({returnTo:e,fallback:t,authIntent:`login`})}function u({returnTo:e,fallback:r,authIntent:i}){let a=n(t(),{kind:`post-auth`,authIntent:i,returnTo:e,fallback:r}),o=a.action===`redirect`?a.to:r;return{destination:o,requiresFullPageNavigation:c(o)}}export{u as a,s as i,r as n,l as o,o as r,i as t};
1
+ import{i as e}from"./routes-VcLWbBmh.js";import{Nr as t,Wr as n}from"./index-87hTkD_v.js";var r=`workos`,i=e.account.providerCallback,a=`authIntent`;function o(e,t={}){let n=new URLSearchParams;e&&n.set(`returnTo`,e),t.authIntent&&n.set(a,t.authIntent);let r=n.toString();return r?`${i}?${r}`:i}function s(e){return e.get(a)===`signup`?`signup`:`login`}function c(e){return e.startsWith(`http`)||e.startsWith(`/accounts/`)||e.startsWith(`/v1/`)||e.startsWith(`/_allauth/`)}function l(e,t){return u({returnTo:e,fallback:t,authIntent:`login`})}function u({returnTo:e,fallback:r,authIntent:i}){let a=n(t(),{kind:`post-auth`,authIntent:i,returnTo:e,fallback:r}),o=a.action===`redirect`?a.to:r;return{destination:o,requiresFullPageNavigation:c(o)}}export{u as a,s as i,r as n,l as o,o as r,i as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n,t as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./cn-DFqQkJlk.js";import{t as o}from"./button-C68o-wep.js";import"./src-Bnn6algv.js";import{D as s,E as c,O as l}from"./auth-store-BDBEYGBC.js";import{i as u}from"./routes-VcLWbBmh.js";import{t as d}from"./google-logo-D4cr9Wyw.js";import{t as f}from"./public-asset-BX5-xa7f.js";import{U as p,sa as m}from"./index-Ue-r3LET.js";import{n as h,r as g}from"./login-flow-BbNFfr7k.js";var _=e(t(),1),v=i();function y({children:e}){return(0,v.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col items-center justify-center bg-[var(--surface-base)] text-[var(--content-default)]`,children:[(0,v.jsx)(`img`,{src:f(`/vellum-logo.svg`),alt:`Vellum`,width:220,height:66,className:`block dark:hidden`}),(0,v.jsx)(`img`,{src:f(`/vellum-logo-white.svg`),alt:`Vellum`,width:220,height:66,className:`hidden dark:block`}),e,(0,v.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute left-1/2 w-full max-w-[900px] -translate-x-1/2`,style:{bottom:0},children:(0,v.jsx)(`img`,{src:f(`/login-background-characters.svg`),alt:``,width:880,height:182,className:`h-auto w-full`})})]})}function b(){return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`pointer-events-none absolute top-[120px] left-1/2 z-0 -translate-x-1/2`,children:(0,v.jsx)(`img`,{src:f(`/vellum-logo-white.svg`),alt:`Vellum`,width:92,height:28})}),(0,v.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute right-0 bottom-0 left-1/2 z-0 w-full max-w-[1100px] -translate-x-1/2`,children:(0,v.jsx)(`img`,{src:f(`/login-background-characters.svg`),alt:``,width:880,height:182,className:`h-auto w-full`})})]})}var x=`flex w-full max-w-[448px] flex-col gap-6 rounded-lg border border-[var(--border-disabled)] bg-[var(--surface-lift)] p-6`;function S({children:e}){return(0,v.jsx)(`div`,{className:x,children:e})}function C({children:e}){return(0,v.jsx)(`h1`,{className:`text-title-large text-center text-[var(--content-emphasised)]`,children:e})}function w({children:e,className:t}){return(0,v.jsx)(`p`,{className:a(`text-body-small-default text-center text-[var(--system-negative-strong)]`,t),children:e})}function T({children:e}){return(0,v.jsx)(`div`,{className:`dark`,children:(0,v.jsxs)(`div`,{className:`relative min-h-screen overflow-x-hidden bg-[var(--surface-base)] text-[var(--content-default)]`,children:[(0,v.jsx)(b,{}),(0,v.jsx)(`div`,{className:`relative z-10 flex min-h-screen flex-col items-center justify-center px-4`,children:e})]})})}function E({signUpHref:e}){return(0,v.jsxs)(`p`,{className:`text-body-small-default flex justify-center gap-1`,children:[(0,v.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Don't have an account?`}),(0,v.jsx)(r,{to:e,className:`font-medium text-[var(--content-emphasised)] hover:underline`,children:`Sign up`})]})}function D({returnTo:e,loading:t,errorMessage:n,onProviderClick:r}){let i=e?`${u.account.signup}?returnTo=${encodeURIComponent(e)}`:u.account.signup;return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(C,{children:`Sign in to Vellum`}),n&&(0,v.jsx)(w,{children:n}),(0,v.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,v.jsx)(o,{type:`button`,variant:`outlined`,fullWidth:!0,onClick:()=>r(`AppleOAuth`),disabled:t,leftIcon:(0,v.jsx)(p,{}),className:`max-w-[300px] gap-3`,children:`Continue with Apple`}),(0,v.jsx)(o,{type:`button`,variant:`outlined`,fullWidth:!0,onClick:()=>r(`GoogleOAuth`),disabled:t,leftIcon:(0,v.jsx)(d,{}),className:`max-w-[300px] gap-3`,children:`Continue with Google`}),(0,v.jsx)(o,{type:`button`,variant:`outlined`,fullWidth:!0,onClick:()=>r(),disabled:t,leftIcon:(0,v.jsx)(m,{}),className:`max-w-[300px] gap-3`,children:`Continue with Email`})]}),(0,v.jsx)(E,{signUpHref:i})]})}var O={signup_closed:`Sign-ups are currently closed. Visit vellum.ai/community to request access.`};function k({returnTo:e}){let[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!1),a=async()=>{n(null),i(!0);try{await s({returnTo:e??null})}catch(e){let t=e&&typeof e==`object`&&`code`in e?e.code:void 0;if(t===`USER_CANCELLED`){i(!1);return}if(t===`AUTH_ERROR`){let t=e&&typeof e==`object`&&`data`in e&&e.data&&typeof e.data==`object`&&`authError`in e.data&&typeof e.data.authError==`string`?e.data.authError:void 0;n((t&&O[t])??`Something went wrong. Please try again.`)}else console.error(`[native-auth] auth flow failed:`,e),n(`Something went wrong. Please try again.`);i(!1)}};return(0,v.jsx)(y,{children:(0,v.jsxs)(`div`,{className:`z-10 mt-8 flex w-full max-w-[320px] flex-col items-center gap-3`,children:[t&&(0,v.jsx)(w,{className:`max-w-[280px]`,children:t}),(0,v.jsx)(o,{type:`button`,variant:`primary`,fullWidth:!0,onClick:()=>{a()},disabled:r,className:`max-w-[300px]`,children:`Sign in`})]})})}function A({returnTo:e}){let[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!1),a=g(e),o=async t=>{n(null),i(!0);try{await c(h,a,{...t?{providerHint:t}:{},returnTo:e})}catch(e){console.error(`[web-login] auth flow failed:`,e),n(`Something went wrong. Please try again.`),i(!1)}};return(0,v.jsx)(T,{children:(0,v.jsx)(S,{children:(0,v.jsx)(D,{returnTo:e,loading:r,errorMessage:t,onProviderClick:e=>{o(e)}})})})}function j(){let[e]=n(),t=l(),r=e.get(`returnTo`);return t?(0,v.jsx)(k,{returnTo:r}):(0,v.jsx)(A,{returnTo:r})}export{j as LoginPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n,t as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./cn-DFqQkJlk.js";import{t as o}from"./button-C68o-wep.js";import"./src-Bnn6algv.js";import{D as s,E as c,O as l}from"./auth-store-C4gcHOWH.js";import{i as u}from"./routes-VcLWbBmh.js";import{t as d}from"./google-logo-D4cr9Wyw.js";import{t as f}from"./public-asset-BX5-xa7f.js";import{U as p,sa as m}from"./index-87hTkD_v.js";import{n as h,r as g}from"./login-flow-DmfVD3r_.js";var _=e(t(),1),v=i();function y({children:e}){return(0,v.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col items-center justify-center bg-[var(--surface-base)] text-[var(--content-default)]`,children:[(0,v.jsx)(`img`,{src:f(`/vellum-logo.svg`),alt:`Vellum`,width:220,height:66,className:`block dark:hidden`}),(0,v.jsx)(`img`,{src:f(`/vellum-logo-white.svg`),alt:`Vellum`,width:220,height:66,className:`hidden dark:block`}),e,(0,v.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute left-1/2 w-full max-w-[900px] -translate-x-1/2`,style:{bottom:0},children:(0,v.jsx)(`img`,{src:f(`/login-background-characters.svg`),alt:``,width:880,height:182,className:`h-auto w-full`})})]})}function b(){return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`pointer-events-none absolute top-[120px] left-1/2 z-0 -translate-x-1/2`,children:(0,v.jsx)(`img`,{src:f(`/vellum-logo-white.svg`),alt:`Vellum`,width:92,height:28})}),(0,v.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute right-0 bottom-0 left-1/2 z-0 w-full max-w-[1100px] -translate-x-1/2`,children:(0,v.jsx)(`img`,{src:f(`/login-background-characters.svg`),alt:``,width:880,height:182,className:`h-auto w-full`})})]})}var x=`flex w-full max-w-[448px] flex-col gap-6 rounded-lg border border-[var(--border-disabled)] bg-[var(--surface-lift)] p-6`;function S({children:e}){return(0,v.jsx)(`div`,{className:x,children:e})}function C({children:e}){return(0,v.jsx)(`h1`,{className:`text-title-large text-center text-[var(--content-emphasised)]`,children:e})}function w({children:e,className:t}){return(0,v.jsx)(`p`,{className:a(`text-body-small-default text-center text-[var(--system-negative-strong)]`,t),children:e})}function T({children:e}){return(0,v.jsx)(`div`,{className:`dark`,children:(0,v.jsxs)(`div`,{className:`relative min-h-screen overflow-x-hidden bg-[var(--surface-base)] text-[var(--content-default)]`,children:[(0,v.jsx)(b,{}),(0,v.jsx)(`div`,{className:`relative z-10 flex min-h-screen flex-col items-center justify-center px-4`,children:e})]})})}function E({signUpHref:e}){return(0,v.jsxs)(`p`,{className:`text-body-small-default flex justify-center gap-1`,children:[(0,v.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Don't have an account?`}),(0,v.jsx)(r,{to:e,className:`font-medium text-[var(--content-emphasised)] hover:underline`,children:`Sign up`})]})}function D({returnTo:e,loading:t,errorMessage:n,onProviderClick:r}){let i=e?`${u.account.signup}?returnTo=${encodeURIComponent(e)}`:u.account.signup;return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(C,{children:`Sign in to Vellum`}),n&&(0,v.jsx)(w,{children:n}),(0,v.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,v.jsx)(o,{type:`button`,variant:`outlined`,fullWidth:!0,onClick:()=>r(`AppleOAuth`),disabled:t,leftIcon:(0,v.jsx)(p,{}),className:`max-w-[300px] gap-3`,children:`Continue with Apple`}),(0,v.jsx)(o,{type:`button`,variant:`outlined`,fullWidth:!0,onClick:()=>r(`GoogleOAuth`),disabled:t,leftIcon:(0,v.jsx)(d,{}),className:`max-w-[300px] gap-3`,children:`Continue with Google`}),(0,v.jsx)(o,{type:`button`,variant:`outlined`,fullWidth:!0,onClick:()=>r(),disabled:t,leftIcon:(0,v.jsx)(m,{}),className:`max-w-[300px] gap-3`,children:`Continue with Email`})]}),(0,v.jsx)(E,{signUpHref:i})]})}var O={signup_closed:`Sign-ups are currently closed. Visit vellum.ai/community to request access.`};function k({returnTo:e}){let[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!1),a=async()=>{n(null),i(!0);try{await s({returnTo:e??null})}catch(e){let t=e&&typeof e==`object`&&`code`in e?e.code:void 0;if(t===`USER_CANCELLED`){i(!1);return}if(t===`AUTH_ERROR`){let t=e&&typeof e==`object`&&`data`in e&&e.data&&typeof e.data==`object`&&`authError`in e.data&&typeof e.data.authError==`string`?e.data.authError:void 0;n((t&&O[t])??`Something went wrong. Please try again.`)}else console.error(`[native-auth] auth flow failed:`,e),n(`Something went wrong. Please try again.`);i(!1)}};return(0,v.jsx)(y,{children:(0,v.jsxs)(`div`,{className:`z-10 mt-8 flex w-full max-w-[320px] flex-col items-center gap-3`,children:[t&&(0,v.jsx)(w,{className:`max-w-[280px]`,children:t}),(0,v.jsx)(o,{type:`button`,variant:`primary`,fullWidth:!0,onClick:()=>{a()},disabled:r,className:`max-w-[300px]`,children:`Sign in`})]})})}function A({returnTo:e}){let[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)(!1),a=g(e),o=async t=>{n(null),i(!0);try{await c(h,a,{...t?{providerHint:t}:{},returnTo:e})}catch(e){console.error(`[web-login] auth flow failed:`,e),n(`Something went wrong. Please try again.`),i(!1)}};return(0,v.jsx)(T,{children:(0,v.jsx)(S,{children:(0,v.jsx)(D,{returnTo:e,loading:r,errorMessage:t,onProviderClick:e=>{o(e)}})})})}function j(){let[e]=n(),t=l(),r=e.get(`returnTo`);return t?(0,v.jsx)(k,{returnTo:r}):(0,v.jsx)(A,{returnTo:r})}export{j as LoginPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{M as i,n as a}from"./auth-store-BDBEYGBC.js";import{i as o}from"./routes-VcLWbBmh.js";import{xr as s}from"./index-Ue-r3LET.js";import{r as c,t as l}from"./account-shell-C6-wTQZB.js";var u=e(t(),1),d=r();function f(){let[e]=n(),t=a.use.logout(),r=(0,u.useRef)(!1);return(0,u.useEffect)(()=>{if(r.current)return;r.current=!0;let n=i(e.get(`returnTo`),o.account.login),a=n.startsWith(`http`)||n===o.account.login?n:`${o.account.login}?returnTo=${encodeURIComponent(n)}`,c=!1;return t().then(()=>{c||s(a)},()=>{c||s(a)}),()=>{c=!0}},[t,e]),(0,d.jsx)(l,{children:(0,d.jsx)(c,{title:`Signing out...`})})}export{f as LogoutPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{M as i,n as a}from"./auth-store-C4gcHOWH.js";import{i as o}from"./routes-VcLWbBmh.js";import{xr as s}from"./index-87hTkD_v.js";import{r as c,t as l}from"./account-shell-C6-wTQZB.js";var u=e(t(),1),d=r();function f(){let[e]=n(),t=a.use.logout(),r=(0,u.useRef)(!1);return(0,u.useEffect)(()=>{if(r.current)return;r.current=!0;let n=i(e.get(`returnTo`),o.account.login),a=n.startsWith(`http`)||n===o.account.login?n:`${o.account.login}?returnTo=${encodeURIComponent(n)}`,c=!1;return t().then(()=>{c||s(a)},()=>{c||s(a)}),()=>{c=!0}},[t,e]),(0,d.jsx)(l,{children:(0,d.jsx)(c,{title:`Signing out...`})})}export{f as LogoutPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{i as n,u as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./createLucideIcon-D6d6iDdi.js";import{i as o}from"./routes-VcLWbBmh.js";import{Dn as s,Ri as c,eo as l,sa as u}from"./index-Ue-r3LET.js";import{n as d,t as f}from"./sidebar-tree-CivI4sXe.js";var p=a(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),m=e(t(),1),h=[{id:`usage`,label:`Usage`,href:o.logs.usage,icon:l},{id:`logs`,label:`Logs`,href:o.logs.trace,icon:c},{id:`emails`,label:`Emails`,href:o.logs.emails,icon:u},{id:`system-events`,label:`System Events`,href:o.logs.systemEvents,icon:p}],g=i();function _(){let e=s({platformHostedOnly:!0}),t=s(),{pathname:i}=r(),a=(0,m.useMemo)(()=>h.filter(n=>!(n.id===`system-events`&&e===`gated`||n.id===`emails`&&t===`gated`)),[e,t]),c=(0,m.useMemo)(()=>{let e=h.find(e=>i===e.href||i.startsWith(e.href+`/`));return e?e.label:i===o.logs.root?h[0]?.label??`Logs & Usage`:`Logs & Usage`},[i]);return(0,g.jsx)(d,{backHref:o.assistant,sidebar:(0,g.jsx)(f,{items:a,indexPath:o.logs.root}),title:c,menuRoute:o.logs.root,children:(0,g.jsx)(n,{})})}export{_ as LogsLayout};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{i as n,u as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./createLucideIcon-D6d6iDdi.js";import{i as o}from"./routes-VcLWbBmh.js";import{Dn as s,Ri as c,sa as l,to as u}from"./index-87hTkD_v.js";import{n as d,t as f}from"./sidebar-tree-KVdXcht-.js";var p=a(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),m=e(t(),1),h=[{id:`usage`,label:`Usage`,href:o.logs.usage,icon:u},{id:`logs`,label:`Logs`,href:o.logs.trace,icon:c},{id:`emails`,label:`Emails`,href:o.logs.emails,icon:l},{id:`system-events`,label:`System Events`,href:o.logs.systemEvents,icon:p}],g=i();function _(){let e=s({platformHostedOnly:!0}),t=s(),{pathname:i}=r(),a=(0,m.useMemo)(()=>h.filter(n=>!(n.id===`system-events`&&e===`gated`||n.id===`emails`&&t===`gated`)),[e,t]),c=(0,m.useMemo)(()=>{let e=h.find(e=>i===e.href||i.startsWith(e.href+`/`));return e?e.label:i===o.logs.root?h[0]?.label??`Logs & Usage`:`Logs & Usage`},[i]);return(0,g.jsx)(d,{backHref:o.assistant,sidebar:(0,g.jsx)(f,{items:a,indexPath:o.logs.root}),title:c,menuRoute:o.logs.root,children:(0,g.jsx)(n,{})})}export{_ as LogsLayout};
@@ -1,3 +1,3 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./useQuery-B45lW1Kk.js";import{t as r}from"./useMutation-Lj4VunQV.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./card-CL5iEMJO.js";import"./src-Bnn6algv.js";import{Ht as o,S as s,Ut as c,Wt as l}from"./sdk.gen-18Tp6Ee_.js";import{a as u,n as d}from"./auth-store-BDBEYGBC.js";import{Mn as f,Mr as p}from"./index-Ue-r3LET.js";import{t as m}from"./use-active-assistant-id-B2Zd0B4I.js";var h=e(t(),1),g=class extends Error{status;constructor(e,t){super(t),this.name=`SimulateMemoryRouterError`,this.status=e}};async function _(e,t,n){let{data:r,response:i}=await l({path:{assistant_id:e},body:t,signal:n,throwOnError:!1}),a=i?await i.clone().text().catch(()=>``):``;if(!i||!i.ok)throw new g(i?.status??0,a||i?.statusText||`Failed to simulate memory router`);if(!r)throw new g(i.status,`Empty response from memory router simulator endpoint`);return{response:r,rawRequest:JSON.stringify(t,null,2),rawResponse:v(a)}}function v(e){if(e.length===0)return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function y(e){return r({mutationFn:async t=>{if(!e)throw new g(0,`Missing assistantId`);return _(e,t)}})}async function b(e,t){let{data:n,response:r}=await s({path:{assistant_id:e},signal:t,throwOnError:!1});if(!r||!r.ok)throw new g(r?.status??0,r?.statusText??`Failed to load LLM profiles`);if(!n)throw new g(r.status,`Empty response from profile list endpoint`);return n}function ee(e){return n({queryKey:[`llm-profiles`,e],queryFn:async({signal:t})=>{if(!e)throw new g(0,`Missing assistantId`);return b(e,t)},enabled:!!e,staleTime:6e4})}async function x(e,t){let{data:n,response:r}=await c({path:{assistant_id:e},signal:t,throwOnError:!1});if(!r||!r.ok)throw new g(r?.status??0,r?.statusText??`Failed to load router prompt template`);if(!n)throw new g(r.status,`Empty response from router prompt template endpoint`);return n}function te(e){return n({queryKey:[`router-prompt-template`,e],queryFn:async({signal:t})=>{if(!e)throw new g(0,`Missing assistantId`);return x(e,t)},enabled:!!e,staleTime:1440*60*1e3})}async function S(e,t){let{data:n,response:r}=await o({path:{assistant_id:e},signal:t,throwOnError:!1});if(!r||!r.ok)throw new g(r?.status??0,r?.statusText??`Failed to load NOW.md`);if(!n)throw new g(r.status,`Empty response from now-text endpoint`);return n}function C(e){return n({queryKey:[`memory-router-now-text`,e],queryFn:async({signal:t})=>{if(!e)throw new g(0,`Missing assistantId`);return S(e,t)},enabled:!!e,staleTime:1/0})}var w=i();function T(){let e=d.use.user(),t=u(),n=p.use.memoryRouterPlayground();return t?(0,w.jsx)($,{children:`Loading…`}):!f(e)||!n?(0,w.jsx)($,{children:`Memory router playground is not available.`}):(0,w.jsx)(D,{})}var E={tier1:``,tier2:``,batch:``,profile:``,customPrompt:``};function D(){let e=m(),t=y(e),n=y(e),r=ee(e),i=te(e),a=C(e),[o,s]=(0,h.useState)(``),[c,l]=(0,h.useState)([{assistantMessage:``,userMessage:``}]),[u,d]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(u)return;let e=a.data?.nowText;typeof e==`string`&&o===``&&s(e)},[a.data?.nowText,o,u]);let[f,p]=(0,h.useState)(E),[g,_]=(0,h.useState)(E),[v,b]=(0,h.useState)(null),[x,S]=(0,h.useState)(null),T=c[c.length-1].userMessage,D=e=>{let r=e===`A`?f:g,i=e===`A`?b:S,a=e===`A`?t:n;i(null);let s;try{s=O(r)}catch(e){i(e instanceof Error?e.message:`Invalid override input`);return}let l=r.profile.trim().length>0?r.profile:void 0,u=r.customPrompt.trim().length>0?r.customPrompt:void 0,d=c.map((e,t)=>t===c.length-1?{...e,userMessage:e.userMessage.trim()}:e);a.mutate({recentTurnPairs:d,nowText:o,...s?{configOverrides:s}:{},...l===void 0?{}:{profileOverride:l},...u===void 0?{}:{routerPromptOverride:u}})},k=()=>{D(`A`),D(`B`)},M=T.trim().length>0,P=M&&!t.isPending,F=M&&!n.isPending;return(0,w.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-y-auto`,children:(0,w.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[1280px] flex-col gap-6 p-6`,children:[(0,w.jsx)(A,{}),(0,w.jsx)(j,{nowText:o,onNowTextChange:e=>{d(!0),s(e)},onReloadNowText:()=>{let e=a.data?.nowText;typeof e==`string`&&(s(e),d(!1))},nowTextLoading:a.isLoading,pairs:c,onPairsChange:l}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,w.jsx)(N,{paneId:`A`,overrides:f,onChange:p,onRun:()=>D(`A`),canRun:P,isRunning:t.isPending,profiles:r.data?.profiles??[],activeProfile:r.data?.activeProfile??null,defaultPromptTemplate:i.data?.template??``}),(0,w.jsx)(N,{paneId:`B`,overrides:g,onChange:_,onRun:()=>D(`B`),canRun:F,isRunning:n.isPending,profiles:r.data?.profiles??[],activeProfile:r.data?.activeProfile??null,defaultPromptTemplate:i.data?.template??``})]}),(0,w.jsx)(`div`,{className:`flex justify-end`,children:(0,w.jsx)(ne,{onClick:k,disabled:!M||t.isPending||n.isPending,isRunning:t.isPending||n.isPending})}),(0,w.jsx)(re,{visible:t.data!==void 0&&n.data!==void 0}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,w.jsx)(R,{paneId:`A`,userMessage:T,mutation:t,otherResult:n.data?.response,validation:v}),(0,w.jsx)(R,{paneId:`B`,userMessage:T,mutation:n,otherResult:t.data?.response,validation:x})]})]})})}function O(e){let t={...k(`tier1_size`,e.tier1),...k(`tier2_size`,e.tier2),...k(`batch_size`,e.batch)};return Object.keys(t).length===0?void 0:t}function k(e,t){let n=t.trim();if(n===``)return{};if(n===`null`)return{[e]:null};let r=Number(n);if(!Number.isInteger(r)||r<1)throw Error(`${e} must be a positive integer or 'null' (got "${n}")`);return{[e]:r}}function A(){return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`h1`,{className:`text-body-large-default`,style:{color:`var(--content-default)`},children:`Memory Router Playground`}),(0,w.jsxs)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:[`Dry-run the v4 router with custom tier/batch overrides. Read-only — no rows are written to `,(0,w.jsx)(`code`,{children:`memory_v2_injection_events`}),` or`,` `,(0,w.jsx)(`code`,{children:`memory_v2_activation_logs`}),`, and no activation state is mutated. Leave an override blank to inherit the live config value; enter`,` `,(0,w.jsx)(`code`,{children:`null`}),` to explicitly disable a tier.`]})]})}function j({nowText:e,onNowTextChange:t,onReloadNowText:n,nowTextLoading:r,pairs:i,onPairsChange:o}){let s=(e,t)=>{o(i.map((n,r)=>r===e?{...n,...t}:n))},c=()=>{o([{assistantMessage:``,userMessage:``},...i])},l=e=>{e!==i.length-1&&o(i.filter((t,n)=>n!==e))};return(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:`Conversational context (shared by both panes)`}),(0,w.jsx)(M,{id:`memory-router-playground-now`,label:`<now> block`,value:e,onChange:t,rows:6,monospace:!0,placeholder:r?`Loading current NOW.md…`:`Pre-filled with the live NOW.md. Edit to test alternate states.`,trailing:(0,w.jsx)(`button`,{type:`button`,onClick:n,disabled:r,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:r?`not-allowed`:`pointer`},children:`Reload live NOW.md`})}),(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsx)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:`Recent (assistant, user) pairs · oldest first`}),(0,w.jsx)(`button`,{type:`button`,onClick:c,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:`pointer`},children:`+ Add older pair`})]}),i.map((e,t)=>{let n=t===i.length-1;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border p-3`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`},children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsxs)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:[`Pair `,t+1,` of `,i.length,n?` · most recent`:``]}),!n&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`rounded px-2 py-1 text-label-default`,style:{background:`transparent`,color:`var(--system-negative-strong)`,border:`none`,cursor:`pointer`},children:`Remove`})]}),(0,w.jsx)(M,{id:`memory-router-playground-pair-${t}-assistant`,label:`[assistant]: reply`,value:e.assistantMessage,onChange:e=>s(t,{assistantMessage:e}),rows:3,placeholder:t===0&&i.length===1?`Leave blank for a first-turn scenario.`:`Assistant's reply that came before the user message below.`}),(0,w.jsx)(M,{id:`memory-router-playground-pair-${t}-user`,label:n?`Just-arrived [user]: message`:`[user]: message`,value:e.userMessage,onChange:e=>s(t,{userMessage:e}),rows:3,placeholder:n?`e.g. what should we ship next`:`User's message.`,required:n})]},t)})]})})}function M({id:e,label:t,value:n,onChange:r,rows:i,placeholder:a,monospace:o,trailing:s,required:c}){return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`label`,{htmlFor:e,className:`text-label-default`,style:{color:`var(--content-secondary)`},children:[t,c?` *`:``]}),s]}),(0,w.jsx)(`textarea`,{id:e,value:n,onChange:e=>r(e.target.value),rows:i,placeholder:a,className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,resize:`vertical`,...o?{fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`}:{}}})]})}function N({paneId:e,overrides:t,onChange:n,onRun:r,canRun:i,isRunning:o,profiles:s,activeProfile:c,defaultPromptTemplate:l}){return(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,w.jsxs)(`div`,{className:`text-body-medium-default`,style:{color:X(e)},children:[`Config `,e]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,w.jsx)(I,{paneId:e,label:`tier1_size`,value:t.tier1,onChange:e=>n({...t,tier1:e})}),(0,w.jsx)(I,{paneId:e,label:`tier2_size`,value:t.tier2,onChange:e=>n({...t,tier2:e})}),(0,w.jsx)(I,{paneId:e,label:`batch_size`,value:t.batch,onChange:e=>n({...t,batch:e})})]}),(0,w.jsx)(F,{paneId:e,value:t.profile,onChange:e=>n({...t,profile:e}),profiles:s,activeProfile:c}),(0,w.jsx)(P,{paneId:e,value:t.customPrompt,onChange:e=>n({...t,customPrompt:e}),defaultTemplate:l}),(0,w.jsx)(`div`,{className:`flex justify-end`,children:(0,w.jsx)(`button`,{type:`button`,onClick:r,disabled:!i,className:`rounded-md px-4 py-2 text-body-medium-default transition-colors`,style:{background:i?`var(--system-positive-strong)`:`var(--surface-overlay)`,color:i?`var(--content-on-positive)`:`var(--content-disabled)`,border:`none`,cursor:i?`pointer`:`not-allowed`},children:o?`Running…`:`Run ${e}`})})]})})}function P({paneId:e,value:t,onChange:n,defaultTemplate:r}){let[i,a]=(0,h.useState)(!1),o=`memory-router-playground-${e}-prompt`,s=t.trim().length>0;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`text-label-default`,style:{color:`var(--content-secondary)`,background:`transparent`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`},children:[i?`▾`:`▸`,` System prompt`,` `,(0,w.jsxs)(`span`,{style:{color:`var(--content-tertiary)`},children:[`(`,s?`custom`:`bundled`,`)`]})]}),i&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(r),disabled:r.length===0,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:r.length===0?`not-allowed`:`pointer`},children:`Load default`}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(``),disabled:!s,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:s?`pointer`:`not-allowed`},children:`Reset`})]})]}),i&&(0,w.jsx)(`textarea`,{id:o,value:t,onChange:e=>n(e.target.value),rows:12,placeholder:`Custom router system prompt. Available placeholders:
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./useQuery-B45lW1Kk.js";import{t as r}from"./useMutation-Lj4VunQV.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./card-CL5iEMJO.js";import"./src-Bnn6algv.js";import{Gt as o,S as s,Ut as c,Wt as l}from"./sdk.gen-DgqwY_WN.js";import{a as u,n as d}from"./auth-store-C4gcHOWH.js";import{Mn as f,Mr as p}from"./index-87hTkD_v.js";import{t as m}from"./use-active-assistant-id-B2Zd0B4I.js";var h=e(t(),1),g=class extends Error{status;constructor(e,t){super(t),this.name=`SimulateMemoryRouterError`,this.status=e}};async function _(e,t,n){let{data:r,response:i}=await o({path:{assistant_id:e},body:t,signal:n,throwOnError:!1}),a=i?await i.clone().text().catch(()=>``):``;if(!i||!i.ok)throw new g(i?.status??0,a||i?.statusText||`Failed to simulate memory router`);if(!r)throw new g(i.status,`Empty response from memory router simulator endpoint`);return{response:r,rawRequest:JSON.stringify(t,null,2),rawResponse:v(a)}}function v(e){if(e.length===0)return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function y(e){return r({mutationFn:async t=>{if(!e)throw new g(0,`Missing assistantId`);return _(e,t)}})}async function b(e,t){let{data:n,response:r}=await s({path:{assistant_id:e},signal:t,throwOnError:!1});if(!r||!r.ok)throw new g(r?.status??0,r?.statusText??`Failed to load LLM profiles`);if(!n)throw new g(r.status,`Empty response from profile list endpoint`);return n}function ee(e){return n({queryKey:[`llm-profiles`,e],queryFn:async({signal:t})=>{if(!e)throw new g(0,`Missing assistantId`);return b(e,t)},enabled:!!e,staleTime:6e4})}async function x(e,t){let{data:n,response:r}=await l({path:{assistant_id:e},signal:t,throwOnError:!1});if(!r||!r.ok)throw new g(r?.status??0,r?.statusText??`Failed to load router prompt template`);if(!n)throw new g(r.status,`Empty response from router prompt template endpoint`);return n}function te(e){return n({queryKey:[`router-prompt-template`,e],queryFn:async({signal:t})=>{if(!e)throw new g(0,`Missing assistantId`);return x(e,t)},enabled:!!e,staleTime:1440*60*1e3})}async function S(e,t){let{data:n,response:r}=await c({path:{assistant_id:e},signal:t,throwOnError:!1});if(!r||!r.ok)throw new g(r?.status??0,r?.statusText??`Failed to load NOW.md`);if(!n)throw new g(r.status,`Empty response from now-text endpoint`);return n}function C(e){return n({queryKey:[`memory-router-now-text`,e],queryFn:async({signal:t})=>{if(!e)throw new g(0,`Missing assistantId`);return S(e,t)},enabled:!!e,staleTime:1/0})}var w=i();function T(){let e=d.use.user(),t=u(),n=p.use.memoryRouterPlayground();return t?(0,w.jsx)($,{children:`Loading…`}):!f(e)||!n?(0,w.jsx)($,{children:`Memory router playground is not available.`}):(0,w.jsx)(D,{})}var E={tier1:``,tier2:``,batch:``,profile:``,customPrompt:``};function D(){let e=m(),t=y(e),n=y(e),r=ee(e),i=te(e),a=C(e),[o,s]=(0,h.useState)(``),[c,l]=(0,h.useState)([{assistantMessage:``,userMessage:``}]),[u,d]=(0,h.useState)(!1);(0,h.useEffect)(()=>{if(u)return;let e=a.data?.nowText;typeof e==`string`&&o===``&&s(e)},[a.data?.nowText,o,u]);let[f,p]=(0,h.useState)(E),[g,_]=(0,h.useState)(E),[v,b]=(0,h.useState)(null),[x,S]=(0,h.useState)(null),T=c[c.length-1].userMessage,D=e=>{let r=e===`A`?f:g,i=e===`A`?b:S,a=e===`A`?t:n;i(null);let s;try{s=O(r)}catch(e){i(e instanceof Error?e.message:`Invalid override input`);return}let l=r.profile.trim().length>0?r.profile:void 0,u=r.customPrompt.trim().length>0?r.customPrompt:void 0,d=c.map((e,t)=>t===c.length-1?{...e,userMessage:e.userMessage.trim()}:e);a.mutate({recentTurnPairs:d,nowText:o,...s?{configOverrides:s}:{},...l===void 0?{}:{profileOverride:l},...u===void 0?{}:{routerPromptOverride:u}})},k=()=>{D(`A`),D(`B`)},M=T.trim().length>0,P=M&&!t.isPending,F=M&&!n.isPending;return(0,w.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-y-auto`,children:(0,w.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[1280px] flex-col gap-6 p-6`,children:[(0,w.jsx)(A,{}),(0,w.jsx)(j,{nowText:o,onNowTextChange:e=>{d(!0),s(e)},onReloadNowText:()=>{let e=a.data?.nowText;typeof e==`string`&&(s(e),d(!1))},nowTextLoading:a.isLoading,pairs:c,onPairsChange:l}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,w.jsx)(N,{paneId:`A`,overrides:f,onChange:p,onRun:()=>D(`A`),canRun:P,isRunning:t.isPending,profiles:r.data?.profiles??[],activeProfile:r.data?.activeProfile??null,defaultPromptTemplate:i.data?.template??``}),(0,w.jsx)(N,{paneId:`B`,overrides:g,onChange:_,onRun:()=>D(`B`),canRun:F,isRunning:n.isPending,profiles:r.data?.profiles??[],activeProfile:r.data?.activeProfile??null,defaultPromptTemplate:i.data?.template??``})]}),(0,w.jsx)(`div`,{className:`flex justify-end`,children:(0,w.jsx)(ne,{onClick:k,disabled:!M||t.isPending||n.isPending,isRunning:t.isPending||n.isPending})}),(0,w.jsx)(re,{visible:t.data!==void 0&&n.data!==void 0}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,w.jsx)(R,{paneId:`A`,userMessage:T,mutation:t,otherResult:n.data?.response,validation:v}),(0,w.jsx)(R,{paneId:`B`,userMessage:T,mutation:n,otherResult:t.data?.response,validation:x})]})]})})}function O(e){let t={...k(`tier1_size`,e.tier1),...k(`tier2_size`,e.tier2),...k(`batch_size`,e.batch)};return Object.keys(t).length===0?void 0:t}function k(e,t){let n=t.trim();if(n===``)return{};if(n===`null`)return{[e]:null};let r=Number(n);if(!Number.isInteger(r)||r<1)throw Error(`${e} must be a positive integer or 'null' (got "${n}")`);return{[e]:r}}function A(){return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`h1`,{className:`text-body-large-default`,style:{color:`var(--content-default)`},children:`Memory Router Playground`}),(0,w.jsxs)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:[`Dry-run the v4 router with custom tier/batch overrides. Read-only — no rows are written to `,(0,w.jsx)(`code`,{children:`memory_v2_injection_events`}),` or`,` `,(0,w.jsx)(`code`,{children:`memory_v2_activation_logs`}),`, and no activation state is mutated. Leave an override blank to inherit the live config value; enter`,` `,(0,w.jsx)(`code`,{children:`null`}),` to explicitly disable a tier.`]})]})}function j({nowText:e,onNowTextChange:t,onReloadNowText:n,nowTextLoading:r,pairs:i,onPairsChange:o}){let s=(e,t)=>{o(i.map((n,r)=>r===e?{...n,...t}:n))},c=()=>{o([{assistantMessage:``,userMessage:``},...i])},l=e=>{e!==i.length-1&&o(i.filter((t,n)=>n!==e))};return(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:`Conversational context (shared by both panes)`}),(0,w.jsx)(M,{id:`memory-router-playground-now`,label:`<now> block`,value:e,onChange:t,rows:6,monospace:!0,placeholder:r?`Loading current NOW.md…`:`Pre-filled with the live NOW.md. Edit to test alternate states.`,trailing:(0,w.jsx)(`button`,{type:`button`,onClick:n,disabled:r,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:r?`not-allowed`:`pointer`},children:`Reload live NOW.md`})}),(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsx)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:`Recent (assistant, user) pairs · oldest first`}),(0,w.jsx)(`button`,{type:`button`,onClick:c,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:`pointer`},children:`+ Add older pair`})]}),i.map((e,t)=>{let n=t===i.length-1;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border p-3`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`},children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsxs)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:[`Pair `,t+1,` of `,i.length,n?` · most recent`:``]}),!n&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`rounded px-2 py-1 text-label-default`,style:{background:`transparent`,color:`var(--system-negative-strong)`,border:`none`,cursor:`pointer`},children:`Remove`})]}),(0,w.jsx)(M,{id:`memory-router-playground-pair-${t}-assistant`,label:`[assistant]: reply`,value:e.assistantMessage,onChange:e=>s(t,{assistantMessage:e}),rows:3,placeholder:t===0&&i.length===1?`Leave blank for a first-turn scenario.`:`Assistant's reply that came before the user message below.`}),(0,w.jsx)(M,{id:`memory-router-playground-pair-${t}-user`,label:n?`Just-arrived [user]: message`:`[user]: message`,value:e.userMessage,onChange:e=>s(t,{userMessage:e}),rows:3,placeholder:n?`e.g. what should we ship next`:`User's message.`,required:n})]},t)})]})})}function M({id:e,label:t,value:n,onChange:r,rows:i,placeholder:a,monospace:o,trailing:s,required:c}){return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`label`,{htmlFor:e,className:`text-label-default`,style:{color:`var(--content-secondary)`},children:[t,c?` *`:``]}),s]}),(0,w.jsx)(`textarea`,{id:e,value:n,onChange:e=>r(e.target.value),rows:i,placeholder:a,className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,resize:`vertical`,...o?{fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`}:{}}})]})}function N({paneId:e,overrides:t,onChange:n,onRun:r,canRun:i,isRunning:o,profiles:s,activeProfile:c,defaultPromptTemplate:l}){return(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,w.jsxs)(`div`,{className:`text-body-medium-default`,style:{color:X(e)},children:[`Config `,e]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,w.jsx)(I,{paneId:e,label:`tier1_size`,value:t.tier1,onChange:e=>n({...t,tier1:e})}),(0,w.jsx)(I,{paneId:e,label:`tier2_size`,value:t.tier2,onChange:e=>n({...t,tier2:e})}),(0,w.jsx)(I,{paneId:e,label:`batch_size`,value:t.batch,onChange:e=>n({...t,batch:e})})]}),(0,w.jsx)(F,{paneId:e,value:t.profile,onChange:e=>n({...t,profile:e}),profiles:s,activeProfile:c}),(0,w.jsx)(P,{paneId:e,value:t.customPrompt,onChange:e=>n({...t,customPrompt:e}),defaultTemplate:l}),(0,w.jsx)(`div`,{className:`flex justify-end`,children:(0,w.jsx)(`button`,{type:`button`,onClick:r,disabled:!i,className:`rounded-md px-4 py-2 text-body-medium-default transition-colors`,style:{background:i?`var(--system-positive-strong)`:`var(--surface-overlay)`,color:i?`var(--content-on-positive)`:`var(--content-disabled)`,border:`none`,cursor:i?`pointer`:`not-allowed`},children:o?`Running…`:`Run ${e}`})})]})})}function P({paneId:e,value:t,onChange:n,defaultTemplate:r}){let[i,a]=(0,h.useState)(!1),o=`memory-router-playground-${e}-prompt`,s=t.trim().length>0;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`text-label-default`,style:{color:`var(--content-secondary)`,background:`transparent`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`},children:[i?`▾`:`▸`,` System prompt`,` `,(0,w.jsxs)(`span`,{style:{color:`var(--content-tertiary)`},children:[`(`,s?`custom`:`bundled`,`)`]})]}),i&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(r),disabled:r.length===0,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:r.length===0?`not-allowed`:`pointer`},children:`Load default`}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(``),disabled:!s,className:`rounded px-2 py-1 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:s?`pointer`:`not-allowed`},children:`Reset`})]})]}),i&&(0,w.jsx)(`textarea`,{id:o,value:t,onChange:e=>n(e.target.value),rows:12,placeholder:`Custom router system prompt. Available placeholders:
2
2
  {{ASSISTANT_NAME}}, {{USER_NAME}}, {{PAGE_INDEX}}
3
3
  Leave blank to use the bundled template. "Load default" seeds the textarea with the bundled body for editing.`,className:`rounded-md border px-3 py-2 text-body-small-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,resize:`vertical`,minHeight:`120px`}})]})}function F({paneId:e,value:t,onChange:n,profiles:r,activeProfile:i}){let a=`memory-router-playground-${e}-profile`,o=i!==null&&i.length>0?`inherit active (${i})`:`inherit active`;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`label`,{htmlFor:a,className:`text-label-default`,style:{color:`var(--content-secondary)`},children:`llm.profiles override`}),(0,w.jsxs)(`select`,{id:a,value:t,onChange:e=>n(e.target.value),className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`},children:[(0,w.jsx)(`option`,{value:``,children:o}),r.map(e=>(0,w.jsx)(`option`,{value:e,children:e},e))]})]})}function I({paneId:e,label:t,value:n,onChange:r}){let i=`memory-router-playground-${e}-${t}`;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`label`,{htmlFor:i,className:`text-label-default`,style:{color:`var(--content-secondary)`},children:t}),(0,w.jsx)(`input`,{id:i,value:n,onChange:e=>r(e.target.value),placeholder:`inherit`,className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`}})]})}function ne({onClick:e,disabled:t,isRunning:n}){return(0,w.jsx)(`button`,{type:`button`,onClick:e,disabled:t,className:`rounded-md px-4 py-2 text-body-medium-default transition-colors`,style:{background:t?`var(--surface-overlay)`:`var(--primary-base)`,color:t?`var(--content-disabled)`:`var(--content-on-primary)`,border:`none`,cursor:t?`not-allowed`:`pointer`},children:n?`Running…`:`Run both`})}function re({visible:e}){return e?(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 rounded-md px-4 py-2 text-label-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`},children:[(0,w.jsx)(L,{marker:`●`,markerColor:`var(--content-default)`,label:`in both`}),(0,w.jsx)(L,{marker:`◆`,markerColor:X(`A`),label:`A only`}),(0,w.jsx)(L,{marker:`◇`,markerColor:X(`B`),label:`B only`})]}):null}function L({marker:e,markerColor:t,label:n}){return(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(`span`,{style:{color:t},children:e}),(0,w.jsx)(`span`,{children:n})]})}function R({paneId:e,userMessage:t,mutation:n,otherResult:r,validation:i}){let a=n.data;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,w.jsx)(V,{paneId:e}),i!==null&&(0,w.jsx)(Q,{message:i}),n.isError&&(0,w.jsx)(Q,{message:n.error instanceof Error?n.error.message:`Failed to run simulation`}),a!==void 0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(H,{paneId:e,userMessage:t,result:a.response,otherResult:r}),(0,w.jsx)(z,{paneId:e,rawRequest:a.rawRequest,rawResponse:a.rawResponse})]})]})}function z({paneId:e,rawRequest:t,rawResponse:n}){let[r,i]=(0,h.useState)(!1);return(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 p-4`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`text-label-default`,style:{color:`var(--content-secondary)`,background:`transparent`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`},children:[r?`▾`:`▸`,` Raw API exchange`]}),r&&(0,w.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,w.jsx)(B,{label:`Request (Pane ${e})`,body:t}),(0,w.jsx)(B,{label:`Response (Pane ${e})`,body:n})]})]})})}function B({label:e,body:t}){return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:e}),(0,w.jsx)(`pre`,{className:`overflow-auto rounded-md border px-3 py-2 text-body-small-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,maxHeight:`320px`,whiteSpace:`pre`},children:t.length===0?`(empty)`:t})]})}function V({paneId:e}){return(0,w.jsxs)(`div`,{className:`text-body-medium-default`,style:{color:X(e)},children:[`Pane `,e]})}function H({paneId:e,userMessage:t,result:n,otherResult:r}){let i=(0,h.useMemo)(()=>U(n,r),[n,r]),a=(0,h.useMemo)(()=>q(n),[n]);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,w.jsx)(G,{result:n,userMessage:t,otherResult:r,counts:(0,h.useMemo)(()=>W(i),[i])}),(0,w.jsx)(K,{result:n}),n.failureReason!==null&&(0,w.jsx)(Q,{message:`Router failure: ${n.failureReason}`}),a.length===0?(0,w.jsx)(oe,{}):a.map(t=>(0,w.jsx)(ae,{paneId:e,source:t.source,slugs:t.slugs,scores:n.scores,diff:i},t.source))]})}function U(e,t){let n=new Map;if(t===void 0){for(let t of e.selectedSlugs)n.set(t,`both`);return n}let r=new Set(t.selectedSlugs);for(let t of e.selectedSlugs)n.set(t,r.has(t)?`both`:`only-here`);return n}function W(e){let t=0,n=0;for(let r of e.values())r===`both`?t++:n++;return{total:e.size,shared:t,unique:n}}function G({result:e,userMessage:t,otherResult:n,counts:r}){let i=[{label:`User message`,value:t},{label:`Total candidate pages`,value:e.totalCandidatePages.toLocaleString()},{label:`Selected`,value:`${e.selectedSlugs.length} (live max_page_ids: ${e.effectiveConfig.max_page_ids})`}];return n!==void 0&&i.push({label:`Diff`,value:`${r.shared} shared · ${r.unique} unique to this pane`}),(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:`Summary`}),(0,w.jsx)(Z,{rows:i})]})})}function K({result:e}){let t=[`tier1_size`,`tier2_size`,`batch_size`,`max_page_ids`].map(t=>{let n=e.effectiveConfig[t],r=e.overrides[t];return{label:t,value:`${n===null?`null`:String(n)}${r===void 0?``:` (override)`}`}});return t.push({label:`llm.profiles override`,value:e.profileOverride===null?`inherit active`:`${e.profileOverride} (override)`}),t.push({label:`system prompt`,value:e.routerPromptOverridden?`custom`:`bundled`}),(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:`Effective config`}),(0,w.jsx)(Z,{rows:t})]})})}function q(e){let t=new Map;for(let n of e.selectedSlugs){let r=e.sourceBySlug[n];if(r===void 0)continue;let i=t.get(r)??[];i.push(n),t.set(r,i)}return[...t.keys()].sort((e,t)=>J(e)-J(t)).map(e=>({source:e,slugs:t.get(e)}))}function J(e){return e===`tier1`?0:e===`tier2`?1:e.startsWith(`tier3:`)?2+Number(e.slice(6)):2**53-1}function Y(e){return e===`tier1`?`tier 1`:e===`tier2`?`tier 2`:e.startsWith(`tier3:`)?`tier 3 · b${e.slice(6)}`:e}function X(e){return e===`A`?`var(--system-mid-strong)`:`var(--primary-base)`}function ie(e,t){return t===`both`?{color:`var(--content-default)`,marker:`●`}:{color:X(e),marker:e===`A`?`◆`:`◇`}}function ae({paneId:e,source:t,slugs:n,scores:r,diff:i}){return(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:Y(t)}),(0,w.jsxs)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:[n.length,` `,n.length===1?`page`:`pages`]})]}),(0,w.jsx)(`ul`,{className:`flex flex-col gap-1`,children:n.map(n=>{let{color:a,marker:o}=ie(e,i.get(n)??`only-here`);return(0,w.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3`,children:[(0,w.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,w.jsx)(`span`,{style:{color:a},children:o}),(0,w.jsx)(`code`,{className:`text-body-medium-default`,style:{color:a},children:n})]}),t===`tier2`&&(0,w.jsxs)(`span`,{className:`tabular-nums text-label-default`,style:{color:`var(--content-secondary)`},children:[`EMA `,(r[n]??0).toFixed(3)]})]},n)})})]})})}function oe(){return(0,w.jsx)(a,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:`No pages selected`}),(0,w.jsx)(`span`,{className:`text-label-default`,style:{color:`var(--content-secondary)`},children:`The router returned an empty selection. Try a more specific query, or relax the override values.`})]})})}function Z({rows:e}){return(0,w.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(({label:e,value:t})=>(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,w.jsx)(`span`,{className:`shrink-0 text-label-default`,style:{color:`var(--content-secondary)`},children:e}),(0,w.jsx)(`span`,{className:`text-right text-body-medium-lighter`,style:{color:`var(--content-default)`},children:t})]},e))})}function Q({message:e}){return(0,w.jsx)(`div`,{className:`rounded-md px-4 py-3 text-body-medium-default`,style:{background:`var(--surface-overlay)`,color:`var(--system-negative-strong)`},children:e})}function $({children:e}){return(0,w.jsx)(`div`,{className:`flex h-full w-full items-center justify-center p-8 text-label-default`,style:{color:`var(--content-tertiary)`},children:e})}export{T as MemoryRouterPlaygroundPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./jsx-runtime-CVSDxk6A.js";import{t as r}from"./button-C68o-wep.js";import"./src-Bnn6algv.js";import{t as i}from"./x-D1JFrRas.js";import{aa as a}from"./index-Ue-r3LET.js";var o=e(t(),1),s=n(),c=`(min-width: 640px)`,l=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function u({open:e,onClose:t,children:n,title:a}){let u=(0,o.useRef)(null),d=(0,o.useRef)(null),f=(0,o.useRef)(t);return(0,o.useEffect)(()=>{f.current=t}),(0,o.useEffect)(()=>{if(!e)return;d.current?.focus();let t=document.body.style.overflow;document.body.style.overflow=`hidden`;let n=window.matchMedia(c),r=e=>{e.matches&&f.current()};n.addEventListener(`change`,r);let i=e=>{if(e.key===`Escape`){f.current();return}if(e.key!==`Tab`||!u.current)return;let t=u.current.querySelectorAll(l),n=t[0],r=t[t.length-1];if(!n||!r){e.preventDefault();return}let i=document.activeElement,a=u.current.contains(i);e.shiftKey?(!a||i===n)&&(e.preventDefault(),r.focus()):(!a||i===r)&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`keydown`,i),n.removeEventListener(`change`,r),document.body.style.overflow=t}},[e]),e?(0,s.jsxs)(`div`,{ref:u,className:`fixed inset-0 sm:hidden`,style:{zIndex:40},role:`dialog`,"aria-modal":`true`,"aria-label":a,children:[(0,s.jsx)(`button`,{type:`button`,"aria-label":`Close sidebar`,className:`absolute inset-0 h-full w-full cursor-default`,style:{background:`rgba(0, 0, 0, 0.4)`,zIndex:40},onClick:t}),(0,s.jsxs)(`aside`,{className:`relative flex h-full w-[80vw] max-w-xs flex-col shadow-xl`,style:{background:`var(--surface-lift)`,borderRight:`1px solid var(--border-base)`,zIndex:50,paddingTop:`var(--safe-area-inset-top, env(safe-area-inset-top, 0px))`,paddingBottom:`var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))`,paddingLeft:`var(--safe-area-inset-left, env(safe-area-inset-left, 0px))`},children:[(0,s.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b px-4 py-3`,style:{borderColor:`var(--border-base)`},children:[(0,s.jsx)(`span`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:a}),(0,s.jsx)(r,{ref:d,type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,s.jsx)(i,{"aria-hidden":!0}),onClick:t,"aria-label":`Close`,tintColor:`var(--content-tertiary)`})]}),(0,s.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:n})]})]}):null}function d({onClick:e}){return(0,s.jsx)(r,{type:`button`,variant:`ghost`,iconOnly:(0,s.jsx)(a,{"aria-hidden":!0}),onClick:e,"aria-label":`Open sidebar`,tintColor:`var(--content-secondary)`,className:`sm:hidden`})}export{d as n,u as t};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./jsx-runtime-CVSDxk6A.js";import{t as r}from"./button-C68o-wep.js";import"./src-Bnn6algv.js";import{t as i}from"./x-D1JFrRas.js";import{aa as a}from"./index-87hTkD_v.js";var o=e(t(),1),s=n(),c=`(min-width: 640px)`,l=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function u({open:e,onClose:t,children:n,title:a}){let u=(0,o.useRef)(null),d=(0,o.useRef)(null),f=(0,o.useRef)(t);return(0,o.useEffect)(()=>{f.current=t}),(0,o.useEffect)(()=>{if(!e)return;d.current?.focus();let t=document.body.style.overflow;document.body.style.overflow=`hidden`;let n=window.matchMedia(c),r=e=>{e.matches&&f.current()};n.addEventListener(`change`,r);let i=e=>{if(e.key===`Escape`){f.current();return}if(e.key!==`Tab`||!u.current)return;let t=u.current.querySelectorAll(l),n=t[0],r=t[t.length-1];if(!n||!r){e.preventDefault();return}let i=document.activeElement,a=u.current.contains(i);e.shiftKey?(!a||i===n)&&(e.preventDefault(),r.focus()):(!a||i===r)&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`keydown`,i),n.removeEventListener(`change`,r),document.body.style.overflow=t}},[e]),e?(0,s.jsxs)(`div`,{ref:u,className:`fixed inset-0 sm:hidden`,style:{zIndex:40},role:`dialog`,"aria-modal":`true`,"aria-label":a,children:[(0,s.jsx)(`button`,{type:`button`,"aria-label":`Close sidebar`,className:`absolute inset-0 h-full w-full cursor-default`,style:{background:`rgba(0, 0, 0, 0.4)`,zIndex:40},onClick:t}),(0,s.jsxs)(`aside`,{className:`relative flex h-full w-[80vw] max-w-xs flex-col shadow-xl`,style:{background:`var(--surface-lift)`,borderRight:`1px solid var(--border-base)`,zIndex:50,paddingTop:`var(--safe-area-inset-top, env(safe-area-inset-top, 0px))`,paddingBottom:`var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))`,paddingLeft:`var(--safe-area-inset-left, env(safe-area-inset-left, 0px))`},children:[(0,s.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b px-4 py-3`,style:{borderColor:`var(--border-base)`},children:[(0,s.jsx)(`span`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:a}),(0,s.jsx)(r,{ref:d,type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,s.jsx)(i,{"aria-hidden":!0}),onClick:t,"aria-label":`Close`,tintColor:`var(--content-tertiary)`})]}),(0,s.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:n})]})]}):null}function d({onClick:e}){return(0,s.jsx)(r,{type:`button`,variant:`ghost`,iconOnly:(0,s.jsx)(a,{"aria-hidden":!0}),onClick:e,"aria-label":`Open sidebar`,tintColor:`var(--content-secondary)`,className:`sm:hidden`})}export{d as n,u as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{r as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as r}from"./QueryClientProvider-DKhXIxGb.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./useMutation-Lj4VunQV.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./menu-B79-l6IU.js";import{t as c}from"./notice-CF2pptne.js";import{n as l,r as u,t as d}from"./panel-item-FzMfzMJA.js";import{t as f}from"./input-Cu3PPVCq.js";import{t as p}from"./createLucideIcon-D6d6iDdi.js";import{t as m}from"./bell-C7RL04h4.js";import{t as h}from"./loader-circle-C563RcPZ.js";import{t as g}from"./moon-MxKfIzam.js";import{i as _}from"./routes-VcLWbBmh.js";import{n as v}from"./use-is-mobile-CgLpEUW2.js";import{$a as y,Dn as b,En as x,Tn as S,_n as C,gn as w,hn as T,mn as E,pn as D,vn as O,yi as k,yn as A}from"./index-Ue-r3LET.js";import{r as j}from"./format-date-Pw0m-fQ8.js";var M=p(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),N=p(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),P=e(t(),1);function F(e){e.invalidateQueries({queryKey:T()}),e.invalidateQueries({queryKey:A()})}function I(e){return e.snoozed_until?new Date(e.snoozed_until)>new Date:!1}var L=[{label:`1 hour`,hours:1},{label:`4 hours`,hours:4},{label:`24 hours`,hours:24},{label:`1 week`,hours:168}],R=o();function z({notificationId:e,currentlySnoozed:t,children:n}){let i=r(),o=a(O()),c=v(),[u,f]=(0,P.useState)(!1),p=()=>F(i),m=async t=>{let n=new Date(new Date().getTime()+t*60*60*1e3).toISOString();await o.mutateAsync({path:{id:e},body:{snoozed_until:n}}),p()},h=async()=>{await o.mutateAsync({path:{id:e},body:{snoozed_until:null}}),p()};return c?(0,R.jsxs)(l.Root,{open:u,onOpenChange:f,children:[(0,R.jsx)(l.Trigger,{asChild:!0,children:n}),(0,R.jsxs)(l.Content,{children:[(0,R.jsx)(l.Header,{children:(0,R.jsx)(l.Title,{children:`Snooze until…`})}),(0,R.jsxs)(l.Body,{children:[L.map(({label:e,hours:t})=>(0,R.jsx)(d,{label:e,onSelect:()=>{o.isPending||(f(!1),m(t))}},e)),t&&(0,R.jsx)(d,{label:`Clear snooze`,onSelect:()=>{o.isPending||(f(!1),h())}})]})]})]}):(0,R.jsxs)(s.Root,{open:u,onOpenChange:f,children:[(0,R.jsx)(s.Trigger,{children:n}),(0,R.jsxs)(s.Content,{align:`start`,className:`min-w-[12rem]`,children:[(0,R.jsx)(s.Label,{children:`Snooze until…`}),L.map(({label:e,hours:t})=>(0,R.jsx)(s.Item,{disabled:o.isPending,onSelect:()=>void m(t),children:e},e)),t&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(s.Separator,{}),(0,R.jsx)(s.Item,{disabled:o.isPending,onSelect:()=>void h(),children:`Clear snooze`})]})]})]})}function B({existingRules:e,onClose:t,onPauseCreated:n,onPauseDeleted:i,hideTitle:o=!1}){let s=r(),c=a(w()),l=a(C()),[u,d]=(0,P.useState)(``),p=()=>F(s),m=async()=>{let e=new Date(new Date().getTime()+365*24*60*60*1e3).toISOString();n(await c.mutateAsync({body:{notification_type:`alert`,dedupe_key_prefix:``,reason:u.trim()||`User requested pause`,expires_at:e}})),p(),t()},g=async e=>{await l.mutateAsync({path:{rule_id:e}}),i(e),p(),t()},_=c.isPending||l.isPending;return(0,R.jsxs)(`div`,{children:[!o&&(0,R.jsx)(`p`,{className:`mb-2 text-body-medium-default text-[var(--content-default)]`,children:`Pause alerts`}),e.length>0?(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Active pause rules:`}),e.map(e=>(0,R.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-2 py-2`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`p`,{className:`truncate text-body-small-default text-[var(--content-default)]`,children:e.reason||`All alerts paused`}),e.expires_at&&(0,R.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Expires `,j(e.expires_at)]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void g(e.id),disabled:_,className:`ml-2 shrink-0 cursor-pointer rounded px-2 py-1 text-body-small-default text-[var(--system-negative-strong)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:`Resume`})]},e.id))]}):(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Temporarily mute all alert notifications.`}),(0,R.jsx)(f,{type:`text`,value:u,onChange:e=>d(e.target.value),placeholder:`Reason (optional)`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void m(),disabled:_,className:`w-full cursor-pointer rounded-md bg-[var(--primary-base)] px-3 py-1.5 text-body-medium-default text-[var(--content-inset)] transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50`,children:c.isPending?(0,R.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,R.jsx)(h,{className:`h-3 w-3 animate-spin`}),`Pausing…`]}):`Pause all alerts`})]})]})}function V({notification:e,onAck:t,isAcking:n}){let r=e.notification_type===`alert`,i=I(e),a=!e.is_read;return(0,R.jsxs)(`div`,{className:`relative rounded-lg border border-[var(--border-base)] p-4`,style:{background:e.is_resolved?`var(--surface-base)`:`var(--surface-lift)`,opacity:e.is_resolved?.75:1},children:[(0,R.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a&&!e.is_resolved&&(0,R.jsx)(`span`,{"aria-hidden":!0,className:`h-2 w-2 shrink-0 rounded-full bg-[var(--primary-base)]`}),r&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-negative-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,R.jsx)(k,{className:`h-3 w-3`}),`Alert`]}),i&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--surface-base)] px-2 py-0.5 text-body-small-default text-[var(--content-secondary)]`,children:[(0,R.jsx)(g,{className:`h-3 w-3`}),`Snoozed`]}),e.is_resolved&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-positive-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-positive-strong)]`,children:[(0,R.jsx)(y,{className:`h-3 w-3`}),`Resolved`]})]}),(0,R.jsx)(`h3`,{className:`text-body-medium-default leading-tight`,style:{color:e.is_resolved?`var(--content-secondary)`:`var(--content-default)`},children:e.title}),e.body&&(0,R.jsx)(`p`,{className:`text-body-small-default leading-relaxed text-[var(--content-secondary)]`,children:e.body})]})}),(0,R.jsxs)(`div`,{className:`mt-3 flex items-center gap-3 text-body-small-default text-[var(--content-secondary)]`,children:[(0,R.jsxs)(`span`,{children:[`Last seen `,j(e.last_seen_at)]}),e.occurrence_count>1&&(0,R.jsxs)(`span`,{children:[`· `,e.occurrence_count,`× occurrences`]})]}),!e.is_resolved&&(0,R.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-[var(--border-base)] pt-3`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id,a),disabled:n,className:`flex cursor-pointer items-center gap-1.5 rounded-md px-3 py-1.5 text-body-small-default transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,style:{background:a?`var(--primary-base)`:`var(--surface-base)`,color:a?`var(--content-inset)`:`var(--content-secondary)`},children:[n?(0,R.jsx)(h,{className:`h-3 w-3 animate-spin`}):(0,R.jsx)(y,{className:`h-3 w-3`}),a?`Mark as read`:`Mark as unread`]}),(0,R.jsx)(z,{notificationId:e.id,currentlySnoozed:i,children:(0,R.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,children:[(0,R.jsx)(g,{className:`h-3 w-3`}),i?`Change snooze`:`Snooze`]})})]})]})}function H(){let e=b({platformHostedOnly:!0}),t=S(),o=x(),s=r(),d=v(),[f,p]=(0,P.useState)(`open`),[g,y]=(0,P.useState)(!1),[C,w]=(0,P.useState)([]),{data:T,isLoading:O,isError:k,refetch:A}=i({...E({query:{status:f}}),enabled:e===`full`&&t}),j=e===`full`&&o||(t?O:!1);(0,P.useEffect)(()=>{!t&&g&&y(!1)},[t,g]);let I=t?k:!1,L=t?T?.results??[]:[],z=L.filter(e=>!e.is_read&&!e.is_resolved),H=a(D()),[U,W]=(0,P.useState)(new Set),[G,K]=(0,P.useState)(!1),q=(0,P.useCallback)(()=>F(s),[s]),J=async(e,t)=>{W(t=>new Set(t).add(e));try{await H.mutateAsync({path:{id:e},body:{acknowledged:t}}),q()}finally{W(t=>{let n=new Set(t);return n.delete(e),n})}},Y=async()=>{if(!(z.length===0||G)){K(!0);try{await Promise.allSettled(z.map(e=>H.mutateAsync({path:{id:e.id},body:{acknowledged:!0}})))}finally{q(),K(!1)}}},X=(0,R.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,title:`Pause alerts`,children:[(0,R.jsx)(M,{className:`h-3.5 w-3.5`}),`Pause alerts`]}),Z=(0,R.jsx)(B,{existingRules:C,onClose:()=>y(!1),onPauseCreated:e=>w(t=>[...t,e]),onPauseDeleted:e=>w(t=>t.filter(t=>t.id!==e))});return e===`gated`?(0,R.jsx)(n,{replace:!0,to:_.settings.general}):e===`disabled`?(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(m,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,R.jsxs)(`div`,{className:`flex-1`,children:[(0,R.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,R.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]})]}),(0,R.jsx)(c,{tone:`info`,children:`Log in to the Vellum platform to view notifications.`})]}):(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(m,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,R.jsxs)(`div`,{className:`flex-1`,children:[(0,R.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,R.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]}),t&&(d?(0,R.jsxs)(l.Root,{open:g,onOpenChange:y,children:[(0,R.jsx)(l.Trigger,{asChild:!0,children:X}),(0,R.jsxs)(l.Content,{children:[(0,R.jsx)(l.Header,{children:(0,R.jsx)(l.Title,{children:`Pause alerts`})}),(0,R.jsx)(l.Body,{children:(0,R.jsx)(B,{existingRules:C,onClose:()=>y(!1),onPauseCreated:e=>w(t=>[...t,e]),onPauseDeleted:e=>w(t=>t.filter(t=>t.id!==e)),hideTitle:!0})})]})]}):(0,R.jsxs)(u.Root,{open:g,onOpenChange:y,children:[(0,R.jsx)(u.Trigger,{asChild:!0,children:X}),(0,R.jsx)(u.Content,{align:`end`,className:`w-72`,children:Z})]}))]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`div`,{className:`flex gap-1 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] p-1`,children:[`open`,`resolved`].map(e=>{let t=f===e;return(0,R.jsx)(`button`,{type:`button`,onClick:()=>p(e),className:`cursor-pointer rounded px-3 py-1 text-body-small-default capitalize transition-colors`,style:{background:t?`var(--surface-lift)`:`transparent`,color:t?`var(--content-default)`:`var(--content-secondary)`,boxShadow:t?`0 1px 2px rgba(0,0,0,0.08)`:void 0},children:e},e)})}),f===`open`&&z.length>1&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void Y(),disabled:G,className:`ml-auto flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-transparent px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:[G?(0,R.jsx)(h,{className:`h-3 w-3 animate-spin`}):(0,R.jsx)(N,{className:`h-3 w-3`}),`Mark all as read (`,z.length,`)`]})]}),j?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,R.jsx)(h,{className:`h-4 w-4 animate-spin`}),`Loading notifications…`]}):I?(0,R.jsxs)(c,{tone:`error`,children:[`Failed to load notifications.`,` `,(0,R.jsx)(`button`,{type:`button`,onClick:()=>void A(),className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]}):L.length===0?(0,R.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,children:[(0,R.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,R.jsx)(m,{className:`h-5 w-5 text-[var(--content-secondary)]`})}),(0,R.jsxs)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`No `,f,` notifications`]}),(0,R.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:f===`open`?`You're all caught up!`:`Nothing to show here.`})]}):(0,R.jsx)(`div`,{className:`space-y-3`,children:L.map(e=>(0,R.jsx)(V,{notification:e,onAck:(e,t)=>void J(e,t),isAcking:U.has(e.id)},e.id))})]})}export{H as NotificationsPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{r as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as r}from"./QueryClientProvider-DKhXIxGb.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./useMutation-Lj4VunQV.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./menu-B79-l6IU.js";import{t as c}from"./notice-CF2pptne.js";import{n as l,r as u,t as d}from"./panel-item-FzMfzMJA.js";import{t as f}from"./input-Cu3PPVCq.js";import{t as p}from"./createLucideIcon-D6d6iDdi.js";import{t as m}from"./bell-C7RL04h4.js";import{t as h}from"./loader-circle-C563RcPZ.js";import{t as g}from"./moon-MxKfIzam.js";import{i as _}from"./routes-VcLWbBmh.js";import{n as v}from"./use-is-mobile-CgLpEUW2.js";import{Dn as y,En as b,Tn as x,_n as S,eo as C,gn as w,hn as T,mn as E,pn as D,vn as O,yi as k,yn as A}from"./index-87hTkD_v.js";import{r as j}from"./format-date-6MJxjyy6.js";var M=p(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),N=p(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),P=e(t(),1);function F(e){e.invalidateQueries({queryKey:T()}),e.invalidateQueries({queryKey:A()})}function I(e){return e.snoozed_until?new Date(e.snoozed_until)>new Date:!1}var L=[{label:`1 hour`,hours:1},{label:`4 hours`,hours:4},{label:`24 hours`,hours:24},{label:`1 week`,hours:168}],R=o();function z({notificationId:e,currentlySnoozed:t,children:n}){let i=r(),o=a(O()),c=v(),[u,f]=(0,P.useState)(!1),p=()=>F(i),m=async t=>{let n=new Date(new Date().getTime()+t*60*60*1e3).toISOString();await o.mutateAsync({path:{id:e},body:{snoozed_until:n}}),p()},h=async()=>{await o.mutateAsync({path:{id:e},body:{snoozed_until:null}}),p()};return c?(0,R.jsxs)(l.Root,{open:u,onOpenChange:f,children:[(0,R.jsx)(l.Trigger,{asChild:!0,children:n}),(0,R.jsxs)(l.Content,{children:[(0,R.jsx)(l.Header,{children:(0,R.jsx)(l.Title,{children:`Snooze until…`})}),(0,R.jsxs)(l.Body,{children:[L.map(({label:e,hours:t})=>(0,R.jsx)(d,{label:e,onSelect:()=>{o.isPending||(f(!1),m(t))}},e)),t&&(0,R.jsx)(d,{label:`Clear snooze`,onSelect:()=>{o.isPending||(f(!1),h())}})]})]})]}):(0,R.jsxs)(s.Root,{open:u,onOpenChange:f,children:[(0,R.jsx)(s.Trigger,{children:n}),(0,R.jsxs)(s.Content,{align:`start`,className:`min-w-[12rem]`,children:[(0,R.jsx)(s.Label,{children:`Snooze until…`}),L.map(({label:e,hours:t})=>(0,R.jsx)(s.Item,{disabled:o.isPending,onSelect:()=>void m(t),children:e},e)),t&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(s.Separator,{}),(0,R.jsx)(s.Item,{disabled:o.isPending,onSelect:()=>void h(),children:`Clear snooze`})]})]})]})}function B({existingRules:e,onClose:t,onPauseCreated:n,onPauseDeleted:i,hideTitle:o=!1}){let s=r(),c=a(w()),l=a(S()),[u,d]=(0,P.useState)(``),p=()=>F(s),m=async()=>{let e=new Date(new Date().getTime()+365*24*60*60*1e3).toISOString();n(await c.mutateAsync({body:{notification_type:`alert`,dedupe_key_prefix:``,reason:u.trim()||`User requested pause`,expires_at:e}})),p(),t()},g=async e=>{await l.mutateAsync({path:{rule_id:e}}),i(e),p(),t()},_=c.isPending||l.isPending;return(0,R.jsxs)(`div`,{children:[!o&&(0,R.jsx)(`p`,{className:`mb-2 text-body-medium-default text-[var(--content-default)]`,children:`Pause alerts`}),e.length>0?(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Active pause rules:`}),e.map(e=>(0,R.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-2 py-2`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`p`,{className:`truncate text-body-small-default text-[var(--content-default)]`,children:e.reason||`All alerts paused`}),e.expires_at&&(0,R.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Expires `,j(e.expires_at)]})]}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void g(e.id),disabled:_,className:`ml-2 shrink-0 cursor-pointer rounded px-2 py-1 text-body-small-default text-[var(--system-negative-strong)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:`Resume`})]},e.id))]}):(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Temporarily mute all alert notifications.`}),(0,R.jsx)(f,{type:`text`,value:u,onChange:e=>d(e.target.value),placeholder:`Reason (optional)`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>void m(),disabled:_,className:`w-full cursor-pointer rounded-md bg-[var(--primary-base)] px-3 py-1.5 text-body-medium-default text-[var(--content-inset)] transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50`,children:c.isPending?(0,R.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,R.jsx)(h,{className:`h-3 w-3 animate-spin`}),`Pausing…`]}):`Pause all alerts`})]})]})}function V({notification:e,onAck:t,isAcking:n}){let r=e.notification_type===`alert`,i=I(e),a=!e.is_read;return(0,R.jsxs)(`div`,{className:`relative rounded-lg border border-[var(--border-base)] p-4`,style:{background:e.is_resolved?`var(--surface-base)`:`var(--surface-lift)`,opacity:e.is_resolved?.75:1},children:[(0,R.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a&&!e.is_resolved&&(0,R.jsx)(`span`,{"aria-hidden":!0,className:`h-2 w-2 shrink-0 rounded-full bg-[var(--primary-base)]`}),r&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-negative-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,R.jsx)(k,{className:`h-3 w-3`}),`Alert`]}),i&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--surface-base)] px-2 py-0.5 text-body-small-default text-[var(--content-secondary)]`,children:[(0,R.jsx)(g,{className:`h-3 w-3`}),`Snoozed`]}),e.is_resolved&&(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-positive-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-positive-strong)]`,children:[(0,R.jsx)(C,{className:`h-3 w-3`}),`Resolved`]})]}),(0,R.jsx)(`h3`,{className:`text-body-medium-default leading-tight`,style:{color:e.is_resolved?`var(--content-secondary)`:`var(--content-default)`},children:e.title}),e.body&&(0,R.jsx)(`p`,{className:`text-body-small-default leading-relaxed text-[var(--content-secondary)]`,children:e.body})]})}),(0,R.jsxs)(`div`,{className:`mt-3 flex items-center gap-3 text-body-small-default text-[var(--content-secondary)]`,children:[(0,R.jsxs)(`span`,{children:[`Last seen `,j(e.last_seen_at)]}),e.occurrence_count>1&&(0,R.jsxs)(`span`,{children:[`· `,e.occurrence_count,`× occurrences`]})]}),!e.is_resolved&&(0,R.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-[var(--border-base)] pt-3`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id,a),disabled:n,className:`flex cursor-pointer items-center gap-1.5 rounded-md px-3 py-1.5 text-body-small-default transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,style:{background:a?`var(--primary-base)`:`var(--surface-base)`,color:a?`var(--content-inset)`:`var(--content-secondary)`},children:[n?(0,R.jsx)(h,{className:`h-3 w-3 animate-spin`}):(0,R.jsx)(C,{className:`h-3 w-3`}),a?`Mark as read`:`Mark as unread`]}),(0,R.jsx)(z,{notificationId:e.id,currentlySnoozed:i,children:(0,R.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,children:[(0,R.jsx)(g,{className:`h-3 w-3`}),i?`Change snooze`:`Snooze`]})})]})]})}function H(){let e=y({platformHostedOnly:!0}),t=x(),o=b(),s=r(),d=v(),[f,p]=(0,P.useState)(`open`),[g,S]=(0,P.useState)(!1),[C,w]=(0,P.useState)([]),{data:T,isLoading:O,isError:k,refetch:A}=i({...E({query:{status:f}}),enabled:e===`full`&&t}),j=e===`full`&&o||(t?O:!1);(0,P.useEffect)(()=>{!t&&g&&S(!1)},[t,g]);let I=t?k:!1,L=t?T?.results??[]:[],z=L.filter(e=>!e.is_read&&!e.is_resolved),H=a(D()),[U,W]=(0,P.useState)(new Set),[G,K]=(0,P.useState)(!1),q=(0,P.useCallback)(()=>F(s),[s]),J=async(e,t)=>{W(t=>new Set(t).add(e));try{await H.mutateAsync({path:{id:e},body:{acknowledged:t}}),q()}finally{W(t=>{let n=new Set(t);return n.delete(e),n})}},Y=async()=>{if(!(z.length===0||G)){K(!0);try{await Promise.allSettled(z.map(e=>H.mutateAsync({path:{id:e.id},body:{acknowledged:!0}})))}finally{q(),K(!1)}}},X=(0,R.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,title:`Pause alerts`,children:[(0,R.jsx)(M,{className:`h-3.5 w-3.5`}),`Pause alerts`]}),Z=(0,R.jsx)(B,{existingRules:C,onClose:()=>S(!1),onPauseCreated:e=>w(t=>[...t,e]),onPauseDeleted:e=>w(t=>t.filter(t=>t.id!==e))});return e===`gated`?(0,R.jsx)(n,{replace:!0,to:_.settings.general}):e===`disabled`?(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(m,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,R.jsxs)(`div`,{className:`flex-1`,children:[(0,R.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,R.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]})]}),(0,R.jsx)(c,{tone:`info`,children:`Log in to the Vellum platform to view notifications.`})]}):(0,R.jsxs)(`div`,{className:`space-y-4`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(m,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,R.jsxs)(`div`,{className:`flex-1`,children:[(0,R.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,R.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]}),t&&(d?(0,R.jsxs)(l.Root,{open:g,onOpenChange:S,children:[(0,R.jsx)(l.Trigger,{asChild:!0,children:X}),(0,R.jsxs)(l.Content,{children:[(0,R.jsx)(l.Header,{children:(0,R.jsx)(l.Title,{children:`Pause alerts`})}),(0,R.jsx)(l.Body,{children:(0,R.jsx)(B,{existingRules:C,onClose:()=>S(!1),onPauseCreated:e=>w(t=>[...t,e]),onPauseDeleted:e=>w(t=>t.filter(t=>t.id!==e)),hideTitle:!0})})]})]}):(0,R.jsxs)(u.Root,{open:g,onOpenChange:S,children:[(0,R.jsx)(u.Trigger,{asChild:!0,children:X}),(0,R.jsx)(u.Content,{align:`end`,className:`w-72`,children:Z})]}))]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`div`,{className:`flex gap-1 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] p-1`,children:[`open`,`resolved`].map(e=>{let t=f===e;return(0,R.jsx)(`button`,{type:`button`,onClick:()=>p(e),className:`cursor-pointer rounded px-3 py-1 text-body-small-default capitalize transition-colors`,style:{background:t?`var(--surface-lift)`:`transparent`,color:t?`var(--content-default)`:`var(--content-secondary)`,boxShadow:t?`0 1px 2px rgba(0,0,0,0.08)`:void 0},children:e},e)})}),f===`open`&&z.length>1&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>void Y(),disabled:G,className:`ml-auto flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-transparent px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:[G?(0,R.jsx)(h,{className:`h-3 w-3 animate-spin`}):(0,R.jsx)(N,{className:`h-3 w-3`}),`Mark all as read (`,z.length,`)`]})]}),j?(0,R.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,R.jsx)(h,{className:`h-4 w-4 animate-spin`}),`Loading notifications…`]}):I?(0,R.jsxs)(c,{tone:`error`,children:[`Failed to load notifications.`,` `,(0,R.jsx)(`button`,{type:`button`,onClick:()=>void A(),className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]}):L.length===0?(0,R.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,children:[(0,R.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,R.jsx)(m,{className:`h-5 w-5 text-[var(--content-secondary)]`})}),(0,R.jsxs)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`No `,f,` notifications`]}),(0,R.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:f===`open`?`You're all caught up!`:`Nothing to show here.`})]}):(0,R.jsx)(`div`,{className:`space-y-3`,children:L.map(e=>(0,R.jsx)(V,{notification:e,onAck:(e,t)=>void J(e,t),isAcking:U.has(e.id)},e.id))})]})}export{H as NotificationsPage};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{R as i}from"./index-Ue-r3LET.js";var a=e(t(),1),o=r();function s(){return(0,o.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,o.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-positive-bg)`}),(0,o.jsx)(`path`,{className:`oauth-check`,d:`M17 28.5L24.5 36L39 21`,stroke:`var(--oauth-positive-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}function c(){return(0,o.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,o.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-negative-bg)`}),(0,o.jsx)(`path`,{className:`oauth-cross oauth-cross-1`,d:`M20 20L36 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`}),(0,o.jsx)(`path`,{className:`oauth-cross oauth-cross-2`,d:`M36 20L20 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`})]})}var l=`
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{R as i}from"./index-87hTkD_v.js";var a=e(t(),1),o=r();function s(){return(0,o.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,o.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-positive-bg)`}),(0,o.jsx)(`path`,{className:`oauth-check`,d:`M17 28.5L24.5 36L39 21`,stroke:`var(--oauth-positive-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}function c(){return(0,o.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,o.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-negative-bg)`}),(0,o.jsx)(`path`,{className:`oauth-cross oauth-cross-1`,d:`M20 20L36 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`}),(0,o.jsx)(`path`,{className:`oauth-cross oauth-cross-2`,d:`M36 20L20 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`})]})}var l=`
2
2
  :root {
3
3
  --oauth-surface: #F5F3EB;
4
4
  --oauth-surface-card: #FFFFFF;
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{N as i,P as a,R as o}from"./index-Ue-r3LET.js";var s=e(t(),1),c=r();function l(){return(0,c.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,c.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-positive-bg)`}),(0,c.jsx)(`path`,{className:`oauth-check`,d:`M17 28.5L24.5 36L39 21`,stroke:`var(--oauth-positive-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}function u(){return(0,c.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,c.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-negative-bg)`}),(0,c.jsx)(`path`,{className:`oauth-cross oauth-cross-1`,d:`M20 20L36 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`}),(0,c.jsx)(`path`,{className:`oauth-cross oauth-cross-2`,d:`M36 20L20 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`})]})}var d=`
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{N as i,P as a,R as o}from"./index-87hTkD_v.js";var s=e(t(),1),c=r();function l(){return(0,c.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,c.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-positive-bg)`}),(0,c.jsx)(`path`,{className:`oauth-check`,d:`M17 28.5L24.5 36L39 21`,stroke:`var(--oauth-positive-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}function u(){return(0,c.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,c.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-negative-bg)`}),(0,c.jsx)(`path`,{className:`oauth-cross oauth-cross-1`,d:`M20 20L36 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`}),(0,c.jsx)(`path`,{className:`oauth-cross oauth-cross-2`,d:`M36 20L20 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`})]})}var d=`
2
2
  :root {
3
3
  --oauth-surface: #F5F3EB;
4
4
  --oauth-surface-card: #FFFFFF;
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,h as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{b as a}from"./resolved-assistants-store-B5ATyCT9.js";import{A as o,c as s,n as c}from"./auth-store-BDBEYGBC.js";import{c as l}from"./api-OKSSIP8W.js";import{i as u}from"./routes-VcLWbBmh.js";var d=e(t(),1),f=i(),p=`vellum:loopback:state`,m=`vellum:loopback:returnTo`;function h(){let[e]=r(),t=n(),[i,h]=(0,d.useState)(null);return(0,d.useEffect)(()=>{let n=e.get(`state`),r=e.get(`session_token`),i=sessionStorage.getItem(p),d=sessionStorage.getItem(m)||u.assistant;if(sessionStorage.removeItem(p),sessionStorage.removeItem(m),!n||n!==i){h(`Login failed: state mismatch. Please try again.`);return}if(!r){h(`Login failed: no session token received. Please try again.`);return}if(!/^[a-zA-Z0-9]+$/.test(r)){h(`Login failed: invalid session token.`);return}document.cookie=`sessionid=${r}; path=/; samesite=lax; max-age=1209600`,(async()=>{await c.getState().initSession(),await o(!0);try{let e=await l();if(e.ok&&e.data.length>0){await a(e.data,s.getState().currentOrganizationId??void 0),t(u.assistant,{replace:!0});return}}catch{}t(d,{replace:!0})})()},[e,t]),i?(0,f.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-[var(--surface-base)] text-[var(--content-default)]`,children:(0,f.jsxs)(`div`,{className:`max-w-md text-center`,children:[(0,f.jsx)(`p`,{className:`text-body-medium-default`,children:i}),(0,f.jsx)(`button`,{type:`button`,className:`mt-4 rounded-lg border border-[var(--border-disabled)] px-4 py-2 text-sm hover:bg-[var(--surface-lift)]`,onClick:()=>void t(u.welcome),children:`Back to Welcome`})]})}):(0,f.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-[var(--surface-base)] text-[var(--content-default)]`,children:(0,f.jsx)(`p`,{className:`text-body-medium-default`,children:`Completing login...`})})}export{h as PlatformLoopbackPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,h as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{b as a}from"./resolved-assistants-store-B5ATyCT9.js";import{A as o,c as s,n as c}from"./auth-store-C4gcHOWH.js";import{c as l}from"./api-DiLLlhgt.js";import{i as u}from"./routes-VcLWbBmh.js";var d=e(t(),1),f=i(),p=`vellum:loopback:state`,m=`vellum:loopback:returnTo`;function h(){let[e]=r(),t=n(),[i,h]=(0,d.useState)(null);return(0,d.useEffect)(()=>{let n=e.get(`state`),r=e.get(`session_token`),i=sessionStorage.getItem(p),d=sessionStorage.getItem(m)||u.assistant;if(sessionStorage.removeItem(p),sessionStorage.removeItem(m),!n||n!==i){h(`Login failed: state mismatch. Please try again.`);return}if(!r){h(`Login failed: no session token received. Please try again.`);return}if(!/^[a-zA-Z0-9]+$/.test(r)){h(`Login failed: invalid session token.`);return}document.cookie=`sessionid=${r}; path=/; samesite=lax; max-age=1209600`,(async()=>{await c.getState().initSession(),await o(!0);try{let e=await l();if(e.ok&&e.data.length>0){await a(e.data,s.getState().currentOrganizationId??void 0),t(u.assistant,{replace:!0});return}}catch{}t(d,{replace:!0})})()},[e,t]),i?(0,f.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-[var(--surface-base)] text-[var(--content-default)]`,children:(0,f.jsxs)(`div`,{className:`max-w-md text-center`,children:[(0,f.jsx)(`p`,{className:`text-body-medium-default`,children:i}),(0,f.jsx)(`button`,{type:`button`,className:`mt-4 rounded-lg border border-[var(--border-disabled)] px-4 py-2 text-sm hover:bg-[var(--surface-lift)]`,onClick:()=>void t(u.welcome),children:`Back to Welcome`})]})}):(0,f.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-[var(--surface-base)] text-[var(--content-default)]`,children:(0,f.jsx)(`p`,{className:`text-body-medium-default`,children:`Completing login...`})})}export{h as PlatformLoopbackPage};
@@ -0,0 +1 @@
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{p as n,r,t as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as a}from"./QueryClientProvider-DKhXIxGb.js";import{t as o}from"./useQuery-B45lW1Kk.js";import{t as s}from"./useMutation-Lj4VunQV.js";import{t as c}from"./jsx-runtime-CVSDxk6A.js";import{t as l}from"./button-C68o-wep.js";import{t as u}from"./card-CL5iEMJO.js";import"./src-Bnn6algv.js";import{t as d}from"./confirm-dialog-94QFOD8a.js";import{n as f}from"./toast-BL8OPiip.js";import{t as p}from"./external-link-Dj8dup-K.js";import{t as m}from"./loader-circle-C563RcPZ.js";import{B as h,F as g,H as _,I as v,L as y,V as b,W as x,z as S}from"./react-query.gen-B_oGDSP8.js";import{i as C}from"./routes-VcLWbBmh.js";import{t as w}from"./assistant-feature-flag-store-BPZq6n_3.js";import{Za as T,ja as E,oo as D,so as O,xi as k,yi as A}from"./index-87hTkD_v.js";import{t as j}from"./use-active-assistant-id-B2Zd0B4I.js";import{t as M}from"./file-markdown-B4DVzQ41.js";import{n as N,r as P,t as F}from"./use-plugin-drift-uJRE3xTx.js";var I=e(t(),1),L=c();function R(e){return e?e.slice(0,7):`unknown`}function z(){let e=w.use.hasHydrated(),t=w.use.externalPlugins(),c=j(),{name:p}=n(),m=a(),[T,E]=(0,I.useState)(!1),[O,k]=(0,I.useState)(!1),A=o({...v({path:{assistant_id:c,name:p??``}}),enabled:!!c&&!!p}),P=A.data?.installed??!1,z=N({assistantId:c,name:p??``,enabled:P}).data,G=(0,I.useCallback)(()=>{m.invalidateQueries({queryKey:b({path:{assistant_id:c}})}),m.invalidateQueries({queryKey:x({path:{assistant_id:c}})}),p&&(m.invalidateQueries({queryKey:y({path:{assistant_id:c,name:p}})}),m.invalidateQueries({queryKey:S({path:{assistant_id:c,name:p}})}))},[c,p,m]),K=s({..._(),onSuccess:()=>{G(),f.success(`Installed ${p??`plugin`}`)}}),q=s({...g(),onSuccess:G}),J=s({...h(),onSuccess:e=>{G(),f.success(e.outcome===`already-up-to-date`?`${p??`Plugin`} is already up to date`:`Upgraded ${p??`plugin`} to ${R(e.toCommit)}`)}});if(!e)return null;if(!t)return(0,L.jsx)(r,{to:C.identity,replace:!0});if(!p)return(0,L.jsx)(r,{to:C.plugins,replace:!0});let Y=()=>{K.mutate({path:{assistant_id:c},body:{name:p}})},X=()=>{E(!1),q.mutate({path:{assistant_id:c,name:p}})},Z=()=>{J.mutate({path:{assistant_id:c,name:p},body:{}})},Q=()=>{if(F(z)){k(!0);return}Z()},ee=()=>{k(!1),Z()},$=A.data??null;return(0,L.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col`,children:[(0,L.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,L.jsx)(l,{asChild:!0,variant:`ghost`,children:(0,L.jsx)(i,{to:C.plugins,"aria-label":`Back to plugins`,children:(0,L.jsx)(D,{"aria-hidden":!0})})}),(0,L.jsx)(B,{name:p,plugin:$,drift:z,onInstall:Y,onRemove:()=>E(!0),onUpgrade:Q,isInstalling:K.isPending,isRemoving:q.isPending,isUpgrading:J.isPending})]}),(K.isError||q.isError||J.isError)&&(0,L.jsx)(W,{message:K.isError?`Failed to install plugin. Please try again.`:q.isError?`Failed to remove plugin. Please try again.`:`Failed to upgrade plugin. Please try again.`}),(0,L.jsx)(u.Root,{asChild:!0,children:(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:A.isLoading?(0,L.jsx)(H,{}):A.isError||!$?(0,L.jsx)(U,{}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(V,{plugin:$}),$.readme?(0,L.jsx)(M,{content:$.readme}):(0,L.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`This plugin doesn't ship a README.`})]})})}),(0,L.jsx)(d,{open:T,title:`Remove plugin`,message:`Remove "${$?.name??p}" from this assistant?`,confirmLabel:`Remove`,destructive:!0,onConfirm:X,onCancel:()=>E(!1)}),(0,L.jsx)(d,{open:O,title:`Upgrade plugin`,message:`"${$?.name??p}" has local edits that will be overwritten by the upgrade. Continue?`,confirmLabel:`Upgrade anyway`,destructive:!0,onConfirm:ee,onCancel:()=>k(!1)})]})}function B({name:e,plugin:t,drift:n,onInstall:r,onRemove:i,onUpgrade:a,isInstalling:o,isRemoving:s,isUpgrading:c}){let u=t?.installed??!1,d=t?.source?.kind===`github`,f=t?.artifact??null,p=n?.status===`update-available`,h=p?`Upgrade ${R(n?.local?.commit??null)} \u2192 ${R(n?.remote?.commit??null)}`:void 0;return(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,L.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:d?`📦`:`🧩`}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,L.jsx)(`h2`,{className:`truncate text-title-medium`,style:{color:`var(--content-default)`},children:t?.name??e}),t?.version?(0,L.jsxs)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:[`v`,t.version]}):null,d?(0,L.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-0.5 text-body-small-default`,style:{backgroundColor:`var(--surface-secondary)`,color:`var(--content-tertiary)`},children:`external`}):null,p?(0,L.jsx)(P,{}):null]}),t?.description?(0,L.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:t.description}):null]})]}),t?u?(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[f?(0,L.jsx)(l,{asChild:!0,leftIcon:(0,L.jsx)(E,{"aria-hidden":!0}),children:(0,L.jsx)(`a`,{href:f.url,download:!0,children:f.label??`Download`})}):null,p?(0,L.jsx)(l,{type:`button`,onClick:a,disabled:c,title:h,leftIcon:c?(0,L.jsx)(m,{className:`animate-spin`,"aria-hidden":!0}):(0,L.jsx)(T,{"aria-hidden":!0}),children:`Upgrade`}):null,(0,L.jsx)(l,{type:`button`,variant:`dangerOutline`,onClick:i,disabled:s,leftIcon:s?(0,L.jsx)(m,{className:`animate-spin`,"aria-hidden":!0}):(0,L.jsx)(k,{"aria-hidden":!0}),children:`Remove`})]}):(0,L.jsx)(l,{type:`button`,onClick:r,disabled:o,leftIcon:o?(0,L.jsx)(m,{className:`animate-spin`,"aria-hidden":!0}):(0,L.jsx)(O,{"aria-hidden":!0}),children:`Install`}):null]})}function V({plugin:e}){let t=[{label:`Source`,value:e.source?.kind===`github`?e.source.repo:`Local`,href:(e.source?.kind===`github`?`https://github.com/${e.source.repo}`:null)??void 0}];return e.homepage&&t.push({label:`Homepage`,value:e.homepage,href:e.homepage}),e.license&&t.push({label:`License`,value:e.license}),(0,L.jsx)(`dl`,{className:`mb-5 grid gap-x-6 gap-y-2 border-b pb-5 sm:grid-cols-[max-content_1fr]`,style:{borderColor:`var(--border-base)`},children:t.map(e=>(0,L.jsxs)(`div`,{className:`contents`,children:[(0,L.jsx)(`dt`,{className:`text-body-small-default`,style:{color:`var(--content-tertiary)`},children:e.label}),(0,L.jsx)(`dd`,{className:`min-w-0 truncate text-body-small-default`,style:{color:`var(--content-secondary)`},children:e.href?(0,L.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 underline`,style:{color:`var(--primary-base, #60a5fa)`},children:[e.value,(0,L.jsx)(p,{className:`h-3 w-3`,"aria-hidden":!0})]}):e.value})]},e.label))})}function H(){return(0,L.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,L.jsx)(m,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function U(){return(0,L.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,style:{color:`var(--content-tertiary)`},children:[(0,L.jsx)(A,{className:`h-6 w-6`,"aria-hidden":!0}),(0,L.jsx)(`p`,{className:`text-body-medium-default`,children:`We couldn't load this plugin.`}),(0,L.jsx)(`p`,{className:`text-body-small-default`,children:`It may not exist, or your assistant may be on an older build.`})]})}function W({message:e}){return(0,L.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 rounded px-3 py-2 text-body-small-default`,style:{backgroundColor:`var(--surface-secondary)`,color:`var(--content-warning, var(--content-tertiary))`},role:`alert`,children:[(0,L.jsx)(A,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),e]})}export{z as PluginDetailPage};
@@ -0,0 +1 @@
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{r as n,t as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./card-CL5iEMJO.js";import"./src-Bnn6algv.js";import{t as s}from"./input-Cu3PPVCq.js";import{t as c}from"./chevron-right-C1TiR5qP.js";import{t as l}from"./loader-circle-C563RcPZ.js";import{fn as u}from"./sdk.gen-DgqwY_WN.js";import{U as d,V as f}from"./react-query.gen-B_oGDSP8.js";import{i as p}from"./routes-VcLWbBmh.js";import{t as m}from"./assistant-feature-flag-store-BPZq6n_3.js";import{Li as h,Ui as g,yi as _}from"./index-87hTkD_v.js";import{t as v}from"./use-active-assistant-id-B2Zd0B4I.js";import{n as y,r as b}from"./use-plugin-drift-uJRE3xTx.js";var x=e(t(),1),S=a();function C({match:e}){return(0,S.jsx)(o.Root,{asChild:!0,children:(0,S.jsxs)(r,{to:p.plugin(e.name),className:`group flex cursor-pointer items-center gap-4 px-5 py-4 text-left transition-colors hover:bg-[var(--surface-hover)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[(0,S.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:`📦`}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:e.name})}),e.description&&(0,S.jsx)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-secondary)`},children:e.description}),(0,S.jsx)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-tertiary)`},title:e.path,children:e.path})]}),(0,S.jsx)(c,{className:`h-5 w-5 shrink-0 opacity-0 transition-opacity group-hover:opacity-100`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0})]})})}function w({plugin:e,assistantId:t}){let n=y({assistantId:t,name:e.name}).data?.status===`update-available`;return(0,S.jsx)(o.Root,{asChild:!0,children:(0,S.jsxs)(r,{to:p.plugin(e.name),className:`group flex cursor-pointer items-center gap-4 px-5 py-4 text-left transition-colors hover:bg-[var(--surface-hover)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[(0,S.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:`🧩`}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:e.name}),e.version?(0,S.jsxs)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:[`v`,e.version]}):null,n?(0,S.jsx)(b,{}):null]}),(0,S.jsx)(`p`,{className:`mt-1 truncate text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:e.description??`No description provided.`}),e.issues&&e.issues.length>0?(0,S.jsxs)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-warning, var(--content-tertiary))`},title:e.issues.join(`; `),children:[e.issues[0],e.issues.length>1?` (+${e.issues.length-1} more)`:``]}):null]}),(0,S.jsx)(c,{className:`h-5 w-5 shrink-0 opacity-0 transition-opacity group-hover:opacity-100`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0})]})})}var T=300*1e3;function E(e,...t){return e?t.some(t=>t?.toLowerCase().includes(e)):!0}function D({assistantId:e}){let[t,n]=(0,x.useState)(``),r=t.trim().toLowerCase(),a=i({queryKey:f({path:{assistant_id:e},query:{q:void 0}}),queryFn:async({signal:t})=>{let n=await u({path:{assistant_id:e},query:{q:void 0},signal:t,throwOnError:!1});if(n.response?.status===404)return{plugins:[]};if(!n.response?.ok)throw Error(`Failed to load plugins`);return n.data??{plugins:[]}},enabled:!!e,staleTime:T}),o=i({...d({path:{assistant_id:e},query:{q:void 0}}),enabled:!!e,staleTime:T}),s=(0,x.useMemo)(()=>O(a.data?.plugins??[]),[a.data?.plugins]),c=(0,x.useMemo)(()=>new Set(s.map(e=>e.name)),[s]),l=(0,x.useMemo)(()=>s.filter(e=>E(r,e.name,e.description)),[s,r]),p=(0,x.useMemo)(()=>(o.data?.matches??[]).filter(e=>!c.has(e.name)&&E(r,e.name,e.description)),[o.data?.matches,c,r]),m=a.isFetching&&!a.isLoading||o.isFetching&&!o.isLoading,h=a.isLoading,g=o.isLoading,_=!h&&!a.isError&&l.length===0,v=!g&&p.length===0;return(0,S.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col gap-4`,children:[(0,S.jsx)(k,{search:t,onSearchChange:n,isSearching:m}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto`,children:[(0,S.jsx)(A,{title:`Installed`}),h?(0,S.jsx)(j,{}):a.isError?(0,S.jsx)(P,{}):_?(0,S.jsx)(M,{hasQuery:!!r}):(0,S.jsx)(`ul`,{className:`flex flex-col gap-2`,children:l.map(t=>(0,S.jsx)(`li`,{children:(0,S.jsx)(w,{plugin:t,assistantId:e})},t.id))}),(0,S.jsx)(`div`,{className:`mt-6`}),(0,S.jsx)(A,{title:`Available to install`}),g?(0,S.jsx)(j,{}):o.isError?(0,S.jsx)(F,{}):v?(0,S.jsx)(N,{hasQuery:!!r}):(0,S.jsx)(`ul`,{className:`flex flex-col gap-2`,children:p.map(e=>(0,S.jsx)(`li`,{children:(0,S.jsx)(C,{match:e})},e.path))})]})]})}function O(e){return[...e].sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`}))}function k({search:e,onSearchChange:t,isSearching:n}){return(0,S.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,S.jsx)(s,{type:`search`,value:e,onChange:e=>{t(e.target.value)},placeholder:`Search Plugins`,"aria-label":`Search Plugins`,leftIcon:(0,S.jsx)(h,{className:`h-4 w-4`,"aria-hidden":!0}),rightIcon:n?(0,S.jsx)(l,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}):void 0,fullWidth:!0,wrapperClassName:`flex-1`})})}function A({title:e}){return(0,S.jsx)(`h3`,{className:`mb-2 text-body-small-default uppercase tracking-wide`,style:{color:`var(--content-tertiary)`},children:e})}function j(){return(0,S.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,S.jsx)(l,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function M({hasQuery:e}){let t=e?`No installed plugins match`:`No Plugins Installed`,n=e?`Try a different search term, or browse the catalog below.`:`Install a plugin with the CLI, or browse the catalog below.`,r=e?h:g;return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(r,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:t}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:n})]})})}function N({hasQuery:e}){let t=e?`No catalog entries match`:`Catalog is empty`,n=e?`Try a different search term, or remove the filter to browse everything.`:`No plugins are currently published in the catalog.`;return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(h,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:t}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:n})]})})}function P(){return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(_,{className:`mb-3 h-8 w-8`,style:{color:`var(--system-danger)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:`Failed to load plugins`}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Something went wrong. Try refreshing the page.`})]})})}function F(){return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(g,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:`Couldn't load catalog`}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Catalog browsing is temporarily unavailable. Installed plugins are still listed above.`})]})})}function I(){let e=m.use.hasHydrated(),t=m.use.externalPlugins(),r=v();return e?t?(0,S.jsx)(D,{assistantId:r}):(0,S.jsx)(n,{to:p.identity,replace:!0}):null}export{I as PluginsPage};