@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,9 @@
|
|
|
1
|
+
var Xt=Object.defineProperty;var s=(t,n)=>Xt(t,"name",{value:n,configurable:!0});import{a as jt}from"./rolldown-runtime-DhZMWcEn.js";import{Ai as $e,Di as bt,Ei as Jt,L as Zt,Nt as es,Oi as st,Qt as nt,R as ts,Ti as vt,V as ss,Xr as ns,Xt as as,Yt as rs,Zt as at,ji as is,ki as ls,un as os,wi as rt}from"./issue-detail-CZfjXs0M.js";import{b as yt}from"./collections-B58p51lw.js";import{l as ds,s as cs,u as De}from"./SkillFolderTree-Cv0CmfYx.js";import{t as us}from"./folder-plus-BJZSMzuj.js";import{$A as ms,$S as xs,Ai as qe,BC as kt,B_ as hs,Cm as ps,Cx as fs,Dw as gs,E_ as js,Ep as bs,Ev as Nt,Ex as vs,Fb as ys,GS as F,Gb as Ae,HE as St,H_ as ne,Hm as ks,In as wt,JC as Ns,Kr as Ue,Kw as Ss,LS as ws,Ln as Ct,MC as Cs,ME as se,Mi as de,NE as R,O_ as Ts,Pb as Fs,Pn as Rs,QT as Ge,Rb as Es,Sm as Ds,Tx as As,Wm as _,XC as Ps,Yb as Pe,Yw as Ls,Zw as Tt,_ as Is,__ as J,_v as Ye,_w as We,aE as Ms,a_ as _s,ab as $s,bE as V,bb as ye,bm as qs,cT as Ft,d as zs,dy as ke,fy as ce,g as Bs,gC as ue,g_ as ie,hC as le,hv as Rt,iC as Ks,iD as Ne,i_ as Vs,ib as Os,jT as He,j_ as Qs,ji as Et,kT as ve,ki as Dt,lS as Se,ly as me,my as xe,nE as Us,nT as At,nj as Ys,nl as Gs,oE as Pt,on as Le,op as O,ov as he,p as Ws,pE as Hs,pT as Xs,pv as Lt,qC as pe,qT as Js,qp as Zs,rb as Fe,sC as It,sy as fe,ub as Mt,uy as ge,vb as G,vm as Xe,wm as en,x as _t,xE as Y,xb as W,xm as tn,xv as sn,yb as H,yl as nn,ym as an,zC as rn,zE as te,z_ as ln}from"./index-BJtnP7H1.js";import{a as we,c as on,i as dn,l as cn,n as un,o as ze,r as mn,s as xn,t as hn}from"./SkillCardIcon-Cp_hws0N.js";import{t as Je}from"./EntityRow-BsICt6pd.js";import{t as pn}from"./SkillBinaryFile-DDkhLlfC.js";import{a as oe,i as fn}from"./company-skill-routes-D5LJ1l8M.js";import{n as Ie}from"./SkillsNavigationTabs-DRwMP1eu.js";import"./CompanySkills-eTqgbqQN.js";import{i as gn,n as it,r as Be,t as jn}from"./FilterBar-rCmsTtG4.js";var $t={name:"file-plus",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]};$t.node;var Ze=Ge($t),qt={name:"folder-git-2",size:24,node:[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]};qt.node;var bn=Ge(qt),zt={name:"folder-minus",size:24,node:[["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};zt.node;var vn=Ge(zt),u=jt(Ys(),1),Bt="paperclip:recent-studio-skills";function yn(){return Vs(Bt)}s(yn,"getRecentStudioSkillIds");function kn(t){_s(Bt,t)}s(kn,"trackRecentStudioSkill");var e=jt(ms(),1),Ke="__latest__";function Nn({companyId:t,skill:n,canManage:a=!0}){const[o,i]=(0,u.useState)(!1),l=n.usedByAgents.length,r=`${l} ${l===1?"agent uses":"agents use"} this skill`;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("button",{type:"button",onClick:s(()=>i(!0),"onClick"),"aria-label":r,className:te("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors",l>0?"border-border bg-muted text-foreground hover:bg-accent":"border-border/60 bg-transparent text-muted-foreground hover:bg-accent/50"),children:[(0,e.jsx)(It,{className:"h-3.5 w-3.5","aria-hidden":"true"}),l," ",l===1?"agent":"agents"]}),(0,e.jsx)(Sn,{open:o,onOpenChange:i,companyId:t,skill:n,canManage:a})]})}s(Nn,"AgentsUsingSkillBadge");function Sn({open:t,onOpenChange:n,companyId:a,skill:o,canManage:i=!0}){const l=se(),r=he(),d=nn(),[c,f]=(0,u.useState)(null),[m,k]=(0,u.useState)(null),x=o.currentVersion!==null,h=Y({queryKey:F.companySkills.versions(a,o.id),queryFn:s(()=>_.versions(a,o.id),"queryFn"),enabled:t&&x}),g=Y({queryKey:F.agents.list(a),queryFn:s(()=>Fe.list(a),"queryFn"),enabled:t});(0,u.useEffect)(()=>{t||k(null)},[t]);const w=(0,u.useMemo)(()=>[...h.data??[]].sort((p,D)=>D.revisionNumber-p.revisionNumber),[h.data]),E=o.currentVersion?.revisionNumber??null,M=(0,u.useMemo)(()=>new Map(w.map(p=>[p.id,p.revisionNumber])),[w]),A=(0,u.useMemo)(()=>new Map((g.data??[]).map(p=>[p.id,p])),[g.data]),C=(0,u.useMemo)(()=>new Set(o.usedByAgents.map(p=>p.id)),[o.usedByAgents]),N=(0,u.useMemo)(()=>(g.data??[]).filter(p=>!C.has(p.id)&&p.status!=="terminated"&&d(p.adapterType).supportsSkills).sort((p,D)=>p.name.localeCompare(D.name)),[g.data,C,d]),S=V({mutationFn:s(async({agent:p,change:D})=>{const K=o.key,I=await Fe.skills(p.id,a),L=I.desiredSkillEntries??I.desiredSkills.map(P=>({key:P,versionId:null})),$=[...L.filter(P=>P.key!==K)];if(D.kind!=="remove"){const P=D.kind==="pin"?D.versionId:null;$.push({key:K,versionId:P})}return Tn(L,$)?{agentId:p.id,changed:!1}:(await Fe.syncSkills(p.id,$,"replace",a),{agentId:p.id,changed:!0})},"mutationFn"),onSuccess:s(async({agentId:p})=>{await Promise.all([l.invalidateQueries({queryKey:F.companySkills.detail(a,o.id)}),l.invalidateQueries({queryKey:F.companySkills.list(a)}),l.invalidateQueries({queryKey:F.agents.skills(p)})])},"onSuccess"),onError:s(p=>{const D=p instanceof Error?p.message:"Failed to update agent skills.";r?.pushToast({tone:"error",title:"Update failed",body:D.includes("403")?"You don't have permission to change this agent's skills.":D})},"onError")});async function j(p,D){f(p.id);try{await S.mutateAsync({agent:p,change:D}),k(null)}catch{}finally{f(null)}}s(j,"applyChange");const T=o.usedByAgents,B=T.length;return(0,e.jsx)(fe,{open:t,onOpenChange:n,children:(0,e.jsxs)(me,{className:"max-w-lg",children:[(0,e.jsxs)(ce,{children:[(0,e.jsxs)(xe,{children:["Agents using ",o.name]}),(0,e.jsx)(ge,{children:B===0?"No agents have this skill assigned yet.":`${B} ${B===1?"agent has":"agents have"} this skill in their desired set.`})]}),(0,e.jsx)("div",{className:"max-h-80 overflow-y-auto",children:B===0?(0,e.jsx)("div",{className:"rounded-md border border-dashed border-border px-4 py-8 text-center text-sm text-muted-foreground",children:i?"Add an agent below to assign this skill.":"This skill isn't assigned to any agents."}):(0,e.jsx)("ul",{className:"divide-y divide-border",children:T.map(p=>(0,e.jsx)(wn,{agent:p,icon:A.get(p.id)?.icon??null,canManage:i,hasVersions:x,versions:w,latestRevision:E,pinnedRevision:p.versionId?M.get(p.versionId)??null:null,busy:c===p.id,confirmingRemove:m===p.id,onRequestRemove:s(()=>k(p.id),"onRequestRemove"),onCancelRemove:s(()=>k(null),"onCancelRemove"),onRemove:s(()=>j(p,{kind:"remove"}),"onRemove"),onPin:s(D=>j(p,{kind:"pin",versionId:D}),"onPin")},p.id))})}),i?(0,e.jsxs)("div",{className:"flex items-center gap-2 border-t border-border pt-3",children:[(0,e.jsx)(Cn,{agents:N,loading:g.isLoading,disabled:S.isPending,onSelect:s(p=>j(p,{kind:"add"}),"onSelect")}),S.isPending?(0,e.jsx)(We,{className:"h-4 w-4 animate-spin text-muted-foreground","aria-hidden":"true"}):null]}):null]})})}s(Sn,"AgentsUsingSkillDialog");function wn({agent:t,icon:n,canManage:a,hasVersions:o,versions:i,latestRevision:l,pinnedRevision:r,busy:d,confirmingRemove:c,onRequestRemove:f,onCancelRemove:m,onRemove:k,onPin:x}){const h=r!==null&&l!==null&&l>r?l-r:0;return(0,e.jsxs)("li",{className:"flex items-center gap-3 py-2.5",children:[(0,e.jsx)(Rs,{icon:n,className:"h-6 w-6 shrink-0 rounded-md text-muted-foreground"}),(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,e.jsx)(Ae,{to:`/agents/${t.urlKey}/skills`,className:"truncate text-sm font-medium text-foreground hover:underline",children:t.name}),(0,e.jsx)("span",{className:"truncate text-(length:--text-micro) uppercase tracking-(--tracking-caps) text-muted-foreground",children:t.adapterType})]}),(0,e.jsxs)("div",{className:"flex shrink-0 flex-col items-end gap-0.5",children:[o?a?(0,e.jsxs)("select",{"aria-label":`${t.name} skill version`,value:t.versionId??Ke,disabled:d,onChange:s(g=>x(g.target.value===Ke?null:g.target.value),"onChange"),className:"h-8 rounded-md border border-border bg-background px-2 text-xs text-foreground disabled:opacity-60",children:[(0,e.jsxs)("option",{value:Ke,children:["Latest",l!==null?` (v${l})`:""]}),i.map(g=>(0,e.jsxs)("option",{value:g.id,children:["v",g.revisionNumber,g.label?` · ${g.label}`:""]},g.id))]}):(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:t.versionId?`v${r??"?"}`:`Latest${l!==null?` (v${l})`:""}`}):(0,e.jsx)("span",{className:"text-sm text-muted-foreground","aria-label":`${t.name} version`,children:"—"}),h>0?(0,e.jsxs)("span",{className:"text-(length:--text-nano) text-amber-500",children:[h," version",h===1?"":"s"," behind latest"]}):null]}),a?c?(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[(0,e.jsx)(R,{variant:"destructive",size:"sm",onClick:k,disabled:d,"aria-label":`Confirm removing this skill from ${t.name}`,children:d?(0,e.jsx)(We,{className:"h-3.5 w-3.5 animate-spin"}):"Remove"}),(0,e.jsx)(R,{variant:"ghost",size:"sm",onClick:m,disabled:d,children:"Cancel"})]}):(0,e.jsx)(R,{variant:"ghost",size:"icon-sm",onClick:f,disabled:d,className:"shrink-0 text-muted-foreground hover:text-destructive","aria-label":`Remove this skill from ${t.name}`,children:(0,e.jsx)(ue,{className:"h-4 w-4"})}):null]})}s(wn,"AgentRow");function Cn({agents:t,loading:n,disabled:a,onSelect:o}){const i=(0,u.useMemo)(()=>[{id:"agents",options:t.map(l=>({key:l.id,value:l.id,label:l.name,title:l.name,searchText:[l.name,l.adapterType].join(" "),agent:l}))}],[t]);return(0,e.jsx)(Xe,{value:"",groups:i,loading:n,loadingMessage:"Loading agents...",placeholder:"Add agent…",searchPlaceholder:"Search agents...",emptyMessage:"All eligible agents already have this skill.",disabled:a,onValueChange:s((l,r)=>(o(r.agent),{close:!0}),"onValueChange"),triggerClassName:"h-8 w-full justify-start",contentClassName:"w-72",renderValue:s(()=>(0,e.jsxs)("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[(0,e.jsx)(pe,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Add agent…"]}),"renderValue"),renderOption:s(l=>(0,e.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,e.jsx)("span",{className:"truncate",children:l.label}),(0,e.jsx)("span",{className:"truncate text-(length:--text-micro) uppercase tracking-(--tracking-caps) text-muted-foreground",children:l.agent.adapterType})]}),"renderOption")})}s(Cn,"AddAgentPicker");function Tn(t,n){if(t.length!==n.length)return!1;const a=s(i=>`${i.key}\0${i.versionId??""}`,"encode"),o=new Set(t.map(a));return n.every(i=>o.has(a(i)))}s(Tn,"desiredSetsEqual");function Fn(t){if(!t)return null;const n=t.trim();return n?/^[0-9a-f]{8,40}$/i.test(n)?n.slice(0,7):n:null}s(Fn,"shortSha");function Rn(t){switch(t){case"managed":return"Microvac";case"github":return"GitHub";case"skills_sh":return"skills.sh";case"url":return"a URL";case"catalog":return"the catalog";case"local_path":return"a local path";default:return"its source"}}s(Rn,"sourceTypeFallbackLabel");function En(t){let n=t.replace(/^git@github\.com:/i,"").replace(/^https?:\/\/github\.com\//i,"");n=n.split("#")[0].split("?")[0].replace(/\.git$/i,"");const a=n.split("/").filter(Boolean);return a.length>=2?`${a[0]}/${a[1]}`:null}s(En,"githubOwnerRepo");function Dn(t){return t.replace(/^https?:\/\//i,"").replace(/\/+$/,"")}s(Dn,"prettyUrl");function An(t){const n=t.sourceLocator?.trim()??"";return n?t.sourceType==="github"?En(n)??n:t.sourceType==="url"?Dn(n):n:Rn(t.sourceType)}s(An,"formatForkSourceName");function Pn(t){const n=An(t),a=Fn(t.sourceRef);return a?`${n} @ ${a}`:n}s(Pn,"formatLineageLabel");function Ln(t){return t.find(n=>n.createdByCurrentActor&&!n.diverged)??null}s(Ln,"pickReusableFork");function In(t){return t<=0?"No agents currently use this skill":`${t} ${t===1?"agent":"agents"} currently use${t===1?"s":""} this skill`}s(In,"agentUsageSentence");function Mn(t){return t.map(n=>n.id)}s(Mn,"reassignTargetIds");function _n(t){if(!t||typeof t!="object")return!1;const n=t.sourceKind;return typeof n=="string"&&n.trim()==="project_scan"}s(_n,"isProjectScanSkill");function $n({companyId:t,skill:n,open:a,onOpenChange:o}){const i=Pe(),l=se(),r=he(),[d,c]=(0,u.useState)(!0),f=(0,u.useMemo)(()=>({skillId:n.id,original:{id:n.id,name:n.name,slug:n.slug,sourceType:n.sourceType,sourceLocator:n.sourceLocator,sourceRef:n.sourceRef},agentUsageCount:n.attachedAgentCount,usedByAgents:n.usedByAgents,existingForks:n.existingForks}),[n]),m=Y({queryKey:F.companySkills.forkPrecheck(t,n.id),queryFn:s(()=>_.forkPrecheck(t,n.id),"queryFn"),enabled:a&&!!(t&&n.id),initialData:f}).data??f,k=m.usedByAgents,x=m.agentUsageCount,h=(0,u.useMemo)(()=>Ln(m.existingForks),[m.existingForks]);(0,u.useEffect)(()=>{a&&c(!0)},[a]);const g=V({mutationFn:s(()=>_.fork(t,n.id,{reassignAgentIds:d?Mn(k):[]}),"mutationFn"),onSuccess:s(A=>{l.invalidateQueries({queryKey:F.companySkills.list(t)}),l.invalidateQueries({queryKey:F.companySkills.detail(t,n.id)}),l.invalidateQueries({queryKey:F.agents.list(t)});for(const N of A.reassignments)l.invalidateQueries({queryKey:F.agents.skills(N.agentId)});const C=A.reassignments.length;r?.pushToast({tone:"success",title:"Editing a copy",body:C>0?`Created a copy of ${n.name} and switched ${C} ${C===1?"agent":"agents"} to it.`:`Created a copy of ${n.name}. It's now editable.`}),o(!1),i(oe(A.skill.id))},"onSuccess"),onError:s(A=>{r?.pushToast({tone:"error",title:"Couldn't create a copy",body:A instanceof Error?A.message:"The fork request failed."})},"onError")}),w=g.isPending,E=d&&x>0?`Create copy & switch ${x} ${x===1?"agent":"agents"}`:"Create copy",M=s(()=>{h&&(o(!1),i(oe(h.id)))},"openExisting");return(0,e.jsx)(fe,{open:a,onOpenChange:s(A=>w?void 0:o(A),"onOpenChange"),children:(0,e.jsxs)(me,{className:"sm:max-w-lg",children:[(0,e.jsxs)(ce,{children:[(0,e.jsxs)(xe,{className:"flex items-center gap-2",children:[(0,e.jsx)(De,{className:"h-4 w-4"}),"Edit a copy of ",n.name]}),(0,e.jsxs)(ge,{children:[n.name," is read-only because it comes from an external source. Creating a fully editable copy in your workspace leaves the original untouched and still updatable."]})]}),h?(0,e.jsxs)("div",{className:"rounded-md border border-primary/40 bg-primary/5 p-3 text-sm",children:[(0,e.jsx)("p",{className:"font-medium text-foreground",children:"You already have a copy"}),(0,e.jsx)("p",{className:"mt-0.5 text-muted-foreground",children:"An unedited copy of this skill already exists. Open it instead of making another."}),(0,e.jsx)(R,{type:"button",size:"sm",className:"mt-2",onClick:M,disabled:w,children:"Open your existing copy"})]}):null,(0,e.jsxs)("div",{className:te("rounded-md border p-3",x>0?"border-amber-500/40 bg-amber-500/5":"border-border bg-muted/30"),children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,e.jsx)(It,{className:"h-4 w-4 shrink-0"}),(0,e.jsx)("span",{children:In(x)})]}),x>0?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:k.map(A=>(0,e.jsx)("span",{className:"inline-flex items-center rounded-full border border-border bg-background px-2 py-0.5 text-xs text-foreground",children:A.name},A.id))}),(0,e.jsxs)("label",{className:"mt-3 flex items-start justify-between gap-3",children:[(0,e.jsxs)("span",{className:"text-sm",children:[(0,e.jsx)("span",{className:"font-medium text-foreground",children:"Switch these agents to the copy"}),(0,e.jsx)("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:d?"These agents will run your copy instead of the original.":"These agents keep running the original — your copy won't change what they do."})]}),(0,e.jsx)(bs,{checked:d,onCheckedChange:c,disabled:w,"aria-label":"Switch these agents to the copy"})]})]}):(0,e.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Nothing is assigned to it, so your copy won't change any agent's behaviour."})]}),(0,e.jsxs)(ke,{children:[(0,e.jsx)(R,{type:"button",variant:"ghost",onClick:s(()=>o(!1),"onClick"),disabled:w,children:"Cancel"}),(0,e.jsxs)(R,{type:"button",variant:h?"outline":"default",onClick:s(()=>g.mutate(),"onClick"),disabled:w,children:[w?(0,e.jsx)(We,{className:"mr-1.5 h-4 w-4 animate-spin"}):null,h?"Create another copy":E]})]})]})})}s($n,"ForkSkillDialog");function qn({companyId:t,forkedFromSkillId:n}){const a=Y({queryKey:F.companySkills.detail(t,n??""),queryFn:s(()=>_.detail(t,n),"queryFn"),enabled:!!(t&&n),staleTime:6e4});if(!n)return null;const o=a.data,i=o?Pn(o):"the original skill";return(0,e.jsxs)(Ae,{to:oe(n),className:"inline-flex max-w-full items-center gap-1.5 rounded-full border border-border bg-muted px-2.5 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",title:`Forked from ${i}`,children:[(0,e.jsx)(De,{className:"h-3 w-3 shrink-0"}),(0,e.jsxs)("span",{className:"truncate",children:["Forked from ",(0,e.jsx)("span",{className:"font-medium text-foreground",children:i})]})]})}s(qn,"SkillLineageChip");function zn({skill:t,onEditACopy:n}){const a=t.sourcePath??t.sourceLabel??"the project working tree";return(0,e.jsxs)("div",{className:"flex flex-wrap items-start gap-2 border-b border-border bg-muted/40 px-3 py-2 text-xs text-muted-foreground",children:[(0,e.jsx)(bn,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsxs)("span",{children:["This skill lives in ",(0,e.jsx)("span",{className:"font-mono text-foreground",children:a}),". Saves write to the project working tree and are not committed."]})," ",(0,e.jsx)(R,{type:"button",variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:n,children:"Edit a copy instead"})]})]})}s(zn,"ProjectScanNotice");function Kt(t){return t===null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}s(Kt,"isScalar");function Ce(t){return t==null?"":typeof t=="boolean"?t?"true":"false":String(t)}s(Ce,"scalarToText");function Vt(t){return t===""?"":t==="true"?!0:t==="false"?!1:t==="null"||t==="~"?null:/^-?\d+(\.\d+)?$/u.test(t)?Number(t):t}s(Vt,"coerceScalar");function Bn(t){return bt(t)&&Object.values(t).every(Kt)}s(Bn,"isFlatScalarRecord");function lt(t){const n="allowed-tools"in t,a=t.metadata,o="metadata"in t,i=o&&Bn(a),l=i?Object.entries(a).map(([d,c],f)=>({id:`meta-${f}-${d}`,key:d,rawValue:c,text:Ce(c),edited:!1})):[],r=Jt(t).map((d,c)=>{const f=t[d],m=Kt(f);return{id:`unknown-${c}-${d}`,key:d,rawValue:f,text:Ce(f),edited:!1,editable:m}});return{hasName:"name"in t,name:typeof t.name=="string"?t.name:Ce(t.name),hasDescription:"description"in t,description:typeof t.description=="string"?t.description:Ce(t.description),allowedToolsPresent:n,allowedTools:n?vt(t["allowed-tools"]):[],metadataPresent:o,metadataComplex:o&&!i?a:null,metaRows:l,unknown:r}}s(lt,"buildFormModel");function Kn(t){const n={};for(const a of t){const o=a.key.trim();o&&(n[o]=a.edited?Vt(a.text):a.rawValue)}return n}s(Kn,"scalarRowsToObject");function ot(t){const n={};t.hasName&&(n.name=t.name),t.hasDescription&&(n.description=t.description),t.allowedToolsPresent&&(n["allowed-tools"]=t.allowedTools??[]),t.metadataPresent&&(n.metadata=t.metadataComplex!==null?t.metadataComplex:Kn(t.metaRows));for(const a of t.unknown){const o=a.key.trim();o&&(n[o]=a.editable&&a.edited?Vt(a.text):a.rawValue)}return is(n)}s(ot,"serializeForm");var Vn=/^[a-z0-9]+(?:-[a-z0-9]+)*$/u;function On(t,n){const a=[],o=t.name.trim(),i=t.description.trim();return n&&!o&&a.push({field:"name",message:"SKILL.md needs a name."}),o&&!Vn.test(o)&&a.push({field:"name",message:"Use lowercase letters, numbers and hyphens."}),n&&!i&&a.push({field:"description",message:"SKILL.md needs a description."}),t.allowedToolsPresent&&t.allowedTools===null&&a.push({field:"allowed-tools",message:"Expected a list — edit in YAML."}),a}s(On,"collectValidation");function Qn(t){return/(^|\/)skill\.md$/i.test(t)}s(Qn,"isSkillMarkdown");function Un({frontmatterText:t,hasFrontmatter:n,fileName:a,skillSlug:o,readOnly:i=!1,onChange:l,className:r}){const d=Qn(a),[c,f]=(0,u.useState)(n),[m,k]=(0,u.useState)(t),x=(0,u.useMemo)(()=>rt(t),[t]),[h,g]=(0,u.useState)(()=>lt(x.parsed)),[w,E]=(0,u.useState)(n&&x.canRoundTrip?"fields":"yaml"),[M,A]=(0,u.useState)(!1),C=(0,u.useMemo)(()=>rt(m),[m]),N=c&&C.canRoundTrip,S=w==="fields"&&!N?"yaml":w,j=(0,u.useMemo)(()=>S==="fields"?On(h,d):[],[S,h,d]),T=(0,u.useCallback)((P,Q)=>{l({frontmatterText:P,hasFrontmatter:Q})},[l]),B=(0,u.useCallback)(P=>{g(P);let Q;try{Q=ot(P)}catch{return}k(Q),T(Q,!0)},[T]),p=(0,u.useCallback)(P=>{k(P),T(P,!0)},[T]),D=(0,u.useCallback)(P=>{if(P==="fields"){if(!N)return;g(lt(ls(m)))}E(P)},[N,m]),K=(0,u.useCallback)(()=>{const P={hasName:!0,name:d?(o??"").trim():"",hasDescription:d,description:"",allowedToolsPresent:!1,allowedTools:[],metadataPresent:!1,metadataComplex:null,metaRows:[],unknown:[]};f(!0),E("fields"),A(!0),g(P);const Q=ot(P);k(Q),T(Q,!0)},[T,d,o]),I=(0,u.useMemo)(()=>Yn(C.parsed),[C.parsed]),L=j.length,$=M?(0,e.jsx)(He,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"}):(0,e.jsx)(ve,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":"true"});return(0,e.jsx)(ye,{children:(0,e.jsxs)(ln,{open:M,onOpenChange:A,className:te("border-b border-border",r),"data-testid":"frontmatter-panel",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5",children:[(0,e.jsxs)("button",{type:"button",onClick:s(()=>A(P=>!P),"onClick"),className:"flex min-w-0 flex-1 items-center gap-1.5 text-left","aria-expanded":M,"aria-controls":"frontmatter-panel-body",children:[$,(0,e.jsx)("span",{className:"text-sm font-medium",children:"Frontmatter"}),!M&&c?(0,e.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:I}):null,!M&&!c?(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"None"}):null]}),c?(0,e.jsx)(Dt,{value:S,onValueChange:s(P=>D(P),"onValueChange"),children:(0,e.jsxs)(Et,{variant:"line",className:"h-7",children:[N?(0,e.jsx)(de,{value:"fields",className:"px-2 py-0.5 text-xs",children:"Fields"}):(0,e.jsxs)(G,{children:[(0,e.jsx)(W,{asChild:!0,children:(0,e.jsx)("span",{children:(0,e.jsx)(de,{value:"fields",disabled:!0,"aria-disabled":"true",className:"px-2 py-0.5 text-xs opacity-50",children:"Fields"})})}),(0,e.jsx)(H,{className:"max-w-60",children:"Switch to YAML to edit. This frontmatter uses YAML features the form can't safely round-trip (e.g. comments, anchors, or custom ordering). Editing here keeps it byte-for-byte."})]}),(0,e.jsx)(de,{value:"yaml",className:"px-2 py-0.5 text-xs",children:"YAML"})]})}):i?null:(0,e.jsxs)(R,{variant:"ghost",size:"sm",onClick:K,"data-testid":"add-frontmatter",children:[(0,e.jsx)(pe,{className:"mr-1 h-3.5 w-3.5"}),"Add frontmatter"]}),c&&S==="fields"&&L>0?(0,e.jsxs)(ne,{variant:"outline",className:"gap-1 text-amber-500","data-testid":"frontmatter-warning-chip",children:[(0,e.jsx)(le,{className:"h-3.5 w-3.5"}),L," ",L===1?"issue":"issues"]}):null]}),(0,e.jsx)(hs,{id:"frontmatter-panel-body",children:c?(0,e.jsx)("div",{className:"px-3 pb-3",children:S==="fields"?(0,e.jsx)(Gn,{form:h,validation:j,readOnly:i,onCommit:B}):(0,e.jsx)(Xn,{value:m,readOnly:i,canReturnToFields:N,parseError:c&&!C.canRoundTrip&&C.issues.length===0,onChange:p})}):(0,e.jsx)("div",{className:"px-3 pb-2 text-xs text-muted-foreground",children:"This file has no frontmatter."})})]})})}s(Un,"FrontmatterPanel");function Yn(t){const n=[];typeof t.name=="string"&&t.name.trim()&&n.push(t.name.trim());const a=vt(t["allowed-tools"]);if(a&&a.length>0&&n.push(`${a.length} ${a.length===1?"tool":"tools"}`),bt(t.metadata)){const o=Object.keys(t.metadata).length;o>0&&n.push(`${o} metadata`)}return n.join(" · ")}s(Yn,"buildSummary");function Ve(t,n){return t.find(a=>a.field===n)?.message??null}s(Ve,"fieldWarning");function dt({message:t}){return(0,e.jsxs)("p",{className:"mt-1 flex items-center gap-1 text-xs text-amber-500",children:[(0,e.jsx)(le,{className:"h-3.5 w-3.5 shrink-0"}),t]})}s(dt,"FieldWarning");function Gn({form:t,validation:n,readOnly:a,onCommit:o}){const i=Ve(n,"name"),l=Ve(n,"description"),r=Ve(n,"allowed-tools");return(0,e.jsxs)("div",{className:"space-y-3 pt-1",children:[t.hasName?(0,e.jsxs)("div",{children:[(0,e.jsx)(O,{htmlFor:"fm-name",className:"text-xs text-muted-foreground",children:"name"}),(0,e.jsx)(J,{id:"fm-name",value:t.name,readOnly:a,"aria-invalid":!!i,onChange:s(d=>o({...t,name:d.target.value}),"onChange"),className:"mt-1"}),i?(0,e.jsx)(dt,{message:i}):null]}):null,t.hasDescription?(0,e.jsxs)("div",{children:[(0,e.jsx)(O,{htmlFor:"fm-description",className:"text-xs text-muted-foreground",children:"description"}),(0,e.jsx)(ie,{id:"fm-description",value:t.description,readOnly:a,rows:3,onChange:s(d=>o({...t,description:d.target.value}),"onChange"),className:"mt-1"}),l?(0,e.jsx)(dt,{message:l}):null]}):null,t.allowedToolsPresent?(0,e.jsxs)("div",{children:[(0,e.jsx)(O,{className:"text-xs text-muted-foreground",children:"allowed-tools"}),t.allowedTools===null?(0,e.jsx)("p",{className:"mt-1 text-xs text-amber-500",children:r??"Expected a list — edit in YAML."}):(0,e.jsx)(Hn,{values:t.allowedTools,readOnly:a,placeholder:"Add a tool…",onChange:s(d=>o({...t,allowedTools:d}),"onChange")})]}):null,t.metadataPresent?(0,e.jsxs)("div",{children:[(0,e.jsx)(O,{className:"text-xs text-muted-foreground",children:"metadata"}),t.metadataComplex!==null?(0,e.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Complex value — edit in YAML."}):(0,e.jsx)(Wn,{rows:t.metaRows,readOnly:a,onChange:s(d=>o({...t,metaRows:d}),"onChange")})]}):null,t.unknown.map((d,c)=>d.editable?(0,e.jsxs)("div",{children:[(0,e.jsx)(O,{htmlFor:`fm-unknown-${d.id}`,className:"text-xs text-muted-foreground",children:d.key}),(0,e.jsx)(J,{id:`fm-unknown-${d.id}`,value:d.text,readOnly:a,onChange:s(f=>{const m=t.unknown.slice();m[c]={...d,text:f.target.value,edited:!0},o({...t,unknown:m})},"onChange"),className:"mt-1"})]},d.id):(0,e.jsxs)("div",{children:[(0,e.jsx)(O,{className:"text-xs text-muted-foreground",children:d.key}),(0,e.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Complex value — edit in YAML."})]},d.id))]})}s(Gn,"FieldsForm");function Wn({rows:t,readOnly:n,onChange:a}){const o=s((r,d)=>{const c=t.slice();c[r]={...c[r],...d,edited:!0},a(c)},"update"),i=s(r=>{a(t.filter((d,c)=>c!==r))},"remove"),l=s(()=>{a([...t,{id:`meta-new-${t.length}-${Date.now()}`,key:"",rawValue:"",text:"",edited:!0}])},"add");return(0,e.jsxs)("div",{className:"mt-1 space-y-1.5",children:[t.map((r,d)=>(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(J,{"aria-label":`Metadata key ${d+1}`,value:r.key,readOnly:n,placeholder:"key",onChange:s(c=>o(d,{key:c.target.value}),"onChange"),className:"h-8 flex-1 font-mono text-xs"}),(0,e.jsx)(J,{"aria-label":`Value for ${r.key||`field ${d+1}`}`,value:r.text,readOnly:n,placeholder:"value",onChange:s(c=>o(d,{text:c.target.value}),"onChange"),className:"h-8 flex-1 text-xs"}),n?null:(0,e.jsx)(R,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0","aria-label":`Remove ${r.key||`field ${d+1}`}`,onClick:s(()=>i(d),"onClick"),children:(0,e.jsx)(ue,{className:"h-3.5 w-3.5"})})]},r.id)),n?null:(0,e.jsxs)(R,{variant:"ghost",size:"sm",onClick:l,className:"text-xs",children:[(0,e.jsx)(pe,{className:"mr-1 h-3.5 w-3.5"}),"add field"]})]})}s(Wn,"MetadataRows");function Hn({values:t,readOnly:n,placeholder:a,onChange:o}){const[i,l]=(0,u.useState)(""),r=s(()=>{const d=i.trim();d&&(o([...t,d]),l(""))},"commit");return(0,e.jsxs)("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 rounded-md border border-border px-2 py-1.5",children:[t.map((d,c)=>(0,e.jsxs)(ne,{variant:"secondary",className:"gap-1",children:[d,n?null:(0,e.jsx)("button",{type:"button","aria-label":`Remove ${d}`,onClick:s(()=>o(t.filter((f,m)=>m!==c)),"onClick"),className:"hover:text-foreground",children:(0,e.jsx)(Ks,{className:"h-3 w-3"})})]},`${d}-${c}`)),n?null:(0,e.jsx)("input",{value:i,placeholder:t.length===0?a:void 0,onChange:s(d=>l(d.target.value),"onChange"),onKeyDown:s(d=>{d.key==="Enter"||d.key===","?(d.preventDefault(),r()):d.key==="Backspace"&&i===""&&t.length>0&&o(t.slice(0,-1))},"onKeyDown"),onBlur:r,"aria-label":"Add tool",className:"min-w-24 flex-1 bg-transparent text-xs outline-none"})]})}s(Hn,"ChipInput");function Xn({value:t,readOnly:n,canReturnToFields:a,parseError:o,onChange:i}){return(0,e.jsxs)("div",{className:"pt-1",children:[!a&&!o?(0,e.jsxs)("div",{className:"mb-1.5 flex items-start gap-2 rounded-md bg-muted/40 px-2 py-1.5 text-xs text-muted-foreground",children:[(0,e.jsx)(gs,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),(0,e.jsx)("span",{children:"Editing raw YAML to preserve formatting the form can't reconstruct."})]}):null,(0,e.jsx)(ie,{value:t,readOnly:n,spellCheck:!1,rows:Math.min(12,Math.max(3,t.split(`
|
|
2
|
+
`).length)),onChange:s(l=>i(l.target.value),"onChange"),className:"font-mono text-xs","aria-label":"Frontmatter YAML"}),(0,e.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Raw YAML is the source of truth in this mode."})]})}s(Xn,"YamlEditor");var Jn=["succeeded","failed","cancelled"],Ot="built-in:default-test-template",Qt="__paperclip_no_template__";function et(t){return Jn.includes(t)}s(et,"isTerminalRunStatus");function Ut(t){return!et(t)}s(Ut,"shouldPollRun");function Zn(t){const n=!!(t.outputBody&&t.outputBody.trim().length>0);return et(t.status)?t.status==="succeeded"?n?"output":"none":n?"draft":"none":n?"output":"pending"}s(Zn,"runOutputMode");function ea(t){return t==="failed"}s(ea,"showRunErrorCard");function ta(t){return t.taskExpired||!t.harnessIssue?{enabled:!1,reason:"Test task expired"}:{enabled:!0,reason:null}}s(ta,"testTaskLinkState");function sa(t){return t.skillFileCount<=0?{disabled:!0,reason:"This skill has no files to test"}:t.hasAgent?t.hasInput?t.hasUnsavedSkillEdits?{disabled:!0,reason:"Save skill edits before running"}:t.runInFlight?{disabled:!0,reason:"A run is already in progress"}:{disabled:!1,reason:null}:{disabled:!0,reason:"Add or paste input text to run"}:{disabled:!0,reason:"Pick an agent to run"}}s(sa,"evaluateRunGate");var Yt={inputId:null,draft:"",baselineContent:""};function na(t,n){return n?t.inputId!==n.id?{inputId:n.id,draft:n.content,baselineContent:n.content}:t.baselineContent===n.content?t:t.draft===t.baselineContent?{inputId:n.id,draft:n.content,baselineContent:n.content}:t:t.inputId===null?t:Yt}s(na,"syncSavedInputDraftState");function aa(t,n){return n?t.inputId===n.id?t.draft:n.content:""}s(aa,"selectedSavedInputDraft");function ra(t,n){return!!(n&&t.inputId===n.id&&t.draft!==n.content)}s(ra,"savedInputDraftDirty");var ia=new Set(["ask_user_questions","request_confirmation"]);function Gt(t){return ia.has(t)?"inline":"fallback"}s(Gt,"routeInteraction");function la(t){return Gt(t.kind)==="inline"&&t.status==="pending"}s(la,"isInteractionAnswerable");function oa(t){return t.status!=="paused"}s(oa,"isAgentSelectable");function da(t){return`#${t.id.replace(/-/g,"").slice(0,7)}`}s(da,"runShortId");function ca(t){return t===null?Qt:t}s(ca,"serializeRunTemplateSelection");function ua(t){return t==="__paperclip_no_template__"?null:t&&t.trim()?t:Ot}s(ua,"parseRunTemplateSelection");function Oe(t,n){if(t===null)return{selection:null,template:null,recovered:!1};const a=n.find(i=>i.id===t)??null;if(a)return{selection:t,template:a,recovered:!1};const o=n.find(i=>i.id==="built-in:default-test-template")??n[0]??null;return{selection:o?.id??null,template:o,recovered:!0}}s(Oe,"resolveRunTemplateSelection");function ma(t){return{agentId:t.agentId,inputId:t.inputId,content:t.content,templateId:t.templateId}}s(ma,"buildCreateRunRequest");function xa(t){return t==="expired"?"Test task expired":t==="deleted"?"Test task deleted":"Test task unavailable"}s(xa,"runHarnessUnavailableTitle");function ha(t){return t.harnessContent.available?null:{title:xa(t.harnessContent.unavailableReason),body:"Stored run snapshots are still shown. Harness documents, attachments, and work products are no longer available."}}s(ha,"runHarnessUnavailableCopy");function pa(t){return t.harnessContent.documents.find(n=>n.key===t.outputDocumentKey)??null}s(pa,"findRunOutputDocument");function fa(t){const n=pa(t);return t.harnessContent.documents.filter(a=>!(a.key===t.outputDocumentKey||n&&a.id===n.id))}s(fa,"getRunAdditionalDocuments");function ga(t){const n=as(t.harnessContent.workProducts);return t.harnessContent.attachments.filter(a=>!n.has(a.id))}s(ga,"getRunRawAttachments");function ja(t){const n=[],a=new Set,o=s((l,r)=>{l&&a.add(`attachment:${l}`),a.add(`content:${r}`)},"mark"),i=s((l,r)=>!!(l&&a.has(`attachment:${l}`))||a.has(`content:${r}`),"hasSeen");for(const l of t.harnessContent.attachments)!at(l.contentType)&&!nt(l.contentType,l.originalFilename)||(n.push(l),o(l.id,l.contentPath));for(const l of rs(t.harnessContent.workProducts).items){const r=l.metadata;r&&(!(at(r.contentType)||nt(r.contentType,r.originalFilename))||i(r.attachmentId,r.contentPath)||(n.push({id:`work-product-${l.id}`,contentPath:r.contentPath,openPath:r.openPath,downloadPath:r.downloadPath,contentType:r.contentType,originalFilename:r.originalFilename??l.title}),o(r.attachmentId,r.contentPath)))}return n}s(ja,"getRunMediaGalleryItems");function ba(t){return{agentId:t.agentId,inputId:t.inputId??void 0,content:t.inputId?void 0:t.inputSnapshot,skillVersionId:t.skillVersionId,templateSnapshot:{templateId:t.templateId,templateName:t.templateName,templateBody:t.templateBody}}}s(ba,"buildReRunRequest");function va(t,n,a=5){const o=new Map(t.map(r=>[r.id,r])),i=[],l=new Set;for(const r of n){if(l.has(r))continue;const d=o.get(r);if(d&&(i.push(d),l.add(r),i.length>=a))break}return i}s(va,"orderRecentlyVisitedSkills");function ct(t){const n=t.updatedAt,a=n instanceof Date?n.getTime():new Date(n).getTime();return Number.isNaN(a)?0:a}s(ct,"updatedAtMs");function ya(t,n,a=10){const o=new Set(n);return t.filter(i=>!o.has(i.id)).slice().sort((i,l)=>{const r=ct(l)-ct(i);return r!==0?r:i.name.localeCompare(l.name)}).slice(0,a)}s(ya,"orderRecentlyUpdatedSkills");function ka(t){const n=t.trim().split(/\s+/).filter(Boolean);return n.length===0?"?":n.length===1?n[0].slice(0,2).toUpperCase():(n[0][0]+n[n.length-1][0]).toUpperCase()}s(ka,"editorInitials");function Na(t){if(!t||t.kind!=="user")return null;const n=t.name?.trim()||"Unknown editor";return{name:n,imageUrl:t.imageUrl,initials:ka(n)}}s(Na,"skillEditorAvatar");var Wt="skillStudio.paneSizes",Sa="skillStudio.runTemplate",ut=900,tt=2e3,wa=[];function Me(){const t=he();return(0,u.useCallback)(n=>a=>{const o=cs(a);if(o){t?.pushToast({tone:"warn",title:o.title,body:o.remediation});return}const i=a instanceof Error&&a.message?a.message:"Please try again.";t?.pushToast({tone:"error",title:n,body:i})},[t])}s(Me,"useMutationErrorToast");var mt={skill:37.5,input:25,runs:37.5};function Ca(){try{const t=localStorage.getItem(Wt);if(!t)return mt;const n=JSON.parse(t);if(typeof n?.skill=="number"&&typeof n?.input=="number"&&typeof n?.runs=="number")return{skill:n.skill,input:n.input,runs:n.runs}}catch{}return mt}s(Ca,"loadPaneLayout");function Ht(t){return`${Sa}.${t}`}s(Ht,"runTemplateStorageKey");function xt(t){try{return ua(localStorage.getItem(Ht(t)))}catch{return Ot}}s(xt,"loadRunTemplateSelection");function Ta(t,n){try{localStorage.setItem(Ht(t),ca(n))}catch{}}s(Ta,"persistRunTemplateSelection");function Fa(){const[t,n]=(0,u.useState)(()=>typeof window<"u"&&window.innerWidth<ut);return(0,u.useEffect)(()=>{const a=s(()=>n(window.innerWidth<ut),"onResize");return window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[]),t}s(Fa,"useIsMobile");function jr(){const{skillId:t=""}=Ms(),n=Us(),[a]=Pt(),{selectedCompanyId:o}=ws(),{setBreadcrumbs:i}=Os(),l=Pe(),r=o??"",d=n.pathname.replace(/\/+$/,"").endsWith("/skills/studio/new"),c=d&&a.get("forkFrom")?.trim()||null,f=d&&a.get("folderId")?.trim()||null,m=Y({queryKey:F.companySkills.list(r),queryFn:s(()=>_.list(r,{sort:"alphabetical"}),"queryFn"),enabled:!!r}),k=Y({queryKey:F.companySkills.detail(r,t),queryFn:s(()=>_.detail(r,t),"queryFn"),enabled:!!(r&&t&&!d)}),x=Mt(k),h=Y({queryKey:F.companySkills.detail(r,c??""),queryFn:s(()=>_.detail(r,c),"queryFn"),enabled:!!(r&&c)}),g=k.data??null;return(0,u.useEffect)(()=>{i(d?[{label:"Skills",href:"/skills"},{label:"Studio",href:"/skills/studio"},{label:"New skill"}]:g?[{label:"Skills",href:"/skills"},{label:"Studio",href:"/skills/studio"},{label:g.name}]:[{label:"Skills",href:"/skills"},{label:"Studio"}])},[d,i,g]),(0,u.useEffect)(()=>{g?.id&&kn(g.id)},[g?.id]),r?d?(0,e.jsx)(Ra,{companyId:r,skills:m.data??[],skillsLoading:m.isLoading,forkFromSkillId:c,folderId:f,forkSkill:h.data??null,forkLoading:h.isLoading,forkError:h.isError,onSelectSkill:s(w=>l(oe(w)),"onSelectSkill")}):t?k.isLoading||x.kind==="reconnecting"?(0,e.jsx)(Re,{message:"Loading skill…"}):x.kind==="error"&&x.errorKind!=="not_found"?(0,e.jsx)($s,{size:"page",error:k.error,action:"load this skill",onRetry:x.retry,retrying:x.isFetching}):x.kind==="error"||!k.data?(0,e.jsx)(Re,{message:"Skill not found."}):(0,e.jsx)(Ia,{companyId:r,skill:k.data,skills:m.data??[],skillsLoading:m.isLoading}):(0,e.jsx)(Aa,{companyId:r,skills:m.data??[],skillsLoading:m.isLoading,onSelectSkill:s(w=>l(oe(w)),"onSelectSkill"),onCreateNew:s(()=>l(fn()),"onCreateNew")}):(0,e.jsx)(Re,{message:"Select an organization to open Skill Studio."})}s(jr,"SkillStudio");function Ra({companyId:t,skills:n,skillsLoading:a,forkFromSkillId:o,folderId:i,forkSkill:l,forkLoading:r,forkError:d,onSelectSkill:c}){return(0,e.jsx)(ye,{delayDuration:200,children:(0,e.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,e.jsx)("header",{className:"flex items-center gap-3 border-b border-border px-3 py-2",children:(0,e.jsx)(_e,{skill:null,skills:n,loading:a,onSelectSkill:c,emptyLabel:"New skill"})}),(0,e.jsx)(Ie,{activeView:"authored"}),(0,e.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:(0,e.jsx)(Ea,{companyId:t,forkFromSkillId:o,folderId:i,forkSkill:l,forkLoading:r,forkError:d})})]})})}s(Ra,"StudioCreateMode");function Ea({companyId:t,forkFromSkillId:n,folderId:a,forkSkill:o,forkLoading:i,forkError:l}){const r=Pe(),d=se(),c=he(),f=(0,u.useMemo)(()=>{const j=o?dn(o):mn();return a?{...j,folderId:a}:j},[o,a]),[m,k]=(0,u.useState)(f),[x,h]=(0,u.useState)(f.slug.trim().length>0),[g,w]=(0,u.useState)(f.categories.join(", ")),E=cn(g),M=m.slug.trim()||ze(m.name),A=m.name.trim().length>0;(0,u.useEffect)(()=>{k(f),h(f.slug.trim().length>0),w(f.categories.join(", "))},[f]);function C(j){k(T=>({...T,...j}))}s(C,"patchDraft");const N=V({mutationFn:s(()=>_.create(t,on({...m,categories:E})),"mutationFn"),onSuccess:s(async j=>{await d.invalidateQueries({queryKey:F.companySkills.list(t)}),c?.pushToast({tone:"success",title:j.forkedFromSkillId?"Skill fork created":"Skill created",body:`${j.name} is now editable in the Microvac workspace.`}),r(oe(j.id))},"onSuccess"),onError:s(j=>{c?.pushToast({tone:"error",title:"Skill creation failed",body:j instanceof Error?j.message:"Failed to create skill."})},"onError")});if(n&&i)return(0,e.jsx)(Re,{message:"Loading fork source..."});const S={key:M||m.name||"new-skill",skillId:null,catalogRef:null,name:m.name||"New Skill",slug:M||"skill",author:"you",version:null,tagline:m.tagline||null,description:m.tagline,categories:E,iconUrl:null,color:m.color,starCount:0,agentCount:0,forkCount:0,installed:!1,required:!1,forkedFrom:!!m.forkedFromSkillId,updatedAt:Date.now()};return(0,e.jsxs)("div",{className:"mx-auto flex w-full max-w-4xl flex-col gap-6 px-4 py-6",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("h1",{className:"text-lg font-semibold text-foreground",children:m.forkedFromSkillId?"Fork skill":"Create a new skill"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Create an editable organization skill and open it directly in Studio."})]}),m.forkedFromName?(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border bg-muted/30 px-3 py-2 text-sm text-muted-foreground",children:[(0,e.jsx)(De,{className:"h-4 w-4"}),"Forking ",m.forkedFromName]}):l?(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:[(0,e.jsx)(le,{className:"h-4 w-4"}),"Fork source not found. You can still create a blank skill."]}):null,(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-foreground",children:"Basics"}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Name the skill and set the route-safe slug."})]}),(0,e.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{htmlFor:"skill-name",children:"Name"}),(0,e.jsx)(J,{id:"skill-name",value:m.name,onChange:s(j=>{const T=j.target.value;C({name:T,slug:x?m.slug:ze(T),markdown:m.markdown===we(m.name,m.tagline)?we(T,m.tagline):m.markdown})},"onChange"),placeholder:"Code review"})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{htmlFor:"skill-slug",children:"Slug"}),(0,e.jsx)(J,{id:"skill-slug",value:m.slug,onChange:s(j=>{const T=ze(j.target.value);h(T.length>0),C({slug:T})},"onChange"),placeholder:"code-review",className:"font-mono"})]})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{htmlFor:"skill-tagline",children:"Tagline"}),(0,e.jsx)(ie,{id:"skill-tagline",value:m.tagline,onChange:s(j=>{const T=j.target.value;C({tagline:T,description:m.description?m.description:T,markdown:m.markdown===we(m.name,m.tagline)?we(m.name,T):m.markdown})},"onChange"),placeholder:"Review repository changes for correctness, tests, and maintainability.",className:"min-h-20"})]})]}),(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-foreground",children:"Appearance"}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Tune how the skill appears in the store and Studio switcher."})]}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)(hn,{card:S,size:48}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"truncate text-sm font-medium",children:S.name}),(0,e.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:m.tagline||"No tagline yet."})]})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(O,{children:"Color"}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[un.map(j=>(0,e.jsx)("button",{type:"button",onClick:s(()=>C({color:j}),"onClick"),className:te("h-7 w-7 rounded-md border",m.color===j?"border-foreground":"border-border"),style:{backgroundColor:j},"aria-label":`Use ${j}`},j)),(0,e.jsx)(J,{"aria-label":"Hex color",value:m.color,onChange:s(j=>C({color:j.target.value}),"onChange"),className:"h-7 w-28 font-mono text-xs"})]})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{htmlFor:"skill-categories",children:"Categories"}),(0,e.jsx)(J,{id:"skill-categories",value:g,onChange:s(j=>w(j.target.value),"onChange"),placeholder:"engineering, review, memory"})]})]}),(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("h2",{className:"text-sm font-medium text-foreground",children:"Sharing"}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Choose who can discover this skill inside Microvac."})]}),(0,e.jsxs)("div",{className:"grid gap-2 sm:grid-cols-3",children:[["company","private"].map(j=>(0,e.jsxs)("button",{type:"button",onClick:s(()=>C({sharingScope:j}),"onClick"),className:te("rounded-md border px-3 py-2 text-left text-sm",m.sharingScope===j?"border-foreground bg-accent/50":"border-border"),children:[(0,e.jsx)("span",{className:"block font-medium",children:j==="company"?"Organization":"Private"}),(0,e.jsx)("span",{className:"mt-1 block text-xs text-muted-foreground",children:j==="company"?"Visible inside this organization.":"Only visible in your library."})]},j)),(0,e.jsxs)("button",{type:"button",disabled:!0,className:"rounded-md border border-dashed border-border px-3 py-2 text-left text-sm text-muted-foreground",children:[(0,e.jsx)("span",{className:"block font-medium",children:"Public"}),(0,e.jsx)("span",{className:"mt-1 block text-xs",children:"Coming later."})]})]})]}),(0,e.jsxs)("details",{className:"rounded-md border border-border px-3 py-2",children:[(0,e.jsx)("summary",{className:"cursor-pointer text-sm font-medium text-foreground",children:"Starter content"}),(0,e.jsx)(ie,{value:m.markdown,onChange:s(j=>C({markdown:j.target.value}),"onChange"),className:"mt-3 min-h-(--sz-22rem) resize-y font-mono text-xs"})]}),(0,e.jsxs)("div",{className:"flex items-center justify-end gap-2 border-t border-border pt-4",children:[(0,e.jsx)(R,{variant:"ghost",onClick:s(()=>r("/skills/studio"),"onClick"),disabled:N.isPending,children:"Cancel"}),(0,e.jsxs)(R,{onClick:s(()=>N.mutate(),"onClick"),disabled:N.isPending||!A,children:[(0,e.jsx)(Ze,{className:"h-4 w-4"}),N.isPending?"Creating...":m.forkedFromSkillId?"Create fork":"Create skill"]})]})]})}s(Ea,"StudioNewSkillPanel");function Re({message:t}){return(0,e.jsx)("div",{className:"flex h-full min-h-(--sz-60vh) items-center justify-center text-sm text-muted-foreground",children:t})}s(Re,"StudioMessage");function Da({skills:t,skillsLoading:n,onSelectSkill:a,onCreateNew:o}){return(0,e.jsx)(ye,{delayDuration:200,children:(0,e.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,e.jsx)("header",{className:"flex items-center gap-3 border-b border-border px-3 py-2",children:(0,e.jsx)(_e,{skill:null,skills:t,loading:n,onSelectSkill:a,emptyLabel:"Select skill"})}),(0,e.jsx)(Ie,{activeView:"authored"}),(0,e.jsx)("div",{className:"flex flex-1 items-center justify-center",children:(0,e.jsx)(Le,{icon:Tt,message:n?"Loading skills...":"Select a skill to open Studio.",action:"Create a new skill",onAction:o})})]})})}s(Da,"StudioEmptyState");function Aa({companyId:t,skills:n,skillsLoading:a,onSelectSkill:o,onCreateNew:i}){const l=Y({queryKey:F.companySkills.listRecent(t),queryFn:s(()=>_.list(t,{sort:"recent",include:["lastEditor"]}),"queryFn"),enabled:!!t}),r=l.data??[],d=(0,u.useMemo)(()=>va(r,yn()),[r]),c=(0,u.useMemo)(()=>ya(r,d.map(f=>f.id)),[r,d]);return r.length===0?(0,e.jsx)(Da,{skills:n,skillsLoading:a||l.isLoading,onSelectSkill:o,onCreateNew:i}):(0,e.jsx)(ye,{delayDuration:200,children:(0,e.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,e.jsxs)("header",{className:"flex items-center gap-3 border-b border-border px-3 py-2",children:[(0,e.jsx)(_e,{skill:null,skills:n,loading:a,onSelectSkill:o,emptyLabel:"Select skill"}),(0,e.jsxs)(R,{variant:"ghost",size:"sm",className:"ml-auto",onClick:i,children:[(0,e.jsx)(pe,{className:"mr-1.5 h-3.5 w-3.5"}),"New skill"]})]}),(0,e.jsx)(Ie,{activeView:"authored"}),(0,e.jsx)("div",{className:"min-h-0 flex-1 overflow-auto",children:(0,e.jsxs)("div",{className:"mx-auto w-full max-w-3xl space-y-8 px-4 py-8",children:[d.length>0?(0,e.jsx)(ht,{title:"Recently visited",skills:d,onSelectSkill:o}):null,(0,e.jsx)(ht,{title:"Recently updated",skills:c,onSelectSkill:o})]})})]})})}s(Aa,"StudioLanding");function ht({title:t,skills:n,onSelectSkill:a}){return n.length===0?null:(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h2",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:t}),(0,e.jsx)("div",{className:"divide-y divide-border overflow-hidden rounded-md border border-border",children:n.map(o=>(0,e.jsx)(Pa,{skill:o,onSelect:s(()=>a(o.id),"onSelect")},o.id))})]})}s(ht,"StudioLandingSection");function Pa({skill:t,onSelect:n}){const a=Na(t.lastEditor);return(0,e.jsxs)("button",{type:"button",onClick:n,className:"flex w-full items-center gap-3 px-3 py-2.5 text-left hover:bg-accent",children:[(0,e.jsx)(La,{skill:t}),(0,e.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,e.jsx)("span",{className:"truncate text-sm font-medium",children:t.name}),t.tagline?(0,e.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:t.tagline}):null]}),(0,e.jsxs)("span",{className:"shrink-0 text-xs text-muted-foreground",children:["updated ",Ne(t.updatedAt)]}),a?(0,e.jsxs)(G,{children:[(0,e.jsx)(W,{asChild:!0,children:(0,e.jsxs)(Fs,{size:"xs",children:[a.imageUrl?(0,e.jsx)(Es,{src:a.imageUrl,alt:""}):null,(0,e.jsx)(ys,{children:a.initials})]})}),(0,e.jsx)(H,{children:a.name})]}):(0,e.jsx)("span",{className:"w-5 shrink-0","aria-hidden":"true"})]})}s(Pa,"StudioLandingRow");function La({skill:t}){if(t.iconUrl)return(0,e.jsx)("img",{src:t.iconUrl,alt:"",className:"h-9 w-9 shrink-0 rounded-md object-cover"});const n=xn(t.key,t.color),a=(t.slug||t.name||"?").trim().charAt(0).toUpperCase();return(0,e.jsx)("span",{"aria-hidden":"true",className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-sm font-semibold text-white",style:{backgroundColor:n},children:a})}s(La,"SkillLandingIcon");function Ia({companyId:t,skill:n,skills:a,skillsLoading:o}){const i=n.id,l=Fa(),[r,d]=Pt(),c=Pe(),f=se(),[m,k]=(0,u.useState)(()=>r.get("input")),[x,h]=(0,u.useState)(()=>r.get("run")),[g,w]=(0,u.useState)(!1),[E,M]=(0,u.useState)(""),[A,C]=(0,u.useState)(null),[N,S]=(0,u.useState)(!1),[j,T]=(0,u.useState)(!1),[B,p]=(0,u.useState)(!1),D=(0,u.useRef)(Ca());(0,u.useEffect)(()=>{const v=new URLSearchParams(r);m?v.set("input",m):v.delete("input"),x?v.set("run",x):v.delete("run"),v.toString()!==r.toString()&&d(v,{replace:!0})},[m,x]);const K=Y({queryKey:F.companySkills.testInputs(t,i),queryFn:s(()=>_.testInputs(t,i),"queryFn"),enabled:!!(t&&i)}),I=(0,u.useCallback)(v=>{const q={skill:v.skill??D.current.skill,input:v.input??D.current.input,runs:v.runs??D.current.runs};D.current=q;try{localStorage.setItem(Wt,JSON.stringify(q))}catch{}},[]),L=K.data??[],$=L.find(v=>v.id===m)??null,P=(0,e.jsx)($a,{companyId:t,skill:n,onDirtyChange:S,onEditACopy:s(()=>p(!0),"onEditACopy")}),Q=_n(n.metadata),Z=(0,e.jsx)(Va,{companyId:t,skillId:i,inputs:L,loading:K.isLoading,selectedInputId:m,adHocMode:g,adHocContent:E,onAdHocChange:M,onSelectInput:s(v=>{k(v),w(!1)},"onSelectInput"),onSelectAdHoc:s(()=>{M(""),w(!0),k(null)},"onSelectAdHoc")}),ee=(0,e.jsx)(Qa,{companyId:t,skill:n,inputs:L,selectedInput:$,adHocMode:g,adHocContent:E,selectedRunId:x,onSelectRun:h,selectedAgentId:A,onSelectAgent:C,skillDirty:N,filterInput:$,onClearFilter:s(()=>k(null),"onClearFilter")});return(0,e.jsxs)(ye,{delayDuration:200,children:[(0,e.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,e.jsx)(Ma,{companyId:t,skill:n,skillDirty:N,skills:a,skillsLoading:o,onSelectSkill:s(v=>c(oe(v)),"onSelectSkill"),onOpenVersions:s(()=>T(!0),"onOpenVersions")}),(0,e.jsx)(Ie,{activeView:"authored"}),Q?(0,e.jsx)(zn,{skill:n,onEditACopy:s(()=>p(!0),"onEditACopy")}):null,l?(0,e.jsx)(nr,{skill:P,input:Z,runs:ee}):(0,e.jsxs)(gn,{className:"flex-1 min-h-0",defaultLayout:{skill:D.current.skill,input:D.current.input,runs:D.current.runs},onLayoutChanged:I,children:[(0,e.jsx)(Be,{id:"skill",minSize:"280px",className:"border-r border-border",children:P}),(0,e.jsx)(it,{}),(0,e.jsx)(Be,{id:"input",minSize:"240px",collapsible:!0,collapsedSize:"40px",className:"border-r border-border",children:Z}),(0,e.jsx)(it,{}),(0,e.jsx)(Be,{id:"runs",minSize:"360px",children:ee})]})]}),(0,e.jsx)(sr,{open:j,onOpenChange:T,companyId:t,skill:n,onRestored:s(()=>{S(!1),f.invalidateQueries({queryKey:F.companySkills.detail(t,i)})},"onRestored"),onFilterRuns:s(v=>k(v),"onFilterRuns")}),(0,e.jsx)($n,{companyId:t,skill:n,open:B,onOpenChange:p})]})}s(Ia,"StudioShell");function Ma({companyId:t,skill:n,skillDirty:a,skills:o,skillsLoading:i,onSelectSkill:l,onOpenVersions:r}){const d=n.currentVersion?.revisionNumber??null,c=he(),f=(0,u.useCallback)(()=>{const m=typeof window<"u"?window.location.href:"";Zs(m).then(()=>c?.pushToast({tone:"success",title:"Link copied",body:"Skill Studio link copied to clipboard."})).catch(k=>c?.pushToast({tone:"error",title:"Copy failed",body:k instanceof Error?k.message:"Could not copy the link."}))},[c]);return(0,e.jsxs)("header",{className:"flex items-center gap-3 border-b border-border px-3 py-2",children:[(0,e.jsx)(_e,{skill:n,skills:o,loading:i,onSelectSkill:l}),d!==null&&(0,e.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:["v",d]}),a?(0,e.jsx)(ne,{variant:"secondary",children:"Unsaved edits"}):null,n.editable?null:(0,e.jsx)(ne,{variant:"secondary",children:"Read-only"}),n.forkedFromSkillId?(0,e.jsx)(qn,{companyId:t,forkedFromSkillId:n.forkedFromSkillId}):null,(0,e.jsx)(Nn,{companyId:t,skill:n}),(0,e.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[(0,e.jsxs)(R,{variant:"ghost",size:"sm",onClick:r,children:[(0,e.jsx)(kt,{className:"mr-1.5 h-3.5 w-3.5"}),"Version history"]}),(0,e.jsxs)(Lt,{children:[(0,e.jsx)(Nt,{asChild:!0,children:(0,e.jsx)(R,{variant:"ghost",size:"icon-sm","aria-label":"Studio menu",children:(0,e.jsx)(At,{className:"h-4 w-4"})})}),(0,e.jsx)(Rt,{align:"end",className:"w-52",children:(0,e.jsxs)(Ye,{onClick:f,children:[(0,e.jsx)(Cs,{className:"mr-2 h-4 w-4"})," Share link"]})})]})]})]})}s(Ma,"StudioHeader");function _e({skill:t,skills:n,loading:a,onSelectSkill:o,emptyLabel:i="Select skill"}){const l=(0,u.useMemo)(()=>[{id:"skills",options:_a(n,t).map(r=>({key:r.id,value:r.id,label:r.name,title:r.name,searchText:[r.name,r.slug,r.key,r.description??""].join(" "),skill:r}))}],[t,n]);return(0,e.jsx)(Xe,{value:t?.id??"",groups:l,loading:a,loadingMessage:"Loading skills...",placeholder:i,searchPlaceholder:"Search skills...",emptyMessage:"No matching skills.",onValueChange:s(r=>{r!==t?.id&&o(r)},"onValueChange"),triggerClassName:"h-8 w-64 max-w-full border-0 bg-transparent px-0 text-base font-semibold shadow-none hover:bg-accent md:w-80",contentClassName:"w-80 max-w-(--sz-calc-4)",contentWidth:"auto",renderValue:s(r=>r?.label??t?.name??i,"renderValue"),renderOption:s((r,{selected:d})=>(0,e.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,e.jsx)("span",{className:te("truncate",d&&"font-medium"),children:r.label}),(0,e.jsx)("span",{className:"truncate text-(length:--text-micro) text-muted-foreground",children:r.skill.slug})]}),"renderOption")})}s(_e,"SkillSwitcher");function _a(t,n){return n?t.some(a=>a.id===n.id)?t:[n,...t]:t}s(_a,"withCurrentSkill");function $a({companyId:t,skill:n,onDirtyChange:a,onEditACopy:o}){const i=n.id,l=se(),r=Me(),d=(0,u.useMemo)(()=>n.fileInventory.map(y=>y.path),[n.fileInventory]),[c,f]=(0,u.useState)(()=>d.find(y=>/skill\.md$/i.test(y))??d[0]??"SKILL.md"),[m,k]=(0,u.useState)(new Set),[x,h]=(0,u.useState)(""),[g,w]=(0,u.useState)(""),[E,M]=(0,u.useState)(!1),[A,C]=(0,u.useState)(null),[N,S]=(0,u.useState)(!1),j=(0,u.useRef)(!1),T=(0,u.useCallback)(()=>{j.current=!0},[]),B=(0,u.useMemo)(()=>Ct(Object.fromEntries(d.map(y=>[y,""]))),[d]),[p,D]=(0,u.useState)(),K=(0,u.useRef)(null),I=(0,u.useRef)({skillId:i,selectedFile:c,draft:x});I.current={skillId:i,selectedFile:c,draft:x};const L=Y({queryKey:F.companySkills.file(t,i,c),queryFn:s(()=>_.file(t,i,c),"queryFn"),enabled:!!(t&&i&&c)});(0,u.useEffect)(()=>{if(L.data){if(K.current===c&&x!==g)return;K.current=c,D(L.data.versionId),M(!1),j.current=!1,h(L.data.content),w(L.data.content)}},[L.data]);const $=x!==g,P=qa(c),Q=(0,u.useMemo)(()=>new Set(d),[d]);(0,u.useEffect)(()=>{a($)},[$,a]);const Z=(0,u.useCallback)(y=>{y!==c&&($&&typeof window<"u"&&!window.confirm("Discard unsaved edits and switch files?")||f(y))},[$,c]),ee=V({mutationFn:s(({path:y,content:b,versionId:U})=>_.updateFile(t,i,y,b,{expectedVersionId:U}),"mutationFn"),onSuccess:s(y=>{l.setQueryData(F.companySkills.file(t,i,y.path),y),K.current===y.path&&(D(y.versionId),w(y.content),M(!1)),l.invalidateQueries({queryKey:F.companySkills.detail(t,i)}),l.invalidateQueries({queryKey:F.companySkills.list(t)}),l.invalidateQueries({queryKey:F.companySkills.versions(t,i)})},"onSuccess"),onError:s(y=>{y instanceof Hs&&y.status===409&&M(!0),r("Couldn't save file")(y)},"onError")});async function v(){if($&&!window.confirm("Discard unsaved edits and load the latest saved file?"))return;const y=await L.refetch();if(y.error){r("Couldn't load latest file")(y.error);return}if(!y.data)return;const b=I.current;b.skillId!==i||b.selectedFile!==c||b.draft!==x||(K.current=c,h(y.data.content),w(y.data.content),D(y.data.versionId),M(!1))}s(v,"loadLatestSavedFile");const q=V({mutationFn:s(({path:y,content:b})=>_.updateFile(t,i,y,b,{expectedVersionId:p??n.currentVersionId}),"mutationFn"),onSuccess:s(y=>{D(y.versionId),l.setQueryData(F.companySkills.file(t,i,y.path),y),f(y.path),h(y.content),w(y.content),C(null),l.invalidateQueries({queryKey:F.companySkills.detail(t,i)}),l.invalidateQueries({queryKey:F.companySkills.list(t)}),l.invalidateQueries({queryKey:F.companySkills.versions(t,i)})},"onSuccess"),onError:r("Couldn't create file")}),z=V({mutationFn:s(y=>_.deleteFile(t,i,{...y,expectedVersionId:p??n.currentVersionId}),"mutationFn"),onSuccess:s(y=>{D(y.versionId),l.invalidateQueries({queryKey:F.companySkills.file(t,i,c)});const b=new Set(y.deletedPaths),U=d.filter(be=>!b.has(be));f(U.find(be=>/skill\.md$/i.test(be))??U[0]??"SKILL.md"),S(!1),l.invalidateQueries({queryKey:F.companySkills.detail(t,i)}),l.invalidateQueries({queryKey:F.companySkills.list(t)}),l.invalidateQueries({queryKey:F.companySkills.versions(t,i)})},"onSuccess"),onError:r("Couldn't delete file")}),X=n.editable===!1||L.data?.editable===!1;if(d.length===0)return(0,e.jsxs)(re,{title:(0,e.jsx)(pt,{skillName:n.name,folder:"root"}),action:(0,e.jsx)(ft,{readOnly:X,selectedFile:c,currentFolder:"",canDeleteFile:!1,pending:q.isPending||z.isPending||$,onAddFile:s(()=>C("file"),"onAddFile"),onAddFolder:s(()=>C("folder"),"onAddFolder"),onDeleteFile:s(()=>{},"onDeleteFile"),onDeleteFolder:s(()=>S(!0),"onDeleteFolder")}),children:[(0,e.jsx)(Le,{icon:Tt,message:"This skill has no files yet."}),(0,e.jsx)(gt,{mode:A,open:A!==null,onOpenChange:s(y=>{y||C(null)},"onOpenChange"),currentFolder:"",existingPaths:Q,pending:q.isPending,onSubmit:s((y,b)=>q.mutate({path:y,content:b}),"onSubmit")})]});const je=L.data?.markdown??/\.md$/i.test(c),ae=je?$e(x):null;return(0,e.jsxs)(re,{title:(0,e.jsx)(pt,{skillName:n.name,folder:P||"root"}),action:(0,e.jsx)(ft,{readOnly:X,selectedFile:c,currentFolder:P,canDeleteFile:c!=="SKILL.md",pending:q.isPending||z.isPending||$,onAddFile:s(()=>C("file"),"onAddFile"),onAddFolder:s(()=>C("folder"),"onAddFolder"),onDeleteFile:s(()=>z.mutate({path:c,target:"file"}),"onDeleteFile"),onDeleteFolder:s(()=>S(!0),"onDeleteFolder")}),children:[(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[E?(0,e.jsxs)("div",{role:"alert",className:"flex items-center gap-2 border-b border-border bg-muted px-3 py-2 text-xs",children:[(0,e.jsx)("span",{children:"This skill changed since you opened it. Your unsaved edits are still here. Copy them before loading the latest file to reconcile the changes."}),(0,e.jsx)(R,{size:"sm",variant:"outline",disabled:L.isFetching,onClick:s(()=>{v()},"onClick"),children:"Load latest saved file"})]}):null,$&&!X?(0,e.jsxs)("div",{className:"flex items-start gap-2 border-b border-border bg-muted/40 px-3 py-2 text-xs text-muted-foreground",children:[(0,e.jsx)(le,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-500"}),(0,e.jsx)("span",{children:"Unsaved edits live only in this Studio session. Save to create the next version before running tests or switching files."})]}):null,(0,e.jsx)("div",{className:"max-h-(--sz-11_75rem) overflow-auto border-b border-border p-1",children:(0,e.jsx)(wt,{nodes:B,selectedFile:c,expandedDirs:m,onToggleDir:s(y=>k(b=>{const U=new Set(b);return U.has(y)?U.delete(y):U.add(y),U}),"onToggleDir"),onSelectFile:Z,showCheckboxes:!1,ariaLabel:"Skill files"})}),(0,e.jsx)(ds,{skill:n}),X&&(0,e.jsxs)("div",{className:"flex items-start gap-3 border-b border-border bg-muted/40 px-3 py-2.5 text-xs text-muted-foreground",children:[(0,e.jsx)(le,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-500"}),(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsxs)("p",{children:[n.metadata?.skillSourceId?"This skill is synced from GitHub and is read-only.":n.editableReason??"This skill is read-only because it comes from an external source."," ","Make an editable copy to change it — the original stays untouched."]}),(0,e.jsxs)(R,{type:"button",size:"sm",className:"mt-2",onClick:o,children:[(0,e.jsx)(De,{className:"mr-1.5 h-3.5 w-3.5"}),"Make a copy"]})]})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2 px-3 py-1.5",children:[(0,e.jsxs)("span",{className:"truncate font-mono text-xs text-muted-foreground",children:[c,n.currentVersion?` · v${n.currentVersion.revisionNumber}`:""]}),(0,e.jsx)("div",{className:"flex items-center gap-2",children:X?(0,e.jsx)(ne,{variant:"secondary",children:"Read-only"}):(0,e.jsxs)(e.Fragment,{children:[$&&(0,e.jsx)(ne,{variant:"secondary",children:"Unsaved"}),(0,e.jsx)(R,{size:"sm",disabled:!$||ee.isPending,onClick:s(()=>ee.mutate({path:c,content:x,versionId:p}),"onClick"),children:ee.isPending?"Saving…":"Save"})]})})]}),je&&ae?.hasFrontmatter?(0,e.jsx)(Un,{frontmatterText:ae.frontmatterText,hasFrontmatter:ae.hasFrontmatter,fileName:c,skillSlug:n.slug,readOnly:X,onChange:s(y=>{h(b=>st({frontmatterText:y.frontmatterText,body:$e(b).body,hasFrontmatter:y.hasFrontmatter}))},"onChange")},`fm:${c}`):null,(0,e.jsx)("div",{className:"min-h-0 flex-1 overflow-auto px-3 pb-3",onBeforeInputCapture:T,onDropCapture:T,onInput:T,onKeyDownCapture:T,onPasteCapture:T,onPointerDownCapture:T,children:L.data?.encoding==="base64"?(0,e.jsx)(pn,{file:L.data}):je&&ae?(0,e.jsx)(ks,{value:ae.body,onChange:s(y=>{j.current&&h(b=>{const U=$e(b);return st({...U,body:y})})},"onChange"),bordered:!1,readOnly:X,className:"min-h-(--sz-320px)"},`body:${c}`):(0,e.jsx)(ie,{value:x,onChange:s(y=>h(y.target.value),"onChange"),readOnly:X,className:"min-h-(--sz-320px) font-mono text-xs",spellCheck:!1})})]}),(0,e.jsx)(gt,{mode:A,open:A!==null,onOpenChange:s(y=>{y||C(null)},"onOpenChange"),currentFolder:P,existingPaths:Q,pending:q.isPending,onSubmit:s((y,b)=>q.mutate({path:y,content:b}),"onSubmit")}),(0,e.jsx)(Ka,{open:N,onOpenChange:S,currentFolder:P,existingPaths:Q,pending:z.isPending,onSubmit:s(y=>z.mutate({path:y,target:"folder"}),"onSubmit")})]})}s($a,"SkillPane");function qa(t){const n=t.split("/").filter(Boolean);return n.length<=1?"":n.slice(0,-1).join("/")}s(qa,"parentFolder");function Ee(t){return t.replace(/\\/g,"/").replace(/^\.\/+/,"").replace(/^\/+/,"").split("/").filter(n=>n&&n!==".").join("/")}s(Ee,"normalizeStudioPath");function za(t){return`${t}/README.md`}s(za,"folderSeedFile");function Ba(t){return`# ${t.split("/").filter(Boolean).at(-1)??"Folder"}
|
|
3
|
+
`}s(Ba,"folderSeedContent");function pt({skillName:t,folder:n}){return(0,e.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,e.jsx)("span",{className:"truncate",children:t}),(0,e.jsx)(ve,{className:"h-3 w-3 shrink-0"}),(0,e.jsx)("span",{className:"truncate font-mono normal-case tracking-normal",children:n})]})}s(pt,"SkillPaneTitle");function ft({readOnly:t,selectedFile:n,canDeleteFile:a,pending:o,onAddFile:i,onAddFolder:l,onDeleteFile:r,onDeleteFolder:d}){const c=t||o;return(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsxs)(G,{children:[(0,e.jsx)(W,{asChild:!0,children:(0,e.jsx)("span",{children:(0,e.jsx)(R,{variant:"ghost",size:"icon-sm",disabled:c,onClick:i,"aria-label":"Add file",children:(0,e.jsx)(Ze,{className:"h-4 w-4"})})})}),(0,e.jsx)(H,{children:"Add file"})]}),(0,e.jsxs)(G,{children:[(0,e.jsx)(W,{asChild:!0,children:(0,e.jsx)("span",{children:(0,e.jsx)(R,{variant:"ghost",size:"icon-sm",disabled:c,onClick:l,"aria-label":"Add folder",children:(0,e.jsx)(us,{className:"h-4 w-4"})})})}),(0,e.jsx)(H,{children:"Add folder"})]}),(0,e.jsxs)(G,{children:[(0,e.jsx)(W,{asChild:!0,children:(0,e.jsx)("span",{children:(0,e.jsx)(R,{variant:"ghost",size:"icon-sm",disabled:c||!a,onClick:s(()=>{(typeof window>"u"||window.confirm(`Delete ${n}?`))&&r()},"onClick"),"aria-label":"Delete file",children:(0,e.jsx)(ue,{className:"h-4 w-4"})})})}),(0,e.jsx)(H,{children:a?"Delete file":"SKILL.md cannot be deleted"})]}),(0,e.jsxs)(G,{children:[(0,e.jsx)(W,{asChild:!0,children:(0,e.jsx)("span",{children:(0,e.jsx)(R,{variant:"ghost",size:"icon-sm",disabled:c,onClick:d,"aria-label":"Delete folder",children:(0,e.jsx)(vn,{className:"h-4 w-4"})})})}),(0,e.jsx)(H,{children:"Delete folder"})]})]})}s(ft,"SkillFileActions");function gt({mode:t,open:n,onOpenChange:a,currentFolder:o,existingPaths:i,pending:l,onSubmit:r}){const[d,c]=(0,u.useState)(""),[f,m]=(0,u.useState)(null);(0,u.useEffect)(()=>{!n||!t||(c(Ee(t==="folder"?o?`${o}/new-folder`:"new-folder":o?`${o}/new-file.md`:"notes.md")),m(null))},[o,t,n]);const k=t==="folder"?"Add folder":"Add file",x=t==="folder"?"Folder path":"File path";function h(){if(!t)return;const g=Ee(d);if(!g){m(`${x} is required.`);return}if(t==="file"){if(i.has(g)){m("A file already exists at that path.");return}r(g,"");return}const w=g.replace(/\/+$/,"");if([...i].some(E=>E.startsWith(`${w}/`))){m("A folder already exists at that path.");return}r(za(w),Ba(w))}return s(h,"submit"),(0,e.jsx)(fe,{open:n,onOpenChange:a,children:(0,e.jsxs)(me,{children:[(0,e.jsxs)(ce,{children:[(0,e.jsx)(xe,{children:k}),(0,e.jsx)(ge,{children:"Saved changes create a new version immediately. External sources are not updated until you publish or install an update."})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(O,{htmlFor:"skill-path-input",children:x}),(0,e.jsx)(J,{id:"skill-path-input",value:d,onChange:s(g=>{c(g.target.value),m(null)},"onChange"),placeholder:t==="folder"?"references/examples":"references/examples.md"}),t==="folder"?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"A README.md seed file is created so the folder appears in the file tree."}):null,f?(0,e.jsx)("p",{className:"text-xs text-destructive",children:f}):null]}),(0,e.jsxs)(ke,{children:[(0,e.jsx)(R,{variant:"ghost",onClick:s(()=>a(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(R,{disabled:l,onClick:h,children:"Create"})]})]})})}s(gt,"SkillPathDialog");function Ka({open:t,onOpenChange:n,currentFolder:a,existingPaths:o,pending:i,onSubmit:l}){const[r,d]=(0,u.useState)(""),[c,f]=(0,u.useState)(null);(0,u.useEffect)(()=>{t&&(d(a),f(null))},[a,t]);function m(){const k=Ee(r).replace(/\/+$/,"");if(!k){f("Folder path is required.");return}const x=[...o].filter(h=>h.startsWith(`${k}/`));if(x.length===0){f("No files exist under that folder.");return}if(x.includes("SKILL.md")){f("SKILL.md cannot be deleted.");return}l(k)}return s(m,"submit"),(0,e.jsx)(fe,{open:t,onOpenChange:n,children:(0,e.jsxs)(me,{children:[(0,e.jsxs)(ce,{children:[(0,e.jsx)(xe,{children:"Delete folder"}),(0,e.jsx)(ge,{children:"This removes every skill file under the folder and saves the result as the next version."})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(O,{htmlFor:"skill-folder-delete",children:"Folder path"}),(0,e.jsx)(J,{id:"skill-folder-delete",value:r,onChange:s(k=>{d(k.target.value),f(null)},"onChange"),placeholder:"references/examples"}),c?(0,e.jsx)("p",{className:"text-xs text-destructive",children:c}):null]}),(0,e.jsxs)(ke,{children:[(0,e.jsx)(R,{variant:"ghost",onClick:s(()=>n(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(R,{variant:"destructive",disabled:i,onClick:m,children:"Delete"})]})]})})}s(Ka,"DeleteFolderDialog");function Va({companyId:t,skillId:n,inputs:a,loading:o,selectedInputId:i,adHocMode:l,adHocContent:r,onAdHocChange:d,onSelectInput:c,onSelectAdHoc:f}){const m=se(),k=Me(),x=Gs(),[h,g]=(0,u.useState)(new Set),[w,E]=(0,u.useState)(Yt),[M,A]=(0,u.useState)(!1),[C,N]=(0,u.useState)(!1),S=a.find(v=>v.id===i)??null,j=aa(w,S),T=l?r:j,B=l?d:v=>{E(q=>({inputId:S?.id??q.inputId,draft:v,baselineContent:S?.content??q.baselineContent}))};(0,u.useEffect)(()=>{l||E(v=>na(v,S))},[l,S?.content,S?.id]),(0,u.useEffect)(()=>{!o&&a.length===0&&!l&&!i&&f()},[l,a.length,o,f,i]);const p=(0,u.useMemo)(()=>new Map(a.map(v=>[v.name,v.id])),[a]),D=(0,u.useMemo)(()=>Ct(Object.fromEntries(a.map(v=>[v.name,v.content]))),[a]),K=S?.name??null,I=!l&&ra(w,S),L=!!(S&&I&&T.trim()),$=(0,u.useCallback)(()=>I?typeof window>"u"||window.confirm("Discard unsaved changes to this input?"):!0,[I]),P=(0,u.useCallback)(v=>{!l&&v===i||$()&&c(v)},[l,$,c,i]),Q=(0,u.useCallback)(()=>{!l&&!$()||f()},[l,$,f]),Z=V({mutationFn:s(v=>_.updateTestInput(t,n,S.id,v),"mutationFn"),onSuccess:s(v=>{E({inputId:v.id,draft:v.content,baselineContent:v.content}),m.setQueryData(F.companySkills.testInputs(t,n),q=>q?.map(z=>z.id===v.id?v:z)),m.invalidateQueries({queryKey:F.companySkills.testInputs(t,n)})},"onSuccess"),onError:k("Couldn't save input")}),ee=V({mutationFn:s(v=>_.deleteTestInput(t,n,v),"mutationFn"),onSuccess:s(v=>{v.id===i&&f(),m.invalidateQueries({queryKey:F.companySkills.testInputs(t,n)})},"onSuccess"),onError:k("Couldn't delete input")});return(0,e.jsxs)(re,{title:(0,e.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[(0,e.jsxs)(G,{children:[(0,e.jsx)(W,{asChild:!0,children:(0,e.jsx)(R,{type:"button",variant:"ghost",size:"icon-xs","aria-label":C?"Expand input":"Collapse input",onClick:s(()=>N(v=>!v),"onClick"),children:C?(0,e.jsx)(ve,{className:"h-3.5 w-3.5"}):(0,e.jsx)(He,{className:"h-3.5 w-3.5"})})}),(0,e.jsx)(H,{children:C?"Expand input":"Collapse input"})]}),(0,e.jsx)("span",{children:"Input"})]}),action:(0,e.jsx)("div",{className:"flex items-center gap-1",children:(0,e.jsxs)(G,{children:[(0,e.jsx)(W,{asChild:!0,children:(0,e.jsx)(R,{variant:"ghost",size:"icon-sm",onClick:Q,"aria-label":"New input",children:(0,e.jsx)(pe,{className:"h-4 w-4"})})}),(0,e.jsx)(H,{children:"New input"})]})}),children:[C?(0,e.jsxs)("button",{type:"button",className:"flex min-h-(--sz-32px) items-center gap-2 border-b border-border px-3 py-2 text-left text-xs text-muted-foreground hover:bg-accent hover:text-foreground",onClick:s(()=>N(!1),"onClick"),children:[(0,e.jsx)(ve,{className:"h-3.5 w-3.5"}),(0,e.jsx)("span",{children:"Input folded"})]}):(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[o||a.length>0?(0,e.jsx)("div",{className:"max-h-(--sz-11_75rem) overflow-auto border-b border-border p-1",children:o?(0,e.jsx)("div",{className:"p-3 text-xs text-muted-foreground",children:"Loading inputs…"}):(0,e.jsxs)(e.Fragment,{children:[l&&(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded px-2 py-1.5 text-sm italic text-muted-foreground",children:[(0,e.jsx)(Ze,{className:"h-3.5 w-3.5"})," New input (not saved)"]}),(0,e.jsx)(wt,{nodes:D,selectedFile:K,expandedDirs:h,onToggleDir:s(v=>g(q=>{const z=new Set(q);return z.has(v)?z.delete(v):z.add(v),z}),"onToggleDir"),onSelectFile:s(v=>{const q=p.get(v);q&&P(q)},"onSelectFile"),showCheckboxes:!1,renderFileExtra:s(v=>{const q=p.get(v.path);return q?(0,e.jsxs)(Lt,{children:[(0,e.jsx)(Nt,{asChild:!0,children:(0,e.jsx)("button",{className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":`Input actions for ${v.name}`,onClick:s(z=>z.stopPropagation(),"onClick"),children:(0,e.jsx)(At,{className:"h-3.5 w-3.5"})})}),(0,e.jsxs)(Rt,{align:"end",className:"w-44",children:[(0,e.jsxs)(Ye,{onClick:s(()=>{const z=a.find(X=>X.id===q);z&&x(z.content,"Input content copied")},"onClick"),children:[(0,e.jsx)(Ft,{className:"mr-2 h-4 w-4"})," Copy content"]}),(0,e.jsx)(sn,{}),(0,e.jsxs)(Ye,{variant:"destructive",onClick:s(()=>ee.mutate(q),"onClick"),children:[(0,e.jsx)(ue,{className:"mr-2 h-4 w-4"})," Delete"]})]})]}):null},"renderFileExtra"),ariaLabel:"Test inputs"})]})}):null,(0,e.jsx)("div",{className:"flex min-h-0 flex-1",children:(0,e.jsx)("textarea",{value:T,onChange:s(v=>B(v.target.value),"onChange"),placeholder:"Paste text - treated as a new issue description.","aria-label":"Skill test input",className:"min-h-0 flex-1 resize-none border-0 bg-transparent px-3 py-3 text-sm leading-6 outline-none placeholder:text-muted-foreground focus-visible:ring-0"})}),(0,e.jsxs)("div",{className:"flex items-center gap-2 border-t border-border px-3 py-2",children:[(0,e.jsxs)("div",{className:"mr-auto flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"truncate",children:S?S.name:l?"New input":"No input selected"}),I?(0,e.jsx)(ne,{variant:"secondary",children:"Unsaved"}):null]}),S&&I?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(R,{variant:"ghost",size:"sm",disabled:Z.isPending,onClick:s(()=>E({inputId:S.id,draft:S.content,baselineContent:S.content}),"onClick"),children:"Revert"}),(0,e.jsx)(R,{variant:"outline",size:"sm",disabled:!L||Z.isPending,onClick:s(()=>Z.mutate({content:T}),"onClick"),children:Z.isPending?"Saving...":"Save changes"})]}):null,(0,e.jsx)(R,{size:"sm",disabled:!T.trim(),onClick:s(()=>A(!0),"onClick"),children:"Save as input"})]})]}),(0,e.jsx)(Oa,{open:M,onOpenChange:A,companyId:t,skillId:n,initialContent:T,onSaved:s(v=>{A(!1),c(v.id)},"onSaved")})]})}s(Va,"InputPane");function Oa({open:t,onOpenChange:n,companyId:a,skillId:o,initialContent:i,onSaved:l}){const r=se(),[d,c]=(0,u.useState)(""),[f,m]=(0,u.useState)(i);(0,u.useEffect)(()=>{t&&(m(i),c(""))},[t,i]);const k=V({mutationFn:s(()=>_.createTestInput(a,o,{name:d.trim(),content:f}),"mutationFn"),onSuccess:s(x=>{r.setQueryData(F.companySkills.testInputs(a,o),h=>[...(h??[]).filter(g=>g.id!==x.id),x].sort((g,w)=>g.name.localeCompare(w.name)||Number(new Date(g.createdAt))-Number(new Date(w.createdAt)))),r.invalidateQueries({queryKey:F.companySkills.testInputs(a,o)}),l(x)},"onSuccess")});return(0,e.jsx)(fe,{open:t,onOpenChange:n,children:(0,e.jsxs)(me,{children:[(0,e.jsxs)(ce,{children:[(0,e.jsx)(xe,{children:"Save test input"}),(0,e.jsx)(ge,{children:"Runs snapshot input at run time — editing later won't change past runs."})]}),(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)(O,{htmlFor:"input-name",children:"Name"}),(0,e.jsx)(J,{id:"input-name",value:d,onChange:s(x=>c(x.target.value),"onChange"),placeholder:"onboarding/happy-path"}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Use “/” for folders, e.g. onboarding/happy-path"})]}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)(O,{htmlFor:"input-content",children:"Content"}),(0,e.jsx)(ie,{id:"input-content",value:f,onChange:s(x=>m(x.target.value),"onChange"),className:"min-h-(--sz-160px)"})]})]}),(0,e.jsxs)(ke,{children:[(0,e.jsx)(R,{variant:"ghost",onClick:s(()=>n(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(R,{disabled:!d.trim()||!f.trim()||k.isPending,onClick:s(()=>k.mutate(),"onClick"),children:"Save"})]})]})})}s(Oa,"SaveInputDialog");function Qa({companyId:t,skill:n,inputs:a,selectedInput:o,adHocMode:i,adHocContent:l,selectedRunId:r,onSelectRun:d,selectedAgentId:c,onSelectAgent:f,skillDirty:m,filterInput:k,onClearFilter:x}){const h=n.id,g=se(),w=Me(),E=he(),[M,A]=(0,u.useState)(!1),[C,N]=(0,u.useState)(()=>xt(t)),[S,j]=(0,u.useState)(null),T=Y({queryKey:F.agents.list(t),queryFn:s(()=>Fe.list(t),"queryFn"),enabled:!!t}).data??[],B=T.find(b=>b.id===c)??null;(0,u.useEffect)(()=>{N(xt(t))},[t]);const p=(0,u.useCallback)(b=>{N(b),Ta(t,b)},[t]),D=Y({queryKey:F.companySkills.testRunTemplates(t),queryFn:s(()=>_.testRunTemplates(t),"queryFn"),enabled:!!t}),K=Mt(D),I=D.data??wa;(0,u.useEffect)(()=>{if(!D.isSuccess)return;const b=Oe(C,I);b.recovered&&(p(b.selection),E?.pushToast({tone:"warn",title:"Run template reset",body:"The saved run template is no longer available. Default test template is selected.",dedupeKey:`skill-studio-template-reset:${t}`}))},[t,C,I,D.isSuccess,E,p]);const L=k?.id??null,$=Y({queryKey:F.companySkills.testRuns(t,h,L),queryFn:s(()=>_.testRuns(t,h,L?{inputId:L}:{}),"queryFn"),enabled:!!(t&&h),refetchInterval:s(b=>b.state.data?.some(U=>Ut(U.status))?tt:!1,"refetchInterval")}),P=$.data??[],Q=i?l.trim().length>0:!!o?.content.trim(),Z=sa({hasAgent:!!B,hasInput:Q,skillFileCount:n.fileInventory.length,hasUnsavedSkillEdits:m}),ee=D.isLoading?"Loading run templates":K.kind==="error"?"Run templates couldn't load":null,v=V({mutationFn:s(b=>_.createTestRunTemplate(t,b),"mutationFn"),onSuccess:s(b=>{j(null),p(b.id),g.invalidateQueries({queryKey:F.companySkills.testRunTemplates(t)}),E?.pushToast({tone:"success",title:"Template saved",body:`${b.name} is ready for Skills Studio runs.`})},"onSuccess"),onError:w("Couldn't save template")}),q=V({mutationFn:s(({templateId:b,payload:U})=>_.updateTestRunTemplate(t,b,U),"mutationFn"),onSuccess:s(b=>{j(null),p(b.id),g.invalidateQueries({queryKey:F.companySkills.testRunTemplates(t)}),E?.pushToast({tone:"success",title:"Template updated",body:`${b.name} is ready for Skills Studio runs.`})},"onSuccess"),onError:w("Couldn't update template")}),z=V({mutationFn:s(b=>_.deleteTestRunTemplate(t,b),"mutationFn"),onSuccess:s(b=>{const U=Oe(C,I.filter(be=>be.id!==b.id));(C===b.id||U.recovered)&&p(U.selection),g.invalidateQueries({queryKey:F.companySkills.testRunTemplates(t)}),E?.pushToast({tone:"success",title:"Template deleted",body:`${b.name} was removed from Skills Studio runs.`})},"onSuccess"),onError:w("Couldn't delete template")}),X=C===null?null:I.find(b=>b.id===C)??null,je=C===null?"No template":X?.name??"Default test template",ae=Z.reason??ee,y=V({mutationFn:s(()=>{if(!D.isSuccess)throw new Error(ee??"Run templates are not ready.");const b=Oe(C,I);if(b.recovered)throw p(b.selection),new Error("Selected run template is no longer available. The selection was reset.");return _.createTestRun(t,h,ma({agentId:c,inputId:i?null:o?.id??null,content:i?l:o?null:l,templateId:b.selection}))},"mutationFn"),onSuccess:s(b=>{g.invalidateQueries({queryKey:F.companySkills.testRuns(t,h,L)}),d(b.id)},"onSuccess"),onError:w("Couldn't start run")});return r?(0,e.jsx)(Ja,{companyId:t,skill:n,runId:r,agents:T,onBack:s(()=>d(null),"onBack"),onSelectRun:d}):(0,e.jsxs)(re,{title:"Test runs",action:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(Xa,{agents:T,selectedAgent:B,onSelect:f}),(0,e.jsxs)(G,{children:[(0,e.jsx)(W,{asChild:!0,children:(0,e.jsx)("span",{children:(0,e.jsxs)(R,{size:"sm",disabled:Z.disabled||!!ee||y.isPending,onClick:s(()=>y.mutate(),"onClick"),children:[(0,e.jsx)(Ns,{className:"mr-1.5 h-3.5 w-3.5"})," Run"]})})}),ae&&(0,e.jsx)(H,{side:"bottom",children:ae})]})]}),children:[(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[(0,e.jsx)(Ga,{open:M,onOpenChange:A,templates:I,templatesLoading:D.isLoading,templatesError:K.kind==="error",selectedTemplateId:C,selectedTemplate:X,selectedTemplateName:je,onSelectTemplate:p,onCreateTemplate:s(()=>j({mode:"create"}),"onCreateTemplate"),onEditTemplate:s(b=>j({mode:"edit",source:b}),"onEditTemplate"),onDuplicateTemplate:s(b=>j({mode:"create",source:b}),"onDuplicateTemplate"),onDeleteTemplate:s(b=>{typeof window<"u"&&!window.confirm(`Delete run template "${b.name}"?`)||z.mutate(b.id)},"onDeleteTemplate"),deletingTemplateId:z.variables??null,actionPending:v.isPending||q.isPending||z.isPending}),k&&(0,e.jsx)("div",{className:"px-3 pt-2",children:(0,e.jsx)(jn,{filters:[{key:"input",label:"Input",value:k.name}],onRemove:x,onClear:x})}),(0,e.jsx)("div",{className:"min-h-0 flex-1 overflow-auto p-3",children:$.isLoading?(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:"Loading runs…"}):P.length===0?(0,e.jsx)(Le,{icon:Ss,message:"No test runs yet. Pick an agent and Run."}):(0,e.jsx)("div",{className:"space-y-1 rounded-md border border-border p-1",children:P.map(b=>(0,e.jsx)(Ha,{run:b,agents:T,onSelect:s(()=>d(b.id),"onSelect")},b.id))})})]}),(0,e.jsx)(Wa,{state:S,pending:v.isPending||q.isPending,onOpenChange:s(b=>{b||j(null)},"onOpenChange"),onSubmit:s(b=>{S?.mode==="edit"?q.mutate({templateId:S.source.id,payload:b}):v.mutate(b)},"onSubmit")})]})}s(Qa,"RunsPane");function Ua(t){return t??"__paperclip_no_template__"}s(Ua,"runTemplateOptionValue");function Ya(t){return t==="__paperclip_no_template__"?null:t}s(Ya,"runTemplateSelectionFromOption");function Ga({open:t,onOpenChange:n,templates:a,templatesLoading:o,templatesError:i,selectedTemplateId:l,selectedTemplate:r,selectedTemplateName:d,onSelectTemplate:c,onCreateTemplate:f,onEditTemplate:m,onDuplicateTemplate:k,onDeleteTemplate:x,deletingTemplateId:h,actionPending:g}){const w=(0,u.useMemo)(()=>{const S={key:"no-template",value:Qt,label:"No template",title:"No template",description:"Run only the input text.",builtIn:!0,searchText:"no template plain input"},j=s(p=>({key:p.id,value:p.id,label:p.name,title:p.name,description:p.description,builtIn:p.builtIn,searchText:[p.name,p.description??"",p.builtIn?"built in":"custom"].join(" ")}),"toOption"),T=a.filter(p=>p.builtIn).map(j),B=a.filter(p=>!p.builtIn).map(j);return[{id:"built-in",label:"Built in",options:[S,...T]},...B.length>0?[{id:"custom",label:"Custom",options:B}]:[]]},[a]),E=Ua(l),M=l!==null&&!r&&!o,A=!!(r&&!r.builtIn),C=!!r,N=!!(r&&!r.builtIn);return(0,e.jsxs)("div",{className:"border-b border-border",children:[(0,e.jsxs)("button",{type:"button",className:"flex min-h-(--sz-32px) w-full items-center gap-2 px-3 py-2 text-left text-xs text-muted-foreground hover:bg-accent hover:text-foreground",onClick:s(()=>n(!t),"onClick"),children:[t?(0,e.jsx)(He,{className:"h-3.5 w-3.5"}):(0,e.jsx)(ve,{className:"h-3.5 w-3.5"}),(0,e.jsx)("span",{className:"font-semibold uppercase tracking-wide",children:"Advanced"}),(0,e.jsx)("span",{className:"ml-auto truncate",children:d})]}),t?(0,e.jsxs)("div",{className:"space-y-3 px-3 pb-3 pt-1",children:[(0,e.jsxs)("div",{className:"flex items-end gap-2",children:[(0,e.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,e.jsx)(O,{children:"Run template"}),(0,e.jsx)(Xe,{value:E,groups:w,loading:o,disabled:o||i,loadingMessage:"Loading templates...",placeholder:"Select template",searchPlaceholder:"Search templates...",emptyMessage:"No templates.",contentClassName:"w-(--sz-320px)",onValueChange:s(S=>c(Ya(S)),"onValueChange"),renderValue:s(S=>S?.label??d,"renderValue"),renderOption:s((S,{selected:j})=>(0,e.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,e.jsx)("span",{className:te("truncate",j&&"font-medium"),children:S.label}),(0,e.jsx)("span",{className:"truncate text-(length:--text-micro) text-muted-foreground",children:S.description??(S.builtIn?"Built in":"Custom")})]}),"renderOption")})]}),(0,e.jsxs)(G,{children:[(0,e.jsx)(W,{asChild:!0,children:(0,e.jsx)(R,{type:"button",variant:"outline",size:"icon-sm","aria-label":"Create run template",disabled:g,onClick:f,children:(0,e.jsx)(pe,{})})}),(0,e.jsx)(H,{children:"Create run template"})]}),(0,e.jsxs)(G,{children:[(0,e.jsx)(W,{asChild:!0,children:(0,e.jsx)("span",{children:(0,e.jsx)(R,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Edit run template",disabled:!A||g,onClick:s(()=>r&&m(r),"onClick"),children:(0,e.jsx)(Ps,{})})})}),(0,e.jsx)(H,{children:"Edit custom template"})]}),(0,e.jsxs)(G,{children:[(0,e.jsx)(W,{asChild:!0,children:(0,e.jsx)("span",{children:(0,e.jsx)(R,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Duplicate run template",disabled:!C||g,onClick:s(()=>r&&k(r),"onClick"),children:(0,e.jsx)(Ft,{})})})}),(0,e.jsx)(H,{children:r?.builtIn?"Duplicate built-in template":"Duplicate template"})]}),(0,e.jsxs)(G,{children:[(0,e.jsx)(W,{asChild:!0,children:(0,e.jsx)("span",{children:(0,e.jsx)(R,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Delete run template",className:"text-destructive hover:text-destructive",disabled:!N||g||h===r?.id,onClick:s(()=>r&&x(r),"onClick"),children:(0,e.jsx)(ue,{})})})}),(0,e.jsx)(H,{children:"Delete custom template"})]})]}),i?(0,e.jsx)("p",{className:"text-xs text-destructive",children:"Run templates could not load."}):l===null?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Runs will use only the input text."}):M?(0,e.jsx)("p",{className:"text-xs text-destructive",children:"Selected template is no longer available."}):r?(0,e.jsxs)("div",{className:"space-y-2",children:[r.description?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:r.description}):null,(0,e.jsx)("pre",{className:te("max-h-(--sz-240px) overflow-auto whitespace-pre-wrap rounded-md border border-border bg-muted/30 p-3 text-xs leading-5 text-muted-foreground",xs),children:r.body})]}):(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Loading template..."})]}):null]})}s(Ga,"RunTemplateAdvancedPanel");function Wa({state:t,pending:n,onOpenChange:a,onSubmit:o}){const i=t?.source??null,[l,r]=(0,u.useState)(""),[d,c]=(0,u.useState)(""),[f,m]=(0,u.useState)("");(0,u.useEffect)(()=>{t&&(r(t.mode==="edit"?i?.name??"":i?`${i.name} copy`:""),c(i?.description??""),m(i?.body??""))},[i,t]);const k=t?.mode==="edit"?"Edit run template":i?.builtIn?"Duplicate built-in template":"Create run template",x=t?.mode==="edit"?"Update the custom run instructions used by Skills Studio.":"Save reusable run instructions for Skills Studio.";return(0,e.jsx)(fe,{open:!!t,onOpenChange:a,children:(0,e.jsxs)(me,{children:[(0,e.jsxs)(ce,{children:[(0,e.jsx)(xe,{children:k}),(0,e.jsx)(ge,{children:x})]}),(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)(O,{htmlFor:"run-template-name",children:"Name"}),(0,e.jsx)(J,{id:"run-template-name",value:l,onChange:s(h=>r(h.target.value),"onChange"),placeholder:"Focused smoke"})]}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)(O,{htmlFor:"run-template-description",children:"Description"}),(0,e.jsx)(J,{id:"run-template-description",value:d,onChange:s(h=>c(h.target.value),"onChange"),placeholder:"Short instructions for common skill checks"})]}),(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)(O,{htmlFor:"run-template-body",children:"Body"}),(0,e.jsx)(ie,{id:"run-template-body",value:f,onChange:s(h=>m(h.target.value),"onChange"),className:"min-h-(--sz-240px) font-mono text-xs leading-5"}),(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Placeholders: ","{{skillName}}",", ","{{skillKey}}",", ","{{skillInvocation}}",", ","{{skillVersion}}",", ","{{runId}}",", ","{{issueId}}",", ","{{outputDocumentKey}}","."]})]})]}),(0,e.jsxs)(ke,{children:[(0,e.jsx)(R,{variant:"ghost",onClick:s(()=>a(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(R,{disabled:!l.trim()||!f.trim()||n,onClick:s(()=>o({name:l.trim(),description:d.trim()||null,body:f}),"onClick"),children:n?"Saving...":"Save template"})]})]})})}s(Wa,"RunTemplateDialog");function Ha({run:t,agents:n,onSelect:a}){const o=n.find(d=>d.id===t.agentId)??null,i=!o,l=t.agentConfigSnapshot?.name??"Agent",r=o?.name??l;return(0,e.jsx)(Je,{leading:(0,e.jsx)(yt,{status:t.status}),identifier:da(t),title:i?`${r} (removed)`:r,subtitle:Ne(t.createdAt),trailing:(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:St(t.cost.costCents)}),onClick:a})}s(Ha,"RunHistoryRow");function Xa({agents:t,selectedAgent:n,onSelect:a}){const[o,i]=(0,u.useState)(!1);return(0,e.jsxs)(fs,{open:o,onOpenChange:i,children:[(0,e.jsx)(vs,{asChild:!0,children:(0,e.jsx)(R,{variant:"outline",size:"sm",children:n?(0,e.jsx)(Ue,{agent:n,size:"xs"}):(0,e.jsx)("span",{className:"text-muted-foreground",children:"Pick an agent"})})}),(0,e.jsx)(As,{align:"end",className:"w-64 p-0",children:(0,e.jsxs)(an,{children:[(0,e.jsx)(Ds,{placeholder:"Search agents…"}),(0,e.jsxs)(en,{children:[(0,e.jsx)(qs,{children:"No agents."}),(0,e.jsx)(tn,{children:t.map(l=>{const r=oa(l);return(0,e.jsxs)(ps,{value:l.name,disabled:!r,onSelect:s(()=>{r&&(a(l.id),i(!1))},"onSelect"),className:te("flex items-center gap-2",!r&&"opacity-50"),children:[(0,e.jsx)("span",{className:te("h-2 w-2 rounded-full",r?"bg-green-500":"bg-orange-400"),"aria-hidden":!0}),(0,e.jsx)(Ue,{agent:l,size:"xs"}),!r&&(0,e.jsx)(ne,{variant:"secondary",className:"ml-auto",children:"Paused"})]},l.id)})})]})]})})]})}s(Xa,"AgentPicker");function Ja({companyId:t,skill:n,runId:a,agents:o,onBack:i,onSelectRun:l}){const r=n.id,d=se(),c=Me(),f=Y({queryKey:F.companySkills.testRunDetail(t,r,a),queryFn:s(()=>_.testRunDetail(t,r,a),"queryFn"),enabled:!!(t&&r&&a),refetchInterval:s(I=>{const L=I.state.data;return L&&Ut(L.status)?tt:!1},"refetchInterval")}),m=V({mutationFn:s(()=>_.cancelTestRun(t,r,a),"mutationFn"),onSuccess:s(()=>d.invalidateQueries({queryKey:F.companySkills.testRunDetail(t,r,a)}),"onSuccess"),onError:c("Couldn't cancel run")}),k=V({mutationFn:s(()=>{const I=f.data;if(!I)throw new Error("Run details are still loading.");return _.createTestRun(t,r,ba(I))},"mutationFn"),onSuccess:s(I=>{d.invalidateQueries({queryKey:["company-skills",t,r,"test-runs"]}),l(I.id)},"onSuccess"),onError:c("Couldn't re-run")}),x=V({mutationFn:s(()=>_.deleteTestRun(t,r,a),"mutationFn"),onSuccess:s(()=>{d.invalidateQueries({queryKey:["company-skills",t,r,"test-runs"]}),l(null)},"onSuccess"),onError:c("Couldn't delete run")}),h=f.data??null,g=(0,u.useMemo)(()=>h?fa(h):[],[h]),w=(0,u.useMemo)(()=>h?ga(h):[],[h]),E=(0,u.useMemo)(()=>h?ha(h):null,[h]),M=(0,u.useMemo)(()=>h?ja(h):[],[h]),[A,C]=(0,u.useState)(!1),[N,S]=(0,u.useState)(0);if(f.isLoading)return(0,e.jsx)(re,{title:"Run",action:(0,e.jsx)(Qe,{onBack:i}),children:(0,e.jsx)("div",{className:"p-3 text-xs text-muted-foreground",children:"Loading run…"})});if(!h)return(0,e.jsx)(re,{title:"Run",action:(0,e.jsx)(Qe,{onBack:i}),children:(0,e.jsx)("div",{className:"p-3 text-xs text-muted-foreground",children:"Run not found."})});const j=o.find(I=>I.id===h.agentId)??null,T=j?.name??h.agentConfigSnapshot?.name??"Agent",B=!j,p=Zn(h),D=!et(h.status),K=ta(h);return(0,e.jsx)(re,{title:"Run",action:(0,e.jsx)(Qe,{onBack:i}),children:(0,e.jsxs)("div",{className:"min-h-0 flex-1 space-y-3 overflow-auto p-3",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(yt,{status:h.status}),(0,e.jsx)(Ue,{agent:j??{id:h.agentId,name:T},size:"xs"}),B&&(0,e.jsx)(ne,{variant:"secondary",children:"removed"}),(0,e.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:["v",h.skillVersion.revisionNumber]}),(0,e.jsx)("span",{className:"ml-auto font-mono text-xs text-muted-foreground",children:St(h.cost.costCents)})]}),(0,e.jsxs)("div",{className:"rounded-md border border-border text-xs",children:[(0,e.jsx)(Te,{label:"Input",value:h.inputId?"saved input":"ad-hoc paste"}),(0,e.jsx)(Te,{label:"Template",value:h.templateName??"No template"}),(0,e.jsx)(Te,{label:"Skill version",value:`v${h.skillVersion.revisionNumber}`}),(0,e.jsx)(Te,{label:"Created",value:Ne(h.createdAt)})]}),ea(h.status)&&(0,e.jsxs)(js,{className:"border-destructive/50",children:[(0,e.jsxs)(Qs,{className:"flex-row items-center gap-2 space-y-0 pb-2",children:[(0,e.jsx)(le,{className:"h-3.5 w-3.5 text-destructive"}),(0,e.jsx)("span",{className:"text-sm font-medium",children:"Run failed"})]}),(0,e.jsx)(Ts,{className:"text-sm text-muted-foreground",children:h.error??"The test task ended with an error."})]}),p==="output"||p==="draft"?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:p==="draft"?"Draft at failure":"Output snapshot"}),(0,e.jsx)("div",{className:"rounded-md border border-border p-3",children:(0,e.jsx)(_t,{children:h.outputBody||"_No output_"})})]}):p==="pending"?(0,e.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)(Xs,{className:"h-3.5 w-3.5"})," Working… output will appear here."]}):null,E?(0,e.jsx)(Za,{copy:E}):null,g.length>0?(0,e.jsx)(er,{documents:g}):null,(0,e.jsx)(Zt,{workProducts:h.harnessContent.workProducts,onMediaClick:s(I=>{const L=I.metadata;if(!L)return;const $=M.findIndex(P=>P.contentPath===L.contentPath||P.id===`work-product-${I.id}`||P.id===L.attachmentId);S($>=0?$:0),C(!0)},"onMediaClick")}),w.length>0?(0,e.jsx)(ss,{attachments:w,onImageClick:s(I=>{const L=M.findIndex($=>$.id===I.id||$.contentPath===I.contentPath);S(L>=0?L:0),C(!0)},"onImageClick")}):null,(0,e.jsx)(tr,{companyId:t,detail:h,agents:o,onAnswered:s(()=>d.invalidateQueries({queryKey:F.companySkills.testRunDetail(t,r,a)}),"onAnswered")}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-t border-border pt-3",children:[(0,e.jsxs)(R,{variant:"outline",size:"sm",disabled:k.isPending,onClick:s(()=>k.mutate(),"onClick"),children:[(0,e.jsx)(rn,{className:"mr-1.5 h-3.5 w-3.5"})," Re-run"]}),D?(0,e.jsx)(R,{variant:"ghost",size:"sm",disabled:m.isPending,onClick:s(()=>m.mutate(),"onClick"),children:"Cancel"}):(0,e.jsxs)(R,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",disabled:x.isPending,onClick:s(()=>x.mutate(),"onClick"),children:[(0,e.jsx)(ue,{className:"mr-1.5 h-3.5 w-3.5"})," Delete"]}),K.enabled&&h.harnessIssue?(0,e.jsx)(R,{variant:"link",size:"sm",asChild:!0,children:(0,e.jsx)(Ae,{to:`/issues/${h.harnessIssue.id}`,children:"Open test task ↗"})}):(0,e.jsxs)(G,{children:[(0,e.jsx)(W,{asChild:!0,children:(0,e.jsx)("span",{className:"cursor-not-allowed text-xs text-muted-foreground",children:"Open test task ↗"})}),(0,e.jsx)(H,{children:K.reason})]})]}),(0,e.jsx)(es,{items:M,initialIndex:N,open:A,onOpenChange:C})]})})}s(Ja,"RunDetailView");function Za({copy:t}){return(0,e.jsxs)("div",{className:"flex items-start gap-2 rounded-md border border-border bg-muted/30 p-3 text-xs",children:[(0,e.jsx)(le,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsx)("p",{className:"font-medium text-foreground",children:t.title}),(0,e.jsx)("p",{className:"text-muted-foreground",children:t.body})]})]})}s(Za,"RunHarnessUnavailableNotice");function er({documents:t}){return(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(Ls,{className:"h-3.5 w-3.5 text-muted-foreground","aria-hidden":"true"}),(0,e.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Documents"}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:t.length})]}),(0,e.jsx)("div",{className:"space-y-2",children:t.map(n=>(0,e.jsxs)("article",{className:"rounded-md border border-border p-3",children:[(0,e.jsxs)("div",{className:"mb-2 flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"truncate font-medium text-foreground",children:n.title??n.key}),(0,e.jsx)("span",{className:"ml-auto shrink-0",children:Ne(n.updatedAt)})]}),(0,e.jsx)(_t,{className:"paperclip-edit-in-place-content text-sm leading-7",softBreaks:!1,children:n.body})]},n.id))})]})}s(er,"RunDocumentsSection");function tr({companyId:t,detail:n,agents:a,onAnswered:o}){const i=n.harnessIssue?.id??null,l=n.interactions.some(x=>la(x)),r=Y({queryKey:["skill-studio","interactions",i],queryFn:s(()=>Se.listInteractions(i),"queryFn"),enabled:!!(i&&l),refetchInterval:s(x=>ns(x.state.data,l?tt:!1),"refetchInterval")}),d=(0,u.useMemo)(()=>new Map((r.data??[]).map(x=>[x.id,x])),[r.data]),c=(0,u.useMemo)(()=>new Map(a.map(x=>[x.id,x])),[a]),f=V({mutationFn:s(x=>Se.acceptInteraction(i,x.interaction.id,{selectedOptionIds:x.optionIds}),"mutationFn"),onSuccess:o}),m=V({mutationFn:s(x=>Se.respondToInteraction(i,x.interaction.id,{answers:x.answers}),"mutationFn"),onSuccess:o}),k=V({mutationFn:s(x=>Se.rejectInteraction(i,x.interaction.id,x.reason),"mutationFn"),onSuccess:o});return n.interactions.length===0?null:(0,e.jsxs)("section",{children:[(0,e.jsx)("h3",{className:"mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Interactions"}),(0,e.jsx)("div",{className:"space-y-2",children:n.interactions.map(x=>{const h=Gt(x.kind)==="inline",g=d.get(x.id);return h&&g?(0,e.jsx)(os,{interaction:g,agentMap:c,onAcceptInteraction:s(async(w,E,M)=>{await f.mutateAsync({interaction:w,optionIds:M})},"onAcceptInteraction"),onRejectInteraction:s(async(w,E)=>{await k.mutateAsync({interaction:w,reason:E})},"onRejectInteraction"),onSubmitInteractionAnswers:s(async(w,E)=>{await m.mutateAsync({interaction:w,answers:E})},"onSubmitInteractionAnswers")},x.id):(0,e.jsx)(Je,{title:x.title,subtitle:`${x.kind} · ${x.status}`,trailing:i?(0,e.jsx)(R,{variant:"link",size:"xs",asChild:!0,children:(0,e.jsx)(Ae,{to:`/issues/${i}`,children:"Open test task ↗"})}):null},x.id)})})]})}s(tr,"InteractionSection");function sr({open:t,onOpenChange:n,companyId:a,skill:o,onRestored:i,onFilterRuns:l}){const r=o.id,d=se(),c=Y({queryKey:F.companySkills.versions(a,r),queryFn:s(()=>_.versions(a,r),"queryFn"),enabled:t&&!!(a&&r)}),f=c.data??[],[m,k]=(0,u.useState)(null),[x,h]=(0,u.useState)(null),g=V({mutationFn:s(async N=>{if(o.sourceType==="local_path"){const S=await _.version(a,r,N.id);let j=o.currentVersionId;for(const T of S.fileInventory)j=(await _.updateFile(a,r,T.path,T.content,{encoding:T.encoding,executable:T.executable??!1,expectedVersionId:j})).versionId??j;return _.createVersion(a,r,{label:`Restore of v${S.revisionNumber}`,expectedVersionId:j})}return _.createVersion(a,r,{sourceVersionId:N.id,expectedVersionId:o.currentVersionId,label:"Restored saved version"})},"mutationFn"),onSuccess:s(()=>{d.invalidateQueries({queryKey:F.companySkills.versions(a,r)}),i()},"onSuccess")}),w=Y({queryKey:[...F.companySkills.versions(a,r),m],queryFn:s(()=>_.version(a,r,m),"queryFn"),enabled:t&&!!(m&&x)}),E=Y({queryKey:[...F.companySkills.versions(a,r),x],queryFn:s(()=>_.version(a,r,x),"queryFn"),enabled:t&&!!(m&&x)}),M=w.data??null,A=E.data??null,C=M&&A?ts(M.fileInventory.map(N=>`# ${N.path}${N.executable?" (executable)":""}
|
|
4
|
+
${N.encoding==="base64"?"[Binary asset]":N.content}`).join(`
|
|
5
|
+
|
|
6
|
+
`),A.fileInventory.map(N=>`# ${N.path}${N.executable?" (executable)":""}
|
|
7
|
+
${N.encoding==="base64"?"[Binary asset]":N.content}`).join(`
|
|
8
|
+
|
|
9
|
+
`)):null;return(0,e.jsx)(zs,{open:t,onOpenChange:n,children:(0,e.jsxs)(Ws,{side:"left",className:"w-full sm:max-w-(--sz-560px)",children:[(0,e.jsx)(Bs,{children:(0,e.jsx)(Is,{children:"Version history"})}),(0,e.jsxs)("div",{className:"mt-3 space-y-2 overflow-auto",children:[c.isLoading?(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:"Loading versions…"}):f.length===0?(0,e.jsx)(Le,{icon:kt,message:"No versions yet. Save changes to create the first."}):(0,e.jsx)("div",{className:"space-y-1 rounded-md border border-border p-1",children:f.map(N=>(0,e.jsx)(Je,{identifier:`v${N.revisionNumber}`,title:N.label??`Version ${N.revisionNumber}`,subtitle:Ne(N.createdAt),selected:N.id===m||N.id===x,onClick:s(()=>{m?!x&&N.id!==m?h(N.id):(k(N.id),h(null)):k(N.id)},"onClick"),trailing:(0,e.jsxs)(R,{variant:"outline",size:"xs",disabled:g.isPending||o.editable===!1,onClick:s(S=>{S.stopPropagation(),g.mutate(N)},"onClick"),children:["Restore as v",(o.currentVersion?.revisionNumber??N.revisionNumber)+1]})},N.id))}),(c.error||w.error||E.error||g.error)&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:(c.error??w.error??E.error??g.error)?.message}),m&&x&&(w.isLoading||E.isLoading)&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading selected versions…"}),C&&(0,e.jsxs)("div",{className:"rounded-md border border-border",children:[(0,e.jsxs)("div",{className:"border-b border-border px-3 py-1.5 text-xs text-muted-foreground",children:["Diff v",M?.revisionNumber," → v",A?.revisionNumber]}),(0,e.jsx)("pre",{className:te("max-h-64 overflow-auto p-2 text-xs","ph-mask ph-sensitive"),children:C.map((N,S)=>(0,e.jsxs)("div",{className:te("whitespace-pre-wrap",N.kind==="added"&&"bg-green-500/10 text-green-700 dark:text-green-300",N.kind==="removed"&&"bg-red-500/10 text-red-700 dark:text-red-300"),children:[N.kind==="added"?"+":N.kind==="removed"?"-":" ",N.text]},S))})]})]})]})})}s(sr,"VersionHistorySheet");function re({title:t,action:n,children:a}){return(0,e.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[(0,e.jsx)("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:t}),n]}),(0,e.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:a})]})}s(re,"PaneScaffold");function Te({label:t,value:n}){return(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-1.5 last:border-b-0",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:t}),(0,e.jsx)("span",{className:"truncate",children:n})]})}s(Te,"PropRow");function Qe({onBack:t}){return(0,e.jsxs)(R,{variant:"ghost",size:"sm",onClick:t,children:[(0,e.jsx)(Js,{className:"mr-1.5 h-3.5 w-3.5"})," Back"]})}s(Qe,"BackButton");function nr({skill:t,input:n,runs:a}){return(0,e.jsxs)(Dt,{defaultValue:"skill",className:"flex flex-1 flex-col",children:[(0,e.jsxs)(Et,{variant:"line",className:"px-3",children:[(0,e.jsx)(de,{value:"skill",children:"Skill"}),(0,e.jsx)(de,{value:"input",children:"Input"}),(0,e.jsx)(de,{value:"runs",children:"Runs"})]}),(0,e.jsx)(qe,{value:"skill",className:"min-h-0 flex-1",children:t}),(0,e.jsx)(qe,{value:"input",className:"min-h-0 flex-1",children:n}),(0,e.jsx)(qe,{value:"runs",className:"min-h-0 flex-1",children:a})]})}s(nr,"MobileTabs");export{jr as SkillStudio};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=Object.defineProperty;var s=(l,a)=>i(l,"name",{value:a,configurable:!0});import{a as n}from"./rolldown-runtime-DhZMWcEn.js";import{$A as t,Gb as o,li as c,o_ as d}from"./index-BJtnP7H1.js";var e=n(t(),1),u=[{value:"installed",label:"Installed"},{value:"discover",label:"Discover"},{value:"authored",label:"My Skills"}];function b({activeView:l}){return(0,e.jsx)("nav",{"aria-label":"Skills views","data-canonical-tabs":"standard",className:"canonical-tab-list",children:u.map(a=>(0,e.jsx)(o,{to:c[a.value],className:"canonical-tab","data-state":l===a.value?"active":"inactive","aria-current":l===a.value?"page":void 0,children:a.label},a.value))})}s(b,"SkillsNavigationTabs");function _({activeView:l,fallback:a=null}){const{enabled:r}=d();return r?(0,e.jsx)("div",{className:"shrink-0 border-b border-border px-3 py-2",children:(0,e.jsx)(b,{activeView:l})}):a}s(_,"SkillsPageNavigation");export{_ as n,b as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var F=Object.defineProperty;var a=(s,t)=>F(s,"name",{value:t,configurable:!0});import{a as R}from"./rolldown-runtime-DhZMWcEn.js";import{$A as L,$S as U,$T as w,ME as P,NE as f,Sp as E,__ as T,bE as S,hE as D,lE as M,lS as K,nj as Y,uE as j,ub as $,xE as k,zE as z}from"./index-BJtnP7H1.js";var d=R(Y(),1),N=a((s,t)=>`/companies/${encodeURIComponent(s)}/voice-phone/${encodeURIComponent(t)}`,"path$1"),C={configuration:a((s,t)=>j.get(N(s,t),{cache:"no-store"}),"configuration"),save:a((s,t,n)=>j.put(N(s,t),n),"save"),incoming:a((s,t)=>j.get(`${N(s,t)}/incoming`,{cache:"no-store"}),"incoming"),history:a((s,t)=>j.get(`${N(s,t)}/history`,{cache:"no-store"}),"history"),decide:a((s,t,n,r)=>j.post(`${N(s,t)}/incoming/${encodeURIComponent(n)}`,r),"decide")},e=R(L(),1);function B({configuration:s,loading:t,saving:n,saved:r,error:i,onRefresh:c,onSave:l}){const[m,b]=(0,d.useState)(s?.number?.id??""),[p,x]=(0,d.useState)(s?.number?.enabled??!1),[v,h]=(0,d.useState)(s?.number?.guestIntake??!1),[o,g]=(0,d.useState)(!1),[I,A]=(0,d.useState)(s?.number?.lowTrustEnvironmentId??"");(0,d.useEffect)(()=>{b(s?.number?.id??""),x(s?.number?.enabled??!1),h(s?.number?.guestIntake??!1),A(s?.number?.lowTrustEnvironmentId??"")},[s]);const y=s?.inventory.find(u=>u.id===m);return(0,e.jsxs)("section",{className:"max-w-xl space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:"Incoming calls"}),(0,e.jsx)(f,{size:"sm",variant:"ghost",disabled:t||n,onClick:c,children:"Refresh numbers"})]}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Let callers start a conversation in a new task, or require approval to discuss an existing task."}),t&&(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Loading Speko numbers…"}),!t&&!s?.inventory.length&&(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:["No numbers are available. ",(0,e.jsx)("a",{className:"text-primary underline",href:"https://platform.speko.ai",target:"_blank",rel:"noreferrer",children:"Buy or import a number in Speko"}),", complete verification and add credits, then refresh."]}),(0,e.jsxs)("form",{className:"space-y-3",onSubmit:a(u=>{if(u.preventDefault(),!m||!y?.available){g(!0);return}g(!1),l({numberId:m,enabled:p,guestIntake:v,lowTrustEnvironmentId:I||null})},"onSubmit"),children:[(0,e.jsxs)("label",{className:"grid min-w-0 gap-2 text-sm font-medium",children:["Company phone number",(0,e.jsxs)("select",{"aria-label":"Company phone number",disabled:t||n,className:"min-w-0 w-full rounded-md border border-input bg-background p-2 text-sm",value:m,onChange:a(u=>{b(u.target.value),g(!1)},"onChange"),children:[(0,e.jsx)("option",{value:"",children:"Select a number"}),s?.inventory.map(u=>(0,e.jsxs)("option",{value:u.id,disabled:!u.available,children:[u.phoneNumber,u.label?` · ${u.label}`:"",u.available?"":" · unavailable"]},u.id))]})]}),y&&!y.inboundReady&&(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Complete number setup in Speko before enabling incoming calls.",y.issues.length?` ${y.issues.join(". ")}`:""]}),(0,e.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,e.jsx)(E,{checked:p,disabled:t||n,onCheckedChange:a(u=>x(u===!0),"onCheckedChange")}),"Enable incoming calls on this number"]}),(0,e.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,e.jsx)(E,{checked:v,disabled:t||n,onCheckedChange:a(u=>h(u===!0),"onCheckedChange")}),"Let callers start new low-trust tasks without sign-in"]}),v&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Each call gets its own task. The assigned agent can discuss that conversation under a low-trust policy, without access to existing private tasks or private tools."}),v&&(0,e.jsxs)("label",{className:"grid min-w-0 gap-2 text-sm font-medium",children:["Execution sandbox",(0,e.jsxs)("select",{"aria-label":"Execution sandbox",disabled:t||n,className:"min-w-0 w-full rounded-md border border-input bg-background p-2 text-sm",value:I,onChange:a(u=>A(u.target.value),"onChange"),children:[(0,e.jsx)("option",{value:"",children:"Use this agent's sandbox"}),s?.sandboxEnvironments?.map(u=>(0,e.jsx)("option",{value:u.id,children:u.name},u.id))]}),(0,e.jsx)("span",{className:"text-sm font-normal text-muted-foreground",children:"Only new incoming tasks use this setting. Low-trust work requires an active sandbox and isolated workspaces."})]}),o&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:"Choose an available company phone number."}),i&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:i}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:r?"Incoming call setting saved":""}),(0,e.jsx)(f,{type:"submit",disabled:t||n,children:n?"Saving…":"Save incoming call setting"})]})]})]})}a(B,"SpekoPhoneLineForm");function ae({companyId:s,endpointId:t}){const n=P(),r=["speko-phone-line",s,t],i=k({queryKey:r,queryFn:a(()=>C.configuration(s,t),"queryFn")}),c=S({mutationFn:a(l=>C.save(s,t,l),"mutationFn"),onSuccess:a(l=>n.setQueryData(r,l),"onSuccess")});return(0,e.jsx)(B,{configuration:i.data,loading:i.isLoading,saving:c.isPending,saved:c.isSuccess,error:(c.error??i.error)?.message,onRefresh:a(()=>{i.refetch()},"onRefresh"),onSave:a(l=>c.mutate(l),"onSave")})}a(ae,"SpekoPhoneLine");function Q({call:s,tasks:t=[],busy:n,error:r,onDecide:i}){const[c,l]=(0,d.useState)(""),[m,b]=(0,d.useState)(""),[p,x]=(0,d.useState)(!1),v=(0,d.useRef)(null),h=["guest_intake","awaiting_approval","approving"].includes(s.state);return(0,d.useEffect)(()=>{h||v.current?.focus()},[h]),s.state==="guest_intake"?(0,e.jsxs)("section",{className:"max-w-xl space-y-3 rounded-md border border-border p-3","aria-label":"Incoming conversation",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Incoming conversation"}),s.intakeIssueId&&(0,e.jsx)(w,{className:"text-sm text-primary underline",to:`/issues/${s.intakeIssueId}`,children:"Open conversation task"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"This caller is talking to the agent in a new low-trust task."}),r&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:r}),(0,e.jsx)(f,{variant:"outline",disabled:n,onClick:a(()=>i({approve:!1,approvalCode:s.approvalCode}),"onClick"),children:"End call"})]}):(0,e.jsxs)("section",{className:"max-w-xl space-y-3 rounded-md border border-border p-3","aria-label":"Incoming call approval",children:[(0,e.jsx)("h3",{ref:v,tabIndex:-1,className:"text-sm font-semibold",children:s.state==="approved"?"Call approved":s.state==="denied"?"Call denied":s.state==="expired"?"Call expired":s.state==="ended"?"Caller hung up":"Incoming call awaiting approval"}),s.intakeIssueId&&(0,e.jsx)(w,{className:"text-sm text-primary underline",to:`/issues/${encodeURIComponent(s.intakeIssueId)}`,children:"Review phone intake"}),h?(0,e.jsxs)("form",{className:"space-y-3",onSubmit:a(o=>{if(o.preventDefault(),c!==s.approvalCode){x(!0);return}x(!1),i({approve:!0,approvalCode:c,...m?{issueId:m}:{}})},"onSubmit"),children:[(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Approve only the call you are currently on. Enter the six-digit code spoken on the phone. Approval gives this call your access to the selected task."}),(0,e.jsxs)("label",{className:"grid gap-2 text-sm font-medium",children:["Code spoken on your call",(0,e.jsx)(T,{inputMode:"numeric",autoComplete:"off",maxLength:6,value:c,disabled:n,"aria-invalid":p,onChange:a(o=>{l(o.target.value),x(!1)},"onChange")})]}),(0,e.jsxs)("label",{className:"grid min-w-0 gap-2 text-sm font-medium",children:["Conversation task",(0,e.jsxs)("select",{"aria-label":"Conversation task",className:"w-full min-w-0 rounded-md border border-input bg-background p-2 text-sm",disabled:n,value:m,onChange:a(o=>b(o.target.value),"onChange"),children:[(0,e.jsx)("option",{value:"",children:"Continue your conversation, or create one"}),t.map(o=>(0,e.jsx)("option",{value:o.id,children:o.label},o.id))]})]}),p&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:"That code does not match this live call. Ask the phone agent to repeat it."}),r&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:r}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)(f,{type:"button",variant:"ghost",disabled:n,onClick:a(()=>i({approve:!1,approvalCode:s.approvalCode}),"onClick"),children:"Deny call"}),(0,e.jsx)(f,{type:"submit",disabled:n,children:n?"Confirming…":"Approve live call"})]})]}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:s.state==="approved"?"Approval was sent for this call. Earlier instructions were discarded. Follow the call in Activity.":"This call cannot access your private tasks."})]})}a(Q,"SpekoIncomingCallCard");function ne({companyId:s,endpointId:t,agentId:n}){const[r,i]=(0,d.useState)(),c=(0,d.useRef)(null),l=(0,d.useRef)(!1);(0,d.useEffect)(()=>{if(!r)return;const o=setTimeout(()=>i(void 0),5e3);return()=>clearTimeout(o)},[r]),(0,d.useEffect)(()=>{i(void 0),l.current=!1},[s,t]);const m=k({queryKey:["speko-incoming",s,t],queryFn:a(()=>C.incoming(s,t),"queryFn"),refetchInterval:2e3}),b=$(m),p=!!m.data?.some(o=>["awaiting_approval","approving"].includes(o.state)),x=k({queryKey:["speko-approval-tasks",s,n],queryFn:a(()=>K.list(s,{assigneeAgentId:n}),"queryFn"),enabled:p}),v=$(x);(0,d.useEffect)(()=>{l.current&&!x.isFetching&&v.kind!=="error"&&(l.current=!1,c.current?.querySelector('select[aria-label="Conversation task"]')?.focus())},[x.data,x.isFetching,v.kind==="error"]);const h=S({mutationFn:a(({id:o,...g})=>C.decide(s,t,o,g),"mutationFn"),onSuccess:a(o=>(i(o),m.refetch()),"onSuccess")});return(0,e.jsxs)("div",{ref:c,className:"space-y-3",children:[p&&v.kind==="error"&&(0,e.jsxs)("div",{role:"alert",className:"space-y-2 text-sm",children:[(0,e.jsx)("p",{children:"Task list could not be loaded. Retry to choose an existing task."}),(0,e.jsx)(f,{variant:"outline",disabled:x.isFetching,onClick:a(()=>{l.current=!0,x.refetch().then(o=>{o.status==="error"&&(l.current=!1)})},"onClick"),children:"Retry tasks"})]}),b.kind==="error"&&(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Incoming call approval is unavailable. ",D(m.error).body]}),b.kind!=="error"&&[...(m.data??[]).filter(o=>o.id!==r?.id),...r?[r]:[]].map(o=>(0,e.jsx)(Q,{call:o,tasks:x.data?.filter(g=>!["done","cancelled"].includes(g.status)).map(g=>({id:g.id,label:`${g.identifier??"Task"} · ${g.title}`})),busy:h.isPending&&h.variables?.id===o.id,error:h.variables?.id===o.id?h.error?.message:void 0,onDecide:a(g=>h.mutate({id:o.id,...g}),"onDecide")},o.id))]})}a(ne,"SpekoIncomingCalls");var V={list:a((s,t)=>j.get(`/companies/${encodeURIComponent(s)}/voice-history/${encodeURIComponent(t)}`,{cache:"no-store"}),"list")};function H(s){if(s===null)return"Not yet reported";const t=BigInt(s);return`$${t/1000000n}.${(t%1000000n).toString().padStart(6,"0")} USD`}a(H,"charge");function O({report:s}){return(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("dl",{className:"flex flex-wrap gap-4 text-sm",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("dt",{className:"text-muted-foreground",children:"Speko charge"}),(0,e.jsx)("dd",{children:H(s.costMicroUsd)})]}),s.durationSeconds!==null&&(0,e.jsxs)("div",{children:[(0,e.jsx)("dt",{className:"text-muted-foreground",children:"Duration"}),(0,e.jsxs)("dd",{children:[s.durationSeconds," seconds"]})]})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Agent costs are separate. Recordings remain in Speko."}),s.transcript.length?(0,e.jsx)("ol",{"aria-label":"Call transcript",className:z("space-y-3",U),children:s.transcript.map(t=>(0,e.jsxs)("li",{className:"min-w-0",children:[(0,e.jsxs)("p",{className:"text-xs font-medium text-muted-foreground",children:[t.speaker==="caller"?"You":"Agent",t.interrupted?" · interrupted":""]}),(0,e.jsx)("p",{className:"whitespace-pre-wrap break-words text-sm",children:t.text})]},t.id))}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:s.status==="unavailable"?"The transcript is unavailable. Microvac will retry while Speko finishes the report.":s.status==="pending"?"The transcript will appear after Speko finishes the call report.":"Speko did not provide a transcript for this call."})]})}a(O,"SpekoCallReport");var G={browser:"Browser voice",inbound_phone:"Incoming call",outbound_phone:"Outgoing call"},J={reserved:"Preparing",creating:"Connecting",creation_unknown:"Checking connection",connecting:"Connecting",active:"In progress",awaiting_approval:"Awaiting approval",ending:"Ending",ended:"Completed",failed:"Failed",expired:"Expired"};function W({entry:{session:s,report:t},onEnd:n,ending:r,presentation:i="history"}){const c=(0,d.useRef)(null),l=(0,d.useRef)(!1);return(0,d.useEffect)(()=>{l.current&&["ended","failed","expired"].includes(s.state)&&(c.current?.focus(),l.current=!1)},[s.state]),(0,e.jsxs)("details",{"data-activity-kind":"call",className:i==="activity"?"px-2 py-3 transition-colors hover:bg-accent/50":"rounded-md border border-border p-3",children:[(0,e.jsxs)("summary",{ref:c,className:"cursor-pointer break-words text-sm font-medium",children:[G[s.mode]," · ",J[s.state],(0,e.jsx)("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:new Date(s.createdAt).toLocaleString()})]}),(0,e.jsxs)("div",{className:"mt-3 space-y-3",children:[(0,e.jsx)(w,{className:"text-sm text-primary underline",to:`/issues/${encodeURIComponent(s.issueId)}`,children:"Conversation task"}),s.errorCode&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:s.errorCode==="cleanup_pending"?"Confirming call cleanup with Speko.":"This call encountered a connection problem. Check your Speko connection before trying again."}),!s.endedAt&&!["ended","failed","expired"].includes(s.state)&&s.callerAuthority!=="guest_intake"&&n&&(0,e.jsx)(f,{size:"sm",variant:"outline",disabled:r,onClick:a(()=>{l.current=!0,n(s.id)},"onClick"),children:r?"Ending…":"End call"}),(0,e.jsx)(O,{report:t})]})]})}a(W,"SpekoCallActivityItem");function X({call:s,presentation:t="history"}){return(0,e.jsxs)("div",{"data-activity-kind":"unapproved_call",className:t==="activity"?"px-2 py-3 text-sm":"rounded-md border border-border p-3 text-sm",children:[(0,e.jsxs)("p",{children:[s.state==="denied"?"Call denied":s.state==="expired"?"Approval expired":"Missed call"," · ",new Date(s.createdAt).toLocaleString()]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"No private task was connected."})]})}a(X,"SpekoUnapprovedCallActivityItem");function re({entries:s=[],unapprovedCalls:t=[],loading:n,error:r,incomingError:i,endError:c,onRetry:l,onEnd:m,endingSessionId:b}){return(0,e.jsxs)("section",{className:"max-w-xl space-y-3","aria-label":"Your calls",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:"Your calls"}),(0,e.jsx)(f,{size:"sm",variant:"ghost",onClick:l,disabled:n,children:"Refresh"})]}),n&&(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Loading calls…"}),r&&(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:r}),(0,e.jsx)(f,{size:"sm",variant:"outline",onClick:l,children:"Try again"})]}),i&&(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Unapproved calls could not be loaded. ",i]}),c&&(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["The call could not be ended. ",c]}),!n&&!r&&!i&&!s.length&&!t.length&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Your browser conversations and phone calls will appear here."}),!r&&s.map(p=>(0,e.jsx)(W,{entry:p,onEnd:m,ending:b===p.session.id},p.session.id)),!i&&t.length>0&&(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Unapproved incoming calls"}),(0,e.jsx)("ul",{className:"space-y-2",children:t.map(p=>(0,e.jsx)("li",{children:(0,e.jsx)(X,{call:p})},p.id))})]})]})}a(re,"SpekoCallHistoryView");function ie(s,t,n=!0){const r=k({queryKey:["speko-history",s,t],queryFn:a(()=>V.list(s,t),"queryFn"),enabled:n,refetchInterval:n?3e4:!1}),i=k({queryKey:["speko-unapproved-history",s,t],queryFn:a(()=>C.history(s,t),"queryFn"),enabled:n&&r.isSuccess,refetchInterval:n?3e4:!1}),c=S({mutationFn:a(l=>M.end(s,l),"mutationFn"),onSuccess:a(()=>r.refetch(),"onSuccess")});return{entries:r.data??[],unapprovedCalls:i.data??[],loading:r.isLoading||i.isLoading,error:r.error?.message,incomingError:i.error?.message,endError:c.error?.message,endingSessionId:c.isPending?c.variables:void 0,onEnd:a(l=>c.mutate(l),"onEnd"),onRetry:a(()=>{c.reset(),r.refetch(),i.refetch()},"onRetry")}}a(ie,"useSpekoCallHistory");var _=a((s,t)=>`/companies/${encodeURIComponent(s)}/voice-callbacks/${encodeURIComponent(t)}`,"path"),q={get:a((s,t)=>j.get(_(s,t),{cache:"no-store"}),"get"),save:a((s,t,n)=>j.put(_(s,t),n),"save")};function Z({preference:s,loading:t,saving:n,error:r,saved:i,onSave:c}){const[l,m]=(0,d.useState)(s?.phoneNumber??""),[b,p]=(0,d.useState)(s?.enabled??!1),[x,v]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{m(s?.phoneNumber??""),p(s?.enabled??!1)},[s]),(0,e.jsxs)("section",{className:"max-w-xl space-y-3",children:[(0,e.jsx)("h2",{className:"text-lg font-semibold",children:"Call my phone"}),(0,e.jsxs)("form",{className:"space-y-3",onSubmit:a(h=>{if(h.preventDefault(),!/^\+[1-9]\d{6,14}$/.test(l)){v(!0);return}v(!1),c({phoneNumber:l,enabled:b})},"onSubmit"),children:[(0,e.jsxs)("label",{className:"grid gap-2 text-sm font-medium",children:["Your callback number",(0,e.jsx)(T,{type:"tel",autoComplete:"tel",placeholder:"+12015551234",value:l,disabled:t||n,"aria-invalid":x,"aria-describedby":x?"speko-phone-error":void 0,onChange:a(h=>{m(h.target.value),v(!1)},"onChange")})]}),(0,e.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,e.jsx)(E,{checked:b,disabled:t||n,onCheckedChange:a(h=>p(h===!0),"onCheckedChange")}),"Allow this agent to call me about my tasks"]}),x&&(0,e.jsx)("p",{id:"speko-phone-error",role:"alert",className:"text-sm text-destructive",children:"Use an international number beginning with + and the country code."}),r&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:r}),(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:t?"Loading your callback setting…":i?"Callback setting saved":""}),(0,e.jsx)(f,{type:"submit",disabled:t||n,children:n?"Saving…":"Save phone setting"})]})]})]})}a(Z,"SpekoPhoneCallbackForm");function le({companyId:s,endpointId:t}){const n=k({queryKey:["speko-callback",s,t],queryFn:a(()=>q.get(s,t),"queryFn")}),r=S({mutationFn:a(i=>q.save(s,t,i),"mutationFn"),onSuccess:a(()=>n.refetch(),"onSuccess")});return(0,e.jsx)(Z,{preference:n.data,loading:n.isLoading,saving:r.isPending,saved:r.isSuccess,error:(n.error??r.error)?.message,onSave:a(i=>r.mutate(i),"onSave")})}a(le,"SpekoPhoneCallback");export{X as a,ne as c,re as i,ae as l,Z as n,ie as o,W as r,Q as s,le as t,B as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var y=Object.defineProperty;var n=(l,i)=>y(l,"name",{value:i,configurable:!0});import{a as v}from"./rolldown-runtime-DhZMWcEn.js";import{$A as j,NE as u,Wf as S,__ as k}from"./index-BJtnP7H1.js";var e=v(j(),1);function w({agentName:l,onSaveExit:i,credentials:s,onChange:c,onConnect:f,callbackUrl:m,pending:a=!1,repairing:o=!1,signingSecretConfigured:g}){const x=g??o,d=o&&x||!!(s.apiKey?.trim()&&s.agentId?.trim()),r=m?.startsWith("https://")===!0;function h(){if(!d||!r||a)return;const t=Object.fromEntries(Object.entries(s).filter(([,p])=>p.trim()));if(!x&&!t.signingSecret){const p=crypto.getRandomValues(new Uint8Array(32));t.signingSecret=`whsec_${btoa(String.fromCharCode(...p))}`,c(t)}f(t)}return n(h,"connect"),(0,e.jsxs)("div",{className:"space-y-5",children:[(0,e.jsxs)("div",{children:[(0,e.jsxs)("h1",{className:"text-xl font-bold",children:["Connect ",l," to Speko"]}),(0,e.jsxs)("p",{className:"mt-1 text-sm text-muted-foreground",children:["Choose a dedicated Speko voice persona. Microvac uses its voice while ",l," keeps its existing runtime, tools, and task context."]})]}),(0,e.jsxs)("ol",{className:"list-decimal space-y-2 pl-5 text-sm",children:[(0,e.jsx)("li",{children:"Create a dedicated agent in Speko and choose its voice. Keep only Speko’s default tools; Microvac adds the task connection."}),(0,e.jsx)("li",{children:"Copy its agent ID and a Speko API key below."}),(0,e.jsx)("li",{children:"Review recording and retention settings in your Speko workspace before testing."})]}),(0,e.jsx)(u,{asChild:!0,variant:"outline",children:(0,e.jsx)("a",{href:"https://platform.speko.ai/agents",target:"_blank",rel:"noreferrer",children:"Open Speko agents"})}),(0,e.jsxs)("label",{className:"grid gap-2 text-sm font-medium",children:["Speko agent ID",(0,e.jsx)(k,{autoComplete:"off",value:s.agentId??"",placeholder:o?"Leave blank to keep the current persona":"agent_…",onChange:n(t=>c({...s,agentId:t.target.value}),"onChange")})]}),(0,e.jsxs)("label",{className:"grid gap-2 text-sm font-medium",children:["Speko API key",(0,e.jsx)(k,{type:"password",autoComplete:"new-password",value:s.apiKey??"",placeholder:o?"Leave blank to keep the saved key":"Paste your Speko API key",onChange:n(t=>c({...s,apiKey:t.target.value}),"onChange")})]}),!r&&(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:"Configure a public HTTPS callback origin for Microvac first. Local instances need an explicitly configured tunnel or reverse proxy."}),r&&(0,e.jsxs)("p",{className:"break-all text-xs text-muted-foreground",children:["Callback: ",m]}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Credentials and a generated callback signing secret are saved in the company vault. Speko charges for voice usage separately from agent work. Outgoing calls are experimental. After connecting, save your callback number to let this agent call you about your tasks."}),i?(0,e.jsx)(S,{onSaveExit:i,disabled:a,children:(0,e.jsx)(u,{disabled:!d||!r||a,onClick:h,children:a?"Verifying Speko…":o?"Reconnect Speko":"Connect Speko"})}):(0,e.jsx)("div",{className:"flex justify-end",children:(0,e.jsx)(u,{disabled:!d||!r||a,onClick:h,children:a?"Verifying Speko…":o?"Reconnect Speko":"Connect Speko"})})]})}n(w,"SpekoProviderSetup");export{w as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var dt=Object.defineProperty;var s=(t,i)=>dt(t,"name",{value:i,configurable:!0});import{a as He}from"./rolldown-runtime-DhZMWcEn.js";import{t as Oe}from"./search-CG-QtPVH.js";import{y as Se}from"./collections-B58p51lw.js";import{$A as ut,$S as ct,$T as re,Ai as ce,Ap as xe,BA as n,BC as mt,B_ as Ke,EA as te,Ev as ht,FA as w,GS as N,HC as Qe,H_ as pe,IA as k,Kw as Be,LA as xt,LS as pt,ME as Me,Mi as me,Mp as gt,NE as q,Np as we,OA as ge,Op as ke,Pp as Ie,RA as ft,Sp as De,TA as Le,Up as yt,V_ as Ve,Vm as bt,WE as he,Yb as vt,_ as jt,__ as X,_v as Z,_w as _,aE as Nt,ab as We,bE as L,d as Ct,dy as St,fy as wt,g as kt,g_ as Ge,hC as Te,hE as F,hv as It,iD as V,ib as Tt,jT as Ye,jb as At,ji as Pt,kA as P,ki as Et,kp as Ae,ly as Mt,m_ as Rt,my as _t,nT as qt,nj as $t,oC as Je,on as Bt,p as Dt,pm as fe,pv as Lt,qC as Ft,rb as Ut,sy as zt,tT as Pe,uE as R,ub as Ee,uy as Ht,vb as Ot,x as ee,xE as U,xS as Kt,xT as Qt,xb as Vt,xv as Wt,yb as Gt,zE as E,z_ as Ze}from"./index-BJtnP7H1.js";import{t as Xe}from"./useSummaryDraftStream-NVNYNt72.js";function Yt(t){try{return new Intl.DateTimeFormat("en",{timeZone:t}).format(),!0}catch{return!1}}s(Yt,"isValidTimeZone");var Jt=te(["compiling","active","error","paused_budget","paused_hours"]),Zt=te(["compile","full","incremental"]),Xt=te(["manual","interval","reactive","restore"]),es=te(["running","ok","failed"]),ts=k({statusTransitions:P().default(!0),membershipChanges:P().default(!0),humanComments:P().default(!0),assigneeChanges:P().default(!0),anyUpdate:P().default(!1)}),ye=k({mode:te(["manual","interval","reactive"]).default("manual"),intervalMinutes:w().int().positive().optional(),debounceSeconds:w().int().positive().optional(),maxUpdatesPerHour:w().int().positive().optional(),triggers:ts.prefault({}),activeHours:k({start:n().regex(/^([01]\d|2[0-3]):[0-5]\d$/),end:n().regex(/^([01]\d|2[0-3]):[0-5]\d$/),timezone:n().trim().min(1).refine(Yt,{message:"Invalid timezone identifier"})}).optional(),dailyTokenCap:w().int().positive().optional()}).superRefine((t,i)=>{t.mode==="interval"&&t.intervalMinutes===void 0&&i.addIssue({code:Le.custom,path:["intervalMinutes"],message:"Required for interval mode"}),t.mode==="reactive"&&t.debounceSeconds===void 0&&i.addIssue({code:Le.custom,path:["debounceSeconds"],message:"Required for reactive mode"})}),et=ye.parse({mode:"manual"}),ss=ft(n(),k({status:n(),updatedAt:n().datetime(),latestHumanCommentAt:n().datetime().nullable().optional(),identifier:n().nullable().optional(),title:n().optional(),assigneeAgentId:n().guid().nullable().optional(),assigneeUserId:n().nullable().optional()})),Rs=k({id:n().guid(),companyId:n().guid(),createdByUserId:n().nullable(),createdByAgentId:n().guid().nullable(),title:n().nullable(),titlePinned:P(),interestPrompt:n(),queries:ge(Oe),queryVersion:w().int().nonnegative(),queryCompiledAt:n().datetime().nullable(),queryCompiledByAgentId:n().guid().nullable(),agentId:n().guid().nullable(),refreshPolicy:ye,state:Jt,pendingChangeCount:w().int().nonnegative(),lastChangeAt:n().datetime().nullable(),fingerprint:ss.nullable(),fingerprintAt:n().datetime().nullable(),mentionedIssueIds:ge(n().guid()).default([]),documentId:n().guid().nullable(),lastUpdateRunKind:te(["full","incremental"]).nullable(),lastGeneratedAt:n().datetime().nullable(),lastModel:n().nullable(),generatingIssueId:n().guid().nullable(),failureReason:n().nullable(),nextEvalAt:n().datetime().nullable(),archivedAt:n().datetime().nullable(),archivedByUserId:n().nullable(),archivedByAgentId:n().guid().nullable(),createdAt:n().datetime(),updatedAt:n().datetime(),summaryBody:n().nullable().optional(),watchedIssueCount:w().int().nonnegative().optional(),todayTokens:w().int().nonnegative().optional(),todayCostCents:w().nonnegative().optional(),href:n().optional()}),as=k({issueId:n().guid(),identifier:n(),from:n().nullable(),to:n().nullable(),changeKind:n()}),_s=k({id:n().guid(),cardId:n().guid(),kind:Zt,trigger:Xt,generationIssueId:n().guid().nullable(),runId:n().guid().nullable(),changes:ge(as),inputTokens:w().int().nonnegative(),outputTokens:w().int().nonnegative(),costCents:w().nonnegative(),model:n().nullable(),queryVersion:w().int().nonnegative().nullable(),changeSummary:n().nullable(),startedAt:n().datetime(),finishedAt:n().datetime().nullable(),status:es,error:n().nullable()}),qs=k({id:n().guid(),revisionNumber:w().int().positive(),title:n().nullable(),body:n(),changeSummary:n().nullable(),createdAt:n().datetime()}),$s=k({archived:xt(t=>t==="true"?!0:t==="false"?!1:t,P().default(!1))}),Bs=k({interestPrompt:n().trim().min(1).max(2e4),title:n().trim().min(1).max(300).optional(),titlePinned:P().default(!1),agentId:n().guid().nullable().optional(),refreshPolicy:ye.default(et)}),Ds=k({interestPrompt:n().trim().min(1).max(2e4).optional(),title:n().trim().min(1).max(300).nullable().optional(),titlePinned:P().optional(),agentId:n().guid().nullable().optional(),refreshPolicy:ye.optional(),archived:P().optional()}).refine(t=>Object.keys(t).length>0,"At least one field is required"),Ls=k({full:P().default(!1)}),Fs=k({queries:ge(Oe).min(1).max(10),title:n().trim().min(1).max(300),changeSummary:n().trim().min(1).max(2e3),generationIssueId:n().guid()}),Us=k({markdown:n().trim().min(1).max(2e5),title:n().trim().min(1).max(300).optional(),changeSummary:n().trim().min(1).max(2e3),generationIssueId:n().guid(),model:n().trim().min(1).max(200).optional().nullable()}),g=He($t(),1),C={list:s((t,i=!1)=>R.get(`/companies/${t}/status-cards?archived=${i?"true":"false"}`),"list"),get:s(t=>R.get(`/status-cards/${t}`),"get"),create:s((t,i)=>R.post(`/companies/${t}/status-cards`,i),"create"),patch:s((t,i)=>R.patch(`/status-cards/${t}`,i),"patch"),remove:s(t=>R.delete(`/status-cards/${t}`),"remove"),updates:s(t=>R.get(`/status-cards/${t}/updates`),"updates"),summaryRevisions:s(t=>R.get(`/status-cards/${t}/summary-revisions`),"summaryRevisions"),refresh:s(t=>R.post(`/status-cards/${t}/refresh`,{}),"refresh"),recompile:s(t=>R.post(`/status-cards/${t}/recompile`,{}),"recompile"),dryRun:s(t=>R.get(`/status-cards/${t}/dry-run`),"dryRun")};function z(t){return t==null?null:t<1e3?`${t} tok`:`${(t/1e3).toFixed(1)}k tok`}s(z,"formatTokens");function W(t){if(t==null)return null;const i=t/100;return i===0?"$0.00":i<.1?`$${i.toFixed(3)}`:`$${i.toFixed(2)}`}s(W,"formatCents");function tt(t){return t.reduce((i,r)=>({updateCount:i.updateCount+(r.kind==="compile"?0:1),totalTokens:i.totalTokens+r.inputTokens+r.outputTokens,totalCostCents:i.totalCostCents+r.costCents}),{updateCount:0,totalTokens:0,totalCostCents:0})}s(tt,"accumulate");function ns(t){return tt(t)}s(ns,"rollupUpdates");function rs(t,i=new Date){const r=new Date(i);r.setUTCHours(0,0,0,0);const m=r.getTime();return tt(t.filter(d=>new Date(d.startedAt).getTime()>=m))}s(rs,"rollupUpdatesToday");var is=4500,ls=3,Fe=2e3,os=1;function ds(t){const i=t.activeHours;if(!i)return 1440;const[r,m]=i.start.split(":").map(Number),[d,c]=i.end.split(":").map(Number),x=r*60+m,f=d*60+c,l=f>x?f-x:1440-(x-f);return l>0?l:1440}s(ds,"activeWindowMinutes");function us(t){if(t.mode==="manual"){const h=`${W(ls)} · ${z(is)}`;return{cost:h,primary:`~1 rebuild per refresh ≈ ${h}`,note:"Manual cards only cost tokens when you press Refresh."}}const i=ds(t);let r,m;if(t.mode==="interval"){const h=t.intervalMinutes??15;r=Math.floor(i/h),m=`every ${h} min`}else{const h=t.maxUpdatesPerHour??6;r=Math.round(i/60*h),m=`up to ${h}/hour`}const d=t.dailyTokenCap??null,c=d!==null?Math.floor(d/Fe):1/0,x=Math.max(0,Math.min(r,c)),f=d!==null&&c<r,l=x*Fe,y=x*os,a=t.activeHours?" during active hours":"",p=`${W(y)} · ${z(l)}`;return{cost:p,primary:`Up to ~${x} updates/day (${m}${a}) ≈ ${p}`,note:f?`Capped by your ${z(d)} daily token cap — the card pauses when it's hit.`:"Only runs when something changed; a cheap no-op check otherwise."}}s(us,"estimateStatusCardCost");function cs(t,i){const r=s(m=>m<1e3?`${m}`:`${(m/1e3).toFixed(1)}k`,"fmt");return`${r(t)} in / ${r(i)} out`}s(cs,"formatTokenSplit");function Ne(t){switch(t){case"compile":return"compile";case"full":return"full rebuild";case"incremental":return"incremental";default:return t}}s(Ne,"updateKindLabel");function st(t){return t.archivedAt?"archived":t.state==="compiling"?"compiling":t.state==="error"?"error":t.state==="paused_budget"?"paused_budget":t.state==="paused_hours"?"paused_hours":t.generatingIssueId?"updating":t.pendingChangeCount>0?"stale":"fresh"}s(st,"deriveStatusCardLifecycle");var at={compiling:{label:"Setting up",dotClassName:"bg-cyan-400 animate-pulse",description:"Just created; setting up and generating the first summary.",dashedBorder:!0,keepsLastSummary:!1},fresh:{label:"Fresh",dotClassName:"bg-emerald-400",description:"Summary reflects all known changes; nothing pending.",dashedBorder:!1,keepsLastSummary:!0},stale:{label:"Stale",dotClassName:"bg-amber-400",description:"Changes are pending since the last update.",dashedBorder:!1,keepsLastSummary:!0},updating:{label:"Updating",dotClassName:"bg-blue-500 animate-pulse",description:"An update is streaming in now.",dashedBorder:!1,keepsLastSummary:!0},error:{label:"Error",dotClassName:"bg-red-500",description:"The last run failed; the last good summary stays visible.",dashedBorder:!1,keepsLastSummary:!0},paused_budget:{label:"Paused — budget",dotClassName:"bg-orange-400",description:"The daily token cap was hit; auto-updates are suspended.",dashedBorder:!1,keepsLastSummary:!0},paused_hours:{label:"Paused — hours",dotClassName:"bg-orange-400",description:"Outside active hours; changes batch into one update at window open.",dashedBorder:!1,keepsLastSummary:!0},archived:{label:"Archived",dotClassName:"bg-muted-foreground/50",description:"No auto-updates and no watches. Restore to start watching again.",dashedBorder:!1,keepsLastSummary:!0}};function nt(t){switch(t.mode){case"manual":return"manual";case"interval":return t.intervalMinutes?`every ${t.intervalMinutes}m if changed`:"on a schedule if changed";case"reactive":return`on change (${t.debounceSeconds??60}s)`;default:return"manual"}}s(nt,"describeRefreshPolicy");var e=He(ut(),1);function ms({className:t}){return(0,e.jsx)("span",{className:E("mt-1 inline-block h-2.5 w-2.5 shrink-0 rounded-full",t),"aria-hidden":"true"})}s(ms,"StateDot");function ne(t){return i=>{i.stopPropagation(),t()}}s(ne,"stopClick");function hs({card:t,companyId:i,onOpen:r,onRefresh:m,onRecompile:d,onEditInterest:c,onOpenDebug:x,onArchive:f,refreshPending:l,recompilePending:y}){const a=st(t),p=at[a],h=a==="compiling"&&!!t.generatingIssueId,b=(0,g.useMemo)(()=>a==="updating"&&t.generatingIssueId?{id:t.generatingIssueId,identifier:null,title:t.title??"Status update",status:"in_progress"}:null,[a,t.generatingIssueId,t.title]),S=Xe(i,b),G=nt(t.refreshPolicy),T=z(t.todayTokens),j=W(t.todayCostCents),H=t.lastGeneratedAt?V(t.lastGeneratedAt):"no summary yet",$=!!(t.summaryBody&&t.summaryBody.trim().length>0);return(0,e.jsxs)("div",{role:"button",tabIndex:0,onClick:r,onKeyDown:s(v=>{v.target===v.currentTarget&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),r())},"onKeyDown"),className:E("group flex h-72 cursor-pointer flex-col rounded-lg border border-border bg-card text-card-foreground transition-colors hover:border-muted-foreground/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",p.dashedBorder&&"border-dashed"),"data-testid":"status-card-tile","data-lifecycle":a,children:[(0,e.jsxs)("div",{className:"flex items-start gap-2 px-4 pt-4",children:[a==="compiling"?null:(0,e.jsx)(ms,{className:p.dotClassName}),(0,e.jsx)("span",{className:E("line-clamp-1 min-w-0 flex-1 text-sm font-semibold",a==="compiling"&&"text-muted-foreground"),title:t.title??t.interestPrompt,children:t.title??"New card"}),(0,e.jsx)("div",{onClick:s(v=>v.stopPropagation(),"onClick"),children:(0,e.jsxs)(Lt,{children:[(0,e.jsx)(ht,{asChild:!0,children:(0,e.jsx)(q,{variant:"ghost",size:"icon",className:"-mr-1 -mt-1 h-7 w-7 text-muted-foreground","aria-label":"Card actions",children:(0,e.jsx)(qt,{className:"h-4 w-4"})})}),(0,e.jsxs)(It,{align:"end",children:[(0,e.jsx)(Z,{onSelect:r,children:"Open detail"}),(0,e.jsx)(Z,{onSelect:m,disabled:l||a==="updating",children:"Refresh now"}),a==="compiling"&&!h||a==="error"?(0,e.jsx)(Z,{onSelect:d,disabled:y,children:"Run now"}):null,(0,e.jsx)(Z,{onSelect:c,children:"Edit interest & settings"}),(0,e.jsx)(Z,{onSelect:x,children:"Query debug"}),(0,e.jsx)(Wt,{}),(0,e.jsx)(Z,{onSelect:f,variant:"destructive",children:"Archive"})]})]})})]}),(0,e.jsxs)("div",{className:"px-4 pt-2",children:[a==="compiling"?(0,e.jsxs)("div",{className:"rounded-md bg-muted px-3 py-2 text-xs text-foreground",role:"status","aria-live":"polite",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[h?(0,e.jsx)(_,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"}):(0,e.jsx)(Te,{className:"h-3.5 w-3.5 shrink-0 text-amber-500"}),(0,e.jsx)("span",{children:h?"Setting up your card…":"Setup didn’t finish"})]}),(0,e.jsxs)("p",{className:"mt-1 line-clamp-2 text-muted-foreground",children:["“",t.interestPrompt,"”"]}),h?(0,e.jsxs)(re,{to:`/issues/${t.generatingIssueId}`,onClick:s(v=>v.stopPropagation(),"onClick"),className:"mt-2 inline-flex items-center gap-1.5 font-medium text-foreground underline-offset-2 hover:underline",children:[(0,e.jsx)(Pe,{className:"h-3.5 w-3.5"}),"View setup task"]}):(0,e.jsxs)("button",{type:"button",onClick:ne(d),disabled:y,className:"mt-2 inline-flex items-center gap-1.5 font-medium text-foreground underline-offset-2 hover:underline disabled:opacity-60",children:[(0,e.jsx)(Je,{className:E("h-3.5 w-3.5",y&&"animate-pulse")}),y?"Starting…":"Run now"]})]}):null,a==="updating"?(0,e.jsx)("div",{className:"rounded-md bg-muted px-3 py-2 text-xs text-foreground",role:"status","aria-live":"polite",children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(_,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-muted-foreground"}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",title:S.statusLine??void 0,children:S.statusLine??(t.pendingChangeCount>0?`Integrating ${t.pendingChangeCount} ${t.pendingChangeCount===1?"change":"changes"}…`:"Updating now…")}),t.generatingIssueId?(0,e.jsxs)(re,{to:Kt(t.generatingIssueId),onClick:s(v=>v.stopPropagation(),"onClick"),className:"inline-flex shrink-0 items-center gap-1 font-medium underline-offset-2 hover:underline",children:[(0,e.jsx)(Pe,{className:"h-3.5 w-3.5"}),"View update task"]}):null]})}):null,a==="stale"?(0,e.jsxs)("button",{type:"button",onClick:ne(m),disabled:l,className:"flex w-full items-center justify-between gap-2 rounded-md border border-amber-500/40 bg-amber-500/5 px-3 py-1.5 text-left text-xs text-foreground transition-colors hover:bg-amber-500/10 disabled:opacity-60",children:[(0,e.jsxs)("span",{children:[t.pendingChangeCount," ",t.pendingChangeCount===1?"change":"changes"," since last update"]}),(0,e.jsx)("span",{className:"shrink-0 font-medium text-amber-700 dark:text-amber-400",children:"Refresh"})]}):null,a==="error"?(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/5 px-3 py-1.5 text-xs",children:[(0,e.jsxs)("span",{className:"flex items-center gap-1.5 text-destructive",children:[(0,e.jsx)(Te,{className:"h-3.5 w-3.5 shrink-0"}),"Last update failed"]}),(0,e.jsxs)("span",{className:"flex shrink-0 items-center gap-3",children:[(0,e.jsx)("button",{type:"button",onClick:ne(m),disabled:l,className:"font-medium text-destructive hover:underline disabled:opacity-60",children:"Retry"}),(0,e.jsx)("button",{type:"button",onClick:ne(r),className:"text-muted-foreground hover:underline",children:"Details"})]})]}):null,a==="paused_budget"||a==="paused_hours"?(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-orange-500/40 bg-orange-500/5 px-3 py-1.5 text-xs text-foreground",children:[(0,e.jsx)(Qt,{className:"h-3.5 w-3.5 shrink-0 text-orange-500"}),(0,e.jsx)("span",{children:a==="paused_budget"?"Daily token cap reached — auto-updates paused":"Outside active hours — auto-updates paused"})]}):null]}),(0,e.jsxs)("div",{className:"min-h-0 flex-1 overflow-hidden px-4 pt-2",children:[a==="error"&&t.summaryBody?(0,e.jsx)("p",{className:"mb-1 text-(length:--text-micro) text-muted-foreground",children:"Showing last good summary:"}):null,$?(0,e.jsx)(ee,{className:"text-xs leading-6 text-foreground [&_p]:my-0.5",children:t.summaryBody}):a==="compiling"?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"You can add instructions and pick an update policy while this runs."}):a==="updating"&&S.draft?(0,e.jsx)(ee,{className:"text-xs leading-6 text-foreground [&_p]:my-0.5",children:S.draft}):(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"No summary yet."})]}),(0,e.jsxs)("div",{className:"mt-auto flex items-center justify-between gap-2 border-t border-border px-4 py-2.5",children:[(0,e.jsx)("span",{className:"truncate text-(length:--text-micro) text-muted-foreground",children:a==="compiling"?"setting up · first summary pending":(0,e.jsxs)(e.Fragment,{children:[H," · ",G,T?` · ${T}`:"",j?` · ${j}`:""]})}),a==="fresh"||a==="paused_budget"||a==="paused_hours"?(0,e.jsx)(q,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 text-muted-foreground",onClick:ne(m),disabled:l,"aria-label":"Refresh card",children:(0,e.jsx)(Qe,{className:E("h-3.5 w-3.5",l&&"animate-spin")})}):null]})]})}s(hs,"StatusCardTile");function Ue(t){return t?new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric"}):"—"}s(Ue,"shortDate");function xs({card:t,onView:i,onRestore:r,restorePending:m}){const d=U({queryKey:N.statusCards.updates(t.id),queryFn:s(()=>C.updates(t.id),"queryFn")}),c=d.data?ns(d.data):null;return(0,e.jsxs)("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border bg-muted/30 px-4 py-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("p",{className:"truncate text-sm font-semibold",children:t.title??"Untitled card"}),(0,e.jsxs)("p",{className:"mt-0.5 text-xs text-muted-foreground",title:t.archivedAt?he(t.archivedAt):void 0,children:["archived ",Ue(t.archivedAt)," · last summary ",Ue(t.lastGeneratedAt),c?` · lifetime ${z(c.totalTokens)} / ${W(c.totalCostCents)}`:""]})]}),(0,e.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,e.jsx)(q,{size:"sm",onClick:i,children:"View"}),(0,e.jsxs)(q,{variant:"outline",size:"sm",onClick:r,disabled:m,children:[m?(0,e.jsx)(_,{className:"animate-spin"}):null,"Restore"]})]})]})}s(xs,"ArchivedStatusCardRow");function rt({companyId:t,value:i,onChange:r,enabled:m=!0}){const d=U({queryKey:t?N.agents.list(t):["agents","none"],queryFn:s(()=>Ut.list(t),"queryFn"),enabled:!!t&&m}),c=(0,g.useMemo)(()=>new Map((d.data??[]).map(l=>[l.id,l])),[d.data]),x=(0,g.useMemo)(()=>(d.data??[]).filter(Rt).map(l=>({id:`agent:${l.id}`,label:l.name,searchText:`${l.name} ${l.role} ${l.title??""}`})),[d.data]),f=s(l=>{if(!l||!l.id)return(0,e.jsx)("span",{children:"Summarizer (default)"});const y=l.id.startsWith("agent:")?c.get(l.id.slice(6)):null;return(0,e.jsxs)(e.Fragment,{children:[y?(0,e.jsx)(At,{agent:y,size:16,className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):null,(0,e.jsx)("span",{className:"truncate",children:l.label})]})},"renderAgent");return(0,e.jsx)(bt,{value:i?`agent:${i}`:"",options:x,placeholder:"Summarizer (default)",noneLabel:"Summarizer (default)",searchPlaceholder:"Search agents...",emptyMessage:"No agents found.",onChange:s(l=>r(l.startsWith("agent:")?l.slice(6):""),"onChange"),className:"h-8 text-sm",renderTriggerValue:f,renderOption:s(l=>f(l),"renderOption")})}s(rt,"SummarizerAgentSelect");var ps=["issues about evals","everything blocked this week","is feature X live? if not, the exact next actions to ship it"];function gs({companyId:t,open:i,onOpenChange:r}){const m=Me(),[d,c]=(0,g.useState)(""),[x,f]=(0,g.useState)(""),[l,y]=(0,g.useState)(null);function a(){c(""),f(""),y(null)}s(a,"reset");function p(){r(!1),window.setTimeout(a,200)}s(p,"close");const h=L({mutationFn:s(()=>C.create(t,{interestPrompt:d.trim(),titlePinned:!1,agentId:x||null,refreshPolicy:et}),"mutationFn"),onMutate:s(()=>y(null),"onMutate"),onSuccess:s(async()=>{await Promise.all([m.invalidateQueries({queryKey:N.statusCards.list(t,!1)}),m.invalidateQueries({queryKey:N.statusCards.list(t,!0)})]),p()},"onSuccess"),onError:s(b=>y(F(b,{action:"create the card"}).body),"onError")});return(0,e.jsx)(zt,{open:i,onOpenChange:s(b=>b?r(!0):p(),"onOpenChange"),children:(0,e.jsxs)(Mt,{className:"sm:max-w-2xl",children:[(0,e.jsxs)(wt,{children:[(0,e.jsx)(_t,{children:"New card"}),(0,e.jsx)(Ht,{children:"One message sets up the whole card: say what you want to watch and what each update should tell you. The agent builds the query from it and writes every update against it."})]}),l?(0,e.jsx)(fe,{tone:"danger",title:"Create failed",children:l}):null,(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("label",{htmlFor:"status-card-prompt",className:"block pb-1 text-sm font-semibold",children:"What do you want to keep an eye on?"}),(0,e.jsx)(Ge,{id:"status-card-prompt",value:d,onChange:s(b=>c(b.target.value),"onChange"),rows:5,autoFocus:!0,placeholder:"Keep an eye on the ID and Cloud projects. Tell me whether the service is live, and if not, the exact three actions needed to get it to production.",className:"text-sm"}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Examples"}),ps.map(b=>(0,e.jsx)("button",{type:"button",onClick:s(()=>c(b),"onClick"),className:"rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:bg-accent/40",children:b},b))]})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("label",{className:"block text-sm font-semibold",children:"Agent"}),(0,e.jsx)(rt,{companyId:t,value:x,onChange:f,enabled:i}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Runs this card's setup and updates. Leave on the default unless another agent should own it."})]}),(0,e.jsx)(St,{children:(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(q,{variant:"outline",onClick:p,disabled:h.isPending,children:"Cancel"}),(0,e.jsxs)(q,{onClick:s(()=>h.mutate(),"onClick"),disabled:d.trim().length===0||h.isPending,children:[h.isPending?(0,e.jsx)(_,{className:"animate-spin"}):null,"Create card"]})]})})]})})}s(gs,"CreateStatusCardDialog");function fs(){return{refreshPolicy:{mode:"manual",triggers:{statusTransitions:!0,membershipChanges:!0,humanComments:!0,assigneeChanges:!0,anyUpdate:!1}}}}s(fs,"defaultSettingsValue");var ys=[5,15,30,60],bs=[30,60,120,300],vs=[{key:"statusTransitions",label:"Became blocked / needs review / done / cancelled"},{key:"membershipChanges",label:"New issue matches the query · issue leaves the query"},{key:"humanComments",label:"Human comments"},{key:"assigneeChanges",label:"Assignee changes"},{key:"anyUpdate",label:"Any update at all (noisy — includes in-progress churn)",noisy:!0}];function Ce({selected:t,title:i,badge:r,onSelect:m,children:d}){return(0,e.jsxs)("div",{className:E("rounded-md border px-3 py-2.5 transition-colors",t?"border-primary bg-primary/5 ring-1 ring-primary":"border-border hover:bg-accent/40"),children:[(0,e.jsxs)("button",{type:"button",role:"radio","aria-checked":t,onClick:m,className:"flex w-full items-center gap-2 text-left",children:[(0,e.jsx)("span",{className:E("flex h-4 w-4 shrink-0 items-center justify-center rounded-full border",t?"border-primary":"border-muted-foreground/50"),children:t?(0,e.jsx)("span",{className:"h-2 w-2 rounded-full bg-primary"}):null}),(0,e.jsx)("span",{className:"text-sm font-medium",children:i}),r]}),t&&d?(0,e.jsx)("div",{className:"mt-2 pl-6",children:d}):null]})}s(Ce,"RadioRow");function js({value:t,onChange:i}){const{refreshPolicy:r}=t,m=r.mode!=="manual",d=us(r),c=s(a=>i({...t,refreshPolicy:{...r,...a}}),"setPolicy"),x=s(a=>{const p={mode:a};a==="interval"&&(p.intervalMinutes=r.intervalMinutes??15),a==="reactive"&&(p.debounceSeconds=r.debounceSeconds??60,p.maxUpdatesPerHour=r.maxUpdatesPerHour??6),c(p)},"setMode"),f=s(a=>c({triggers:{...r.triggers,[a]:!r.triggers[a]}}),"toggleTrigger"),l=r.activeHours,y=s(a=>c({activeHours:a?{start:l?.start??"08:00",end:l?.end??"19:00",timezone:l?.timezone??"UTC"}:void 0}),"setActiveHoursEnabled");return(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Auto-update policy"}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(Ce,{selected:r.mode==="manual",title:"Manual only — updates when I press refresh",badge:(0,e.jsx)("span",{className:"ml-auto rounded-full bg-muted px-2 py-0.5 text-(length:--text-nano) font-medium uppercase tracking-wide text-muted-foreground",children:"Default"}),onSelect:s(()=>x("manual"),"onSelect")}),(0,e.jsx)(Ce,{selected:r.mode==="interval",title:"On a schedule, only if something changed",onSelect:s(()=>x("interval"),"onSelect"),children:(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,e.jsx)("span",{children:"Check every"}),(0,e.jsxs)(ke,{value:String(r.intervalMinutes??15),onValueChange:s(a=>c({intervalMinutes:Number(a)}),"onValueChange"),children:[(0,e.jsx)(we,{size:"sm",className:"w-28","aria-label":"Check interval",children:(0,e.jsx)(Ie,{})}),(0,e.jsx)(Ae,{children:ys.map(a=>(0,e.jsxs)(xe,{value:String(a),children:[a," min"]},a))})]})]})}),(0,e.jsx)(Ce,{selected:r.mode==="reactive",title:"As soon as something changes (debounced)",onSelect:s(()=>x("reactive"),"onSelect"),children:(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[(0,e.jsx)("span",{children:"Wait"}),(0,e.jsxs)(ke,{value:String(r.debounceSeconds??60),onValueChange:s(a=>c({debounceSeconds:Number(a)}),"onValueChange"),children:[(0,e.jsx)(we,{size:"sm",className:"w-24","aria-label":"Debounce",children:(0,e.jsx)(Ie,{})}),(0,e.jsx)(Ae,{children:bs.map(a=>(0,e.jsxs)(xe,{value:String(a),children:[a,"s"]},a))})]}),(0,e.jsx)("span",{className:"text-xs",children:"after the last change · max"}),(0,e.jsx)(X,{type:"number",min:1,max:60,value:r.maxUpdatesPerHour??6,onChange:s(a=>c({maxUpdatesPerHour:Math.max(1,Number(a.target.value)||1)}),"onChange"),className:"h-8 w-16 text-sm","aria-label":"Max updates per hour"}),(0,e.jsx)("span",{className:"text-xs",children:"updates/hour"})]})})]})]}),m?(0,e.jsxs)(Ze,{className:"rounded-md border border-border",children:[(0,e.jsxs)(Ve,{className:"group flex w-full items-center justify-between gap-2 px-3 py-2.5 text-sm font-semibold",children:["Advanced",(0,e.jsx)(Ye,{className:"h-4 w-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),(0,e.jsxs)(Ke,{className:"space-y-6 border-t border-border px-3 py-3",children:[(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Count as a change"}),(0,e.jsx)("div",{className:"space-y-2",children:vs.map(a=>(0,e.jsxs)("label",{className:"flex items-start gap-2.5 text-sm",children:[(0,e.jsx)(De,{checked:r.triggers[a.key],onCheckedChange:s(()=>f(a.key),"onCheckedChange"),className:"mt-0.5","aria-label":a.label}),(0,e.jsx)("span",{className:E(a.noisy&&"text-muted-foreground"),children:a.label})]},a.key))})]}),(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Guardrails"}),(0,e.jsxs)("label",{className:"flex items-start gap-2.5 text-sm",children:[(0,e.jsx)(De,{checked:!!l,onCheckedChange:s(a=>y(!!a),"onCheckedChange"),className:"mt-0.5","aria-label":"Limit to active hours"}),(0,e.jsx)("span",{children:"Only auto-update during active hours"})]}),l?(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 pl-6 text-sm",children:[(0,e.jsx)(X,{type:"time",value:l.start,onChange:s(a=>c({activeHours:{...l,start:a.target.value}}),"onChange"),className:"h-8 w-32","aria-label":"Active hours start"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:"–"}),(0,e.jsx)(X,{type:"time",value:l.end,onChange:s(a=>c({activeHours:{...l,end:a.target.value}}),"onChange"),className:"h-8 w-32","aria-label":"Active hours end"}),(0,e.jsx)(X,{value:l.timezone,onChange:s(a=>c({activeHours:{...l,timezone:a.target.value}}),"onChange"),className:"h-8 w-40",placeholder:"Timezone","aria-label":"Active hours timezone"})]}):null,(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,e.jsx)("span",{className:"w-32 shrink-0",children:"Daily token cap"}),(0,e.jsx)(X,{type:"number",min:0,step:1e3,value:r.dailyTokenCap??"",onChange:s(a=>{const p=Number(a.target.value);c({dailyTokenCap:a.target.value===""||p<=0?void 0:p})},"onChange"),className:"h-8 w-36",placeholder:"no cap","aria-label":"Daily token cap"})]})]})]})]}):null,(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,e.jsx)("span",{className:"font-semibold",children:"Estimated cost"}),(0,e.jsx)("span",{className:"text-muted-foreground",children:"="}),(0,e.jsxs)(Ot,{children:[(0,e.jsx)(Vt,{asChild:!0,children:(0,e.jsx)("span",{className:"cursor-default font-medium text-foreground underline decoration-dotted decoration-muted-foreground/50 underline-offset-4",children:d.cost})}),(0,e.jsxs)(Gt,{className:"max-w-(--sz-18rem) text-left",children:[(0,e.jsx)("p",{children:d.primary}),d.note?(0,e.jsx)("p",{className:"mt-1 opacity-80",children:d.note}):null,(0,e.jsx)("p",{className:"mt-1 opacity-80",children:"Rough estimate from typical update sizes; actual cost is tracked per update."})]})]})]})]})}s(js,"StatusCardSettingsForm");function Ns({card:t,companyId:i,open:r,onOpenChange:m,initialTab:d="summary"}){const c=Me(),[x,f]=(0,g.useState)("summary"),[l,y]=(0,g.useState)(fs()),[a,p]=(0,g.useState)(""),[h,b]=(0,g.useState)(""),[S,G]=(0,g.useState)(""),[T,j]=(0,g.useState)(null),[H,$]=(0,g.useState)(null),[v,O]=(0,g.useState)(null);(0,g.useEffect)(()=>{t&&(y({refreshPolicy:t.refreshPolicy}),p(t.title??""),b(t.interestPrompt),G(t.agentId??""),j(null),$(null),O(null))},[t]),(0,g.useEffect)(()=>{r&&f(d)},[r,d]);const K=U({queryKey:t?N.statusCards.updates(t.id):["status-cards","detail","none","updates"],queryFn:s(()=>C.updates(t.id),"queryFn"),enabled:!!(t&&r)}),se=Ee(K),be=U({queryKey:t?N.statusCards.summaryRevisions(t.id):["status-cards","detail","none","summary-revisions"],queryFn:s(()=>C.summaryRevisions(t.id),"queryFn"),enabled:!!(t&&r&&t.documentId)}),D=U({queryKey:t?N.statusCards.dryRun(t.id):["status-cards","detail","none","dry-run"],queryFn:s(()=>C.dryRun(t.id),"queryFn"),enabled:!!(t&&r&&x==="watched"&&(t.queries.length>0||(t.mentionedIssueIds?.length??0)>0))}),M=Ee(D),A=t?st(t):"fresh",Y=(0,g.useMemo)(()=>t&&A==="updating"&&t.generatingIssueId?{id:t.generatingIssueId,identifier:null,title:t.title??"Status update",status:"in_progress"}:null,[t,A]),ie=Xe(i,Y),u=s(async()=>{t&&await Promise.all([c.invalidateQueries({queryKey:N.statusCards.list(t.companyId,!1)}),c.invalidateQueries({queryKey:N.statusCards.detail(t.id)})])},"invalidateCard"),B=L({mutationFn:s(()=>C.refresh(t.id),"mutationFn"),onMutate:s(()=>{j(null),$(null)},"onMutate"),onSuccess:s(async()=>{await u(),$("Refresh queued — the Summarizer is updating this card.")},"onSuccess"),onError:s(o=>j(F(o,{action:"refresh the card"}).body),"onError")}),le=L({mutationFn:s(()=>C.recompile(t.id),"mutationFn"),onMutate:s(()=>{j(null),$(null)},"onMutate"),onSuccess:s(async()=>{await u(),$("Run queued — the Summarizer is updating this card.")},"onSuccess"),onError:s(o=>j(F(o,{action:"run the card"}).body),"onError")}),ve=L({mutationFn:s(()=>{const o=a.trim(),je=h.trim(),ot=je.length>0&&je!==t.interestPrompt.trim();return C.patch(t.id,{title:o||null,titlePinned:o.length>0,...ot?{interestPrompt:je}:{},agentId:S||null,refreshPolicy:l.refreshPolicy})},"mutationFn"),onMutate:s(()=>j(null),"onMutate"),onSuccess:s(async()=>{t&&await Promise.all([c.invalidateQueries({queryKey:N.statusCards.list(t.companyId,!1)}),c.invalidateQueries({queryKey:N.statusCards.detail(t.id)})])},"onSuccess"),onError:s(o=>j(F(o,{action:"save the settings"}).body),"onError")});if(!t)return null;const ae=K.data??[],it=ae[0]??null,oe=rs(ae),Q=ae.filter(o=>o.status==="ok"&&o.finishedAt&&(o.kind==="full"||o.kind==="incremental")),I=v?Q.find(o=>o.id===v)??null:null,lt=be.data??[],Re=I?lt[Q.indexOf(I)]?.body??null:null,de=Q.length,_e=s(o=>de-Q.indexOf(o),"revisionNumberOf"),ue=I?I.changes:it?.changes??[],qe=at[A],$e=!!(t.summaryBody&&t.summaryBody.trim().length>0),J=A==="compiling"&&!!t.generatingIssueId;return(0,e.jsx)(Ct,{open:r,onOpenChange:m,children:(0,e.jsxs)(Dt,{className:"flex w-full flex-col gap-0 p-0 sm:max-w-2xl",children:[(0,e.jsxs)(kt,{className:"border-b border-border p-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 pr-8",children:[(0,e.jsx)("span",{className:E("inline-block h-2.5 w-2.5 shrink-0 rounded-full",qe.dotClassName),"aria-hidden":"true"}),(0,e.jsx)(jt,{className:"min-w-0 flex-1 truncate text-lg",children:t.title??"Untitled card"}),(0,e.jsx)(pe,{variant:"outline",children:qe.label}),A==="compiling"?(0,e.jsxs)(q,{variant:"outline",size:"sm",onClick:s(()=>le.mutate(),"onClick"),disabled:le.isPending||J,children:[J||le.isPending?(0,e.jsx)(_,{className:"h-3.5 w-3.5 animate-spin"}):(0,e.jsx)(Je,{className:"h-3.5 w-3.5"}),J?"Setting up…":le.isPending?"Running…":"Run now"]}):(0,e.jsxs)(q,{variant:"outline",size:"sm",onClick:s(()=>B.mutate(),"onClick"),disabled:B.isPending||A==="updating",children:[(0,e.jsx)(Qe,{className:E("h-3.5 w-3.5",B.isPending&&"animate-spin")}),B.isPending?"Refreshing…":"Refresh"]})]}),(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[t.lastGeneratedAt?`Updated ${V(t.lastGeneratedAt)}`:"No summary yet"," ·"," ",nt(t.refreshPolicy)]})]}),(0,e.jsxs)(Et,{value:x,onValueChange:f,className:"flex min-h-0 flex-1 flex-col gap-0",children:[(0,e.jsxs)(Pt,{variant:"line",className:"w-full justify-start gap-4 border-b border-border px-4",children:[(0,e.jsx)(me,{value:"summary",children:"Summary"}),(0,e.jsx)(me,{value:"settings",children:"Settings"}),(0,e.jsx)(me,{value:"watched",children:"Watched issues"}),(0,e.jsx)(me,{value:"history",children:"History"})]}),T?(0,e.jsx)("div",{className:"px-4 pt-3",children:(0,e.jsx)(fe,{tone:"warning",title:"Heads up",children:T})}):H?(0,e.jsx)("div",{className:"px-4 pt-3",children:(0,e.jsx)(fe,{tone:"info",title:"Working on it",children:H})}):null,(0,e.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:[(0,e.jsxs)(ce,{value:"summary",className:"mt-0 space-y-5",children:[($e||Q.length>0)&&A!=="compiling"?(0,e.jsx)("div",{className:"flex items-center justify-end gap-2",children:Q.length>1?(0,e.jsxs)(ke,{value:v??"__latest__",onValueChange:s(o=>O(o==="__latest__"?null:o),"onValueChange"),children:[(0,e.jsxs)(we,{size:"sm",className:"w-auto gap-1.5","aria-label":"Select summary revision",children:[(0,e.jsx)(mt,{className:"h-3.5 w-3.5","aria-hidden":"true"}),(0,e.jsx)(Ie,{})]}),(0,e.jsxs)(Ae,{align:"end",position:"popper",children:[(0,e.jsxs)(xe,{value:"__latest__",className:"text-xs",children:["Revision ",de," · latest"]}),(0,e.jsx)(gt,{}),Q.slice(0,30).map(o=>(0,e.jsxs)(xe,{value:o.id,className:"text-xs",title:he(o.startedAt),children:["Rev ",_e(o)," · ",Ne(o.kind)," · ",V(o.startedAt)]},o.id))]})]}):de>0?(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Revision ",de," · latest"]}):null}):null,A==="updating"&&ie.draft&&!I?(0,e.jsx)(ee,{className:"text-sm leading-7",children:ie.draft}):I?(0,e.jsxs)("div",{className:"space-y-2 rounded-md border border-border bg-muted/30 p-3",children:[(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",title:he(I.startedAt),children:["Revision ",_e(I)," · ",Ne(I.kind)," ·"," ",V(I.startedAt)]}),Re?(0,e.jsx)(ee,{className:"text-sm leading-7",children:Re}):I.changeSummary?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ee,{className:"text-sm leading-7",children:I.changeSummary}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground/70",children:"The full summary text for this revision is unavailable — showing its change summary. The integrated changes below are the live ledger for this revision."})]}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No change summary was recorded for this revision."})]}):$e?(0,e.jsx)(ee,{className:"text-sm leading-7",children:t.summaryBody}):A==="compiling"?(0,e.jsxs)("div",{className:"space-y-2 text-sm text-muted-foreground",children:[(0,e.jsxs)("p",{className:"flex items-center gap-2",children:[J?(0,e.jsx)(_,{className:"h-4 w-4 shrink-0 animate-spin"}):(0,e.jsx)(Te,{className:"h-4 w-4 shrink-0 text-amber-500"}),J?"Setting up — the first summary is generated automatically once this finishes.":"Setup didn’t finish. Run it now to try again."]}),J&&t.generatingIssueId?(0,e.jsxs)(re,{to:`/issues/${t.generatingIssueId}`,className:"inline-flex items-center gap-1.5 text-xs font-medium text-foreground underline-offset-2 hover:underline",children:[(0,e.jsx)(Pe,{className:"h-3.5 w-3.5"}),"View setup task"]}):null]}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No summary yet — the first one is generated automatically once this card finishes setting up."}),ue.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsxs)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[I?"Integrated in this revision":"Integrated in this update"," (",ue.length," ",ue.length===1?"change":"changes",")"]}),(0,e.jsx)("div",{className:"space-y-1.5",children:ue.map(o=>(0,e.jsx)(ws,{change:o},o.issueId))})]}):null]}),(0,e.jsx)(ce,{value:"history",className:"mt-0 space-y-3",children:K.isLoading||se.kind==="reconnecting"?(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,e.jsx)(_,{className:"h-4 w-4 animate-spin"})," Loading history…"]}):ae.length===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No updates recorded yet."}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Today: ",oe.updateCount," ",oe.updateCount===1?"update":"updates"," ·"," ",z(oe.totalTokens)," · ",W(oe.totalCostCents),t.refreshPolicy.dailyTokenCap?` · daily cap ${z(t.refreshPolicy.dailyTokenCap)}`:""]}),(0,e.jsx)("div",{className:"divide-y divide-border",children:ae.map(o=>(0,e.jsxs)("div",{className:"py-2.5 first:pt-1",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium",children:[Ne(o.kind),(0,e.jsx)(pe,{variant:o.status==="failed"?"destructive":"secondary",children:o.status==="ok"?o.trigger:o.status})]}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",title:he(o.startedAt),children:V(o.startedAt)})]}),(0,e.jsxs)("p",{className:"mt-1 text-xs text-muted-foreground",children:[cs(o.inputTokens,o.outputTokens)," · ",W(o.costCents),o.model?` · ${o.model}`:"",o.changes.length>0?` · ${o.changes.length} changes`:""]}),o.error?(0,e.jsx)("p",{className:"mt-1 text-xs text-destructive",children:o.error}):null]},o.id))})]})}),(0,e.jsx)(ce,{value:"watched",className:"mt-0 space-y-3",children:t.queries.length===0&&(t.mentionedIssueIds?.length??0)===0?(0,e.jsx)("div",{className:"rounded-md border border-dashed border-border px-3 py-4 text-sm text-muted-foreground",children:"This card is still setting up — the issues it watches appear here once it's ready."}):D.isLoading||M.kind==="reconnecting"?(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,e.jsx)(_,{className:"h-4 w-4 animate-spin"})," Matching issues…"]}):M.kind==="error"?(0,e.jsx)(We,{error:M.error,action:"load matched issues",onRetry:M.retry,retrying:M.isFetching}):(0,e.jsx)(Ss,{queries:D.data?.queries??[],mentioned:D.data?.mentionedIssues??[]})}),(0,e.jsxs)(ce,{value:"settings",className:"mt-0 space-y-6",children:[(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Card name"}),(0,e.jsx)(X,{value:a,onChange:s(o=>p(o.target.value),"onChange"),placeholder:"Auto-named from the query",className:"text-sm","aria-label":"Card name"})]}),(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"What this card watches & reports"}),(0,e.jsx)(Ge,{value:h,onChange:s(o=>b(o.target.value),"onChange"),rows:3,className:"text-sm","aria-label":"What this card watches & reports"}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"This one message drives the whole card: the agent compiles the watch query from it and follows it as the instructions for every update. Editing it rebuilds the card."})]}),(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Agent"}),(0,e.jsx)(rt,{companyId:t.companyId,value:S,onChange:G,enabled:r})]}),(0,e.jsx)(js,{value:l,onChange:y}),(0,e.jsx)(Cs,{card:t}),(0,e.jsx)("div",{className:"flex justify-end border-t border-border pt-4",children:(0,e.jsxs)(q,{onClick:s(()=>ve.mutate(),"onClick"),disabled:ve.isPending,children:[ve.isPending?(0,e.jsx)(_,{className:"animate-spin"}):null,"Save"]})})]})]})]})]})})}s(Ns,"StatusCardDetailDrawer");function Cs({card:t}){const i=JSON.stringify({queries:t.queries,limit:50},null,2);return(0,e.jsxs)(Ze,{className:"rounded-md border border-border",children:[(0,e.jsxs)(Ve,{className:"group flex w-full items-center justify-between gap-2 px-3 py-2.5 text-sm font-semibold",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2",children:["Query debug",(0,e.jsxs)(pe,{variant:"secondary",children:["v",t.queryVersion]})]}),(0,e.jsx)(Ye,{className:"h-4 w-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]}),(0,e.jsxs)(Ke,{className:"space-y-2 border-t border-border px-3 py-3",children:[(0,e.jsx)("pre",{className:E("max-h-64 overflow-auto rounded-md bg-muted p-3 font-mono text-xs text-foreground",ct),children:t.queries.length>0?i:"// query not compiled yet"}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t.queryCompiledAt?`Compiled by Summarizer ${V(t.queryCompiledAt)} · version ${t.queryVersion}. Edit “What this card watches” above to rebuild it.`:"Not compiled yet. The query builds automatically once the card finishes setting up."})]})]})}s(Cs,"QueryDebugSection");function Ss({queries:t,mentioned:i}){const r=new Set,m=[];for(const{result:c}of t)for(const x of c.results)!x.issue||r.has(x.issue.id)||(r.add(x.issue.id),m.push(x.issue));const d=i.filter(c=>!r.has(c.id));return m.length===0&&d.length===0?(0,e.jsx)("div",{className:"rounded-md border border-dashed border-border px-3 py-4 text-sm text-muted-foreground",children:"The compiled query matches no issues right now."}):(0,e.jsxs)("div",{className:"space-y-3",children:[m.length>0?(0,e.jsx)("div",{className:"space-y-1.5",children:m.map(c=>(0,e.jsx)(ze,{issue:c},c.id))}):null,d.length>0?(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:"Mentioned in the latest update"}),d.map(c=>(0,e.jsx)(ze,{issue:c},c.id))]}):null]})}s(Ss,"MatchedIssueList");function ze({issue:t}){return(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border px-3 py-2 text-xs",children:[(0,e.jsx)(re,{to:`/issues/${t.identifier??t.id}`,className:"shrink-0 font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:t.identifier??t.id.slice(0,8)}),(0,e.jsx)(Se,{...yt(t)}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:t.title}),(0,e.jsx)("span",{className:"shrink-0 text-muted-foreground",children:V(t.updatedAt)})]})}s(ze,"WatchedIssueRow");function ws({change:t}){const i=!!(t.from&&t.to);return(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-border px-3 py-2 text-xs",children:[(0,e.jsx)(re,{to:`/issues/${t.identifier}`,className:"shrink-0 font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:t.identifier}),i?(0,e.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,e.jsx)(Se,{status:t.from}),(0,e.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"→"}),(0,e.jsx)(Se,{status:t.to})]}):(0,e.jsx)("span",{className:"truncate text-muted-foreground",children:ks(t.changeKind)})]})}s(ws,"ChangeRow");function ks(t){return t==="entered_query"||t==="new"?"new issue matched the query":t==="left_query"?"left the query":t.replace(/_/g," ")}s(ks,"describeChangeKind");function zs(){const{selectedCompanyId:t}=pt(),{setBreadcrumbs:i}=Tt(),r=vt(),m=Me(),{cardId:d}=Nt(),[c,x]=(0,g.useState)(!1),[f,l]=(0,g.useState)(!1),[y,a]=(0,g.useState)("summary"),[p,h]=(0,g.useState)(null);(0,g.useEffect)(()=>{i([{label:"Status"}])},[i]);const b=U({queryKey:t?N.statusCards.list(t,!1):["status-cards","none","active"],queryFn:s(()=>C.list(t,!1),"queryFn"),enabled:!!t}),S=Ee(b),G=U({queryKey:t?N.statusCards.list(t,!0):["status-cards","none","archived"],queryFn:s(()=>C.list(t,!0),"queryFn"),enabled:!!t}),T=b.data??[],j=G.data??[],H=(0,g.useMemo)(()=>[...T,...j].find(u=>u.id===d)??null,[T,j,d]),$=U({queryKey:d?N.statusCards.detail(d):["status-cards","detail","none"],queryFn:s(()=>C.get(d),"queryFn"),enabled:!!d&&!H}),v=H??$.data??null,O=s(()=>t?Promise.all([m.invalidateQueries({queryKey:N.statusCards.list(t,!1)}),m.invalidateQueries({queryKey:N.statusCards.list(t,!0)})]):Promise.resolve(),"invalidateLists"),K=L({mutationFn:s(u=>C.refresh(u),"mutationFn"),onMutate:s(()=>h(null),"onMutate"),onSuccess:s(()=>O(),"onSuccess"),onError:s(u=>h(F(u,{action:"refresh the card"}).body),"onError")}),se=L({mutationFn:s(u=>C.recompile(u),"mutationFn"),onMutate:s(()=>h(null),"onMutate"),onSuccess:s(()=>O(),"onSuccess"),onError:s(u=>h(F(u,{action:"run the card"}).body),"onError")}),be=L({mutationFn:s(u=>C.patch(u,{archived:!0}),"mutationFn"),onMutate:s(()=>h(null),"onMutate"),onSuccess:s(()=>O(),"onSuccess"),onError:s(u=>h(F(u,{action:"archive the card"}).body),"onError")}),D=L({mutationFn:s(u=>C.patch(u,{archived:!1}),"mutationFn"),onMutate:s(()=>h(null),"onMutate"),onSuccess:s(()=>O(),"onSuccess"),onError:s(u=>h(F(u,{action:"restore the card"}).body),"onError")}),M=s((u,B="summary")=>{a(B),r(`/status/${u}`)},"openDetail"),A=s(()=>r("/status"),"closeDetail"),Y=T.reduce((u,B)=>({tokens:u.tokens+(B.todayTokens??0),cents:u.cents+(B.todayCostCents??0)}),{tokens:0,cents:0}),ie=Y.tokens>0||Y.cents>0;return(0,e.jsxs)("div",{className:"mx-auto max-w-6xl space-y-5",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)("h1",{className:"text-xl font-bold",children:"Status"}),(0,e.jsxs)(pe,{variant:"secondary",className:"gap-1",children:[(0,e.jsx)(Be,{className:"h-3 w-3"}),"Experimental"]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[ie?(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Today: ",z(Y.tokens)," · ~",W(Y.cents)]}):null,(0,e.jsxs)(q,{onClick:s(()=>l(!0),"onClick"),disabled:!t,children:[(0,e.jsx)(Ft,{className:"h-4 w-4"}),"New card"]})]})]}),p?(0,e.jsx)(fe,{tone:"warning",title:"Heads up",children:p}):null,S.kind==="loading"||S.kind==="reconnecting"?(0,e.jsxs)("div",{className:"flex items-center gap-2 py-12 text-sm text-muted-foreground",children:[(0,e.jsx)(_,{className:"h-4 w-4 animate-spin"})," Loading cards…"]}):S.kind==="error"?(0,e.jsx)(We,{error:S.error,action:"load status cards",onRetry:S.retry,retrying:S.isFetching}):T.length===0?(0,e.jsx)(Bt,{icon:Be,title:"No status cards yet",message:"Create a card to keep a living summary of the issues you care about.",action:t?"New card":void 0,onAction:s(()=>l(!0),"onAction")}):(0,e.jsx)("div",{className:"grid gap-4 sm:grid-cols-2",children:T.map(u=>(0,e.jsx)(hs,{card:u,companyId:t,onOpen:s(()=>M(u.id),"onOpen"),onRefresh:s(()=>K.mutate(u.id),"onRefresh"),onRecompile:s(()=>se.mutate(u.id),"onRecompile"),onEditInterest:s(()=>M(u.id,"settings"),"onEditInterest"),onOpenDebug:s(()=>M(u.id,"settings"),"onOpenDebug"),onArchive:s(()=>be.mutate(u.id),"onArchive"),refreshPending:K.isPending&&K.variables===u.id,recompilePending:se.isPending&&se.variables===u.id},u.id))}),j.length>0?(0,e.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,e.jsx)("button",{type:"button",onClick:s(()=>x(u=>!u),"onClick"),className:"text-xs text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:c?"Hide archived":`Show archived (${j.length})`}),c?j.map(u=>(0,e.jsx)(xs,{card:u,onView:s(()=>M(u.id),"onView"),onRestore:s(()=>D.mutate(u.id),"onRestore"),restorePending:D.isPending&&D.variables===u.id},u.id)):null]}):null,t?(0,e.jsx)(gs,{companyId:t,open:f,onOpenChange:l}):null,(0,e.jsx)(Ns,{card:v,companyId:t,open:!!d,onOpenChange:s(u=>u?void 0:A(),"onOpenChange"),initialTab:y})]})}s(zs,"StatusCards");export{zs as StatusCards,zs as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var ke=Object.defineProperty;var n=(s,d)=>ke(s,"name",{value:d,configurable:!0});import{a as ue}from"./rolldown-runtime-DhZMWcEn.js";import{$A as we,$S as Se,Ap as re,BC as _e,EC as ie,GS as u,Gb as Z,HC as Ce,H_ as G,Hn as Re,Kv as Ae,ME as me,Mp as Ee,NE as b,Np as Te,Op as Le,Pp as Pe,QE as le,RT as Ie,WE as J,_w as L,ab as xe,as as qe,bE as ee,cv as ze,dy as Be,fy as Me,hE as De,iD as Ke,kp as $e,ly as Fe,mT as Qe,my as We,nj as Ge,pm as U,rb as Ue,sy as Oe,uE as O,ub as pe,uy as Ve,x as oe,xE as T,y_ as de,zE as ge}from"./index-BJtnP7H1.js";import{t as He}from"./ConfigureBuiltInAgentModal-DgeD7t_i.js";import{t as Ye}from"./useSummaryDraftStream-NVNYNt72.js";var e=ue(we(),1);function Xe(s){return s==="blocked"?"border-destructive/30 bg-destructive/5 text-destructive":s==="ready_with_warnings"?"border-amber-500/30 bg-amber-500/10 text-amber-800 dark:text-amber-300":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"}n(Xe,"readinessTone");function ms({workspaceId:s,workspaceName:d,currentStatus:l,open:c,onOpenChange:m,onClosed:P}){const R=me(),{pushToast:N}=ze(),A=l==="cleanup_failed"?"Retry close":"Close workspace",p=T({queryKey:u.executionWorkspaces.closeReadiness(s),queryFn:n(()=>de.getCloseReadiness(s),"queryFn"),enabled:c}),g=pe(p),h=ee({mutationFn:n(()=>de.update(s,{status:"archived"}),"mutationFn"),onSuccess:n(t=>{R.setQueryData(u.executionWorkspaces.detail(t.id),t),R.invalidateQueries({queryKey:u.executionWorkspaces.overview(t.companyId)}),R.invalidateQueries({queryKey:u.executionWorkspaces.closeReadiness(t.id)}),N({title:l==="cleanup_failed"?"Workspace close retried":"Workspace closed",tone:"success"}),m(!1),P?.(t)},"onSuccess"),onError:n(t=>{N({title:"Failed to close workspace",body:De(t).body,tone:"error"})},"onError")}),a=p.data??null,k=a?.linkedIssues.filter(t=>!t.isTerminal)??[],i=a?.linkedIssues.filter(t=>t.isTerminal)??[],E=l==="archived"||h.isPending||p.isLoading||a==null||a.state==="blocked";return(0,e.jsx)(Oe,{open:c,onOpenChange:n(t=>{h.isPending||m(t)},"onOpenChange"),children:(0,e.jsxs)(Fe,{className:"max-h-(--sz-85vh) overflow-y-auto sm:max-w-2xl",children:[(0,e.jsxs)(Me,{children:[(0,e.jsx)(We,{children:A}),(0,e.jsxs)(Ve,{className:"break-words",children:["Archive ",(0,e.jsx)("span",{className:"font-medium text-foreground",children:d})," and clean up any owned workspace artifacts. Microvac keeps the workspace record and task history, but removes it from active workspace views."]})]}),g.kind==="loading"||g.kind==="reconnecting"?(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-xl border border-border bg-background px-4 py-3 text-sm text-muted-foreground",children:[(0,e.jsx)(L,{className:"h-4 w-4 animate-spin"}),"Checking whether this workspace is safe to close..."]}):g.kind==="error"?(0,e.jsx)(xe,{error:g.error,action:"inspect workspace close readiness",onRetry:g.retry,retrying:g.isFetching}):a?(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:`rounded-xl border px-4 py-3 text-sm ${Xe(a.state)}`,children:[(0,e.jsx)("div",{className:"font-medium",children:a.state==="blocked"?"Close is blocked":a.state==="ready_with_warnings"?"Close is allowed with warnings":"Close is ready"}),(0,e.jsx)("div",{className:"mt-1 text-xs opacity-80",children:a.isSharedWorkspace?"This is a shared workspace session. Archiving it removes this session record but keeps the underlying project workspace.":a.git?.workspacePath&&a.git.repoRoot&&a.git.workspacePath!==a.git.repoRoot?"This execution workspace has its own checkout path and can be archived independently.":a.isProjectPrimaryWorkspace?"This execution workspace currently points at the project's primary workspace path.":"This workspace is disposable and can be archived."})]}),k.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Blocking tasks"}),(0,e.jsx)("div",{className:"space-y-2",children:k.map(t=>(0,e.jsx)("div",{className:"rounded-xl border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm",children:(0,e.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2",children:[(0,e.jsxs)(Z,{to:le(t),className:"min-w-0 break-words font-medium hover:underline",children:[t.identifier??t.id," · ",t.title]}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:t.status})]})},t.id))})]}):null,a.blockingReasons.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Blocking reasons"}),(0,e.jsx)("ul",{className:"space-y-2 text-sm text-muted-foreground",children:a.blockingReasons.map(t=>(0,e.jsx)("li",{className:"break-words rounded-lg border border-destructive/20 bg-destructive/5 px-3 py-2 text-destructive",children:t},t))})]}):null,a.warnings.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Warnings"}),(0,e.jsx)("ul",{className:"space-y-2 text-sm text-muted-foreground",children:a.warnings.map(t=>(0,e.jsx)("li",{className:"break-words rounded-lg border border-amber-500/20 bg-amber-500/5 px-3 py-2",children:t},t))})]}):null,a.git?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Git status"}),(0,e.jsx)("div",{className:"rounded-xl border border-border bg-background px-4 py-3 text-sm",children:(0,e.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-muted-foreground",children:"Branch"}),(0,e.jsx)("div",{className:"font-mono text-xs",children:a.git.branchName??"Unknown"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-muted-foreground",children:"Base ref"}),(0,e.jsx)("div",{className:"font-mono text-xs",children:a.git.baseRef??"Not set"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-muted-foreground",children:"Merged into base"}),(0,e.jsx)("div",{children:a.git.isMergedIntoBase==null?"Unknown":a.git.isMergedIntoBase?"Yes":"No"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-muted-foreground",children:"Ahead / behind"}),(0,e.jsxs)("div",{children:[(a.git.aheadCount??0).toString()," / ",(a.git.behindCount??0).toString()]})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-muted-foreground",children:"Dirty tracked files"}),(0,e.jsx)("div",{children:a.git.dirtyEntryCount})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-muted-foreground",children:"Untracked files"}),(0,e.jsx)("div",{children:a.git.untrackedEntryCount})]})]})})]}):null,i.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Other linked tasks"}),(0,e.jsx)("div",{className:"space-y-2",children:i.map(t=>(0,e.jsx)("div",{className:"rounded-xl border border-border bg-background px-4 py-3 text-sm",children:(0,e.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2",children:[(0,e.jsxs)(Z,{to:le(t),className:"min-w-0 break-words font-medium hover:underline",children:[t.identifier??t.id," · ",t.title]}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:t.status})]})},t.id))})]}):null,a.runtimeServices.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Attached runtime services"}),(0,e.jsx)("div",{className:"space-y-2",children:a.runtimeServices.map(t=>(0,e.jsxs)("div",{className:"rounded-xl border border-border bg-background px-4 py-3 text-sm",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2",children:[(0,e.jsx)("span",{className:"font-medium",children:t.serviceName}),(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[t.status," · ",t.lifecycle]})]}),(0,e.jsx)("div",{className:"mt-1 break-words text-xs text-muted-foreground",children:t.url??t.command??"No additional details"})]},t.id))})]}):null,(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Cleanup actions"}),(0,e.jsx)("div",{className:"space-y-2",children:a.plannedActions.map((t,z)=>(0,e.jsxs)("div",{className:"rounded-xl border border-border bg-background px-4 py-3 text-sm",children:[(0,e.jsx)("div",{className:"font-medium",children:t.label}),(0,e.jsx)("div",{className:"mt-1 break-words text-muted-foreground",children:t.description}),t.command?(0,e.jsx)("pre",{className:ge("mt-2 whitespace-pre-wrap break-all rounded-lg bg-background px-3 py-2 font-mono text-xs text-foreground",Se),children:t.command}):null]},`${t.kind}-${z}`))})]}),l==="cleanup_failed"?(0,e.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/5 px-4 py-3 text-sm text-muted-foreground",children:"Cleanup previously failed on this workspace. Retrying close will rerun the cleanup flow and update the workspace status if it succeeds."}):null,l==="archived"?(0,e.jsx)("div",{className:"rounded-xl border border-border bg-background px-4 py-3 text-sm text-muted-foreground",children:"This workspace is already archived."}):null,a.git?.repoRoot?(0,e.jsxs)("div",{className:"break-words text-xs text-muted-foreground",children:["Repo root: ",(0,e.jsx)("span",{className:"font-mono break-all",children:a.git.repoRoot}),a.git.workspacePath?(0,e.jsxs)(e.Fragment,{children:[" · ","Workspace path: ",(0,e.jsx)("span",{className:"font-mono break-all",children:a.git.workspacePath})]}):null]}):null,(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Last checked ",J(new Date(p.dataUpdatedAt))]})]}):null,(0,e.jsxs)(Be,{children:[(0,e.jsx)(b,{variant:"outline",onClick:n(()=>m(!1),"onClick"),disabled:h.isPending,children:"Cancel"}),(0,e.jsxs)(b,{variant:l==="cleanup_failed"?"default":"destructive",onClick:n(()=>h.mutate(),"onClick"),disabled:E,children:[h.isPending?(0,e.jsx)(L,{className:"mr-2 h-4 w-4 animate-spin"}):null,A]})]})]})})}n(ms,"ExecutionWorkspaceCloseDialog");var C=ue(Ge(),1);function V(s,d=""){const l=new URLSearchParams;s.scopeId&&l.set("scopeId",s.scopeId);const c=l.toString();return[`/companies/${s.companyId}/summary-slots/${s.scopeKind}/${s.slotKey}`,d,c?`?${c}`:""].join("")}n(V,"summarySlotPath");var H={get:n(s=>O.get(V(s)),"get"),revisions:n(s=>O.get(V(s,"/revisions")),"revisions"),generate:n(s=>O.post(V(s,"/generate"),{scopeId:s.scopeId??null}),"generate")},Ze="summarizer",Je=new Set(["done","cancelled"]),Y="__latest__",es=30;function ss(s){return s.identifier?`${s.identifier}: ${s.title}`:s.title}n(ss,"issueLabel");function ts(s){return`Rev ${s.revisionNumber}`}n(ts,"revisionLabel");function he(s){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(new Date(s)).replace(",","")}n(he,"formatRevisionTimestamp");function ce(s){return`${ts(s)} - ${he(s.createdAt)}`}n(ce,"revisionOptionLabel");function ns(s,d){return`Latest (Rev ${s.latestRevisionNumber}) - ${he(d?.createdAt??s.updatedAt)}`}n(ns,"latestRevisionOptionLabel");function X(s){return typeof s=="string"&&s.trim().length>0?s.trim():null}n(X,"readPayloadString");function as(s){return s?s.message?s.message:s.lastAssistantSnippet?s.lastAssistantSnippet:s.currentToolName?`Working with ${s.currentToolName}`:null:null}n(as,"resolveGenerationStatusLine");function rs(s){const[d,l]=(0,C.useState)(null);return(0,C.useEffect)(()=>{l(null)},[s]),Re(c=>{if(!s||c.type!=="heartbeat.run.progress")return;const m=c.payload??{};m.issueId===s&&l({message:X(m.message),currentToolName:X(m.currentToolName),lastAssistantSnippet:X(m.lastAssistantSnippet)})}),s?d:null}n(rs,"useGenerationStatus");function is(s){return s&&(s.status==="not_provisioned"||s.status==="needs_setup"||s.status==="pending_approval")?s:null}n(is,"setupState");function xs({companyId:s,scopeKind:d,scopeId:l=null,slotKey:c="header",title:m,description:P,className:R}){const N=me(),[A,p]=(0,C.useState)(null),[g,h]=(0,C.useState)(!1),[a,k]=(0,C.useState)(null),i=s?{companyId:s,scopeKind:d,scopeId:l,slotKey:c}:null,E=T({queryKey:u.instance.experimentalSettings,queryFn:n(()=>Ae.getExperimental(),"queryFn")}),t=E.data?.enableSummaries===!0,z=E.data?.enableBuiltInAgents===!0,w=T({queryKey:u.builtInAgents.list(s??"__none__"),queryFn:n(()=>qe.list(s),"queryFn"),enabled:!!(s&&t&&z)}).data?.find(r=>r.definition.key===Ze),S=is(w),se=i?u.summarySlots.detail(i.companyId,i.scopeKind,i.slotKey,i.scopeId):u.summarySlots.detail("__none__",d,c,l),te=i?u.summarySlots.revisions(i.companyId,i.scopeKind,i.slotKey,i.scopeId):u.summarySlots.revisions("__none__",d,c,l),y=T({queryKey:se,queryFn:n(()=>H.get(i),"queryFn"),enabled:!!(i&&t),refetchInterval:n(r=>r.state.data?.slot?.status==="generating"?3e3:!1,"refetchInterval")}),_=pe(y),B=_.kind==="ready"||_.kind==="stale",fe=T({queryKey:te,queryFn:n(()=>H.revisions(i),"queryFn"),enabled:!!(i&&t&&y.data?.document)}),x=ee({mutationFn:n(()=>H.generate(i),"mutationFn"),onMutate:n(()=>k(null),"onMutate"),onSuccess:n(async()=>{p(null),await Promise.all([N.invalidateQueries({queryKey:se}),N.invalidateQueries({queryKey:te})])},"onSuccess"),onError:n(r=>{k(r instanceof Error?r.message:"Summary generation could not be started.")},"onError")}),M=ee({mutationFn:n(r=>Ue.resume(r,s??void 0),"mutationFn"),onSuccess:n(async()=>{s&&await N.invalidateQueries({queryKey:u.builtInAgents.list(s)})},"onSuccess")}),j=fe.data?.revisions??[],o=y.data?.document??null,D=(0,C.useMemo)(()=>j.find(r=>r.id===A)??null,[j,A]),K=o?j.find(r=>r.id===o.latestRevisionId)??null:null,v=D&&D.id!==o?.latestRevisionId?D:null,be=v?.body??o?.body??"",$=!!v,ne=(o?j.filter(r=>r.id!==o.latestRevisionId):j).toSorted((r,Ne)=>Ne.revisionNumber-r.revisionNumber).slice(0,es-(o?1:0)),ye=v?.id??Y,ae=o?ns(o,K):"Latest",f=y.data?.generatingIssue??null,je=as(rs(f?.id??null)),I=Ye(s,f),F=I.statusLine??je,q=y.data?.slot?.status==="generating"&&f&&!Je.has(f.status),Q=y.data?.slot?.status==="failed",ve=w?.status==="ready";if(E.isLoading||!t)return null;const W=n(()=>{!i||x.isPending||x.mutate()},"startGeneration");return(0,e.jsxs)("section",{className:ge("space-y-4",R),children:[(0,e.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(ie,{className:"h-4 w-4 text-muted-foreground","aria-hidden":"true"}),(0,e.jsx)("h2",{className:"text-sm font-semibold",children:m}),q?(0,e.jsx)(G,{variant:"secondary",children:"Generating"}):null,$?(0,e.jsx)(G,{variant:"outline",children:"Historical revision"}):null,o&&!$?(0,e.jsx)(G,{variant:"outline",children:"Latest revision"}):null]}),P?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:P}):null]}),(0,e.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[$?(0,e.jsx)(b,{type:"button",size:"sm",variant:"outline",onClick:n(()=>p(null),"onClick"),children:"Latest"}):null,o&&!Q?(0,e.jsxs)(b,{type:"button",size:"sm",variant:"outline",onClick:W,disabled:!i||x.isPending||!!q,children:[x.isPending?(0,e.jsx)(L,{className:"animate-spin"}):(0,e.jsx)(Ce,{}),"Refresh"]}):null]})]}),S?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex flex-col items-start gap-3 rounded-lg border border-border bg-muted/30 p-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[S.status==="pending_approval"?(0,e.jsx)(Qe,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}):(0,e.jsx)(Ie,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),(0,e.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,e.jsx)("p",{className:"font-medium text-foreground",children:S.status==="pending_approval"?"Summarizer setup is pending approval":"Set up the Summarizer"}),(0,e.jsx)("p",{className:"text-muted-foreground",children:"Summaries are generated by Microvac's built-in Summarizer agent. Configure its adapter and model before requesting this summary."})]})]}),S.status==="pending_approval"?null:(0,e.jsx)(b,{type:"button",size:"sm",onClick:n(()=>h(!0),"onClick"),children:"Set up Summarizer"})]}),s?(0,e.jsx)(He,{companyId:s,state:S,open:g,onOpenChange:h,onConfigured:n(()=>k(null),"onConfigured")}):null]}):null,!S&&w?.status==="paused"&&w.agent?(0,e.jsx)(U,{tone:"warning",title:"Summarizer is paused",actions:(0,e.jsx)(b,{type:"button",size:"sm",onClick:n(()=>w.agent&&M.mutate(w.agent.id),"onClick"),disabled:M.isPending,children:M.isPending?"Resuming...":"Resume agent"}),children:"Existing summaries remain readable, but new summaries will not be generated until the agent resumes."}):null,a?(0,e.jsx)(U,{tone:"warning",title:"Summary request failed",children:a}):null,_.kind==="error"?(0,e.jsx)(xe,{size:"panel",error:_.error,action:"load the summary",onRetry:_.retry,retrying:_.isFetching}):null,B&&Q?(0,e.jsx)(U,{tone:"danger",title:"Summary generation failed",actions:(0,e.jsx)(b,{type:"button",size:"sm",onClick:W,disabled:!i||x.isPending,children:x.isPending?"Retrying...":"Retry"}),children:y.data?.slot?.failureReason??"The generation task ended before writing a summary."}):null,B&&q&&f?(0,e.jsxs)("div",{className:"flex items-start gap-3 text-sm",children:[(0,e.jsx)(L,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-muted-foreground"}),(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsx)("p",{className:"font-medium text-foreground",children:"Generating summary"}),F?(0,e.jsx)("p",{className:"animate-pulse truncate text-muted-foreground","aria-live":"polite","data-testid":"summary-generation-status-line",title:F,children:F}):null,I.draft?(0,e.jsxs)("div",{className:"mt-2 rounded-md border border-border bg-muted/20 p-3","data-testid":"summary-generation-draft","aria-live":"polite",children:[(0,e.jsx)(oe,{className:"text-sm leading-7 text-foreground",children:I.draft}),I.draftClosed?null:(0,e.jsx)("span",{className:"mt-1 inline-block h-4 w-px animate-pulse bg-foreground align-text-bottom","aria-hidden":"true","data-testid":"summary-generation-caret"})]}):null,(0,e.jsxs)("p",{className:"text-muted-foreground",children:["Summarizer is working in"," ",(0,e.jsx)(Z,{className:"underline",to:`/issues/${f.identifier??f.id}`,children:ss(f)}),"."]})]})]}):null,B&&!o&&!q&&!Q&&ve?(0,e.jsxs)("div",{className:"flex flex-col items-start gap-3 rounded-lg border border-border bg-muted/30 p-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,e.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,e.jsx)("p",{className:"font-medium text-foreground",children:"No summary yet"}),(0,e.jsx)("p",{className:"text-muted-foreground",children:"Generate a concise status snapshot for this surface."})]}),(0,e.jsxs)(b,{type:"button",size:"sm",onClick:W,disabled:!i||x.isPending,children:[x.isPending?(0,e.jsx)(L,{className:"animate-spin"}):(0,e.jsx)(ie,{}),x.isPending?"Generating...":"Generate summary"]})]}):null,o?(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)(oe,{className:"text-sm leading-7 text-foreground",children:be}),(0,e.jsxs)("div",{className:"flex flex-col gap-3 text-xs text-muted-foreground sm:flex-row sm:items-center sm:justify-between",children:[(0,e.jsxs)("span",{title:J(v?.createdAt??K?.createdAt??o.updatedAt),children:["Updated ",Ke(v?.createdAt??K?.createdAt??o.updatedAt)]}),j.length>1?(0,e.jsxs)(Le,{value:ye,onValueChange:n(r=>{p(r===Y?null:r)},"onValueChange"),children:[(0,e.jsx)(Te,{size:"sm",className:"h-auto border-0 bg-transparent p-0 text-xs shadow-none hover:text-foreground focus-visible:ring-0","aria-label":"Select summary revision",title:v?ce(v):ae,children:(0,e.jsxs)(Pe,{children:[(0,e.jsx)(_e,{className:"size-3.5","aria-hidden":"true"}),(0,e.jsxs)("span",{children:[j.length," revisions"]})]})}),(0,e.jsxs)($e,{align:"end",position:"popper",children:[(0,e.jsx)(re,{value:Y,className:"text-xs",children:ae}),ne.length>0?(0,e.jsx)(Ee,{}):null,ne.map(r=>(0,e.jsx)(re,{value:r.id,className:"text-xs",title:J(r.createdAt),children:ce(r)},r.id))]})]}):null]})]}):null]})}n(xs,"SummarySlotCard");export{ms as n,xs as t};
|