@microvac/ui 0.1.0-rc.14 → 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.
Files changed (280) hide show
  1. package/dist/assets/{ActiveAgentsPanel-C9AP9hJu.js → ActiveAgentsPanel-BEx06tMt.js} +1 -1
  2. package/dist/assets/{AdapterManager-CmxTUKJH.js → AdapterManager-3kEEQWFJ.js} +1 -1
  3. package/dist/assets/{AdvancedToolsRoute-CXsQnTei.js → AdvancedToolsRoute-CgS6B-oh.js} +1 -1
  4. package/dist/assets/{AgentActionButtons-DWq2OuVK.js → AgentActionButtons-Cz3jCEd7.js} +1 -1
  5. package/dist/assets/{AgentAdvancedTab-dhBDxF-H.js → AgentAdvancedTab-BG6ZIAuN.js} +1 -1
  6. package/dist/assets/{AgentBulkSettingsSheet-DYT4ovDg.js → AgentBulkSettingsSheet-BrrbvspS.js} +1 -1
  7. package/dist/assets/{AgentChat-r0TPOfPK.js → AgentChat-Dw9iXD6H.js} +1 -1
  8. package/dist/assets/{AgentDetailPage-Bc_okBuS.js → AgentDetailPage-CuVIHv_q.js} +3 -3
  9. package/dist/assets/{AgentIdentityChip-CB2NBXkZ.js → AgentIdentityChip-BrVCcuHQ.js} +1 -1
  10. package/dist/assets/{AgentRosterFilters-b7qMLv8-.js → AgentRosterFilters-GQ2bdXfW.js} +2 -2
  11. package/dist/assets/{Agents-BsvXy3pZ.js → Agents-clrVQnvc.js} +2 -2
  12. package/dist/assets/{Agents.production-BeOZmzaF.js → Agents.production-DTopo7XB.js} +2 -2
  13. package/dist/assets/{AnimatedDialogContent-CWshmxP2.js → AnimatedDialogContent-CDLfw-dJ.js} +1 -1
  14. package/dist/assets/{AppDetail-DbqENTF_.js → AppDetail-BcWBg5yW.js} +1 -1
  15. package/dist/assets/{AppNotConnected-BhnCqL0F.js → AppNotConnected-NgfyHZ4L.js} +1 -1
  16. package/dist/assets/{ApprovalDetail-B2KiYLTj.js → ApprovalDetail-Dm_1V4tC.js} +1 -1
  17. package/dist/assets/{Approvals-j-wRmqKj.js → Approvals-i5AB3JPj.js} +1 -1
  18. package/dist/assets/{AppsConnect-CcPVEZ0C.js → AppsConnect-D660Tpuo.js} +1 -1
  19. package/dist/assets/{AppsReview-B8eWvKkS.js → AppsReview-DdTqOisY.js} +1 -1
  20. package/dist/assets/{ArtifactEmptyGraphic-5mdkS5jj.js → ArtifactEmptyGraphic-DzxCruYA.js} +1 -1
  21. package/dist/assets/{Artifacts-Bz7Oo6VX.js → Artifacts-CkXBz6nh.js} +1 -1
  22. package/dist/assets/{AssigneePickerInner-DdpF7hck.js → AssigneePickerInner-BNjyABBe.js} +1 -1
  23. package/dist/assets/{AssistantConnection-BpaaJDc_.js → AssistantConnection-CNF6mDmO.js} +1 -1
  24. package/dist/assets/{AttentionInlineVerbs-DlPQVCO-.js → AttentionInlineVerbs-BiyZ1ekZ.js} +1 -1
  25. package/dist/assets/{AttentionQueueRow-BC6ezctS.js → AttentionQueueRow-Bh0dKHpF.js} +1 -1
  26. package/dist/assets/{AuditHub-BVP7LKL9.js → AuditHub-BK848cb4.js} +1 -1
  27. package/dist/assets/{AuditRuns-DqizHgX1.js → AuditRuns-CUdlbP7S.js} +1 -1
  28. package/dist/assets/{Auth-DOF0snjp.js → Auth-DDqxm5gD.js} +1 -1
  29. package/dist/assets/{BoardChat-BYAbDtfd.js → BoardChat-fvKqk0R7.js} +1 -1
  30. package/dist/assets/{BoardClaim-7y41Pr8e.js → BoardClaim-BEC5BZfz.js} +1 -1
  31. package/dist/assets/{BootstrapSetupUxLab-BftH1vOv.js → BootstrapSetupUxLab-CXzErrin.js} +1 -1
  32. package/dist/assets/{Browse-Ck01W1Yl.js → Browse-DoovSMuF.js} +1 -1
  33. package/dist/assets/{BudgetPolicyCard-CKhrzfgy.js → BudgetPolicyCard-BYMlczCq.js} +1 -1
  34. package/dist/assets/{CaseDetail-qlXKJ66D.js → CaseDetail-UMAcSH_x.js} +1 -1
  35. package/dist/assets/{CaseStatus-B3RiZVDH.js → CaseStatus-BI0aMl9l.js} +1 -1
  36. package/dist/assets/{Cases-CFV3V-5X.js → Cases-CMTkGghU.js} +1 -1
  37. package/dist/assets/{ChatEndpointDetail-7Hi5TJNt.js → ChatEndpointDetail-CocNEInH.js} +1 -1
  38. package/dist/assets/{ChatEndpointSetup-CtwgH6sg.js → ChatEndpointSetup-Cyi2tI9K.js} +1 -1
  39. package/dist/assets/{ChatIdentityConfirm-CXjksBwX.js → ChatIdentityConfirm-Ba3JuTX1.js} +1 -1
  40. package/dist/assets/{CliAuth-KVjrGMfZ.js → CliAuth-D2jnueGH.js} +1 -1
  41. package/dist/assets/{Companies-oeJem3De.js → Companies-K75I9dJs.js} +1 -1
  42. package/dist/assets/{CompanyAccess-vWT6G-n_.js → CompanyAccess-Cw6nLUhE.js} +1 -1
  43. package/dist/assets/{CompanyActivity-zOzzeN1B.js → CompanyActivity-BsgmVpWS.js} +1 -1
  44. package/dist/assets/CompanyActivity.production-w-KGxvo6.js +1 -0
  45. package/dist/assets/{CompanyConnections-llSEaVa2.js → CompanyConnections-yRPYSdm7.js} +1 -1
  46. package/dist/assets/{CompanyEnvironments-DNyyGC_S.js → CompanyEnvironments-BA7kWdOJ.js} +1 -1
  47. package/dist/assets/{CompanyExport-CFa-F8Es.js → CompanyExport-DfsK4b9c.js} +1 -1
  48. package/dist/assets/{CompanyImport-DG6qwQ8F.js → CompanyImport-DJHAsmSF.js} +1 -1
  49. package/dist/assets/{CompanySettings-Dv5Z3ZQi.js → CompanySettings-DwzHGXec.js} +1 -1
  50. package/dist/assets/{CompanySettingsPluginPage-CZk1d_0d.js → CompanySettingsPluginPage-Bpa81PF3.js} +1 -1
  51. package/dist/assets/{CompanySkills-CdzWhJfQ.js → CompanySkills-eTqgbqQN.js} +1 -1
  52. package/dist/assets/{CompanySkills.production-IoCRW5FQ.js → CompanySkills.production-CQSWfH0r.js} +1 -1
  53. package/dist/assets/{ConfigureBuiltInAgentModal-BwW7XQ1O.js → ConfigureBuiltInAgentModal-DgeD7t_i.js} +1 -1
  54. package/dist/assets/{CopyableGatewayUrl-PTn061ft.js → CopyableGatewayUrl-B6K3rOal.js} +1 -1
  55. package/dist/assets/{CordisPluginSettings-C_BeeGEc.js → CordisPluginSettings-DD3AnD2G.js} +1 -1
  56. package/dist/assets/{Costs-DhuNxwSj.js → Costs-orBM8T-a.js} +1 -1
  57. package/dist/assets/{CrossIssueCollaborationUxLab-ZaAXq46r.js → CrossIssueCollaborationUxLab-Bv9y9-NE.js} +1 -1
  58. package/dist/assets/{Dashboard-BaDnqiKo.js → Dashboard-CrSBNKX1.js} +1 -1
  59. package/dist/assets/{DashboardLive-D-Ed7osd.js → DashboardLive-Cg8C9RiS.js} +1 -1
  60. package/dist/assets/{DecisionDateChips-D3pl_mLn.js → DecisionDateChips-BLZKZH71.js} +1 -1
  61. package/dist/assets/{DecisionHistoryPanel-D5MzyrOh.js → DecisionHistoryPanel-yK-CP7Qg.js} +1 -1
  62. package/dist/assets/{DecisionQueuePage-D3UZ9oRk.js → DecisionQueuePage-BKXbERai.js} +1 -1
  63. package/dist/assets/{DesignGuide-COTo7ICj.js → DesignGuide-2FswNsXz.js} +1 -1
  64. package/dist/assets/{DesignSandboxTaskThread-CMeCSQid.js → DesignSandboxTaskThread-CGU--FXR.js} +1 -1
  65. package/dist/assets/{EmailConnectionAccess-kCL7obSr.js → EmailConnectionAccess-CZ5QRKyg.js} +1 -1
  66. package/dist/assets/{EmailEndpointSetup-BGrksR_u.js → EmailEndpointSetup-BI2vsd8Y.js} +1 -1
  67. package/dist/assets/{EnforcementBanner-_Eb_nK3M.js → EnforcementBanner-B-iX466h.js} +1 -1
  68. package/dist/assets/{EntityRow-gpsOgEtu.js → EntityRow-BsICt6pd.js} +1 -1
  69. package/dist/assets/{ExecutionWorkspaceDetail-DwGkH6d3.js → ExecutionWorkspaceDetail-CMqR9puh.js} +1 -1
  70. package/dist/assets/{ExternalAgentInviteDialog-CGid6pM9.js → ExternalAgentInviteDialog-De30ZrLP.js} +1 -1
  71. package/dist/assets/{FilterBar-1D-VhrvG.js → FilterBar-rCmsTtG4.js} +1 -1
  72. package/dist/assets/{FolderControls-CQ6kef3c.js → FolderControls-CmnB7Ap-.js} +1 -1
  73. package/dist/assets/{GatewayDetail-CCqekM1J.js → GatewayDetail-Duw9pJ10.js} +1 -1
  74. package/dist/assets/{GatewaysList-nFsRcszh.js → GatewaysList-BBhVGhRq.js} +1 -1
  75. package/dist/assets/{GitHubConnectionRecovery-B9sFWJup.js → GitHubConnectionRecovery-6VshLoNV.js} +1 -1
  76. package/dist/assets/{GoalDetail-BQ8y55P-.js → GoalDetail-CahntjlI.js} +1 -1
  77. package/dist/assets/{GoalTree-laRjXp0P.js → GoalTree-CU4GBFCh.js} +1 -1
  78. package/dist/assets/{Goals-Cm14EaeP.js → Goals-CzM2NDFR.js} +1 -1
  79. package/dist/assets/{InstanceAccess-DxQ-Akt_.js → InstanceAccess-CZzkE65W.js} +1 -1
  80. package/dist/assets/{InstanceExperimentalSettings-BxwqbXNw.js → InstanceExperimentalSettings-DWumKtOK.js} +1 -1
  81. package/dist/assets/{InviteLanding-Cf0L_u6s.js → InviteLanding-BIy2z50u.js} +1 -1
  82. package/dist/assets/{IssueChatLongThreadPerf-BfsF6FdF.js → IssueChatLongThreadPerf-D4DJvdOG.js} +1 -1
  83. package/dist/assets/{JoinRequestQueue-BXCdTFG_.js → JoinRequestQueue-C5rauGYm.js} +1 -1
  84. package/dist/assets/{Layout.production-CqzU0qMi.js → Layout.production-BSDWnupa.js} +1 -1
  85. package/dist/assets/{McpConnect-COWnZ9Eb.js → McpConnect-BN8ST0RS.js} +1 -1
  86. package/dist/assets/{MembershipAction-C9i9Sdmi.js → MembershipAction-DTjhGn-L.js} +1 -1
  87. package/dist/assets/{MetricCard-Bwnt3_p3.js → MetricCard-CeL9Pdn5.js} +1 -1
  88. package/dist/assets/{MissingPluginTabPlaceholder-B0Zxv1Kx.js → MissingPluginTabPlaceholder-CbQiSVnZ.js} +1 -1
  89. package/dist/assets/{NewAgent-BIlJ5Dyt.js → NewAgent-BszrNpQk.js} +1 -1
  90. package/dist/assets/{NewAgentDialog-CJdMxxYL.js → NewAgentDialog-U9qAcTzc.js} +1 -1
  91. package/dist/assets/{NewGoalDialog-B8izfKLm.js → NewGoalDialog-DqKbk4-i.js} +1 -1
  92. package/dist/assets/{NewProjectDialog-DXqjTYFK.js → NewProjectDialog-DrlUAF-N.js} +1 -1
  93. package/dist/assets/{OnboardingPrimitives-DHYBqn_0.js → OnboardingPrimitives-BkgPF4Mu.js} +1 -1
  94. package/dist/assets/{OnboardingWizard-DqSfZ13V.js → OnboardingWizard-CMBMcuXv.js} +1 -1
  95. package/dist/assets/{OrgChart.production-DrSFUf7i.js → OrgChart.production-BLczTjRj.js} +1 -1
  96. package/dist/assets/{PaperclipCloudOAuthHandoff-jPUvjJ8q.js → PaperclipCloudOAuthHandoff-BTtF8UPD.js} +1 -1
  97. package/dist/assets/{PluginManager-h3LFPaUq.js → PluginManager-CCcqlfgK.js} +1 -1
  98. package/dist/assets/{PluginPage-E5Im4454.js → PluginPage-B1empV69.js} +1 -1
  99. package/dist/assets/{PluginSettings-BBO0jAgo.js → PluginSettings-DtopaRqR.js} +1 -1
  100. package/dist/assets/{ProfileDetailRoute-CQBD7fms.js → ProfileDetailRoute-BqvVpBZi.js} +1 -1
  101. package/dist/assets/{ProfileSettings-BwnVEHLp.js → ProfileSettings-5__tVfGi.js} +1 -1
  102. package/dist/assets/{ProfileWizardRoute-By_SC6Gn.js → ProfileWizardRoute-vt-MRLuD.js} +1 -1
  103. package/dist/assets/{ProjectDetail-CbiwFBAE.js → ProjectDetail-DJ4zjube.js} +1 -1
  104. package/dist/assets/{ProjectRepositoryInput-DZF9bX4E.js → ProjectRepositoryInput-BJcnj3At.js} +1 -1
  105. package/dist/assets/{ProjectWorkspaceDetail-DPsl_4bD.js → ProjectWorkspaceDetail-DEAO3q6v.js} +1 -1
  106. package/dist/assets/{ProjectWorkspacesContent-COH4dOWK.js → ProjectWorkspacesContent-CZvO7p0i.js} +1 -1
  107. package/dist/assets/{Projects-Ch9Qu7sn.js → Projects-Dm7-zXUH.js} +1 -1
  108. package/dist/assets/{QuotaBar-DIFOT9Uh.js → QuotaBar-Drp3CaxX.js} +1 -1
  109. package/dist/assets/{RepositoryEditor-DHB1bqId.js → RepositoryEditor-BT_VAkJu.js} +1 -1
  110. package/dist/assets/{Responsibilities-C5O0JXXG.js → Responsibilities-DbUEtGZu.js} +1 -1
  111. package/dist/assets/{ResponsibilityDetail-D6NpZpkm.js → ResponsibilityDetail--S8_GOkb.js} +1 -1
  112. package/dist/assets/{ResponsibleUserDenialUxLab-CFrIWYwe.js → ResponsibleUserDenialUxLab-1PB3JNG0.js} +1 -1
  113. package/dist/assets/{ReviewQueueCard-BPC4Lm67.js → ReviewQueueCard-B8w9aXKU.js} +1 -1
  114. package/dist/assets/{RoutineAuditActivity-sKyzMajz.js → RoutineAuditActivity-BCo7pYe5.js} +1 -1
  115. package/dist/assets/{RoutineDetail-CG8HF5fp.js → RoutineDetail-C9Dwn5G9.js} +1 -1
  116. package/dist/assets/{RoutineRunVariablesDialog-CKh3CmLD.js → RoutineRunVariablesDialog-Baomcbe3.js} +1 -1
  117. package/dist/assets/{Routines-tF2qfUKo.js → Routines-Dkv4gJno.js} +1 -1
  118. package/dist/assets/{Routines.production-BTyj1Ljr.js → Routines.production-Cs2Y-lpt.js} +1 -1
  119. package/dist/assets/{RoutinesToolbar-CvUFVCGN.js → RoutinesToolbar-BNKfCrTo.js} +1 -1
  120. package/dist/assets/{Search-Z9D0NuS1.js → Search-CVx4cl2o.js} +1 -1
  121. package/dist/assets/{Secrets-DgmbLOJK.js → Secrets-C2qv2HKZ.js} +1 -1
  122. package/dist/assets/{SkillBinaryFile-F3_9qcaM.js → SkillBinaryFile-DDkhLlfC.js} +1 -1
  123. package/dist/assets/{SkillCardIcon-CXHUCMej.js → SkillCardIcon-Cp_hws0N.js} +1 -1
  124. package/dist/assets/{SkillFolderTree-CB3lrTIE.js → SkillFolderTree-Cv0CmfYx.js} +1 -1
  125. package/dist/assets/{SkillSourceTree-BbuciCo6.js → SkillSourceTree-DmjlUswf.js} +1 -1
  126. package/dist/assets/{SkillSources-Dlo6Cew3.js → SkillSources-nmlYypUU.js} +1 -1
  127. package/dist/assets/{SkillStudio-ZO-Nf7eI.js → SkillStudio-BK3y_3zr.js} +1 -1
  128. package/dist/assets/{SkillsNavigationTabs-B9Iqnlqt.js → SkillsNavigationTabs-DRwMP1eu.js} +1 -1
  129. package/dist/assets/{SpekoPhoneCallback-C4VnMiZh.js → SpekoPhoneCallback-Cqi7AIyH.js} +1 -1
  130. package/dist/assets/{SpekoProviderSetup-I4evPZb3.js → SpekoProviderSetup-CJI4oXk5.js} +1 -1
  131. package/dist/assets/{StatusCards-D0MVzbsw.js → StatusCards-DKyyY81S.js} +1 -1
  132. package/dist/assets/{SummarySlotCard-DUXgZPxG.js → SummarySlotCard-f3RomdZS.js} +1 -1
  133. package/dist/assets/{TailscaleConnector-CMhT73gj.js → TailscaleConnector-yQWLR1Ra.js} +1 -1
  134. package/dist/assets/{TaskChatLab-D9-KAE-7.js → TaskChatLab-Dsr7eyj4.js} +1 -1
  135. package/dist/assets/{TaskSummaryList-CUxieFNe.js → TaskSummaryList-eFDfK_QH.js} +1 -1
  136. package/dist/assets/{Timeline-BNMoRbtK.js → Timeline-BWA9dyk6.js} +1 -1
  137. package/dist/assets/{ToolsAdminGate-CEr0zy2T.js → ToolsAdminGate-DpBg30hQ.js} +1 -1
  138. package/dist/assets/{TrustPresetSection-B9YXZtkh.js → TrustPresetSection-DtWjK9Kp.js} +1 -1
  139. package/dist/assets/{UserProfile-D-tnW96X.js → UserProfile-C66UI5xx.js} +1 -1
  140. package/dist/assets/{WebhookUrlWarning-Ba_DixKh.js → WebhookUrlWarning-CDygVnDH.js} +1 -1
  141. package/dist/assets/{WhatNeedsMe-B-Jzj8_M.js → WhatNeedsMe-BQ82RHus.js} +1 -1
  142. package/dist/assets/{Workspaces-BqhDI_Bl.js → Workspaces-DrjJes30.js} +1 -1
  143. package/dist/assets/{abnfDiagram-YUKMZFIV-Bn9P-nUW.js → abnfDiagram-YUKMZFIV-Crkksu2D.js} +1 -1
  144. package/dist/assets/{architecture-WOLXFQ4H-V1ldsZlt.js → architecture-WOLXFQ4H-bHU8FW0c.js} +1 -1
  145. package/dist/assets/{architectureDiagram-47P4ROYG-BkYxt-Gc.js → architectureDiagram-47P4ROYG-Bj5Styf9.js} +1 -1
  146. package/dist/assets/{arrow-down-left-o81ENfeW.js → arrow-down-left-Ck9VQyqQ.js} +1 -1
  147. package/dist/assets/{blockDiagram-E7TT5TSB-BO7pPYbp.js → blockDiagram-E7TT5TSB-OeHpNCQ-.js} +1 -1
  148. package/dist/assets/{budgets-0Dw6TH1A.js → budgets-CAWPqcn4.js} +1 -1
  149. package/dist/assets/{building-complex-DciZTnys.js → building-complex-Dxiyk_pH.js} +1 -1
  150. package/dist/assets/{c4Diagram-CRA5TL53-D4EpmmzV.js → c4Diagram-CRA5TL53-QbK5p76P.js} +1 -1
  151. package/dist/assets/channel-BSmZkKA8.js +1 -0
  152. package/dist/assets/{chat-channels-DWyry-9M.js → chat-channels-CzTZV2fr.js} +1 -1
  153. package/dist/assets/{chunk-2BW5OAIV-DFXIyCJy.js → chunk-2BW5OAIV-Ckr4HfBO.js} +1 -1
  154. package/dist/assets/{chunk-3YJQHVM4-Dj5wEKIw.js → chunk-3YJQHVM4-C_uoPpLR.js} +1 -1
  155. package/dist/assets/{chunk-4EA7E6EY-5XiUVgzK.js → chunk-4EA7E6EY-BeMEfIRS.js} +1 -1
  156. package/dist/assets/{chunk-7TKQ45FW-D0opKcsy.js → chunk-7TKQ45FW-DiwqWHvN.js} +1 -1
  157. package/dist/assets/{chunk-AW2ZBBNX-DnjsTe04.js → chunk-AW2ZBBNX-Cf57K3PO.js} +1 -1
  158. package/dist/assets/{chunk-DBDB3WZW-DNqSQPZ0.js → chunk-DBDB3WZW-B2qouVQO.js} +1 -1
  159. package/dist/assets/{chunk-E2ZNV5FY-cjSf_BTz.js → chunk-E2ZNV5FY-DG8wQ_NS.js} +1 -1
  160. package/dist/assets/{chunk-EU5HNXII-CZYBiaSw.js → chunk-EU5HNXII-cxRrXRGV.js} +1 -1
  161. package/dist/assets/{chunk-FVRAUYC3-DSc0-wJA.js → chunk-FVRAUYC3-Dizswk0V.js} +1 -1
  162. package/dist/assets/{chunk-HJ2JQQFS-MXK0gYSP.js → chunk-HJ2JQQFS-DL4lnpSv.js} +1 -1
  163. package/dist/assets/{chunk-HTAEGDNF-BjDZm_5k.js → chunk-HTAEGDNF-Zxjdb6kj.js} +1 -1
  164. package/dist/assets/{chunk-KQW6MTUR-Bfj0tDmO.js → chunk-KQW6MTUR-BsVaJdnu.js} +1 -1
  165. package/dist/assets/{chunk-NTY3LDVX-Bpz5TkVb.js → chunk-NTY3LDVX-DyT9N5sM.js} +1 -1
  166. package/dist/assets/{chunk-VPRB5NB3-CfeHjtbb.js → chunk-VPRB5NB3-BNz5CtBn.js} +1 -1
  167. package/dist/assets/{chunk-XC4XBNZT-FBCWmi6K.js → chunk-XC4XBNZT-CCgIhjYS.js} +1 -1
  168. package/dist/assets/{circle-slash-DqKFFqfb.js → circle-slash-uNv_ha0X.js} +1 -1
  169. package/dist/assets/{classDiagram-v2-K4WV4PDN-DbC_J0kK.js → classDiagram-v2-K4WV4PDN-Cdh3CEl4.js} +1 -1
  170. package/dist/assets/{coins-BztUbqyl.js → coins-BDAh8hDQ.js} +1 -1
  171. package/dist/assets/{collections-BxrcELwt.js → collections-B58p51lw.js} +1 -1
  172. package/dist/assets/{connection-owner-D-ikSHyR.js → connection-owner-D8fNrFqC.js} +1 -1
  173. package/dist/assets/{cynefin-EF2NZ3EQ-COwSJ4qP.js → cynefin-EF2NZ3EQ-BkwhfqJ0.js} +1 -1
  174. package/dist/assets/{cynefinDiagram-3GCD6N5R-diaEJq9Y.js → cynefinDiagram-3GCD6N5R-DuGb_wq2.js} +1 -1
  175. package/dist/assets/{dagre-W4DXFKR2-BPAMRuIj.js → dagre-W4DXFKR2-Bxq_Mhia.js} +1 -1
  176. package/dist/assets/{diagram-2UJZ2QOL-BvRnO1Id.js → diagram-2UJZ2QOL-B-P_hrXV.js} +1 -1
  177. package/dist/assets/{diagram-OVF4WLC6-CDgBeD0m.js → diagram-OVF4WLC6-Ds0BqQWH.js} +1 -1
  178. package/dist/assets/{diagram-PFPMY2P6-DAw9lREG.js → diagram-PFPMY2P6-Dpqb2-Cb.js} +1 -1
  179. package/dist/assets/{diagram-UMYRVEAY-ZQqQn22t.js → diagram-UMYRVEAY-BJSoxjiu.js} +1 -1
  180. package/dist/assets/{diagram-YEKJPTXX-CoJtGgWs.js → diagram-YEKJPTXX-BxaG_9tT.js} +1 -1
  181. package/dist/assets/{diagram-ZIFT7M5P-qW_Zn_bO.js → diagram-ZIFT7M5P-6acvVOtc.js} +1 -1
  182. package/dist/assets/{dist-B2E6oBK1.js → dist-0EWXio4m.js} +1 -1
  183. package/dist/assets/{dist-IcdxEhjC.js → dist-BGvZP_Cl.js} +1 -1
  184. package/dist/assets/{dist-DXjkgaZX.js → dist-BZ7AbEhN.js} +1 -1
  185. package/dist/assets/{dist-_EtfntKJ.js → dist-BlosHr86.js} +1 -1
  186. package/dist/assets/{dist-DylHAy-6.js → dist-Bmr4uhSk.js} +1 -1
  187. package/dist/assets/{dist-DML0cJH3.js → dist-C6yMfMNS.js} +1 -1
  188. package/dist/assets/{dist-Dl94YqeS.js → dist-CMZQedYl.js} +1 -1
  189. package/dist/assets/{dist-DKyBHaH2.js → dist-C_N_-eaT.js} +1 -1
  190. package/dist/assets/{dist-CvRpZH53.js → dist-CaUbG4Hl.js} +1 -1
  191. package/dist/assets/{dist-ptDa9fKh.js → dist-Cn7-nxjU.js} +1 -1
  192. package/dist/assets/{dist-CG-phytt.js → dist-Cnj95_pX.js} +1 -1
  193. package/dist/assets/{dist-DbXGl-wj.js → dist-D9DR7k9k.js} +1 -1
  194. package/dist/assets/{dist-CjRqeLFz.js → dist-DIwsVdS2.js} +1 -1
  195. package/dist/assets/{dist-BCJybC91.js → dist-DVE0lLId.js} +1 -1
  196. package/dist/assets/{dist-CPgRB-NQ.js → dist-DkAPL4CQ.js} +1 -1
  197. package/dist/assets/{dist-CeSzCyeG.js → dist-Dl6N3kpQ.js} +1 -1
  198. package/dist/assets/{dist-DZruZxAk.js → dist-DmBvXBzK.js} +1 -1
  199. package/dist/assets/{dist-CdmdXwCZ.js → dist-DpgXK0aZ.js} +1 -1
  200. package/dist/assets/{dist-CYRzGbSY.js → dist-gMRyU9GJ.js} +1 -1
  201. package/dist/assets/{dist-CG6fC1Db.js → dist-jQQX2kOU.js} +1 -1
  202. package/dist/assets/{dist-DZIxMHOT.js → dist-lUaUoFTq.js} +1 -1
  203. package/dist/assets/{dist-CuwPDbnL.js → dist-qw1ZF2vD.js} +1 -1
  204. package/dist/assets/{dist-B6Qde8KJ.js → dist-rH4qrNAn.js} +1 -1
  205. package/dist/assets/{ebnfDiagram-VR2GEFS7-DA4UvKXV.js → ebnfDiagram-VR2GEFS7-Ytj3Z5qC.js} +1 -1
  206. package/dist/assets/{elk-IJKZMXRS-CM74d3mJ.js → elk-IJKZMXRS-CJurNqqK.js} +1 -1
  207. package/dist/assets/{erDiagram-O2IAPWRE-d869V0qL.js → erDiagram-O2IAPWRE-hyXckW2d.js} +1 -1
  208. package/dist/assets/{eventmodeling-K75KTNOO-C-oz_eyI.js → eventmodeling-K75KTNOO-D3xQujrh.js} +1 -1
  209. package/dist/assets/flowDiagram-OXPTDLAJ-D4ojBTuY.js +1 -0
  210. package/dist/assets/{folder-plus-CxWXoYCi.js → folder-plus-BJZSMzuj.js} +1 -1
  211. package/dist/assets/{ganttDiagram-R7TSEDQI-BBul4Kpm.js → ganttDiagram-R7TSEDQI-C8U_ITl4.js} +1 -1
  212. package/dist/assets/{gitGraph-VSP46ZUC-BriEZgAq.js → gitGraph-VSP46ZUC-CDeq3yKT.js} +1 -1
  213. package/dist/assets/{gitGraphDiagram-XJZIOB7I-I12rg8s1.js → gitGraphDiagram-XJZIOB7I-CST3EWE9.js} +1 -1
  214. package/dist/assets/{goals-CvMWzjH4.js → goals-BNJZ4nzg.js} +1 -1
  215. package/dist/assets/{index-Bt31d8ga.js → index-BJtnP7H1.js} +8 -8
  216. package/dist/assets/{info-OHQRW6UA-CxrcGiem.js → info-OHQRW6UA-CPvTWk7J.js} +1 -1
  217. package/dist/assets/{infoDiagram-5W2HQ5XZ-4Sm0LiOu.js → infoDiagram-5W2HQ5XZ-BPUiNdxI.js} +1 -1
  218. package/dist/assets/{ishikawaDiagram-K3B6WC7H-CKXvKV-s.js → ishikawaDiagram-K3B6WC7H-D5Z3rmaA.js} +1 -1
  219. package/dist/assets/{issue-detail-4PCbYpdv.js → issue-detail-CZfjXs0M.js} +3 -3
  220. package/dist/assets/{journeyDiagram-COXZFDF6-BHsrZLvQ.js → journeyDiagram-COXZFDF6-CEkwEYdR.js} +1 -1
  221. package/dist/assets/{kanban-definition-P3RFRI5V-8HhnIs_l.js → kanban-definition-P3RFRI5V-8h_R6Qjq.js} +1 -1
  222. package/dist/assets/{line-rrKrpB-b.js → line-Ljt_vfsb.js} +1 -1
  223. package/dist/assets/{link-BecLzmfo.js → link-DvgFK0mz.js} +1 -1
  224. package/dist/assets/{list-filter-BC3D4IoX.js → list-filter-BR4_dvwm.js} +1 -1
  225. package/dist/assets/{log-in-BJCGwGGT.js → log-in-Dvx9-FMC.js} +1 -1
  226. package/dist/assets/{mcpSkills-DRs3pGKn.js → mcpSkills-76szK_k1.js} +1 -1
  227. package/dist/assets/{mermaid-parser.core-DmG0b4S0.js → mermaid-parser.core-BjFu937m.js} +3 -3
  228. package/dist/assets/{mermaid.core-D1vILTuF.js → mermaid.core-B0t95EIS.js} +4 -4
  229. package/dist/assets/{mindmap-definition-LZFPQGKD-DIMpL0de.js → mindmap-definition-LZFPQGKD-TVnHYUR4.js} +1 -1
  230. package/dist/assets/{packet-JDAUHWVQ-BnbYht3G.js → packet-JDAUHWVQ-aNGiRWLy.js} +1 -1
  231. package/dist/assets/{pegDiagram-BGZESJAR-BUjtJVjT.js → pegDiagram-BGZESJAR-DDadxqWQ.js} +1 -1
  232. package/dist/assets/{pie-XZMESJXO-CM4VXUb-.js → pie-XZMESJXO-CydFP1hd.js} +1 -1
  233. package/dist/assets/{pieDiagram-CAPJLFHJ-B3v8ryvG.js → pieDiagram-CAPJLFHJ-KhdUDwDS.js} +1 -1
  234. package/dist/assets/{power-0mw59G-l.js → power-sYV-WuqQ.js} +1 -1
  235. package/dist/assets/{profile-summary-B5rPf8v-.js → profile-summary-D4LPX-Dv.js} +1 -1
  236. package/dist/assets/{quadrantDiagram-GDMTTRAM-Cv-dS2Rn.js → quadrantDiagram-GDMTTRAM-B1X8K2Fs.js} +1 -1
  237. package/dist/assets/{radar-ABXABTNO-v6yZj4Fk.js → radar-ABXABTNO-BqodkLpx.js} +1 -1
  238. package/dist/assets/{railroad-I3PHUGI6-D-U8Cs0m.js → railroad-I3PHUGI6-HmRKXDJj.js} +1 -1
  239. package/dist/assets/{railroad-abnf-LNEFI6M7-Dw3fkrVy.js → railroad-abnf-LNEFI6M7-CkBttaHp.js} +1 -1
  240. package/dist/assets/{railroad-ebnf-DWYD2UWJ-_ln-e3Tx.js → railroad-ebnf-DWYD2UWJ-C6DBawFA.js} +1 -1
  241. package/dist/assets/{railroad-peg-JR7BVNR7-Bf8u1-RZ.js → railroad-peg-JR7BVNR7-Z9df3u5o.js} +1 -1
  242. package/dist/assets/{railroadDiagram-SM67HX2B-Drr5UhQI.js → railroadDiagram-SM67HX2B-2vDUUppL.js} +1 -1
  243. package/dist/assets/{requirementDiagram-X7JNWC4A-D5ef6_ac.js → requirementDiagram-X7JNWC4A-DAuP39Hc.js} +1 -1
  244. package/dist/assets/{sankeyDiagram-UM26HJRW-DncJWIz_.js → sankeyDiagram-UM26HJRW-ByS54QZK.js} +1 -1
  245. package/dist/assets/{saved-permissions-CizWg8-P.js → saved-permissions-CPiYtxkZ.js} +1 -1
  246. package/dist/assets/{scroll-text-Ck6HB7eM.js → scroll-text-CVSt6aO2.js} +1 -1
  247. package/dist/assets/{sdk-CWyUlmcn.js → sdk-vrG4HtB4.js} +1 -1
  248. package/dist/assets/{search-DkTqg7ab.js → search-CG-QtPVH.js} +1 -1
  249. package/dist/assets/{send-CYVi50sh.js → send-CH-0xdLm.js} +1 -1
  250. package/dist/assets/{sequenceDiagram-ZO4K6R2Y-Cs0nGCCg.js → sequenceDiagram-ZO4K6R2Y-DvWxKTLK.js} +1 -1
  251. package/dist/assets/{shared-CIwISWMj.js → shared-D37zfckm.js} +1 -1
  252. package/dist/assets/{smoke-lab-matrix-A7ubFpfk.js → smoke-lab-matrix-C5gR81E3.js} +1 -1
  253. package/dist/assets/{stateDiagram-v2-TBUQTH76-Dpp3m5Wq.js → stateDiagram-v2-TBUQTH76-DtiiZIXq.js} +1 -1
  254. package/dist/assets/{swimlanes-N4OXWK64-NXVbx1w8.js → swimlanes-N4OXWK64-BWSEtCbX.js} +1 -1
  255. package/dist/assets/swimlanesDiagram-K3J5GTZL-Bl_9DvHU.js +8 -0
  256. package/dist/assets/{timeline-definition-YOQAKGHF-DqI-Mv2e.js → timeline-definition-YOQAKGHF-U4QcniMh.js} +1 -1
  257. package/dist/assets/{treeView-D4JQ5SDB-CZBlE7ya.js → treeView-D4JQ5SDB-B2tdrtsj.js} +1 -1
  258. package/dist/assets/{treemap-SAJKECNS-BlueznID.js → treemap-SAJKECNS-DodN8j4n.js} +1 -1
  259. package/dist/assets/{useAgentlessOnboardingAutoOpen-CnFwEQ-H.js → useAgentlessOnboardingAutoOpen-DSWW7Juw.js} +1 -1
  260. package/dist/assets/{useAuthorizationWindow-DnFQsiFj.js → useAuthorizationWindow-tg3aKEU7.js} +1 -1
  261. package/dist/assets/{useDateRange-9EbqkWXy.js → useDateRange-CnZQr2KO.js} +1 -1
  262. package/dist/assets/{useFastResponsesEnabled-D8dunm4j.js → useFastResponsesEnabled-B8tHSJ1y.js} +1 -1
  263. package/dist/assets/{usePageView-BiX5i8ck.js → usePageView-CtFMs34g.js} +1 -1
  264. package/dist/assets/{useProfilesData-0VYQ4lAT.js → useProfilesData-CWHdMSuL.js} +1 -1
  265. package/dist/assets/{useReviewCount-WBWxwKI3.js → useReviewCount-W_bCZ2Hz.js} +1 -1
  266. package/dist/assets/{useRoutineFormOptions-DnX5DBn1.js → useRoutineFormOptions-CCLMmVSF.js} +1 -1
  267. package/dist/assets/{useSummaryDraftStream-DPQRvaXT.js → useSummaryDraftStream-NVNYNt72.js} +1 -1
  268. package/dist/assets/{useTailscaleConnections-BDff6dWx.js → useTailscaleConnections-Dy52nCY3.js} +1 -1
  269. package/dist/assets/{usecaseDiagram-VIAY4XPW-BSDn8OaJ.js → usecaseDiagram-VIAY4XPW-kEHhqgOj.js} +1 -1
  270. package/dist/assets/{vennDiagram-BLWOH2XV-BBSA9KNN.js → vennDiagram-BLWOH2XV-NPJU0aCU.js} +1 -1
  271. package/dist/assets/{wardley-7MLQ67FV-CsT-rTZ9.js → wardley-7MLQ67FV-bUGKvIPT.js} +1 -1
  272. package/dist/assets/{wardleyDiagram-YMQ3BMBF-BLClsIjw.js → wardleyDiagram-YMQ3BMBF-qtUDHfhb.js} +1 -1
  273. package/dist/assets/{xychartDiagram-TAQBALBS-2x4wB0gq.js → xychartDiagram-TAQBALBS-C-z57aZj.js} +1 -1
  274. package/dist/index.html +4 -4
  275. package/dist/sw.js +1 -1
  276. package/package.json +1 -1
  277. package/dist/assets/CompanyActivity.production-DbaFBsM0.js +0 -1
  278. package/dist/assets/channel-BQh2vFIU.js +0 -1
  279. package/dist/assets/flowDiagram-OXPTDLAJ-Be1xLbJu.js +0 -1
  280. package/dist/assets/swimlanesDiagram-K3J5GTZL-Ct3LnXZt.js +0 -8
@@ -1 +1 @@
1
- var is=Object.defineProperty;var a=(t,s)=>is(t,"name",{value:s,configurable:!0});import{a as mt}from"./rolldown-runtime-DhZMWcEn.js";import{Bi as os,Bn as me,Dr as ds,En as _,Fn as ht,Fr as cs,In as us,Ir as Xe,It as xs,Jn as ms,Kt as hs,Li as gs,Ln as $e,Mn as fs,Nn as ps,Nr as js,Pn as gt,Pt as vs,Ri as bs,Rn as Ns,Sr as ks,Un as Ze,Vi as ws,Vn as Me,dr as ys,er as ft,et as Ae,fr as pt,gr as Ss,jn as Cs,jt as As,kr as jt,nr as Je,pr as vt,qt as bt,rr as Ts,ur as Rs,wn as Nt,wr as Is,xr as Ds,yr as kt,zi as Es,zn as et,zt as Ps}from"./issue-detail-4PCbYpdv.js";import{A as Fs,D as $s,E as tt,G as Ms,H as _s,K as Ls,L as zs,U as _e,V as fe,W as qs,X as Os,Z as Us,_ as Bs,a as Hs,at as Ks,b as Vs,d as Ws,dt as Qs,et as Ys,ft as Gs,g as Te,h as Xs,i as Zs,lt as Js,n as ea,o as ta,p as sa,pt as aa,q as na,r as ra,s as st,t as la,ut as ia,y as oa}from"./usePageView-BiX5i8ck.js";import{b as at}from"./collections-BxrcELwt.js";import{$A as da,Bb as ca,Cm as ua,Cv as wt,Cx as xa,Db as yt,ET as ma,E_ as q,Eb as St,Ek as Ct,Ev as U,Ex as ha,FE as ga,GS as R,Gb as M,Gw as fa,LS as pa,ME as V,NE as b,Ob as At,QE as Le,Sb as Tt,Sm as ja,Tb as Rt,Tv as It,Tx as va,UT as ba,Um as Dt,Up as Et,VC as Pt,Vp as Ft,Wm as Na,XC as Re,YS as ka,Yb as $t,Yw as wa,__ as Mt,_v as P,_w as ee,aC as ya,aE as Sa,ab as ae,bE as L,bm as Ca,bv as J,cb as Aa,cs as Ta,cw as te,dy as _t,eD as Ie,fy as ze,hE as E,hv as B,iC as Lt,iS as Ra,ib as Ia,jT as zt,jb as qt,kb as Ot,lS as Da,ly as qe,my as Oe,nT as pe,nj as Ea,pE as Pa,pb as Fa,pv as H,qC as ne,sw as $a,sy as Ue,uE as Ma,ub as je,uy as Be,vv as he,wC as nt,wb as Ut,wm as _a,wv as Bt,wx as La,xE as z,x_ as za,xv as ge,ym as qa,yv as Ht,zE as $}from"./index-Bt31d8ga.js";import{n as Oa}from"./NewProjectDialog-DXqjTYFK.js";import{t as Ua}from"./SkillCardIcon-CXHUCMej.js";import{t as Ne}from"./EntityRow-gpsOgEtu.js";import{r as He}from"./company-skill-routes-D5LJ1l8M.js";var g=mt(Ea(),1),e=mt(da(),1),Ba={behind:"behind",at_risk:"at_risk",on_track:"on_track",unknown:"not_measured"};function Ha(t,s=!0){return z({queryKey:R.responsibilities.statusReport(t),queryFn:a(()=>_.statusReport(t),"queryFn"),enabled:s,staleTime:3e4})}a(Ha,"useResponsibilityStatusReport");function Ka(t,s,n,r){return`Written by ${t.agentId?s.get(t.agentId)?.name??"an agent":t.userId?t.userId===r?"the owner":"a teammate":"an agent no longer here"} · ${pt(t.writtenAt,n)}`}a(Ka,"describeStatusAuthor");function Kt({responsibility:t,agentsById:s,now:n,editable:r,className:l}){const i=V(),c=Ha(t.id,t.status==="active"),d=L({mutationFn:a(()=>_.requestStatusUpdate(t.id),"mutationFn"),onSuccess:a(k=>i.setQueryData(R.responsibilities.statusReport(t.id),k),"onSuccess")}),{rollup:h}=t,m=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{children:(0,e.jsx)(me,{health:h.health,overridden:h.healthOverridden})}),(0,e.jsx)("p",{className:"text-sm text-foreground","data-status-sentence":"",children:h.statusSentence})]}),x=c.data?.current??null;if(!x)return(0,e.jsx)("div",{className:$("flex flex-col gap-1.5",l),children:m});const f=c.data?.reporterAgentId??x.agentId,j=f?s.get(f)?.name??"the agent":null,w=c.data?.updateRequested??!1;return(0,e.jsxs)("div",{className:$("flex flex-col gap-3",l),children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-agent-status":"",children:[(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,e.jsx)(me,{health:Ba[x.status],label:aa[x.status]})}),(0,e.jsx)("p",{className:"text-sm text-foreground","data-agent-status-message":"",children:x.message}),(0,e.jsxs)("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{children:Ka(x,s,n,t.ownerUserId)}),x.outOfDate?(0,e.jsx)(Me,{label:"Out of date"}):null]}),r&&j?(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxs)(b,{type:"button",size:"xs",variant:"ghost",className:"w-fit text-muted-foreground",disabled:w||d.isPending,onClick:a(()=>d.mutate(),"onClick"),"data-ask-for-update":"",children:[d.isPending?(0,e.jsx)(ee,{"aria-hidden":"true",className:"animate-spin"}):(0,e.jsx)(te,{"aria-hidden":"true"}),w?`Asked ${j} for an update`:`Ask ${j} for an update`]}),d.error?(0,e.jsxs)("p",{role:"alert",className:"text-xs text-destructive",children:["Couldn’t ask. ",E(d.error).body]}):null]}):null]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5 border-t border-border pt-3","data-derived-status":"",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"From the number"}),m]})]})}a(Kt,"ResponsibilityStatusBlock");function Ke(t){const s=V();return L({mutationFn:a(n=>_.update(t,n),"mutationFn"),onSuccess:a(n=>{s.setQueriesData({queryKey:R.responsibilities.detail(t)},r=>r&&{...r,...n}),s.invalidateQueries({queryKey:R.responsibilities.all})},"onSuccess")})}a(Ke,"useUpdateResponsibility");function Va(t,s){const n=z({queryKey:R.auth.session,queryFn:a(()=>ka.getSession(),"queryFn")}),r=z({queryKey:[...R.responsibilities.activity(t.id),t.metricUpdatedAt?String(t.metricUpdatedAt):null],queryFn:a(()=>Ra.list(t.companyId,{entityType:"responsibility",entityId:t.id,limit:50}),"queryFn"),enabled:!!t.metricUpdatedAt,staleTime:6e4}),l=Ds(r.data??[],t.metricUpdatedAt);return l?l.actorType==="agent"?s.get(l.actorId)?.name??"an agent":l.actorType==="user"?n.data?.user?.id&&l.actorId===n.data.user.id?"you":l.actorId===t.ownerUserId?"the owner":"a teammate":null:null}a(Va,"useReadingAuthor");function Vt({responsibility:t}){const s=(0,g.useId)(),n=Ke(t.id),[r,l]=(0,g.useState)(""),[i,c]=(0,g.useState)(null),d=ds(r),h=a((j,w)=>{n.isPending||n.mutate({metricCurrent:j},{onSuccess:a(()=>{w?.(),c("Recorded.")},"onSuccess")})},"record"),m=n.error?(0,e.jsxs)("p",{role:"alert",className:"text-xs text-destructive",children:["Couldn’t record it. ",E(n.error).body]}):null;if(t.metricKind==="yes_no")return(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",role:"group","aria-label":"Record a new reading",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Is it true today?"}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(b,{type:"button",size:"sm",variant:"outline",disabled:n.isPending,onClick:a(()=>h(!0),"onClick"),children:"Yes"}),(0,e.jsx)(b,{type:"button",size:"sm",variant:"outline",disabled:n.isPending,onClick:a(()=>h(!1),"onClick"),children:"No"})]}),i?(0,e.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:i}):null,m]});const x=a(j=>{j.preventDefault(),typeof d=="number"&&h(d,()=>l(""))},"submit"),f=t.metricKind==="percentage"?"%":t.metricUnit?.trim();return(0,e.jsxs)("form",{className:"flex flex-col gap-1.5",onSubmit:x,"aria-label":"Record a new reading",children:[(0,e.jsxs)("label",{htmlFor:s,className:"text-xs text-muted-foreground",children:["New reading",f?` (${f})`:""]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(Mt,{id:s,inputMode:"decimal",value:r,placeholder:t.metricCurrent===null?"e.g. 9":String(t.metricCurrent),className:"max-w-40","aria-invalid":d==="invalid"||void 0,onChange:a(j=>{l(j.target.value),c(null)},"onChange")}),(0,e.jsx)(b,{type:"submit",size:"sm",variant:"outline",disabled:typeof d!="number"||n.isPending,children:n.isPending?"Saving…":"Record"})]}),d==="invalid"?(0,e.jsx)("p",{className:"text-xs text-destructive",children:"Enter a number"}):null,i?(0,e.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:i}):null,m]})}a(Vt,"RecordReading");function Wt({responsibility:t,open:s,onOpenChange:n}){const r=Ke(t.id),[l,i]=(0,g.useState)(()=>Je(t)),[c,d]=(0,g.useState)(!1),h=r.reset;(0,g.useEffect)(()=>{s&&(i(Je(t)),d(!1),h())},[s,h]);const m=cs(l),x=new Set([...c&&!m.ok?m.missing:[],...Is(r.error)]),f=new Set(c&&!m.ok?m.invalid:[]),j=c&&!m.ok?m.problems:void 0,w=a(k=>{k.preventDefault(),d(!0),!(!m.ok||r.isPending)&&r.mutate(Ts(m.value),{onSuccess:a(()=>n(!1),"onSuccess")})},"submit");return(0,e.jsx)(Ue,{open:s,onOpenChange:n,children:(0,e.jsx)(qe,{className:"sm:max-w-xl",children:(0,e.jsxs)("form",{className:"flex flex-col gap-5",onSubmit:w,noValidate:!0,children:[(0,e.jsxs)(ze,{children:[(0,e.jsx)(Oe,{children:t.standard?.trim()?"Edit the bar":"Set the bar"}),(0,e.jsxs)(Be,{children:["How is success measured for ",t.title,"? The status follows from the reading, by the kind of measure you choose."]})]}),(0,e.jsx)(Gs,{draft:l,onChange:i,missing:x,invalid:f,problems:j}),r.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t save the bar. ",E(r.error).body]}):null,(0,e.jsxs)(_t,{className:"items-center sm:justify-between",children:[(0,e.jsx)(b,{type:"button",variant:"ghost",onClick:a(()=>n(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(b,{type:"submit",disabled:r.isPending,children:r.isPending?"Saving…":"Save the bar"})]})]})})})}a(Wt,"EditBarDialog");function Ve(t,s){const n=V(),r=$t(),l=z({queryKey:R.responsibilities.barConversation(t.id),queryFn:a(()=>Xe.conversation(t.id),"queryFn"),enabled:s}),i=L({mutationFn:a(()=>Xe.start(t.id),"mutationFn"),onSuccess:a(m=>{n.setQueryData(R.responsibilities.barConversation(t.id),m),m.conversation&&r(`/issues/${m.conversation.identifier??m.conversation.issueId}`)},"onSuccess")}),c=je(l),d=l.data??null,h=d?.state==="discussing"||d?.state==="proposal_waiting";return{state:d,open:h,canTalk:!!d&&(h||d.defaultAgentId!==null),start:i,loadError:s&&c.kind==="error"?c.error:null,retry:c.retry,retrying:c.isFetching}}a(Ve,"useBarConversation");function Wa({responsibility:t,agentsById:s}){const n=t.status==="active"||t.status==="proposed",r=Ve(t,n);return!n||!r.state||!r.state.proposal&&r.state.state!=="discussing"?null:(0,e.jsx)(Qt,{state:r.state,agentsById:s})}a(Wa,"BarConversationStatus");function Qt({state:t,agentsById:s}){if(t.proposal)return(0,e.jsx)(Cs,{interaction:t.proposal,showConversationLink:!0,showResponsibilityLink:!1});if(t.state!=="discussing"||!t.conversation)return null;const n=t.conversation.agentId?s.get(t.conversation.agentId)?.name:null;return(0,e.jsxs)("p",{className:"flex flex-wrap items-center gap-x-2 text-sm text-muted-foreground","data-testid":"bar-conversation-open",children:[(0,e.jsx)(te,{"aria-hidden":!0,className:"h-4 w-4 shrink-0"}),(0,e.jsxs)("span",{children:["You are talking the bar through with ",n??"an agent","."]}),(0,e.jsx)(M,{to:`/issues/${t.conversation.identifier??t.conversation.issueId}`,className:"font-medium text-foreground underline-offset-4 hover:underline",children:"Open the conversation"})]})}a(Qt,"BarConversationNotice");function Qa({responsibility:t}){const s=Ke(t.id),n=t.healthOverride??"automatic",{rollup:r}=t;return(0,e.jsxs)("div",{className:"flex flex-col gap-2",children:[r.healthOverridden?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Set by hand.",r.computedHealth!==r.health?` From the number alone it is ${ms[r.computedHealth].toLowerCase()}.`:""]}),(0,e.jsx)(Ae,{value:t.healthNote??"",onSave:a(l=>s.mutateAsync({healthNote:l.trim()||null}),"onSave"),as:"p",className:"text-sm text-foreground",placeholder:"Why you set it (optional)",nullable:!0})]}):null,(0,e.jsxs)(H,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsxs)(b,{size:"xs",variant:"ghost",className:"w-fit text-muted-foreground",disabled:s.isPending,children:[r.healthOverridden?"Change or clear":"Set the status by hand",(0,e.jsx)(zt,{"aria-hidden":"true"})]})}),(0,e.jsxs)(B,{align:"start",children:[(0,e.jsx)(he,{children:"Status"}),(0,e.jsxs)(Ht,{value:n,onValueChange:a(l=>s.mutate({healthOverride:l==="automatic"?null:l}),"onValueChange"),children:[(0,e.jsx)(J,{value:"automatic",children:"From the number"}),(0,e.jsx)(J,{value:"behind",children:"Behind"}),(0,e.jsx)(J,{value:"at_risk",children:"At risk"}),(0,e.jsx)(J,{value:"on_track",children:"On track"})]})]})]}),s.error?(0,e.jsxs)("p",{role:"alert",className:"text-xs text-destructive",children:["Couldn’t change the status. ",E(s.error).body]}):null]})}a(Qa,"StatusOverride");function Ya({responsibility:t,agentsById:s,now:n,editable:r}){const l=(0,g.useId)(),[i,c]=(0,g.useState)(!1),d=Ve(t,r),h=!!t.standard?.trim(),{rollup:m}=t,x=Va(t,s),f=m.metric?.updatedAt??null;return(0,e.jsxs)(q,{id:"responsibility-bar",elevation:"low",className:"gap-5 px-5 py-5","aria-labelledby":l,children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,e.jsx)("h2",{id:l,className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"The bar"}),(0,e.jsx)("p",{className:"text-base text-foreground",children:t.standard?.trim()||(0,e.jsx)("span",{className:"text-muted-foreground",children:"No bar yet. How is success measured?"})})]}),r?(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:d.canTalk?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(b,{size:"sm",variant:"ghost",onClick:a(()=>c(!0),"onClick"),children:[(0,e.jsx)(Re,{"aria-hidden":"true"}),"Edit by hand"]}),(0,e.jsxs)(b,{size:"sm",variant:h?"outline":"default","data-bar-edit-primary":"",disabled:d.start.isPending,onClick:a(()=>d.start.mutate(),"onClick"),children:[d.start.isPending?(0,e.jsx)(ee,{"aria-hidden":"true",className:"animate-spin"}):(0,e.jsx)(te,{"aria-hidden":"true"}),d.open?"Continue the conversation":h?"Edit the bar":"Set the bar"]})]}):(0,e.jsxs)(b,{size:"sm",variant:"ghost","data-bar-edit-primary":"",onClick:a(()=>c(!0),"onClick"),children:[(0,e.jsx)(Re,{"aria-hidden":"true"}),h?"Edit the bar":"Set the bar"]})}):null]}),d.start.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t start the conversation. ",E(d.start.error).body," You can still edit the bar by hand."]}):null,d.loadError?(0,e.jsx)(ae,{error:d.loadError,size:"inline",action:"load the bar conversation",onRetry:d.retry,retrying:d.retrying}):null,r&&d.state?(0,e.jsx)(Qt,{state:d.state,agentsById:s}):null,(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-bar-status":"",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Status"}),(0,e.jsx)(Kt,{responsibility:t,agentsById:s,now:n,editable:r})]}),r?(0,e.jsx)(Qa,{responsibility:t}):null]}),(0,e.jsx)("div",{className:"border-t border-border pt-5","data-bar-metrics":"",children:(0,e.jsx)(ht,{responsibilityId:t.id,primary:m.metric,now:n,agentsById:s,layout:"grid",editable:r,fallback:(0,e.jsx)($e,{metric:m.metric,health:m.health,now:n,size:"hero",className:"max-w-sm"})})}),f||m.metric?(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:f?`Updated ${pt(f,n)}${x?` by ${x}`:""}.`:"No reading yet. The agents working on this keep the number current; you can record one too."}),r&&m.metric?(0,e.jsx)(Vt,{responsibility:t}):null]}):null,r?(0,e.jsx)(Wt,{responsibility:t,open:i,onOpenChange:c}):null]})}a(Ya,"ResponsibilityBarCard");var Ga={project:3,task:4,routine:3},Xa={project:"Projects",task:"Tasks",routine:"Routines"},Za={project:"No open projects.",task:"No open tasks.",routine:"No routines."},Ja={holding:"Holding the number back: ",moving:"Moving the number: ",neutral:""},De={holding:"text-(--status-task-icon-blocked)",moving:"text-(--status-task-icon-done)",neutral:"text-muted-foreground"};function Ee({bearing:t}){return t==="holding"?(0,e.jsx)(ma,{"aria-hidden":"true",className:"size-3.5 shrink-0"}):t==="moving"?(0,e.jsx)(ba,{"aria-hidden":"true",className:"size-3.5 shrink-0"}):null}a(Ee,"BearingIcon");function en({entry:t,automate:s}){const{item:n,bearing:r,reason:l}=t,i=s?.onByHand;return(0,e.jsxs)("li",{"data-work-kind":n.kind,"data-work-id":n.id,"data-bearing":r,"data-finished":t.finished?"true":void 0,className:i?"relative":void 0,children:[(0,e.jsxs)(M,{to:n.href,className:$("flex min-w-0 items-start gap-3 px-4 py-2 text-sm transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",i&&"pr-18"),children:[(0,e.jsx)("span",{className:"mt-0.5",children:(0,e.jsx)(na,{item:n,showLabel:!1})}),(0,e.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,e.jsxs)("span",{className:"flex min-w-0 items-baseline gap-2",children:[n.kind==="task"&&n.task.identifier?(0,e.jsx)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:n.task.identifier}):null,(0,e.jsx)("span",{className:$("line-clamp-1 text-foreground",t.finished&&"text-muted-foreground"),title:n.title,children:n.title})]}),(0,e.jsxs)("span",{className:$("flex min-w-0 items-center gap-1 text-xs",De[r]),"data-bearing-reason":"",children:[(0,e.jsx)(Ee,{bearing:r}),(0,e.jsxs)("span",{className:"line-clamp-1",title:l,children:[(0,e.jsx)("span",{className:"sr-only",children:Ja[r]}),l]})]})]})]}),s?(0,e.jsxs)("span",{className:"absolute right-3 top-2 flex items-center gap-0.5",children:[(0,e.jsx)(b,{type:"button",size:"icon-xs",variant:"ghost",className:"text-muted-foreground",disabled:s.busy,"aria-label":`${s.label}: “${n.title}”`,title:s.label,onClick:s.onTalk,"data-automate-with-agent":"",children:(0,e.jsx)($a,{"aria-hidden":"true"})}),(0,e.jsx)(b,{type:"button",size:"icon-xs",variant:"ghost",className:"text-muted-foreground","aria-label":`Set up “${n.title}” by hand`,title:"Set it up by hand",onClick:s.onByHand,"data-make-routine":"",children:(0,e.jsx)(ya,{"aria-hidden":"true"})})]}):null]})}a(en,"BearingRow");function ke({kind:t,items:s,total:n,automateFor:r}){const{shown:l}=Ys(s,Ga[t]),i=Math.max(0,n-l.length),c=`one-screen-${t}-heading`;return(0,e.jsx)("section",{"aria-labelledby":c,"data-work-list":t,children:(0,e.jsxs)(q,{elevation:"low",className:"gap-0 overflow-hidden py-0",children:[(0,e.jsxs)("h2",{id:c,className:"flex items-baseline gap-2 border-b border-border px-4 py-2 text-sm font-semibold text-foreground",children:[Xa[t]," ",(0,e.jsx)("span",{className:"text-xs font-normal tabular-nums text-muted-foreground",children:n})]}),l.length>0?(0,e.jsx)("ul",{className:"flex flex-col",children:l.map(d=>(0,e.jsx)(en,{entry:d,automate:r?.(d)},d.item.id))}):(0,e.jsx)("p",{className:"px-4 py-2 text-sm text-muted-foreground",children:Za[t]}),i>0?(0,e.jsxs)("p",{className:"border-t border-border px-4 py-1.5 text-xs text-muted-foreground",children:["and ",i," more"]}):null]})})}a(ke,"CappedList");function tn(){return(0,e.jsxs)("p",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground","data-bearing-key":"",children:[(0,e.jsxs)("span",{className:$("flex items-center gap-1",De.holding),children:[(0,e.jsx)(Ee,{bearing:"holding"}),"Holding the number back"]}),(0,e.jsxs)("span",{className:$("flex items-center gap-1",De.moving),children:[(0,e.jsx)(Ee,{bearing:"moving"}),"Moving it"]})]})}a(tn,"BearingKey");function sn({responsibility:t,companyId:s,agents:n,agentsById:r,now:l,notices:i,actions:c,onReviewProposal:d,onEditBar:h}){const{rollup:m}=t,x=z({queryKey:R.responsibilities.automation(s,t.ownerUserId),queryFn:a(()=>_.automation(s,{ownerUserId:t.ownerUserId}),"queryFn"),enabled:!!s&&t.status==="active"}).data?.responsibilities.find(v=>v.responsibilityId===t.id)??null,[f,j]=(0,g.useState)(null),w=(0,g.useCallback)(v=>r.get(v)?.name,[r]),k=Vs(),p=k.open,C=(0,g.useCallback)(v=>{if(v.item.kind!=="task"||!x?.manualTaskIds.includes(v.item.id))return;const{task:T}=v.item,N=x.candidates.find(ve=>ve.issueId===T.id),W=N?.responsibleAgentId??T.assigneeAgentId??null;return{label:Fs({conversation:N?.conversation??null,responsibleAgentId:W},w),busy:k.isPending,onTalk:a(()=>p({issueId:T.id,agentId:W,responsibilityId:t.id,conversation:N?.conversation??null}),"onTalk"),onByHand:a(()=>j({issueId:T.id,identifier:T.identifier,title:N?.pendingOffer?.title??T.title,assigneeAgentId:N?.pendingOffer?.agentId??W,suggestedCadence:N?.suggestedCadence??null,cadenceSource:N?.cadenceSource}),"onByHand")}},[x,w,k.isPending,p,t.id]),y=(0,g.useMemo)(()=>{const v=Qs(t,l,w);return{project:v.filter(T=>T.item.kind==="project"),task:v.filter(T=>T.item.kind==="task"),routine:v.filter(T=>T.item.kind==="routine")}},[t,l,w]),A=oa(t.id),F=t.standard?.trim(),D=y.task.filter(v=>!v.finished).length,u=y.task.length-D,S=[...y.project,...y.task,...y.routine].some(v=>v.bearing!=="neutral"),I=h&&t.status!=="dismissed";return(0,e.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-5","data-responsibility-view":"one_screen",children:[(0,e.jsx)(_e,{responsibility:t,actions:(0,e.jsx)(_s,{status:t.status,actions:c}),children:i}),t.status==="proposed"?(0,e.jsx)(fe,{count:1,subject:"this",onReview:d}):null,(0,e.jsx)(Wa,{responsibility:t,agentsById:r}),(0,e.jsxs)("div",{className:"grid gap-5 lg:grid-cols-5",children:[(0,e.jsxs)(q,{id:"responsibility-bar-summary",elevation:"low",className:"h-fit gap-5 px-5 py-5 lg:col-span-2","aria-labelledby":"one-screen-bar-heading",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h2",{id:"one-screen-bar-heading",className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"The bar"}),I?(0,e.jsxs)(b,{size:"xs",variant:"ghost",onClick:h,children:[(0,e.jsx)(Re,{"aria-hidden":"true"}),"Edit the bar"]}):null]}),(0,e.jsx)("p",{className:"text-sm text-foreground",children:F||(0,e.jsx)("span",{className:"text-muted-foreground",children:"No bar yet."})})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(Kt,{responsibility:t,agentsById:r,now:l,editable:!!I}),x?(0,e.jsxs)("p",{className:"flex items-center gap-1.5 text-xs tabular-nums text-muted-foreground","data-automation-line":"",children:[(0,e.jsx)(Pt,{"aria-hidden":"true",className:"size-3.5 shrink-0"}),$s(x.automationCount,x.manualTaskCount),tt(x.share)?` · ${tt(x.share)}`:null]}):null]}),(0,e.jsx)("div",{className:"border-t border-border pt-4","data-bar-metrics":"",children:(0,e.jsx)(ht,{responsibilityId:t.id,primary:m.metric,now:l,agentsById:r,layout:"stack",editable:!!I,fallback:(0,e.jsx)($e,{metric:m.metric,health:m.health,now:l,size:"hero"})})}),A.summary?.text.trim()?(0,e.jsxs)("section",{"aria-labelledby":"one-screen-affecting-heading",className:"flex flex-col gap-1.5 border-t border-border pt-4","data-affecting-summary":"",children:[(0,e.jsx)("h3",{id:"one-screen-affecting-heading",className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"What is affecting the number"}),(0,e.jsx)(Bs,{summary:A.summary,stillWaiting:A.stillWaiting})]}):null]}),(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-4 lg:col-span-3","data-work-order":"",children:[S?(0,e.jsx)(tn,{}):null,(0,e.jsx)(ke,{kind:"routine",items:y.routine,total:y.routine.length}),(0,e.jsx)(Ms,{skills:t.skills,agentsById:r}),(0,e.jsx)(ke,{kind:"project",items:y.project,total:y.project.length}),(0,e.jsx)(ke,{kind:"task",items:y.task,total:Math.max(m.openTasks,D)+u,automateFor:C}),k.error?(0,e.jsxs)("p",{role:"alert",className:"text-xs text-destructive",children:["Couldn’t open the conversation. ",E(k.error).body]}):null,(0,e.jsx)(zs,{artifacts:t.artifacts,total:t.artifactsTotal})]})]}),(0,e.jsx)(Nt,{open:f!==null,onOpenChange:a(v=>{v||j(null)},"onOpenChange"),companyId:s,task:f,agents:n,filedUnder:[t.title]})]})}a(sn,"ResponsibilityOneScreen");var Pe=6e4,Fe=60*Pe,se=24*Fe,rt=7*se,lt=30*se;function X(t,s){const n=Math.max(0,s.getTime()-new Date(t).getTime());return n<Pe?"just now":n<Fe?`${Math.floor(n/Pe)}m ago`:n<se?`${Math.floor(n/Fe)}h ago`:n<rt?`${Math.floor(n/se)}d ago`:n<lt?`${Math.floor(n/rt)}w ago`:`${Math.floor(n/lt)}mo ago`}a(X,"ago");function an(t,s){if(t.status==="paused")return"Paused";const n=t.lastRun;if(!n)return"Not run yet";const r=X(n.at,s);return n.outcome==="succeeded"?`Last successful run ${r}`:n.outcome==="failed"?`Failed ${r}`:`Running, started ${r}`}a(an,"routineStat");function nn(t,s){const[n,r,l]=t.split("-").map(Number);if(!n||!r||!l)return null;const[i,c,d]=ks(s).split("-").map(Number);return Math.round((Date.UTC(n,r-1,l)-Date.UTC(i,c-1,d))/se)}a(nn,"daysUntil");function rn(t,s){if(!t.targetDate)return null;const n=nn(t.targetDate,s);return n===null?null:n===0?"Due today":n===1?"Due tomorrow":n>1?`Due in ${n} days`:n===-1?"1 day late":`${-n} days late`}a(rn,"projectDueStat");function ln(t){return`${t.done} of ${t.total} ${t.total===1?"task":"tasks"} done`}a(ln,"projectProgressLabel");function on(t){return{open:t.filter(s=>!kt(s.status)),done:t.filter(s=>s.status==="done")}}a(on,"splitTasksForTable");var dn={succeeded:"Succeeded",failed:"Failed",cancelled:"Cancelled",timed_out:"Timed out"};function cn(t,s){return t.status==="running"?`Running, started ${X(t.startedAt??t.createdAt,s)}`:t.status==="queued"?`Queued ${X(t.createdAt,s)}`:`${dn[t.status]??`${t.status.charAt(0).toUpperCase()}${t.status.slice(1).replace(/_/g," ")}`} ${X(t.finishedAt??t.startedAt??t.createdAt,s)}`}a(cn,"runStat");var it=20,un=200,K={project:"project",task:"task",routine:"routine",skill:"skill"};function xn(t,s){return t instanceof Pa&&t.status===404?`That ${K[s]} is no longer available to you. It may have been deleted or made private.`:E(t).body}a(xn,"describeLinkError");function mn(t,s){return t==="project"?{projectId:s}:t==="task"?{issueId:s}:t==="skill"?{skillId:s}:{routineId:s}}a(mn,"linkBody");function hn(t,s){const[n,r]=(0,g.useState)(t);return(0,g.useEffect)(()=>{const l=window.setTimeout(()=>r(t),s);return()=>window.clearTimeout(l)},[t,s]),n}a(hn,"useDebounced");function Yt({companyId:t,responsibilityId:s,kind:n,linkedIds:r,onLinked:l,open:i,onOpenChange:c,anchor:d}){const h=V(),[m,x]=(0,g.useState)(!1),f=i??m,j=a(N=>{i===void 0&&x(N),c?.(N)},"setOpen"),[w,k]=(0,g.useState)(""),p=hn(w.trim(),un),C=z({...za(t),enabled:f&&n==="project"}),y=z({queryKey:R.routines.list(t),queryFn:a(()=>Dt.list(t),"queryFn"),enabled:f&&n==="routine"}),A=z({queryKey:R.companySkills.list(t),queryFn:a(()=>Na.list(t),"queryFn"),enabled:f&&n==="skill"}),F=z({queryKey:R.issues.search(t,p,void 0,it),queryFn:a(()=>Da.list(t,{q:p||void 0,limit:it}),"queryFn"),enabled:f&&n==="task"}),D=(0,g.useMemo)(()=>n==="project"?(C.data??[]).map(N=>({id:N.id,label:N.name})):n==="routine"?(y.data??[]).map(N=>({id:N.id,label:N.title})):n==="skill"?(A.data??[]).map(N=>({id:N.id,label:N.name})):(F.data??[]).map(N=>({id:N.id,label:N.title,detail:N.identifier})),[n,C.data,y.data,A.data,F.data]),u=(0,g.useMemo)(()=>D.filter(N=>!r.has(N.id)),[D,r]),S=n==="project"?C:n==="routine"?y:n==="skill"?A:F,I=je({data:S.data,error:S.error,status:S.status,fetchStatus:S.fetchStatus,failureReason:S.failureReason,refetch:S.refetch}),v=L({mutationFn:a(N=>_.link(s,mn(n,N)),"mutationFn"),onSuccess:a(N=>{j(!1),k(""),l?.(N),h.invalidateQueries({queryKey:R.responsibilities.all})},"onSuccess")}),T=v.reset;return(0,g.useEffect)(()=>{f&&T()},[f,T]),(0,e.jsxs)(xa,{open:f,onOpenChange:j,children:[d?(0,e.jsx)(La,{asChild:!0,children:(0,e.jsx)("span",{className:"inline-flex",children:d})}):(0,e.jsx)(ha,{asChild:!0,children:(0,e.jsxs)(b,{size:"sm",variant:"ghost",children:[(0,e.jsx)(ne,{"aria-hidden":"true"}),"Add existing ",K[n]]})}),(0,e.jsx)(va,{align:"end",className:"w-80 p-0",children:(0,e.jsxs)(qa,{shouldFilter:n!=="task",children:[(0,e.jsx)(ja,{value:w,onValueChange:k,placeholder:`Search ${K[n]}s…`,"aria-label":`Search ${K[n]}s`}),(0,e.jsx)(_a,{children:I.kind==="error"?(0,e.jsx)("div",{className:"px-3 py-4",children:(0,e.jsx)(ae,{error:I.error,size:"inline",action:`load ${K[n]}s`,onRetry:I.retry,retrying:I.isFetching})}):I.data?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Ca,{children:D.length>0&&u.length===0?`Every matching ${K[n]} is already here.`:`No ${K[n]}s found.`}),u.map(N=>(0,e.jsxs)(ua,{value:`${N.label} ${N.detail??""} ${N.id}`,disabled:v.isPending,onSelect:a(()=>v.mutate(N.id),"onSelect"),children:[N.detail?(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:N.detail}):null,(0,e.jsx)("span",{className:"truncate",children:N.label})]},N.id))]}):(0,e.jsx)("p",{className:"px-3 py-4 text-sm text-muted-foreground",role:"status",children:"Loading…"})}),v.error?(0,e.jsx)("p",{role:"alert",className:"border-t border-border px-3 py-2 text-sm text-destructive",children:xn(v.error,n)}):null]})})]})}a(Yt,"AddExistingWorkPicker");function gn(t,s){return Ze(t,s)??Ze({...t,primaryDisplay:bs(t.bar.metricKind,t.metricCurrent===null?0:1)},s)}a(gn,"proposalVisualizations");function fn(t,s){if(s.size!==0)return Array.from({length:t},(n,r)=>r).filter(n=>!s.has(n))}a(fn,"keptMetricIndexes");function Gt(t){return t.health===null?t:{...t,health:null}}a(Gt,"withoutStatus");function Xt(t){return $("grid gap-x-6 gap-y-5",t>1&&"sm:grid-cols-2",t>2&&"lg:grid-cols-3")}a(Xt,"tileGrid");function pn({interaction:t,agentsById:s}){const n=(0,g.useMemo)(()=>new Date,[]),r=(0,g.useMemo)(()=>gn(t.payload,n),[t.payload,n]),[l,i]=(0,g.useState)(new Set),[c,d]=(0,g.useState)(!1),{accept:h,decline:m,busy:x,error:f}=ps(t),j=(t.createdByAgentId?s.get(t.createdByAgentId)?.name:null)??"Your agent",w=r.metrics.length-1,k=a(p=>i(C=>{const y=new Set(C);return y.has(p)?y.delete(p):y.add(p),y}),"toggle");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-bar-proposal":"","data-testid":"bar-proposal",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[j," proposes"]}),(0,e.jsx)("p",{className:"text-sm text-foreground",children:t.payload.bar.standard})]}),(0,e.jsx)("div",{className:Xt(r.metrics.length),children:r.metrics.map((p,C)=>{const y=C-1;return p.role==="supporting"&&l.has(y)?(0,e.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2 rounded-md border border-dashed border-border px-3 py-2.5","data-metric-key":p.key,"data-dropped":"",children:[(0,e.jsx)("span",{className:"truncate text-sm text-muted-foreground line-through",children:p.title}),(0,e.jsx)(b,{type:"button",size:"xs",variant:"ghost",disabled:x,onClick:a(()=>k(y),"onClick"),children:"Keep"})]},p.key):(0,e.jsx)(gt,{metric:Gt(p),now:n,primary:p.role==="primary"?r.primary:null,details:"on_demand",showReadLine:!1,className:"rounded-md border border-border px-3 py-2.5",menu:p.role==="primary"?w>0?(0,e.jsx)("span",{className:"pr-1.5 pt-1 text-xs text-muted-foreground","data-always-kept":"",children:"Always kept"}):null:(0,e.jsx)(b,{type:"button",size:"icon-xs",variant:"ghost",className:"text-muted-foreground","aria-label":`Drop “${p.title}”`,title:"Drop",disabled:x,onClick:a(()=>k(y),"onClick"),"data-drop-metric":"",children:(0,e.jsx)(Lt,{"aria-hidden":"true"})})},p.key)})}),f?(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:E(f).body}):null,c?(0,e.jsx)(fs,{busy:x,sending:m.isPending,onSend:a(p=>m.mutate(p,{onSuccess:a(()=>d(!1),"onSuccess")}),"onSend"),onBack:a(()=>d(!1),"onBack")}):(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[(0,e.jsx)(b,{type:"button",variant:"ghost",size:"sm",disabled:x,onClick:a(()=>d(!0),"onClick"),children:"Not right"}),(0,e.jsxs)(b,{type:"button",size:"sm",disabled:x,onClick:a(()=>h.mutate(fn(w,l)),"onClick"),children:[h.isPending?(0,e.jsx)(ee,{"aria-hidden":"true",className:"animate-spin"}):null,"Use this bar"]})]})]})}a(pn,"ProposalPreview");function jn({metric:t,onShowAs:s,onRemove:n,busy:r}){const l=t.role==="primary"?t.kind:null,i=ws({role:t.role,kind:l,display:t.display,unit:t.unit}),c=os({display:t.display,kind:l});return i.length<=1&&!n?null:(0,e.jsxs)(H,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{type:"button",size:"icon-xs",variant:"ghost",className:"text-muted-foreground","aria-label":`Options for “${t.title}”`,disabled:r,children:(0,e.jsx)(pe,{"aria-hidden":"true"})})}),(0,e.jsxs)(B,{align:"end",children:[i.length>1?(0,e.jsxs)(wt,{children:[(0,e.jsx)(It,{children:"Show as"}),(0,e.jsx)(Bt,{children:(0,e.jsx)(Ht,{value:c,onValueChange:a(d=>{d!==c&&s(Es(d))},"onValueChange"),children:i.map(d=>(0,e.jsx)(J,{value:d,children:gs[d]},d))})})]}):null,n?(0,e.jsx)(P,{variant:"destructive",onSelect:n,children:"Remove"}):null]})]})}a(jn,"VisualizationMenu");function vn(t){const s=V(),n=R.responsibilities.metrics(t);return{showAs:L({mutationFn:a(({metric:r,display:l})=>et.setDisplay(t,r.role==="primary"?"primary":r.id,l),"mutationFn"),onMutate:a(async({metric:r,display:l})=>{await s.cancelQueries({queryKey:n});const i=s.getQueryData(n);return s.setQueryData(n,c=>c&&{...c,metrics:c.metrics.map(d=>d.key===r.key?{...d,display:l,period:l==="bar"?"week":null}:d)}),{before:i}},"onMutate"),onError:a((r,l,i)=>{i?.before&&s.setQueryData(n,i.before)},"onError"),onSuccess:a(r=>s.setQueryData(n,r),"onSuccess")}),remove:L({mutationFn:a(r=>et.removeMetric(t,r.id),"mutationFn"),onSuccess:a(r=>s.setQueryData(n,r),"onSuccess")})}}a(vn,"useVisualizationWrites");function bn({responsibility:t,now:s,editable:n}){const r=us(t.id),l=je(r),{showAs:i,remove:c}=vn(t.id),[d,h]=(0,g.useState)(null),m=t.rollup.metric;if(!r.data||l.kind==="error")return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)($e,{metric:m,health:t.rollup.health,now:s,size:"hero",className:"max-w-sm"}),l.kind==="error"?(0,e.jsx)(ae,{error:l.error,size:"inline",action:"load the measures",onRetry:l.retry,retrying:l.isFetching}):null]});const x=r.data,f=n&&x.source==="chosen";return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:Xt(x.metrics.length),"data-bar-visualizations":x.source,children:x.metrics.map(j=>(0,e.jsx)(gt,{metric:Gt(j),now:s,primary:j.role==="primary"?m:null,details:"on_demand",menu:f?(0,e.jsx)(jn,{metric:j,busy:i.isPending||c.isPending,onShowAs:a(w=>i.mutate({metric:j,display:w}),"onShowAs"),onRemove:j.role==="supporting"&&j.id?()=>{c.reset(),h(j)}:void 0}):void 0},j.key))}),i.error?(0,e.jsxs)("p",{role:"alert",className:"text-xs text-destructive",children:["Couldn’t change how it is shown. ",E(i.error).body]}):null,(0,e.jsx)(Tt,{open:d!==null,onOpenChange:a(j=>{j||h(null)},"onOpenChange"),children:(0,e.jsxs)(Rt,{children:[(0,e.jsxs)(At,{children:[(0,e.jsxs)(Ot,{children:["Remove “",d?.title,"”?"]}),(0,e.jsx)(St,{children:"Its readings are kept."})]}),c.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t remove it. ",E(c.error).body]}):null,(0,e.jsxs)(yt,{className:"items-center sm:justify-between",children:[(0,e.jsx)(Ut,{children:"Keep it"}),(0,e.jsx)(b,{variant:"destructive",disabled:c.isPending||!d,onClick:a(()=>d&&c.mutate(d,{onSuccess:a(()=>h(null),"onSuccess")}),"onClick"),children:c.isPending?"Removing…":"Remove"})]})]})})]})}a(bn,"SetVisualizations");function Nn({responsibility:t,agentsById:s,now:n,editable:r}){const l=(0,g.useId)(),i=Ve(t,r),[c,d]=(0,g.useState)(!1),[h,m]=(0,g.useState)(!1),x=!!t.rollup.metric,f=i.state,j=a(T=>T?s.get(T)?.name:void 0,"nameOf"),w=j(f?.conversation?.agentId)??"an agent",k=j(f?.defaultAgentId)??"your agent",p=r?f?.proposal??null:null,C=r&&!p&&f?.state==="discussing"&&f.conversation?f.conversation:null,y=!!f,A=y&&!i.canTalk,F=a(()=>i.start.mutate(),"startTalking"),D=i.start.isPending,u=r&&!x&&!p&&!C&&(A||i.start.isError),S=r&&!u?(0,e.jsxs)(H,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{size:"icon-xs",variant:"ghost",className:"text-muted-foreground","aria-label":"More for the bar",children:(0,e.jsx)(pe,{"aria-hidden":"true"})})}),(0,e.jsxs)(B,{align:"end",children:[(0,e.jsx)(P,{onSelect:a(()=>d(!0),"onSelect"),children:x?"Edit by hand":"Set it by hand"}),x?(0,e.jsx)(P,{onSelect:a(()=>m(!0),"onSelect"),children:"Record a reading"}):null]})]}):null,I=r&&x&&!p&&!C&&i.canTalk?(0,e.jsxs)(b,{size:"xs",variant:"ghost",disabled:D,onClick:F,"data-bar-edit-primary":"",children:[D?(0,e.jsx)(ee,{"aria-hidden":"true",className:"animate-spin"}):(0,e.jsx)(te,{"aria-hidden":"true"}),"Change it with ",k]}):null;let v;return p?v=(0,e.jsx)(pn,{interaction:p,agentsById:s}):x?v=(0,e.jsx)(bn,{responsibility:t,now:n,editable:r}):v=r?C?null:(0,e.jsxs)("div",{className:"flex flex-col items-start gap-3","data-bar-empty":"",children:[(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"How will you know this is going well?"}),u?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(b,{size:"sm",onClick:a(()=>d(!0),"onClick"),"data-bar-edit-primary":"",children:"Set it by hand"}),A?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"No agent is free to talk it through."}):null]}):(0,e.jsxs)(b,{size:"sm",disabled:!y||D,onClick:F,"data-bar-edit-primary":"",children:[D?(0,e.jsx)(ee,{"aria-hidden":"true",className:"animate-spin"}):(0,e.jsx)(te,{"aria-hidden":"true"}),y?`Set it with ${k}`:"Set it with an agent"]})]}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No bar."}),(0,e.jsxs)(q,{id:"responsibility-bar",elevation:"low",className:"gap-4 px-5 py-4","aria-labelledby":l,"data-bar-module":"",children:[(0,e.jsxs)("div",{className:"flex min-h-6 items-center justify-between gap-2",children:[(0,e.jsx)("h2",{id:l,className:"text-sm font-semibold text-foreground",children:"The bar"}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[I,S]})]}),C?(0,e.jsxs)("p",{className:"text-sm text-muted-foreground","data-bar-talking":"",children:["Talking it through with ",w,"."," ",(0,e.jsx)(M,{to:`/issues/${C.identifier??C.issueId}`,className:"font-medium text-foreground underline-offset-4 hover:underline",children:"Open the conversation"})]}):null,i.start.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t start the conversation. ",E(i.start.error).body]}):null,i.loadError?(0,e.jsx)(ae,{error:i.loadError,size:"inline",action:"load the bar conversation",onRetry:i.retry,retrying:i.retrying}):null,v,r?(0,e.jsx)(Wt,{responsibility:t,open:c,onOpenChange:d}):null,r&&x?(0,e.jsx)(Ue,{open:h,onOpenChange:m,children:(0,e.jsxs)(qe,{className:"sm:max-w-sm",children:[(0,e.jsxs)(ze,{children:[(0,e.jsx)(Oe,{children:"Record a reading"}),(0,e.jsx)(Be,{className:"sr-only",children:t.rollup.metric?.name})]}),(0,e.jsx)(Vt,{responsibility:t})]})}):null]})}a(Nn,"BarModule");var kn={recent:a((t,s)=>Ma.get(`/responsibilities/${encodeURIComponent(t)}/runs${s?`?limit=${s}`:""}`),"recent")},wn=new Set(["queued","running"]);function yn(t){return z({queryKey:R.responsibilities.runs(t),queryFn:a(()=>kn.recent(t),"queryFn"),staleTime:15e3,refetchInterval:a(s=>s.state.data?.runs.some(n=>wn.has(n.status))?5e3:!1,"refetchInterval")})}a(yn,"useResponsibilityRuns");var Zt=(0,g.createContext)(!0);function Q({section:t,title:s,add:n,empty:r,withWho:l=!0,children:i,footer:c}){const d=`one-screen-v2-${t}-heading`;return(0,e.jsx)("section",{"aria-labelledby":d,"data-section":t,children:(0,e.jsxs)(q,{elevation:"low",className:"gap-0 overflow-hidden py-0","data-section-table":"",children:[(0,e.jsxs)("div",{className:"flex min-h-11 items-center justify-between gap-2 border-b border-border px-4 py-2","data-section-header":"",children:[(0,e.jsx)("h2",{id:d,className:"text-sm font-semibold text-foreground",children:s}),n]}),r!=null?(0,e.jsx)("p",{className:"px-4 py-3 text-sm text-muted-foreground","data-section-empty":"",children:r}):(0,e.jsx)(Zt.Provider,{value:l,children:(0,e.jsx)("ul",{className:$("flex flex-col divide-y divide-border sm:grid sm:gap-x-6",l?"sm:grid-cols-(--gtc-27)":"sm:grid-cols-(--gtc-13)"),"data-section-rows":"",children:i})}),c]})})}a(Q,"SectionTable");function Y({to:t,label:s,leading:n,title:r,aside:l,stat:i,who:c,rowData:d}){const h=(0,g.useContext)(Zt);return(0,e.jsx)("li",{className:"min-w-0 sm:col-span-full sm:grid sm:grid-cols-subgrid",...d,children:(0,e.jsxs)(M,{to:t,"aria-label":s,className:"flex min-h-11 min-w-0 items-center gap-3 px-4 py-2 text-sm transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring sm:col-span-full sm:grid sm:grid-cols-subgrid",children:[(0,e.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5 sm:contents",children:[(0,e.jsxs)("span",{className:"flex min-w-0 items-center gap-2","data-row-title":"",children:[n,(0,e.jsx)("span",{className:"min-w-0 truncate text-foreground",title:r,children:r}),l?(0,e.jsx)("span",{className:"ml-auto flex shrink-0 items-center pl-2",children:l}):null]}),i!=null&&i!==""?(0,e.jsx)("span",{className:"min-w-0 truncate text-muted-foreground tabular-nums sm:whitespace-nowrap sm:text-right","data-row-stat":"",children:i}):(0,e.jsx)("span",{"aria-hidden":"true",className:"hidden sm:block"})]}),h?c?(0,e.jsx)("span",{className:"flex shrink-0 items-center justify-end gap-1","data-row-who":"",children:c}):(0,e.jsx)("span",{"aria-hidden":"true",className:"hidden sm:block"}):null]})})}a(Y,"SectionTableRow");function ot({children:t,onClick:s}){return(0,e.jsx)("button",{type:"button",onClick:s,className:"flex min-h-11 w-full items-center border-t border-border px-4 text-left text-sm text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","data-section-footer":"",children:t})}a(ot,"SectionTableFooterButton");function dt({children:t,alert:s=!1}){return(0,e.jsx)("p",{role:s?"alert":void 0,className:$("border-t border-border px-4 py-3 text-sm",s?"text-destructive":"text-muted-foreground"),children:t})}a(dt,"SectionTableNote");function Jt({agentId:t,agentsById:s}){if(!t)return null;const n=s.get(t),r=n?.name??"An agent";return(0,e.jsx)("span",{title:r,className:"flex shrink-0",children:(0,e.jsx)(qt,{agent:n??{id:t},name:n?.name,size:20,label:r})})}a(Jt,"WhoAvatar");function ct({identifier:t,when:s}){return(0,e.jsxs)("span",{className:"inline-flex items-center gap-3",children:[t?(0,e.jsx)("span",{className:"font-mono",children:t}):null,(0,e.jsx)("span",{className:"sm:inline-block sm:min-w-16 sm:text-right",children:s})]})}a(ct,"TaskRefStat");var G={routines:"Routines",skills:"Skills",projects:"Projects",tasks:"Tasks",runs:"Recent runs",artifacts:"Artifacts"},we=8,Sn=4;function Cn({agentIds:t,agentsById:s}){const n=t.length>Sn,r=n?t.slice(0,3):t;return(0,e.jsxs)(e.Fragment,{children:[r.map(l=>(0,e.jsx)(Jt,{agentId:l,agentsById:s},l)),n?(0,e.jsxs)("span",{className:"text-sm text-muted-foreground tabular-nums",children:["+",t.length-r.length]}):null]})}a(Cn,"SkillHolders");function An({progress:t}){const s=ln(t),n=Math.round(Math.min(t.done,t.total)/t.total*100);return(0,e.jsx)("span",{role:"img","aria-label":s,title:s,className:"relative block h-1 w-16 overflow-hidden rounded-full bg-muted","data-project-progress":n,children:(0,e.jsx)("span",{className:"absolute inset-y-0 left-0 rounded-full bg-muted-foreground",style:{width:`${n}%`}})})}a(An,"ProjectProgress");function Tn({artifact:t}){const s=hs(bt(t));return(0,e.jsx)(s==="bars"?wa:s,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground"})}a(Tn,"ArtifactKindMark");function ye({label:t,newLabel:s,onNew:n,existing:r,onExisting:l}){const i=(0,g.useRef)(!1);return!n&&!r?null:(0,e.jsxs)(H,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{type:"button",size:"icon-xs",variant:"ghost",className:"text-muted-foreground","aria-label":t,"data-section-add":"",children:(0,e.jsx)(ne,{"aria-hidden":"true"})})}),(0,e.jsxs)(B,{align:"end",onCloseAutoFocus:a(c=>{i.current&&(i.current=!1,c.preventDefault(),l?.())},"onCloseAutoFocus"),children:[n?(0,e.jsx)(P,{onSelect:n,children:s}):null,r&&l?(0,e.jsx)(P,{onSelect:a(()=>{i.current=!0},"onSelect"),children:"Add existing"}):null]})]})}a(ye,"AddMenu");function Rn({onExisting:t,filed:s,onRemove:n,removingLinkId:r,agents:l}){const i=(0,g.useRef)(!1);return(0,e.jsxs)(H,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{type:"button",size:"icon-xs",variant:"ghost",className:"text-muted-foreground","aria-label":"Add or remove a skill","data-section-add":"",children:(0,e.jsx)(ne,{"aria-hidden":"true"})})}),(0,e.jsxs)(B,{align:"end",onCloseAutoFocus:a(c=>{i.current&&(i.current=!1,c.preventDefault(),t())},"onCloseAutoFocus"),children:[(0,e.jsx)(P,{onSelect:a(()=>{i.current=!0},"onSelect"),children:"Add existing skill"}),s.length>0?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ge,{}),(0,e.jsx)(he,{children:"Remove from this responsibility"}),s.map(c=>(0,e.jsx)(P,{disabled:r===c.linkId,"aria-label":`Remove ${c.name} from this responsibility`,onSelect:a(()=>n(c),"onSelect"),children:c.name},c.id))]}):null,l.length>0?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ge,{}),(0,e.jsx)(he,{children:"Give a skill to"}),l.map(c=>(0,e.jsx)(P,{asChild:!0,children:(0,e.jsx)(M,{to:Ta(ga(c),"skills"),children:c.name})},c.id))]}):null]})]})}a(Rn,"SkillsMenu");function In({label:t,reason:s}){return(0,e.jsx)("span",{title:s,className:"inline-flex","data-section-add-disabled":"",children:(0,e.jsx)(b,{type:"button",size:"icon-xs",variant:"ghost",className:"text-muted-foreground","aria-label":`${t}: ${s}`,disabled:!0,children:(0,e.jsx)(ne,{"aria-hidden":"true"})})})}a(In,"DisabledAdd");function Dn({open:t,onOpenChange:s,title:n,onSave:r}){const[l,i]=(0,g.useState)(n),[c,d]=(0,g.useState)(null),[h,m]=(0,g.useState)(!1),x=a(async f=>{f.preventDefault();const j=l.trim();if(!(!j||h)){if(j===n){s(!1);return}m(!0),d(null);try{await r(j),s(!1)}catch(w){d(w)}finally{m(!1)}}},"submit");return(0,e.jsx)(Ue,{open:t,onOpenChange:a(f=>{f&&i(n),s(f)},"onOpenChange"),children:(0,e.jsx)(qe,{className:"sm:max-w-md",children:(0,e.jsxs)("form",{className:"flex flex-col gap-4",onSubmit:x,children:[(0,e.jsxs)(ze,{children:[(0,e.jsx)(Oe,{children:"Rename"}),(0,e.jsx)(Be,{className:"sr-only",children:"The short name this responsibility goes by."})]}),(0,e.jsx)(Mt,{"aria-label":"Name",value:l,maxLength:200,autoFocus:!0,onChange:a(f=>i(f.target.value),"onChange")}),c?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t rename it. ",E(c).body]}):null,(0,e.jsxs)(_t,{className:"sm:justify-between",children:[(0,e.jsx)(b,{type:"button",variant:"ghost",onClick:a(()=>s(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(b,{type:"submit",disabled:!l.trim()||h,children:h?"Saving…":"Save"})]})]})})})}a(Dn,"RenameDialog");function En({responsibility:t,companyId:s,agents:n,agentsById:r,areas:l,now:i,notices:c,actions:d,onReviewProposal:h}){const m=V(),x=t.status==="active",f=t.status!=="dismissed",j=t.status==="active"||t.status==="proposed",w=t.standard?.trim()||t.title,k=Hs(t.id),[p,C]=(0,g.useState)(!1),[y,A]=(0,g.useState)(null),[F,D]=(0,g.useState)(!1),[u,S]=(0,g.useState)(!1),[I,v]=(0,g.useState)(null),[T,N]=(0,g.useState)(!1),[W,ve]=(0,g.useState)(!1),re=yn(t.id),Z=je(re),ts=(0,g.useMemo)(()=>({project:new Set(t.projects.map(o=>o.id)),task:new Set(t.tasks.filter(o=>o.membership==="direct").map(o=>o.id)),routine:new Set(t.routines.filter(o=>o.membership==="direct").map(o=>o.id)),skill:new Set(t.skills.filter(o=>o.linkId).map(o=>o.id))}),[t.projects,t.tasks,t.routines,t.skills]),le=t.routines.filter(o=>o.status!=="archived"),We=t.projects.filter(o=>!Ks(o)),{open:ie,done:be}=(0,g.useMemo)(()=>on(t.tasks),[t.tasks]),Qe=[...T?ie:ie.slice(0,we),...W?be:[]],Ye=(0,g.useMemo)(()=>{const o=ft(t).map(O=>O.agentId);return t.runByAgentId&&!o.includes(t.runByAgentId)&&o.unshift(t.runByAgentId),o.flatMap(O=>{const ue=r.get(O);return ue?[ue]:[]})},[t,r]),ss=Ye[0]?.id??null,oe=L({mutationFn:a(o=>Dt.run(o.id,{}),"mutationFn"),onSuccess:a(async()=>{await Promise.all([m.invalidateQueries({queryKey:R.responsibilities.runs(t.id)}),m.invalidateQueries({queryKey:R.responsibilities.detail(t.id)})])},"onSuccess")}),de=a((o,O)=>(0,e.jsx)(Yt,{companyId:s,responsibilityId:t.id,kind:o,linkedIds:ts[o],open:y===o,onOpenChange:a(ue=>A(ue?o:null),"onOpenChange"),anchor:O}),"picker"),ce=a(o=>o?(0,e.jsx)(Jt,{agentId:o,agentsById:r}):null,"whoFor"),Ge=le.filter(o=>o.status==="active"),as=x?Ge.length===0?(0,e.jsx)(In,{label:"Run a routine now",reason:le.length===0?"No routines to run yet":"No active routine to run"}):(0,e.jsxs)(H,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{type:"button",size:"icon-xs",variant:"ghost",className:"text-muted-foreground","aria-label":"Run a routine now",disabled:oe.isPending,"data-section-add":"",children:(0,e.jsx)(ne,{"aria-hidden":"true"})})}),(0,e.jsxs)(B,{align:"end",children:[(0,e.jsx)(he,{children:"Run now"}),Ge.map(o=>(0,e.jsx)(P,{onSelect:a(()=>oe.mutate(o),"onSelect"),children:o.title},o.id))]})]}):null,ns=(0,g.useMemo)(()=>t.skills.filter(o=>o.linkId),[t.skills]),rs=f?de("skill",(0,e.jsx)(Rn,{onExisting:a(()=>A("skill"),"onExisting"),filed:ns,removingLinkId:d.unlinkingId,onRemove:a(o=>d.unlink({linkId:o.linkId,label:o.name,relink:{skillId:o.id}}),"onRemove"),agents:Ye})):null,ls=a(async o=>{v(null);try{await _.link(t.id,{projectId:o.id})}catch(O){v(O)}await m.invalidateQueries({queryKey:R.responsibilities.all})},"fileNewProject");return(0,e.jsxs)("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-8","data-responsibility-view":"one_screen_v2",children:[(0,e.jsxs)("header",{className:"flex flex-col gap-1",children:[t.area?(0,e.jsx)("p",{className:"text-xs text-muted-foreground","data-area":"",children:t.area.title}):null,(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsx)("h1",{className:"min-w-0 flex-1 text-xl font-semibold text-foreground",children:w}),(0,e.jsxs)(H,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{size:"icon-sm",variant:"ghost",className:"shrink-0 text-muted-foreground","aria-label":"More actions for this responsibility",children:(0,e.jsx)(pe,{"aria-hidden":"true"})})}),(0,e.jsxs)(B,{align:"end",children:[(0,e.jsx)(P,{onSelect:a(()=>C(!0),"onSelect"),children:"Rename…"}),(0,e.jsxs)(wt,{children:[(0,e.jsx)(It,{children:"Move to area"}),(0,e.jsx)(Bt,{className:"max-h-(--sz-50vh) overflow-y-auto",children:(0,e.jsx)(Zs,{areas:t.area&&!l.some(o=>o.id===t.area.id)?[t.area,...l]:l,value:t.area?.id??null,onChange:a(o=>{o!==(t.area?.id??null)&&k.mutate(o)},"onChange")})})]}),x?(0,e.jsx)(P,{onSelect:a(()=>d.setStatus("let_go"),"onSelect"),children:"Let go"}):t.status==="let_go"||t.status==="dismissed"?(0,e.jsx)(P,{onSelect:a(()=>d.setStatus("active"),"onSelect"),children:"Take it back on"}):null,(0,e.jsx)(ge,{}),(0,e.jsx)(P,{variant:"destructive",onSelect:d.requestDelete,children:"Delete…"})]})]})]}),t.status==="let_go"?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"You let go of this."}):t.status==="dismissed"?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"You dismissed this."}):null,k.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t move it. ",E(k.error).body]}):null,c]}),t.status==="proposed"?(0,e.jsx)(fe,{count:1,subject:"this",onReview:h}):null,(0,e.jsx)(Nn,{responsibility:t,agentsById:r,now:i,editable:j}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-section-order":"",children:[(0,e.jsx)(Q,{section:"routines",title:G.routines,add:f?de("routine",(0,e.jsx)(ye,{label:"Add a routine",newLabel:"New routine",onNew:x?()=>D(!0):void 0,existing:!0,onExisting:a(()=>A("routine"),"onExisting")})):null,empty:le.length===0?"None yet.":null,children:le.map(o=>(0,e.jsx)(Y,{rowData:{"data-work-id":o.id},to:jt(o.id),title:o.title,stat:an(o,i),who:ce(o.assigneeAgentId)},o.id))}),(0,e.jsx)(Q,{section:"skills",title:G.skills,add:rs,empty:t.skills.length===0?"None yet.":null,children:t.skills.map(o=>(0,e.jsx)(Y,{rowData:{"data-work-id":o.id},to:He(o),title:o.name,stat:o.linkId?"Filed here":void 0,who:o.agentIds.length>0?(0,e.jsx)(Cn,{agentIds:o.agentIds,agentsById:r}):null},o.id))}),(0,e.jsx)(Q,{section:"projects",title:G.projects,add:f?de("project",(0,e.jsx)(ye,{label:"Add a project",newLabel:"New project",onNew:x?()=>S(!0):void 0,existing:!0,onExisting:a(()=>A("project"),"onExisting")})):null,empty:We.length===0?t.projects.length>0?"None open.":"None yet.":null,footer:I?(0,e.jsxs)(dt,{alert:!0,children:["The project was made but couldn’t be filed here. ",E(I).body]}):null,children:We.map(o=>(0,e.jsx)(Y,{rowData:{"data-work-id":o.id},to:Ie(o),title:o.name,aside:o.progress?(0,e.jsx)(An,{progress:o.progress}):null,stat:rn(o,i),who:ce(o.leadAgentId)},o.id))}),(0,e.jsx)(Q,{section:"tasks",title:G.tasks,add:f?de("task",(0,e.jsx)(ye,{label:"Add a task",newLabel:"New task",onNew:x?()=>d.newTask({defaultTitle:""}):void 0,existing:!0,onExisting:a(()=>A("task"),"onExisting")})):null,empty:Qe.length===0?t.tasks.length>0?"None open.":"None yet.":null,footer:(0,e.jsxs)(e.Fragment,{children:[!T&&ie.length>we?(0,e.jsxs)(ot,{onClick:a(()=>N(!0),"onClick"),children:["Show ",ie.length-we," more"]}):null,be.length>0?(0,e.jsx)(ot,{onClick:a(()=>ve(o=>!o),"onClick"),children:W?"Hide done":`Show ${be.length} done`}):null]}),children:Qe.map(o=>(0,e.jsx)(Y,{rowData:{"data-work-id":o.id},to:Le(o),leading:(0,e.jsx)(Ft,{...Et(o),size:"sm"}),title:o.title,stat:(0,e.jsx)(ct,{identifier:o.identifier,when:X(o.updatedAt,i)}),who:ce(o.assigneeAgentId)},o.id))}),(0,e.jsx)(Q,{section:"runs",title:G.runs,add:as,empty:Z.kind==="error"?(0,e.jsx)(ae,{error:Z.error,size:"inline",action:"load the runs",onRetry:Z.retry,retrying:Z.isFetching}):re.data?re.data.runs.length===0?"None yet.":null:(0,e.jsx)("span",{role:"status",children:"Loading…"}),footer:oe.error?(0,e.jsxs)(dt,{alert:!0,children:["Couldn’t start the run. ",E(oe.error).body]}):null,children:(Z.kind==="error"?[]:re.data?.runs??[]).map(o=>{const O=cn(o,i);return(0,e.jsx)(Y,{rowData:{"data-run-id":o.id,"data-run-status":o.status},to:`/agents/${o.agentId}/runs/${o.id}`,label:`${r.get(o.agentId)?.name??"An agent"} on ${o.issue.title}: ${O}`,title:o.issue.title,stat:O,who:ce(o.agentId)},o.id)})}),(0,e.jsx)(Q,{section:"artifacts",title:G.artifacts,withWho:!1,empty:t.artifacts.length===0?"None yet.":null,children:t.artifacts.map(o=>(0,e.jsx)(Y,{rowData:{"data-artifact-id":o.id},to:o.href,leading:(0,e.jsx)(Tn,{artifact:o}),title:o.title,stat:(0,e.jsx)(ct,{identifier:o.issue.identifier,when:X(o.updatedAt,i)})},`${o.source}:${o.id}`))})]}),(0,e.jsx)(Dn,{open:p,onOpenChange:C,title:t.title,onSave:d.saveTitle}),(0,e.jsx)(Nt,{open:F,onOpenChange:D,companyId:s,task:null,newFor:{responsibilityId:t.id,responsibilityTitle:t.title,assigneeAgentId:ss},agents:n,filedUnder:[t.title]}),u?(0,e.jsx)(Oa,{companyId:s,onClose:a(()=>S(!1),"onClose"),onCreated:ls}):null]})}a(En,"ResponsibilityOneScreenV2");function es({id:t,title:s,count:n,question:r,action:l}){return(0,e.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[(0,e.jsxs)("h2",{id:t,className:"text-base font-semibold text-foreground",children:[s," ",(0,e.jsx)("span",{className:"text-sm font-normal tabular-nums text-muted-foreground",children:n})]}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r})]}),l]})}a(es,"SectionHeading$1");function Pn({agentIds:t,agentsById:s}){if(t.length===0)return null;const n=t.map(r=>s.get(r)?.name??"An agent");return(0,e.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground","aria-label":`Held by ${n.join(", ")}`,children:[(0,e.jsx)("span",{className:"flex shrink-0 -space-x-1","aria-hidden":"true",children:t.slice(0,3).map(r=>(0,e.jsx)(qt,{agent:s.get(r)??{id:r},name:s.get(r)?.name,size:16},r))}),(0,e.jsx)("span",{className:"truncate","aria-hidden":"true",children:n.join(", ")})]})}a(Pn,"Holders");function Fn({skills:t,agentsById:s,addControl:n,removeControl:r}){return(0,e.jsxs)("section",{"aria-labelledby":"responsibility-skills-heading",className:"flex flex-col gap-2",children:[(0,e.jsx)(es,{id:"responsibility-skills-heading",title:"Skills",count:t.length,question:"What does this need, and what can the agents working on it do?",action:n}),t.length>0?(0,e.jsx)("ul",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"responsibility-skills",children:t.map(l=>(0,e.jsx)("li",{className:"min-w-0",children:(0,e.jsxs)(q,{elevation:"low",className:"h-full gap-3 px-4 py-4",children:[(0,e.jsxs)(M,{to:He(l),className:"flex min-w-0 items-start gap-3 rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,e.jsx)(Ua,{card:l,size:32}),(0,e.jsxs)("span",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,e.jsx)("span",{className:"truncate text-sm font-medium text-foreground underline-offset-4 hover:underline",children:l.name}),l.tagline||l.description?(0,e.jsx)("span",{className:"line-clamp-2 text-xs text-muted-foreground",children:l.tagline||l.description}):null]})]}),(0,e.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[l.agentIds.length>0?(0,e.jsx)(Pn,{agentIds:l.agentIds,agentsById:s}):(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Filed here"}),l.linkId?r?.(l):null]})]})},l.id))}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No skills yet. Add one this needs, or they appear here from the agents doing the work: the ones assigned its tasks and routines, and the leads of its projects."})]})}a(Fn,"ResponsibilitySkills");function $n(t,s){return`Showing the newest ${t} of ${s>=1e3?`${Ct.toLocaleString("en-US")} or more`:s.toLocaleString("en-US")}.`}a($n,"artifactsTruncationNote");function Mn({artifacts:t,total:s,truncated:n}){const{enabled:r}=Ps();return(0,e.jsxs)("section",{"aria-labelledby":"responsibility-artifacts-heading",className:"flex flex-col gap-3",children:[(0,e.jsx)(es,{id:"responsibility-artifacts-heading",title:"Artifacts",count:s,question:"What has the work produced? Newest first; each opens in the task that made it."}),t.length===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Nothing produced yet. Documents, files and other output from the tasks under this responsibility collect here."}):r?(0,e.jsx)(xs,{testId:"responsibility-artifacts",children:t.map(l=>(0,e.jsx)(vs,{subject:bt(l),to:l.href},`${l.source}:${l.id}`))}):(0,e.jsx)("ul",{className:"grid grid-cols-1 gap-6 md:grid-cols-2 xl:grid-cols-3","data-testid":"responsibility-artifacts",children:t.map(l=>(0,e.jsxs)("li",{className:"flex min-w-0 flex-col gap-1",children:[(0,e.jsx)(As,{artifact:l}),(0,e.jsxs)(M,{to:Le(l.issue),className:"truncate px-1 text-xs text-muted-foreground underline-offset-4 hover:underline",children:[(0,e.jsx)("span",{className:"font-mono",children:l.issue.identifier})," ",l.issue.title]})]},`${l.source}:${l.id}`))}),n?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:$n(t.length,s)}):null]})}a(Mn,"ResponsibilityArtifacts");function xe({id:t,title:s,count:n,question:r,action:l}){return(0,e.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[(0,e.jsxs)("h2",{id:t,className:"text-base font-semibold text-foreground",children:[s,n!==void 0?(0,e.jsxs)(e.Fragment,{children:[" ",(0,e.jsx)("span",{className:"text-sm font-normal tabular-nums text-muted-foreground",children:n})]}):null]}),r?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r}):null]}),l]})}a(xe,"SectionHeading");function _n({label:t,pending:s,onRemove:n}){return(0,e.jsx)(b,{size:"icon-xs",variant:"ghost","aria-label":`Remove ${t} from this responsibility`,title:"Remove from this responsibility. It stays wherever else it is filed.",disabled:s,onClick:n,children:(0,e.jsx)(Lt,{"aria-hidden":"true"})})}a(_n,"RemoveLinkButton");function Se({children:t,actions:s}){return(0,e.jsxs)("li",{className:"flex items-center gap-1 pr-3",children:[(0,e.jsx)("div",{className:"min-w-0 flex-1",children:t}),s?(0,e.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:s}):null]})}a(Se,"WorkRow");function Ln({responsibility:t,companyId:s,agents:n,agentsById:r,areas:l,now:i,actions:c,notices:d}){const[h,m]=(0,g.useState)(!1),x=(0,g.useMemo)(()=>new Map(t.projects.map(u=>[u.id,u])),[t.projects]),f=(0,g.useMemo)(()=>js(t.tasks),[t.tasks]),j=(0,g.useMemo)(()=>ft(t),[t]),w=(0,g.useMemo)(()=>({project:new Set(t.projects.map(u=>u.id)),task:new Set(t.tasks.filter(u=>u.membership==="direct").map(u=>u.id)),routine:new Set(t.routines.filter(u=>u.membership==="direct").map(u=>u.id)),skill:new Set(t.skills.filter(u=>u.linkId).map(u=>u.id))}),[t.projects,t.tasks,t.routines,t.skills]),k=t.status==="active",p=t.status!=="dismissed",C=a(u=>(0,e.jsx)(Yt,{companyId:s,responsibilityId:t.id,kind:u,linkedIds:w[u]}),"picker"),y=a((u,S,I)=>u&&p?(0,e.jsx)(_n,{label:S,pending:c.unlinkingId===u,onRemove:a(()=>c.unlink({linkId:u,label:S,relink:I}),"onRemove")}):null,"unlinkRow"),A=a(u=>p?(0,e.jsx)(st,{companyId:s,agents:n,item:u,size:"icon-xs"}):null,"giveRow"),F=a(u=>{if(!k||u.tone!=="attention")return null;const S=Ss(u);return S?(0,e.jsx)(st,{companyId:s,agents:n,item:S}):(0,e.jsxs)(b,{size:"xs",variant:"ghost",className:"shrink-0 text-muted-foreground",onClick:a(()=>c.newTask({defaultTitle:u.text}),"onClick"),"aria-label":`New task for an agent: ${u.text}`,children:[(0,e.jsx)(nt,{"aria-hidden":"true"}),"New task for an agent"]})},"signalAction"),D=a(u=>{const S=u.membership==="project"&&u.projectId?x.get(u.projectId):null;return(0,e.jsxs)(Se,{actions:(0,e.jsxs)(e.Fragment,{children:[kt(u.status)?null:A({kind:"task",id:u.id,label:u.title,currentAgentId:u.assigneeAgentId}),y(u.linkId,u.title,{issueId:u.id})]}),children:[(0,e.jsx)(Ne,{className:"border-b-0",leading:(0,e.jsx)(Ft,{...Et(u)}),identifier:u.identifier??void 0,title:u.title,to:Le(u),trailing:u.status==="blocked"?(0,e.jsx)("span",{className:"text-xs text-(--status-task-icon-blocked)",children:"Blocked"}):null}),S?(0,e.jsxs)("p",{className:"pb-2 pl-12 text-xs text-muted-foreground",children:["Here through"," ",(0,e.jsx)(M,{to:Ie(S),className:"underline-offset-4 hover:underline",children:S.name})]}):null]},u.id)},"renderTask");return(0,e.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-8",children:[t.status==="proposed"?(0,e.jsx)(ta,{companyId:s,proposed:[t],areas:t.area?[t.area]:[],heading:"Proposed for you",description:"Confirm it to start giving its work to agents, or adjust the bar and numbers first.",onReviewed:c.onProposalReviewed}):null,(0,e.jsxs)("header",{className:"flex flex-col gap-3",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,e.jsx)(Ae,{value:t.title,onSave:a(u=>{const S=u.trim();if(S&&S!==t.title)return c.saveTitle(S)},"onSave"),as:"h1",className:"text-2xl font-semibold text-foreground"}),(0,e.jsx)(Ae,{value:t.description??"",onSave:a(u=>c.saveDescription(u.trim()||null),"onSave"),as:"p",className:"text-sm text-muted-foreground",placeholder:"What this covers (optional)",multiline:!0,nullable:!0})]}),(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[k?(0,e.jsxs)(b,{variant:"outline",onClick:a(()=>c.newTask({defaultTitle:""}),"onClick"),children:[(0,e.jsx)(nt,{"aria-hidden":"true"}),"New task for an agent"]}):null,(0,e.jsxs)(H,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{size:"icon",variant:"ghost","aria-label":"More actions for this responsibility",children:(0,e.jsx)(pe,{"aria-hidden":"true"})})}),(0,e.jsxs)(B,{align:"end",children:[k?(0,e.jsx)(P,{onSelect:a(()=>c.setStatus("let_go"),"onSelect"),children:"Let go"}):t.status==="let_go"||t.status==="dismissed"?(0,e.jsx)(P,{onSelect:a(()=>c.setStatus("active"),"onSelect"),children:"Take it back on"}):null,(0,e.jsx)(ge,{}),(0,e.jsx)(P,{variant:"destructive",onSelect:c.requestDelete,children:"Delete…"})]})]})]})]}),(0,e.jsxs)("dl",{className:"flex flex-col gap-2 text-sm",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[(0,e.jsx)("dt",{className:"text-xs text-muted-foreground",children:"Area"}),(0,e.jsx)("dd",{children:(0,e.jsx)(ra,{responsibilityId:t.id,area:t.area,areas:l})})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("dt",{className:"text-xs text-muted-foreground",children:"Agents on this"}),(0,e.jsx)("dd",{children:(0,e.jsx)(sa,{agents:j,agentsById:r})})]})]}),t.status==="let_go"?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"You let go of this. Take it back on from the menu to own it again."}):t.status==="dismissed"?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"You dismissed this when it was proposed. Take it back on from the menu if you do own it."}):null]}),(0,e.jsx)(Ya,{responsibility:t,agentsById:r,now:i,editable:p}),(0,e.jsxs)("section",{"aria-labelledby":"responsibility-work-summary-heading",className:"flex flex-col gap-3",children:[(0,e.jsx)(xe,{id:"responsibility-work-summary-heading",title:"Across the work",question:"What its projects, tasks and routines need, and what they are getting done."}),t.rollup.workSummary.length>0?(0,e.jsx)(Te,{signals:t.rollup.workSummary,renderAction:F,responsibilityHref:a(()=>"#responsibility-bar","responsibilityHref")}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Nothing to report yet. Once projects, tasks or routines are filed here, what they need shows up here."})]}),d,(0,e.jsxs)("section",{"aria-labelledby":"responsibility-routines-heading",className:"flex flex-col gap-2",children:[(0,e.jsx)(xe,{id:"responsibility-routines-heading",title:"Routines",count:t.routines.length,question:"Tasks that repeat.",action:p?C("routine"):null}),t.routines.length>0?(0,e.jsx)("ul",{className:"flex flex-col",children:t.routines.map(u=>(0,e.jsx)(Se,{actions:(0,e.jsxs)(e.Fragment,{children:[u.status==="archived"?null:A({kind:"routine",id:u.id,label:u.title,currentAgentId:u.assigneeAgentId}),y(u.linkId,u.title,{routineId:u.id})]}),children:(0,e.jsx)(Ne,{className:"border-b-0",leading:(0,e.jsx)(Pt,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),title:u.title,to:jt(u.id),trailing:(0,e.jsx)(at,{status:u.status})})},u.id))}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No routines yet. A routine is work that repeats, like a weekly review. Add one you already have."})]}),(0,e.jsx)(Fn,{skills:t.skills,agentsById:r,addControl:p?C("skill"):null,removeControl:a(u=>y(u.linkId,u.name,{skillId:u.id}),"removeControl")}),(0,e.jsxs)("section",{"aria-labelledby":"responsibility-projects-heading",className:"flex flex-col gap-2",children:[(0,e.jsx)(xe,{id:"responsibility-projects-heading",title:"Projects",count:t.projects.length,question:"What groups of work move the number?",action:p?C("project"):null}),t.projects.length>0?(0,e.jsx)("ul",{className:"flex flex-col",children:t.projects.map(u=>{const S=ys(u.targetDate,i);return(0,e.jsx)(Se,{actions:(0,e.jsxs)(e.Fragment,{children:[A({kind:"project",id:u.id,label:u.name,currentAgentId:u.leadAgentId}),y(u.linkId,u.name,{projectId:u.id})]}),children:(0,e.jsx)(Ne,{className:"border-b-0",leading:(0,e.jsx)(fa,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),title:u.name,to:Ie(u),meta:S?(0,e.jsx)("span",{className:$("text-xs tabular-nums",S.late?"text-(--status-task-icon-blocked)":"text-muted-foreground"),children:S.late?`Late · ${S.label}`:`Due ${S.label}`}):null,trailing:(0,e.jsx)(at,{status:u.status})})},u.id)})}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No projects yet. A project groups the tasks that move this number, with a due date if it has one."})]}),(0,e.jsxs)("section",{"aria-labelledby":"responsibility-tasks-heading",className:"flex flex-col gap-2",children:[(0,e.jsx)(xe,{id:"responsibility-tasks-heading",title:"Tasks",count:t.rollup.openTasks,question:"Open work, done or not done.",action:p?C("task"):null}),f.blocked>0?(0,e.jsx)("p",{className:"text-sm text-(--status-task-icon-blocked)",children:f.blocked===1?"1 task is blocked.":`${f.blocked} tasks are blocked.`}):null,f.open.length>0?(0,e.jsx)("ul",{className:"flex flex-col",children:f.open.map(D)}):(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:["No open tasks. ",k?"Create one for an agent, or add a task you already have.":"Add a task you already have."]}),f.done.length>0?(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxs)(b,{size:"sm",variant:"ghost",className:"w-fit","aria-expanded":h,onClick:a(()=>m(u=>!u),"onClick"),children:[(0,e.jsx)(zt,{"aria-hidden":"true",className:$("transition-transform",!h&&"-rotate-90")}),h?"Hide":"Show"," ",f.done.length," done"]}),h?(0,e.jsx)("ul",{className:"flex flex-col",children:f.done.map(D)}):null]}):null,t.tasksTruncated?(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Showing the first ",200," tasks. The counts include all of them."]}):null]}),(0,e.jsx)(Mn,{artifacts:t.artifacts,total:t.artifactsTotal,truncated:t.artifactsTruncated})]})}a(Ln,"ResponsibilityPageLayout");function zn({responsibility:t,now:s,className:n}){const{rollup:r}=t,l=r.metric,i=l?Rs(l):null;return(0,e.jsxs)(q,{id:"responsibility-score",elevation:"low",className:$("gap-6 px-6 py-6",n),children:[l&&i?(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:l.name}),(0,e.jsx)("p",{className:"flex flex-wrap items-baseline gap-x-2 tabular-nums",children:i.current?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-4xl font-semibold text-foreground",children:i.current}),(0,e.jsx)("span",{className:"text-lg text-muted-foreground",children:i.targetLabel})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-2xl font-semibold text-muted-foreground",children:"No reading yet"}),(0,e.jsx)("span",{className:"text-lg text-muted-foreground",children:i.targetLabel})]})}),(0,e.jsx)(Ns,{reading:i,health:r.health,label:`${l.name}, toward its bar`,className:"h-2"})]}):(0,e.jsx)("p",{className:"text-2xl font-semibold text-muted-foreground",children:"No number to track yet"}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(me,{health:r.health,overridden:r.healthOverridden}),l?.stale&&l.updatedAt?(0,e.jsx)(Me,{label:vt(l.updatedAt,s)}):null]}),(0,e.jsx)("p",{className:"text-sm text-foreground",children:r.statusSentence})]})]})}a(zn,"ScoreHero");function Ce({label:t,count:s}){return(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-1 px-5 py-4","data-count":t.toLowerCase(),children:[(0,e.jsx)("dt",{className:"text-sm text-muted-foreground",children:t}),(0,e.jsx)("dd",{className:"text-2xl font-semibold tabular-nums text-foreground",children:s.value}),(0,e.jsx)("dd",{className:$("text-sm",s.alert?"text-(--status-task-icon-blocked)":"text-muted-foreground"),children:s.line})]})}a(Ce,"CountCell");function ut({label:t,value:s,children:n}){return(0,e.jsxs)(q,{elevation:"low",className:"min-w-0 gap-0.5 px-4 py-3","data-count":t.toLowerCase(),children:[(0,e.jsxs)("dt",{className:"flex items-baseline gap-2 text-sm text-muted-foreground",children:[t," ",(0,e.jsx)("span",{className:"font-semibold tabular-nums text-foreground",children:s})]}),(0,e.jsx)("dd",{className:"truncate text-xs text-muted-foreground",children:n})]})}a(ut,"CompactCount");function qn({responsibility:t,now:s,notices:n,onReviewProposal:r}){const l=(0,g.useMemo)(()=>Js(t),[t]),{skills:i,artifacts:c,artifactsTotal:d}=t,h=c[0]??null;return(0,e.jsx)("div",{className:"mx-auto flex w-full max-w-5xl flex-col","data-responsibility-view":"scorecard",children:(0,e.jsxs)("div",{className:"flex w-full max-w-3xl flex-col gap-6",children:[(0,e.jsx)(_e,{responsibility:t,children:n}),t.status==="proposed"?(0,e.jsx)(fe,{count:1,subject:"this",onReview:r}):null,(0,e.jsx)(zn,{responsibility:t,now:s}),(0,e.jsx)(q,{elevation:"low",className:"gap-0 py-0",children:(0,e.jsxs)("dl",{className:"grid grid-cols-1 divide-y divide-border sm:grid-cols-3 sm:divide-x sm:divide-y-0","aria-label":"The work",children:[(0,e.jsx)(Ce,{label:"Routines",count:l.routines}),(0,e.jsx)(Ce,{label:"Projects",count:l.projects}),(0,e.jsx)(Ce,{label:"Tasks",count:l.tasks})]})}),(0,e.jsxs)("dl",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,e.jsxs)(ut,{label:"Skills",value:String(i.length),children:[i.length===0?"None yet":i.slice(0,3).map((m,x)=>(0,e.jsxs)(g.Fragment,{children:[x>0?", ":null,(0,e.jsx)(M,{to:He(m),className:"underline-offset-4 hover:text-foreground hover:underline",children:m.name})]},m.id)),i.length>3?` and ${i.length-3} more`:null]}),(0,e.jsx)(ut,{label:"Artifacts",value:d>=1e3?`${Ct.toLocaleString("en-US")}+`:d.toLocaleString("en-US"),children:h?(0,e.jsxs)(e.Fragment,{children:["Newest:"," ",(0,e.jsx)(M,{to:h.href,className:"underline-offset-4 hover:text-foreground hover:underline",children:h.title})]}):"None yet"})]})]})})}a(qn,"ResponsibilityScorecard");var xt="#responsibility-status";function On({responsibility:t,agentsById:s,now:n,notices:r,onReviewProposal:l}){const{rollup:i}=t,c=(0,g.useMemo)(()=>i.workSummary.filter(x=>x.tone==="attention"),[i.workSummary]),d=(0,g.useMemo)(()=>i.workSummary.filter(x=>x.tone!=="attention"),[i.workSummary]),h=(0,g.useMemo)(()=>ia(t,n),[t,n]),m=i.metric?.stale&&i.metric.updatedAt?vt(i.metric.updatedAt,n):null;return(0,e.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-8","data-responsibility-view":"moving",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsx)(_e,{responsibility:t,children:r}),(0,e.jsxs)("p",{id:"responsibility-status",className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,e.jsx)(me,{health:i.health,overridden:i.healthOverridden}),(0,e.jsx)("span",{className:"text-sm text-foreground",children:i.statusSentence}),m?(0,e.jsx)(Me,{label:m}):null]})]}),t.status==="proposed"?(0,e.jsx)(fe,{count:1,subject:"this",onReview:l}):null,(0,e.jsxs)("section",{"aria-labelledby":"moving-summary-heading",className:"flex flex-col gap-3",children:[(0,e.jsx)("h2",{id:"moving-summary-heading",className:"text-base font-semibold text-foreground",children:"What's moving"}),i.workSummary.length===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Nothing to report yet. Once projects, tasks or routines are filed here, what they need shows up here."}):(0,e.jsxs)(q,{elevation:"low",className:"gap-5 px-5 py-4",children:[c.length>0?(0,e.jsxs)("div",{className:"flex flex-col gap-2","data-signal-group":"attention",children:[(0,e.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Needs attention"}),(0,e.jsx)(Te,{signals:c,responsibilityHref:a(()=>xt,"responsibilityHref")})]}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Nothing in the work needs attention."}),d.length>0?(0,e.jsxs)("div",{className:"flex flex-col gap-2","data-signal-group":"moving",children:[(0,e.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Everything else"}),(0,e.jsx)(Te,{signals:d,responsibilityHref:a(()=>xt,"responsibilityHref")})]}):null]})]}),(0,e.jsxs)("section",{"aria-labelledby":"moving-work-heading",className:"flex flex-col gap-2",children:[(0,e.jsxs)("h2",{id:"moving-work-heading",className:"text-base font-semibold text-foreground",children:["The work ",(0,e.jsx)("span",{className:"text-sm font-normal tabular-nums text-muted-foreground",children:h.items.length})]}),h.items.length>0?(0,e.jsx)(q,{elevation:"low",className:"gap-0 overflow-hidden py-0",children:(0,e.jsx)("ul",{className:"flex flex-col divide-y divide-border",children:h.items.map(x=>(0,e.jsx)(Ls,{item:x},`${x.kind}:${x.id}`))})}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No open projects, tasks or routines are filed here."}),h.finished>0||t.tasksTruncated?(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[h.finished>0?`${h.finished} finished ${h.finished===1?"item is":"items are"} not listed.`:null,h.finished>0&&t.tasksTruncated?" ":null,t.tasksTruncated?"Only the first 200 tasks are listed.":null]}):null]}),(0,e.jsx)(qs,{skills:t.skills,artifacts:t.artifacts,artifactsTotal:t.artifactsTotal,agentsById:s})]})}a(On,"ResponsibilityWhatsMoving");function Un(t,s){const n=V(),r=$t(),[l,i]=(0,g.useState)(null),c=Xs(s),d=Ws(s),h=[...R.responsibilities.detail(t.id),s,t.ownerUserId],m=a(()=>n.invalidateQueries({queryKey:R.responsibilities.all}),"refreshAll"),x=L({mutationFn:a(k=>_.update(t.id,k),"mutationFn"),onSuccess:a(k=>{n.setQueryData(h,p=>p&&{...p,...k}),m()},"onSuccess")}),f=L({mutationFn:a(()=>_.remove(t.id),"mutationFn"),onSuccess:a(()=>{n.removeQueries({queryKey:h}),n.invalidateQueries({queryKey:R.responsibilities.overviews(s)}),r("/responsibilities")},"onSuccess")}),j=L({mutationFn:a(k=>_.unlink(t.id,k.linkId),"mutationFn"),onSuccess:a((k,p)=>{i({label:p.label,relink:p.relink}),m()},"onSuccess")}),w=L({mutationFn:a(k=>_.link(t.id,k),"mutationFn"),onSuccess:a(()=>{i(null),m()},"onSuccess")});return{directory:c,areas:d.data??[],update:x,remove:f,unlink:j,relink:w,removed:l,navigate:r}}a(Un,"useResponsibilityPage");function Bn({responsibility:t,companyId:s}){const n=Un(t,s),{update:r,remove:l,unlink:i,relink:c,removed:d,navigate:h}=n,[m,x]=(0,g.useState)(null),[f,j]=(0,g.useState)(!1),{view:w,visiting:k,visit:p,leave:C}=la(Us,Os),y=(0,g.useMemo)(()=>new Date,[]),A=(0,g.useRef)(!1);(0,g.useEffect)(()=>{if(!A.current||w!=="full")return;A.current=!1;const v=requestAnimationFrame(()=>{const T=document.getElementById("responsibility-bar");T?.scrollIntoView?.({block:"start"}),T?.querySelector("button[data-bar-edit-primary]")?.click()});return()=>cancelAnimationFrame(v)},[w]);const F=a(()=>{A.current=!0,p("full")},"editBar"),D={saveTitle:a(v=>r.mutateAsync({title:v}),"saveTitle"),saveDescription:a(v=>r.mutateAsync({description:v}),"saveDescription"),setStatus:a(v=>r.mutate({status:v}),"setStatus"),requestDelete:a(()=>j(!0),"requestDelete"),newTask:x,unlink:a(v=>i.mutate(v),"unlink"),unlinkingId:i.isPending?i.variables?.linkId??null:null,onProposalReviewed:a(({dismissed:v})=>{v.length>0&&h("/responsibilities")},"onProposalReviewed")},u=(0,e.jsxs)(e.Fragment,{children:[r.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t save the change. ",E(r.error).body]}):null,d?(0,e.jsxs)("div",{role:"status",className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[(0,e.jsxs)("span",{children:["Removed “",d.label,"” from this responsibility. It still exists, and stays under any other responsibility it is filed under."]}),(0,e.jsx)(b,{size:"xs",variant:"ghost",disabled:c.isPending,onClick:a(()=>c.mutate(d.relink),"onClick"),children:"Undo"})]}):null,i.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t remove it from this responsibility. ",E(i.error).body]}):null,c.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t put it back. ",E(c.error).body]}):null]}),S={responsibility:t,companyId:s,agents:n.directory.agents,agentsById:n.directory.byId,areas:n.areas,now:y,actions:D,notices:u},I={...S,onReviewProposal:a(()=>p("full"),"onReviewProposal"),onEditBar:t.status==="dismissed"?void 0:F};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[k?(0,e.jsx)("div",{className:"mx-auto flex w-full max-w-5xl justify-end",children:(0,e.jsx)(b,{variant:"ghost",onClick:C,"data-responsibility-back":"",children:"Back"})}):null,w==="scorecard"?(0,e.jsx)(qn,{...I}):w==="moving"?(0,e.jsx)(On,{...I}):w==="one_screen"?(0,e.jsx)(sn,{...I}):w==="one_screen_v2"?(0,e.jsx)(En,{...I}):(0,e.jsx)(Ln,{...S})]}),m?(0,e.jsx)(ea,{open:!0,onOpenChange:a(v=>{v||x(null)},"onOpenChange"),companyId:s,responsibility:{id:t.id,title:t.title},defaultTitle:m.defaultTitle,projectId:m.projectId??null}):null,(0,e.jsx)(Tt,{open:f,onOpenChange:j,children:(0,e.jsxs)(Rt,{children:[(0,e.jsxs)(At,{children:[(0,e.jsxs)(Ot,{children:["Delete ",t.title,"?"]}),(0,e.jsx)(St,{children:"This removes the responsibility, its bar and its number. The projects, tasks and routines filed under it stay. To stop owning it but keep its history, let it go instead."})]}),l.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t delete it. ",E(l.error).body]}):null,(0,e.jsxs)(yt,{className:"items-center sm:justify-between",children:[(0,e.jsx)(Ut,{children:"Keep it"}),(0,e.jsx)(b,{variant:"destructive",disabled:l.isPending,onClick:a(()=>l.mutate(),"onClick"),children:l.isPending?"Deleting…":"Delete responsibility"})]})]})})]})}a(Bn,"ResponsibilityView");function er(){const{responsibilityId:t}=Sa(),{selectedCompanyId:s}=pa(),{setBreadcrumbs:n}=Ia(),{userId:r}=ca(),l=z({queryKey:[...R.responsibilities.detail(t??"__none__"),s,r],queryFn:a(()=>_.get(t),"queryFn"),enabled:!!t&&!!s&&!!r}),i=l.data?.title;return(0,g.useEffect)(()=>{n([{label:"Dashboard",href:"/responsibilities"},...i?[{label:i}]:[]])},[n,i]),!s||!t?null:(0,e.jsx)(Aa,{query:l,size:"page",action:"load this responsibility",loading:(0,e.jsx)(Fa,{variant:"detail"}),notFound:(0,e.jsxs)("div",{className:"mx-auto flex max-w-xl flex-col items-start gap-3 py-10",children:[(0,e.jsx)("h1",{className:"text-xl font-semibold text-foreground",children:"This responsibility is not available"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"It may have been deleted, or it belongs to someone else."}),(0,e.jsx)(b,{asChild:!0,variant:"outline",children:(0,e.jsx)(M,{to:"/responsibilities",children:"Back to the dashboard"})})]}),children:a(c=>c.companyId===s?(0,e.jsx)(Bn,{responsibility:c,companyId:s}):(0,e.jsxs)("div",{className:"mx-auto flex max-w-xl flex-col items-start gap-3 py-10",children:[(0,e.jsx)("h1",{className:"text-xl font-semibold text-foreground",children:"This responsibility belongs to another organization"}),(0,e.jsx)(b,{asChild:!0,variant:"outline",children:(0,e.jsx)(M,{to:"/responsibilities",children:"Back to the dashboard"})})]}),"children")})}a(er,"ResponsibilityDetail");export{er as ResponsibilityDetail};
1
+ var is=Object.defineProperty;var a=(t,s)=>is(t,"name",{value:s,configurable:!0});import{a as mt}from"./rolldown-runtime-DhZMWcEn.js";import{Bi as os,Bn as me,Dr as ds,En as _,Fn as ht,Fr as cs,In as us,Ir as Xe,It as xs,Jn as ms,Kt as hs,Li as gs,Ln as $e,Mn as fs,Nn as ps,Nr as js,Pn as gt,Pt as vs,Ri as bs,Rn as Ns,Sr as ks,Un as Ze,Vi as ws,Vn as Me,dr as ys,er as ft,et as Ae,fr as pt,gr as Ss,jn as Cs,jt as As,kr as jt,nr as Je,pr as vt,qt as bt,rr as Ts,ur as Rs,wn as Nt,wr as Is,xr as Ds,yr as kt,zi as Es,zn as et,zt as Ps}from"./issue-detail-CZfjXs0M.js";import{A as Fs,D as $s,E as tt,G as Ms,H as _s,K as Ls,L as zs,U as _e,V as fe,W as qs,X as Os,Z as Us,_ as Bs,a as Hs,at as Ks,b as Vs,d as Ws,dt as Qs,et as Ys,ft as Gs,g as Te,h as Xs,i as Zs,lt as Js,n as ea,o as ta,p as sa,pt as aa,q as na,r as ra,s as st,t as la,ut as ia,y as oa}from"./usePageView-CtFMs34g.js";import{b as at}from"./collections-B58p51lw.js";import{$A as da,Bb as ca,Cm as ua,Cv as wt,Cx as xa,Db as yt,ET as ma,E_ as q,Eb as St,Ek as Ct,Ev as U,Ex as ha,FE as ga,GS as R,Gb as M,Gw as fa,LS as pa,ME as V,NE as b,Ob as At,QE as Le,Sb as Tt,Sm as ja,Tb as Rt,Tv as It,Tx as va,UT as ba,Um as Dt,Up as Et,VC as Pt,Vp as Ft,Wm as Na,XC as Re,YS as ka,Yb as $t,Yw as wa,__ as Mt,_v as P,_w as ee,aC as ya,aE as Sa,ab as ae,bE as L,bm as Ca,bv as J,cb as Aa,cs as Ta,cw as te,dy as _t,eD as Ie,fy as ze,hE as E,hv as B,iC as Lt,iS as Ra,ib as Ia,jT as zt,jb as qt,kb as Ot,lS as Da,ly as qe,my as Oe,nT as pe,nj as Ea,pE as Pa,pb as Fa,pv as H,qC as ne,sw as $a,sy as Ue,uE as Ma,ub as je,uy as Be,vv as he,wC as nt,wb as Ut,wm as _a,wv as Bt,wx as La,xE as z,x_ as za,xv as ge,ym as qa,yv as Ht,zE as $}from"./index-BJtnP7H1.js";import{n as Oa}from"./NewProjectDialog-DrlUAF-N.js";import{t as Ua}from"./SkillCardIcon-Cp_hws0N.js";import{t as Ne}from"./EntityRow-BsICt6pd.js";import{r as He}from"./company-skill-routes-D5LJ1l8M.js";var g=mt(Ea(),1),e=mt(da(),1),Ba={behind:"behind",at_risk:"at_risk",on_track:"on_track",unknown:"not_measured"};function Ha(t,s=!0){return z({queryKey:R.responsibilities.statusReport(t),queryFn:a(()=>_.statusReport(t),"queryFn"),enabled:s,staleTime:3e4})}a(Ha,"useResponsibilityStatusReport");function Ka(t,s,n,r){return`Written by ${t.agentId?s.get(t.agentId)?.name??"an agent":t.userId?t.userId===r?"the owner":"a teammate":"an agent no longer here"} · ${pt(t.writtenAt,n)}`}a(Ka,"describeStatusAuthor");function Kt({responsibility:t,agentsById:s,now:n,editable:r,className:l}){const i=V(),c=Ha(t.id,t.status==="active"),d=L({mutationFn:a(()=>_.requestStatusUpdate(t.id),"mutationFn"),onSuccess:a(k=>i.setQueryData(R.responsibilities.statusReport(t.id),k),"onSuccess")}),{rollup:h}=t,m=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{children:(0,e.jsx)(me,{health:h.health,overridden:h.healthOverridden})}),(0,e.jsx)("p",{className:"text-sm text-foreground","data-status-sentence":"",children:h.statusSentence})]}),x=c.data?.current??null;if(!x)return(0,e.jsx)("div",{className:$("flex flex-col gap-1.5",l),children:m});const f=c.data?.reporterAgentId??x.agentId,j=f?s.get(f)?.name??"the agent":null,w=c.data?.updateRequested??!1;return(0,e.jsxs)("div",{className:$("flex flex-col gap-3",l),children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-agent-status":"",children:[(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,e.jsx)(me,{health:Ba[x.status],label:aa[x.status]})}),(0,e.jsx)("p",{className:"text-sm text-foreground","data-agent-status-message":"",children:x.message}),(0,e.jsxs)("p",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{children:Ka(x,s,n,t.ownerUserId)}),x.outOfDate?(0,e.jsx)(Me,{label:"Out of date"}):null]}),r&&j?(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxs)(b,{type:"button",size:"xs",variant:"ghost",className:"w-fit text-muted-foreground",disabled:w||d.isPending,onClick:a(()=>d.mutate(),"onClick"),"data-ask-for-update":"",children:[d.isPending?(0,e.jsx)(ee,{"aria-hidden":"true",className:"animate-spin"}):(0,e.jsx)(te,{"aria-hidden":"true"}),w?`Asked ${j} for an update`:`Ask ${j} for an update`]}),d.error?(0,e.jsxs)("p",{role:"alert",className:"text-xs text-destructive",children:["Couldn’t ask. ",E(d.error).body]}):null]}):null]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5 border-t border-border pt-3","data-derived-status":"",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"From the number"}),m]})]})}a(Kt,"ResponsibilityStatusBlock");function Ke(t){const s=V();return L({mutationFn:a(n=>_.update(t,n),"mutationFn"),onSuccess:a(n=>{s.setQueriesData({queryKey:R.responsibilities.detail(t)},r=>r&&{...r,...n}),s.invalidateQueries({queryKey:R.responsibilities.all})},"onSuccess")})}a(Ke,"useUpdateResponsibility");function Va(t,s){const n=z({queryKey:R.auth.session,queryFn:a(()=>ka.getSession(),"queryFn")}),r=z({queryKey:[...R.responsibilities.activity(t.id),t.metricUpdatedAt?String(t.metricUpdatedAt):null],queryFn:a(()=>Ra.list(t.companyId,{entityType:"responsibility",entityId:t.id,limit:50}),"queryFn"),enabled:!!t.metricUpdatedAt,staleTime:6e4}),l=Ds(r.data??[],t.metricUpdatedAt);return l?l.actorType==="agent"?s.get(l.actorId)?.name??"an agent":l.actorType==="user"?n.data?.user?.id&&l.actorId===n.data.user.id?"you":l.actorId===t.ownerUserId?"the owner":"a teammate":null:null}a(Va,"useReadingAuthor");function Vt({responsibility:t}){const s=(0,g.useId)(),n=Ke(t.id),[r,l]=(0,g.useState)(""),[i,c]=(0,g.useState)(null),d=ds(r),h=a((j,w)=>{n.isPending||n.mutate({metricCurrent:j},{onSuccess:a(()=>{w?.(),c("Recorded.")},"onSuccess")})},"record"),m=n.error?(0,e.jsxs)("p",{role:"alert",className:"text-xs text-destructive",children:["Couldn’t record it. ",E(n.error).body]}):null;if(t.metricKind==="yes_no")return(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",role:"group","aria-label":"Record a new reading",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Is it true today?"}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(b,{type:"button",size:"sm",variant:"outline",disabled:n.isPending,onClick:a(()=>h(!0),"onClick"),children:"Yes"}),(0,e.jsx)(b,{type:"button",size:"sm",variant:"outline",disabled:n.isPending,onClick:a(()=>h(!1),"onClick"),children:"No"})]}),i?(0,e.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:i}):null,m]});const x=a(j=>{j.preventDefault(),typeof d=="number"&&h(d,()=>l(""))},"submit"),f=t.metricKind==="percentage"?"%":t.metricUnit?.trim();return(0,e.jsxs)("form",{className:"flex flex-col gap-1.5",onSubmit:x,"aria-label":"Record a new reading",children:[(0,e.jsxs)("label",{htmlFor:s,className:"text-xs text-muted-foreground",children:["New reading",f?` (${f})`:""]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(Mt,{id:s,inputMode:"decimal",value:r,placeholder:t.metricCurrent===null?"e.g. 9":String(t.metricCurrent),className:"max-w-40","aria-invalid":d==="invalid"||void 0,onChange:a(j=>{l(j.target.value),c(null)},"onChange")}),(0,e.jsx)(b,{type:"submit",size:"sm",variant:"outline",disabled:typeof d!="number"||n.isPending,children:n.isPending?"Saving…":"Record"})]}),d==="invalid"?(0,e.jsx)("p",{className:"text-xs text-destructive",children:"Enter a number"}):null,i?(0,e.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:i}):null,m]})}a(Vt,"RecordReading");function Wt({responsibility:t,open:s,onOpenChange:n}){const r=Ke(t.id),[l,i]=(0,g.useState)(()=>Je(t)),[c,d]=(0,g.useState)(!1),h=r.reset;(0,g.useEffect)(()=>{s&&(i(Je(t)),d(!1),h())},[s,h]);const m=cs(l),x=new Set([...c&&!m.ok?m.missing:[],...Is(r.error)]),f=new Set(c&&!m.ok?m.invalid:[]),j=c&&!m.ok?m.problems:void 0,w=a(k=>{k.preventDefault(),d(!0),!(!m.ok||r.isPending)&&r.mutate(Ts(m.value),{onSuccess:a(()=>n(!1),"onSuccess")})},"submit");return(0,e.jsx)(Ue,{open:s,onOpenChange:n,children:(0,e.jsx)(qe,{className:"sm:max-w-xl",children:(0,e.jsxs)("form",{className:"flex flex-col gap-5",onSubmit:w,noValidate:!0,children:[(0,e.jsxs)(ze,{children:[(0,e.jsx)(Oe,{children:t.standard?.trim()?"Edit the bar":"Set the bar"}),(0,e.jsxs)(Be,{children:["How is success measured for ",t.title,"? The status follows from the reading, by the kind of measure you choose."]})]}),(0,e.jsx)(Gs,{draft:l,onChange:i,missing:x,invalid:f,problems:j}),r.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t save the bar. ",E(r.error).body]}):null,(0,e.jsxs)(_t,{className:"items-center sm:justify-between",children:[(0,e.jsx)(b,{type:"button",variant:"ghost",onClick:a(()=>n(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(b,{type:"submit",disabled:r.isPending,children:r.isPending?"Saving…":"Save the bar"})]})]})})})}a(Wt,"EditBarDialog");function Ve(t,s){const n=V(),r=$t(),l=z({queryKey:R.responsibilities.barConversation(t.id),queryFn:a(()=>Xe.conversation(t.id),"queryFn"),enabled:s}),i=L({mutationFn:a(()=>Xe.start(t.id),"mutationFn"),onSuccess:a(m=>{n.setQueryData(R.responsibilities.barConversation(t.id),m),m.conversation&&r(`/issues/${m.conversation.identifier??m.conversation.issueId}`)},"onSuccess")}),c=je(l),d=l.data??null,h=d?.state==="discussing"||d?.state==="proposal_waiting";return{state:d,open:h,canTalk:!!d&&(h||d.defaultAgentId!==null),start:i,loadError:s&&c.kind==="error"?c.error:null,retry:c.retry,retrying:c.isFetching}}a(Ve,"useBarConversation");function Wa({responsibility:t,agentsById:s}){const n=t.status==="active"||t.status==="proposed",r=Ve(t,n);return!n||!r.state||!r.state.proposal&&r.state.state!=="discussing"?null:(0,e.jsx)(Qt,{state:r.state,agentsById:s})}a(Wa,"BarConversationStatus");function Qt({state:t,agentsById:s}){if(t.proposal)return(0,e.jsx)(Cs,{interaction:t.proposal,showConversationLink:!0,showResponsibilityLink:!1});if(t.state!=="discussing"||!t.conversation)return null;const n=t.conversation.agentId?s.get(t.conversation.agentId)?.name:null;return(0,e.jsxs)("p",{className:"flex flex-wrap items-center gap-x-2 text-sm text-muted-foreground","data-testid":"bar-conversation-open",children:[(0,e.jsx)(te,{"aria-hidden":!0,className:"h-4 w-4 shrink-0"}),(0,e.jsxs)("span",{children:["You are talking the bar through with ",n??"an agent","."]}),(0,e.jsx)(M,{to:`/issues/${t.conversation.identifier??t.conversation.issueId}`,className:"font-medium text-foreground underline-offset-4 hover:underline",children:"Open the conversation"})]})}a(Qt,"BarConversationNotice");function Qa({responsibility:t}){const s=Ke(t.id),n=t.healthOverride??"automatic",{rollup:r}=t;return(0,e.jsxs)("div",{className:"flex flex-col gap-2",children:[r.healthOverridden?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Set by hand.",r.computedHealth!==r.health?` From the number alone it is ${ms[r.computedHealth].toLowerCase()}.`:""]}),(0,e.jsx)(Ae,{value:t.healthNote??"",onSave:a(l=>s.mutateAsync({healthNote:l.trim()||null}),"onSave"),as:"p",className:"text-sm text-foreground",placeholder:"Why you set it (optional)",nullable:!0})]}):null,(0,e.jsxs)(H,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsxs)(b,{size:"xs",variant:"ghost",className:"w-fit text-muted-foreground",disabled:s.isPending,children:[r.healthOverridden?"Change or clear":"Set the status by hand",(0,e.jsx)(zt,{"aria-hidden":"true"})]})}),(0,e.jsxs)(B,{align:"start",children:[(0,e.jsx)(he,{children:"Status"}),(0,e.jsxs)(Ht,{value:n,onValueChange:a(l=>s.mutate({healthOverride:l==="automatic"?null:l}),"onValueChange"),children:[(0,e.jsx)(J,{value:"automatic",children:"From the number"}),(0,e.jsx)(J,{value:"behind",children:"Behind"}),(0,e.jsx)(J,{value:"at_risk",children:"At risk"}),(0,e.jsx)(J,{value:"on_track",children:"On track"})]})]})]}),s.error?(0,e.jsxs)("p",{role:"alert",className:"text-xs text-destructive",children:["Couldn’t change the status. ",E(s.error).body]}):null]})}a(Qa,"StatusOverride");function Ya({responsibility:t,agentsById:s,now:n,editable:r}){const l=(0,g.useId)(),[i,c]=(0,g.useState)(!1),d=Ve(t,r),h=!!t.standard?.trim(),{rollup:m}=t,x=Va(t,s),f=m.metric?.updatedAt??null;return(0,e.jsxs)(q,{id:"responsibility-bar",elevation:"low",className:"gap-5 px-5 py-5","aria-labelledby":l,children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,e.jsx)("h2",{id:l,className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"The bar"}),(0,e.jsx)("p",{className:"text-base text-foreground",children:t.standard?.trim()||(0,e.jsx)("span",{className:"text-muted-foreground",children:"No bar yet. How is success measured?"})})]}),r?(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:d.canTalk?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(b,{size:"sm",variant:"ghost",onClick:a(()=>c(!0),"onClick"),children:[(0,e.jsx)(Re,{"aria-hidden":"true"}),"Edit by hand"]}),(0,e.jsxs)(b,{size:"sm",variant:h?"outline":"default","data-bar-edit-primary":"",disabled:d.start.isPending,onClick:a(()=>d.start.mutate(),"onClick"),children:[d.start.isPending?(0,e.jsx)(ee,{"aria-hidden":"true",className:"animate-spin"}):(0,e.jsx)(te,{"aria-hidden":"true"}),d.open?"Continue the conversation":h?"Edit the bar":"Set the bar"]})]}):(0,e.jsxs)(b,{size:"sm",variant:"ghost","data-bar-edit-primary":"",onClick:a(()=>c(!0),"onClick"),children:[(0,e.jsx)(Re,{"aria-hidden":"true"}),h?"Edit the bar":"Set the bar"]})}):null]}),d.start.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t start the conversation. ",E(d.start.error).body," You can still edit the bar by hand."]}):null,d.loadError?(0,e.jsx)(ae,{error:d.loadError,size:"inline",action:"load the bar conversation",onRetry:d.retry,retrying:d.retrying}):null,r&&d.state?(0,e.jsx)(Qt,{state:d.state,agentsById:s}):null,(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-bar-status":"",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Status"}),(0,e.jsx)(Kt,{responsibility:t,agentsById:s,now:n,editable:r})]}),r?(0,e.jsx)(Qa,{responsibility:t}):null]}),(0,e.jsx)("div",{className:"border-t border-border pt-5","data-bar-metrics":"",children:(0,e.jsx)(ht,{responsibilityId:t.id,primary:m.metric,now:n,agentsById:s,layout:"grid",editable:r,fallback:(0,e.jsx)($e,{metric:m.metric,health:m.health,now:n,size:"hero",className:"max-w-sm"})})}),f||m.metric?(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:f?`Updated ${pt(f,n)}${x?` by ${x}`:""}.`:"No reading yet. The agents working on this keep the number current; you can record one too."}),r&&m.metric?(0,e.jsx)(Vt,{responsibility:t}):null]}):null,r?(0,e.jsx)(Wt,{responsibility:t,open:i,onOpenChange:c}):null]})}a(Ya,"ResponsibilityBarCard");var Ga={project:3,task:4,routine:3},Xa={project:"Projects",task:"Tasks",routine:"Routines"},Za={project:"No open projects.",task:"No open tasks.",routine:"No routines."},Ja={holding:"Holding the number back: ",moving:"Moving the number: ",neutral:""},De={holding:"text-(--status-task-icon-blocked)",moving:"text-(--status-task-icon-done)",neutral:"text-muted-foreground"};function Ee({bearing:t}){return t==="holding"?(0,e.jsx)(ma,{"aria-hidden":"true",className:"size-3.5 shrink-0"}):t==="moving"?(0,e.jsx)(ba,{"aria-hidden":"true",className:"size-3.5 shrink-0"}):null}a(Ee,"BearingIcon");function en({entry:t,automate:s}){const{item:n,bearing:r,reason:l}=t,i=s?.onByHand;return(0,e.jsxs)("li",{"data-work-kind":n.kind,"data-work-id":n.id,"data-bearing":r,"data-finished":t.finished?"true":void 0,className:i?"relative":void 0,children:[(0,e.jsxs)(M,{to:n.href,className:$("flex min-w-0 items-start gap-3 px-4 py-2 text-sm transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",i&&"pr-18"),children:[(0,e.jsx)("span",{className:"mt-0.5",children:(0,e.jsx)(na,{item:n,showLabel:!1})}),(0,e.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,e.jsxs)("span",{className:"flex min-w-0 items-baseline gap-2",children:[n.kind==="task"&&n.task.identifier?(0,e.jsx)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:n.task.identifier}):null,(0,e.jsx)("span",{className:$("line-clamp-1 text-foreground",t.finished&&"text-muted-foreground"),title:n.title,children:n.title})]}),(0,e.jsxs)("span",{className:$("flex min-w-0 items-center gap-1 text-xs",De[r]),"data-bearing-reason":"",children:[(0,e.jsx)(Ee,{bearing:r}),(0,e.jsxs)("span",{className:"line-clamp-1",title:l,children:[(0,e.jsx)("span",{className:"sr-only",children:Ja[r]}),l]})]})]})]}),s?(0,e.jsxs)("span",{className:"absolute right-3 top-2 flex items-center gap-0.5",children:[(0,e.jsx)(b,{type:"button",size:"icon-xs",variant:"ghost",className:"text-muted-foreground",disabled:s.busy,"aria-label":`${s.label}: “${n.title}”`,title:s.label,onClick:s.onTalk,"data-automate-with-agent":"",children:(0,e.jsx)($a,{"aria-hidden":"true"})}),(0,e.jsx)(b,{type:"button",size:"icon-xs",variant:"ghost",className:"text-muted-foreground","aria-label":`Set up “${n.title}” by hand`,title:"Set it up by hand",onClick:s.onByHand,"data-make-routine":"",children:(0,e.jsx)(ya,{"aria-hidden":"true"})})]}):null]})}a(en,"BearingRow");function ke({kind:t,items:s,total:n,automateFor:r}){const{shown:l}=Ys(s,Ga[t]),i=Math.max(0,n-l.length),c=`one-screen-${t}-heading`;return(0,e.jsx)("section",{"aria-labelledby":c,"data-work-list":t,children:(0,e.jsxs)(q,{elevation:"low",className:"gap-0 overflow-hidden py-0",children:[(0,e.jsxs)("h2",{id:c,className:"flex items-baseline gap-2 border-b border-border px-4 py-2 text-sm font-semibold text-foreground",children:[Xa[t]," ",(0,e.jsx)("span",{className:"text-xs font-normal tabular-nums text-muted-foreground",children:n})]}),l.length>0?(0,e.jsx)("ul",{className:"flex flex-col",children:l.map(d=>(0,e.jsx)(en,{entry:d,automate:r?.(d)},d.item.id))}):(0,e.jsx)("p",{className:"px-4 py-2 text-sm text-muted-foreground",children:Za[t]}),i>0?(0,e.jsxs)("p",{className:"border-t border-border px-4 py-1.5 text-xs text-muted-foreground",children:["and ",i," more"]}):null]})})}a(ke,"CappedList");function tn(){return(0,e.jsxs)("p",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground","data-bearing-key":"",children:[(0,e.jsxs)("span",{className:$("flex items-center gap-1",De.holding),children:[(0,e.jsx)(Ee,{bearing:"holding"}),"Holding the number back"]}),(0,e.jsxs)("span",{className:$("flex items-center gap-1",De.moving),children:[(0,e.jsx)(Ee,{bearing:"moving"}),"Moving it"]})]})}a(tn,"BearingKey");function sn({responsibility:t,companyId:s,agents:n,agentsById:r,now:l,notices:i,actions:c,onReviewProposal:d,onEditBar:h}){const{rollup:m}=t,x=z({queryKey:R.responsibilities.automation(s,t.ownerUserId),queryFn:a(()=>_.automation(s,{ownerUserId:t.ownerUserId}),"queryFn"),enabled:!!s&&t.status==="active"}).data?.responsibilities.find(v=>v.responsibilityId===t.id)??null,[f,j]=(0,g.useState)(null),w=(0,g.useCallback)(v=>r.get(v)?.name,[r]),k=Vs(),p=k.open,C=(0,g.useCallback)(v=>{if(v.item.kind!=="task"||!x?.manualTaskIds.includes(v.item.id))return;const{task:T}=v.item,N=x.candidates.find(ve=>ve.issueId===T.id),W=N?.responsibleAgentId??T.assigneeAgentId??null;return{label:Fs({conversation:N?.conversation??null,responsibleAgentId:W},w),busy:k.isPending,onTalk:a(()=>p({issueId:T.id,agentId:W,responsibilityId:t.id,conversation:N?.conversation??null}),"onTalk"),onByHand:a(()=>j({issueId:T.id,identifier:T.identifier,title:N?.pendingOffer?.title??T.title,assigneeAgentId:N?.pendingOffer?.agentId??W,suggestedCadence:N?.suggestedCadence??null,cadenceSource:N?.cadenceSource}),"onByHand")}},[x,w,k.isPending,p,t.id]),y=(0,g.useMemo)(()=>{const v=Qs(t,l,w);return{project:v.filter(T=>T.item.kind==="project"),task:v.filter(T=>T.item.kind==="task"),routine:v.filter(T=>T.item.kind==="routine")}},[t,l,w]),A=oa(t.id),F=t.standard?.trim(),D=y.task.filter(v=>!v.finished).length,u=y.task.length-D,S=[...y.project,...y.task,...y.routine].some(v=>v.bearing!=="neutral"),I=h&&t.status!=="dismissed";return(0,e.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-5","data-responsibility-view":"one_screen",children:[(0,e.jsx)(_e,{responsibility:t,actions:(0,e.jsx)(_s,{status:t.status,actions:c}),children:i}),t.status==="proposed"?(0,e.jsx)(fe,{count:1,subject:"this",onReview:d}):null,(0,e.jsx)(Wa,{responsibility:t,agentsById:r}),(0,e.jsxs)("div",{className:"grid gap-5 lg:grid-cols-5",children:[(0,e.jsxs)(q,{id:"responsibility-bar-summary",elevation:"low",className:"h-fit gap-5 px-5 py-5 lg:col-span-2","aria-labelledby":"one-screen-bar-heading",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h2",{id:"one-screen-bar-heading",className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"The bar"}),I?(0,e.jsxs)(b,{size:"xs",variant:"ghost",onClick:h,children:[(0,e.jsx)(Re,{"aria-hidden":"true"}),"Edit the bar"]}):null]}),(0,e.jsx)("p",{className:"text-sm text-foreground",children:F||(0,e.jsx)("span",{className:"text-muted-foreground",children:"No bar yet."})})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(Kt,{responsibility:t,agentsById:r,now:l,editable:!!I}),x?(0,e.jsxs)("p",{className:"flex items-center gap-1.5 text-xs tabular-nums text-muted-foreground","data-automation-line":"",children:[(0,e.jsx)(Pt,{"aria-hidden":"true",className:"size-3.5 shrink-0"}),$s(x.automationCount,x.manualTaskCount),tt(x.share)?` · ${tt(x.share)}`:null]}):null]}),(0,e.jsx)("div",{className:"border-t border-border pt-4","data-bar-metrics":"",children:(0,e.jsx)(ht,{responsibilityId:t.id,primary:m.metric,now:l,agentsById:r,layout:"stack",editable:!!I,fallback:(0,e.jsx)($e,{metric:m.metric,health:m.health,now:l,size:"hero"})})}),A.summary?.text.trim()?(0,e.jsxs)("section",{"aria-labelledby":"one-screen-affecting-heading",className:"flex flex-col gap-1.5 border-t border-border pt-4","data-affecting-summary":"",children:[(0,e.jsx)("h3",{id:"one-screen-affecting-heading",className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"What is affecting the number"}),(0,e.jsx)(Bs,{summary:A.summary,stillWaiting:A.stillWaiting})]}):null]}),(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-4 lg:col-span-3","data-work-order":"",children:[S?(0,e.jsx)(tn,{}):null,(0,e.jsx)(ke,{kind:"routine",items:y.routine,total:y.routine.length}),(0,e.jsx)(Ms,{skills:t.skills,agentsById:r}),(0,e.jsx)(ke,{kind:"project",items:y.project,total:y.project.length}),(0,e.jsx)(ke,{kind:"task",items:y.task,total:Math.max(m.openTasks,D)+u,automateFor:C}),k.error?(0,e.jsxs)("p",{role:"alert",className:"text-xs text-destructive",children:["Couldn’t open the conversation. ",E(k.error).body]}):null,(0,e.jsx)(zs,{artifacts:t.artifacts,total:t.artifactsTotal})]})]}),(0,e.jsx)(Nt,{open:f!==null,onOpenChange:a(v=>{v||j(null)},"onOpenChange"),companyId:s,task:f,agents:n,filedUnder:[t.title]})]})}a(sn,"ResponsibilityOneScreen");var Pe=6e4,Fe=60*Pe,se=24*Fe,rt=7*se,lt=30*se;function X(t,s){const n=Math.max(0,s.getTime()-new Date(t).getTime());return n<Pe?"just now":n<Fe?`${Math.floor(n/Pe)}m ago`:n<se?`${Math.floor(n/Fe)}h ago`:n<rt?`${Math.floor(n/se)}d ago`:n<lt?`${Math.floor(n/rt)}w ago`:`${Math.floor(n/lt)}mo ago`}a(X,"ago");function an(t,s){if(t.status==="paused")return"Paused";const n=t.lastRun;if(!n)return"Not run yet";const r=X(n.at,s);return n.outcome==="succeeded"?`Last successful run ${r}`:n.outcome==="failed"?`Failed ${r}`:`Running, started ${r}`}a(an,"routineStat");function nn(t,s){const[n,r,l]=t.split("-").map(Number);if(!n||!r||!l)return null;const[i,c,d]=ks(s).split("-").map(Number);return Math.round((Date.UTC(n,r-1,l)-Date.UTC(i,c-1,d))/se)}a(nn,"daysUntil");function rn(t,s){if(!t.targetDate)return null;const n=nn(t.targetDate,s);return n===null?null:n===0?"Due today":n===1?"Due tomorrow":n>1?`Due in ${n} days`:n===-1?"1 day late":`${-n} days late`}a(rn,"projectDueStat");function ln(t){return`${t.done} of ${t.total} ${t.total===1?"task":"tasks"} done`}a(ln,"projectProgressLabel");function on(t){return{open:t.filter(s=>!kt(s.status)),done:t.filter(s=>s.status==="done")}}a(on,"splitTasksForTable");var dn={succeeded:"Succeeded",failed:"Failed",cancelled:"Cancelled",timed_out:"Timed out"};function cn(t,s){return t.status==="running"?`Running, started ${X(t.startedAt??t.createdAt,s)}`:t.status==="queued"?`Queued ${X(t.createdAt,s)}`:`${dn[t.status]??`${t.status.charAt(0).toUpperCase()}${t.status.slice(1).replace(/_/g," ")}`} ${X(t.finishedAt??t.startedAt??t.createdAt,s)}`}a(cn,"runStat");var it=20,un=200,K={project:"project",task:"task",routine:"routine",skill:"skill"};function xn(t,s){return t instanceof Pa&&t.status===404?`That ${K[s]} is no longer available to you. It may have been deleted or made private.`:E(t).body}a(xn,"describeLinkError");function mn(t,s){return t==="project"?{projectId:s}:t==="task"?{issueId:s}:t==="skill"?{skillId:s}:{routineId:s}}a(mn,"linkBody");function hn(t,s){const[n,r]=(0,g.useState)(t);return(0,g.useEffect)(()=>{const l=window.setTimeout(()=>r(t),s);return()=>window.clearTimeout(l)},[t,s]),n}a(hn,"useDebounced");function Yt({companyId:t,responsibilityId:s,kind:n,linkedIds:r,onLinked:l,open:i,onOpenChange:c,anchor:d}){const h=V(),[m,x]=(0,g.useState)(!1),f=i??m,j=a(N=>{i===void 0&&x(N),c?.(N)},"setOpen"),[w,k]=(0,g.useState)(""),p=hn(w.trim(),un),C=z({...za(t),enabled:f&&n==="project"}),y=z({queryKey:R.routines.list(t),queryFn:a(()=>Dt.list(t),"queryFn"),enabled:f&&n==="routine"}),A=z({queryKey:R.companySkills.list(t),queryFn:a(()=>Na.list(t),"queryFn"),enabled:f&&n==="skill"}),F=z({queryKey:R.issues.search(t,p,void 0,it),queryFn:a(()=>Da.list(t,{q:p||void 0,limit:it}),"queryFn"),enabled:f&&n==="task"}),D=(0,g.useMemo)(()=>n==="project"?(C.data??[]).map(N=>({id:N.id,label:N.name})):n==="routine"?(y.data??[]).map(N=>({id:N.id,label:N.title})):n==="skill"?(A.data??[]).map(N=>({id:N.id,label:N.name})):(F.data??[]).map(N=>({id:N.id,label:N.title,detail:N.identifier})),[n,C.data,y.data,A.data,F.data]),u=(0,g.useMemo)(()=>D.filter(N=>!r.has(N.id)),[D,r]),S=n==="project"?C:n==="routine"?y:n==="skill"?A:F,I=je({data:S.data,error:S.error,status:S.status,fetchStatus:S.fetchStatus,failureReason:S.failureReason,refetch:S.refetch}),v=L({mutationFn:a(N=>_.link(s,mn(n,N)),"mutationFn"),onSuccess:a(N=>{j(!1),k(""),l?.(N),h.invalidateQueries({queryKey:R.responsibilities.all})},"onSuccess")}),T=v.reset;return(0,g.useEffect)(()=>{f&&T()},[f,T]),(0,e.jsxs)(xa,{open:f,onOpenChange:j,children:[d?(0,e.jsx)(La,{asChild:!0,children:(0,e.jsx)("span",{className:"inline-flex",children:d})}):(0,e.jsx)(ha,{asChild:!0,children:(0,e.jsxs)(b,{size:"sm",variant:"ghost",children:[(0,e.jsx)(ne,{"aria-hidden":"true"}),"Add existing ",K[n]]})}),(0,e.jsx)(va,{align:"end",className:"w-80 p-0",children:(0,e.jsxs)(qa,{shouldFilter:n!=="task",children:[(0,e.jsx)(ja,{value:w,onValueChange:k,placeholder:`Search ${K[n]}s…`,"aria-label":`Search ${K[n]}s`}),(0,e.jsx)(_a,{children:I.kind==="error"?(0,e.jsx)("div",{className:"px-3 py-4",children:(0,e.jsx)(ae,{error:I.error,size:"inline",action:`load ${K[n]}s`,onRetry:I.retry,retrying:I.isFetching})}):I.data?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Ca,{children:D.length>0&&u.length===0?`Every matching ${K[n]} is already here.`:`No ${K[n]}s found.`}),u.map(N=>(0,e.jsxs)(ua,{value:`${N.label} ${N.detail??""} ${N.id}`,disabled:v.isPending,onSelect:a(()=>v.mutate(N.id),"onSelect"),children:[N.detail?(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:N.detail}):null,(0,e.jsx)("span",{className:"truncate",children:N.label})]},N.id))]}):(0,e.jsx)("p",{className:"px-3 py-4 text-sm text-muted-foreground",role:"status",children:"Loading…"})}),v.error?(0,e.jsx)("p",{role:"alert",className:"border-t border-border px-3 py-2 text-sm text-destructive",children:xn(v.error,n)}):null]})})]})}a(Yt,"AddExistingWorkPicker");function gn(t,s){return Ze(t,s)??Ze({...t,primaryDisplay:bs(t.bar.metricKind,t.metricCurrent===null?0:1)},s)}a(gn,"proposalVisualizations");function fn(t,s){if(s.size!==0)return Array.from({length:t},(n,r)=>r).filter(n=>!s.has(n))}a(fn,"keptMetricIndexes");function Gt(t){return t.health===null?t:{...t,health:null}}a(Gt,"withoutStatus");function Xt(t){return $("grid gap-x-6 gap-y-5",t>1&&"sm:grid-cols-2",t>2&&"lg:grid-cols-3")}a(Xt,"tileGrid");function pn({interaction:t,agentsById:s}){const n=(0,g.useMemo)(()=>new Date,[]),r=(0,g.useMemo)(()=>gn(t.payload,n),[t.payload,n]),[l,i]=(0,g.useState)(new Set),[c,d]=(0,g.useState)(!1),{accept:h,decline:m,busy:x,error:f}=ps(t),j=(t.createdByAgentId?s.get(t.createdByAgentId)?.name:null)??"Your agent",w=r.metrics.length-1,k=a(p=>i(C=>{const y=new Set(C);return y.has(p)?y.delete(p):y.add(p),y}),"toggle");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-bar-proposal":"","data-testid":"bar-proposal",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[j," proposes"]}),(0,e.jsx)("p",{className:"text-sm text-foreground",children:t.payload.bar.standard})]}),(0,e.jsx)("div",{className:Xt(r.metrics.length),children:r.metrics.map((p,C)=>{const y=C-1;return p.role==="supporting"&&l.has(y)?(0,e.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2 rounded-md border border-dashed border-border px-3 py-2.5","data-metric-key":p.key,"data-dropped":"",children:[(0,e.jsx)("span",{className:"truncate text-sm text-muted-foreground line-through",children:p.title}),(0,e.jsx)(b,{type:"button",size:"xs",variant:"ghost",disabled:x,onClick:a(()=>k(y),"onClick"),children:"Keep"})]},p.key):(0,e.jsx)(gt,{metric:Gt(p),now:n,primary:p.role==="primary"?r.primary:null,details:"on_demand",showReadLine:!1,className:"rounded-md border border-border px-3 py-2.5",menu:p.role==="primary"?w>0?(0,e.jsx)("span",{className:"pr-1.5 pt-1 text-xs text-muted-foreground","data-always-kept":"",children:"Always kept"}):null:(0,e.jsx)(b,{type:"button",size:"icon-xs",variant:"ghost",className:"text-muted-foreground","aria-label":`Drop “${p.title}”`,title:"Drop",disabled:x,onClick:a(()=>k(y),"onClick"),"data-drop-metric":"",children:(0,e.jsx)(Lt,{"aria-hidden":"true"})})},p.key)})}),f?(0,e.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:E(f).body}):null,c?(0,e.jsx)(fs,{busy:x,sending:m.isPending,onSend:a(p=>m.mutate(p,{onSuccess:a(()=>d(!1),"onSuccess")}),"onSend"),onBack:a(()=>d(!1),"onBack")}):(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[(0,e.jsx)(b,{type:"button",variant:"ghost",size:"sm",disabled:x,onClick:a(()=>d(!0),"onClick"),children:"Not right"}),(0,e.jsxs)(b,{type:"button",size:"sm",disabled:x,onClick:a(()=>h.mutate(fn(w,l)),"onClick"),children:[h.isPending?(0,e.jsx)(ee,{"aria-hidden":"true",className:"animate-spin"}):null,"Use this bar"]})]})]})}a(pn,"ProposalPreview");function jn({metric:t,onShowAs:s,onRemove:n,busy:r}){const l=t.role==="primary"?t.kind:null,i=ws({role:t.role,kind:l,display:t.display,unit:t.unit}),c=os({display:t.display,kind:l});return i.length<=1&&!n?null:(0,e.jsxs)(H,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{type:"button",size:"icon-xs",variant:"ghost",className:"text-muted-foreground","aria-label":`Options for “${t.title}”`,disabled:r,children:(0,e.jsx)(pe,{"aria-hidden":"true"})})}),(0,e.jsxs)(B,{align:"end",children:[i.length>1?(0,e.jsxs)(wt,{children:[(0,e.jsx)(It,{children:"Show as"}),(0,e.jsx)(Bt,{children:(0,e.jsx)(Ht,{value:c,onValueChange:a(d=>{d!==c&&s(Es(d))},"onValueChange"),children:i.map(d=>(0,e.jsx)(J,{value:d,children:gs[d]},d))})})]}):null,n?(0,e.jsx)(P,{variant:"destructive",onSelect:n,children:"Remove"}):null]})]})}a(jn,"VisualizationMenu");function vn(t){const s=V(),n=R.responsibilities.metrics(t);return{showAs:L({mutationFn:a(({metric:r,display:l})=>et.setDisplay(t,r.role==="primary"?"primary":r.id,l),"mutationFn"),onMutate:a(async({metric:r,display:l})=>{await s.cancelQueries({queryKey:n});const i=s.getQueryData(n);return s.setQueryData(n,c=>c&&{...c,metrics:c.metrics.map(d=>d.key===r.key?{...d,display:l,period:l==="bar"?"week":null}:d)}),{before:i}},"onMutate"),onError:a((r,l,i)=>{i?.before&&s.setQueryData(n,i.before)},"onError"),onSuccess:a(r=>s.setQueryData(n,r),"onSuccess")}),remove:L({mutationFn:a(r=>et.removeMetric(t,r.id),"mutationFn"),onSuccess:a(r=>s.setQueryData(n,r),"onSuccess")})}}a(vn,"useVisualizationWrites");function bn({responsibility:t,now:s,editable:n}){const r=us(t.id),l=je(r),{showAs:i,remove:c}=vn(t.id),[d,h]=(0,g.useState)(null),m=t.rollup.metric;if(!r.data||l.kind==="error")return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)($e,{metric:m,health:t.rollup.health,now:s,size:"hero",className:"max-w-sm"}),l.kind==="error"?(0,e.jsx)(ae,{error:l.error,size:"inline",action:"load the measures",onRetry:l.retry,retrying:l.isFetching}):null]});const x=r.data,f=n&&x.source==="chosen";return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:Xt(x.metrics.length),"data-bar-visualizations":x.source,children:x.metrics.map(j=>(0,e.jsx)(gt,{metric:Gt(j),now:s,primary:j.role==="primary"?m:null,details:"on_demand",menu:f?(0,e.jsx)(jn,{metric:j,busy:i.isPending||c.isPending,onShowAs:a(w=>i.mutate({metric:j,display:w}),"onShowAs"),onRemove:j.role==="supporting"&&j.id?()=>{c.reset(),h(j)}:void 0}):void 0},j.key))}),i.error?(0,e.jsxs)("p",{role:"alert",className:"text-xs text-destructive",children:["Couldn’t change how it is shown. ",E(i.error).body]}):null,(0,e.jsx)(Tt,{open:d!==null,onOpenChange:a(j=>{j||h(null)},"onOpenChange"),children:(0,e.jsxs)(Rt,{children:[(0,e.jsxs)(At,{children:[(0,e.jsxs)(Ot,{children:["Remove “",d?.title,"”?"]}),(0,e.jsx)(St,{children:"Its readings are kept."})]}),c.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t remove it. ",E(c.error).body]}):null,(0,e.jsxs)(yt,{className:"items-center sm:justify-between",children:[(0,e.jsx)(Ut,{children:"Keep it"}),(0,e.jsx)(b,{variant:"destructive",disabled:c.isPending||!d,onClick:a(()=>d&&c.mutate(d,{onSuccess:a(()=>h(null),"onSuccess")}),"onClick"),children:c.isPending?"Removing…":"Remove"})]})]})})]})}a(bn,"SetVisualizations");function Nn({responsibility:t,agentsById:s,now:n,editable:r}){const l=(0,g.useId)(),i=Ve(t,r),[c,d]=(0,g.useState)(!1),[h,m]=(0,g.useState)(!1),x=!!t.rollup.metric,f=i.state,j=a(T=>T?s.get(T)?.name:void 0,"nameOf"),w=j(f?.conversation?.agentId)??"an agent",k=j(f?.defaultAgentId)??"your agent",p=r?f?.proposal??null:null,C=r&&!p&&f?.state==="discussing"&&f.conversation?f.conversation:null,y=!!f,A=y&&!i.canTalk,F=a(()=>i.start.mutate(),"startTalking"),D=i.start.isPending,u=r&&!x&&!p&&!C&&(A||i.start.isError),S=r&&!u?(0,e.jsxs)(H,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{size:"icon-xs",variant:"ghost",className:"text-muted-foreground","aria-label":"More for the bar",children:(0,e.jsx)(pe,{"aria-hidden":"true"})})}),(0,e.jsxs)(B,{align:"end",children:[(0,e.jsx)(P,{onSelect:a(()=>d(!0),"onSelect"),children:x?"Edit by hand":"Set it by hand"}),x?(0,e.jsx)(P,{onSelect:a(()=>m(!0),"onSelect"),children:"Record a reading"}):null]})]}):null,I=r&&x&&!p&&!C&&i.canTalk?(0,e.jsxs)(b,{size:"xs",variant:"ghost",disabled:D,onClick:F,"data-bar-edit-primary":"",children:[D?(0,e.jsx)(ee,{"aria-hidden":"true",className:"animate-spin"}):(0,e.jsx)(te,{"aria-hidden":"true"}),"Change it with ",k]}):null;let v;return p?v=(0,e.jsx)(pn,{interaction:p,agentsById:s}):x?v=(0,e.jsx)(bn,{responsibility:t,now:n,editable:r}):v=r?C?null:(0,e.jsxs)("div",{className:"flex flex-col items-start gap-3","data-bar-empty":"",children:[(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"How will you know this is going well?"}),u?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(b,{size:"sm",onClick:a(()=>d(!0),"onClick"),"data-bar-edit-primary":"",children:"Set it by hand"}),A?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"No agent is free to talk it through."}):null]}):(0,e.jsxs)(b,{size:"sm",disabled:!y||D,onClick:F,"data-bar-edit-primary":"",children:[D?(0,e.jsx)(ee,{"aria-hidden":"true",className:"animate-spin"}):(0,e.jsx)(te,{"aria-hidden":"true"}),y?`Set it with ${k}`:"Set it with an agent"]})]}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No bar."}),(0,e.jsxs)(q,{id:"responsibility-bar",elevation:"low",className:"gap-4 px-5 py-4","aria-labelledby":l,"data-bar-module":"",children:[(0,e.jsxs)("div",{className:"flex min-h-6 items-center justify-between gap-2",children:[(0,e.jsx)("h2",{id:l,className:"text-sm font-semibold text-foreground",children:"The bar"}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[I,S]})]}),C?(0,e.jsxs)("p",{className:"text-sm text-muted-foreground","data-bar-talking":"",children:["Talking it through with ",w,"."," ",(0,e.jsx)(M,{to:`/issues/${C.identifier??C.issueId}`,className:"font-medium text-foreground underline-offset-4 hover:underline",children:"Open the conversation"})]}):null,i.start.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t start the conversation. ",E(i.start.error).body]}):null,i.loadError?(0,e.jsx)(ae,{error:i.loadError,size:"inline",action:"load the bar conversation",onRetry:i.retry,retrying:i.retrying}):null,v,r?(0,e.jsx)(Wt,{responsibility:t,open:c,onOpenChange:d}):null,r&&x?(0,e.jsx)(Ue,{open:h,onOpenChange:m,children:(0,e.jsxs)(qe,{className:"sm:max-w-sm",children:[(0,e.jsxs)(ze,{children:[(0,e.jsx)(Oe,{children:"Record a reading"}),(0,e.jsx)(Be,{className:"sr-only",children:t.rollup.metric?.name})]}),(0,e.jsx)(Vt,{responsibility:t})]})}):null]})}a(Nn,"BarModule");var kn={recent:a((t,s)=>Ma.get(`/responsibilities/${encodeURIComponent(t)}/runs${s?`?limit=${s}`:""}`),"recent")},wn=new Set(["queued","running"]);function yn(t){return z({queryKey:R.responsibilities.runs(t),queryFn:a(()=>kn.recent(t),"queryFn"),staleTime:15e3,refetchInterval:a(s=>s.state.data?.runs.some(n=>wn.has(n.status))?5e3:!1,"refetchInterval")})}a(yn,"useResponsibilityRuns");var Zt=(0,g.createContext)(!0);function Q({section:t,title:s,add:n,empty:r,withWho:l=!0,children:i,footer:c}){const d=`one-screen-v2-${t}-heading`;return(0,e.jsx)("section",{"aria-labelledby":d,"data-section":t,children:(0,e.jsxs)(q,{elevation:"low",className:"gap-0 overflow-hidden py-0","data-section-table":"",children:[(0,e.jsxs)("div",{className:"flex min-h-11 items-center justify-between gap-2 border-b border-border px-4 py-2","data-section-header":"",children:[(0,e.jsx)("h2",{id:d,className:"text-sm font-semibold text-foreground",children:s}),n]}),r!=null?(0,e.jsx)("p",{className:"px-4 py-3 text-sm text-muted-foreground","data-section-empty":"",children:r}):(0,e.jsx)(Zt.Provider,{value:l,children:(0,e.jsx)("ul",{className:$("flex flex-col divide-y divide-border sm:grid sm:gap-x-6",l?"sm:grid-cols-(--gtc-27)":"sm:grid-cols-(--gtc-13)"),"data-section-rows":"",children:i})}),c]})})}a(Q,"SectionTable");function Y({to:t,label:s,leading:n,title:r,aside:l,stat:i,who:c,rowData:d}){const h=(0,g.useContext)(Zt);return(0,e.jsx)("li",{className:"min-w-0 sm:col-span-full sm:grid sm:grid-cols-subgrid",...d,children:(0,e.jsxs)(M,{to:t,"aria-label":s,className:"flex min-h-11 min-w-0 items-center gap-3 px-4 py-2 text-sm transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring sm:col-span-full sm:grid sm:grid-cols-subgrid",children:[(0,e.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5 sm:contents",children:[(0,e.jsxs)("span",{className:"flex min-w-0 items-center gap-2","data-row-title":"",children:[n,(0,e.jsx)("span",{className:"min-w-0 truncate text-foreground",title:r,children:r}),l?(0,e.jsx)("span",{className:"ml-auto flex shrink-0 items-center pl-2",children:l}):null]}),i!=null&&i!==""?(0,e.jsx)("span",{className:"min-w-0 truncate text-muted-foreground tabular-nums sm:whitespace-nowrap sm:text-right","data-row-stat":"",children:i}):(0,e.jsx)("span",{"aria-hidden":"true",className:"hidden sm:block"})]}),h?c?(0,e.jsx)("span",{className:"flex shrink-0 items-center justify-end gap-1","data-row-who":"",children:c}):(0,e.jsx)("span",{"aria-hidden":"true",className:"hidden sm:block"}):null]})})}a(Y,"SectionTableRow");function ot({children:t,onClick:s}){return(0,e.jsx)("button",{type:"button",onClick:s,className:"flex min-h-11 w-full items-center border-t border-border px-4 text-left text-sm text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring","data-section-footer":"",children:t})}a(ot,"SectionTableFooterButton");function dt({children:t,alert:s=!1}){return(0,e.jsx)("p",{role:s?"alert":void 0,className:$("border-t border-border px-4 py-3 text-sm",s?"text-destructive":"text-muted-foreground"),children:t})}a(dt,"SectionTableNote");function Jt({agentId:t,agentsById:s}){if(!t)return null;const n=s.get(t),r=n?.name??"An agent";return(0,e.jsx)("span",{title:r,className:"flex shrink-0",children:(0,e.jsx)(qt,{agent:n??{id:t},name:n?.name,size:20,label:r})})}a(Jt,"WhoAvatar");function ct({identifier:t,when:s}){return(0,e.jsxs)("span",{className:"inline-flex items-center gap-3",children:[t?(0,e.jsx)("span",{className:"font-mono",children:t}):null,(0,e.jsx)("span",{className:"sm:inline-block sm:min-w-16 sm:text-right",children:s})]})}a(ct,"TaskRefStat");var G={routines:"Routines",skills:"Skills",projects:"Projects",tasks:"Tasks",runs:"Recent runs",artifacts:"Artifacts"},we=8,Sn=4;function Cn({agentIds:t,agentsById:s}){const n=t.length>Sn,r=n?t.slice(0,3):t;return(0,e.jsxs)(e.Fragment,{children:[r.map(l=>(0,e.jsx)(Jt,{agentId:l,agentsById:s},l)),n?(0,e.jsxs)("span",{className:"text-sm text-muted-foreground tabular-nums",children:["+",t.length-r.length]}):null]})}a(Cn,"SkillHolders");function An({progress:t}){const s=ln(t),n=Math.round(Math.min(t.done,t.total)/t.total*100);return(0,e.jsx)("span",{role:"img","aria-label":s,title:s,className:"relative block h-1 w-16 overflow-hidden rounded-full bg-muted","data-project-progress":n,children:(0,e.jsx)("span",{className:"absolute inset-y-0 left-0 rounded-full bg-muted-foreground",style:{width:`${n}%`}})})}a(An,"ProjectProgress");function Tn({artifact:t}){const s=hs(bt(t));return(0,e.jsx)(s==="bars"?wa:s,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground"})}a(Tn,"ArtifactKindMark");function ye({label:t,newLabel:s,onNew:n,existing:r,onExisting:l}){const i=(0,g.useRef)(!1);return!n&&!r?null:(0,e.jsxs)(H,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{type:"button",size:"icon-xs",variant:"ghost",className:"text-muted-foreground","aria-label":t,"data-section-add":"",children:(0,e.jsx)(ne,{"aria-hidden":"true"})})}),(0,e.jsxs)(B,{align:"end",onCloseAutoFocus:a(c=>{i.current&&(i.current=!1,c.preventDefault(),l?.())},"onCloseAutoFocus"),children:[n?(0,e.jsx)(P,{onSelect:n,children:s}):null,r&&l?(0,e.jsx)(P,{onSelect:a(()=>{i.current=!0},"onSelect"),children:"Add existing"}):null]})]})}a(ye,"AddMenu");function Rn({onExisting:t,filed:s,onRemove:n,removingLinkId:r,agents:l}){const i=(0,g.useRef)(!1);return(0,e.jsxs)(H,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{type:"button",size:"icon-xs",variant:"ghost",className:"text-muted-foreground","aria-label":"Add or remove a skill","data-section-add":"",children:(0,e.jsx)(ne,{"aria-hidden":"true"})})}),(0,e.jsxs)(B,{align:"end",onCloseAutoFocus:a(c=>{i.current&&(i.current=!1,c.preventDefault(),t())},"onCloseAutoFocus"),children:[(0,e.jsx)(P,{onSelect:a(()=>{i.current=!0},"onSelect"),children:"Add existing skill"}),s.length>0?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ge,{}),(0,e.jsx)(he,{children:"Remove from this responsibility"}),s.map(c=>(0,e.jsx)(P,{disabled:r===c.linkId,"aria-label":`Remove ${c.name} from this responsibility`,onSelect:a(()=>n(c),"onSelect"),children:c.name},c.id))]}):null,l.length>0?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(ge,{}),(0,e.jsx)(he,{children:"Give a skill to"}),l.map(c=>(0,e.jsx)(P,{asChild:!0,children:(0,e.jsx)(M,{to:Ta(ga(c),"skills"),children:c.name})},c.id))]}):null]})]})}a(Rn,"SkillsMenu");function In({label:t,reason:s}){return(0,e.jsx)("span",{title:s,className:"inline-flex","data-section-add-disabled":"",children:(0,e.jsx)(b,{type:"button",size:"icon-xs",variant:"ghost",className:"text-muted-foreground","aria-label":`${t}: ${s}`,disabled:!0,children:(0,e.jsx)(ne,{"aria-hidden":"true"})})})}a(In,"DisabledAdd");function Dn({open:t,onOpenChange:s,title:n,onSave:r}){const[l,i]=(0,g.useState)(n),[c,d]=(0,g.useState)(null),[h,m]=(0,g.useState)(!1),x=a(async f=>{f.preventDefault();const j=l.trim();if(!(!j||h)){if(j===n){s(!1);return}m(!0),d(null);try{await r(j),s(!1)}catch(w){d(w)}finally{m(!1)}}},"submit");return(0,e.jsx)(Ue,{open:t,onOpenChange:a(f=>{f&&i(n),s(f)},"onOpenChange"),children:(0,e.jsx)(qe,{className:"sm:max-w-md",children:(0,e.jsxs)("form",{className:"flex flex-col gap-4",onSubmit:x,children:[(0,e.jsxs)(ze,{children:[(0,e.jsx)(Oe,{children:"Rename"}),(0,e.jsx)(Be,{className:"sr-only",children:"The short name this responsibility goes by."})]}),(0,e.jsx)(Mt,{"aria-label":"Name",value:l,maxLength:200,autoFocus:!0,onChange:a(f=>i(f.target.value),"onChange")}),c?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t rename it. ",E(c).body]}):null,(0,e.jsxs)(_t,{className:"sm:justify-between",children:[(0,e.jsx)(b,{type:"button",variant:"ghost",onClick:a(()=>s(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(b,{type:"submit",disabled:!l.trim()||h,children:h?"Saving…":"Save"})]})]})})})}a(Dn,"RenameDialog");function En({responsibility:t,companyId:s,agents:n,agentsById:r,areas:l,now:i,notices:c,actions:d,onReviewProposal:h}){const m=V(),x=t.status==="active",f=t.status!=="dismissed",j=t.status==="active"||t.status==="proposed",w=t.standard?.trim()||t.title,k=Hs(t.id),[p,C]=(0,g.useState)(!1),[y,A]=(0,g.useState)(null),[F,D]=(0,g.useState)(!1),[u,S]=(0,g.useState)(!1),[I,v]=(0,g.useState)(null),[T,N]=(0,g.useState)(!1),[W,ve]=(0,g.useState)(!1),re=yn(t.id),Z=je(re),ts=(0,g.useMemo)(()=>({project:new Set(t.projects.map(o=>o.id)),task:new Set(t.tasks.filter(o=>o.membership==="direct").map(o=>o.id)),routine:new Set(t.routines.filter(o=>o.membership==="direct").map(o=>o.id)),skill:new Set(t.skills.filter(o=>o.linkId).map(o=>o.id))}),[t.projects,t.tasks,t.routines,t.skills]),le=t.routines.filter(o=>o.status!=="archived"),We=t.projects.filter(o=>!Ks(o)),{open:ie,done:be}=(0,g.useMemo)(()=>on(t.tasks),[t.tasks]),Qe=[...T?ie:ie.slice(0,we),...W?be:[]],Ye=(0,g.useMemo)(()=>{const o=ft(t).map(O=>O.agentId);return t.runByAgentId&&!o.includes(t.runByAgentId)&&o.unshift(t.runByAgentId),o.flatMap(O=>{const ue=r.get(O);return ue?[ue]:[]})},[t,r]),ss=Ye[0]?.id??null,oe=L({mutationFn:a(o=>Dt.run(o.id,{}),"mutationFn"),onSuccess:a(async()=>{await Promise.all([m.invalidateQueries({queryKey:R.responsibilities.runs(t.id)}),m.invalidateQueries({queryKey:R.responsibilities.detail(t.id)})])},"onSuccess")}),de=a((o,O)=>(0,e.jsx)(Yt,{companyId:s,responsibilityId:t.id,kind:o,linkedIds:ts[o],open:y===o,onOpenChange:a(ue=>A(ue?o:null),"onOpenChange"),anchor:O}),"picker"),ce=a(o=>o?(0,e.jsx)(Jt,{agentId:o,agentsById:r}):null,"whoFor"),Ge=le.filter(o=>o.status==="active"),as=x?Ge.length===0?(0,e.jsx)(In,{label:"Run a routine now",reason:le.length===0?"No routines to run yet":"No active routine to run"}):(0,e.jsxs)(H,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{type:"button",size:"icon-xs",variant:"ghost",className:"text-muted-foreground","aria-label":"Run a routine now",disabled:oe.isPending,"data-section-add":"",children:(0,e.jsx)(ne,{"aria-hidden":"true"})})}),(0,e.jsxs)(B,{align:"end",children:[(0,e.jsx)(he,{children:"Run now"}),Ge.map(o=>(0,e.jsx)(P,{onSelect:a(()=>oe.mutate(o),"onSelect"),children:o.title},o.id))]})]}):null,ns=(0,g.useMemo)(()=>t.skills.filter(o=>o.linkId),[t.skills]),rs=f?de("skill",(0,e.jsx)(Rn,{onExisting:a(()=>A("skill"),"onExisting"),filed:ns,removingLinkId:d.unlinkingId,onRemove:a(o=>d.unlink({linkId:o.linkId,label:o.name,relink:{skillId:o.id}}),"onRemove"),agents:Ye})):null,ls=a(async o=>{v(null);try{await _.link(t.id,{projectId:o.id})}catch(O){v(O)}await m.invalidateQueries({queryKey:R.responsibilities.all})},"fileNewProject");return(0,e.jsxs)("div",{className:"mx-auto flex w-full max-w-3xl flex-col gap-8","data-responsibility-view":"one_screen_v2",children:[(0,e.jsxs)("header",{className:"flex flex-col gap-1",children:[t.area?(0,e.jsx)("p",{className:"text-xs text-muted-foreground","data-area":"",children:t.area.title}):null,(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsx)("h1",{className:"min-w-0 flex-1 text-xl font-semibold text-foreground",children:w}),(0,e.jsxs)(H,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{size:"icon-sm",variant:"ghost",className:"shrink-0 text-muted-foreground","aria-label":"More actions for this responsibility",children:(0,e.jsx)(pe,{"aria-hidden":"true"})})}),(0,e.jsxs)(B,{align:"end",children:[(0,e.jsx)(P,{onSelect:a(()=>C(!0),"onSelect"),children:"Rename…"}),(0,e.jsxs)(wt,{children:[(0,e.jsx)(It,{children:"Move to area"}),(0,e.jsx)(Bt,{className:"max-h-(--sz-50vh) overflow-y-auto",children:(0,e.jsx)(Zs,{areas:t.area&&!l.some(o=>o.id===t.area.id)?[t.area,...l]:l,value:t.area?.id??null,onChange:a(o=>{o!==(t.area?.id??null)&&k.mutate(o)},"onChange")})})]}),x?(0,e.jsx)(P,{onSelect:a(()=>d.setStatus("let_go"),"onSelect"),children:"Let go"}):t.status==="let_go"||t.status==="dismissed"?(0,e.jsx)(P,{onSelect:a(()=>d.setStatus("active"),"onSelect"),children:"Take it back on"}):null,(0,e.jsx)(ge,{}),(0,e.jsx)(P,{variant:"destructive",onSelect:d.requestDelete,children:"Delete…"})]})]})]}),t.status==="let_go"?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"You let go of this."}):t.status==="dismissed"?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"You dismissed this."}):null,k.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t move it. ",E(k.error).body]}):null,c]}),t.status==="proposed"?(0,e.jsx)(fe,{count:1,subject:"this",onReview:h}):null,(0,e.jsx)(Nn,{responsibility:t,agentsById:r,now:i,editable:j}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-section-order":"",children:[(0,e.jsx)(Q,{section:"routines",title:G.routines,add:f?de("routine",(0,e.jsx)(ye,{label:"Add a routine",newLabel:"New routine",onNew:x?()=>D(!0):void 0,existing:!0,onExisting:a(()=>A("routine"),"onExisting")})):null,empty:le.length===0?"None yet.":null,children:le.map(o=>(0,e.jsx)(Y,{rowData:{"data-work-id":o.id},to:jt(o.id),title:o.title,stat:an(o,i),who:ce(o.assigneeAgentId)},o.id))}),(0,e.jsx)(Q,{section:"skills",title:G.skills,add:rs,empty:t.skills.length===0?"None yet.":null,children:t.skills.map(o=>(0,e.jsx)(Y,{rowData:{"data-work-id":o.id},to:He(o),title:o.name,stat:o.linkId?"Filed here":void 0,who:o.agentIds.length>0?(0,e.jsx)(Cn,{agentIds:o.agentIds,agentsById:r}):null},o.id))}),(0,e.jsx)(Q,{section:"projects",title:G.projects,add:f?de("project",(0,e.jsx)(ye,{label:"Add a project",newLabel:"New project",onNew:x?()=>S(!0):void 0,existing:!0,onExisting:a(()=>A("project"),"onExisting")})):null,empty:We.length===0?t.projects.length>0?"None open.":"None yet.":null,footer:I?(0,e.jsxs)(dt,{alert:!0,children:["The project was made but couldn’t be filed here. ",E(I).body]}):null,children:We.map(o=>(0,e.jsx)(Y,{rowData:{"data-work-id":o.id},to:Ie(o),title:o.name,aside:o.progress?(0,e.jsx)(An,{progress:o.progress}):null,stat:rn(o,i),who:ce(o.leadAgentId)},o.id))}),(0,e.jsx)(Q,{section:"tasks",title:G.tasks,add:f?de("task",(0,e.jsx)(ye,{label:"Add a task",newLabel:"New task",onNew:x?()=>d.newTask({defaultTitle:""}):void 0,existing:!0,onExisting:a(()=>A("task"),"onExisting")})):null,empty:Qe.length===0?t.tasks.length>0?"None open.":"None yet.":null,footer:(0,e.jsxs)(e.Fragment,{children:[!T&&ie.length>we?(0,e.jsxs)(ot,{onClick:a(()=>N(!0),"onClick"),children:["Show ",ie.length-we," more"]}):null,be.length>0?(0,e.jsx)(ot,{onClick:a(()=>ve(o=>!o),"onClick"),children:W?"Hide done":`Show ${be.length} done`}):null]}),children:Qe.map(o=>(0,e.jsx)(Y,{rowData:{"data-work-id":o.id},to:Le(o),leading:(0,e.jsx)(Ft,{...Et(o),size:"sm"}),title:o.title,stat:(0,e.jsx)(ct,{identifier:o.identifier,when:X(o.updatedAt,i)}),who:ce(o.assigneeAgentId)},o.id))}),(0,e.jsx)(Q,{section:"runs",title:G.runs,add:as,empty:Z.kind==="error"?(0,e.jsx)(ae,{error:Z.error,size:"inline",action:"load the runs",onRetry:Z.retry,retrying:Z.isFetching}):re.data?re.data.runs.length===0?"None yet.":null:(0,e.jsx)("span",{role:"status",children:"Loading…"}),footer:oe.error?(0,e.jsxs)(dt,{alert:!0,children:["Couldn’t start the run. ",E(oe.error).body]}):null,children:(Z.kind==="error"?[]:re.data?.runs??[]).map(o=>{const O=cn(o,i);return(0,e.jsx)(Y,{rowData:{"data-run-id":o.id,"data-run-status":o.status},to:`/agents/${o.agentId}/runs/${o.id}`,label:`${r.get(o.agentId)?.name??"An agent"} on ${o.issue.title}: ${O}`,title:o.issue.title,stat:O,who:ce(o.agentId)},o.id)})}),(0,e.jsx)(Q,{section:"artifacts",title:G.artifacts,withWho:!1,empty:t.artifacts.length===0?"None yet.":null,children:t.artifacts.map(o=>(0,e.jsx)(Y,{rowData:{"data-artifact-id":o.id},to:o.href,leading:(0,e.jsx)(Tn,{artifact:o}),title:o.title,stat:(0,e.jsx)(ct,{identifier:o.issue.identifier,when:X(o.updatedAt,i)})},`${o.source}:${o.id}`))})]}),(0,e.jsx)(Dn,{open:p,onOpenChange:C,title:t.title,onSave:d.saveTitle}),(0,e.jsx)(Nt,{open:F,onOpenChange:D,companyId:s,task:null,newFor:{responsibilityId:t.id,responsibilityTitle:t.title,assigneeAgentId:ss},agents:n,filedUnder:[t.title]}),u?(0,e.jsx)(Oa,{companyId:s,onClose:a(()=>S(!1),"onClose"),onCreated:ls}):null]})}a(En,"ResponsibilityOneScreenV2");function es({id:t,title:s,count:n,question:r,action:l}){return(0,e.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[(0,e.jsxs)("h2",{id:t,className:"text-base font-semibold text-foreground",children:[s," ",(0,e.jsx)("span",{className:"text-sm font-normal tabular-nums text-muted-foreground",children:n})]}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r})]}),l]})}a(es,"SectionHeading$1");function Pn({agentIds:t,agentsById:s}){if(t.length===0)return null;const n=t.map(r=>s.get(r)?.name??"An agent");return(0,e.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground","aria-label":`Held by ${n.join(", ")}`,children:[(0,e.jsx)("span",{className:"flex shrink-0 -space-x-1","aria-hidden":"true",children:t.slice(0,3).map(r=>(0,e.jsx)(qt,{agent:s.get(r)??{id:r},name:s.get(r)?.name,size:16},r))}),(0,e.jsx)("span",{className:"truncate","aria-hidden":"true",children:n.join(", ")})]})}a(Pn,"Holders");function Fn({skills:t,agentsById:s,addControl:n,removeControl:r}){return(0,e.jsxs)("section",{"aria-labelledby":"responsibility-skills-heading",className:"flex flex-col gap-2",children:[(0,e.jsx)(es,{id:"responsibility-skills-heading",title:"Skills",count:t.length,question:"What does this need, and what can the agents working on it do?",action:n}),t.length>0?(0,e.jsx)("ul",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"responsibility-skills",children:t.map(l=>(0,e.jsx)("li",{className:"min-w-0",children:(0,e.jsxs)(q,{elevation:"low",className:"h-full gap-3 px-4 py-4",children:[(0,e.jsxs)(M,{to:He(l),className:"flex min-w-0 items-start gap-3 rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,e.jsx)(Ua,{card:l,size:32}),(0,e.jsxs)("span",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,e.jsx)("span",{className:"truncate text-sm font-medium text-foreground underline-offset-4 hover:underline",children:l.name}),l.tagline||l.description?(0,e.jsx)("span",{className:"line-clamp-2 text-xs text-muted-foreground",children:l.tagline||l.description}):null]})]}),(0,e.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[l.agentIds.length>0?(0,e.jsx)(Pn,{agentIds:l.agentIds,agentsById:s}):(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Filed here"}),l.linkId?r?.(l):null]})]})},l.id))}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No skills yet. Add one this needs, or they appear here from the agents doing the work: the ones assigned its tasks and routines, and the leads of its projects."})]})}a(Fn,"ResponsibilitySkills");function $n(t,s){return`Showing the newest ${t} of ${s>=1e3?`${Ct.toLocaleString("en-US")} or more`:s.toLocaleString("en-US")}.`}a($n,"artifactsTruncationNote");function Mn({artifacts:t,total:s,truncated:n}){const{enabled:r}=Ps();return(0,e.jsxs)("section",{"aria-labelledby":"responsibility-artifacts-heading",className:"flex flex-col gap-3",children:[(0,e.jsx)(es,{id:"responsibility-artifacts-heading",title:"Artifacts",count:s,question:"What has the work produced? Newest first; each opens in the task that made it."}),t.length===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Nothing produced yet. Documents, files and other output from the tasks under this responsibility collect here."}):r?(0,e.jsx)(xs,{testId:"responsibility-artifacts",children:t.map(l=>(0,e.jsx)(vs,{subject:bt(l),to:l.href},`${l.source}:${l.id}`))}):(0,e.jsx)("ul",{className:"grid grid-cols-1 gap-6 md:grid-cols-2 xl:grid-cols-3","data-testid":"responsibility-artifacts",children:t.map(l=>(0,e.jsxs)("li",{className:"flex min-w-0 flex-col gap-1",children:[(0,e.jsx)(As,{artifact:l}),(0,e.jsxs)(M,{to:Le(l.issue),className:"truncate px-1 text-xs text-muted-foreground underline-offset-4 hover:underline",children:[(0,e.jsx)("span",{className:"font-mono",children:l.issue.identifier})," ",l.issue.title]})]},`${l.source}:${l.id}`))}),n?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:$n(t.length,s)}):null]})}a(Mn,"ResponsibilityArtifacts");function xe({id:t,title:s,count:n,question:r,action:l}){return(0,e.jsxs)("div",{className:"flex flex-wrap items-end justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[(0,e.jsxs)("h2",{id:t,className:"text-base font-semibold text-foreground",children:[s,n!==void 0?(0,e.jsxs)(e.Fragment,{children:[" ",(0,e.jsx)("span",{className:"text-sm font-normal tabular-nums text-muted-foreground",children:n})]}):null]}),r?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r}):null]}),l]})}a(xe,"SectionHeading");function _n({label:t,pending:s,onRemove:n}){return(0,e.jsx)(b,{size:"icon-xs",variant:"ghost","aria-label":`Remove ${t} from this responsibility`,title:"Remove from this responsibility. It stays wherever else it is filed.",disabled:s,onClick:n,children:(0,e.jsx)(Lt,{"aria-hidden":"true"})})}a(_n,"RemoveLinkButton");function Se({children:t,actions:s}){return(0,e.jsxs)("li",{className:"flex items-center gap-1 pr-3",children:[(0,e.jsx)("div",{className:"min-w-0 flex-1",children:t}),s?(0,e.jsx)("div",{className:"flex shrink-0 items-center gap-1",children:s}):null]})}a(Se,"WorkRow");function Ln({responsibility:t,companyId:s,agents:n,agentsById:r,areas:l,now:i,actions:c,notices:d}){const[h,m]=(0,g.useState)(!1),x=(0,g.useMemo)(()=>new Map(t.projects.map(u=>[u.id,u])),[t.projects]),f=(0,g.useMemo)(()=>js(t.tasks),[t.tasks]),j=(0,g.useMemo)(()=>ft(t),[t]),w=(0,g.useMemo)(()=>({project:new Set(t.projects.map(u=>u.id)),task:new Set(t.tasks.filter(u=>u.membership==="direct").map(u=>u.id)),routine:new Set(t.routines.filter(u=>u.membership==="direct").map(u=>u.id)),skill:new Set(t.skills.filter(u=>u.linkId).map(u=>u.id))}),[t.projects,t.tasks,t.routines,t.skills]),k=t.status==="active",p=t.status!=="dismissed",C=a(u=>(0,e.jsx)(Yt,{companyId:s,responsibilityId:t.id,kind:u,linkedIds:w[u]}),"picker"),y=a((u,S,I)=>u&&p?(0,e.jsx)(_n,{label:S,pending:c.unlinkingId===u,onRemove:a(()=>c.unlink({linkId:u,label:S,relink:I}),"onRemove")}):null,"unlinkRow"),A=a(u=>p?(0,e.jsx)(st,{companyId:s,agents:n,item:u,size:"icon-xs"}):null,"giveRow"),F=a(u=>{if(!k||u.tone!=="attention")return null;const S=Ss(u);return S?(0,e.jsx)(st,{companyId:s,agents:n,item:S}):(0,e.jsxs)(b,{size:"xs",variant:"ghost",className:"shrink-0 text-muted-foreground",onClick:a(()=>c.newTask({defaultTitle:u.text}),"onClick"),"aria-label":`New task for an agent: ${u.text}`,children:[(0,e.jsx)(nt,{"aria-hidden":"true"}),"New task for an agent"]})},"signalAction"),D=a(u=>{const S=u.membership==="project"&&u.projectId?x.get(u.projectId):null;return(0,e.jsxs)(Se,{actions:(0,e.jsxs)(e.Fragment,{children:[kt(u.status)?null:A({kind:"task",id:u.id,label:u.title,currentAgentId:u.assigneeAgentId}),y(u.linkId,u.title,{issueId:u.id})]}),children:[(0,e.jsx)(Ne,{className:"border-b-0",leading:(0,e.jsx)(Ft,{...Et(u)}),identifier:u.identifier??void 0,title:u.title,to:Le(u),trailing:u.status==="blocked"?(0,e.jsx)("span",{className:"text-xs text-(--status-task-icon-blocked)",children:"Blocked"}):null}),S?(0,e.jsxs)("p",{className:"pb-2 pl-12 text-xs text-muted-foreground",children:["Here through"," ",(0,e.jsx)(M,{to:Ie(S),className:"underline-offset-4 hover:underline",children:S.name})]}):null]},u.id)},"renderTask");return(0,e.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-8",children:[t.status==="proposed"?(0,e.jsx)(ta,{companyId:s,proposed:[t],areas:t.area?[t.area]:[],heading:"Proposed for you",description:"Confirm it to start giving its work to agents, or adjust the bar and numbers first.",onReviewed:c.onProposalReviewed}):null,(0,e.jsxs)("header",{className:"flex flex-col gap-3",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,e.jsx)(Ae,{value:t.title,onSave:a(u=>{const S=u.trim();if(S&&S!==t.title)return c.saveTitle(S)},"onSave"),as:"h1",className:"text-2xl font-semibold text-foreground"}),(0,e.jsx)(Ae,{value:t.description??"",onSave:a(u=>c.saveDescription(u.trim()||null),"onSave"),as:"p",className:"text-sm text-muted-foreground",placeholder:"What this covers (optional)",multiline:!0,nullable:!0})]}),(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[k?(0,e.jsxs)(b,{variant:"outline",onClick:a(()=>c.newTask({defaultTitle:""}),"onClick"),children:[(0,e.jsx)(nt,{"aria-hidden":"true"}),"New task for an agent"]}):null,(0,e.jsxs)(H,{children:[(0,e.jsx)(U,{asChild:!0,children:(0,e.jsx)(b,{size:"icon",variant:"ghost","aria-label":"More actions for this responsibility",children:(0,e.jsx)(pe,{"aria-hidden":"true"})})}),(0,e.jsxs)(B,{align:"end",children:[k?(0,e.jsx)(P,{onSelect:a(()=>c.setStatus("let_go"),"onSelect"),children:"Let go"}):t.status==="let_go"||t.status==="dismissed"?(0,e.jsx)(P,{onSelect:a(()=>c.setStatus("active"),"onSelect"),children:"Take it back on"}):null,(0,e.jsx)(ge,{}),(0,e.jsx)(P,{variant:"destructive",onSelect:c.requestDelete,children:"Delete…"})]})]})]})]}),(0,e.jsxs)("dl",{className:"flex flex-col gap-2 text-sm",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[(0,e.jsx)("dt",{className:"text-xs text-muted-foreground",children:"Area"}),(0,e.jsx)("dd",{children:(0,e.jsx)(ra,{responsibilityId:t.id,area:t.area,areas:l})})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("dt",{className:"text-xs text-muted-foreground",children:"Agents on this"}),(0,e.jsx)("dd",{children:(0,e.jsx)(sa,{agents:j,agentsById:r})})]})]}),t.status==="let_go"?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"You let go of this. Take it back on from the menu to own it again."}):t.status==="dismissed"?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"You dismissed this when it was proposed. Take it back on from the menu if you do own it."}):null]}),(0,e.jsx)(Ya,{responsibility:t,agentsById:r,now:i,editable:p}),(0,e.jsxs)("section",{"aria-labelledby":"responsibility-work-summary-heading",className:"flex flex-col gap-3",children:[(0,e.jsx)(xe,{id:"responsibility-work-summary-heading",title:"Across the work",question:"What its projects, tasks and routines need, and what they are getting done."}),t.rollup.workSummary.length>0?(0,e.jsx)(Te,{signals:t.rollup.workSummary,renderAction:F,responsibilityHref:a(()=>"#responsibility-bar","responsibilityHref")}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Nothing to report yet. Once projects, tasks or routines are filed here, what they need shows up here."})]}),d,(0,e.jsxs)("section",{"aria-labelledby":"responsibility-routines-heading",className:"flex flex-col gap-2",children:[(0,e.jsx)(xe,{id:"responsibility-routines-heading",title:"Routines",count:t.routines.length,question:"Tasks that repeat.",action:p?C("routine"):null}),t.routines.length>0?(0,e.jsx)("ul",{className:"flex flex-col",children:t.routines.map(u=>(0,e.jsx)(Se,{actions:(0,e.jsxs)(e.Fragment,{children:[u.status==="archived"?null:A({kind:"routine",id:u.id,label:u.title,currentAgentId:u.assigneeAgentId}),y(u.linkId,u.title,{routineId:u.id})]}),children:(0,e.jsx)(Ne,{className:"border-b-0",leading:(0,e.jsx)(Pt,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),title:u.title,to:jt(u.id),trailing:(0,e.jsx)(at,{status:u.status})})},u.id))}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No routines yet. A routine is work that repeats, like a weekly review. Add one you already have."})]}),(0,e.jsx)(Fn,{skills:t.skills,agentsById:r,addControl:p?C("skill"):null,removeControl:a(u=>y(u.linkId,u.name,{skillId:u.id}),"removeControl")}),(0,e.jsxs)("section",{"aria-labelledby":"responsibility-projects-heading",className:"flex flex-col gap-2",children:[(0,e.jsx)(xe,{id:"responsibility-projects-heading",title:"Projects",count:t.projects.length,question:"What groups of work move the number?",action:p?C("project"):null}),t.projects.length>0?(0,e.jsx)("ul",{className:"flex flex-col",children:t.projects.map(u=>{const S=ys(u.targetDate,i);return(0,e.jsx)(Se,{actions:(0,e.jsxs)(e.Fragment,{children:[A({kind:"project",id:u.id,label:u.name,currentAgentId:u.leadAgentId}),y(u.linkId,u.name,{projectId:u.id})]}),children:(0,e.jsx)(Ne,{className:"border-b-0",leading:(0,e.jsx)(fa,{className:"size-4 text-muted-foreground","aria-hidden":"true"}),title:u.name,to:Ie(u),meta:S?(0,e.jsx)("span",{className:$("text-xs tabular-nums",S.late?"text-(--status-task-icon-blocked)":"text-muted-foreground"),children:S.late?`Late · ${S.label}`:`Due ${S.label}`}):null,trailing:(0,e.jsx)(at,{status:u.status})})},u.id)})}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No projects yet. A project groups the tasks that move this number, with a due date if it has one."})]}),(0,e.jsxs)("section",{"aria-labelledby":"responsibility-tasks-heading",className:"flex flex-col gap-2",children:[(0,e.jsx)(xe,{id:"responsibility-tasks-heading",title:"Tasks",count:t.rollup.openTasks,question:"Open work, done or not done.",action:p?C("task"):null}),f.blocked>0?(0,e.jsx)("p",{className:"text-sm text-(--status-task-icon-blocked)",children:f.blocked===1?"1 task is blocked.":`${f.blocked} tasks are blocked.`}):null,f.open.length>0?(0,e.jsx)("ul",{className:"flex flex-col",children:f.open.map(D)}):(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:["No open tasks. ",k?"Create one for an agent, or add a task you already have.":"Add a task you already have."]}),f.done.length>0?(0,e.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,e.jsxs)(b,{size:"sm",variant:"ghost",className:"w-fit","aria-expanded":h,onClick:a(()=>m(u=>!u),"onClick"),children:[(0,e.jsx)(zt,{"aria-hidden":"true",className:$("transition-transform",!h&&"-rotate-90")}),h?"Hide":"Show"," ",f.done.length," done"]}),h?(0,e.jsx)("ul",{className:"flex flex-col",children:f.done.map(D)}):null]}):null,t.tasksTruncated?(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Showing the first ",200," tasks. The counts include all of them."]}):null]}),(0,e.jsx)(Mn,{artifacts:t.artifacts,total:t.artifactsTotal,truncated:t.artifactsTruncated})]})}a(Ln,"ResponsibilityPageLayout");function zn({responsibility:t,now:s,className:n}){const{rollup:r}=t,l=r.metric,i=l?Rs(l):null;return(0,e.jsxs)(q,{id:"responsibility-score",elevation:"low",className:$("gap-6 px-6 py-6",n),children:[l&&i?(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:l.name}),(0,e.jsx)("p",{className:"flex flex-wrap items-baseline gap-x-2 tabular-nums",children:i.current?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-4xl font-semibold text-foreground",children:i.current}),(0,e.jsx)("span",{className:"text-lg text-muted-foreground",children:i.targetLabel})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-2xl font-semibold text-muted-foreground",children:"No reading yet"}),(0,e.jsx)("span",{className:"text-lg text-muted-foreground",children:i.targetLabel})]})}),(0,e.jsx)(Ns,{reading:i,health:r.health,label:`${l.name}, toward its bar`,className:"h-2"})]}):(0,e.jsx)("p",{className:"text-2xl font-semibold text-muted-foreground",children:"No number to track yet"}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(me,{health:r.health,overridden:r.healthOverridden}),l?.stale&&l.updatedAt?(0,e.jsx)(Me,{label:vt(l.updatedAt,s)}):null]}),(0,e.jsx)("p",{className:"text-sm text-foreground",children:r.statusSentence})]})]})}a(zn,"ScoreHero");function Ce({label:t,count:s}){return(0,e.jsxs)("div",{className:"flex min-w-0 flex-col gap-1 px-5 py-4","data-count":t.toLowerCase(),children:[(0,e.jsx)("dt",{className:"text-sm text-muted-foreground",children:t}),(0,e.jsx)("dd",{className:"text-2xl font-semibold tabular-nums text-foreground",children:s.value}),(0,e.jsx)("dd",{className:$("text-sm",s.alert?"text-(--status-task-icon-blocked)":"text-muted-foreground"),children:s.line})]})}a(Ce,"CountCell");function ut({label:t,value:s,children:n}){return(0,e.jsxs)(q,{elevation:"low",className:"min-w-0 gap-0.5 px-4 py-3","data-count":t.toLowerCase(),children:[(0,e.jsxs)("dt",{className:"flex items-baseline gap-2 text-sm text-muted-foreground",children:[t," ",(0,e.jsx)("span",{className:"font-semibold tabular-nums text-foreground",children:s})]}),(0,e.jsx)("dd",{className:"truncate text-xs text-muted-foreground",children:n})]})}a(ut,"CompactCount");function qn({responsibility:t,now:s,notices:n,onReviewProposal:r}){const l=(0,g.useMemo)(()=>Js(t),[t]),{skills:i,artifacts:c,artifactsTotal:d}=t,h=c[0]??null;return(0,e.jsx)("div",{className:"mx-auto flex w-full max-w-5xl flex-col","data-responsibility-view":"scorecard",children:(0,e.jsxs)("div",{className:"flex w-full max-w-3xl flex-col gap-6",children:[(0,e.jsx)(_e,{responsibility:t,children:n}),t.status==="proposed"?(0,e.jsx)(fe,{count:1,subject:"this",onReview:r}):null,(0,e.jsx)(zn,{responsibility:t,now:s}),(0,e.jsx)(q,{elevation:"low",className:"gap-0 py-0",children:(0,e.jsxs)("dl",{className:"grid grid-cols-1 divide-y divide-border sm:grid-cols-3 sm:divide-x sm:divide-y-0","aria-label":"The work",children:[(0,e.jsx)(Ce,{label:"Routines",count:l.routines}),(0,e.jsx)(Ce,{label:"Projects",count:l.projects}),(0,e.jsx)(Ce,{label:"Tasks",count:l.tasks})]})}),(0,e.jsxs)("dl",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,e.jsxs)(ut,{label:"Skills",value:String(i.length),children:[i.length===0?"None yet":i.slice(0,3).map((m,x)=>(0,e.jsxs)(g.Fragment,{children:[x>0?", ":null,(0,e.jsx)(M,{to:He(m),className:"underline-offset-4 hover:text-foreground hover:underline",children:m.name})]},m.id)),i.length>3?` and ${i.length-3} more`:null]}),(0,e.jsx)(ut,{label:"Artifacts",value:d>=1e3?`${Ct.toLocaleString("en-US")}+`:d.toLocaleString("en-US"),children:h?(0,e.jsxs)(e.Fragment,{children:["Newest:"," ",(0,e.jsx)(M,{to:h.href,className:"underline-offset-4 hover:text-foreground hover:underline",children:h.title})]}):"None yet"})]})]})})}a(qn,"ResponsibilityScorecard");var xt="#responsibility-status";function On({responsibility:t,agentsById:s,now:n,notices:r,onReviewProposal:l}){const{rollup:i}=t,c=(0,g.useMemo)(()=>i.workSummary.filter(x=>x.tone==="attention"),[i.workSummary]),d=(0,g.useMemo)(()=>i.workSummary.filter(x=>x.tone!=="attention"),[i.workSummary]),h=(0,g.useMemo)(()=>ia(t,n),[t,n]),m=i.metric?.stale&&i.metric.updatedAt?vt(i.metric.updatedAt,n):null;return(0,e.jsxs)("div",{className:"mx-auto flex w-full max-w-5xl flex-col gap-8","data-responsibility-view":"moving",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsx)(_e,{responsibility:t,children:r}),(0,e.jsxs)("p",{id:"responsibility-status",className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[(0,e.jsx)(me,{health:i.health,overridden:i.healthOverridden}),(0,e.jsx)("span",{className:"text-sm text-foreground",children:i.statusSentence}),m?(0,e.jsx)(Me,{label:m}):null]})]}),t.status==="proposed"?(0,e.jsx)(fe,{count:1,subject:"this",onReview:l}):null,(0,e.jsxs)("section",{"aria-labelledby":"moving-summary-heading",className:"flex flex-col gap-3",children:[(0,e.jsx)("h2",{id:"moving-summary-heading",className:"text-base font-semibold text-foreground",children:"What's moving"}),i.workSummary.length===0?(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Nothing to report yet. Once projects, tasks or routines are filed here, what they need shows up here."}):(0,e.jsxs)(q,{elevation:"low",className:"gap-5 px-5 py-4",children:[c.length>0?(0,e.jsxs)("div",{className:"flex flex-col gap-2","data-signal-group":"attention",children:[(0,e.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Needs attention"}),(0,e.jsx)(Te,{signals:c,responsibilityHref:a(()=>xt,"responsibilityHref")})]}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Nothing in the work needs attention."}),d.length>0?(0,e.jsxs)("div",{className:"flex flex-col gap-2","data-signal-group":"moving",children:[(0,e.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Everything else"}),(0,e.jsx)(Te,{signals:d,responsibilityHref:a(()=>xt,"responsibilityHref")})]}):null]})]}),(0,e.jsxs)("section",{"aria-labelledby":"moving-work-heading",className:"flex flex-col gap-2",children:[(0,e.jsxs)("h2",{id:"moving-work-heading",className:"text-base font-semibold text-foreground",children:["The work ",(0,e.jsx)("span",{className:"text-sm font-normal tabular-nums text-muted-foreground",children:h.items.length})]}),h.items.length>0?(0,e.jsx)(q,{elevation:"low",className:"gap-0 overflow-hidden py-0",children:(0,e.jsx)("ul",{className:"flex flex-col divide-y divide-border",children:h.items.map(x=>(0,e.jsx)(Ls,{item:x},`${x.kind}:${x.id}`))})}):(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No open projects, tasks or routines are filed here."}),h.finished>0||t.tasksTruncated?(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[h.finished>0?`${h.finished} finished ${h.finished===1?"item is":"items are"} not listed.`:null,h.finished>0&&t.tasksTruncated?" ":null,t.tasksTruncated?"Only the first 200 tasks are listed.":null]}):null]}),(0,e.jsx)(qs,{skills:t.skills,artifacts:t.artifacts,artifactsTotal:t.artifactsTotal,agentsById:s})]})}a(On,"ResponsibilityWhatsMoving");function Un(t,s){const n=V(),r=$t(),[l,i]=(0,g.useState)(null),c=Xs(s),d=Ws(s),h=[...R.responsibilities.detail(t.id),s,t.ownerUserId],m=a(()=>n.invalidateQueries({queryKey:R.responsibilities.all}),"refreshAll"),x=L({mutationFn:a(k=>_.update(t.id,k),"mutationFn"),onSuccess:a(k=>{n.setQueryData(h,p=>p&&{...p,...k}),m()},"onSuccess")}),f=L({mutationFn:a(()=>_.remove(t.id),"mutationFn"),onSuccess:a(()=>{n.removeQueries({queryKey:h}),n.invalidateQueries({queryKey:R.responsibilities.overviews(s)}),r("/responsibilities")},"onSuccess")}),j=L({mutationFn:a(k=>_.unlink(t.id,k.linkId),"mutationFn"),onSuccess:a((k,p)=>{i({label:p.label,relink:p.relink}),m()},"onSuccess")}),w=L({mutationFn:a(k=>_.link(t.id,k),"mutationFn"),onSuccess:a(()=>{i(null),m()},"onSuccess")});return{directory:c,areas:d.data??[],update:x,remove:f,unlink:j,relink:w,removed:l,navigate:r}}a(Un,"useResponsibilityPage");function Bn({responsibility:t,companyId:s}){const n=Un(t,s),{update:r,remove:l,unlink:i,relink:c,removed:d,navigate:h}=n,[m,x]=(0,g.useState)(null),[f,j]=(0,g.useState)(!1),{view:w,visiting:k,visit:p,leave:C}=la(Us,Os),y=(0,g.useMemo)(()=>new Date,[]),A=(0,g.useRef)(!1);(0,g.useEffect)(()=>{if(!A.current||w!=="full")return;A.current=!1;const v=requestAnimationFrame(()=>{const T=document.getElementById("responsibility-bar");T?.scrollIntoView?.({block:"start"}),T?.querySelector("button[data-bar-edit-primary]")?.click()});return()=>cancelAnimationFrame(v)},[w]);const F=a(()=>{A.current=!0,p("full")},"editBar"),D={saveTitle:a(v=>r.mutateAsync({title:v}),"saveTitle"),saveDescription:a(v=>r.mutateAsync({description:v}),"saveDescription"),setStatus:a(v=>r.mutate({status:v}),"setStatus"),requestDelete:a(()=>j(!0),"requestDelete"),newTask:x,unlink:a(v=>i.mutate(v),"unlink"),unlinkingId:i.isPending?i.variables?.linkId??null:null,onProposalReviewed:a(({dismissed:v})=>{v.length>0&&h("/responsibilities")},"onProposalReviewed")},u=(0,e.jsxs)(e.Fragment,{children:[r.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t save the change. ",E(r.error).body]}):null,d?(0,e.jsxs)("div",{role:"status",className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[(0,e.jsxs)("span",{children:["Removed “",d.label,"” from this responsibility. It still exists, and stays under any other responsibility it is filed under."]}),(0,e.jsx)(b,{size:"xs",variant:"ghost",disabled:c.isPending,onClick:a(()=>c.mutate(d.relink),"onClick"),children:"Undo"})]}):null,i.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t remove it from this responsibility. ",E(i.error).body]}):null,c.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t put it back. ",E(c.error).body]}):null]}),S={responsibility:t,companyId:s,agents:n.directory.agents,agentsById:n.directory.byId,areas:n.areas,now:y,actions:D,notices:u},I={...S,onReviewProposal:a(()=>p("full"),"onReviewProposal"),onEditBar:t.status==="dismissed"?void 0:F};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[k?(0,e.jsx)("div",{className:"mx-auto flex w-full max-w-5xl justify-end",children:(0,e.jsx)(b,{variant:"ghost",onClick:C,"data-responsibility-back":"",children:"Back"})}):null,w==="scorecard"?(0,e.jsx)(qn,{...I}):w==="moving"?(0,e.jsx)(On,{...I}):w==="one_screen"?(0,e.jsx)(sn,{...I}):w==="one_screen_v2"?(0,e.jsx)(En,{...I}):(0,e.jsx)(Ln,{...S})]}),m?(0,e.jsx)(ea,{open:!0,onOpenChange:a(v=>{v||x(null)},"onOpenChange"),companyId:s,responsibility:{id:t.id,title:t.title},defaultTitle:m.defaultTitle,projectId:m.projectId??null}):null,(0,e.jsx)(Tt,{open:f,onOpenChange:j,children:(0,e.jsxs)(Rt,{children:[(0,e.jsxs)(At,{children:[(0,e.jsxs)(Ot,{children:["Delete ",t.title,"?"]}),(0,e.jsx)(St,{children:"This removes the responsibility, its bar and its number. The projects, tasks and routines filed under it stay. To stop owning it but keep its history, let it go instead."})]}),l.error?(0,e.jsxs)("p",{role:"alert",className:"text-sm text-destructive",children:["Couldn’t delete it. ",E(l.error).body]}):null,(0,e.jsxs)(yt,{className:"items-center sm:justify-between",children:[(0,e.jsx)(Ut,{children:"Keep it"}),(0,e.jsx)(b,{variant:"destructive",disabled:l.isPending,onClick:a(()=>l.mutate(),"onClick"),children:l.isPending?"Deleting…":"Delete responsibility"})]})]})})]})}a(Bn,"ResponsibilityView");function er(){const{responsibilityId:t}=Sa(),{selectedCompanyId:s}=pa(),{setBreadcrumbs:n}=Ia(),{userId:r}=ca(),l=z({queryKey:[...R.responsibilities.detail(t??"__none__"),s,r],queryFn:a(()=>_.get(t),"queryFn"),enabled:!!t&&!!s&&!!r}),i=l.data?.title;return(0,g.useEffect)(()=>{n([{label:"Dashboard",href:"/responsibilities"},...i?[{label:i}]:[]])},[n,i]),!s||!t?null:(0,e.jsx)(Aa,{query:l,size:"page",action:"load this responsibility",loading:(0,e.jsx)(Fa,{variant:"detail"}),notFound:(0,e.jsxs)("div",{className:"mx-auto flex max-w-xl flex-col items-start gap-3 py-10",children:[(0,e.jsx)("h1",{className:"text-xl font-semibold text-foreground",children:"This responsibility is not available"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"It may have been deleted, or it belongs to someone else."}),(0,e.jsx)(b,{asChild:!0,variant:"outline",children:(0,e.jsx)(M,{to:"/responsibilities",children:"Back to the dashboard"})})]}),children:a(c=>c.companyId===s?(0,e.jsx)(Bn,{responsibility:c,companyId:s}):(0,e.jsxs)("div",{className:"mx-auto flex max-w-xl flex-col items-start gap-3 py-10",children:[(0,e.jsx)("h1",{className:"text-xl font-semibold text-foreground",children:"This responsibility belongs to another organization"}),(0,e.jsx)(b,{asChild:!0,variant:"outline",children:(0,e.jsx)(M,{to:"/responsibilities",children:"Back to the dashboard"})})]}),"children")})}a(er,"ResponsibilityDetail");export{er as ResponsibilityDetail};
@@ -1 +1 @@
1
- var c=Object.defineProperty;var n=(t,s)=>c(t,"name",{value:s,configurable:!0});import{a as x}from"./rolldown-runtime-DhZMWcEn.js";import{f as d}from"./issue-detail-4PCbYpdv.js";import{$A as m,E_ as u,zE as h}from"./index-Bt31d8ga.js";var e=x(m(),1);function a({title:t,description:s,children:o}){return(0,e.jsxs)("section",{className:"rounded-2xl border border-border/70 bg-background/85 p-5 shadow-sm",children:[(0,e.jsxs)("div",{className:"mb-4",children:[(0,e.jsx)("h2",{className:"text-base font-semibold text-foreground",children:t}),(0,e.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:s})]}),(0,e.jsx)("div",{className:"grid gap-4 lg:grid-cols-2",children:o})]})}n(a,"LabSection");function r({label:t,children:s}){return(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) font-semibold uppercase tracking-(--tracking-caps) text-muted-foreground",children:t}),(0,e.jsx)(u,{className:"block border-border/60 p-3",children:s})]})}n(r,"BeforeAfter");function l({onBehalfOf:t,denial:s}){return(0,e.jsxs)("article",{className:"space-y-1.5 rounded-lg border border-border/60 px-3 py-2 text-xs text-muted-foreground",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,e.jsx)("span",{className:"font-medium text-foreground",children:"Run"}),(0,e.jsx)("span",{className:"min-w-0 max-w-full truncate font-mono text-foreground",children:"a1b2c3d4"}),(0,e.jsx)("span",{children:"by CodexCoder"}),t?(0,e.jsxs)("span",{className:"min-w-0 max-w-full truncate text-muted-foreground",children:["on behalf of ",(0,e.jsx)("span",{className:"text-foreground",children:t})]}):null,(0,e.jsx)("span",{className:"rounded-md border border-border px-1.5 py-0.5 text-(length:--text-micro) capitalize text-muted-foreground",children:s?"Failed":"Succeeded"}),(0,e.jsx)("span",{className:"ml-auto shrink-0",children:"2m ago"})]}),(0,e.jsxs)("div",{className:"grid gap-2 text-xs text-muted-foreground sm:grid-cols-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("span",{className:"text-foreground",children:"Elapsed"})," 1m 4s"]}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("span",{className:"text-foreground",children:"Last useful action"})," 2m ago"]}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("span",{className:"text-foreground",children:"Stop"})," ",s?"Denied":"Completed"]})]}),s]})}n(l,"RunLedgerRow");function i({onBehalfOf:t,denial:s}){return(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-lg font-semibold text-foreground",children:"Run a1b2c3d4"}),(0,e.jsx)("span",{className:"rounded-md border border-border px-1.5 py-0.5 text-(length:--text-micro) capitalize text-muted-foreground",children:s?"failed":"succeeded"})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 font-mono text-(length:--text-micro) text-muted-foreground",children:[(0,e.jsx)("span",{className:"rounded bg-muted px-1.5 py-0.5 text-(length:--text-nano) font-medium uppercase tracking-wide",children:"codex local"}),(0,e.jsx)("span",{children:"anthropic/claude-opus-4-8"})]}),t?(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:["On behalf of ",(0,e.jsx)("span",{className:"text-foreground",children:t})]}):null,s]})}n(i,"RunDetailHeader");function b(){return(0,e.jsx)("div",{className:"min-h-screen bg-muted/20 p-6",children:(0,e.jsxs)("div",{className:"mx-auto max-w-5xl space-y-6",children:[(0,e.jsxs)("header",{children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) font-semibold uppercase tracking-(--tracking-caps) text-muted-foreground",children:"PAP-12462 · P7"}),(0,e.jsx)("h1",{className:"mt-1 text-xl font-semibold text-foreground",children:'Run "on behalf of" surfacing + denial copy'}),(0,e.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Before/after of the two run surfaces and the four denial-related states."})]}),(0,e.jsxs)(a,{title:"1 · Run identity — “on behalf of {user}”",description:"A run acting for a human now names that user on both the issue run ledger and the run detail header.",children:[(0,e.jsx)(r,{label:"Before — run ledger",children:(0,e.jsx)(l,{})}),(0,e.jsx)(r,{label:"After — run ledger",children:(0,e.jsx)(l,{onBehalfOf:"Ada Lovelace"})}),(0,e.jsx)(r,{label:"Before — run detail",children:(0,e.jsx)(i,{})}),(0,e.jsx)(r,{label:"After — run detail",children:(0,e.jsx)(i,{onBehalfOf:"Ada Lovelace"})})]}),(0,e.jsxs)(a,{title:"2 · Denial state — responsible user not authorized",description:"The agent is allowed, but the user the run acts for is not. Distinct from a plain agent-lacks-permission failure.",children:[(0,e.jsx)(r,{label:"Before — generic failure text",children:(0,e.jsxs)("div",{className:"text-xs",children:[(0,e.jsx)("span",{className:"text-red-600 dark:text-red-400",children:"Forbidden: action not permitted"}),(0,e.jsx)("span",{className:"ml-1 text-muted-foreground",children:"(RESPONSIBLE_USER_UNAUTHORIZED)"})]})}),(0,e.jsx)(r,{label:"After — actionable denial copy",children:(0,e.jsx)(d,{code:"RESPONSIBLE_USER_UNAUTHORIZED",userName:"Ada Lovelace"})})]}),(0,e.jsxs)(a,{title:"3 · Denial state — agent lacks permission (unchanged)",description:"A denial that is NOT a responsible-user code keeps the existing generic error copy — no responsible-user notice.",children:[(0,e.jsx)(r,{label:"Agent-lacks-permission failure",children:(0,e.jsxs)("div",{className:"text-xs",children:[(0,e.jsx)("span",{className:"text-red-600 dark:text-red-400",children:"Forbidden: agent is not permitted to perform this action"}),(0,e.jsx)("span",{className:"ml-1 text-muted-foreground",children:"(deny_missing_membership)"})]})}),(0,e.jsx)(r,{label:"No responsible-user notice rendered",children:(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:"Responsible-user denial notice intentionally absent for non-responsible-user codes."})})]}),(0,e.jsxs)(a,{title:"4 · Denial state — responsible user unavailable",description:"The user this run acts for was removed or deactivated. Steers the agent to mark work blocked.",children:[(0,e.jsx)(r,{label:"Before — generic failure text",children:(0,e.jsxs)("div",{className:"text-xs",children:[(0,e.jsx)("span",{className:"text-red-600 dark:text-red-400",children:"Forbidden: responsible user unavailable"}),(0,e.jsx)("span",{className:"ml-1 text-muted-foreground",children:"(RESPONSIBLE_USER_UNAVAILABLE)"})]})}),(0,e.jsx)(r,{label:"After — actionable denial copy",children:(0,e.jsx)(d,{code:"RESPONSIBLE_USER_UNAVAILABLE",userName:"Grace Hopper"})})]}),(0,e.jsxs)(a,{title:"In-context — denial inside a failed run ledger row",description:"How the notice reads within a run row on the issue timeline.",children:[(0,e.jsx)(r,{label:"Unauthorized",children:(0,e.jsx)(l,{onBehalfOf:"Ada Lovelace",denial:(0,e.jsx)(d,{code:"RESPONSIBLE_USER_UNAUTHORIZED",userName:"Ada Lovelace"})})}),(0,e.jsx)(r,{label:"Unavailable",children:(0,e.jsx)(l,{onBehalfOf:"Grace Hopper",denial:(0,e.jsx)(d,{code:"RESPONSIBLE_USER_UNAVAILABLE",userName:"Grace Hopper"})})})]}),(0,e.jsxs)("p",{className:h("text-center text-(length:--text-micro) text-muted-foreground"),children:["Copy is sourced from the shared ",(0,e.jsx)("code",{children:"describeResponsibleUserDenial"})," contract."]})]})})}n(b,"ResponsibleUserDenialUxLab");export{b as ResponsibleUserDenialUxLab};
1
+ var c=Object.defineProperty;var n=(t,s)=>c(t,"name",{value:s,configurable:!0});import{a as x}from"./rolldown-runtime-DhZMWcEn.js";import{f as d}from"./issue-detail-CZfjXs0M.js";import{$A as m,E_ as u,zE as h}from"./index-BJtnP7H1.js";var e=x(m(),1);function a({title:t,description:s,children:o}){return(0,e.jsxs)("section",{className:"rounded-2xl border border-border/70 bg-background/85 p-5 shadow-sm",children:[(0,e.jsxs)("div",{className:"mb-4",children:[(0,e.jsx)("h2",{className:"text-base font-semibold text-foreground",children:t}),(0,e.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:s})]}),(0,e.jsx)("div",{className:"grid gap-4 lg:grid-cols-2",children:o})]})}n(a,"LabSection");function r({label:t,children:s}){return(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) font-semibold uppercase tracking-(--tracking-caps) text-muted-foreground",children:t}),(0,e.jsx)(u,{className:"block border-border/60 p-3",children:s})]})}n(r,"BeforeAfter");function l({onBehalfOf:t,denial:s}){return(0,e.jsxs)("article",{className:"space-y-1.5 rounded-lg border border-border/60 px-3 py-2 text-xs text-muted-foreground",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,e.jsx)("span",{className:"font-medium text-foreground",children:"Run"}),(0,e.jsx)("span",{className:"min-w-0 max-w-full truncate font-mono text-foreground",children:"a1b2c3d4"}),(0,e.jsx)("span",{children:"by CodexCoder"}),t?(0,e.jsxs)("span",{className:"min-w-0 max-w-full truncate text-muted-foreground",children:["on behalf of ",(0,e.jsx)("span",{className:"text-foreground",children:t})]}):null,(0,e.jsx)("span",{className:"rounded-md border border-border px-1.5 py-0.5 text-(length:--text-micro) capitalize text-muted-foreground",children:s?"Failed":"Succeeded"}),(0,e.jsx)("span",{className:"ml-auto shrink-0",children:"2m ago"})]}),(0,e.jsxs)("div",{className:"grid gap-2 text-xs text-muted-foreground sm:grid-cols-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("span",{className:"text-foreground",children:"Elapsed"})," 1m 4s"]}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("span",{className:"text-foreground",children:"Last useful action"})," 2m ago"]}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("span",{className:"text-foreground",children:"Stop"})," ",s?"Denied":"Completed"]})]}),s]})}n(l,"RunLedgerRow");function i({onBehalfOf:t,denial:s}){return(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-lg font-semibold text-foreground",children:"Run a1b2c3d4"}),(0,e.jsx)("span",{className:"rounded-md border border-border px-1.5 py-0.5 text-(length:--text-micro) capitalize text-muted-foreground",children:s?"failed":"succeeded"})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 font-mono text-(length:--text-micro) text-muted-foreground",children:[(0,e.jsx)("span",{className:"rounded bg-muted px-1.5 py-0.5 text-(length:--text-nano) font-medium uppercase tracking-wide",children:"codex local"}),(0,e.jsx)("span",{children:"anthropic/claude-opus-4-8"})]}),t?(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:["On behalf of ",(0,e.jsx)("span",{className:"text-foreground",children:t})]}):null,s]})}n(i,"RunDetailHeader");function b(){return(0,e.jsx)("div",{className:"min-h-screen bg-muted/20 p-6",children:(0,e.jsxs)("div",{className:"mx-auto max-w-5xl space-y-6",children:[(0,e.jsxs)("header",{children:[(0,e.jsx)("div",{className:"text-(length:--text-micro) font-semibold uppercase tracking-(--tracking-caps) text-muted-foreground",children:"PAP-12462 · P7"}),(0,e.jsx)("h1",{className:"mt-1 text-xl font-semibold text-foreground",children:'Run "on behalf of" surfacing + denial copy'}),(0,e.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Before/after of the two run surfaces and the four denial-related states."})]}),(0,e.jsxs)(a,{title:"1 · Run identity — “on behalf of {user}”",description:"A run acting for a human now names that user on both the issue run ledger and the run detail header.",children:[(0,e.jsx)(r,{label:"Before — run ledger",children:(0,e.jsx)(l,{})}),(0,e.jsx)(r,{label:"After — run ledger",children:(0,e.jsx)(l,{onBehalfOf:"Ada Lovelace"})}),(0,e.jsx)(r,{label:"Before — run detail",children:(0,e.jsx)(i,{})}),(0,e.jsx)(r,{label:"After — run detail",children:(0,e.jsx)(i,{onBehalfOf:"Ada Lovelace"})})]}),(0,e.jsxs)(a,{title:"2 · Denial state — responsible user not authorized",description:"The agent is allowed, but the user the run acts for is not. Distinct from a plain agent-lacks-permission failure.",children:[(0,e.jsx)(r,{label:"Before — generic failure text",children:(0,e.jsxs)("div",{className:"text-xs",children:[(0,e.jsx)("span",{className:"text-red-600 dark:text-red-400",children:"Forbidden: action not permitted"}),(0,e.jsx)("span",{className:"ml-1 text-muted-foreground",children:"(RESPONSIBLE_USER_UNAUTHORIZED)"})]})}),(0,e.jsx)(r,{label:"After — actionable denial copy",children:(0,e.jsx)(d,{code:"RESPONSIBLE_USER_UNAUTHORIZED",userName:"Ada Lovelace"})})]}),(0,e.jsxs)(a,{title:"3 · Denial state — agent lacks permission (unchanged)",description:"A denial that is NOT a responsible-user code keeps the existing generic error copy — no responsible-user notice.",children:[(0,e.jsx)(r,{label:"Agent-lacks-permission failure",children:(0,e.jsxs)("div",{className:"text-xs",children:[(0,e.jsx)("span",{className:"text-red-600 dark:text-red-400",children:"Forbidden: agent is not permitted to perform this action"}),(0,e.jsx)("span",{className:"ml-1 text-muted-foreground",children:"(deny_missing_membership)"})]})}),(0,e.jsx)(r,{label:"No responsible-user notice rendered",children:(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:"Responsible-user denial notice intentionally absent for non-responsible-user codes."})})]}),(0,e.jsxs)(a,{title:"4 · Denial state — responsible user unavailable",description:"The user this run acts for was removed or deactivated. Steers the agent to mark work blocked.",children:[(0,e.jsx)(r,{label:"Before — generic failure text",children:(0,e.jsxs)("div",{className:"text-xs",children:[(0,e.jsx)("span",{className:"text-red-600 dark:text-red-400",children:"Forbidden: responsible user unavailable"}),(0,e.jsx)("span",{className:"ml-1 text-muted-foreground",children:"(RESPONSIBLE_USER_UNAVAILABLE)"})]})}),(0,e.jsx)(r,{label:"After — actionable denial copy",children:(0,e.jsx)(d,{code:"RESPONSIBLE_USER_UNAVAILABLE",userName:"Grace Hopper"})})]}),(0,e.jsxs)(a,{title:"In-context — denial inside a failed run ledger row",description:"How the notice reads within a run row on the issue timeline.",children:[(0,e.jsx)(r,{label:"Unauthorized",children:(0,e.jsx)(l,{onBehalfOf:"Ada Lovelace",denial:(0,e.jsx)(d,{code:"RESPONSIBLE_USER_UNAUTHORIZED",userName:"Ada Lovelace"})})}),(0,e.jsx)(r,{label:"Unavailable",children:(0,e.jsx)(l,{onBehalfOf:"Grace Hopper",denial:(0,e.jsx)(d,{code:"RESPONSIBLE_USER_UNAVAILABLE",userName:"Grace Hopper"})})})]}),(0,e.jsxs)("p",{className:h("text-center text-(length:--text-micro) text-muted-foreground"),children:["Copy is sourced from the shared ",(0,e.jsx)("code",{children:"describeResponsibleUserDenial"})," contract."]})]})})}n(b,"ResponsibleUserDenialUxLab");export{b as ResponsibleUserDenialUxLab};
@@ -1 +1 @@
1
- var D=Object.defineProperty;var t=(n,s)=>D(n,"name",{value:s,configurable:!0});import{a as L}from"./rolldown-runtime-DhZMWcEn.js";import{$r as O,Qr as z,ei as F,ri as Y,un as P}from"./issue-detail-4PCbYpdv.js";import{$A as G,$S as M,AO as U,Ev as V,GS as m,Gb as W,IS as T,Jp as j,LS as H,ME as J,MT as X,NE as y,Rp as Z,UT as ee,_v as se,_w as b,ab as te,bE as k,hE as ne,hv as ae,iC as re,jb as ie,kC as le,lS as oe,nT as de,nj as ce,pv as ue,rO as _,rb as xe,sv as pe,ub as me,x as $,xE as C,zE as E}from"./index-Bt31d8ga.js";var R=L(ce(),1),e=L(G(),1);function be({connectionId:n,emptyState:s="hidden",heading:h="Waiting for your OK",plain:p=!1,layout:x="queue"}){const{selectedCompanyId:r}=H(),l=C({queryKey:m.tools.actionRequests(r??"__none__","pending"),queryFn:t(()=>j.listActionRequests(r,"pending"),"queryFn"),enabled:!!r,refetchInterval:2e4}),o=me(l),d=(0,R.useMemo)(()=>{const i=l.data?.actionRequests??[];return n?i.filter(v=>v.connectionId===n):i},[l.data,n]),w=x==="decisions",N=C({queryKey:m.agents.list(r??"__none__"),queryFn:t(()=>xe.list(r),"queryFn"),enabled:w&&!!r&&d.some(i=>i.requestedByAgentId)}),u=(0,R.useMemo)(()=>ge(N.data??[]),[N.data]);return!r||l.isLoading||o.kind==="reconnecting"?null:o.kind==="error"?(0,e.jsx)(te,{error:l.error,action:"load connection reviews",onRetry:o.retry,retrying:o.isFetching}):d.length===0?s==="hidden"?null:(0,e.jsx)("div",{className:p?"py-5 text-sm text-muted-foreground":"rounded-xl border border-border bg-card p-5 text-sm text-muted-foreground",children:"Nothing is waiting for your OK right now."}):w?(0,e.jsx)("ul",{"aria-label":"Requests to review",className:"flex flex-col gap-3",children:d.map(i=>(0,e.jsx)("li",{children:(0,e.jsx)(K,{companyId:r,item:i,plain:!1,decision:!0,agent:i.requestedByAgentId?u.get(i.requestedByAgentId)??null:null})},i.request.id))}):(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(le,{className:"h-4 w-4 text-muted-foreground"}),(0,e.jsx)("h2",{className:"text-sm font-bold text-foreground",children:h}),(0,e.jsx)("span",{className:"inline-flex items-center rounded-full bg-muted px-2 py-0.5 text-xs font-semibold text-muted-foreground",children:d.length})]}),(0,e.jsx)("div",{className:"space-y-3",children:d.map(i=>(0,e.jsx)(K,{companyId:r,item:i,plain:p},i.request.id))})]})}t(be,"ReviewQueueCard");function K({companyId:n,item:s,plain:h,decision:p=!1,agent:x=null}){const r=J(),{pushToast:l}=pe(),[o,d]=(0,R.useState)(null),w=C({queryKey:m.issues.interactions(s.request.issueId??"__none__"),queryFn:t(()=>oe.listInteractions(s.request.issueId),"queryFn"),enabled:!!(s.request.issueId&&s.request.interactionId)}),N=w.data?.find(a=>a.id===s.request.interactionId),u=t(()=>{r.invalidateQueries({queryKey:m.tools.actionRequests(n,"pending")}),r.invalidateQueries({queryKey:m.apps.attention(n)}),r.invalidateQueries({queryKey:m.tools.trustRules(n)}),s.request.issueId&&r.invalidateQueries({queryKey:m.issues.interactions(s.request.issueId)})},"invalidate"),i=k({mutationFn:t(()=>j.approveActionRequest(n,s.request.id),"mutationFn"),onMutate:t(()=>d("allow"),"onMutate"),onSuccess:t(()=>{l({title:"Allowed once",body:`${q(s)} can run this time.`,tone:"success"}),u()},"onSuccess"),onError:t(a=>{u(),I(l,a)},"onError"),onSettled:t(()=>d(null),"onSettled")}),v=k({mutationFn:t(async()=>j.approveActionRequest(n,s.request.id,!0),"mutationFn"),onMutate:t(()=>d("always"),"onMutate"),onSuccess:t(()=>{l({title:"Always allowed",body:`${q(s)} won’t ask again.`,tone:"success"}),u(),r.invalidateQueries({queryKey:m.tools.trustRules(n)})},"onSuccess"),onError:t(a=>{u(),I(l,a)},"onError"),onSettled:t(()=>d(null),"onSettled")}),S=k({mutationFn:t(()=>j.declineActionRequest(n,s.request.id),"mutationFn"),onMutate:t(()=>d("decline"),"onMutate"),onSuccess:t(()=>{l({title:"Declined",body:`${q(s)} won’t run.`,tone:"info"}),u()},"onSuccess"),onError:t(a=>{u(),I(l,a)},"onError"),onSettled:t(()=>d(null),"onSettled")});if(p&&w.isLoading)return(0,e.jsx)("article",{className:"coordinator-decision-card","aria-busy":"true",children:(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading request…"})});if(N){const a=(0,e.jsx)(P,{interaction:N,presentationVariant:p?"coordinator-decision":"default",primaryActionOnRight:p,onAcceptInteraction:t(async(c,f,fe,B)=>{try{await j.approveActionRequest(n,s.request.id,B)}finally{u()}},"onAcceptInteraction"),onRejectInteraction:t(async(c,f)=>{try{await j.declineActionRequest(n,s.request.id,f)}finally{u()}},"onRejectInteraction")});return p?(0,e.jsx)("article",{className:"coordinator-decision-card space-y-3",children:a}):a}const g=o!==null,A=s.request.previewMarkdown?.trim(),Q=!!(s.requestedByAgentId&&s.connectionId&&!s.request.approvalId);if(p){const a=q(s),c=s.applicationName?_(s.applicationName):null,f=s.riskLevel?he[s.riskLevel]:null;return(0,e.jsxs)("article",{className:E("coordinator-decision-card space-y-3",M),"aria-label":c?`${a} in ${c}`:a,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,e.jsx)("span",{className:"min-w-0 truncate text-xs leading-4.5 text-muted-foreground",children:"Approve tool access"}),(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-3","data-attention-context":!0,children:[x?(0,e.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-2 text-xs leading-4.5 text-muted-foreground",children:[(0,e.jsx)(ie,{agent:x,size:20}),(0,e.jsxs)("span",{className:"truncate",children:["from ",x.name]})]}):null,(0,e.jsx)("time",{className:"shrink-0 text-xs leading-4.5 text-muted-foreground",dateTime:new Date(s.request.createdAt).toISOString(),children:T(s.request.createdAt)}),Q?(0,e.jsxs)(ue,{children:[(0,e.jsx)(V,{asChild:!0,children:(0,e.jsx)(y,{type:"button",variant:"ghost",size:"icon-sm",className:"-mr-1.5 size-7 text-muted-foreground","aria-label":`More for ${a}`,disabled:g,children:(0,e.jsx)(de,{"aria-hidden":!0})})}),(0,e.jsx)(ae,{align:"end",className:`w-72 ${M}`,children:(0,e.jsxs)(se,{className:"flex flex-col items-start gap-0.5 py-2",onSelect:t(()=>v.mutate(),"onSelect"),children:[(0,e.jsx)("span",{className:"text-sm text-foreground",children:"Always allow"}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"This agent can run this action on this connection without asking again."})]})})]}):null]})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{children:c?`${a} in ${c}`:a}),(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:[c?`${a} is set to Ask first in ${c}, so it waits for your OK.`:"This action is set to Ask first, so it waits for your OK."," Allow once runs it now."]})]}),(0,e.jsxs)(z,{children:[c?(0,e.jsx)(F,{icon:(0,e.jsx)(Z,{name:c,size:20,compact:!0,className:"bg-transparent"}),title:c,meta:(0,e.jsxs)(e.Fragment,{children:[a,f?(0,e.jsxs)(e.Fragment,{children:[" · ",(0,e.jsx)("span",{className:E(f.danger&&"text-destructive"),children:f.label})]}):null]})}):null,A?(0,e.jsx)("div",{className:"text-sm",children:(0,e.jsx)($,{children:A})}):null,x?(0,e.jsxs)(O,{children:["Requested by ",x.name,"."]}):null]}),(0,e.jsxs)(Y,{leading:s.request.issueId?(0,e.jsxs)(W,{to:`/issues/${s.request.issueId}`,className:"flex max-w-full min-w-0 items-center gap-1.5 text-(length:--text-compact) leading-5 text-muted-foreground hover:text-foreground",children:[(0,e.jsx)("span",{className:"min-w-0 truncate",children:x?`Open task · Chat with ${x.name}`:"Open task"}),(0,e.jsx)(ee,{className:"size-4 shrink-0","aria-hidden":!0})]}):void 0,children:[(0,e.jsxs)(y,{type:"button",variant:"ghost",onClick:t(()=>S.mutate(),"onClick"),disabled:g,children:[o==="decline"?(0,e.jsx)(b,{className:"animate-spin","aria-hidden":!0}):null,"Decline"]}),(0,e.jsxs)(y,{type:"button",onClick:t(()=>i.mutate(),"onClick"),disabled:g,children:[o==="allow"||o==="always"?(0,e.jsx)(b,{className:"animate-spin","aria-hidden":!0}):null,"Allow once"]})]})]})}return(0,e.jsxs)("div",{className:h?"py-3":"rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1 text-sm",children:[(0,e.jsx)("span",{className:"font-bold text-foreground",children:q(s)}),s.applicationName&&(0,e.jsxs)("span",{className:"text-muted-foreground",children:["in ",_(s.applicationName)]}),(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:["· asked ",T(s.request.createdAt)]})]}),A?(0,e.jsx)("div",{className:"mt-2 rounded-lg border border-border bg-background px-3 py-2 text-sm",children:(0,e.jsx)($,{children:A})}):(0,e.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"An agent wants to run this action. Your connection policy requires approval first."}),s.requestedByAgentId&&s.connectionId&&!s.request.approvalId?(0,e.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:"Always allow lets this agent use this action with different arguments on this connection, within the current project when present."}):null,(0,e.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,e.jsxs)(y,{size:"sm",onClick:t(()=>i.mutate(),"onClick"),disabled:g,children:[o==="allow"?(0,e.jsx)(b,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,e.jsx)(X,{className:"mr-1.5 h-3.5 w-3.5"}),"Allow once"]}),s.requestedByAgentId&&s.connectionId&&!s.request.approvalId?(0,e.jsxs)(y,{size:"sm",variant:"outline",onClick:t(()=>v.mutate(),"onClick"),disabled:g,children:[o==="always"?(0,e.jsx)(b,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):null,"Always allow"]}):null,(0,e.jsxs)(y,{size:"sm",variant:"ghost",onClick:t(()=>S.mutate(),"onClick"),disabled:g,children:[o==="decline"?(0,e.jsx)(b,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,e.jsx)(re,{className:"mr-1.5 h-3.5 w-3.5"}),"Decline"]})]})]})}t(K,"ReviewRow");var he={low:{label:"Low risk",danger:!1},medium:{label:"Medium risk",danger:!1},high:{label:"High risk",danger:!0},critical:{label:"Critical risk",danger:!0},read:{label:"Reads data",danger:!1},write:{label:"Changes data",danger:!1},destructive:{label:"Destructive",danger:!0}};function ge(n){const s=new Map;for(const h of n)s.set(h.id,h);return s}t(ge,"indexAgentsById");function q(n){return!n.toolTitle&&!n.toolName?"This action":_(n.toolName??"",{title:U(n.toolName??"",n.toolTitle)})}t(q,"actionLabel");function I(n,s){n({title:"Couldn’t save that",body:ne(s).body,tone:"error"})}t(I,"failToast");export{be as t};
1
+ var D=Object.defineProperty;var t=(n,s)=>D(n,"name",{value:s,configurable:!0});import{a as L}from"./rolldown-runtime-DhZMWcEn.js";import{$r as O,Qr as z,ei as F,ri as Y,un as P}from"./issue-detail-CZfjXs0M.js";import{$A as G,$S as M,AO as U,Ev as V,GS as m,Gb as W,IS as T,Jp as j,LS as H,ME as J,MT as X,NE as y,Rp as Z,UT as ee,_v as se,_w as b,ab as te,bE as k,hE as ne,hv as ae,iC as re,jb as ie,kC as le,lS as oe,nT as de,nj as ce,pv as ue,rO as _,rb as xe,sv as pe,ub as me,x as $,xE as C,zE as E}from"./index-BJtnP7H1.js";var R=L(ce(),1),e=L(G(),1);function be({connectionId:n,emptyState:s="hidden",heading:h="Waiting for your OK",plain:p=!1,layout:x="queue"}){const{selectedCompanyId:r}=H(),l=C({queryKey:m.tools.actionRequests(r??"__none__","pending"),queryFn:t(()=>j.listActionRequests(r,"pending"),"queryFn"),enabled:!!r,refetchInterval:2e4}),o=me(l),d=(0,R.useMemo)(()=>{const i=l.data?.actionRequests??[];return n?i.filter(v=>v.connectionId===n):i},[l.data,n]),w=x==="decisions",N=C({queryKey:m.agents.list(r??"__none__"),queryFn:t(()=>xe.list(r),"queryFn"),enabled:w&&!!r&&d.some(i=>i.requestedByAgentId)}),u=(0,R.useMemo)(()=>ge(N.data??[]),[N.data]);return!r||l.isLoading||o.kind==="reconnecting"?null:o.kind==="error"?(0,e.jsx)(te,{error:l.error,action:"load connection reviews",onRetry:o.retry,retrying:o.isFetching}):d.length===0?s==="hidden"?null:(0,e.jsx)("div",{className:p?"py-5 text-sm text-muted-foreground":"rounded-xl border border-border bg-card p-5 text-sm text-muted-foreground",children:"Nothing is waiting for your OK right now."}):w?(0,e.jsx)("ul",{"aria-label":"Requests to review",className:"flex flex-col gap-3",children:d.map(i=>(0,e.jsx)("li",{children:(0,e.jsx)(K,{companyId:r,item:i,plain:!1,decision:!0,agent:i.requestedByAgentId?u.get(i.requestedByAgentId)??null:null})},i.request.id))}):(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(le,{className:"h-4 w-4 text-muted-foreground"}),(0,e.jsx)("h2",{className:"text-sm font-bold text-foreground",children:h}),(0,e.jsx)("span",{className:"inline-flex items-center rounded-full bg-muted px-2 py-0.5 text-xs font-semibold text-muted-foreground",children:d.length})]}),(0,e.jsx)("div",{className:"space-y-3",children:d.map(i=>(0,e.jsx)(K,{companyId:r,item:i,plain:p},i.request.id))})]})}t(be,"ReviewQueueCard");function K({companyId:n,item:s,plain:h,decision:p=!1,agent:x=null}){const r=J(),{pushToast:l}=pe(),[o,d]=(0,R.useState)(null),w=C({queryKey:m.issues.interactions(s.request.issueId??"__none__"),queryFn:t(()=>oe.listInteractions(s.request.issueId),"queryFn"),enabled:!!(s.request.issueId&&s.request.interactionId)}),N=w.data?.find(a=>a.id===s.request.interactionId),u=t(()=>{r.invalidateQueries({queryKey:m.tools.actionRequests(n,"pending")}),r.invalidateQueries({queryKey:m.apps.attention(n)}),r.invalidateQueries({queryKey:m.tools.trustRules(n)}),s.request.issueId&&r.invalidateQueries({queryKey:m.issues.interactions(s.request.issueId)})},"invalidate"),i=k({mutationFn:t(()=>j.approveActionRequest(n,s.request.id),"mutationFn"),onMutate:t(()=>d("allow"),"onMutate"),onSuccess:t(()=>{l({title:"Allowed once",body:`${q(s)} can run this time.`,tone:"success"}),u()},"onSuccess"),onError:t(a=>{u(),I(l,a)},"onError"),onSettled:t(()=>d(null),"onSettled")}),v=k({mutationFn:t(async()=>j.approveActionRequest(n,s.request.id,!0),"mutationFn"),onMutate:t(()=>d("always"),"onMutate"),onSuccess:t(()=>{l({title:"Always allowed",body:`${q(s)} won’t ask again.`,tone:"success"}),u(),r.invalidateQueries({queryKey:m.tools.trustRules(n)})},"onSuccess"),onError:t(a=>{u(),I(l,a)},"onError"),onSettled:t(()=>d(null),"onSettled")}),S=k({mutationFn:t(()=>j.declineActionRequest(n,s.request.id),"mutationFn"),onMutate:t(()=>d("decline"),"onMutate"),onSuccess:t(()=>{l({title:"Declined",body:`${q(s)} won’t run.`,tone:"info"}),u()},"onSuccess"),onError:t(a=>{u(),I(l,a)},"onError"),onSettled:t(()=>d(null),"onSettled")});if(p&&w.isLoading)return(0,e.jsx)("article",{className:"coordinator-decision-card","aria-busy":"true",children:(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading request…"})});if(N){const a=(0,e.jsx)(P,{interaction:N,presentationVariant:p?"coordinator-decision":"default",primaryActionOnRight:p,onAcceptInteraction:t(async(c,f,fe,B)=>{try{await j.approveActionRequest(n,s.request.id,B)}finally{u()}},"onAcceptInteraction"),onRejectInteraction:t(async(c,f)=>{try{await j.declineActionRequest(n,s.request.id,f)}finally{u()}},"onRejectInteraction")});return p?(0,e.jsx)("article",{className:"coordinator-decision-card space-y-3",children:a}):a}const g=o!==null,A=s.request.previewMarkdown?.trim(),Q=!!(s.requestedByAgentId&&s.connectionId&&!s.request.approvalId);if(p){const a=q(s),c=s.applicationName?_(s.applicationName):null,f=s.riskLevel?he[s.riskLevel]:null;return(0,e.jsxs)("article",{className:E("coordinator-decision-card space-y-3",M),"aria-label":c?`${a} in ${c}`:a,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,e.jsx)("span",{className:"min-w-0 truncate text-xs leading-4.5 text-muted-foreground",children:"Approve tool access"}),(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-3","data-attention-context":!0,children:[x?(0,e.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-2 text-xs leading-4.5 text-muted-foreground",children:[(0,e.jsx)(ie,{agent:x,size:20}),(0,e.jsxs)("span",{className:"truncate",children:["from ",x.name]})]}):null,(0,e.jsx)("time",{className:"shrink-0 text-xs leading-4.5 text-muted-foreground",dateTime:new Date(s.request.createdAt).toISOString(),children:T(s.request.createdAt)}),Q?(0,e.jsxs)(ue,{children:[(0,e.jsx)(V,{asChild:!0,children:(0,e.jsx)(y,{type:"button",variant:"ghost",size:"icon-sm",className:"-mr-1.5 size-7 text-muted-foreground","aria-label":`More for ${a}`,disabled:g,children:(0,e.jsx)(de,{"aria-hidden":!0})})}),(0,e.jsx)(ae,{align:"end",className:`w-72 ${M}`,children:(0,e.jsxs)(se,{className:"flex flex-col items-start gap-0.5 py-2",onSelect:t(()=>v.mutate(),"onSelect"),children:[(0,e.jsx)("span",{className:"text-sm text-foreground",children:"Always allow"}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"This agent can run this action on this connection without asking again."})]})})]}):null]})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{children:c?`${a} in ${c}`:a}),(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:[c?`${a} is set to Ask first in ${c}, so it waits for your OK.`:"This action is set to Ask first, so it waits for your OK."," Allow once runs it now."]})]}),(0,e.jsxs)(z,{children:[c?(0,e.jsx)(F,{icon:(0,e.jsx)(Z,{name:c,size:20,compact:!0,className:"bg-transparent"}),title:c,meta:(0,e.jsxs)(e.Fragment,{children:[a,f?(0,e.jsxs)(e.Fragment,{children:[" · ",(0,e.jsx)("span",{className:E(f.danger&&"text-destructive"),children:f.label})]}):null]})}):null,A?(0,e.jsx)("div",{className:"text-sm",children:(0,e.jsx)($,{children:A})}):null,x?(0,e.jsxs)(O,{children:["Requested by ",x.name,"."]}):null]}),(0,e.jsxs)(Y,{leading:s.request.issueId?(0,e.jsxs)(W,{to:`/issues/${s.request.issueId}`,className:"flex max-w-full min-w-0 items-center gap-1.5 text-(length:--text-compact) leading-5 text-muted-foreground hover:text-foreground",children:[(0,e.jsx)("span",{className:"min-w-0 truncate",children:x?`Open task · Chat with ${x.name}`:"Open task"}),(0,e.jsx)(ee,{className:"size-4 shrink-0","aria-hidden":!0})]}):void 0,children:[(0,e.jsxs)(y,{type:"button",variant:"ghost",onClick:t(()=>S.mutate(),"onClick"),disabled:g,children:[o==="decline"?(0,e.jsx)(b,{className:"animate-spin","aria-hidden":!0}):null,"Decline"]}),(0,e.jsxs)(y,{type:"button",onClick:t(()=>i.mutate(),"onClick"),disabled:g,children:[o==="allow"||o==="always"?(0,e.jsx)(b,{className:"animate-spin","aria-hidden":!0}):null,"Allow once"]})]})]})}return(0,e.jsxs)("div",{className:h?"py-3":"rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1 text-sm",children:[(0,e.jsx)("span",{className:"font-bold text-foreground",children:q(s)}),s.applicationName&&(0,e.jsxs)("span",{className:"text-muted-foreground",children:["in ",_(s.applicationName)]}),(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:["· asked ",T(s.request.createdAt)]})]}),A?(0,e.jsx)("div",{className:"mt-2 rounded-lg border border-border bg-background px-3 py-2 text-sm",children:(0,e.jsx)($,{children:A})}):(0,e.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"An agent wants to run this action. Your connection policy requires approval first."}),s.requestedByAgentId&&s.connectionId&&!s.request.approvalId?(0,e.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:"Always allow lets this agent use this action with different arguments on this connection, within the current project when present."}):null,(0,e.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,e.jsxs)(y,{size:"sm",onClick:t(()=>i.mutate(),"onClick"),disabled:g,children:[o==="allow"?(0,e.jsx)(b,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,e.jsx)(X,{className:"mr-1.5 h-3.5 w-3.5"}),"Allow once"]}),s.requestedByAgentId&&s.connectionId&&!s.request.approvalId?(0,e.jsxs)(y,{size:"sm",variant:"outline",onClick:t(()=>v.mutate(),"onClick"),disabled:g,children:[o==="always"?(0,e.jsx)(b,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):null,"Always allow"]}):null,(0,e.jsxs)(y,{size:"sm",variant:"ghost",onClick:t(()=>S.mutate(),"onClick"),disabled:g,children:[o==="decline"?(0,e.jsx)(b,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):(0,e.jsx)(re,{className:"mr-1.5 h-3.5 w-3.5"}),"Decline"]})]})]})}t(K,"ReviewRow");var he={low:{label:"Low risk",danger:!1},medium:{label:"Medium risk",danger:!1},high:{label:"High risk",danger:!0},critical:{label:"Critical risk",danger:!0},read:{label:"Reads data",danger:!1},write:{label:"Changes data",danger:!1},destructive:{label:"Destructive",danger:!0}};function ge(n){const s=new Map;for(const h of n)s.set(h.id,h);return s}t(ge,"indexAgentsById");function q(n){return!n.toolTitle&&!n.toolName?"This action":_(n.toolName??"",{title:U(n.toolName??"",n.toolTitle)})}t(q,"actionLabel");function I(n,s){n({title:"Couldn’t save that",body:ne(s).body,tone:"error"})}t(I,"failToast");export{be as t};