@tickernelz/wardmote-ui 2026.1118.0 → 2026.1118.2

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 (164) hide show
  1. package/dist/assets/{AdapterManager-Cz1qnS9X.js → AdapterManager-DvntZ2AW.js} +1 -1
  2. package/dist/assets/{AdvancedToolsRoute-7YTRdxju.js → AdvancedToolsRoute-CUW8D9Ux.js} +1 -1
  3. package/dist/assets/{AgentActionButtons-CE0nmrqG.js → AgentActionButtons-CQLGCtfu.js} +1 -1
  4. package/dist/assets/{AgentBubbleActionRow-Dqrx638X.js → AgentBubbleActionRow-CnkfFlB3.js} +1 -1
  5. package/dist/assets/{AgentChat-AunGdpGT.js → AgentChat-DCwwZA2b.js} +1 -1
  6. package/dist/assets/{AgentChats-T9fzOwzH.js → AgentChats-DMMLdo-o.js} +1 -1
  7. package/dist/assets/{AgentDefaults-C0WFwQky.js → AgentDefaults-Cu8O2iTJ.js} +1 -1
  8. package/dist/assets/{AgentDetail-DEmzneVa.js → AgentDetail-BMVWOVp-.js} +7 -7
  9. package/dist/assets/{AgentIconPicker-BJerBmcL.js → AgentIconPicker-DJaVz-Vx.js} +1 -1
  10. package/dist/assets/{AgentTodoCard-D1lORgGy.js → AgentTodoCard-C4BfJg4x.js} +1 -1
  11. package/dist/assets/Agents-C0IDC6KD.js +3 -0
  12. package/dist/assets/{AppDetail-BX1FNfWC.js → AppDetail-DzEGsx94.js} +1 -1
  13. package/dist/assets/{AppNotConnected-7VCE3fbW.js → AppNotConnected-BVL32B49.js} +1 -1
  14. package/dist/assets/{ApprovalCard-BFjlBJIl.js → ApprovalCard-DCQ49PuW.js} +1 -1
  15. package/dist/assets/{ApprovalDetail-nh-aAVQ1.js → ApprovalDetail-B0J70llD.js} +1 -1
  16. package/dist/assets/{ApprovalPayload-CrxNpWYr.js → ApprovalPayload-8lqBw-XQ.js} +1 -1
  17. package/dist/assets/{Approvals-T3qTJIwh.js → Approvals-BkiVjx0M.js} +1 -1
  18. package/dist/assets/{AppsConnect-D7l2xnv-.js → AppsConnect-B_hvpdTB.js} +1 -1
  19. package/dist/assets/{AppsReview-BQpLs2ic.js → AppsReview-CeXp22cE.js} +1 -1
  20. package/dist/assets/{ArtifactCard-9vsmkZzO.js → ArtifactCard-BV82tDLI.js} +1 -1
  21. package/dist/assets/{Artifacts-DN7vvCse.js → Artifacts-CL5ZmZ3m.js} +1 -1
  22. package/dist/assets/{AssistantConnection-DFVB49U5.js → AssistantConnection-C5rmoEsm.js} +1 -1
  23. package/dist/assets/{AttentionInteractionResolver-61BN1ky5.js → AttentionInteractionResolver-DxZpuIIF.js} +1 -1
  24. package/dist/assets/AuditHub-DDPFGvHG.js +1 -0
  25. package/dist/assets/{Auth-D0lGuVnd.js → Auth-CkILt4fl.js} +1 -1
  26. package/dist/assets/{BoardChat-CMIqWEbi.js → BoardChat-DlaNGzcQ.js} +3 -3
  27. package/dist/assets/{BoardClaim-CbYY66Qd.js → BoardClaim-B135Nebr.js} +1 -1
  28. package/dist/assets/{BootstrapSetupUxLab-M3IOGjXI.js → BootstrapSetupUxLab-B2tOIzXd.js} +1 -1
  29. package/dist/assets/{Browse-AYCtuCFi.js → Browse-xEc9mGl7.js} +1 -1
  30. package/dist/assets/{BudgetPolicyCard-Cwm5wpvU.js → BudgetPolicyCard-Ccr3EX5M.js} +1 -1
  31. package/dist/assets/{CaseDetail-CgZ4u934.js → CaseDetail-CvMk_M-F.js} +2 -2
  32. package/dist/assets/{Cases-BvCHo_JJ.js → Cases-H1Y4Oipe.js} +2 -2
  33. package/dist/assets/{ChatEndpointDetail-CM83nK2S.js → ChatEndpointDetail-CjDVQWl8.js} +1 -1
  34. package/dist/assets/{ChatEndpointSetup-Dzm1h4LA.js → ChatEndpointSetup-BfohtKVM.js} +1 -1
  35. package/dist/assets/{ChatIdentityConfirm-Dc4AnYX8.js → ChatIdentityConfirm-tOTIxwjm.js} +1 -1
  36. package/dist/assets/{CliAuth-CatEsBxW.js → CliAuth-CE0EwTW_.js} +1 -1
  37. package/dist/assets/{Companies-BBdNER6U.js → Companies-C4ObCu9j.js} +1 -1
  38. package/dist/assets/{CompanyAccess-CX4qyiXc.js → CompanyAccess-J5Vwnko2.js} +1 -1
  39. package/dist/assets/{CompanyActivity-Csqqnldg.js → CompanyActivity-B7-kMNmz.js} +1 -1
  40. package/dist/assets/{CompanyConnections-Ds1e8fjb.js → CompanyConnections-D2N6UWXk.js} +1 -1
  41. package/dist/assets/{CompanyEnvironments-BQGpdLk1.js → CompanyEnvironments-ChSu4gxW.js} +1 -1
  42. package/dist/assets/{CompanyExport-CBJU6SZ5.js → CompanyExport-B_opHRSJ.js} +1 -1
  43. package/dist/assets/{CompanyImport-BtODUy1v.js → CompanyImport-DZAMEBBy.js} +1 -1
  44. package/dist/assets/{CompanySettings-x6CbuKeE.js → CompanySettings-Rz8cwgKC.js} +1 -1
  45. package/dist/assets/{CompanySettingsPluginPage-CEDKNwLY.js → CompanySettingsPluginPage-CM-ViPwj.js} +1 -1
  46. package/dist/assets/{CompanySkills-C32TKvfI.js → CompanySkills-BnwPuZze.js} +2 -2
  47. package/dist/assets/{ComposerAddMenu-BPPkbm0o.js → ComposerAddMenu-jKf-6Yli.js} +1 -1
  48. package/dist/assets/{ConfigureBuiltInAgentModal-v8kbSAuE.js → ConfigureBuiltInAgentModal-BAfoTveX.js} +1 -1
  49. package/dist/assets/{ConnectionSetupFlow-g6asOGFg.js → ConnectionSetupFlow-8alK3I_h.js} +1 -1
  50. package/dist/assets/{CopyableGatewayUrl-DM4I2CJE.js → CopyableGatewayUrl-D90Bjxj0.js} +1 -1
  51. package/dist/assets/{Dashboard-4TvnZKHQ.js → Dashboard-DepIxrje.js} +2 -2
  52. package/dist/assets/{DecisionDateChips-H3AqvYWG.js → DecisionDateChips-89KkV4mo.js} +1 -1
  53. package/dist/assets/{DecisionModelSettings-HEZJ0E6n.js → DecisionModelSettings-CvVCBVCM.js} +1 -1
  54. package/dist/assets/{DecisionQueuePage-C--TNteA.js → DecisionQueuePage-nU9qXzln.js} +1 -1
  55. package/dist/assets/{DesignGuide-PDM2oacG.js → DesignGuide-40TixHZ-.js} +4 -4
  56. package/dist/assets/{EmailEndpointSetup-B0haS5AA.js → EmailEndpointSetup-D7-8f1XV.js} +1 -1
  57. package/dist/assets/{EntityRow-B24YmFE7.js → EntityRow-jUxCK6IM.js} +1 -1
  58. package/dist/assets/ExecutionWorkspaceDetail-CnUD3jLO.js +19 -0
  59. package/dist/assets/{GatewayDetail-CtpVgcnJ.js → GatewayDetail-Bg7GU-1a.js} +2 -2
  60. package/dist/assets/{GatewaysList-DCuMJisg.js → GatewaysList-4vvZCBkY.js} +1 -1
  61. package/dist/assets/{GoalDetail-B4Iw4vhL.js → GoalDetail-h7WsjaOO.js} +1 -1
  62. package/dist/assets/{GoalTree-Bxei53eI.js → GoalTree-yPtfejUx.js} +1 -1
  63. package/dist/assets/{Goals-CszzFpXF.js → Goals-DOi3E4DX.js} +1 -1
  64. package/dist/assets/{ImageGalleryModal-7mN3BVkG.js → ImageGalleryModal-D_VQgcBt.js} +1 -1
  65. package/dist/assets/{Inbox-Dzj03JZw.js → Inbox-COKxRKhR.js} +2 -2
  66. package/dist/assets/{InlineBanner-DYx7A02D.js → InlineBanner-DeTqU5Gp.js} +1 -1
  67. package/dist/assets/{InlineEditor-BJTE1pyF.js → InlineEditor-4ew5gxf0.js} +1 -1
  68. package/dist/assets/{InstanceAdvanced-HzNvpWAC.js → InstanceAdvanced-DlMlwZbU.js} +1 -1
  69. package/dist/assets/{InstanceFeatures-C1eqcxDI.js → InstanceFeatures-BbDE9waY.js} +1 -1
  70. package/dist/assets/{InviteLanding-BHDk8eVb.js → InviteLanding-BGvJMHKw.js} +1 -1
  71. package/dist/assets/{IssueChatLongThreadPerf-E61LYLEE.js → IssueChatLongThreadPerf-C3U2FZKJ.js} +1 -1
  72. package/dist/assets/{IssueChatThread-DERjeWcT.js → IssueChatThread-CDKaIB6v.js} +10 -10
  73. package/dist/assets/{IssueDetail--oKqoH82.js → IssueDetail-BCwHANTn.js} +6 -6
  74. package/dist/assets/{IssueDocumentAnnotations-DjcRXcEw.js → IssueDocumentAnnotations-DpFXlkRb.js} +1 -1
  75. package/dist/assets/{IssueOutputSection-Dvul0VAn.js → IssueOutputSection-BzXRmoV7.js} +1 -1
  76. package/dist/assets/{IssueRecoveryActionCard-DpJjLu9A.js → IssueRecoveryActionCard-BYtbaP-M.js} +1 -1
  77. package/dist/assets/{IssueReferencePill-DIqTKSRc.js → IssueReferencePill-BT7NBEy_.js} +1 -1
  78. package/dist/assets/{IssueThreadInteractionCard-PnjBaM8M.js → IssueThreadInteractionCard-Btd0rZ23.js} +1 -1
  79. package/dist/assets/{Issues-Dwcvbvvw.js → Issues-XKf7zemQ.js} +3 -3
  80. package/dist/assets/{LiveNowTodoLine-B3GKP4a7.js → LiveNowTodoLine-CoL6ZNuK.js} +1 -1
  81. package/dist/assets/ManagedAiConnectionDetails-CebBi-Tw.js +1 -0
  82. package/dist/assets/{MarkdownBody-D7qCQaU_.js → MarkdownBody-cPGkwwjq.js} +1 -1
  83. package/dist/assets/{McpConnect-CYz1a9lA.js → McpConnect-ByorZN7G.js} +1 -1
  84. package/dist/assets/{MembershipAction-BCf-FK7R.js → MembershipAction-De0MBfgb.js} +1 -1
  85. package/dist/assets/{MetricCard-DlcBTKQs.js → MetricCard-CTOmJVRL.js} +1 -1
  86. package/dist/assets/{MissingPluginTabPlaceholder-l1R-Q4nh.js → MissingPluginTabPlaceholder-D3N0rd-p.js} +1 -1
  87. package/dist/assets/{ModelsAndProviders-CI6zoBD9.js → ModelsAndProviders-BqM4UJc7.js} +1 -1
  88. package/dist/assets/{NewAgent-BWaZTy_v.js → NewAgent-pMTQYNxn.js} +1 -1
  89. package/dist/assets/{OmpAllSettings-DTJLATQL.js → OmpAllSettings-BeXrdLBc.js} +1 -1
  90. package/dist/assets/{PipelineSettings-pFkHM2Ns.js → PipelineSettings-C2k3BzLQ.js} +2 -2
  91. package/dist/assets/Pipelines-Cr6Xs32p.js +1 -0
  92. package/dist/assets/PixelsOffice-Dfd4XKSj.js +2 -0
  93. package/dist/assets/{PluginManager-DkADWuR8.js → PluginManager-7ZdeHrGQ.js} +1 -1
  94. package/dist/assets/{PluginPage-CBAkPwZs.js → PluginPage-fPlWyFSc.js} +1 -1
  95. package/dist/assets/{PluginSettings-CsXh8PMi.js → PluginSettings-X_VHvvo5.js} +1 -1
  96. package/dist/assets/{ProfileDetailRoute-B6mZqIhS.js → ProfileDetailRoute-PAsWmN-1.js} +1 -1
  97. package/dist/assets/{ProfileSettings-BZG_OvIh.js → ProfileSettings-BACxlGZS.js} +1 -1
  98. package/dist/assets/{ProfileWizardRoute-yUXZqjqr.js → ProfileWizardRoute-Dbq0n7If.js} +1 -1
  99. package/dist/assets/ProjectDetail-DOJZUIWu.js +1 -0
  100. package/dist/assets/{ProjectWorkspaceDetail-rSo7mMQc.js → ProjectWorkspaceDetail-ZNnaHnuA.js} +1 -1
  101. package/dist/assets/{ProjectWorkspacesContent-DnGszD3v.js → ProjectWorkspacesContent-DrWfnTJY.js} +1 -1
  102. package/dist/assets/{Projects-kZ7Li_8n.js → Projects-CCzxmEZ8.js} +1 -1
  103. package/dist/assets/{PublicIssueSharePage-DMy8nXt2.js → PublicIssueSharePage-BUSkP1Js.js} +1 -1
  104. package/dist/assets/{QuestionForm-DF6R7lYE.js → QuestionForm-MfSDsey7.js} +1 -1
  105. package/dist/assets/{RepositoryEditor-BuV4JRgV.js → RepositoryEditor-2QyuT99t.js} +1 -1
  106. package/dist/assets/{ReviewQueueCard-Bz8uXwnD.js → ReviewQueueCard-CrCN_30c.js} +1 -1
  107. package/dist/assets/{RichWorkProductCard-BCB8SaZp.js → RichWorkProductCard-DndJn4LV.js} +1 -1
  108. package/dist/assets/{RoutineDetail-C-gt9_NY.js → RoutineDetail-B5MzV_74.js} +2 -2
  109. package/dist/assets/{RoutineRunVariablesDialog-CrKptoDW.js → RoutineRunVariablesDialog-kGyQVBid.js} +1 -1
  110. package/dist/assets/Routines-B2zX9h3J.js +1 -0
  111. package/dist/assets/ScrollToBottom-Dd3SpeJi.js +1 -0
  112. package/dist/assets/{Search-B-8DqpI2.js → Search-D4W3cZZf.js} +1 -1
  113. package/dist/assets/{Secrets-CPNzZnuu.js → Secrets-C4nbuMIh.js} +3 -3
  114. package/dist/assets/{SidebarNavItem-afEXEFeo.js → SidebarNavItem-kYI7H9f3.js} +1 -1
  115. package/dist/assets/{SkillSourceTree-CR8rC1PY.js → SkillSourceTree-BvGzMa2u.js} +1 -1
  116. package/dist/assets/{SkillSources-3haDckt2.js → SkillSources-DL2tNkcr.js} +1 -1
  117. package/dist/assets/{SkillStudio-CXzQR1ws.js → SkillStudio-BnZ2cfDq.js} +1 -1
  118. package/dist/assets/{SourceTrustBadge-DNvpVd9i.js → SourceTrustBadge-CCPQEGrC.js} +1 -1
  119. package/dist/assets/{StatusCards-D-O7dS5f.js → StatusCards-BkE-9R8F.js} +1 -1
  120. package/dist/assets/{StatusIcon-Bx4H7RuA.js → StatusIcon-Cs1RbJGu.js} +1 -1
  121. package/dist/assets/{SummarySlotCard-CYpYMfTa.js → SummarySlotCard-D1EyiciB.js} +1 -1
  122. package/dist/assets/{TaskChatLab-BfxurxKS.js → TaskChatLab-D3PsNRr5.js} +1 -1
  123. package/dist/assets/{TaskChatMarker-Cj8k3l9N.js → TaskChatMarker-DEF88_sr.js} +2 -2
  124. package/dist/assets/{TaskChatProtocolCard-BsdB1fYv.js → TaskChatProtocolCard-Ba_vhDxn.js} +1 -1
  125. package/dist/assets/{TaskChatThreadView-B90tQ4X1.js → TaskChatThreadView-BsPvbxiA.js} +1 -1
  126. package/dist/assets/{TaskTreeControls-zoH_P07l.js → TaskTreeControls-BKOIbilg.js} +2 -2
  127. package/dist/assets/{Terminal-y6EdGsxY.js → Terminal-1uPX7VEe.js} +1 -1
  128. package/dist/assets/{TerminalView-CWvRC4uL.js → TerminalView-DDv6s-R_.js} +1 -1
  129. package/dist/assets/{ToolsAdminGate-C5dQpL4C.js → ToolsAdminGate-BzvfSwod.js} +1 -1
  130. package/dist/assets/{TrustPresetSection-gUExLKOq.js → TrustPresetSection-BDb0N4Pe.js} +1 -1
  131. package/dist/assets/{UserProfile-uUu_7SHc.js → UserProfile-DqPRuGWk.js} +1 -1
  132. package/dist/assets/{WebhookUrlWarning-CbkWHsPb.js → WebhookUrlWarning-CHx5gr2m.js} +1 -1
  133. package/dist/assets/WhatNeedsMe-DtBxgH24.js +1 -0
  134. package/dist/assets/{WorkspaceRuntimeControls-Cp5E1FME.js → WorkspaceRuntimeControls-Clk2nzU6.js} +1 -1
  135. package/dist/assets/{Workspaces-MhwqOigu.js → Workspaces-BQOyG5HK.js} +1 -1
  136. package/dist/assets/{connection-owner-CslVCQSM.js → connection-owner-CPrMcD3t.js} +1 -1
  137. package/dist/assets/{index-D1wQsid4.js → index-QhteFtm-.js} +16 -16
  138. package/dist/assets/{issue-properties-BXissCm1.js → issue-properties--M7WE6Ot.js} +3 -3
  139. package/dist/assets/{issue-workspace-selection-Ey-jzxzA.js → issue-workspace-selection-pUdSkrJA.js} +1 -1
  140. package/dist/assets/{pipeline-stage-presentation-B_etSYde.js → pipeline-stage-presentation-Dv1xgEPW.js} +1 -1
  141. package/dist/assets/router-CJbFZfVR.js +1 -0
  142. package/dist/assets/{shared-CSvxoeyx.js → shared-B75ClBUg.js} +1 -1
  143. package/dist/assets/{slots-DZ1hj5sG.js → slots-B7lwlN1w.js} +1 -1
  144. package/dist/assets/system-notice-comment-D0I6rz8Y.js +1 -0
  145. package/dist/assets/{task-chat-attachments-DNPQ-jOG.js → task-chat-attachments-2KmZkOL7.js} +1 -1
  146. package/dist/assets/{transcript-adapter-CppFOMQA.js → transcript-adapter-ClaGWYVL.js} +1 -1
  147. package/dist/assets/useSummaryDraftStream-BDuMgNcA.js +3 -0
  148. package/dist/index.html +12 -13
  149. package/dist/sw.js +1 -1
  150. package/package.json +1 -1
  151. package/dist/assets/Agents-BwRQ91d5.js +0 -3
  152. package/dist/assets/AuditHub-CPsJe_Bl.js +0 -1
  153. package/dist/assets/ExecutionWorkspaceDetail-BI4rAhvY.js +0 -19
  154. package/dist/assets/ManagedAiConnectionDetails-D7zoLLKJ.js +0 -1
  155. package/dist/assets/Pipelines-C8_wN0Sv.js +0 -1
  156. package/dist/assets/PixelsOffice-GHMNmVjR.js +0 -2
  157. package/dist/assets/ProjectDetail-CTwwSUZn.js +0 -1
  158. package/dist/assets/Routines-D3JG-gCI.js +0 -1
  159. package/dist/assets/ScrollToBottom-CYzcByH1.js +0 -1
  160. package/dist/assets/WhatNeedsMe-JNJ5uJyH.js +0 -1
  161. package/dist/assets/heartbeats-D96c9g2n.js +0 -1
  162. package/dist/assets/router-BKzUF9uf.js +0 -1
  163. package/dist/assets/system-notice-comment-DPCHQ4-Y.js +0 -1
  164. package/dist/assets/useSummaryDraftStream-DQYbVHb7.js +0 -3
@@ -1 +1 @@
1
- var We=Object.defineProperty;var a=(s,n)=>We(s,"name",{value:n,configurable:!0});import{i as ge}from"./rolldown-runtime-ZpX3ckPj.js";import{T as Ie,l as H,la as we,ua as Ne}from"./createLucideIcon-CgrPXnTY.js";import{t as K,v as G}from"./queryKeys-BzT8CD34.js";import{n as ye}from"./CompanyContext-fQCNWI_f.js";import{ot as ae,t as Y}from"./router-BKzUF9uf.js";import{t as ee}from"./label-B707hSFt.js";import{t as _e}from"./check-Bis3vECb.js";import{t as ve}from"./SearchableSelect-BbuRtdzg.js";import{t as Se}from"./copy-C1cfcpxY.js";import{t as Ce}from"./file-search-Ccb88q3t.js";import{t as Pe}from"./folder-open-Dkshp3J4.js";import{t as Re}from"./folder-search-B_Hz17IO.js";import{t as L}from"./button-DI4w5WP7.js";import{t as Ee}from"./x-6E1yeU3Q.js";import{t as Oe}from"./badge-jeXr866I.js";import{t as oe}from"./AgentAvatar-BZiiDlCN.js";import{t as je}from"./instanceSettings-D1nNVWU0.js";import{a as Ae,i as Me,n as Be,r as Te,s as Ve,t as Fe}from"./dialog-CeH7rDcv.js";import{t as se}from"./input-BBNGmECW.js";import{t as De}from"./textarea-CTx68BDs.js";import{i as qe,r as Le,t as Ue}from"./recent-assignees-DmalYaLf.js";import{t as ce}from"./InlineEntitySelector-BboofK18.js";import{i as D,n as ie,o as le,r as de,s as ue}from"./select-DNiRU1d9.js";import{t as $e}from"./environments-xuhuvnTt.js";import{t as ze}from"./clipboard-CTLKYvRL.js";import{$n as Ke,Bn as Ge,Ia as He,Un as Xe,Wn as Je,Xn as Ze,Zn as Qe,fr as Ye,pr as be}from"./index-D1wQsid4.js";import{n as es,t as ss}from"./issue-workspace-selection-Ey-jzxzA.js";var c=ge(Ne(),1),e=ge(we(),1),ts="h-8 px-2 py-1.5 text-xs font-normal";function ns({value:s,workspaces:n,onValueChange:u,placeholder:m="Choose an existing workspace",loading:k=!1,error:f=!1,disabled:I=!1,className:P,triggerClassName:i,disablePortal:_}){const j=(0,c.useMemo)(()=>Ge(n),[n]);return(0,e.jsx)(ve,{value:s,groups:j,onValueChange:u,placeholder:m,searchPlaceholder:"Search workspaces...",emptyMessage:f?"Workspaces failed to load.":"No matching workspaces.",loadingMessage:"Loading workspaces...",loading:k,disabled:I,className:P,triggerClassName:H(ts,i),filterOption:Xe,scoreOption:Je,disablePortal:_,renderOption:a((b,{selected:d})=>(0,e.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,e.jsx)("span",{className:H("truncate",d&&"font-medium"),children:b.label}),(0,e.jsxs)("span",{className:"truncate text-(length:--text-micro) text-ink-3",children:[b.workspace.status?`${b.workspace.status} - `:"",b.description]})]}),"renderOption")})}a(ns,"ReusableExecutionWorkspaceSelect");var rs=[{value:"shared_workspace",label:"Project default"},{value:"isolated_workspace",label:"New isolated workspace"},{value:"reuse_existing",label:"Reuse existing workspace"}];function q({text:s}){const n=[],u=s.split(/(?<=[\/-])/);for(let m=0;m<u.length;m++)m>0&&n.push((0,e.jsx)("wbr",{},m)),n.push(u[m]);return(0,e.jsx)(e.Fragment,{children:n})}a(q,"BreakablePath");function te({value:s,label:n,mono:u}){const[m,k]=(0,c.useState)(!1),f=(0,c.useRef)(void 0);(0,c.useEffect)(()=>()=>clearTimeout(f.current),[]);const I=(0,c.useCallback)(async()=>{try{await ze(s),k(!0),clearTimeout(f.current),f.current=setTimeout(()=>k(!1),1500)}catch{}},[s]);return(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 group/copy",children:[n&&(0,e.jsx)("span",{className:"text-ink-3",children:n}),(0,e.jsx)("span",{className:H("min-w-0",u&&"font-mono"),style:{overflowWrap:"anywhere"},children:(0,e.jsx)(q,{text:s})}),(0,e.jsx)("button",{type:"button",className:"shrink-0 p-0.5 rounded hover:bg-bg-3/50 transition-colors text-ink-3 hover:text-ink opacity-0 group-hover/copy:opacity-100 focus:opacity-100",onClick:I,title:m?"Copied!":"Copy","aria-label":m?"Copied to clipboard":`Copy ${n??"value"}`,children:m?(0,e.jsx)(_e,{className:"h-3 w-3 text-green-500"}):(0,e.jsx)(Se,{className:"h-3 w-3"})})]})}a(te,"CopyableInline");function as(s){switch(s){case"isolated_workspace":return"Isolated workspace";case"operator_branch":return"Operator branch";case"cloud_sandbox":return"Cloud environment";case"adapter_managed":return"Adapter managed";default:return"Workspace"}}a(as,"workspaceModeLabel");function os(s,n){switch(s){case"isolated_workspace":return"New isolated workspace";case"reuse_existing":return n?.mode==="isolated_workspace"?"Existing isolated workspace":"Reuse existing workspace";default:return"Project default"}}a(os,"configuredWorkspaceLabel");function cs(s){return!s.projectId||!s.projectWorkspaceId?null:Ie({id:s.projectId,urlKey:s.projectId},s.projectWorkspaceId)}a(cs,"projectWorkspaceDetailLink");function pe(s){const n=s.workspace?.projectWorkspaceId??s.issueProjectWorkspaceId??null;return s.workspace?.mode==="shared_workspace"?cs({projectId:s.projectId,projectWorkspaceId:n}):s.workspace?`/execution-workspaces/${s.workspace.id}`:null}a(pe,"workspaceDetailLink");function xe(s){const n={active:"bg-green-500/15 text-green-700 dark:text-green-400",idle:"bg-bg-3 text-ink-3",in_review:"bg-blue-500/15 text-blue-700 dark:text-blue-400",archived:"bg-bg-3 text-ink-3"};return(0,e.jsx)(Oe,{variant:"ghost",className:H("text-(length:--text-nano) px-1.5",n[s]??n.idle),children:s.replace(/_/g," ")})}a(xe,"statusBadge");function is({issue:s,project:n,onUpdate:u,initialEditing:m=!1,livePreview:k=!1,onDraftChange:f,onBrowseFiles:I,onOpenFileByPath:P}){const{visible:i}=be(),{selectedCompanyId:_}=ye(),j=s.companyId??_,[b,d]=(0,c.useState)(m),{data:w}=G({queryKey:K.instance.experimentalSettings,queryFn:a(()=>je.getExperimental(),"queryFn")}),h=w?.enableEnvironments===!0,T=w===void 0||w.enableManagedSandboxOnly===!0,N=w?.enableIsolatedWorkspaces===!0&&!!n?.executionWorkspacePolicy?.enabled,l=s.currentExecutionWorkspace,{data:X}=G({queryKey:K.environments.list(j),queryFn:a(()=>$e.list(j),"queryFn"),enabled:!!j&&h}),{data:J,isLoading:Z,isError:U}=G({queryKey:K.executionWorkspaces.list(j,{projectId:s.projectId??void 0,projectWorkspaceId:s.projectWorkspaceId??void 0,reuseEligible:!0}),queryFn:a(()=>Ye.list(j,{projectId:s.projectId??void 0,projectWorkspaceId:s.projectWorkspaceId??void 0,reuseEligible:!0}),"queryFn"),enabled:!!j&&!!s.projectId&&b&&i}),p=J??[],W=p.find(x=>x.id===s.executionWorkspaceId)??l??null,g=es(s,n)??Ke(n),[v,V]=(0,c.useState)(g),[y,R]=(0,c.useState)(s.executionWorkspaceId??""),$=h?n?.executionWorkspacePolicy?.environmentId??null:null,C=W?.config?.environmentId??null,S=h?(g==="reuse_existing"&&C)??l?.config?.environmentId??$:null,A=X?.find(x=>x.id===S)??null;(0,c.useEffect)(()=>{b||(V(g),R(s.executionWorkspaceId??""))},[g,b,s.executionWorkspaceId]);const F=!!(l&&l.mode!=="shared_workspace"),E=p.find(x=>x.id===y)??(y===s.executionWorkspaceId?W:null),z=pe({projectId:n?.id,issueProjectWorkspaceId:s.projectWorkspaceId,workspace:W}),M=pe({projectId:n?.id,issueProjectWorkspaceId:s.projectWorkspaceId,workspace:l}),O=v!=="reuse_existing"||y.length>0,t=v==="reuse_existing"&&E?.mode!=="shared_workspace"?E?.branchName??null:null,r=(0,c.useCallback)(()=>ss(v,y||null,E?.mode),[E?.mode,y,v]);(0,c.useEffect)(()=>{!f||!i||f(r(),{canSave:O,workspaceBranchName:t})},[r,O,t,f,i]);const o=(0,c.useCallback)(()=>{if(!O||!i)return;const x=r();x&&(u(x),d(!1))},[r,O,i,u]),Q=(0,c.useCallback)(()=>{V(g),R(s.executionWorkspaceId??""),d(!1)},[g,s.executionWorkspaceId]);if(!N||!n)return null;const B=i&&(k||b);return(0,e.jsxs)("div",{className:"rounded-lg border border-line p-3 space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-ink",children:[(0,e.jsx)(ae,{className:"h-3.5 w-3.5 text-ink-3"}),F&&l?as(l.mode):os(g,W),xe(l?l.status:"idle")]}),i&&(0,e.jsx)("div",{className:"flex items-center gap-1",children:B?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(L,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:Q,children:[(0,e.jsx)(Ee,{className:"h-3 w-3 mr-1"}),"Cancel"]}),(0,e.jsx)(L,{size:"sm",className:"h-6 px-2 text-xs",onClick:o,disabled:!O,children:"Save"})]}):(0,e.jsxs)(L,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:a(()=>d(!0),"onClick"),children:[(0,e.jsx)(He,{className:"h-3 w-3 mr-1"}),"Edit"]})})]}),!B&&(0,e.jsxs)("div",{className:"space-y-1.5 text-xs",children:[l?.branchName&&(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(ae,{className:"h-3 w-3 text-ink-3 shrink-0"}),(0,e.jsx)(te,{value:l.branchName,mono:!0})]}),l?.cwd&&!T&&(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(Pe,{className:"h-3 w-3 text-ink-3 shrink-0"}),(0,e.jsx)(te,{value:l.cwd,mono:!0})]}),l?.repoUrl&&(0,e.jsxs)("div",{className:"flex items-center gap-1.5 text-ink-3",children:[(0,e.jsx)("span",{className:"text-(length:--text-micro)",children:"Repo:"}),(0,e.jsx)(te,{value:l.repoUrl,mono:!0})]}),h&&S&&(0,e.jsxs)("div",{className:"text-ink-3",style:{overflowWrap:"anywhere"},children:["Environment: ",(0,e.jsx)("span",{className:"text-ink",children:A?.name??S}),g==="reuse_existing"&&C===S?" · reused workspace":!s.executionWorkspaceSettings?.environmentId&&$===S?" · project default":null]}),!l&&(0,e.jsx)("div",{className:"text-ink-3",children:g==="isolated_workspace"?"A fresh isolated workspace will be created when this task runs.":g==="reuse_existing"?"This task will reuse an existing workspace when it runs.":"This task will use the project default workspace configuration when it runs."}),g==="reuse_existing"&&W&&(0,e.jsxs)("div",{className:"text-ink-3",style:{overflowWrap:"anywhere"},children:["Reusing:"," ",z?(0,e.jsx)(Y,{to:z,className:"hover:text-ink hover:underline",children:(0,e.jsx)(q,{text:W.name})}):(0,e.jsx)(q,{text:W.name})]}),l&&M&&(0,e.jsx)("div",{className:"pt-0.5",children:(0,e.jsx)(Y,{to:M,className:"text-(length:--text-micro) text-ink-3 hover:text-ink hover:underline",children:"View workspace details →"})})]}),b&&i&&(0,e.jsxs)("div",{className:"space-y-2 pt-1",children:[(0,e.jsx)("select",{className:"w-full rounded border border-line bg-transparent px-2 py-1.5 text-xs outline-none",value:v,onChange:a(x=>{const re=x.target.value;V(re),re!=="reuse_existing"?R(""):!y&&s.executionWorkspaceId&&R(s.executionWorkspaceId)},"onChange"),children:rs.map(x=>(0,e.jsx)("option",{value:x.value,children:x.value==="reuse_existing"&&E?.mode==="isolated_workspace"?"Existing isolated workspace":x.label},x.value))}),v==="reuse_existing"&&(0,e.jsx)(ns,{value:y,workspaces:p,onValueChange:a(x=>R(x),"onValueChange"),loading:Z,error:U}),l&&(0,e.jsx)("div",{className:"text-(length:--text-micro) text-ink-3 space-y-0.5 pt-1 border-t border-line/50",children:(0,e.jsxs)("div",{style:{overflowWrap:"anywhere"},children:["Current:"," ",M?(0,e.jsx)(Y,{to:M,className:"hover:text-ink hover:underline",children:(0,e.jsx)(q,{text:l.name})}):(0,e.jsx)(q,{text:l.name})," · ",l.status]})})]}),!B&&I&&(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 border-t border-line/50 pt-2 text-xs",children:[(0,e.jsxs)("button",{type:"button",onClick:I,className:"inline-flex items-center gap-1.5 text-ink-3 transition-colors hover:text-ink",children:[(0,e.jsx)(Re,{className:"h-3.5 w-3.5 shrink-0"}),"Browse files…"]}),(0,e.jsxs)("button",{type:"button",onClick:P??I,className:"inline-flex items-center gap-1.5 text-ink-3 transition-colors hover:text-ink",children:[(0,e.jsx)(Ce,{className:"h-3.5 w-3.5 shrink-0"}),"Open file by path…"]})]})]})}a(is,"IssueWorkspaceCard");function ls(s){return Object.fromEntries(s.map(n=>[n.name,n.defaultValue??""]))}a(ls,"buildInitialValues");function me(s){return{assigneeAgentId:s.defaultAssigneeAgentId??"",projectId:s.defaultProjectId??""}}a(me,"buildInitialRunSelection");function he(s){return s?s.executionWorkspacePolicy?.defaultProjectWorkspaceId??s.workspaces?.find(n=>n.isPrimary)?.id??s.workspaces?.[0]?.id??null:null}a(he,"defaultProjectWorkspaceIdForProject");function ds(s){const n=s?.executionWorkspacePolicy?.enabled?s.executionWorkspacePolicy.defaultMode:null;return n==="isolated_workspace"||n==="operator_branch"||n==="adapter_default"?n==="adapter_default"?"agent_default":n:"shared_workspace"}a(ds,"defaultExecutionWorkspaceModeForProject");function us(s){return s==="isolated_workspace"||s==="operator_branch"||s==="shared_workspace"?s:s==="adapter_managed"||s==="cloud_sandbox"?"agent_default":"shared_workspace"}a(us,"issueModeForExistingWorkspace");function ps(s,n){return s==="inherit"||s==="shared_workspace"||s==="isolated_workspace"||s==="operator_branch"||s==="reuse_existing"||s==="agent_default"?s:n}a(ps,"issueWorkspacePreferenceFromDraft");function ne(s,n){if(n&&n.projectId===s?.id)return{executionWorkspaceId:n.id,executionWorkspacePreference:"reuse_existing",executionWorkspaceSettings:{mode:us(n.mode)},projectWorkspaceId:n.projectWorkspaceId??he(s)};const u=ds(s);return{executionWorkspaceId:null,executionWorkspacePreference:u,executionWorkspaceSettings:{mode:u},projectWorkspaceId:he(s)}}a(ne,"buildInitialWorkspaceConfig");function xs(s,n){return s.executionWorkspaceId===n.executionWorkspaceId&&s.executionWorkspacePreference===n.executionWorkspacePreference&&s.projectWorkspaceId===n.projectWorkspaceId&&JSON.stringify(s.executionWorkspaceSettings??null)===JSON.stringify(n.executionWorkspaceSettings??null)}a(xs,"workspaceConfigEquals");function ke(s,n){const u={...s,executionWorkspaceId:n.executionWorkspaceId??null,executionWorkspacePreference:ps(n.executionWorkspacePreference,s.executionWorkspacePreference),executionWorkspaceSettings:n.executionWorkspaceSettings??s.executionWorkspaceSettings};return xs(s,u)?s:u}a(ke,"applyWorkspaceDraft");function fe(s){return s==null||typeof s=="string"&&s.trim().length===0}a(fe,"isMissingRequiredValue");function ms(s){return s.type==="date"}a(ms,"shouldUseDateInput");function hs(s,n){return n&&!!s?.executionWorkspacePolicy?.enabled}a(hs,"supportsRoutineRunWorkspaceSelection");function zs({open:s,onOpenChange:n,companyId:u,routineName:m,projects:k,agents:f,defaultProjectId:I,defaultAssigneeAgentId:P,defaultExecutionWorkspace:i,variables:_,isPending:j,onSubmit:b}){const[d,w]=(0,c.useState)({}),[h,T]=(0,c.useState)(()=>me({defaultAssigneeAgentId:P,defaultProjectId:I})),N=(0,c.useMemo)(()=>k.find(t=>t.id===h.projectId)??null,[k,h.projectId]),l=(0,c.useMemo)(()=>Ue(),[s]),X=(0,c.useMemo)(()=>Ze(),[s]),J=(0,c.useMemo)(()=>Le(f.filter(t=>t.status!=="terminated"),l).map(t=>({id:t.id,label:t.name,searchText:`${t.name} ${t.role} ${t.title??""}`})),[f,l]),Z=(0,c.useMemo)(()=>k.map(t=>({id:t.id,label:t.name,searchText:t.description??""})),[k]),U=h.assigneeAgentId?f.find(t=>t.id===h.assigneeAgentId)??null:null,[p,W]=(0,c.useState)(()=>ne(N,i)),[g,v]=(0,c.useState)(!0),[V,y]=(0,c.useState)(null),{data:R}=G({queryKey:K.instance.experimentalSettings,queryFn:a(()=>je.getExperimental(),"queryFn"),retry:!1}),{visible:$}=be(),C=$&&hs(N,R?.enableIsolatedWorkspaces===!0);(0,c.useEffect)(()=>{if(!s)return;w(ls(_));const t=me({defaultAssigneeAgentId:P,defaultProjectId:I});T(t),W(ne(k.find(r=>r.id===t.projectId)??null,i)),v(!0),y(i?.branchName??null)},[P,i,I,s,k,_]);const S=C?V:i?.projectId===h.projectId?i?.branchName??null:null,A=(0,c.useCallback)(t=>t.name==="workspaceBranch"&&!!S,[S]),F=(0,c.useMemo)(()=>_.filter(t=>t.required).filter(t=>!A(t)).filter(t=>fe(d[t.name])).map(t=>t.label||t.name),[A,d,_]),E=(0,c.useMemo)(()=>({companyId:u??null,projectId:N?.id??null,projectWorkspaceId:p.projectWorkspaceId,executionWorkspaceId:p.executionWorkspaceId,executionWorkspacePreference:p.executionWorkspacePreference,executionWorkspaceSettings:p.executionWorkspaceSettings,currentExecutionWorkspace:p.executionWorkspaceId&&p.executionWorkspaceId===i?.id?i:null}),[u,i,N?.id,p.executionWorkspaceId,p.executionWorkspacePreference,p.executionWorkspaceSettings,p.projectWorkspaceId]),z=h.assigneeAgentId.trim().length>0&&F.length===0&&(!C||g),M=(0,c.useCallback)(t=>{W(r=>ke(r,t))},[]),O=(0,c.useCallback)((t,r)=>{t&&W(o=>ke(o,t)),v(o=>o===r.canSave?o:r.canSave),y(o=>{const Q=i?.branchName??null,B=r.workspaceBranchName??(t?.executionWorkspaceId===i?.id?Q:null)??null;return o===B?o:B})},[i]);return(0,e.jsx)(Fe,{open:s,onOpenChange:a(t=>!j&&n(t),"onOpenChange"),children:(0,e.jsxs)(Be,{className:"flex h-(--sz-calc-18) max-h-(--sz-calc-18) max-w-xl flex-col gap-0 overflow-hidden p-0 sm:h-auto sm:max-h-(--sz-calc-20)",children:[(0,e.jsxs)(Ae,{className:"shrink-0 border-b border-line/60 px-6 pb-4 pr-12 pt-6",children:[m&&(0,e.jsx)("p",{className:"text-ink-3 text-sm",children:m}),(0,e.jsx)(Ve,{children:"Run routine"}),(0,e.jsx)(Te,{children:"Choose the agent and optional project for this one run. Routine defaults are prefilled and won't be changed."})]}),(0,e.jsxs)("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-contain px-6 py-4",children:[(0,e.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(ee,{className:"text-xs",children:"Agent *"}),(0,e.jsx)(ce,{value:h.assigneeAgentId,options:J,recentOptionIds:l,placeholder:"Agent",noneLabel:"Select an agent",searchPlaceholder:"Search agents...",emptyMessage:"No agents found.",disablePortal:!0,openOnFocus:!1,onChange:a(t=>{t&&qe(t),T(r=>({...r,assigneeAgentId:t}))},"onChange"),renderTriggerValue:a(t=>t?U?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(oe,{agent:U,size:16,className:"h-3.5 w-3.5 shrink-0 text-ink-3"}),(0,e.jsx)("span",{className:"truncate",children:t.label})]}):(0,e.jsx)("span",{className:"truncate",children:t.label}):(0,e.jsx)("span",{className:"text-ink-3",children:"Select an agent"}),"renderTriggerValue"),renderOption:a(t=>{if(!t.id)return(0,e.jsx)("span",{className:"truncate",children:t.label});const r=f.find(o=>o.id===t.id);return(0,e.jsxs)(e.Fragment,{children:[r?(0,e.jsx)(oe,{agent:r,size:16,className:"h-3.5 w-3.5 shrink-0 text-ink-3"}):null,(0,e.jsx)("span",{className:"truncate",children:t.label})]})},"renderOption")})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(ee,{className:"text-xs",children:"Project"}),(0,e.jsx)(ce,{value:h.projectId,options:Z,recentOptionIds:X,placeholder:"Project",noneLabel:"No project",searchPlaceholder:"Search projects...",emptyMessage:"No projects found.",disablePortal:!0,openOnFocus:!1,onChange:a(t=>{const r=k.find(o=>o.id===t)??null;t&&Qe(t),T(o=>({...o,projectId:t})),W(ne(r,i)),v(!0),y(i&&i.projectId===r?.id?i.branchName:null)},"onChange"),renderTriggerValue:a(t=>t&&N?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"h-3.5 w-3.5 shrink-0 rounded-sm",style:{backgroundColor:N.color??"var(--project-none)"}}),(0,e.jsx)("span",{className:"truncate",children:t.label})]}):(0,e.jsx)("span",{className:"text-ink-3",children:"No project"}),"renderTriggerValue"),renderOption:a(t=>{if(!t.id)return(0,e.jsx)("span",{className:"truncate",children:t.label});const r=k.find(o=>o.id===t.id);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"h-3.5 w-3.5 shrink-0 rounded-sm",style:{backgroundColor:r?.color??"var(--project-none)"}}),(0,e.jsx)("span",{className:"truncate",children:t.label})]})},"renderOption")})]})]}),_.map(t=>(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsxs)(ee,{className:"text-xs",children:[t.label||t.name,t.required?" *":""]}),A(t)?(0,e.jsx)(se,{readOnly:!0,disabled:!0,value:S??""}):t.type==="textarea"?(0,e.jsx)(De,{rows:4,value:typeof d[t.name]=="string"?d[t.name]:"",onChange:a(r=>w(o=>({...o,[t.name]:r.target.value})),"onChange")}):t.type==="boolean"?(0,e.jsxs)(ie,{value:d[t.name]===!0?"true":d[t.name]===!1?"false":"__unset__",onValueChange:a(r=>w(o=>({...o,[t.name]:r==="__unset__"?"":r==="true"})),"onValueChange"),children:[(0,e.jsx)(le,{children:(0,e.jsx)(ue,{})}),(0,e.jsxs)(de,{children:[(0,e.jsx)(D,{value:"__unset__",children:"No value"}),(0,e.jsx)(D,{value:"true",children:"True"}),(0,e.jsx)(D,{value:"false",children:"False"})]})]}):t.type==="select"?(0,e.jsxs)(ie,{value:typeof d[t.name]=="string"&&d[t.name]?d[t.name]:"__unset__",onValueChange:a(r=>w(o=>({...o,[t.name]:r==="__unset__"?"":r})),"onValueChange"),children:[(0,e.jsx)(le,{children:(0,e.jsx)(ue,{placeholder:"Choose a value"})}),(0,e.jsxs)(de,{children:[(0,e.jsx)(D,{value:"__unset__",children:"No value"}),t.options.map(r=>(0,e.jsx)(D,{value:r,children:r},r))]})]}):ms(t)?(0,e.jsx)(se,{type:"date",value:d[t.name]==null?"":String(d[t.name]),onChange:a(r=>w(o=>({...o,[t.name]:r.target.value})),"onChange")}):(0,e.jsx)(se,{type:t.type==="number"?"number":"text",value:d[t.name]==null?"":String(d[t.name]),onChange:a(r=>w(o=>({...o,[t.name]:r.target.value})),"onChange")})]},t.name)),C&&N&&u?(0,e.jsx)(is,{issue:E,project:N,initialEditing:!0,livePreview:!0,onUpdate:M,onDraftChange:O},`${s?"open":"closed"}:${N.id}`):null]}),(0,e.jsxs)(Me,{showCloseButton:!1,className:"shrink-0 border-t border-line/60 bg-bg px-6 pb-(--sz-calc-19) pt-4",children:[h.assigneeAgentId?F.length>0?(0,e.jsxs)("p",{className:"mr-auto text-xs text-amber-600",children:["Missing: ",F.join(", ")]}):C&&!g?(0,e.jsx)("p",{className:"mr-auto text-xs text-amber-600",children:"Choose an existing workspace before running."}):(0,e.jsx)("span",{className:"mr-auto"}):(0,e.jsx)("p",{className:"mr-auto text-xs text-amber-600",children:"Default agent required for this run."}),(0,e.jsx)(L,{variant:"ghost",onClick:a(()=>n(!1),"onClick"),disabled:j,children:"Cancel"}),(0,e.jsx)(L,{onClick:a(()=>{const t={};for(const r of _){if(A(r)){t[r.name]=S;continue}const o=d[r.name];fe(o)||(r.type==="number"?t[r.name]=Number(o):r.type==="boolean"?t[r.name]=o===!0:t[r.name]=String(o))}b({variables:t,assigneeAgentId:h.assigneeAgentId,projectId:h.projectId||null,...C?{executionWorkspaceId:p.executionWorkspaceId,executionWorkspacePreference:p.executionWorkspacePreference,executionWorkspaceSettings:p.executionWorkspaceSettings}:{}})},"onClick"),disabled:j||!z,children:j?"Running...":"Run routine"})]})]})})}a(zs,"RoutineRunVariablesDialog");export{zs as t};
1
+ var We=Object.defineProperty;var a=(s,n)=>We(s,"name",{value:n,configurable:!0});import{i as ge}from"./rolldown-runtime-ZpX3ckPj.js";import{T as Ie,l as H,la as we,ua as Ne}from"./createLucideIcon-CgrPXnTY.js";import{t as K,v as G}from"./queryKeys-BzT8CD34.js";import{n as ye}from"./CompanyContext-fQCNWI_f.js";import{ot as ae,t as Y}from"./router-CJbFZfVR.js";import{t as ee}from"./label-B707hSFt.js";import{t as _e}from"./check-Bis3vECb.js";import{t as ve}from"./SearchableSelect-BbuRtdzg.js";import{t as Se}from"./copy-C1cfcpxY.js";import{t as Ce}from"./file-search-Ccb88q3t.js";import{t as Pe}from"./folder-open-Dkshp3J4.js";import{t as Re}from"./folder-search-B_Hz17IO.js";import{t as L}from"./button-DI4w5WP7.js";import{t as Ee}from"./x-6E1yeU3Q.js";import{t as Oe}from"./badge-jeXr866I.js";import{t as oe}from"./AgentAvatar-BZiiDlCN.js";import{t as je}from"./instanceSettings-D1nNVWU0.js";import{a as Ae,i as Me,n as Be,r as Te,s as Ve,t as Fe}from"./dialog-CeH7rDcv.js";import{t as se}from"./input-BBNGmECW.js";import{t as De}from"./textarea-CTx68BDs.js";import{i as qe,r as Le,t as Ue}from"./recent-assignees-DmalYaLf.js";import{t as ce}from"./InlineEntitySelector-BboofK18.js";import{i as D,n as ie,o as le,r as de,s as ue}from"./select-DNiRU1d9.js";import{t as $e}from"./environments-xuhuvnTt.js";import{t as ze}from"./clipboard-CTLKYvRL.js";import{$n as Ke,Bn as Ge,La as He,Un as Xe,Wn as Je,Xn as Ze,Zn as Qe,fr as Ye,pr as be}from"./index-QhteFtm-.js";import{n as es,t as ss}from"./issue-workspace-selection-pUdSkrJA.js";var c=ge(Ne(),1),e=ge(we(),1),ts="h-8 px-2 py-1.5 text-xs font-normal";function ns({value:s,workspaces:n,onValueChange:u,placeholder:m="Choose an existing workspace",loading:k=!1,error:f=!1,disabled:I=!1,className:P,triggerClassName:i,disablePortal:_}){const j=(0,c.useMemo)(()=>Ge(n),[n]);return(0,e.jsx)(ve,{value:s,groups:j,onValueChange:u,placeholder:m,searchPlaceholder:"Search workspaces...",emptyMessage:f?"Workspaces failed to load.":"No matching workspaces.",loadingMessage:"Loading workspaces...",loading:k,disabled:I,className:P,triggerClassName:H(ts,i),filterOption:Xe,scoreOption:Je,disablePortal:_,renderOption:a((b,{selected:d})=>(0,e.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,e.jsx)("span",{className:H("truncate",d&&"font-medium"),children:b.label}),(0,e.jsxs)("span",{className:"truncate text-(length:--text-micro) text-ink-3",children:[b.workspace.status?`${b.workspace.status} - `:"",b.description]})]}),"renderOption")})}a(ns,"ReusableExecutionWorkspaceSelect");var rs=[{value:"shared_workspace",label:"Project default"},{value:"isolated_workspace",label:"New isolated workspace"},{value:"reuse_existing",label:"Reuse existing workspace"}];function q({text:s}){const n=[],u=s.split(/(?<=[\/-])/);for(let m=0;m<u.length;m++)m>0&&n.push((0,e.jsx)("wbr",{},m)),n.push(u[m]);return(0,e.jsx)(e.Fragment,{children:n})}a(q,"BreakablePath");function te({value:s,label:n,mono:u}){const[m,k]=(0,c.useState)(!1),f=(0,c.useRef)(void 0);(0,c.useEffect)(()=>()=>clearTimeout(f.current),[]);const I=(0,c.useCallback)(async()=>{try{await ze(s),k(!0),clearTimeout(f.current),f.current=setTimeout(()=>k(!1),1500)}catch{}},[s]);return(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 group/copy",children:[n&&(0,e.jsx)("span",{className:"text-ink-3",children:n}),(0,e.jsx)("span",{className:H("min-w-0",u&&"font-mono"),style:{overflowWrap:"anywhere"},children:(0,e.jsx)(q,{text:s})}),(0,e.jsx)("button",{type:"button",className:"shrink-0 p-0.5 rounded hover:bg-bg-3/50 transition-colors text-ink-3 hover:text-ink opacity-0 group-hover/copy:opacity-100 focus:opacity-100",onClick:I,title:m?"Copied!":"Copy","aria-label":m?"Copied to clipboard":`Copy ${n??"value"}`,children:m?(0,e.jsx)(_e,{className:"h-3 w-3 text-green-500"}):(0,e.jsx)(Se,{className:"h-3 w-3"})})]})}a(te,"CopyableInline");function as(s){switch(s){case"isolated_workspace":return"Isolated workspace";case"operator_branch":return"Operator branch";case"cloud_sandbox":return"Cloud environment";case"adapter_managed":return"Adapter managed";default:return"Workspace"}}a(as,"workspaceModeLabel");function os(s,n){switch(s){case"isolated_workspace":return"New isolated workspace";case"reuse_existing":return n?.mode==="isolated_workspace"?"Existing isolated workspace":"Reuse existing workspace";default:return"Project default"}}a(os,"configuredWorkspaceLabel");function cs(s){return!s.projectId||!s.projectWorkspaceId?null:Ie({id:s.projectId,urlKey:s.projectId},s.projectWorkspaceId)}a(cs,"projectWorkspaceDetailLink");function pe(s){const n=s.workspace?.projectWorkspaceId??s.issueProjectWorkspaceId??null;return s.workspace?.mode==="shared_workspace"?cs({projectId:s.projectId,projectWorkspaceId:n}):s.workspace?`/execution-workspaces/${s.workspace.id}`:null}a(pe,"workspaceDetailLink");function xe(s){const n={active:"bg-green-500/15 text-green-700 dark:text-green-400",idle:"bg-bg-3 text-ink-3",in_review:"bg-blue-500/15 text-blue-700 dark:text-blue-400",archived:"bg-bg-3 text-ink-3"};return(0,e.jsx)(Oe,{variant:"ghost",className:H("text-(length:--text-nano) px-1.5",n[s]??n.idle),children:s.replace(/_/g," ")})}a(xe,"statusBadge");function is({issue:s,project:n,onUpdate:u,initialEditing:m=!1,livePreview:k=!1,onDraftChange:f,onBrowseFiles:I,onOpenFileByPath:P}){const{visible:i}=be(),{selectedCompanyId:_}=ye(),j=s.companyId??_,[b,d]=(0,c.useState)(m),{data:w}=G({queryKey:K.instance.experimentalSettings,queryFn:a(()=>je.getExperimental(),"queryFn")}),h=w?.enableEnvironments===!0,T=w===void 0||w.enableManagedSandboxOnly===!0,N=w?.enableIsolatedWorkspaces===!0&&!!n?.executionWorkspacePolicy?.enabled,l=s.currentExecutionWorkspace,{data:X}=G({queryKey:K.environments.list(j),queryFn:a(()=>$e.list(j),"queryFn"),enabled:!!j&&h}),{data:J,isLoading:Z,isError:U}=G({queryKey:K.executionWorkspaces.list(j,{projectId:s.projectId??void 0,projectWorkspaceId:s.projectWorkspaceId??void 0,reuseEligible:!0}),queryFn:a(()=>Ye.list(j,{projectId:s.projectId??void 0,projectWorkspaceId:s.projectWorkspaceId??void 0,reuseEligible:!0}),"queryFn"),enabled:!!j&&!!s.projectId&&b&&i}),p=J??[],W=p.find(x=>x.id===s.executionWorkspaceId)??l??null,g=es(s,n)??Ke(n),[v,V]=(0,c.useState)(g),[y,R]=(0,c.useState)(s.executionWorkspaceId??""),$=h?n?.executionWorkspacePolicy?.environmentId??null:null,C=W?.config?.environmentId??null,S=h?(g==="reuse_existing"&&C)??l?.config?.environmentId??$:null,A=X?.find(x=>x.id===S)??null;(0,c.useEffect)(()=>{b||(V(g),R(s.executionWorkspaceId??""))},[g,b,s.executionWorkspaceId]);const F=!!(l&&l.mode!=="shared_workspace"),E=p.find(x=>x.id===y)??(y===s.executionWorkspaceId?W:null),z=pe({projectId:n?.id,issueProjectWorkspaceId:s.projectWorkspaceId,workspace:W}),M=pe({projectId:n?.id,issueProjectWorkspaceId:s.projectWorkspaceId,workspace:l}),O=v!=="reuse_existing"||y.length>0,t=v==="reuse_existing"&&E?.mode!=="shared_workspace"?E?.branchName??null:null,r=(0,c.useCallback)(()=>ss(v,y||null,E?.mode),[E?.mode,y,v]);(0,c.useEffect)(()=>{!f||!i||f(r(),{canSave:O,workspaceBranchName:t})},[r,O,t,f,i]);const o=(0,c.useCallback)(()=>{if(!O||!i)return;const x=r();x&&(u(x),d(!1))},[r,O,i,u]),Q=(0,c.useCallback)(()=>{V(g),R(s.executionWorkspaceId??""),d(!1)},[g,s.executionWorkspaceId]);if(!N||!n)return null;const B=i&&(k||b);return(0,e.jsxs)("div",{className:"rounded-lg border border-line p-3 space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-ink",children:[(0,e.jsx)(ae,{className:"h-3.5 w-3.5 text-ink-3"}),F&&l?as(l.mode):os(g,W),xe(l?l.status:"idle")]}),i&&(0,e.jsx)("div",{className:"flex items-center gap-1",children:B?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(L,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:Q,children:[(0,e.jsx)(Ee,{className:"h-3 w-3 mr-1"}),"Cancel"]}),(0,e.jsx)(L,{size:"sm",className:"h-6 px-2 text-xs",onClick:o,disabled:!O,children:"Save"})]}):(0,e.jsxs)(L,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:a(()=>d(!0),"onClick"),children:[(0,e.jsx)(He,{className:"h-3 w-3 mr-1"}),"Edit"]})})]}),!B&&(0,e.jsxs)("div",{className:"space-y-1.5 text-xs",children:[l?.branchName&&(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(ae,{className:"h-3 w-3 text-ink-3 shrink-0"}),(0,e.jsx)(te,{value:l.branchName,mono:!0})]}),l?.cwd&&!T&&(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(Pe,{className:"h-3 w-3 text-ink-3 shrink-0"}),(0,e.jsx)(te,{value:l.cwd,mono:!0})]}),l?.repoUrl&&(0,e.jsxs)("div",{className:"flex items-center gap-1.5 text-ink-3",children:[(0,e.jsx)("span",{className:"text-(length:--text-micro)",children:"Repo:"}),(0,e.jsx)(te,{value:l.repoUrl,mono:!0})]}),h&&S&&(0,e.jsxs)("div",{className:"text-ink-3",style:{overflowWrap:"anywhere"},children:["Environment: ",(0,e.jsx)("span",{className:"text-ink",children:A?.name??S}),g==="reuse_existing"&&C===S?" · reused workspace":!s.executionWorkspaceSettings?.environmentId&&$===S?" · project default":null]}),!l&&(0,e.jsx)("div",{className:"text-ink-3",children:g==="isolated_workspace"?"A fresh isolated workspace will be created when this task runs.":g==="reuse_existing"?"This task will reuse an existing workspace when it runs.":"This task will use the project default workspace configuration when it runs."}),g==="reuse_existing"&&W&&(0,e.jsxs)("div",{className:"text-ink-3",style:{overflowWrap:"anywhere"},children:["Reusing:"," ",z?(0,e.jsx)(Y,{to:z,className:"hover:text-ink hover:underline",children:(0,e.jsx)(q,{text:W.name})}):(0,e.jsx)(q,{text:W.name})]}),l&&M&&(0,e.jsx)("div",{className:"pt-0.5",children:(0,e.jsx)(Y,{to:M,className:"text-(length:--text-micro) text-ink-3 hover:text-ink hover:underline",children:"View workspace details →"})})]}),b&&i&&(0,e.jsxs)("div",{className:"space-y-2 pt-1",children:[(0,e.jsx)("select",{className:"w-full rounded border border-line bg-transparent px-2 py-1.5 text-xs outline-none",value:v,onChange:a(x=>{const re=x.target.value;V(re),re!=="reuse_existing"?R(""):!y&&s.executionWorkspaceId&&R(s.executionWorkspaceId)},"onChange"),children:rs.map(x=>(0,e.jsx)("option",{value:x.value,children:x.value==="reuse_existing"&&E?.mode==="isolated_workspace"?"Existing isolated workspace":x.label},x.value))}),v==="reuse_existing"&&(0,e.jsx)(ns,{value:y,workspaces:p,onValueChange:a(x=>R(x),"onValueChange"),loading:Z,error:U}),l&&(0,e.jsx)("div",{className:"text-(length:--text-micro) text-ink-3 space-y-0.5 pt-1 border-t border-line/50",children:(0,e.jsxs)("div",{style:{overflowWrap:"anywhere"},children:["Current:"," ",M?(0,e.jsx)(Y,{to:M,className:"hover:text-ink hover:underline",children:(0,e.jsx)(q,{text:l.name})}):(0,e.jsx)(q,{text:l.name})," · ",l.status]})})]}),!B&&I&&(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 border-t border-line/50 pt-2 text-xs",children:[(0,e.jsxs)("button",{type:"button",onClick:I,className:"inline-flex items-center gap-1.5 text-ink-3 transition-colors hover:text-ink",children:[(0,e.jsx)(Re,{className:"h-3.5 w-3.5 shrink-0"}),"Browse files…"]}),(0,e.jsxs)("button",{type:"button",onClick:P??I,className:"inline-flex items-center gap-1.5 text-ink-3 transition-colors hover:text-ink",children:[(0,e.jsx)(Ce,{className:"h-3.5 w-3.5 shrink-0"}),"Open file by path…"]})]})]})}a(is,"IssueWorkspaceCard");function ls(s){return Object.fromEntries(s.map(n=>[n.name,n.defaultValue??""]))}a(ls,"buildInitialValues");function me(s){return{assigneeAgentId:s.defaultAssigneeAgentId??"",projectId:s.defaultProjectId??""}}a(me,"buildInitialRunSelection");function he(s){return s?s.executionWorkspacePolicy?.defaultProjectWorkspaceId??s.workspaces?.find(n=>n.isPrimary)?.id??s.workspaces?.[0]?.id??null:null}a(he,"defaultProjectWorkspaceIdForProject");function ds(s){const n=s?.executionWorkspacePolicy?.enabled?s.executionWorkspacePolicy.defaultMode:null;return n==="isolated_workspace"||n==="operator_branch"||n==="adapter_default"?n==="adapter_default"?"agent_default":n:"shared_workspace"}a(ds,"defaultExecutionWorkspaceModeForProject");function us(s){return s==="isolated_workspace"||s==="operator_branch"||s==="shared_workspace"?s:s==="adapter_managed"||s==="cloud_sandbox"?"agent_default":"shared_workspace"}a(us,"issueModeForExistingWorkspace");function ps(s,n){return s==="inherit"||s==="shared_workspace"||s==="isolated_workspace"||s==="operator_branch"||s==="reuse_existing"||s==="agent_default"?s:n}a(ps,"issueWorkspacePreferenceFromDraft");function ne(s,n){if(n&&n.projectId===s?.id)return{executionWorkspaceId:n.id,executionWorkspacePreference:"reuse_existing",executionWorkspaceSettings:{mode:us(n.mode)},projectWorkspaceId:n.projectWorkspaceId??he(s)};const u=ds(s);return{executionWorkspaceId:null,executionWorkspacePreference:u,executionWorkspaceSettings:{mode:u},projectWorkspaceId:he(s)}}a(ne,"buildInitialWorkspaceConfig");function xs(s,n){return s.executionWorkspaceId===n.executionWorkspaceId&&s.executionWorkspacePreference===n.executionWorkspacePreference&&s.projectWorkspaceId===n.projectWorkspaceId&&JSON.stringify(s.executionWorkspaceSettings??null)===JSON.stringify(n.executionWorkspaceSettings??null)}a(xs,"workspaceConfigEquals");function ke(s,n){const u={...s,executionWorkspaceId:n.executionWorkspaceId??null,executionWorkspacePreference:ps(n.executionWorkspacePreference,s.executionWorkspacePreference),executionWorkspaceSettings:n.executionWorkspaceSettings??s.executionWorkspaceSettings};return xs(s,u)?s:u}a(ke,"applyWorkspaceDraft");function fe(s){return s==null||typeof s=="string"&&s.trim().length===0}a(fe,"isMissingRequiredValue");function ms(s){return s.type==="date"}a(ms,"shouldUseDateInput");function hs(s,n){return n&&!!s?.executionWorkspacePolicy?.enabled}a(hs,"supportsRoutineRunWorkspaceSelection");function zs({open:s,onOpenChange:n,companyId:u,routineName:m,projects:k,agents:f,defaultProjectId:I,defaultAssigneeAgentId:P,defaultExecutionWorkspace:i,variables:_,isPending:j,onSubmit:b}){const[d,w]=(0,c.useState)({}),[h,T]=(0,c.useState)(()=>me({defaultAssigneeAgentId:P,defaultProjectId:I})),N=(0,c.useMemo)(()=>k.find(t=>t.id===h.projectId)??null,[k,h.projectId]),l=(0,c.useMemo)(()=>Ue(),[s]),X=(0,c.useMemo)(()=>Ze(),[s]),J=(0,c.useMemo)(()=>Le(f.filter(t=>t.status!=="terminated"),l).map(t=>({id:t.id,label:t.name,searchText:`${t.name} ${t.role} ${t.title??""}`})),[f,l]),Z=(0,c.useMemo)(()=>k.map(t=>({id:t.id,label:t.name,searchText:t.description??""})),[k]),U=h.assigneeAgentId?f.find(t=>t.id===h.assigneeAgentId)??null:null,[p,W]=(0,c.useState)(()=>ne(N,i)),[g,v]=(0,c.useState)(!0),[V,y]=(0,c.useState)(null),{data:R}=G({queryKey:K.instance.experimentalSettings,queryFn:a(()=>je.getExperimental(),"queryFn"),retry:!1}),{visible:$}=be(),C=$&&hs(N,R?.enableIsolatedWorkspaces===!0);(0,c.useEffect)(()=>{if(!s)return;w(ls(_));const t=me({defaultAssigneeAgentId:P,defaultProjectId:I});T(t),W(ne(k.find(r=>r.id===t.projectId)??null,i)),v(!0),y(i?.branchName??null)},[P,i,I,s,k,_]);const S=C?V:i?.projectId===h.projectId?i?.branchName??null:null,A=(0,c.useCallback)(t=>t.name==="workspaceBranch"&&!!S,[S]),F=(0,c.useMemo)(()=>_.filter(t=>t.required).filter(t=>!A(t)).filter(t=>fe(d[t.name])).map(t=>t.label||t.name),[A,d,_]),E=(0,c.useMemo)(()=>({companyId:u??null,projectId:N?.id??null,projectWorkspaceId:p.projectWorkspaceId,executionWorkspaceId:p.executionWorkspaceId,executionWorkspacePreference:p.executionWorkspacePreference,executionWorkspaceSettings:p.executionWorkspaceSettings,currentExecutionWorkspace:p.executionWorkspaceId&&p.executionWorkspaceId===i?.id?i:null}),[u,i,N?.id,p.executionWorkspaceId,p.executionWorkspacePreference,p.executionWorkspaceSettings,p.projectWorkspaceId]),z=h.assigneeAgentId.trim().length>0&&F.length===0&&(!C||g),M=(0,c.useCallback)(t=>{W(r=>ke(r,t))},[]),O=(0,c.useCallback)((t,r)=>{t&&W(o=>ke(o,t)),v(o=>o===r.canSave?o:r.canSave),y(o=>{const Q=i?.branchName??null,B=r.workspaceBranchName??(t?.executionWorkspaceId===i?.id?Q:null)??null;return o===B?o:B})},[i]);return(0,e.jsx)(Fe,{open:s,onOpenChange:a(t=>!j&&n(t),"onOpenChange"),children:(0,e.jsxs)(Be,{className:"flex h-(--sz-calc-18) max-h-(--sz-calc-18) max-w-xl flex-col gap-0 overflow-hidden p-0 sm:h-auto sm:max-h-(--sz-calc-20)",children:[(0,e.jsxs)(Ae,{className:"shrink-0 border-b border-line/60 px-6 pb-4 pr-12 pt-6",children:[m&&(0,e.jsx)("p",{className:"text-ink-3 text-sm",children:m}),(0,e.jsx)(Ve,{children:"Run routine"}),(0,e.jsx)(Te,{children:"Choose the agent and optional project for this one run. Routine defaults are prefilled and won't be changed."})]}),(0,e.jsxs)("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto overscroll-contain px-6 py-4",children:[(0,e.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(ee,{className:"text-xs",children:"Agent *"}),(0,e.jsx)(ce,{value:h.assigneeAgentId,options:J,recentOptionIds:l,placeholder:"Agent",noneLabel:"Select an agent",searchPlaceholder:"Search agents...",emptyMessage:"No agents found.",disablePortal:!0,openOnFocus:!1,onChange:a(t=>{t&&qe(t),T(r=>({...r,assigneeAgentId:t}))},"onChange"),renderTriggerValue:a(t=>t?U?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(oe,{agent:U,size:16,className:"h-3.5 w-3.5 shrink-0 text-ink-3"}),(0,e.jsx)("span",{className:"truncate",children:t.label})]}):(0,e.jsx)("span",{className:"truncate",children:t.label}):(0,e.jsx)("span",{className:"text-ink-3",children:"Select an agent"}),"renderTriggerValue"),renderOption:a(t=>{if(!t.id)return(0,e.jsx)("span",{className:"truncate",children:t.label});const r=f.find(o=>o.id===t.id);return(0,e.jsxs)(e.Fragment,{children:[r?(0,e.jsx)(oe,{agent:r,size:16,className:"h-3.5 w-3.5 shrink-0 text-ink-3"}):null,(0,e.jsx)("span",{className:"truncate",children:t.label})]})},"renderOption")})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(ee,{className:"text-xs",children:"Project"}),(0,e.jsx)(ce,{value:h.projectId,options:Z,recentOptionIds:X,placeholder:"Project",noneLabel:"No project",searchPlaceholder:"Search projects...",emptyMessage:"No projects found.",disablePortal:!0,openOnFocus:!1,onChange:a(t=>{const r=k.find(o=>o.id===t)??null;t&&Qe(t),T(o=>({...o,projectId:t})),W(ne(r,i)),v(!0),y(i&&i.projectId===r?.id?i.branchName:null)},"onChange"),renderTriggerValue:a(t=>t&&N?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"h-3.5 w-3.5 shrink-0 rounded-sm",style:{backgroundColor:N.color??"var(--project-none)"}}),(0,e.jsx)("span",{className:"truncate",children:t.label})]}):(0,e.jsx)("span",{className:"text-ink-3",children:"No project"}),"renderTriggerValue"),renderOption:a(t=>{if(!t.id)return(0,e.jsx)("span",{className:"truncate",children:t.label});const r=k.find(o=>o.id===t.id);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"h-3.5 w-3.5 shrink-0 rounded-sm",style:{backgroundColor:r?.color??"var(--project-none)"}}),(0,e.jsx)("span",{className:"truncate",children:t.label})]})},"renderOption")})]})]}),_.map(t=>(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsxs)(ee,{className:"text-xs",children:[t.label||t.name,t.required?" *":""]}),A(t)?(0,e.jsx)(se,{readOnly:!0,disabled:!0,value:S??""}):t.type==="textarea"?(0,e.jsx)(De,{rows:4,value:typeof d[t.name]=="string"?d[t.name]:"",onChange:a(r=>w(o=>({...o,[t.name]:r.target.value})),"onChange")}):t.type==="boolean"?(0,e.jsxs)(ie,{value:d[t.name]===!0?"true":d[t.name]===!1?"false":"__unset__",onValueChange:a(r=>w(o=>({...o,[t.name]:r==="__unset__"?"":r==="true"})),"onValueChange"),children:[(0,e.jsx)(le,{children:(0,e.jsx)(ue,{})}),(0,e.jsxs)(de,{children:[(0,e.jsx)(D,{value:"__unset__",children:"No value"}),(0,e.jsx)(D,{value:"true",children:"True"}),(0,e.jsx)(D,{value:"false",children:"False"})]})]}):t.type==="select"?(0,e.jsxs)(ie,{value:typeof d[t.name]=="string"&&d[t.name]?d[t.name]:"__unset__",onValueChange:a(r=>w(o=>({...o,[t.name]:r==="__unset__"?"":r})),"onValueChange"),children:[(0,e.jsx)(le,{children:(0,e.jsx)(ue,{placeholder:"Choose a value"})}),(0,e.jsxs)(de,{children:[(0,e.jsx)(D,{value:"__unset__",children:"No value"}),t.options.map(r=>(0,e.jsx)(D,{value:r,children:r},r))]})]}):ms(t)?(0,e.jsx)(se,{type:"date",value:d[t.name]==null?"":String(d[t.name]),onChange:a(r=>w(o=>({...o,[t.name]:r.target.value})),"onChange")}):(0,e.jsx)(se,{type:t.type==="number"?"number":"text",value:d[t.name]==null?"":String(d[t.name]),onChange:a(r=>w(o=>({...o,[t.name]:r.target.value})),"onChange")})]},t.name)),C&&N&&u?(0,e.jsx)(is,{issue:E,project:N,initialEditing:!0,livePreview:!0,onUpdate:M,onDraftChange:O},`${s?"open":"closed"}:${N.id}`):null]}),(0,e.jsxs)(Me,{showCloseButton:!1,className:"shrink-0 border-t border-line/60 bg-bg px-6 pb-(--sz-calc-19) pt-4",children:[h.assigneeAgentId?F.length>0?(0,e.jsxs)("p",{className:"mr-auto text-xs text-amber-600",children:["Missing: ",F.join(", ")]}):C&&!g?(0,e.jsx)("p",{className:"mr-auto text-xs text-amber-600",children:"Choose an existing workspace before running."}):(0,e.jsx)("span",{className:"mr-auto"}):(0,e.jsx)("p",{className:"mr-auto text-xs text-amber-600",children:"Default agent required for this run."}),(0,e.jsx)(L,{variant:"ghost",onClick:a(()=>n(!1),"onClick"),disabled:j,children:"Cancel"}),(0,e.jsx)(L,{onClick:a(()=>{const t={};for(const r of _){if(A(r)){t[r.name]=S;continue}const o=d[r.name];fe(o)||(r.type==="number"?t[r.name]=Number(o):r.type==="boolean"?t[r.name]=o===!0:t[r.name]=String(o))}b({variables:t,assigneeAgentId:h.assigneeAgentId,projectId:h.projectId||null,...C?{executionWorkspaceId:p.executionWorkspaceId,executionWorkspacePreference:p.executionWorkspacePreference,executionWorkspaceSettings:p.executionWorkspaceSettings}:{}})},"onClick"),disabled:j||!z,children:j?"Running...":"Run routine"})]})]})})}a(zs,"RoutineRunVariablesDialog");export{zs as t};
@@ -0,0 +1 @@
1
+ var bt=Object.defineProperty;var s=(n,c)=>bt(n,"name",{value:c,configurable:!0});import{i as tt}from"./rolldown-runtime-ZpX3ckPj.js";import{l as wt,la as Nt,ua as It}from"./createLucideIcon-CgrPXnTY.js";import{y as kt}from"./star-eem0qj3E.js";import{X as _t,_ as F,t as p,v as D}from"./queryKeys-BzT8CD34.js";import{n as Ct}from"./CompanyContext-fQCNWI_f.js";import{o as Rt,r as St,t as Ft,tt as At}from"./router-CJbFZfVR.js";import{n as Qe,r as st,t as Be}from"./collapsible-D_rwONtV.js";import{t as Pt}from"./MarkdownEditor-ubJimjUH.js";import{o as We,r as Ve,t as ze}from"./popover-CWlBonqy.js";import{t as Mt}from"./arrow-up-down-Ci6AcwB0.js";import{t as Dt}from"./check-Bis3vECb.js";import{t as qt}from"./chevron-down-nRcQ7bok.js";import{t as nt}from"./chevron-right-BP8JjEC_.js";import{t as _}from"./button-DI4w5WP7.js";import{t as Y}from"./plus-CwNlqadt.js";import{t as Z}from"./repeat-DzPORJjX.js";import{t as $e}from"./AgentAvatar-BZiiDlCN.js";import{a as Tt}from"./ToastContext-DyVJ6bCh.js";import{t as Ot}from"./agents-B8n-p0aX.js";import{n as Kt,t as Ut}from"./useSharedPolling-CFeiZe2t.js";import{t as Et}from"./projects-l3kQxnTp.js";import{n as Lt,t as Qt}from"./dialog-CeH7rDcv.js";import{t as Bt}from"./access-DhB95qNC.js";import{r as Ge}from"./audit-navigation-IalprBz0.js";import{t as J}from"./routines-DteAuK7S.js";import{n as Wt}from"./BreadcrumbContext-DNbB7zWn.js";import{i as Vt,r as zt,t as $t}from"./recent-assignees-DmalYaLf.js";import{t as He}from"./InlineEntitySelector-BboofK18.js";import{i as X,n as fe,o as xe,r as he,s as ge}from"./select-DNiRU1d9.js";import{r as Gt,t as Ht}from"./card-BVZvs7aX.js";import{J as je,T as ye,Wr as Yt,Xn as Jt,Zn as Xt,_ as Zt,_a as es,ar as ts,n as ss,t as ns}from"./index-QhteFtm-.js";import{a as rs,c as is,d as os,f as as,i as ls,l as cs,n as ds,o as us,r as ms,s as ps,t as fs,u as xs,x as A}from"./FolderControls-DI7QVvPv.js";import{t as hs}from"./RoutineRunVariablesDialog-kGyQVBid.js";var l=tt(It(),1),t=tt(Nt(),1),gs=["coalesce_if_active","always_enqueue","skip_if_active"],js=["skip_missed","enqueue_missed_with_cap"],ys={coalesce_if_active:"If a run is already active, keep just one follow-up run queued.",always_enqueue:"Queue every trigger occurrence, even if the routine is already running.",skip_if_active:"Drop new trigger occurrences while a run is still active."},vs={skip_missed:"Ignore windows that were missed while the scheduler or routine was paused.",enqueue_missed_with_cap:"Catch up missed schedule windows after recovery; sub-hourly schedules are combined into one catch-up run, slower schedules replay each missed window up to a cap."};function Ye(n){n&&(n.style.height="auto",n.style.height=`${n.scrollHeight}px`)}s(Ye,"autoResizeTextarea");var bs="__built_in_routines",Je={sortField:"title",sortDir:"asc",groupBy:"folder",collapsedGroups:[]};function Xe(n){try{const c=localStorage.getItem(n);if(c)return{...Je,...JSON.parse(c)}}catch{}return{...Je}}s(Xe,"getRoutineViewState");function ws(n,c){localStorage.setItem(n,JSON.stringify(c))}s(ws,"saveRoutineViewState");function q(n){if(!n)return Number.NEGATIVE_INFINITY;const c=new Date(n).getTime();return Number.isFinite(c)?c:Number.NEGATIVE_INFINITY}s(q,"timestampValue");function Ze(n,c){return(n??"").localeCompare(c??"",void 0,{sensitivity:"base"})}s(Ze,"compareNullableText");function Ns(n){return{...n,description:n.description.trim()||null,projectId:n.projectId||null,folderId:n.folderId||null,assigneeAgentId:n.assigneeAgentId||null}}s(Ns,"buildRoutineMutationPayload");function Is(n,c,d,N,x){if(c==="none")return[{key:"__all",label:null,items:n}];if(c==="folder"){const i=je(n,o=>o.folderId??"__unfiled");return Object.keys(i).sort((o,j)=>{if(o==="__unfiled"||j==="__unfiled")return o===j?0:o==="__unfiled"?1:-1;const b=x.get(o),I=x.get(j),U=(Number.isFinite(b?.position)?b.position:Number.POSITIVE_INFINITY)-(Number.isFinite(I?.position)?I.position:Number.POSITIVE_INFINITY);return U!==0?U:(b?.name??"Unknown folder").localeCompare(I?.name??"Unknown folder",void 0,{sensitivity:"base"})||o.localeCompare(j)}).map(o=>({key:o,label:o==="__unfiled"?"Unfiled":x.get(o)?.name??"Unknown folder",items:i[o]}))}if(c==="project"){const i=je(n,o=>o.projectId??"__no_project");return Object.keys(i).sort((o,j)=>{const b=o==="__no_project"?"No project":d.get(o)?.name??"Unknown project",I=j==="__no_project"?"No project":d.get(j)?.name??"Unknown project";return b.localeCompare(I)}).map(o=>({key:o,label:o==="__no_project"?"No project":d.get(o)?.name??"Unknown project",items:i[o]}))}const h=je(n,i=>i.assigneeAgentId??"__unassigned");return Object.keys(h).sort((i,o)=>{const j=i==="__unassigned"?"Unassigned":N.get(i)?.name??"Unknown agent",b=o==="__unassigned"?"Unassigned":N.get(o)?.name??"Unknown agent";return j.localeCompare(b)}).map(i=>({key:i,label:i==="__unassigned"?"Unassigned":N.get(i)?.name??"Unknown agent",items:h[i]}))}s(Is,"buildRoutineGroups");function et(n){return n.originKind==="built_in_agent_bundle"}s(et,"isBuiltInRoutine");function ks(n,c,d,N,x){const h=n.filter(et),i=Is(n.filter(o=>!et(o)),c,d,N,x).filter(o=>o.items.length>0).map(o=>h.length>0&&c==="none"&&o.key==="__all"?{...o,label:"Custom routines"}:o);return h.length===0?i:[...i,{key:bs,label:"Built-in routines",items:h}]}s(ks,"buildRoutineSections");function _s(n,c,d){const N=d==="asc"?1:-1;return[...n].sort((x,h)=>{let i=0;return c==="title"?i=Ze(x.title,h.title):c==="created"?i=q(x.createdAt)-q(h.createdAt):c==="lastRun"?i=q(x.lastRun?.triggeredAt??x.lastTriggeredAt)-q(h.lastRun?.triggeredAt??h.lastTriggeredAt):i=q(x.updatedAt)-q(h.updatedAt),i!==0?i*N:Ze(x.title,h.title)})}s(_s,"sortRoutines");function Cs({label:n,count:c,isOpen:d}){return(0,t.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[(0,t.jsxs)(st,{className:"flex items-center gap-1.5",children:[(0,t.jsx)(nt,{className:"h-3.5 w-3.5 shrink-0 text-ink-3 transition-transform [[data-state=open]>&]:rotate-90"}),(0,t.jsx)("span",{"data-routine-section-label":!0,className:"text-sm font-medium",children:n})]}),(0,t.jsx)("span",{className:"text-xs text-ink-3",children:c})]})}s(Cs,"RoutineSectionHeader");function dn(){const{selectedCompanyId:n}=Ct(),{setBreadcrumbs:c}=Wt(),d=_t(),N=Rt(),[x,h]=kt(),{pushToast:i}=Tt(),o=(0,l.useRef)(null),j=(0,l.useRef)(null),b=(0,l.useRef)(null),I=(0,l.useRef)(null),[U,T]=(0,l.useState)(!1),[ee,E]=(0,l.useState)(null),[L,te]=(0,l.useState)(null),[rt,ve]=(0,l.useState)(!1),[se,ne]=(0,l.useState)(!1),[Q,B]=(0,l.useState)([]),[be,we]=(0,l.useState)([]),[it,Ne]=(0,l.useState)(null),[ot,Ie]=(0,l.useState)(null),[C,re]=(0,l.useState)(null),[W,V]=(0,l.useState)(!1),[ke,ie]=(0,l.useState)(!1),at=x.get("tab")==="runs",[m,k]=(0,l.useState)({title:"",description:"",projectId:"",folderId:null,assigneeAgentId:"",priority:"medium",concurrencyPolicy:"coalesce_if_active",catchUpPolicy:"skip_missed",variables:[]}),z=n?`wardmote:routines-view:${n}`:"wardmote:routines-view",[u,_e]=(0,l.useState)(()=>Xe(z)),f=os(x.get("folder"));(0,l.useEffect)(()=>{c([{label:"Routines"}])},[c]),(0,l.useEffect)(()=>{_e(Xe(z))},[z]);const{data:Ce,isLoading:lt,error:oe}=D({queryKey:p.routines.list(n),queryFn:s(()=>J.list(n),"queryFn"),enabled:!!n}),{data:g,isLoading:Re}=D({queryKey:p.folders.list(n,"routine"),queryFn:s(()=>A.list(n,"routine"),"queryFn"),enabled:!!n}),{data:R}=D({queryKey:p.agents.list(n),queryFn:s(()=>Ot.list(n),"queryFn"),enabled:!!n}),{data:S}=D({queryKey:p.projects.list(n,{includeArchived:!0}),queryFn:s(()=>Et.list(n,{includeArchived:!0}),"queryFn"),enabled:!!n}),{data:Se}=D({queryKey:p.access.companyUserDirectory(n),queryFn:s(()=>Bt.listUserDirectory(n),"queryFn"),enabled:!!n}),Fe=p.liveRuns(n),ae=Kt({companyId:n,resourceKey:"live-runs",queryKey:Fe,enabled:!!n&&!1,refetchInterval:!1,leaderOnly:!0}),{data:ct,dataUpdatedAt:dt}=D({queryKey:Fe,queryFn:s(()=>es.liveRunsForCompany(n),"queryFn"),enabled:ae.enabled,refetchInterval:ae.refetchInterval});Ut(ae,ct,dt),(0,l.useEffect)(()=>{Ye(j.current)},[m.title,W]);const ut=(0,l.useMemo)(()=>ts({agents:R,projects:(S??[]).filter(e=>!e.archivedAt),members:Se?.users}),[R,Se?.users,S]),w=F({mutationFn:s(()=>J.create(n,Ns(m)),"mutationFn"),onSuccess:s(async e=>{k({title:"",description:"",projectId:"",folderId:null,assigneeAgentId:"",priority:"medium",concurrencyPolicy:"coalesce_if_active",catchUpPolicy:"skip_missed",variables:[]}),V(!1),ie(!1),await d.invalidateQueries({queryKey:p.routines.list(n)}),i({title:"Routine created",body:e.assigneeAgentId?"Add the first trigger to turn it into a live workflow.":"Draft saved. Add a default agent before enabling automation.",tone:"success"}),N(Yt(e.id,"triggers"))},"onSuccess")}),Ae=F({mutationFn:s(e=>A.create(n,{kind:"routine",...e}),"mutationFn"),onSuccess:s(async e=>{if(T(!1),E(null),await d.invalidateQueries({queryKey:p.folders.list(n,"routine")}),be.length>0){const r=be;we([]);try{await Promise.all(r.map(a=>A.moveItem(n,{kind:"routine",itemId:a,folderId:e.id}))),await Promise.all([d.invalidateQueries({queryKey:p.routines.list(n)}),d.invalidateQueries({queryKey:p.folders.list(n,"routine")})])}catch(a){i({title:"Folder created, move failed",body:a instanceof Error?a.message:"Wardmote could not move the selected routines.",tone:"error"});return}}else G(e.id);i({title:"Folder created",body:e.name,tone:"success"})},"onSuccess"),onError:s(e=>{i({title:"Failed to save folder",body:e instanceof Error?e.message:"Wardmote could not save the folder.",tone:"error"})},"onError")}),le=F({mutationFn:s(({folderId:e,payload:r})=>A.update(n,e,r),"mutationFn"),onSuccess:s(async()=>{T(!1),E(null),await d.invalidateQueries({queryKey:p.folders.list(n,"routine")})},"onSuccess"),onError:s(e=>{i({title:"Folder save failed",body:e instanceof Error?e.message:"Wardmote could not update the folder.",tone:"error"})},"onError")}),Pe=F({mutationFn:s(e=>A.delete(n,e),"mutationFn"),onSuccess:s(async(e,r)=>{f===r&&G("all"),te(null),await Promise.all([d.invalidateQueries({queryKey:p.routines.list(n)}),d.invalidateQueries({queryKey:p.folders.list(n,"routine")})]),i({title:"Folder deleted",body:"Items moved to Unfiled.",tone:"success"})},"onSuccess"),onError:s(e=>{i({title:"Folder delete failed",body:e instanceof Error?e.message:"Wardmote could not delete the folder.",tone:"error"})},"onError")}),Me=F({mutationFn:s(({itemId:e,folderId:r})=>A.moveItem(n,{kind:"routine",itemId:e,folderId:r}),"mutationFn"),onSuccess:s(async()=>{await Promise.all([d.invalidateQueries({queryKey:p.routines.list(n)}),d.invalidateQueries({queryKey:p.folders.list(n,"routine")})])},"onSuccess"),onError:s(e=>{i({title:"Move failed",body:e instanceof Error?e.message:"Wardmote could not move the routine.",tone:"error"})},"onError")}),De=F({mutationFn:s(({id:e,status:r})=>J.update(e,{status:r}),"mutationFn"),onMutate:s(({id:e})=>{Ie(e)},"onMutate"),onSuccess:s(async(e,r)=>{await Promise.all([d.invalidateQueries({queryKey:p.routines.list(n)}),d.invalidateQueries({queryKey:p.routines.detail(r.id)})])},"onSuccess"),onSettled:s(()=>{Ie(null)},"onSettled"),onError:s(e=>{i({title:"Failed to update routine",body:e instanceof Error?e.message:"Wardmote could not update the routine.",tone:"error"})},"onError")}),qe=F({mutationFn:s(({id:e,data:r})=>J.run(e,{...r?.variables&&Object.keys(r.variables).length>0?{variables:r.variables}:{},...r?.assigneeAgentId!==void 0?{assigneeAgentId:r.assigneeAgentId}:{},...r?.projectId!==void 0?{projectId:r.projectId}:{},...r?.executionWorkspaceId!==void 0?{executionWorkspaceId:r.executionWorkspaceId}:{},...r?.executionWorkspacePreference!==void 0?{executionWorkspacePreference:r.executionWorkspacePreference}:{},...r?.executionWorkspaceSettings!==void 0?{executionWorkspaceSettings:r.executionWorkspaceSettings}:{}}),"mutationFn"),onMutate:s(({id:e})=>{Ne(e)},"onMutate"),onSuccess:s(async(e,{id:r})=>{re(null),await Promise.all([d.invalidateQueries({queryKey:p.routines.list(n)}),d.invalidateQueries({queryKey:p.routines.detail(r)})])},"onSuccess"),onSettled:s(()=>{Ne(null)},"onSettled"),onError:s(e=>{i({title:"Routine run failed",body:e instanceof Error?e.message:"Wardmote could not start the routine run.",tone:"error"})},"onError")}),ce=(0,l.useMemo)(()=>$t(),[W]),mt=(0,l.useMemo)(()=>Jt(),[W]),pt=(0,l.useMemo)(()=>zt((R??[]).filter(e=>e.status!=="terminated"),ce).map(e=>({id:e.id,label:e.name,searchText:`${e.name} ${e.role} ${e.title??""}`})),[R,ce]),ft=(0,l.useMemo)(()=>(S??[]).filter(e=>!e.archivedAt).map(e=>({id:e.id,label:e.name,searchText:e.description??""})),[S]),O=(0,l.useMemo)(()=>new Map((R??[]).map(e=>[e.id,e])),[R]),K=(0,l.useMemo)(()=>new Map((S??[]).map(e=>[e.id,e])),[S]),Te=(0,l.useMemo)(()=>new Map((g?.folders??[]).map(e=>[e.id,e])),[g]),y=(0,l.useMemo)(()=>(Ce??[]).filter(e=>e.status!=="archived"),[Ce]),Oe=(0,l.useMemo)(()=>u.groupBy!=="folder"||f==="all"?y:f==="unfiled"?y.filter(e=>!e.folderId):y.filter(e=>e.folderId===f),[f,u.groupBy,y]),de=(0,l.useMemo)(()=>{if(!g)return g;const e=new Map;let r=0;for(const a of y)a.folderId?e.set(a.folderId,(e.get(a.folderId)??0)+1):r+=1;return{...g,allCount:y.length,unfiledCount:r,folders:g.folders.map(a=>({...a,itemCount:e.get(a.id)??0}))}},[g,y]),P=(0,l.useMemo)(()=>_s(Oe,u.sortField,u.sortDir),[Oe,u.sortDir,u.sortField]),xt=(0,l.useMemo)(()=>ks(P,u.groupBy,K,O,Te),[O,Te,K,u.groupBy,P]),Ke=m.assigneeAgentId?O.get(m.assigneeAgentId)??null:null,Ue=m.projectId?K.get(m.projectId)??null:null,Ee=as(g?.folders??[],f),$=(g?.folders.length??0)>0,ue=u.groupBy==="folder"&&$;function me(e){_e(r=>{const a={...r,...e};return ws(z,a),a})}s(me,"updateRoutineView");function G(e){h(r=>{const a=new URLSearchParams(r),v=xs(e);return v?a.set("folder",v):a.delete("folder"),a})}s(G,"setFolderSelection");function M(e=[]){we(e),E(null),T(!0)}s(M,"openCreateFolder");function Le(){k(e=>({...e,folderId:f==="all"||f==="unfiled"?null:f})),V(!0)}s(Le,"openCreateRoutine");async function ht(e){const r=Q;if(r.length!==0)try{await Promise.all(r.map(a=>A.moveItem(n,{kind:"routine",itemId:a,folderId:e}))),B([]),ne(!1),await Promise.all([d.invalidateQueries({queryKey:p.routines.list(n)}),d.invalidateQueries({queryKey:p.folders.list(n,"routine")})]),i({title:"Routines moved",body:`${r.length} routine${r.length===1?"":"s"} filed.`,tone:"success"})}catch(a){i({title:"Failed to move routines",body:a instanceof Error?a.message:"Wardmote could not move the selected routines.",tone:"error"})}}s(ht,"moveSelectedRoutines");function gt(e){re(e)}s(gt,"handleRunNow");function jt(e,r){if(!r&&!e.assigneeAgentId){i({title:"Default agent required",body:"Set a default agent before enabling routine automation.",tone:"warn"});return}De.mutate({id:e.id,status:ss(e.status,!r)})}s(jt,"handleToggleEnabled");function yt(e){De.mutate({id:e.id,status:e.status==="archived"?"active":"archived"})}return s(yt,"handleToggleArchived"),n?at?(0,t.jsx)(St,{to:Ge("runs",{}),replace:!0}):lt?(0,t.jsx)(Zt,{variant:"issues-list"}):(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h1",{className:"text-xl font-bold",children:"Routines"}),(0,t.jsx)("p",{className:"text-sm text-ink-3",children:"Recurring work definitions that materialize into auditable execution tasks."})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(_,{variant:"secondary",asChild:!0,children:(0,t.jsx)(Ft,{to:Ge("runs",{}),children:"View all runs"})}),(0,t.jsxs)(_,{onClick:Le,children:[(0,t.jsx)(Y,{className:"mr-2 h-4 w-4"}),"Create routine"]})]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsxs)("p",{className:"text-sm text-ink-3",children:[y.length," routine",y.length===1?"":"s"]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsxs)(ze,{children:[(0,t.jsx)(We,{asChild:!0,children:(0,t.jsxs)(_,{variant:"ghost",size:"sm",className:"text-xs",title:"Sort",children:[(0,t.jsx)(Mt,{className:"h-3.5 w-3.5 sm:h-3 sm:w-3 sm:mr-1"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:"Sort"})]})}),(0,t.jsx)(Ve,{align:"end",className:"w-44 p-0",children:(0,t.jsx)("div",{className:"p-2 space-y-0.5",children:[["updated","Updated"],["created","Created"],["lastRun","Last run"],["title","Title"]].map(([e,r])=>(0,t.jsxs)("button",{className:`flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-sm ${u.sortField===e?"bg-bg-3/50 text-ink":"text-ink-3 hover:bg-bg-3/50"}`,onClick:s(()=>{me(u.sortField===e?{sortDir:u.sortDir==="asc"?"desc":"asc"}:{sortField:e,sortDir:e==="title"?"asc":"desc"})},"onClick"),children:[(0,t.jsx)("span",{children:r}),u.sortField===e?(0,t.jsx)("span",{className:"text-xs text-ink-3",children:u.sortDir==="asc"?"Asc":"Desc"}):null]},e))})})]}),(0,t.jsxs)(ze,{children:[(0,t.jsx)(We,{asChild:!0,children:(0,t.jsxs)(_,{variant:"ghost",size:"sm",className:"text-xs",title:"Group",children:[(0,t.jsx)(At,{className:"h-3.5 w-3.5 sm:h-3 sm:w-3 sm:mr-1"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:"Group"})]})}),(0,t.jsx)(Ve,{align:"end",className:"w-44 p-0",children:(0,t.jsx)("div",{className:"p-2 space-y-0.5",children:[["folder","Folder"],["project","Project"],["assignee","Agent"],["none","None"]].map(([e,r])=>(0,t.jsxs)("button",{className:`flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-sm ${u.groupBy===e?"bg-bg-3/50 text-ink":"text-ink-3 hover:bg-bg-3/50"}`,onClick:s(()=>me({groupBy:e,collapsedGroups:[]}),"onClick"),children:[(0,t.jsx)("span",{children:r}),u.groupBy===e?(0,t.jsx)(Dt,{className:"h-3.5 w-3.5"}):null]},e))})})]}),u.groupBy==="folder"&&!$?(0,t.jsxs)(_,{variant:"secondary",size:"sm",onClick:s(()=>M(),"onClick"),children:[(0,t.jsx)(Y,{className:"mr-2 h-3.5 w-3.5"}),"New folder"]}):null,ue?(0,t.jsx)(_,{variant:"ghost",size:"sm",className:"text-xs",onClick:s(()=>ne(e=>!e),"onClick"),children:se?"Done":"Select"}):null]})]}),u.groupBy==="folder"?(0,t.jsx)("div",{className:"md:hidden",children:(0,t.jsx)(ls,{result:de,selection:f,allLabel:"All routines",onClick:s(()=>ve(!0),"onClick")})}):null]}),(0,t.jsx)(Qt,{open:W,onOpenChange:s(e=>{w.isPending||V(e)},"onOpenChange"),children:(0,t.jsxs)(Lt,{showCloseButton:!1,className:"flex max-h-(--sz-calc-18) max-w-3xl flex-col gap-0 overflow-hidden p-0",children:[(0,t.jsxs)("div",{className:"shrink-0 flex flex-wrap items-center justify-between gap-3 border-b border-line/60 px-5 py-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-xs font-medium uppercase tracking-(--tracking-caps) text-ink-3",children:"New routine"}),(0,t.jsx)("p",{className:"text-sm text-ink-3",children:"Define the recurring work first. Default project and agent are optional for draft routines."})]}),(0,t.jsx)(_,{variant:"ghost",size:"sm",onClick:s(()=>{V(!1),ie(!1)},"onClick"),disabled:w.isPending,children:"Cancel"})]}),(0,t.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[(0,t.jsx)("div",{className:"px-5 pt-5 pb-3",children:(0,t.jsx)("textarea",{ref:j,className:"w-full resize-none overflow-hidden bg-transparent text-xl font-semibold outline-none placeholder:text-ink-3/50",placeholder:"Routine title",rows:1,value:m.title,onChange:s(e=>{k(r=>({...r,title:e.target.value})),Ye(e.target)},"onChange"),onKeyDown:s(e=>{if(e.key==="Enter"&&!e.metaKey&&!e.ctrlKey&&!e.nativeEvent.isComposing){e.preventDefault(),o.current?.focus();return}e.key==="Tab"&&!e.shiftKey&&(e.preventDefault(),m.assigneeAgentId?m.projectId?o.current?.focus():I.current?.focus():b.current?.focus())},"onKeyDown"),autoFocus:!0})}),(0,t.jsx)("div",{className:"px-5 pb-3",children:(0,t.jsx)("div",{className:"overflow-x-auto overscroll-x-contain",children:(0,t.jsxs)("div",{className:"inline-flex min-w-full flex-wrap items-center gap-2 text-sm text-ink-3 sm:min-w-max sm:flex-nowrap",children:[(0,t.jsx)("span",{children:"For"}),(0,t.jsx)(He,{ref:b,value:m.assigneeAgentId,options:pt,recentOptionIds:ce,placeholder:"Responsible",noneLabel:"No responsible",searchPlaceholder:"Search responsible...",emptyMessage:"No responsible found.",onChange:s(e=>{e&&Vt(e),k(r=>({...r,assigneeAgentId:e}))},"onChange"),onConfirm:s(()=>{m.projectId?o.current?.focus():I.current?.focus()},"onConfirm"),renderTriggerValue:s(e=>e?Ke?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)($e,{agent:Ke,size:16,className:"h-3.5 w-3.5 shrink-0 text-ink-3"}),(0,t.jsx)("span",{className:"truncate",children:e.label})]}):(0,t.jsx)("span",{className:"truncate",children:e.label}):(0,t.jsx)("span",{className:"text-ink-3",children:"Responsible"}),"renderTriggerValue"),renderOption:s(e=>{if(!e.id)return(0,t.jsx)("span",{className:"truncate",children:e.label});const r=O.get(e.id);return(0,t.jsxs)(t.Fragment,{children:[r?(0,t.jsx)($e,{agent:r,size:16,className:"h-3.5 w-3.5 shrink-0 text-ink-3"}):null,(0,t.jsx)("span",{className:"truncate",children:e.label})]})},"renderOption")}),(0,t.jsx)("span",{children:"in"}),(0,t.jsx)(He,{ref:I,value:m.projectId,options:ft,recentOptionIds:mt,placeholder:"Project",noneLabel:"No project",searchPlaceholder:"Search projects...",emptyMessage:"No projects found.",onChange:s(e=>{e&&Xt(e),k(r=>({...r,projectId:e}))},"onChange"),onConfirm:s(()=>o.current?.focus(),"onConfirm"),renderTriggerValue:s(e=>e&&Ue?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"h-3.5 w-3.5 shrink-0 rounded-sm",style:{backgroundColor:Ue.color??"var(--project-none)"}}),(0,t.jsx)("span",{className:"truncate",children:e.label})]}):(0,t.jsx)("span",{className:"text-ink-3",children:"Project"}),"renderTriggerValue"),renderOption:s(e=>{if(!e.id)return(0,t.jsx)("span",{className:"truncate",children:e.label});const r=K.get(e.id);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"h-3.5 w-3.5 shrink-0 rounded-sm",style:{backgroundColor:r?.color??"var(--project-none)"}}),(0,t.jsx)("span",{className:"truncate",children:e.label})]})},"renderOption")}),(0,t.jsx)("span",{children:"filed in"}),(0,t.jsxs)(fe,{value:m.folderId??"__unfiled",onValueChange:s(e=>k(r=>({...r,folderId:e==="__unfiled"?null:e})),"onValueChange"),children:[(0,t.jsx)(xe,{className:"h-8 w-auto min-w-32 border-0 bg-bg-3/50 px-2 shadow-none",children:(0,t.jsx)(ge,{})}),(0,t.jsxs)(he,{children:[(0,t.jsx)(X,{value:"__unfiled",children:"Unfiled"}),(g?.folders??[]).map(e=>(0,t.jsx)(X,{value:e.id,children:e.name},e.id))]})]})]})})}),(0,t.jsx)("div",{className:"border-t border-line/60 px-5 py-4",children:(0,t.jsx)(Pt,{ref:o,value:m.description,onChange:s(e=>k(r=>({...r,description:e})),"onChange"),placeholder:"Add instructions...",bordered:!1,contentClassName:"min-h-(--sz-160px) text-sm text-ink-3",mentions:ut,onSubmit:s(()=>{!w.isPending&&m.title.trim()&&m.projectId&&m.assigneeAgentId&&w.mutate()},"onSubmit")})}),(0,t.jsx)("div",{className:"border-t border-line/60 px-5 py-3",children:(0,t.jsxs)(Be,{open:ke,onOpenChange:ie,children:[(0,t.jsxs)(st,{className:"flex w-full items-center justify-between text-left",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:"Advanced delivery settings"}),(0,t.jsx)("p",{className:"text-sm text-ink-3",children:"Keep policy controls secondary to the work definition."})]}),ke?(0,t.jsx)(qt,{className:"h-4 w-4 text-ink-3"}):(0,t.jsx)(nt,{className:"h-4 w-4 text-ink-3"})]}),(0,t.jsx)(Qe,{className:"pt-3",children:(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("p",{className:"text-xs font-medium uppercase tracking-(--tracking-caps) text-ink-3",children:"Concurrency"}),(0,t.jsxs)(fe,{value:m.concurrencyPolicy,onValueChange:s(e=>k(r=>({...r,concurrencyPolicy:e})),"onValueChange"),children:[(0,t.jsx)(xe,{children:(0,t.jsx)(ge,{})}),(0,t.jsx)(he,{children:gs.map(e=>(0,t.jsx)(X,{value:e,children:e.replaceAll("_"," ")},e))})]}),(0,t.jsx)("p",{className:"text-xs text-ink-3",children:ys[m.concurrencyPolicy]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("p",{className:"text-xs font-medium uppercase tracking-(--tracking-caps) text-ink-3",children:"Catch-up"}),(0,t.jsxs)(fe,{value:m.catchUpPolicy,onValueChange:s(e=>k(r=>({...r,catchUpPolicy:e})),"onValueChange"),children:[(0,t.jsx)(xe,{children:(0,t.jsx)(ge,{})}),(0,t.jsx)(he,{children:js.map(e=>(0,t.jsx)(X,{value:e,children:e.replaceAll("_"," ")},e))})]}),(0,t.jsx)("p",{className:"text-xs text-ink-3",children:vs[m.catchUpPolicy]})]})]})})]})})]}),(0,t.jsxs)("div",{className:"shrink-0 flex flex-col gap-3 border-t border-line/60 px-5 py-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsx)("div",{className:"text-sm text-ink-3",children:"After creation, Wardmote takes you straight to trigger setup. Draft routines stay paused until you add a default agent."}),(0,t.jsxs)("div",{className:"flex flex-col gap-2 sm:items-end",children:[(0,t.jsxs)(_,{onClick:s(()=>w.mutate(),"onClick"),disabled:w.isPending||!m.title.trim(),children:[(0,t.jsx)(Y,{className:"mr-2 h-4 w-4"}),w.isPending?"Creating...":"Create routine"]}),w.isError?(0,t.jsx)("p",{className:"text-sm text-bad",children:w.error instanceof Error?w.error.message:"Failed to create routine"}):null]})]})]})}),oe?(0,t.jsx)(Ht,{children:(0,t.jsx)(Gt,{className:"pt-6 text-sm text-bad",children:oe instanceof Error?oe.message:"Failed to load routines"})}):null,(0,t.jsxs)("div",{className:wt(ue&&"flex gap-4"),children:[ue?(0,t.jsx)(us,{result:de,selection:f,allLabel:"All routines",itemLabelPlural:"routines",loading:Re,onSelect:G,onCreate:s(()=>M(),"onCreate"),onRename:s((e,r)=>le.mutate({folderId:e.id,payload:{name:r}}),"onRename"),onEdit:s(e=>{E(e),T(!0)},"onEdit"),onDelete:te}):null,(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[u.groupBy==="folder"&&$?(0,t.jsx)("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:f==="all"?(0,t.jsx)(Rs,{label:"All routines",count:P.length}):(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-2 text-sm",children:[(0,t.jsx)(ps,{color:Ee?.color}),(0,t.jsx)("span",{className:"truncate font-medium",children:f==="unfiled"?"Unfiled":Ee?.name??"Folder"}),(0,t.jsxs)("span",{className:"text-ink-3",children:[P.length," routine",P.length===1?"":"s"]})]})}):null,u.groupBy==="folder"&&!$&&!Re&&y.length>0?(0,t.jsx)(fs,{storageKey:`wardmote:routines-folder-nudge:${n??"none"}`,itemLabelPlural:"routines",onCreateFolder:s(()=>M(),"onCreateFolder")}):null,se?(0,t.jsx)(ds,{selectedCount:Q.length,folders:g?.folders??[],onMove:s(e=>{ht(e)},"onMove"),onCreateAndMove:s(()=>M(Q),"onCreateAndMove"),onClear:s(()=>B([]),"onClear"),onDone:s(()=>{ne(!1),B([])},"onDone")}):null,y.length===0?(0,t.jsx)("div",{className:"py-12",children:(0,t.jsx)(ye,{icon:Z,message:"No active routines. Use Create routine to define the first recurring workflow."})}):P.length===0?(0,t.jsxs)("div",{className:"py-12",children:[(0,t.jsx)(ye,{icon:Z,message:f==="all"?"No routines match this view.":"This folder is empty."}),f!=="all"?(0,t.jsx)("div",{className:"mt-3 flex justify-center",children:(0,t.jsxs)(_,{size:"sm",onClick:Le,children:[(0,t.jsx)(Y,{className:"mr-2 h-3.5 w-3.5"}),"New routine in this folder"]})}):null]}):(0,t.jsx)("div",{className:"flex flex-col gap-3",children:xt.map(e=>{const r=!u.collapsedGroups.includes(e.key);return(0,t.jsxs)(Be,{open:r,onOpenChange:s(a=>{me({collapsedGroups:a?u.collapsedGroups.filter(v=>v!==e.key):[...u.collapsedGroups,e.key]})},"onOpenChange"),children:[e.label?(0,t.jsx)(Cs,{label:e.label,count:e.items.length,isOpen:r}):null,(0,t.jsx)(Qe,{children:e.items.map(a=>(0,t.jsx)(ns,{routine:a,projectById:K,agentById:O,runningRoutineId:it,statusMutationRoutineId:ot,href:`/routines/${a.id}`,runNowButton:!0,divider:!1,onRunNow:gt,onToggleEnabled:jt,onToggleArchived:yt,selectMode:se,selected:Q.includes(a.id),onSelectChange:s((v,pe)=>{B(H=>pe?Array.from(new Set([...H,v.id])):H.filter(vt=>vt!==v.id))},"onSelectChange"),extraMenuItems:(0,t.jsx)(cs,{folders:g?.folders??[],currentFolderId:a.folderId??null,onMove:s(v=>{const pe=a.folderId??null;Me.mutate({itemId:a.id,folderId:v}),i({title:"Routine moved",body:v?`Moved "${a.title}" to ${g?.folders.find(H=>H.id===v)?.name??"folder"}.`:`Moved "${a.title}" to Unfiled.`,tone:"success",action:{label:"Undo",onClick:s(()=>Me.mutate({itemId:a.id,folderId:pe}),"onClick")}})},"onMove"),onCreateAndMove:s(()=>M([a.id]),"onCreateAndMove")})},a.id))})]},e.key)})})]})]}),(0,t.jsx)(rs,{open:U,kind:"routine",folder:ee,pending:Ae.isPending||le.isPending,onOpenChange:T,onSubmit:s(e=>{ee?le.mutate({folderId:ee.id,payload:e}):Ae.mutate(e)},"onSubmit")}),(0,t.jsx)(ms,{open:L!==null,folder:L,itemLabelPlural:"routines",pending:Pe.isPending,onOpenChange:s(e=>{e||te(null)},"onOpenChange"),onConfirm:s(()=>{L&&Pe.mutate(L.id)},"onConfirm")}),(0,t.jsx)(is,{open:rt,onOpenChange:ve,result:de,selection:f,allLabel:"All routines",itemLabelPlural:"Routines",onSelect:G,onCreate:s(()=>M(),"onCreate")}),(0,t.jsx)(hs,{open:C!==null,onOpenChange:s(e=>{e||re(null)},"onOpenChange"),companyId:n,routineName:C?.title??null,agents:R??[],projects:S??[],defaultProjectId:C?.projectId??null,defaultAssigneeAgentId:C?.assigneeAgentId??null,variables:C?.variables??[],isPending:qe.isPending,onSubmit:s(e=>{C&&qe.mutate({id:C.id,data:e})},"onSubmit")})]}):(0,t.jsx)(ye,{icon:Z,message:"Select an organization to view routines."})}s(dn,"Routines");function Rs({label:n,count:c}){return(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-2 text-sm",children:[(0,t.jsx)(Z,{className:"h-3.5 w-3.5 text-ink-3"}),(0,t.jsx)("span",{className:"truncate font-medium",children:n}),(0,t.jsxs)("span",{className:"text-ink-3",children:[c," routine",c===1?"":"s"]})]})}s(Rs,"FolderIconHeader");export{dn as Routines};
@@ -0,0 +1 @@
1
+ var ht=Object.defineProperty;var i=(t,n)=>ht(t,"name",{value:n,configurable:!0});import{i as Ae}from"./rolldown-runtime-ZpX3ckPj.js";import{l as M,la as ft,t as We,ua as gt}from"./createLucideIcon-CgrPXnTY.js";import{l as bt}from"./dist-DYoIyA63.js";import{A as vt}from"./ConnectionSetupFlow-8alK3I_h.js";import{J as jt,gt as wt,tt as Nt}from"./router-CJbFZfVR.js";import{t as ie}from"./scroll-area-Ci3PubY2.js";import{t as yt}from"./arrow-down-C_oYEUXL.js";import{t as ue}from"./arrow-right-W0iJ_-Zs.js";import{t as kt}from"./braces-CpXTT0w9.js";import{t as Ie}from"./check-Bis3vECb.js";import{t as Ge}from"./chevron-down-nRcQ7bok.js";import{t as _t}from"./chevron-right-BP8JjEC_.js";import{t as St}from"./copy-C1cfcpxY.js";import{t as Rt}from"./eye-off-DTXvEIMp.js";import{t as Pe}from"./eye-D8HiVtuU.js";import{t as ae}from"./button-DI4w5WP7.js";import{n as It}from"./TaskChatProtocolCard-Ba_vhDxn.js";import{t as Pt}from"./refresh-cw-CfzWP9se.js";import{t as Ye}from"./search-CgZSuGC8.js";import{t as Se}from"./shield-alert-BAXWoBTh.js";import{t as Tt}from"./trash-QxFF084e.js";import{r as Et}from"./SidebarContext-bEtg0ItG.js";import{t as V}from"./badge-jeXr866I.js";import{t as Qe}from"./input-BBNGmECW.js";import{t as Re}from"./access-DhB95qNC.js";import{i as C,n as oe,o as ce,r as le,s as de}from"./select-DNiRU1d9.js";import{t as De}from"./use-copy-action-DFzauB4H.js";import{Za as At,_a as me,zr as Ct}from"./index-QhteFtm-.js";import{g as Ot}from"./transcript-adapter-ClaGWYVL.js";import{i as qt,o as $t,r as Mt,s as Lt,t as Ft}from"./sheet-D5sUsyfT.js";var Xe={name:"circle-off",size:24,node:[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.35 2.69A10 10 0 0 1 21.3 15.65",key:"1pfsoa"}],["path",{d:"M19.08 19.08A10 10 0 1 1 4.92 4.92",key:"1ablyi"}]]};Xe.node;var Ze=We(Xe),et={name:"file-braces-corner",size:24,node:[["path",{d:"M14 22h4a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v6",key:"14cnrg"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M5 14a1 1 0 0 0-1 1v2a1 1 0 0 1-1 1 1 1 0 0 1 1 1v2a1 1 0 0 0 1 1",key:"sr0ebq"}],["path",{d:"M9 22a1 1 0 0 0 1-1v-2a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-2a1 1 0 0 0-1-1",key:"w793db"}]],aliases:["file-json-2"]};et.node;var zt=We(et);function Dt(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}i(Dt,"asRecord$1");function Gr(t,n){if(!t||!n)return!1;if(n.source==="local_implicit"||n.isInstanceAdmin)return!0;if(!n.memberships||n.memberships.length===0)return n.companyIds.includes(t);const s=n.memberships.find(c=>c.companyId===t&&c.status==="active");return s?s.membershipRole!=="viewer"&&s.membershipRole!==null:!1}i(Gr,"canBoardManageRuntime");function Yr(t){if(!t||t.kind!=="workspace_validation")return null;const n=Dt(t.evidence?.workspaceValidation);if(!n)return null;const s=n.persistedExecutionWorkspaceId;if(typeof s=="string"&&s.length>0)return s;const c=n.executionWorkspaceId;return typeof c=="string"&&c.length>0?c:null}i(Yr,"readRecoveryReconcileWorkspaceId");function Ce(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}i(Ce,"asRecord");function q(t){return typeof t=="string"?t:null}i(q,"asString");function Te(t){return typeof t=="number"&&Number.isFinite(t)?t:null}i(Te,"asFiniteNumber");function Vt(t){return t===!0}i(Vt,"asBoolean");function Bt(t){const n=Ce(t);return n?{attempted:Vt(n.attempted),outcome:q(n.outcome)??"no_process_metadata",adapterType:q(n.adapterType),pid:Te(n.pid),processGroupId:Te(n.processGroupId),error:q(n.error)}:{attempted:!1,outcome:"no_process_metadata",adapterType:null,pid:null,processGroupId:null,error:null}}i(Bt,"parseCleanup");function Ut(t){const n=Ce(t);if(!n)return null;const s=q(n.sourceIssueId),c=q(n.sourceIssueStatus);if(!s||!c)return null;const o=q(n.sameRunEvidenceKind),d=q(n.sameRunEvidenceId),u=q(n.sameRunEvidenceAt);return!o||!d||!u?null:{sourceIssueId:s,sourceIssueIdentifier:q(n.sourceIssueIdentifier),sourceIssueStatus:c,sameRunEvidenceKind:o,sameRunEvidenceId:d,sameRunEvidenceAt:u,silenceStartedAt:q(n.silenceStartedAt),silenceAgeMs:Te(n.silenceAgeMs),evaluationIssueId:q(n.evaluationIssueId),evaluationIssueIdentifier:q(n.evaluationIssueIdentifier),cleanup:Bt(n.cleanup)}}i(Ut,"parseSourceResolvedWatchdogFold");function Qr(t){const n=Ce(t);return n?Ut(n.sourceResolvedWatchdogFold):null}i(Qr,"readSourceResolvedWatchdogFold");var Jt={terminated:"terminated",termination_sent_still_running:"termination sent (still running)",failed:"failed",not_running:"not running",no_process_metadata:"no process metadata",skipped_non_local_adapter:"skipped (non-local adapter)"};function Xr(t){return Jt[t]??t.replace(/_/g," ")}i(Xr,"formatCleanupOutcome");function Zr(t){if(!t||t<=0)return null;const n=Math.floor(t/6e4);if(n<1)return"under 1 minute";if(n<60)return`${n} minute${n===1?"":"s"}`;const s=Math.floor(n/60),c=n%60;return c===0?`${s} hour${s===1?"":"s"}`:`${s}h ${c}m`}i(Zr,"formatSilenceAgeMs");function en(t){return t.length<=12?t:t.slice(0,8)}i(en,"shortenEvidenceId");var e=Ae(ft(),1);function tn({className:t,title:n="System folded this run as a source-resolved false positive.",showIcon:s=!0}){return(0,e.jsxs)("span",{className:M("inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-(length:--text-micro) font-medium","border-emerald-300/60 bg-emerald-50/80 text-emerald-900","dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-200",t),title:n,"aria-label":"Source-resolved watchdog fold",children:[s?(0,e.jsx)(jt,{className:"h-3 w-3 text-emerald-700 dark:text-emerald-300","aria-hidden":!0}):null,"Source-resolved"]})}i(tn,"SourceResolvedFoldBadge");var p=Ae(gt(),1),E=i((t,n,s)=>({disposition:"inline",surface:t,story:n,rationale:s}),"inline"),S=i((t,n)=>({disposition:"folded",surface:t,story:null,rationale:n}),"folded"),Ve=i((t,n)=>({disposition:"debug-only",surface:t,story:null,rationale:n}),"debugOnly"),Ht=["plan.updated","tool.execution.started","tool.execution.progressed","tool.execution.completed","research.started","research.progressed","research.completed","delegation.started","delegation.updated","delegation.completed","model.route.changed","model.verification.updated","context.compacted","artifact.viewed","artifact.generated","review.mode.changed","hook.started","hook.completed","memory.citation.referenced","safety.review.started","safety.review.completed","terminal.input.sent","wait.started","wait.completed","provider.notice.recorded"],Kt=["runner.connected","runner.reconnected","runner.reconciled","runner.disconnected","runner.draining","runner.backpressure","runner.suspending","runner.suspended","runner.stopped","runtime.phase.changed","workspace.ready","harness.starting","harness.ready","harness.exited","session.starting","session.started","session.resuming","session.resumed","session.reconciled","session.updated","session.closed","turn.submitted","turn.accepted","turn.started","turn.completed","run.attached","run.detached"],Wt=["runner.diagnostic","harness.diagnostic","session.failed","turn.failed","turn.interrupted","turn.cancelled","item.failed"],Gt=["item.started","item.delta","item.completed","usage.reported"],Yt=["mcp_app.discovered","mcp_app.resource.resolved","mcp_app.initializing","mcp_app.ready","mcp_app.host_context.changed","mcp_app.failed","mcp_app.teardown"],Qt=["interaction.request.proposed","interaction.request.materialized","interaction.request.rejected","interaction.response.progressed","interaction.response.resolved","interaction.response.delivered"],Xt=["attention.request.proposed","attention.request.routed","attention.request.resolved","attention.request.expired","attention.request.superseded","work.assessment.recorded","issue.status.decision.recorded","issue.status.decision.applied","issue.status.decision.rejected","issue.status.decision.superseded"],Zt=Object.freeze({...Object.fromEntries(Ht.map(t=>[t,E("provider_activity","Task Page/Runner Protocol/Provider semantics","Provider-neutral semantic activity is readable in the task turn.")])),"workspace.change.updated":E("workspace_change","Task Page/Runner Protocol/Workspace changes","In-progress workspace changes update one diff card."),"workspace.diff.recorded":E("workspace_change","Task Page/Runner Protocol/Workspace changes","The runner-verified final diff replaces the in-progress revision."),"workspace.file.referenced":E("workspace_file","Task Page/Runner Protocol/File references","Verified references open a bounded preview and the production file viewer."),"semantic_tool.input":S("tool","Semantic operations reuse the production tool row."),"semantic_tool.result":S("tool","Semantic operation outcomes update the matching tool row."),"semantic_tool.reconciled":S("tool","Recovered semantic operation outcomes update the matching tool row without duplicating it."),"mcp_app.tool_input":S("tool","MCP inputs reuse the production tool row."),"mcp_app.tool_result":S("tool","MCP outcomes update the matching tool row."),"mcp_app.action.requested":S("interaction","Action requests materialize as authoritative issue-thread interactions."),"mcp_app.action.resolved":S("interaction","Action resolution is shown on the authoritative interaction card."),"runtime_request.created":E("runtime_request","Task Page/Runner Protocol/Runtime requests","Pending provider runtime requests remain visible and actionable when a resolver is available."),"runtime_request.resolved":S("runtime_request","Resolution updates the existing request card."),"runtime_request.expired":S("runtime_request","Expiry updates the existing request card."),"runtime_request.cancelled":S("runtime_request","Cancellation updates the existing request card."),...Object.fromEntries(Qt.map(t=>[t,S("interaction","The control-plane interaction record is canonical and owns rendering.")])),"run.result.proposed":E("run_result","Task Page/Runner Protocol/Results and terminal states","Structured completion, evidence, verification, blockers, and artifacts remain inspectable."),"run.result.accepted":S("run_result","Acceptance updates the existing result without duplicating it."),"run.result.rejected":S("run_result","Rejected results remain part of run governance rather than a second completion card."),"run.terminal":E("run_terminal","Task Page/Runner Protocol/Results and terminal states","Terminal outcome and stop reason remain visible."),...Object.fromEntries(Kt.map(t=>[t,S("turn","Routine lifecycle transitions are summarized by the run turn and composer state.")])),...Object.fromEntries(Wt.map(t=>[t,S("system_notice","Actionable failure text is folded into the run or system notice.")])),...Object.fromEntries(Gt.map(t=>[t,S("conversation_or_tool","Item payloads normalize into messages, reasoning, tools, diffs, or usage.")])),"sandbox.metric":Ve("run_debug","Sandbox telemetry is available in run details, not the primary task thread."),...Object.fromEntries(Yt.map(t=>[t,Ve("run_debug","MCP application transport lifecycle remains in run details unless it produces an actionable failure.")])),...Object.fromEntries(Xt.map(t=>[t,S("governance","Authoritative task status, attention, and interaction records own this state.")]))}),rn=Object.freeze({"runtime.permission":E("runtime_request","Task Page/Runner Protocol/Runtime requests","Permission choices render on the runtime request card."),"runtime.input":E("runtime_request","Task Page/Runner Protocol/Runtime requests","Structured runtime input renders on the runtime request card."),"issue_thread.request_confirmation":E("interaction","Task Page/Runner Protocol/Interactions","Uses the production confirmation card."),"issue_thread.request_checkbox_confirmation":E("interaction","Task Page/Runner Protocol/Interactions","Uses the production bounded checkbox card."),"issue_thread.request_item_verdicts":E("interaction","Task Page/Runner Protocol/Interactions","Uses the production per-item verdict card."),"issue_thread.ask_user_questions":E("interaction","Task Page/Runner Protocol/Interactions","Uses the production typed question controls."),"issue_thread.suggest_tasks":E("interaction","Task Page/Runner Protocol/Interactions","Uses the production task suggestion tree.")}),nn=Object.freeze({done:"run_result",blocked:"run_result",needs_review:"run_result",yielded:"run_result"}),sn=Object.freeze({completed:"run_terminal",failed:"run_terminal",interrupted:"run_terminal",cancelled:"run_terminal"}),an=Object.freeze({succeeded:"run_terminal",failed:"run_terminal",cancelled:"run_terminal"}),er=[{value:"overview",label:"Overview",icon:Nt},{value:"pipeline",label:"Pipeline",icon:ue},{value:"trace",label:"Exact trace",icon:zt}],tr=1e3;function P(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}i(P,"record");function m(t){return typeof t=="string"?t:""}i(m,"text");function Be(t,n){return`${t}:${n}`}i(Be,"revealedFrameKey");function ve(t){return typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):""}i(ve,"scalar");function D(t){return[...new Set(t.filter(Boolean))]}i(D,"unique");function be(t){return t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KiB`:`${(t/1048576).toFixed(1)} MiB`}i(be,"formatBytes");function rr(t,n){const s=URL.createObjectURL(t),c=document.createElement("a");c.href=s,c.download=n,c.click(),URL.revokeObjectURL(s)}i(rr,"downloadBlob");function Ue(t){const n=atob(t);try{return JSON.parse(n)}catch{return n}}i(Ue,"decodeExactFrame");function nr(t){return t==="complete"?"secondary":t==="incomplete"||t==="truncated"?"destructive":"outline"}i(nr,"statusVariant");function Je(t,n){if(t==="capturing")return"Raw trace enabled";if(t==="incomplete")return"Incomplete";if(t==="truncated")return"Truncated";if(t==="deleted")return"Deleted";if(t==="expired")return"Expired";const s=new Date(n).getTime()-Date.now();return!Number.isFinite(s)||s<=0?"Expired":`Expires in ${Math.max(1,Math.ceil(s/36e5))}h`}i(Je,"traceBadgeLabel");function je(t){return P(t.parsed)}i(je,"frameParsed");function W(t){const n=je(t);return m(n.method)||m(P(n.params).method)}i(W,"frameMethod");function tt(t){const n=je(t);return P(P(n.params).item??n.item)}i(tt,"frameItem");function sr(t){const n=je(t),s=P(n.params);return m(tt(t).type)||m(s.itemType)||m(n.type)}i(sr,"frameItemType");function we(t){const n=P(t.payload),s=P(n.prpEvent);return Object.keys(s).length>0?s:n}i(we,"eventPrp");function He(t){return m(we(t).sourceEventId)}i(He,"eventSourceId");function ir(t){const n=new Date(t.createdAt).getTime();return Number.isFinite(n)?n:Number.MAX_SAFE_INTEGER}i(ir,"eventTimestamp");function ar(t){const n=ve(t.timestamp),s=Number(n);if(Number.isFinite(s))return s<1e10?s*1e3:s;const c=Date.parse(n);return Number.isFinite(c)?c:Number.MAX_SAFE_INTEGER}i(ar,"frameTimestamp");function re(t){const n=Zt[t.eventType];return n?{visible:n.disposition!=="debug-only",surface:n.surface,container:n.disposition==="inline"?"primary run turn":"collapsed activity",state:n.disposition,action:n.disposition==="inline"?"render":n.disposition==="folded"?"fold":"operator only",reasonCode:`presentation_${n.disposition}`,reason:n.rationale}:{visible:!1,surface:"run_debug",container:"Runner Inspector",state:"hidden",action:"none",reasonCode:"presentation_surface_unregistered",reason:"No production surface registration exists for this event type."}}i(re,"visibilityDecision");function rt(t){return Array.isArray(t.emittedEventIds)?t.emittedEventIds.map(String):[]}i(rt,"interpretationEventIds");function or(t,n){const s=je(t),c=P(s.params),o=tt(t),d=n.flatMap(rt).map(v=>`event:${v}`),u=ve(s.id);if(u){const v=m(t.direction),w=W(t)?v==="client_to_provider"?"client":"provider":v==="client_to_provider"?"provider":"client";d.push(`rpc:${w}:${u}`)}for(const v of[o.id,c.itemId,c.callId,s.itemId]){const w=ve(v);w&&d.push(`item:${w}`)}return D(d)}i(or,"frameCorrelationTokens");function cr(t,n,s){const c=[...t].sort((l,h)=>Number(l.frameId)-Number(h.frameId)),o=new Map(c.map(l=>[Number(l.frameId),l])),d=new Map([...o.keys()].map(l=>[l,l])),u=i(l=>{const h=d.get(l)??l;if(h===l)return l;const N=u(h);return d.set(l,N),N},"find"),v=i((l,h)=>{const N=u(l),I=u(h);N!==I&&d.set(I,N)},"union"),w=new Map;for(const l of c){const h=Number(l.frameId),N=n.filter(I=>Number(I.frameId)===h);for(const I of or(l,N)){const f=w.get(I);f===void 0?w.set(I,h):v(f,h)}}const g=new Map;for(const l of c){const h=u(Number(l.frameId));g.set(h,[...g.get(h)??[],l])}const k=new Set,R=[];for(const l of g.values()){const h=new Set(l.map(y=>Number(y.frameId))),N=n.filter(y=>h.has(Number(y.frameId))),I=new Set(N.flatMap(rt)),f=s.filter(y=>I.has(He(y)));f.forEach(y=>k.add(y.id));const O=D(l.map(W)),L=D(l.map(sr)),G=L.at(-1)||O.at(-1)||m(l[0]?.direction)||"Provider frame",Y=l[0],B=l.at(-1),Ne=Y===B?`frame ${Y?.frameId}`:`frames ${Y?.frameId}–${B?.frameId}`;R.push({key:`frames:${Y?.frameId}`,frames:l,interpretations:N,events:f,title:G,subtitle:`${Ne} · ${f.length} PRP event${f.length===1?"":"s"}`,itemType:L.at(-1)??"",nativeMethods:O,directions:D(l.map(y=>m(y.direction))),dispositions:D(N.map(y=>m(y.disposition))),prpTypes:D(f.map(y=>y.eventType)),visible:f.some(y=>re(y).visible),timestamp:Math.min(...l.map(ar))})}for(const l of s){if(k.has(l.id))continue;const h=re(l);R.push({key:`event:${l.id}`,frames:[],interpretations:[],events:[l],title:l.eventType,subtitle:`PRP ${He(l)||`event ${l.seq}`} · no raw correlation`,itemType:"",nativeMethods:[],directions:[],dispositions:[],prpTypes:[l.eventType],visible:h.visible,timestamp:ir(l)})}return R.sort((l,h)=>l.timestamp-h.timestamp)}i(cr,"buildOperations");async function lr(t){const n=[];let s=0;for(;;){const c=await me.events(t,s,1e3);if(n.push(...c),c.length<1e3)return n;const o=c.at(-1)?.seq??s;if(o<=s)return n;s=o}}i(lr,"loadAllRunEvents");function Ee(t,n){if(!n)return!0;try{return JSON.stringify(t).toLowerCase().includes(n.toLowerCase())}catch{return String(t).toLowerCase().includes(n.toLowerCase())}}i(Ee,"jsonMatches");function dr({value:t}){return typeof t=="string"?(0,e.jsxs)("span",{className:"text-accent",children:['"',t,'"']}):typeof t=="number"?(0,e.jsx)("span",{className:"text-ink-3",children:t}):typeof t=="boolean"?(0,e.jsx)("span",{className:"text-ink",children:String(t)}):t===null?(0,e.jsx)("span",{className:"text-ink-3",children:"null"}):(0,e.jsx)("span",{children:String(t)})}i(dr,"JsonPrimitive");function nt({label:t,value:n,path:s,depth:c,query:o}){const d=n!==null&&typeof n=="object",u=Array.isArray(n)?n.map((f,O)=>[String(O),f]):Object.entries(P(n)),v=u.length>8,[w,g]=(0,p.useState)(c<1&&!v),k=!!o&&Ee(n,o),R=d&&(w||k),l=o?u.filter(([f,O])=>f.toLowerCase().includes(o.toLowerCase())||Ee(O,o)):u,h=De(),N=De(),I=i(()=>{const f=typeof n=="string"?n:JSON.stringify(n,null,2);N.copy(f??String(n))},"copyValue");return(0,e.jsxs)("div",{className:M(c>0&&"border-l border-line/60 pl-3"),children:[(0,e.jsxs)("div",{className:"group flex min-h-6 items-start gap-1 font-mono text-xs leading-6",children:[d?(0,e.jsx)("button",{type:"button",className:"mt-1 rounded p-0.5 text-ink-3 hover:bg-bg-3 hover:text-ink",onClick:i(()=>g(!R),"onClick"),"aria-label":R?"Collapse JSON value":"Expand JSON value",children:R?(0,e.jsx)(Ge,{className:"h-3 w-3"}):(0,e.jsx)(_t,{className:"h-3 w-3"})}):(0,e.jsx)("span",{className:"w-4"}),t!==void 0?(0,e.jsxs)("span",{className:"text-accent",children:[t,":"]}):null,d?(0,e.jsx)("span",{className:"text-ink-3",children:Array.isArray(n)?`[${u.length}]`:`{${u.length}}`}):(0,e.jsx)(dr,{value:n}),(0,e.jsxs)("span",{className:"ml-auto hidden items-center gap-0.5 group-hover:flex",children:[(0,e.jsx)("button",{type:"button",title:h.copied?"JSON path copied":h.failed?"Copy failed":"Copy JSON path",className:"rounded p-1 text-ink-3 hover:bg-bg-3 hover:text-ink",onClick:i(()=>{h.copy(s)},"onClick"),children:h.copied?(0,e.jsx)(Ie,{className:"h-3 w-3"}):(0,e.jsx)(kt,{className:"h-3 w-3"})}),(0,e.jsx)("button",{type:"button",title:N.copied?"Value copied":N.failed?"Copy failed":"Copy value",className:"rounded p-1 text-ink-3 hover:bg-bg-3 hover:text-ink",onClick:I,children:N.copied?(0,e.jsx)(Ie,{className:"h-3 w-3"}):(0,e.jsx)(St,{className:"h-3 w-3"})})]})]}),R?(0,e.jsxs)("div",{children:[l.map(([f,O])=>(0,e.jsx)(nt,{label:f,value:O,path:Array.isArray(n)?`${s}[${f}]`:`${s}.${f}`,depth:c+1,query:o},`${s}.${f}`)),o&&l.length===0?(0,e.jsx)("p",{className:"pl-5 text-xs text-ink-3",children:"No fields match."}):null]}):null]})}i(nt,"JsonNode");function K({value:t,label:n="Search this JSON"}){const[s,c]=(0,p.useState)("");return(0,e.jsxs)("div",{className:"overflow-hidden rounded-md border border-line bg-bg-3/20",children:[(0,e.jsxs)("div",{className:"relative border-b border-line bg-bg/60",children:[(0,e.jsx)(Ye,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-ink-3"}),(0,e.jsx)(Qe,{value:s,onChange:i(o=>c(o.target.value),"onChange"),placeholder:n,className:"h-8 border-0 bg-transparent pl-8 text-xs shadow-none focus-visible:ring-0"})]}),(0,e.jsx)("div",{className:"max-h-80 overflow-auto p-3",children:(0,e.jsx)(nt,{value:t,path:"$",depth:0,query:s.trim()})})]})}i(K,"JsonExplorer");function ur(t){const n=Array.isArray(t.fieldMappings)?t.fieldMappings.map(P).filter(o=>m(o.action)).map(o=>({inputPath:m(o.inputPath)||void 0,outputPath:m(o.outputPath)||void 0,action:m(o.action),reason:m(o.reason)||void 0})):[],s=new Set(n.filter(o=>o.action==="dropped").map(o=>o.inputPath)),c=Array.isArray(t.droppedFields)?t.droppedFields.map(String).filter(o=>!s.has(o)).map(o=>({inputPath:o,action:"dropped",reason:m(t.reason)||"Field was not carried into the next stage"})):[];return[...n,...c]}i(ur,"fieldMappings");function mr(t){return t==="dropped"||t==="redacted"?"border-bad/30 bg-bad/10 text-bad":t==="derived"?"border-bg-3 bg-bg-3 text-ink":"border-accent/30 bg-accent/10 text-accent"}i(mr,"mappingTone");function pr({entry:t,last:n}){const s=ur(t);return(0,e.jsxs)("div",{className:"relative grid grid-cols-(--gtc-runner-inspector-stage) gap-3",children:[(0,e.jsxs)("div",{className:"relative flex justify-center",children:[n?null:(0,e.jsx)("span",{className:"absolute bottom-(--sz-neg-1_25rem) top-4 w-px bg-line"}),(0,e.jsx)("span",{className:M("relative mt-1 h-3 w-3 rounded-full border-2 bg-bg",t.disposition==="rejected"?"border-bad":t.disposition==="ignored"?"border-ink-3":"border-accent")})]}),(0,e.jsxs)("div",{className:"mb-4 overflow-hidden rounded-lg border border-line bg-bg-2",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-line/70 px-3 py-2",children:[(0,e.jsx)("code",{className:"text-xs font-semibold",children:m(t.stage)}),(0,e.jsx)(V,{variant:"outline",className:"capitalize",children:m(t.disposition)}),(0,e.jsx)("code",{className:"ml-auto text-(length:--text-nano) text-ink-3",children:m(t.ruleId)})]}),(0,e.jsx)("p",{className:"px-3 py-2 text-xs text-ink-3",children:m(t.reason)}),s.length>0?(0,e.jsx)("div",{className:"overflow-x-auto border-t border-line/70",children:(0,e.jsxs)("table",{className:"w-full min-w-(--sz-36rem) text-left text-xs",children:[(0,e.jsx)("thead",{className:"bg-bg-3/30 text-ink-3",children:(0,e.jsxs)("tr",{children:[(0,e.jsx)("th",{className:"px-3 py-1.5 font-medium",children:"Action"}),(0,e.jsx)("th",{className:"px-3 py-1.5 font-medium",children:"Provider path"}),(0,e.jsx)("th",{className:"px-3 py-1.5 font-medium",children:"Output path"}),(0,e.jsx)("th",{className:"px-3 py-1.5 font-medium",children:"Reason"})]})}),(0,e.jsx)("tbody",{children:s.map((c,o)=>(0,e.jsxs)("tr",{className:"border-t border-line/50 align-top",children:[(0,e.jsx)("td",{className:"px-3 py-2",children:(0,e.jsx)("span",{className:M("rounded border px-1.5 py-0.5 text-(length:--text-nano)",mr(c.action)),children:c.action})}),(0,e.jsx)("td",{className:"px-3 py-2 font-mono",children:c.inputPath??"—"}),(0,e.jsx)("td",{className:"px-3 py-2 font-mono",children:c.outputPath??"—"}),(0,e.jsx)("td",{className:"max-w-xs px-3 py-2 text-ink-3",children:c.reason??"—"})]},`${c.inputPath}:${c.outputPath}:${o}`))})]})}):(0,e.jsx)("p",{className:"border-t border-line/70 px-3 py-2 text-(length:--text-nano) text-ink-3",children:"No field-level mapping was recorded at this stage."})]})]})}i(pr,"InterpretationStage");function xr(t){const n=we(t),s=P(n.payload),c=P(s.item);return[["Event type",t.eventType],["Source event",m(n.sourceEventId)],["Sequence",ve(n.sourceSequence)||String(t.seq)],["Item type",m(c.type)||m(s.kind)],["Status",m(s.status)||m(c.status)],["Query",m(s.query)||m(c.query)]].filter(([,o])=>!!o)}i(xr,"typedPrpFields");function hr({event:t,runId:n}){const s=we(t),c=new Date(t.createdAt).toISOString(),o=vt(JSON.stringify({type:"wardmote.prp.event",event:s}),c),d=Ot(o,{runId:n,agentName:"Runner",running:!1}).find(w=>w.kind==="protocol");if(d)return(0,e.jsx)(It,{item:d});const u=re(t),v=u.visible?Pe:Rt;return(0,e.jsx)("div",{className:"rounded-md border border-line bg-bg-2/60 px-3 py-2.5",children:(0,e.jsxs)("div",{className:"flex items-start gap-2",children:[(0,e.jsx)(v,{className:"mt-0.5 h-4 w-4 text-ink-3"}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("p",{className:"text-sm font-medium",children:t.eventType}),(0,e.jsxs)("p",{className:"mt-0.5 text-xs text-ink-3",children:["Production surface: ",u.surface," · ",u.action," in ",u.container]})]})]})})}i(hr,"ProductionSurfacePreview");function te({label:t,value:n,detail:s}){return(0,e.jsxs)("div",{className:"rounded-lg border border-line bg-bg-2 px-4 py-3",children:[(0,e.jsx)("p",{className:"text-(length:--text-nano) font-medium uppercase tracking-wide text-ink-3",children:t}),(0,e.jsx)("p",{className:"mt-1 text-2xl font-semibold tracking-tight",children:n}),s?(0,e.jsx)("p",{className:"mt-1 text-xs text-ink-3",children:s}):null]})}i(te,"StatCard");function on({runId:t,run:n,open:s,onOpenChange:c,onRerunWithTrace:o}){const[d,u]=(0,p.useState)(null),[v,w]=(0,p.useState)([]),[g,k]=(0,p.useState)(!1),[R,l]=(0,p.useState)(null),[h,N]=(0,p.useState)("pipeline"),[I,f]=(0,p.useState)(null),[O,L]=(0,p.useState)(null),[G,Y]=(0,p.useState)(""),[B,Ne]=(0,p.useState)("all"),[y,st]=(0,p.useState)("all"),[pe,it]=(0,p.useState)("all"),[xe,at]=(0,p.useState)("all"),[he,Oe]=(0,p.useState)("all"),[ot,Q]=(0,p.useState)({}),[qe,X]=(0,p.useState)(null),_=(0,p.useRef)(null),A=(0,p.useRef)(0),F=s&&qe?.runId===t?qe.allowed:null;(0,p.useLayoutEffect)(()=>{A.current+=1,_.current=null,X(null),u(null),w([]),k(s),l(null),f(null),L(null),Q({})},[s,t]);const ne=(0,p.useCallback)(()=>{const r=_.current;if(r?.runId===t&&r.phase==="denied")return;A.current+=1;const a={runId:t,allowed:!1,epoch:A.current,phase:"denied"};_.current=a,X(a),u({trace:null,entries:[]}),k(!1),l(null),f(null),L(null),Q({})},[t]);(0,p.useEffect)(()=>{if(!s)return;const r=new URLSearchParams(window.location.search),a=r.get("traceView");(a==="overview"||a==="pipeline"||a==="trace")&&N(a);const x=r.get("traceOperation");x&&f(x)},[s]),(0,p.useEffect)(()=>{if(!s)return;let r=!0;const a=A.current;return k(!0),l(null),Promise.all([Re.getCurrentBoardAccess(),lr(t)]).then(async([x,$])=>{if(!r||A.current!==a)return;const T=x.source==="local_implicit"||x.isInstanceAdmin,H={runId:t,allowed:T,epoch:A.current,phase:T?"granted":"denied"};_.current=H,X(H),T||Q({});const xt=T?await me.providerTrace(t):{trace:null,entries:[]},_e=_.current;!r||_e?.runId!==t||_e.epoch!==a||_e.allowed!==T||(u(xt),w($))}).catch(x=>{!r||A.current!==a||l(x instanceof Error?x.message:"Runner inspection failed")}).finally(()=>{r&&A.current===a&&k(!1)}),()=>{r=!1}},[s,t]),(0,p.useEffect)(()=>{if(!s)return;let r=!0;const a=i(async()=>{try{const H=await Re.getCurrentBoardAccess();if(!r)return;H.source==="local_implicit"||H.isInstanceAdmin||ne()}catch{r&&ne()}},"revalidate"),x=i(()=>{a()},"onFocus"),$=i(()=>{document.visibilityState==="visible"&&a()},"onVisibilityChange"),T=window.setInterval(()=>{a()},tr);return window.addEventListener("focus",x),document.addEventListener("visibilitychange",$),()=>{r=!1,window.clearInterval(T),window.removeEventListener("focus",x),document.removeEventListener("visibilitychange",$)}},[ne,s]);const fe=d?.entries??[],U=(0,p.useMemo)(()=>fe.filter(r=>r.kind==="frame"),[fe]),Z=(0,p.useMemo)(()=>fe.filter(r=>r.kind==="interpretation"),[fe]),$e=D(U.map(r=>m(r.provider))),se=(0,p.useMemo)(()=>cr(U,Z,v),[v,U,Z]),z=(0,p.useMemo)(()=>se.filter(r=>!(G.trim()&&!Ee(r,G.trim())||B!=="all"&&!r.directions.includes(B)||y!=="all"&&!r.nativeMethods.includes(y)||pe!=="all"&&!r.dispositions.includes(pe)||xe!=="all"&&!r.prpTypes.includes(xe)||he==="visible"&&!r.visible||he==="hidden"&&r.visible)),[B,pe,y,se,xe,G,he]);(0,p.useEffect)(()=>{if(z.length&&(!I||!z.some(r=>r.key===I))){const r=z.find(a=>a.itemType&&a.events.length>0)??z.find(a=>a.frames.length>0&&a.events.length>0)??z[0];f(r.key)}},[z,I]);const b=z.find(r=>r.key===I)??z[0]??null;(0,p.useEffect)(()=>{if(b&&!b.frames.some(r=>Number(r.frameId)===O)){const r=[...b.frames].reverse().find(a=>W(a).includes("completed"))??b.frames.at(-1);L(r?Number(r.frameId):null)}},[O,b]),(0,p.useEffect)(()=>{if(!s||!b)return;const r=new URLSearchParams(window.location.search);r.set("inspectRun",t),r.set("traceView",h),r.set("traceOperation",b.key);const a=`${window.location.pathname}?${r.toString()}${window.location.hash}`;window.history.replaceState(window.history.state,"",a)},[s,t,b,h]);const j=b?.frames.find(r=>Number(r.frameId)===O)??b?.frames.at(-1)??null,ge=F===!0&&j?ot[Be(t,Number(j.frameId))]??null:null,ye=j?b?.interpretations.filter(r=>Number(r.frameId)===Number(j.frameId))??[]:b?.interpretations??[],ee=b?.events??[],J=P(n?.resultJson),Me=P(J.presentationDecision),Le=Array.isArray(J.verificationCaveats)?J.verificationCaveats:[],ke=Array.isArray(J.ignoredAttentionRequests)?J.ignoredAttentionRequests:[],ct=v.filter(r=>re(r).visible).length,lt=Z.filter(r=>r.disposition==="ignored").length,Fe=Z.reduce((r,a)=>{const x=m(a.disposition)||"unknown";return r[x]=(r[x]??0)+1,r},{}),dt=i(r=>{f(r.key),N("pipeline")},"selectOperation"),ze=i(async r=>{if(F!==!0)return;const a=_.current;if(a?.runId!==t||a.allowed!==!0||!window.confirm("This exact provider frame may contain prompts, tool arguments, secrets, or reasoning. Reveal it now?"))return;const x=t,$=await me.revealProviderTraceFrame(x,r),T=_.current;T?.runId!==x||T.allowed!==!0||T.epoch!==a.epoch||Q(H=>({...H,[Be(x,r)]:$}))},"reveal"),ut=i(async()=>{if(F!==!0)return;const r=_.current;if(r?.runId!==t||r.allowed!==!0||!window.confirm("Download the exact raw trace? It may contain sensitive prompts, tool arguments, and provider-only fields."))return;const a=await me.downloadProviderTrace(t),x=_.current;x?.runId!==t||x.allowed!==!0||x.epoch!==r.epoch||rr(a,`provider-trace-${t}.ndjson`)},"downloadTrace"),mt=i(async()=>{if(F!==!0)return;const r=_.current;if(r?.runId!==t||r.allowed!==!0||!window.confirm("Delete this raw trace immediately? This cannot be undone."))return;A.current+=1;const a={...r,allowed:!1,epoch:A.current,phase:"deleting"};_.current=a,X(a),Q({});try{await me.deleteProviderTrace(t)}catch(T){_.current?.epoch===a.epoch&&l(T instanceof Error?T.message:"Raw trace deletion failed");return}if(_.current?.epoch!==a.epoch)return;let x;try{x=await Re.getCurrentBoardAccess()}catch{_.current?.epoch===a.epoch&&ne();return}if(_.current?.epoch!==a.epoch)return;if(!(x.source==="local_implicit"||x.isInstanceAdmin)){ne();return}A.current+=1;const $={runId:t,allowed:!0,epoch:A.current,phase:"granted"};_.current=$,X($),u({trace:null,entries:[]}),f(null),L(null)},"deleteTrace"),pt=i(r=>{if(!r){A.current+=1,_.current=null,X(null),u(null),w([]),f(null),L(null),Q({});const a=new URLSearchParams(window.location.search);a.delete("inspectRun"),a.delete("traceView"),a.delete("traceOperation");const x=a.toString();window.history.replaceState(window.history.state,"",`${window.location.pathname}${x?`?${x}`:""}${window.location.hash}`)}c(r)},"handleOpenChange");return(0,e.jsx)(Ft,{open:s,onOpenChange:pt,children:(0,e.jsxs)(Mt,{className:"w-(--sz-calc-43) max-w-none gap-0 p-0 sm:max-w-none","aria-describedby":"runner-inspector-description",children:[(0,e.jsxs)($t,{className:"border-b border-line pr-12",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(Lt,{children:"Runner Inspector"}),d?.trace?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(V,{variant:nr(d.trace.status),children:Je(d.trace.status,d.trace.expiresAt)}),(0,e.jsx)(V,{variant:"outline",className:"font-mono",children:$e.join(", ")||d.trace.provider})]}):null]}),(0,e.jsx)(qt,{id:"runner-inspector-description",children:"Correlate exact provider traffic with every interpretation stage, canonical PRP event, and production surface."}),(0,e.jsx)("div",{className:"flex gap-1 pt-1",role:"tablist","aria-label":"Runner inspector views",children:er.map(r=>{const a=r.icon;return(0,e.jsxs)("button",{type:"button",role:"tab","aria-selected":h===r.value,onClick:i(()=>N(r.value),"onClick"),className:M("inline-flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm font-medium transition-colors",h===r.value?"border-ink text-ink":"border-transparent text-ink-3 hover:text-ink"),children:[(0,e.jsx)(a,{className:"h-4 w-4"})," ",r.label]},r.value)})})]}),(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col",children:[R?(0,e.jsx)("div",{className:"m-4 rounded-md border border-bad/40 bg-bad/5 p-3 text-sm text-bad",children:R}):null,!g&&!R&&F===!1?(0,e.jsxs)("div",{className:"m-4 rounded-md border border-line bg-bg-3/20 p-4",children:[(0,e.jsx)("p",{className:"font-medium",children:"Raw provider traces require an instance administrator."}),(0,e.jsx)("p",{className:"mt-1 text-sm text-ink-3",children:"Canonical PRP events and presentation decisions remain inspectable below."})]}):null,!g&&!R&&F===!0&&!d?.trace?(0,e.jsxs)("div",{className:"m-4 flex items-start justify-between gap-4 rounded-md border border-line bg-bg-3/20 p-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"font-medium",children:"Raw provider capture was off for this run."}),(0,e.jsx)("p",{className:"mt-1 text-sm text-ink-3",children:"Canonical PRP events and persisted presentation decisions remain available below."})]}),o&&F===!0?(0,e.jsxs)(ae,{size:"sm",onClick:o,children:[(0,e.jsx)(Pt,{className:"mr-1.5 h-4 w-4"}),"Re-run with provider trace"]}):null]}):null,h==="overview"?(0,e.jsx)(ie,{className:"min-h-0 flex-1",children:(0,e.jsxs)("div",{className:"space-y-6 p-5",children:[g?(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Loading run pipeline…"}):null,(0,e.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6",children:[(0,e.jsx)(te,{label:"Provider",value:$e.join(", ")||d?.trace?.provider||"PRP only",detail:d?.trace?`captured through ${d.trace.provider}`:"capture was off"}),(0,e.jsx)(te,{label:"Raw frames",value:U.length,detail:d?.trace?be(d.trace.byteCount):"no exact bytes"}),(0,e.jsx)(te,{label:"Operations",value:se.length,detail:"correlated groups"}),(0,e.jsx)(te,{label:"PRP events",value:v.length,detail:`${ct} visible`}),(0,e.jsx)(te,{label:"Mappings",value:Z.length,detail:`${lt} ignored`}),(0,e.jsx)(te,{label:"Run status",value:n?.status??"unknown",detail:d?.trace?Je(d.trace.status,d.trace.expiresAt):"Raw capture off"})]}),(0,e.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,e.jsxs)("section",{className:"rounded-lg border border-line bg-bg-2 p-4",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Interpretation outcomes"}),(0,e.jsx)("div",{className:"mt-3 space-y-2",children:Object.entries(Fe).length?Object.entries(Fe).map(([r,a])=>(0,e.jsxs)("div",{className:"flex items-center gap-3 text-sm",children:[(0,e.jsx)(V,{variant:"outline",className:"w-24 justify-center capitalize",children:r}),(0,e.jsx)("div",{className:"h-2 flex-1 overflow-hidden rounded-full bg-bg-3",children:(0,e.jsx)("div",{className:"h-full rounded-full bg-accent",style:{width:`${Math.max(4,a/Math.max(1,Z.length)*100)}%`}})}),(0,e.jsx)("span",{className:"w-8 text-right font-mono text-xs",children:a})]},r)):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No interpretation records were persisted."})})]}),(0,e.jsxs)("section",{className:"rounded-lg border border-line bg-bg-2 p-4",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Recent correlated operations"}),(0,e.jsx)("div",{className:"mt-2 divide-y divide-line/70",children:se.slice(-6).reverse().map(r=>(0,e.jsxs)("button",{type:"button",onClick:i(()=>dt(r),"onClick"),className:"flex w-full items-center gap-3 py-2 text-left hover:text-accent",children:[(0,e.jsx)("span",{className:M("h-2 w-2 rounded-full",r.events.length?"bg-accent":"bg-ink-3")}),(0,e.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,e.jsx)("span",{className:"block truncate text-sm font-medium",children:r.title}),(0,e.jsx)("span",{className:"block truncate text-xs text-ink-3",children:r.subtitle})]}),(0,e.jsx)(ue,{className:"h-4 w-4 text-ink-3"})]},r.key))})]})]}),(0,e.jsx)("section",{className:"rounded-lg border border-line bg-bg-3/30 p-4",children:(0,e.jsxs)("div",{className:"flex gap-3",children:[(0,e.jsx)(Se,{className:"mt-0.5 h-5 w-5 shrink-0 text-ink"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Sensitive debug data"}),(0,e.jsx)("p",{className:"mt-1 text-sm text-ink-3",children:"Parsed frames are redacted on the server. Exact reveals and downloads are administrator-only, warned, audited, and automatically expire."})]})]})})]})}):null,h==="pipeline"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"grid gap-2 border-b border-line p-3 sm:grid-cols-2 xl:grid-cols-(--gtc-runner-inspector-filters)",children:[(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)(Ye,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-ink-3"}),(0,e.jsx)(Qe,{className:"pl-8",value:G,onChange:i(r=>Y(r.target.value),"onChange"),placeholder:"Search operations, fields, and events"})]}),(0,e.jsxs)(oe,{value:B,onValueChange:Ne,children:[(0,e.jsx)(ce,{children:(0,e.jsx)(de,{placeholder:"Direction"})}),(0,e.jsxs)(le,{children:[(0,e.jsx)(C,{value:"all",children:"All directions"}),(0,e.jsx)(C,{value:"client_to_provider",children:"Client → provider"}),(0,e.jsx)(C,{value:"provider_to_client",children:"Provider → client"}),(0,e.jsx)(C,{value:"provider_stderr",children:"Provider stderr"})]})]}),(0,e.jsxs)(oe,{value:y,onValueChange:st,children:[(0,e.jsx)(ce,{children:(0,e.jsx)(de,{placeholder:"Native method"})}),(0,e.jsxs)(le,{children:[(0,e.jsx)(C,{value:"all",children:"All native methods"}),D(U.map(W)).sort().map(r=>(0,e.jsx)(C,{value:r,children:r},r))]})]}),(0,e.jsxs)(oe,{value:pe,onValueChange:it,children:[(0,e.jsx)(ce,{children:(0,e.jsx)(de,{placeholder:"Mapping"})}),(0,e.jsxs)(le,{children:[(0,e.jsx)(C,{value:"all",children:"All mappings"}),["mapped","generic","ignored","rejected","operator_only"].map(r=>(0,e.jsx)(C,{value:r,children:r},r))]})]}),(0,e.jsxs)(oe,{value:xe,onValueChange:at,children:[(0,e.jsx)(ce,{children:(0,e.jsx)(de,{placeholder:"PRP type"})}),(0,e.jsxs)(le,{children:[(0,e.jsx)(C,{value:"all",children:"All PRP types"}),D(v.map(r=>r.eventType)).sort().map(r=>(0,e.jsx)(C,{value:r,children:r},r))]})]}),(0,e.jsxs)(oe,{value:he,onValueChange:Oe,children:[(0,e.jsx)(ce,{children:(0,e.jsx)(de,{placeholder:"Visibility"})}),(0,e.jsxs)(le,{children:[(0,e.jsx)(C,{value:"all",children:"Visible + hidden"}),(0,e.jsx)(C,{value:"visible",children:"Visible"}),(0,e.jsx)(C,{value:"hidden",children:"Hidden"})]})]})]}),(0,e.jsxs)("div",{className:"grid min-h-0 flex-1 lg:grid-cols-(--gtc-runner-inspector-pipeline)",children:[(0,e.jsx)(ie,{className:"border-r border-line",children:(0,e.jsxs)("div",{className:"p-2",children:[g?(0,e.jsx)("p",{className:"p-3 text-sm text-ink-3",children:"Loading run pipeline…"}):null,!g&&z.length===0?(0,e.jsx)("p",{className:"p-3 text-sm text-ink-3",children:"No operations match these filters."}):null,z.map(r=>(0,e.jsxs)("button",{type:"button",onClick:i(()=>f(r.key),"onClick"),className:"mb-1 w-full rounded-lg border border-transparent px-3 py-2.5 text-left hover:bg-bg-3/50 data-[selected=true]:border-line data-[selected=true]:bg-bg-3","data-selected":b?.key===r.key,children:[(0,e.jsxs)("span",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:M("h-2 w-2 shrink-0 rounded-full",r.events.length?r.visible?"bg-accent":"bg-ink":"bg-ink-3"),role:"img","aria-label":r.events.length?r.visible?"Visible production event":"Hidden production event":"No production event"}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:r.title}),r.frames.length>1?(0,e.jsxs)(V,{variant:"outline",className:"px-1.5 text-(length:--text-nano)",children:[r.frames.length," frames"]}):null]}),(0,e.jsx)("span",{className:"mt-1 block truncate pl-4 text-(length:--text-nano) text-ink-3",children:r.subtitle}),(0,e.jsx)("span",{className:"mt-1.5 flex flex-wrap gap-1 pl-4",children:r.prpTypes.slice(0,3).map(a=>(0,e.jsx)("span",{className:"rounded bg-bg px-1.5 py-0.5 font-mono text-(length:--text-nano) text-ink-3",children:a},a))})]},r.key))]})}),(0,e.jsx)(ie,{children:b?(0,e.jsxs)("div",{className:"space-y-6 p-5",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-line bg-bg-3/20 px-4 py-3",children:[(0,e.jsx)("strong",{className:"text-sm",children:b.title}),(0,e.jsx)(ue,{className:"h-3.5 w-3.5 text-ink-3"}),(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:[b.frames.length," raw frame",b.frames.length===1?"":"s"]}),(0,e.jsx)(ue,{className:"h-3.5 w-3.5 text-ink-3"}),(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:[b.interpretations.length," mapping stage",b.interpretations.length===1?"":"s"]}),(0,e.jsx)(ue,{className:"h-3.5 w-3.5 text-ink-3"}),(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:[ee.length," PRP event",ee.length===1?"":"s"]})]}),(0,e.jsxs)("section",{children:[(0,e.jsxs)("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[(0,e.jsx)("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-bg-3 text-xs font-semibold text-ink",children:"1"}),(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Provider frames"}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"server-redacted by default"})]}),b.frames.length>1?(0,e.jsx)("div",{className:"mb-2 flex flex-wrap gap-1",children:b.frames.map(r=>(0,e.jsxs)("button",{type:"button",onClick:i(()=>L(Number(r.frameId)),"onClick"),className:M("rounded-md border px-2 py-1 font-mono text-xs",Number(r.frameId)===Number(j?.frameId)?"border-accent/50 bg-accent/10 text-ink":"border-line text-ink-3 hover:bg-bg-3"),children:["#",String(r.frameId)," ",W(r)||m(r.direction)]},Number(r.frameId)))}):null,j?(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs text-ink-3",children:[(0,e.jsxs)(V,{variant:"outline",children:["frame ",String(j.frameId)]}),(0,e.jsx)("span",{children:m(j.direction).replaceAll("_"," ")}),(0,e.jsx)("span",{children:be(Number(j.byteLength)||0)}),(0,e.jsx)("code",{className:"truncate",children:m(j.digest)})]}),(0,e.jsx)(K,{value:j.parsed}),Array.isArray(j.withheldPaths)&&j.withheldPaths.length>0?(0,e.jsxs)("div",{className:"flex items-start gap-2 rounded-md border border-line bg-bg-3/30 px-3 py-2 text-xs text-ink-3",children:[(0,e.jsx)(Se,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-ink"}),(0,e.jsxs)("span",{children:["Withheld paths: ",j.withheldPaths.join(", ")]})]}):null,F===!0?(0,e.jsxs)(ae,{size:"sm",variant:"secondary",onClick:i(()=>{ze(Number(j.frameId))},"onClick"),children:[(0,e.jsx)(Pe,{className:"mr-1.5 h-4 w-4"}),"Reveal exact frame"]}):null,ge?(0,e.jsxs)("div",{className:"rounded-md border border-bad/30 p-2",children:[(0,e.jsxs)("p",{className:"mb-2 flex items-center gap-1.5 text-xs font-medium text-bad",children:[(0,e.jsx)(Se,{className:"h-3.5 w-3.5"}),"Exact unredacted frame"]}),(0,e.jsx)(K,{value:Ue(ge.rawBase64),label:"Search exact frame"})]}):null]}):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"This PRP event has no recoverable raw frame."})]}),(0,e.jsxs)("section",{children:[(0,e.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,e.jsx)("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-accent/10 text-xs font-semibold text-accent",children:"2"}),(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Interpretation stages"})]}),ye.length?ye.map((r,a)=>(0,e.jsx)(pr,{entry:r,last:a===ye.length-1},`${r.debugChannel}:${r.debugSequence}:${a}`)):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No interpretation stage was recorded for this frame."})]}),(0,e.jsxs)("section",{children:[(0,e.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,e.jsx)("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-bg-3 text-xs font-semibold text-ink",children:"3"}),(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Canonical PRP events"})]}),ee.length?ee.map(r=>(0,e.jsxs)("div",{className:"mb-3 overflow-hidden rounded-lg border border-line bg-bg-2",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 border-b border-line/70 px-3 py-2",children:[(0,e.jsx)("code",{className:"text-xs font-semibold",children:r.eventType}),(0,e.jsxs)(V,{variant:"outline",children:["seq ",r.seq]}),(0,e.jsx)("button",{type:"button",className:"ml-auto text-xs text-accent underline-offset-4 hover:underline",onClick:i(()=>{Oe(re(r).visible?"visible":"hidden"),f(b.key)},"onClick"),children:"Why isn’t this visible?"})]}),(0,e.jsx)("dl",{className:"grid gap-x-4 gap-y-1 px-3 py-2 text-xs sm:grid-cols-(--gtc-runner-inspector-fields)",children:xr(r).map(([a,x])=>(0,e.jsxs)("div",{className:"contents",children:[(0,e.jsx)("dt",{className:"text-ink-3",children:a}),(0,e.jsx)("dd",{className:"min-w-0 break-words font-mono",children:x})]},a))}),(0,e.jsxs)("details",{className:"border-t border-line/70",children:[(0,e.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1 px-3 py-2 text-xs font-medium text-ink-3",children:[(0,e.jsx)(Ge,{className:"h-3.5 w-3.5"}),"Canonical event JSON"]}),(0,e.jsx)("div",{className:"p-3 pt-0",children:(0,e.jsx)(K,{value:we(r)})})]})]},r.id)):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"This provider operation emitted no canonical PRP events."})]}),(0,e.jsxs)("section",{children:[(0,e.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,e.jsx)("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-bg-3 text-xs font-semibold text-ink",children:"4"}),(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Production presentation"})]}),ee.length?ee.map(r=>{const a=re(r);return(0,e.jsxs)("div",{className:"mb-4 grid gap-3 xl:grid-cols-(--gtc-runner-inspector-presentation)",children:[(0,e.jsxs)("dl",{className:"grid grid-cols-(--gtc-runner-inspector-fields) gap-x-3 gap-y-1 rounded-lg border border-line p-3 text-sm",children:[(0,e.jsx)("dt",{className:"text-ink-3",children:"Visible"}),(0,e.jsxs)("dd",{className:"flex items-center gap-1.5",children:[a.visible?(0,e.jsx)(Ie,{className:"h-3.5 w-3.5 text-accent"}):(0,e.jsx)(Ze,{className:"h-3.5 w-3.5 text-ink-3"}),a.visible?"yes":"no"]}),(0,e.jsx)("dt",{className:"text-ink-3",children:"Surface"}),(0,e.jsx)("dd",{children:a.surface}),(0,e.jsx)("dt",{className:"text-ink-3",children:"Container"}),(0,e.jsx)("dd",{children:a.container}),(0,e.jsx)("dt",{className:"text-ink-3",children:"State"}),(0,e.jsx)("dd",{children:a.state}),(0,e.jsx)("dt",{className:"text-ink-3",children:"Action"}),(0,e.jsx)("dd",{children:a.action}),(0,e.jsx)("dt",{className:"text-ink-3",children:"Reason"}),(0,e.jsx)("dd",{children:a.reason}),(0,e.jsx)("dt",{className:"text-ink-3",children:"Reason code"}),(0,e.jsx)("dd",{children:(0,e.jsx)("code",{className:"text-xs",children:a.reasonCode})})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"mb-2 text-(length:--text-nano) font-medium uppercase tracking-wide text-ink-3",children:"Production surface preview"}),(0,e.jsx)(hr,{event:r,runId:t})]})]},r.id)}):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No presentation surface was emitted for this operation."}),Object.keys(Me).length>0?(0,e.jsxs)("details",{className:"rounded-lg border border-line",children:[(0,e.jsx)("summary",{className:"cursor-pointer px-3 py-2 text-xs font-medium text-ink-3",children:"Resolved final response decision"}),(0,e.jsx)("div",{className:"p-3 pt-0",children:(0,e.jsx)(K,{value:Me})})]}):null,Le.length>0||ke.length>0?(0,e.jsxs)("div",{className:"mt-3 rounded-lg border border-line bg-bg-3/30 p-3",children:[(0,e.jsx)("p",{className:"text-xs font-semibold text-ink",children:"Semantic finalization lineage"}),(0,e.jsx)("p",{className:"mt-1 text-xs text-ink-3",children:"Provider-native transport and model-authored tool arguments are separate layers. PRP normalized the model payload, then server policy chose the issue disposition."}),ke.some(r=>P(r).sourceKind==="environment_constraint")?(0,e.jsxs)("p",{className:"mt-2 text-xs",children:[(0,e.jsx)("code",{children:"environment_constraint"})," was model-authored tool payload data, not a Codex app-server event. It was normalized into a non-blocking verification caveat."]}):null,(0,e.jsxs)("dl",{className:"mt-2 grid grid-cols-(--gtc-runner-inspector-fields) gap-x-3 gap-y-1 text-xs",children:[(0,e.jsx)("dt",{className:"text-ink-3",children:"Policy"}),(0,e.jsx)("dd",{children:(0,e.jsx)("code",{children:m(J.finalizationPolicyVersion)||"unknown"})}),(0,e.jsx)("dt",{className:"text-ink-3",children:"Decision reason"}),(0,e.jsx)("dd",{children:(0,e.jsx)("code",{children:m(J.finalizationReasonCode)||"unknown"})})]}),(0,e.jsxs)("details",{className:"mt-2",children:[(0,e.jsx)("summary",{className:"cursor-pointer text-xs font-medium text-ink-3",children:"Normalized caveats and ignored requests"}),(0,e.jsx)("div",{className:"mt-2",children:(0,e.jsx)(K,{value:{verificationCaveats:Le,ignoredAttentionRequests:ke}})})]})]}):null]})]}):(0,e.jsx)("div",{className:"p-5 text-sm text-ink-3",children:"Select a correlated operation to inspect its pipeline."})})]})]}):null,h==="trace"?(0,e.jsxs)("div",{className:"grid min-h-0 flex-1 md:grid-cols-(--gtc-runner-inspector-trace)",children:[(0,e.jsx)(ie,{className:"border-r border-line",children:(0,e.jsx)("div",{className:"p-2",children:U.length?[...U].sort((r,a)=>Number(r.frameId)-Number(a.frameId)).map(r=>(0,e.jsxs)("button",{type:"button",onClick:i(()=>{const a=se.find(x=>x.frames.some($=>Number($.frameId)===Number(r.frameId)));a&&f(a.key),L(Number(r.frameId))},"onClick"),className:M("mb-1 w-full rounded-md border px-3 py-2 text-left",Number(r.frameId)===Number(j?.frameId)?"border-accent/40 bg-accent/10":"border-transparent hover:bg-bg-3/50"),children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,e.jsxs)("span",{className:"font-mono text-xs text-ink-3",children:["#",String(r.frameId)]}),(0,e.jsx)("span",{className:"truncate",children:W(r)||m(r.direction)})]}),(0,e.jsxs)("span",{className:"mt-1 block text-(length:--text-nano) text-ink-3",children:[m(r.direction).replaceAll("_"," ")," · ",be(Number(r.byteLength)||0)]})]},Number(r.frameId))):(0,e.jsx)("p",{className:"p-3 text-sm text-ink-3",children:"No raw frames were captured for this run."})})}),(0,e.jsx)(ie,{children:(0,e.jsx)("div",{className:"space-y-3 p-5",children:j?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxs)("h3",{className:"text-sm font-semibold",children:["Exact trace frame #",String(j.frameId)]}),(0,e.jsx)(V,{variant:"outline",children:W(j)||m(j.direction)})]}),(0,e.jsx)(K,{value:j.parsed}),F===!0?(0,e.jsxs)(ae,{size:"sm",variant:"secondary",onClick:i(()=>{ze(Number(j.frameId))},"onClick"),children:[(0,e.jsx)(Pe,{className:"mr-1.5 h-4 w-4"}),"Reveal exact frame"]}):null,ge?(0,e.jsx)(K,{value:Ue(ge.rawBase64),label:"Search exact frame"}):null]}):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Select a frame from the chronological trace."})})})]}):null,F===!0&&d?.trace?.runId===t?(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t border-line p-3",children:[(0,e.jsxs)("p",{className:"text-xs text-ink-3",children:[d.trace.frameCount," frames · ",be(d.trace.byteCount)," · expires ",new Date(d.trace.expiresAt).toLocaleString()]}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsxs)(ae,{size:"sm",variant:"secondary",onClick:i(()=>{ut()},"onClick"),children:[(0,e.jsx)(At,{className:"mr-1.5 h-4 w-4"}),"Download exact trace"]}),(0,e.jsxs)(ae,{size:"sm",variant:"danger",onClick:i(()=>{mt()},"onClick"),children:[(0,e.jsx)(Tt,{className:"mr-1.5 h-4 w-4"}),"Delete trace"]})]})]}):null]})]})})}i(on,"RunnerInspector");function cn(t){if(!t)return!1;const n=t.debug;return typeof n=="object"&&n!==null&&!Array.isArray(n)&&n.providerTrace==="raw"}i(cn,"runRequestedProviderTrace");function ln({trace:t,requested:n=!1,showOff:s=!1,className:c}){const o=t?.status,d=t?new Date(t.expiresAt).getTime()<=Date.now():!1,u=d?"Trace expired":o==="capturing"?"Raw tracing enabled":o==="complete"?"Trace captured":o==="incomplete"?"Trace incomplete":o==="truncated"?"Trace truncated":o==="expired"?"Trace expired":o==="deleted"?"Trace deleted":n?"Trace requested":s?"Trace off":null;if(!u)return null;const v=o==="incomplete"||o==="truncated"||o==="expired"||o==="deleted"||d,w=u==="Trace off"?Ze:wt;return(0,e.jsxs)("span",{className:M("inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-(length:--text-micro) font-medium",u==="Trace off"||u==="Trace deleted"||u==="Trace expired"?"border-line bg-bg text-ink-3":v?"border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300":"border-amber-500/30 bg-amber-500/10 text-amber-800 dark:text-amber-200",c),title:t?`${t.frameCount} frames · ${t.byteCount} bytes · expires ${new Date(t.expiresAt).toLocaleString()}`:n?"This run requested sensitive provider-frame capture.":"Raw provider-frame capture was disabled for this run.",children:[(0,e.jsx)(w,{className:"h-3 w-3"}),u]})}i(ln,"ProviderTraceStatusBadge");var fr=Ae(bt(),1);function Ke(){const t=document.getElementById("main-content");if(t instanceof HTMLElement){const n=window.getComputedStyle(t).overflowY;if((n==="auto"||n==="scroll"||n==="overlay")&&t.scrollHeight>t.clientHeight+1)return{type:"element",element:t}}return{type:"window"}}i(Ke,"resolveScrollTarget");function gr(t){return t.type==="element"?t.element.scrollHeight-t.element.scrollTop-t.element.clientHeight:(document.scrollingElement??document.documentElement).scrollHeight-window.scrollY-window.innerHeight}i(gr,"distanceFromBottom");function dn(){const[t,n]=(0,p.useState)(!1),{panelVisible:s,panelContent:c}=Ct(),{isMobile:o}=Et(),[d,u]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(!o){u(null);return}const g=document.getElementById("main-content");if(!g)return;const k=i(()=>u(g.querySelector('[data-testid="task-chat-composer-dock"]')),"findDock");k();const R=new MutationObserver(k);return R.observe(g,{childList:!0,subtree:!0}),()=>R.disconnect()},[o]),(0,p.useEffect)(()=>{const g=i(()=>{n(gr(Ke())>300)},"check"),k=document.getElementById("main-content");return g(),k?.addEventListener("scroll",g,{passive:!0}),window.addEventListener("scroll",g,{passive:!0}),window.addEventListener("resize",g),()=>{k?.removeEventListener("scroll",g),window.removeEventListener("scroll",g),window.removeEventListener("resize",g)}},[]);const v=(0,p.useCallback)(()=>{const g=Ke();if(g.type==="element"){g.element.scrollTo({top:g.element.scrollHeight,behavior:"smooth"});return}const k=document.scrollingElement??document.documentElement;window.scrollTo({top:k.scrollHeight,behavior:"smooth"})},[]);if(!t)return null;const w=(0,e.jsx)("button",{"data-slot":"icon-button",onClick:v,className:M("z-40 flex h-9 w-9 items-center justify-center rounded-full border border-line bg-bg shadow-md hover:bg-bg-3 transition-(--tp-background-color-right) duration-200",o&&d?"absolute bottom-full left-1/2 -translate-x-1/2 mb-3":"fixed bottom-(--sz-calc-21) right-6 md:bottom-6",!o&&s&&c&&"md:right-(--sz-calc-22)"),"aria-label":"Scroll to bottom",children:(0,e.jsx)(yt,{className:"h-4 w-4"})});return o&&d?(0,fr.createPortal)(w,d):w}i(dn,"ScrollToBottom");export{tn as a,Qr as c,Yr as d,on as i,en as l,ln as n,Xr as o,cn as r,Zr as s,dn as t,Gr as u};