@microvac/ui 0.0.0-stage → 0.1.0-rc.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -2
- package/dist/android-chrome-192x192.png +0 -0
- package/dist/android-chrome-512x512.png +0 -0
- package/dist/announcement-preview.svg +11 -0
- package/dist/apple-touch-icon.png +0 -0
- package/dist/assets/ActiveAgentsPanel-BEx06tMt.js +1 -0
- package/dist/assets/AdapterManager-3kEEQWFJ.js +1 -0
- package/dist/assets/AdvancedToolsRoute-CgS6B-oh.js +39 -0
- package/dist/assets/AgentActionButtons-Cz3jCEd7.js +1 -0
- package/dist/assets/AgentAdvancedTab-BG6ZIAuN.js +131 -0
- package/dist/assets/AgentBulkSettingsSheet-BrrbvspS.js +1 -0
- package/dist/assets/AgentChat-Dw9iXD6H.js +1 -0
- package/dist/assets/AgentDetailPage-CuVIHv_q.js +39 -0
- package/dist/assets/AgentIdentityChip-BrVCcuHQ.js +1 -0
- package/dist/assets/AgentRosterFilters-GQ2bdXfW.js +2 -0
- package/dist/assets/Agents-clrVQnvc.js +2 -0
- package/dist/assets/Agents.production-DTopo7XB.js +2 -0
- package/dist/assets/AnimatedDialogContent-CDLfw-dJ.js +1 -0
- package/dist/assets/AppDetail-BcWBg5yW.js +1 -0
- package/dist/assets/AppNotConnected-NgfyHZ4L.js +1 -0
- package/dist/assets/ApprovalDetail-Dm_1V4tC.js +1 -0
- package/dist/assets/Approvals-i5AB3JPj.js +1 -0
- package/dist/assets/AppsConnect-D660Tpuo.js +1 -0
- package/dist/assets/AppsReview-DdTqOisY.js +1 -0
- package/dist/assets/ArtifactEmptyGraphic-DzxCruYA.js +1 -0
- package/dist/assets/Artifacts-CkXBz6nh.js +1 -0
- package/dist/assets/AssigneePickerInner-BNjyABBe.js +1 -0
- package/dist/assets/AssistantConnection-CNF6mDmO.js +1 -0
- package/dist/assets/AttentionInlineVerbs-BiyZ1ekZ.js +1 -0
- package/dist/assets/AttentionQueueRow-Bh0dKHpF.js +1 -0
- package/dist/assets/AuditHub-BK848cb4.js +1 -0
- package/dist/assets/AuditRuns-CUdlbP7S.js +1 -0
- package/dist/assets/Auth-DDqxm5gD.js +3 -0
- package/dist/assets/BoardChat-fvKqk0R7.js +18 -0
- package/dist/assets/BoardClaim-BEC5BZfz.js +1 -0
- package/dist/assets/BootstrapSetupUxLab-CXzErrin.js +1 -0
- package/dist/assets/Browse-DoovSMuF.js +1 -0
- package/dist/assets/BudgetPolicyCard-BYMlczCq.js +1 -0
- package/dist/assets/CaseDetail-UMAcSH_x.js +1 -0
- package/dist/assets/CaseStatus-BI0aMl9l.js +1 -0
- package/dist/assets/Cases-CMTkGghU.js +1 -0
- package/dist/assets/ChatEndpointDetail-CocNEInH.js +5 -0
- package/dist/assets/ChatEndpointSetup-Cyi2tI9K.js +1 -0
- package/dist/assets/ChatIdentityConfirm-Ba3JuTX1.js +1 -0
- package/dist/assets/CliAuth-D2jnueGH.js +1 -0
- package/dist/assets/Companies-K75I9dJs.js +1 -0
- package/dist/assets/CompanyAccess-Cw6nLUhE.js +1 -0
- package/dist/assets/CompanyActivity-BsgmVpWS.js +1 -0
- package/dist/assets/CompanyActivity.production-w-KGxvo6.js +1 -0
- package/dist/assets/CompanyConnections-yRPYSdm7.js +1 -0
- package/dist/assets/CompanyEnvironments-BA7kWdOJ.js +35 -0
- package/dist/assets/CompanyEnvironments-BrP-ENHg.css +1 -0
- package/dist/assets/CompanyExport-DfsK4b9c.js +4 -0
- package/dist/assets/CompanyImport-DJHAsmSF.js +1 -0
- package/dist/assets/CompanySettings-DwzHGXec.js +1 -0
- package/dist/assets/CompanySettingsPluginPage-Bpa81PF3.js +1 -0
- package/dist/assets/CompanySkills-eTqgbqQN.js +10 -0
- package/dist/assets/CompanySkills.production-CQSWfH0r.js +10 -0
- package/dist/assets/ConfigureBuiltInAgentModal-DgeD7t_i.js +1 -0
- package/dist/assets/CopyableGatewayUrl-B6K3rOal.js +1 -0
- package/dist/assets/CordisPluginSettings-DD3AnD2G.js +1 -0
- package/dist/assets/Costs-orBM8T-a.js +1 -0
- package/dist/assets/CrossIssueCollaborationUxLab-Bv9y9-NE.js +1 -0
- package/dist/assets/Dashboard-CrSBNKX1.js +2 -0
- package/dist/assets/DashboardLive-Cg8C9RiS.js +1 -0
- package/dist/assets/DecisionDateChips-BLZKZH71.js +1 -0
- package/dist/assets/DecisionHistoryPanel-yK-CP7Qg.js +1 -0
- package/dist/assets/DecisionQueuePage-BKXbERai.js +1 -0
- package/dist/assets/DesignGuide-2FswNsXz.js +25 -0
- package/dist/assets/DesignSandboxTaskThread-CGU--FXR.js +28 -0
- package/dist/assets/EmailConnectionAccess-CZ5QRKyg.js +1 -0
- package/dist/assets/EmailEndpointSetup-BI2vsd8Y.js +1 -0
- package/dist/assets/EnforcementBanner-B-iX466h.js +1 -0
- package/dist/assets/EntityRow-BsICt6pd.js +1 -0
- package/dist/assets/ExecutionWorkspaceDetail-CMqR9puh.js +19 -0
- package/dist/assets/ExternalAgentInviteDialog-De30ZrLP.js +50 -0
- package/dist/assets/FilterBar-rCmsTtG4.js +1 -0
- package/dist/assets/FolderControls-CmnB7Ap-.js +1 -0
- package/dist/assets/GatewayDetail-Duw9pJ10.js +2 -0
- package/dist/assets/GatewaysList-BBhVGhRq.js +1 -0
- package/dist/assets/GitHubConnectionRecovery-6VshLoNV.js +1 -0
- package/dist/assets/GoalDetail-CahntjlI.js +1 -0
- package/dist/assets/GoalTree-CU4GBFCh.js +1 -0
- package/dist/assets/Goals-CzM2NDFR.js +1 -0
- package/dist/assets/InstanceAccess-CZzkE65W.js +1 -0
- package/dist/assets/InstanceExperimentalSettings-DWumKtOK.js +1 -0
- package/dist/assets/InviteLanding-BIy2z50u.js +1 -0
- package/dist/assets/IssueChatLongThreadPerf-D4DJvdOG.js +2 -0
- package/dist/assets/JoinRequestQueue-C5rauGYm.js +1 -0
- package/dist/assets/Layout.production-BSDWnupa.js +1 -0
- package/dist/assets/McpConnect-BN8ST0RS.js +1 -0
- package/dist/assets/MembershipAction-DTjhGn-L.js +1 -0
- package/dist/assets/MetricCard-CeL9Pdn5.js +1 -0
- package/dist/assets/MissingPluginTabPlaceholder-CbQiSVnZ.js +1 -0
- package/dist/assets/NewAgent-BszrNpQk.js +1 -0
- package/dist/assets/NewAgentDialog-U9qAcTzc.js +1 -0
- package/dist/assets/NewGoalDialog-DqKbk4-i.js +1 -0
- package/dist/assets/NewProjectDialog-DrlUAF-N.js +1 -0
- package/dist/assets/OnboardingPrimitives-BkgPF4Mu.js +1 -0
- package/dist/assets/OnboardingWizard-CMBMcuXv.js +2 -0
- package/dist/assets/OrgChart.production-BLczTjRj.js +1 -0
- package/dist/assets/PaperclipCloudOAuthHandoff-BTtF8UPD.js +1 -0
- package/dist/assets/PluginManager-CCcqlfgK.js +1 -0
- package/dist/assets/PluginPage-B1empV69.js +1 -0
- package/dist/assets/PluginSettings-DtopaRqR.js +1 -0
- package/dist/assets/ProfileDetailRoute-BqvVpBZi.js +1 -0
- package/dist/assets/ProfileSettings-5__tVfGi.js +1 -0
- package/dist/assets/ProfileWizardRoute-vt-MRLuD.js +1 -0
- package/dist/assets/ProjectDetail-DJ4zjube.js +1 -0
- package/dist/assets/ProjectRepositoryInput-BJcnj3At.js +1 -0
- package/dist/assets/ProjectWorkspaceDetail-DEAO3q6v.js +29 -0
- package/dist/assets/ProjectWorkspacesContent-CZvO7p0i.js +1 -0
- package/dist/assets/Projects-Dm7-zXUH.js +1 -0
- package/dist/assets/QuotaBar-Drp3CaxX.js +1 -0
- package/dist/assets/RepositoryEditor-BT_VAkJu.js +1 -0
- package/dist/assets/Responsibilities-DbUEtGZu.js +4 -0
- package/dist/assets/ResponsibilityDetail--S8_GOkb.js +1 -0
- package/dist/assets/ResponsibleUserDenialUxLab-1PB3JNG0.js +1 -0
- package/dist/assets/ReviewQueueCard-B8w9aXKU.js +1 -0
- package/dist/assets/RoutineAuditActivity-BCo7pYe5.js +1 -0
- package/dist/assets/RoutineDetail-C9Dwn5G9.js +2 -0
- package/dist/assets/RoutineRunVariablesDialog-Baomcbe3.js +1 -0
- package/dist/assets/Routines-Dkv4gJno.js +1 -0
- package/dist/assets/Routines.production-Cs2Y-lpt.js +1 -0
- package/dist/assets/RoutinesToolbar-BNKfCrTo.js +1 -0
- package/dist/assets/Search-CVx4cl2o.js +1 -0
- package/dist/assets/Secrets-C2qv2HKZ.js +4 -0
- package/dist/assets/SkillBinaryFile-DDkhLlfC.js +1 -0
- package/dist/assets/SkillCardIcon-Cp_hws0N.js +2 -0
- package/dist/assets/SkillFolderTree-Cv0CmfYx.js +1 -0
- package/dist/assets/SkillSourceTree-DmjlUswf.js +2 -0
- package/dist/assets/SkillSources-nmlYypUU.js +2 -0
- package/dist/assets/SkillStudio-BK3y_3zr.js +9 -0
- package/dist/assets/SkillsNavigationTabs-DRwMP1eu.js +1 -0
- package/dist/assets/SpekoPhoneCallback-Cqi7AIyH.js +1 -0
- package/dist/assets/SpekoProviderSetup-CJI4oXk5.js +1 -0
- package/dist/assets/StatusCards-DKyyY81S.js +1 -0
- package/dist/assets/SummarySlotCard-f3RomdZS.js +1 -0
- package/dist/assets/TailscaleConnector-yQWLR1Ra.js +1 -0
- package/dist/assets/TaskChatLab-Dsr7eyj4.js +11 -0
- package/dist/assets/TaskSummaryList-eFDfK_QH.js +1 -0
- package/dist/assets/Timeline-BWA9dyk6.js +1 -0
- package/dist/assets/ToolsAdminGate-DpBg30hQ.js +1 -0
- package/dist/assets/TrustPresetSection-DtWjK9Kp.js +1 -0
- package/dist/assets/UserProfile-C66UI5xx.js +1 -0
- package/dist/assets/WebhookUrlWarning-CDygVnDH.js +1 -0
- package/dist/assets/WhatNeedsMe-BQ82RHus.js +1 -0
- package/dist/assets/Workspaces-DrjJes30.js +1 -0
- package/dist/assets/abnfDiagram-YUKMZFIV-Crkksu2D.js +1 -0
- package/dist/assets/apl-MHzTCvfx.js +1 -0
- package/dist/assets/arc-Dnq9Aszq.js +1 -0
- package/dist/assets/architecture-WOLXFQ4H-bHU8FW0c.js +1 -0
- package/dist/assets/architectureDiagram-47P4ROYG-Bj5Styf9.js +36 -0
- package/dist/assets/array-CL5Tisss.js +1 -0
- package/dist/assets/arrow-down-left-Ck9VQyqQ.js +1 -0
- package/dist/assets/asciiarmor-DFLNSgns.js +1 -0
- package/dist/assets/asn1-CfPVWRYE.js +1 -0
- package/dist/assets/asterisk-CJ4OeA7Y.js +1 -0
- package/dist/assets/blockDiagram-E7TT5TSB-OeHpNCQ-.js +140 -0
- package/dist/assets/brainfuck-NEHkmXMc.js +1 -0
- package/dist/assets/budgets-CAWPqcn4.js +1 -0
- package/dist/assets/building-complex-Dxiyk_pH.js +1 -0
- package/dist/assets/c4Diagram-CRA5TL53-QbK5p76P.js +38 -0
- package/dist/assets/channel-BSmZkKA8.js +1 -0
- package/dist/assets/character-CguPM7IG.js +1 -0
- package/dist/assets/chat-channels-CzTZV2fr.js +1 -0
- package/dist/assets/chunk-2BW5OAIV-Ckr4HfBO.js +10 -0
- package/dist/assets/chunk-2Q5K7J3B-CkPHWFj-.js +1 -0
- package/dist/assets/chunk-3YJQHVM4-C_uoPpLR.js +2 -0
- package/dist/assets/chunk-4EA7E6EY-BeMEfIRS.js +1 -0
- package/dist/assets/chunk-5VM5RSS4-2H3r6wq0.js +15 -0
- package/dist/assets/chunk-7TKQ45FW-DiwqWHvN.js +1 -0
- package/dist/assets/chunk-AW2ZBBNX-Cf57K3PO.js +88 -0
- package/dist/assets/chunk-DBDB3WZW-B2qouVQO.js +1 -0
- package/dist/assets/chunk-DUW6YSOI-slPglwIh.js +1 -0
- package/dist/assets/chunk-E2ZNV5FY-DG8wQ_NS.js +70 -0
- package/dist/assets/chunk-EU5HNXII-cxRrXRGV.js +213 -0
- package/dist/assets/chunk-FVRAUYC3-Dizswk0V.js +2 -0
- package/dist/assets/chunk-HJ2JQQFS-DL4lnpSv.js +1 -0
- package/dist/assets/chunk-HTAEGDNF-Zxjdb6kj.js +1 -0
- package/dist/assets/chunk-J5ZVWO5B-ClU583ja.js +1 -0
- package/dist/assets/chunk-JWPE2WC7--HEGjv3t.js +1 -0
- package/dist/assets/chunk-KQW6MTUR-BsVaJdnu.js +1 -0
- package/dist/assets/chunk-NGNAAXSQ-e5XI1hSt.js +128 -0
- package/dist/assets/chunk-NTY3LDVX-DyT9N5sM.js +1 -0
- package/dist/assets/chunk-VPRB5NB3-BNz5CtBn.js +129 -0
- package/dist/assets/chunk-XC4XBNZT-CCgIhjYS.js +62 -0
- package/dist/assets/chunk-XXDRQBXY-BdWplhUD.js +1 -0
- package/dist/assets/chunk-Y2CYZVJY-OvsAdhaO.js +1 -0
- package/dist/assets/circle-slash-uNv_ha0X.js +1 -0
- package/dist/assets/classDiagram-v2-K4WV4PDN-Cdh3CEl4.js +217 -0
- package/dist/assets/clike-CIx9nZSv.js +1 -0
- package/dist/assets/clojure-DFaIEz5O.js +1 -0
- package/dist/assets/cmake-koz-qBlo.js +1 -0
- package/dist/assets/cobol-Bo8Zw9gB.js +1 -0
- package/dist/assets/coffeescript-CXYzYf-Y.js +1 -0
- package/dist/assets/coins-BDAh8hDQ.js +1 -0
- package/dist/assets/collections-B58p51lw.js +3 -0
- package/dist/assets/commonlisp-C4OOCwkD.js +1 -0
- package/dist/assets/company-skill-routes-D5LJ1l8M.js +1 -0
- package/dist/assets/company-skill-summary-DnWVmP1S.js +1 -0
- package/dist/assets/configuration-warnings-CZKSfHJv.js +2 -0
- package/dist/assets/connection-owner-D8fNrFqC.js +1 -0
- package/dist/assets/cose-bilkent-JH36ORCC-DFyVDb92.js +1 -0
- package/dist/assets/crystal-BlJXQDvy.js +1 -0
- package/dist/assets/css-DEZwfVpY.js +1 -0
- package/dist/assets/cynefin-EF2NZ3EQ-BkwhfqJ0.js +1 -0
- package/dist/assets/cynefinDiagram-3GCD6N5R-DuGb_wq2.js +62 -0
- package/dist/assets/cypher-z2oFsVv2.js +1 -0
- package/dist/assets/cytoscape.esm-C2vp4vBx.js +321 -0
- package/dist/assets/d-Dkt6y7AQ.js +1 -0
- package/dist/assets/dagre-W4DXFKR2-Bxq_Mhia.js +4 -0
- package/dist/assets/defaultLocale-C2Bpu8Ih.js +1 -0
- package/dist/assets/definition-DxwMBXnu.js +1 -0
- package/dist/assets/diagram-2UJZ2QOL-B-P_hrXV.js +200 -0
- package/dist/assets/diagram-OVF4WLC6-Ds0BqQWH.js +24 -0
- package/dist/assets/diagram-PFPMY2P6-Dpqb2-Cb.js +30 -0
- package/dist/assets/diagram-UMYRVEAY-BJSoxjiu.js +24 -0
- package/dist/assets/diagram-YEKJPTXX-BxaG_9tT.js +41 -0
- package/dist/assets/diagram-ZIFT7M5P-6acvVOtc.js +3 -0
- package/dist/assets/diff-C60bAYOU.js +1 -0
- package/dist/assets/dist-0EWXio4m.js +1 -0
- package/dist/assets/dist-BGvZP_Cl.js +1 -0
- package/dist/assets/dist-BZ7AbEhN.js +1 -0
- package/dist/assets/dist-BlosHr86.js +6 -0
- package/dist/assets/dist-Bmr4uhSk.js +1 -0
- package/dist/assets/dist-C6yMfMNS.js +13 -0
- package/dist/assets/dist-CMZQedYl.js +1 -0
- package/dist/assets/dist-CTlCK4Pe.js +1 -0
- package/dist/assets/dist-C_N_-eaT.js +1 -0
- package/dist/assets/dist-CaUbG4Hl.js +1 -0
- package/dist/assets/dist-Cd7wdKYE.js +39 -0
- package/dist/assets/dist-Cn7-nxjU.js +1 -0
- package/dist/assets/dist-Cnj95_pX.js +1 -0
- package/dist/assets/dist-D9DR7k9k.js +3 -0
- package/dist/assets/dist-DIwsVdS2.js +2 -0
- package/dist/assets/dist-DVE0lLId.js +1 -0
- package/dist/assets/dist-DkAPL4CQ.js +1 -0
- package/dist/assets/dist-Dl6N3kpQ.js +1 -0
- package/dist/assets/dist-DmBvXBzK.js +1 -0
- package/dist/assets/dist-DpgXK0aZ.js +1 -0
- package/dist/assets/dist-gMRyU9GJ.js +7 -0
- package/dist/assets/dist-jQQX2kOU.js +1 -0
- package/dist/assets/dist-lUaUoFTq.js +1 -0
- package/dist/assets/dist-qw1ZF2vD.js +1 -0
- package/dist/assets/dist-rH4qrNAn.js +1 -0
- package/dist/assets/dockerfile-BttNdtK0.js +1 -0
- package/dist/assets/dtd-CCVZU5Da.js +1 -0
- package/dist/assets/dylan-3pmV5wzs.js +1 -0
- package/dist/assets/ebnf-bm-I2WIh.js +1 -0
- package/dist/assets/ebnfDiagram-VR2GEFS7-Ytj3Z5qC.js +1 -0
- package/dist/assets/ecl-BIv3PrZb.js +1 -0
- package/dist/assets/eiffel-DuLnr4-r.js +1 -0
- package/dist/assets/elk-IJKZMXRS-CJurNqqK.js +25 -0
- package/dist/assets/elm-njbaCU-L.js +1 -0
- package/dist/assets/erDiagram-O2IAPWRE-hyXckW2d.js +99 -0
- package/dist/assets/erlang-CuhOC2I8.js +1 -0
- package/dist/assets/eventmodeling-K75KTNOO-D3xQujrh.js +1 -0
- package/dist/assets/factor-CM3-9V3b.js +1 -0
- package/dist/assets/fcl-nWsMJ92o.js +1 -0
- package/dist/assets/flowDiagram-OXPTDLAJ-D4ojBTuY.js +1 -0
- package/dist/assets/folder-plus-BJZSMzuj.js +1 -0
- package/dist/assets/forth-BQ9HrCVY.js +1 -0
- package/dist/assets/fortran-DHJe28ev.js +1 -0
- package/dist/assets/ganttDiagram-R7TSEDQI-C8U_ITl4.js +292 -0
- package/dist/assets/gas-ByO0qYMr.js +1 -0
- package/dist/assets/gherkin-CwOmHL5K.js +1 -0
- package/dist/assets/gitGraph-VSP46ZUC-CDeq3yKT.js +1 -0
- package/dist/assets/gitGraphDiagram-XJZIOB7I-CST3EWE9.js +106 -0
- package/dist/assets/goals-BNJZ4nzg.js +1 -0
- package/dist/assets/googleAccessRemoval-CQIi1dvu.js +1 -0
- package/dist/assets/graphlib-DHhK3saS.js +1 -0
- package/dist/assets/groovy-ByXGF8cx.js +1 -0
- package/dist/assets/haskell-CHSpCNOy.js +1 -0
- package/dist/assets/haxe-P2jh68ck.js +1 -0
- package/dist/assets/http-0jwMmfWP.js +1 -0
- package/dist/assets/idl-DTVVj6r5.js +1 -0
- package/dist/assets/index-BJtnP7H1.js +706 -0
- package/dist/assets/index-z7lcCz2I.css +1 -0
- package/dist/assets/info-OHQRW6UA-CPvTWk7J.js +1 -0
- package/dist/assets/infoDiagram-5W2HQ5XZ-BPUiNdxI.js +2 -0
- package/dist/assets/init-BXPE0p7i.js +1 -0
- package/dist/assets/invite-memory-BKdqfr5K.js +1 -0
- package/dist/assets/ishikawaDiagram-K3B6WC7H-D5Z3rmaA.js +70 -0
- package/dist/assets/issue-detail-CZfjXs0M.js +119 -0
- package/dist/assets/javascript-Cblpdx44.js +1 -0
- package/dist/assets/journeyDiagram-COXZFDF6-CEkwEYdR.js +139 -0
- package/dist/assets/julia-KVJvUu_F.js +1 -0
- package/dist/assets/kanban-definition-P3RFRI5V-8h_R6Qjq.js +89 -0
- package/dist/assets/katex-Du_FPwxl.js +257 -0
- package/dist/assets/line-Ljt_vfsb.js +1 -0
- package/dist/assets/linear-BRQgexd0.js +1 -0
- package/dist/assets/link-DvgFK0mz.js +1 -0
- package/dist/assets/list-filter-BR4_dvwm.js +1 -0
- package/dist/assets/livescript-DSHsJPcD.js +1 -0
- package/dist/assets/log-in-Dvx9-FMC.js +1 -0
- package/dist/assets/lua-Vher-70I.js +1 -0
- package/dist/assets/mathematica-CE9SaVsW.js +1 -0
- package/dist/assets/mbox-JGl1Fgvq.js +1 -0
- package/dist/assets/mcpSkills-76szK_k1.js +1 -0
- package/dist/assets/mermaid-parser.core-BjFu937m.js +7 -0
- package/dist/assets/mermaid.core-B0t95EIS.js +42 -0
- package/dist/assets/mindmap-definition-LZFPQGKD-TVnHYUR4.js +96 -0
- package/dist/assets/mirc-BGWbO906.js +1 -0
- package/dist/assets/mllike-DuNQsEw8.js +1 -0
- package/dist/assets/model-DL5biheO.js +1 -0
- package/dist/assets/modelica-5XCgKQt8.js +1 -0
- package/dist/assets/mscgen-mVFg19ri.js +1 -0
- package/dist/assets/mumps-C7oS353s.js +1 -0
- package/dist/assets/nginx-DXVlpyCz.js +1 -0
- package/dist/assets/nsis-KFC6hioG.js +1 -0
- package/dist/assets/ntriples-5ckCopnn.js +1 -0
- package/dist/assets/octave-D1J2QQNt.js +1 -0
- package/dist/assets/onboarding-state-C5_mIw3o.js +1 -0
- package/dist/assets/ordinal-BJyFM1v8.js +1 -0
- package/dist/assets/oz-CPsllMDD.js +1 -0
- package/dist/assets/packet-JDAUHWVQ-aNGiRWLy.js +1 -0
- package/dist/assets/palette-tokens-CL5ZDrEd.js +1 -0
- package/dist/assets/pascal-B-I6JP0Y.js +1 -0
- package/dist/assets/path-D6mommQw.js +1 -0
- package/dist/assets/pegDiagram-BGZESJAR-DDadxqWQ.js +1 -0
- package/dist/assets/perl-CI8WIWBi.js +1 -0
- package/dist/assets/pie-XZMESJXO-CydFP1hd.js +1 -0
- package/dist/assets/pieDiagram-CAPJLFHJ-KhdUDwDS.js +39 -0
- package/dist/assets/pig-FQI0W3S3.js +1 -0
- package/dist/assets/portable-files-CloN_vbk.js +1 -0
- package/dist/assets/power-sYV-WuqQ.js +1 -0
- package/dist/assets/powershell-BAu6x78A.js +1 -0
- package/dist/assets/prod-C6Q7tISe.js +495 -0
- package/dist/assets/profile-summary-D4LPX-Dv.js +1 -0
- package/dist/assets/properties-BKTTDgau.js +1 -0
- package/dist/assets/protobuf-UWh8gh_j.js +1 -0
- package/dist/assets/pug-C20tNwmy.js +1 -0
- package/dist/assets/puppet-BAHVzCkO.js +1 -0
- package/dist/assets/python-C2DOnsac.js +1 -0
- package/dist/assets/q-Cooe-Nh8.js +1 -0
- package/dist/assets/quadrantDiagram-GDMTTRAM-B1X8K2Fs.js +7 -0
- package/dist/assets/r-CktBKya9.js +1 -0
- package/dist/assets/radar-ABXABTNO-BqodkLpx.js +1 -0
- package/dist/assets/railroad-I3PHUGI6-HmRKXDJj.js +1 -0
- package/dist/assets/railroad-abnf-LNEFI6M7-CkBttaHp.js +1 -0
- package/dist/assets/railroad-ebnf-DWYD2UWJ-C6DBawFA.js +1 -0
- package/dist/assets/railroad-peg-JR7BVNR7-Z9df3u5o.js +1 -0
- package/dist/assets/railroadDiagram-SM67HX2B-2vDUUppL.js +1 -0
- package/dist/assets/requirementDiagram-X7JNWC4A-DAuP39Hc.js +84 -0
- package/dist/assets/rolldown-runtime-DhZMWcEn.js +1 -0
- package/dist/assets/rough.esm-DnC5Tr1g.js +1 -0
- package/dist/assets/rpm-Csj9nLHl.js +1 -0
- package/dist/assets/ruby-bGx9eo-K.js +1 -0
- package/dist/assets/runtime-IAg0vdY9.js +4137 -0
- package/dist/assets/sankeyDiagram-UM26HJRW-ByS54QZK.js +40 -0
- package/dist/assets/sas-Drou_EQ9.js +1 -0
- package/dist/assets/saved-permissions-CPiYtxkZ.js +1 -0
- package/dist/assets/scheme-DcjG9bAf.js +1 -0
- package/dist/assets/scroll-text-CVSt6aO2.js +1 -0
- package/dist/assets/sdk-vrG4HtB4.js +1 -0
- package/dist/assets/search-CG-QtPVH.js +1 -0
- package/dist/assets/send-CH-0xdLm.js +1 -0
- package/dist/assets/sequenceDiagram-ZO4K6R2Y-DvWxKTLK.js +169 -0
- package/dist/assets/shared-D37zfckm.js +1 -0
- package/dist/assets/shell-BSKClwid.js +1 -0
- package/dist/assets/sieve-CcvsXPZo.js +1 -0
- package/dist/assets/simple-mode-B79cVo-x.js +1 -0
- package/dist/assets/sizeCapture-INFHLROL-XURNLuv_.js +1 -0
- package/dist/assets/skill-source-connect-return-eFTeuj7y.js +1 -0
- package/dist/assets/smalltalk-Cmg-4mjQ.js +1 -0
- package/dist/assets/smoke-lab-matrix-C5gR81E3.js +1 -0
- package/dist/assets/solr-Dj8ahEwG.js +1 -0
- package/dist/assets/sparql-LAJYmgfk.js +1 -0
- package/dist/assets/spreadsheet-B8doD_pL.js +1 -0
- package/dist/assets/sql-C3kWxFGw.js +1 -0
- package/dist/assets/src-DYjgETqR.js +1 -0
- package/dist/assets/stateDiagram-v2-TBUQTH76-DtiiZIXq.js +291 -0
- package/dist/assets/stex-CW6K5Nmu.js +1 -0
- package/dist/assets/stylus-BS-Ienrc.js +1 -0
- package/dist/assets/swift-BD82LMDK.js +1 -0
- package/dist/assets/swimlanes-N4OXWK64-BWSEtCbX.js +1 -0
- package/dist/assets/swimlanesDiagram-K3J5GTZL-Bl_9DvHU.js +8 -0
- package/dist/assets/tcl-RZa1cqc-.js +1 -0
- package/dist/assets/textile-C-BY_OGF.js +1 -0
- package/dist/assets/tiddlywiki-C9bm_Oju.js +1 -0
- package/dist/assets/tiki-DJOT-rFT.js +1 -0
- package/dist/assets/timeline-definition-YOQAKGHF-U4QcniMh.js +120 -0
- package/dist/assets/toml-Civ2fTsu.js +1 -0
- package/dist/assets/treeView-D4JQ5SDB-B2tdrtsj.js +1 -0
- package/dist/assets/treemap-SAJKECNS-DodN8j4n.js +1 -0
- package/dist/assets/troff-Lns35Xcq.js +1 -0
- package/dist/assets/ttcn-7vlxVTUK.js +1 -0
- package/dist/assets/ttcn-cfg-B8qhhp6o.js +1 -0
- package/dist/assets/turtle-DTIS1YQ7.js +1 -0
- package/dist/assets/useAgentlessOnboardingAutoOpen-DSWW7Juw.js +1 -0
- package/dist/assets/useAuthorizationWindow-tg3aKEU7.js +1 -0
- package/dist/assets/useDateRange-CnZQr2KO.js +1 -0
- package/dist/assets/useFastResponsesEnabled-B8tHSJ1y.js +1 -0
- package/dist/assets/usePageView-CtFMs34g.js +1 -0
- package/dist/assets/useProfilesData-CWHdMSuL.js +1 -0
- package/dist/assets/useReviewCount-W_bCZ2Hz.js +1 -0
- package/dist/assets/useRoutineFormOptions-CCLMmVSF.js +3 -0
- package/dist/assets/useSummaryDraftStream-NVNYNt72.js +3 -0
- package/dist/assets/useTailscaleConnections-Dy52nCY3.js +1 -0
- package/dist/assets/usecaseDiagram-VIAY4XPW-kEHhqgOj.js +362 -0
- package/dist/assets/vb-BO8UacKu.js +1 -0
- package/dist/assets/vbscript-DWLru3lT.js +1 -0
- package/dist/assets/velocity-BIIn-Nl2.js +1 -0
- package/dist/assets/vennDiagram-BLWOH2XV-NPJU0aCU.js +34 -0
- package/dist/assets/verilog-BVYlmXGg.js +1 -0
- package/dist/assets/vhdl-Cn8cC8Yb.js +1 -0
- package/dist/assets/wardley-7MLQ67FV-bUGKvIPT.js +1 -0
- package/dist/assets/wardleyDiagram-YMQ3BMBF-qtUDHfhb.js +78 -0
- package/dist/assets/webidl-ChvzbZ5-.js +1 -0
- package/dist/assets/xquery-BKN7qEbU.js +1 -0
- package/dist/assets/xychartDiagram-TAQBALBS-C-z57aZj.js +7 -0
- package/dist/assets/yacas-BG9ha7tU.js +1 -0
- package/dist/assets/z80-CB2cGLew.js +1 -0
- package/dist/brands/adapters/LICENSE +21 -0
- package/dist/brands/adapters/README.md +7 -0
- package/dist/brands/adapters/cursor-dark.svg +1 -0
- package/dist/brands/adapters/cursor.svg +1 -0
- package/dist/brands/adapters/gemini-color.svg +1 -0
- package/dist/brands/adapters/grok-dark.svg +1 -0
- package/dist/brands/adapters/grok.svg +1 -0
- package/dist/brands/adapters/hermesagent-dark.svg +1 -0
- package/dist/brands/adapters/hermesagent.svg +1 -0
- package/dist/brands/adapters/kimi-color-light.svg +1 -0
- package/dist/brands/adapters/kimi-color.svg +1 -0
- package/dist/brands/adapters/openai-dot.README.md +7 -0
- package/dist/brands/adapters/openai-dot.svg +3 -0
- package/dist/brands/adapters/pi-dark.svg +1 -0
- package/dist/brands/adapters/pi.svg +1 -0
- package/dist/brands/apps/1password-dark.svg +1 -0
- package/dist/brands/apps/1password.svg +1 -0
- package/dist/brands/apps/LOBE-LICENSE +21 -0
- package/dist/brands/apps/agentmail-dark.svg +16 -0
- package/dist/brands/apps/agentmail.svg +17 -0
- package/dist/brands/apps/airtable.svg +1 -0
- package/dist/brands/apps/anthropic-dark.svg +1 -0
- package/dist/brands/apps/anthropic.svg +1 -0
- package/dist/brands/apps/antigravity.svg +31 -0
- package/dist/brands/apps/api-key-generic.svg +1 -0
- package/dist/brands/apps/arcade.png +0 -0
- package/dist/brands/apps/asana.svg +12 -0
- package/dist/brands/apps/aws-dark.svg +1 -0
- package/dist/brands/apps/aws.svg +1 -0
- package/dist/brands/apps/bedrock.svg +1 -0
- package/dist/brands/apps/beehiiv.png +0 -0
- package/dist/brands/apps/bitly.svg +1 -0
- package/dist/brands/apps/box.svg +1 -0
- package/dist/brands/apps/braintrust-dark.png +0 -0
- package/dist/brands/apps/braintrust.png +0 -0
- package/dist/brands/apps/brex-dark.svg +1 -0
- package/dist/brands/apps/brex.svg +1 -0
- package/dist/brands/apps/browser-use.svg +6 -0
- package/dist/brands/apps/calendly.png +0 -0
- package/dist/brands/apps/candid.png +0 -0
- package/dist/brands/apps/circleback.png +0 -0
- package/dist/brands/apps/clickhouse-dark.svg +1 -0
- package/dist/brands/apps/clickhouse.svg +1 -0
- package/dist/brands/apps/clickup.png +0 -0
- package/dist/brands/apps/cloudflare.svg +1 -0
- package/dist/brands/apps/cloudinary-dark.svg +1 -0
- package/dist/brands/apps/cloudinary.svg +3 -0
- package/dist/brands/apps/coda.svg +1 -0
- package/dist/brands/apps/cognee.png +0 -0
- package/dist/brands/apps/composio-dark.svg +11 -0
- package/dist/brands/apps/composio.svg +16 -0
- package/dist/brands/apps/connection-pool.svg +1 -0
- package/dist/brands/apps/context7-dark.svg +8 -0
- package/dist/brands/apps/context7.svg +8 -0
- package/dist/brands/apps/daytona-dark.svg +1 -0
- package/dist/brands/apps/daytona.svg +1 -0
- package/dist/brands/apps/discord-dark.svg +1 -0
- package/dist/brands/apps/discord.svg +1 -0
- package/dist/brands/apps/ditto.png +0 -0
- package/dist/brands/apps/egnyte.svg +1 -0
- package/dist/brands/apps/embat.svg +1 -0
- package/dist/brands/apps/enterpret.png +0 -0
- package/dist/brands/apps/exa.svg +5 -0
- package/dist/brands/apps/executor.png +0 -0
- package/dist/brands/apps/firecrawl.svg +12 -0
- package/dist/brands/apps/fireflies.svg +76 -0
- package/dist/brands/apps/gauge.png +0 -0
- package/dist/brands/apps/github-copilot-dark.svg +1 -0
- package/dist/brands/apps/github-copilot.svg +1 -0
- package/dist/brands/apps/github-dark.svg +10 -0
- package/dist/brands/apps/github.svg +10 -0
- package/dist/brands/apps/gmail.svg +1 -0
- package/dist/brands/apps/google-calendar.svg +1 -0
- package/dist/brands/apps/google-chat.svg +1 -0
- package/dist/brands/apps/google-docs.svg +1 -0
- package/dist/brands/apps/google-drive.svg +1 -0
- package/dist/brands/apps/google-people.svg +1 -0
- package/dist/brands/apps/google-sheets.svg +1 -0
- package/dist/brands/apps/google-slides.svg +1 -0
- package/dist/brands/apps/google-workspace-search.svg +1 -0
- package/dist/brands/apps/google.svg +1 -0
- package/dist/brands/apps/gsc-wizard.png +0 -0
- package/dist/brands/apps/honcho.svg +33 -0
- package/dist/brands/apps/hugging-face.svg +8 -0
- package/dist/brands/apps/imessage-photon.png +0 -0
- package/dist/brands/apps/jam-dev-dark.svg +1 -0
- package/dist/brands/apps/jam-dev.svg +1 -0
- package/dist/brands/apps/jira-dark.svg +1 -0
- package/dist/brands/apps/jira.svg +4 -0
- package/dist/brands/apps/kernel.svg +3 -0
- package/dist/brands/apps/klaviyo.png +0 -0
- package/dist/brands/apps/linear-dark.svg +5 -0
- package/dist/brands/apps/linear.svg +5 -0
- package/dist/brands/apps/local-falcon.png +0 -0
- package/dist/brands/apps/make-dark.svg +1 -0
- package/dist/brands/apps/make.svg +1 -0
- package/dist/brands/apps/manifest.json +756 -0
- package/dist/brands/apps/manufact-dark.svg +6 -0
- package/dist/brands/apps/manufact.svg +5 -0
- package/dist/brands/apps/mem0.svg +1 -0
- package/dist/brands/apps/microsoft-teams.svg +68 -0
- package/dist/brands/apps/miro-dark.svg +1 -0
- package/dist/brands/apps/miro.svg +4 -0
- package/dist/brands/apps/mixpanel-dark.svg +1 -0
- package/dist/brands/apps/mixpanel.svg +1 -0
- package/dist/brands/apps/monday-dark.png +0 -0
- package/dist/brands/apps/monday.png +0 -0
- package/dist/brands/apps/neon.png +0 -0
- package/dist/brands/apps/netlify-dark.svg +1 -0
- package/dist/brands/apps/netlify.svg +16 -0
- package/dist/brands/apps/notion-dark.svg +1 -0
- package/dist/brands/apps/notion.svg +1 -0
- package/dist/brands/apps/oauth-generic.svg +1 -0
- package/dist/brands/apps/openai-dark.svg +1 -0
- package/dist/brands/apps/openai.svg +1 -0
- package/dist/brands/apps/openrouter-dark.svg +3 -0
- package/dist/brands/apps/openrouter.svg +3 -0
- package/dist/brands/apps/oreilly.svg +1 -0
- package/dist/brands/apps/pagerduty.svg +4 -0
- package/dist/brands/apps/paperclip-notebook-dark.svg +1 -0
- package/dist/brands/apps/paperclip-notebook.svg +1 -0
- package/dist/brands/apps/parallel-dark.svg +11 -0
- package/dist/brands/apps/parallel.svg +11 -0
- package/dist/brands/apps/planetscale-dark.svg +1 -0
- package/dist/brands/apps/planetscale.svg +1 -0
- package/dist/brands/apps/posthog-dark.svg +1 -0
- package/dist/brands/apps/posthog.svg +1 -0
- package/dist/brands/apps/postman.svg +1 -0
- package/dist/brands/apps/railway-dark.svg +1 -0
- package/dist/brands/apps/railway.svg +1 -0
- package/dist/brands/apps/razorpay-dark.svg +1 -0
- package/dist/brands/apps/razorpay.svg +1 -0
- package/dist/brands/apps/resend-dark.svg +1 -0
- package/dist/brands/apps/resend.svg +1 -0
- package/dist/brands/apps/sanity-dark.svg +1 -0
- package/dist/brands/apps/sanity.svg +1 -0
- package/dist/brands/apps/sentry-dark.svg +1 -0
- package/dist/brands/apps/sentry.svg +1 -0
- package/dist/brands/apps/shopify.svg +24 -0
- package/dist/brands/apps/similarweb-dark.svg +1 -0
- package/dist/brands/apps/similarweb.svg +1 -0
- package/dist/brands/apps/slack.png +0 -0
- package/dist/brands/apps/slack.svg +17 -0
- package/dist/brands/apps/speko.svg +16 -0
- package/dist/brands/apps/stripe.svg +11 -0
- package/dist/brands/apps/supabase.svg +15 -0
- package/dist/brands/apps/superagent.png +0 -0
- package/dist/brands/apps/supermemory.png +0 -0
- package/dist/brands/apps/tailscale.png +0 -0
- package/dist/brands/apps/tavily.png +0 -0
- package/dist/brands/apps/telegram.svg +12 -0
- package/dist/brands/apps/telem-dark.svg +9 -0
- package/dist/brands/apps/telem.svg +9 -0
- package/dist/brands/apps/ticket-tailor-dark.svg +1 -0
- package/dist/brands/apps/ticket-tailor.svg +1 -0
- package/dist/brands/apps/ticktick.svg +1 -0
- package/dist/brands/apps/todoist.svg +1 -0
- package/dist/brands/apps/unikraft.svg +1 -0
- package/dist/brands/apps/vercel-dark.svg +1 -0
- package/dist/brands/apps/vercel.svg +1 -0
- package/dist/brands/apps/webflow.svg +1 -0
- package/dist/brands/apps/windsor-ai.png +0 -0
- package/dist/brands/apps/wix-dark.svg +12 -0
- package/dist/brands/apps/wix.svg +12 -0
- package/dist/brands/apps/xai-dark.svg +1 -0
- package/dist/brands/apps/xai.svg +1 -0
- package/dist/brands/apps/xero.svg +1 -0
- package/dist/brands/apps/youcom-dark.svg +13 -0
- package/dist/brands/apps/youcom.svg +13 -0
- package/dist/brands/apps/zapier.svg +1 -0
- package/dist/brands/apps/zep.png +0 -0
- package/dist/brands/claude-color.svg +17 -0
- package/dist/brands/codex-color.svg +17 -0
- package/dist/brands/opencode-logo-dark-square.svg +18 -0
- package/dist/brands/opencode-logo-light-square.svg +18 -0
- package/dist/favicon-16x16.png +0 -0
- package/dist/favicon-32x32.png +0 -0
- package/dist/favicon.ico +0 -0
- package/dist/favicon.svg +7 -0
- package/dist/fonts/InterVariable-Italic.woff2 +0 -0
- package/dist/fonts/InterVariable.woff2 +0 -0
- package/dist/fonts/NOTICE.md +30 -0
- package/dist/fonts/PaperMono-OFL.txt +93 -0
- package/dist/fonts/PaperMono-Variable.woff2 +0 -0
- package/dist/index.html +165 -0
- package/dist/microvac-push-sw.js +37 -0
- package/dist/paperclip-thinking.svg +17 -0
- package/dist/site.webmanifest +30 -0
- package/dist/storybook/grok-comparison.csv +4 -0
- package/dist/sw.js +176 -0
- package/dist/worktree-favicon-16x16.png +0 -0
- package/dist/worktree-favicon-32x32.png +0 -0
- package/dist/worktree-favicon.ico +0 -0
- package/dist/worktree-favicon.svg +9 -0
- package/package.json +20 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var xt=Object.defineProperty;var i=(t,n)=>xt(t,"name",{value:n,configurable:!0});import{a as Us,n as pt}from"./rolldown-runtime-DhZMWcEn.js";import{a as ht,i as gt,n as bt,r as vt,t as ft}from"./BudgetPolicyCard-BYMlczCq.js";import{b as jt}from"./collections-B58p51lw.js";import{t as yt}from"./arrow-down-left-Ck9VQyqQ.js";import{t as ns}from"./coins-BDAh8hDQ.js";import{$A as Nt,$S as Ls,Ai as re,BA as M,BE as Ct,CA as Ps,Di as As,EA as Ne,E_ as W,FA as Oe,GA as kt,GE as St,GS as F,Gb as Qe,HE as j,H_ as We,IA as me,Kr as Tt,LS as It,ME as qs,M_ as ie,Mb as Pt,Mi as je,NE as ee,OA as Ks,O_ as X,RE as cs,UT as as,VA as At,VE as zs,WC as rs,WE as Ce,XE as I,__ as ws,bE as Ae,cv as wt,fy as Mt,iT as Xe,ib as Et,jT as Os,j_ as oe,jb as $t,ji as Dt,kT as Qs,k_ as be,ki as es,ly as Ft,mb as ye,my as Bt,nD as se,nj as Rt,oE as _t,on as Ut,op as Pe,pb as ss,rD as ds,rb as Lt,sy as qt,uE as qe,uy as Kt,wA as zt,xE as q,zE as $e}from"./index-BJtnP7H1.js";import{t as ts}from"./budgets-CAWPqcn4.js";import{a as Ot,i as we,n as Qt,o as _,r as Wt,s as Ms,t as Gt}from"./useDateRange-CnZQr2KO.js";import{n as Vt,r as Yt,t as Ht}from"./useFastResponsesEnabled-B8tHSJ1y.js";import{t as Ge}from"./QuotaBar-Drp3CaxX.js";var ge=At([M().max(160),Oe().finite()]).transform((t,n)=>{try{if((typeof t=="number"?t<0:t.startsWith("-"))||bt(t)<0n)throw new Error("Money cannot be negative");return gt(t)}catch(a){return n.addIssue({code:"custom",message:a instanceof Error?a.message:"Invalid money"}),kt}}),Ws=me({source:Ne(["provider_reported","provider_invoice","operator","rate_card","unknown"]).default("unknown"),version:M().max(100).optional(),evidence:M().max(1e3).optional(),inputCentsPerMillion:ge.optional(),cachedInputCentsPerMillion:ge.optional(),outputCentsPerMillion:ge.optional(),cacheWriteCentsPerMillion:ge.optional(),serviceTier:M().max(50).optional(),contextTier:Ne(["short","long"]).optional()}),Bn=me({biller:M().trim().min(1).max(150),externalId:M().trim().min(1).max(200),currency:M().regex(/^[A-Za-z]{3}$/).transform(t=>t.toUpperCase()),lines:Ks(me({externalId:M().trim().min(1).max(200),kind:Ne(["inference","fee","credit"]).default("inference"),amountCents:ge,occurredAt:zt({offset:!0}),costEventId:M().uuid().optional(),runId:M().uuid().optional(),providerRequestId:M().min(1).max(250).optional(),model:M().min(1).max(250).optional(),pricing:Ws.optional()})).min(1).max(2e3)}).superRefine((t,n)=>{new Set(t.lines.map(a=>a.externalId)).size!==t.lines.length&&n.addIssue({code:"custom",path:["lines"],message:"Invoice line identifiers must be unique"})}),Rn=me({idempotencyKey:M().trim().min(1).max(200),expectedCents:ge,correctedCents:ge,invoiceLineId:M().uuid().optional(),reason:M().trim().min(1).max(1e3),pricing:Ws}),_n=me({fingerprint:M().regex(/^[a-f0-9]{64}$/),reason:M().trim().min(1).max(1e3)}),Un=me({runId:M().uuid()}),Ln=me({provider:Ne(["openai","anthropic"]),secretId:M().uuid(),accountId:M().trim().min(1).max(150).regex(/^[a-zA-Z0-9_-]+$/),scopeIds:Ks(M().trim().min(1).max(150)).min(1).max(25),from:Ps(),to:Ps()}).superRefine((t,n)=>{const a=Date.parse(t.to)-Date.parse(t.from);(a<=0||a>26784e5||Date.parse(t.to)>Math.floor(Date.now()/864e5)*864e5)&&n.addIssue({code:"custom",message:"Choose up to 31 completed UTC days; the end date is exclusive."}),new Set(t.scopeIds).size!==t.scopeIds.length&&n.addIssue({code:"custom",message:"Project/workspace identifiers must be unique."})}),Gs=["USD","EUR","GBP","CAD","AUD","CHF"],qn=me({expectedRevision:Oe().int().nonnegative(),plan:M().trim().min(1).max(100),amountCents:ge.nullable(),currency:Ne(Gs),cadence:Ne(["month","year"]),status:Ne(["active","ended","excluded"])}).strict(),Kn=me({targetId:M().uuid(),expectedRevision:Oe().int().nonnegative(),targetRevision:Oe().int().nonnegative()}).strict(),zn=[["openai","free","ChatGPT Free","0","https://learn.chatgpt.com/docs/pricing"],["openai","go","ChatGPT Go","800","https://learn.chatgpt.com/docs/pricing"],["openai","plus","ChatGPT Plus","2000","https://learn.chatgpt.com/docs/pricing"],["anthropic","pro","Claude Pro","2000","https://claude.com/pricing"],["anthropic","max_5x","Claude Max 5x","10000","https://claude.com/pricing"],["anthropic","max_20x","Claude Max 20x","20000","https://claude.com/pricing"],["xai","supergrok","SuperGrok","3000","https://x.ai/pricing"],["xai","supergrok_plus","SuperGrok Plus","10000","https://x.ai/pricing"]].map(([t,n,a,r,l])=>({provider:t,id:n,name:a,monthlyCents:r,sourceUrl:l,currency:"USD",checkedAt:"2026-10-08"})),e=Us(Nt(),1);function Vs({entries:t,fastResponse:n=!1,fastResponsesEnabled:a=!0}){return t.length?(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Recent requests. Inputs are not retained."}),(0,e.jsx)("div",{className:"overflow-x-auto",children:(0,e.jsxs)("table",{className:"w-full text-sm","aria-label":n?"Fast responses":"Decision requests",children:[(0,e.jsx)("thead",{children:(0,e.jsx)("tr",{className:"border-b border-border text-muted-foreground",children:["When / feature","Responsible","Task",...n?["Connection"]:[],"Model","Status","Duration","Tokens in / out","Cost"].map(r=>(0,e.jsx)("th",{className:"px-3 py-2 text-left font-medium",children:r},r))})}),(0,e.jsx)("tbody",{children:t.map(r=>(0,e.jsxs)("tr",{className:"border-b border-border last:border-0",children:[(0,e.jsxs)("td",{className:"px-3 py-3",children:[(0,e.jsx)("div",{className:"whitespace-nowrap",children:Ce(r.startedAt)}),(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:r.feature==="settings.test"?"Setup test":r.feature})]}),(0,e.jsx)("td",{className:"px-3 py-3",children:r.actorType==="system"?"Microvac services":r.userName??(r.responsibleUserId==="local-board"?"Board":"Former user")}),(0,e.jsx)("td",{className:"px-3 py-3",children:r.issueId?(0,e.jsx)(Qe,{className:"underline underline-offset-4",to:`/issues/${r.issueIdentifier??r.issueId}`,children:r.issueIdentifier??"View task"}):"—"}),n&&(0,e.jsx)("td",{className:"px-3 py-3 ph-mask ph-sensitive",children:r.connectionName??(r.connectionId?"Removed connection":"—")}),(0,e.jsx)("td",{className:"px-3 py-3 font-mono text-xs",children:r.model}),(0,e.jsxs)("td",{className:"px-3 py-3",children:[(0,e.jsx)("div",{children:r.status==="succeeded"?"Succeeded":r.status==="running"?"Running":r.status==="unknown"?"Unresolved":r.status==="skipped"?"Skipped":r.status==="pending"?"Pending":"Failed"}),r.publicationStatus&&(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:r.publicationStatus}),r.errorCode&&(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:r.errorCode.replaceAll("_"," ")})]}),(0,e.jsx)("td",{className:"px-3 py-3 font-mono",children:r.durationMs===null?"—":`${(r.durationMs/1e3).toFixed(1)}s`}),(0,e.jsxs)("td",{className:"whitespace-nowrap px-3 py-3 font-mono",children:[r.inputTokens===null?"—":I(r.inputTokens)," / ",r.outputTokens===null?"—":I(r.outputTokens)]}),(0,e.jsxs)("td",{className:"px-3 py-3 font-mono",children:[(0,e.jsx)("div",{children:r.costCents===null?"Unknown":St(r.costCents)}),r.costStatus!=="unpriced"&&r.costStatus&&(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:r.costStatus==="estimated"?"Estimated":"Reported"})]})]},r.id))})]})})]}):(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:[n?"No fast responses in this period.":"No decision requests in this period."," ",(0,e.jsx)(Qe,{to:n&&!a?"/company/settings/instance/experimental":"/company/settings/connections",className:"underline underline-offset-4",children:n?a?"Configure fast response":"Enable experimental fast responses":"Configure a decision model"})," to run a test."]})}i(Vs,"DecisionHistoryTable");function Zt({companyId:t,from:n,to:a}){const r=q({queryKey:["decision-history",t,n,a],queryFn:i(()=>Yt.history(t,n,a),"queryFn"),refetchInterval:i(l=>l.state.data?.some(g=>g.status==="running")?5e3:!1,"refetchInterval")});return r.isPending?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading decision requests…"}):r.error?(0,e.jsxs)("div",{role:"alert",className:"space-y-2",children:[(0,e.jsx)("p",{className:"text-sm text-destructive",children:"Could not load decision requests."}),(0,e.jsx)(ee,{variant:"outline",onClick:i(()=>{r.refetch()},"onClick"),children:"Try again"})]}):(0,e.jsx)(Vs,{entries:r.data??[]})}i(Zt,"DecisionHistory");function Jt({companyId:t,from:n,to:a}){const{enabled:r}=Ht(),l=q({queryKey:["fast-response-history",t,n,a],queryFn:i(()=>Vt.history(t,n??void 0,a??void 0),"queryFn"),refetchInterval:i(g=>g.state.data?.some(u=>["pending","running"].includes(u.status)||["pending","streaming","retry"].includes(u.publicationStatus))?3e3:!1,"refetchInterval")});return l.isPending?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading fast responses…"}):l.error?(0,e.jsxs)("div",{role:"alert",children:[(0,e.jsx)("p",{className:"text-sm text-destructive",children:"Could not load fast responses."}),(0,e.jsx)(ee,{variant:"outline",onClick:i(()=>{l.refetch()},"onClick"),children:"Try again"})]}):(0,e.jsx)(Vs,{entries:l.data??[],fastResponse:!0,fastResponsesEnabled:r})}i(Jt,"FastResponseHistory");var p=Us(Rt(),1),Ve={report(t,n,a){const r=new URLSearchParams;return n&&r.set("from",n),a&&r.set("to",a),!n&&!a&&r.set("period","all"),qe.get(`/companies/${t}/costs/subscriptions?${r}`)},refresh:i(t=>qe.post(`/companies/${t}/costs/subscriptions/refresh`,{}),"refresh"),update:i((t,n,a)=>qe.patch(`/companies/${t}/costs/subscriptions/${n}`,a),"update"),link:i((t,n,a,r,l)=>qe.post(`/companies/${t}/costs/subscriptions/${n}/link`,{targetId:a,expectedRevision:r,targetRevision:l}),"link")};function Es(t,n){return n==="USD"?j(Number(t)):new Intl.NumberFormat(void 0,{style:"currency",currency:n,currencyDisplay:"code"}).format(Number(t)/100)}i(Es,"subscriptionMoney");function is({usage:t}){return(0,e.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:[I(t.inputTokens+t.cachedInputTokens)," in · ",I(t.outputTokens)," out",t.cachedInputTokens>0&&(0,e.jsxs)("span",{className:"block",children:[I(t.cachedInputTokens)," input cached"]})]})}i(is,"SubscriptionTokenUsage");function Xt({account:t,accounts:n,companyId:a,onDone:r}){const[l,g]=(0,p.useState)(t.price.plan),[u,E]=(0,p.useState)(t.price.amountCents==null?"":vt(t.price.amountCents).replace(/\.?0+$/,"")),[U,B]=(0,p.useState)(t.price.currency),[v,c]=(0,p.useState)(t.price.cadence),[T,R]=(0,p.useState)(t.price.status),[L,$]=(0,p.useState)(""),G=Ae({mutationFn:i(()=>Ve.update(a,t.id,{expectedRevision:t.price.revision,plan:l,amountCents:u.trim()?ht(u.trim()):null,currency:U,cadence:v,status:T}),"mutationFn"),onSuccess:r}),K=Ae({mutationFn:i(()=>Ve.link(a,t.id,L,t.price.revision,n.find(C=>C.id===L).price.revision),"mutationFn"),onSuccess:r}),z=n.filter(C=>C.id!==t.id&&C.provider===t.provider&&C.canEdit),w=G.isPending||K.isPending,k="h-9 rounded-md border border-input bg-background px-3 text-sm";return(0,e.jsxs)("div",{className:"space-y-5",children:[(0,e.jsxs)("form",{className:"space-y-4",onSubmit:i(C=>{C.preventDefault(),G.mutate()},"onSubmit"),children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(Pe,{htmlFor:"subscription-plan",children:"Plan"}),(0,e.jsx)(ws,{id:"subscription-plan",value:l,onChange:i(C=>g(C.target.value),"onChange"),required:!0,maxLength:100})]}),(0,e.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(Pe,{htmlFor:"subscription-price",children:"Price per billing period"}),(0,e.jsx)(ws,{id:"subscription-price",type:"number",min:"0",step:"any",value:u,placeholder:"Unknown",onChange:i(C=>E(C.target.value),"onChange")})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(Pe,{htmlFor:"subscription-currency",children:"Currency"}),(0,e.jsx)("select",{id:"subscription-currency",className:k,value:U,onChange:i(C=>B(C.target.value),"onChange"),children:Gs.map(C=>(0,e.jsx)("option",{children:C},C))})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(Pe,{htmlFor:"subscription-cadence",children:"Billed"}),(0,e.jsxs)("select",{id:"subscription-cadence",className:k,value:v,onChange:i(C=>c(C.target.value),"onChange"),children:[(0,e.jsx)("option",{value:"month",children:"Monthly"}),(0,e.jsx)("option",{value:"year",children:"Annually"})]})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(Pe,{htmlFor:"subscription-status",children:"Tracking"}),(0,e.jsxs)("select",{id:"subscription-status",className:k,value:T,onChange:i(C=>R(C.target.value),"onChange"),children:[(0,e.jsx)("option",{value:"active",children:"Active"}),(0,e.jsx)("option",{value:"ended",children:"Subscription ended"}),(0,e.jsx)("option",{value:"excluded",children:"Exclude from this organization"})]})]})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Enter the full amount for one account or seat. Annual prices are divided by 12. Changes apply from now. Ending tracking here does not cancel your provider subscription."}),G.error&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:"Could not save this price. Check the amount, or reopen the account if another person updated it."}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)(ee,{type:"button",variant:"ghost",disabled:w,onClick:r,children:"Cancel"}),(0,e.jsx)(ee,{type:"submit",disabled:w,children:G.isPending?"Saving…":"Save price"})]})]}),z.length>0&&(0,e.jsxs)("div",{className:"space-y-2 border-t border-border pt-4",children:[(0,e.jsx)(Pe,{htmlFor:"subscription-link",children:"Same subscription as another account?"}),(0,e.jsxs)("select",{id:"subscription-link",className:$e(k,"ph-mask ph-sensitive"),value:L,onChange:i(C=>$(C.target.value),"onChange"),children:[(0,e.jsx)("option",{value:"",children:"Choose an account"}),z.map(C=>(0,e.jsxs)("option",{value:C.id,children:[C.name," · ",C.price.plan]},C.id))]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Linking counts these accounts once, combines their Microvac usage, and keeps the selected account’s price. Only link the same subscription or paid seat."}),K.error&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:"Could not link these accounts. Reopen their details and try again."}),(0,e.jsx)(ee,{type:"button",variant:"outline",disabled:!L||w,onClick:i(()=>K.mutate(),"onClick"),children:"Link accounts"})]})]})}i(Xt,"SubscriptionEditor");function en({companyId:t,report:n,error:a,onChanged:r}){const[l,g]=(0,p.useState)(!1),[u,E]=(0,p.useState)(null),U=i(()=>{E(null),r()},"closeEditor"),B=n?.monthlyTotals.length,v=n?.monthlyTotals.reduce((c,T)=>c+T.estimatedCount,0)??0;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(W,{className:"block p-4",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) uppercase tracking-(--tracking-eyebrow) text-muted-foreground",children:"Subscriptions"}),(0,e.jsx)("div",{className:"mt-2 font-mono text-2xl font-semibold tabular-nums",children:B?n.monthlyTotals.map(c=>(0,e.jsxs)("div",{children:[Es(c.amountCents,c.currency),(0,e.jsx)("span",{className:"text-sm font-normal",children:"/month"})]},c.currency)):n&&n.activeCount===0&&n.accounts.length>0?"$0.00/month":"—"}),(0,e.jsxs)("div",{className:"mt-1 space-y-1 text-xs text-muted-foreground",children:[n?(0,e.jsxs)(e.Fragment,{children:[v>0&&(0,e.jsx)("div",{children:(0,e.jsx)(We,{variant:"outline",className:"font-normal text-muted-foreground",children:v<n.activeCount-n.unknownPriceCount?"Partially estimated":"Estimated"})}),n.unknownPriceCount>0&&!!B&&(0,e.jsx)("div",{children:"Known monthly subtotal"}),(0,e.jsx)("div",{children:n.accounts.length===0?"No visible subscriptions":(0,e.jsxs)(e.Fragment,{children:[n.activeCount," active ",n.activeCount===1?"subscription":"subscriptions",n.unknownPriceCount>0&&` · ${n.unknownPriceCount} ${n.unknownPriceCount===1?"price":"prices"} unknown`]})}),n.accounts.length>0&&(0,e.jsx)("div",{children:"Monthly fees for accounts visible to you"}),n.unidentifiedAccountCount>0&&(0,e.jsxs)("div",{children:[n.unidentifiedAccountCount," unconfirmed ",n.unidentifiedAccountCount===1?"account identity":"account identities"]}),(0,e.jsx)(is,{usage:n.subscription})]}):a?(0,e.jsx)("div",{children:"Subscription data is unavailable."}):(0,e.jsx)("div",{children:"Loading subscriptions…"}),n&&a?(0,e.jsx)("div",{children:"Showing last loaded subscription data."}):null]}),(0,e.jsx)(ee,{variant:"link",size:"sm",className:"h-auto p-0",onClick:i(()=>g(!0),"onClick"),disabled:!n,children:"View details"})]}),(0,e.jsx)(qt,{open:l,onOpenChange:i(c=>{g(c),c||E(null)},"onOpenChange"),children:(0,e.jsxs)(Ft,{className:"max-h-(--sz-80vh) overflow-y-auto sm:max-w-3xl",children:[(0,e.jsxs)(Mt,{children:[(0,e.jsx)(Bt,{children:u?"Subscription price":"Subscriptions"}),(0,e.jsx)(Kt,{children:"Current monthly costs for accounts visible to you. Token totals cover company work in the selected period."})]}),u?(0,e.jsx)(Xt,{companyId:t,account:u,accounts:n?.accounts??[],onDone:U},u.id):(0,e.jsxs)("div",{className:"space-y-4",children:[n?.accounts.length===0&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No subscriptions are visible to you yet. Connect an AI account or run an agent with a connected subscription."}),n?.accounts.map(c=>(0,e.jsxs)("div",{className:"space-y-2 border-b border-border pb-4 last:border-0",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:Ls,children:[(0,e.jsx)("div",{className:"font-medium",children:c.name}),(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:[c.shared?"Shared":c.ownerName??(c.ownerUserId?"Account owner":"Personal accounts")," · ",se(c.provider)," · ",c.price.plan]})]}),(0,e.jsxs)("div",{className:"text-right",children:[(0,e.jsx)("div",{className:"font-mono",children:c.price.status!=="active"?c.price.status==="ended"?"Ended":"Excluded":c.price.monthlyCents==null?"Price unknown":`${Es(c.price.monthlyCents,c.price.currency)}/month`}),(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:[c.price.source==="catalog"?"Estimated · before tax":c.price.source==="user"?"User supplied":"",c.price.cadence==="year"?" · annual payment ÷ 12":""]})]})]}),(0,e.jsx)(is,{usage:c.usage}),Number(c.usage.costCents)>0&&(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:[j(Number(c.usage.costCents))," recorded usage charges in selected period, separate from the subscription fee."]}),c.agents.length>0&&(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Used by ",c.agents.map(T=>T.name).join(", ")]}),!c.identityVerified&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Account identity is unconfirmed. Link duplicates if these connections use the same subscription."}),c.observedAt&&(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Plan checked ",Ce(c.observedAt),c.refreshStatus==="unavailable"?" · latest check unavailable":""]}),c.refreshStatus==="unavailable"&&!c.observedAt&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"The provider did not make plan details available. You can enter the price yourself."}),c.canEdit&&(0,e.jsx)("div",{children:(0,e.jsx)(ee,{variant:"outline",size:"sm",onClick:i(()=>E(c),"onClick"),children:"Edit price"})})]},c.id)),!!n?.unattributedSubscription.eventCount&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Some subscription usage has no recorded account. It is included in the subscription token total."}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Monthly fees cover the whole account, including use outside Microvac. They are separate from recorded charges and agent budgets. Currencies are totaled separately."})]})]})})]})}i(en,"SubscriptionCostCard");function sn({report:t}){return(0,e.jsxs)(W,{className:"min-w-0 max-w-full gap-3 py-4",children:[(0,e.jsx)(oe,{className:"gap-0 px-5",children:(0,e.jsx)(ie,{className:"text-base",children:"By user"})}),(0,e.jsxs)(X,{className:"min-w-0 px-5",children:[(0,e.jsx)("div",{className:"max-w-full overflow-x-auto",children:(0,e.jsxs)("table",{"aria-label":"Costs by user",className:"w-full text-sm",children:[(0,e.jsx)("thead",{className:"text-muted-foreground",children:(0,e.jsxs)("tr",{className:"border-b border-border",children:[(0,e.jsx)("th",{scope:"col",className:"py-2 pr-4 text-left font-medium",children:"User"}),(0,e.jsx)("th",{scope:"col",className:"px-4 py-2 text-right font-medium",children:"Runs"}),(0,e.jsx)("th",{scope:"col",className:"px-4 py-2 text-right font-medium",children:"Input"}),(0,e.jsx)("th",{scope:"col",className:"px-4 py-2 text-right font-medium",children:"Output"}),(0,e.jsx)("th",{scope:"col",className:"py-2 pl-4 text-right font-medium",children:"Cost"})]})}),(0,e.jsxs)("tbody",{children:[t.rows.length===0&&(0,e.jsx)("tr",{children:(0,e.jsx)("td",{colSpan:5,className:"py-3 text-muted-foreground",children:"No user-attributed costs yet."})}),t.rows.map(n=>(0,e.jsxs)("tr",{className:"border-b border-border last:border-0",children:[(0,e.jsx)("th",{scope:"row",className:"py-3 pr-4 text-left font-normal",children:n.userId?(0,e.jsx)(Pt,{name:n.userName??"Unknown user",avatarUrl:n.userImage}):"Unattributed"}),(0,e.jsx)("td",{className:"px-4 py-3 text-right tabular-nums",children:n.runCount.toLocaleString()}),(0,e.jsxs)("td",{className:"px-4 py-3 text-right tabular-nums",children:[I(n.inputTokens+n.cachedInputTokens),n.cachedInputTokens>0&&(0,e.jsxs)("div",{className:"whitespace-nowrap text-xs text-muted-foreground",children:[I(n.cachedInputTokens)," cached"]})]}),(0,e.jsx)("td",{className:"px-4 py-3 text-right tabular-nums",children:I(n.outputTokens)}),(0,e.jsxs)("td",{className:"py-3 pl-4 text-right tabular-nums",children:[(0,e.jsx)(we,{costCents:n.costCents,eventCount:n.eventCount,estimatedEventCount:n.estimatedEventCount,unpricedEventCount:n.unpricedEventCount}),n.unpricedEventCount>0&&(0,e.jsxs)("div",{className:"whitespace-nowrap text-xs text-muted-foreground",children:[n.unpricedEventCount," unpriced ",n.unpricedEventCount===1?"charge":"charges"]})]})]},n.userId??"unattributed"))]})]})}),t.rows.some(n=>n.userId===null)&&(0,e.jsx)("p",{className:"mt-3 text-xs text-muted-foreground",children:"Unattributed costs have no recorded user in this organization."})]})]})}i(sn,"CostByUserTable");var tn={unknown_billing:{label:"Billing category unknown",description:"This run did not identify API or subscription billing. Any recorded charges are included in the inference ledger. For future runs, select an AI connection in the agent’s configuration so Microvac can identify its billing."},missing_model:{label:"Model not reported",description:"Token usage was recorded without a model, so Microvac cannot estimate its cost. Select an explicit model in the agent’s configuration for future runs. Changing settings will not reprice this past run."},missing_price:{label:"Cost unavailable",description:"The provider did not supply a reliable price for this usage. There is no action required for this past entry. New API runs with complete usage and a supported model are estimated automatically."},waiting_for_receipt:{label:"Receiving usage",description:"This run has stopped. Microvac is waiting for its final usage data and will record it automatically. You do not need to rerun the agent."},receipt_unavailable:{label:"Final usage unavailable",description:"This run stopped without final usage data. Its cost remains unresolved for budget checks. Microvac will record a late receipt if one arrives; rerunning the agent will not recover this usage."},retryable:{label:"Ready to record",description:"Saved usage data is ready to be recorded. Microvac retries automatically, or you can retry now. This records costs only; it does not rerun the agent."}};function nn({companyId:t,from:n,to:a,reportKey:r,unpricedCount:l,pendingCount:g,unknownBillingCount:u}){const[E,U]=(0,p.useState)(!1),B=l+g,v=B>0||u>0,c=(0,p.useId)(),T=qs(),{pushToast:R}=wt(),L=[...r,"data-quality"],{data:$,error:G,isPending:K,refetch:z}=q({queryKey:L,queryFn:i(()=>_.dataQuality(t,n,a),"queryFn"),enabled:E&&v,refetchInterval:E&&v?3e4:!1}),w=Ae({mutationFn:i(h=>_.retryAccounting(t,h),"mutationFn"),onSuccess:i(h=>{R({title:h.accounted?"Costs recorded.":"No new cost data is available.",body:"The agent was not rerun.",tone:h.accounted?"success":"info"}),T.invalidateQueries({queryKey:["costs",t]}),T.invalidateQueries({queryKey:L}),T.invalidateQueries({queryKey:["cost-subscriptions",t]})},"onSuccess")}),k=B>0?`${B} run ${B===1?"cost":"costs"} unavailable`:`${u} billing ${u===1?"type":"types"} unknown`,C=new Map;for(const[h,D]of[["event",$?.events??[]],["run",$?.runs??[]]])for(const y of D){let A=C.get(y.agentId);A||(A={agent:{id:y.agentId??void 0,name:y.agentName??(y.agentId?"Unknown agent":"Microvac services"),appearance:y.agentAppearance},items:[]},C.set(y.agentId,A)),A.items.push({item:y,source:h})}const ve=[...C.values()].sort((h,D)=>h.agent.name.localeCompare(D.agent.name,"en",{sensitivity:"base",numeric:!0})||(h.agent.id??"").localeCompare(D.agent.id??""));for(const h of ve)h.items.sort((D,y)=>Date.parse(y.item.occurredAt)-Date.parse(D.item.occurredAt)||`${D.source}:${D.item.id}`.localeCompare(`${y.source}:${y.item.id}`));function ke(h,D){const y=tn[h.reason];return(0,e.jsxs)("li",{className:"space-y-2 border-b border-border py-3 last:border-0",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(We,{variant:"outline",className:"font-normal text-muted-foreground",children:y.label}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(0,e.jsx)("time",{dateTime:h.occurredAt,children:Ce(h.occurredAt)}),h.runId&&h.agentId&&(0,e.jsx)(Qe,{className:"text-primary underline underline-offset-4 hover:text-primary/80",to:`/agents/${h.agentId}/runs/${h.runId}`,children:"View run"}),h.reason==="retryable"&&h.runId&&$?.canRetry&&(0,e.jsx)(ee,{type:"button",variant:"link",size:"sm",className:"h-auto p-0 text-xs font-normal underline hover:text-primary/80",disabled:w.isPending,onClick:i(()=>{w.reset(),w.mutate(h.runId)},"onClick"),children:"Retry cost recording"})]})]}),(0,e.jsx)("p",{children:y.description}),w.variables===h.runId&&w.isPending&&(0,e.jsx)("p",{role:"status",children:"Recording saved costs…"}),w.variables===h.runId&&w.error&&(0,e.jsx)("p",{role:"status",children:"Cost recording failed. Try again shortly."})]},`${D}:${h.id}`)}return i(ke,"itemRow"),(0,e.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,e.jsxs)(ee,{type:"button",variant:"ghost",size:"sm",className:"h-auto justify-start gap-1 px-0 py-1 font-normal has-[>svg]:px-0","aria-expanded":E,"aria-controls":c,onClick:i(()=>U(h=>!h),"onClick"),children:[E?(0,e.jsx)(Os,{className:"size-3","aria-hidden":"true"}):(0,e.jsx)(Qs,{className:"size-3","aria-hidden":"true"}),k]}),E&&(0,e.jsxs)("div",{id:c,className:"space-y-2",children:[v&&K&&(0,e.jsx)("p",{role:"status",children:"Loading affected runs…"}),v&&G&&!$&&(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("p",{role:"status",children:"Cost details could not be loaded."}),(0,e.jsx)(ee,{variant:"outline",size:"sm",onClick:i(()=>z(),"onClick"),children:"Retry loading"})]}),v&&$&&(0,e.jsxs)(e.Fragment,{children:[G&&(0,e.jsx)("p",{role:"status",children:"Showing the last loaded cost details. Updates will resume automatically."}),$.events.length===0&&$.runs.length===0&&(0,e.jsx)("p",{role:"status",children:"No cost gaps remain in this period."}),(0,e.jsx)("ul",{"aria-label":"Cost details by agent",className:"space-y-4",children:ve.map(h=>(0,e.jsxs)("li",{children:[(0,e.jsxs)("h3",{className:"flex items-center gap-2 font-medium text-foreground",children:[(0,e.jsx)($t,{agent:h.agent,size:20}),h.agent.id?(0,e.jsx)(Qe,{className:"text-primary underline underline-offset-4 hover:text-primary/80",to:`/agents/${h.agent.id}/configuration`,children:h.agent.name}):h.agent.name]}),(0,e.jsx)("ul",{"aria-label":`${h.agent.name} cost details`,children:h.items.map(({item:D,source:y})=>ke(D,y))})]},h.agent.id??"services"))}),($.hasMoreEvents||$.hasMoreRuns)&&(0,e.jsx)("p",{className:"text-xs",children:"Showing the 25 most recent entries in each category. Select a shorter date range to inspect more."})]})]})]})}i(nn,"CostDataQualityNotice");function $s({row:t,weekSpendCents:n,budgetMonthlyCents:a,showBudgetUtilization:r=!0,totalCompanySpendCents:l,providerRows:g}){const u=(0,p.useMemo)(()=>{const v=new Map;for(const c of g){const T=v.get(c.provider)??{provider:c.provider,costCents:0,inputTokens:0,outputTokens:0};T.costCents+=c.costCents,T.inputTokens+=c.inputTokens+c.cachedInputTokens,T.outputTokens+=c.outputTokens,v.set(c.provider,T)}return Array.from(v.values()).sort((c,T)=>T.costCents-c.costCents)},[g]),E=(0,p.useMemo)(()=>{const v=new Map;for(const c of g)v.set(c.billingType,(v.get(c.billingType)??0)+c.costCents);return Array.from(v.entries()).sort((c,T)=>T[1]-c[1])},[g]),U=a,B=U>0?Math.min(100,t.costCents/U*100):0;return(0,e.jsxs)(W,{children:[(0,e.jsx)(oe,{className:"px-4 pt-4 pb-0 gap-1",children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)(ie,{className:"text-sm font-semibold",children:se(t.biller)}),(0,e.jsxs)(be,{className:"text-xs mt-0.5",children:[(0,e.jsx)("span",{className:"font-mono",children:I(t.inputTokens+t.cachedInputTokens)})," in"," · ",(0,e.jsx)("span",{className:"font-mono",children:I(t.outputTokens)})," out"," · ",t.providerCount," provider",t.providerCount===1?"":"s"," · ",t.modelCount," model",t.modelCount===1?"":"s"]})]}),(0,e.jsx)("div",{className:"text-xl shrink-0",children:(0,e.jsx)(we,{costCents:t.costCents,eventCount:t.eventCount,estimatedEventCount:t.estimatedEventCount,unpricedEventCount:t.unpricedEventCount,showUnavailableCount:!0})})]})}),(0,e.jsxs)(X,{className:"px-4 pb-4 pt-3 space-y-4",children:[r&&a>0&&(0,e.jsx)(Ge,{label:"Period spend",percentUsed:B,leftLabel:j(t.costCents),rightLabel:`${Math.round(B)}% of company budget`}),(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:[t.apiRunCount>0?`${t.apiRunCount} metered run${t.apiRunCount===1?"":"s"}`:"0 metered runs"," · ",t.subscriptionRunCount>0?`${t.subscriptionRunCount} subscription run${t.subscriptionRunCount===1?"":"s"}`:"0 subscription runs"," · ",j(n)," this week"]}),E.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"border-t border-border"}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Billing types"}),(0,e.jsx)("div",{className:"space-y-1.5",children:E.map(([v,c])=>(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:cs(v)}),(0,e.jsx)("span",{className:"font-medium tabular-nums",children:j(c)})]},v))})]})]}),u.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"border-t border-border"}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Upstream providers"}),(0,e.jsx)("div",{className:"space-y-1.5",children:u.map(v=>(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:se(v.provider)}),(0,e.jsxs)("div",{className:"text-right tabular-nums",children:[(0,e.jsx)("div",{className:"font-medium",children:j(v.costCents)}),(0,e.jsxs)("div",{className:"text-muted-foreground",children:[I(v.inputTokens+v.outputTokens)," tok"]})]})]},v.provider))})]})]})]})]})}i($s,"BillerSpendCard");function an({row:t}){return(0,e.jsxs)(W,{children:[(0,e.jsx)(oe,{className:"px-4 pt-4 pb-1",children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)(ie,{className:"text-base",children:se(t.biller)}),(0,e.jsxs)(be,{className:"mt-1 text-xs",children:[t.eventCount," event",t.eventCount===1?"":"s"," across ",t.kindCount," kind",t.kindCount===1?"":"s"]})]}),(0,e.jsxs)("div",{className:"text-right",children:[(0,e.jsx)("div",{className:"text-lg font-semibold tabular-nums",children:j(t.netCents,t.currency)}),(0,e.jsx)("div",{className:"text-(length:--text-micro) uppercase tracking-(--tracking-eyebrow) text-muted-foreground",children:"net"})]})]})}),(0,e.jsx)(X,{className:"space-y-3 px-4 pb-4 pt-3",children:(0,e.jsxs)("div",{className:"grid gap-2 text-sm sm:grid-cols-3",children:[(0,e.jsxs)("div",{className:"border border-border p-3",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) uppercase tracking-(--tracking-eyebrow) text-muted-foreground",children:"debits"}),(0,e.jsx)("div",{className:"mt-1 font-medium tabular-nums",children:j(t.debitCents,t.currency)})]}),(0,e.jsxs)("div",{className:"border border-border p-3",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) uppercase tracking-(--tracking-eyebrow) text-muted-foreground",children:"credits"}),(0,e.jsx)("div",{className:"mt-1 font-medium tabular-nums",children:j(t.creditCents,t.currency)})]}),(0,e.jsxs)("div",{className:"border border-border p-3",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) uppercase tracking-(--tracking-eyebrow) text-muted-foreground",children:"estimated"}),(0,e.jsx)("div",{className:"mt-1 font-medium tabular-nums",children:j(t.estimatedDebitCents,t.currency)})]})]})})]})}i(an,"FinanceBillerCard");function rn({rows:t}){return(0,e.jsxs)(W,{children:[(0,e.jsxs)(oe,{className:"px-4 pt-4 pb-1",children:[(0,e.jsx)(ie,{className:"text-base",children:"Financial event mix"}),(0,e.jsx)(be,{children:"Account-level charges grouped by event kind."})]}),(0,e.jsx)(X,{className:"space-y-2 px-4 pb-4 pt-3",children:t.length===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No finance events in this period."}):t.map(n=>(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3 border border-border px-3 py-2",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"truncate text-sm font-medium",children:zs(n.eventKind)}),(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:[n.eventCount," event",n.eventCount===1?"":"s"," · ",n.billerCount," biller",n.billerCount===1?"":"s"]})]}),(0,e.jsxs)("div",{className:"text-right tabular-nums",children:[(0,e.jsx)("div",{className:"text-sm font-medium",children:j(n.netCents,n.currency)}),(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:[j(n.debitCents,n.currency)," debits"]})]})]},`${n.eventKind}:${n.currency}`))})]})}i(rn,"FinanceKindCard");function on({rows:t,emptyMessage:n="No financial events recorded in this period. Events appear when reported through the API, CLI, or a supported integration."}){return(0,e.jsxs)(W,{children:[(0,e.jsxs)(oe,{className:"px-4 pt-4 pb-1",children:[(0,e.jsx)(ie,{className:"text-base",children:"Recent financial events"}),(0,e.jsx)(be,{children:"Provider charges, subscriptions, fees, and credits. Reported separately from run-cost estimates."})]}),(0,e.jsx)(X,{className:"space-y-3 px-4 pb-4 pt-3",children:t.length===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:n}):t.map(a=>(0,e.jsx)("div",{className:"border border-border p-3",children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-2",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(We,{variant:"secondary",children:a.metadataJson?.source==="provider_cost_report"?"Provider cost report":zs(a.eventKind)}),(0,e.jsx)(We,{variant:a.direction==="credit"?"outline":"secondary",children:Ct(a.direction)}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:Ce(a.occurredAt)})]}),(0,e.jsxs)("div",{className:"text-sm font-medium",children:[se(a.biller),a.provider?` -> ${se(a.provider)}`:"",a.model?(0,e.jsx)("span",{className:"ml-1 font-mono text-xs text-muted-foreground",children:a.model}):null]}),(a.description||a.externalInvoiceId||a.region||a.pricingTier)&&(0,e.jsxs)("div",{className:"space-y-1 text-xs text-muted-foreground",children:[a.description?(0,e.jsx)("div",{children:a.description}):null,a.externalInvoiceId?(0,e.jsxs)("div",{children:["invoice ",a.externalInvoiceId]}):null,a.region?(0,e.jsxs)("div",{children:["region ",a.region]}):null,a.pricingTier?(0,e.jsxs)("div",{children:["tier ",a.pricingTier]}):null]})]}),(0,e.jsxs)("div",{className:"text-right tabular-nums",children:[(0,e.jsx)("div",{className:"text-sm font-semibold",children:j(a.amountCents,a.currency)}),(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:a.currency}),a.estimated?(0,e.jsx)("div",{className:"text-(length:--text-micro) uppercase tracking-(--tracking-eyebrow) text-amber-600",children:"estimated"}):null]})]})},a.id))})]})}i(on,"FinanceTimelineCard");var ln=new Set(["credentials_unavailable","authentication_required","refresh_token_reused","refresh_token_expired","refresh_token_invalidated"]);function cn(t,n){return n.map(a=>{if(a.ok||a.errorFamily&&ln.has(a.errorFamily))return a;const r=t?.find(l=>l.provider===a.provider&&l.accountKey===a.accountKey);return r?.windows.length?{...a,windows:r.windows,source:r.source,capturedAt:r.capturedAt}:a})}i(cn,"retainQuotaWindows");function Ye(t){return t?"Showing the last available quota. Updates will resume automatically.":"Subscription quota is currently unavailable. Check usage with your provider."}i(Ye,"quotaUnavailableMessage");function dn({accounts:t,failed:n}){return(0,e.jsx)("div",{className:"space-y-4",children:t.map(a=>(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("p",{className:$e("text-sm font-medium",Ls),children:a.accountLabel??"Subscription account"}),(n||!a.ok)&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:a.errorFamily==="credentials_unavailable"?"Connect or reconnect a subscription in AI connections to view its quota.":Ye(a.windows.length>0)}),a.windows.map((r,l)=>r.usedPercent==null?(0,e.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,e.jsxs)("div",{className:"flex justify-between gap-3",children:[(0,e.jsx)("span",{children:r.label}),(0,e.jsx)("span",{className:"font-mono text-muted-foreground",children:r.valueLabel??"Usage not reported"})]}),r.resetsAt&&(0,e.jsxs)("p",{className:"text-xs font-mono text-muted-foreground",children:["Resets ",Ce(r.resetsAt)]})]},`${r.label}:${l}`):(0,e.jsx)(Ge,{className:"font-mono",label:r.label,percentUsed:r.usedPercent,leftLabel:r.valueLabel??(r.usedPercent===null?"Usage not reported":`${r.usedPercent}% used`),rightLabel:r.resetsAt?`Resets ${Ce(r.resetsAt)}`:void 0},`${r.label}:${l}`)),a.capturedAt&&(0,e.jsxs)("p",{className:"text-xs font-mono text-muted-foreground",children:["Last checked ",Ce(a.capturedAt)]})]},a.accountKey??a.provider))})}i(dn,"AccountQuotaPanels");var Ke=["currentsession","currentweekallmodels","currentweeksonnetonly","currentweeksonnet","currentweekopusonly","currentweekopus","extrausage"];function os(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"")}i(os,"normalizeLabel$1");function un(t){return typeof t.detail=="string"&&t.detail.trim().length>0?t.detail.trim():t.resetsAt?`Resets ${new Date(t.resetsAt).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"})}`:null}i(un,"detailText$1");function mn(t){return[...t].sort((n,a)=>{const r=Ke.indexOf(os(n.label)),l=Ke.indexOf(os(a.label));return(r===-1?Ke.length:r)-(l===-1?Ke.length:l)})}i(mn,"orderedWindows$1");function xn(t){return t==null?"bg-zinc-700":t>=90?"bg-(--status-task-blocked)":t>=70?"bg-(--status-task-todo)":"bg-primary/70"}i(xn,"fillClass$1");function pn({windows:t,source:n=null,error:a=null}){const r=mn(t);return(0,e.jsxs)("div",{className:"border border-border px-4 py-4",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3 border-b border-border pb-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) font-semibold uppercase tracking-(--tracking-caps) text-muted-foreground",children:"Anthropic subscription"}),(0,e.jsx)("div",{className:"mt-1 text-sm text-muted-foreground",children:"Quota from the Claude subscription connected to this server."})]}),n?(0,e.jsx)("span",{className:"shrink-0 border border-border px-2.5 py-1 text-(length:--text-nano) font-semibold uppercase tracking-(--tracking-eyebrow) text-muted-foreground",children:ds(n)}):null]}),a?(0,e.jsx)("div",{role:"status",className:"mt-4 text-sm text-muted-foreground",children:Ye(t.length>0)}):null,(0,e.jsx)("div",{className:"mt-4 space-y-4",children:r.map(l=>{const g=os(l.label),u=un(l);if(g==="extrausage")return(0,e.jsxs)("div",{className:"border border-border px-3.5 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-foreground",children:l.label}),l.valueLabel?(0,e.jsx)("div",{className:"text-sm font-medium text-foreground",children:l.valueLabel}):null]}),u?(0,e.jsx)("div",{className:"mt-2 text-sm text-muted-foreground",children:u}):null]},l.label);const E=Math.min(100,Math.max(0,l.usedPercent??0));return(0,e.jsxs)("div",{className:"border border-border px-3.5 py-3",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-foreground",children:l.label}),u?(0,e.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:u}):null]}),l.usedPercent!=null?(0,e.jsxs)("div",{className:"shrink-0 text-sm font-semibold tabular-nums text-foreground",children:[l.usedPercent,"% used"]}):null]}),(0,e.jsx)("div",{className:"mt-3 h-2 overflow-hidden bg-muted",children:(0,e.jsx)("div",{className:$e("h-full transition-(--tp-width) duration-200",xn(l.usedPercent)),style:{width:`${E}%`}})})]},l.label)})})]})}i(pn,"ClaudeSubscriptionPanel");var ze=["5hlimit","weeklylimit","credits"];function ls(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"")}i(ls,"normalizeLabel");function hn(t){return[...t].sort((n,a)=>{const r=ls(n.label).replace(/^gpt53codexspark/,""),l=ls(a.label).replace(/^gpt53codexspark/,""),g=ze.indexOf(r),u=ze.indexOf(l);return(g===-1?ze.length:g)-(u===-1?ze.length:u)})}i(hn,"orderedWindows");function gn(t){return typeof t.detail=="string"&&t.detail.trim().length>0?t.detail.trim():t.resetsAt?`Resets ${new Date(t.resetsAt).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"})}`:null}i(gn,"detailText");function bn(t){return t==null?"bg-zinc-700":t>=90?"bg-(--status-task-blocked)":t>=70?"bg-(--status-task-todo)":"bg-primary/70"}i(bn,"fillClass");function Ds(t){const n=ls(t);return n.includes("gpt53codexspark")||n.includes("gpt5")}i(Ds,"isModelSpecific");function vn({windows:t,source:n=null,error:a=null}){const r=hn(t),l=r.filter(u=>!Ds(u.label)),g=r.filter(u=>Ds(u.label));return(0,e.jsxs)("div",{className:"border border-border px-4 py-4",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3 border-b border-border pb-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) font-semibold uppercase tracking-(--tracking-caps) text-muted-foreground",children:"Codex subscription"}),(0,e.jsx)("div",{className:"mt-1 text-sm text-muted-foreground",children:"Quota from the Codex subscription connected to this server."})]}),n?(0,e.jsx)("span",{className:"shrink-0 border border-border px-2.5 py-1 text-(length:--text-nano) font-semibold uppercase tracking-(--tracking-eyebrow) text-muted-foreground",children:ds(n)}):null]}),a?(0,e.jsx)("div",{role:"status",className:"mt-4 text-sm text-muted-foreground",children:Ye(t.length>0)}):null,(0,e.jsxs)("div",{className:"mt-4 space-y-5",children:[(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) font-semibold uppercase tracking-(--tracking-caps) text-muted-foreground",children:"Account windows"}),(0,e.jsx)("div",{className:"space-y-3",children:l.map(u=>(0,e.jsx)(Fs,{window:u},u.label))})]}),g.length>0?(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) font-semibold uppercase tracking-(--tracking-caps) text-muted-foreground",children:"Model windows"}),(0,e.jsx)("div",{className:"space-y-3",children:g.map(u=>(0,e.jsx)(Fs,{window:u},u.label))})]}):null]})]})}i(vn,"CodexSubscriptionPanel");function Fs({window:t}){const n=gn(t);return t.usedPercent==null?(0,e.jsxs)("div",{className:"border border-border px-3.5 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-foreground",children:t.label}),t.valueLabel?(0,e.jsx)("div",{className:"text-sm font-semibold tabular-nums text-foreground",children:t.valueLabel}):null]}),n?(0,e.jsx)("div",{className:"mt-2 text-xs text-muted-foreground",children:n}):null]}):(0,e.jsxs)("div",{className:"border border-border px-3.5 py-3",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"text-sm font-medium text-foreground",children:t.label}),n?(0,e.jsx)("div",{className:"mt-1 text-xs text-muted-foreground",children:n}):null]}),(0,e.jsxs)("div",{className:"shrink-0 text-sm font-semibold tabular-nums text-foreground",children:[t.usedPercent,"% used"]})]}),(0,e.jsx)("div",{className:"mt-3 h-2 overflow-hidden bg-muted",children:(0,e.jsx)("div",{className:$e("h-full transition-(--tp-width) duration-200",bn(t.usedPercent)),style:{width:`${Math.max(0,Math.min(100,t.usedPercent))}%`}})})]})}i(Fs,"QuotaWindowRow");var fn=["5h","24h","7d"];function Bs({provider:t,rows:n,budgetMonthlyCents:a,showBudgetUtilization:r=!0,totalCompanySpendCents:l,weekSpendCents:g,windowRows:u,showDeficitNotch:E,quotaAccounts:U,quotaRequestFailed:B,quotaWindows:v=[],quotaError:c=null,quotaSource:T=null,quotaLoading:R=!1}){const L=(0,p.useMemo)(()=>{let d=0,b=0,Z=0,ce=0,fe=0,de=0,O=0,De=0,Te=0,Me=0;for(const Q of n)d+=Q.inputTokens+Q.cachedInputTokens,b+=Q.outputTokens,Z+=Q.costCents,De+=Q.eventCount??0,Te+=Q.estimatedEventCount??0,Me+=Q.unpricedEventCount??0,ce+=Q.apiRunCount,fe+=Q.subscriptionRunCount,de+=Q.subscriptionInputTokens+Q.subscriptionCachedInputTokens,O+=Q.subscriptionOutputTokens;const xe=d+b,le=de+O,N=xe;return{totalInputTokens:d,totalOutputTokens:b,totalTokens:xe,totalCostCents:Z,eventCount:De,estimatedEventCount:Te,unpricedEventCount:Me,totalApiRuns:ce,totalSubRuns:fe,totalSubInputTokens:de,totalSubOutputTokens:O,totalSubTokens:le,subSharePct:N>0?le/N*100:0}},[n]),{totalInputTokens:$,totalOutputTokens:G,totalTokens:K,totalCostCents:z,totalApiRuns:w,totalSubRuns:k,totalSubInputTokens:C,totalSubOutputTokens:ve,totalSubTokens:ke,subSharePct:h}=L,D=a,y=D>0?Math.min(100,z/D*100):0,A=D>0?D/4.33:0,H=A>0?Math.min(100,g/A*100):0,He=r&&a>0,Ze=(0,p.useMemo)(()=>new Map(u.map(d=>[d.window,d])),[u]),Se=(0,p.useMemo)(()=>Math.max(...u.map(d=>d.costCents),0),[u]),te=t==="anthropic",x=t==="openai"&&T?.startsWith("codex-"),V=(t==="anthropic"||t==="openai")&&(R||!!U?.length||v.length>0||c!=null);return(0,e.jsxs)(W,{children:[(0,e.jsx)(oe,{className:"px-4 pt-4 pb-0 gap-1",children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)(ie,{className:"text-sm font-semibold",children:se(t)}),(0,e.jsxs)(be,{className:"text-xs mt-0.5",children:[(0,e.jsx)("span",{className:"font-mono",children:I($)})," in"," · ",(0,e.jsx)("span",{className:"font-mono",children:I(G)})," out",(w>0||k>0)&&(0,e.jsxs)("span",{className:"ml-1.5",children:["·"," ",w>0&&`~${w} api`,w>0&&k>0&&" / ",k>0&&`~${k} sub`," runs"]})]})]}),(0,e.jsx)("div",{className:"text-xl shrink-0",children:(0,e.jsx)(we,{costCents:z,eventCount:L.eventCount,estimatedEventCount:L.estimatedEventCount,unpricedEventCount:L.unpricedEventCount,showUnavailableCount:!0})})]})}),(0,e.jsxs)(X,{className:"px-4 pb-4 pt-3 space-y-4",children:[He&&(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)(Ge,{label:"Period spend",percentUsed:y,leftLabel:j(z),rightLabel:`${Math.round(y)}% of company budget`,showDeficitNotch:E}),(0,e.jsx)(Ge,{label:"This week",percentUsed:H,leftLabel:j(g),rightLabel:`~${j(Math.round(A))} / wk`,showDeficitNotch:H>=100})]}),u.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"border-t border-border"}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Rolling windows"}),(0,e.jsx)("div",{className:"space-y-2.5",children:fn.map(d=>{const b=Ze.get(d);if(!b)return null;const Z=b.costCents,ce=b.inputTokens+b.cachedInputTokens+b.outputTokens,fe=Se>0?Z/Se*100:0;return(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs",children:[(0,e.jsx)("span",{className:"font-mono text-muted-foreground w-6 shrink-0",children:d}),(0,e.jsxs)("span",{className:"text-muted-foreground font-mono flex-1",children:[I(ce)," tok"]}),(0,e.jsx)("span",{className:"font-medium tabular-nums",children:j(Z)})]}),(0,e.jsx)("div",{className:"h-2 w-full border border-border overflow-hidden",children:(0,e.jsx)("div",{className:"h-full bg-primary/60 transition-(--tp-width) duration-150",style:{width:`${fe}%`}})})]},d)})})]})]}),k>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"border-t border-border"}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Subscription"}),(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"font-mono text-foreground",children:k})," runs"," · ",ke>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"font-mono text-foreground",children:I(ke)})," total"," · "]}),(0,e.jsx)("span",{className:"font-mono text-foreground",children:I(C)})," in"," · ",(0,e.jsx)("span",{className:"font-mono text-foreground",children:I(ve)})," out"]}),h>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"h-1.5 w-full border border-border overflow-hidden",children:(0,e.jsx)("div",{className:"h-full bg-primary/60 transition-(--tp-width) duration-150",style:{width:`${h}%`}})}),(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[Math.round(h),"% of token usage via subscription"]})]})]})]}),n.length>0&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"border-t border-border"}),(0,e.jsx)("div",{className:"space-y-3",children:n.map(d=>{const b=d.inputTokens+d.cachedInputTokens+d.outputTokens,Z=K>0?b/K*100:0,ce=z>0?d.costCents/z*100:0;return(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground truncate font-mono block",children:d.model}),(0,e.jsxs)("span",{className:"text-(length:--text-micro) text-muted-foreground truncate block",children:[se(d.biller)," · ",cs(d.billingType)]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-3 shrink-0 tabular-nums text-xs",children:[(0,e.jsxs)("span",{className:"text-muted-foreground",children:[I(b)," tok"]}),(0,e.jsx)("span",{className:"font-medium",children:j(d.costCents)})]})]}),(0,e.jsxs)("div",{className:"relative h-2 w-full border border-border overflow-hidden",children:[(0,e.jsx)("div",{className:"absolute inset-y-0 left-0 bg-primary/60 transition-(--tp-width) duration-150",style:{width:`${Z}%`},title:`${Math.round(Z)}% of provider tokens`}),(0,e.jsx)("div",{className:"absolute inset-y-0 left-0 bg-primary/85 transition-(--tp-width) duration-150",style:{width:`${ce}%`},title:`${Math.round(ce)}% of provider cost`})]})]},`${d.provider}:${d.model}`)})})]}),V&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"border-t border-border"}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Subscription quota"}),T&&!te&&!x?(0,e.jsx)("span",{className:"text-(length:--text-nano) uppercase tracking-(--tracking-eyebrow) text-muted-foreground",children:ds(T)}):null]}),R?(0,e.jsx)(jn,{}):U?.length?(0,e.jsx)(dn,{accounts:U,failed:B}):te?(0,e.jsx)(pn,{windows:v,source:T,error:c}):x?(0,e.jsx)(vn,{windows:v,source:T,error:c}):(0,e.jsxs)(e.Fragment,{children:[c?(0,e.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:Ye(v.length>0)}):null,(0,e.jsx)("div",{className:"space-y-2.5",children:v.map(d=>{const b=d.usedPercent==null?null:d.usedPercent>=90?"bg-(--status-task-blocked)":d.usedPercent>=70?"bg-(--status-task-todo)":"bg-(--status-task-done)";return(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs",children:[(0,e.jsx)("span",{className:"font-mono text-muted-foreground shrink-0",children:d.label}),(0,e.jsx)("span",{className:"flex-1"}),d.valueLabel!=null?(0,e.jsx)("span",{className:"font-medium tabular-nums",children:d.valueLabel}):d.usedPercent!=null?(0,e.jsxs)("span",{className:"font-medium tabular-nums",children:[d.usedPercent,"% used"]}):null]}),d.usedPercent!=null&&b!=null&&(0,e.jsx)("div",{className:"h-2 w-full border border-border overflow-hidden",children:(0,e.jsx)("div",{className:`h-full transition-(--tp-width) duration-150 ${b}`,style:{width:`${d.usedPercent}%`}})}),d.detail?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:d.detail}):d.resetsAt?(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["resets ",new Date(d.resetsAt).toLocaleDateString(void 0,{month:"short",day:"numeric"})]}):null]},d.label)})})]})]})]})]})]})}i(Bs,"ProviderQuotaCard");function jn(){return(0,e.jsxs)("div",{className:"border border-border px-4 py-4",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3 border-b border-border pb-3",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-2",children:[(0,e.jsx)(ye,{className:"h-3 w-36"}),(0,e.jsx)(ye,{className:"h-4 w-64 max-w-full"})]}),(0,e.jsx)(ye,{className:"h-7 w-28"})]}),(0,e.jsx)("div",{className:"mt-4 space-y-3",children:Array.from({length:3}).map((t,n)=>(0,e.jsxs)("div",{className:"border border-border px-3.5 py-3",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-2",children:[(0,e.jsx)(ye,{className:"h-4 w-32"}),(0,e.jsx)(ye,{className:"h-3 w-44 max-w-full"})]}),(0,e.jsx)(ye,{className:"h-4 w-20"})]}),(0,e.jsx)(ye,{className:"mt-3 h-2 w-full"})]},n))})]})}i(jn,"QuotaPanelSkeleton");var On=pt({Costs:i(()=>kn,"Costs")}),Rs="__none__";function yn(){const t=new Date,n=t.getDay(),a=n===0?-6:1-n,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()+a,0,0,0,0),l=new Date(r.getFullYear(),r.getMonth(),r.getDate()+6,23,59,59,999);return{from:r.toISOString(),to:l.toISOString()}}i(yn,"currentWeekRange");function Nn({provider:t,rows:n}){const a=n.reduce((l,g)=>l+g.inputTokens+g.cachedInputTokens+g.outputTokens,0),r=n.reduce((l,g)=>l+g.costCents,0);return(0,e.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("span",{children:se(t)}),(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:I(a)}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:j(r)})]})}i(Nn,"ProviderTabLabel");function Cn({biller:t,rows:n}){const a=n.reduce((l,g)=>l+g.inputTokens+g.cachedInputTokens+g.outputTokens,0),r=n.reduce((l,g)=>l+g.costCents,0);return(0,e.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("span",{children:se(t)}),(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:I(a)}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:j(r)})]})}i(Cn,"BillerTabLabel");function J({label:t,value:n,subtitle:a,icon:r}){return(0,e.jsx)(W,{className:"block p-4",children:(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) uppercase tracking-(--tracking-eyebrow) text-muted-foreground",children:t}),(0,e.jsx)("div",{className:"mt-2 text-2xl font-semibold tabular-nums",children:n}),(0,e.jsx)("div",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:a})]}),(0,e.jsx)("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-md border border-border",children:(0,e.jsx)(r,{className:"h-4 w-4 text-muted-foreground"})})]})})}i(J,"MetricTile");function _s({debitCents:t,creditCents:n,netCents:a,estimatedDebitCents:r,eventCount:l}){return(0,e.jsxs)(W,{children:[(0,e.jsxs)(oe,{className:"px-5 pt-5 pb-2",children:[(0,e.jsx)(ie,{className:"text-base",children:"Finance ledger"}),(0,e.jsx)(be,{children:"Account-level charges that do not map to a single inference request."})]}),(0,e.jsxs)(X,{className:"grid gap-3 px-5 pb-5 pt-2 sm:grid-cols-2 xl:grid-cols-4",children:[(0,e.jsx)(J,{label:"Debits",value:j(t),subtitle:`${l} total event${l===1?"":"s"} in range`,icon:as}),(0,e.jsx)(J,{label:"Credits",value:j(n),subtitle:"Refunds, offsets, and credit returns",icon:yt}),(0,e.jsx)(J,{label:"Net",value:j(a),subtitle:"Debit minus credit for the selected period",icon:rs}),(0,e.jsx)(J,{label:"Estimated",value:j(r),subtitle:"Estimated debits that are not yet invoice-authoritative",icon:ns})]})]})}i(_s,"FinanceSummaryCard");function kn({embedded:t=!1,initialTab:n="overview",lockTab:a=!1,hideBudgetsTab:r=!1}={}){const{selectedCompanyId:l}=It(),{setBreadcrumbs:g}=Et(),u=qs(),[E,U]=_t(),B=E.get("agentId"),{data:v,error:c}=q({queryKey:[...F.agents.detail(B??Rs),l],queryFn:i(()=>Lt.get(B,l),"queryFn"),enabled:!!(l&&B)}),T=v?.adapterType==="paperclip_runner"&&v.adapterConfig.provider==="muse",[R,L]=(0,p.useState)(n),[$,G]=(0,p.useState)("all"),[K,z]=(0,p.useState)("all"),w=!(t&&a&&n==="budgets"),{preset:k,setPreset:C,customFrom:ve,setCustomFrom:ke,customTo:h,setCustomTo:D,from:y,to:A,customReady:H}=Wt();(0,p.useEffect)(()=>{t||g([{label:"Costs"}])},[t,g]),(0,p.useEffect)(()=>{const s=E.get("tab");L(!a&&s&&["overview","providers","billers","finance","budgets","decisions","fast-responses"].includes(s)?s:n)},[n,a,E]);const[He,Ze]=(0,p.useState)(()=>new Date().toDateString()),Se=(0,p.useRef)(null);(0,p.useEffect)(()=>{const s=i(()=>{const o=new Date,m=new Date(o.getFullYear(),o.getMonth(),o.getDate()+1).getTime()-o.getTime();Se.current=setTimeout(()=>{Ze(new Date().toDateString()),s()},m)},"schedule");return s(),()=>{Se.current!=null&&clearTimeout(Se.current)}},[]);const te=(0,p.useMemo)(()=>yn(),[He]),x=l??Rs,V=["custom","mtd","ytd"].includes(k)&&y||void 0,d=k==="custom"?A||void 0:k,{data:b,error:Z}=q({queryKey:["cost-subscriptions",x,V,d],queryFn:i(()=>Ve.report(x,y||void 0,A||void 0),"queryFn"),enabled:!!l&&H&&w,refetchInterval:3e4}),ce=i(()=>{u.invalidateQueries({queryKey:["cost-subscriptions",x]})},"invalidateSubscriptions"),fe=(0,p.useRef)(null),de=Ae({mutationFn:i(s=>Ve.refresh(s),"mutationFn"),onSuccess:i((s,o)=>{u.invalidateQueries({queryKey:["cost-subscriptions",o]})},"onSuccess")});(0,p.useEffect)(()=>{!l||!w||!b?.canRefresh||fe.current===l||(fe.current=l,de.mutate(l))},[l,w,b?.canRefresh,de.mutate]);const{data:O,isLoading:De,error:Te}=q({queryKey:F.budgets.overview(x),queryFn:i(()=>ts.overview(x),"queryFn"),enabled:!!l&&H,refetchInterval:3e4,staleTime:5e3}),Me=i(()=>{l&&(u.invalidateQueries({queryKey:F.budgets.overview(l)}),u.invalidateQueries({queryKey:F.dashboard(l)}),u.invalidateQueries({queryKey:F.agents.list(l)}),u.invalidateQueries({queryKey:F.projects.all(l)}))},"invalidateBudgetViews"),xe=Ae({mutationFn:i(({summary:s,changes:o})=>ts.upsertPolicy(x,{scopeType:s.scopeType,scopeId:s.scopeId,metric:s.metric,windowKind:s.windowKind,...o}),"mutationFn"),onSuccess:Me}),le=Ae({mutationFn:i(s=>ts.resolveIncident(x,s.incidentId,s),"mutationFn"),onSuccess:Me}),{data:N,isLoading:Q,error:us}=q({queryKey:F.costs(x,V,d),queryFn:i(async()=>{const[s,o,m,f]=await Promise.all([_.summary(x,y||void 0,A||void 0),_.byAgent(x,y||void 0,A||void 0),_.byProject(x,y||void 0,A||void 0),_.byAgentModel(x,y||void 0,A||void 0)]);return{summary:s,byAgent:o,byProject:m,byAgentModel:f}},"queryFn"),enabled:!!l&&H&&w,refetchInterval:3e4}),{data:Je,error:Ys}=q({queryKey:[...F.costs(x,V,d),"by-user"],queryFn:i(()=>_.byUser(x,y||void 0,A||void 0),"queryFn"),enabled:!!l&&H&&w&&R==="overview",refetchInterval:3e4}),{data:S,isLoading:ms,error:xs}=q({queryKey:[F.financeSummary(x,V,d),F.financeByBiller(x,V,d),F.financeByKind(x,V,d),F.financeEvents(x,V,d,18)],queryFn:i(async()=>{const[s,o,m,f]=await Promise.all([_.financeSummary(x,y||void 0,A||void 0),_.financeByBiller(x,y||void 0,A||void 0),_.financeByKind(x,y||void 0,A||void 0),_.financeEvents(x,y||void 0,A||void 0,18)]);return{summary:s,byBiller:o,byKind:m,events:f}},"queryFn"),enabled:!!l&&H&&w,refetchInterval:3e4}),[Hs,ps]=(0,p.useState)(new Set);(0,p.useEffect)(()=>{ps(new Set)},[x,k,ve,h]);function Zs(s){ps(o=>{const m=new Set(o);return m.has(s)?m.delete(s):m.add(s),m})}i(Zs,"toggleAgent");const Js=(0,p.useMemo)(()=>{const s=new Map;for(const o of N?.byAgentModel??[]){const m=s.get(o.agentId)??[];m.push(o),s.set(o.agentId,m)}for(const[o,m]of s)s.set(o,m.slice().sort((f,P)=>P.costCents-f.costCents));return s},[N?.byAgentModel]),{data:Fe,error:Xs}=q({queryKey:F.usageByProvider(x,V,d),queryFn:i(()=>_.byProvider(x,y||void 0,A||void 0),"queryFn"),enabled:!!l&&H&&(R==="providers"||R==="billers"),refetchInterval:3e4,staleTime:1e4}),{data:hs,error:et}=q({queryKey:F.usageByBiller(x,V,d),queryFn:i(()=>_.byBiller(x,y||void 0,A||void 0),"queryFn"),enabled:!!l&&H&&R==="billers",refetchInterval:3e4,staleTime:1e4}),{data:gs,error:st}=q({queryKey:F.usageByProvider(x,te.from,te.to),queryFn:i(()=>_.byProvider(x,te.from,te.to),"queryFn"),enabled:!!l&&(R==="providers"||R==="billers"),refetchInterval:3e4,staleTime:1e4}),{data:bs,error:tt}=q({queryKey:F.usageByBiller(x,te.from,te.to),queryFn:i(()=>_.byBiller(x,te.from,te.to),"queryFn"),enabled:!!l&&R==="billers",refetchInterval:3e4,staleTime:1e4}),{data:vs,error:nt}=q({queryKey:F.usageWindowSpend(x),queryFn:i(()=>_.windowSpend(x),"queryFn"),enabled:!!l&&R==="providers",refetchInterval:3e4,staleTime:1e4}),{data:pe,isLoading:fs,error:Be}=q({queryKey:F.usageQuotaWindows(x),queryFn:i(()=>_.quotaWindows(x),"queryFn"),structuralSharing:i((s,o)=>cn(s,o),"structuralSharing"),enabled:!!l&&R==="providers",refetchInterval:3e5,staleTime:6e4}),ne=(0,p.useMemo)(()=>{const s=new Map;for(const o of Fe??[]){const m=s.get(o.provider)??[];m.push(o),s.set(o.provider,m)}return s},[Fe]),ue=(0,p.useMemo)(()=>{const s=new Map;for(const o of hs??[]){const m=s.get(o.biller)??[];m.push(o),s.set(o.biller,m)}return s},[hs]),js=(0,p.useMemo)(()=>{const s=new Map;for(const o of gs??[])s.set(o.provider,(s.get(o.provider)??0)+o.costCents);return s},[gs]),ys=(0,p.useMemo)(()=>{const s=new Map;for(const o of bs??[])s.set(o.biller,(s.get(o.biller)??0)+o.costCents);return s},[bs]),Ns=(0,p.useMemo)(()=>{const s=new Map;for(const o of vs??[]){const m=s.get(o.provider)??[];m.push(o),s.set(o.provider,m)}return s},[vs]),Cs=(0,p.useMemo)(()=>{const s=new Map;for(const o of pe??[])o.windows.length>0&&s.set(o.provider,o.windows);return s},[pe]),ks=(0,p.useMemo)(()=>{const s=new Map;for(const o of pe??[])o.ok||s.set(o.provider,"unavailable");return Be&&(s.set("anthropic","unavailable"),s.set("openai","unavailable")),s},[pe,Be]),Ss=(0,p.useMemo)(()=>{const s=new Map;for(const o of pe??[])typeof o.source=="string"&&o.source.length>0&&s.set(o.provider,o.source);return s},[pe]),Ts=(0,p.useMemo)(()=>{const s=new Map;if(k!=="mtd")return s;const o=N?.summary.budgetCents??0;if(o<=0)return s;const m=new Date,f=m.getUTCDate(),P=new Date(Date.UTC(m.getUTCFullYear(),m.getUTCMonth()+1,0)).getUTCDate();for(const[ae,Y]of ne){const Is=Y.reduce((ut,mt)=>ut+mt.costCents,0),dt=Is/Math.max(f,1);s.set(ae,Is+dt*(P-f)>o)}return s},[k,N,ne]),Re=(0,p.useMemo)(()=>Array.from(ne.keys()),[ne]),_e=(0,p.useMemo)(()=>Array.from(ue.keys()),[ue]),Ue=$==="all"||Re.includes($)?$:"all";(0,p.useEffect)(()=>{Ue!==$&&G("all")},[Ue,$]);const Le=K==="all"||_e.includes(K)?K:"all";(0,p.useEffect)(()=>{Le!==K&&z("all")},[Le,K]);const at=(0,p.useMemo)(()=>{const s=Array.from(ne.keys()),o=s.reduce((f,P)=>f+(ne.get(P)?.reduce((ae,Y)=>ae+Y.inputTokens+Y.cachedInputTokens+Y.outputTokens,0)??0),0),m=s.reduce((f,P)=>f+(ne.get(P)?.reduce((ae,Y)=>ae+Y.costCents,0)??0),0);return[{value:"all",label:(0,e.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("span",{children:"All providers"}),s.length>0?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:I(o)}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:j(m)})]}):null]})},...s.map(f=>({value:f,label:(0,e.jsx)(Nn,{provider:f,rows:ne.get(f)??[]})}))]},[ne]),rt=(0,p.useMemo)(()=>{const s=Array.from(ue.keys()),o=s.reduce((f,P)=>f+(ue.get(P)?.reduce((ae,Y)=>ae+Y.inputTokens+Y.cachedInputTokens+Y.outputTokens,0)??0),0),m=s.reduce((f,P)=>f+(ue.get(P)?.reduce((ae,Y)=>ae+Y.costCents,0)??0),0);return[{value:"all",label:(0,e.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,e.jsx)("span",{children:"All billers"}),s.length>0?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:I(o)}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:j(m)})]}):null]})},...s.map(f=>({value:f,label:(0,e.jsx)(Cn,{biller:f,rows:ue.get(f)??[]})}))]},[ue]),it=S?.events??[],Ee=O?.policies??[],he=O?.activeIncidents??[],ot=(0,p.useMemo)(()=>({company:Ee.filter(s=>s.scopeType==="company"),agent:Ee.filter(s=>s.scopeType==="agent"),project:Ee.filter(s=>s.scopeType==="project")}),[Ee]);if(!l)return(0,e.jsx)(Ut,{icon:Xe,message:"Select an organization to view costs."});const Ie=k==="custom"&&!H,lt=Q&&H,ct=!N&&us;return(0,e.jsxs)("div",{className:"min-w-0 max-w-full space-y-6",children:[c&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:"Could not load agent details. Totals below show recorded organization costs."}),T&&(0,e.jsxs)("p",{role:"status",className:"text-sm text-muted-foreground",children:[v.name,"'s Muse activity has no reported usage or cost. Totals below show recorded organization charges only. Microvac cannot enforce a Muse spend ceiling."]}),w?(0,e.jsxs)("div",{className:"space-y-5",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[(0,e.jsx)("div",{children:t?(0,e.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:"Costs"}):(0,e.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:"Costs"})}),(0,e.jsx)("div",{"data-canonical-toolbar":"cost-range",role:"toolbar","aria-label":"Cost date range",className:"flex flex-wrap items-center gap-2",children:Gt.map(s=>(0,e.jsx)(ee,{variant:k===s?"secondary":"ghost",size:"sm",onClick:i(()=>C(s),"onClick"),"aria-pressed":k===s,children:Qt[s]},s))})]}),k==="custom"?(0,e.jsxs)("div",{"data-canonical-toolbar":"cost-dates",className:"flex flex-wrap items-center gap-2 border border-border p-3",children:[(0,e.jsx)("input",{type:"date",value:ve,onChange:i(s=>ke(s.target.value),"onChange"),className:"h-9 rounded-md border border-input bg-background px-3 text-sm text-foreground"}),(0,e.jsx)("span",{className:"text-sm text-muted-foreground",children:"to"}),(0,e.jsx)("input",{type:"date",value:h,onChange:i(s=>D(s.target.value),"onChange"),className:"h-9 rounded-md border border-input bg-background px-3 text-sm text-foreground"})]}):null,S?.summary.currencies?.some(s=>s.currency!=="USD")&&(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Finance headline totals are USD only. Other currencies are listed separately; no exchange-rate conversion is applied."}),(0,e.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-5",children:[(0,e.jsx)(J,{label:"API spend",value:b?b.api.unpricedEventCount===b.api.eventCount&&b.api.eventCount>0?"—":j(Number(b.api.costCents)):"—",subtitle:b?(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)(Ot,{eventCount:b.api.eventCount,estimatedEventCount:b.api.estimatedEventCount}),(0,e.jsx)("div",{children:(0,e.jsx)(is,{usage:b.api})})]}):Z?"API usage is unavailable":"API usage is loading",icon:Xe}),(0,e.jsx)(en,{companyId:x,report:b,error:Z,onChanged:ce},x),(0,e.jsx)(J,{label:"Budget",value:he.length>0?String(he.length):N?.summary.budgetCents&&N.summary.budgetCents>0?k==="mtd"?`${N.summary.utilizationPercent}%`:j(N.summary.budgetCents):"Open",subtitle:he.length>0?`${O?.pausedAgentCount??0} agents paused · ${O?.pausedProjectCount??0} projects paused`:N?.summary.budgetCents&&N.summary.budgetCents>0?k==="mtd"?`${j(N.summary.spendCents)} of ${j(N.summary.budgetCents)} this month`:"Monthly limit":"No monthly cap configured",icon:ns}),(0,e.jsx)(J,{label:"Recorded charges",value:S?j(S.summary.netCents):"—",subtitle:S?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("span",{className:"block whitespace-nowrap",children:[j(S.summary.debitCents)," debits"]}),(0,e.jsxs)("span",{className:"block whitespace-nowrap",children:[j(S.summary.creditCents)," credits"]})]}):"Financial data unavailable",icon:rs}),(0,e.jsx)(J,{label:"Finance events",value:S?String(S.summary.eventCount):"—",subtitle:S?`${j(S.summary.estimatedDebitCents)} estimated in range`:"Financial data unavailable",icon:as})]}),b&&Number(b.subscription.costCents)>0&&(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Subscription accounts also have ",j(Number(b.subscription.costCents))," in recorded usage charges for this period, separate from monthly fees."]}),b&&b.unknown.eventCount>0&&(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Other billing usage: ",I(b.unknown.inputTokens+b.unknown.cachedInputTokens+b.unknown.outputTokens)," tokens",Number(b.unknown.costCents)>0?` · ${j(Number(b.unknown.costCents))} in recorded charges`:"",", included in the inference ledger."]}),Z&&b&&(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Showing the last loaded API and subscription usage. Updates will resume automatically."}),de.error&&(0,e.jsxs)("div",{role:"status",className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[(0,e.jsx)("p",{children:"Connected accounts could not be checked. Existing subscription estimates are still shown."}),b?.canRefresh&&(0,e.jsx)(ee,{variant:"outline",size:"sm",disabled:de.isPending,onClick:i(()=>de.mutate(x),"onClick"),children:"Retry account check"})]}),R==="overview"&&N&&(N.summary.unpricedEventCount>0||N.summary.pendingRunCount>0||(N.summary.unknownBillingEventCount??0)>0)&&(0,e.jsx)(nn,{companyId:x,from:y||void 0,to:A||void 0,reportKey:F.costs(x,V,d),unpricedCount:N.summary.unpricedEventCount,pendingCount:N.summary.pendingRunCount,unknownBillingCount:N.summary.unknownBillingEventCount??0},`${x}:${V}:${d}`)]}):null,Te&&!O?(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Budget data could not be loaded. Please try again shortly."}):null,N&&us||S&&xs||O&&Te||Xs||et||st||tt||nt?(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Showing the last loaded data. Updates will resume automatically."}):null,le.error&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:"Could not update the budget. Check any pending runs or unpriced usage shown on this page, then try again."}),(0,e.jsxs)(es,{className:"min-w-0 max-w-full",value:R,onValueChange:i(s=>{L(s),U(o=>{const m=new URLSearchParams(o);return m.set("tab",s),m},{replace:!0})},"onValueChange"),children:[a?null:(0,e.jsx)("div",{className:"max-w-full overflow-x-auto pb-2",children:(0,e.jsxs)(Dt,{variant:"line",className:"justify-start",children:[(0,e.jsx)(je,{value:"overview",children:"Overview"}),r?null:(0,e.jsx)(je,{value:"budgets",children:"Budgets"}),(0,e.jsx)(je,{value:"providers",children:"Providers"}),(0,e.jsx)(je,{value:"billers",children:"Billers"}),(0,e.jsx)(je,{value:"finance",children:"Finance"}),(0,e.jsx)(je,{value:"decisions",children:"Decisions"}),(0,e.jsx)(je,{value:"fast-responses",children:"Fast responses"})]})}),(0,e.jsx)(re,{value:"fast-responses",className:"mt-4 min-w-0 max-w-full",children:Ie?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a start and end date to load data."}):(0,e.jsx)(Jt,{companyId:x,from:y,to:A})}),(0,e.jsx)(re,{value:"decisions",className:"mt-4 min-w-0 max-w-full",children:Ie?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a start and end date to load data."}):(0,e.jsx)(Zt,{companyId:x,from:y,to:A})}),(0,e.jsx)(re,{value:"overview",className:"mt-4 min-w-0 max-w-full space-y-4",children:Ie?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a start and end date to load data."}):lt?(0,e.jsx)(ss,{variant:"costs"}):ct?(0,e.jsx)("p",{className:"text-sm text-destructive",children:"Cost data could not be loaded. Please try again shortly."}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"grid min-w-0 gap-4 xl:grid-cols-(--gtc-32)",children:[(0,e.jsxs)("div",{className:"min-w-0 max-w-full space-y-4",children:[(0,e.jsxs)(W,{className:"gap-3 py-4",children:[(0,e.jsx)(oe,{className:"gap-0 px-5",children:(0,e.jsx)(ie,{className:"text-base",children:"By agent"})}),(0,e.jsx)(X,{className:"space-y-2 px-5",children:(N?.byAgent.length??0)===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No cost events yet."}):N?.byAgent.map(s=>{const o=Js.get(s.agentId)??[],m=Hs.has(s.agentId),f=o.length>0;return(0,e.jsxs)("div",{role:"group","aria-label":`${s.agentName??s.agentId??"Microvac services"} costs`,className:"border border-border px-4 py-3",children:[(0,e.jsxs)("div",{className:$e("flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",f?"cursor-pointer select-none":""),onClick:i(()=>f&&Zs(s.agentId),"onClick"),children:[(0,e.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[f?m?(0,e.jsx)(Os,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,e.jsx)(Qs,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):(0,e.jsx)("span",{className:"h-3 w-3 shrink-0"}),s.agentId?(0,e.jsx)(Tt,{agent:{id:s.agentId,name:s.agentName??s.agentId,appearance:s.agentAppearance},size:"sm"}):(0,e.jsx)("span",{className:"font-medium",children:"Microvac services"}),s.agentStatus==="terminated"?(0,e.jsx)(jt,{status:"terminated"}):null]}),(0,e.jsxs)("div",{className:"text-right text-sm tabular-nums",children:[(0,e.jsx)(we,{costCents:s.costCents,eventCount:s.eventCount,estimatedEventCount:s.estimatedEventCount}),(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:["in ",I(s.inputTokens+s.cachedInputTokens)," (",I(s.cachedInputTokens)," cached) · out ",I(s.outputTokens)]}),s.apiRunCount>0||s.subscriptionRunCount>0?(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:["runs: ",s.apiRunCount>0?`${s.apiRunCount} api`:"0 api"," · ",s.subscriptionRunCount>0?`${s.subscriptionRunCount} sub`:"0 sub"]}):null]})]}),m&&o.length>0?(0,e.jsx)("div",{className:"mt-3 space-y-2 border-l border-border pl-4",children:o.map(P=>{const ae=s.costCents>0?Math.round(P.costCents/s.costCents*100):0;return(0,e.jsxs)("div",{className:"flex flex-col gap-2 text-xs sm:flex-row sm:items-start sm:justify-between sm:gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("div",{className:"truncate font-medium text-foreground",children:[se(P.provider),(0,e.jsx)("span",{className:"mx-1 text-border",children:"/"}),(0,e.jsx)("span",{className:"font-mono",children:P.model})]}),(0,e.jsxs)("div",{className:"truncate text-muted-foreground",children:[se(P.biller)," · ",cs(P.billingType)]})]}),(0,e.jsxs)("div",{className:"text-right tabular-nums",children:[(0,e.jsx)(we,{costCents:P.costCents,eventCount:P.eventCount,estimatedEventCount:P.estimatedEventCount,suffix:(0,e.jsxs)("span",{className:"ml-1 font-normal text-muted-foreground",children:["(",ae,"%)"]})}),(0,e.jsxs)("div",{className:"text-muted-foreground",children:[I(P.inputTokens+P.cachedInputTokens+P.outputTokens)," tok"]})]})]},`${P.provider}:${P.model}:${P.billingType}`)})}):null]},s.agentId??"services")})})]}),Ys&&(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:Je?"User costs could not be refreshed. Showing the last loaded data.":"User costs could not be loaded. Please try again shortly."}),Je&&(0,e.jsx)(sn,{report:Je})]}),(0,e.jsx)("div",{className:"min-w-0 max-w-full space-y-4",children:(0,e.jsxs)(W,{className:"gap-3 py-4",children:[(0,e.jsx)(oe,{className:"gap-0 px-5",children:(0,e.jsx)(ie,{className:"text-base",children:"By project"})}),(0,e.jsx)(X,{className:"space-y-2 px-5",children:(N?.byProject.length??0)===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No project-attributed run costs yet."}):N?.byProject.map((s,o)=>(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3 border border-border px-3 py-2 text-sm",children:[(0,e.jsx)("span",{className:"truncate",children:s.projectName??s.projectId??"Unattributed"}),(0,e.jsx)(we,{costCents:s.costCents,eventCount:s.eventCount,estimatedEventCount:s.estimatedEventCount})]},s.projectId??`unattributed-${o}`))})]})})]}),he.length>0?(0,e.jsx)("div",{className:"grid gap-4 xl:grid-cols-2",children:he.slice(0,2).map(s=>(0,e.jsx)(Ms,{incident:s,isMutating:le.isPending,onKeepPaused:i(()=>le.mutate({incidentId:s.id,action:"keep_paused"}),"onKeepPaused"),onRaiseAndResume:i(o=>le.mutate({incidentId:s.id,action:"raise_budget_and_resume",amount:o}),"onRaiseAndResume")},s.id))}):null,S?(0,e.jsx)(_s,{debitCents:S.summary.debitCents,creditCents:S.summary.creditCents,netCents:S.summary.netCents,estimatedDebitCents:S.summary.estimatedDebitCents,eventCount:S.summary.eventCount}):(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:ms?"Loading financial events…":"Financial events could not be loaded. Please try again shortly."})]})}),(0,e.jsxs)(re,{value:"budgets",className:"mt-4 min-w-0 max-w-full space-y-4",children:[xe.error&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:"Could not update the budget policy. Review your settings and try again."}),De?(0,e.jsx)(ss,{variant:"costs"}):Te&&!O?null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(W,{className:"border-border/70 bg-(image:--gradient-extract-2)",children:[(0,e.jsxs)(oe,{className:"px-5 pt-5 pb-3",children:[(0,e.jsx)(ie,{className:"text-base",children:"Budget control plane"}),(0,e.jsx)(be,{children:"Hard-stop spend limits for agents and projects. Provider subscription quota stays separate and appears under Providers."})]}),(0,e.jsxs)(X,{className:"grid gap-3 px-5 pb-5 pt-0 md:grid-cols-4",children:[(0,e.jsx)(J,{label:"Active incidents",value:String(he.length),subtitle:"Open soft or hard threshold crossings",icon:rs}),(0,e.jsx)(J,{label:"Pending approvals",value:String(O?.pendingApprovalCount??0),subtitle:"Budget override approvals awaiting board action",icon:as}),(0,e.jsx)(J,{label:"Paused agents",value:String(O?.pausedAgentCount??0),subtitle:"Agent heartbeats blocked by budget",icon:ns}),(0,e.jsx)(J,{label:"Paused projects",value:String(O?.pausedProjectCount??0),subtitle:"Project execution blocked by budget",icon:Xe})]})]}),he.length>0?(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:"Active incidents"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Raise the budget or keep a hard stop paused. Dismiss a warning when no action is needed."})]}),(0,e.jsx)("div",{className:"grid gap-4 xl:grid-cols-2",children:he.map(s=>(0,e.jsx)(Ms,{incident:s,isMutating:le.isPending,onKeepPaused:i(()=>le.mutate({incidentId:s.id,action:"keep_paused"}),"onKeepPaused"),onRaiseAndResume:i(o=>le.mutate({incidentId:s.id,action:"raise_budget_and_resume",amount:o}),"onRaiseAndResume")},s.id))})]}):null,(0,e.jsxs)("div",{className:"space-y-5",children:[["company","agent","project"].map(s=>{const o=ot[s];return o.length===0?null:(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsxs)("div",{children:[(0,e.jsxs)("h2",{className:"text-lg font-semibold capitalize",children:[s==="company"?"organization":s," budgets"]}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:s==="company"?"Organization-wide monthly policy.":s==="agent"?"Recurring monthly spend policies for individual agents.":"Lifetime spend policies for execution-bound projects."})]}),(0,e.jsx)("div",{className:"grid gap-4 xl:grid-cols-2",children:o.map(m=>(0,e.jsx)(ft,{summary:m,onReservationChange:i(f=>xe.mutate({summary:m,changes:{reservationCents:f}}),"onReservationChange"),onUnpricedUsagePolicyChange:i(f=>xe.mutate({summary:m,changes:{unpricedUsagePolicy:f}}),"onUnpricedUsagePolicyChange"),isSaving:xe.isPending,onSave:i(f=>xe.mutate({summary:m,changes:{amount:f}}),"onSave")},m.policyId))})]},s)}),Ee.length===0?(0,e.jsx)(W,{children:(0,e.jsx)(X,{className:"px-5 py-8 text-sm text-muted-foreground",children:"No budget policies yet. Set agent and project budgets from their detail pages, or use the existing organization monthly budget control."})}):null]})]})]}),(0,e.jsx)(re,{value:"providers",className:"mt-4 min-w-0 max-w-full space-y-4",children:Ie?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a start and end date to load data."}):(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)(es,{className:"min-w-0 max-w-full",value:Ue,onValueChange:G,children:[(0,e.jsx)(As,{items:at,value:Ue,onValueChange:G}),(0,e.jsx)(re,{value:"all",className:"mt-4",children:Re.length===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No cost events in this period."}):(0,e.jsx)("div",{className:"grid gap-4 md:grid-cols-2",children:Re.map(s=>(0,e.jsx)(Bs,{provider:s,rows:ne.get(s)??[],budgetMonthlyCents:N?.summary.budgetCents??0,showBudgetUtilization:k==="mtd",totalCompanySpendCents:N?.summary.spendCents??0,weekSpendCents:js.get(s)??0,windowRows:Ns.get(s)??[],showDeficitNotch:Ts.get(s)??!1,quotaAccounts:pe?.filter(o=>o.provider===s),quotaRequestFailed:!!Be,quotaWindows:Cs.get(s)??[],quotaError:ks.get(s)??null,quotaSource:Ss.get(s)??null,quotaLoading:fs},s))})}),Re.map(s=>(0,e.jsx)(re,{value:s,className:"mt-4",children:(0,e.jsx)(Bs,{provider:s,rows:ne.get(s)??[],budgetMonthlyCents:N?.summary.budgetCents??0,showBudgetUtilization:k==="mtd",totalCompanySpendCents:N?.summary.spendCents??0,weekSpendCents:js.get(s)??0,windowRows:Ns.get(s)??[],showDeficitNotch:Ts.get(s)??!1,quotaAccounts:pe?.filter(o=>o.provider===s),quotaRequestFailed:!!Be,quotaWindows:Cs.get(s)??[],quotaError:ks.get(s)??null,quotaSource:Ss.get(s)??null,quotaLoading:fs})},s))]})})}),(0,e.jsx)(re,{value:"billers",className:"mt-4 min-w-0 max-w-full space-y-4",children:Ie?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a start and end date to load data."}):(0,e.jsx)(e.Fragment,{children:(0,e.jsxs)(es,{className:"min-w-0 max-w-full",value:Le,onValueChange:z,children:[(0,e.jsx)(As,{items:rt,value:Le,onValueChange:z}),(0,e.jsx)(re,{value:"all",className:"mt-4",children:_e.length===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No billable events in this period."}):(0,e.jsx)("div",{className:"grid gap-4 md:grid-cols-2",children:_e.map(s=>{const o=(ue.get(s)??[])[0];if(!o)return null;const m=(Fe??[]).filter(f=>f.biller===s);return(0,e.jsx)($s,{row:o,weekSpendCents:ys.get(s)??0,budgetMonthlyCents:N?.summary.budgetCents??0,showBudgetUtilization:k==="mtd",totalCompanySpendCents:N?.summary.spendCents??0,providerRows:m},s)})})}),_e.map(s=>{const o=(ue.get(s)??[])[0];if(!o)return null;const m=(Fe??[]).filter(f=>f.biller===s);return(0,e.jsx)(re,{value:s,className:"mt-4",children:(0,e.jsx)($s,{row:o,weekSpendCents:ys.get(s)??0,budgetMonthlyCents:N?.summary.budgetCents??0,showBudgetUtilization:k==="mtd",totalCompanySpendCents:N?.summary.spendCents??0,providerRows:m})},s)})]})})}),(0,e.jsxs)(re,{value:"finance",className:"mt-4 min-w-0 max-w-full space-y-4",children:[S?.summary.providerReportedCentsExact!==void 0&&(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Provider API cost reports: ",j(S.summary.providerReportedCents??0),". Report totals overlap invoices and run estimates and are shown separately from recorded charges."]}),Ie?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select a start and end date to load data."}):ms?(0,e.jsx)(ss,{variant:"costs"}):xs&&!S?(0,e.jsx)("p",{className:"text-sm text-destructive",children:"Financial events could not be loaded. Please try again shortly."}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(_s,{debitCents:S?.summary.debitCents??0,creditCents:S?.summary.creditCents??0,netCents:S?.summary.netCents??0,estimatedDebitCents:S?.summary.estimatedDebitCents??0,eventCount:S?.summary.eventCount??0}),(0,e.jsxs)("div",{className:"grid min-w-0 gap-4 xl:grid-cols-(--gtc-33)",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-4",children:[(0,e.jsxs)(W,{children:[(0,e.jsxs)(oe,{className:"px-5 pt-5 pb-2",children:[(0,e.jsx)(ie,{className:"text-base",children:"By biller"}),(0,e.jsx)(be,{children:"Account-level financial events grouped by who charged or credited them."})]}),(0,e.jsx)(X,{className:"grid gap-4 px-5 pb-5 pt-2 md:grid-cols-2",children:(S?.byBiller.length??0)===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No finance events yet."}):S?.byBiller.map(s=>(0,e.jsx)(an,{row:s},`${s.biller}:${s.currency}`))})]}),(0,e.jsx)(on,{rows:it})]}),(0,e.jsx)(rn,{rows:S?.byKind??[]})]})]})]})]})]})}i(kn,"Costs");export{On as n,kn as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var u=Object.defineProperty;var n=(t,s)=>u(t,"name",{value:s,configurable:!0});import{a as m}from"./rolldown-runtime-DhZMWcEn.js";import{G as b,Mi as x,N as p,P as d}from"./issue-detail-CZfjXs0M.js";import{$A as g,E_ as f,Fb as j,Mb as w,Pb as y,zE as N}from"./index-BJtnP7H1.js";var e=m(g(),1);function l({index:t,title:s,description:a,children:c,columns:h=2}){return(0,e.jsxs)("section",{className:"rounded-2xl border border-border/70 bg-background/85 p-5 shadow-sm",children:[(0,e.jsxs)("div",{className:"mb-4",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) font-semibold uppercase tracking-(--tracking-caps) text-muted-foreground",children:t}),(0,e.jsx)("h2",{className:"mt-1 text-base font-semibold text-foreground",children:s}),(0,e.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:a})]}),(0,e.jsx)("div",{className:N("grid gap-4",h===2&&"lg:grid-cols-2"),children:c})]})}n(l,"LabSection");function r({label:t,children:s}){return(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) font-semibold uppercase tracking-(--tracking-caps) text-muted-foreground",children:t}),(0,e.jsx)(f,{className:"block border-border/60 p-3",children:s})]})}n(r,"Frame");function o({authorName:t,onBehalfOf:s,body:a}){return(0,e.jsxs)("div",{className:"flex flex-col items-start py-1.5",children:[(0,e.jsxs)("div",{className:"mb-1 flex items-center gap-1.5 px-1",children:[(0,e.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center text-muted-foreground",children:(0,e.jsx)(y,{size:"sm",className:"size-5",children:(0,e.jsx)(j,{className:"text-(length:--text-nano)",children:t.slice(0,2).toUpperCase()})})}),(0,e.jsx)("span",{className:"text-sm font-medium text-foreground",children:t}),s?(0,e.jsx)(b,{agentName:t,userName:s}):null]}),(0,e.jsx)("div",{className:"min-w-0 max-w-(--pct-85) break-words border border-border bg-card px-3 py-2 text-sm text-foreground [border-radius:14px_14px_14px_4px]",children:a})]})}n(o,"AgentCommentBubble");function i({actorName:t,verb:s,children:a}){return(0,e.jsxs)("div",{className:"space-y-1.5 rounded-lg border border-border/60 px-3 py-2 text-xs text-muted-foreground",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(w,{name:t,size:"sm"}),(0,e.jsx)("span",{children:s}),(0,e.jsx)("span",{className:"ml-auto shrink-0",children:"2m ago"})]}),a]})}n(i,"ActivityRow");var v=new Map([["3108ef8e-5ed0-41d9-b561-6b41c41b8545","ClaudeCoder"],["6670e11b-91d3-4429-82e0-436b88b51808","UXDesigner"]]);function I(){const t=n(a=>v.get(a)??null,"resolveAgentLabel"),s=n(a=>a==="user-dotta"?"Dotta":null,"resolveUserLabel");return(0,e.jsx)("div",{className:"min-h-screen bg-muted/20 p-6",children:(0,e.jsxs)("div",{className:"mx-auto max-w-5xl space-y-6",children:[(0,e.jsxs)("header",{children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) font-semibold uppercase tracking-(--tracking-caps) text-muted-foreground",children:"Open cross-task collaboration"}),(0,e.jsx)("h1",{className:"mt-1 text-xl font-semibold text-foreground",children:"Open cross-task collaboration — attribution, audit, and denial copy"}),(0,e.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Agents may now write to any task they can read. These are the three surfaces that keep that legible: whose authority a comment rode, what an edit changed, and — when a write is refused — which boundary fired and what to do instead."})]}),(0,e.jsxs)(l,{index:"1 · Attribution chip (plan §3a)",title:"“Fable · for Dotta” on a cross-task agent comment",description:"An agent commenting on a task it is not assigned to names the responsible user whose authority it rode. The assignee's own comments stay unchipped — that is the ordinary case, and chipping every bubble would be noise.",children:[(0,e.jsx)(r,{label:"Assignee's own comment — no chip",children:(0,e.jsx)(o,{authorName:"CodexCoder",body:"Rebased onto master and re-ran the containment suite; all green."})}),(0,e.jsx)(r,{label:"Cross-task comment — chipped",children:(0,e.jsx)(o,{authorName:"Fable",onBehalfOf:"Dotta",body:"Dotta asked me to flag that the retry window here overlaps TASK-482. Worth a look before you close this."})}),(0,e.jsx)(r,{label:"Responsible user not in the loaded directory",children:(0,e.jsx)(o,{authorName:"Fable",onBehalfOf:"the responsible user",body:"Falls back to a generic label rather than printing a raw user id."})}),(0,e.jsx)(r,{label:"Long user name truncates in the chip",children:(0,e.jsx)(o,{authorName:"Fable",onBehalfOf:"Alexandra Konstantinopoulos-Whitfield",body:"The chip caps its width and truncates; the tooltip carries the full name."})})]}),(0,e.jsxs)(l,{index:"2 · Field-edit audit receipt (plan §3b)",title:"Every PATCH says who changed what, and under which authorization",description:"Required for agent and board edits alike. Before/after per field, the responsible user behind the write, and the authorization reason that let it through.",children:[(0,e.jsx)(r,{label:"Cross-task agent edit",children:(0,e.jsx)(i,{actorName:"Fable",verb:"changed the status from todo to in progress",children:(0,e.jsx)(d,{event:{action:"issue.updated",responsibleUserId:"user-dotta",details:{authorizationReason:"allow_visible_issue_write",changes:{status:{from:"todo",to:"in_progress"},priority:{from:"medium",to:"high"}}}},resolveAgentLabel:t,resolveUserLabel:s})})}),(0,e.jsx)(r,{label:"Board (human) edit — audited the same way",children:(0,e.jsx)(i,{actorName:"Dotta",verb:"updated the issue",children:(0,e.jsx)(d,{event:{action:"issue.updated",responsibleUserId:"user-dotta",details:{authorizationReason:"allow_board_actor",changes:{assigneeAgentId:{from:"3108ef8e-5ed0-41d9-b561-6b41c41b8545",to:"6670e11b-91d3-4429-82e0-436b88b51808"},description:{from:"Old brief…",to:"New brief…",updated:!0}}}},resolveAgentLabel:t,resolveUserLabel:s})})}),(0,e.jsx)(r,{label:"Reassignment, blockers, and work mode in one write",children:(0,e.jsx)(i,{actorName:"CTO",verb:"updated the issue",children:(0,e.jsx)(d,{event:{action:"issue.updated",responsibleUserId:"user-dotta",details:{authorizationReason:"allow_visible_issue_write",changes:{blockedByIssueIds:{from:[],to:["TASK-491","TASK-492"]},workMode:{from:"planning",to:"standard"},assigneeAgentId:{from:null,to:"3108ef8e-5ed0-41d9-b561-6b41c41b8545"}}}},resolveAgentLabel:t,resolveUserLabel:s})})}),(0,e.jsx)(r,{label:"Older activity row — no receipt, renders unchanged",children:(0,e.jsx)(i,{actorName:"CodexCoder",verb:"checked out the issue"})})]}),(0,e.jsxs)(l,{index:"3 · Actionable denial copy (plan §6)",title:"Every wall names the boundary, who can act, and the sanctioned path",description:"A real incident burned a full detour discovering a workaround behind an opaque 403. These are all the ways an issue write can now be refused — the same copy the API error body carries.",columns:1,children:[(0,e.jsx)(r,{label:"Before — what the incident actually saw",children:(0,e.jsxs)("div",{className:"text-xs",children:[(0,e.jsx)("span",{className:"text-red-600 dark:text-red-400",children:"403 Forbidden: Issue is outside this actor's authorization boundary"}),(0,e.jsx)("p",{className:"mt-1 text-muted-foreground",children:"No boundary named, nobody named, no path forward. The workaround (create a child issue) had to be discovered by trial and error."})]})}),x.map(a=>(0,e.jsx)(r,{label:`After — ${a}`,children:(0,e.jsx)(p,{code:a,context:{actorLabel:"Fable",assigneeLabel:"CodexCoder",responsibleUserName:"Dotta",issueIdentifier:"TASK-482",cap:20,count:21}})},a))]})]})})}n(I,"CrossIssueCollaborationUxLab");export{I as CrossIssueCollaborationUxLab,I as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var Me=Object.defineProperty;var o=(s,t)=>Me(s,"name",{value:t,configurable:!0});import{a as we}from"./rolldown-runtime-DhZMWcEn.js";import{F as ke,o as _e}from"./issue-detail-CZfjXs0M.js";import{c as de,o as Pe,s as Le}from"./smoke-lab-matrix-C5gR81E3.js";import{r as qe}from"./collections-B58p51lw.js";import{$A as Ee,AC as Be,Ao as le,CT as Fe,Dy as Ke,E_ as B,Fb as Oe,GS as j,Gb as R,HE as ce,Hv as Q,IS as Y,Kr as ze,Kw as He,LS as Ue,ME as Qe,NE as ue,Nb as Ve,Pb as Ge,Q_ as We,RT as me,Rb as Ye,Up as Je,Uv as Xe,VS as Ze,Vp as et,Wv as tt,ab as st,ay as at,bE as rt,f_ as nt,iS as it,iT as ot,ib as dt,jb as lt,jo as xe,kT as ct,ky as ut,lS as he,mi as mt,nj as xt,on as ge,pb as ht,pm as pe,rb as fe,ub as gt,vi as pt,ww as ye,xE as w,xT as V,x_ as ft,zD as yt,zE as D}from"./index-BJtnP7H1.js";import{t as bt}from"./TaskSummaryList-eFDfK_QH.js";import{t as F}from"./MetricCard-CeL9Pdn5.js";import{t as vt}from"./useAgentlessOnboardingAutoOpen-DSWW7Juw.js";import{t as jt}from"./ActiveAgentsPanel-BEx06tMt.js";var p=we(xt(),1),e=we(Ee(),1);function wt(s,t,a){switch(s){case"issue":return`/issues/${a??t}`;case"agent":return`/agents/${t}`;case"project":return`/projects/${yt(a,t)}`;case"goal":return`/goals/${t}`;case"approval":return`/approvals/${t}`;default:return null}}o(wt,"entityLink");function Ne({event:s,agentMap:t,userProfileMap:a,entityNameMap:n,entityTitleMap:i,className:l,appearance:d="default",density:g="comfortable"}){const c=_e(s.action,s.details,{agentMap:t,userProfileMap:a}),h=s.entityType==="heartbeat_run",m=h?s.details?.agentId:void 0,f=h?m?n.get(`agent:${m}`):null:n.get(`${s.entityType}:${s.entityId}`),v=i?.get(`${s.entityType}:${s.entityId}`)??(s.entityType==="issue"&&typeof s.details?.issueTitle=="string"?s.details.issueTitle:void 0),b=h&&m?`/agents/${m}/runs/${s.entityId}`:wt(s.entityType,s.entityId,f),k=s.actorType==="agent"?t.get(s.actorId):null,S=s.actorType==="user"?a?.get(s.actorId):null,N=k?.name??(s.actorType==="system"?"System":S?.label??(s.actorType==="user"?"Board":s.actorId||"Unknown")),u=S?.image??null,_=s.actorType==="agent"?(0,e.jsx)(lt,{agent:k,name:N,size:24,className:"@xl:self-center"}):(0,e.jsxs)(Ge,{size:"sm","aria-hidden":"true",className:"@xl:self-center",children:[u&&(0,e.jsx)(Ye,{src:u,alt:""}),(0,e.jsx)(Oe,{children:Ve(N)})]});if(d==="refreshed"){const L=s.entityType==="issue"?v||f||"Task":[f,v].filter(Boolean).join(" — ");return(0,e.jsx)(kt,{event:s,avatar:_,actorName:N,verb:c,subject:L,identifier:s.entityType==="issue"?f??void 0:void 0,link:b,density:g,className:l})}const P=(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-start gap-2 @xl:grid @xl:grid-cols-(--dashboard-activity-list-columns) @xl:items-baseline",children:[_,(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1 @xl:contents",children:[(0,e.jsxs)("div",{className:"flex min-w-0 items-baseline gap-2 @xl:contents",children:[(0,e.jsxs)("p",{className:"flex h-6 min-w-0 flex-1 items-center gap-1.5",children:[(0,e.jsxs)("span",{className:"max-w-1/2 shrink-0 truncate",title:`${N} ${c}`,children:[(0,e.jsx)("span",{children:N})," ",(0,e.jsx)("span",{className:"text-muted-foreground",children:c})]}),s.entityType==="issue"?(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",title:v,children:v}):(0,e.jsxs)("span",{className:"min-w-0 flex-1 truncate",children:[f&&(0,e.jsx)("span",{className:"font-medium",children:f}),v&&(0,e.jsxs)("span",{className:"text-muted-foreground",children:[" — ",v]})]})]}),(0,e.jsx)("span",{className:"ml-auto shrink-0 truncate text-right font-mono text-(length:--text-micro) text-muted-foreground @xl:w-(--dashboard-list-id-width)",children:s.entityType==="issue"?f:null})]}),(0,e.jsx)("div",{className:"flex min-h-6 min-w-0 items-center @xl:contents",children:(0,e.jsx)("span",{className:"ml-auto w-(--dashboard-list-time-width) shrink-0 whitespace-nowrap text-right text-xs text-muted-foreground",children:Y(s.createdAt)})})]})]}),(0,e.jsx)(ke,{event:s})]}),A=D("dashboard-list-row text-sm",b&&"cursor-pointer hover:bg-accent/50 transition-colors",l);return b?(0,e.jsx)(R,{to:b,className:D(A,"no-underline text-inherit block"),children:P}):(0,e.jsx)("div",{className:A,children:P})}o(Ne,"ActivityRow");function kt({event:s,avatar:t,actorName:a,verb:n,subject:i,identifier:l,link:d,density:g,className:c}){const{hoveredCell:h,onMouseMove:m,clearHoveredCell:f}=tt(),[v,b]=(0,p.useState)(!1),k={"data-slot":"activity-row","data-density":g,className:D("task-row-refreshed task-summary-row activity-row-refreshed",c),onMouseMove:m,onMouseLeave:o(()=>{f(),b(!1)},"onMouseLeave"),onFocus:o(()=>b(!0),"onFocus"),onBlur:o(()=>b(!1),"onBlur")},S=(0,e.jsxs)(e.Fragment,{children:[t,(0,e.jsx)("span",{"data-marquee-cell":"activity",className:"min-w-0 flex-1",children:(0,e.jsxs)(Q,{cell:"activity",active:v,slot:"task-row-title",tabbable:!d,children:[a," ",n,i?` ${i}`:""]})}),(0,e.jsxs)("span",{"data-slot":"task-row-trailing",className:"ml-auto flex shrink-0 items-center",children:[l?(0,e.jsx)("span",{"data-slot":"task-row-identifier","data-marquee-cell":"identifier",className:"shrink-0 text-right text-muted-foreground",children:(0,e.jsx)(Q,{cell:"identifier",children:l})}):null,(0,e.jsx)("span",{"data-slot":"task-row-timestamp","data-marquee-cell":"timestamp",className:"shrink-0 text-right text-muted-foreground",children:(0,e.jsx)(Q,{cell:"timestamp",children:Y(s.createdAt)})})]})]});return(0,e.jsxs)(Xe.Provider,{value:h,children:[d?(0,e.jsx)(R,{to:d,...k,children:S}):(0,e.jsx)("div",{...k,children:S}),(0,e.jsx)("div",{className:"activity-row-details",children:(0,e.jsx)(ke,{event:s})})]})}o(kt,"RefreshedActivityRow");function Nt({events:s,label:t="Recent activity",density:a="comfortable",rowClassName:n,...i}){return(0,e.jsx)("ul",{className:"task-summary-list activity-list","aria-label":t,children:s.map(l=>(0,e.jsx)("li",{children:(0,e.jsx)(Ne,{...i,event:l,appearance:"refreshed",density:a,className:n?.(l)})},l.id))})}o(Nt,"ActivityList");function K(){return Array.from({length:14},(s,t)=>{const a=new Date;return a.setDate(a.getDate()-(13-t)),a.toISOString().slice(0,10)})}o(K,"getLast14Days");function At(s){const t=new Date(s+"T12:00:00");return`${t.getMonth()+1}/${t.getDate()}`}o(At,"formatDayLabel");function J(s){return{date:s,succeeded:0,failed:0,recovered:0,other:0,total:0,failedByErrorCode:{}}}o(J,"emptyRunDay");var C={succeeded:"var(--status-task-icon-done)",recovered:"var(--status-task-todo)",failed:"var(--status-task-icon-blocked)",other:"var(--hex-737373)"};function Ct(s){const t=[`${s.date}: ${s.total} run${s.total===1?"":"s"}`];if(s.succeeded>0&&t.push(` succeeded: ${s.succeeded}`),s.recovered>0&&t.push(` recovered: ${s.recovered} (retry succeeded)`),s.failed>0){t.push(` failed: ${s.failed}`);const a=Object.entries(s.failedByErrorCode??{}).sort((n,i)=>i[1]-n[1]);for(const[n,i]of a)t.push(` ${n}: ${i}`)}return s.other>0&&t.push(` other: ${s.other}`),t.join(`
|
|
2
|
+
`)}o(Ct,"runDayTooltip");function X({days:s}){return(0,e.jsx)("div",{className:"flex gap-(--sz-3px) mt-1.5",children:s.map((t,a)=>(0,e.jsx)("div",{className:"flex-1 text-center",children:a===0||a===6||a===13?(0,e.jsx)("span",{className:"text-(length:--text-nano) text-muted-foreground tabular-nums",children:At(t)}):null},t))})}o(X,"DateLabels");function Ae({items:s}){return(0,e.jsx)("div",{className:"flex flex-wrap gap-x-2.5 gap-y-0.5 mt-2",children:s.map(t=>(0,e.jsxs)("span",{className:"flex items-center gap-1 text-(length:--text-nano) text-muted-foreground",children:[(0,e.jsx)("span",{className:"h-1.5 w-1.5 rounded-full shrink-0",style:{backgroundColor:t.color}}),t.label]},t.label))})}o(Ae,"ChartLegend");function G({title:s,subtitle:t,children:a}){return(0,e.jsxs)("div",{className:"border border-border rounded-lg p-4 space-y-3",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-xs font-medium text-muted-foreground",children:s}),t&&(0,e.jsx)("span",{className:"text-(length:--text-nano) text-muted-foreground/60",children:t})]}),a]})}o(G,"ChartCard");function St(s=[]){const t=K(),a=new Map;for(const n of t)a.set(n,J(n));for(const n of s){const i=new Date(n.createdAt).toISOString().slice(0,10),l=a.get(i);if(l){if(n.status==="succeeded")l.succeeded++;else if(n.status==="failed"||n.status==="timed_out"){l.failed++;const d=n.errorCode&&n.errorCode.length>0?n.errorCode:"unknown";l.failedByErrorCode[d]=(l.failedByErrorCode[d]??0)+1}else l.other++;l.total++}}return Array.from(a.values())}o(St,"aggregateRuns");function Ce(s){return Array.isArray(s.activity)?s.activity:Array.isArray(s.runs)?St(s.runs):[]}o(Ce,"resolveRunActivity");function It(s){const t=Ce(s),a=t.length>0?t.map(c=>c.date):K(),n=new Map(t.map(c=>[c.date,c])),i=Math.max(...t.map(c=>c.total),1),l=t.some(c=>c.total>0),d=t.some(c=>c.recovered>0);if(!l)return(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"No runs yet"});const g=[{color:C.succeeded,label:"Succeeded"},...d?[{color:C.recovered,label:"Recovered"}]:[],{color:C.failed,label:"Failed"},{color:C.other,label:"Other"}];return(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"flex items-end gap-(--sz-3px) h-20",children:a.map(c=>{const h=n.get(c)??J(c),m=h.total,f=m/i*100;return(0,e.jsx)("div",{className:"flex-1 h-full flex flex-col justify-end",title:Ct(h),children:m>0?(0,e.jsxs)("div",{className:"flex flex-col-reverse gap-px overflow-hidden",style:{height:`${f}%`,minHeight:2},children:[h.succeeded>0&&(0,e.jsx)("div",{style:{flex:h.succeeded,backgroundColor:C.succeeded}}),h.recovered>0&&(0,e.jsx)("div",{style:{flex:h.recovered,backgroundColor:C.recovered}}),h.failed>0&&(0,e.jsx)("div",{style:{flex:h.failed,backgroundColor:C.failed}}),h.other>0&&(0,e.jsx)("div",{style:{flex:h.other,backgroundColor:C.other}})]}):(0,e.jsx)("div",{className:"bg-muted/30 rounded-sm",style:{height:2}})},c)})}),(0,e.jsx)(X,{days:a}),(0,e.jsx)(Ae,{items:g})]})}o(It,"RunActivityChart");var be={todo:"var(--status-task-todo)",in_progress:"var(--status-task-icon-in_progress)",in_review:"var(--status-task-in_review)",done:"var(--status-task-icon-done)",blocked:"var(--status-task-icon-blocked)",cancelled:"var(--status-task-cancelled)",backlog:"var(--project-none)"},Tt={todo:"To Do",in_progress:"In Progress",in_review:"In Review",done:"Done",blocked:"Blocked",cancelled:"Cancelled",backlog:"Backlog"};function $t({issues:s}){const t=K(),a=new Set,n=new Map;for(const d of t)n.set(d,{});for(const d of s){const g=new Date(d.createdAt).toISOString().slice(0,10),c=n.get(g);c&&(c[d.status]=(c[d.status]??0)+1,a.add(d.status))}const i=["todo","in_progress","in_review","done","blocked","cancelled","backlog"].filter(d=>a.has(d)),l=Math.max(...Array.from(n.values()).map(d=>Object.values(d).reduce((g,c)=>g+c,0)),1);return a.size>0?(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"flex items-end gap-(--sz-3px) h-20",children:t.map(d=>{const g=n.get(d),c=Object.values(g).reduce((m,f)=>m+f,0),h=c/l*100;return(0,e.jsx)("div",{className:"flex-1 h-full flex flex-col justify-end",title:`${d}: ${c} issues`,children:c>0?(0,e.jsx)("div",{className:"flex flex-col-reverse gap-px overflow-hidden",style:{height:`${h}%`,minHeight:2},children:i.map(m=>(g[m]??0)>0?(0,e.jsx)("div",{style:{flex:g[m],backgroundColor:be[m]??"var(--hex-6b7280)"}},m):null)}):(0,e.jsx)("div",{className:"bg-muted/30 rounded-sm",style:{height:2}})},d)})}),(0,e.jsx)(X,{days:t}),(0,e.jsx)(Ae,{items:i.map(d=>({color:be[d]??"var(--hex-6b7280)",label:Tt[d]??d}))})]}):(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"No tasks"})}o($t,"IssueStatusChart");function Rt(s){const t=Ce(s),a=t.length>0?t.map(i=>i.date):K(),n=new Map(t.map(i=>[i.date,i]));return t.some(i=>i.total>0)?(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"flex items-end gap-(--sz-3px) h-20",children:a.map(i=>{const l=n.get(i)??J(i),d=l.succeeded+l.recovered,g=l.total>0?d/l.total:0,c=l.total===0?void 0:g>=.8?"var(--status-task-icon-done)":g>=.5?"var(--hex-eab308)":"var(--status-task-icon-blocked)";return(0,e.jsx)("div",{className:"flex-1 h-full flex flex-col justify-end",title:`${i}: ${l.total>0?Math.round(g*100):0}% (${d}/${l.total})`,children:l.total>0?(0,e.jsx)("div",{style:{height:`${g*100}%`,minHeight:2,backgroundColor:c}}):(0,e.jsx)("div",{className:"bg-muted/30 rounded-sm",style:{height:2}})},i)})}),(0,e.jsx)(X,{days:a})]}):(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"No runs yet"})}o(Rt,"SuccessRateChart");var Dt={green:"bg-emerald-500",amber:"bg-amber-500",red:"bg-destructive",unknown:"bg-muted-foreground/40"},Mt={green:"All paths passing",amber:"Needs a run",red:"Failing paths",unknown:"No runs yet"};function _t(s){if(!s)return"—";const t=new Date(s);return Number.isNaN(t.getTime())?"—":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}o(_t,"formatTime");function Pt({companyId:s}){const{enabled:t,loaded:a}=mt(),n=w({queryKey:j.smokeLab.runs(s),queryFn:o(()=>de.listRuns(s),"queryFn"),enabled:t&&a}).data?.runs?.[0],i=w({queryKey:j.smokeLab.run(s,n?.id??"__none__"),queryFn:o(()=>de.getRun(s,n.id),"queryFn"),enabled:t&&a&&!!n});if(!a||!t)return null;const l=i.data?.steps??[],d=Le(n,l),g=Pe(l);return(0,e.jsxs)(R,{to:pt("smoke-lab"),className:"group flex items-center justify-between gap-3 rounded-lg border border-border bg-card p-4 shadow-sm transition-colors hover:bg-accent/40","data-testid":"smoke-lab-dashboard-card",children:[(0,e.jsxs)("div",{className:"flex min-w-0 items-start gap-3",children:[(0,e.jsx)("span",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-muted",children:(0,e.jsx)(He,{className:"h-4 w-4 text-muted-foreground"})}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:D("h-2.5 w-2.5 shrink-0 rounded-full",Dt[d])}),(0,e.jsx)("p",{className:"truncate text-sm font-semibold text-foreground",children:"Integration smoke"})]}),(0,e.jsxs)("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[Mt[d],g.length>0&&`: ${g.join(", ")}`]}),(0,e.jsx)("p",{className:"mt-0.5 truncate text-(length:--text-micro) text-muted-foreground/80",children:n?`Last run ${_t(n.startedAt)}`:"Run one from the Smoke Lab tab"})]})]}),(0,e.jsx)(ct,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5"})]})}o(Pt,"SmokeLabDashboardCard");var W=10,ve=10;function Lt(s){const t=[];for(const a of s){const n=new Date(a.updatedAt).getTime();if(t.length===ve&&n<=t[t.length-1].at)continue;let i=t.length;for(;i>0&&t[i-1].at<n;)i-=1;t.splice(i,0,{issue:a,at:n}),t.length>ve&&t.pop()}return t.map(a=>a.issue)}o(Lt,"recentTaskIndexRows");function qt(s,t){const a=new Map((t??[]).map(n=>[n.id,n]));return s.map(n=>{const i=a.get(n.id);return{...n,...i?{displayStatus:i.displayStatus,externalConversationState:i.externalConversationState,...i.blockerAttention?{blockerAttention:i.blockerAttention}:{}}:{}}})}o(qt,"withTaskSummaries");function je(s){if(!s||s.length===0)return null;const t=s.filter(a=>a.status==="paused"&&a.pauseReason==="import");return t.length>0?{kind:"imported",pausedImportedAgentIds:t.map(a=>a.id)}:s.every(a=>a.status==="paused")?{kind:"all-paused"}:null}o(je,"derivePausedAgentBanner");function Gt(){const s=ut(),{selectedCompanyId:t,companies:a}=Ue(),{openOnboarding:n}=Ke(),{setBreadcrumbs:i}=dt(),[l,d]=(0,p.useState)(new Set),g=(0,p.useRef)(new Set),c=(0,p.useRef)(!1),h=(0,p.useRef)([]),{data:m,isFetching:f}=w({queryKey:j.agents.list(t),queryFn:o(()=>fe.list(t),"queryFn"),enabled:!!t}),v=Qe(),b=rt({mutationFn:o(async()=>{const r=je(m);if(!(!r||r.kind!=="imported"))for(const x of r.pausedImportedAgentIds)try{await fe.resume(x,t??void 0)}catch{}},"mutationFn"),onSettled:o(async()=>{await Promise.all([v.invalidateQueries({queryKey:j.agents.list(t)}),v.invalidateQueries({queryKey:j.dashboard(t)})])},"onSettled")});vt(),(0,p.useEffect)(()=>{i([{label:"Dashboard"}])},[i]);const k=j.dashboard(t),S=xe({companyId:t,resourceKey:"dashboard",queryKey:k,enabled:!!t}),N=w({queryKey:k,queryFn:o(()=>qe.summary(t),"queryFn"),enabled:!!t}),{data:u,isLoading:_,dataUpdatedAt:P}=N,A=gt(N);le(S,u,P);const L=[...j.activity(t),{limit:W}],Se=xe({companyId:t,resourceKey:`activity:limit:${W}`,queryKey:L,enabled:!!t}),{data:O,dataUpdatedAt:Ie}=w({queryKey:L,queryFn:o(()=>it.list(t,{limit:W}),"queryFn"),enabled:!!t});le(Se,O,Ie);const{data:I}=w({queryKey:j.issues.listIndex(t),queryFn:o(({signal:r})=>he.listCompact(t,{projection:"index"},{signal:r}),"queryFn"),enabled:!!t}),{userId:Te,settled:$e}=Ze(),q=(0,p.useMemo)(()=>Lt(I??[]),[I]),z=(0,p.useMemo)(()=>q.map(r=>r.id).sort(),[q]),{data:Z}=w({queryKey:j.issues.summaryBatch(t,Te,z),queryFn:o(({signal:r})=>he.summaries(t,z,{signal:r}),"queryFn"),enabled:!!t&&$e&&z.length>0}),{data:ee}=w({...ft(t,{includeArchived:!0}),enabled:!!t}),{data:te}=w({queryKey:j.access.companyUserDirectory(t),queryFn:o(()=>at.listUserDirectory(t),"queryFn"),enabled:!!t}),se=(0,p.useMemo)(()=>nt(te?.users),[te?.users]),H=(0,p.useMemo)(()=>qt(q,Z),[q,Z]),T=(0,p.useMemo)(()=>(O??[]).slice(0,10),[O]);(0,p.useEffect)(()=>{for(const r of h.current)window.clearTimeout(r);h.current=[],g.current=new Set,c.current=!1,d(new Set)},[t]),(0,p.useEffect)(()=>{if(T.length===0)return;const r=g.current,x=T.map(y=>y.id);if(!c.current){for(const y of x)r.add(y);c.current=!0;return}const $=x.filter(y=>!r.has(y));if($.length===0){for(const y of x)r.add(y);return}d(y=>{const M=new Set(y);for(const U of $)M.add(U);return M});for(const y of $)r.add(y);const oe=window.setTimeout(()=>{d(y=>{const M=new Set(y);for(const U of $)M.delete(U);return M}),h.current=h.current.filter(y=>y!==oe)},980);h.current.push(oe)},[T]),(0,p.useEffect)(()=>()=>{for(const r of h.current)window.clearTimeout(r)},[]);const ae=(0,p.useMemo)(()=>{const r=new Map;for(const x of m??[])r.set(x.id,x);return r},[m]),re=(0,p.useMemo)(()=>{const r=new Map;for(const x of I??[])r.set(`issue:${x.id}`,x.identifier??x.id.slice(0,8));for(const x of m??[])r.set(`agent:${x.id}`,x.name);for(const x of ee??[])r.set(`project:${x.id}`,x.name);return r},[I,m,ee]),ne=(0,p.useMemo)(()=>{const r=new Map;for(const x of I??[])r.set(`issue:${x.id}`,x.title);return r},[I]),Re=o(r=>!r||!m?null:m.find(x=>x.id===r)?.name??null,"agentName");if(!t)return a.length===0?(0,e.jsx)(ge,{icon:ye,message:"Welcome to Microvac. Set up your first organization and agent to get started.",action:"Get Started",onAction:n}):(0,e.jsx)(ge,{icon:ye,message:"Create or select an organization to view the dashboard."});if(_||A.kind==="reconnecting")return(0,e.jsx)(ht,{variant:"dashboard"});if(A.kind==="error")return(0,e.jsx)(st,{size:"page",error:A.error,action:"load the dashboard",onRetry:A.retry,retrying:A.isFetching});const De=m!==void 0&&!f&&m.length===0,E=je(m),ie=E?.kind==="imported"?E.pausedImportedAgentIds.length:0;return(0,e.jsxs)("div",{className:"space-y-6",children:[E?.kind==="imported"?(0,e.jsx)(pe,{tone:"warning",icon:V,title:`${ie} imported agent${ie===1?" is":"s are"} paused and will not run.`,actions:(0,e.jsx)(ue,{size:"sm",onClick:o(()=>b.mutate(),"onClick"),disabled:b.isPending,"data-testid":"dashboard-resume-imported-agents",children:b.isPending?"Resuming…":"Resume all"}),children:"Agents from an organization import arrive paused as a safety default. Resume them so assigned tasks can start."}):E?.kind==="all-paused"?(0,e.jsx)(pe,{tone:"warning",icon:V,title:"All agents in this organization are paused — nothing will run.",actions:(0,e.jsx)(ue,{variant:"ghost",size:"sm",asChild:!0,children:(0,e.jsx)(R,{to:"/agents",children:"Review agents"})}),children:"Resume at least one agent to let assigned tasks start."}):null,De&&(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-md border border-amber-300 bg-amber-50 px-4 py-3 dark:border-amber-500/25 dark:bg-amber-950/60",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,e.jsx)(me,{className:"h-4 w-4 text-amber-600 dark:text-amber-400 shrink-0"}),(0,e.jsx)("p",{className:"text-sm text-amber-900 dark:text-amber-100",children:"You have no agents."})]}),(0,e.jsx)("button",{onClick:o(()=>n({initialStep:3,companyId:t}),"onClick"),className:"text-sm font-medium text-amber-700 hover:text-amber-900 dark:text-amber-300 dark:hover:text-amber-100 underline underline-offset-2 shrink-0",children:"Create one here"})]}),(0,e.jsx)(jt,{companyId:t,dedupeLinkedTasks:!0}),u&&(0,e.jsxs)(e.Fragment,{children:[u.budgets.activeIncidents>0?(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3 rounded-xl border border-red-500/20 bg-(image:--gradient-extract-1) px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,e.jsx)(V,{className:"mt-0.5 h-4 w-4 shrink-0 text-red-700 dark:text-red-300"}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("p",{className:"text-sm font-medium text-red-950 dark:text-red-50",children:[u.budgets.activeIncidents," active budget incident",u.budgets.activeIncidents===1?"":"s"]}),(0,e.jsxs)("p",{className:"text-xs text-red-900/70 dark:text-red-100/70",children:[u.budgets.pausedAgents," agents paused · ",u.budgets.pausedProjects," projects paused · ",u.budgets.pendingApprovals," pending budget approvals"]})]})]}),(0,e.jsx)(R,{to:"/costs",className:"text-sm underline underline-offset-2 text-red-900 dark:text-red-100",children:"Open budgets"})]}):null,(0,e.jsxs)("div",{className:D("grid auto-rows-fr grid-cols-2 items-stretch xl:grid-cols-4",s?"gap-4":"gap-1 sm:gap-2"),children:[(0,e.jsx)(F,{appearance:s?"card":"plain",icon:me,value:u.agents.active+u.agents.running+u.agents.paused+u.agents.error,label:"Agents Enabled",to:"/agents",description:(0,e.jsxs)("span",{children:[u.agents.running," running",", ",u.agents.paused," paused",", ",u.agents.error," errors"]})}),(0,e.jsx)(F,{appearance:s?"card":"plain",icon:Fe,value:u.tasks.inProgress,label:"Tasks In Progress",to:"/issues",description:(0,e.jsxs)("span",{children:[u.tasks.open," open",", ",u.tasks.blocked," blocked"]})}),(0,e.jsx)(F,{appearance:s?"card":"plain",icon:ot,value:ce(u.costs.monthSpendCents),label:"Month Spend",to:"/costs",description:(0,e.jsx)("span",{children:u.costs.monthBudgetCents>0?`${u.costs.monthUtilizationPercent}% of ${ce(u.costs.monthBudgetCents)} budget`:"Unlimited budget"})}),(0,e.jsx)(F,{appearance:s?"card":"plain",icon:Be,value:u.pendingApprovals+u.budgets.pendingApprovals,label:"Pending Approvals",to:"/approvals",description:(0,e.jsx)("span",{children:u.budgets.pendingApprovals>0?`${u.budgets.pendingApprovals} budget overrides awaiting board review`:"Awaiting board review"})})]}),(0,e.jsx)(Pt,{companyId:t}),(0,e.jsxs)("div",{className:D("grid grid-cols-1 gap-4 sm:grid-cols-2","lg:grid-cols-3"),children:[(0,e.jsx)(G,{title:"Run Activity",subtitle:"Last 14 days",children:(0,e.jsx)(It,{activity:u.runActivity})}),!1,(0,e.jsx)(G,{title:"Tasks by Status",subtitle:"Last 14 days",children:(0,e.jsx)($t,{issues:I??[]})}),(0,e.jsx)(G,{title:"Success Rate",subtitle:"Last 14 days",children:(0,e.jsx)(Rt,{activity:u.runActivity})})]}),(0,e.jsx)(We,{slotTypes:["dashboardWidget"],context:{companyId:t},className:"grid gap-4 md:grid-cols-2",itemClassName:"rounded-lg border bg-card p-4 shadow-sm"}),(0,e.jsxs)("div",{className:"grid md:grid-cols-2 gap-4",children:[T.length>0&&(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Recent Activity"}),(0,e.jsx)(B,{className:"@container block py-0 divide-y divide-border overflow-hidden",children:s?(0,e.jsx)(Nt,{events:T,agentMap:ae,userProfileMap:se,entityNameMap:re,entityTitleMap:ne,rowClassName:o(r=>l.has(r.id)?"activity-row-enter":void 0,"rowClassName")}):T.map(r=>(0,e.jsx)(Ne,{event:r,agentMap:ae,userProfileMap:se,entityNameMap:re,entityTitleMap:ne,className:l.has(r.id)?"activity-row-enter":void 0},r.id))})]}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Recent Tasks"}),H.length===0?(0,e.jsx)(B,{className:"block p-4",children:(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No tasks yet."})}):s?(0,e.jsx)(B,{className:"block overflow-hidden py-0",children:(0,e.jsx)(bt,{issues:H.slice(0,10)})}):(0,e.jsx)(B,{className:"@container block py-0 divide-y divide-border overflow-hidden",children:H.slice(0,10).map(r=>(0,e.jsx)(R,{to:`/issues/${r.identifier??r.id}`,className:"dashboard-list-row text-sm cursor-pointer hover:bg-accent/50 transition-colors no-underline text-inherit block",children:(0,e.jsxs)("div",{className:"flex items-start gap-2 @xl:grid @xl:grid-cols-(--dashboard-task-list-columns) @xl:items-baseline",children:[(0,e.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-end @xl:self-center",children:(0,e.jsx)(et,{...Je(r)})}),(0,e.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col gap-1 @xl:contents",children:[(0,e.jsxs)("span",{className:"flex min-w-0 items-baseline gap-2 @xl:contents",children:[(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm leading-6",title:r.title,children:r.title}),(0,e.jsx)("span",{className:"ml-auto shrink-0 truncate text-right font-mono text-(length:--text-micro) text-muted-foreground @xl:col-start-4 @xl:row-start-1 @xl:w-(--dashboard-list-id-width)",children:r.identifier??r.id.slice(0,8)})]}),(0,e.jsxs)("span",{className:"flex min-h-6 min-w-0 items-center gap-2 @xl:contents",children:[(0,e.jsx)("span",{className:"flex min-w-0 flex-1 items-center @xl:col-start-3 @xl:row-start-1 @xl:self-center",children:r.assigneeAgentId&&(()=>{const x=Re(r.assigneeAgentId);return x?(0,e.jsx)(ze,{agent:m?.find($=>$.id===r.assigneeAgentId)??{id:r.assigneeAgentId??void 0,name:x},size:"sm",className:"max-w-32"}):null})()}),(0,e.jsx)("span",{className:"ml-auto w-(--dashboard-list-time-width) shrink-0 whitespace-nowrap text-right text-xs text-muted-foreground",children:Y(r.updatedAt)})]})]})]})},r.id))})]})]})]})]})}o(Gt,"Dashboard");export{Gt as Dashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c=Object.defineProperty;var o=(t,a)=>c(t,"name",{value:a,configurable:!0});import{a as n}from"./rolldown-runtime-DhZMWcEn.js";import{$A as d,Gb as m,LS as l,QT as u,ib as h,nj as x,on as f,qT as p}from"./index-BJtnP7H1.js";import{t as v}from"./ActiveAgentsPanel-BEx06tMt.js";var i={name:"radio-tower",size:24,node:[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]]};i.node;var y=u(i),g=n(x(),1),e=n(d(),1),r=50;function L(){const{selectedCompanyId:t,companies:a}=l(),{setBreadcrumbs:s}=h();return(0,g.useEffect)(()=>{s([{label:"Dashboard",href:"/dashboard"},{label:"Live runs"}])},[s]),t?(0,e.jsxs)("div",{className:"space-y-5",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[(0,e.jsxs)("div",{children:[(0,e.jsxs)(m,{to:"/dashboard",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground transition-colors hover:text-foreground",children:[(0,e.jsx)(p,{className:"h-3.5 w-3.5"}),"Dashboard"]}),(0,e.jsx)("h1",{className:"mt-2 text-2xl font-semibold tracking-normal text-foreground",children:"Live agent runs"}),(0,e.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Active runs first, followed by the most recent completed runs."})]}),(0,e.jsxs)("div",{className:"text-sm text-muted-foreground",children:["Showing up to ",r]})]}),(0,e.jsx)(v,{companyId:t,title:"Active / recent",minRunCount:r,fetchLimit:r,cardLimit:r,emptyMessage:"No active or recent agent runs.",queryScope:"dashboard-live",showMoreLink:!1})]}):(0,e.jsx)(f,{icon:y,message:a.length===0?"Create an organization to view live runs.":"Select an organization to view live runs."})}o(L,"DashboardLive");export{L as DashboardLive};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var R=Object.defineProperty;var n=(s,t)=>R(s,"name",{value:t,configurable:!0});import{a as A}from"./rolldown-runtime-DhZMWcEn.js";import{x as D}from"./collections-B58p51lw.js";import{t as F}from"./list-filter-BR4_dvwm.js";import{$A as L,Cx as f,Ex as N,GS as I,Gb as K,Gs as G,Ks as z,ME as Q,MT as _,NE as g,QT as q,Sc as $,Sp as W,Tw as H,Tx as y,WT as U,Ws as Y,Zs as V,_w as B,an as J,bE as Z,cv as X,ic as O,nj as ee,oc as se,u as M,xE as te,xc as ae,yC as ne,zE as x}from"./index-BJtnP7H1.js";import{AttentionQueueRow as re}from"./AttentionQueueRow-Bh0dKHpF.js";var P={name:"calendar-range",size:24,node:[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M16 2v3",key:"otl347"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M17 13h-6",key:"1qbiup"}],["path",{d:"M13 17H7",key:"1x38vv"}],["path",{d:"M7 13h.01",key:"1vezk1"}],["path",{d:"M17 17h.01",key:"1sd3ek"}]]};P.node;var ie=q(P),e=A(L(),1),le={critical:"Critical",high:"High",medium:"Medium",low:"Low"};function ge({query:s,onQueryChange:t,visibleCount:r,filterOptions:i,filters:l,onFiltersChange:a,groupBy:o,onGroupByChange:d,sortOrder:p,onSortOrderChange:m}){const b=O(l);return(0,e.jsxs)("div",{"data-canonical-toolbar":"decisions",role:"toolbar","aria-label":"Decisions controls",className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(D,{query:s,onQueryChange:t,label:"Search decisions",placeholder:"Search decisions…"}),(0,e.jsxs)(f,{children:[(0,e.jsx)(N,{asChild:!0,children:(0,e.jsx)(g,{type:"button",variant:"outline",size:"icon",className:x("h-8 w-8 shrink-0",b>0&&"bg-accent"),title:"Filter","data-active":b>0,"aria-label":"Filter",children:(0,e.jsx)(F,{className:"h-3.5 w-3.5"})})}),(0,e.jsx)(y,{align:"end",className:"w-64 p-0",children:(0,e.jsx)(oe,{options:i,filters:l,onChange:a})})]}),(0,e.jsxs)(f,{children:[(0,e.jsx)(N,{asChild:!0,children:(0,e.jsx)(g,{type:"button",variant:"outline",size:"icon",className:x("h-8 w-8 shrink-0",o!=="none"&&"bg-accent"),title:"Group","data-active":o!=="none","aria-label":"Group",children:(0,e.jsx)(H,{className:"h-3.5 w-3.5"})})}),(0,e.jsx)(y,{align:"end",className:"w-40 p-2",children:(0,e.jsx)("div",{className:"space-y-0.5",children:G.map(([c,h])=>(0,e.jsxs)("button",{type:"button",className:x("flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-sm",o===c?"bg-accent/50 text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:n(()=>d(c),"onClick"),children:[(0,e.jsx)("span",{children:h}),o===c?(0,e.jsx)(_,{className:"h-3.5 w-3.5"}):null]},c))})})]}),(0,e.jsxs)(f,{children:[(0,e.jsx)(N,{asChild:!0,children:(0,e.jsx)(g,{type:"button",variant:"outline",size:"icon",className:"h-8 w-8 shrink-0",title:"Sort","aria-label":"Sort",children:(0,e.jsx)(U,{className:"h-3.5 w-3.5"})})}),(0,e.jsx)(y,{align:"end",className:"w-44 p-2",children:(0,e.jsx)("div",{className:"space-y-0.5",children:z.map(([c,h])=>(0,e.jsxs)("button",{type:"button",className:x("flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-sm",p===c?"bg-accent/50 text-foreground":"text-muted-foreground hover:bg-accent/50"),onClick:n(()=>m(c),"onClick"),children:[(0,e.jsx)("span",{children:h}),p===c?(0,e.jsx)(_,{className:"h-3.5 w-3.5"}):null]},c))})})]}),(0,e.jsxs)("span",{"data-toolbar-count":!0,className:"w-full text-xs text-muted-foreground","aria-live":"polite",children:[r," ",r===1?"decision":"decisions"]})]})}n(ge,"DecisionsToolbar");function oe({options:s,filters:t,onChange:r}){const i=n((a,o)=>{const d=t[a],p=d.includes(o)?d.filter(m=>m!==o):[...d,o];r({...t,[a]:p})},"toggle"),l=O(t)>0;return(0,e.jsxs)("div",{className:"max-h-(--sz-70vh) overflow-y-auto",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between px-3 py-2",children:[(0,e.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Filter"}),l&&(0,e.jsx)("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground",onClick:n(()=>r(se),"onClick"),children:"Clear"})]}),s.sourceKinds.length>1&&(0,e.jsx)(j,{title:"Type",children:s.sourceKinds.map(a=>(0,e.jsx)(u,{label:ae(a).label,checked:t.sourceKinds.includes(a),onToggle:n(()=>i("sourceKinds",a),"onToggle")},a))}),(s.categories?.length??0)>1&&(0,e.jsx)(j,{title:"Category",children:s.categories.map(a=>(0,e.jsx)(u,{label:$[a],checked:t.categories?.includes(a)??!1,onToggle:n(()=>{const o=t.categories??[];r({...t,categories:o.includes(a)?o.filter(d=>d!==a):[...o,a]})},"onToggle")},a))}),s.severities.length>1&&(0,e.jsx)(j,{title:"Severity",children:s.severities.map(a=>(0,e.jsx)(u,{label:le[a]??a,checked:t.severities.includes(a),onToggle:n(()=>i("severities",a),"onToggle")},a))}),(s.projects.length>0||s.hasNoProject)&&(0,e.jsxs)(j,{title:"Project",children:[s.projects.map(a=>(0,e.jsx)(u,{label:a.name,checked:t.projectIds.includes(a.id),onToggle:n(()=>i("projectIds",a.id),"onToggle")},a.id)),s.hasNoProject&&(0,e.jsx)(u,{label:"No project",checked:t.projectIds.includes("__none__"),onToggle:n(()=>i("projectIds","__none__"),"onToggle")})]}),(s.workspaces.length>0||s.hasNoWorkspace)&&(0,e.jsxs)(j,{title:"Workspace",children:[s.workspaces.map(a=>(0,e.jsx)(u,{label:a.name,checked:t.workspaceIds.includes(a.id),onToggle:n(()=>i("workspaceIds",a.id),"onToggle")},a.id)),s.hasNoWorkspace&&(0,e.jsx)(u,{label:"No workspace",checked:t.workspaceIds.includes("__none__"),onToggle:n(()=>i("workspaceIds","__none__"),"onToggle")})]})]})}n(oe,"FilterMenu");function j({title:s,children:t}){return(0,e.jsxs)("div",{className:"border-t border-border/60 px-2 py-1.5",children:[(0,e.jsx)("p",{className:"px-1 pb-1 text-(length:--text-nano) font-medium uppercase tracking-wide text-muted-foreground",children:s}),(0,e.jsx)("div",{className:"space-y-0.5",children:t})]})}n(j,"FilterSection");function u({label:s,checked:t,onToggle:r}){return(0,e.jsxs)("button",{type:"button",className:"flex w-full items-center gap-2 rounded-sm px-1 py-1 text-left text-sm hover:bg-accent/50",onClick:r,children:[(0,e.jsx)(W,{checked:t,className:"pointer-events-none",tabIndex:-1}),(0,e.jsx)("span",{className:"truncate",children:s})]})}n(u,"FilterRow");function be({label:s,count:t,open:r,onToggle:i,children:l}){return(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)(J,{label:t==null?s:`${s} (${t})`,collapsible:!0,collapsed:!r,onToggle:i,className:"text-muted-foreground"}),r&&(0,e.jsx)("div",{className:"space-y-4",children:l})]})}n(be,"Curtain");function fe({item:s,companyId:t,now:r,agentMap:i,agents:l,currentUserId:a,expanded:o,onToggleExpand:d,onDismiss:p,onSnooze:m,evidence:b}){const c=Q(),{pushToast:h}=X(),k=V(s,r),v=Z({mutationFn:n(()=>M.setKeep(t,s.sourceKind,s.subject.id,!0),"mutationFn"),onSuccess:n(()=>{c.invalidateQueries({queryKey:I.attention(t)}),h({title:"Kept on desk",body:s.subject.title??void 0,tone:"success"})},"onSuccess"),onError:n(T=>h({title:"Could not keep this decision",body:T instanceof Error?T.message:"Please try again.",tone:"error"}),"onError")});return(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2 px-1",children:[(0,e.jsxs)("span",{className:"text-(length:--text-nano) text-muted-foreground",children:["Idle ",k," ",k===1?"day":"days"]}),(0,e.jsxs)(g,{type:"button",variant:"outline",size:"xs",className:"h-7 gap-1",disabled:v.isPending||s.keep,onClick:n(()=>v.mutate(),"onClick"),children:[v.isPending&&(0,e.jsx)(B,{className:"h-3 w-3 animate-spin"}),(0,e.jsx)(ne,{className:"h-3.5 w-3.5"}),s.keep?"Kept":"Keep on desk"]})]}),(0,e.jsx)(re,{item:s,companyId:t,expanded:o,onToggleExpand:d,onDismiss:p,onSnooze:m,agentMap:i,agents:l,showTriage:!0,currentUserId:a,evidence:b})]})}n(fe,"AgingItemRow");var ce=864e5;function C(s){return s?`/decisions/queues/${encodeURIComponent(s)}`:"/decisions"}n(C,"decisionsHref");function Ne({companyId:s,activeQueueKey:t=null}){const{data:r}=te({queryKey:I.decisionQueues.list(s),queryFn:n(()=>M.list(s),"queryFn"),enabled:!!s});if(!r||r.length===0)return null;const i=Date.now();return(0,e.jsxs)("nav",{className:"flex flex-wrap items-center gap-1.5","aria-label":"Decision queues","data-decision-queue-rail":!0,children:[(0,e.jsx)(E,{href:C(null),active:t==null,label:"All"}),r.map(l=>{const a=i-new Date(l.updatedAt).getTime()<ce;return(0,e.jsx)(E,{href:C(l.key),active:t===l.key,label:l.title,count:l.itemCount,recent:a},l.key)})]})}n(Ne,"DecisionQueueRail");function E({href:s,active:t,label:r,count:i,recent:l}){return(0,e.jsxs)(K,{to:s,className:x("inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-colors",t?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground hover:bg-accent/50 hover:text-foreground"),"aria-current":t?"page":void 0,children:[l&&(0,e.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-primary","aria-label":"Recent activity"}),(0,e.jsx)("span",{className:"truncate",children:r}),i!=null&&i>0&&(0,e.jsx)("span",{className:"tabular-nums text-(length:--text-nano) text-muted-foreground",children:i})]})}n(E,"Chip");var w=A(ee(),1);function ye({value:s,custom:t,onChange:r}){const[i,l]=(0,w.useState)(!1);return(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5","data-decision-date-chips":!0,children:[Y.map(([a,o])=>(0,e.jsx)(S,{active:s===a,onClick:n(()=>r(a,t),"onClick"),children:o},a)),(0,e.jsxs)(f,{open:i,onOpenChange:l,children:[(0,e.jsx)(N,{asChild:!0,children:(0,e.jsx)(S,{active:s==="custom",asChild:!0,children:(0,e.jsxs)("button",{type:"button",children:[(0,e.jsx)(ie,{className:"h-3.5 w-3.5"}),s==="custom"&&(t.from||t.to)?`${t.from??"…"} → ${t.to??"…"}`:"Custom"]})})}),(0,e.jsxs)(y,{align:"start",className:"w-auto space-y-2 p-3",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)("label",{className:"text-(length:--text-nano) font-medium uppercase tracking-wide text-muted-foreground",children:"From"}),(0,e.jsx)("input",{type:"date",value:t.from??"",max:t.to??void 0,className:"rounded-sm border border-border bg-background px-2 py-1 text-xs",onChange:n(a=>r("custom",{...t,from:a.target.value||null}),"onChange")})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)("label",{className:"text-(length:--text-nano) font-medium uppercase tracking-wide text-muted-foreground",children:"To"}),(0,e.jsx)("input",{type:"date",value:t.to??"",min:t.from??void 0,className:"rounded-sm border border-border bg-background px-2 py-1 text-xs",onChange:n(a=>r("custom",{...t,to:a.target.value||null}),"onChange")})]}),(0,e.jsx)("div",{className:"flex justify-end",children:(0,e.jsx)(g,{type:"button",variant:"ghost",size:"xs",onClick:n(()=>{r("all",{from:null,to:null}),l(!1)},"onClick"),children:"Clear"})})]})]})]})}n(ye,"DecisionDateChips");function S({active:s,onClick:t,asChild:r,children:i}){const l=x("inline-flex items-center gap-1 rounded-full border px-3 py-1 text-xs font-medium transition-colors",s?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground hover:bg-accent/50 hover:text-foreground");return r?(0,w.isValidElement)(i)?(0,w.cloneElement)(i,{className:x(l,i.props.className)}):(0,e.jsx)("span",{className:l,children:i}):(0,e.jsx)("button",{type:"button",className:l,onClick:t,"aria-pressed":s,children:i})}n(S,"ChipButton");export{ge as a,be as i,Ne as n,fe as r,ye as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var L=Object.defineProperty;var t=(a,i)=>L(a,"name",{value:i,configurable:!0});import{a as A}from"./rolldown-runtime-DhZMWcEn.js";import{C as R,x as q}from"./collections-B58p51lw.js";import{$A as z,$S as B,Cc as U,Ds as Q,Ev as Y,GS as O,Ls as G,MT as D,NE as E,Os as K,Rs as $,S_ as V,UT as W,Yb as J,_v as X,ab as Z,hv as ee,jT as se,ks as ae,nj as te,on as oe,pv as ne,ub as re,vv as ie,xE as le,zE as S}from"./index-BJtnP7H1.js";var l=A(te(),1),e=A(z(),1);function ce({item:a,onOpen:i,userLabelMap:o,showTimestamp:c=!1}){const d=a.handledForUserId?o?.get(a.handledForUserId)??"someone else":null;return(0,e.jsxs)("button",{type:"button",onClick:t(()=>i(a.href),"onClick"),"data-decision-history-item":a.id,className:"coordinator-decision-receipt flex w-full items-center gap-3 rounded-xl border border-border bg-card p-4 text-left hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,e.jsx)(D,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),(0,e.jsxs)("span",{className:S("min-w-0 flex-1 space-y-1",B),children:[(0,e.jsxs)("span",{className:"block text-sm font-medium",children:[$(a,o),d?(0,e.jsxs)("span",{className:"font-normal text-muted-foreground",children:[" · for @",d]}):null]}),(0,e.jsx)("span",{className:"block truncate text-sm text-muted-foreground",children:G(a)}),a.reason?(0,e.jsxs)("span",{className:"block text-sm text-muted-foreground","data-decision-history-reason":!0,children:["Reason: ",a.reason]}):null,c&&(0,e.jsx)("time",{className:"block text-xs tabular-nums text-muted-foreground",dateTime:a.resolvedAt,children:new Date(a.resolvedAt).toLocaleString()})]}),(0,e.jsx)(W,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0})]})}t(ce,"CoordinatorDecisionReceipt");function x({label:a,heading:i,value:o,options:c,onChange:d,defaultLabel:u,disabled:v}){const r=c.find(n=>n.value===o);return(0,e.jsxs)(ne,{children:[(0,e.jsx)(Y,{asChild:!0,children:(0,e.jsxs)(E,{variant:"outline",size:"sm",value:o,disabled:v,"aria-label":r?`${a}, ${r.label}`:a,children:[(0,e.jsx)("span",{className:"max-w-(--sz-160px) truncate font-medium",children:u??r?.label}),(0,e.jsx)(se,{"aria-hidden":!0,className:"size-3.5 text-muted-foreground"})]})}),(0,e.jsxs)(ee,{align:"start",collisionPadding:8,className:"w-(--sz-260px)","aria-label":i,children:[(0,e.jsx)(ie,{children:i}),c.map(n=>(0,e.jsxs)(X,{"aria-current":n.value===o||void 0,className:"items-start gap-2",onSelect:t(()=>d(n.value),"onSelect"),children:[(0,e.jsx)(D,{"aria-hidden":!0,className:S("mt-0.5 size-3.5 shrink-0",o!==n.value&&"opacity-0")}),(0,e.jsx)("span",{className:S("truncate",o===n.value&&"font-medium"),children:n.label})]},n.value))]})]})}t(x,"InboxFilter");var k="handled_for_me";function xe({companyId:a,agents:i,userLabelMap:o,afterControls:c}){const d=J(),[u,v]=(0,l.useState)(""),[r,n]=(0,l.useState)(""),[p,P]=(0,l.useState)(""),[j,T]=(0,l.useState)(""),[y,F]=(0,l.useState)("none"),[f,M]=(0,l.useState)("newest"),[g,C]=(0,l.useState)(ae),H=le({queryKey:O.projects.list(a),queryFn:t(()=>V.list(a),"queryFn")}),h=R({queryKey:[...O.attention(a),"history",{search:u,outcome:r,agentId:p,projectId:j,sort:f,scope:g}],queryFn:t(({pageParam:s})=>U.history(a,{search:u,agentId:p,projectId:j,sort:f,scope:g,cursor:s,limit:40,...r===k?{handledForMe:!0}:{outcome:r}}),"queryFn"),initialPageParam:void 0,getNextPageParam:t(s=>s.nextCursor??void 0,"getNextPageParam")}),m=re(h),_=m.kind==="loading"||m.kind==="reconnecting",w=h.data?.pages.flatMap(s=>s.items)??[],N=new Map;for(const s of w){const b=y==="task"?s.issueIdentifier??s.issueTitle??"No task":y==="agent"?s.agentName??"Other agents":y==="project"?s.projectName??"No project":"";N.set(b,[...N.get(b)??[],s])}return(0,e.jsxs)("div",{className:"space-y-5","data-decision-history":!0,children:[(0,e.jsxs)("div",{role:"toolbar","aria-label":"Decision history controls",className:"space-y-5",children:[(0,e.jsx)(q,{query:u,onQueryChange:v,label:"Search decision history",placeholder:"Search decisions or task IDs…"}),(0,e.jsxs)("div",{"data-canonical-toolbar":"history",children:[(0,e.jsx)(x,{label:"Whose decision history",heading:"Whose decisions",value:g,options:K,onChange:C}),(0,e.jsx)(x,{label:"Filter decision outcomes",heading:"Outcome",value:r,onChange:n,options:[{value:"",label:"All outcomes"},...Q,{value:k,label:"Handled for me"}]}),(0,e.jsx)(x,{label:"Sort decision history",heading:"Sort by",value:f,onChange:M,options:[{value:"newest",label:"Newest first"},{value:"oldest",label:"Oldest first"}]}),(0,e.jsx)(x,{label:"Filter decision history by agent",heading:"Agents",value:p,onChange:P,options:[{value:"",label:"All agents"},...i.map(s=>({value:s.id,label:s.name}))]}),(0,e.jsx)(x,{label:"Filter decision history by project",heading:"Projects",value:j,onChange:T,options:[{value:"",label:"All projects"},...(H.data??[]).map(s=>({value:s.id,label:s.name}))]}),(0,e.jsx)(x,{label:"Group decision history",heading:"Group by",value:y,onChange:F,options:[{value:"none",label:"No grouping"},{value:"task",label:"By task"},{value:"agent",label:"By agent"},{value:"project",label:"By project"}]})]})]}),c,_?(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Loading decisions…"}):null,m.kind==="error"?(0,e.jsx)(Z,{error:m.error,onRetry:m.retry}):null,!_&&m.kind!=="error"&&!w.length&&(0,e.jsx)(oe,{placement:"upper",message:g==="mine"&&!u&&!r&&!p&&!j?"No decisions handled by you or for you yet.":"No decisions match these filters.",action:g==="mine"?"Show everyone's decisions":void 0,onAction:t(()=>C("all"),"onAction"),hideActionIcon:!0}),(0,e.jsx)("div",{className:"space-y-4",children:[...N].map(([s,b])=>(0,e.jsxs)("section",{className:"space-y-3",children:[s&&(0,e.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:s}),b.map(I=>(0,e.jsx)(ce,{item:I,onOpen:d,userLabelMap:o,showTimestamp:!0},I.id))]},s))}),h.hasNextPage?(0,e.jsx)(E,{variant:"outline",disabled:h.isFetchingNextPage,onClick:t(()=>{h.fetchNextPage()},"onClick"),children:h.isFetchingNextPage?"Loading…":"Load more decisions"}):null]})}t(xe,"DecisionHistoryPanel");export{xe as DecisionHistoryPanel,ce as n,x as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var fe=Object.defineProperty;var n=(t,l)=>fe(t,"name",{value:l,configurable:!0});import{a as ee}from"./rolldown-runtime-DhZMWcEn.js";import{a as be,i as je,n as ve,r as Ne,t as Se}from"./DecisionDateChips-BLZKZH71.js";import{$A as we,$s as J,Cc as Ce,Cx as Ae,Ex as qe,GS as c,LS as Ee,ME as Re,MT as Ie,NE as T,PC as Ke,Ri as Qe,Tx as Fe,YS as Te,_c as ke,_w as se,aE as De,ab as Me,an as Oe,bE as te,bc as Ge,cc as Pe,cv as ne,dc as ze,fc as Be,gc as _e,hE as ae,hc as Le,iC as Ue,ib as Ve,nc as $e,nj as He,o as Z,oc as We,pb as Xe,pc as Ye,rb as Je,rc as Ze,s as es,sc as ss,u as _,ub as ts,uc as ns,vc as as,xE as F,yc as os,zE as is}from"./index-BJtnP7H1.js";import{AttentionQueueRow as rs}from"./AttentionQueueRow-Bh0dKHpF.js";var a=ee(He(),1),e=ee(we(),1);function gs(){const{selectedCompanyId:t}=Ee(),{setBreadcrumbs:l}=Ve(),{pushToast:m}=ne(),u=Re(),i=De().key??"",[C,k]=(0,a.useState)(null),{dismiss:A,snooze:q}=Qe(t),[y,D]=(0,a.useState)(""),[p,E]=(0,a.useState)(()=>ze()),[f,b]=(0,a.useState)(()=>Be()),[x,j]=(0,a.useState)(()=>We),[g,h]=(0,a.useState)(()=>new Set),[oe,ie]=(0,a.useState)(!1),[M,re]=(0,a.useState)("all"),[O,de]=(0,a.useState)({from:null,to:null}),G=(0,a.useMemo)(()=>Le(M,Date.now(),O),[M,O]),{data:L}=F({queryKey:c.decisionQueues.list(t),queryFn:n(()=>_.list(t),"queryFn"),enabled:!!t}),r=(0,a.useMemo)(()=>L?.find(s=>s.key===i)??null,[L,i]),U=F({queryKey:[...c.attention(t),"queue",i,G.activitySince??null,G.activityUntil??null],queryFn:n(()=>Ce.list(t,{queue:i,all:!0,...G}),"queryFn"),enabled:!!t&&!!i,refetchOnWindowFocus:!0}),{data:v,isLoading:le}=U,N=ts(U),{data:R}=F({queryKey:c.agents.list(t),queryFn:n(()=>Je.list(t),"queryFn"),enabled:!!t}),{data:V}=F({queryKey:c.auth.session,queryFn:n(()=>Te.getSession(),"queryFn")}),$=V?.user?.id??V?.session?.userId??null,H=(0,a.useMemo)(()=>{const s=new Map;for(const o of R??[])s.set(o.id,o);return s},[R]);(0,a.useEffect)(()=>{l([{label:"Decisions",href:"/decisions"},{label:r?.title??i}])},[l,r?.title,i]),(0,a.useEffect)(()=>{j(ns(t)),h(Ye(t))},[t]);const P=(0,a.useMemo)(()=>v?.generatedAt?new Date(v.generatedAt).getTime():Date.now(),[v?.generatedAt]),I=(0,a.useMemo)(()=>es(v?.items??[]),[v]),S=(0,a.useMemo)(()=>I.cards.filter(s=>!(s.dismissal?.isActive??!1)),[I]),z=(0,a.useMemo)(()=>S.filter(J),[S]),K=(0,a.useMemo)(()=>S.filter(s=>!J(s)),[S]),ue=(0,a.useMemo)(()=>$e(K),[K]),B=(0,a.useMemo)(()=>{const s=ss(K,x,y);if(p==="none")return Ze(s,P);const o=Ge(s,f);return Pe(o,p)},[K,x,y,f,p,P]),W=(0,a.useMemo)(()=>B.reduce((s,o)=>s+o.items.length,0),[B]),ce=n(s=>{E(s),ke(s)},"updateGroupBy"),me=n(s=>{b(s),as(s)},"updateSortOrder"),pe=n(s=>{j(s),_e(t,s)},"updateFilters"),xe=n(s=>{h(o=>{const d=new Set(o);return d.has(s)?d.delete(s):d.add(s),os(t,d),d})},"toggleGroupCollapse"),X=(0,a.useCallback)(s=>{k(o=>o===s.id?null:s.id)},[]),ge=n(()=>{u.invalidateQueries({queryKey:c.attention(t)}),u.invalidateQueries({queryKey:c.decisionQueues.list(t)})},"invalidate"),Y=te({mutationFn:n(s=>_.update(t,i,{seedRulesEnabled:s}),"mutationFn"),onSuccess:n(()=>u.invalidateQueries({queryKey:c.decisionQueues.list(t)}),"onSuccess"),onError:n(s=>m({title:"Could not update seeding",body:ae(s).body,tone:"error"}),"onError")});if(!t)return(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Select an organization first."});if(le||N.kind==="reconnecting")return(0,e.jsx)(Xe,{variant:"approvals"});if(N.kind==="error")return(0,e.jsx)(Me,{size:"page",error:N.error,action:"load this queue",onRetry:N.retry,retrying:N.isFetching});const he=S.length===0;return(0,e.jsxs)("div",{className:"max-w-3xl space-y-4",children:[(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("h1",{className:"text-xl font-bold",children:r?.title??i}),r?.description&&(0,e.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:r.description})]}),(0,e.jsx)(be,{query:y,onQueryChange:D,visibleCount:W,filterOptions:ue,filters:x,onFiltersChange:pe,groupBy:p,onGroupByChange:ce,sortOrder:f,onSortOrderChange:me})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(ve,{companyId:t,activeQueueKey:i}),(0,e.jsx)(Se,{value:M,custom:O,onChange:n((s,o)=>{re(s),de(o)},"onChange")})]}),r&&r.seedRules.length>0&&(0,e.jsx)(ds,{enabled:r.seedRulesEnabled,rules:r.seedRules.map(s=>s.description),pending:Y.isPending,onToggle:n(()=>Y.mutate(!r.seedRulesEnabled),"onToggle")}),he?(0,e.jsxs)("div",{className:"rounded-xl border border-dashed border-border py-14 text-center",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:"This queue is empty."}),(0,e.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Decisions land here when they match the queue's rules or an agent adds them."})]}):(0,e.jsxs)("div",{className:"space-y-4",children:[W===0?(0,e.jsxs)("div",{className:"rounded-xl border border-dashed border-border py-10 text-center",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-foreground",children:"No decisions match your search or filters."}),(0,e.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Adjust or clear your search and filters to see the rest."})]}):B.map(s=>{const o=s.label,d=o!==null&&g.has(s.key);return(0,e.jsxs)("section",{className:"space-y-2",children:[o!==null&&(0,e.jsx)(Oe,{label:o,collapsible:!0,collapsed:d,onToggle:n(()=>xe(s.key),"onToggle"),trailing:(0,e.jsx)("span",{className:"text-xs tabular-nums text-muted-foreground",children:s.items.length})}),!d&&(0,e.jsx)("div",{className:"space-y-4",children:s.items.map(Q=>(0,e.jsx)(ls,{item:Q,companyId:t,queueKey:i,agentMap:H,agents:R,currentUserId:$,expanded:C===Q.id,onToggleExpand:X,onDismiss:n(w=>A(w.dismissalKey,w.changeFingerprint),"onDismiss"),onSnooze:n((w,ye)=>q(w.dismissalKey,ye,w.changeFingerprint),"onSnooze"),onExcluded:ge,evidence:Z(I,Q)},Q.id))})]},s.key)}),z.length>0&&(0,e.jsxs)(je,{label:"Aging",count:z.length,open:oe,onToggle:n(()=>ie(s=>!s),"onToggle"),children:[(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Idle past ",30," days — kept off the queue. Keep any you still want surfaced."]}),z.map(s=>(0,e.jsx)(Ne,{item:s,companyId:t,now:P,agentMap:H,agents:R,currentUserId:$,expanded:C===s.id,onToggleExpand:X,onDismiss:n(o=>A(o.dismissalKey,o.changeFingerprint),"onDismiss"),onSnooze:n((o,d)=>q(o.dismissalKey,d,o.changeFingerprint),"onSnooze"),evidence:Z(I,s)},s.id))]})]})]})}n(gs,"DecisionQueuePage");function ds({enabled:t,rules:l,pending:m,onToggle:u}){return(0,e.jsx)("div",{className:"rounded-xl border border-border bg-muted/20 p-3",children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,e.jsx)(Ke,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsxs)("p",{className:"text-sm font-medium text-foreground",children:["Auto-seeding is ",t?"on":"off"]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t?"This queue fills itself automatically. Decisions are added the moment they match any of its rules:":"Automatic adds are paused. These rules would add decisions to the queue when on:"}),(0,e.jsx)("ul",{className:"mt-0.5 space-y-0.5",children:l.map(i=>(0,e.jsxs)("li",{className:"flex items-start gap-1.5 text-xs text-muted-foreground",children:[(0,e.jsx)(Ie,{className:"mt-0.5 h-3 w-3 shrink-0"}),i]},i))}),(0,e.jsx)("p",{className:"text-(length:--text-nano) text-muted-foreground",children:t?"Turning it off stops new automatic adds only — decisions already here stay, and you can still add or remove decisions by hand.":"Adding or removing decisions by hand still works while automatic seeding is off."})]})]}),(0,e.jsxs)(T,{type:"button",variant:"outline",size:"xs",className:"h-7 shrink-0",disabled:m,onClick:u,children:[m&&(0,e.jsx)(se,{className:"h-3 w-3 animate-spin"}),t?"Disable":"Enable"]})]})})}n(ds,"SeedRulesCard");function ls({item:t,companyId:l,queueKey:m,agentMap:u,agents:i,currentUserId:C,expanded:k,onToggleExpand:A,onDismiss:q,onSnooze:y,onExcluded:D,evidence:p}){const{pushToast:E}=ne(),[f,b]=(0,a.useState)(!1),[x,j]=(0,a.useState)(""),g=te({mutationFn:n(async()=>{await _.removeItem(l,m,t.sourceKind,t.subject.id,x.trim()||void 0)},"mutationFn"),onSuccess:n(()=>{b(!1),j(""),E({title:"Removed from queue",body:t.subject.title??void 0,tone:"info"}),D()},"onSuccess"),onError:n(h=>E({title:"Could not exclude",body:ae(h).body,tone:"error"}),"onError")});return(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("div",{className:"flex items-center justify-end px-1",children:(0,e.jsxs)(Ae,{open:f,onOpenChange:b,children:[(0,e.jsx)(qe,{asChild:!0,children:(0,e.jsxs)(T,{type:"button",variant:"ghost",size:"xs",className:"h-7 gap-1 text-muted-foreground",children:[(0,e.jsx)(Ue,{className:"h-3.5 w-3.5"}),"Exclude"]})}),(0,e.jsxs)(Fe,{align:"end",className:"w-64 space-y-2 p-3",children:[(0,e.jsx)("p",{className:"text-xs font-medium text-foreground",children:"Remove from this queue"}),(0,e.jsx)("textarea",{value:x,onChange:n(h=>j(h.target.value),"onChange"),placeholder:"Reason (optional)…",className:"min-h-16 w-full rounded-sm border border-border bg-background px-2 py-1 text-xs"}),(0,e.jsxs)("div",{className:"flex justify-end gap-1",children:[(0,e.jsx)(T,{type:"button",variant:"ghost",size:"xs",onClick:n(()=>b(!1),"onClick"),children:"Cancel"}),(0,e.jsxs)(T,{type:"button",size:"xs",className:is(g.isPending&&"opacity-80"),disabled:g.isPending,onClick:n(()=>g.mutate(),"onClick"),children:[g.isPending&&(0,e.jsx)(se,{className:"h-3 w-3 animate-spin"}),"Exclude"]})]})]})]})}),(0,e.jsx)(rs,{item:t,companyId:l,expanded:k,onToggleExpand:A,onDismiss:q,onSnooze:y,agentMap:u,agents:i,showTriage:!0,currentUserId:C,evidence:p})]})}n(ls,"QueueItemRow");export{gs as DecisionQueuePage};
|