@tickernelz/wardmote-ui 2026.1114.2 → 2026.1114.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ActiveAgentsPanel-Budj8e9v.js → ActiveAgentsPanel-CF0fwsze.js} +1 -1
- package/dist/assets/{AdapterManager-DhiW44Eo.js → AdapterManager-DUXWwNxv.js} +1 -1
- package/dist/assets/{AdvancedToolsRoute-CICI1XRd.js → AdvancedToolsRoute-BamlkE3p.js} +1 -1
- package/dist/assets/{AgentActionButtons-DIhpv51Y.js → AgentActionButtons-CPIhsP04.js} +1 -1
- package/dist/assets/{AgentBubbleActionRow-DIr3TdR9.js → AgentBubbleActionRow-BUAUmJKa.js} +1 -1
- package/dist/assets/{AgentChat-CeuGtMXr.js → AgentChat-BAn_ghsu.js} +1 -1
- package/dist/assets/{AgentChats-CmDtTrMa.js → AgentChats-f73hodzr.js} +1 -1
- package/dist/assets/{AgentDefaults-DpYaMGkf.js → AgentDefaults-BL1XYvEo.js} +1 -1
- package/dist/assets/{AgentDetail-DFTeFc4-.js → AgentDetail-DthxFfuB.js} +1 -1
- package/dist/assets/{AgentTodoCard-DRXZ7hmU.js → AgentTodoCard-BvgkWD0T.js} +1 -1
- package/dist/assets/{Agents-CClUUMUq.js → Agents-D5qI6yZZ.js} +3 -3
- package/dist/assets/{AppDetail-DfHLFOtj.js → AppDetail-B6PtMl8J.js} +1 -1
- package/dist/assets/{AppNotConnected-CcmXbFtD.js → AppNotConnected-C_tGn786.js} +1 -1
- package/dist/assets/{ApprovalCard-uT_9D_uH.js → ApprovalCard-DrfZAdGQ.js} +1 -1
- package/dist/assets/{ApprovalDetail-CE41WFbd.js → ApprovalDetail-sfPpfdXc.js} +1 -1
- package/dist/assets/{ApprovalPayload-_zU9bukt.js → ApprovalPayload-C4F3ItGH.js} +1 -1
- package/dist/assets/{Approvals-BXrjqpKc.js → Approvals-DZoMl7_m.js} +1 -1
- package/dist/assets/{AppsConnect-DH7aSjtS.js → AppsConnect-D8Gu187f.js} +1 -1
- package/dist/assets/{AppsReview-C0Y3SxmZ.js → AppsReview-DokFETm0.js} +1 -1
- package/dist/assets/{ArtifactCard-DKUUBZ0K.js → ArtifactCard-BTf2-JIV.js} +1 -1
- package/dist/assets/{Artifacts-Bsv5m0aU.js → Artifacts-CK8FaygC.js} +1 -1
- package/dist/assets/{AssistantConnection-Dm2PaSeU.js → AssistantConnection-BlKC7jk0.js} +1 -1
- package/dist/assets/{AttentionInteractionResolver-CBjNuhYo.js → AttentionInteractionResolver-C2iz6oqT.js} +1 -1
- package/dist/assets/{AuditHub-DbUni0O_.js → AuditHub-DMhunMn8.js} +1 -1
- package/dist/assets/{BoardChat-CgzCuFIL.js → BoardChat-C4W8JLKB.js} +1 -1
- package/dist/assets/{BootstrapSetupUxLab-D-niQCV5.js → BootstrapSetupUxLab-D58OwniR.js} +1 -1
- package/dist/assets/{Browse-0bmB5mqw.js → Browse-BDjohBak.js} +1 -1
- package/dist/assets/{BudgetPolicyCard-CqFUHqOj.js → BudgetPolicyCard-DfAAgk9Z.js} +1 -1
- package/dist/assets/{CaseDetail-DakrB2jI.js → CaseDetail-CL0FC5sG.js} +1 -1
- package/dist/assets/{Cases-DXbr4HJt.js → Cases-C-7dXrEt.js} +1 -1
- package/dist/assets/{ChatEndpointDetail-BdDKo-Gq.js → ChatEndpointDetail-C-IYAYG8.js} +1 -1
- package/dist/assets/{ChatEndpointSetup-BX3iDH7N.js → ChatEndpointSetup-CM3QixMj.js} +1 -1
- package/dist/assets/{ChoiceControls-Bu-fd6qI.js → ChoiceControls-3Qpci4yE.js} +1 -1
- package/dist/assets/{Companies-FcUNLIkt.js → Companies-97toQ8Cw.js} +1 -1
- package/dist/assets/{CompanyAccess-BUcTNg7_.js → CompanyAccess-CKhS1BaS.js} +1 -1
- package/dist/assets/{CompanyActivity-ScpRBz1G.js → CompanyActivity-DzNrAyAb.js} +1 -1
- package/dist/assets/{CompanyConnections-DMEwbZv7.js → CompanyConnections-ORCH4i3U.js} +1 -1
- package/dist/assets/{CompanyEnvironments-EqXhVruZ.js → CompanyEnvironments-DphURbtb.js} +1 -1
- package/dist/assets/{CompanyExport-DQ9ffuua.js → CompanyExport-XeVCUcK3.js} +1 -1
- package/dist/assets/{CompanyImport-BhuZu4oc.js → CompanyImport-DPKpUaRa.js} +1 -1
- package/dist/assets/{CompanySettings-BSkg4ahA.js → CompanySettings-4JQpzuS1.js} +1 -1
- package/dist/assets/{CompanySettingsPluginPage-BzZkZqh-.js → CompanySettingsPluginPage-cVvXh0_G.js} +1 -1
- package/dist/assets/{CompanySkills-BbA4RKIw.js → CompanySkills-BA_9Ztwj.js} +1 -1
- package/dist/assets/{ComposerAddMenu-D9z2INup.js → ComposerAddMenu-DNp4ecG8.js} +1 -1
- package/dist/assets/{ConfigureBuiltInAgentModal-BUJPbmWc.js → ConfigureBuiltInAgentModal-CQCHDkl4.js} +1 -1
- package/dist/assets/{ConnectionSetupFlow-DKjP5RBZ.js → ConnectionSetupFlow-BaarToKu.js} +1 -1
- package/dist/assets/{CopyableGatewayUrl-BZyE_jT9.js → CopyableGatewayUrl-DxQsV7Hr.js} +1 -1
- package/dist/assets/{Dashboard--lTwxjV-.js → Dashboard--iaPJqJp.js} +1 -1
- package/dist/assets/{DashboardLive-BYyTgF5d.js → DashboardLive-4rGeotay.js} +1 -1
- package/dist/assets/{DecisionDateChips-vXwAFdua.js → DecisionDateChips-CJOLtNrJ.js} +1 -1
- package/dist/assets/{DecisionModelSettings-NrNERkaW.js → DecisionModelSettings-D-OxKIGP.js} +1 -1
- package/dist/assets/{DecisionQueuePage-BaaKuZBi.js → DecisionQueuePage-D-kNFav_.js} +1 -1
- package/dist/assets/{DesignGuide-DS6MuXWY.js → DesignGuide-D7486q4b.js} +1 -1
- package/dist/assets/{DocumentFrameHeader-DTSqcw4Q.js → DocumentFrameHeader-B61HhahB.js} +1 -1
- package/dist/assets/{EmailEndpointSetup-CJFYu2G0.js → EmailEndpointSetup-6OHb9B4q.js} +1 -1
- package/dist/assets/{ExecutionWorkspaceDetail-CuD5xWOB.js → ExecutionWorkspaceDetail-BGV-9D5Y.js} +1 -1
- package/dist/assets/{FolderControls-B7TWghGc.js → FolderControls-L2RzbfdQ.js} +1 -1
- package/dist/assets/{GatewayDetail-xNVOxSIs.js → GatewayDetail-CdXNQ9gD.js} +1 -1
- package/dist/assets/{GatewaysList-DsSKLm1h.js → GatewaysList-B0Jq1IRC.js} +1 -1
- package/dist/assets/{GoalDetail-oN5pyUUY.js → GoalDetail-D2VhPtvw.js} +1 -1
- package/dist/assets/{GoalTree-DaFizciF.js → GoalTree-kFpgH4dA.js} +1 -1
- package/dist/assets/{Goals-xgGKfQZi.js → Goals-B-_gq_Qu.js} +1 -1
- package/dist/assets/{ImageGalleryModal-CjHED0Lb.js → ImageGalleryModal-DzKBMOnu.js} +1 -1
- package/dist/assets/{Inbox-wHhHozfr.js → Inbox-zllmqRcB.js} +1 -1
- package/dist/assets/{InstanceAdvanced-Bdf2a4c_.js → InstanceAdvanced-B7tDfjwG.js} +1 -1
- package/dist/assets/{InviteLanding-McBYpNeW.js → InviteLanding-brwa_8NC.js} +1 -1
- package/dist/assets/{IssueChatLongThreadPerf-DD3RLbBo.js → IssueChatLongThreadPerf-D0HJe6IV.js} +1 -1
- package/dist/assets/{IssueChatThread-BN-_8hT8.js → IssueChatThread-CMXzuvrF.js} +1 -1
- package/dist/assets/{IssueDetail-CsaD311l.js → IssueDetail-DGdg-mB8.js} +1 -1
- package/dist/assets/{IssueDocumentAnnotations-BVdH4RTa.js → IssueDocumentAnnotations-BK-LgExc.js} +1 -1
- package/dist/assets/{IssueOutputSection-CDIMRaF0.js → IssueOutputSection-aSyiE1pg.js} +1 -1
- package/dist/assets/{IssueRecoveryActionCard-C9qJAHes.js → IssueRecoveryActionCard-vAuL_OEC.js} +1 -1
- package/dist/assets/{IssueThreadInteractionCard-BbigJB2U.js → IssueThreadInteractionCard-wFidFTIh.js} +1 -1
- package/dist/assets/{Issues-BWoc80Y9.js → Issues-CsmM33z_.js} +1 -1
- package/dist/assets/{LiveNowTodoLine-B9oTH2L0.js → LiveNowTodoLine-CP32NNp_.js} +1 -1
- package/dist/assets/{ManagedAiConnectionDetails-B0aWUPkf.js → ManagedAiConnectionDetails-Ba0awZ-O.js} +1 -1
- package/dist/assets/{McpConnect-Dzf7W2K6.js → McpConnect-CYLP1yLX.js} +1 -1
- package/dist/assets/{MembershipAction-oiLtxQm3.js → MembershipAction-CKs7Ua9x.js} +1 -1
- package/dist/assets/{ModelsAndProviders-BEb4Z38S.js → ModelsAndProviders-gaR7HDQm.js} +1 -1
- package/dist/assets/{NewAgent-C3MxIRJj.js → NewAgent-DBQzvxIr.js} +1 -1
- package/dist/assets/{OmpAllSettings-DBtL1qDL.js → OmpAllSettings-B_Knr51Z.js} +1 -1
- package/dist/assets/{PipelineSettings-BcAtsehE.js → PipelineSettings-Dl-94FB5.js} +1 -1
- package/dist/assets/{Pipelines-CkiYUQS-.js → Pipelines-CY9hGe0h.js} +1 -1
- package/dist/assets/{PixelsOffice-BSlctoug.js → PixelsOffice-BgyGZsiV.js} +1 -1
- package/dist/assets/{PluginPage-C6Qnf9ka.js → PluginPage-CMA4Ei50.js} +1 -1
- package/dist/assets/{PluginSettings-Do37r6Zu.js → PluginSettings-Cm4H1JRT.js} +1 -1
- package/dist/assets/{ProfileDetailRoute-DRFQNId6.js → ProfileDetailRoute-BEBctbC6.js} +1 -1
- package/dist/assets/{ProfileSettings-BMwLBQDB.js → ProfileSettings-Djo7BLIj.js} +1 -1
- package/dist/assets/{ProfileWizardRoute-XnnvzH9S.js → ProfileWizardRoute-DxLujEtD.js} +1 -1
- package/dist/assets/{ProjectDetail-BW6Lr4Iq.js → ProjectDetail-CmmdvUHn.js} +1 -1
- package/dist/assets/{ProjectWorkspaceDetail-DR4JCa1b.js → ProjectWorkspaceDetail-BsA0hJ-k.js} +1 -1
- package/dist/assets/{ProjectWorkspacesContent-CadPZn0k.js → ProjectWorkspacesContent-BNNI_WAk.js} +1 -1
- package/dist/assets/{Projects-DLBFbxcj.js → Projects-BTAauZr0.js} +1 -1
- package/dist/assets/{PublicIssueSharePage-C9yRZOdP.js → PublicIssueSharePage-DdPjfmD9.js} +1 -1
- package/dist/assets/{ReviewQueueCard-CIkiY-Lm.js → ReviewQueueCard-BC6VY8Bc.js} +1 -1
- package/dist/assets/{RichWorkProductCard-JGHGU_RI.js → RichWorkProductCard-ClpMt_Bh.js} +1 -1
- package/dist/assets/{RoutineDetail-izWzADvA.js → RoutineDetail-BT6_GKnC.js} +1 -1
- package/dist/assets/{RoutineRunVariablesDialog-DiT_o5Dm.js → RoutineRunVariablesDialog-D_Mls1sV.js} +1 -1
- package/dist/assets/{Routines-CHtabiYj.js → Routines-4LevOfvV.js} +1 -1
- package/dist/assets/{ScrollToBottom-pyHLjOjY.js → ScrollToBottom-jItsgDR8.js} +1 -1
- package/dist/assets/{Search-yNNB6kys.js → Search-bmcm0_m_.js} +1 -1
- package/dist/assets/{Secrets-BOyOk5BF.js → Secrets-DfR1fBAZ.js} +1 -1
- package/dist/assets/{SkillSourceTree-M58QwBFF.js → SkillSourceTree--FWKWyF3.js} +1 -1
- package/dist/assets/{SkillSources-Cw4PU-Bz.js → SkillSources-jUDjqy5i.js} +1 -1
- package/dist/assets/{SkillStudio-Cj_M3ZJa.js → SkillStudio-BsqtUnzF.js} +1 -1
- package/dist/assets/{SourceTrustBadge-BZBQe5No.js → SourceTrustBadge-CfBrvKL3.js} +1 -1
- package/dist/assets/{StatusCards-DaJdQUN5.js → StatusCards-Dt3zorUZ.js} +1 -1
- package/dist/assets/{SummarySlotCard-DlSmN6PL.js → SummarySlotCard-D1C0qH2L.js} +1 -1
- package/dist/assets/{TaskChatLab-CU5eA7nX.js → TaskChatLab-B0coUvdp.js} +1 -1
- package/dist/assets/{TaskChatMarker-wBVUFL3u.js → TaskChatMarker-C40twVjh.js} +1 -1
- package/dist/assets/{TaskChatProtocolCard-D-Dwy2EL.js → TaskChatProtocolCard--bi_tc6i.js} +1 -1
- package/dist/assets/{TaskChatThreadView-Crlf9I05.js → TaskChatThreadView-DkzFDrLW.js} +1 -1
- package/dist/assets/{TaskDetailRelationsPanel-CkktN1EC.js → TaskDetailRelationsPanel-DZGkinoJ.js} +1 -1
- package/dist/assets/{TaskTreeControls-B_ulMOi1.js → TaskTreeControls-DznugVpi.js} +1 -1
- package/dist/assets/Terminal-NjEb5-2b.js +1 -0
- package/dist/assets/TerminalView-DZxK2Ei5.js +58 -0
- package/dist/assets/{TrustPresetSection-DTc1Rj4q.js → TrustPresetSection-CjNwNBo3.js} +1 -1
- package/dist/assets/{UserProfile-C6q55R0Q.js → UserProfile-Dujv3qdz.js} +1 -1
- package/dist/assets/{WhatNeedsMe-1igJA4gL.js → WhatNeedsMe-C9P2EsqQ.js} +1 -1
- package/dist/assets/{Workspaces-rtQKliW0.js → Workspaces-BTgSx9nA.js} +1 -1
- package/dist/assets/{connection-owner-CZwxTEuM.js → connection-owner-DL4yKhSt.js} +1 -1
- package/dist/assets/dist-ypeTPGg_.js +1 -0
- package/dist/assets/dropdown-menu-DEO3mF_E.js +1 -0
- package/dist/assets/{environment-variables-editor-CCxeFKKk.js → environment-variables-editor-0qgSPgNN.js} +1 -1
- package/dist/assets/{index-DDoARkPG.js → index-3AxqhPET.js} +4 -4
- package/dist/assets/index-B5bd7Tk6.css +2 -0
- package/dist/assets/{issue-properties-lmRBaUTG.js → issue-properties-B1cYnBDU.js} +1 -1
- package/dist/assets/{issue-workspace-selection-4JI2Uh9p.js → issue-workspace-selection-S8UgGgK1.js} +1 -1
- package/dist/assets/{pipeline-stage-presentation-BSuBql6K.js → pipeline-stage-presentation-5UBw7nsb.js} +1 -1
- package/dist/assets/{shared-DDwmHbeD.js → shared-4LF6wQ38.js} +1 -1
- package/dist/assets/{tool-taxonomy-DR7Q8sVs.js → tool-taxonomy-B5zpbkHA.js} +1 -1
- package/dist/assets/{transcript-adapter-wiFIjKfq.js → transcript-adapter-C29ZJiU2.js} +1 -1
- package/dist/assets/{useSummaryDraftStream-CWOQt25o.js → useSummaryDraftStream-R2Y2bAUU.js} +1 -1
- package/dist/index.html +7 -6
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/dist/assets/Terminal-Bo-WuezO.js +0 -1
- package/dist/assets/TerminalView-AkFY5bLC.js +0 -58
- package/dist/assets/dropdown-menu-CqRAF7Oj.js +0 -1
- package/dist/assets/index-KZ2bEg2H.css +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var os=Object.defineProperty;var s=(t,n)=>os(t,"name",{value:n,configurable:!0});import{i as Zt}from"./rolldown-runtime-ZpX3ckPj.js";import{Ki as et,fn as ls,hn as ds,l as k,na as cs,t as ms,ta as ps}from"./createLucideIcon-DJi9suAC.js";import{r as us}from"./star-BZgQbzhV.js";import"./queryKeys-DYV5MhM_.js";import{$ as xs,J as hs,L as gs,Q as vs,Z as fs,gt as Je,nt as js,q as Ne,st as bs}from"./ConnectionSetupFlow-
|
|
1
|
+
var os=Object.defineProperty;var s=(t,n)=>os(t,"name",{value:n,configurable:!0});import{i as Zt}from"./rolldown-runtime-ZpX3ckPj.js";import{Ki as et,fn as ls,hn as ds,l as k,na as cs,t as ms,ta as ps}from"./createLucideIcon-DJi9suAC.js";import{r as us}from"./star-BZgQbzhV.js";import"./queryKeys-DYV5MhM_.js";import{$ as xs,J as hs,L as gs,Q as vs,Z as fs,gt as Je,nt as js,q as Ne,st as bs}from"./ConnectionSetupFlow-BaarToKu.js";import{S as Ft,g as ys,h as tt,m as Ie,p as re,v as ws,y as ks}from"./connection-identity-YKZfppDS.js";import"./CompanyContext-CSrVsSze.js";import{$ as Ns,W as st,nt,q as at,ut as Is,x as As}from"./router-2UfGeejU.js";import{n as Ss,r as Cs,t as Ts}from"./collapsible-CqjPlqOa.js";import{a as Ps,i as Rs,n as L,r as _s,t as z}from"./avatar-UO226cef.js";import{t as Ae}from"./checkbox-BHQhs41k.js";import{c as Ds,i as Se,l as Us,n as Bs,p as Es,r as Ls,t as zs}from"./dropdown-menu-DEO3mF_E.js";import{t as B}from"./label-BPz3pg9_.js";import{t as qs}from"./scroll-area-P1KpIQWe.js";import{i as q,n as O,r as it,t as rt}from"./tabs-B2Os_leL.js";import{o as Os,r as Ms,t as Zs}from"./popover-BhYHYj7q.js";import{t as Ce}from"./bot-C9arfJWx.js";import{t as Qe}from"./boxes-fV98p9-r.js";import{t as Fs}from"./check-Ctsrlfa-.js";import{t as Vt}from"./chevron-down-BCvxsWfI.js";import{t as Vs}from"./chevron-right-s7L6hXXq.js";import{t as Ws}from"./chevron-up-rFDQGA-7.js";import{t as oe}from"./circle-dot-zr8GONq2.js";import{n as Gs,t as Ks}from"./ComposerAddMenu-DNp4ecG8.js";import{t as Hs}from"./clock-CzrJT_cP.js";import{b as ot}from"./MarkdownBody-BTjuUgFa.js";import{t as $s}from"./environment-variables-editor-0qgSPgNN.js";import{t as Js}from"./package-CYC5MDhY.js";import{i as lt,n as Qs,r as Ys,t as Xs}from"./TaskChatMarker-C40twVjh.js";import{r as dt}from"./RichWorkProductCard-ClpMt_Bh.js";import{t as Te}from"./inbox-C08arfF_.js";import{t as en}from"./key-round-0RqEOB_C.js";import{t as Pe}from"./layout-dashboard-DClZjSaR.js";import{t as ct}from"./link-2-CND-9QZ2.js";import{t as mt}from"./list-todo-BmObdeVq.js";import{t as c}from"./button-CMwV3L1P.js";import{t as pt}from"./RepositoryEditor-CFt-HPgf.js";import{t as Re}from"./IssueThreadInteractionCard-wFidFTIh.js";import{t as _e}from"./ThemeToggle-BWFlFnSX.js";import{t as le}from"./plus-C6fnr28l.js";import{t as Y}from"./search-04O7m-IF.js";import{t as ut}from"./settings-DuZndeX2.js";import{t as Fe}from"./shield-check-B0HVjzM_.js";import{t as De}from"./trash-D7zTaHTj.js";import{t as Ve}from"./triangle-alert-CBVKiaXB.js";import{t as tn}from"./user-Ccom_Ph0.js";import{n as sn,t as nn}from"./SetupWizard-C8qzkJn1.js";import{i as X,n as ee,t as te}from"./tooltip-B5WQ3lq5.js";import{t as y}from"./badge-DuA2EgZC.js";import{t as M}from"./Identity-Cv_2a9qJ.js";import{t as an}from"./AgentAvatar-DgGEobSY.js";import"./ToastContext-DMdt9oTd.js";import"./agents-DmlgUVso.js";import{a as rn,c as xt,i as on,n as ln,r as ht,s as gt,t as vt}from"./dialog-CKUblzlR.js";import{t as G}from"./input-DobnTAyB.js";import{t as fe}from"./skeleton-Bv_lQagE.js";import{t as je}from"./AppLogo-CZr1Y48O.js";import{t as dn}from"./github-icon-Bbgf67tg.js";import"./BreadcrumbContext-BVZDZoC0.js";import{a as cn,c as mn,i as ft,o as de,r as pn,s as un,t as xn}from"./command-Ca3v36Mu.js";import{t as ce}from"./textarea-BRPEfJ-g.js";import{t as hn}from"./toggle-switch-BHxNtSq9.js";import{t as me}from"./InlineBanner-VQ5mstsR.js";import{i as R,n as jt,o as bt,r as yt,s as wt}from"./select-V0Hm_q4f.js";import"./adapter-display-registry-Bk0KWAHT.js";import{t as kt}from"./AgentSetupPrompt-DYBB5Med.js";import{t as Nt}from"./AgentCharacter-BTEn5MBu.js";import{a as gn,i as vn,o as fn,r as Wt,s as jn,t as We}from"./card-Bru3x_SJ.js";import{t as E}from"./StatusIcon-0GcYXDdN.js";import{Cr as Ue,Dr as It,Ea as bn,Er as yn,Ga as wn,Ot as Be,Pn as Gt,Sr as kn,T as At,Tr as Nn,_ as St,cn as In,en as Ee,fn as K,ga as Ct,ln as Tt,oa as Le,pn as ze,sn as qe,tn as An,un as Sn,v as Cn,wa as Tn,wr as Pt,x as Pn,za as Rt}from"./index-3AxqhPET.js";import{p as Rn}from"./system-notice-comment-CL_SWj_f.js";import{a as _t,n as _n,r as Dn,t as Un,u as pe}from"./TaskTreeControls-DznugVpi.js";import{t as Oe}from"./InlineEditor-BKBqNA21.js";import{n as Bn}from"./AgentMailCredentialField-L4T0REEW.js";import{t as H}from"./IssueReferencePill-DAEplgLd.js";import{t as Ge}from"./separator-B2LFqBpM.js";import{a as En,c as Ln,i as zn,o as qn,r as On,s as Mn,t as Zn}from"./sheet-jd7y5x4-.js";import{t as ue}from"./MembershipAction-CKs7Ua9x.js";import{t as $}from"./EnforcementBanner-DWPluRU0.js";import{n as Fn,o as Vn,t as Wn}from"./shared-4LF6wQ38.js";import{t as C}from"./EntityRow-BIfupmlZ.js";import{t as Gn}from"./FilterBar-5ta25FCb.js";import{t as Kn}from"./SkillBinaryFile-DNe-MmCv.js";import{t as xe}from"./MetricCard-DaAh5x_N.js";import{n as Hn}from"./ActiveAgentsPanel-CF0fwsze.js";import{t as $n}from"./SkillSourceTree--FWKWyF3.js";import{t as Jn}from"./WebhookUrlWarning-D0GLAS0A.js";import{n as Me,r as Qn,t as Dt}from"./resizable-panels-Qjbo0P05.js";import{t as Ut}from"./IssueOutputSection-aSyiE1pg.js";var Kt={name:"command",size:24,node:[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]};Kt.node;var Yn=ms(Kt),u=Zt(cs(),1);function Xn(){!vs.current&&fs();const[t]=(0,u.useState)(xs.current);return t}s(Xn,"useReducedMotion");var e=Zt(ps(),1);function ea({providerId:t}){const n=Ft[t],[a,l]=(0,u.useState)({step:"access",grantKind:"organization",setupComplete:!1,url:n.defaultUrl,auth:n.supportsBrowserAuth?"auto":"none",token:"",headers:[],connectStatus:"idle",connected:!1,identity:null,allAgents:!0,agentIds:[],permissions:{},tools:[],notice:null,refreshing:!1}),m=s(f=>l(x=>({...x,...f})),"edit"),p=s(()=>m({notice:"Design example only. Review the interactive states in Storybook → Apps / Connections. No credentials are saved or sent."}),"explain");return(0,e.jsx)(js,{companyId:"",connectionId:"design-example",provider:n,state:a,actions:{edit:m,navigate:s(f=>m({step:f}),"navigate"),connect:p,cancelConnect:p,openProvider:p,saveExit:p,resumeDraft:p,finish:p,refresh:p,reconnect:p,disconnect:p},agents:[]})}s(ea,"ConnectExample");function ta(){const[t,n]=(0,u.useState)("zapier");return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("div",{className:"flex flex-wrap gap-2",children:Object.values(Ft).map(a=>(0,e.jsx)(c,{size:"sm",variant:t===a.id?"primary":"secondary",onClick:s(()=>n(a.id),"onClick"),children:a.name},a.id))}),(0,e.jsx)(ea,{providerId:t},t)]})}s(ta,"RemoteMcpDesignExample");var sa=`<!doctype html>
|
|
2
2
|
<html><head><style>
|
|
3
3
|
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden}body{font-family:system-ui,sans-serif;background:#14171c;color:#e9edf2;display:grid;place-items:center}
|
|
4
4
|
.scene{position:relative;width:100%;height:100%;min-height:90px;background:radial-gradient(ellipse at 50% 120%,#403762 0%,transparent 68%),linear-gradient(110deg,#181c22,#20242c)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var v=Object.defineProperty;var r=(t,a)=>v(t,"name",{value:a,configurable:!0});import{i as N}from"./rolldown-runtime-ZpX3ckPj.js";import{O as d,l as k,ta as w}from"./createLucideIcon-DJi9suAC.js";import{a as b,n as R,t as C}from"./avatar-UO226cef.js";import{a as D,i as x,o as I,p as A,r as y,s as _,t as z}from"./dropdown-menu-
|
|
1
|
+
var v=Object.defineProperty;var r=(t,a)=>v(t,"name",{value:a,configurable:!0});import{i as N}from"./rolldown-runtime-ZpX3ckPj.js";import{O as d,l as k,ta as w}from"./createLucideIcon-DJi9suAC.js";import{a as b,n as R,t as C}from"./avatar-UO226cef.js";import{a as D,i as x,o as I,p as A,r as y,s as _,t as z}from"./dropdown-menu-DEO3mF_E.js";import{t as h}from"./chevron-down-BCvxsWfI.js";import{t as F}from"./chevron-right-s7L6hXXq.js";import{t as O}from"./button-CMwV3L1P.js";import{t as l}from"./badge-DuA2EgZC.js";import{n as U}from"./Identity-Cv_2a9qJ.js";import{t as $}from"./AgentAvatar-DgGEobSY.js";var e=N(w(),1);function B({actor:t}){return t.kind==="agent"?(0,e.jsx)($,{agent:t.agent,name:t.name,size:20}):(0,e.jsxs)(C,{size:"xs",className:"shrink-0",children:[t.imageUrl?(0,e.jsx)(b,{src:t.imageUrl,alt:t.name}):null,(0,e.jsx)(R,{children:U(t.name)})]})}r(B,"RevisionActorAvatar");function W({documentKey:t,documentLabel:a,folded:i,onToggleFolded:p,revisionMenu:n,updatedAt:o,updatedHref:g,sourceTrustSlot:u,annotationSlot:j,titleSlot:f,actionsSlot:m}){return(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,e.jsx)("button",{type:"button",className:"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-sm text-ink-3 transition-colors hover:bg-bg-3/60 hover:text-ink",onClick:p,"aria-label":i?`Expand ${t} document`:`Collapse ${t} document`,"aria-expanded":!i,children:i?(0,e.jsx)(F,{className:"h-3.5 w-3.5"}):(0,e.jsx)(h,{className:"h-3.5 w-3.5"})}),a?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"truncate text-sm font-semibold text-ink",children:a}),(0,e.jsx)(l,{variant:"outline",className:"border-line font-mono text-(length:--text-nano) uppercase tracking-(--tracking-eyebrow) text-ink-3",children:t})]}):(0,e.jsx)(l,{variant:"outline",className:"border-line font-mono text-(length:--text-nano) uppercase tracking-(--tracking-eyebrow) text-ink-3",children:t}),u,n?(0,e.jsxs)(z,{open:n.open,onOpenChange:n.onOpenChange,children:[(0,e.jsx)(A,{asChild:!0,children:(0,e.jsxs)(O,{variant:"ghost",size:"sm",className:k("h-auto px-1.5 py-0 text-(length:--text-micro) font-normal"),children:["rev ",n.displayedRevisionNumber,(0,e.jsx)(h,{className:"h-3 w-3"})]})}),(0,e.jsxs)(y,{align:"start",className:"w-72",children:[(0,e.jsx)(D,{children:"Revision history"}),n.loading&&n.revisions.length===0?(0,e.jsx)(x,{disabled:!0,children:"Loading revisions..."}):n.revisions.length>0?(0,e.jsx)(I,{value:n.selectedRevisionId??n.currentRevisionId??"",children:n.revisions.map(s=>{const c=s.id===n.currentRevisionId;return(0,e.jsx)(_,{value:s.id,onSelect:r(()=>n.onSelectRevision(s.id,c),"onSelect"),className:"items-start",children:(0,e.jsxs)("div",{className:"flex min-w-0 flex-col",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsxs)("span",{className:"font-medium",children:["rev ",s.revisionNumber]}),c?(0,e.jsx)(l,{variant:"outline",className:"border-line px-1.5 text-(length:--text-nano) uppercase tracking-(--tracking-eyebrow) text-ink-3",children:"Current"}):null]}),(0,e.jsxs)("div",{className:"mt-1 flex min-w-0 items-center gap-1.5 text-(length:--text-micro) text-ink-3",children:[(0,e.jsx)(B,{actor:s.actor}),(0,e.jsxs)("span",{className:"truncate",children:[d(s.createdAt)," • ",s.actor.name]})]})]})},s.id)})}):(0,e.jsx)(x,{disabled:!0,children:"No revisions yet"})]})]}):null,o?(0,e.jsxs)("a",{href:g??`#document-${encodeURIComponent(t)}`,className:"truncate text-(length:--text-micro) text-ink-3 transition-colors hover:text-ink hover:underline",children:["updated ",d(o)]}):null,j]}),f]}),m?(0,e.jsx)("div",{className:"flex items-center gap-1 shrink-0",children:m}):null]})}r(W,"DocumentFrameHeader");export{W as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var es=Object.defineProperty;var t=(a,n)=>es(a,"name",{value:n,configurable:!0});import{i as Ue}from"./rolldown-runtime-ZpX3ckPj.js";import{Fr as Qe,h as ss,na as ts,ta as as}from"./createLucideIcon-DJi9suAC.js";import{y as Oe}from"./star-BZgQbzhV.js";import{X as We,_ as G,n as ns,t as R,v as T}from"./queryKeys-DYV5MhM_.js";import{n as is}from"./CompanyContext-CSrVsSze.js";import{o as rs,t as Le,zt as os}from"./router-2UfGeejU.js";import{t as de}from"./label-BPz3pg9_.js";import{t as ls}from"./arrow-left-Ce_LIut0.js";import{t as $e}from"./arrow-right-BL5kYtCZ.js";import{t as ds}from"./check-Ctsrlfa-.js";import{t as cs}from"./copy-_wvZOjTe.js";import{t as ms}from"./external-link-nl1b263c.js";import{t as u}from"./button-CMwV3L1P.js";import{t as xs}from"./triangle-alert-CBVKiaXB.js";import{t as be}from"./agents-DmlgUVso.js";import{t as us}from"./projects-mixWrT5q.js";import{a as hs,i as ps,n as gs,r as fs,s as bs,t as js}from"./dialog-CKUblzlR.js";import{t as ys}from"./input-DobnTAyB.js";import{t as Be}from"./tools-B-L_sU_9.js";import{n as vs}from"./AgentMultiSelect-DsJfZtR2.js";import{i as ks,o as Ns,t as He}from"./card-Bru3x_SJ.js";import{Cn as Pe,Tn as ze,Wr as ws,pn as Cs,xn as De}from"./index-DDoARkPG.js";import{t as q}from"./email-BNu4jmOH.js";import{n as Ss,t as As}from"./AgentMailCredentialField-L4T0REEW.js";import{t as Is}from"./CopyText-Cr673_Kx.js";import{t as qs}from"./TrustPresetSection-DTc1Rj4q.js";var o=Ue(ts(),1);function Es(a,n,d,l,m){const i=JSON.stringify([a,n,d,l]),[w,r]=(0,o.useState)();(0,o.useEffect)(()=>{if(!m)return;const _=new AbortController,h=setTimeout(()=>{q.checkAddress(a,n,{username:d,domain:l},_.signal).then(j=>{_.signal.aborted||r({key:i,result:j})}).catch(j=>{_.signal.aborted||r({key:i,error:j instanceof Error?j.message:"Could not check this address."})})},350);return()=>{clearTimeout(h),_.abort()}},[a,n,d,l,i,m]);const c=m&&w?.key===i?w:void 0;return{result:c?.result,error:c?.error,checking:m&&!c}}t(Es,"useEmailAddressCheck");var e=Ue(as(),1);function Je(){return(0,e.jsxs)("div",{role:"note",className:"space-y-3 rounded-lg border border-line bg-bg-3/30 p-4",children:[(0,e.jsxs)("div",{className:"flex items-start gap-2",children:[(0,e.jsx)(xs,{className:"size-4 shrink-0 text-(--status-agent-paused)"}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("p",{className:"text-sm font-medium",children:"Anyone can email an unrestricted inbox"}),(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Incoming email can create tasks and trigger agent work. Set up an allowlist in AgentMail to limit who can contact this inbox."}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"Wardmote does not verify sender restrictions. AgentMail controls new messages and replies separately; check both lists."})]})]}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-4 text-sm",children:[(0,e.jsx)("a",{href:"https://console.agentmail.to",target:"_blank",rel:"noreferrer",className:"underline underline-offset-4",children:"Open AgentMail ↗"}),(0,e.jsx)("a",{href:"https://docs.agentmail.to/knowledge-base/allowlists-blocklists",target:"_blank",rel:"noreferrer",className:"text-ink-3 underline underline-offset-4",children:"Set up allowlists ↗"})]})]})}t(Je,"EmailSafetyNotice");var ce="w-full rounded-md border border-line-strong bg-bg px-3 py-2 text-sm";function Ks(a){try{const n=JSON.parse(sessionStorage.getItem(a)??"{}");if(!n||typeof n!="object")return{};const d={};for(const l of["connectionId","agentId","inboxId","username","domain"])typeof n[l]=="string"&&(d[l]=n[l]);return(n.step===0||n.step===1)&&(d.step=n.step),typeof n.requestId=="string"&&Qe(n.requestId)&&(d.requestId=n.requestId),(n.addressMode==="new"||n.addressMode==="existing")&&(d.addressMode=n.addressMode),(n.mode==="websocket"||n.mode==="webhook")&&(d.mode=n.mode),(n.selectedCredentialId===null||typeof n.selectedCredentialId=="string")&&(d.selectedCredentialId=n.selectedCredentialId),typeof n.allowInboxKey=="boolean"&&(d.allowInboxKey=n.allowInboxKey),typeof n.domainSelected=="boolean"&&(d.domainSelected=n.domainSelected),Array.isArray(n.takenAddresses)&&(d.takenAddresses=n.takenAddresses.filter(l=>typeof l=="string"&&l.length<=320).slice(-20)),d}catch{return{}}}t(Ks,"readEmailSetupDraft");function rt(){const{selectedCompanyId:a}=is(),[n]=Oe();return a?(0,e.jsx)(_s,{companyId:a},`${a}:${n.get("resume")??n.get("setupId")??n.get("connectionId")??"new"}:${n.get("agentId")??"choose"}`):(0,e.jsx)("p",{role:"status",className:"p-6 text-sm text-ink-3",children:"Loading email setup…"})}t(rt,"EmailEndpointSetup");function _s({companyId:a}){const[n]=Oe(),d=rs(),l=We(),m=n.get("resume"),i=n.get("setupId"),w=`wardmote.agentmail-setup:${a}:${m??i??n.get("connectionId")??"new"}:${n.get("agentId")??"choose"}`,[r]=(0,o.useState)(()=>{const s=Ks(w);return m&&s.requestId&&s.requestId!==m?{}:s}),[c,_]=(0,o.useState)(r.connectionId??n.get("connectionId")??""),[h,j]=(0,o.useState)(r.step??(m?1:0)),[g,V]=(0,o.useState)(r.agentId??n.get("agentId")??""),[y,v]=(0,o.useState)(""),[p,me]=(0,o.useState)(r.selectedCredentialId!==void 0?r.selectedCredentialId:c||null),[je,B]=(0,o.useState)(""),[D,xe]=(0,o.useState)(r.allowInboxKey??!1),[E]=(0,o.useState)(()=>r.requestId??m??(i&&Qe(i)?i:crypto.randomUUID())),[C,ue]=(0,o.useState)(r.addressMode??"new"),[U,he]=(0,o.useState)(r.inboxId??""),[S,X]=(0,o.useState)(r.username??""),[K,ye]=(0,o.useState)(r.domain??"agentmail.to"),[Y,ve]=(0,o.useState)(r.domainSelected??(!!r.domain&&r.domain!=="agentmail.to")),[Z,ke]=(0,o.useState)(r.takenAddresses??[]),[Q,Ne]=(0,o.useState)(r.mode??"websocket"),[ee,se]=(0,o.useState)(!1),[O,we]=(0,o.useState)({}),Ce=(0,o.useRef)(!1);(0,o.useEffect)(()=>{if(a)try{h===2?sessionStorage.removeItem(w):sessionStorage.setItem(w,JSON.stringify({connectionId:c,step:h,agentId:g,requestId:E,addressMode:C,inboxId:U,username:S,domain:K,domainSelected:Y,takenAddresses:Z,mode:Q,allowInboxKey:D,selectedCredentialId:p}))}catch{}},[a,w,c,h,g,E,C,U,S,K,Y,Z,Q,D,p]);const H=T({queryKey:R.agents.list(a),queryFn:t(()=>be.list(a),"queryFn"),enabled:!!a}),te=T({queryKey:R.projects.list(a),queryFn:t(()=>us.list(a),"queryFn"),enabled:!!a&&ee}),ae=T({queryKey:["email-boundary-issues",a],queryFn:t(()=>os.list(a),"queryFn"),enabled:!!a&&ee}),k=H.data?.find(s=>s.id===g),ne=Pe(k?.permissions)==="low_trust_review",ie=ze(De(k?.permissions)),N=T({queryKey:["email-credential-inspect",a,c],queryFn:t(()=>q.inspectSaved(a,c),"queryFn"),enabled:!!a&&!!c,retry:!1}),A=T({queryKey:["email-inboxes",a],queryFn:t(()=>q.list(a),"queryFn"),enabled:!!a}),f=A.data?.find(s=>s.id===E&&s.status!=="archived"),x=f?.address,J=T({queryKey:["email-resume-account",a,f?.connectionId],queryFn:t(()=>Be.getConnection(f.connectionId),"queryFn"),enabled:!!m&&E===m&&!!f&&!c,retry:!1});(0,o.useEffect)(()=>{if(!m||!f||c||!J.isSuccess)return;const s=J.data?.config?.credentialConnectionId;typeof s=="string"?_(s):j(0),Ne(f.receiveMode)},[m,f,c,J.isSuccess,J.data]),(0,o.useEffect)(()=>{f&&V(f.assignedAgentId)},[f]);const M=N.data?.scope.scope_type==="inbox",Se=[...new Set(N.data?.domains.filter(s=>s.status==="VERIFIED"&&s.domain.toLowerCase()!=="agentmail.to").map(s=>s.domain.toLowerCase())??[])],Ae=Se[0]??"agentmail.to";(0,o.useEffect)(()=>{N.isSuccess&&!Y&&!x&&ye(Ae)},[N.isSuccess,Y,x,Ae]),(0,o.useEffect)(()=>{!M||!A.isSuccess||(x||D?(ue("existing"),he(N.data?.inboxes[0]?.inbox_id??"")):h===1&&(B(N.data?.inboxes[0]?.inbox_id??"this inbox"),me(null),j(0)))},[M,N.data,A.isSuccess,x,D,h]),(0,o.useEffect)(()=>{k&&!Ce.current&&(Ce.current=!0,S||X(k.name.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").slice(0,64)))},[k,S]);const $=G({mutationFn:t(async()=>{if(x)return!0;const s=p?await q.inspectSaved(a,p):await q.inspect(a,y.trim());if(s.scope.scope_type==="inbox"&&!D)return B(s.inboxes[0]?.inbox_id??"this inbox"),!1;const F=!!c&&p!==c,W=F?crypto.randomUUID():E;let z=p;return z||(z=(await q.connect(a,{apiKey:y.trim(),grantKind:"organization",allAgents:!1,agentIds:[g],idempotencyKey:W})).id),l.setQueryData(["email-credential-inspect",a,z],s),me(z),v(""),l.invalidateQueries({queryKey:["email-credentials",a]}),l.invalidateQueries({queryKey:R.tools.connections(a)}),F?(f&&(await q.control(f.id,"remove"),await l.invalidateQueries({queryKey:["email-inboxes",a]})),Me({connectionId:z,selectedCredentialId:z,agentId:g,step:1,requestId:W,addressMode:s.scope.scope_type==="inbox"?"existing":"new",inboxId:s.scope.scope_type==="inbox"?s.inboxes[0]?.inbox_id??"":"",username:S,domain:"agentmail.to",domainSelected:!1,takenAddresses:[],mode:Q,allowInboxKey:D}),!1):(_(z),B(""),ue(s.scope.scope_type==="inbox"?"existing":"new"),s.scope.scope_type==="inbox"&&he(s.inboxes[0]?.inbox_id??""),!0)},"mutationFn"),onSuccess:t(s=>{s&&j(1)},"onSuccess")});function Ge(s){me(s),v(""),B(""),xe(!1),ve(!1),ke([]),$.reset()}t(Ge,"selectCredential");const pe=T({queryKey:R.agents.detail(g),queryFn:t(()=>be.get(g),"queryFn"),enabled:!!g&&ee}),re=G({mutationFn:t(()=>be.updatePermissions(g,{...O,canCreateAgents:O.canCreateAgents??!1,canCreateSkills:O.canCreateSkills??!0,canAssignTasks:pe.data?.access?.canAssignTasks??!1},a),"mutationFn"),onSuccess:t(()=>{se(!1),l.invalidateQueries({queryKey:R.agents.list(a)})},"onSuccess")}),I=G({mutationFn:t(()=>q.setup(a,{assignedAgentId:g,credentialConnectionId:c,...x?{inboxId:x}:C==="existing"?{inboxId:U}:{username:S,domain:K},receiveMode:Q,idempotencyKey:E}),"mutationFn"),onError:t(async s=>{s instanceof ns&&s.body?.code==="agentmail_address_taken"&&ke(F=>[...new Set([...F,`${S}@${K}`.toLowerCase()])].slice(-20)),await l.invalidateQueries({queryKey:["email-inboxes",a]})},"onError"),onSuccess:t(()=>{l.invalidateQueries({queryKey:["email-inboxes",a]}),l.invalidateQueries({queryKey:R.chatEndpoints.list(a)}),l.invalidateQueries({queryKey:R.tools.connections(a)}),l.invalidateQueries({queryKey:R.tools.connectionInstalls(c)}),j(2)},"onSuccess")}),Ie=x??(C==="existing"?U:`${S}@${K}`),qe=new Set([...Z,...N.data?.inboxes.map(s=>s.inbox_id.toLowerCase())??[]]),oe=h===1&&C==="new"&&!x&&!M,Ee=oe&&qe.has(Ie.toLowerCase()),ge=/^[a-z0-9][a-z0-9._-]*$/.test(S)&&S.length<=64,P=Es(a,c,S,K,oe&&ge&&!!N.data&&!Ee),fe=Ee||P.result?.status==="taken",Ke=oe&&ge&&(fe||P.result?.status==="unknown")?["-agent","-team",`-${E.slice(0,6)}`].map(s=>`${S.slice(0,64-s.length)}${s}`).filter(s=>!qe.has(`${s}@${K}`)):[],Ve=C==="existing"&&A.data?.some(s=>s.id!==E&&s.address===Ie&&s.status!=="archived"),L=fe?"This email address is already in use. Choose a different address.":Ve?"This inbox is already assigned to an agent.":null,le=$.error??(fe?null:I.error)??J.error??N.error??H.error,b=$.isPending||I.isPending,_e=A.isSuccess&&(!m||E!==m||!!f)&&(!f||f.assignedAgentId===g),Te=_e&&!!k&&!b&&!(ne&&!ie)&&(!!x||!!p||!!y.trim()),Fe=_e&&!!k&&!b&&!!N.data&&!(ne&&!ie)&&!L&&!P.checking&&(!!x||(C==="existing"?!!U:ge)),Re=t(()=>{k&&(we(k.permissions),se(!0))},"openTrust"),Xe=t(()=>d(`/apps/chat/${I.data?.id??f?.id}/settings`),"leave"),Ye=t(()=>{try{sessionStorage.removeItem(w)}catch{}d("/apps")},"cancel");function Me(s){try{sessionStorage.setItem(`wardmote.agentmail-setup:${a}:${s.requestId}:${g}`,JSON.stringify(s))}catch{}d(`/apps/chat/connect?${new URLSearchParams({provider:"agentmail",purpose:"chat",setupId:s.requestId,agentId:g,connectionId:s.connectionId})}`)}t(Me,"openDraft");const Ze=t(()=>{const s=crypto.randomUUID();Me({connectionId:c,selectedCredentialId:c,agentId:g,step:1,requestId:s,addressMode:"new",username:"",inboxId:"",domain:x?.slice(x.lastIndexOf("@")+1)??K,domainSelected:!0,takenAddresses:Z,mode:Q,allowInboxKey:!1})},"chooseAnotherAddress");return(0,e.jsxs)("div",{className:"mx-auto max-w-xl space-y-6 p-6",children:[(0,e.jsx)("header",{className:"space-y-2",children:(0,e.jsx)("h1",{className:"text-xl font-bold",children:h===2?"Your agent’s email is ready":"Give an agent an email address"})}),h<2&&A.isError&&(0,e.jsxs)("div",{role:"alert",className:"space-y-2 text-sm",children:[(0,e.jsxs)("p",{className:"text-bad",children:["Could not load email setup progress. ",A.error.message]}),(0,e.jsx)(u,{type:"button",variant:"secondary",size:"sm",disabled:b||A.isFetching,onClick:t(()=>{A.refetch()},"onClick"),children:A.isFetching?"Loading…":"Retry loading inboxes"})]}),h<2&&m===E&&A.isSuccess&&!f&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:"This email setup could not be found. Return to Connectors and start a new connection."}),h<2&&(0,e.jsx)(ws,{labels:["Agent","Email address"],step:h,availableStep:h,disabled:b,onSelect:t(s=>{I.reset(),j(s)},"onSelect")}),h===0&&(0,e.jsxs)("form",{className:"space-y-6",onSubmit:t(s=>{s.preventDefault(),Te&&$.mutate()},"onSubmit"),children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(de,{htmlFor:"email-agent",children:"Agent"}),(0,e.jsx)(vs,{id:"email-agent",value:g,disabled:b||H.isPending||!A.isSuccess||!!f,placeholder:"Choose an agent",emptyMessage:"No agents found.",triggerClassName:"h-10",agents:(H.data??[]).filter(s=>!["terminated","pending_approval"].includes(s.status)),onChange:t(s=>{V(s),X((H.data?.find(F=>F.id===s)?.name??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").slice(0,64))},"onChange")})]}),!x&&(0,e.jsx)(As,{companyId:a,connectionId:p,onConnectionChange:Ge,value:y,onChange:t(s=>{v(s),$.reset()},"onChange"),disabled:b}),je&&(0,e.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,e.jsxs)("p",{className:"text-ink-3",children:["That key only connects ",je,". Choose a saved account key or enter one to create a new address."]}),(0,e.jsx)(u,{type:"button",variant:"link",size:"sm",className:"h-auto p-0",disabled:b||!(p||y.trim()),onClick:t(()=>{xe(!0),B(""),$.reset()},"onClick"),children:"Use the existing inbox instead"})]}),ne&&!ie&&(0,e.jsxs)("div",{role:"alert",className:"space-y-2 text-sm",children:[(0,e.jsx)("p",{children:"This agent needs a work boundary before it can receive email."}),(0,e.jsx)(u,{type:"button",variant:"secondary",size:"sm",onClick:Re,children:"Configure work boundary"})]}),le&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:le.message}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t border-line pt-5",children:[(0,e.jsx)(u,{type:"button",variant:"ghost",disabled:b,onClick:Ye,children:"Cancel"}),(0,e.jsxs)(u,{disabled:!Te,children:[$.isPending?"Connecting…":"Continue",(0,e.jsx)($e,{className:"size-4"})]})]})]}),h===1&&(0,e.jsxs)("form",{className:"space-y-6",onSubmit:t(s=>{s.preventDefault(),Fe&&I.mutate()},"onSubmit"),children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)(de,{htmlFor:C==="new"?"email-name":"email-existing",children:[k?.name,"’s email address"]}),x?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("p",{className:"text-sm font-medium",children:x}),(0,e.jsxs)("p",{className:"text-sm text-ink-3",children:["This address was created in AgentMail. Finish connecting it to ",k?.name,M?".":", or choose a different address. The original inbox will stay in AgentMail."]}),!M&&(0,e.jsx)(u,{type:"button",variant:"link",size:"sm",className:"h-auto p-0",disabled:b,onClick:Ze,children:"Choose a different address"})]}):C==="new"?(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(ys,{id:"email-name",className:"min-w-0",value:S,maxLength:64,autoComplete:"off",spellCheck:!1,disabled:b,"aria-invalid":!!L,"aria-describedby":L?"email-address-error":"email-address-status",onChange:t(s=>{X(s.target.value.toLowerCase()),I.reset()},"onChange")}),(0,e.jsx)("select",{id:"email-domain","aria-label":"Email domain",className:`${ce} max-w-1/2 shrink-0`,value:K,disabled:b||!N.data,onChange:t(s=>{ve(!0),ye(s.target.value),I.reset()},"onChange"),children:[...new Set([...Se,"agentmail.to",K])].map(s=>(0,e.jsxs)("option",{value:s,children:["@",s]},s))})]})}):(0,e.jsxs)("select",{id:"email-existing",className:ce,value:x??U,disabled:b||M||!!x,"aria-invalid":!!L,"aria-describedby":L?"email-address-error":void 0,onChange:t(s=>{he(s.target.value),I.reset()},"onChange"),children:[(0,e.jsx)("option",{value:"",children:"Choose an inbox"}),N.data?.inboxes.map(s=>{const F=A.data?.some(W=>W.id!==E&&W.address===s.inbox_id&&W.status!=="archived");return(0,e.jsxs)("option",{value:s.inbox_id,disabled:F,children:[s.inbox_id,F?" — already assigned":""]},s.inbox_id)})]}),M&&!x&&(0,e.jsx)(u,{type:"button",variant:"link",size:"sm",className:"h-auto p-0",disabled:b,onClick:t(()=>{xe(!1),j(0)},"onClick"),children:"Choose a key for a new address"}),L&&(0,e.jsx)("p",{id:"email-address-error",role:"alert",className:"text-sm text-bad",children:L}),oe&&!L&&(0,e.jsx)("p",{id:"email-address-status",role:"status",className:"text-sm text-ink-3",children:P.checking?"Checking address…":P.error?`Could not check this address. ${P.error}`:P.result?.status==="unknown"?"AgentMail confirms availability when you create the address.":null}),Ke.length>0&&(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-sm","aria-label":"Suggested email addresses",children:[(0,e.jsx)("span",{className:"text-ink-3",children:"Try:"}),Ke.map(s=>(0,e.jsxs)(u,{type:"button",variant:"link",size:"sm",className:"h-auto p-0",disabled:b,onClick:t(()=>{X(s),I.reset()},"onClick"),children:[s,"@",K]},s))]}),!M&&!x&&(0,e.jsx)(u,{type:"button",variant:"link",size:"sm",className:"h-auto p-0",disabled:b,onClick:t(()=>{ue(C==="new"?"existing":"new"),I.reset()},"onClick"),children:C==="new"?"Use an existing inbox":"Create a new address"})]}),(0,e.jsx)(He,{className:"py-4",children:(0,e.jsxs)(Ns,{className:"px-4",children:[(0,e.jsx)("h2",{className:"text-sm font-medium",children:"How it Works"}),(0,e.jsxs)(ks,{children:["Incoming email creates tasks for ",k?.name,". Replies stay in the same task."]})]})}),(0,e.jsxs)("details",{className:"space-y-4",children:[(0,e.jsx)("summary",{className:"cursor-pointer text-sm text-ink-3",children:"Advanced options"}),(0,e.jsxs)("div",{className:"space-y-4",children:[C==="new"&&(0,e.jsx)("div",{className:"space-y-2",children:(0,e.jsx)("a",{className:"text-sm underline",href:"https://docs.agentmail.to/custom-domains",target:"_blank",rel:"noreferrer",children:"Set up a custom domain ↗"})}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(de,{htmlFor:"email-mode",children:"Receiving"}),(0,e.jsxs)("select",{id:"email-mode",value:Q,disabled:b,className:ce,onChange:t(s=>Ne(s.target.value),"onChange"),children:[(0,e.jsx)("option",{value:"websocket",children:"Live connection"}),(0,e.jsx)("option",{value:"webhook",children:"Webhook"})]})]}),(0,e.jsx)(Je,{}),(0,e.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,e.jsx)("p",{children:ne&&ie?"Low-trust review configured":"Manage which tasks and tools this agent can access."}),(0,e.jsx)(u,{type:"button",variant:"secondary",size:"sm",onClick:Re,children:"Review trust settings"})]})]})]}),le&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:le.message}),N.isPending&&(0,e.jsx)("p",{role:"status",className:"text-sm text-ink-3",children:"Loading email options…"}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t border-line pt-5",children:[(0,e.jsxs)(u,{type:"button",variant:"ghost",disabled:b,onClick:t(()=>{I.reset(),j(0)},"onClick"),children:[(0,e.jsx)(ls,{className:"size-4"}),"Back"]}),(0,e.jsxs)(u,{disabled:!Fe,children:[I.isPending?"Connecting…":x?"Finish connecting":C==="new"?"Create email address":"Connect email address",(0,e.jsx)($e,{className:"size-4"})]})]})]}),h===2&&(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("p",{className:"flex items-center gap-2 font-medium",children:[(0,e.jsx)(ds,{className:"size-4"}),I.data?.address]}),(0,e.jsxs)("p",{className:"text-sm text-ink-3",children:[k?.name," can now receive email at this address."]})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t border-line pt-5",children:[(0,e.jsx)(u,{variant:"ghost",onClick:Xe,children:"Email settings"}),(0,e.jsx)(u,{onClick:t(()=>d("/apps"),"onClick"),children:"Done"})]})]}),(0,e.jsx)(js,{open:ee,onOpenChange:se,children:(0,e.jsxs)(gs,{className:"max-h-screen overflow-y-auto sm:max-w-2xl",children:[(0,e.jsxs)(hs,{children:[(0,e.jsxs)(bs,{children:["Trust settings · ",k?.name]}),(0,e.jsx)(fs,{children:"Changes apply to all of this agent’s work. Use a dedicated email agent if its other tasks need broader access."})]}),(0,e.jsx)(qs,{permissions:O,onChange:we,companyId:a,projectCandidates:(te.data??[]).map(s=>({id:s.id,label:s.name})),issueCandidates:(ae.data??[]).map(s=>({id:s.id,label:`${s.identifier} · ${s.title}`})),allowSingleIssue:!1,candidatesLoading:te.isPending||ae.isPending}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"Low trust limits Wardmote access; it does not sandbox the runtime. Review filesystem, tool, and secret access separately."}),(re.error||te.error||ae.error)&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:(re.error??te.error??ae.error)?.message}),(0,e.jsxs)(ps,{children:[(0,e.jsx)(u,{variant:"ghost",onClick:t(()=>se(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(u,{disabled:re.isPending||pe.isPending||!!pe.error||Pe(O)==="low_trust_review"&&!ze(De(O)),onClick:t(()=>re.mutate(),"onClick"),children:"Save trust settings"})]})]})})]})}t(_s,"EmailEndpointSetupForm");function ot({companyId:a,connectionId:n,canConfigure:d}){const l=T({queryKey:["email-inboxes",a],queryFn:t(()=>q.list(a),"queryFn"),refetchInterval:1e4}),m=T({queryKey:R.tools.connections(a),queryFn:t(()=>Be.listConnections(a),"queryFn")}),i=new Set(m.data?.connections.filter(r=>r.config?.credentialConnectionId===n).map(r=>r.id)),w=l.data?.filter(r=>r.connectionId===n||i.has(r.connectionId))??[];return(0,e.jsxs)("section",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 rounded-xl border border-line p-6",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:"Give an agent an email address"}),(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Each email conversation becomes a task."})]}),d&&(0,e.jsx)(u,{asChild:!0,size:"lg",children:(0,e.jsx)(Le,{to:`/apps/chat/connect?provider=agentmail&connectionId=${n}`,children:"Give an agent an email address"})})]}),w.map(r=>(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border border-line p-4",children:[(0,e.jsx)(Le,{className:"text-sm underline",to:`/apps/chat/${r.id}/settings`,children:r.address}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:r.lastError??(r.status==="active"?"Receiving email":r.status)})]},r.id)),!!w.length&&(0,e.jsx)(Je,{}),l.error&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:l.error.message})]})}t(ot,"EmailConnectionInboxes");function lt({endpointId:a,companyId:n,assignedAgentName:d}){const l=We(),m=T({queryKey:["email-inboxes",n],queryFn:t(()=>q.list(n),"queryFn"),refetchInterval:1e4}),i=m.data?.find(p=>p.id===a),[w,r]=(0,o.useState)(!1),[c,_]=(0,o.useState)(""),[h,j]=(0,o.useState)(!1);(0,o.useEffect)(()=>{i?.lastError&&j(!0)},[i?.lastError]);const[g,V]=(0,o.useState)(""),y=G({mutationFn:t(()=>q.reconnect(a,c,g||i.receiveMode),"mutationFn"),onSuccess:t(()=>{_("")},"onSuccess"),onSettled:t(()=>{l.invalidateQueries({queryKey:["email-inboxes",n]})},"onSettled")}),v=G({mutationFn:t(p=>q.control(a,p),"mutationFn"),onSuccess:t(p=>{r(p.status==="archived"),l.invalidateQueries({queryKey:["email-inboxes",n]})},"onSuccess")});return w?(0,e.jsx)("p",{children:"Inbox disconnected. Email history remains in its tasks."}):i?(0,e.jsxs)("div",{className:"max-w-2xl space-y-8 pb-8",children:[(0,e.jsxs)("header",{className:"space-y-2",children:[(0,e.jsxs)("p",{className:"text-sm text-ink-3",children:[d,"’s email address"]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[(0,e.jsx)("h1",{"aria-label":i.address??void 0,className:"min-w-0 break-all text-xl font-bold",children:i.address?(0,e.jsxs)(Is,{text:i.address,ariaLabel:"Copy email address",title:"Copy email address",containerClassName:"max-w-full",className:"flex min-w-0 items-center gap-2 rounded-md text-left",children:[(0,e.jsx)("span",{className:"min-w-0 break-all",children:i.address}),(0,e.jsx)(cs,{"aria-hidden":"true",className:"size-4 shrink-0 text-ink-3"})]}):"Email inbox"}),i.address&&(0,e.jsxs)("a",{href:`https://console.agentmail.to/dashboard/inboxes/${encodeURIComponent(i.address)}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-sm text-ink-3 underline underline-offset-4 hover:text-ink",children:["View inbox ",(0,e.jsx)(ms,{"aria-hidden":"true",className:"size-3"})]})]}),i.status==="active"&&i.address&&(0,e.jsxs)("p",{className:"text-sm text-ink-3",children:["Send an email to this address to start a task with ",d,"."]})]}),(0,e.jsxs)(He,{className:"gap-2 p-4",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"How it Works"}),(0,e.jsxs)("p",{className:"text-sm text-ink-3",children:["Incoming email creates tasks for ",d,". Replies stay in the same task. Task comments stay internal; use Email reply to send an email."]})]}),(0,e.jsxs)("section",{"aria-labelledby":"email-receiving-heading",className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h2",{id:"email-receiving-heading",className:"text-sm font-semibold",children:"Receiving email"}),(i.status!=="active"||i.lastError)&&(0,e.jsx)(Cs,{status:i.status==="active"?"attention":i.status,label:i.status==="active"?"Needs attention":i.status==="revoked"?"Access revoked":void 0})]}),["active","paused"].includes(i.status)&&(0,e.jsx)(u,{variant:"secondary",size:"sm",disabled:v.isPending,onClick:t(()=>v.mutate(i.status==="active"?"pause":"resume"),"onClick"),children:i.status==="active"?"Pause":"Resume"})]}),i.status==="paused"&&(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Receiving is paused. Resume to receive new email."}),(0,e.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("dt",{className:"text-xs text-ink-3",children:"Receiving mode"}),(0,e.jsx)("dd",{className:"text-sm",children:i.receiveMode==="websocket"?"Live connection":"Webhook"})]}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("dt",{className:"text-xs text-ink-3",children:"Last mail check"}),(0,e.jsx)("dd",{className:"font-mono text-xs",children:i.lastSyncAt?ss(i.lastSyncAt):"Not checked yet"})]})]}),i.lastError&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:i.lastError}),v.error&&v.variables!=="remove"&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:v.error.message})]}),(0,e.jsxs)("details",{open:h,onToggle:t(p=>j(p.currentTarget.open),"onToggle"),className:"border-t border-line pt-5",children:[(0,e.jsx)("summary",{className:"cursor-pointer text-sm font-medium",children:"Reconnect inbox"}),(0,e.jsxs)("div",{className:"space-y-4 pt-4",children:[(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Replace the API key or change how this inbox receives email. The email address and task history stay the same."}),(0,e.jsx)(Ss,{label:"New API key",value:c,onChange:_,disabled:y.isPending}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(de,{htmlFor:"email-reconnect-mode",children:"Receiving mode"}),(0,e.jsxs)("select",{id:"email-reconnect-mode",className:ce,disabled:y.isPending,value:g||i.receiveMode,onChange:t(p=>V(p.target.value),"onChange"),children:[(0,e.jsx)("option",{value:"websocket",children:"Live connection"}),(0,e.jsx)("option",{value:"webhook",children:"Webhook"})]})]}),y.error&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:y.error.message}),y.isSuccess&&(0,e.jsx)("p",{role:"status",className:"text-sm",children:"Inbox reconnected."}),(0,e.jsx)("div",{className:"flex justify-end",children:(0,e.jsx)(u,{variant:"secondary",disabled:!c||y.isPending,onClick:t(()=>y.mutate(),"onClick"),children:y.isPending?"Reconnecting…":"Reconnect inbox"})})]})]}),(0,e.jsxs)("section",{"aria-labelledby":"email-disconnect-heading",className:"space-y-3 border-t border-line pt-5",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("h2",{id:"email-disconnect-heading",className:"text-sm font-semibold",children:"Disconnect inbox"}),(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Stop receiving email in Wardmote. The inbox stays in AgentMail."})]}),(0,e.jsx)(u,{variant:"secondary",size:"sm",disabled:v.isPending,onClick:t(()=>v.mutate("remove"),"onClick"),children:"Disconnect inbox"})]}),v.error&&v.variables==="remove"&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:v.error.message})]})]}):(0,e.jsx)("p",{role:m.error?"alert":void 0,children:m.error?.message??"Loading email inbox…"})}t(lt,"EmailEndpointSettings");export{lt as n,rt as r,ot as t};
|
|
1
|
+
var es=Object.defineProperty;var t=(a,n)=>es(a,"name",{value:n,configurable:!0});import{i as Ue}from"./rolldown-runtime-ZpX3ckPj.js";import{Fr as Qe,h as ss,na as ts,ta as as}from"./createLucideIcon-DJi9suAC.js";import{y as Oe}from"./star-BZgQbzhV.js";import{X as We,_ as G,n as ns,t as R,v as T}from"./queryKeys-DYV5MhM_.js";import{n as is}from"./CompanyContext-CSrVsSze.js";import{o as rs,t as Le,zt as os}from"./router-2UfGeejU.js";import{t as de}from"./label-BPz3pg9_.js";import{t as ls}from"./arrow-left-Ce_LIut0.js";import{t as $e}from"./arrow-right-BL5kYtCZ.js";import{t as ds}from"./check-Ctsrlfa-.js";import{t as cs}from"./copy-_wvZOjTe.js";import{t as ms}from"./external-link-nl1b263c.js";import{t as u}from"./button-CMwV3L1P.js";import{t as xs}from"./triangle-alert-CBVKiaXB.js";import{t as be}from"./agents-DmlgUVso.js";import{t as us}from"./projects-mixWrT5q.js";import{a as hs,i as ps,n as gs,r as fs,s as bs,t as js}from"./dialog-CKUblzlR.js";import{t as ys}from"./input-DobnTAyB.js";import{t as Be}from"./tools-B-L_sU_9.js";import{n as vs}from"./AgentMultiSelect-DsJfZtR2.js";import{i as ks,o as Ns,t as He}from"./card-Bru3x_SJ.js";import{Cn as Pe,Tn as ze,Wr as ws,pn as Cs,xn as De}from"./index-3AxqhPET.js";import{t as q}from"./email-BNu4jmOH.js";import{n as Ss,t as As}from"./AgentMailCredentialField-L4T0REEW.js";import{t as Is}from"./CopyText-Cr673_Kx.js";import{t as qs}from"./TrustPresetSection-CjNwNBo3.js";var o=Ue(ts(),1);function Es(a,n,d,l,m){const i=JSON.stringify([a,n,d,l]),[w,r]=(0,o.useState)();(0,o.useEffect)(()=>{if(!m)return;const _=new AbortController,h=setTimeout(()=>{q.checkAddress(a,n,{username:d,domain:l},_.signal).then(j=>{_.signal.aborted||r({key:i,result:j})}).catch(j=>{_.signal.aborted||r({key:i,error:j instanceof Error?j.message:"Could not check this address."})})},350);return()=>{clearTimeout(h),_.abort()}},[a,n,d,l,i,m]);const c=m&&w?.key===i?w:void 0;return{result:c?.result,error:c?.error,checking:m&&!c}}t(Es,"useEmailAddressCheck");var e=Ue(as(),1);function Je(){return(0,e.jsxs)("div",{role:"note",className:"space-y-3 rounded-lg border border-line bg-bg-3/30 p-4",children:[(0,e.jsxs)("div",{className:"flex items-start gap-2",children:[(0,e.jsx)(xs,{className:"size-4 shrink-0 text-(--status-agent-paused)"}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("p",{className:"text-sm font-medium",children:"Anyone can email an unrestricted inbox"}),(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Incoming email can create tasks and trigger agent work. Set up an allowlist in AgentMail to limit who can contact this inbox."}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"Wardmote does not verify sender restrictions. AgentMail controls new messages and replies separately; check both lists."})]})]}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-4 text-sm",children:[(0,e.jsx)("a",{href:"https://console.agentmail.to",target:"_blank",rel:"noreferrer",className:"underline underline-offset-4",children:"Open AgentMail ↗"}),(0,e.jsx)("a",{href:"https://docs.agentmail.to/knowledge-base/allowlists-blocklists",target:"_blank",rel:"noreferrer",className:"text-ink-3 underline underline-offset-4",children:"Set up allowlists ↗"})]})]})}t(Je,"EmailSafetyNotice");var ce="w-full rounded-md border border-line-strong bg-bg px-3 py-2 text-sm";function Ks(a){try{const n=JSON.parse(sessionStorage.getItem(a)??"{}");if(!n||typeof n!="object")return{};const d={};for(const l of["connectionId","agentId","inboxId","username","domain"])typeof n[l]=="string"&&(d[l]=n[l]);return(n.step===0||n.step===1)&&(d.step=n.step),typeof n.requestId=="string"&&Qe(n.requestId)&&(d.requestId=n.requestId),(n.addressMode==="new"||n.addressMode==="existing")&&(d.addressMode=n.addressMode),(n.mode==="websocket"||n.mode==="webhook")&&(d.mode=n.mode),(n.selectedCredentialId===null||typeof n.selectedCredentialId=="string")&&(d.selectedCredentialId=n.selectedCredentialId),typeof n.allowInboxKey=="boolean"&&(d.allowInboxKey=n.allowInboxKey),typeof n.domainSelected=="boolean"&&(d.domainSelected=n.domainSelected),Array.isArray(n.takenAddresses)&&(d.takenAddresses=n.takenAddresses.filter(l=>typeof l=="string"&&l.length<=320).slice(-20)),d}catch{return{}}}t(Ks,"readEmailSetupDraft");function rt(){const{selectedCompanyId:a}=is(),[n]=Oe();return a?(0,e.jsx)(_s,{companyId:a},`${a}:${n.get("resume")??n.get("setupId")??n.get("connectionId")??"new"}:${n.get("agentId")??"choose"}`):(0,e.jsx)("p",{role:"status",className:"p-6 text-sm text-ink-3",children:"Loading email setup…"})}t(rt,"EmailEndpointSetup");function _s({companyId:a}){const[n]=Oe(),d=rs(),l=We(),m=n.get("resume"),i=n.get("setupId"),w=`wardmote.agentmail-setup:${a}:${m??i??n.get("connectionId")??"new"}:${n.get("agentId")??"choose"}`,[r]=(0,o.useState)(()=>{const s=Ks(w);return m&&s.requestId&&s.requestId!==m?{}:s}),[c,_]=(0,o.useState)(r.connectionId??n.get("connectionId")??""),[h,j]=(0,o.useState)(r.step??(m?1:0)),[g,V]=(0,o.useState)(r.agentId??n.get("agentId")??""),[y,v]=(0,o.useState)(""),[p,me]=(0,o.useState)(r.selectedCredentialId!==void 0?r.selectedCredentialId:c||null),[je,B]=(0,o.useState)(""),[D,xe]=(0,o.useState)(r.allowInboxKey??!1),[E]=(0,o.useState)(()=>r.requestId??m??(i&&Qe(i)?i:crypto.randomUUID())),[C,ue]=(0,o.useState)(r.addressMode??"new"),[U,he]=(0,o.useState)(r.inboxId??""),[S,X]=(0,o.useState)(r.username??""),[K,ye]=(0,o.useState)(r.domain??"agentmail.to"),[Y,ve]=(0,o.useState)(r.domainSelected??(!!r.domain&&r.domain!=="agentmail.to")),[Z,ke]=(0,o.useState)(r.takenAddresses??[]),[Q,Ne]=(0,o.useState)(r.mode??"websocket"),[ee,se]=(0,o.useState)(!1),[O,we]=(0,o.useState)({}),Ce=(0,o.useRef)(!1);(0,o.useEffect)(()=>{if(a)try{h===2?sessionStorage.removeItem(w):sessionStorage.setItem(w,JSON.stringify({connectionId:c,step:h,agentId:g,requestId:E,addressMode:C,inboxId:U,username:S,domain:K,domainSelected:Y,takenAddresses:Z,mode:Q,allowInboxKey:D,selectedCredentialId:p}))}catch{}},[a,w,c,h,g,E,C,U,S,K,Y,Z,Q,D,p]);const H=T({queryKey:R.agents.list(a),queryFn:t(()=>be.list(a),"queryFn"),enabled:!!a}),te=T({queryKey:R.projects.list(a),queryFn:t(()=>us.list(a),"queryFn"),enabled:!!a&&ee}),ae=T({queryKey:["email-boundary-issues",a],queryFn:t(()=>os.list(a),"queryFn"),enabled:!!a&&ee}),k=H.data?.find(s=>s.id===g),ne=Pe(k?.permissions)==="low_trust_review",ie=ze(De(k?.permissions)),N=T({queryKey:["email-credential-inspect",a,c],queryFn:t(()=>q.inspectSaved(a,c),"queryFn"),enabled:!!a&&!!c,retry:!1}),A=T({queryKey:["email-inboxes",a],queryFn:t(()=>q.list(a),"queryFn"),enabled:!!a}),f=A.data?.find(s=>s.id===E&&s.status!=="archived"),x=f?.address,J=T({queryKey:["email-resume-account",a,f?.connectionId],queryFn:t(()=>Be.getConnection(f.connectionId),"queryFn"),enabled:!!m&&E===m&&!!f&&!c,retry:!1});(0,o.useEffect)(()=>{if(!m||!f||c||!J.isSuccess)return;const s=J.data?.config?.credentialConnectionId;typeof s=="string"?_(s):j(0),Ne(f.receiveMode)},[m,f,c,J.isSuccess,J.data]),(0,o.useEffect)(()=>{f&&V(f.assignedAgentId)},[f]);const M=N.data?.scope.scope_type==="inbox",Se=[...new Set(N.data?.domains.filter(s=>s.status==="VERIFIED"&&s.domain.toLowerCase()!=="agentmail.to").map(s=>s.domain.toLowerCase())??[])],Ae=Se[0]??"agentmail.to";(0,o.useEffect)(()=>{N.isSuccess&&!Y&&!x&&ye(Ae)},[N.isSuccess,Y,x,Ae]),(0,o.useEffect)(()=>{!M||!A.isSuccess||(x||D?(ue("existing"),he(N.data?.inboxes[0]?.inbox_id??"")):h===1&&(B(N.data?.inboxes[0]?.inbox_id??"this inbox"),me(null),j(0)))},[M,N.data,A.isSuccess,x,D,h]),(0,o.useEffect)(()=>{k&&!Ce.current&&(Ce.current=!0,S||X(k.name.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").slice(0,64)))},[k,S]);const $=G({mutationFn:t(async()=>{if(x)return!0;const s=p?await q.inspectSaved(a,p):await q.inspect(a,y.trim());if(s.scope.scope_type==="inbox"&&!D)return B(s.inboxes[0]?.inbox_id??"this inbox"),!1;const F=!!c&&p!==c,W=F?crypto.randomUUID():E;let z=p;return z||(z=(await q.connect(a,{apiKey:y.trim(),grantKind:"organization",allAgents:!1,agentIds:[g],idempotencyKey:W})).id),l.setQueryData(["email-credential-inspect",a,z],s),me(z),v(""),l.invalidateQueries({queryKey:["email-credentials",a]}),l.invalidateQueries({queryKey:R.tools.connections(a)}),F?(f&&(await q.control(f.id,"remove"),await l.invalidateQueries({queryKey:["email-inboxes",a]})),Me({connectionId:z,selectedCredentialId:z,agentId:g,step:1,requestId:W,addressMode:s.scope.scope_type==="inbox"?"existing":"new",inboxId:s.scope.scope_type==="inbox"?s.inboxes[0]?.inbox_id??"":"",username:S,domain:"agentmail.to",domainSelected:!1,takenAddresses:[],mode:Q,allowInboxKey:D}),!1):(_(z),B(""),ue(s.scope.scope_type==="inbox"?"existing":"new"),s.scope.scope_type==="inbox"&&he(s.inboxes[0]?.inbox_id??""),!0)},"mutationFn"),onSuccess:t(s=>{s&&j(1)},"onSuccess")});function Ge(s){me(s),v(""),B(""),xe(!1),ve(!1),ke([]),$.reset()}t(Ge,"selectCredential");const pe=T({queryKey:R.agents.detail(g),queryFn:t(()=>be.get(g),"queryFn"),enabled:!!g&&ee}),re=G({mutationFn:t(()=>be.updatePermissions(g,{...O,canCreateAgents:O.canCreateAgents??!1,canCreateSkills:O.canCreateSkills??!0,canAssignTasks:pe.data?.access?.canAssignTasks??!1},a),"mutationFn"),onSuccess:t(()=>{se(!1),l.invalidateQueries({queryKey:R.agents.list(a)})},"onSuccess")}),I=G({mutationFn:t(()=>q.setup(a,{assignedAgentId:g,credentialConnectionId:c,...x?{inboxId:x}:C==="existing"?{inboxId:U}:{username:S,domain:K},receiveMode:Q,idempotencyKey:E}),"mutationFn"),onError:t(async s=>{s instanceof ns&&s.body?.code==="agentmail_address_taken"&&ke(F=>[...new Set([...F,`${S}@${K}`.toLowerCase()])].slice(-20)),await l.invalidateQueries({queryKey:["email-inboxes",a]})},"onError"),onSuccess:t(()=>{l.invalidateQueries({queryKey:["email-inboxes",a]}),l.invalidateQueries({queryKey:R.chatEndpoints.list(a)}),l.invalidateQueries({queryKey:R.tools.connections(a)}),l.invalidateQueries({queryKey:R.tools.connectionInstalls(c)}),j(2)},"onSuccess")}),Ie=x??(C==="existing"?U:`${S}@${K}`),qe=new Set([...Z,...N.data?.inboxes.map(s=>s.inbox_id.toLowerCase())??[]]),oe=h===1&&C==="new"&&!x&&!M,Ee=oe&&qe.has(Ie.toLowerCase()),ge=/^[a-z0-9][a-z0-9._-]*$/.test(S)&&S.length<=64,P=Es(a,c,S,K,oe&&ge&&!!N.data&&!Ee),fe=Ee||P.result?.status==="taken",Ke=oe&&ge&&(fe||P.result?.status==="unknown")?["-agent","-team",`-${E.slice(0,6)}`].map(s=>`${S.slice(0,64-s.length)}${s}`).filter(s=>!qe.has(`${s}@${K}`)):[],Ve=C==="existing"&&A.data?.some(s=>s.id!==E&&s.address===Ie&&s.status!=="archived"),L=fe?"This email address is already in use. Choose a different address.":Ve?"This inbox is already assigned to an agent.":null,le=$.error??(fe?null:I.error)??J.error??N.error??H.error,b=$.isPending||I.isPending,_e=A.isSuccess&&(!m||E!==m||!!f)&&(!f||f.assignedAgentId===g),Te=_e&&!!k&&!b&&!(ne&&!ie)&&(!!x||!!p||!!y.trim()),Fe=_e&&!!k&&!b&&!!N.data&&!(ne&&!ie)&&!L&&!P.checking&&(!!x||(C==="existing"?!!U:ge)),Re=t(()=>{k&&(we(k.permissions),se(!0))},"openTrust"),Xe=t(()=>d(`/apps/chat/${I.data?.id??f?.id}/settings`),"leave"),Ye=t(()=>{try{sessionStorage.removeItem(w)}catch{}d("/apps")},"cancel");function Me(s){try{sessionStorage.setItem(`wardmote.agentmail-setup:${a}:${s.requestId}:${g}`,JSON.stringify(s))}catch{}d(`/apps/chat/connect?${new URLSearchParams({provider:"agentmail",purpose:"chat",setupId:s.requestId,agentId:g,connectionId:s.connectionId})}`)}t(Me,"openDraft");const Ze=t(()=>{const s=crypto.randomUUID();Me({connectionId:c,selectedCredentialId:c,agentId:g,step:1,requestId:s,addressMode:"new",username:"",inboxId:"",domain:x?.slice(x.lastIndexOf("@")+1)??K,domainSelected:!0,takenAddresses:Z,mode:Q,allowInboxKey:!1})},"chooseAnotherAddress");return(0,e.jsxs)("div",{className:"mx-auto max-w-xl space-y-6 p-6",children:[(0,e.jsx)("header",{className:"space-y-2",children:(0,e.jsx)("h1",{className:"text-xl font-bold",children:h===2?"Your agent’s email is ready":"Give an agent an email address"})}),h<2&&A.isError&&(0,e.jsxs)("div",{role:"alert",className:"space-y-2 text-sm",children:[(0,e.jsxs)("p",{className:"text-bad",children:["Could not load email setup progress. ",A.error.message]}),(0,e.jsx)(u,{type:"button",variant:"secondary",size:"sm",disabled:b||A.isFetching,onClick:t(()=>{A.refetch()},"onClick"),children:A.isFetching?"Loading…":"Retry loading inboxes"})]}),h<2&&m===E&&A.isSuccess&&!f&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:"This email setup could not be found. Return to Connectors and start a new connection."}),h<2&&(0,e.jsx)(ws,{labels:["Agent","Email address"],step:h,availableStep:h,disabled:b,onSelect:t(s=>{I.reset(),j(s)},"onSelect")}),h===0&&(0,e.jsxs)("form",{className:"space-y-6",onSubmit:t(s=>{s.preventDefault(),Te&&$.mutate()},"onSubmit"),children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(de,{htmlFor:"email-agent",children:"Agent"}),(0,e.jsx)(vs,{id:"email-agent",value:g,disabled:b||H.isPending||!A.isSuccess||!!f,placeholder:"Choose an agent",emptyMessage:"No agents found.",triggerClassName:"h-10",agents:(H.data??[]).filter(s=>!["terminated","pending_approval"].includes(s.status)),onChange:t(s=>{V(s),X((H.data?.find(F=>F.id===s)?.name??"").toLowerCase().replace(/[^a-z0-9._-]+/g,"-").slice(0,64))},"onChange")})]}),!x&&(0,e.jsx)(As,{companyId:a,connectionId:p,onConnectionChange:Ge,value:y,onChange:t(s=>{v(s),$.reset()},"onChange"),disabled:b}),je&&(0,e.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,e.jsxs)("p",{className:"text-ink-3",children:["That key only connects ",je,". Choose a saved account key or enter one to create a new address."]}),(0,e.jsx)(u,{type:"button",variant:"link",size:"sm",className:"h-auto p-0",disabled:b||!(p||y.trim()),onClick:t(()=>{xe(!0),B(""),$.reset()},"onClick"),children:"Use the existing inbox instead"})]}),ne&&!ie&&(0,e.jsxs)("div",{role:"alert",className:"space-y-2 text-sm",children:[(0,e.jsx)("p",{children:"This agent needs a work boundary before it can receive email."}),(0,e.jsx)(u,{type:"button",variant:"secondary",size:"sm",onClick:Re,children:"Configure work boundary"})]}),le&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:le.message}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t border-line pt-5",children:[(0,e.jsx)(u,{type:"button",variant:"ghost",disabled:b,onClick:Ye,children:"Cancel"}),(0,e.jsxs)(u,{disabled:!Te,children:[$.isPending?"Connecting…":"Continue",(0,e.jsx)($e,{className:"size-4"})]})]})]}),h===1&&(0,e.jsxs)("form",{className:"space-y-6",onSubmit:t(s=>{s.preventDefault(),Fe&&I.mutate()},"onSubmit"),children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)(de,{htmlFor:C==="new"?"email-name":"email-existing",children:[k?.name,"’s email address"]}),x?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("p",{className:"text-sm font-medium",children:x}),(0,e.jsxs)("p",{className:"text-sm text-ink-3",children:["This address was created in AgentMail. Finish connecting it to ",k?.name,M?".":", or choose a different address. The original inbox will stay in AgentMail."]}),!M&&(0,e.jsx)(u,{type:"button",variant:"link",size:"sm",className:"h-auto p-0",disabled:b,onClick:Ze,children:"Choose a different address"})]}):C==="new"?(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(ys,{id:"email-name",className:"min-w-0",value:S,maxLength:64,autoComplete:"off",spellCheck:!1,disabled:b,"aria-invalid":!!L,"aria-describedby":L?"email-address-error":"email-address-status",onChange:t(s=>{X(s.target.value.toLowerCase()),I.reset()},"onChange")}),(0,e.jsx)("select",{id:"email-domain","aria-label":"Email domain",className:`${ce} max-w-1/2 shrink-0`,value:K,disabled:b||!N.data,onChange:t(s=>{ve(!0),ye(s.target.value),I.reset()},"onChange"),children:[...new Set([...Se,"agentmail.to",K])].map(s=>(0,e.jsxs)("option",{value:s,children:["@",s]},s))})]})}):(0,e.jsxs)("select",{id:"email-existing",className:ce,value:x??U,disabled:b||M||!!x,"aria-invalid":!!L,"aria-describedby":L?"email-address-error":void 0,onChange:t(s=>{he(s.target.value),I.reset()},"onChange"),children:[(0,e.jsx)("option",{value:"",children:"Choose an inbox"}),N.data?.inboxes.map(s=>{const F=A.data?.some(W=>W.id!==E&&W.address===s.inbox_id&&W.status!=="archived");return(0,e.jsxs)("option",{value:s.inbox_id,disabled:F,children:[s.inbox_id,F?" — already assigned":""]},s.inbox_id)})]}),M&&!x&&(0,e.jsx)(u,{type:"button",variant:"link",size:"sm",className:"h-auto p-0",disabled:b,onClick:t(()=>{xe(!1),j(0)},"onClick"),children:"Choose a key for a new address"}),L&&(0,e.jsx)("p",{id:"email-address-error",role:"alert",className:"text-sm text-bad",children:L}),oe&&!L&&(0,e.jsx)("p",{id:"email-address-status",role:"status",className:"text-sm text-ink-3",children:P.checking?"Checking address…":P.error?`Could not check this address. ${P.error}`:P.result?.status==="unknown"?"AgentMail confirms availability when you create the address.":null}),Ke.length>0&&(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-sm","aria-label":"Suggested email addresses",children:[(0,e.jsx)("span",{className:"text-ink-3",children:"Try:"}),Ke.map(s=>(0,e.jsxs)(u,{type:"button",variant:"link",size:"sm",className:"h-auto p-0",disabled:b,onClick:t(()=>{X(s),I.reset()},"onClick"),children:[s,"@",K]},s))]}),!M&&!x&&(0,e.jsx)(u,{type:"button",variant:"link",size:"sm",className:"h-auto p-0",disabled:b,onClick:t(()=>{ue(C==="new"?"existing":"new"),I.reset()},"onClick"),children:C==="new"?"Use an existing inbox":"Create a new address"})]}),(0,e.jsx)(He,{className:"py-4",children:(0,e.jsxs)(Ns,{className:"px-4",children:[(0,e.jsx)("h2",{className:"text-sm font-medium",children:"How it Works"}),(0,e.jsxs)(ks,{children:["Incoming email creates tasks for ",k?.name,". Replies stay in the same task."]})]})}),(0,e.jsxs)("details",{className:"space-y-4",children:[(0,e.jsx)("summary",{className:"cursor-pointer text-sm text-ink-3",children:"Advanced options"}),(0,e.jsxs)("div",{className:"space-y-4",children:[C==="new"&&(0,e.jsx)("div",{className:"space-y-2",children:(0,e.jsx)("a",{className:"text-sm underline",href:"https://docs.agentmail.to/custom-domains",target:"_blank",rel:"noreferrer",children:"Set up a custom domain ↗"})}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(de,{htmlFor:"email-mode",children:"Receiving"}),(0,e.jsxs)("select",{id:"email-mode",value:Q,disabled:b,className:ce,onChange:t(s=>Ne(s.target.value),"onChange"),children:[(0,e.jsx)("option",{value:"websocket",children:"Live connection"}),(0,e.jsx)("option",{value:"webhook",children:"Webhook"})]})]}),(0,e.jsx)(Je,{}),(0,e.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,e.jsx)("p",{children:ne&&ie?"Low-trust review configured":"Manage which tasks and tools this agent can access."}),(0,e.jsx)(u,{type:"button",variant:"secondary",size:"sm",onClick:Re,children:"Review trust settings"})]})]})]}),le&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:le.message}),N.isPending&&(0,e.jsx)("p",{role:"status",className:"text-sm text-ink-3",children:"Loading email options…"}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t border-line pt-5",children:[(0,e.jsxs)(u,{type:"button",variant:"ghost",disabled:b,onClick:t(()=>{I.reset(),j(0)},"onClick"),children:[(0,e.jsx)(ls,{className:"size-4"}),"Back"]}),(0,e.jsxs)(u,{disabled:!Fe,children:[I.isPending?"Connecting…":x?"Finish connecting":C==="new"?"Create email address":"Connect email address",(0,e.jsx)($e,{className:"size-4"})]})]})]}),h===2&&(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("p",{className:"flex items-center gap-2 font-medium",children:[(0,e.jsx)(ds,{className:"size-4"}),I.data?.address]}),(0,e.jsxs)("p",{className:"text-sm text-ink-3",children:[k?.name," can now receive email at this address."]})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t border-line pt-5",children:[(0,e.jsx)(u,{variant:"ghost",onClick:Xe,children:"Email settings"}),(0,e.jsx)(u,{onClick:t(()=>d("/apps"),"onClick"),children:"Done"})]})]}),(0,e.jsx)(js,{open:ee,onOpenChange:se,children:(0,e.jsxs)(gs,{className:"max-h-screen overflow-y-auto sm:max-w-2xl",children:[(0,e.jsxs)(hs,{children:[(0,e.jsxs)(bs,{children:["Trust settings · ",k?.name]}),(0,e.jsx)(fs,{children:"Changes apply to all of this agent’s work. Use a dedicated email agent if its other tasks need broader access."})]}),(0,e.jsx)(qs,{permissions:O,onChange:we,companyId:a,projectCandidates:(te.data??[]).map(s=>({id:s.id,label:s.name})),issueCandidates:(ae.data??[]).map(s=>({id:s.id,label:`${s.identifier} · ${s.title}`})),allowSingleIssue:!1,candidatesLoading:te.isPending||ae.isPending}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"Low trust limits Wardmote access; it does not sandbox the runtime. Review filesystem, tool, and secret access separately."}),(re.error||te.error||ae.error)&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:(re.error??te.error??ae.error)?.message}),(0,e.jsxs)(ps,{children:[(0,e.jsx)(u,{variant:"ghost",onClick:t(()=>se(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(u,{disabled:re.isPending||pe.isPending||!!pe.error||Pe(O)==="low_trust_review"&&!ze(De(O)),onClick:t(()=>re.mutate(),"onClick"),children:"Save trust settings"})]})]})})]})}t(_s,"EmailEndpointSetupForm");function ot({companyId:a,connectionId:n,canConfigure:d}){const l=T({queryKey:["email-inboxes",a],queryFn:t(()=>q.list(a),"queryFn"),refetchInterval:1e4}),m=T({queryKey:R.tools.connections(a),queryFn:t(()=>Be.listConnections(a),"queryFn")}),i=new Set(m.data?.connections.filter(r=>r.config?.credentialConnectionId===n).map(r=>r.id)),w=l.data?.filter(r=>r.connectionId===n||i.has(r.connectionId))??[];return(0,e.jsxs)("section",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 rounded-xl border border-line p-6",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:"Give an agent an email address"}),(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Each email conversation becomes a task."})]}),d&&(0,e.jsx)(u,{asChild:!0,size:"lg",children:(0,e.jsx)(Le,{to:`/apps/chat/connect?provider=agentmail&connectionId=${n}`,children:"Give an agent an email address"})})]}),w.map(r=>(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border border-line p-4",children:[(0,e.jsx)(Le,{className:"text-sm underline",to:`/apps/chat/${r.id}/settings`,children:r.address}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:r.lastError??(r.status==="active"?"Receiving email":r.status)})]},r.id)),!!w.length&&(0,e.jsx)(Je,{}),l.error&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:l.error.message})]})}t(ot,"EmailConnectionInboxes");function lt({endpointId:a,companyId:n,assignedAgentName:d}){const l=We(),m=T({queryKey:["email-inboxes",n],queryFn:t(()=>q.list(n),"queryFn"),refetchInterval:1e4}),i=m.data?.find(p=>p.id===a),[w,r]=(0,o.useState)(!1),[c,_]=(0,o.useState)(""),[h,j]=(0,o.useState)(!1);(0,o.useEffect)(()=>{i?.lastError&&j(!0)},[i?.lastError]);const[g,V]=(0,o.useState)(""),y=G({mutationFn:t(()=>q.reconnect(a,c,g||i.receiveMode),"mutationFn"),onSuccess:t(()=>{_("")},"onSuccess"),onSettled:t(()=>{l.invalidateQueries({queryKey:["email-inboxes",n]})},"onSettled")}),v=G({mutationFn:t(p=>q.control(a,p),"mutationFn"),onSuccess:t(p=>{r(p.status==="archived"),l.invalidateQueries({queryKey:["email-inboxes",n]})},"onSuccess")});return w?(0,e.jsx)("p",{children:"Inbox disconnected. Email history remains in its tasks."}):i?(0,e.jsxs)("div",{className:"max-w-2xl space-y-8 pb-8",children:[(0,e.jsxs)("header",{className:"space-y-2",children:[(0,e.jsxs)("p",{className:"text-sm text-ink-3",children:[d,"’s email address"]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[(0,e.jsx)("h1",{"aria-label":i.address??void 0,className:"min-w-0 break-all text-xl font-bold",children:i.address?(0,e.jsxs)(Is,{text:i.address,ariaLabel:"Copy email address",title:"Copy email address",containerClassName:"max-w-full",className:"flex min-w-0 items-center gap-2 rounded-md text-left",children:[(0,e.jsx)("span",{className:"min-w-0 break-all",children:i.address}),(0,e.jsx)(cs,{"aria-hidden":"true",className:"size-4 shrink-0 text-ink-3"})]}):"Email inbox"}),i.address&&(0,e.jsxs)("a",{href:`https://console.agentmail.to/dashboard/inboxes/${encodeURIComponent(i.address)}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-sm text-ink-3 underline underline-offset-4 hover:text-ink",children:["View inbox ",(0,e.jsx)(ms,{"aria-hidden":"true",className:"size-3"})]})]}),i.status==="active"&&i.address&&(0,e.jsxs)("p",{className:"text-sm text-ink-3",children:["Send an email to this address to start a task with ",d,"."]})]}),(0,e.jsxs)(He,{className:"gap-2 p-4",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"How it Works"}),(0,e.jsxs)("p",{className:"text-sm text-ink-3",children:["Incoming email creates tasks for ",d,". Replies stay in the same task. Task comments stay internal; use Email reply to send an email."]})]}),(0,e.jsxs)("section",{"aria-labelledby":"email-receiving-heading",className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h2",{id:"email-receiving-heading",className:"text-sm font-semibold",children:"Receiving email"}),(i.status!=="active"||i.lastError)&&(0,e.jsx)(Cs,{status:i.status==="active"?"attention":i.status,label:i.status==="active"?"Needs attention":i.status==="revoked"?"Access revoked":void 0})]}),["active","paused"].includes(i.status)&&(0,e.jsx)(u,{variant:"secondary",size:"sm",disabled:v.isPending,onClick:t(()=>v.mutate(i.status==="active"?"pause":"resume"),"onClick"),children:i.status==="active"?"Pause":"Resume"})]}),i.status==="paused"&&(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Receiving is paused. Resume to receive new email."}),(0,e.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("dt",{className:"text-xs text-ink-3",children:"Receiving mode"}),(0,e.jsx)("dd",{className:"text-sm",children:i.receiveMode==="websocket"?"Live connection":"Webhook"})]}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("dt",{className:"text-xs text-ink-3",children:"Last mail check"}),(0,e.jsx)("dd",{className:"font-mono text-xs",children:i.lastSyncAt?ss(i.lastSyncAt):"Not checked yet"})]})]}),i.lastError&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:i.lastError}),v.error&&v.variables!=="remove"&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:v.error.message})]}),(0,e.jsxs)("details",{open:h,onToggle:t(p=>j(p.currentTarget.open),"onToggle"),className:"border-t border-line pt-5",children:[(0,e.jsx)("summary",{className:"cursor-pointer text-sm font-medium",children:"Reconnect inbox"}),(0,e.jsxs)("div",{className:"space-y-4 pt-4",children:[(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Replace the API key or change how this inbox receives email. The email address and task history stay the same."}),(0,e.jsx)(Ss,{label:"New API key",value:c,onChange:_,disabled:y.isPending}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(de,{htmlFor:"email-reconnect-mode",children:"Receiving mode"}),(0,e.jsxs)("select",{id:"email-reconnect-mode",className:ce,disabled:y.isPending,value:g||i.receiveMode,onChange:t(p=>V(p.target.value),"onChange"),children:[(0,e.jsx)("option",{value:"websocket",children:"Live connection"}),(0,e.jsx)("option",{value:"webhook",children:"Webhook"})]})]}),y.error&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:y.error.message}),y.isSuccess&&(0,e.jsx)("p",{role:"status",className:"text-sm",children:"Inbox reconnected."}),(0,e.jsx)("div",{className:"flex justify-end",children:(0,e.jsx)(u,{variant:"secondary",disabled:!c||y.isPending,onClick:t(()=>y.mutate(),"onClick"),children:y.isPending?"Reconnecting…":"Reconnect inbox"})})]})]}),(0,e.jsxs)("section",{"aria-labelledby":"email-disconnect-heading",className:"space-y-3 border-t border-line pt-5",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("h2",{id:"email-disconnect-heading",className:"text-sm font-semibold",children:"Disconnect inbox"}),(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Stop receiving email in Wardmote. The inbox stays in AgentMail."})]}),(0,e.jsx)(u,{variant:"secondary",size:"sm",disabled:v.isPending,onClick:t(()=>v.mutate("remove"),"onClick"),children:"Disconnect inbox"})]}),v.error&&v.variables==="remove"&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:v.error.message})]})]}):(0,e.jsx)("p",{role:m.error?"alert":void 0,children:m.error?.message??"Loading email inbox…"})}t(lt,"EmailEndpointSettings");export{lt as n,rt as r,ot as t};
|
package/dist/assets/{ExecutionWorkspaceDetail-CuD5xWOB.js → ExecutionWorkspaceDetail-BGV-9D5Y.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ms=Object.defineProperty;var r=(s,n)=>ms(s,"name",{value:n,configurable:!0});import{i as $e}from"./rolldown-runtime-ZpX3ckPj.js";import{C as ps,S as xs,T as hs,Ui as fs,Zn as gs,h as L,l as S,na as js,ta as vs}from"./createLucideIcon-DJi9suAC.js";import{h as bs,v as ks}from"./star-BZgQbzhV.js";import{X as Re,_ as le,t as x,v as P}from"./queryKeys-DYV5MhM_.js";import{a as ys,i as ws,r as Ns,t as Rs}from"./WorkspaceRuntimeControls-T4YUoZvK.js";import{n as Cs}from"./CompanyContext-CSrVsSze.js";import{o as Is,r as Ss,t as Y,zt as ke}from"./router-2UfGeejU.js";import{t as Ws}from"./tabs-B2Os_leL.js";import{o as Ps,r as _s,t as Es}from"./popover-BhYHYj7q.js";import{t as As}from"./check-Ctsrlfa-.js";import{t as Ts}from"./chevron-down-BCvxsWfI.js";import{t as Ce}from"./copy-_wvZOjTe.js";import{t as ye}from"./external-link-nl1b263c.js";import{r as ue,t as N}from"./button-CMwV3L1P.js";import{t as we}from"./play-CJNuUj69.js";import{t as Fs}from"./repeat-DGPKlc5I.js";import{t as De}from"./rotate-ccw-CQEJ4ewP.js";import{t as Ls}from"./square-B2aH51tE.js";import{t as Ve}from"./triangle-alert-CBVKiaXB.js";import{a as qs}from"./ToastContext-DMdt9oTd.js";import{t as Je}from"./agents-DmlgUVso.js";import{t as Os}from"./heartbeats-DOyojsaN.js";import{n as Us,t as Ks}from"./useSharedPolling-D4Xn8mY2.js";import{t as Bs}from"./projects-mixWrT5q.js";import{t as U}from"./input-DobnTAyB.js";import{n as Ds,o as Ms,t as zs}from"./slots-Dw517dxP.js";import{t as Me}from"./routines-KPtwxuS7.js";import{n as Qs}from"./BreadcrumbContext-BVZDZoC0.js";import{t as $}from"./textarea-BRPEfJ-g.js";import{t as $s}from"./clipboard-CTLKYvRL.js";import{i as H,n as Vs,o as G,r as K,s as X,t as B}from"./card-Bru3x_SJ.js";import{Kr as Js,M as Hs,nr as Gs,r as Xs,tr as V}from"./index-DDoARkPG.js";import{t as ae}from"./separator-B2LFqBpM.js";import{t as Zs}from"./useManagedSandboxOnly-CO01cDK4.js";import{t as He}from"./CopyText-Cr673_Kx.js";import{n as Ys,t as en}from"./SummarySlotCard-DlSmN6PL.js";import{t as sn}from"./MissingPluginTabPlaceholder-DT47WyQq.js";import{t as nn}from"./RoutineRunVariablesDialog-DiT_o5Dm.js";var h=$e(js(),1),e=$e(vs(),1),tn=["provisioning","starting","stopping","restarting"];function Ie(s){return tn.includes(s)}r(Ie,"isTransitional");function Ge(s){return s?s.replace(/^https?:\/\//,"").replace(/\/$/,""):null}r(Ge,"formatServiceUrl");function Xe(s){switch(s.state){case"provisioning":return{label:"Provisioning…",unhealthy:!1};case"starting":return{label:"Starting…",unhealthy:!1};case"stopping":return{label:"Stopping…",unhealthy:!1};case"restarting":return{label:"Restarting…",unhealthy:!1};case"failed":return{label:"Failed",unhealthy:!1};case"running":return s.healthStatus==="unhealthy"?{label:"Unhealthy",unhealthy:!0}:{label:"Running",unhealthy:!1};default:return{label:"Stopped",unhealthy:!1}}}r(Xe,"statusMeta");function Se({entry:s,className:n}){if(Ie(s.state))return(0,e.jsx)(ue,{className:S("size-3 shrink-0 animate-spin text-ink-3",n)});if(s.state==="failed")return(0,e.jsx)(Ve,{className:S("size-3 shrink-0 text-bad",n)});const a=s.state==="running"&&s.healthStatus==="unhealthy";return(0,e.jsx)("span",{className:S("size-2 shrink-0 rounded-full",s.state==="running"?a?"bg-amber-500 ring-2 ring-amber-500/30":"bg-emerald-500":"border border-ink-3/60 bg-transparent",n)})}r(Se,"StatusIndicator");function Ze({url:s,disabled:n}){const[a,o]=(0,h.useState)("idle"),d=(0,h.useRef)(null);(0,h.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]);const c=a==="copied"?"URL copied":a==="failed"?"Copy failed":"Copy URL";return(0,e.jsxs)(N,{variant:"ghost",size:"icon-xs",disabled:n,"aria-label":c,title:c,onClick:r(async()=>{try{await $s(s),o("copied")}catch{o("failed")}d.current&&clearTimeout(d.current),d.current=setTimeout(()=>o("idle"),1500)},"onClick"),children:[a==="copied"?(0,e.jsx)(As,{className:"size-3"}):a==="failed"?(0,e.jsx)(Ve,{className:"size-3 text-bad"}):(0,e.jsx)(Ce,{className:"size-3"}),(0,e.jsx)("span",{className:"sr-only","aria-live":"polite",children:c})]})}r(Ze,"CopyUrlButton");function ce({entry:s,compact:n}){const a=Ge(s.url)??(s.port?`:${s.port}`:null),o=s.state==="running"&&!!s.url;return a?(0,e.jsxs)(e.Fragment,{children:[o?(0,e.jsx)("a",{href:s.url??void 0,target:"_blank",rel:"noreferrer",title:s.url??void 0,className:S("min-w-0 truncate font-mono text-xs text-ink hover:underline",n?"max-w-44":"max-w-56"),children:a}):(0,e.jsx)("span",{title:s.url??void 0,className:S("min-w-0 truncate font-mono text-xs text-ink-3/70",n?"max-w-44":"max-w-56"),children:a}),(0,e.jsxs)("span",{className:S("flex items-center",o?null:"invisible"),"aria-hidden":o?void 0:!0,children:[(0,e.jsx)(Ze,{url:s.url??"",disabled:!o}),(0,e.jsx)(N,{asChild:o,variant:"ghost",size:"icon-xs",disabled:!o,title:"Open in new tab",children:o?(0,e.jsx)("a",{href:s.url??void 0,target:"_blank",rel:"noreferrer","aria-label":"Open in new tab",children:(0,e.jsx)(ye,{className:"size-3"})}):(0,e.jsx)(ye,{className:"size-3"})})]})]}):(0,e.jsx)("span",{className:"font-mono text-xs text-ink-3/70",children:"no url"})}r(ce,"UrlSegment");function We({entry:s,onAction:n}){const a=Ie(s.state),o=s.canStart??!0;return s.state==="stopped"?(0,e.jsxs)(N,{variant:"primary",size:"xs",className:"w-13 justify-center",disabled:!o,onClick:r(()=>n("start"),"onClick"),"aria-label":"Start",title:"Start",children:[(0,e.jsx)(we,{className:"size-3"}),"Start"]}):s.state==="failed"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(N,{variant:"primary",size:"icon-xs",disabled:!o,onClick:r(()=>n("start"),"onClick"),"aria-label":"Start",title:"Start",children:(0,e.jsx)(we,{className:"size-3"})}),(0,e.jsx)(N,{variant:"ghost",size:"icon-xs",disabled:!o,onClick:r(()=>n("restart"),"onClick"),"aria-label":"Restart",title:"Restart",className:"border",children:(0,e.jsx)(De,{className:"size-3"})})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(N,{variant:"ghost",size:"icon-xs",disabled:a,onClick:r(()=>n("stop"),"onClick"),"aria-label":"Stop",title:"Stop",className:"border",children:(0,e.jsx)(Ls,{className:"size-3"})}),(0,e.jsx)(N,{variant:"ghost",size:"icon-xs",disabled:a||!o,onClick:r(()=>n("restart"),"onClick"),"aria-label":"Restart",title:"Restart",className:"border",children:(0,e.jsx)(De,{className:"size-3"})})]})}r(We,"ActionSlots");function rn({entry:s,onViewLogs:n}){const a=s.exposureDetail??(s.state==="failed"?s.failureDetail:null);if(!a)return null;const o=s.exposureState==="failed"||s.exposureState==="cleanup_pending";return(0,e.jsxs)("div",{className:S("flex items-center gap-1 text-xs",o?"text-bad":"text-ink-3"),children:[(0,e.jsx)("span",{children:a}),n&&s.state==="failed"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{"aria-hidden":!0,children:"·"}),(0,e.jsx)("button",{type:"button",onClick:n,className:"font-medium text-ink underline underline-offset-2 hover:text-ink/80",children:"View logs"})]}):null]})}r(rn,"ServiceDetail");function an({entry:s,onAction:n,onViewLogs:a,className:o}){const d=Xe(s);return(0,e.jsxs)("div",{className:S("flex w-full flex-col items-stretch gap-1 sm:w-auto sm:items-end",o),children:[(0,e.jsxs)("div",{className:"rounded-lg border border-line bg-bg",children:[(0,e.jsxs)("div",{className:"flex h-9 items-center pl-3 pr-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 sm:min-w-24",children:[(0,e.jsx)(Se,{entry:s}),(0,e.jsx)("span",{className:"whitespace-nowrap text-xs font-medium text-ink",children:d.label})]}),(0,e.jsx)("div",{className:"mx-3 hidden h-5 w-px bg-line sm:block"}),(0,e.jsx)("div",{className:"hidden w-56 min-w-0 shrink-0 items-center gap-0.5 sm:flex",children:(0,e.jsx)(ce,{entry:s})}),(0,e.jsx)("div",{className:"mx-3 hidden h-5 w-px bg-line sm:block"}),(0,e.jsx)("div",{className:"ml-auto flex items-center gap-1 pl-3 sm:pl-0",children:(0,e.jsx)(We,{entry:s,onAction:r(c=>n(c,s.key),"onAction")})})]}),(0,e.jsx)("div",{className:"flex h-8 items-center justify-between gap-0.5 border-t border-line px-3 sm:hidden",children:(0,e.jsx)(ce,{entry:s,compact:!0})})]}),(0,e.jsx)(rn,{entry:s,onViewLogs:a})]})}r(an,"SingleServiceBar");function on({entry:s,onAction:n}){const a=Xe(s),o=Ge(s.url),d=s.state==="running"&&!!s.url,c=s.exposureState==="failed"||s.exposureState==="cleanup_pending",u=s.exposureDetail?s.exposureDetail:d?o:s.state==="starting"&&s.port?`starting on :${s.port}…`:s.state==="failed"&&s.failureDetail?s.failureDetail:`${a.label.toLowerCase().replace(/…$/,"")}${s.port?` · :${s.port}`:""}`;return(0,e.jsxs)("div",{className:"flex items-center gap-3 py-2.5",children:[(0,e.jsx)(Se,{entry:s,className:"mt-0.5"}),(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsx)("div",{className:"truncate text-sm font-medium text-ink",children:s.name}),(0,e.jsx)("div",{className:"flex min-w-0 items-center gap-0.5",children:d&&s.url?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("a",{href:s.url,target:"_blank",rel:"noreferrer",title:s.url,className:"min-w-0 truncate font-mono text-xs text-ink-3 hover:text-ink hover:underline",children:o}),(0,e.jsx)(Ze,{url:s.url})]}):(0,e.jsx)("span",{className:S("min-w-0 text-xs",c?"whitespace-normal break-words text-bad":"truncate text-ink-3"),children:u})})]}),(0,e.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:(0,e.jsx)(We,{entry:s,onAction:r(v=>n(v,s.key),"onAction")})})]})}r(on,"ServicePopoverRow");function ln({services:s,onAction:n,onManageServices:a,defaultServicesOpen:o,className:d}){const[c,u]=(0,h.useState)(o??!1),v=s.filter(f=>f.state==="running").length,k=s.some(f=>Ie(f.state)),y=s.some(f=>f.state==="failed"),m=v>0,p=s.find(f=>f.state==="running"&&f.url)??null,_={key:"__all__",name:"All services",state:k?"starting":y?"failed":m?"running":"stopped",healthStatus:s.some(f=>f.state==="running"&&f.healthStatus==="unhealthy")?"unhealthy":"healthy"};return(0,e.jsx)("div",{className:S("flex w-full flex-col items-stretch gap-1 sm:w-auto sm:items-end",d),children:(0,e.jsxs)("div",{className:"rounded-lg border border-line bg-bg",children:[(0,e.jsxs)("div",{className:"flex h-9 items-center pl-3 pr-1.5",children:[(0,e.jsxs)(Es,{open:c,onOpenChange:u,children:[(0,e.jsx)(Ps,{asChild:!0,children:(0,e.jsxs)("button",{type:"button",className:"flex h-full items-center gap-2 rounded-l-lg pr-1 text-xs font-medium text-ink hover:bg-bg-3","aria-label":`${v} of ${s.length} services running — show services`,children:[(0,e.jsx)(Se,{entry:_}),(0,e.jsxs)("span",{className:"whitespace-nowrap",children:[v,"/",s.length," running"]}),(0,e.jsx)(Ts,{className:"size-3 text-ink-3"})]})}),(0,e.jsxs)(_s,{align:"end",className:"w-96 p-0",onOpenAutoFocus:r(f=>f.preventDefault(),"onOpenAutoFocus"),children:[(0,e.jsxs)("div",{className:"px-4 pb-1 pt-3 text-xs font-medium uppercase tracking-wide text-ink-3",children:["Services · ",s.length]}),(0,e.jsx)("div",{className:"divide-y divide-line px-4",children:s.map(f=>(0,e.jsx)(on,{entry:f,onAction:n},f.key))}),(0,e.jsxs)("div",{className:"flex items-center gap-1 border-t border-line px-4 py-2",children:[(0,e.jsx)(N,{variant:"ghost",size:"xs",onClick:r(()=>n("start",null),"onClick"),children:"Start all"}),(0,e.jsx)(N,{variant:"ghost",size:"xs",onClick:r(()=>n("stop",null),"onClick"),children:"Stop all"}),(0,e.jsx)(N,{variant:"ghost",size:"xs",onClick:r(()=>n("restart",null),"onClick"),children:"Restart all"}),a?(0,e.jsx)(N,{variant:"link",size:"xs",className:"ml-auto",onClick:a,children:"Manage in Services tab →"}):null]})]})]}),(0,e.jsx)("div",{className:"mx-3 hidden h-5 w-px bg-line sm:block"}),(0,e.jsx)("div",{className:"hidden min-w-0 items-center gap-0.5 sm:flex",children:p?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"mr-1 shrink-0 text-xs text-ink-3",children:p.name}),(0,e.jsx)(ce,{entry:p})]}):(0,e.jsx)("span",{className:"font-mono text-xs text-ink-3/70",children:"no url"})}),(0,e.jsx)("div",{className:"mx-3 hidden h-5 w-px bg-line sm:block"}),(0,e.jsx)("div",{className:"ml-auto flex items-center gap-1 pl-3 sm:pl-0",children:(0,e.jsx)(We,{entry:{state:_.state,canStart:!0},onAction:r(f=>n(f,null),"onAction")})})]}),p?(0,e.jsx)("div",{className:"flex h-8 items-center justify-between gap-0.5 border-t border-line px-3 sm:hidden",children:(0,e.jsx)(ce,{entry:p,compact:!0})}):null]})})}r(ln,"MultiServiceBar");function cn({services:s,onAction:n,onViewLogs:a,onManageServices:o,defaultServicesOpen:d,className:c}){return s.length===0?null:s.length===1?(0,e.jsx)(an,{entry:s[0],onAction:n,onViewLogs:a,className:c}):(0,e.jsx)(ln,{services:s,onAction:n,onManageServices:o,defaultServicesOpen:d,className:c})}r(cn,"WorkspaceServiceControlBar");var ze=new Set([fs]);function Ye(s){const n=new Set;for(const a of s.variables)ze.has(a.name)&&n.add(a.name);for(const a of gs([s.title,s.description]))ze.has(a)&&n.add(a);return[...n]}r(Ye,"getWorkspaceSpecificRoutineVariableNames");function dn(s){return Ye(s).length>0}r(dn,"routineHasWorkspaceSpecificVariables");function un(s){return[...s].sort((n,a)=>{const o=n.title.localeCompare(a.title,void 0,{sensitivity:"base"});return o!==0?o:n.id.localeCompare(a.id)})}r(un,"sortWorkspaceRoutinesByName");var mn=100,pn=[{value:"issues",label:"Tasks",order:10},{value:"services",label:"Services",order:20},{value:"configuration",label:"Configuration",order:30},{value:"runtime_logs",label:"Runtime logs",order:40},{value:"routines",label:"Routines",order:60}];function J(s){return typeof s=="string"&&s.startsWith("plugin:")}r(J,"isExecutionWorkspacePluginTab");function xn(s){return s.map((n,a)=>({item:n,index:a})).sort((n,a)=>n.item.order-a.item.order||n.index-a.index).map(({item:n})=>n)}r(xn,"orderExecutionWorkspaceTabItems");function hn(s,n){const a=s.split("/").filter(Boolean),o=a.indexOf("execution-workspaces");if(o===-1||a[o+1]!==n)return null;const d=a[o+2];return d==="services"?"services":d==="issues"?"issues":d==="routines"?"routines":d==="runtime-logs"?"runtime_logs":d==="configuration"?"configuration":null}r(hn,"resolveExecutionWorkspaceTab");function ie(s,n){return`/execution-workspaces/${s}/${n==="runtime_logs"?"runtime-logs":n}`}r(ie,"executionWorkspaceTabPath");function be({workspaceId:s}){return(0,h.useEffect)(()=>{try{localStorage.removeItem(`wardmote:execution-workspace-tab:${s}`)}catch{}},[s]),(0,e.jsx)(Ss,{to:ie(s,"issues"),replace:!0})}r(be,"LegacyWorkspaceTabRedirect");function fn(s){if(!s)return!1;try{const n=new URL(s);return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}}r(fn,"isSafeExternalUrl");function T(s){return s??""}r(T,"readText");function Ne(s){return!s||Object.keys(s).length===0?"":JSON.stringify(s,null,2)}r(Ne,"formatJson");function gn(s){return s?L(s):"Never"}r(gn,"formatOptionalDateTime");function oe(s){const n=s.trim();return n.length>0?n:null}r(oe,"normalizeText");function de(s){const n=s.trim();if(!n)return{ok:!0,value:null};try{const a=JSON.parse(n);return!a||typeof a!="object"||Array.isArray(a)?{ok:!1,error:"Workspace commands JSON must be a JSON object."}:{ok:!0,value:a}}catch(a){return{ok:!1,error:a instanceof Error?a.message:"Invalid JSON."}}}r(de,"parseWorkspaceRuntimeJson");function es(s){if(!s)return[];const n=[],a=r((o,d,c)=>{Array.isArray(d)&&d.forEach((u,v)=>{if(!u||typeof u!="object"||Array.isArray(u))return;const k=u;if(c&&k.kind!=="service")return;const y=k.port,m=!!(y&&typeof y=="object"&&!Array.isArray(y)&&Object.hasOwn(y,"value")),p=typeof y=="number"?y:m?y.value:null;n.push({collection:o,index:v,name:typeof k.name=="string"&&k.name.trim()?k.name:`Service ${v+1}`,port:typeof p=="number"?p:null,invalidPort:(typeof y=="number"||m)&&(typeof p!="number"||!Number.isInteger(p)||p<1||p>65535)})})},"addServices");return a("commands",s.commands,!0),a("services",s.services,!1),n}r(es,"readConfiguredRuntimeServicePorts");function jn(s){const n=structuredClone(s.runtimeConfig),a=n[s.service.collection];if(!Array.isArray(a))return n;const o=a[s.service.index];if(!o||typeof o!="object"||Array.isArray(o))return n;const d=o,c=d.port&&typeof d.port=="object"&&!Array.isArray(d.port)?d.port:null,u=s.port.trim();if(!u){if(c){const k={...c,type:"auto"};delete k.value,d.port=k}else delete d.port;return n}const v=Number(u);return!Number.isInteger(v)||v<1||v>65535||(d.port={...c,type:"fixed",value:v}),n}r(jn,"updateConfiguredRuntimeServicePort");function vn(s){const n=new Map;for(const a of s){if(a.invalidPort||!a.port)continue;const o=n.get(a.port)??[];o.push(a),n.set(a.port,o)}return Array.from(n.entries()).filter(([,a])=>a.length>1).map(([a,o])=>`Port ${a} is assigned to multiple services: ${o.map(d=>d.name).join(", ")}.`)}r(vn,"getConfiguredRuntimeServicePortWarnings");function Qe(s){return{name:s.name,cwd:T(s.cwd),repoUrl:T(s.repoUrl),baseRef:T(s.baseRef),branchName:T(s.branchName),providerRef:T(s.providerRef),provisionCommand:T(s.config?.provisionCommand),runtimeProvisionCommand:T(s.config?.runtimeProvisionCommand),teardownCommand:T(s.config?.teardownCommand),cleanupCommand:T(s.config?.cleanupCommand),inheritRuntime:!s.config?.workspaceRuntime,workspaceRuntime:Ne(s.config?.workspaceRuntime)}}r(Qe,"formStateFromWorkspace");function bn(s,n){const a={},o={},d=r(u=>{s[u]!==n[u]&&(a[u]=u==="name"?oe(n[u])??s.name:oe(n[u]))},"maybeAssign");d("name"),d("cwd"),d("repoUrl"),d("baseRef"),d("branchName"),d("providerRef");const c=r(u=>{s[u]!==n[u]&&(o[u]=oe(n[u]))},"maybeAssignConfigText");if(c("provisionCommand"),c("runtimeProvisionCommand"),c("teardownCommand"),c("cleanupCommand"),s.inheritRuntime!==n.inheritRuntime||s.workspaceRuntime!==n.workspaceRuntime){const u=de(n.workspaceRuntime);if(!u.ok)throw new Error(u.error);o.workspaceRuntime=n.inheritRuntime?null:u.value}return Object.keys(o).length>0&&(a.config=o),a}r(bn,"buildWorkspacePatch");function kn(s){const n=oe(s.repoUrl);if(n)try{new URL(n)}catch{return"Repo URL must be a valid URL."}if(!s.inheritRuntime){const a=de(s.workspaceRuntime);if(!a.ok)return a.error;const o=es(a.value).find(d=>d.invalidPort);if(o)return`${o.name} has an invalid fixed port.`}return null}r(kn,"validateForm");function I({label:s,hint:n,children:a}){return(0,e.jsxs)("label",{className:"block space-y-2",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-0.5 sm:flex-row sm:items-baseline sm:justify-between sm:gap-3",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-ink",children:s}),n?(0,e.jsx)("span",{className:"text-xs text-ink-3 sm:text-right",children:n}):null]}),a]})}r(I,"Field");function yn(s){switch(s){case"worktree_prepare":return"Worktree setup";case"workspace_config_freshness":return"Config freshness";case"workspace_provision":return"Provision";case"workspace_seed":return"Database seed";case"workspace_runtime_provision":return"Runtime provision";case"workspace_teardown":return"Teardown";case"worktree_cleanup":return"Worktree cleanup";case"workspace_finalize":return"Finalize";default:return s}}r(yn,"workspaceOperationPhaseLabel");function wn(s){const n=(s.operations??[]).find(a=>a.phase==="workspace_seed"||a.phase==="workspace_runtime_provision")??null;if(n){const a=n.finishedAt??n.startedAt??null;if(n.status==="running")return{kind:"provisioning",at:a};if(n.status==="succeeded")return{kind:"provisioned",at:a};if(n.status==="failed")return{kind:"failed",at:a}}return s.runtimeProvisionCommand&&s.runtimeProvisionCommand.trim()?{kind:"deferred"}:{kind:"eager"}}r(wn,"resolveRuntimeProvisionStatus");function C({label:s,children:n}){return(0,e.jsxs)("div",{className:"flex flex-col gap-1.5 py-1.5 sm:flex-row sm:items-start sm:gap-3",children:[(0,e.jsx)("div",{className:"shrink-0 text-xs text-ink-3 sm:w-32",children:s}),(0,e.jsx)("div",{className:"min-w-0 flex-1 text-sm",children:n})]})}r(C,"DetailRow");function Z({children:s,className:n}){return(0,e.jsx)("div",{className:S("inline-flex items-center rounded-full border border-line bg-bg px-2.5 py-1 text-xs text-ink-3",n),children:s})}r(Z,"StatusPill");function Nn({status:s,onViewLogs:n}){return s.kind==="eager"?(0,e.jsx)("span",{className:"text-sm text-ink-3",children:"Eager · provisioned during workspace setup"}):s.kind==="deferred"?(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(Z,{className:"border-amber-500/40 text-amber-600 dark:text-amber-400",children:"Deferred"}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"Runs once before the first runtime-service start."})]}):s.kind==="provisioning"?(0,e.jsxs)(Z,{className:"border-line text-ink-3",children:[(0,e.jsx)(ue,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Provisioning…"]}):s.kind==="provisioned"?(0,e.jsxs)(Z,{className:"border-emerald-500/40 text-emerald-600 dark:text-emerald-400",children:["Provisioned",s.at?` · ${L(s.at)}`:""]}):(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxs)(Z,{className:"border-bad/50 text-bad",children:["Provisioning failed",s.at?` · ${L(s.at)}`:""]}),(0,e.jsx)("button",{type:"button",onClick:n,className:"self-start text-xs text-ink-3 underline underline-offset-2 hover:text-ink",children:"View runtime logs"})]})}r(Nn,"RuntimeProvisionStatusValue");function W({value:s,copy:n}){return(0,e.jsxs)("div",{className:"inline-flex max-w-full items-start gap-2",children:[(0,e.jsx)("span",{className:"break-all font-mono text-xs",children:s}),n?(0,e.jsx)(He,{text:s,className:"shrink-0 text-ink-3 hover:text-ink",copiedLabel:"Copied",children:(0,e.jsx)(Ce,{className:"h-3.5 w-3.5"})}):null]})}r(W,"MonoValue");function Rn({project:s,workspace:n}){return(0,e.jsx)(Y,{to:hs(s,n.id),className:"hover:underline",children:n.name})}r(Rn,"WorkspaceLink");function Cn({companyId:s,workspace:n,issues:a,isLoading:o,error:d,project:c}){const u=Re(),{data:v}=P({queryKey:x.agents.list(s),queryFn:r(()=>Je.list(s),"queryFn"),enabled:!!s}),k=x.liveRuns(s),y=Us({companyId:s,resourceKey:"live-runs",queryKey:k,enabled:!!s,refetchInterval:!1,leaderOnly:!0}),{data:m,dataUpdatedAt:p}=P({queryKey:k,queryFn:r(()=>Os.liveRunsForCompany(s),"queryFn"),enabled:y.enabled,refetchInterval:y.refetchInterval});Ks(y,m,p);const _=(0,h.useMemo)(()=>Hs(m,a),[a,m]),f=le({mutationFn:r(({id:q,data:F})=>ke.update(q,F),"mutationFn"),onSuccess:r(()=>{u.invalidateQueries({queryKey:x.issues.listByExecutionWorkspace(s,n.id)}),u.invalidateQueries({queryKey:x.issues.list(s)}),c?.id&&u.invalidateQueries({queryKey:x.issues.listByProject(s,c.id)})},"onSuccess")}),b=(0,h.useMemo)(()=>c?[{id:c.id,name:c.name,workspaces:c.workspaces??[]}]:void 0,[c]),g=(0,h.useMemo)(()=>({projectId:n.projectId,...n.projectWorkspaceId?{projectWorkspaceId:n.projectWorkspaceId}:{},executionWorkspaceId:n.id,executionWorkspaceMode:"reuse_existing"}),[n.id,n.projectId,n.projectWorkspaceId]);return(0,e.jsx)(Xs,{issues:a,isLoading:o,error:d,agents:v,projects:b,liveIssueIds:_,projectId:c?.id,viewStateKey:"wardmote:execution-workspace-issues-view",baseCreateIssueDefaults:g,onUpdateIssue:r((q,F)=>f.mutate({id:q,data:F}),"onUpdateIssue")})}r(Cn,"ExecutionWorkspaceIssuesList");function In({routine:s,variableNames:n,runningRoutineId:a,onRunNow:o}){const d=s.status==="archived",c=a===s.id;return(0,e.jsxs)("div",{className:"flex flex-col gap-3 border-b border-line px-3 py-3 last:border-b-0 sm:flex-row sm:items-center",children:[(0,e.jsxs)("div",{className:"min-w-0 flex-1 space-y-1.5",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(Y,{to:`/routines/${s.id}`,className:"truncate text-sm font-medium hover:underline",children:s.title}),s.status!=="active"?(0,e.jsx)("span",{className:"text-xs text-ink-3",children:s.status}):null]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-ink-3",children:[(0,e.jsx)("span",{children:s.assigneeAgentId?"Default agent set":"Choose agent when running"}),(0,e.jsxs)("span",{children:["Last run ",gn(s.lastRun?.triggeredAt??s.lastTriggeredAt)]}),(0,e.jsx)("span",{className:"flex flex-wrap gap-1",children:n.map(u=>(0,e.jsx)("span",{className:"rounded-sm bg-bg-3 px-1.5 py-0.5 font-mono text-(length:--text-micro) text-ink-3",children:u},u))})]})]}),(0,e.jsxs)(N,{variant:"secondary",size:"sm",className:"w-full sm:w-auto",disabled:d||c,onClick:r(()=>o(s),"onClick"),children:[c?(0,e.jsx)(ue,{className:"mr-2 h-4 w-4 animate-spin"}):(0,e.jsx)(we,{className:"mr-2 h-4 w-4"}),c?"Running...":"Run now"]})]})}r(In,"WorkspaceRoutineRow");function Sn({workspace:s,project:n}){const a=Re(),{pushToast:o}=qs(),[d,c]=(0,h.useState)(null),[u,v]=(0,h.useState)(null),{data:k,isLoading:y,error:m}=P({queryKey:x.routines.list(s.companyId,{projectId:s.projectId}),queryFn:r(()=>Me.list(s.companyId,{projectId:s.projectId}),"queryFn")}),{data:p}=P({queryKey:x.agents.list(s.companyId),queryFn:r(()=>Je.list(s.companyId),"queryFn")}),_=(0,h.useMemo)(()=>un((k??[]).filter(dn)),[k]),f=le({mutationFn:r(({id:b,data:g})=>Me.run(b,{...g?.variables&&Object.keys(g.variables).length>0?{variables:g.variables}:{},...g?.assigneeAgentId!==void 0?{assigneeAgentId:g.assigneeAgentId}:{},...g?.projectId!==void 0?{projectId:g.projectId}:{},...g?.executionWorkspaceId!==void 0?{executionWorkspaceId:g.executionWorkspaceId}:{},...g?.executionWorkspacePreference!==void 0?{executionWorkspacePreference:g.executionWorkspacePreference}:{},...g?.executionWorkspaceSettings!==void 0?{executionWorkspaceSettings:g.executionWorkspaceSettings}:{}}),"mutationFn"),onMutate:r(({id:b})=>{v(b)},"onMutate"),onSuccess:r(async(b,{id:g})=>{c(null),await Promise.all([a.invalidateQueries({queryKey:["routines",s.companyId]}),a.invalidateQueries({queryKey:x.routines.detail(g)}),a.invalidateQueries({queryKey:x.issues.listByExecutionWorkspace(s.companyId,s.id)}),a.invalidateQueries({queryKey:x.issues.list(s.companyId)})]),o({title:"Routine started",body:"Wardmote created a run using this execution workspace.",tone:"success"})},"onSuccess"),onSettled:r(()=>{v(null)},"onSettled"),onError:r(b=>{o({title:"Routine run failed",body:b instanceof Error?b.message:"Wardmote could not start the routine run.",tone:"error"})},"onError")});return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(B,{className:"rounded-none",children:[(0,e.jsxs)(G,{children:[(0,e.jsx)(X,{children:"Workspace routines"}),(0,e.jsx)(H,{children:"Routines that use workspace-specific variables can be run against this execution workspace."})]}),(0,e.jsx)(K,{children:y?(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Loading routines..."}):m?(0,e.jsx)("p",{className:"text-sm text-bad",children:m instanceof Error?m.message:"Failed to load routines."}):_.length===0?(0,e.jsxs)("div",{className:"flex flex-col items-center gap-2 py-10 text-center",children:[(0,e.jsx)(Fs,{className:"h-5 w-5 text-ink-3"}),(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No routines use workspace-specific variables yet."})]}):(0,e.jsx)("div",{className:"rounded-lg border border-line",children:_.map(b=>(0,e.jsx)(In,{routine:b,variableNames:Ye(b),runningRoutineId:u,onRunNow:c},b.id))})})]}),(0,e.jsx)(nn,{open:d!==null,onOpenChange:r(b=>{b||c(null)},"onOpenChange"),companyId:s.companyId,routineName:d?.title??null,agents:p??[],projects:n?[n]:[],defaultProjectId:s.projectId,defaultAssigneeAgentId:d?.assigneeAgentId??null,defaultExecutionWorkspace:s,variables:d?.variables??[],isPending:f.isPending,onSubmit:r(b=>{d&&f.mutate({id:d.id,data:b})},"onSubmit")})]})}r(Sn,"ExecutionWorkspaceRoutinesList");function xt(){const{visible:s,loaded:n}=Gs(),{workspaceId:a}=ks(),o=bs(),d=Is(),c=Re(),{setBreadcrumbs:u}=Qs(),{selectedCompanyId:v,setSelectedCompanyId:k}=Cs(),{hideHostPaths:y}=Zs(),[m,p]=(0,h.useState)(null),[_,f]=(0,h.useState)(!1),[b,g]=(0,h.useState)(null),[q,F]=(0,h.useState)(null),[Pe,me]=(0,h.useState)(null),[ss,pe]=(0,h.useState)([]),ns=a?hn(o.pathname,a):null,ts=(0,h.useMemo)(()=>{const t=new URLSearchParams(o.search).get("tab");return J(t)?t:null},[o.search]),R=ns??ts,D=P({queryKey:x.executionWorkspaces.detail(a),queryFn:r(()=>V.get(a),"queryFn"),enabled:!!a}),i=D.data??null,j=P({queryKey:i?[...x.projects.detail(i.projectId),i.companyId]:["projects","detail","__pending__"],queryFn:r(()=>Bs.get(i.projectId,i.companyId),"queryFn"),enabled:!!i?.projectId}).data??null,E=P({queryKey:i?.sourceIssueId?x.issues.detail(i.sourceIssueId):["issues","detail","__none__"],queryFn:r(()=>ke.get(i.sourceIssueId),"queryFn"),enabled:!!i?.sourceIssueId}).data??null,xe=P({queryKey:i?.derivedFromExecutionWorkspaceId?x.executionWorkspaces.detail(i.derivedFromExecutionWorkspaceId):["execution-workspaces","detail","__none__"],queryFn:r(()=>V.get(i.derivedFromExecutionWorkspaceId),"queryFn"),enabled:!!i?.derivedFromExecutionWorkspaceId}).data??null,he=P({queryKey:i?x.issues.listByExecutionWorkspace(i.companyId,i.id):["issues","__execution-workspace__","__none__"],queryFn:r(()=>ke.list(i.companyId,{executionWorkspaceId:i.id}),"queryFn"),enabled:!!i?.companyId}),rs=he.data??[],ee=(0,h.useMemo)(()=>j?.workspaces.find(t=>t.id===i?.projectWorkspaceId)??null,[j,i?.projectWorkspaceId]),{slots:_e,isLoading:as,errorMessage:Ee}=Ms({slotTypes:["detailTab"],entityType:"execution_workspace",companyId:i?.companyId??null,enabled:!!i?.companyId}),fe=(0,h.useMemo)(()=>_e.map(t=>({value:`plugin:${t.pluginKey}:${t.id}`,label:t.displayName,order:t.order??mn,slot:t})),[_e]),is=(0,h.useMemo)(()=>xn([...pn.filter(t=>t.value!=="configuration"||s),...fe]),[fe,s]),O=ee?.runtimeConfig?.workspaceRuntime??null,ge=i?.config?.workspaceRuntime??O,Ae=i?.config?.workspaceRuntime?"execution_workspace":O?"project_workspace":"none",Te=(0,h.useMemo)(()=>{if(!m||m.inheritRuntime)return O;const t=de(m.workspaceRuntime);return t.ok?t.value:null},[m,O]),se=(0,h.useMemo)(()=>es(Te),[Te]),Fe=(0,h.useMemo)(()=>vn(se),[se]),M=(0,h.useMemo)(()=>i?Qe(i):null,[i]),je=!!(m&&M&&JSON.stringify(m)!==JSON.stringify(M)),ne=j?ps(j):i?.projectId??"";(0,h.useEffect)(()=>{!i?.companyId||i.companyId===v||k(i.companyId,{source:"route_sync"})},[i?.companyId,v,k]),(0,h.useEffect)(()=>{i&&(p(Qe(i)),g(null),F(null),pe([]))},[i]),(0,h.useEffect)(()=>{if(!i)return;const t=[{label:"Projects",href:"/projects"},...j?[{label:j.name,href:`/projects/${ne}`}]:[],...j?[{label:"Workspaces",href:`/projects/${ne}/workspaces`}]:[],{label:i.name}];u(t)},[u,i,j,ne]);const te=le({mutationFn:r(t=>V.update(i.id,t),"mutationFn"),onSuccess:r(t=>{c.setQueryData(x.executionWorkspaces.detail(t.id),t),c.invalidateQueries({queryKey:x.executionWorkspaces.closeReadiness(t.id)}),c.invalidateQueries({queryKey:x.executionWorkspaces.workspaceOperations(t.id)}),j&&(c.invalidateQueries({queryKey:x.projects.detail(j.id)}),c.invalidateQueries({queryKey:x.projects.detail(j.urlKey)})),E&&c.invalidateQueries({queryKey:x.issues.detail(E.id)}),g(null)},"onSuccess"),onError:r(t=>{g(t instanceof Error?t.message:"Failed to save execution workspace.")},"onError")}),A=P({queryKey:x.executionWorkspaces.workspaceOperations(a),queryFn:r(()=>V.listWorkspaceOperations(a),"queryFn"),enabled:!!a}),Le=i?.config?.runtimeProvisionCommand??j?.executionWorkspacePolicy?.workspaceStrategy?.runtimeProvisionCommand??null,os=(0,h.useMemo)(()=>wn({runtimeProvisionCommand:Le,operations:A.data}),[Le,A.data]),re=le({mutationFn:r(t=>V.controlRuntimeCommands(i.id,t.action,t),"mutationFn"),onSuccess:r((t,l)=>{c.setQueryData(x.executionWorkspaces.detail(t.workspace.id),t.workspace),c.invalidateQueries({queryKey:x.executionWorkspaces.overview(t.workspace.companyId)}),c.invalidateQueries({queryKey:x.executionWorkspaces.workspaceOperations(t.workspace.id)}),c.invalidateQueries({queryKey:x.projects.detail(t.workspace.projectId)}),F(null),me(l.action==="run"?"Workspace job completed.":l.action==="stop"?"Workspace service stopped.":l.action==="restart"?"Workspace service restarted.":"Workspace service started.")},"onSuccess"),onError:r(t=>{me(null),F(t instanceof Error?t.message:"Failed to control workspace commands.")},"onError"),onSettled:r((t,l,w)=>{pe(Q=>Q.filter(us=>us!==w))},"onSettled")});if(D.isLoading)return(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Loading workspace…"});if(D.error)return(0,e.jsx)("p",{className:"text-sm text-bad",children:D.error instanceof Error?D.error.message:"Failed to load workspace"});if(!i||!m||!M)return null;const qe=!!i.cwd,Oe=!!ge&&qe,ve=Ns({runtimeConfig:ge,runtimeServices:i.runtimeServices??[],canStartServices:Oe,canRunJobs:qe}),ls=re.isPending?re.variables??null:null,cs=ws({sections:ve,runtimeServices:i.runtimeServices??[],pendingRequests:ss}),Ue={companyId:i.companyId,projectId:i.projectId,entityId:i.id,entityType:"execution_workspace"},Ke=fe.find(t=>t.value===R)??null;if(R==="configuration"&&!n)return null;if(a&&R==="configuration"&&!s)return(0,e.jsx)(be,{workspaceId:a});if(a&&R===null)return(0,e.jsx)(be,{workspaceId:a});const z=r(t=>{if(J(t)){d(`/execution-workspaces/${i.id}?tab=${encodeURIComponent(t)}`);return}d(ie(i.id,t))},"handleTabChange"),ds=r(()=>{const t=kn(m);if(t){g(t);return}let l;try{l=bn(M,m)}catch(w){g(w instanceof Error?w.message:"Failed to build workspace update.");return}Object.keys(l).length!==0&&te.mutate(l)},"saveChanges"),Be=r(t=>{if(t.length!==0){pe(l=>[...l,...t]);for(const l of t)re.mutate(l)}},"runRuntimeControlRequests");return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"space-y-4 overflow-hidden sm:space-y-6",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-2",children:[(0,e.jsx)("div",{className:"text-xs font-medium uppercase tracking-(--tracking-eyebrow) text-ink-3",children:"Execution workspace"}),(0,e.jsx)("h1",{className:"truncate text-xl font-semibold sm:text-2xl",children:i.name})]}),(0,e.jsx)(cn,{services:cs,onAction:r((t,l)=>{Be(ys(ve,t,l))},"onAction"),onViewLogs:r(()=>z("runtime_logs"),"onViewLogs"),onManageServices:r(()=>z("services"),"onManageServices")})]}),q?(0,e.jsx)("p",{className:"text-sm text-bad",children:q}):null,!q&&Pe?(0,e.jsx)("p",{className:"text-sm text-ink-3",children:Pe}):null,(0,e.jsx)(Ds,{slotTypes:["toolbarButton","contextMenuItem"],entityType:"execution_workspace",context:Ue,className:"flex flex-wrap gap-2",itemClassName:"inline-flex",missingBehavior:"placeholder"}),(0,e.jsx)(Ws,{value:R??"issues",onValueChange:r(t=>z(t),"onValueChange"),children:(0,e.jsx)(Js,{items:is.map(t=>({value:t.value,label:t.label})),align:"start",value:R??"issues",onValueChange:r(t=>z(t),"onValueChange")})}),R==="services"?(0,e.jsx)(Rs,{sections:ve,isPending:re.isPending,pendingRequest:ls,serviceEmptyMessage:ge?"No services have been started for this execution workspace yet.":"No workspace command config is defined for this execution workspace yet.",jobEmptyMessage:"No one-shot jobs are configured for this execution workspace yet.",disabledHint:Oe?null:"Execution workspaces need a working directory before local commands can run, and services also need runtime config.",onAction:r(t=>Be([t]),"onAction")}):R==="configuration"?(0,e.jsxs)("div",{className:"space-y-4 sm:space-y-6",children:[(0,e.jsxs)(B,{className:"rounded-none",children:[(0,e.jsxs)(G,{children:[(0,e.jsx)(X,{children:"Workspace settings"}),(0,e.jsx)(H,{children:"Edit the concrete path, repo, branch, provisioning, teardown, and runtime overrides attached to this execution workspace. Saved changes affect future runs; Wardmote may refresh or replace a reused workspace when config changes."}),(0,e.jsx)(Vs,{children:(0,e.jsx)(N,{variant:"danger",size:"sm",className:"w-full sm:w-auto",onClick:r(()=>f(!0),"onClick"),disabled:i.status==="archived",children:i.status==="cleanup_failed"?"Retry close":"Close workspace"})})]}),(0,e.jsxs)(K,{children:[(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium uppercase tracking-widest text-ink-3",children:"General"}),(0,e.jsx)(I,{label:"Workspace name",children:(0,e.jsx)(U,{value:m.name,onChange:r(t=>p(l=>l&&{...l,name:t.target.value}),"onChange"),placeholder:"Execution workspace name"})})]}),(0,e.jsx)(ae,{}),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium uppercase tracking-widest text-ink-3",children:"Source control"}),(0,e.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,e.jsx)(I,{label:"Branch name",hint:"Useful for isolated worktrees",children:(0,e.jsx)(U,{className:"font-mono",value:m.branchName,onChange:r(t=>p(l=>l&&{...l,branchName:t.target.value}),"onChange"),placeholder:"PAP-946-workspace"})}),(0,e.jsx)(I,{label:"Base ref",children:(0,e.jsx)(U,{className:"font-mono",value:m.baseRef,onChange:r(t=>p(l=>l&&{...l,baseRef:t.target.value}),"onChange"),placeholder:"origin/main"})})]}),(0,e.jsx)(I,{label:"Repo URL",children:(0,e.jsx)(U,{value:m.repoUrl,onChange:r(t=>p(l=>l&&{...l,repoUrl:t.target.value}),"onChange"),placeholder:"https://github.com/org/repo"})})]}),(0,e.jsx)(ae,{}),!y&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium uppercase tracking-widest text-ink-3",children:"Paths"}),(0,e.jsx)(I,{label:"Working directory",children:(0,e.jsx)(U,{className:"font-mono",value:m.cwd,onChange:r(t=>p(l=>l&&{...l,cwd:t.target.value}),"onChange"),placeholder:"/absolute/path/to/workspace"})}),(0,e.jsx)(I,{label:"Provider path / ref",children:(0,e.jsx)(U,{className:"font-mono",value:m.providerRef,onChange:r(t=>p(l=>l&&{...l,providerRef:t.target.value}),"onChange"),placeholder:"/path/to/worktree or provider ref"})})]}),(0,e.jsx)(ae,{})]}),!y&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium uppercase tracking-widest text-ink-3",children:"Lifecycle commands"}),(0,e.jsx)(I,{label:"Provision command",hint:"Runs when Wardmote prepares this execution workspace",children:(0,e.jsx)($,{className:"min-h-20 font-mono",value:m.provisionCommand,onChange:r(t=>p(l=>l&&{...l,provisionCommand:t.target.value}),"onChange"),placeholder:"bash ./scripts/provision-worktree.sh"})}),(0,e.jsx)(I,{label:"Runtime provision command",hint:"Runs once before the first runtime-service start. Leave empty to keep eager provisioning.",children:(0,e.jsx)($,{className:"min-h-20 font-mono",value:m.runtimeProvisionCommand,onChange:r(t=>p(l=>l&&{...l,runtimeProvisionCommand:t.target.value}),"onChange"),placeholder:"bash ./scripts/provision-worktree-runtime.sh"})}),(0,e.jsx)(I,{label:"Teardown command",hint:"Runs when the execution workspace is archived or cleaned up",children:(0,e.jsx)($,{className:"min-h-20 font-mono",value:m.teardownCommand,onChange:r(t=>p(l=>l&&{...l,teardownCommand:t.target.value}),"onChange"),placeholder:"bash ./scripts/teardown-worktree.sh"})}),(0,e.jsx)(I,{label:"Cleanup command",hint:"Workspace-specific cleanup before teardown",children:(0,e.jsx)($,{className:"min-h-16 font-mono",value:m.cleanupCommand,onChange:r(t=>p(l=>l&&{...l,cleanupCommand:t.target.value}),"onChange"),placeholder:"pkill -f vite || true"})})]}),(0,e.jsx)(ae,{})]}),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium uppercase tracking-widest text-ink-3",children:"Runtime config"}),(0,e.jsx)("div",{className:"rounded-md border border-dashed border-line/70 bg-bg px-4 py-3",children:(0,e.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-ink",children:"Runtime config source"}),(0,e.jsx)("p",{className:"text-sm text-ink-3",children:Ae==="execution_workspace"?"This execution workspace currently overrides the project workspace runtime config.":Ae==="project_workspace"?"This execution workspace is inheriting the project workspace runtime config.":"No runtime config is currently defined on this execution workspace or its project workspace."})]}),(0,e.jsx)(N,{variant:"secondary",className:"w-full sm:w-auto",size:"sm",disabled:!ee?.runtimeConfig?.workspaceRuntime,onClick:r(()=>p(t=>t&&{...t,inheritRuntime:!0,workspaceRuntime:""}),"onClick"),children:"Reset to inherit"})]})}),(0,e.jsxs)("details",{className:"rounded-md border border-dashed border-line/70 bg-bg px-4 py-3",children:[(0,e.jsx)("summary",{className:"cursor-pointer text-sm font-medium",children:"Advanced runtime JSON"}),(0,e.jsx)("p",{className:"mt-2 text-sm text-ink-3",children:"Override the inherited workspace command model only when this execution workspace truly needs different service or job behavior."}),(0,e.jsx)("div",{className:"mt-3",children:(0,e.jsxs)(I,{label:"Workspace commands JSON",hint:"Legacy `services` arrays still work, but `commands` supports both services and jobs.",children:[(0,e.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-sm text-ink-3",children:[(0,e.jsx)("input",{id:"inherit-runtime-config",type:"checkbox",className:"rounded border-line",checked:m.inheritRuntime,onChange:r(t=>{const l=t.target.checked;p(w=>w&&(!l&&!w.workspaceRuntime.trim()&&O?{...w,inheritRuntime:l,workspaceRuntime:Ne(O)}:{...w,inheritRuntime:l}))},"onChange")}),(0,e.jsx)("label",{htmlFor:"inherit-runtime-config",children:"Inherit project workspace runtime config"})]}),(0,e.jsx)($,{className:"min-h-64 font-mono sm:min-h-96",value:m.workspaceRuntime,onChange:r(t=>p(l=>l&&{...l,workspaceRuntime:t.target.value}),"onChange"),disabled:m.inheritRuntime,placeholder:`{
|
|
1
|
+
var ms=Object.defineProperty;var r=(s,n)=>ms(s,"name",{value:n,configurable:!0});import{i as $e}from"./rolldown-runtime-ZpX3ckPj.js";import{C as ps,S as xs,T as hs,Ui as fs,Zn as gs,h as L,l as S,na as js,ta as vs}from"./createLucideIcon-DJi9suAC.js";import{h as bs,v as ks}from"./star-BZgQbzhV.js";import{X as Re,_ as le,t as x,v as P}from"./queryKeys-DYV5MhM_.js";import{a as ys,i as ws,r as Ns,t as Rs}from"./WorkspaceRuntimeControls-T4YUoZvK.js";import{n as Cs}from"./CompanyContext-CSrVsSze.js";import{o as Is,r as Ss,t as Y,zt as ke}from"./router-2UfGeejU.js";import{t as Ws}from"./tabs-B2Os_leL.js";import{o as Ps,r as _s,t as Es}from"./popover-BhYHYj7q.js";import{t as As}from"./check-Ctsrlfa-.js";import{t as Ts}from"./chevron-down-BCvxsWfI.js";import{t as Ce}from"./copy-_wvZOjTe.js";import{t as ye}from"./external-link-nl1b263c.js";import{r as ue,t as N}from"./button-CMwV3L1P.js";import{t as we}from"./play-CJNuUj69.js";import{t as Fs}from"./repeat-DGPKlc5I.js";import{t as De}from"./rotate-ccw-CQEJ4ewP.js";import{t as Ls}from"./square-B2aH51tE.js";import{t as Ve}from"./triangle-alert-CBVKiaXB.js";import{a as qs}from"./ToastContext-DMdt9oTd.js";import{t as Je}from"./agents-DmlgUVso.js";import{t as Os}from"./heartbeats-DOyojsaN.js";import{n as Us,t as Ks}from"./useSharedPolling-D4Xn8mY2.js";import{t as Bs}from"./projects-mixWrT5q.js";import{t as U}from"./input-DobnTAyB.js";import{n as Ds,o as Ms,t as zs}from"./slots-Dw517dxP.js";import{t as Me}from"./routines-KPtwxuS7.js";import{n as Qs}from"./BreadcrumbContext-BVZDZoC0.js";import{t as $}from"./textarea-BRPEfJ-g.js";import{t as $s}from"./clipboard-CTLKYvRL.js";import{i as H,n as Vs,o as G,r as K,s as X,t as B}from"./card-Bru3x_SJ.js";import{Kr as Js,M as Hs,nr as Gs,r as Xs,tr as V}from"./index-3AxqhPET.js";import{t as ae}from"./separator-B2LFqBpM.js";import{t as Zs}from"./useManagedSandboxOnly-CO01cDK4.js";import{t as He}from"./CopyText-Cr673_Kx.js";import{n as Ys,t as en}from"./SummarySlotCard-D1C0qH2L.js";import{t as sn}from"./MissingPluginTabPlaceholder-DT47WyQq.js";import{t as nn}from"./RoutineRunVariablesDialog-D_Mls1sV.js";var h=$e(js(),1),e=$e(vs(),1),tn=["provisioning","starting","stopping","restarting"];function Ie(s){return tn.includes(s)}r(Ie,"isTransitional");function Ge(s){return s?s.replace(/^https?:\/\//,"").replace(/\/$/,""):null}r(Ge,"formatServiceUrl");function Xe(s){switch(s.state){case"provisioning":return{label:"Provisioning…",unhealthy:!1};case"starting":return{label:"Starting…",unhealthy:!1};case"stopping":return{label:"Stopping…",unhealthy:!1};case"restarting":return{label:"Restarting…",unhealthy:!1};case"failed":return{label:"Failed",unhealthy:!1};case"running":return s.healthStatus==="unhealthy"?{label:"Unhealthy",unhealthy:!0}:{label:"Running",unhealthy:!1};default:return{label:"Stopped",unhealthy:!1}}}r(Xe,"statusMeta");function Se({entry:s,className:n}){if(Ie(s.state))return(0,e.jsx)(ue,{className:S("size-3 shrink-0 animate-spin text-ink-3",n)});if(s.state==="failed")return(0,e.jsx)(Ve,{className:S("size-3 shrink-0 text-bad",n)});const a=s.state==="running"&&s.healthStatus==="unhealthy";return(0,e.jsx)("span",{className:S("size-2 shrink-0 rounded-full",s.state==="running"?a?"bg-amber-500 ring-2 ring-amber-500/30":"bg-emerald-500":"border border-ink-3/60 bg-transparent",n)})}r(Se,"StatusIndicator");function Ze({url:s,disabled:n}){const[a,o]=(0,h.useState)("idle"),d=(0,h.useRef)(null);(0,h.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]);const c=a==="copied"?"URL copied":a==="failed"?"Copy failed":"Copy URL";return(0,e.jsxs)(N,{variant:"ghost",size:"icon-xs",disabled:n,"aria-label":c,title:c,onClick:r(async()=>{try{await $s(s),o("copied")}catch{o("failed")}d.current&&clearTimeout(d.current),d.current=setTimeout(()=>o("idle"),1500)},"onClick"),children:[a==="copied"?(0,e.jsx)(As,{className:"size-3"}):a==="failed"?(0,e.jsx)(Ve,{className:"size-3 text-bad"}):(0,e.jsx)(Ce,{className:"size-3"}),(0,e.jsx)("span",{className:"sr-only","aria-live":"polite",children:c})]})}r(Ze,"CopyUrlButton");function ce({entry:s,compact:n}){const a=Ge(s.url)??(s.port?`:${s.port}`:null),o=s.state==="running"&&!!s.url;return a?(0,e.jsxs)(e.Fragment,{children:[o?(0,e.jsx)("a",{href:s.url??void 0,target:"_blank",rel:"noreferrer",title:s.url??void 0,className:S("min-w-0 truncate font-mono text-xs text-ink hover:underline",n?"max-w-44":"max-w-56"),children:a}):(0,e.jsx)("span",{title:s.url??void 0,className:S("min-w-0 truncate font-mono text-xs text-ink-3/70",n?"max-w-44":"max-w-56"),children:a}),(0,e.jsxs)("span",{className:S("flex items-center",o?null:"invisible"),"aria-hidden":o?void 0:!0,children:[(0,e.jsx)(Ze,{url:s.url??"",disabled:!o}),(0,e.jsx)(N,{asChild:o,variant:"ghost",size:"icon-xs",disabled:!o,title:"Open in new tab",children:o?(0,e.jsx)("a",{href:s.url??void 0,target:"_blank",rel:"noreferrer","aria-label":"Open in new tab",children:(0,e.jsx)(ye,{className:"size-3"})}):(0,e.jsx)(ye,{className:"size-3"})})]})]}):(0,e.jsx)("span",{className:"font-mono text-xs text-ink-3/70",children:"no url"})}r(ce,"UrlSegment");function We({entry:s,onAction:n}){const a=Ie(s.state),o=s.canStart??!0;return s.state==="stopped"?(0,e.jsxs)(N,{variant:"primary",size:"xs",className:"w-13 justify-center",disabled:!o,onClick:r(()=>n("start"),"onClick"),"aria-label":"Start",title:"Start",children:[(0,e.jsx)(we,{className:"size-3"}),"Start"]}):s.state==="failed"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(N,{variant:"primary",size:"icon-xs",disabled:!o,onClick:r(()=>n("start"),"onClick"),"aria-label":"Start",title:"Start",children:(0,e.jsx)(we,{className:"size-3"})}),(0,e.jsx)(N,{variant:"ghost",size:"icon-xs",disabled:!o,onClick:r(()=>n("restart"),"onClick"),"aria-label":"Restart",title:"Restart",className:"border",children:(0,e.jsx)(De,{className:"size-3"})})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(N,{variant:"ghost",size:"icon-xs",disabled:a,onClick:r(()=>n("stop"),"onClick"),"aria-label":"Stop",title:"Stop",className:"border",children:(0,e.jsx)(Ls,{className:"size-3"})}),(0,e.jsx)(N,{variant:"ghost",size:"icon-xs",disabled:a||!o,onClick:r(()=>n("restart"),"onClick"),"aria-label":"Restart",title:"Restart",className:"border",children:(0,e.jsx)(De,{className:"size-3"})})]})}r(We,"ActionSlots");function rn({entry:s,onViewLogs:n}){const a=s.exposureDetail??(s.state==="failed"?s.failureDetail:null);if(!a)return null;const o=s.exposureState==="failed"||s.exposureState==="cleanup_pending";return(0,e.jsxs)("div",{className:S("flex items-center gap-1 text-xs",o?"text-bad":"text-ink-3"),children:[(0,e.jsx)("span",{children:a}),n&&s.state==="failed"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{"aria-hidden":!0,children:"·"}),(0,e.jsx)("button",{type:"button",onClick:n,className:"font-medium text-ink underline underline-offset-2 hover:text-ink/80",children:"View logs"})]}):null]})}r(rn,"ServiceDetail");function an({entry:s,onAction:n,onViewLogs:a,className:o}){const d=Xe(s);return(0,e.jsxs)("div",{className:S("flex w-full flex-col items-stretch gap-1 sm:w-auto sm:items-end",o),children:[(0,e.jsxs)("div",{className:"rounded-lg border border-line bg-bg",children:[(0,e.jsxs)("div",{className:"flex h-9 items-center pl-3 pr-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 sm:min-w-24",children:[(0,e.jsx)(Se,{entry:s}),(0,e.jsx)("span",{className:"whitespace-nowrap text-xs font-medium text-ink",children:d.label})]}),(0,e.jsx)("div",{className:"mx-3 hidden h-5 w-px bg-line sm:block"}),(0,e.jsx)("div",{className:"hidden w-56 min-w-0 shrink-0 items-center gap-0.5 sm:flex",children:(0,e.jsx)(ce,{entry:s})}),(0,e.jsx)("div",{className:"mx-3 hidden h-5 w-px bg-line sm:block"}),(0,e.jsx)("div",{className:"ml-auto flex items-center gap-1 pl-3 sm:pl-0",children:(0,e.jsx)(We,{entry:s,onAction:r(c=>n(c,s.key),"onAction")})})]}),(0,e.jsx)("div",{className:"flex h-8 items-center justify-between gap-0.5 border-t border-line px-3 sm:hidden",children:(0,e.jsx)(ce,{entry:s,compact:!0})})]}),(0,e.jsx)(rn,{entry:s,onViewLogs:a})]})}r(an,"SingleServiceBar");function on({entry:s,onAction:n}){const a=Xe(s),o=Ge(s.url),d=s.state==="running"&&!!s.url,c=s.exposureState==="failed"||s.exposureState==="cleanup_pending",u=s.exposureDetail?s.exposureDetail:d?o:s.state==="starting"&&s.port?`starting on :${s.port}…`:s.state==="failed"&&s.failureDetail?s.failureDetail:`${a.label.toLowerCase().replace(/…$/,"")}${s.port?` · :${s.port}`:""}`;return(0,e.jsxs)("div",{className:"flex items-center gap-3 py-2.5",children:[(0,e.jsx)(Se,{entry:s,className:"mt-0.5"}),(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsx)("div",{className:"truncate text-sm font-medium text-ink",children:s.name}),(0,e.jsx)("div",{className:"flex min-w-0 items-center gap-0.5",children:d&&s.url?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("a",{href:s.url,target:"_blank",rel:"noreferrer",title:s.url,className:"min-w-0 truncate font-mono text-xs text-ink-3 hover:text-ink hover:underline",children:o}),(0,e.jsx)(Ze,{url:s.url})]}):(0,e.jsx)("span",{className:S("min-w-0 text-xs",c?"whitespace-normal break-words text-bad":"truncate text-ink-3"),children:u})})]}),(0,e.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:(0,e.jsx)(We,{entry:s,onAction:r(v=>n(v,s.key),"onAction")})})]})}r(on,"ServicePopoverRow");function ln({services:s,onAction:n,onManageServices:a,defaultServicesOpen:o,className:d}){const[c,u]=(0,h.useState)(o??!1),v=s.filter(f=>f.state==="running").length,k=s.some(f=>Ie(f.state)),y=s.some(f=>f.state==="failed"),m=v>0,p=s.find(f=>f.state==="running"&&f.url)??null,_={key:"__all__",name:"All services",state:k?"starting":y?"failed":m?"running":"stopped",healthStatus:s.some(f=>f.state==="running"&&f.healthStatus==="unhealthy")?"unhealthy":"healthy"};return(0,e.jsx)("div",{className:S("flex w-full flex-col items-stretch gap-1 sm:w-auto sm:items-end",d),children:(0,e.jsxs)("div",{className:"rounded-lg border border-line bg-bg",children:[(0,e.jsxs)("div",{className:"flex h-9 items-center pl-3 pr-1.5",children:[(0,e.jsxs)(Es,{open:c,onOpenChange:u,children:[(0,e.jsx)(Ps,{asChild:!0,children:(0,e.jsxs)("button",{type:"button",className:"flex h-full items-center gap-2 rounded-l-lg pr-1 text-xs font-medium text-ink hover:bg-bg-3","aria-label":`${v} of ${s.length} services running — show services`,children:[(0,e.jsx)(Se,{entry:_}),(0,e.jsxs)("span",{className:"whitespace-nowrap",children:[v,"/",s.length," running"]}),(0,e.jsx)(Ts,{className:"size-3 text-ink-3"})]})}),(0,e.jsxs)(_s,{align:"end",className:"w-96 p-0",onOpenAutoFocus:r(f=>f.preventDefault(),"onOpenAutoFocus"),children:[(0,e.jsxs)("div",{className:"px-4 pb-1 pt-3 text-xs font-medium uppercase tracking-wide text-ink-3",children:["Services · ",s.length]}),(0,e.jsx)("div",{className:"divide-y divide-line px-4",children:s.map(f=>(0,e.jsx)(on,{entry:f,onAction:n},f.key))}),(0,e.jsxs)("div",{className:"flex items-center gap-1 border-t border-line px-4 py-2",children:[(0,e.jsx)(N,{variant:"ghost",size:"xs",onClick:r(()=>n("start",null),"onClick"),children:"Start all"}),(0,e.jsx)(N,{variant:"ghost",size:"xs",onClick:r(()=>n("stop",null),"onClick"),children:"Stop all"}),(0,e.jsx)(N,{variant:"ghost",size:"xs",onClick:r(()=>n("restart",null),"onClick"),children:"Restart all"}),a?(0,e.jsx)(N,{variant:"link",size:"xs",className:"ml-auto",onClick:a,children:"Manage in Services tab →"}):null]})]})]}),(0,e.jsx)("div",{className:"mx-3 hidden h-5 w-px bg-line sm:block"}),(0,e.jsx)("div",{className:"hidden min-w-0 items-center gap-0.5 sm:flex",children:p?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"mr-1 shrink-0 text-xs text-ink-3",children:p.name}),(0,e.jsx)(ce,{entry:p})]}):(0,e.jsx)("span",{className:"font-mono text-xs text-ink-3/70",children:"no url"})}),(0,e.jsx)("div",{className:"mx-3 hidden h-5 w-px bg-line sm:block"}),(0,e.jsx)("div",{className:"ml-auto flex items-center gap-1 pl-3 sm:pl-0",children:(0,e.jsx)(We,{entry:{state:_.state,canStart:!0},onAction:r(f=>n(f,null),"onAction")})})]}),p?(0,e.jsx)("div",{className:"flex h-8 items-center justify-between gap-0.5 border-t border-line px-3 sm:hidden",children:(0,e.jsx)(ce,{entry:p,compact:!0})}):null]})})}r(ln,"MultiServiceBar");function cn({services:s,onAction:n,onViewLogs:a,onManageServices:o,defaultServicesOpen:d,className:c}){return s.length===0?null:s.length===1?(0,e.jsx)(an,{entry:s[0],onAction:n,onViewLogs:a,className:c}):(0,e.jsx)(ln,{services:s,onAction:n,onManageServices:o,defaultServicesOpen:d,className:c})}r(cn,"WorkspaceServiceControlBar");var ze=new Set([fs]);function Ye(s){const n=new Set;for(const a of s.variables)ze.has(a.name)&&n.add(a.name);for(const a of gs([s.title,s.description]))ze.has(a)&&n.add(a);return[...n]}r(Ye,"getWorkspaceSpecificRoutineVariableNames");function dn(s){return Ye(s).length>0}r(dn,"routineHasWorkspaceSpecificVariables");function un(s){return[...s].sort((n,a)=>{const o=n.title.localeCompare(a.title,void 0,{sensitivity:"base"});return o!==0?o:n.id.localeCompare(a.id)})}r(un,"sortWorkspaceRoutinesByName");var mn=100,pn=[{value:"issues",label:"Tasks",order:10},{value:"services",label:"Services",order:20},{value:"configuration",label:"Configuration",order:30},{value:"runtime_logs",label:"Runtime logs",order:40},{value:"routines",label:"Routines",order:60}];function J(s){return typeof s=="string"&&s.startsWith("plugin:")}r(J,"isExecutionWorkspacePluginTab");function xn(s){return s.map((n,a)=>({item:n,index:a})).sort((n,a)=>n.item.order-a.item.order||n.index-a.index).map(({item:n})=>n)}r(xn,"orderExecutionWorkspaceTabItems");function hn(s,n){const a=s.split("/").filter(Boolean),o=a.indexOf("execution-workspaces");if(o===-1||a[o+1]!==n)return null;const d=a[o+2];return d==="services"?"services":d==="issues"?"issues":d==="routines"?"routines":d==="runtime-logs"?"runtime_logs":d==="configuration"?"configuration":null}r(hn,"resolveExecutionWorkspaceTab");function ie(s,n){return`/execution-workspaces/${s}/${n==="runtime_logs"?"runtime-logs":n}`}r(ie,"executionWorkspaceTabPath");function be({workspaceId:s}){return(0,h.useEffect)(()=>{try{localStorage.removeItem(`wardmote:execution-workspace-tab:${s}`)}catch{}},[s]),(0,e.jsx)(Ss,{to:ie(s,"issues"),replace:!0})}r(be,"LegacyWorkspaceTabRedirect");function fn(s){if(!s)return!1;try{const n=new URL(s);return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}}r(fn,"isSafeExternalUrl");function T(s){return s??""}r(T,"readText");function Ne(s){return!s||Object.keys(s).length===0?"":JSON.stringify(s,null,2)}r(Ne,"formatJson");function gn(s){return s?L(s):"Never"}r(gn,"formatOptionalDateTime");function oe(s){const n=s.trim();return n.length>0?n:null}r(oe,"normalizeText");function de(s){const n=s.trim();if(!n)return{ok:!0,value:null};try{const a=JSON.parse(n);return!a||typeof a!="object"||Array.isArray(a)?{ok:!1,error:"Workspace commands JSON must be a JSON object."}:{ok:!0,value:a}}catch(a){return{ok:!1,error:a instanceof Error?a.message:"Invalid JSON."}}}r(de,"parseWorkspaceRuntimeJson");function es(s){if(!s)return[];const n=[],a=r((o,d,c)=>{Array.isArray(d)&&d.forEach((u,v)=>{if(!u||typeof u!="object"||Array.isArray(u))return;const k=u;if(c&&k.kind!=="service")return;const y=k.port,m=!!(y&&typeof y=="object"&&!Array.isArray(y)&&Object.hasOwn(y,"value")),p=typeof y=="number"?y:m?y.value:null;n.push({collection:o,index:v,name:typeof k.name=="string"&&k.name.trim()?k.name:`Service ${v+1}`,port:typeof p=="number"?p:null,invalidPort:(typeof y=="number"||m)&&(typeof p!="number"||!Number.isInteger(p)||p<1||p>65535)})})},"addServices");return a("commands",s.commands,!0),a("services",s.services,!1),n}r(es,"readConfiguredRuntimeServicePorts");function jn(s){const n=structuredClone(s.runtimeConfig),a=n[s.service.collection];if(!Array.isArray(a))return n;const o=a[s.service.index];if(!o||typeof o!="object"||Array.isArray(o))return n;const d=o,c=d.port&&typeof d.port=="object"&&!Array.isArray(d.port)?d.port:null,u=s.port.trim();if(!u){if(c){const k={...c,type:"auto"};delete k.value,d.port=k}else delete d.port;return n}const v=Number(u);return!Number.isInteger(v)||v<1||v>65535||(d.port={...c,type:"fixed",value:v}),n}r(jn,"updateConfiguredRuntimeServicePort");function vn(s){const n=new Map;for(const a of s){if(a.invalidPort||!a.port)continue;const o=n.get(a.port)??[];o.push(a),n.set(a.port,o)}return Array.from(n.entries()).filter(([,a])=>a.length>1).map(([a,o])=>`Port ${a} is assigned to multiple services: ${o.map(d=>d.name).join(", ")}.`)}r(vn,"getConfiguredRuntimeServicePortWarnings");function Qe(s){return{name:s.name,cwd:T(s.cwd),repoUrl:T(s.repoUrl),baseRef:T(s.baseRef),branchName:T(s.branchName),providerRef:T(s.providerRef),provisionCommand:T(s.config?.provisionCommand),runtimeProvisionCommand:T(s.config?.runtimeProvisionCommand),teardownCommand:T(s.config?.teardownCommand),cleanupCommand:T(s.config?.cleanupCommand),inheritRuntime:!s.config?.workspaceRuntime,workspaceRuntime:Ne(s.config?.workspaceRuntime)}}r(Qe,"formStateFromWorkspace");function bn(s,n){const a={},o={},d=r(u=>{s[u]!==n[u]&&(a[u]=u==="name"?oe(n[u])??s.name:oe(n[u]))},"maybeAssign");d("name"),d("cwd"),d("repoUrl"),d("baseRef"),d("branchName"),d("providerRef");const c=r(u=>{s[u]!==n[u]&&(o[u]=oe(n[u]))},"maybeAssignConfigText");if(c("provisionCommand"),c("runtimeProvisionCommand"),c("teardownCommand"),c("cleanupCommand"),s.inheritRuntime!==n.inheritRuntime||s.workspaceRuntime!==n.workspaceRuntime){const u=de(n.workspaceRuntime);if(!u.ok)throw new Error(u.error);o.workspaceRuntime=n.inheritRuntime?null:u.value}return Object.keys(o).length>0&&(a.config=o),a}r(bn,"buildWorkspacePatch");function kn(s){const n=oe(s.repoUrl);if(n)try{new URL(n)}catch{return"Repo URL must be a valid URL."}if(!s.inheritRuntime){const a=de(s.workspaceRuntime);if(!a.ok)return a.error;const o=es(a.value).find(d=>d.invalidPort);if(o)return`${o.name} has an invalid fixed port.`}return null}r(kn,"validateForm");function I({label:s,hint:n,children:a}){return(0,e.jsxs)("label",{className:"block space-y-2",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-0.5 sm:flex-row sm:items-baseline sm:justify-between sm:gap-3",children:[(0,e.jsx)("span",{className:"text-sm font-medium text-ink",children:s}),n?(0,e.jsx)("span",{className:"text-xs text-ink-3 sm:text-right",children:n}):null]}),a]})}r(I,"Field");function yn(s){switch(s){case"worktree_prepare":return"Worktree setup";case"workspace_config_freshness":return"Config freshness";case"workspace_provision":return"Provision";case"workspace_seed":return"Database seed";case"workspace_runtime_provision":return"Runtime provision";case"workspace_teardown":return"Teardown";case"worktree_cleanup":return"Worktree cleanup";case"workspace_finalize":return"Finalize";default:return s}}r(yn,"workspaceOperationPhaseLabel");function wn(s){const n=(s.operations??[]).find(a=>a.phase==="workspace_seed"||a.phase==="workspace_runtime_provision")??null;if(n){const a=n.finishedAt??n.startedAt??null;if(n.status==="running")return{kind:"provisioning",at:a};if(n.status==="succeeded")return{kind:"provisioned",at:a};if(n.status==="failed")return{kind:"failed",at:a}}return s.runtimeProvisionCommand&&s.runtimeProvisionCommand.trim()?{kind:"deferred"}:{kind:"eager"}}r(wn,"resolveRuntimeProvisionStatus");function C({label:s,children:n}){return(0,e.jsxs)("div",{className:"flex flex-col gap-1.5 py-1.5 sm:flex-row sm:items-start sm:gap-3",children:[(0,e.jsx)("div",{className:"shrink-0 text-xs text-ink-3 sm:w-32",children:s}),(0,e.jsx)("div",{className:"min-w-0 flex-1 text-sm",children:n})]})}r(C,"DetailRow");function Z({children:s,className:n}){return(0,e.jsx)("div",{className:S("inline-flex items-center rounded-full border border-line bg-bg px-2.5 py-1 text-xs text-ink-3",n),children:s})}r(Z,"StatusPill");function Nn({status:s,onViewLogs:n}){return s.kind==="eager"?(0,e.jsx)("span",{className:"text-sm text-ink-3",children:"Eager · provisioned during workspace setup"}):s.kind==="deferred"?(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsx)(Z,{className:"border-amber-500/40 text-amber-600 dark:text-amber-400",children:"Deferred"}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"Runs once before the first runtime-service start."})]}):s.kind==="provisioning"?(0,e.jsxs)(Z,{className:"border-line text-ink-3",children:[(0,e.jsx)(ue,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Provisioning…"]}):s.kind==="provisioned"?(0,e.jsxs)(Z,{className:"border-emerald-500/40 text-emerald-600 dark:text-emerald-400",children:["Provisioned",s.at?` · ${L(s.at)}`:""]}):(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxs)(Z,{className:"border-bad/50 text-bad",children:["Provisioning failed",s.at?` · ${L(s.at)}`:""]}),(0,e.jsx)("button",{type:"button",onClick:n,className:"self-start text-xs text-ink-3 underline underline-offset-2 hover:text-ink",children:"View runtime logs"})]})}r(Nn,"RuntimeProvisionStatusValue");function W({value:s,copy:n}){return(0,e.jsxs)("div",{className:"inline-flex max-w-full items-start gap-2",children:[(0,e.jsx)("span",{className:"break-all font-mono text-xs",children:s}),n?(0,e.jsx)(He,{text:s,className:"shrink-0 text-ink-3 hover:text-ink",copiedLabel:"Copied",children:(0,e.jsx)(Ce,{className:"h-3.5 w-3.5"})}):null]})}r(W,"MonoValue");function Rn({project:s,workspace:n}){return(0,e.jsx)(Y,{to:hs(s,n.id),className:"hover:underline",children:n.name})}r(Rn,"WorkspaceLink");function Cn({companyId:s,workspace:n,issues:a,isLoading:o,error:d,project:c}){const u=Re(),{data:v}=P({queryKey:x.agents.list(s),queryFn:r(()=>Je.list(s),"queryFn"),enabled:!!s}),k=x.liveRuns(s),y=Us({companyId:s,resourceKey:"live-runs",queryKey:k,enabled:!!s,refetchInterval:!1,leaderOnly:!0}),{data:m,dataUpdatedAt:p}=P({queryKey:k,queryFn:r(()=>Os.liveRunsForCompany(s),"queryFn"),enabled:y.enabled,refetchInterval:y.refetchInterval});Ks(y,m,p);const _=(0,h.useMemo)(()=>Hs(m,a),[a,m]),f=le({mutationFn:r(({id:q,data:F})=>ke.update(q,F),"mutationFn"),onSuccess:r(()=>{u.invalidateQueries({queryKey:x.issues.listByExecutionWorkspace(s,n.id)}),u.invalidateQueries({queryKey:x.issues.list(s)}),c?.id&&u.invalidateQueries({queryKey:x.issues.listByProject(s,c.id)})},"onSuccess")}),b=(0,h.useMemo)(()=>c?[{id:c.id,name:c.name,workspaces:c.workspaces??[]}]:void 0,[c]),g=(0,h.useMemo)(()=>({projectId:n.projectId,...n.projectWorkspaceId?{projectWorkspaceId:n.projectWorkspaceId}:{},executionWorkspaceId:n.id,executionWorkspaceMode:"reuse_existing"}),[n.id,n.projectId,n.projectWorkspaceId]);return(0,e.jsx)(Xs,{issues:a,isLoading:o,error:d,agents:v,projects:b,liveIssueIds:_,projectId:c?.id,viewStateKey:"wardmote:execution-workspace-issues-view",baseCreateIssueDefaults:g,onUpdateIssue:r((q,F)=>f.mutate({id:q,data:F}),"onUpdateIssue")})}r(Cn,"ExecutionWorkspaceIssuesList");function In({routine:s,variableNames:n,runningRoutineId:a,onRunNow:o}){const d=s.status==="archived",c=a===s.id;return(0,e.jsxs)("div",{className:"flex flex-col gap-3 border-b border-line px-3 py-3 last:border-b-0 sm:flex-row sm:items-center",children:[(0,e.jsxs)("div",{className:"min-w-0 flex-1 space-y-1.5",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(Y,{to:`/routines/${s.id}`,className:"truncate text-sm font-medium hover:underline",children:s.title}),s.status!=="active"?(0,e.jsx)("span",{className:"text-xs text-ink-3",children:s.status}):null]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-ink-3",children:[(0,e.jsx)("span",{children:s.assigneeAgentId?"Default agent set":"Choose agent when running"}),(0,e.jsxs)("span",{children:["Last run ",gn(s.lastRun?.triggeredAt??s.lastTriggeredAt)]}),(0,e.jsx)("span",{className:"flex flex-wrap gap-1",children:n.map(u=>(0,e.jsx)("span",{className:"rounded-sm bg-bg-3 px-1.5 py-0.5 font-mono text-(length:--text-micro) text-ink-3",children:u},u))})]})]}),(0,e.jsxs)(N,{variant:"secondary",size:"sm",className:"w-full sm:w-auto",disabled:d||c,onClick:r(()=>o(s),"onClick"),children:[c?(0,e.jsx)(ue,{className:"mr-2 h-4 w-4 animate-spin"}):(0,e.jsx)(we,{className:"mr-2 h-4 w-4"}),c?"Running...":"Run now"]})]})}r(In,"WorkspaceRoutineRow");function Sn({workspace:s,project:n}){const a=Re(),{pushToast:o}=qs(),[d,c]=(0,h.useState)(null),[u,v]=(0,h.useState)(null),{data:k,isLoading:y,error:m}=P({queryKey:x.routines.list(s.companyId,{projectId:s.projectId}),queryFn:r(()=>Me.list(s.companyId,{projectId:s.projectId}),"queryFn")}),{data:p}=P({queryKey:x.agents.list(s.companyId),queryFn:r(()=>Je.list(s.companyId),"queryFn")}),_=(0,h.useMemo)(()=>un((k??[]).filter(dn)),[k]),f=le({mutationFn:r(({id:b,data:g})=>Me.run(b,{...g?.variables&&Object.keys(g.variables).length>0?{variables:g.variables}:{},...g?.assigneeAgentId!==void 0?{assigneeAgentId:g.assigneeAgentId}:{},...g?.projectId!==void 0?{projectId:g.projectId}:{},...g?.executionWorkspaceId!==void 0?{executionWorkspaceId:g.executionWorkspaceId}:{},...g?.executionWorkspacePreference!==void 0?{executionWorkspacePreference:g.executionWorkspacePreference}:{},...g?.executionWorkspaceSettings!==void 0?{executionWorkspaceSettings:g.executionWorkspaceSettings}:{}}),"mutationFn"),onMutate:r(({id:b})=>{v(b)},"onMutate"),onSuccess:r(async(b,{id:g})=>{c(null),await Promise.all([a.invalidateQueries({queryKey:["routines",s.companyId]}),a.invalidateQueries({queryKey:x.routines.detail(g)}),a.invalidateQueries({queryKey:x.issues.listByExecutionWorkspace(s.companyId,s.id)}),a.invalidateQueries({queryKey:x.issues.list(s.companyId)})]),o({title:"Routine started",body:"Wardmote created a run using this execution workspace.",tone:"success"})},"onSuccess"),onSettled:r(()=>{v(null)},"onSettled"),onError:r(b=>{o({title:"Routine run failed",body:b instanceof Error?b.message:"Wardmote could not start the routine run.",tone:"error"})},"onError")});return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(B,{className:"rounded-none",children:[(0,e.jsxs)(G,{children:[(0,e.jsx)(X,{children:"Workspace routines"}),(0,e.jsx)(H,{children:"Routines that use workspace-specific variables can be run against this execution workspace."})]}),(0,e.jsx)(K,{children:y?(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Loading routines..."}):m?(0,e.jsx)("p",{className:"text-sm text-bad",children:m instanceof Error?m.message:"Failed to load routines."}):_.length===0?(0,e.jsxs)("div",{className:"flex flex-col items-center gap-2 py-10 text-center",children:[(0,e.jsx)(Fs,{className:"h-5 w-5 text-ink-3"}),(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No routines use workspace-specific variables yet."})]}):(0,e.jsx)("div",{className:"rounded-lg border border-line",children:_.map(b=>(0,e.jsx)(In,{routine:b,variableNames:Ye(b),runningRoutineId:u,onRunNow:c},b.id))})})]}),(0,e.jsx)(nn,{open:d!==null,onOpenChange:r(b=>{b||c(null)},"onOpenChange"),companyId:s.companyId,routineName:d?.title??null,agents:p??[],projects:n?[n]:[],defaultProjectId:s.projectId,defaultAssigneeAgentId:d?.assigneeAgentId??null,defaultExecutionWorkspace:s,variables:d?.variables??[],isPending:f.isPending,onSubmit:r(b=>{d&&f.mutate({id:d.id,data:b})},"onSubmit")})]})}r(Sn,"ExecutionWorkspaceRoutinesList");function xt(){const{visible:s,loaded:n}=Gs(),{workspaceId:a}=ks(),o=bs(),d=Is(),c=Re(),{setBreadcrumbs:u}=Qs(),{selectedCompanyId:v,setSelectedCompanyId:k}=Cs(),{hideHostPaths:y}=Zs(),[m,p]=(0,h.useState)(null),[_,f]=(0,h.useState)(!1),[b,g]=(0,h.useState)(null),[q,F]=(0,h.useState)(null),[Pe,me]=(0,h.useState)(null),[ss,pe]=(0,h.useState)([]),ns=a?hn(o.pathname,a):null,ts=(0,h.useMemo)(()=>{const t=new URLSearchParams(o.search).get("tab");return J(t)?t:null},[o.search]),R=ns??ts,D=P({queryKey:x.executionWorkspaces.detail(a),queryFn:r(()=>V.get(a),"queryFn"),enabled:!!a}),i=D.data??null,j=P({queryKey:i?[...x.projects.detail(i.projectId),i.companyId]:["projects","detail","__pending__"],queryFn:r(()=>Bs.get(i.projectId,i.companyId),"queryFn"),enabled:!!i?.projectId}).data??null,E=P({queryKey:i?.sourceIssueId?x.issues.detail(i.sourceIssueId):["issues","detail","__none__"],queryFn:r(()=>ke.get(i.sourceIssueId),"queryFn"),enabled:!!i?.sourceIssueId}).data??null,xe=P({queryKey:i?.derivedFromExecutionWorkspaceId?x.executionWorkspaces.detail(i.derivedFromExecutionWorkspaceId):["execution-workspaces","detail","__none__"],queryFn:r(()=>V.get(i.derivedFromExecutionWorkspaceId),"queryFn"),enabled:!!i?.derivedFromExecutionWorkspaceId}).data??null,he=P({queryKey:i?x.issues.listByExecutionWorkspace(i.companyId,i.id):["issues","__execution-workspace__","__none__"],queryFn:r(()=>ke.list(i.companyId,{executionWorkspaceId:i.id}),"queryFn"),enabled:!!i?.companyId}),rs=he.data??[],ee=(0,h.useMemo)(()=>j?.workspaces.find(t=>t.id===i?.projectWorkspaceId)??null,[j,i?.projectWorkspaceId]),{slots:_e,isLoading:as,errorMessage:Ee}=Ms({slotTypes:["detailTab"],entityType:"execution_workspace",companyId:i?.companyId??null,enabled:!!i?.companyId}),fe=(0,h.useMemo)(()=>_e.map(t=>({value:`plugin:${t.pluginKey}:${t.id}`,label:t.displayName,order:t.order??mn,slot:t})),[_e]),is=(0,h.useMemo)(()=>xn([...pn.filter(t=>t.value!=="configuration"||s),...fe]),[fe,s]),O=ee?.runtimeConfig?.workspaceRuntime??null,ge=i?.config?.workspaceRuntime??O,Ae=i?.config?.workspaceRuntime?"execution_workspace":O?"project_workspace":"none",Te=(0,h.useMemo)(()=>{if(!m||m.inheritRuntime)return O;const t=de(m.workspaceRuntime);return t.ok?t.value:null},[m,O]),se=(0,h.useMemo)(()=>es(Te),[Te]),Fe=(0,h.useMemo)(()=>vn(se),[se]),M=(0,h.useMemo)(()=>i?Qe(i):null,[i]),je=!!(m&&M&&JSON.stringify(m)!==JSON.stringify(M)),ne=j?ps(j):i?.projectId??"";(0,h.useEffect)(()=>{!i?.companyId||i.companyId===v||k(i.companyId,{source:"route_sync"})},[i?.companyId,v,k]),(0,h.useEffect)(()=>{i&&(p(Qe(i)),g(null),F(null),pe([]))},[i]),(0,h.useEffect)(()=>{if(!i)return;const t=[{label:"Projects",href:"/projects"},...j?[{label:j.name,href:`/projects/${ne}`}]:[],...j?[{label:"Workspaces",href:`/projects/${ne}/workspaces`}]:[],{label:i.name}];u(t)},[u,i,j,ne]);const te=le({mutationFn:r(t=>V.update(i.id,t),"mutationFn"),onSuccess:r(t=>{c.setQueryData(x.executionWorkspaces.detail(t.id),t),c.invalidateQueries({queryKey:x.executionWorkspaces.closeReadiness(t.id)}),c.invalidateQueries({queryKey:x.executionWorkspaces.workspaceOperations(t.id)}),j&&(c.invalidateQueries({queryKey:x.projects.detail(j.id)}),c.invalidateQueries({queryKey:x.projects.detail(j.urlKey)})),E&&c.invalidateQueries({queryKey:x.issues.detail(E.id)}),g(null)},"onSuccess"),onError:r(t=>{g(t instanceof Error?t.message:"Failed to save execution workspace.")},"onError")}),A=P({queryKey:x.executionWorkspaces.workspaceOperations(a),queryFn:r(()=>V.listWorkspaceOperations(a),"queryFn"),enabled:!!a}),Le=i?.config?.runtimeProvisionCommand??j?.executionWorkspacePolicy?.workspaceStrategy?.runtimeProvisionCommand??null,os=(0,h.useMemo)(()=>wn({runtimeProvisionCommand:Le,operations:A.data}),[Le,A.data]),re=le({mutationFn:r(t=>V.controlRuntimeCommands(i.id,t.action,t),"mutationFn"),onSuccess:r((t,l)=>{c.setQueryData(x.executionWorkspaces.detail(t.workspace.id),t.workspace),c.invalidateQueries({queryKey:x.executionWorkspaces.overview(t.workspace.companyId)}),c.invalidateQueries({queryKey:x.executionWorkspaces.workspaceOperations(t.workspace.id)}),c.invalidateQueries({queryKey:x.projects.detail(t.workspace.projectId)}),F(null),me(l.action==="run"?"Workspace job completed.":l.action==="stop"?"Workspace service stopped.":l.action==="restart"?"Workspace service restarted.":"Workspace service started.")},"onSuccess"),onError:r(t=>{me(null),F(t instanceof Error?t.message:"Failed to control workspace commands.")},"onError"),onSettled:r((t,l,w)=>{pe(Q=>Q.filter(us=>us!==w))},"onSettled")});if(D.isLoading)return(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Loading workspace…"});if(D.error)return(0,e.jsx)("p",{className:"text-sm text-bad",children:D.error instanceof Error?D.error.message:"Failed to load workspace"});if(!i||!m||!M)return null;const qe=!!i.cwd,Oe=!!ge&&qe,ve=Ns({runtimeConfig:ge,runtimeServices:i.runtimeServices??[],canStartServices:Oe,canRunJobs:qe}),ls=re.isPending?re.variables??null:null,cs=ws({sections:ve,runtimeServices:i.runtimeServices??[],pendingRequests:ss}),Ue={companyId:i.companyId,projectId:i.projectId,entityId:i.id,entityType:"execution_workspace"},Ke=fe.find(t=>t.value===R)??null;if(R==="configuration"&&!n)return null;if(a&&R==="configuration"&&!s)return(0,e.jsx)(be,{workspaceId:a});if(a&&R===null)return(0,e.jsx)(be,{workspaceId:a});const z=r(t=>{if(J(t)){d(`/execution-workspaces/${i.id}?tab=${encodeURIComponent(t)}`);return}d(ie(i.id,t))},"handleTabChange"),ds=r(()=>{const t=kn(m);if(t){g(t);return}let l;try{l=bn(M,m)}catch(w){g(w instanceof Error?w.message:"Failed to build workspace update.");return}Object.keys(l).length!==0&&te.mutate(l)},"saveChanges"),Be=r(t=>{if(t.length!==0){pe(l=>[...l,...t]);for(const l of t)re.mutate(l)}},"runRuntimeControlRequests");return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"space-y-4 overflow-hidden sm:space-y-6",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-2",children:[(0,e.jsx)("div",{className:"text-xs font-medium uppercase tracking-(--tracking-eyebrow) text-ink-3",children:"Execution workspace"}),(0,e.jsx)("h1",{className:"truncate text-xl font-semibold sm:text-2xl",children:i.name})]}),(0,e.jsx)(cn,{services:cs,onAction:r((t,l)=>{Be(ys(ve,t,l))},"onAction"),onViewLogs:r(()=>z("runtime_logs"),"onViewLogs"),onManageServices:r(()=>z("services"),"onManageServices")})]}),q?(0,e.jsx)("p",{className:"text-sm text-bad",children:q}):null,!q&&Pe?(0,e.jsx)("p",{className:"text-sm text-ink-3",children:Pe}):null,(0,e.jsx)(Ds,{slotTypes:["toolbarButton","contextMenuItem"],entityType:"execution_workspace",context:Ue,className:"flex flex-wrap gap-2",itemClassName:"inline-flex",missingBehavior:"placeholder"}),(0,e.jsx)(Ws,{value:R??"issues",onValueChange:r(t=>z(t),"onValueChange"),children:(0,e.jsx)(Js,{items:is.map(t=>({value:t.value,label:t.label})),align:"start",value:R??"issues",onValueChange:r(t=>z(t),"onValueChange")})}),R==="services"?(0,e.jsx)(Rs,{sections:ve,isPending:re.isPending,pendingRequest:ls,serviceEmptyMessage:ge?"No services have been started for this execution workspace yet.":"No workspace command config is defined for this execution workspace yet.",jobEmptyMessage:"No one-shot jobs are configured for this execution workspace yet.",disabledHint:Oe?null:"Execution workspaces need a working directory before local commands can run, and services also need runtime config.",onAction:r(t=>Be([t]),"onAction")}):R==="configuration"?(0,e.jsxs)("div",{className:"space-y-4 sm:space-y-6",children:[(0,e.jsxs)(B,{className:"rounded-none",children:[(0,e.jsxs)(G,{children:[(0,e.jsx)(X,{children:"Workspace settings"}),(0,e.jsx)(H,{children:"Edit the concrete path, repo, branch, provisioning, teardown, and runtime overrides attached to this execution workspace. Saved changes affect future runs; Wardmote may refresh or replace a reused workspace when config changes."}),(0,e.jsx)(Vs,{children:(0,e.jsx)(N,{variant:"danger",size:"sm",className:"w-full sm:w-auto",onClick:r(()=>f(!0),"onClick"),disabled:i.status==="archived",children:i.status==="cleanup_failed"?"Retry close":"Close workspace"})})]}),(0,e.jsxs)(K,{children:[(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium uppercase tracking-widest text-ink-3",children:"General"}),(0,e.jsx)(I,{label:"Workspace name",children:(0,e.jsx)(U,{value:m.name,onChange:r(t=>p(l=>l&&{...l,name:t.target.value}),"onChange"),placeholder:"Execution workspace name"})})]}),(0,e.jsx)(ae,{}),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium uppercase tracking-widest text-ink-3",children:"Source control"}),(0,e.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,e.jsx)(I,{label:"Branch name",hint:"Useful for isolated worktrees",children:(0,e.jsx)(U,{className:"font-mono",value:m.branchName,onChange:r(t=>p(l=>l&&{...l,branchName:t.target.value}),"onChange"),placeholder:"PAP-946-workspace"})}),(0,e.jsx)(I,{label:"Base ref",children:(0,e.jsx)(U,{className:"font-mono",value:m.baseRef,onChange:r(t=>p(l=>l&&{...l,baseRef:t.target.value}),"onChange"),placeholder:"origin/main"})})]}),(0,e.jsx)(I,{label:"Repo URL",children:(0,e.jsx)(U,{value:m.repoUrl,onChange:r(t=>p(l=>l&&{...l,repoUrl:t.target.value}),"onChange"),placeholder:"https://github.com/org/repo"})})]}),(0,e.jsx)(ae,{}),!y&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium uppercase tracking-widest text-ink-3",children:"Paths"}),(0,e.jsx)(I,{label:"Working directory",children:(0,e.jsx)(U,{className:"font-mono",value:m.cwd,onChange:r(t=>p(l=>l&&{...l,cwd:t.target.value}),"onChange"),placeholder:"/absolute/path/to/workspace"})}),(0,e.jsx)(I,{label:"Provider path / ref",children:(0,e.jsx)(U,{className:"font-mono",value:m.providerRef,onChange:r(t=>p(l=>l&&{...l,providerRef:t.target.value}),"onChange"),placeholder:"/path/to/worktree or provider ref"})})]}),(0,e.jsx)(ae,{})]}),!y&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium uppercase tracking-widest text-ink-3",children:"Lifecycle commands"}),(0,e.jsx)(I,{label:"Provision command",hint:"Runs when Wardmote prepares this execution workspace",children:(0,e.jsx)($,{className:"min-h-20 font-mono",value:m.provisionCommand,onChange:r(t=>p(l=>l&&{...l,provisionCommand:t.target.value}),"onChange"),placeholder:"bash ./scripts/provision-worktree.sh"})}),(0,e.jsx)(I,{label:"Runtime provision command",hint:"Runs once before the first runtime-service start. Leave empty to keep eager provisioning.",children:(0,e.jsx)($,{className:"min-h-20 font-mono",value:m.runtimeProvisionCommand,onChange:r(t=>p(l=>l&&{...l,runtimeProvisionCommand:t.target.value}),"onChange"),placeholder:"bash ./scripts/provision-worktree-runtime.sh"})}),(0,e.jsx)(I,{label:"Teardown command",hint:"Runs when the execution workspace is archived or cleaned up",children:(0,e.jsx)($,{className:"min-h-20 font-mono",value:m.teardownCommand,onChange:r(t=>p(l=>l&&{...l,teardownCommand:t.target.value}),"onChange"),placeholder:"bash ./scripts/teardown-worktree.sh"})}),(0,e.jsx)(I,{label:"Cleanup command",hint:"Workspace-specific cleanup before teardown",children:(0,e.jsx)($,{className:"min-h-16 font-mono",value:m.cleanupCommand,onChange:r(t=>p(l=>l&&{...l,cleanupCommand:t.target.value}),"onChange"),placeholder:"pkill -f vite || true"})})]}),(0,e.jsx)(ae,{})]}),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium uppercase tracking-widest text-ink-3",children:"Runtime config"}),(0,e.jsx)("div",{className:"rounded-md border border-dashed border-line/70 bg-bg px-4 py-3",children:(0,e.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-ink",children:"Runtime config source"}),(0,e.jsx)("p",{className:"text-sm text-ink-3",children:Ae==="execution_workspace"?"This execution workspace currently overrides the project workspace runtime config.":Ae==="project_workspace"?"This execution workspace is inheriting the project workspace runtime config.":"No runtime config is currently defined on this execution workspace or its project workspace."})]}),(0,e.jsx)(N,{variant:"secondary",className:"w-full sm:w-auto",size:"sm",disabled:!ee?.runtimeConfig?.workspaceRuntime,onClick:r(()=>p(t=>t&&{...t,inheritRuntime:!0,workspaceRuntime:""}),"onClick"),children:"Reset to inherit"})]})}),(0,e.jsxs)("details",{className:"rounded-md border border-dashed border-line/70 bg-bg px-4 py-3",children:[(0,e.jsx)("summary",{className:"cursor-pointer text-sm font-medium",children:"Advanced runtime JSON"}),(0,e.jsx)("p",{className:"mt-2 text-sm text-ink-3",children:"Override the inherited workspace command model only when this execution workspace truly needs different service or job behavior."}),(0,e.jsx)("div",{className:"mt-3",children:(0,e.jsxs)(I,{label:"Workspace commands JSON",hint:"Legacy `services` arrays still work, but `commands` supports both services and jobs.",children:[(0,e.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-sm text-ink-3",children:[(0,e.jsx)("input",{id:"inherit-runtime-config",type:"checkbox",className:"rounded border-line",checked:m.inheritRuntime,onChange:r(t=>{const l=t.target.checked;p(w=>w&&(!l&&!w.workspaceRuntime.trim()&&O?{...w,inheritRuntime:l,workspaceRuntime:Ne(O)}:{...w,inheritRuntime:l}))},"onChange")}),(0,e.jsx)("label",{htmlFor:"inherit-runtime-config",children:"Inherit project workspace runtime config"})]}),(0,e.jsx)($,{className:"min-h-64 font-mono sm:min-h-96",value:m.workspaceRuntime,onChange:r(t=>p(l=>l&&{...l,workspaceRuntime:t.target.value}),"onChange"),disabled:m.inheritRuntime,placeholder:`{
|
|
2
2
|
"commands": [
|
|
3
3
|
{
|
|
4
4
|
"id": "web",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var W=Object.defineProperty;var r=(s,n)=>W(s,"name",{value:n,configurable:!0});import{i as U}from"./rolldown-runtime-ZpX3ckPj.js";import{l as N,na as H,ta as V}from"./createLucideIcon-DJi9suAC.js";import{r as k}from"./star-BZgQbzhV.js";import{r as g}from"./queryKeys-DYV5MhM_.js";import{a as G,c as Q,i as X,n as J,o as Y,r as Z,s as ee,t as se}from"./alert-dialog-Blls2GnU.js";import{c as S,d as ne,f as te,i as b,p as B,r as E,t as $,u as re}from"./dropdown-menu-CqRAF7Oj.js";import{t as F}from"./check-Ctsrlfa-.js";import{t as le}from"./chevron-down-BCvxsWfI.js";import{t as ae}from"./ellipsis-BTiLRUn4.js";import{t as h}from"./button-CMwV3L1P.js";import{t as I}from"./plus-C6fnr28l.js";import{t as oe}from"./search-04O7m-IF.js";import{t as ie}from"./trash-D7zTaHTj.js";import{t as de}from"./x-DRDFdlYE.js";import{a as ce,i as me,n as ue,r as fe,s as xe,t as he}from"./dialog-CKUblzlR.js";import{t as pe}from"./input-DobnTAyB.js";import{o as je,r as ge,s as be,t as ye}from"./sheet-jd7y5x4-.js";var Ve={list:r((s,n)=>g.get(`/companies/${encodeURIComponent(s)}/folders?kind=${n}`),"list"),create:r((s,n)=>g.post(`/companies/${encodeURIComponent(s)}/folders`,n),"create"),ensureMy:r((s,n={})=>g.post(`/companies/${encodeURIComponent(s)}/folders/ensure-my`,n),"ensureMy"),update:r((s,n,t)=>g.patch(`/companies/${encodeURIComponent(s)}/folders/${encodeURIComponent(n)}`,t),"update"),moveFolder:r((s,n,t)=>g.post(`/companies/${encodeURIComponent(s)}/folders/${encodeURIComponent(n)}/move`,t),"moveFolder"),moveItem:r((s,n)=>g.post(`/companies/${encodeURIComponent(s)}/folders/items/move`,n),"moveItem"),delete:r((s,n)=>g.delete(`/companies/${encodeURIComponent(s)}/folders/${encodeURIComponent(n)}`),"delete")},p=U(H(),1);function Ge(s){return s.systemKey==="bundled"||s.systemKey?.startsWith("bundled:")?!0:s.path==="bundled"||s.path.startsWith("bundled/")}r(Ge,"isBundledFolder");function Qe(s){return s.systemKey==="projects"||s.systemKey?.startsWith("project:")?!0:s.path==="projects"||s.path.startsWith("projects/")}r(Qe,"isProjectsFolder");function _(s){s.sort((n,t)=>n.folder.position-t.folder.position||n.folder.name.localeCompare(t.folder.name));for(const n of s)_(n.children)}r(_,"sortNodes");function ve(s){const n=new Map,t=new Map;for(const d of s)n.set(d.id,d),t.set(d.id,{folder:d,children:[]});const l=[];for(const d of s){const a=t.get(d.id),j=d.parentId?t.get(d.parentId):null;j?j.children.push(a):l.push(a)}_(l);let o=null,i=null,m=null;const c=[];for(const d of l)switch(d.folder.systemKey){case"my":o=d;break;case"projects":i=d;break;case"bundled":m=d;break;default:c.push(d)}const x=new Map;for(const[d,a]of t)x.set(d,a.children);const u=[];return o&&u.push(o),u.push(...c),i&&u.push(i),m&&u.push(m),{my:o,company:c,projects:i,bundled:m,byId:n,childrenById:x,roots:u}}r(ve,"buildSkillFolderTree");function Xe(s,n){const t=new Set([n]),l=[n];for(;l.length>0;){const o=l.pop();for(const i of s.childrenById.get(o)??[])t.has(i.folder.id)||(t.add(i.folder.id),l.push(i.folder.id))}return t}r(Xe,"subtreeFolderIds");function Ne(s,n){const t=[];let l=s.byId.get(n);const o=new Set;for(;l&&!o.has(l.id);)o.add(l.id),t.unshift(l),l=l.parentId?s.byId.get(l.parentId):void 0;return t}r(Ne,"folderBreadcrumbTrail");function A(s){switch(s.systemKey){case"my":return"My Skills";case"projects":return"Projects";case"bundled":return"Bundled";default:return s.name}}r(A,"reservedRootLabel");function Je(s,n){if(!n)return null;const t=Ne(s,n);if(t.length===0)return null;const l=t.map(o=>A(o));return t[0]?.systemKey||l.unshift("Organization"),l.join(" / ")}r(Je,"skillFolderDisplayPath");function we(s){return s.replace(/[-_]+/g," ").replace(/\b\w/g,n=>n.toUpperCase())}r(we,"humanizeFolderPathSegment");function Ye(s){if(!s)return null;if(s.includes(" / "))return s;const n=s.split("/").filter(Boolean);if(n.length===0)return null;const t=n[0]?.toLowerCase(),l=n.map(we);return t==="my"?l[0]="My Skills":t==="projects"?l[0]="Projects":t==="bundled"?l[0]="Bundled":l.unshift("Organization"),l.join(" / ")}r(Ye,"skillFolderPathDisplayFallback");function ke(s){return ve(s?.folders??[])}r(ke,"treeFromResult");var e=U(V(),1),C=["indigo","violet","emerald","cyan","amber","slate"],T={indigo:"var(--folder-color-indigo)",violet:"var(--folder-color-violet)",emerald:"var(--folder-color-emerald)",cyan:"var(--folder-color-cyan)",amber:"var(--folder-color-amber)",slate:"var(--folder-color-slate)"};function Ze(s){return s?s==="unfiled"?"unfiled":s:"all"}r(Ze,"normalizeFolderSelection");function es(s){return s==="all"?"":s==="unfiled"?"unfiled":s}r(es,"folderSearchValue");function Ce(s,n){return n==="all"||n==="unfiled"?null:s.find(t=>t.id===n)??null}r(Ce,"selectedFolderFromList");function y({color:s,className:n}){const t=s?T[s]??s:"var(--folder-color-slate)";return(0,e.jsx)("span",{"aria-hidden":"true",className:N("h-2.5 w-2.5 shrink-0 rounded-sm border border-line/40",n),style:{backgroundColor:t}})}r(y,"FolderSwatch");function De({folders:s,selection:n,allLabel:t}){return n==="all"?t:n==="unfiled"?"Unfiled":s.find(l=>l.id===n)?.name??t}r(De,"selectionLabel");function Se(s,n){return s?n==="all"?s.allCount:n==="unfiled"?s.unfiledCount:s.folders.find(t=>t.id===n)?.itemCount??0:0}r(Se,"selectionCount");function ss({result:s,selection:n,allLabel:t,onClick:l}){const o=s?Ce(s.folders,n):null;return(0,e.jsxs)(h,{variant:"secondary",size:"sm",className:"max-w-full justify-start",onClick:l,children:[n==="all"?(0,e.jsx)(k,{className:"mr-2 h-3.5 w-3.5"}):(0,e.jsx)(y,{color:o?.color,className:"mr-2"}),(0,e.jsx)("span",{className:"truncate",children:De({folders:s?.folders??[],selection:n,allLabel:t})}),(0,e.jsx)("span",{className:"ml-2 text-xs text-ink-3",children:Se(s,n)}),(0,e.jsx)(le,{className:"ml-1 h-3.5 w-3.5 shrink-0"})]})}r(ss,"FolderChip");function ns({result:s,selection:n,itemLabelPlural:t,allLabel:l,loading:o=!1,onSelect:i,onCreate:m,onRename:c,onEdit:x,onDelete:u}){const d=s?.folders??[],[a,j]=(0,p.useState)(null),[w,R]=(0,p.useState)("");(0,p.useEffect)(()=>{a&&(d.find(f=>f.id===a)||j(null))},[d,a]);function K(f){j(f.id),R(f.name)}r(K,"startRename");function O(f){const v=w.trim();v&&v!==f.name&&c(f,v),j(null)}r(O,"commitRename");function M(f,v,P,q){const z=n===f;return(0,e.jsxs)("button",{type:"button",className:N("grid w-full grid-cols-(--gtc-folder-row) items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors hover:bg-bg-3/40",z?"bg-bg-3/60 text-ink":"text-ink-3"),"aria-current":z?"page":void 0,onClick:r(()=>i(f),"onClick"),children:[(0,e.jsx)("span",{className:"h-4 w-4",children:q}),(0,e.jsx)("span",{className:"truncate",children:v}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:P})]})}return r(M,"renderVirtualRow"),(0,e.jsxs)("nav",{"aria-label":`${t} folders`,className:"hidden w-(--sz-folder-rail) shrink-0 border-r border-line pr-3 md:block",children:[(0,e.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:"Folders"}),(0,e.jsx)(h,{variant:"ghost",size:"icon-sm",title:"New folder",onClick:m,children:(0,e.jsx)(I,{className:"h-3.5 w-3.5"})})]}),o?(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("div",{className:"h-7 rounded-md bg-bg-3/60"}),(0,e.jsx)("div",{className:"h-7 rounded-md bg-bg-3/40"}),(0,e.jsx)("div",{className:"h-7 rounded-md bg-bg-3/30"})]}):(0,e.jsxs)("div",{className:"space-y-0.5",children:[M("all",l,s?.allCount??0,(0,e.jsx)(k,{className:"h-3.5 w-3.5"})),d.map(f=>(0,e.jsx)(Fe,{folder:f,active:n===f.id,renaming:a===f.id,renameDraft:w,onRenameDraftChange:R,onRenameCommit:r(()=>O(f),"onRenameCommit"),onRenameCancel:r(()=>j(null),"onRenameCancel"),onSelect:r(()=>i(f.id),"onSelect"),onStartRename:r(()=>K(f),"onStartRename"),onEdit:r(()=>x(f),"onEdit"),onDelete:r(()=>u(f),"onDelete")},f.id)),(0,e.jsx)("div",{className:"px-2 pb-1 pt-3 text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:"System"}),M("unfiled","Unfiled",s?.unfiledCount??0,(0,e.jsx)(y,{color:null,className:"mt-0.5"}))]})]})}r(ns,"FolderRail");function Fe({folder:s,active:n,renaming:t,renameDraft:l,onRenameDraftChange:o,onRenameCommit:i,onRenameCancel:m,onSelect:c,onStartRename:x,onEdit:u,onDelete:d}){return(0,e.jsxs)("div",{className:N("group grid grid-cols-(--gtc-folder-row-actions) items-center gap-2 rounded-md px-2 py-1 text-sm transition-colors hover:bg-bg-3/40",n?"bg-bg-3/60 text-ink":"text-ink-3"),children:[(0,e.jsx)("span",{className:"h-4 w-4"}),(0,e.jsxs)("button",{type:"button",className:"flex min-w-0 items-center gap-2 text-left","aria-current":n?"page":void 0,onClick:c,onDoubleClick:x,children:[(0,e.jsx)(y,{color:s.color}),t?(0,e.jsx)("input",{value:l,onChange:r(a=>o(a.target.value),"onChange"),onClick:r(a=>a.stopPropagation(),"onClick"),onKeyDown:r(a=>{a.key==="Enter"&&i(),a.key==="Escape"&&m()},"onKeyDown"),onBlur:i,className:"h-6 min-w-0 flex-1 rounded-sm border border-line bg-bg px-1 text-sm outline-none",autoFocus:!0}):(0,e.jsx)("span",{className:"truncate",children:s.name})]}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:s.itemCount}),(0,e.jsxs)($,{children:[(0,e.jsx)(B,{asChild:!0,children:(0,e.jsx)(h,{variant:"ghost",size:"icon-sm",className:"h-6 w-6 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100","aria-label":`Folder actions for ${s.name}`,children:(0,e.jsx)(ae,{className:"h-3.5 w-3.5"})})}),(0,e.jsxs)(E,{align:"end",children:[(0,e.jsx)(b,{onSelect:x,children:"Rename"}),(0,e.jsx)(b,{onSelect:u,children:"Edit color"}),(0,e.jsx)(S,{}),(0,e.jsxs)(b,{variant:"destructive",onSelect:d,children:[(0,e.jsx)(ie,{className:"h-3.5 w-3.5"}),"Delete"]})]})]})]})}r(Fe,"FolderRailItem");function ts({storageKey:s,itemLabelPlural:n,onCreateFolder:t}){const[l,o]=(0,p.useState)(()=>{try{return window.localStorage.getItem(s)==="1"}catch{return!1}});if(l)return null;function i(){o(!0);try{window.localStorage.setItem(s,"1")}catch{}}return r(i,"dismiss"),(0,e.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2 rounded-md border border-line bg-bg-3/40 px-3 py-2 text-sm",children:[(0,e.jsx)(k,{className:"h-3.5 w-3.5 shrink-0 text-ink-3"}),(0,e.jsxs)("span",{className:"min-w-0 flex-1 text-ink-3",children:["Group these ",n," into folders to keep things tidy."]}),(0,e.jsx)(h,{size:"sm",variant:"secondary",onClick:t,children:"Create your first folder"}),(0,e.jsx)(h,{size:"icon-sm",variant:"ghost","aria-label":"Dismiss folder suggestion",onClick:i,children:(0,e.jsx)(de,{className:"h-3.5 w-3.5"})})]})}r(ts,"AllUnfiledBanner");function rs({open:s,onOpenChange:n,result:t,selection:l,allLabel:o,itemLabelPlural:i,onSelect:m,onCreate:c}){function x(a){m(a),n(!1)}r(x,"select");const u=(0,p.useMemo)(()=>ke(t),[t]);function d(a,j){return(0,e.jsxs)("div",{"data-folder-id":a.folder.id,children:[(0,e.jsx)(D,{id:a.folder.id,label:j??a.folder.name,count:a.folder.itemCount,color:a.folder.color,selected:l===a.folder.id,onSelect:x}),a.children.length>0?(0,e.jsx)("div",{className:"pl-3",children:a.children.map(w=>d(w))}):null]},a.folder.id)}return r(d,"renderBranch"),(0,e.jsx)(ye,{open:s,onOpenChange:n,children:(0,e.jsxs)(ge,{side:"bottom",className:"max-h-(--sz-folder-sheet-max) rounded-t-lg pb-4",children:[(0,e.jsx)(je,{className:"border-b border-line px-4 py-3",children:(0,e.jsxs)(be,{children:[i," folders"]})}),(0,e.jsxs)("div",{className:"overflow-y-auto px-3",children:[(0,e.jsx)(D,{id:"all",label:o,count:t?.allCount??0,selected:l==="all",onSelect:x,all:!0}),t?.kind==="skill"?(0,e.jsxs)(e.Fragment,{children:[u.my?d(u.my,"My Skills"):null,(0,e.jsx)("div",{className:"px-2 pb-0.5 pt-2 text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:"Organization"}),u.company.map(a=>d(a)),u.projects?d(u.projects,"Projects"):null,u.bundled?d(u.bundled,"Bundled"):null]}):u.roots.map(a=>d(a,A(a.folder))),(0,e.jsx)(D,{id:"unfiled",label:"Unfiled",count:t?.unfiledCount??0,selected:l==="unfiled",onSelect:x})]}),(0,e.jsx)("div",{className:"border-t border-line px-4 pt-3",children:(0,e.jsxs)(h,{size:"sm",variant:"secondary",className:"w-full",onClick:c,children:[(0,e.jsx)(I,{className:"mr-2 h-3.5 w-3.5"}),"New folder"]})})]})})}r(rs,"MobileFolderSheet");function D({id:s,label:n,count:t,color:l,selected:o,all:i=!1,onSelect:m}){return(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm hover:bg-bg-3/50",onClick:r(()=>m(s),"onClick"),children:[i?(0,e.jsx)(k,{className:"h-3.5 w-3.5 text-ink-3"}):(0,e.jsx)(y,{color:l}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:n}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:t}),o?(0,e.jsx)(F,{className:"h-3.5 w-3.5"}):null]})}r(D,"MobileFolderRow");function ls({folders:s,currentFolderId:n,onMove:t,onCreateAndMove:l}){return(0,e.jsxs)(re,{children:[(0,e.jsx)(te,{children:"Move to..."}),(0,e.jsx)(ne,{className:"w-56",children:(0,e.jsx)(L,{folders:s,currentFolderId:n,onMove:t,onCreateAndMove:l})})]})}r(ls,"MoveToMenu");function L({folders:s,currentFolderId:n,onMove:t,onCreateAndMove:l}){const[o,i]=(0,p.useState)(""),m=(0,p.useMemo)(()=>{const c=o.trim().toLowerCase();return c?s.filter(x=>x.name.toLowerCase().includes(c)):s},[s,o]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[(0,e.jsx)(oe,{className:"h-3.5 w-3.5 text-ink-3"}),(0,e.jsx)("input",{value:o,onChange:r(c=>i(c.target.value),"onChange"),onKeyDown:r(c=>c.stopPropagation(),"onKeyDown"),placeholder:"Search folders",className:"h-7 min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-ink-3"})]}),(0,e.jsx)(S,{}),(0,e.jsxs)(b,{onSelect:r(()=>t(null),"onSelect"),children:[(0,e.jsx)(y,{color:null}),"Unfiled",n==null?(0,e.jsx)(F,{className:"ml-auto h-3.5 w-3.5"}):null]}),m.map(c=>(0,e.jsxs)(b,{onSelect:r(()=>t(c.id),"onSelect"),children:[(0,e.jsx)(y,{color:c.color}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:c.name}),n===c.id?(0,e.jsx)(F,{className:"ml-auto h-3.5 w-3.5"}):null]},c.id)),m.length===0?(0,e.jsx)("div",{className:"px-2 py-2 text-xs text-ink-3",children:"No folders match."}):null,(0,e.jsx)(S,{}),(0,e.jsxs)(b,{onSelect:l,children:[(0,e.jsx)(I,{className:"h-3.5 w-3.5"}),"New folder..."]})]})}r(L,"MoveToMenuItems");function as({open:s,kind:n,folder:t,onOpenChange:l,onSubmit:o,pending:i=!1}){const[m,c]=(0,p.useState)(""),[x,u]=(0,p.useState)(C[0]??null),d=!!t;return(0,p.useEffect)(()=>{s&&(c(t?.name??""),u(t?.color??C[0]??null))},[t,s]),(0,e.jsx)(he,{open:s,onOpenChange:l,children:(0,e.jsxs)(ue,{className:"sm:max-w-md",children:[(0,e.jsxs)(ce,{children:[(0,e.jsx)(xe,{children:d?"Edit folder":"Create folder"}),(0,e.jsx)(fe,{children:n==="routine"?"Organize routines in this organization.":"Organize installed organization skills."})]}),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("label",{className:"text-sm font-medium",htmlFor:"folder-name",children:"Name"}),(0,e.jsx)(pe,{id:"folder-name",value:m,onChange:r(a=>c(a.target.value),"onChange"),autoFocus:!0,onKeyDown:r(a=>{a.key==="Enter"&&m.trim()&&o({name:m.trim(),color:x})},"onKeyDown")})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("div",{className:"text-sm font-medium",children:"Color"}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-2",children:[C.map(a=>(0,e.jsx)("button",{type:"button","aria-label":`Use folder color ${a}`,className:N("h-7 w-7 rounded-md border border-line",x===a&&"ring-2 ring-focus ring-offset-2 ring-offset-bg"),style:{backgroundColor:T[a]},onClick:r(()=>u(a),"onClick")},a)),(0,e.jsx)("button",{type:"button",className:N("h-7 rounded-md border border-line px-2 text-xs text-ink-3",x==null&&"ring-2 ring-focus ring-offset-2 ring-offset-bg"),onClick:r(()=>u(null),"onClick"),children:"None"})]})]})]}),(0,e.jsxs)(me,{children:[(0,e.jsx)(h,{variant:"ghost",onClick:r(()=>l(!1),"onClick"),disabled:i,children:"Cancel"}),(0,e.jsx)(h,{onClick:r(()=>o({name:m.trim(),color:x}),"onClick"),disabled:i||!m.trim(),children:i?"Saving...":d?"Save":"Create folder"})]})]})})}r(as,"FolderFormDialog");function os({open:s,folder:n,itemLabelPlural:t,onOpenChange:l,onConfirm:o,pending:i=!1}){return(0,e.jsx)(se,{open:s,onOpenChange:l,children:(0,e.jsxs)(X,{children:[(0,e.jsxs)(ee,{children:[(0,e.jsx)(Q,{children:"Delete folder"}),(0,e.jsxs)(G,{children:["The ",n?.itemCount??0," ",t," in this folder won't be deleted. They'll move to Unfiled."]})]}),(0,e.jsxs)(Y,{children:[(0,e.jsx)(Z,{disabled:i,children:"Cancel"}),(0,e.jsx)(J,{className:"bg-bad text-accent-ink hover:bg-bad/90",disabled:i||!n,onClick:r(m=>{m.preventDefault(),o()},"onClick"),children:i?"Deleting...":"Delete folder"})]})]})})}r(os,"DeleteFolderDialog");function is({selectedCount:s,folders:n,onMove:t,onCreateAndMove:l,onClear:o,onDone:i}){return s===0?null:(0,e.jsxs)("div",{className:"sticky top-2 z-10 flex flex-wrap items-center gap-2 rounded-md border border-line bg-bg/95 px-3 py-2 shadow-sm backdrop-blur",children:[(0,e.jsxs)("span",{className:"mr-auto text-sm text-ink-3",children:[s," selected"]}),(0,e.jsxs)($,{children:[(0,e.jsx)(B,{asChild:!0,children:(0,e.jsx)(h,{size:"sm",variant:"secondary",children:"Move to..."})}),(0,e.jsx)(E,{align:"end",className:"w-56",children:(0,e.jsx)(L,{folders:n,currentFolderId:void 0,onMove:t,onCreateAndMove:l})})]}),(0,e.jsx)(h,{size:"sm",variant:"ghost",onClick:o,children:"Deselect all"}),(0,e.jsx)(h,{size:"sm",onClick:i,children:"Done"})]})}r(is,"BulkBar");export{Je as _,as as a,ke as b,rs as c,Ze as d,Ce as f,A as g,Qe as h,ss as i,ls as l,Ge as m,is as n,ns as o,Ne as p,os as r,y as s,ts as t,es as u,Ye as v,Ve as x,Xe as y};
|
|
1
|
+
var W=Object.defineProperty;var r=(s,n)=>W(s,"name",{value:n,configurable:!0});import{i as U}from"./rolldown-runtime-ZpX3ckPj.js";import{l as N,na as H,ta as V}from"./createLucideIcon-DJi9suAC.js";import{r as k}from"./star-BZgQbzhV.js";import{r as g}from"./queryKeys-DYV5MhM_.js";import{a as G,c as Q,i as X,n as J,o as Y,r as Z,s as ee,t as se}from"./alert-dialog-Blls2GnU.js";import{c as S,d as ne,f as te,i as b,p as B,r as E,t as $,u as re}from"./dropdown-menu-DEO3mF_E.js";import{t as F}from"./check-Ctsrlfa-.js";import{t as le}from"./chevron-down-BCvxsWfI.js";import{t as ae}from"./ellipsis-BTiLRUn4.js";import{t as h}from"./button-CMwV3L1P.js";import{t as I}from"./plus-C6fnr28l.js";import{t as oe}from"./search-04O7m-IF.js";import{t as ie}from"./trash-D7zTaHTj.js";import{t as de}from"./x-DRDFdlYE.js";import{a as ce,i as me,n as ue,r as fe,s as xe,t as he}from"./dialog-CKUblzlR.js";import{t as pe}from"./input-DobnTAyB.js";import{o as je,r as ge,s as be,t as ye}from"./sheet-jd7y5x4-.js";var Ve={list:r((s,n)=>g.get(`/companies/${encodeURIComponent(s)}/folders?kind=${n}`),"list"),create:r((s,n)=>g.post(`/companies/${encodeURIComponent(s)}/folders`,n),"create"),ensureMy:r((s,n={})=>g.post(`/companies/${encodeURIComponent(s)}/folders/ensure-my`,n),"ensureMy"),update:r((s,n,t)=>g.patch(`/companies/${encodeURIComponent(s)}/folders/${encodeURIComponent(n)}`,t),"update"),moveFolder:r((s,n,t)=>g.post(`/companies/${encodeURIComponent(s)}/folders/${encodeURIComponent(n)}/move`,t),"moveFolder"),moveItem:r((s,n)=>g.post(`/companies/${encodeURIComponent(s)}/folders/items/move`,n),"moveItem"),delete:r((s,n)=>g.delete(`/companies/${encodeURIComponent(s)}/folders/${encodeURIComponent(n)}`),"delete")},p=U(H(),1);function Ge(s){return s.systemKey==="bundled"||s.systemKey?.startsWith("bundled:")?!0:s.path==="bundled"||s.path.startsWith("bundled/")}r(Ge,"isBundledFolder");function Qe(s){return s.systemKey==="projects"||s.systemKey?.startsWith("project:")?!0:s.path==="projects"||s.path.startsWith("projects/")}r(Qe,"isProjectsFolder");function _(s){s.sort((n,t)=>n.folder.position-t.folder.position||n.folder.name.localeCompare(t.folder.name));for(const n of s)_(n.children)}r(_,"sortNodes");function ve(s){const n=new Map,t=new Map;for(const d of s)n.set(d.id,d),t.set(d.id,{folder:d,children:[]});const l=[];for(const d of s){const a=t.get(d.id),j=d.parentId?t.get(d.parentId):null;j?j.children.push(a):l.push(a)}_(l);let o=null,i=null,m=null;const c=[];for(const d of l)switch(d.folder.systemKey){case"my":o=d;break;case"projects":i=d;break;case"bundled":m=d;break;default:c.push(d)}const x=new Map;for(const[d,a]of t)x.set(d,a.children);const u=[];return o&&u.push(o),u.push(...c),i&&u.push(i),m&&u.push(m),{my:o,company:c,projects:i,bundled:m,byId:n,childrenById:x,roots:u}}r(ve,"buildSkillFolderTree");function Xe(s,n){const t=new Set([n]),l=[n];for(;l.length>0;){const o=l.pop();for(const i of s.childrenById.get(o)??[])t.has(i.folder.id)||(t.add(i.folder.id),l.push(i.folder.id))}return t}r(Xe,"subtreeFolderIds");function Ne(s,n){const t=[];let l=s.byId.get(n);const o=new Set;for(;l&&!o.has(l.id);)o.add(l.id),t.unshift(l),l=l.parentId?s.byId.get(l.parentId):void 0;return t}r(Ne,"folderBreadcrumbTrail");function A(s){switch(s.systemKey){case"my":return"My Skills";case"projects":return"Projects";case"bundled":return"Bundled";default:return s.name}}r(A,"reservedRootLabel");function Je(s,n){if(!n)return null;const t=Ne(s,n);if(t.length===0)return null;const l=t.map(o=>A(o));return t[0]?.systemKey||l.unshift("Organization"),l.join(" / ")}r(Je,"skillFolderDisplayPath");function we(s){return s.replace(/[-_]+/g," ").replace(/\b\w/g,n=>n.toUpperCase())}r(we,"humanizeFolderPathSegment");function Ye(s){if(!s)return null;if(s.includes(" / "))return s;const n=s.split("/").filter(Boolean);if(n.length===0)return null;const t=n[0]?.toLowerCase(),l=n.map(we);return t==="my"?l[0]="My Skills":t==="projects"?l[0]="Projects":t==="bundled"?l[0]="Bundled":l.unshift("Organization"),l.join(" / ")}r(Ye,"skillFolderPathDisplayFallback");function ke(s){return ve(s?.folders??[])}r(ke,"treeFromResult");var e=U(V(),1),C=["indigo","violet","emerald","cyan","amber","slate"],T={indigo:"var(--folder-color-indigo)",violet:"var(--folder-color-violet)",emerald:"var(--folder-color-emerald)",cyan:"var(--folder-color-cyan)",amber:"var(--folder-color-amber)",slate:"var(--folder-color-slate)"};function Ze(s){return s?s==="unfiled"?"unfiled":s:"all"}r(Ze,"normalizeFolderSelection");function es(s){return s==="all"?"":s==="unfiled"?"unfiled":s}r(es,"folderSearchValue");function Ce(s,n){return n==="all"||n==="unfiled"?null:s.find(t=>t.id===n)??null}r(Ce,"selectedFolderFromList");function y({color:s,className:n}){const t=s?T[s]??s:"var(--folder-color-slate)";return(0,e.jsx)("span",{"aria-hidden":"true",className:N("h-2.5 w-2.5 shrink-0 rounded-sm border border-line/40",n),style:{backgroundColor:t}})}r(y,"FolderSwatch");function De({folders:s,selection:n,allLabel:t}){return n==="all"?t:n==="unfiled"?"Unfiled":s.find(l=>l.id===n)?.name??t}r(De,"selectionLabel");function Se(s,n){return s?n==="all"?s.allCount:n==="unfiled"?s.unfiledCount:s.folders.find(t=>t.id===n)?.itemCount??0:0}r(Se,"selectionCount");function ss({result:s,selection:n,allLabel:t,onClick:l}){const o=s?Ce(s.folders,n):null;return(0,e.jsxs)(h,{variant:"secondary",size:"sm",className:"max-w-full justify-start",onClick:l,children:[n==="all"?(0,e.jsx)(k,{className:"mr-2 h-3.5 w-3.5"}):(0,e.jsx)(y,{color:o?.color,className:"mr-2"}),(0,e.jsx)("span",{className:"truncate",children:De({folders:s?.folders??[],selection:n,allLabel:t})}),(0,e.jsx)("span",{className:"ml-2 text-xs text-ink-3",children:Se(s,n)}),(0,e.jsx)(le,{className:"ml-1 h-3.5 w-3.5 shrink-0"})]})}r(ss,"FolderChip");function ns({result:s,selection:n,itemLabelPlural:t,allLabel:l,loading:o=!1,onSelect:i,onCreate:m,onRename:c,onEdit:x,onDelete:u}){const d=s?.folders??[],[a,j]=(0,p.useState)(null),[w,R]=(0,p.useState)("");(0,p.useEffect)(()=>{a&&(d.find(f=>f.id===a)||j(null))},[d,a]);function K(f){j(f.id),R(f.name)}r(K,"startRename");function O(f){const v=w.trim();v&&v!==f.name&&c(f,v),j(null)}r(O,"commitRename");function M(f,v,P,q){const z=n===f;return(0,e.jsxs)("button",{type:"button",className:N("grid w-full grid-cols-(--gtc-folder-row) items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors hover:bg-bg-3/40",z?"bg-bg-3/60 text-ink":"text-ink-3"),"aria-current":z?"page":void 0,onClick:r(()=>i(f),"onClick"),children:[(0,e.jsx)("span",{className:"h-4 w-4",children:q}),(0,e.jsx)("span",{className:"truncate",children:v}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:P})]})}return r(M,"renderVirtualRow"),(0,e.jsxs)("nav",{"aria-label":`${t} folders`,className:"hidden w-(--sz-folder-rail) shrink-0 border-r border-line pr-3 md:block",children:[(0,e.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:"Folders"}),(0,e.jsx)(h,{variant:"ghost",size:"icon-sm",title:"New folder",onClick:m,children:(0,e.jsx)(I,{className:"h-3.5 w-3.5"})})]}),o?(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("div",{className:"h-7 rounded-md bg-bg-3/60"}),(0,e.jsx)("div",{className:"h-7 rounded-md bg-bg-3/40"}),(0,e.jsx)("div",{className:"h-7 rounded-md bg-bg-3/30"})]}):(0,e.jsxs)("div",{className:"space-y-0.5",children:[M("all",l,s?.allCount??0,(0,e.jsx)(k,{className:"h-3.5 w-3.5"})),d.map(f=>(0,e.jsx)(Fe,{folder:f,active:n===f.id,renaming:a===f.id,renameDraft:w,onRenameDraftChange:R,onRenameCommit:r(()=>O(f),"onRenameCommit"),onRenameCancel:r(()=>j(null),"onRenameCancel"),onSelect:r(()=>i(f.id),"onSelect"),onStartRename:r(()=>K(f),"onStartRename"),onEdit:r(()=>x(f),"onEdit"),onDelete:r(()=>u(f),"onDelete")},f.id)),(0,e.jsx)("div",{className:"px-2 pb-1 pt-3 text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:"System"}),M("unfiled","Unfiled",s?.unfiledCount??0,(0,e.jsx)(y,{color:null,className:"mt-0.5"}))]})]})}r(ns,"FolderRail");function Fe({folder:s,active:n,renaming:t,renameDraft:l,onRenameDraftChange:o,onRenameCommit:i,onRenameCancel:m,onSelect:c,onStartRename:x,onEdit:u,onDelete:d}){return(0,e.jsxs)("div",{className:N("group grid grid-cols-(--gtc-folder-row-actions) items-center gap-2 rounded-md px-2 py-1 text-sm transition-colors hover:bg-bg-3/40",n?"bg-bg-3/60 text-ink":"text-ink-3"),children:[(0,e.jsx)("span",{className:"h-4 w-4"}),(0,e.jsxs)("button",{type:"button",className:"flex min-w-0 items-center gap-2 text-left","aria-current":n?"page":void 0,onClick:c,onDoubleClick:x,children:[(0,e.jsx)(y,{color:s.color}),t?(0,e.jsx)("input",{value:l,onChange:r(a=>o(a.target.value),"onChange"),onClick:r(a=>a.stopPropagation(),"onClick"),onKeyDown:r(a=>{a.key==="Enter"&&i(),a.key==="Escape"&&m()},"onKeyDown"),onBlur:i,className:"h-6 min-w-0 flex-1 rounded-sm border border-line bg-bg px-1 text-sm outline-none",autoFocus:!0}):(0,e.jsx)("span",{className:"truncate",children:s.name})]}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:s.itemCount}),(0,e.jsxs)($,{children:[(0,e.jsx)(B,{asChild:!0,children:(0,e.jsx)(h,{variant:"ghost",size:"icon-sm",className:"h-6 w-6 opacity-0 group-hover:opacity-100 data-[state=open]:opacity-100","aria-label":`Folder actions for ${s.name}`,children:(0,e.jsx)(ae,{className:"h-3.5 w-3.5"})})}),(0,e.jsxs)(E,{align:"end",children:[(0,e.jsx)(b,{onSelect:x,children:"Rename"}),(0,e.jsx)(b,{onSelect:u,children:"Edit color"}),(0,e.jsx)(S,{}),(0,e.jsxs)(b,{variant:"destructive",onSelect:d,children:[(0,e.jsx)(ie,{className:"h-3.5 w-3.5"}),"Delete"]})]})]})]})}r(Fe,"FolderRailItem");function ts({storageKey:s,itemLabelPlural:n,onCreateFolder:t}){const[l,o]=(0,p.useState)(()=>{try{return window.localStorage.getItem(s)==="1"}catch{return!1}});if(l)return null;function i(){o(!0);try{window.localStorage.setItem(s,"1")}catch{}}return r(i,"dismiss"),(0,e.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-2 rounded-md border border-line bg-bg-3/40 px-3 py-2 text-sm",children:[(0,e.jsx)(k,{className:"h-3.5 w-3.5 shrink-0 text-ink-3"}),(0,e.jsxs)("span",{className:"min-w-0 flex-1 text-ink-3",children:["Group these ",n," into folders to keep things tidy."]}),(0,e.jsx)(h,{size:"sm",variant:"secondary",onClick:t,children:"Create your first folder"}),(0,e.jsx)(h,{size:"icon-sm",variant:"ghost","aria-label":"Dismiss folder suggestion",onClick:i,children:(0,e.jsx)(de,{className:"h-3.5 w-3.5"})})]})}r(ts,"AllUnfiledBanner");function rs({open:s,onOpenChange:n,result:t,selection:l,allLabel:o,itemLabelPlural:i,onSelect:m,onCreate:c}){function x(a){m(a),n(!1)}r(x,"select");const u=(0,p.useMemo)(()=>ke(t),[t]);function d(a,j){return(0,e.jsxs)("div",{"data-folder-id":a.folder.id,children:[(0,e.jsx)(D,{id:a.folder.id,label:j??a.folder.name,count:a.folder.itemCount,color:a.folder.color,selected:l===a.folder.id,onSelect:x}),a.children.length>0?(0,e.jsx)("div",{className:"pl-3",children:a.children.map(w=>d(w))}):null]},a.folder.id)}return r(d,"renderBranch"),(0,e.jsx)(ye,{open:s,onOpenChange:n,children:(0,e.jsxs)(ge,{side:"bottom",className:"max-h-(--sz-folder-sheet-max) rounded-t-lg pb-4",children:[(0,e.jsx)(je,{className:"border-b border-line px-4 py-3",children:(0,e.jsxs)(be,{children:[i," folders"]})}),(0,e.jsxs)("div",{className:"overflow-y-auto px-3",children:[(0,e.jsx)(D,{id:"all",label:o,count:t?.allCount??0,selected:l==="all",onSelect:x,all:!0}),t?.kind==="skill"?(0,e.jsxs)(e.Fragment,{children:[u.my?d(u.my,"My Skills"):null,(0,e.jsx)("div",{className:"px-2 pb-0.5 pt-2 text-(length:--text-micro) font-medium uppercase tracking-wide text-ink-3",children:"Organization"}),u.company.map(a=>d(a)),u.projects?d(u.projects,"Projects"):null,u.bundled?d(u.bundled,"Bundled"):null]}):u.roots.map(a=>d(a,A(a.folder))),(0,e.jsx)(D,{id:"unfiled",label:"Unfiled",count:t?.unfiledCount??0,selected:l==="unfiled",onSelect:x})]}),(0,e.jsx)("div",{className:"border-t border-line px-4 pt-3",children:(0,e.jsxs)(h,{size:"sm",variant:"secondary",className:"w-full",onClick:c,children:[(0,e.jsx)(I,{className:"mr-2 h-3.5 w-3.5"}),"New folder"]})})]})})}r(rs,"MobileFolderSheet");function D({id:s,label:n,count:t,color:l,selected:o,all:i=!1,onSelect:m}){return(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm hover:bg-bg-3/50",onClick:r(()=>m(s),"onClick"),children:[i?(0,e.jsx)(k,{className:"h-3.5 w-3.5 text-ink-3"}):(0,e.jsx)(y,{color:l}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:n}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:t}),o?(0,e.jsx)(F,{className:"h-3.5 w-3.5"}):null]})}r(D,"MobileFolderRow");function ls({folders:s,currentFolderId:n,onMove:t,onCreateAndMove:l}){return(0,e.jsxs)(re,{children:[(0,e.jsx)(te,{children:"Move to..."}),(0,e.jsx)(ne,{className:"w-56",children:(0,e.jsx)(L,{folders:s,currentFolderId:n,onMove:t,onCreateAndMove:l})})]})}r(ls,"MoveToMenu");function L({folders:s,currentFolderId:n,onMove:t,onCreateAndMove:l}){const[o,i]=(0,p.useState)(""),m=(0,p.useMemo)(()=>{const c=o.trim().toLowerCase();return c?s.filter(x=>x.name.toLowerCase().includes(c)):s},[s,o]);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[(0,e.jsx)(oe,{className:"h-3.5 w-3.5 text-ink-3"}),(0,e.jsx)("input",{value:o,onChange:r(c=>i(c.target.value),"onChange"),onKeyDown:r(c=>c.stopPropagation(),"onKeyDown"),placeholder:"Search folders",className:"h-7 min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-ink-3"})]}),(0,e.jsx)(S,{}),(0,e.jsxs)(b,{onSelect:r(()=>t(null),"onSelect"),children:[(0,e.jsx)(y,{color:null}),"Unfiled",n==null?(0,e.jsx)(F,{className:"ml-auto h-3.5 w-3.5"}):null]}),m.map(c=>(0,e.jsxs)(b,{onSelect:r(()=>t(c.id),"onSelect"),children:[(0,e.jsx)(y,{color:c.color}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:c.name}),n===c.id?(0,e.jsx)(F,{className:"ml-auto h-3.5 w-3.5"}):null]},c.id)),m.length===0?(0,e.jsx)("div",{className:"px-2 py-2 text-xs text-ink-3",children:"No folders match."}):null,(0,e.jsx)(S,{}),(0,e.jsxs)(b,{onSelect:l,children:[(0,e.jsx)(I,{className:"h-3.5 w-3.5"}),"New folder..."]})]})}r(L,"MoveToMenuItems");function as({open:s,kind:n,folder:t,onOpenChange:l,onSubmit:o,pending:i=!1}){const[m,c]=(0,p.useState)(""),[x,u]=(0,p.useState)(C[0]??null),d=!!t;return(0,p.useEffect)(()=>{s&&(c(t?.name??""),u(t?.color??C[0]??null))},[t,s]),(0,e.jsx)(he,{open:s,onOpenChange:l,children:(0,e.jsxs)(ue,{className:"sm:max-w-md",children:[(0,e.jsxs)(ce,{children:[(0,e.jsx)(xe,{children:d?"Edit folder":"Create folder"}),(0,e.jsx)(fe,{children:n==="routine"?"Organize routines in this organization.":"Organize installed organization skills."})]}),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("label",{className:"text-sm font-medium",htmlFor:"folder-name",children:"Name"}),(0,e.jsx)(pe,{id:"folder-name",value:m,onChange:r(a=>c(a.target.value),"onChange"),autoFocus:!0,onKeyDown:r(a=>{a.key==="Enter"&&m.trim()&&o({name:m.trim(),color:x})},"onKeyDown")})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("div",{className:"text-sm font-medium",children:"Color"}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-2",children:[C.map(a=>(0,e.jsx)("button",{type:"button","aria-label":`Use folder color ${a}`,className:N("h-7 w-7 rounded-md border border-line",x===a&&"ring-2 ring-focus ring-offset-2 ring-offset-bg"),style:{backgroundColor:T[a]},onClick:r(()=>u(a),"onClick")},a)),(0,e.jsx)("button",{type:"button",className:N("h-7 rounded-md border border-line px-2 text-xs text-ink-3",x==null&&"ring-2 ring-focus ring-offset-2 ring-offset-bg"),onClick:r(()=>u(null),"onClick"),children:"None"})]})]})]}),(0,e.jsxs)(me,{children:[(0,e.jsx)(h,{variant:"ghost",onClick:r(()=>l(!1),"onClick"),disabled:i,children:"Cancel"}),(0,e.jsx)(h,{onClick:r(()=>o({name:m.trim(),color:x}),"onClick"),disabled:i||!m.trim(),children:i?"Saving...":d?"Save":"Create folder"})]})]})})}r(as,"FolderFormDialog");function os({open:s,folder:n,itemLabelPlural:t,onOpenChange:l,onConfirm:o,pending:i=!1}){return(0,e.jsx)(se,{open:s,onOpenChange:l,children:(0,e.jsxs)(X,{children:[(0,e.jsxs)(ee,{children:[(0,e.jsx)(Q,{children:"Delete folder"}),(0,e.jsxs)(G,{children:["The ",n?.itemCount??0," ",t," in this folder won't be deleted. They'll move to Unfiled."]})]}),(0,e.jsxs)(Y,{children:[(0,e.jsx)(Z,{disabled:i,children:"Cancel"}),(0,e.jsx)(J,{className:"bg-bad text-accent-ink hover:bg-bad/90",disabled:i||!n,onClick:r(m=>{m.preventDefault(),o()},"onClick"),children:i?"Deleting...":"Delete folder"})]})]})})}r(os,"DeleteFolderDialog");function is({selectedCount:s,folders:n,onMove:t,onCreateAndMove:l,onClear:o,onDone:i}){return s===0?null:(0,e.jsxs)("div",{className:"sticky top-2 z-10 flex flex-wrap items-center gap-2 rounded-md border border-line bg-bg/95 px-3 py-2 shadow-sm backdrop-blur",children:[(0,e.jsxs)("span",{className:"mr-auto text-sm text-ink-3",children:[s," selected"]}),(0,e.jsxs)($,{children:[(0,e.jsx)(B,{asChild:!0,children:(0,e.jsx)(h,{size:"sm",variant:"secondary",children:"Move to..."})}),(0,e.jsx)(E,{align:"end",className:"w-56",children:(0,e.jsx)(L,{folders:n,currentFolderId:void 0,onMove:t,onCreateAndMove:l})})]}),(0,e.jsx)(h,{size:"sm",variant:"ghost",onClick:o,children:"Deselect all"}),(0,e.jsx)(h,{size:"sm",onClick:i,children:"Done"})]})}r(is,"BulkBar");export{Je as _,as as a,ke as b,rs as c,Ze as d,Ce as f,A as g,Qe as h,ss as i,ls as l,Ge as m,is as n,ns as o,Ne as p,os as r,y as s,ts as t,es as u,Ye as v,Ve as x,Xe as y};
|