@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.
- package/dist/assets/{AdapterManager-Cz1qnS9X.js → AdapterManager-DvntZ2AW.js} +1 -1
- package/dist/assets/{AdvancedToolsRoute-7YTRdxju.js → AdvancedToolsRoute-CUW8D9Ux.js} +1 -1
- package/dist/assets/{AgentActionButtons-CE0nmrqG.js → AgentActionButtons-CQLGCtfu.js} +1 -1
- package/dist/assets/{AgentBubbleActionRow-Dqrx638X.js → AgentBubbleActionRow-CnkfFlB3.js} +1 -1
- package/dist/assets/{AgentChat-AunGdpGT.js → AgentChat-DCwwZA2b.js} +1 -1
- package/dist/assets/{AgentChats-T9fzOwzH.js → AgentChats-DMMLdo-o.js} +1 -1
- package/dist/assets/{AgentDefaults-C0WFwQky.js → AgentDefaults-Cu8O2iTJ.js} +1 -1
- package/dist/assets/{AgentDetail-DEmzneVa.js → AgentDetail-BMVWOVp-.js} +7 -7
- package/dist/assets/{AgentIconPicker-BJerBmcL.js → AgentIconPicker-DJaVz-Vx.js} +1 -1
- package/dist/assets/{AgentTodoCard-D1lORgGy.js → AgentTodoCard-C4BfJg4x.js} +1 -1
- package/dist/assets/Agents-C0IDC6KD.js +3 -0
- package/dist/assets/{AppDetail-BX1FNfWC.js → AppDetail-DzEGsx94.js} +1 -1
- package/dist/assets/{AppNotConnected-7VCE3fbW.js → AppNotConnected-BVL32B49.js} +1 -1
- package/dist/assets/{ApprovalCard-BFjlBJIl.js → ApprovalCard-DCQ49PuW.js} +1 -1
- package/dist/assets/{ApprovalDetail-nh-aAVQ1.js → ApprovalDetail-B0J70llD.js} +1 -1
- package/dist/assets/{ApprovalPayload-CrxNpWYr.js → ApprovalPayload-8lqBw-XQ.js} +1 -1
- package/dist/assets/{Approvals-T3qTJIwh.js → Approvals-BkiVjx0M.js} +1 -1
- package/dist/assets/{AppsConnect-D7l2xnv-.js → AppsConnect-B_hvpdTB.js} +1 -1
- package/dist/assets/{AppsReview-BQpLs2ic.js → AppsReview-CeXp22cE.js} +1 -1
- package/dist/assets/{ArtifactCard-9vsmkZzO.js → ArtifactCard-BV82tDLI.js} +1 -1
- package/dist/assets/{Artifacts-DN7vvCse.js → Artifacts-CL5ZmZ3m.js} +1 -1
- package/dist/assets/{AssistantConnection-DFVB49U5.js → AssistantConnection-C5rmoEsm.js} +1 -1
- package/dist/assets/{AttentionInteractionResolver-61BN1ky5.js → AttentionInteractionResolver-DxZpuIIF.js} +1 -1
- package/dist/assets/AuditHub-DDPFGvHG.js +1 -0
- package/dist/assets/{Auth-D0lGuVnd.js → Auth-CkILt4fl.js} +1 -1
- package/dist/assets/{BoardChat-CMIqWEbi.js → BoardChat-DlaNGzcQ.js} +3 -3
- package/dist/assets/{BoardClaim-CbYY66Qd.js → BoardClaim-B135Nebr.js} +1 -1
- package/dist/assets/{BootstrapSetupUxLab-M3IOGjXI.js → BootstrapSetupUxLab-B2tOIzXd.js} +1 -1
- package/dist/assets/{Browse-AYCtuCFi.js → Browse-xEc9mGl7.js} +1 -1
- package/dist/assets/{BudgetPolicyCard-Cwm5wpvU.js → BudgetPolicyCard-Ccr3EX5M.js} +1 -1
- package/dist/assets/{CaseDetail-CgZ4u934.js → CaseDetail-CvMk_M-F.js} +2 -2
- package/dist/assets/{Cases-BvCHo_JJ.js → Cases-H1Y4Oipe.js} +2 -2
- package/dist/assets/{ChatEndpointDetail-CM83nK2S.js → ChatEndpointDetail-CjDVQWl8.js} +1 -1
- package/dist/assets/{ChatEndpointSetup-Dzm1h4LA.js → ChatEndpointSetup-BfohtKVM.js} +1 -1
- package/dist/assets/{ChatIdentityConfirm-Dc4AnYX8.js → ChatIdentityConfirm-tOTIxwjm.js} +1 -1
- package/dist/assets/{CliAuth-CatEsBxW.js → CliAuth-CE0EwTW_.js} +1 -1
- package/dist/assets/{Companies-BBdNER6U.js → Companies-C4ObCu9j.js} +1 -1
- package/dist/assets/{CompanyAccess-CX4qyiXc.js → CompanyAccess-J5Vwnko2.js} +1 -1
- package/dist/assets/{CompanyActivity-Csqqnldg.js → CompanyActivity-B7-kMNmz.js} +1 -1
- package/dist/assets/{CompanyConnections-Ds1e8fjb.js → CompanyConnections-D2N6UWXk.js} +1 -1
- package/dist/assets/{CompanyEnvironments-BQGpdLk1.js → CompanyEnvironments-ChSu4gxW.js} +1 -1
- package/dist/assets/{CompanyExport-CBJU6SZ5.js → CompanyExport-B_opHRSJ.js} +1 -1
- package/dist/assets/{CompanyImport-BtODUy1v.js → CompanyImport-DZAMEBBy.js} +1 -1
- package/dist/assets/{CompanySettings-x6CbuKeE.js → CompanySettings-Rz8cwgKC.js} +1 -1
- package/dist/assets/{CompanySettingsPluginPage-CEDKNwLY.js → CompanySettingsPluginPage-CM-ViPwj.js} +1 -1
- package/dist/assets/{CompanySkills-C32TKvfI.js → CompanySkills-BnwPuZze.js} +2 -2
- package/dist/assets/{ComposerAddMenu-BPPkbm0o.js → ComposerAddMenu-jKf-6Yli.js} +1 -1
- package/dist/assets/{ConfigureBuiltInAgentModal-v8kbSAuE.js → ConfigureBuiltInAgentModal-BAfoTveX.js} +1 -1
- package/dist/assets/{ConnectionSetupFlow-g6asOGFg.js → ConnectionSetupFlow-8alK3I_h.js} +1 -1
- package/dist/assets/{CopyableGatewayUrl-DM4I2CJE.js → CopyableGatewayUrl-D90Bjxj0.js} +1 -1
- package/dist/assets/{Dashboard-4TvnZKHQ.js → Dashboard-DepIxrje.js} +2 -2
- package/dist/assets/{DecisionDateChips-H3AqvYWG.js → DecisionDateChips-89KkV4mo.js} +1 -1
- package/dist/assets/{DecisionModelSettings-HEZJ0E6n.js → DecisionModelSettings-CvVCBVCM.js} +1 -1
- package/dist/assets/{DecisionQueuePage-C--TNteA.js → DecisionQueuePage-nU9qXzln.js} +1 -1
- package/dist/assets/{DesignGuide-PDM2oacG.js → DesignGuide-40TixHZ-.js} +4 -4
- package/dist/assets/{EmailEndpointSetup-B0haS5AA.js → EmailEndpointSetup-D7-8f1XV.js} +1 -1
- package/dist/assets/{EntityRow-B24YmFE7.js → EntityRow-jUxCK6IM.js} +1 -1
- package/dist/assets/ExecutionWorkspaceDetail-CnUD3jLO.js +19 -0
- package/dist/assets/{GatewayDetail-CtpVgcnJ.js → GatewayDetail-Bg7GU-1a.js} +2 -2
- package/dist/assets/{GatewaysList-DCuMJisg.js → GatewaysList-4vvZCBkY.js} +1 -1
- package/dist/assets/{GoalDetail-B4Iw4vhL.js → GoalDetail-h7WsjaOO.js} +1 -1
- package/dist/assets/{GoalTree-Bxei53eI.js → GoalTree-yPtfejUx.js} +1 -1
- package/dist/assets/{Goals-CszzFpXF.js → Goals-DOi3E4DX.js} +1 -1
- package/dist/assets/{ImageGalleryModal-7mN3BVkG.js → ImageGalleryModal-D_VQgcBt.js} +1 -1
- package/dist/assets/{Inbox-Dzj03JZw.js → Inbox-COKxRKhR.js} +2 -2
- package/dist/assets/{InlineBanner-DYx7A02D.js → InlineBanner-DeTqU5Gp.js} +1 -1
- package/dist/assets/{InlineEditor-BJTE1pyF.js → InlineEditor-4ew5gxf0.js} +1 -1
- package/dist/assets/{InstanceAdvanced-HzNvpWAC.js → InstanceAdvanced-DlMlwZbU.js} +1 -1
- package/dist/assets/{InstanceFeatures-C1eqcxDI.js → InstanceFeatures-BbDE9waY.js} +1 -1
- package/dist/assets/{InviteLanding-BHDk8eVb.js → InviteLanding-BGvJMHKw.js} +1 -1
- package/dist/assets/{IssueChatLongThreadPerf-E61LYLEE.js → IssueChatLongThreadPerf-C3U2FZKJ.js} +1 -1
- package/dist/assets/{IssueChatThread-DERjeWcT.js → IssueChatThread-CDKaIB6v.js} +10 -10
- package/dist/assets/{IssueDetail--oKqoH82.js → IssueDetail-BCwHANTn.js} +6 -6
- package/dist/assets/{IssueDocumentAnnotations-DjcRXcEw.js → IssueDocumentAnnotations-DpFXlkRb.js} +1 -1
- package/dist/assets/{IssueOutputSection-Dvul0VAn.js → IssueOutputSection-BzXRmoV7.js} +1 -1
- package/dist/assets/{IssueRecoveryActionCard-DpJjLu9A.js → IssueRecoveryActionCard-BYtbaP-M.js} +1 -1
- package/dist/assets/{IssueReferencePill-DIqTKSRc.js → IssueReferencePill-BT7NBEy_.js} +1 -1
- package/dist/assets/{IssueThreadInteractionCard-PnjBaM8M.js → IssueThreadInteractionCard-Btd0rZ23.js} +1 -1
- package/dist/assets/{Issues-Dwcvbvvw.js → Issues-XKf7zemQ.js} +3 -3
- package/dist/assets/{LiveNowTodoLine-B3GKP4a7.js → LiveNowTodoLine-CoL6ZNuK.js} +1 -1
- package/dist/assets/ManagedAiConnectionDetails-CebBi-Tw.js +1 -0
- package/dist/assets/{MarkdownBody-D7qCQaU_.js → MarkdownBody-cPGkwwjq.js} +1 -1
- package/dist/assets/{McpConnect-CYz1a9lA.js → McpConnect-ByorZN7G.js} +1 -1
- package/dist/assets/{MembershipAction-BCf-FK7R.js → MembershipAction-De0MBfgb.js} +1 -1
- package/dist/assets/{MetricCard-DlcBTKQs.js → MetricCard-CTOmJVRL.js} +1 -1
- package/dist/assets/{MissingPluginTabPlaceholder-l1R-Q4nh.js → MissingPluginTabPlaceholder-D3N0rd-p.js} +1 -1
- package/dist/assets/{ModelsAndProviders-CI6zoBD9.js → ModelsAndProviders-BqM4UJc7.js} +1 -1
- package/dist/assets/{NewAgent-BWaZTy_v.js → NewAgent-pMTQYNxn.js} +1 -1
- package/dist/assets/{OmpAllSettings-DTJLATQL.js → OmpAllSettings-BeXrdLBc.js} +1 -1
- package/dist/assets/{PipelineSettings-pFkHM2Ns.js → PipelineSettings-C2k3BzLQ.js} +2 -2
- package/dist/assets/Pipelines-Cr6Xs32p.js +1 -0
- package/dist/assets/PixelsOffice-Dfd4XKSj.js +2 -0
- package/dist/assets/{PluginManager-DkADWuR8.js → PluginManager-7ZdeHrGQ.js} +1 -1
- package/dist/assets/{PluginPage-CBAkPwZs.js → PluginPage-fPlWyFSc.js} +1 -1
- package/dist/assets/{PluginSettings-CsXh8PMi.js → PluginSettings-X_VHvvo5.js} +1 -1
- package/dist/assets/{ProfileDetailRoute-B6mZqIhS.js → ProfileDetailRoute-PAsWmN-1.js} +1 -1
- package/dist/assets/{ProfileSettings-BZG_OvIh.js → ProfileSettings-BACxlGZS.js} +1 -1
- package/dist/assets/{ProfileWizardRoute-yUXZqjqr.js → ProfileWizardRoute-Dbq0n7If.js} +1 -1
- package/dist/assets/ProjectDetail-DOJZUIWu.js +1 -0
- package/dist/assets/{ProjectWorkspaceDetail-rSo7mMQc.js → ProjectWorkspaceDetail-ZNnaHnuA.js} +1 -1
- package/dist/assets/{ProjectWorkspacesContent-DnGszD3v.js → ProjectWorkspacesContent-DrWfnTJY.js} +1 -1
- package/dist/assets/{Projects-kZ7Li_8n.js → Projects-CCzxmEZ8.js} +1 -1
- package/dist/assets/{PublicIssueSharePage-DMy8nXt2.js → PublicIssueSharePage-BUSkP1Js.js} +1 -1
- package/dist/assets/{QuestionForm-DF6R7lYE.js → QuestionForm-MfSDsey7.js} +1 -1
- package/dist/assets/{RepositoryEditor-BuV4JRgV.js → RepositoryEditor-2QyuT99t.js} +1 -1
- package/dist/assets/{ReviewQueueCard-Bz8uXwnD.js → ReviewQueueCard-CrCN_30c.js} +1 -1
- package/dist/assets/{RichWorkProductCard-BCB8SaZp.js → RichWorkProductCard-DndJn4LV.js} +1 -1
- package/dist/assets/{RoutineDetail-C-gt9_NY.js → RoutineDetail-B5MzV_74.js} +2 -2
- package/dist/assets/{RoutineRunVariablesDialog-CrKptoDW.js → RoutineRunVariablesDialog-kGyQVBid.js} +1 -1
- package/dist/assets/Routines-B2zX9h3J.js +1 -0
- package/dist/assets/ScrollToBottom-Dd3SpeJi.js +1 -0
- package/dist/assets/{Search-B-8DqpI2.js → Search-D4W3cZZf.js} +1 -1
- package/dist/assets/{Secrets-CPNzZnuu.js → Secrets-C4nbuMIh.js} +3 -3
- package/dist/assets/{SidebarNavItem-afEXEFeo.js → SidebarNavItem-kYI7H9f3.js} +1 -1
- package/dist/assets/{SkillSourceTree-CR8rC1PY.js → SkillSourceTree-BvGzMa2u.js} +1 -1
- package/dist/assets/{SkillSources-3haDckt2.js → SkillSources-DL2tNkcr.js} +1 -1
- package/dist/assets/{SkillStudio-CXzQR1ws.js → SkillStudio-BnZ2cfDq.js} +1 -1
- package/dist/assets/{SourceTrustBadge-DNvpVd9i.js → SourceTrustBadge-CCPQEGrC.js} +1 -1
- package/dist/assets/{StatusCards-D-O7dS5f.js → StatusCards-BkE-9R8F.js} +1 -1
- package/dist/assets/{StatusIcon-Bx4H7RuA.js → StatusIcon-Cs1RbJGu.js} +1 -1
- package/dist/assets/{SummarySlotCard-CYpYMfTa.js → SummarySlotCard-D1EyiciB.js} +1 -1
- package/dist/assets/{TaskChatLab-BfxurxKS.js → TaskChatLab-D3PsNRr5.js} +1 -1
- package/dist/assets/{TaskChatMarker-Cj8k3l9N.js → TaskChatMarker-DEF88_sr.js} +2 -2
- package/dist/assets/{TaskChatProtocolCard-BsdB1fYv.js → TaskChatProtocolCard-Ba_vhDxn.js} +1 -1
- package/dist/assets/{TaskChatThreadView-B90tQ4X1.js → TaskChatThreadView-BsPvbxiA.js} +1 -1
- package/dist/assets/{TaskTreeControls-zoH_P07l.js → TaskTreeControls-BKOIbilg.js} +2 -2
- package/dist/assets/{Terminal-y6EdGsxY.js → Terminal-1uPX7VEe.js} +1 -1
- package/dist/assets/{TerminalView-CWvRC4uL.js → TerminalView-DDv6s-R_.js} +1 -1
- package/dist/assets/{ToolsAdminGate-C5dQpL4C.js → ToolsAdminGate-BzvfSwod.js} +1 -1
- package/dist/assets/{TrustPresetSection-gUExLKOq.js → TrustPresetSection-BDb0N4Pe.js} +1 -1
- package/dist/assets/{UserProfile-uUu_7SHc.js → UserProfile-DqPRuGWk.js} +1 -1
- package/dist/assets/{WebhookUrlWarning-CbkWHsPb.js → WebhookUrlWarning-CHx5gr2m.js} +1 -1
- package/dist/assets/WhatNeedsMe-DtBxgH24.js +1 -0
- package/dist/assets/{WorkspaceRuntimeControls-Cp5E1FME.js → WorkspaceRuntimeControls-Clk2nzU6.js} +1 -1
- package/dist/assets/{Workspaces-MhwqOigu.js → Workspaces-BQOyG5HK.js} +1 -1
- package/dist/assets/{connection-owner-CslVCQSM.js → connection-owner-CPrMcD3t.js} +1 -1
- package/dist/assets/{index-D1wQsid4.js → index-QhteFtm-.js} +16 -16
- package/dist/assets/{issue-properties-BXissCm1.js → issue-properties--M7WE6Ot.js} +3 -3
- package/dist/assets/{issue-workspace-selection-Ey-jzxzA.js → issue-workspace-selection-pUdSkrJA.js} +1 -1
- package/dist/assets/{pipeline-stage-presentation-B_etSYde.js → pipeline-stage-presentation-Dv1xgEPW.js} +1 -1
- package/dist/assets/router-CJbFZfVR.js +1 -0
- package/dist/assets/{shared-CSvxoeyx.js → shared-B75ClBUg.js} +1 -1
- package/dist/assets/{slots-DZ1hj5sG.js → slots-B7lwlN1w.js} +1 -1
- package/dist/assets/system-notice-comment-D0I6rz8Y.js +1 -0
- package/dist/assets/{task-chat-attachments-DNPQ-jOG.js → task-chat-attachments-2KmZkOL7.js} +1 -1
- package/dist/assets/{transcript-adapter-CppFOMQA.js → transcript-adapter-ClaGWYVL.js} +1 -1
- package/dist/assets/useSummaryDraftStream-BDuMgNcA.js +3 -0
- package/dist/index.html +12 -13
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/dist/assets/Agents-BwRQ91d5.js +0 -3
- package/dist/assets/AuditHub-CPsJe_Bl.js +0 -1
- package/dist/assets/ExecutionWorkspaceDetail-BI4rAhvY.js +0 -19
- package/dist/assets/ManagedAiConnectionDetails-D7zoLLKJ.js +0 -1
- package/dist/assets/Pipelines-C8_wN0Sv.js +0 -1
- package/dist/assets/PixelsOffice-GHMNmVjR.js +0 -2
- package/dist/assets/ProjectDetail-CTwwSUZn.js +0 -1
- package/dist/assets/Routines-D3JG-gCI.js +0 -1
- package/dist/assets/ScrollToBottom-CYzcByH1.js +0 -1
- package/dist/assets/WhatNeedsMe-JNJ5uJyH.js +0 -1
- package/dist/assets/heartbeats-D96c9g2n.js +0 -1
- package/dist/assets/router-BKzUF9uf.js +0 -1
- package/dist/assets/system-notice-comment-DPCHQ4-Y.js +0 -1
- package/dist/assets/useSummaryDraftStream-DQYbVHb7.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
var S=Object.defineProperty;var s=(e,t)=>S(e,"name",{value:t,configurable:!0});import{i as y}from"./rolldown-runtime-ZpX3ckPj.js";import{h as M,l as u,la as $,ua as P}from"./createLucideIcon-CgrPXnTY.js";import{a as O}from"./star-eem0qj3E.js";import{X as H,_ as q,n as N,t as m}from"./queryKeys-BzT8CD34.js";import{nt as L}from"./mention-chips-COg-185l.js";import{bt as U,t as W,xt as z,zt as B}from"./router-BKzUF9uf.js";import{t as D}from"./badge-check-BNLpGDnd.js";import{t as K}from"./circle-alert-C7T1cdKm.js";import{t as g}from"./clock-D2UFngg7.js";import{t as Q}from"./info-Clx4FKz9.js";import{r as X,t as x}from"./button-DI4w5WP7.js";import{t as F}from"./rotate-ccw-DpzLJhXT.js";import{t as V}from"./shield-alert-BAXWoBTh.js";import{t as j}from"./triangle-alert-CnHMpmva.js";import{t as Y}from"./user-D5V640s5.js";import{t as G}from"./x-6E1yeU3Q.js";import{i as Z,n as J,t as ee}from"./tooltip-CW50mEoC.js";import{t as w}from"./badge-jeXr866I.js";import{t as te}from"./AgentAvatar-BZiiDlCN.js";import{a as ne}from"./ToastContext-DyVJ6bCh.js";import{t as re}from"./InlineBanner-DYx7A02D.js";import{_ as ae}from"./issue-blockers-t3wlvg4M.js";import{Rn as se}from"./index-D1wQsid4.js";import{n as ie}from"./runRetryState-p_i4Mh7u.js";function Xe(e,t){return t==="operator_interrupted"?!0:!e||typeof e!="object"?!1:e.operatorInterrupted===!0?!0:e.interruptionSource==="issue_comment_interrupt"}s(Xe,"isOperatorInterruptedRun");function oe(e){switch(e){case"succeeded":return"text-green-700 dark:text-green-300";case"failed":case"error":return"text-red-700 dark:text-red-300";case"timed_out":return"text-orange-700 dark:text-orange-300";case"running":return"text-blue-700 dark:text-blue-300";case"queued":case"pending":return"text-amber-700 dark:text-amber-300";case"cancelled":return"text-ink-3";default:return"text-ink"}}s(oe,"runStatusClassName");function de(e,t={}){return e==="cancelled"&&t.operatorInterrupted?{label:"interrupted",className:"text-amber-700 dark:text-amber-300",srHint:"interrupted by board comment"}:{label:e==="timed_out"?"timed out":e.replace(/_/g," "),className:oe(e),srHint:null}}s(de,"resolveRunStatusPresentation");var A=/\[[^\]]*\]\(([^)]*)\)/g;function Fe(e){const t=[];if(!e)return t;for(const r of e.matchAll(A)){const a=r[1]??"",i=L(a);i?.agentId&&!t.includes(i.agentId)&&t.push(i.agentId)}return t}s(Fe,"extractAgentMentionIds");function le(e){return e.replace(A," ")}s(le,"plainTextOutsideLinks");function ue(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}s(ue,"escapeRegExp");function Ve(e,t){if(!e.trim()||t.length===0)return null;const r=le(e);let a=null;for(const i of t){const l=[i.name,i.role??""].filter(o=>o&&o.trim().length>=2);for(const o of l)new RegExp(`(?<![\\w@/])${ue(o)}(?![\\w/])`,"i").test(r)&&(!a||o.length>a.matchedText.length)&&(a={agentId:i.agentId,matchedText:o})}return a}s(Ve,"findPlainAgentNameCandidate");function ce(e){return!e||e==="__none__"?{kind:"none",id:null}:e.startsWith("agent:")?{kind:"agent",id:e.slice(6)||null}:e.startsWith("user:")?{kind:"user",id:e.slice(5)||null}:{kind:"none",id:null}}s(ce,"parseReassignValue");function Ye(e){if(e.reassignTarget!==e.currentAssigneeValue){const t=ce(e.reassignTarget);return t.kind==="agent"&&t.id?e.hasActiveRun?{kind:"interrupt_handoff_agent",tone:"neutral",text:"Interrupt current run, hand off to",chip:{kind:"agent",id:t.id}}:{kind:"wake_agent",tone:"neutral",text:"Wake",chip:{kind:"agent",id:t.id}}:t.kind==="user"&&t.id?{kind:"user_handoff",tone:"neutral",text:"Hand off to",chip:{kind:"user",id:t.id},suffix:"— no agent will be notified"}:{kind:"clear_assignee",tone:"neutral",text:"Clear responsible — no agent will be notified"}}return e.bodyHasAgentMention?{kind:"notify_agent",tone:"neutral",text:"Notify",chip:e.mentionedAgentId?{kind:"agent",id:e.mentionedAgentId}:void 0,suffix:e.mentionedAgentId?void 0:"the mentioned agent"}:e.plainNameCandidate?{kind:"plain_text_only",tone:"warn",text:"No agent will be notified. Use @ to mention an agent."}:{kind:"none",tone:"neutral",text:""}}s(Ye,"computeComposerHandoffPreview");function me(e,t={}){return e.agentId?{kind:"agent_wake",wakeText:`queued for ${t.agentName??"the responsible agent"}${t.interruptedRunAttached?" (interrupted run attached)":""}`}:e.userId?{kind:"user_handoff",wakeText:"not created — this is a handoff to a board user"}:{kind:"unassigned",wakeText:"not created — no agent selected. Mention @agent or pick a responsible to dispatch."}}s(me,"classifyAssigneeHandoff");function Ge(e={}){return{banner:`${e.runningAgentName?.trim()||"An agent"} is running — changing the responsible will interrupt this run.`,confirmTitle:"Interrupt the current run?",confirmAction:"Interrupt & assign",cancelAction:"Cancel"}}s(Ge,"describeReassignInterrupt");var n=y($(),1);function _(e,t){return t.agentMap?.get(e)?.name??e.slice(0,8)}s(_,"agentName");function fe(e,t){const r=t.resolveUserLabel?.(e)??null??"Board";return t.currentUserId&&t.currentUserId===e?`${r} (you)`:r}s(fe,"userLabel");var h="inline-flex items-center gap-1 rounded-full border border-line bg-bg-3/40 px-2 py-0.5 text-xs";function I({assignee:e,resolvers:t,className:r}){return e.agentId?(0,n.jsxs)("span",{className:u(h,r),"data-testid":"handoff-assignee-chip","data-kind":"agent",children:[(0,n.jsx)("span",{className:"sr-only",children:"Agent "}),(0,n.jsx)(te,{agent:{...t.agentMap?.get(e.agentId),id:e.agentId},size:16}),(0,n.jsx)("span",{className:"max-w-(--sz-12rem) truncate",children:_(e.agentId,t)})]}):e.userId?(0,n.jsxs)("span",{className:u(h,r),"data-testid":"handoff-assignee-chip","data-kind":"user",children:[(0,n.jsx)("span",{className:"sr-only",children:"User "}),(0,n.jsx)(Y,{className:"h-3 w-3 shrink-0 text-ink-3"}),(0,n.jsx)("span",{className:"max-w-(--sz-12rem) truncate",children:fe(e.userId,t)})]}):(0,n.jsxs)("span",{className:u("text-xs italic text-ink-3",r),"data-testid":"handoff-assignee-chip","data-kind":"unassigned",children:[(0,n.jsx)("span",{className:"sr-only",children:"No responsible — "}),"Unassigned"]})}s(I,"AssigneeChip");function Ze({to:e,resolvers:t,interruptedRunAttached:r=!1}){const a=me(e,{agentName:e.agentId?_(e.agentId,t):null,interruptedRunAttached:r});return(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 text-xs","data-testid":"handoff-wake-row","data-kind":a.kind,children:[(0,n.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-ink-3",children:"Wake"}),(0,n.jsx)("span",{className:u(a.kind==="agent_wake"?"text-ink":"text-ink-3"),children:a.wakeText})]})}s(Ze,"HandoffWakeRow");function Je({status:e,operatorInterrupted:t=!1,className:r}){const a=de(e,{operatorInterrupted:t});return(0,n.jsxs)("span",{className:u("font-medium",a.className,r),"data-testid":"run-status-badge","data-interrupted":t?"true":"false",children:[a.label,a.srHint?(0,n.jsxs)("span",{className:"sr-only",children:[" — ",a.srHint]}):null]})}s(Je,"RunStatusBadge");function xe({chip:e,resolvers:t}){return(0,n.jsx)(I,{assignee:e.kind==="agent"?{agentId:e.id,userId:null}:{agentId:null,userId:e.id},resolvers:t})}s(xe,"PreviewChip");function et({preview:e,resolvers:t}){return e.kind==="none"?null:(0,n.jsxs)("div",{className:u("flex flex-wrap items-center justify-end gap-1.5 text-xs",e.tone==="warn"?"text-amber-700 dark:text-amber-300":"text-ink-3"),"data-testid":"composer-handoff-preview","data-kind":e.kind,role:"status","aria-live":"polite",children:[(0,n.jsx)("span",{children:e.text}),e.chip?(0,n.jsx)(xe,{chip:e.chip,resolvers:t}):null,e.suffix?(0,n.jsx)("span",{children:e.suffix}):null]})}s(et,"ComposerHandoffPreviewRow");function tt({candidate:e,agentDisplayName:t,onInsert:r,onDismiss:a}){return(0,n.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-amber-300/40 bg-amber-50/70 px-2 py-1.5 text-xs text-amber-700 dark:bg-amber-500/10 dark:text-amber-300","data-testid":"composer-mention-coach",role:"alert","aria-live":"polite",children:[(0,n.jsx)(Q,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,n.jsxs)("span",{className:"min-w-0 flex-1",children:["Did you mean ",(0,n.jsxs)("span",{className:"font-medium",children:["@",e.matchedText]}),"? Plain text won't notify or assign an agent."]}),(0,n.jsx)(x,{variant:"secondary",size:"xs",className:"shrink-0",type:"button",onClick:r,"aria-label":`Insert mention for ${t} into your comment`,children:"Insert mention"}),(0,n.jsx)("button",{type:"button",onClick:a,className:"shrink-0 rounded p-0.5 hover:bg-amber-100/60 dark:hover:bg-amber-500/20","aria-label":"Dismiss suggestion",children:(0,n.jsx)(G,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}s(tt,"ComposerMentionCoach");function nt({copy:e,className:t}){return(0,n.jsxs)("div",{role:"status","aria-live":"polite","data-testid":"assignee-running-banner",className:u("flex items-start gap-1.5 rounded-md border border-amber-300/40 bg-amber-50/70 px-2 py-1.5 text-xs text-amber-700 dark:bg-amber-500/10 dark:text-amber-300",t),children:[(0,n.jsx)(j,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,n.jsx)("span",{className:"min-w-0 flex-1",children:e.banner})]})}s(nt,"AssigneeRunningBanner");function rt({copy:e,to:t,resolvers:r,onConfirm:a,onCancel:i}){return(0,n.jsxs)("div",{"data-testid":"interrupt-assign-confirm",className:"space-y-2 rounded-md border border-amber-300/40 bg-amber-50/70 p-2 text-xs text-amber-700 dark:bg-amber-500/10 dark:text-amber-300",children:[(0,n.jsxs)("div",{className:"flex items-start gap-1.5",children:[(0,n.jsx)(j,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,n.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,n.jsx)("p",{className:"font-medium",children:e.confirmTitle}),(0,n.jsxs)("p",{className:"flex flex-wrap items-center gap-1 text-amber-700/90 dark:text-amber-300/90",children:[(0,n.jsx)("span",{children:"Hand off to"}),(0,n.jsx)(I,{assignee:t,resolvers:r})]})]})]}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(x,{variant:"secondary",size:"xs",type:"button",onClick:i,children:e.cancelAction}),(0,n.jsx)(x,{variant:"primary",size:"xs",type:"button",onClick:a,"data-testid":"interrupt-assign-confirm-action",children:e.confirmAction})]})]})}s(rt,"InterruptAssignConfirm");var pe=y(P(),1);function b(e){return e instanceof N?typeof e.message=="string"&&e.message.trim().length>0?e.message:`Request failed (${e.status})`:e instanceof Error&&e.message?e.message:"The request failed. Try again in a moment."}s(b,"readErrorMessage");var k={promoted:"Retry promoted",already_promoted:"Retry already running",waiting:"Retry waiting",no_scheduled_retry:"No scheduled retry",gate_suppressed:"Couldn't retry now",blocked:"Couldn't retry now"};function ge(e,t){const r=U(e,t);return[...new Set([t,...r?z(r):[]])]}s(ge,"issueCacheRefs");function he(e){const t=H(),{pushToast:r}=ne(),a=q({mutationFn:s(()=>{if(!e)throw new Error("Missing issue id");return B.retryScheduledRetryNow(e)},"mutationFn"),onSuccess:s(d=>{if(e)for(const c of ge(t,e))t.invalidateQueries({queryKey:m.issues.detail(c)}),t.invalidateQueries({queryKey:m.issues.activity(c)}),t.invalidateQueries({queryKey:m.issues.runs(c)}),t.invalidateQueries({queryKey:m.issues.liveRuns(c)}),t.invalidateQueries({queryKey:m.issues.activeRun(c)});d.outcome==="promoted"?r({title:k.promoted,body:d.message,tone:"success"}):(d.outcome==="gate_suppressed"||d.outcome==="blocked")&&r({title:k[d.outcome],body:d.message,tone:"error"})},"onSuccess"),onError:s(d=>{r({title:"Couldn't retry now",body:b(d),tone:"error"})},"onError")}),i=a.reset,l=(0,pe.useCallback)(()=>i(),[i]),o=(()=>{if(a.error){const d=a.error instanceof N?a.error:null;return{message:b(a.error),outcomeMessage:null,status:d?.status??null}}return a.data&&(a.data.outcome==="gate_suppressed"||a.data.outcome==="blocked")?{message:a.data.message,outcomeMessage:a.data.message,status:null}:null})();return{...a,reset:l,lastError:o}}s(he,"useRetryNowMutation");var be="max_turns_continuation";function ke(e){return e===be}s(ke,"isContinuationReason");function ye(e){return typeof e=="string"&&e.length>=8?e.slice(0,8):e??""}s(ye,"shortRunId");function at({issueId:e,scheduledRetry:t}){const r=he(e);if(!t||!e||t.status!=="scheduled_retry")return null;if(t.scheduledRetryReason==="workspace_busy")return(0,n.jsx)(re,{tone:"info",icon:g,title:"Waiting for workspace",className:"mb-3",children:"Another task is using this workspace. Work starts automatically when it is available."});const a=ke(t.scheduledRetryReason),i=t.scheduledRetryAt?new Date(t.scheduledRetryAt).toISOString():null,l=i?ae(i):null,o=t.scheduledRetryAt?M(t.scheduledRetryAt):null,d=ie(t.scheduledRetryReason),c=typeof t.scheduledRetryAttempt=="number"&&Number.isFinite(t.scheduledRetryAttempt)&&t.scheduledRetryAttempt>0?t.scheduledRetryAttempt:null,v=a?"Continuation scheduled":"Retry scheduled",C=a?"Automatic continuation":"Automatic retry";let f;l==="now"?f="due now":l?f=l:f="pending schedule";const R=`${C} ${f}`,T=a?"Pulls continuation forward immediately":"Pulls retry forward immediately",E=r.isError||r.lastError!==null,p=r.isSuccess&&(r.data?.outcome==="promoted"||r.data?.outcome==="already_promoted");return(0,n.jsx)("div",{"data-testid":"issue-scheduled-retry-card",className:"mb-3 rounded-lg border border-blue-500/30 bg-blue-500/5 px-3 py-3",children:(0,n.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(0,n.jsxs)(w,{variant:"outline",className:"border-blue-500/30 bg-blue-500/10 text-blue-700 dark:text-blue-300",children:[(0,n.jsx)(g,{className:"h-3 w-3","aria-hidden":"true"}),v]}),c!==null?(0,n.jsxs)("span",{className:"text-ink-3",children:["Attempt ",c]}):null,d?(0,n.jsx)("span",{className:"text-ink-3",children:d}):null]}),(0,n.jsx)("div",{className:"mt-1 text-sm font-medium text-ink",children:R}),o||t.retryOfRunId?(0,n.jsxs)("div",{className:"mt-0.5 text-xs text-ink-3",children:[o?(0,n.jsx)("span",{children:o}):null,o&&t.retryOfRunId?(0,n.jsx)("span",{children:" · "}):null,t.retryOfRunId?(0,n.jsxs)("span",{children:["Replaces run"," ",(0,n.jsx)(W,{to:`/agents/${t.agentId}/runs/${t.retryOfRunId}`,className:"font-mono text-ink hover:underline",children:ye(t.retryOfRunId)})]}):null]}):null,t.error?(0,n.jsxs)("div",{className:"mt-1 text-xs text-ink-3",children:["Last attempt failed: ",t.error,/[.!?]$/.test(t.error.trim())?"":"."," Wardmote will retry automatically."]}):null,E?(0,n.jsx)(Ne,{error:r.lastError,onRetry:s(()=>{r.reset(),r.mutate()},"onRetry")}):null]}),(0,n.jsxs)("div",{className:"flex flex-col items-stretch gap-1 sm:items-end",children:[(0,n.jsx)(x,{type:"button",variant:"secondary",size:"sm",className:"shrink-0 shadow-none",onClick:s(()=>r.mutate(),"onClick"),disabled:r.isPending||p,"data-testid":"issue-scheduled-retry-card-retry-now",children:r.isPending?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,n.jsx)(X,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":"true"}),"Retrying…"]}):p?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,n.jsx)(O,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.data?.outcome==="already_promoted"?"Already promoted":"Promoted"]}):(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,n.jsx)(F,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Retry now"]})}),(0,n.jsx)("span",{className:"text-right text-xs text-ink-3 sm:max-w-(--sz-12rem)",children:r.isPending?"Promoting scheduled retry":p?r.data?.outcome==="already_promoted"?"Already promoted — run starting":"Promoted — run starting":r.data?.outcome==="waiting"&&r.data.scheduledRetry?.runId===t.runId?r.data.message:T})]})]})})}s(at,"IssueScheduledRetryCard");function Ne({error:e,onRetry:t,className:r}){return e?(0,n.jsxs)("div",{className:u("mt-2 flex items-start gap-2 rounded-md border border-rose-500/30 bg-rose-500/5 px-2 py-1.5 text-xs text-rose-700 dark:text-rose-300",r),role:"alert","data-testid":"issue-scheduled-retry-error-band",children:[(0,n.jsx)(K,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("div",{className:"font-medium",children:"Couldn't retry now"}),(0,n.jsx)("div",{className:"mt-0.5 text-ink-3",children:e.message})]}),(0,n.jsx)("button",{type:"button",onClick:t,className:"shrink-0 font-medium text-rose-700 hover:underline dark:text-rose-300",children:"Try again"})]}):null}s(Ne,"RetryErrorBand");function st({sourceTrust:e,artifactLabel:t="content",className:r}){const a=se(e);if(!a)return null;const i=e?.disposition==="promoted",l=i?`Promoted from low-trust${e.promotedAt?` on ${new Date(e.promotedAt).toLocaleString()}`:""}.`:`Authored by a low-trust review agent. Raw ${t} is not auto-shared with higher-trust agents.`;return(0,n.jsxs)(ee,{children:[(0,n.jsx)(Z,{asChild:!0,children:(0,n.jsxs)(w,{variant:"outline","aria-label":a,className:u("inline-flex items-center gap-1 whitespace-nowrap px-1.5 py-0 text-(length:--text-nano) font-medium tracking-normal",i?"border-line text-ink-3":"border-amber-500/40 text-amber-700 dark:text-amber-100",r),children:[i?(0,n.jsx)(D,{className:"h-3 w-3"}):(0,n.jsx)(V,{className:"h-3 w-3"}),a]})}),(0,n.jsx)(J,{className:"max-w-xs text-xs",children:l})]})}s(st,"SourceTrustBadge");export{I as a,tt as c,Je as d,Ye as f,Xe as g,Ve as h,he as i,Ze as l,Fe as m,at as n,nt as o,Ge as p,Ne as r,et as s,st as t,rt as u};
|
|
1
|
+
var S=Object.defineProperty;var s=(e,t)=>S(e,"name",{value:t,configurable:!0});import{i as y}from"./rolldown-runtime-ZpX3ckPj.js";import{h as M,l as u,la as $,ua as P}from"./createLucideIcon-CgrPXnTY.js";import{a as O}from"./star-eem0qj3E.js";import{X as H,_ as q,n as N,t as m}from"./queryKeys-BzT8CD34.js";import{nt as L}from"./mention-chips-COg-185l.js";import{bt as U,t as W,xt as z,zt as B}from"./router-CJbFZfVR.js";import{t as D}from"./badge-check-BNLpGDnd.js";import{t as K}from"./circle-alert-C7T1cdKm.js";import{t as g}from"./clock-D2UFngg7.js";import{t as Q}from"./info-Clx4FKz9.js";import{r as X,t as x}from"./button-DI4w5WP7.js";import{t as F}from"./rotate-ccw-DpzLJhXT.js";import{t as V}from"./shield-alert-BAXWoBTh.js";import{t as j}from"./triangle-alert-CnHMpmva.js";import{t as Y}from"./user-D5V640s5.js";import{t as G}from"./x-6E1yeU3Q.js";import{i as Z,n as J,t as ee}from"./tooltip-CW50mEoC.js";import{t as w}from"./badge-jeXr866I.js";import{t as te}from"./AgentAvatar-BZiiDlCN.js";import{a as ne}from"./ToastContext-DyVJ6bCh.js";import{t as re}from"./InlineBanner-DeTqU5Gp.js";import{_ as ae}from"./issue-blockers-t3wlvg4M.js";import{Rn as se}from"./index-QhteFtm-.js";import{n as ie}from"./runRetryState-p_i4Mh7u.js";function Xe(e,t){return t==="operator_interrupted"?!0:!e||typeof e!="object"?!1:e.operatorInterrupted===!0?!0:e.interruptionSource==="issue_comment_interrupt"}s(Xe,"isOperatorInterruptedRun");function oe(e){switch(e){case"succeeded":return"text-green-700 dark:text-green-300";case"failed":case"error":return"text-red-700 dark:text-red-300";case"timed_out":return"text-orange-700 dark:text-orange-300";case"running":return"text-blue-700 dark:text-blue-300";case"queued":case"pending":return"text-amber-700 dark:text-amber-300";case"cancelled":return"text-ink-3";default:return"text-ink"}}s(oe,"runStatusClassName");function de(e,t={}){return e==="cancelled"&&t.operatorInterrupted?{label:"interrupted",className:"text-amber-700 dark:text-amber-300",srHint:"interrupted by board comment"}:{label:e==="timed_out"?"timed out":e.replace(/_/g," "),className:oe(e),srHint:null}}s(de,"resolveRunStatusPresentation");var A=/\[[^\]]*\]\(([^)]*)\)/g;function Fe(e){const t=[];if(!e)return t;for(const r of e.matchAll(A)){const a=r[1]??"",i=L(a);i?.agentId&&!t.includes(i.agentId)&&t.push(i.agentId)}return t}s(Fe,"extractAgentMentionIds");function le(e){return e.replace(A," ")}s(le,"plainTextOutsideLinks");function ue(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}s(ue,"escapeRegExp");function Ve(e,t){if(!e.trim()||t.length===0)return null;const r=le(e);let a=null;for(const i of t){const l=[i.name,i.role??""].filter(o=>o&&o.trim().length>=2);for(const o of l)new RegExp(`(?<![\\w@/])${ue(o)}(?![\\w/])`,"i").test(r)&&(!a||o.length>a.matchedText.length)&&(a={agentId:i.agentId,matchedText:o})}return a}s(Ve,"findPlainAgentNameCandidate");function ce(e){return!e||e==="__none__"?{kind:"none",id:null}:e.startsWith("agent:")?{kind:"agent",id:e.slice(6)||null}:e.startsWith("user:")?{kind:"user",id:e.slice(5)||null}:{kind:"none",id:null}}s(ce,"parseReassignValue");function Ye(e){if(e.reassignTarget!==e.currentAssigneeValue){const t=ce(e.reassignTarget);return t.kind==="agent"&&t.id?e.hasActiveRun?{kind:"interrupt_handoff_agent",tone:"neutral",text:"Interrupt current run, hand off to",chip:{kind:"agent",id:t.id}}:{kind:"wake_agent",tone:"neutral",text:"Wake",chip:{kind:"agent",id:t.id}}:t.kind==="user"&&t.id?{kind:"user_handoff",tone:"neutral",text:"Hand off to",chip:{kind:"user",id:t.id},suffix:"— no agent will be notified"}:{kind:"clear_assignee",tone:"neutral",text:"Clear responsible — no agent will be notified"}}return e.bodyHasAgentMention?{kind:"notify_agent",tone:"neutral",text:"Notify",chip:e.mentionedAgentId?{kind:"agent",id:e.mentionedAgentId}:void 0,suffix:e.mentionedAgentId?void 0:"the mentioned agent"}:e.plainNameCandidate?{kind:"plain_text_only",tone:"warn",text:"No agent will be notified. Use @ to mention an agent."}:{kind:"none",tone:"neutral",text:""}}s(Ye,"computeComposerHandoffPreview");function me(e,t={}){return e.agentId?{kind:"agent_wake",wakeText:`queued for ${t.agentName??"the responsible agent"}${t.interruptedRunAttached?" (interrupted run attached)":""}`}:e.userId?{kind:"user_handoff",wakeText:"not created — this is a handoff to a board user"}:{kind:"unassigned",wakeText:"not created — no agent selected. Mention @agent or pick a responsible to dispatch."}}s(me,"classifyAssigneeHandoff");function Ge(e={}){return{banner:`${e.runningAgentName?.trim()||"An agent"} is running — changing the responsible will interrupt this run.`,confirmTitle:"Interrupt the current run?",confirmAction:"Interrupt & assign",cancelAction:"Cancel"}}s(Ge,"describeReassignInterrupt");var n=y($(),1);function _(e,t){return t.agentMap?.get(e)?.name??e.slice(0,8)}s(_,"agentName");function fe(e,t){const r=t.resolveUserLabel?.(e)??null??"Board";return t.currentUserId&&t.currentUserId===e?`${r} (you)`:r}s(fe,"userLabel");var h="inline-flex items-center gap-1 rounded-full border border-line bg-bg-3/40 px-2 py-0.5 text-xs";function I({assignee:e,resolvers:t,className:r}){return e.agentId?(0,n.jsxs)("span",{className:u(h,r),"data-testid":"handoff-assignee-chip","data-kind":"agent",children:[(0,n.jsx)("span",{className:"sr-only",children:"Agent "}),(0,n.jsx)(te,{agent:{...t.agentMap?.get(e.agentId),id:e.agentId},size:16}),(0,n.jsx)("span",{className:"max-w-(--sz-12rem) truncate",children:_(e.agentId,t)})]}):e.userId?(0,n.jsxs)("span",{className:u(h,r),"data-testid":"handoff-assignee-chip","data-kind":"user",children:[(0,n.jsx)("span",{className:"sr-only",children:"User "}),(0,n.jsx)(Y,{className:"h-3 w-3 shrink-0 text-ink-3"}),(0,n.jsx)("span",{className:"max-w-(--sz-12rem) truncate",children:fe(e.userId,t)})]}):(0,n.jsxs)("span",{className:u("text-xs italic text-ink-3",r),"data-testid":"handoff-assignee-chip","data-kind":"unassigned",children:[(0,n.jsx)("span",{className:"sr-only",children:"No responsible — "}),"Unassigned"]})}s(I,"AssigneeChip");function Ze({to:e,resolvers:t,interruptedRunAttached:r=!1}){const a=me(e,{agentName:e.agentId?_(e.agentId,t):null,interruptedRunAttached:r});return(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 text-xs","data-testid":"handoff-wake-row","data-kind":a.kind,children:[(0,n.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-ink-3",children:"Wake"}),(0,n.jsx)("span",{className:u(a.kind==="agent_wake"?"text-ink":"text-ink-3"),children:a.wakeText})]})}s(Ze,"HandoffWakeRow");function Je({status:e,operatorInterrupted:t=!1,className:r}){const a=de(e,{operatorInterrupted:t});return(0,n.jsxs)("span",{className:u("font-medium",a.className,r),"data-testid":"run-status-badge","data-interrupted":t?"true":"false",children:[a.label,a.srHint?(0,n.jsxs)("span",{className:"sr-only",children:[" — ",a.srHint]}):null]})}s(Je,"RunStatusBadge");function xe({chip:e,resolvers:t}){return(0,n.jsx)(I,{assignee:e.kind==="agent"?{agentId:e.id,userId:null}:{agentId:null,userId:e.id},resolvers:t})}s(xe,"PreviewChip");function et({preview:e,resolvers:t}){return e.kind==="none"?null:(0,n.jsxs)("div",{className:u("flex flex-wrap items-center justify-end gap-1.5 text-xs",e.tone==="warn"?"text-amber-700 dark:text-amber-300":"text-ink-3"),"data-testid":"composer-handoff-preview","data-kind":e.kind,role:"status","aria-live":"polite",children:[(0,n.jsx)("span",{children:e.text}),e.chip?(0,n.jsx)(xe,{chip:e.chip,resolvers:t}):null,e.suffix?(0,n.jsx)("span",{children:e.suffix}):null]})}s(et,"ComposerHandoffPreviewRow");function tt({candidate:e,agentDisplayName:t,onInsert:r,onDismiss:a}){return(0,n.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-amber-300/40 bg-amber-50/70 px-2 py-1.5 text-xs text-amber-700 dark:bg-amber-500/10 dark:text-amber-300","data-testid":"composer-mention-coach",role:"alert","aria-live":"polite",children:[(0,n.jsx)(Q,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,n.jsxs)("span",{className:"min-w-0 flex-1",children:["Did you mean ",(0,n.jsxs)("span",{className:"font-medium",children:["@",e.matchedText]}),"? Plain text won't notify or assign an agent."]}),(0,n.jsx)(x,{variant:"secondary",size:"xs",className:"shrink-0",type:"button",onClick:r,"aria-label":`Insert mention for ${t} into your comment`,children:"Insert mention"}),(0,n.jsx)("button",{type:"button",onClick:a,className:"shrink-0 rounded p-0.5 hover:bg-amber-100/60 dark:hover:bg-amber-500/20","aria-label":"Dismiss suggestion",children:(0,n.jsx)(G,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}s(tt,"ComposerMentionCoach");function nt({copy:e,className:t}){return(0,n.jsxs)("div",{role:"status","aria-live":"polite","data-testid":"assignee-running-banner",className:u("flex items-start gap-1.5 rounded-md border border-amber-300/40 bg-amber-50/70 px-2 py-1.5 text-xs text-amber-700 dark:bg-amber-500/10 dark:text-amber-300",t),children:[(0,n.jsx)(j,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,n.jsx)("span",{className:"min-w-0 flex-1",children:e.banner})]})}s(nt,"AssigneeRunningBanner");function rt({copy:e,to:t,resolvers:r,onConfirm:a,onCancel:i}){return(0,n.jsxs)("div",{"data-testid":"interrupt-assign-confirm",className:"space-y-2 rounded-md border border-amber-300/40 bg-amber-50/70 p-2 text-xs text-amber-700 dark:bg-amber-500/10 dark:text-amber-300",children:[(0,n.jsxs)("div",{className:"flex items-start gap-1.5",children:[(0,n.jsx)(j,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),(0,n.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,n.jsx)("p",{className:"font-medium",children:e.confirmTitle}),(0,n.jsxs)("p",{className:"flex flex-wrap items-center gap-1 text-amber-700/90 dark:text-amber-300/90",children:[(0,n.jsx)("span",{children:"Hand off to"}),(0,n.jsx)(I,{assignee:t,resolvers:r})]})]})]}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(x,{variant:"secondary",size:"xs",type:"button",onClick:i,children:e.cancelAction}),(0,n.jsx)(x,{variant:"primary",size:"xs",type:"button",onClick:a,"data-testid":"interrupt-assign-confirm-action",children:e.confirmAction})]})]})}s(rt,"InterruptAssignConfirm");var pe=y(P(),1);function b(e){return e instanceof N?typeof e.message=="string"&&e.message.trim().length>0?e.message:`Request failed (${e.status})`:e instanceof Error&&e.message?e.message:"The request failed. Try again in a moment."}s(b,"readErrorMessage");var k={promoted:"Retry promoted",already_promoted:"Retry already running",waiting:"Retry waiting",no_scheduled_retry:"No scheduled retry",gate_suppressed:"Couldn't retry now",blocked:"Couldn't retry now"};function ge(e,t){const r=U(e,t);return[...new Set([t,...r?z(r):[]])]}s(ge,"issueCacheRefs");function he(e){const t=H(),{pushToast:r}=ne(),a=q({mutationFn:s(()=>{if(!e)throw new Error("Missing issue id");return B.retryScheduledRetryNow(e)},"mutationFn"),onSuccess:s(d=>{if(e)for(const c of ge(t,e))t.invalidateQueries({queryKey:m.issues.detail(c)}),t.invalidateQueries({queryKey:m.issues.activity(c)}),t.invalidateQueries({queryKey:m.issues.runs(c)}),t.invalidateQueries({queryKey:m.issues.liveRuns(c)}),t.invalidateQueries({queryKey:m.issues.activeRun(c)});d.outcome==="promoted"?r({title:k.promoted,body:d.message,tone:"success"}):(d.outcome==="gate_suppressed"||d.outcome==="blocked")&&r({title:k[d.outcome],body:d.message,tone:"error"})},"onSuccess"),onError:s(d=>{r({title:"Couldn't retry now",body:b(d),tone:"error"})},"onError")}),i=a.reset,l=(0,pe.useCallback)(()=>i(),[i]),o=(()=>{if(a.error){const d=a.error instanceof N?a.error:null;return{message:b(a.error),outcomeMessage:null,status:d?.status??null}}return a.data&&(a.data.outcome==="gate_suppressed"||a.data.outcome==="blocked")?{message:a.data.message,outcomeMessage:a.data.message,status:null}:null})();return{...a,reset:l,lastError:o}}s(he,"useRetryNowMutation");var be="max_turns_continuation";function ke(e){return e===be}s(ke,"isContinuationReason");function ye(e){return typeof e=="string"&&e.length>=8?e.slice(0,8):e??""}s(ye,"shortRunId");function at({issueId:e,scheduledRetry:t}){const r=he(e);if(!t||!e||t.status!=="scheduled_retry")return null;if(t.scheduledRetryReason==="workspace_busy")return(0,n.jsx)(re,{tone:"info",icon:g,title:"Waiting for workspace",className:"mb-3",children:"Another task is using this workspace. Work starts automatically when it is available."});const a=ke(t.scheduledRetryReason),i=t.scheduledRetryAt?new Date(t.scheduledRetryAt).toISOString():null,l=i?ae(i):null,o=t.scheduledRetryAt?M(t.scheduledRetryAt):null,d=ie(t.scheduledRetryReason),c=typeof t.scheduledRetryAttempt=="number"&&Number.isFinite(t.scheduledRetryAttempt)&&t.scheduledRetryAttempt>0?t.scheduledRetryAttempt:null,v=a?"Continuation scheduled":"Retry scheduled",C=a?"Automatic continuation":"Automatic retry";let f;l==="now"?f="due now":l?f=l:f="pending schedule";const R=`${C} ${f}`,T=a?"Pulls continuation forward immediately":"Pulls retry forward immediately",E=r.isError||r.lastError!==null,p=r.isSuccess&&(r.data?.outcome==="promoted"||r.data?.outcome==="already_promoted");return(0,n.jsx)("div",{"data-testid":"issue-scheduled-retry-card",className:"mb-3 rounded-lg border border-blue-500/30 bg-blue-500/5 px-3 py-3",children:(0,n.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[(0,n.jsxs)(w,{variant:"outline",className:"border-blue-500/30 bg-blue-500/10 text-blue-700 dark:text-blue-300",children:[(0,n.jsx)(g,{className:"h-3 w-3","aria-hidden":"true"}),v]}),c!==null?(0,n.jsxs)("span",{className:"text-ink-3",children:["Attempt ",c]}):null,d?(0,n.jsx)("span",{className:"text-ink-3",children:d}):null]}),(0,n.jsx)("div",{className:"mt-1 text-sm font-medium text-ink",children:R}),o||t.retryOfRunId?(0,n.jsxs)("div",{className:"mt-0.5 text-xs text-ink-3",children:[o?(0,n.jsx)("span",{children:o}):null,o&&t.retryOfRunId?(0,n.jsx)("span",{children:" · "}):null,t.retryOfRunId?(0,n.jsxs)("span",{children:["Replaces run"," ",(0,n.jsx)(W,{to:`/agents/${t.agentId}/runs/${t.retryOfRunId}`,className:"font-mono text-ink hover:underline",children:ye(t.retryOfRunId)})]}):null]}):null,t.error?(0,n.jsxs)("div",{className:"mt-1 text-xs text-ink-3",children:["Last attempt failed: ",t.error,/[.!?]$/.test(t.error.trim())?"":"."," Wardmote will retry automatically."]}):null,E?(0,n.jsx)(Ne,{error:r.lastError,onRetry:s(()=>{r.reset(),r.mutate()},"onRetry")}):null]}),(0,n.jsxs)("div",{className:"flex flex-col items-stretch gap-1 sm:items-end",children:[(0,n.jsx)(x,{type:"button",variant:"secondary",size:"sm",className:"shrink-0 shadow-none",onClick:s(()=>r.mutate(),"onClick"),disabled:r.isPending||p,"data-testid":"issue-scheduled-retry-card-retry-now",children:r.isPending?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,n.jsx)(X,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":"true"}),"Retrying…"]}):p?(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,n.jsx)(O,{className:"h-3.5 w-3.5","aria-hidden":"true"}),r.data?.outcome==="already_promoted"?"Already promoted":"Promoted"]}):(0,n.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,n.jsx)(F,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Retry now"]})}),(0,n.jsx)("span",{className:"text-right text-xs text-ink-3 sm:max-w-(--sz-12rem)",children:r.isPending?"Promoting scheduled retry":p?r.data?.outcome==="already_promoted"?"Already promoted — run starting":"Promoted — run starting":r.data?.outcome==="waiting"&&r.data.scheduledRetry?.runId===t.runId?r.data.message:T})]})]})})}s(at,"IssueScheduledRetryCard");function Ne({error:e,onRetry:t,className:r}){return e?(0,n.jsxs)("div",{className:u("mt-2 flex items-start gap-2 rounded-md border border-rose-500/30 bg-rose-500/5 px-2 py-1.5 text-xs text-rose-700 dark:text-rose-300",r),role:"alert","data-testid":"issue-scheduled-retry-error-band",children:[(0,n.jsx)(K,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("div",{className:"font-medium",children:"Couldn't retry now"}),(0,n.jsx)("div",{className:"mt-0.5 text-ink-3",children:e.message})]}),(0,n.jsx)("button",{type:"button",onClick:t,className:"shrink-0 font-medium text-rose-700 hover:underline dark:text-rose-300",children:"Try again"})]}):null}s(Ne,"RetryErrorBand");function st({sourceTrust:e,artifactLabel:t="content",className:r}){const a=se(e);if(!a)return null;const i=e?.disposition==="promoted",l=i?`Promoted from low-trust${e.promotedAt?` on ${new Date(e.promotedAt).toLocaleString()}`:""}.`:`Authored by a low-trust review agent. Raw ${t} is not auto-shared with higher-trust agents.`;return(0,n.jsxs)(ee,{children:[(0,n.jsx)(Z,{asChild:!0,children:(0,n.jsxs)(w,{variant:"outline","aria-label":a,className:u("inline-flex items-center gap-1 whitespace-nowrap px-1.5 py-0 text-(length:--text-nano) font-medium tracking-normal",i?"border-line text-ink-3":"border-amber-500/40 text-amber-700 dark:text-amber-100",r),children:[i?(0,n.jsx)(D,{className:"h-3 w-3"}):(0,n.jsx)(V,{className:"h-3 w-3"}),a]})}),(0,n.jsx)(J,{className:"max-w-xs text-xs",children:l})]})}s(st,"SourceTrustBadge");export{I as a,tt as c,Je as d,Ye as f,Xe as g,Ve as h,he as i,Ze as l,Fe as m,at as n,nt as o,Ge as p,Ne as r,et as s,st as t,rt as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var We=Object.defineProperty;var t=(s,r)=>We(s,"name",{value:r,configurable:!0});import{i as Me}from"./rolldown-runtime-ZpX3ckPj.js";import{O as F,h as ie,jr as Ge,l as A,la as Je,ua as Xe}from"./createLucideIcon-CgrPXnTY.js";import{c as Y,v as Ye}from"./star-eem0qj3E.js";import{X as be,_ as R,r as I,t as v,v as _}from"./queryKeys-BzT8CD34.js";import{n as Ze}from"./CompanyContext-fQCNWI_f.js";import{Ut as es,o as ss}from"./router-BKzUF9uf.js";import{n as Pe,r as $e,t as qe}from"./collapsible-D_rwONtV.js";import{t as Se}from"./checkbox-Cf2_HXDG.js";import{c as ts,i as Q,p as as,r as ns,t as is}from"./dropdown-menu-rUbU8QKw.js";import{i as ae,n as ne,r as rs,t as ls}from"./tabs-CjHzZxtD.js";import{t as Re}from"./chevron-down-nRcQ7bok.js";import{t as W}from"./MarkdownBody-D7qCQaU_.js";import{t as os}from"./ellipsis-DyXbAp4P.js";import{t as xe}from"./external-link-BIcMNNSN.js";import{t as Te}from"./flask-conical-BxspRG7d.js";import{r as E,t as M}from"./button-DI4w5WP7.js";import{t as ds}from"./plus-CwNlqadt.js";import{t as _e}from"./refresh-cw-CfzWP9se.js";import{t as pe}from"./triangle-alert-CnHMpmva.js";import{t as Be}from"./wand-sparkles-CONrztQy.js";import{i as cs,n as us,t as ms}from"./tooltip-CW50mEoC.js";import{t as re}from"./badge-jeXr866I.js";import{t as hs}from"./AgentAvatar-BZiiDlCN.js";import{t as xs}from"./agents-B8n-p0aX.js";import{a as ps,i as gs,n as fs,r as ys,s as js,t as vs}from"./dialog-CeH7rDcv.js";import{t as V}from"./input-BBNGmECW.js";import{n as bs}from"./BreadcrumbContext-DNbB7zWn.js";import{t as De}from"./textarea-CTx68BDs.js";import{t as Ns}from"./InlineEntitySelector-BboofK18.js";import{t as G}from"./InlineBanner-DYx7A02D.js";import{a as Cs,i as le,n as ge,o as fe,r as ye,s as je}from"./select-DNiRU1d9.js";import{Cn as ve,Pa as ks,T as ws,eo as Ss,or as Ts}from"./index-D1wQsid4.js";import{o as Is,r as Es,s as As,t as Ms}from"./sheet-D5sUsyfT.js";import{t as Le}from"./useSummaryDraftStream-DQYbVHb7.js";var p=Me(Xe(),1),b={list:t((s,r=!1)=>I.get(`/companies/${s}/status-cards?archived=${r?"true":"false"}`),"list"),get:t(s=>I.get(`/status-cards/${s}`),"get"),create:t((s,r)=>I.post(`/companies/${s}/status-cards`,r),"create"),patch:t((s,r)=>I.patch(`/status-cards/${s}`,r),"patch"),remove:t(s=>I.delete(`/status-cards/${s}`),"remove"),updates:t(s=>I.get(`/status-cards/${s}/updates`),"updates"),summaryRevisions:t(s=>I.get(`/status-cards/${s}/summary-revisions`),"summaryRevisions"),refresh:t(s=>I.post(`/status-cards/${s}/refresh`,{}),"refresh"),recompile:t(s=>I.post(`/status-cards/${s}/recompile`,{}),"recompile"),dryRun:t(s=>I.get(`/status-cards/${s}/dry-run`),"dryRun")};function B(s){return s==null?null:s<1e3?`${s} tok`:`${(s/1e3).toFixed(1)}k tok`}t(B,"formatTokens");function O(s){if(s==null)return null;const r=s/100;return r===0?"$0.00":r<.1?`$${r.toFixed(3)}`:`$${r.toFixed(2)}`}t(O,"formatCents");function Fe(s){return s.reduce((r,n)=>({updateCount:r.updateCount+(n.kind==="compile"?0:1),totalTokens:r.totalTokens+n.inputTokens+n.outputTokens,totalCostCents:r.totalCostCents+n.costCents}),{updateCount:0,totalTokens:0,totalCostCents:0})}t(Fe,"accumulate");function Ps(s){return Fe(s)}t(Ps,"rollupUpdates");function $s(s,r=new Date){const n=new Date(r);n.setUTCHours(0,0,0,0);const u=n.getTime();return Fe(s.filter(d=>new Date(d.startedAt).getTime()>=u))}t($s,"rollupUpdatesToday");var qs=4500,Rs=3,Ie=2e3,_s=1;function Bs(s){const r=s.activeHours;if(!r)return 1440;const[n,u]=r.start.split(":").map(Number),[d,c]=r.end.split(":").map(Number),h=n*60+u,f=d*60+c,l=f>h?f-h:1440-(h-f);return l>0?l:1440}t(Bs,"activeWindowMinutes");function Ds(s){if(s.mode==="manual"){const m=`${O(Rs)} · ${B(qs)}`;return{cost:m,primary:`~1 rebuild per refresh ≈ ${m}`,note:"Manual cards only cost tokens when you press Refresh."}}const r=Bs(s);let n,u;if(s.mode==="interval"){const m=s.intervalMinutes??15;n=Math.floor(r/m),u=`every ${m} min`}else{const m=s.maxUpdatesPerHour??6;n=Math.round(r/60*m),u=`up to ${m}/hour`}const d=s.dailyTokenCap??null,c=d!==null?Math.floor(d/Ie):1/0,h=Math.max(0,Math.min(n,c)),f=d!==null&&c<n,l=h*Ie,y=h*_s,a=s.activeHours?" during active hours":"",x=`${O(y)} · ${B(l)}`;return{cost:x,primary:`Up to ~${h} updates/day (${u}${a}) ≈ ${x}`,note:f?`Capped by your ${B(d)} daily token cap — the card pauses when it's hit.`:"Only runs when something changed; a cheap no-op check otherwise."}}t(Ds,"estimateStatusCardCost");function Ls(s,r){const n=t(u=>u<1e3?`${u}`:`${(u/1e3).toFixed(1)}k`,"fmt");return`${n(s)} in / ${n(r)} out`}t(Ls,"formatTokenSplit");function me(s){switch(s){case"compile":return"compile";case"full":return"full rebuild";case"incremental":return"incremental";default:return s}}t(me,"updateKindLabel");function Oe(s){return s.archivedAt?"archived":s.state==="compiling"?"compiling":s.state==="error"?"error":s.state==="paused_budget"?"paused_budget":s.state==="paused_hours"?"paused_hours":s.generatingIssueId?"updating":s.pendingChangeCount>0?"stale":"fresh"}t(Oe,"deriveStatusCardLifecycle");var ze={compiling:{label:"Setting up",dotClassName:"bg-cyan-400 animate-pulse",description:"Just created; setting up and generating the first summary.",dashedBorder:!0,keepsLastSummary:!1},fresh:{label:"Fresh",dotClassName:"bg-emerald-400",description:"Summary reflects all known changes; nothing pending.",dashedBorder:!1,keepsLastSummary:!0},stale:{label:"Stale",dotClassName:"bg-amber-400",description:"Changes are pending since the last update.",dashedBorder:!1,keepsLastSummary:!0},updating:{label:"Updating",dotClassName:"bg-blue-500 animate-pulse",description:"An update is streaming in now.",dashedBorder:!1,keepsLastSummary:!0},error:{label:"Error",dotClassName:"bg-red-500",description:"The last run failed; the last good summary stays visible.",dashedBorder:!1,keepsLastSummary:!0},paused_budget:{label:"Paused — budget",dotClassName:"bg-orange-400",description:"The daily token cap was hit; auto-updates are suspended.",dashedBorder:!1,keepsLastSummary:!0},paused_hours:{label:"Paused — hours",dotClassName:"bg-orange-400",description:"Outside active hours; changes batch into one update at window open.",dashedBorder:!1,keepsLastSummary:!0},archived:{label:"Archived",dotClassName:"bg-ink-3/50",description:"No auto-updates and no watches. Restore to start watching again.",dashedBorder:!1,keepsLastSummary:!0}};function He(s){switch(s.mode){case"manual":return"manual";case"interval":return s.intervalMinutes?`every ${s.intervalMinutes}m if changed`:"on a schedule if changed";case"reactive":return`on change (${s.debounceSeconds??60}s)`;default:return"manual"}}t(He,"describeRefreshPolicy");var e=Me(Je(),1);function Fs({className:s}){return(0,e.jsx)("span",{className:A("mt-1 inline-block h-2.5 w-2.5 shrink-0 rounded-full",s),"aria-hidden":"true"})}t(Fs,"StateDot");function X(s){return r=>{r.stopPropagation(),s()}}t(X,"stopClick");function Os({card:s,companyId:r,onOpen:n,onRefresh:u,onRecompile:d,onEditInterest:c,onOpenDebug:h,onArchive:f,refreshPending:l,recompilePending:y}){const a=Oe(s),x=ze[a],m=a==="compiling"&&!!s.generatingIssueId,g=(0,p.useMemo)(()=>a==="updating"&&s.generatingIssueId?{id:s.generatingIssueId,identifier:null,title:s.title??"Status update",status:"in_progress"}:null,[a,s.generatingIssueId,s.title]),P=Le(r,g),S=He(s.refreshPolicy),w=B(s.todayTokens),C=O(s.todayCostCents),z=s.lastGeneratedAt?F(s.lastGeneratedAt):"no summary yet",$=!!(s.summaryBody&&s.summaryBody.trim().length>0);return(0,e.jsxs)("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:t(j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),n())},"onKeyDown"),className:A("group flex h-72 cursor-pointer flex-col rounded-lg border border-line bg-bg-2 text-ink transition-colors hover:border-ink-3/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus",x.dashedBorder&&"border-dashed"),"data-testid":"status-card-tile","data-lifecycle":a,children:[(0,e.jsxs)("div",{className:"flex items-start gap-2 px-4 pt-4",children:[a==="compiling"?null:(0,e.jsx)(Fs,{className:x.dotClassName}),(0,e.jsx)("span",{className:A("line-clamp-1 min-w-0 flex-1 text-sm font-semibold",a==="compiling"&&"text-ink-3"),title:s.title??s.interestPrompt,children:s.title??"New card"}),(0,e.jsx)("div",{onClick:t(j=>j.stopPropagation(),"onClick"),children:(0,e.jsxs)(is,{children:[(0,e.jsx)(as,{asChild:!0,children:(0,e.jsx)(M,{variant:"ghost",size:"icon",className:"-mr-1 -mt-1 h-7 w-7","aria-label":"Card actions",children:(0,e.jsx)(os,{className:"h-4 w-4"})})}),(0,e.jsxs)(ns,{align:"end",children:[(0,e.jsx)(Q,{onSelect:n,children:"Open detail"}),(0,e.jsx)(Q,{onSelect:u,disabled:l||a==="updating",children:"Refresh now"}),a==="compiling"&&!m||a==="error"?(0,e.jsx)(Q,{onSelect:d,disabled:y,children:"Run now"}):null,(0,e.jsx)(Q,{onSelect:c,children:"Edit interest & settings"}),(0,e.jsx)(Q,{onSelect:h,children:"Query debug"}),(0,e.jsx)(ts,{}),(0,e.jsx)(Q,{onSelect:f,variant:"destructive",children:"Archive"})]})]})})]}),(0,e.jsxs)("div",{className:"px-4 pt-2",children:[a==="compiling"?(0,e.jsxs)("div",{className:"rounded-md bg-bg-3 px-3 py-2 text-xs text-ink",role:"status","aria-live":"polite",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[m?(0,e.jsx)(E,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-ink-3"}):(0,e.jsx)(pe,{className:"h-3.5 w-3.5 shrink-0 text-amber-500"}),(0,e.jsx)("span",{children:m?"Setting up your card…":"Setup didn’t finish"})]}),(0,e.jsxs)("p",{className:"mt-1 line-clamp-2 text-ink-3",children:["“",s.interestPrompt,"”"]}),m?(0,e.jsxs)(Y,{to:`/issues/${s.generatingIssueId}`,onClick:t(j=>j.stopPropagation(),"onClick"),className:"mt-2 inline-flex items-center gap-1.5 font-medium text-ink underline-offset-2 hover:underline",children:[(0,e.jsx)(xe,{className:"h-3.5 w-3.5"}),"View setup task"]}):(0,e.jsxs)("button",{type:"button",onClick:X(d),disabled:y,className:"mt-2 inline-flex items-center gap-1.5 font-medium text-ink underline-offset-2 hover:underline disabled:opacity-60",children:[(0,e.jsx)(Be,{className:A("h-3.5 w-3.5",y&&"animate-pulse")}),y?"Starting…":"Run now"]})]}):null,a==="updating"?(0,e.jsx)("div",{className:"rounded-md bg-bg-3 px-3 py-2 text-xs text-ink",role:"status","aria-live":"polite",children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(E,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-ink-3"}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",title:P.statusLine??void 0,children:P.statusLine??(s.pendingChangeCount>0?`Integrating ${s.pendingChangeCount} ${s.pendingChangeCount===1?"change":"changes"}…`:"Updating now…")}),s.generatingIssueId?(0,e.jsxs)(Y,{to:es(s.generatingIssueId),onClick:t(j=>j.stopPropagation(),"onClick"),className:"inline-flex shrink-0 items-center gap-1 font-medium underline-offset-2 hover:underline",children:[(0,e.jsx)(xe,{className:"h-3.5 w-3.5"}),"View update task"]}):null]})}):null,a==="stale"?(0,e.jsxs)("button",{type:"button",onClick:X(u),disabled:l,className:"flex w-full items-center justify-between gap-2 rounded-md border border-amber-500/40 bg-amber-500/5 px-3 py-1.5 text-left text-xs text-ink transition-colors hover:bg-amber-500/10 disabled:opacity-60",children:[(0,e.jsxs)("span",{children:[s.pendingChangeCount," ",s.pendingChangeCount===1?"change":"changes"," since last update"]}),(0,e.jsx)("span",{className:"shrink-0 font-medium text-amber-700 dark:text-amber-400",children:"Refresh"})]}):null,a==="error"?(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-md border border-bad/40 bg-bad/5 px-3 py-1.5 text-xs",children:[(0,e.jsxs)("span",{className:"flex items-center gap-1.5 text-bad",children:[(0,e.jsx)(pe,{className:"h-3.5 w-3.5 shrink-0"}),"Last update failed"]}),(0,e.jsxs)("span",{className:"flex shrink-0 items-center gap-3",children:[(0,e.jsx)("button",{type:"button",onClick:X(u),disabled:l,className:"font-medium text-bad hover:underline disabled:opacity-60",children:"Retry"}),(0,e.jsx)("button",{type:"button",onClick:X(n),className:"text-ink-3 hover:underline",children:"Details"})]})]}):null,a==="paused_budget"||a==="paused_hours"?(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-orange-500/40 bg-orange-500/5 px-3 py-1.5 text-xs text-ink",children:[(0,e.jsx)(Ss,{className:"h-3.5 w-3.5 shrink-0 text-orange-500"}),(0,e.jsx)("span",{children:a==="paused_budget"?"Daily token cap reached — auto-updates paused":"Outside active hours — auto-updates paused"})]}):null]}),(0,e.jsxs)("div",{className:"min-h-0 flex-1 overflow-hidden px-4 pt-2",children:[a==="error"&&s.summaryBody?(0,e.jsx)("p",{className:"mb-1 text-(length:--text-micro) text-ink-3",children:"Showing last good summary:"}):null,$?(0,e.jsx)(W,{className:"text-xs leading-6 text-ink [&_p]:my-0.5",children:s.summaryBody}):a==="compiling"?(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"You can add instructions and pick an update policy while this runs."}):a==="updating"&&P.draft?(0,e.jsx)(W,{className:"text-xs leading-6 text-ink [&_p]:my-0.5",children:P.draft}):(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"No summary yet."})]}),(0,e.jsxs)("div",{className:"mt-auto flex items-center justify-between gap-2 border-t border-line px-4 py-2.5",children:[(0,e.jsx)("span",{className:"truncate text-(length:--text-micro) text-ink-3",children:a==="compiling"?"setting up · first summary pending":(0,e.jsxs)(e.Fragment,{children:[z," · ",S,w?` · ${w}`:"",C?` · ${C}`:""]})}),a==="fresh"||a==="paused_budget"||a==="paused_hours"?(0,e.jsx)(M,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:X(u),disabled:l,"aria-label":"Refresh card",children:(0,e.jsx)(_e,{className:A("h-3.5 w-3.5",l&&"animate-spin")})}):null]})]})}t(Os,"StatusCardTile");function Ee(s){return s?new Date(s).toLocaleDateString(void 0,{month:"short",day:"numeric"}):"—"}t(Ee,"shortDate");function zs({card:s,onView:r,onRestore:n,restorePending:u}){const d=_({queryKey:v.statusCards.updates(s.id),queryFn:t(()=>b.updates(s.id),"queryFn")}),c=d.data?Ps(d.data):null;return(0,e.jsxs)("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-line bg-bg-3/30 px-4 py-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("p",{className:"truncate text-sm font-semibold",children:s.title??"Untitled card"}),(0,e.jsxs)("p",{className:"mt-0.5 text-xs text-ink-3",title:s.archivedAt?ie(s.archivedAt):void 0,children:["archived ",Ee(s.archivedAt)," · last summary ",Ee(s.lastGeneratedAt),c?` · lifetime ${B(c.totalTokens)} / ${O(c.totalCostCents)}`:""]})]}),(0,e.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,e.jsx)(M,{size:"sm",onClick:r,children:"View"}),(0,e.jsxs)(M,{variant:"secondary",size:"sm",onClick:n,disabled:u,children:[u?(0,e.jsx)(E,{className:"animate-spin"}):null,"Restore"]})]})]})}t(zs,"ArchivedStatusCardRow");function Ue({companyId:s,value:r,onChange:n,enabled:u=!0}){const d=_({queryKey:s?v.agents.list(s):["agents","none"],queryFn:t(()=>xs.list(s),"queryFn"),enabled:!!s&&u}),c=(0,p.useMemo)(()=>new Map((d.data??[]).map(l=>[l.id,l])),[d.data]),h=(0,p.useMemo)(()=>(d.data??[]).filter(Ts).map(l=>({id:`agent:${l.id}`,label:l.name,searchText:`${l.name} ${l.role} ${l.title??""}`})),[d.data]),f=t(l=>{if(!l||!l.id)return(0,e.jsx)("span",{children:"Summarizer (default)"});const y=l.id.startsWith("agent:")?c.get(l.id.slice(6)):null;return(0,e.jsxs)(e.Fragment,{children:[y?(0,e.jsx)(hs,{agent:y,size:16,className:"h-3.5 w-3.5 shrink-0 text-ink-3"}):null,(0,e.jsx)("span",{className:"truncate",children:l.label})]})},"renderAgent");return(0,e.jsx)(Ns,{value:r?`agent:${r}`:"",options:h,placeholder:"Summarizer (default)",noneLabel:"Summarizer (default)",searchPlaceholder:"Search agents...",emptyMessage:"No agents found.",onChange:t(l=>n(l.startsWith("agent:")?l.slice(6):""),"onChange"),className:"h-8 text-sm",renderTriggerValue:f,renderOption:t(l=>f(l),"renderOption")})}t(Ue,"SummarizerAgentSelect");var Hs=["issues about evals","everything blocked this week","is feature X live? if not, the exact next actions to ship it"];function Us({companyId:s,open:r,onOpenChange:n}){const u=be(),[d,c]=(0,p.useState)(""),[h,f]=(0,p.useState)(""),[l,y]=(0,p.useState)(null);function a(){c(""),f(""),y(null)}t(a,"reset");function x(){n(!1),window.setTimeout(a,200)}t(x,"close");const m=R({mutationFn:t(()=>b.create(s,{interestPrompt:d.trim(),titlePinned:!1,agentId:h||null,refreshPolicy:Ge}),"mutationFn"),onMutate:t(()=>y(null),"onMutate"),onSuccess:t(async()=>{await Promise.all([u.invalidateQueries({queryKey:v.statusCards.list(s,!1)}),u.invalidateQueries({queryKey:v.statusCards.list(s,!0)})]),x()},"onSuccess"),onError:t(g=>y(g instanceof Error?g.message:"Could not create the card."),"onError")});return(0,e.jsx)(vs,{open:r,onOpenChange:t(g=>g?n(!0):x(),"onOpenChange"),children:(0,e.jsxs)(fs,{className:"sm:max-w-2xl",children:[(0,e.jsxs)(ps,{children:[(0,e.jsx)(js,{children:"New card"}),(0,e.jsx)(ys,{children:"One message sets up the whole card: say what you want to watch and what each update should tell you. The agent builds the query from it and writes every update against it."})]}),l?(0,e.jsx)(G,{tone:"danger",title:"Create failed",children:l}):null,(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("label",{htmlFor:"status-card-prompt",className:"block pb-1 text-sm font-semibold",children:"What do you want to keep an eye on?"}),(0,e.jsx)(De,{id:"status-card-prompt",value:d,onChange:t(g=>c(g.target.value),"onChange"),rows:5,autoFocus:!0,placeholder:"Keep an eye on the ID and Cloud projects. Tell me whether the service is live, and if not, the exact three actions needed to get it to production.",className:"text-sm"}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Examples"}),Hs.map(g=>(0,e.jsx)("button",{type:"button",onClick:t(()=>c(g),"onClick"),className:"rounded-full border border-line px-3 py-1 text-xs text-ink-3 transition-colors hover:bg-bg-3/40",children:g},g))]})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("label",{className:"block text-sm font-semibold",children:"Agent"}),(0,e.jsx)(Ue,{companyId:s,value:h,onChange:f,enabled:r}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"Runs this card's setup and updates. Leave on the default unless another agent should own it."})]}),(0,e.jsx)(gs,{children:(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(M,{variant:"secondary",onClick:x,disabled:m.isPending,children:"Cancel"}),(0,e.jsxs)(M,{onClick:t(()=>m.mutate(),"onClick"),disabled:d.trim().length===0||m.isPending,children:[m.isPending?(0,e.jsx)(E,{className:"animate-spin"}):null,"Create card"]})]})})]})})}t(Us,"CreateStatusCardDialog");function Ks(){return{refreshPolicy:{mode:"manual",triggers:{statusTransitions:!0,membershipChanges:!0,humanComments:!0,assigneeChanges:!0,anyUpdate:!1}}}}t(Ks,"defaultSettingsValue");var Qs=[5,15,30,60],Vs=[30,60,120,300],Ws=[{key:"statusTransitions",label:"Became blocked / needs review / done / cancelled"},{key:"membershipChanges",label:"New issue matches the query · issue leaves the query"},{key:"humanComments",label:"Human comments"},{key:"assigneeChanges",label:"Assignee changes"},{key:"anyUpdate",label:"Any update at all (noisy — includes in-progress churn)",noisy:!0}];function he({selected:s,title:r,badge:n,onSelect:u,children:d}){return(0,e.jsxs)("div",{className:A("rounded-md border px-3 py-2.5 transition-colors",s?"border-accent bg-accent/5 ring-1 ring-accent":"border-line hover:bg-bg-3/40"),children:[(0,e.jsxs)("button",{type:"button",role:"radio","aria-checked":s,onClick:u,className:"flex w-full items-center gap-2 text-left",children:[(0,e.jsx)("span",{className:A("flex h-4 w-4 shrink-0 items-center justify-center rounded-full border",s?"border-accent":"border-ink-3/50"),children:s?(0,e.jsx)("span",{className:"h-2 w-2 rounded-full bg-accent"}):null}),(0,e.jsx)("span",{className:"text-sm font-medium",children:r}),n]}),s&&d?(0,e.jsx)("div",{className:"mt-2 pl-6",children:d}):null]})}t(he,"RadioRow");function Gs({value:s,onChange:r}){const{refreshPolicy:n}=s,u=n.mode!=="manual",d=Ds(n),c=t(a=>r({...s,refreshPolicy:{...n,...a}}),"setPolicy"),h=t(a=>{const x={mode:a};a==="interval"&&(x.intervalMinutes=n.intervalMinutes??15),a==="reactive"&&(x.debounceSeconds=n.debounceSeconds??60,x.maxUpdatesPerHour=n.maxUpdatesPerHour??6),c(x)},"setMode"),f=t(a=>c({triggers:{...n.triggers,[a]:!n.triggers[a]}}),"toggleTrigger"),l=n.activeHours,y=t(a=>c({activeHours:a?{start:l?.start??"08:00",end:l?.end??"19:00",timezone:l?.timezone??"UTC"}:void 0}),"setActiveHoursEnabled");return(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Auto-update policy"}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(he,{selected:n.mode==="manual",title:"Manual only — updates when I press refresh",badge:(0,e.jsx)("span",{className:"ml-auto rounded-full bg-bg-3 px-2 py-0.5 text-(length:--text-nano) font-medium uppercase tracking-wide text-ink-3",children:"Default"}),onSelect:t(()=>h("manual"),"onSelect")}),(0,e.jsx)(he,{selected:n.mode==="interval",title:"On a schedule, only if something changed",onSelect:t(()=>h("interval"),"onSelect"),children:(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm text-ink-3",children:[(0,e.jsx)("span",{children:"Check every"}),(0,e.jsxs)(ge,{value:String(n.intervalMinutes??15),onValueChange:t(a=>c({intervalMinutes:Number(a)}),"onValueChange"),children:[(0,e.jsx)(fe,{size:"sm",className:"w-28","aria-label":"Check interval",children:(0,e.jsx)(je,{})}),(0,e.jsx)(ye,{children:Qs.map(a=>(0,e.jsxs)(le,{value:String(a),children:[a," min"]},a))})]})]})}),(0,e.jsx)(he,{selected:n.mode==="reactive",title:"As soon as something changes (debounced)",onSelect:t(()=>h("reactive"),"onSelect"),children:(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm text-ink-3",children:[(0,e.jsx)("span",{children:"Wait"}),(0,e.jsxs)(ge,{value:String(n.debounceSeconds??60),onValueChange:t(a=>c({debounceSeconds:Number(a)}),"onValueChange"),children:[(0,e.jsx)(fe,{size:"sm",className:"w-24","aria-label":"Debounce",children:(0,e.jsx)(je,{})}),(0,e.jsx)(ye,{children:Vs.map(a=>(0,e.jsxs)(le,{value:String(a),children:[a,"s"]},a))})]}),(0,e.jsx)("span",{className:"text-xs",children:"after the last change · max"}),(0,e.jsx)(V,{type:"number",min:1,max:60,value:n.maxUpdatesPerHour??6,onChange:t(a=>c({maxUpdatesPerHour:Math.max(1,Number(a.target.value)||1)}),"onChange"),className:"h-8 w-16 text-sm","aria-label":"Max updates per hour"}),(0,e.jsx)("span",{className:"text-xs",children:"updates/hour"})]})})]})]}),u?(0,e.jsxs)(qe,{className:"rounded-md border border-line",children:[(0,e.jsxs)($e,{className:"group flex w-full items-center justify-between gap-2 px-3 py-2.5 text-sm font-semibold",children:["Advanced",(0,e.jsx)(Re,{className:"h-4 w-4 text-ink-3 transition-transform group-data-[state=open]:rotate-180"})]}),(0,e.jsxs)(Pe,{className:"space-y-6 border-t border-line px-3 py-3",children:[(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Count as a change"}),(0,e.jsx)("div",{className:"space-y-2",children:Ws.map(a=>(0,e.jsxs)("label",{className:"flex items-start gap-2.5 text-sm",children:[(0,e.jsx)(Se,{checked:n.triggers[a.key],onCheckedChange:t(()=>f(a.key),"onCheckedChange"),className:"mt-0.5","aria-label":a.label}),(0,e.jsx)("span",{className:A(a.noisy&&"text-ink-3"),children:a.label})]},a.key))})]}),(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Guardrails"}),(0,e.jsxs)("label",{className:"flex items-start gap-2.5 text-sm",children:[(0,e.jsx)(Se,{checked:!!l,onCheckedChange:t(a=>y(!!a),"onCheckedChange"),className:"mt-0.5","aria-label":"Limit to active hours"}),(0,e.jsx)("span",{children:"Only auto-update during active hours"})]}),l?(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 pl-6 text-sm",children:[(0,e.jsx)(V,{type:"time",value:l.start,onChange:t(a=>c({activeHours:{...l,start:a.target.value}}),"onChange"),className:"h-8 w-32","aria-label":"Active hours start"}),(0,e.jsx)("span",{className:"text-ink-3",children:"–"}),(0,e.jsx)(V,{type:"time",value:l.end,onChange:t(a=>c({activeHours:{...l,end:a.target.value}}),"onChange"),className:"h-8 w-32","aria-label":"Active hours end"}),(0,e.jsx)(V,{value:l.timezone,onChange:t(a=>c({activeHours:{...l,timezone:a.target.value}}),"onChange"),className:"h-8 w-40",placeholder:"Timezone","aria-label":"Active hours timezone"})]}):null,(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,e.jsx)("span",{className:"w-32 shrink-0",children:"Daily token cap"}),(0,e.jsx)(V,{type:"number",min:0,step:1e3,value:n.dailyTokenCap??"",onChange:t(a=>{const x=Number(a.target.value);c({dailyTokenCap:a.target.value===""||x<=0?void 0:x})},"onChange"),className:"h-8 w-36",placeholder:"no cap","aria-label":"Daily token cap"})]})]})]})]}):null,(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,e.jsx)("span",{className:"font-semibold",children:"Estimated cost"}),(0,e.jsx)("span",{className:"text-ink-3",children:"="}),(0,e.jsxs)(ms,{children:[(0,e.jsx)(cs,{asChild:!0,children:(0,e.jsx)("span",{className:"cursor-default font-medium text-ink underline decoration-dotted decoration-ink-3/50 underline-offset-4",children:d.cost})}),(0,e.jsxs)(us,{className:"max-w-(--sz-18rem) text-left",children:[(0,e.jsx)("p",{children:d.primary}),d.note?(0,e.jsx)("p",{className:"mt-1 opacity-80",children:d.note}):null,(0,e.jsx)("p",{className:"mt-1 opacity-80",children:"Rough estimate from typical update sizes; actual cost is tracked per update."})]})]})]})]})}t(Gs,"StatusCardSettingsForm");function Js({card:s,companyId:r,open:n,onOpenChange:u,initialTab:d="summary"}){const c=be(),[h,f]=(0,p.useState)("summary"),[l,y]=(0,p.useState)(Ks()),[a,x]=(0,p.useState)(""),[m,g]=(0,p.useState)(""),[P,S]=(0,p.useState)(""),[w,C]=(0,p.useState)(null),[z,$]=(0,p.useState)(null),[j,H]=(0,p.useState)(null);(0,p.useEffect)(()=>{s&&(y({refreshPolicy:s.refreshPolicy}),x(s.title??""),g(s.interestPrompt),S(s.agentId??""),C(null),$(null),H(null))},[s]),(0,p.useEffect)(()=>{n&&f(d)},[n,d]);const U=_({queryKey:s?v.statusCards.updates(s.id):["status-cards","detail","none","updates"],queryFn:t(()=>b.updates(s.id),"queryFn"),enabled:!!(s&&n)}),oe=_({queryKey:s?v.statusCards.summaryRevisions(s.id):["status-cards","detail","none","summary-revisions"],queryFn:t(()=>b.summaryRevisions(s.id),"queryFn"),enabled:!!(s&&n&&s.documentId)}),T=_({queryKey:s?v.statusCards.dryRun(s.id):["status-cards","detail","none","dry-run"],queryFn:t(()=>b.dryRun(s.id),"queryFn"),enabled:!!(s&&n&&h==="watched"&&(s.queries.length>0||(s.mentionedIssueIds?.length??0)>0))}),N=s?Oe(s):"fresh",de=(0,p.useMemo)(()=>s&&N==="updating"&&s.generatingIssueId?{id:s.generatingIssueId,identifier:null,title:s.title??"Status update",status:"in_progress"}:null,[s,N]),D=Le(r,de),Z=t(async()=>{s&&await Promise.all([c.invalidateQueries({queryKey:v.statusCards.list(s.companyId,!1)}),c.invalidateQueries({queryKey:v.statusCards.detail(s.id)})])},"invalidateCard"),o=R({mutationFn:t(()=>b.refresh(s.id),"mutationFn"),onMutate:t(()=>{C(null),$(null)},"onMutate"),onSuccess:t(async()=>{await Z(),$("Refresh queued — the Summarizer is updating this card.")},"onSuccess"),onError:t(i=>C(i instanceof Error?i.message:"Could not refresh the card."),"onError")}),q=R({mutationFn:t(()=>b.recompile(s.id),"mutationFn"),onMutate:t(()=>{C(null),$(null)},"onMutate"),onSuccess:t(async()=>{await Z(),$("Run queued — the Summarizer is updating this card.")},"onSuccess"),onError:t(i=>C(i instanceof Error?i.message:"Could not run the card."),"onError")}),ce=R({mutationFn:t(()=>{const i=a.trim(),ue=m.trim(),Ve=ue.length>0&&ue!==s.interestPrompt.trim();return b.patch(s.id,{title:i||null,titlePinned:i.length>0,...Ve?{interestPrompt:ue}:{},agentId:P||null,refreshPolicy:l.refreshPolicy})},"mutationFn"),onMutate:t(()=>C(null),"onMutate"),onSuccess:t(async()=>{s&&await Promise.all([c.invalidateQueries({queryKey:v.statusCards.list(s.companyId,!1)}),c.invalidateQueries({queryKey:v.statusCards.detail(s.id)})])},"onSuccess"),onError:t(i=>C(i instanceof Error?i.message:"Could not save settings."),"onError")});if(!s)return null;const J=U.data??[],Ke=J[0]??null,ee=$s(J),L=J.filter(i=>i.status==="ok"&&i.finishedAt&&(i.kind==="full"||i.kind==="incremental")),k=j?L.find(i=>i.id===j)??null:null,Qe=oe.data??[],Ne=k?Qe[L.indexOf(k)]?.body??null:null,se=L.length,Ce=t(i=>se-L.indexOf(i),"revisionNumberOf"),te=k?k.changes:Ke?.changes??[],ke=ze[N],we=!!(s.summaryBody&&s.summaryBody.trim().length>0),K=N==="compiling"&&!!s.generatingIssueId;return(0,e.jsx)(Ms,{open:n,onOpenChange:u,children:(0,e.jsxs)(Es,{className:"flex w-full flex-col gap-0 p-0 sm:max-w-2xl",children:[(0,e.jsxs)(Is,{className:"border-b border-line p-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 pr-8",children:[(0,e.jsx)("span",{className:A("inline-block h-2.5 w-2.5 shrink-0 rounded-full",ke.dotClassName),"aria-hidden":"true"}),(0,e.jsx)(As,{className:"min-w-0 flex-1 truncate text-lg",children:s.title??"Untitled card"}),(0,e.jsx)(re,{variant:"outline",children:ke.label}),N==="compiling"?(0,e.jsxs)(M,{variant:"secondary",size:"sm",onClick:t(()=>q.mutate(),"onClick"),disabled:q.isPending||K,children:[K||q.isPending?(0,e.jsx)(E,{className:"h-3.5 w-3.5 animate-spin"}):(0,e.jsx)(Be,{className:"h-3.5 w-3.5"}),K?"Setting up…":q.isPending?"Running…":"Run now"]}):(0,e.jsxs)(M,{variant:"secondary",size:"sm",onClick:t(()=>o.mutate(),"onClick"),disabled:o.isPending||N==="updating",children:[(0,e.jsx)(_e,{className:A("h-3.5 w-3.5",o.isPending&&"animate-spin")}),o.isPending?"Refreshing…":"Refresh"]})]}),(0,e.jsxs)("p",{className:"text-xs text-ink-3",children:[s.lastGeneratedAt?`Updated ${F(s.lastGeneratedAt)}`:"No summary yet"," ·"," ",He(s.refreshPolicy)]})]}),(0,e.jsxs)(ls,{value:h,onValueChange:f,className:"flex min-h-0 flex-1 flex-col gap-0",children:[(0,e.jsxs)(rs,{variant:"line",className:"w-full justify-start gap-4 border-b border-line px-4",children:[(0,e.jsx)(ae,{value:"summary",children:"Summary"}),(0,e.jsx)(ae,{value:"settings",children:"Settings"}),(0,e.jsx)(ae,{value:"watched",children:"Watched issues"}),(0,e.jsx)(ae,{value:"history",children:"History"})]}),w?(0,e.jsx)("div",{className:"px-4 pt-3",children:(0,e.jsx)(G,{tone:"warning",title:"Heads up",children:w})}):z?(0,e.jsx)("div",{className:"px-4 pt-3",children:(0,e.jsx)(G,{tone:"info",title:"Working on it",children:z})}):null,(0,e.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:[(0,e.jsxs)(ne,{value:"summary",className:"mt-0 space-y-5",children:[(we||L.length>0)&&N!=="compiling"?(0,e.jsx)("div",{className:"flex items-center justify-end gap-2",children:L.length>1?(0,e.jsxs)(ge,{value:j??"__latest__",onValueChange:t(i=>H(i==="__latest__"?null:i),"onValueChange"),children:[(0,e.jsxs)(fe,{size:"sm",className:"w-auto gap-1.5","aria-label":"Select summary revision",children:[(0,e.jsx)(ks,{className:"h-3.5 w-3.5","aria-hidden":"true"}),(0,e.jsx)(je,{})]}),(0,e.jsxs)(ye,{align:"end",position:"popper",children:[(0,e.jsxs)(le,{value:"__latest__",className:"text-xs",children:["Revision ",se," · latest"]}),(0,e.jsx)(Cs,{}),L.slice(0,30).map(i=>(0,e.jsxs)(le,{value:i.id,className:"text-xs",title:ie(i.startedAt),children:["Rev ",Ce(i)," · ",me(i.kind)," · ",F(i.startedAt)]},i.id))]})]}):se>0?(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:["Revision ",se," · latest"]}):null}):null,N==="updating"&&D.draft&&!k?(0,e.jsx)(W,{className:"text-sm leading-7",children:D.draft}):k?(0,e.jsxs)("div",{className:"space-y-2 rounded-md border border-line bg-bg-3/30 p-3",children:[(0,e.jsxs)("p",{className:"text-xs text-ink-3",title:ie(k.startedAt),children:["Revision ",Ce(k)," · ",me(k.kind)," ·"," ",F(k.startedAt)]}),Ne?(0,e.jsx)(W,{className:"text-sm leading-7",children:Ne}):k.changeSummary?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(W,{className:"text-sm leading-7",children:k.changeSummary}),(0,e.jsx)("p",{className:"text-xs text-ink-3/70",children:"The full summary text for this revision is unavailable — showing its change summary. The integrated changes below are the live ledger for this revision."})]}):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No change summary was recorded for this revision."})]}):we?(0,e.jsx)(W,{className:"text-sm leading-7",children:s.summaryBody}):N==="compiling"?(0,e.jsxs)("div",{className:"space-y-2 text-sm text-ink-3",children:[(0,e.jsxs)("p",{className:"flex items-center gap-2",children:[K?(0,e.jsx)(E,{className:"h-4 w-4 shrink-0 animate-spin"}):(0,e.jsx)(pe,{className:"h-4 w-4 shrink-0 text-amber-500"}),K?"Setting up — the first summary is generated automatically once this finishes.":"Setup didn’t finish. Run it now to try again."]}),K&&s.generatingIssueId?(0,e.jsxs)(Y,{to:`/issues/${s.generatingIssueId}`,className:"inline-flex items-center gap-1.5 text-xs font-medium text-ink underline-offset-2 hover:underline",children:[(0,e.jsx)(xe,{className:"h-3.5 w-3.5"}),"View setup task"]}):null]}):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No summary yet — the first one is generated automatically once this card finishes setting up."}),te.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsxs)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-ink-3",children:[k?"Integrated in this revision":"Integrated in this update"," (",te.length," ",te.length===1?"change":"changes",")"]}),(0,e.jsx)("div",{className:"space-y-1.5",children:te.map(i=>(0,e.jsx)(Zs,{change:i},i.issueId))})]}):null]}),(0,e.jsx)(ne,{value:"history",className:"mt-0 space-y-3",children:U.isLoading?(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm text-ink-3",children:[(0,e.jsx)(E,{className:"h-4 w-4 animate-spin"})," Loading history…"]}):J.length===0?(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No updates recorded yet."}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"text-xs text-ink-3",children:["Today: ",ee.updateCount," ",ee.updateCount===1?"update":"updates"," ·"," ",B(ee.totalTokens)," · ",O(ee.totalCostCents),s.refreshPolicy.dailyTokenCap?` · daily cap ${B(s.refreshPolicy.dailyTokenCap)}`:""]}),(0,e.jsx)("div",{className:"divide-y divide-line",children:J.map(i=>(0,e.jsxs)("div",{className:"py-2.5 first:pt-1",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium",children:[me(i.kind),(0,e.jsx)(re,{variant:i.status==="failed"?"destructive":"secondary",children:i.status==="ok"?i.trigger:i.status})]}),(0,e.jsx)("span",{className:"text-xs text-ink-3",title:ie(i.startedAt),children:F(i.startedAt)})]}),(0,e.jsxs)("p",{className:"mt-1 text-xs text-ink-3",children:[Ls(i.inputTokens,i.outputTokens)," · ",O(i.costCents),i.model?` · ${i.model}`:"",i.changes.length>0?` · ${i.changes.length} changes`:""]}),i.error?(0,e.jsx)("p",{className:"mt-1 text-xs text-bad",children:i.error}):null]},i.id))})]})}),(0,e.jsx)(ne,{value:"watched",className:"mt-0 space-y-3",children:s.queries.length===0&&(s.mentionedIssueIds?.length??0)===0?(0,e.jsx)("div",{className:"rounded-md border border-dashed border-line px-3 py-4 text-sm text-ink-3",children:"This card is still setting up — the issues it watches appear here once it's ready."}):T.isLoading?(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm text-ink-3",children:[(0,e.jsx)(E,{className:"h-4 w-4 animate-spin"})," Matching issues…"]}):T.isError?(0,e.jsx)(G,{tone:"danger",title:"Could not load matched issues",children:T.error instanceof Error?T.error.message:"Try again."}):(0,e.jsx)(Ys,{queries:T.data?.queries??[],mentioned:T.data?.mentionedIssues??[]})}),(0,e.jsxs)(ne,{value:"settings",className:"mt-0 space-y-6",children:[(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Card name"}),(0,e.jsx)(V,{value:a,onChange:t(i=>x(i.target.value),"onChange"),placeholder:"Auto-named from the query",className:"text-sm","aria-label":"Card name"})]}),(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"What this card watches & reports"}),(0,e.jsx)(De,{value:m,onChange:t(i=>g(i.target.value),"onChange"),rows:3,className:"text-sm","aria-label":"What this card watches & reports"}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"This one message drives the whole card: the agent compiles the watch query from it and follows it as the instructions for every update. Editing it rebuilds the card."})]}),(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Agent"}),(0,e.jsx)(Ue,{companyId:s.companyId,value:P,onChange:S,enabled:n})]}),(0,e.jsx)(Gs,{value:l,onChange:y}),(0,e.jsx)(Xs,{card:s}),(0,e.jsx)("div",{className:"flex justify-end border-t border-line pt-4",children:(0,e.jsxs)(M,{onClick:t(()=>ce.mutate(),"onClick"),disabled:ce.isPending,children:[ce.isPending?(0,e.jsx)(E,{className:"animate-spin"}):null,"Save"]})})]})]})]})]})})}t(Js,"StatusCardDetailDrawer");function Xs({card:s}){const r=JSON.stringify({queries:s.queries,limit:50},null,2);return(0,e.jsxs)(qe,{className:"rounded-md border border-line",children:[(0,e.jsxs)($e,{className:"group flex w-full items-center justify-between gap-2 px-3 py-2.5 text-sm font-semibold",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2",children:["Query debug",(0,e.jsxs)(re,{variant:"secondary",children:["v",s.queryVersion]})]}),(0,e.jsx)(Re,{className:"h-4 w-4 text-ink-3 transition-transform group-data-[state=open]:rotate-180"})]}),(0,e.jsxs)(Pe,{className:"space-y-2 border-t border-line px-3 py-3",children:[(0,e.jsx)("pre",{className:"max-h-64 overflow-auto rounded-md bg-bg-3 p-3 font-mono text-xs text-ink",children:s.queries.length>0?r:"// query not compiled yet"}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:s.queryCompiledAt?`Compiled by Summarizer ${F(s.queryCompiledAt)} · version ${s.queryVersion}. Edit “What this card watches” above to rebuild it.`:"Not compiled yet. The query builds automatically once the card finishes setting up."})]})]})}t(Xs,"QueryDebugSection");function Ys({queries:s,mentioned:r}){const n=new Set,u=[];for(const{result:c}of s)for(const h of c.results)!h.issue||n.has(h.issue.id)||(n.add(h.issue.id),u.push(h.issue));const d=r.filter(c=>!n.has(c.id));return u.length===0&&d.length===0?(0,e.jsx)("div",{className:"rounded-md border border-dashed border-line px-3 py-4 text-sm text-ink-3",children:"The compiled query matches no issues right now."}):(0,e.jsxs)("div",{className:"space-y-3",children:[u.length>0?(0,e.jsx)("div",{className:"space-y-1.5",children:u.map(c=>(0,e.jsx)(Ae,{issue:c},c.id))}):null,d.length>0?(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("p",{className:"text-xs font-medium text-ink-3",children:"Mentioned in the latest update"}),d.map(c=>(0,e.jsx)(Ae,{issue:c},c.id))]}):null]})}t(Ys,"MatchedIssueList");function Ae({issue:s}){return(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-line px-3 py-2 text-xs",children:[(0,e.jsx)(Y,{to:`/issues/${s.identifier??s.id}`,className:"shrink-0 font-medium text-ink-3 underline-offset-2 hover:text-ink hover:underline",children:s.identifier??s.id.slice(0,8)}),(0,e.jsx)(ve,{status:s.status,externalConversationState:s.externalConversationState}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:s.title}),(0,e.jsx)("span",{className:"shrink-0 text-ink-3",children:F(s.updatedAt)})]})}t(Ae,"WatchedIssueRow");function Zs({change:s}){const r=!!(s.from&&s.to);return(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-line px-3 py-2 text-xs",children:[(0,e.jsx)(Y,{to:`/issues/${s.identifier}`,className:"shrink-0 font-medium text-ink-3 underline-offset-2 hover:text-ink hover:underline",children:s.identifier}),r?(0,e.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,e.jsx)(ve,{status:s.from}),(0,e.jsx)("span",{"aria-hidden":"true",className:"text-ink-3",children:"→"}),(0,e.jsx)(ve,{status:s.to})]}):(0,e.jsx)("span",{className:"truncate text-ink-3",children:et(s.changeKind)})]})}t(Zs,"ChangeRow");function et(s){return s==="entered_query"||s==="new"?"new issue matched the query":s==="left_query"?"left the query":s.replace(/_/g," ")}t(et,"describeChangeKind");function _t(){const{selectedCompanyId:s}=Ze(),{setBreadcrumbs:r}=bs(),n=ss(),u=be(),{cardId:d}=Ye(),[c,h]=(0,p.useState)(!1),[f,l]=(0,p.useState)(!1),[y,a]=(0,p.useState)("summary"),[x,m]=(0,p.useState)(null);(0,p.useEffect)(()=>{r([{label:"Status"}])},[r]);const g=_({queryKey:s?v.statusCards.list(s,!1):["status-cards","none","active"],queryFn:t(()=>b.list(s,!1),"queryFn"),enabled:!!s}),P=_({queryKey:s?v.statusCards.list(s,!0):["status-cards","none","archived"],queryFn:t(()=>b.list(s,!0),"queryFn"),enabled:!!s}),S=g.data??[],w=P.data??[],C=(0,p.useMemo)(()=>[...S,...w].find(o=>o.id===d)??null,[S,w,d]),z=_({queryKey:d?v.statusCards.detail(d):["status-cards","detail","none"],queryFn:t(()=>b.get(d),"queryFn"),enabled:!!d&&!C}),$=C??z.data??null,j=t(()=>s?Promise.all([u.invalidateQueries({queryKey:v.statusCards.list(s,!1)}),u.invalidateQueries({queryKey:v.statusCards.list(s,!0)})]):Promise.resolve(),"invalidateLists"),H=R({mutationFn:t(o=>b.refresh(o),"mutationFn"),onMutate:t(()=>m(null),"onMutate"),onSuccess:t(()=>j(),"onSuccess"),onError:t(o=>m(o instanceof Error?o.message:"Could not refresh the card."),"onError")}),U=R({mutationFn:t(o=>b.recompile(o),"mutationFn"),onMutate:t(()=>m(null),"onMutate"),onSuccess:t(()=>j(),"onSuccess"),onError:t(o=>m(o instanceof Error?o.message:"Could not run the card."),"onError")}),oe=R({mutationFn:t(o=>b.patch(o,{archived:!0}),"mutationFn"),onMutate:t(()=>m(null),"onMutate"),onSuccess:t(()=>j(),"onSuccess"),onError:t(o=>m(o instanceof Error?o.message:"Could not archive the card."),"onError")}),T=R({mutationFn:t(o=>b.patch(o,{archived:!1}),"mutationFn"),onMutate:t(()=>m(null),"onMutate"),onSuccess:t(()=>j(),"onSuccess"),onError:t(o=>m(o instanceof Error?o.message:"Could not restore the card."),"onError")}),N=t((o,q="summary")=>{a(q),n(`/status/${o}`)},"openDetail"),de=t(()=>n("/status"),"closeDetail"),D=S.reduce((o,q)=>({tokens:o.tokens+(q.todayTokens??0),cents:o.cents+(q.todayCostCents??0)}),{tokens:0,cents:0}),Z=D.tokens>0||D.cents>0;return(0,e.jsxs)("div",{className:"mx-auto max-w-6xl space-y-5",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)("h1",{className:"text-xl font-bold",children:"Status"}),(0,e.jsxs)(re,{variant:"secondary",className:"gap-1",children:[(0,e.jsx)(Te,{className:"h-3 w-3"}),"Beta"]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[Z?(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:["Today: ",B(D.tokens)," · ~",O(D.cents)]}):null,(0,e.jsxs)(M,{onClick:t(()=>l(!0),"onClick"),disabled:!s,children:[(0,e.jsx)(ds,{className:"h-4 w-4"}),"New card"]})]})]}),x?(0,e.jsx)(G,{tone:"warning",title:"Heads up",children:x}):null,g.isLoading?(0,e.jsxs)("div",{className:"flex items-center gap-2 py-12 text-sm text-ink-3",children:[(0,e.jsx)(E,{className:"h-4 w-4 animate-spin"})," Loading cards…"]}):g.isError?(0,e.jsx)(G,{tone:"danger",title:"Could not load status cards",children:g.error instanceof Error?g.error.message:"Try again."}):S.length===0?(0,e.jsx)(ws,{icon:Te,title:"No status cards yet",message:"Create a card to keep a living summary of the issues you care about.",action:s?"New card":void 0,onAction:t(()=>l(!0),"onAction")}):(0,e.jsx)("div",{className:"grid gap-4 sm:grid-cols-2",children:S.map(o=>(0,e.jsx)(Os,{card:o,companyId:s,onOpen:t(()=>N(o.id),"onOpen"),onRefresh:t(()=>H.mutate(o.id),"onRefresh"),onRecompile:t(()=>U.mutate(o.id),"onRecompile"),onEditInterest:t(()=>N(o.id,"settings"),"onEditInterest"),onOpenDebug:t(()=>N(o.id,"settings"),"onOpenDebug"),onArchive:t(()=>oe.mutate(o.id),"onArchive"),refreshPending:H.isPending&&H.variables===o.id,recompilePending:U.isPending&&U.variables===o.id},o.id))}),w.length>0?(0,e.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,e.jsx)("button",{type:"button",onClick:t(()=>h(o=>!o),"onClick"),className:"text-xs text-ink-3 underline-offset-2 hover:text-ink hover:underline",children:c?"Hide archived":`Show archived (${w.length})`}),c?w.map(o=>(0,e.jsx)(zs,{card:o,onView:t(()=>N(o.id),"onView"),onRestore:t(()=>T.mutate(o.id),"onRestore"),restorePending:T.isPending&&T.variables===o.id},o.id)):null]}):null,s?(0,e.jsx)(Us,{companyId:s,open:f,onOpenChange:l}):null,(0,e.jsx)(Js,{card:$,companyId:s,open:!!d,onOpenChange:t(o=>o?void 0:de(),"onOpenChange"),initialTab:y})]})}t(_t,"StatusCards");export{_t as StatusCards,_t as default};
|
|
1
|
+
var We=Object.defineProperty;var t=(s,r)=>We(s,"name",{value:r,configurable:!0});import{i as Me}from"./rolldown-runtime-ZpX3ckPj.js";import{O as F,h as ie,jr as Ge,l as A,la as Je,ua as Xe}from"./createLucideIcon-CgrPXnTY.js";import{c as Y,v as Ye}from"./star-eem0qj3E.js";import{X as be,_ as R,r as I,t as v,v as _}from"./queryKeys-BzT8CD34.js";import{n as Ze}from"./CompanyContext-fQCNWI_f.js";import{Ut as es,o as ss}from"./router-CJbFZfVR.js";import{n as Pe,r as $e,t as qe}from"./collapsible-D_rwONtV.js";import{t as Se}from"./checkbox-Cf2_HXDG.js";import{c as ts,i as Q,p as as,r as ns,t as is}from"./dropdown-menu-rUbU8QKw.js";import{i as ae,n as ne,r as rs,t as ls}from"./tabs-CjHzZxtD.js";import{t as Re}from"./chevron-down-nRcQ7bok.js";import{t as W}from"./MarkdownBody-cPGkwwjq.js";import{t as os}from"./ellipsis-DyXbAp4P.js";import{t as xe}from"./external-link-BIcMNNSN.js";import{t as Te}from"./flask-conical-BxspRG7d.js";import{r as E,t as M}from"./button-DI4w5WP7.js";import{t as ds}from"./plus-CwNlqadt.js";import{t as _e}from"./refresh-cw-CfzWP9se.js";import{t as pe}from"./triangle-alert-CnHMpmva.js";import{t as Be}from"./wand-sparkles-CONrztQy.js";import{i as cs,n as us,t as ms}from"./tooltip-CW50mEoC.js";import{t as re}from"./badge-jeXr866I.js";import{t as hs}from"./AgentAvatar-BZiiDlCN.js";import{t as xs}from"./agents-B8n-p0aX.js";import{a as ps,i as gs,n as fs,r as ys,s as js,t as vs}from"./dialog-CeH7rDcv.js";import{t as V}from"./input-BBNGmECW.js";import{n as bs}from"./BreadcrumbContext-DNbB7zWn.js";import{t as De}from"./textarea-CTx68BDs.js";import{t as Ns}from"./InlineEntitySelector-BboofK18.js";import{t as G}from"./InlineBanner-DeTqU5Gp.js";import{a as Cs,i as le,n as ge,o as fe,r as ye,s as je}from"./select-DNiRU1d9.js";import{Cn as ve,Fa as ks,T as ws,or as Ss,to as Ts}from"./index-QhteFtm-.js";import{o as Is,r as Es,s as As,t as Ms}from"./sheet-D5sUsyfT.js";import{t as Le}from"./useSummaryDraftStream-BDuMgNcA.js";var p=Me(Xe(),1),b={list:t((s,r=!1)=>I.get(`/companies/${s}/status-cards?archived=${r?"true":"false"}`),"list"),get:t(s=>I.get(`/status-cards/${s}`),"get"),create:t((s,r)=>I.post(`/companies/${s}/status-cards`,r),"create"),patch:t((s,r)=>I.patch(`/status-cards/${s}`,r),"patch"),remove:t(s=>I.delete(`/status-cards/${s}`),"remove"),updates:t(s=>I.get(`/status-cards/${s}/updates`),"updates"),summaryRevisions:t(s=>I.get(`/status-cards/${s}/summary-revisions`),"summaryRevisions"),refresh:t(s=>I.post(`/status-cards/${s}/refresh`,{}),"refresh"),recompile:t(s=>I.post(`/status-cards/${s}/recompile`,{}),"recompile"),dryRun:t(s=>I.get(`/status-cards/${s}/dry-run`),"dryRun")};function B(s){return s==null?null:s<1e3?`${s} tok`:`${(s/1e3).toFixed(1)}k tok`}t(B,"formatTokens");function O(s){if(s==null)return null;const r=s/100;return r===0?"$0.00":r<.1?`$${r.toFixed(3)}`:`$${r.toFixed(2)}`}t(O,"formatCents");function Fe(s){return s.reduce((r,n)=>({updateCount:r.updateCount+(n.kind==="compile"?0:1),totalTokens:r.totalTokens+n.inputTokens+n.outputTokens,totalCostCents:r.totalCostCents+n.costCents}),{updateCount:0,totalTokens:0,totalCostCents:0})}t(Fe,"accumulate");function Ps(s){return Fe(s)}t(Ps,"rollupUpdates");function $s(s,r=new Date){const n=new Date(r);n.setUTCHours(0,0,0,0);const u=n.getTime();return Fe(s.filter(d=>new Date(d.startedAt).getTime()>=u))}t($s,"rollupUpdatesToday");var qs=4500,Rs=3,Ie=2e3,_s=1;function Bs(s){const r=s.activeHours;if(!r)return 1440;const[n,u]=r.start.split(":").map(Number),[d,c]=r.end.split(":").map(Number),h=n*60+u,f=d*60+c,l=f>h?f-h:1440-(h-f);return l>0?l:1440}t(Bs,"activeWindowMinutes");function Ds(s){if(s.mode==="manual"){const m=`${O(Rs)} · ${B(qs)}`;return{cost:m,primary:`~1 rebuild per refresh ≈ ${m}`,note:"Manual cards only cost tokens when you press Refresh."}}const r=Bs(s);let n,u;if(s.mode==="interval"){const m=s.intervalMinutes??15;n=Math.floor(r/m),u=`every ${m} min`}else{const m=s.maxUpdatesPerHour??6;n=Math.round(r/60*m),u=`up to ${m}/hour`}const d=s.dailyTokenCap??null,c=d!==null?Math.floor(d/Ie):1/0,h=Math.max(0,Math.min(n,c)),f=d!==null&&c<n,l=h*Ie,y=h*_s,a=s.activeHours?" during active hours":"",x=`${O(y)} · ${B(l)}`;return{cost:x,primary:`Up to ~${h} updates/day (${u}${a}) ≈ ${x}`,note:f?`Capped by your ${B(d)} daily token cap — the card pauses when it's hit.`:"Only runs when something changed; a cheap no-op check otherwise."}}t(Ds,"estimateStatusCardCost");function Ls(s,r){const n=t(u=>u<1e3?`${u}`:`${(u/1e3).toFixed(1)}k`,"fmt");return`${n(s)} in / ${n(r)} out`}t(Ls,"formatTokenSplit");function me(s){switch(s){case"compile":return"compile";case"full":return"full rebuild";case"incremental":return"incremental";default:return s}}t(me,"updateKindLabel");function Oe(s){return s.archivedAt?"archived":s.state==="compiling"?"compiling":s.state==="error"?"error":s.state==="paused_budget"?"paused_budget":s.state==="paused_hours"?"paused_hours":s.generatingIssueId?"updating":s.pendingChangeCount>0?"stale":"fresh"}t(Oe,"deriveStatusCardLifecycle");var ze={compiling:{label:"Setting up",dotClassName:"bg-cyan-400 animate-pulse",description:"Just created; setting up and generating the first summary.",dashedBorder:!0,keepsLastSummary:!1},fresh:{label:"Fresh",dotClassName:"bg-emerald-400",description:"Summary reflects all known changes; nothing pending.",dashedBorder:!1,keepsLastSummary:!0},stale:{label:"Stale",dotClassName:"bg-amber-400",description:"Changes are pending since the last update.",dashedBorder:!1,keepsLastSummary:!0},updating:{label:"Updating",dotClassName:"bg-blue-500 animate-pulse",description:"An update is streaming in now.",dashedBorder:!1,keepsLastSummary:!0},error:{label:"Error",dotClassName:"bg-red-500",description:"The last run failed; the last good summary stays visible.",dashedBorder:!1,keepsLastSummary:!0},paused_budget:{label:"Paused — budget",dotClassName:"bg-orange-400",description:"The daily token cap was hit; auto-updates are suspended.",dashedBorder:!1,keepsLastSummary:!0},paused_hours:{label:"Paused — hours",dotClassName:"bg-orange-400",description:"Outside active hours; changes batch into one update at window open.",dashedBorder:!1,keepsLastSummary:!0},archived:{label:"Archived",dotClassName:"bg-ink-3/50",description:"No auto-updates and no watches. Restore to start watching again.",dashedBorder:!1,keepsLastSummary:!0}};function He(s){switch(s.mode){case"manual":return"manual";case"interval":return s.intervalMinutes?`every ${s.intervalMinutes}m if changed`:"on a schedule if changed";case"reactive":return`on change (${s.debounceSeconds??60}s)`;default:return"manual"}}t(He,"describeRefreshPolicy");var e=Me(Je(),1);function Fs({className:s}){return(0,e.jsx)("span",{className:A("mt-1 inline-block h-2.5 w-2.5 shrink-0 rounded-full",s),"aria-hidden":"true"})}t(Fs,"StateDot");function X(s){return r=>{r.stopPropagation(),s()}}t(X,"stopClick");function Os({card:s,companyId:r,onOpen:n,onRefresh:u,onRecompile:d,onEditInterest:c,onOpenDebug:h,onArchive:f,refreshPending:l,recompilePending:y}){const a=Oe(s),x=ze[a],m=a==="compiling"&&!!s.generatingIssueId,g=(0,p.useMemo)(()=>a==="updating"&&s.generatingIssueId?{id:s.generatingIssueId,identifier:null,title:s.title??"Status update",status:"in_progress"}:null,[a,s.generatingIssueId,s.title]),P=Le(r,g),S=He(s.refreshPolicy),w=B(s.todayTokens),C=O(s.todayCostCents),z=s.lastGeneratedAt?F(s.lastGeneratedAt):"no summary yet",$=!!(s.summaryBody&&s.summaryBody.trim().length>0);return(0,e.jsxs)("div",{role:"button",tabIndex:0,onClick:n,onKeyDown:t(j=>{j.target===j.currentTarget&&(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),n())},"onKeyDown"),className:A("group flex h-72 cursor-pointer flex-col rounded-lg border border-line bg-bg-2 text-ink transition-colors hover:border-ink-3/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus",x.dashedBorder&&"border-dashed"),"data-testid":"status-card-tile","data-lifecycle":a,children:[(0,e.jsxs)("div",{className:"flex items-start gap-2 px-4 pt-4",children:[a==="compiling"?null:(0,e.jsx)(Fs,{className:x.dotClassName}),(0,e.jsx)("span",{className:A("line-clamp-1 min-w-0 flex-1 text-sm font-semibold",a==="compiling"&&"text-ink-3"),title:s.title??s.interestPrompt,children:s.title??"New card"}),(0,e.jsx)("div",{onClick:t(j=>j.stopPropagation(),"onClick"),children:(0,e.jsxs)(is,{children:[(0,e.jsx)(as,{asChild:!0,children:(0,e.jsx)(M,{variant:"ghost",size:"icon",className:"-mr-1 -mt-1 h-7 w-7","aria-label":"Card actions",children:(0,e.jsx)(os,{className:"h-4 w-4"})})}),(0,e.jsxs)(ns,{align:"end",children:[(0,e.jsx)(Q,{onSelect:n,children:"Open detail"}),(0,e.jsx)(Q,{onSelect:u,disabled:l||a==="updating",children:"Refresh now"}),a==="compiling"&&!m||a==="error"?(0,e.jsx)(Q,{onSelect:d,disabled:y,children:"Run now"}):null,(0,e.jsx)(Q,{onSelect:c,children:"Edit interest & settings"}),(0,e.jsx)(Q,{onSelect:h,children:"Query debug"}),(0,e.jsx)(ts,{}),(0,e.jsx)(Q,{onSelect:f,variant:"destructive",children:"Archive"})]})]})})]}),(0,e.jsxs)("div",{className:"px-4 pt-2",children:[a==="compiling"?(0,e.jsxs)("div",{className:"rounded-md bg-bg-3 px-3 py-2 text-xs text-ink",role:"status","aria-live":"polite",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[m?(0,e.jsx)(E,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-ink-3"}):(0,e.jsx)(pe,{className:"h-3.5 w-3.5 shrink-0 text-amber-500"}),(0,e.jsx)("span",{children:m?"Setting up your card…":"Setup didn’t finish"})]}),(0,e.jsxs)("p",{className:"mt-1 line-clamp-2 text-ink-3",children:["“",s.interestPrompt,"”"]}),m?(0,e.jsxs)(Y,{to:`/issues/${s.generatingIssueId}`,onClick:t(j=>j.stopPropagation(),"onClick"),className:"mt-2 inline-flex items-center gap-1.5 font-medium text-ink underline-offset-2 hover:underline",children:[(0,e.jsx)(xe,{className:"h-3.5 w-3.5"}),"View setup task"]}):(0,e.jsxs)("button",{type:"button",onClick:X(d),disabled:y,className:"mt-2 inline-flex items-center gap-1.5 font-medium text-ink underline-offset-2 hover:underline disabled:opacity-60",children:[(0,e.jsx)(Be,{className:A("h-3.5 w-3.5",y&&"animate-pulse")}),y?"Starting…":"Run now"]})]}):null,a==="updating"?(0,e.jsx)("div",{className:"rounded-md bg-bg-3 px-3 py-2 text-xs text-ink",role:"status","aria-live":"polite",children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(E,{className:"h-3.5 w-3.5 shrink-0 animate-spin text-ink-3"}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",title:P.statusLine??void 0,children:P.statusLine??(s.pendingChangeCount>0?`Integrating ${s.pendingChangeCount} ${s.pendingChangeCount===1?"change":"changes"}…`:"Updating now…")}),s.generatingIssueId?(0,e.jsxs)(Y,{to:es(s.generatingIssueId),onClick:t(j=>j.stopPropagation(),"onClick"),className:"inline-flex shrink-0 items-center gap-1 font-medium underline-offset-2 hover:underline",children:[(0,e.jsx)(xe,{className:"h-3.5 w-3.5"}),"View update task"]}):null]})}):null,a==="stale"?(0,e.jsxs)("button",{type:"button",onClick:X(u),disabled:l,className:"flex w-full items-center justify-between gap-2 rounded-md border border-amber-500/40 bg-amber-500/5 px-3 py-1.5 text-left text-xs text-ink transition-colors hover:bg-amber-500/10 disabled:opacity-60",children:[(0,e.jsxs)("span",{children:[s.pendingChangeCount," ",s.pendingChangeCount===1?"change":"changes"," since last update"]}),(0,e.jsx)("span",{className:"shrink-0 font-medium text-amber-700 dark:text-amber-400",children:"Refresh"})]}):null,a==="error"?(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-md border border-bad/40 bg-bad/5 px-3 py-1.5 text-xs",children:[(0,e.jsxs)("span",{className:"flex items-center gap-1.5 text-bad",children:[(0,e.jsx)(pe,{className:"h-3.5 w-3.5 shrink-0"}),"Last update failed"]}),(0,e.jsxs)("span",{className:"flex shrink-0 items-center gap-3",children:[(0,e.jsx)("button",{type:"button",onClick:X(u),disabled:l,className:"font-medium text-bad hover:underline disabled:opacity-60",children:"Retry"}),(0,e.jsx)("button",{type:"button",onClick:X(n),className:"text-ink-3 hover:underline",children:"Details"})]})]}):null,a==="paused_budget"||a==="paused_hours"?(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-orange-500/40 bg-orange-500/5 px-3 py-1.5 text-xs text-ink",children:[(0,e.jsx)(Ts,{className:"h-3.5 w-3.5 shrink-0 text-orange-500"}),(0,e.jsx)("span",{children:a==="paused_budget"?"Daily token cap reached — auto-updates paused":"Outside active hours — auto-updates paused"})]}):null]}),(0,e.jsxs)("div",{className:"min-h-0 flex-1 overflow-hidden px-4 pt-2",children:[a==="error"&&s.summaryBody?(0,e.jsx)("p",{className:"mb-1 text-(length:--text-micro) text-ink-3",children:"Showing last good summary:"}):null,$?(0,e.jsx)(W,{className:"text-xs leading-6 text-ink [&_p]:my-0.5",children:s.summaryBody}):a==="compiling"?(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"You can add instructions and pick an update policy while this runs."}):a==="updating"&&P.draft?(0,e.jsx)(W,{className:"text-xs leading-6 text-ink [&_p]:my-0.5",children:P.draft}):(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"No summary yet."})]}),(0,e.jsxs)("div",{className:"mt-auto flex items-center justify-between gap-2 border-t border-line px-4 py-2.5",children:[(0,e.jsx)("span",{className:"truncate text-(length:--text-micro) text-ink-3",children:a==="compiling"?"setting up · first summary pending":(0,e.jsxs)(e.Fragment,{children:[z," · ",S,w?` · ${w}`:"",C?` · ${C}`:""]})}),a==="fresh"||a==="paused_budget"||a==="paused_hours"?(0,e.jsx)(M,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:X(u),disabled:l,"aria-label":"Refresh card",children:(0,e.jsx)(_e,{className:A("h-3.5 w-3.5",l&&"animate-spin")})}):null]})]})}t(Os,"StatusCardTile");function Ee(s){return s?new Date(s).toLocaleDateString(void 0,{month:"short",day:"numeric"}):"—"}t(Ee,"shortDate");function zs({card:s,onView:r,onRestore:n,restorePending:u}){const d=_({queryKey:v.statusCards.updates(s.id),queryFn:t(()=>b.updates(s.id),"queryFn")}),c=d.data?Ps(d.data):null;return(0,e.jsxs)("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-line bg-bg-3/30 px-4 py-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("p",{className:"truncate text-sm font-semibold",children:s.title??"Untitled card"}),(0,e.jsxs)("p",{className:"mt-0.5 text-xs text-ink-3",title:s.archivedAt?ie(s.archivedAt):void 0,children:["archived ",Ee(s.archivedAt)," · last summary ",Ee(s.lastGeneratedAt),c?` · lifetime ${B(c.totalTokens)} / ${O(c.totalCostCents)}`:""]})]}),(0,e.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,e.jsx)(M,{size:"sm",onClick:r,children:"View"}),(0,e.jsxs)(M,{variant:"secondary",size:"sm",onClick:n,disabled:u,children:[u?(0,e.jsx)(E,{className:"animate-spin"}):null,"Restore"]})]})]})}t(zs,"ArchivedStatusCardRow");function Ue({companyId:s,value:r,onChange:n,enabled:u=!0}){const d=_({queryKey:s?v.agents.list(s):["agents","none"],queryFn:t(()=>xs.list(s),"queryFn"),enabled:!!s&&u}),c=(0,p.useMemo)(()=>new Map((d.data??[]).map(l=>[l.id,l])),[d.data]),h=(0,p.useMemo)(()=>(d.data??[]).filter(Ss).map(l=>({id:`agent:${l.id}`,label:l.name,searchText:`${l.name} ${l.role} ${l.title??""}`})),[d.data]),f=t(l=>{if(!l||!l.id)return(0,e.jsx)("span",{children:"Summarizer (default)"});const y=l.id.startsWith("agent:")?c.get(l.id.slice(6)):null;return(0,e.jsxs)(e.Fragment,{children:[y?(0,e.jsx)(hs,{agent:y,size:16,className:"h-3.5 w-3.5 shrink-0 text-ink-3"}):null,(0,e.jsx)("span",{className:"truncate",children:l.label})]})},"renderAgent");return(0,e.jsx)(Ns,{value:r?`agent:${r}`:"",options:h,placeholder:"Summarizer (default)",noneLabel:"Summarizer (default)",searchPlaceholder:"Search agents...",emptyMessage:"No agents found.",onChange:t(l=>n(l.startsWith("agent:")?l.slice(6):""),"onChange"),className:"h-8 text-sm",renderTriggerValue:f,renderOption:t(l=>f(l),"renderOption")})}t(Ue,"SummarizerAgentSelect");var Hs=["issues about evals","everything blocked this week","is feature X live? if not, the exact next actions to ship it"];function Us({companyId:s,open:r,onOpenChange:n}){const u=be(),[d,c]=(0,p.useState)(""),[h,f]=(0,p.useState)(""),[l,y]=(0,p.useState)(null);function a(){c(""),f(""),y(null)}t(a,"reset");function x(){n(!1),window.setTimeout(a,200)}t(x,"close");const m=R({mutationFn:t(()=>b.create(s,{interestPrompt:d.trim(),titlePinned:!1,agentId:h||null,refreshPolicy:Ge}),"mutationFn"),onMutate:t(()=>y(null),"onMutate"),onSuccess:t(async()=>{await Promise.all([u.invalidateQueries({queryKey:v.statusCards.list(s,!1)}),u.invalidateQueries({queryKey:v.statusCards.list(s,!0)})]),x()},"onSuccess"),onError:t(g=>y(g instanceof Error?g.message:"Could not create the card."),"onError")});return(0,e.jsx)(vs,{open:r,onOpenChange:t(g=>g?n(!0):x(),"onOpenChange"),children:(0,e.jsxs)(fs,{className:"sm:max-w-2xl",children:[(0,e.jsxs)(ps,{children:[(0,e.jsx)(js,{children:"New card"}),(0,e.jsx)(ys,{children:"One message sets up the whole card: say what you want to watch and what each update should tell you. The agent builds the query from it and writes every update against it."})]}),l?(0,e.jsx)(G,{tone:"danger",title:"Create failed",children:l}):null,(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("label",{htmlFor:"status-card-prompt",className:"block pb-1 text-sm font-semibold",children:"What do you want to keep an eye on?"}),(0,e.jsx)(De,{id:"status-card-prompt",value:d,onChange:t(g=>c(g.target.value),"onChange"),rows:5,autoFocus:!0,placeholder:"Keep an eye on the ID and Cloud projects. Tell me whether the service is live, and if not, the exact three actions needed to get it to production.",className:"text-sm"}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Examples"}),Hs.map(g=>(0,e.jsx)("button",{type:"button",onClick:t(()=>c(g),"onClick"),className:"rounded-full border border-line px-3 py-1 text-xs text-ink-3 transition-colors hover:bg-bg-3/40",children:g},g))]})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("label",{className:"block text-sm font-semibold",children:"Agent"}),(0,e.jsx)(Ue,{companyId:s,value:h,onChange:f,enabled:r}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"Runs this card's setup and updates. Leave on the default unless another agent should own it."})]}),(0,e.jsx)(gs,{children:(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(M,{variant:"secondary",onClick:x,disabled:m.isPending,children:"Cancel"}),(0,e.jsxs)(M,{onClick:t(()=>m.mutate(),"onClick"),disabled:d.trim().length===0||m.isPending,children:[m.isPending?(0,e.jsx)(E,{className:"animate-spin"}):null,"Create card"]})]})})]})})}t(Us,"CreateStatusCardDialog");function Ks(){return{refreshPolicy:{mode:"manual",triggers:{statusTransitions:!0,membershipChanges:!0,humanComments:!0,assigneeChanges:!0,anyUpdate:!1}}}}t(Ks,"defaultSettingsValue");var Qs=[5,15,30,60],Vs=[30,60,120,300],Ws=[{key:"statusTransitions",label:"Became blocked / needs review / done / cancelled"},{key:"membershipChanges",label:"New issue matches the query · issue leaves the query"},{key:"humanComments",label:"Human comments"},{key:"assigneeChanges",label:"Assignee changes"},{key:"anyUpdate",label:"Any update at all (noisy — includes in-progress churn)",noisy:!0}];function he({selected:s,title:r,badge:n,onSelect:u,children:d}){return(0,e.jsxs)("div",{className:A("rounded-md border px-3 py-2.5 transition-colors",s?"border-accent bg-accent/5 ring-1 ring-accent":"border-line hover:bg-bg-3/40"),children:[(0,e.jsxs)("button",{type:"button",role:"radio","aria-checked":s,onClick:u,className:"flex w-full items-center gap-2 text-left",children:[(0,e.jsx)("span",{className:A("flex h-4 w-4 shrink-0 items-center justify-center rounded-full border",s?"border-accent":"border-ink-3/50"),children:s?(0,e.jsx)("span",{className:"h-2 w-2 rounded-full bg-accent"}):null}),(0,e.jsx)("span",{className:"text-sm font-medium",children:r}),n]}),s&&d?(0,e.jsx)("div",{className:"mt-2 pl-6",children:d}):null]})}t(he,"RadioRow");function Gs({value:s,onChange:r}){const{refreshPolicy:n}=s,u=n.mode!=="manual",d=Ds(n),c=t(a=>r({...s,refreshPolicy:{...n,...a}}),"setPolicy"),h=t(a=>{const x={mode:a};a==="interval"&&(x.intervalMinutes=n.intervalMinutes??15),a==="reactive"&&(x.debounceSeconds=n.debounceSeconds??60,x.maxUpdatesPerHour=n.maxUpdatesPerHour??6),c(x)},"setMode"),f=t(a=>c({triggers:{...n.triggers,[a]:!n.triggers[a]}}),"toggleTrigger"),l=n.activeHours,y=t(a=>c({activeHours:a?{start:l?.start??"08:00",end:l?.end??"19:00",timezone:l?.timezone??"UTC"}:void 0}),"setActiveHoursEnabled");return(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Auto-update policy"}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(he,{selected:n.mode==="manual",title:"Manual only — updates when I press refresh",badge:(0,e.jsx)("span",{className:"ml-auto rounded-full bg-bg-3 px-2 py-0.5 text-(length:--text-nano) font-medium uppercase tracking-wide text-ink-3",children:"Default"}),onSelect:t(()=>h("manual"),"onSelect")}),(0,e.jsx)(he,{selected:n.mode==="interval",title:"On a schedule, only if something changed",onSelect:t(()=>h("interval"),"onSelect"),children:(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm text-ink-3",children:[(0,e.jsx)("span",{children:"Check every"}),(0,e.jsxs)(ge,{value:String(n.intervalMinutes??15),onValueChange:t(a=>c({intervalMinutes:Number(a)}),"onValueChange"),children:[(0,e.jsx)(fe,{size:"sm",className:"w-28","aria-label":"Check interval",children:(0,e.jsx)(je,{})}),(0,e.jsx)(ye,{children:Qs.map(a=>(0,e.jsxs)(le,{value:String(a),children:[a," min"]},a))})]})]})}),(0,e.jsx)(he,{selected:n.mode==="reactive",title:"As soon as something changes (debounced)",onSelect:t(()=>h("reactive"),"onSelect"),children:(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm text-ink-3",children:[(0,e.jsx)("span",{children:"Wait"}),(0,e.jsxs)(ge,{value:String(n.debounceSeconds??60),onValueChange:t(a=>c({debounceSeconds:Number(a)}),"onValueChange"),children:[(0,e.jsx)(fe,{size:"sm",className:"w-24","aria-label":"Debounce",children:(0,e.jsx)(je,{})}),(0,e.jsx)(ye,{children:Vs.map(a=>(0,e.jsxs)(le,{value:String(a),children:[a,"s"]},a))})]}),(0,e.jsx)("span",{className:"text-xs",children:"after the last change · max"}),(0,e.jsx)(V,{type:"number",min:1,max:60,value:n.maxUpdatesPerHour??6,onChange:t(a=>c({maxUpdatesPerHour:Math.max(1,Number(a.target.value)||1)}),"onChange"),className:"h-8 w-16 text-sm","aria-label":"Max updates per hour"}),(0,e.jsx)("span",{className:"text-xs",children:"updates/hour"})]})})]})]}),u?(0,e.jsxs)(qe,{className:"rounded-md border border-line",children:[(0,e.jsxs)($e,{className:"group flex w-full items-center justify-between gap-2 px-3 py-2.5 text-sm font-semibold",children:["Advanced",(0,e.jsx)(Re,{className:"h-4 w-4 text-ink-3 transition-transform group-data-[state=open]:rotate-180"})]}),(0,e.jsxs)(Pe,{className:"space-y-6 border-t border-line px-3 py-3",children:[(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Count as a change"}),(0,e.jsx)("div",{className:"space-y-2",children:Ws.map(a=>(0,e.jsxs)("label",{className:"flex items-start gap-2.5 text-sm",children:[(0,e.jsx)(Se,{checked:n.triggers[a.key],onCheckedChange:t(()=>f(a.key),"onCheckedChange"),className:"mt-0.5","aria-label":a.label}),(0,e.jsx)("span",{className:A(a.noisy&&"text-ink-3"),children:a.label})]},a.key))})]}),(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Guardrails"}),(0,e.jsxs)("label",{className:"flex items-start gap-2.5 text-sm",children:[(0,e.jsx)(Se,{checked:!!l,onCheckedChange:t(a=>y(!!a),"onCheckedChange"),className:"mt-0.5","aria-label":"Limit to active hours"}),(0,e.jsx)("span",{children:"Only auto-update during active hours"})]}),l?(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 pl-6 text-sm",children:[(0,e.jsx)(V,{type:"time",value:l.start,onChange:t(a=>c({activeHours:{...l,start:a.target.value}}),"onChange"),className:"h-8 w-32","aria-label":"Active hours start"}),(0,e.jsx)("span",{className:"text-ink-3",children:"–"}),(0,e.jsx)(V,{type:"time",value:l.end,onChange:t(a=>c({activeHours:{...l,end:a.target.value}}),"onChange"),className:"h-8 w-32","aria-label":"Active hours end"}),(0,e.jsx)(V,{value:l.timezone,onChange:t(a=>c({activeHours:{...l,timezone:a.target.value}}),"onChange"),className:"h-8 w-40",placeholder:"Timezone","aria-label":"Active hours timezone"})]}):null,(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,e.jsx)("span",{className:"w-32 shrink-0",children:"Daily token cap"}),(0,e.jsx)(V,{type:"number",min:0,step:1e3,value:n.dailyTokenCap??"",onChange:t(a=>{const x=Number(a.target.value);c({dailyTokenCap:a.target.value===""||x<=0?void 0:x})},"onChange"),className:"h-8 w-36",placeholder:"no cap","aria-label":"Daily token cap"})]})]})]})]}):null,(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,e.jsx)("span",{className:"font-semibold",children:"Estimated cost"}),(0,e.jsx)("span",{className:"text-ink-3",children:"="}),(0,e.jsxs)(ms,{children:[(0,e.jsx)(cs,{asChild:!0,children:(0,e.jsx)("span",{className:"cursor-default font-medium text-ink underline decoration-dotted decoration-ink-3/50 underline-offset-4",children:d.cost})}),(0,e.jsxs)(us,{className:"max-w-(--sz-18rem) text-left",children:[(0,e.jsx)("p",{children:d.primary}),d.note?(0,e.jsx)("p",{className:"mt-1 opacity-80",children:d.note}):null,(0,e.jsx)("p",{className:"mt-1 opacity-80",children:"Rough estimate from typical update sizes; actual cost is tracked per update."})]})]})]})]})}t(Gs,"StatusCardSettingsForm");function Js({card:s,companyId:r,open:n,onOpenChange:u,initialTab:d="summary"}){const c=be(),[h,f]=(0,p.useState)("summary"),[l,y]=(0,p.useState)(Ks()),[a,x]=(0,p.useState)(""),[m,g]=(0,p.useState)(""),[P,S]=(0,p.useState)(""),[w,C]=(0,p.useState)(null),[z,$]=(0,p.useState)(null),[j,H]=(0,p.useState)(null);(0,p.useEffect)(()=>{s&&(y({refreshPolicy:s.refreshPolicy}),x(s.title??""),g(s.interestPrompt),S(s.agentId??""),C(null),$(null),H(null))},[s]),(0,p.useEffect)(()=>{n&&f(d)},[n,d]);const U=_({queryKey:s?v.statusCards.updates(s.id):["status-cards","detail","none","updates"],queryFn:t(()=>b.updates(s.id),"queryFn"),enabled:!!(s&&n)}),oe=_({queryKey:s?v.statusCards.summaryRevisions(s.id):["status-cards","detail","none","summary-revisions"],queryFn:t(()=>b.summaryRevisions(s.id),"queryFn"),enabled:!!(s&&n&&s.documentId)}),T=_({queryKey:s?v.statusCards.dryRun(s.id):["status-cards","detail","none","dry-run"],queryFn:t(()=>b.dryRun(s.id),"queryFn"),enabled:!!(s&&n&&h==="watched"&&(s.queries.length>0||(s.mentionedIssueIds?.length??0)>0))}),N=s?Oe(s):"fresh",de=(0,p.useMemo)(()=>s&&N==="updating"&&s.generatingIssueId?{id:s.generatingIssueId,identifier:null,title:s.title??"Status update",status:"in_progress"}:null,[s,N]),D=Le(r,de),Z=t(async()=>{s&&await Promise.all([c.invalidateQueries({queryKey:v.statusCards.list(s.companyId,!1)}),c.invalidateQueries({queryKey:v.statusCards.detail(s.id)})])},"invalidateCard"),o=R({mutationFn:t(()=>b.refresh(s.id),"mutationFn"),onMutate:t(()=>{C(null),$(null)},"onMutate"),onSuccess:t(async()=>{await Z(),$("Refresh queued — the Summarizer is updating this card.")},"onSuccess"),onError:t(i=>C(i instanceof Error?i.message:"Could not refresh the card."),"onError")}),q=R({mutationFn:t(()=>b.recompile(s.id),"mutationFn"),onMutate:t(()=>{C(null),$(null)},"onMutate"),onSuccess:t(async()=>{await Z(),$("Run queued — the Summarizer is updating this card.")},"onSuccess"),onError:t(i=>C(i instanceof Error?i.message:"Could not run the card."),"onError")}),ce=R({mutationFn:t(()=>{const i=a.trim(),ue=m.trim(),Ve=ue.length>0&&ue!==s.interestPrompt.trim();return b.patch(s.id,{title:i||null,titlePinned:i.length>0,...Ve?{interestPrompt:ue}:{},agentId:P||null,refreshPolicy:l.refreshPolicy})},"mutationFn"),onMutate:t(()=>C(null),"onMutate"),onSuccess:t(async()=>{s&&await Promise.all([c.invalidateQueries({queryKey:v.statusCards.list(s.companyId,!1)}),c.invalidateQueries({queryKey:v.statusCards.detail(s.id)})])},"onSuccess"),onError:t(i=>C(i instanceof Error?i.message:"Could not save settings."),"onError")});if(!s)return null;const J=U.data??[],Ke=J[0]??null,ee=$s(J),L=J.filter(i=>i.status==="ok"&&i.finishedAt&&(i.kind==="full"||i.kind==="incremental")),k=j?L.find(i=>i.id===j)??null:null,Qe=oe.data??[],Ne=k?Qe[L.indexOf(k)]?.body??null:null,se=L.length,Ce=t(i=>se-L.indexOf(i),"revisionNumberOf"),te=k?k.changes:Ke?.changes??[],ke=ze[N],we=!!(s.summaryBody&&s.summaryBody.trim().length>0),K=N==="compiling"&&!!s.generatingIssueId;return(0,e.jsx)(Ms,{open:n,onOpenChange:u,children:(0,e.jsxs)(Es,{className:"flex w-full flex-col gap-0 p-0 sm:max-w-2xl",children:[(0,e.jsxs)(Is,{className:"border-b border-line p-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 pr-8",children:[(0,e.jsx)("span",{className:A("inline-block h-2.5 w-2.5 shrink-0 rounded-full",ke.dotClassName),"aria-hidden":"true"}),(0,e.jsx)(As,{className:"min-w-0 flex-1 truncate text-lg",children:s.title??"Untitled card"}),(0,e.jsx)(re,{variant:"outline",children:ke.label}),N==="compiling"?(0,e.jsxs)(M,{variant:"secondary",size:"sm",onClick:t(()=>q.mutate(),"onClick"),disabled:q.isPending||K,children:[K||q.isPending?(0,e.jsx)(E,{className:"h-3.5 w-3.5 animate-spin"}):(0,e.jsx)(Be,{className:"h-3.5 w-3.5"}),K?"Setting up…":q.isPending?"Running…":"Run now"]}):(0,e.jsxs)(M,{variant:"secondary",size:"sm",onClick:t(()=>o.mutate(),"onClick"),disabled:o.isPending||N==="updating",children:[(0,e.jsx)(_e,{className:A("h-3.5 w-3.5",o.isPending&&"animate-spin")}),o.isPending?"Refreshing…":"Refresh"]})]}),(0,e.jsxs)("p",{className:"text-xs text-ink-3",children:[s.lastGeneratedAt?`Updated ${F(s.lastGeneratedAt)}`:"No summary yet"," ·"," ",He(s.refreshPolicy)]})]}),(0,e.jsxs)(ls,{value:h,onValueChange:f,className:"flex min-h-0 flex-1 flex-col gap-0",children:[(0,e.jsxs)(rs,{variant:"line",className:"w-full justify-start gap-4 border-b border-line px-4",children:[(0,e.jsx)(ae,{value:"summary",children:"Summary"}),(0,e.jsx)(ae,{value:"settings",children:"Settings"}),(0,e.jsx)(ae,{value:"watched",children:"Watched issues"}),(0,e.jsx)(ae,{value:"history",children:"History"})]}),w?(0,e.jsx)("div",{className:"px-4 pt-3",children:(0,e.jsx)(G,{tone:"warning",title:"Heads up",children:w})}):z?(0,e.jsx)("div",{className:"px-4 pt-3",children:(0,e.jsx)(G,{tone:"info",title:"Working on it",children:z})}):null,(0,e.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:[(0,e.jsxs)(ne,{value:"summary",className:"mt-0 space-y-5",children:[(we||L.length>0)&&N!=="compiling"?(0,e.jsx)("div",{className:"flex items-center justify-end gap-2",children:L.length>1?(0,e.jsxs)(ge,{value:j??"__latest__",onValueChange:t(i=>H(i==="__latest__"?null:i),"onValueChange"),children:[(0,e.jsxs)(fe,{size:"sm",className:"w-auto gap-1.5","aria-label":"Select summary revision",children:[(0,e.jsx)(ks,{className:"h-3.5 w-3.5","aria-hidden":"true"}),(0,e.jsx)(je,{})]}),(0,e.jsxs)(ye,{align:"end",position:"popper",children:[(0,e.jsxs)(le,{value:"__latest__",className:"text-xs",children:["Revision ",se," · latest"]}),(0,e.jsx)(Cs,{}),L.slice(0,30).map(i=>(0,e.jsxs)(le,{value:i.id,className:"text-xs",title:ie(i.startedAt),children:["Rev ",Ce(i)," · ",me(i.kind)," · ",F(i.startedAt)]},i.id))]})]}):se>0?(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:["Revision ",se," · latest"]}):null}):null,N==="updating"&&D.draft&&!k?(0,e.jsx)(W,{className:"text-sm leading-7",children:D.draft}):k?(0,e.jsxs)("div",{className:"space-y-2 rounded-md border border-line bg-bg-3/30 p-3",children:[(0,e.jsxs)("p",{className:"text-xs text-ink-3",title:ie(k.startedAt),children:["Revision ",Ce(k)," · ",me(k.kind)," ·"," ",F(k.startedAt)]}),Ne?(0,e.jsx)(W,{className:"text-sm leading-7",children:Ne}):k.changeSummary?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(W,{className:"text-sm leading-7",children:k.changeSummary}),(0,e.jsx)("p",{className:"text-xs text-ink-3/70",children:"The full summary text for this revision is unavailable — showing its change summary. The integrated changes below are the live ledger for this revision."})]}):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No change summary was recorded for this revision."})]}):we?(0,e.jsx)(W,{className:"text-sm leading-7",children:s.summaryBody}):N==="compiling"?(0,e.jsxs)("div",{className:"space-y-2 text-sm text-ink-3",children:[(0,e.jsxs)("p",{className:"flex items-center gap-2",children:[K?(0,e.jsx)(E,{className:"h-4 w-4 shrink-0 animate-spin"}):(0,e.jsx)(pe,{className:"h-4 w-4 shrink-0 text-amber-500"}),K?"Setting up — the first summary is generated automatically once this finishes.":"Setup didn’t finish. Run it now to try again."]}),K&&s.generatingIssueId?(0,e.jsxs)(Y,{to:`/issues/${s.generatingIssueId}`,className:"inline-flex items-center gap-1.5 text-xs font-medium text-ink underline-offset-2 hover:underline",children:[(0,e.jsx)(xe,{className:"h-3.5 w-3.5"}),"View setup task"]}):null]}):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No summary yet — the first one is generated automatically once this card finishes setting up."}),te.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsxs)("h3",{className:"text-xs font-semibold uppercase tracking-wide text-ink-3",children:[k?"Integrated in this revision":"Integrated in this update"," (",te.length," ",te.length===1?"change":"changes",")"]}),(0,e.jsx)("div",{className:"space-y-1.5",children:te.map(i=>(0,e.jsx)(Zs,{change:i},i.issueId))})]}):null]}),(0,e.jsx)(ne,{value:"history",className:"mt-0 space-y-3",children:U.isLoading?(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm text-ink-3",children:[(0,e.jsx)(E,{className:"h-4 w-4 animate-spin"})," Loading history…"]}):J.length===0?(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"No updates recorded yet."}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"text-xs text-ink-3",children:["Today: ",ee.updateCount," ",ee.updateCount===1?"update":"updates"," ·"," ",B(ee.totalTokens)," · ",O(ee.totalCostCents),s.refreshPolicy.dailyTokenCap?` · daily cap ${B(s.refreshPolicy.dailyTokenCap)}`:""]}),(0,e.jsx)("div",{className:"divide-y divide-line",children:J.map(i=>(0,e.jsxs)("div",{className:"py-2.5 first:pt-1",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium",children:[me(i.kind),(0,e.jsx)(re,{variant:i.status==="failed"?"destructive":"secondary",children:i.status==="ok"?i.trigger:i.status})]}),(0,e.jsx)("span",{className:"text-xs text-ink-3",title:ie(i.startedAt),children:F(i.startedAt)})]}),(0,e.jsxs)("p",{className:"mt-1 text-xs text-ink-3",children:[Ls(i.inputTokens,i.outputTokens)," · ",O(i.costCents),i.model?` · ${i.model}`:"",i.changes.length>0?` · ${i.changes.length} changes`:""]}),i.error?(0,e.jsx)("p",{className:"mt-1 text-xs text-bad",children:i.error}):null]},i.id))})]})}),(0,e.jsx)(ne,{value:"watched",className:"mt-0 space-y-3",children:s.queries.length===0&&(s.mentionedIssueIds?.length??0)===0?(0,e.jsx)("div",{className:"rounded-md border border-dashed border-line px-3 py-4 text-sm text-ink-3",children:"This card is still setting up — the issues it watches appear here once it's ready."}):T.isLoading?(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm text-ink-3",children:[(0,e.jsx)(E,{className:"h-4 w-4 animate-spin"})," Matching issues…"]}):T.isError?(0,e.jsx)(G,{tone:"danger",title:"Could not load matched issues",children:T.error instanceof Error?T.error.message:"Try again."}):(0,e.jsx)(Ys,{queries:T.data?.queries??[],mentioned:T.data?.mentionedIssues??[]})}),(0,e.jsxs)(ne,{value:"settings",className:"mt-0 space-y-6",children:[(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Card name"}),(0,e.jsx)(V,{value:a,onChange:t(i=>x(i.target.value),"onChange"),placeholder:"Auto-named from the query",className:"text-sm","aria-label":"Card name"})]}),(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"What this card watches & reports"}),(0,e.jsx)(De,{value:m,onChange:t(i=>g(i.target.value),"onChange"),rows:3,className:"text-sm","aria-label":"What this card watches & reports"}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:"This one message drives the whole card: the agent compiles the watch query from it and follows it as the instructions for every update. Editing it rebuilds the card."})]}),(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold",children:"Agent"}),(0,e.jsx)(Ue,{companyId:s.companyId,value:P,onChange:S,enabled:n})]}),(0,e.jsx)(Gs,{value:l,onChange:y}),(0,e.jsx)(Xs,{card:s}),(0,e.jsx)("div",{className:"flex justify-end border-t border-line pt-4",children:(0,e.jsxs)(M,{onClick:t(()=>ce.mutate(),"onClick"),disabled:ce.isPending,children:[ce.isPending?(0,e.jsx)(E,{className:"animate-spin"}):null,"Save"]})})]})]})]})]})})}t(Js,"StatusCardDetailDrawer");function Xs({card:s}){const r=JSON.stringify({queries:s.queries,limit:50},null,2);return(0,e.jsxs)(qe,{className:"rounded-md border border-line",children:[(0,e.jsxs)($e,{className:"group flex w-full items-center justify-between gap-2 px-3 py-2.5 text-sm font-semibold",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2",children:["Query debug",(0,e.jsxs)(re,{variant:"secondary",children:["v",s.queryVersion]})]}),(0,e.jsx)(Re,{className:"h-4 w-4 text-ink-3 transition-transform group-data-[state=open]:rotate-180"})]}),(0,e.jsxs)(Pe,{className:"space-y-2 border-t border-line px-3 py-3",children:[(0,e.jsx)("pre",{className:"max-h-64 overflow-auto rounded-md bg-bg-3 p-3 font-mono text-xs text-ink",children:s.queries.length>0?r:"// query not compiled yet"}),(0,e.jsx)("p",{className:"text-xs text-ink-3",children:s.queryCompiledAt?`Compiled by Summarizer ${F(s.queryCompiledAt)} · version ${s.queryVersion}. Edit “What this card watches” above to rebuild it.`:"Not compiled yet. The query builds automatically once the card finishes setting up."})]})]})}t(Xs,"QueryDebugSection");function Ys({queries:s,mentioned:r}){const n=new Set,u=[];for(const{result:c}of s)for(const h of c.results)!h.issue||n.has(h.issue.id)||(n.add(h.issue.id),u.push(h.issue));const d=r.filter(c=>!n.has(c.id));return u.length===0&&d.length===0?(0,e.jsx)("div",{className:"rounded-md border border-dashed border-line px-3 py-4 text-sm text-ink-3",children:"The compiled query matches no issues right now."}):(0,e.jsxs)("div",{className:"space-y-3",children:[u.length>0?(0,e.jsx)("div",{className:"space-y-1.5",children:u.map(c=>(0,e.jsx)(Ae,{issue:c},c.id))}):null,d.length>0?(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("p",{className:"text-xs font-medium text-ink-3",children:"Mentioned in the latest update"}),d.map(c=>(0,e.jsx)(Ae,{issue:c},c.id))]}):null]})}t(Ys,"MatchedIssueList");function Ae({issue:s}){return(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-line px-3 py-2 text-xs",children:[(0,e.jsx)(Y,{to:`/issues/${s.identifier??s.id}`,className:"shrink-0 font-medium text-ink-3 underline-offset-2 hover:text-ink hover:underline",children:s.identifier??s.id.slice(0,8)}),(0,e.jsx)(ve,{status:s.status,externalConversationState:s.externalConversationState}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate",children:s.title}),(0,e.jsx)("span",{className:"shrink-0 text-ink-3",children:F(s.updatedAt)})]})}t(Ae,"WatchedIssueRow");function Zs({change:s}){const r=!!(s.from&&s.to);return(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-line px-3 py-2 text-xs",children:[(0,e.jsx)(Y,{to:`/issues/${s.identifier}`,className:"shrink-0 font-medium text-ink-3 underline-offset-2 hover:text-ink hover:underline",children:s.identifier}),r?(0,e.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,e.jsx)(ve,{status:s.from}),(0,e.jsx)("span",{"aria-hidden":"true",className:"text-ink-3",children:"→"}),(0,e.jsx)(ve,{status:s.to})]}):(0,e.jsx)("span",{className:"truncate text-ink-3",children:et(s.changeKind)})]})}t(Zs,"ChangeRow");function et(s){return s==="entered_query"||s==="new"?"new issue matched the query":s==="left_query"?"left the query":s.replace(/_/g," ")}t(et,"describeChangeKind");function _t(){const{selectedCompanyId:s}=Ze(),{setBreadcrumbs:r}=bs(),n=ss(),u=be(),{cardId:d}=Ye(),[c,h]=(0,p.useState)(!1),[f,l]=(0,p.useState)(!1),[y,a]=(0,p.useState)("summary"),[x,m]=(0,p.useState)(null);(0,p.useEffect)(()=>{r([{label:"Status"}])},[r]);const g=_({queryKey:s?v.statusCards.list(s,!1):["status-cards","none","active"],queryFn:t(()=>b.list(s,!1),"queryFn"),enabled:!!s}),P=_({queryKey:s?v.statusCards.list(s,!0):["status-cards","none","archived"],queryFn:t(()=>b.list(s,!0),"queryFn"),enabled:!!s}),S=g.data??[],w=P.data??[],C=(0,p.useMemo)(()=>[...S,...w].find(o=>o.id===d)??null,[S,w,d]),z=_({queryKey:d?v.statusCards.detail(d):["status-cards","detail","none"],queryFn:t(()=>b.get(d),"queryFn"),enabled:!!d&&!C}),$=C??z.data??null,j=t(()=>s?Promise.all([u.invalidateQueries({queryKey:v.statusCards.list(s,!1)}),u.invalidateQueries({queryKey:v.statusCards.list(s,!0)})]):Promise.resolve(),"invalidateLists"),H=R({mutationFn:t(o=>b.refresh(o),"mutationFn"),onMutate:t(()=>m(null),"onMutate"),onSuccess:t(()=>j(),"onSuccess"),onError:t(o=>m(o instanceof Error?o.message:"Could not refresh the card."),"onError")}),U=R({mutationFn:t(o=>b.recompile(o),"mutationFn"),onMutate:t(()=>m(null),"onMutate"),onSuccess:t(()=>j(),"onSuccess"),onError:t(o=>m(o instanceof Error?o.message:"Could not run the card."),"onError")}),oe=R({mutationFn:t(o=>b.patch(o,{archived:!0}),"mutationFn"),onMutate:t(()=>m(null),"onMutate"),onSuccess:t(()=>j(),"onSuccess"),onError:t(o=>m(o instanceof Error?o.message:"Could not archive the card."),"onError")}),T=R({mutationFn:t(o=>b.patch(o,{archived:!1}),"mutationFn"),onMutate:t(()=>m(null),"onMutate"),onSuccess:t(()=>j(),"onSuccess"),onError:t(o=>m(o instanceof Error?o.message:"Could not restore the card."),"onError")}),N=t((o,q="summary")=>{a(q),n(`/status/${o}`)},"openDetail"),de=t(()=>n("/status"),"closeDetail"),D=S.reduce((o,q)=>({tokens:o.tokens+(q.todayTokens??0),cents:o.cents+(q.todayCostCents??0)}),{tokens:0,cents:0}),Z=D.tokens>0||D.cents>0;return(0,e.jsxs)("div",{className:"mx-auto max-w-6xl space-y-5",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsx)("h1",{className:"text-xl font-bold",children:"Status"}),(0,e.jsxs)(re,{variant:"secondary",className:"gap-1",children:[(0,e.jsx)(Te,{className:"h-3 w-3"}),"Beta"]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[Z?(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:["Today: ",B(D.tokens)," · ~",O(D.cents)]}):null,(0,e.jsxs)(M,{onClick:t(()=>l(!0),"onClick"),disabled:!s,children:[(0,e.jsx)(ds,{className:"h-4 w-4"}),"New card"]})]})]}),x?(0,e.jsx)(G,{tone:"warning",title:"Heads up",children:x}):null,g.isLoading?(0,e.jsxs)("div",{className:"flex items-center gap-2 py-12 text-sm text-ink-3",children:[(0,e.jsx)(E,{className:"h-4 w-4 animate-spin"})," Loading cards…"]}):g.isError?(0,e.jsx)(G,{tone:"danger",title:"Could not load status cards",children:g.error instanceof Error?g.error.message:"Try again."}):S.length===0?(0,e.jsx)(ws,{icon:Te,title:"No status cards yet",message:"Create a card to keep a living summary of the issues you care about.",action:s?"New card":void 0,onAction:t(()=>l(!0),"onAction")}):(0,e.jsx)("div",{className:"grid gap-4 sm:grid-cols-2",children:S.map(o=>(0,e.jsx)(Os,{card:o,companyId:s,onOpen:t(()=>N(o.id),"onOpen"),onRefresh:t(()=>H.mutate(o.id),"onRefresh"),onRecompile:t(()=>U.mutate(o.id),"onRecompile"),onEditInterest:t(()=>N(o.id,"settings"),"onEditInterest"),onOpenDebug:t(()=>N(o.id,"settings"),"onOpenDebug"),onArchive:t(()=>oe.mutate(o.id),"onArchive"),refreshPending:H.isPending&&H.variables===o.id,recompilePending:U.isPending&&U.variables===o.id},o.id))}),w.length>0?(0,e.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,e.jsx)("button",{type:"button",onClick:t(()=>h(o=>!o),"onClick"),className:"text-xs text-ink-3 underline-offset-2 hover:text-ink hover:underline",children:c?"Hide archived":`Show archived (${w.length})`}),c?w.map(o=>(0,e.jsx)(zs,{card:o,onView:t(()=>N(o.id),"onView"),onRestore:t(()=>T.mutate(o.id),"onRestore"),restorePending:T.isPending&&T.variables===o.id},o.id)):null]}):null,s?(0,e.jsx)(Us,{companyId:s,open:f,onOpenChange:l}):null,(0,e.jsx)(Js,{card:$,companyId:s,open:!!d,onOpenChange:t(o=>o?void 0:de(),"onOpenChange"),initialTab:y})]})}t(_t,"StatusCards");export{_t as StatusCards,_t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _=Object.defineProperty;var i=(e,r)=>_(e,"name",{value:r,configurable:!0});import{i as B}from"./rolldown-runtime-ZpX3ckPj.js";import{l as v,la as j,ua as w}from"./createLucideIcon-CgrPXnTY.js";import{b as $}from"./router-
|
|
1
|
+
var _=Object.defineProperty;var i=(e,r)=>_(e,"name",{value:r,configurable:!0});import{i as B}from"./rolldown-runtime-ZpX3ckPj.js";import{l as v,la as j,ua as w}from"./createLucideIcon-CgrPXnTY.js";import{b as $}from"./router-CJbFZfVR.js";import{o as C,r as b,t as I}from"./popover-CWlBonqy.js";import{t as N}from"./button-DI4w5WP7.js";var S=B(w(),1),s=B(j(),1),q=["backlog","todo","in_progress","in_review","done","cancelled","blocked"];function l(e){return e.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}i(l,"statusLabel");function P(e){if(!e||e.state==="none")return"Blocked";if(e.reason==="active_child"){const r=e.coveredBlockerCount;return r===1&&e.sampleBlockerIdentifier?`Blocked · waiting on active sub-task ${e.sampleBlockerIdentifier}`:r===1?"Blocked · waiting on 1 active sub-task":`Blocked · waiting on ${r} active sub-tasks`}if(e.reason==="active_dependency"){const r=e.coveredBlockerCount;return r===1&&e.sampleBlockerIdentifier?`Blocked · covered by active dependency ${e.sampleBlockerIdentifier}`:r===1?"Blocked · covered by 1 active dependency":`Blocked · covered by ${r} active dependencies`}if(e.reason==="stalled_review"){const r=e.stalledBlockerCount,t=e.sampleStalledBlockerIdentifier??e.sampleBlockerIdentifier;return r===1&&t?`Blocked · review stalled on ${t}`:r===1?"Blocked · review stalled with no clear next step":`Blocked · ${r} reviews stalled with no clear next step`}if(e.reason==="attention_required"){const r=e.attentionBlockerCount||e.unresolvedBlockerCount,t=`${r} ${r===1?"blocker needs":"blockers need"} attention`,n=e.coveredBlockerCount;return n>0?`Blocked · ${t}; ${n} covered by active work`:`Blocked · ${t}`}return"Blocked"}i(P,"blockedAttentionLabel");function z({status:e,externalConversationState:r,blockerAttention:t,onChange:n,className:g,glyphContainerClassName:p,showLabel:d,size:x="md"}){const[h,f]=(0,S.useState)(!1),o=e==="in_review"&&r==="waiting"?"idle":e,k=e==="blocked"&&t?.state==="covered",u=e==="blocked"?P(t):l(o),m=(0,s.jsx)($,{status:k?"in_queue":o,size:x,className:v(n&&!d&&"cursor-pointer",g),title:u}),c=p?(0,s.jsx)("span",{className:p,"data-status-glyph-container":"true",children:m}):m;if(!n)return d?(0,s.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[c,(0,s.jsx)("span",{className:"text-sm",children:l(o)})]}):c;const y=d?(0,s.jsxs)("button",{type:"button","aria-label":`Change status (current: ${u})`,className:"inline-flex min-h-5 items-center gap-1.5 cursor-pointer hover:bg-bg-3/50 rounded px-1 -mx-1 py-0.5 transition-colors",children:[c,(0,s.jsx)("span",{className:"text-sm",children:l(o)})]}):(0,s.jsx)("button",{type:"button","data-slot":"icon-button","aria-label":`Change status (current: ${u})`,className:"inline-flex cursor-pointer items-center justify-center rounded-sm focus-visible:outline-none focus-visible:ring-(length:--rad-3) focus-visible:ring-focus",children:c});return(0,s.jsxs)(I,{open:h,onOpenChange:f,children:[(0,s.jsx)(C,{asChild:!0,children:y}),(0,s.jsx)(b,{className:"w-40 p-1",align:"start",children:q.map(a=>(0,s.jsxs)(N,{active:a===e,variant:"ghost",size:"sm",className:v("w-full justify-start gap-2 text-xs"),onClick:i(()=>{n(a),f(!1)},"onClick"),children:[(0,s.jsx)(z,{status:a,size:"lg"}),l(a)]},a))})]})}i(z,"StatusIcon");export{z as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var fe=Object.defineProperty;var a=(s,d)=>fe(s,"name",{value:d,configurable:!0});import{i as oe}from"./rolldown-runtime-ZpX3ckPj.js";import{O as ye,S as te,h as H,l as je,la as ve,ua as ke}from"./createLucideIcon-CgrPXnTY.js";import{X as de,_ as X,r as Q,t as x,v as E}from"./queryKeys-BzT8CD34.js";import{J as ae,t as Y}from"./router-BKzUF9uf.js";import{t as Ne}from"./bot-kSfD9MPZ.js";import{t as ne}from"./MarkdownBody-D7qCQaU_.js";import{r as T,t as g}from"./button-DI4w5WP7.js";import{t as we}from"./refresh-cw-CfzWP9se.js";import{t as M}from"./badge-jeXr866I.js";import{a as Se}from"./ToastContext-DyVJ6bCh.js";import{t as _e}from"./agents-B8n-p0aX.js";import{t as Ce}from"./instanceSettings-D1nNVWU0.js";import{a as Re,i as Ae,n as Ee,r as Te,s as Le,t as Pe}from"./dialog-CeH7rDcv.js";import{t as I}from"./InlineBanner-DYx7A02D.js";import{a as qe,i as ie,n as Ie,o as ze,r as Be,s as De}from"./select-DNiRU1d9.js";import{Pa as Fe,Qa as Ke,fr as re,ht as We,va as $e}from"./index-D1wQsid4.js";import{t as Qe}from"./ConfigureBuiltInAgentModal-v8kbSAuE.js";import{t as Me}from"./useSummaryDraftStream-DQYbVHb7.js";var e=oe(ve(),1);function Ue(s){return s==="blocked"?"border-bad/30 bg-bad/5 text-bad":s==="ready_with_warnings"?"border-amber-500/30 bg-amber-500/10 text-amber-800 dark:text-amber-300":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"}a(Ue,"readinessTone");function js({workspaceId:s,workspaceName:d,currentStatus:l,open:m,onOpenChange:p,onClosed:L}){const C=de(),{pushToast:v}=Se(),R=l==="cleanup_failed"?"Retry close":"Close workspace",u=E({queryKey:x.executionWorkspaces.closeReadiness(s),queryFn:a(()=>re.getCloseReadiness(s),"queryFn"),enabled:m}),f=X({mutationFn:a(()=>re.update(s,{status:"archived"}),"mutationFn"),onSuccess:a(t=>{C.setQueryData(x.executionWorkspaces.detail(t.id),t),C.invalidateQueries({queryKey:x.executionWorkspaces.overview(t.companyId)}),C.invalidateQueries({queryKey:x.executionWorkspaces.closeReadiness(t.id)}),v({title:l==="cleanup_failed"?"Workspace close retried":"Workspace closed",tone:"success"}),p(!1),L?.(t)},"onSuccess"),onError:a(t=>{v({title:"Failed to close workspace",body:t instanceof Error?t.message:"Unknown error",tone:"error"})},"onError")}),n=u.data??null,A=n?.linkedIssues.filter(t=>!t.isTerminal)??[],k=n?.linkedIssues.filter(t=>t.isTerminal)??[],r=l==="archived"||f.isPending||u.isLoading||n==null||n.state==="blocked";return(0,e.jsx)(Pe,{open:m,onOpenChange:a(t=>{f.isPending||p(t)},"onOpenChange"),children:(0,e.jsxs)(Ee,{className:"max-h-(--sz-85vh) overflow-y-auto sm:max-w-2xl",children:[(0,e.jsxs)(Re,{children:[(0,e.jsx)(Le,{children:R}),(0,e.jsxs)(Te,{className:"break-words",children:["Archive ",(0,e.jsx)("span",{className:"font-medium text-ink",children:d})," and clean up any owned workspace artifacts. Wardmote keeps the workspace record and task history, but removes it from active workspace views."]})]}),u.isLoading?(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-xl border border-line bg-bg px-4 py-3 text-sm text-ink-3",children:[(0,e.jsx)(T,{className:"h-4 w-4 animate-spin"}),"Checking whether this workspace is safe to close..."]}):u.error?(0,e.jsx)("div",{className:"rounded-xl border border-bad/30 bg-bad/5 px-4 py-3 text-sm text-bad",children:u.error instanceof Error?u.error.message:"Failed to inspect workspace close readiness."}):n?(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:`rounded-xl border px-4 py-3 text-sm ${Ue(n.state)}`,children:[(0,e.jsx)("div",{className:"font-medium",children:n.state==="blocked"?"Close is blocked":n.state==="ready_with_warnings"?"Close is allowed with warnings":"Close is ready"}),(0,e.jsx)("div",{className:"mt-1 text-xs opacity-80",children:n.isSharedWorkspace?"This is a shared workspace session. Archiving it removes this session record but keeps the underlying project workspace.":n.git?.workspacePath&&n.git.repoRoot&&n.git.workspacePath!==n.git.repoRoot?"This execution workspace has its own checkout path and can be archived independently.":n.isProjectPrimaryWorkspace?"This execution workspace currently points at the project's primary workspace path.":"This workspace is disposable and can be archived."})]}),A.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Blocking tasks"}),(0,e.jsx)("div",{className:"space-y-2",children:A.map(t=>(0,e.jsx)("div",{className:"rounded-xl border border-bad/20 bg-bad/5 px-4 py-3 text-sm",children:(0,e.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2",children:[(0,e.jsxs)(Y,{to:te(t),className:"min-w-0 break-words font-medium hover:underline",children:[t.identifier??t.id," · ",t.title]}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:t.status})]})},t.id))})]}):null,n.blockingReasons.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Blocking reasons"}),(0,e.jsx)("ul",{className:"space-y-2 text-sm text-ink-3",children:n.blockingReasons.map(t=>(0,e.jsx)("li",{className:"break-words rounded-lg border border-bad/20 bg-bad/5 px-3 py-2 text-bad",children:t},t))})]}):null,n.warnings.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Warnings"}),(0,e.jsx)("ul",{className:"space-y-2 text-sm text-ink-3",children:n.warnings.map(t=>(0,e.jsx)("li",{className:"break-words rounded-lg border border-amber-500/20 bg-amber-500/5 px-3 py-2",children:t},t))})]}):null,n.git?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Git status"}),(0,e.jsx)("div",{className:"rounded-xl border border-line bg-bg px-4 py-3 text-sm",children:(0,e.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-ink-3",children:"Branch"}),(0,e.jsx)("div",{className:"font-mono text-xs",children:n.git.branchName??"Unknown"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-ink-3",children:"Base ref"}),(0,e.jsx)("div",{className:"font-mono text-xs",children:n.git.baseRef??"Not set"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-ink-3",children:"Merged into base"}),(0,e.jsx)("div",{children:n.git.isMergedIntoBase==null?"Unknown":n.git.isMergedIntoBase?"Yes":"No"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-ink-3",children:"Ahead / behind"}),(0,e.jsxs)("div",{children:[(n.git.aheadCount??0).toString()," / ",(n.git.behindCount??0).toString()]})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-ink-3",children:"Dirty tracked files"}),(0,e.jsx)("div",{children:n.git.dirtyEntryCount})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-ink-3",children:"Untracked files"}),(0,e.jsx)("div",{children:n.git.untrackedEntryCount})]})]})})]}):null,k.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Other linked tasks"}),(0,e.jsx)("div",{className:"space-y-2",children:k.map(t=>(0,e.jsx)("div",{className:"rounded-xl border border-line bg-bg px-4 py-3 text-sm",children:(0,e.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2",children:[(0,e.jsxs)(Y,{to:te(t),className:"min-w-0 break-words font-medium hover:underline",children:[t.identifier??t.id," · ",t.title]}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:t.status})]})},t.id))})]}):null,n.runtimeServices.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Attached runtime services"}),(0,e.jsx)("div",{className:"space-y-2",children:n.runtimeServices.map(t=>(0,e.jsxs)("div",{className:"rounded-xl border border-line bg-bg px-4 py-3 text-sm",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2",children:[(0,e.jsx)("span",{className:"font-medium",children:t.serviceName}),(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:[t.status," · ",t.lifecycle]})]}),(0,e.jsx)("div",{className:"mt-1 break-words text-xs text-ink-3",children:t.url??t.command??"No additional details"})]},t.id))})]}):null,(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Cleanup actions"}),(0,e.jsx)("div",{className:"space-y-2",children:n.plannedActions.map((t,N)=>(0,e.jsxs)("div",{className:"rounded-xl border border-line bg-bg px-4 py-3 text-sm",children:[(0,e.jsx)("div",{className:"font-medium",children:t.label}),(0,e.jsx)("div",{className:"mt-1 break-words text-ink-3",children:t.description}),t.command?(0,e.jsx)("pre",{className:"mt-2 whitespace-pre-wrap break-all rounded-lg bg-bg px-3 py-2 font-mono text-xs text-ink",children:t.command}):null]},`${t.kind}-${N}`))})]}),l==="cleanup_failed"?(0,e.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/5 px-4 py-3 text-sm text-ink-3",children:"Cleanup previously failed on this workspace. Retrying close will rerun the cleanup flow and update the workspace status if it succeeds."}):null,l==="archived"?(0,e.jsx)("div",{className:"rounded-xl border border-line bg-bg px-4 py-3 text-sm text-ink-3",children:"This workspace is already archived."}):null,n.git?.repoRoot?(0,e.jsxs)("div",{className:"break-words text-xs text-ink-3",children:["Repo root: ",(0,e.jsx)("span",{className:"font-mono break-all",children:n.git.repoRoot}),n.git.workspacePath?(0,e.jsxs)(e.Fragment,{children:[" · ","Workspace path: ",(0,e.jsx)("span",{className:"font-mono break-all",children:n.git.workspacePath})]}):null]}):null,(0,e.jsxs)("div",{className:"text-xs text-ink-3",children:["Last checked ",H(new Date(u.dataUpdatedAt))]})]}):null,(0,e.jsxs)(Ae,{children:[(0,e.jsx)(g,{variant:"secondary",onClick:a(()=>p(!1),"onClick"),disabled:f.isPending,children:"Cancel"}),(0,e.jsxs)(g,{variant:l==="cleanup_failed"?"primary":"delete",onClick:a(()=>f.mutate(),"onClick"),disabled:r,children:[f.isPending?(0,e.jsx)(T,{className:"mr-2 h-4 w-4 animate-spin"}):null,R]})]})]})})}a(js,"ExecutionWorkspaceCloseDialog");var _=oe(ke(),1);function U(s,d=""){const l=new URLSearchParams;s.scopeId&&l.set("scopeId",s.scopeId);const m=l.toString();return[`/companies/${s.companyId}/summary-slots/${s.scopeKind}/${s.slotKey}`,d,m?`?${m}`:""].join("")}a(U,"summarySlotPath");var G={get:a(s=>Q.get(U(s)),"get"),revisions:a(s=>Q.get(U(s,"/revisions")),"revisions"),generate:a(s=>Q.post(U(s,"/generate"),{scopeId:s.scopeId??null}),"generate")},Ge="summarizer",Oe=new Set(["done","cancelled"]),O="__latest__",Ve=30;function He(s){return s.identifier?`${s.identifier}: ${s.title}`:s.title}a(He,"issueLabel");function Xe(s){return`Rev ${s.revisionNumber}`}a(Xe,"revisionLabel");function ce(s){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(new Date(s)).replace(",","")}a(ce,"formatRevisionTimestamp");function le(s){return`${Xe(s)} - ${ce(s.createdAt)}`}a(le,"revisionOptionLabel");function Ye(s,d){return`Latest (Rev ${s.latestRevisionNumber}) - ${ce(d?.createdAt??s.updatedAt)}`}a(Ye,"latestRevisionOptionLabel");function V(s){return typeof s=="string"&&s.trim().length>0?s.trim():null}a(V,"readPayloadString");function Je(s){return s?s.message?s.message:s.lastAssistantSnippet?s.lastAssistantSnippet:s.currentToolName?`Working with ${s.currentToolName}`:null:null}a(Je,"resolveGenerationStatusLine");function Ze(s){const[d,l]=(0,_.useState)(null);return(0,_.useEffect)(()=>{l(null)},[s]),We(m=>{if(!s||m.type!=="heartbeat.run.progress")return;const p=m.payload??{};p.issueId===s&&l({message:V(p.message),currentToolName:V(p.currentToolName),lastAssistantSnippet:V(p.lastAssistantSnippet)})}),s?d:null}a(Ze,"useGenerationStatus");function es(s){return s&&(s.status==="not_provisioned"||s.status==="needs_setup"||s.status==="pending_approval")?s:null}a(es,"setupState");function vs({companyId:s,scopeKind:d,scopeId:l=null,slotKey:m="header",title:p,description:L,className:C}){const v=de(),[R,u]=(0,_.useState)(null),[f,n]=(0,_.useState)(!1),[A,k]=(0,_.useState)(null),r=s?{companyId:s,scopeKind:d,scopeId:l,slotKey:m}:null,t=E({queryKey:x.instance.experimentalSettings,queryFn:a(()=>Ce.getExperimental(),"queryFn")}),N=t.data?.enableSummaries===!0,me=t.data?.enableBuiltInAgents===!0,w=E({queryKey:x.builtInAgents.list(s??"__none__"),queryFn:a(()=>$e.list(s),"queryFn"),enabled:!!(s&&N&&me),retry:!1}).data?.find(i=>i.definition.key===Ge),S=es(w),J=r?x.summarySlots.detail(r.companyId,r.scopeKind,r.slotKey,r.scopeId):x.summarySlots.detail("__none__",d,m,l),Z=r?x.summarySlots.revisions(r.companyId,r.scopeKind,r.slotKey,r.scopeId):x.summarySlots.revisions("__none__",d,m,l),c=E({queryKey:J,queryFn:a(()=>G.get(r),"queryFn"),enabled:!!(r&&N),retry:!1,refetchInterval:a(i=>i.state.data?.slot?.status==="generating"?3e3:!1,"refetchInterval")}),ue=E({queryKey:Z,queryFn:a(()=>G.revisions(r),"queryFn"),enabled:!!(r&&N&&c.data?.document),retry:!1}),h=X({mutationFn:a(()=>G.generate(r),"mutationFn"),onMutate:a(()=>k(null),"onMutate"),onSuccess:a(async()=>{u(null),await Promise.all([v.invalidateQueries({queryKey:J}),v.invalidateQueries({queryKey:Z})])},"onSuccess"),onError:a(i=>{k(i instanceof Error?i.message:"Summary generation could not be started.")},"onError")}),z=X({mutationFn:a(i=>_e.resume(i,s??void 0),"mutationFn"),onSuccess:a(async()=>{s&&await v.invalidateQueries({queryKey:x.builtInAgents.list(s)})},"onSuccess")}),y=ue.data?.revisions??[],o=c.data?.document??null,B=(0,_.useMemo)(()=>y.find(i=>i.id===R)??null,[y,R]),D=o?y.find(i=>i.id===o.latestRevisionId)??null:null,j=B&&B.id!==o?.latestRevisionId?B:null,xe=j?.body??o?.body??"",F=!!j,ee=(o?y.filter(i=>i.id!==o.latestRevisionId):y).toSorted((i,be)=>be.revisionNumber-i.revisionNumber).slice(0,Ve-(o?1:0)),pe=j?.id??O,se=o?Ye(o,D):"Latest",b=c.data?.generatingIssue??null,he=Je(Ze(b?.id??null)),P=Me(s,b),K=P.statusLine??he,q=c.data?.slot?.status==="generating"&&b&&!Oe.has(b.status),W=c.data?.slot?.status==="failed",ge=w?.status==="ready";if(t.isLoading||!N)return null;const $=a(()=>{!r||h.isPending||h.mutate()},"startGeneration");return(0,e.jsxs)("section",{className:je("space-y-4",C),children:[(0,e.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(ae,{className:"h-4 w-4 text-ink-3","aria-hidden":"true"}),(0,e.jsx)("h2",{className:"text-sm font-semibold",children:p}),q?(0,e.jsx)(M,{variant:"secondary",children:"Generating"}):null,F?(0,e.jsx)(M,{variant:"outline",children:"Historical revision"}):null,o&&!F?(0,e.jsx)(M,{variant:"outline",children:"Latest revision"}):null]}),L?(0,e.jsx)("p",{className:"text-sm text-ink-3",children:L}):null]}),(0,e.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[F?(0,e.jsx)(g,{type:"button",size:"sm",variant:"secondary",onClick:a(()=>u(null),"onClick"),children:"Latest"}):null,o&&!W?(0,e.jsxs)(g,{type:"button",size:"sm",variant:"secondary",onClick:$,disabled:!r||h.isPending||!!q,children:[h.isPending?(0,e.jsx)(T,{className:"animate-spin"}):(0,e.jsx)(we,{}),"Refresh"]}):null]})]}),S?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex flex-col items-start gap-3 rounded-lg border border-line bg-bg-3/30 p-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[S.status==="pending_approval"?(0,e.jsx)(Ke,{className:"mt-0.5 h-4 w-4 shrink-0 text-ink-3"}):(0,e.jsx)(Ne,{className:"mt-0.5 h-4 w-4 shrink-0 text-ink-3"}),(0,e.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,e.jsx)("p",{className:"font-medium text-ink",children:S.status==="pending_approval"?"Summarizer setup is pending approval":"Set up the Summarizer"}),(0,e.jsx)("p",{className:"text-ink-3",children:"Summaries are generated by Wardmote's built-in Summarizer agent. Configure its adapter and model before requesting this summary."})]})]}),S.status==="pending_approval"?null:(0,e.jsx)(g,{type:"button",size:"sm",onClick:a(()=>n(!0),"onClick"),children:"Set up Summarizer"})]}),s?(0,e.jsx)(Qe,{companyId:s,state:S,open:f,onOpenChange:n,onConfigured:a(()=>k(null),"onConfigured")}):null]}):null,!S&&w?.status==="paused"&&w.agent?(0,e.jsx)(I,{tone:"warning",title:"Summarizer is paused",actions:(0,e.jsx)(g,{type:"button",size:"sm",onClick:a(()=>w.agent&&z.mutate(w.agent.id),"onClick"),disabled:z.isPending,children:z.isPending?"Resuming...":"Resume agent"}),children:"Existing summaries remain readable, but new summaries will not be generated until the agent resumes."}):null,A?(0,e.jsx)(I,{tone:"warning",title:"Summary request failed",children:A}):null,c.isError?(0,e.jsx)(I,{tone:"warning",title:"Summary could not be loaded",actions:(0,e.jsx)(g,{type:"button",size:"sm",variant:"secondary",onClick:a(()=>{c.refetch()},"onClick"),children:"Retry"}),children:c.error instanceof Error?c.error.message:"Try loading the summary again."}):null,!c.isError&&W?(0,e.jsx)(I,{tone:"danger",title:"Summary generation failed",actions:(0,e.jsx)(g,{type:"button",size:"sm",onClick:$,disabled:!r||h.isPending,children:h.isPending?"Retrying...":"Retry"}),children:c.data?.slot?.failureReason??"The generation task ended before writing a summary."}):null,!c.isError&&q&&b?(0,e.jsxs)("div",{className:"flex items-start gap-3 text-sm",children:[(0,e.jsx)(T,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-ink-3"}),(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsx)("p",{className:"font-medium text-ink",children:"Generating summary"}),K?(0,e.jsx)("p",{className:"animate-pulse truncate text-ink-3","aria-live":"polite","data-testid":"summary-generation-status-line",title:K,children:K}):null,P.draft?(0,e.jsxs)("div",{className:"mt-2 rounded-md border border-line bg-bg-3/20 p-3","data-testid":"summary-generation-draft","aria-live":"polite",children:[(0,e.jsx)(ne,{className:"text-sm leading-7 text-ink",children:P.draft}),P.draftClosed?null:(0,e.jsx)("span",{className:"mt-1 inline-block h-4 w-px animate-pulse bg-ink align-text-bottom","aria-hidden":"true","data-testid":"summary-generation-caret"})]}):null,(0,e.jsxs)("p",{className:"text-ink-3",children:["Summarizer is working in"," ",(0,e.jsx)(Y,{className:"underline",to:`/issues/${b.identifier??b.id}`,children:He(b)}),"."]})]})]}):null,!c.isError&&!o&&!q&&!W&&ge?(0,e.jsxs)("div",{className:"flex flex-col items-start gap-3 rounded-lg border border-line bg-bg-3/30 p-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,e.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,e.jsx)("p",{className:"font-medium text-ink",children:"No summary yet"}),(0,e.jsx)("p",{className:"text-ink-3",children:"Generate a concise status snapshot for this surface."})]}),(0,e.jsxs)(g,{type:"button",size:"sm",onClick:$,disabled:!r||h.isPending,children:[h.isPending?(0,e.jsx)(T,{className:"animate-spin"}):(0,e.jsx)(ae,{}),h.isPending?"Generating...":"Generate summary"]})]}):null,o?(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)(ne,{className:"text-sm leading-7 text-ink",children:xe}),(0,e.jsxs)("div",{className:"flex flex-col gap-3 text-xs text-ink-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,e.jsxs)("span",{title:H(j?.createdAt??D?.createdAt??o.updatedAt),children:["Updated ",ye(j?.createdAt??D?.createdAt??o.updatedAt)]}),y.length>1?(0,e.jsxs)(Ie,{value:pe,onValueChange:a(i=>{u(i===O?null:i)},"onValueChange"),children:[(0,e.jsx)(ze,{size:"sm",className:"h-auto border-0 bg-transparent p-0 text-xs shadow-none hover:text-ink focus-visible:ring-0","aria-label":"Select summary revision",title:j?le(j):se,children:(0,e.jsxs)(De,{children:[(0,e.jsx)(Fe,{className:"size-3.5","aria-hidden":"true"}),(0,e.jsxs)("span",{children:[y.length," revisions"]})]})}),(0,e.jsxs)(Be,{align:"end",position:"popper",children:[(0,e.jsx)(ie,{value:O,className:"text-xs",children:se}),ee.length>0?(0,e.jsx)(qe,{}):null,ee.map(i=>(0,e.jsx)(ie,{value:i.id,className:"text-xs",title:H(i.createdAt),children:le(i)},i.id))]})]}):null]})]}):null]})}a(vs,"SummarySlotCard");export{js as n,vs as t};
|
|
1
|
+
var fe=Object.defineProperty;var a=(s,d)=>fe(s,"name",{value:d,configurable:!0});import{i as oe}from"./rolldown-runtime-ZpX3ckPj.js";import{O as ye,S as te,h as H,l as je,la as ve,ua as ke}from"./createLucideIcon-CgrPXnTY.js";import{X as de,_ as X,r as M,t as x,v as E}from"./queryKeys-BzT8CD34.js";import{J as ae,t as Y}from"./router-CJbFZfVR.js";import{t as Ne}from"./bot-kSfD9MPZ.js";import{t as ne}from"./MarkdownBody-cPGkwwjq.js";import{r as T,t as g}from"./button-DI4w5WP7.js";import{t as we}from"./refresh-cw-CfzWP9se.js";import{t as Q}from"./badge-jeXr866I.js";import{a as Se}from"./ToastContext-DyVJ6bCh.js";import{t as _e}from"./agents-B8n-p0aX.js";import{t as Ce}from"./instanceSettings-D1nNVWU0.js";import{a as Re,i as Ae,n as Ee,r as Te,s as Le,t as Pe}from"./dialog-CeH7rDcv.js";import{t as I}from"./InlineBanner-DeTqU5Gp.js";import{a as qe,i as ie,n as Ie,o as ze,r as Be,s as De}from"./select-DNiRU1d9.js";import{$a as Fe,Fa as $e,fr as re,ht as Ke,ya as We}from"./index-QhteFtm-.js";import{t as Me}from"./ConfigureBuiltInAgentModal-BAfoTveX.js";import{t as Qe}from"./useSummaryDraftStream-BDuMgNcA.js";var e=oe(ve(),1);function Ue(s){return s==="blocked"?"border-bad/30 bg-bad/5 text-bad":s==="ready_with_warnings"?"border-amber-500/30 bg-amber-500/10 text-amber-800 dark:text-amber-300":"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"}a(Ue,"readinessTone");function js({workspaceId:s,workspaceName:d,currentStatus:l,open:m,onOpenChange:p,onClosed:L}){const C=de(),{pushToast:v}=Se(),R=l==="cleanup_failed"?"Retry close":"Close workspace",u=E({queryKey:x.executionWorkspaces.closeReadiness(s),queryFn:a(()=>re.getCloseReadiness(s),"queryFn"),enabled:m}),f=X({mutationFn:a(()=>re.update(s,{status:"archived"}),"mutationFn"),onSuccess:a(t=>{C.setQueryData(x.executionWorkspaces.detail(t.id),t),C.invalidateQueries({queryKey:x.executionWorkspaces.overview(t.companyId)}),C.invalidateQueries({queryKey:x.executionWorkspaces.closeReadiness(t.id)}),v({title:l==="cleanup_failed"?"Workspace close retried":"Workspace closed",tone:"success"}),p(!1),L?.(t)},"onSuccess"),onError:a(t=>{v({title:"Failed to close workspace",body:t instanceof Error?t.message:"Unknown error",tone:"error"})},"onError")}),n=u.data??null,A=n?.linkedIssues.filter(t=>!t.isTerminal)??[],k=n?.linkedIssues.filter(t=>t.isTerminal)??[],r=l==="archived"||f.isPending||u.isLoading||n==null||n.state==="blocked";return(0,e.jsx)(Pe,{open:m,onOpenChange:a(t=>{f.isPending||p(t)},"onOpenChange"),children:(0,e.jsxs)(Ee,{className:"max-h-(--sz-85vh) overflow-y-auto sm:max-w-2xl",children:[(0,e.jsxs)(Re,{children:[(0,e.jsx)(Le,{children:R}),(0,e.jsxs)(Te,{className:"break-words",children:["Archive ",(0,e.jsx)("span",{className:"font-medium text-ink",children:d})," and clean up any owned workspace artifacts. Wardmote keeps the workspace record and task history, but removes it from active workspace views."]})]}),u.isLoading?(0,e.jsxs)("div",{className:"flex items-center gap-2 rounded-xl border border-line bg-bg px-4 py-3 text-sm text-ink-3",children:[(0,e.jsx)(T,{className:"h-4 w-4 animate-spin"}),"Checking whether this workspace is safe to close..."]}):u.error?(0,e.jsx)("div",{className:"rounded-xl border border-bad/30 bg-bad/5 px-4 py-3 text-sm text-bad",children:u.error instanceof Error?u.error.message:"Failed to inspect workspace close readiness."}):n?(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:`rounded-xl border px-4 py-3 text-sm ${Ue(n.state)}`,children:[(0,e.jsx)("div",{className:"font-medium",children:n.state==="blocked"?"Close is blocked":n.state==="ready_with_warnings"?"Close is allowed with warnings":"Close is ready"}),(0,e.jsx)("div",{className:"mt-1 text-xs opacity-80",children:n.isSharedWorkspace?"This is a shared workspace session. Archiving it removes this session record but keeps the underlying project workspace.":n.git?.workspacePath&&n.git.repoRoot&&n.git.workspacePath!==n.git.repoRoot?"This execution workspace has its own checkout path and can be archived independently.":n.isProjectPrimaryWorkspace?"This execution workspace currently points at the project's primary workspace path.":"This workspace is disposable and can be archived."})]}),A.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Blocking tasks"}),(0,e.jsx)("div",{className:"space-y-2",children:A.map(t=>(0,e.jsx)("div",{className:"rounded-xl border border-bad/20 bg-bad/5 px-4 py-3 text-sm",children:(0,e.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2",children:[(0,e.jsxs)(Y,{to:te(t),className:"min-w-0 break-words font-medium hover:underline",children:[t.identifier??t.id," · ",t.title]}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:t.status})]})},t.id))})]}):null,n.blockingReasons.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Blocking reasons"}),(0,e.jsx)("ul",{className:"space-y-2 text-sm text-ink-3",children:n.blockingReasons.map(t=>(0,e.jsx)("li",{className:"break-words rounded-lg border border-bad/20 bg-bad/5 px-3 py-2 text-bad",children:t},t))})]}):null,n.warnings.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Warnings"}),(0,e.jsx)("ul",{className:"space-y-2 text-sm text-ink-3",children:n.warnings.map(t=>(0,e.jsx)("li",{className:"break-words rounded-lg border border-amber-500/20 bg-amber-500/5 px-3 py-2",children:t},t))})]}):null,n.git?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Git status"}),(0,e.jsx)("div",{className:"rounded-xl border border-line bg-bg px-4 py-3 text-sm",children:(0,e.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-ink-3",children:"Branch"}),(0,e.jsx)("div",{className:"font-mono text-xs",children:n.git.branchName??"Unknown"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-ink-3",children:"Base ref"}),(0,e.jsx)("div",{className:"font-mono text-xs",children:n.git.baseRef??"Not set"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-ink-3",children:"Merged into base"}),(0,e.jsx)("div",{children:n.git.isMergedIntoBase==null?"Unknown":n.git.isMergedIntoBase?"Yes":"No"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-ink-3",children:"Ahead / behind"}),(0,e.jsxs)("div",{children:[(n.git.aheadCount??0).toString()," / ",(n.git.behindCount??0).toString()]})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-ink-3",children:"Dirty tracked files"}),(0,e.jsx)("div",{children:n.git.dirtyEntryCount})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-xs uppercase tracking-(--tracking-eyebrow) text-ink-3",children:"Untracked files"}),(0,e.jsx)("div",{children:n.git.untrackedEntryCount})]})]})})]}):null,k.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Other linked tasks"}),(0,e.jsx)("div",{className:"space-y-2",children:k.map(t=>(0,e.jsx)("div",{className:"rounded-xl border border-line bg-bg px-4 py-3 text-sm",children:(0,e.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2",children:[(0,e.jsxs)(Y,{to:te(t),className:"min-w-0 break-words font-medium hover:underline",children:[t.identifier??t.id," · ",t.title]}),(0,e.jsx)("span",{className:"text-xs text-ink-3",children:t.status})]})},t.id))})]}):null,n.runtimeServices.length>0?(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Attached runtime services"}),(0,e.jsx)("div",{className:"space-y-2",children:n.runtimeServices.map(t=>(0,e.jsxs)("div",{className:"rounded-xl border border-line bg-bg px-4 py-3 text-sm",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2",children:[(0,e.jsx)("span",{className:"font-medium",children:t.serviceName}),(0,e.jsxs)("span",{className:"text-xs text-ink-3",children:[t.status," · ",t.lifecycle]})]}),(0,e.jsx)("div",{className:"mt-1 break-words text-xs text-ink-3",children:t.url??t.command??"No additional details"})]},t.id))})]}):null,(0,e.jsxs)("section",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Cleanup actions"}),(0,e.jsx)("div",{className:"space-y-2",children:n.plannedActions.map((t,N)=>(0,e.jsxs)("div",{className:"rounded-xl border border-line bg-bg px-4 py-3 text-sm",children:[(0,e.jsx)("div",{className:"font-medium",children:t.label}),(0,e.jsx)("div",{className:"mt-1 break-words text-ink-3",children:t.description}),t.command?(0,e.jsx)("pre",{className:"mt-2 whitespace-pre-wrap break-all rounded-lg bg-bg px-3 py-2 font-mono text-xs text-ink",children:t.command}):null]},`${t.kind}-${N}`))})]}),l==="cleanup_failed"?(0,e.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/5 px-4 py-3 text-sm text-ink-3",children:"Cleanup previously failed on this workspace. Retrying close will rerun the cleanup flow and update the workspace status if it succeeds."}):null,l==="archived"?(0,e.jsx)("div",{className:"rounded-xl border border-line bg-bg px-4 py-3 text-sm text-ink-3",children:"This workspace is already archived."}):null,n.git?.repoRoot?(0,e.jsxs)("div",{className:"break-words text-xs text-ink-3",children:["Repo root: ",(0,e.jsx)("span",{className:"font-mono break-all",children:n.git.repoRoot}),n.git.workspacePath?(0,e.jsxs)(e.Fragment,{children:[" · ","Workspace path: ",(0,e.jsx)("span",{className:"font-mono break-all",children:n.git.workspacePath})]}):null]}):null,(0,e.jsxs)("div",{className:"text-xs text-ink-3",children:["Last checked ",H(new Date(u.dataUpdatedAt))]})]}):null,(0,e.jsxs)(Ae,{children:[(0,e.jsx)(g,{variant:"secondary",onClick:a(()=>p(!1),"onClick"),disabled:f.isPending,children:"Cancel"}),(0,e.jsxs)(g,{variant:l==="cleanup_failed"?"primary":"delete",onClick:a(()=>f.mutate(),"onClick"),disabled:r,children:[f.isPending?(0,e.jsx)(T,{className:"mr-2 h-4 w-4 animate-spin"}):null,R]})]})]})})}a(js,"ExecutionWorkspaceCloseDialog");var _=oe(ke(),1);function U(s,d=""){const l=new URLSearchParams;s.scopeId&&l.set("scopeId",s.scopeId);const m=l.toString();return[`/companies/${s.companyId}/summary-slots/${s.scopeKind}/${s.slotKey}`,d,m?`?${m}`:""].join("")}a(U,"summarySlotPath");var G={get:a(s=>M.get(U(s)),"get"),revisions:a(s=>M.get(U(s,"/revisions")),"revisions"),generate:a(s=>M.post(U(s,"/generate"),{scopeId:s.scopeId??null}),"generate")},Ge="summarizer",Oe=new Set(["done","cancelled"]),O="__latest__",Ve=30;function He(s){return s.identifier?`${s.identifier}: ${s.title}`:s.title}a(He,"issueLabel");function Xe(s){return`Rev ${s.revisionNumber}`}a(Xe,"revisionLabel");function ce(s){return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(new Date(s)).replace(",","")}a(ce,"formatRevisionTimestamp");function le(s){return`${Xe(s)} - ${ce(s.createdAt)}`}a(le,"revisionOptionLabel");function Ye(s,d){return`Latest (Rev ${s.latestRevisionNumber}) - ${ce(d?.createdAt??s.updatedAt)}`}a(Ye,"latestRevisionOptionLabel");function V(s){return typeof s=="string"&&s.trim().length>0?s.trim():null}a(V,"readPayloadString");function Je(s){return s?s.message?s.message:s.lastAssistantSnippet?s.lastAssistantSnippet:s.currentToolName?`Working with ${s.currentToolName}`:null:null}a(Je,"resolveGenerationStatusLine");function Ze(s){const[d,l]=(0,_.useState)(null);return(0,_.useEffect)(()=>{l(null)},[s]),Ke(m=>{if(!s||m.type!=="heartbeat.run.progress")return;const p=m.payload??{};p.issueId===s&&l({message:V(p.message),currentToolName:V(p.currentToolName),lastAssistantSnippet:V(p.lastAssistantSnippet)})}),s?d:null}a(Ze,"useGenerationStatus");function es(s){return s&&(s.status==="not_provisioned"||s.status==="needs_setup"||s.status==="pending_approval")?s:null}a(es,"setupState");function vs({companyId:s,scopeKind:d,scopeId:l=null,slotKey:m="header",title:p,description:L,className:C}){const v=de(),[R,u]=(0,_.useState)(null),[f,n]=(0,_.useState)(!1),[A,k]=(0,_.useState)(null),r=s?{companyId:s,scopeKind:d,scopeId:l,slotKey:m}:null,t=E({queryKey:x.instance.experimentalSettings,queryFn:a(()=>Ce.getExperimental(),"queryFn")}),N=t.data?.enableSummaries===!0,me=t.data?.enableBuiltInAgents===!0,w=E({queryKey:x.builtInAgents.list(s??"__none__"),queryFn:a(()=>We.list(s),"queryFn"),enabled:!!(s&&N&&me),retry:!1}).data?.find(i=>i.definition.key===Ge),S=es(w),J=r?x.summarySlots.detail(r.companyId,r.scopeKind,r.slotKey,r.scopeId):x.summarySlots.detail("__none__",d,m,l),Z=r?x.summarySlots.revisions(r.companyId,r.scopeKind,r.slotKey,r.scopeId):x.summarySlots.revisions("__none__",d,m,l),c=E({queryKey:J,queryFn:a(()=>G.get(r),"queryFn"),enabled:!!(r&&N),retry:!1,refetchInterval:a(i=>i.state.data?.slot?.status==="generating"?3e3:!1,"refetchInterval")}),ue=E({queryKey:Z,queryFn:a(()=>G.revisions(r),"queryFn"),enabled:!!(r&&N&&c.data?.document),retry:!1}),h=X({mutationFn:a(()=>G.generate(r),"mutationFn"),onMutate:a(()=>k(null),"onMutate"),onSuccess:a(async()=>{u(null),await Promise.all([v.invalidateQueries({queryKey:J}),v.invalidateQueries({queryKey:Z})])},"onSuccess"),onError:a(i=>{k(i instanceof Error?i.message:"Summary generation could not be started.")},"onError")}),z=X({mutationFn:a(i=>_e.resume(i,s??void 0),"mutationFn"),onSuccess:a(async()=>{s&&await v.invalidateQueries({queryKey:x.builtInAgents.list(s)})},"onSuccess")}),y=ue.data?.revisions??[],o=c.data?.document??null,B=(0,_.useMemo)(()=>y.find(i=>i.id===R)??null,[y,R]),D=o?y.find(i=>i.id===o.latestRevisionId)??null:null,j=B&&B.id!==o?.latestRevisionId?B:null,xe=j?.body??o?.body??"",F=!!j,ee=(o?y.filter(i=>i.id!==o.latestRevisionId):y).toSorted((i,be)=>be.revisionNumber-i.revisionNumber).slice(0,Ve-(o?1:0)),pe=j?.id??O,se=o?Ye(o,D):"Latest",b=c.data?.generatingIssue??null,he=Je(Ze(b?.id??null)),P=Qe(s,b),$=P.statusLine??he,q=c.data?.slot?.status==="generating"&&b&&!Oe.has(b.status),K=c.data?.slot?.status==="failed",ge=w?.status==="ready";if(t.isLoading||!N)return null;const W=a(()=>{!r||h.isPending||h.mutate()},"startGeneration");return(0,e.jsxs)("section",{className:je("space-y-4",C),children:[(0,e.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(ae,{className:"h-4 w-4 text-ink-3","aria-hidden":"true"}),(0,e.jsx)("h2",{className:"text-sm font-semibold",children:p}),q?(0,e.jsx)(Q,{variant:"secondary",children:"Generating"}):null,F?(0,e.jsx)(Q,{variant:"outline",children:"Historical revision"}):null,o&&!F?(0,e.jsx)(Q,{variant:"outline",children:"Latest revision"}):null]}),L?(0,e.jsx)("p",{className:"text-sm text-ink-3",children:L}):null]}),(0,e.jsxs)("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[F?(0,e.jsx)(g,{type:"button",size:"sm",variant:"secondary",onClick:a(()=>u(null),"onClick"),children:"Latest"}):null,o&&!K?(0,e.jsxs)(g,{type:"button",size:"sm",variant:"secondary",onClick:W,disabled:!r||h.isPending||!!q,children:[h.isPending?(0,e.jsx)(T,{className:"animate-spin"}):(0,e.jsx)(we,{}),"Refresh"]}):null]})]}),S?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex flex-col items-start gap-3 rounded-lg border border-line bg-bg-3/30 p-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[S.status==="pending_approval"?(0,e.jsx)(Fe,{className:"mt-0.5 h-4 w-4 shrink-0 text-ink-3"}):(0,e.jsx)(Ne,{className:"mt-0.5 h-4 w-4 shrink-0 text-ink-3"}),(0,e.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,e.jsx)("p",{className:"font-medium text-ink",children:S.status==="pending_approval"?"Summarizer setup is pending approval":"Set up the Summarizer"}),(0,e.jsx)("p",{className:"text-ink-3",children:"Summaries are generated by Wardmote's built-in Summarizer agent. Configure its adapter and model before requesting this summary."})]})]}),S.status==="pending_approval"?null:(0,e.jsx)(g,{type:"button",size:"sm",onClick:a(()=>n(!0),"onClick"),children:"Set up Summarizer"})]}),s?(0,e.jsx)(Me,{companyId:s,state:S,open:f,onOpenChange:n,onConfigured:a(()=>k(null),"onConfigured")}):null]}):null,!S&&w?.status==="paused"&&w.agent?(0,e.jsx)(I,{tone:"warning",title:"Summarizer is paused",actions:(0,e.jsx)(g,{type:"button",size:"sm",onClick:a(()=>w.agent&&z.mutate(w.agent.id),"onClick"),disabled:z.isPending,children:z.isPending?"Resuming...":"Resume agent"}),children:"Existing summaries remain readable, but new summaries will not be generated until the agent resumes."}):null,A?(0,e.jsx)(I,{tone:"warning",title:"Summary request failed",children:A}):null,c.isError?(0,e.jsx)(I,{tone:"warning",title:"Summary could not be loaded",actions:(0,e.jsx)(g,{type:"button",size:"sm",variant:"secondary",onClick:a(()=>{c.refetch()},"onClick"),children:"Retry"}),children:c.error instanceof Error?c.error.message:"Try loading the summary again."}):null,!c.isError&&K?(0,e.jsx)(I,{tone:"danger",title:"Summary generation failed",actions:(0,e.jsx)(g,{type:"button",size:"sm",onClick:W,disabled:!r||h.isPending,children:h.isPending?"Retrying...":"Retry"}),children:c.data?.slot?.failureReason??"The generation task ended before writing a summary."}):null,!c.isError&&q&&b?(0,e.jsxs)("div",{className:"flex items-start gap-3 text-sm",children:[(0,e.jsx)(T,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-ink-3"}),(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsx)("p",{className:"font-medium text-ink",children:"Generating summary"}),$?(0,e.jsx)("p",{className:"animate-pulse truncate text-ink-3","aria-live":"polite","data-testid":"summary-generation-status-line",title:$,children:$}):null,P.draft?(0,e.jsxs)("div",{className:"mt-2 rounded-md border border-line bg-bg-3/20 p-3","data-testid":"summary-generation-draft","aria-live":"polite",children:[(0,e.jsx)(ne,{className:"text-sm leading-7 text-ink",children:P.draft}),P.draftClosed?null:(0,e.jsx)("span",{className:"mt-1 inline-block h-4 w-px animate-pulse bg-ink align-text-bottom","aria-hidden":"true","data-testid":"summary-generation-caret"})]}):null,(0,e.jsxs)("p",{className:"text-ink-3",children:["Summarizer is working in"," ",(0,e.jsx)(Y,{className:"underline",to:`/issues/${b.identifier??b.id}`,children:He(b)}),"."]})]})]}):null,!c.isError&&!o&&!q&&!K&&ge?(0,e.jsxs)("div",{className:"flex flex-col items-start gap-3 rounded-lg border border-line bg-bg-3/30 p-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,e.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,e.jsx)("p",{className:"font-medium text-ink",children:"No summary yet"}),(0,e.jsx)("p",{className:"text-ink-3",children:"Generate a concise status snapshot for this surface."})]}),(0,e.jsxs)(g,{type:"button",size:"sm",onClick:W,disabled:!r||h.isPending,children:[h.isPending?(0,e.jsx)(T,{className:"animate-spin"}):(0,e.jsx)(ae,{}),h.isPending?"Generating...":"Generate summary"]})]}):null,o?(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)(ne,{className:"text-sm leading-7 text-ink",children:xe}),(0,e.jsxs)("div",{className:"flex flex-col gap-3 text-xs text-ink-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,e.jsxs)("span",{title:H(j?.createdAt??D?.createdAt??o.updatedAt),children:["Updated ",ye(j?.createdAt??D?.createdAt??o.updatedAt)]}),y.length>1?(0,e.jsxs)(Ie,{value:pe,onValueChange:a(i=>{u(i===O?null:i)},"onValueChange"),children:[(0,e.jsx)(ze,{size:"sm",className:"h-auto border-0 bg-transparent p-0 text-xs shadow-none hover:text-ink focus-visible:ring-0","aria-label":"Select summary revision",title:j?le(j):se,children:(0,e.jsxs)(De,{children:[(0,e.jsx)($e,{className:"size-3.5","aria-hidden":"true"}),(0,e.jsxs)("span",{children:[y.length," revisions"]})]})}),(0,e.jsxs)(Be,{align:"end",position:"popper",children:[(0,e.jsx)(ie,{value:O,className:"text-xs",children:se}),ee.length>0?(0,e.jsx)(qe,{}):null,ee.map(i=>(0,e.jsx)(ie,{value:i.id,className:"text-xs",title:H(i.createdAt),children:le(i)},i.id))]})]}):null]})]}):null]})}a(vs,"SummarySlotCard");export{js as n,vs as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var G=Object.defineProperty;var l=(t,d)=>G(t,"name",{value:d,configurable:!0});import{i as q}from"./rolldown-runtime-ZpX3ckPj.js";import{l as C,la as H,t as U,ua as $}from"./createLucideIcon-CgrPXnTY.js";import{t as Y}from"./check-Bis3vECb.js";import{t as W}from"./circle-DCDVf2v0.js";import{t as X}from"./copy-C1cfcpxY.js";import{r as J}from"./button-DI4w5WP7.js";import{t as Q}from"./minus-BttANimQ.js";import{t as Z}from"./pause-B6AkvDer.js";import{t as ee}from"./play-Czm7OCYh.js";import{t as te}from"./plus-CwNlqadt.js";import{t as B}from"./rotate-ccw-DpzLJhXT.js";import{a as N,i as M,l as ae,o as I,s as O,t as se}from"./TaskChatThreadView-
|
|
1
|
+
var G=Object.defineProperty;var l=(t,d)=>G(t,"name",{value:d,configurable:!0});import{i as q}from"./rolldown-runtime-ZpX3ckPj.js";import{l as C,la as H,t as U,ua as $}from"./createLucideIcon-CgrPXnTY.js";import{t as Y}from"./check-Bis3vECb.js";import{t as W}from"./circle-DCDVf2v0.js";import{t as X}from"./copy-C1cfcpxY.js";import{r as J}from"./button-DI4w5WP7.js";import{t as Q}from"./minus-BttANimQ.js";import{t as Z}from"./pause-B6AkvDer.js";import{t as ee}from"./play-Czm7OCYh.js";import{t as te}from"./plus-CwNlqadt.js";import{t as B}from"./rotate-ccw-DpzLJhXT.js";import{a as N,i as M,l as ae,o as I,s as O,t as se}from"./TaskChatThreadView-BsPvbxiA.js";import{t as ne}from"./use-copy-action-DFzauB4H.js";import{n as K}from"./segmented-tuNVx49H.js";var F={name:"grip-horizontal",size:24,node:[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]};F.node;var re=U(F),o=q($(),1),ie=["session-start","human-message","agent-message","thinking","responding","responding-burst","tool-call","diff","working","running","completed","activity-phases","awaiting-approval","plan-todo","interrupted","refused","truncated","live-token-cost"],oe={"session-start":{id:"session-start",label:"Session start",tier:"live",surface:"thread",protocol:'acpx.session → TranscriptEntry kind:"init"'},"human-message":{id:"human-message",label:"Human message",tier:"live",surface:"thread",protocol:'IssueComment authorType:"user"'},"agent-message":{id:"agent-message",label:"Final response",tier:"live",surface:"thread",protocol:'PRP item.delta kind:"agentMessage" channel:"final"'},thinking:{id:"thinking",label:"Thinking",tier:"live",surface:"thread",protocol:"text_delta stream:thought (ACP agent_thought_chunk)"},responding:{id:"responding",label:"Progress update (streaming)",tier:"live",surface:"thread",protocol:'PRP item.delta kind:"agentMessage" channel:"progress"'},"responding-burst":{id:"responding-burst",label:"Progress update burst",tier:"live",surface:"thread",protocol:"text_delta stream:output ×N, tool calls between (PAP-368 dwell)"},"tool-call":{id:"tool-call",label:"Tool call",tier:"live",surface:"thread",protocol:"acpx.tool_call (ACP tool_call / tool_call_update)"},diff:{id:"diff",label:"Diff",tier:"live",surface:"thread",protocol:'ToolCallContent type:"diff" → TranscriptEntry kind:"diff"'},working:{id:"working",label:"Working",tier:"live",surface:"thread",protocol:"heartbeat.run.progress + acpx.status"},running:{id:"running",label:"Running",tier:"live",surface:"thread",protocol:'message.status.type === "running"'},completed:{id:"completed",label:"Completed (collapsed)",tier:"live",surface:"thread",protocol:"acpx.result (StopReason in subtype)"},"activity-phases":{id:"activity-phases",label:"Long-run activity phases",tier:"live",surface:"thread",protocol:"assistant boundaries + chronological tool calls"},"awaiting-approval":{id:"awaiting-approval",label:"Awaiting approval",tier:"tier-b",surface:"thread",protocol:"ACP RequestPermissionRequest + PermissionOptionKind"},"plan-todo":{id:"plan-todo",label:"Plan / todo",tier:"tier-b",surface:"plan",protocol:"ACP Plan { entries: PlanEntry[] }, PlanEntryStatus"},interrupted:{id:"interrupted",label:"Interrupted",tier:"tier-b",surface:"thread",protocol:'AcpRuntimeTurnResult.status:"cancelled" / StopReason "cancelled"'},refused:{id:"refused",label:"Refused",tier:"tier-b",surface:"thread",protocol:'StopReason "refusal"'},truncated:{id:"truncated",label:"Truncated",tier:"tier-b",surface:"thread",protocol:'StopReason "max_tokens" | "max_turn_requests"'},"live-token-cost":{id:"live-token-cost",label:"Live token / cost",tier:"tier-b",surface:"thread",protocol:"ACP UsageUpdate { used, size, cost }"}},L=ie.map(t=>oe[t]),j="Atlas";function b(){return[{id:"m-user-1",kind:"message",author:"human",text:"Add a rate limiter to the login route.",timestamp:"2:31 PM"}]}l(b,"exchangePrefix");var le={revision:2,updatedAt:"2:33 PM",entries:[{id:"p1",content:"Read the login route and existing middleware",status:"completed",priority:"medium"},{id:"p2",content:"Add a token-bucket rate limiter util",status:"in_progress",priority:"high"},{id:"p3",content:"Wire the limiter into POST /login",status:"pending",priority:"high"},{id:"p4",content:"Add tests for the limit + reset window",status:"pending",priority:"low"}]};function de(t){switch(t){case"session-start":return{surface:"thread",items:[{id:"mk-start",kind:"marker",variant:"session_start",label:"Session started",detail:"claude · Auto mode"},...b()]};case"human-message":return{surface:"thread",items:b()};case"agent-message":return{surface:"thread",items:[...b(),{id:"m-agent-1",kind:"message",author:"agent",authorName:j,agentIcon:"bot",text:"On it — I'll add a token-bucket limiter and wire it into the login route.",timestamp:"2:31 PM"}]};case"thinking":return{surface:"thread",items:[...b(),{id:"turn-thinking",kind:"turn",settled:!1,summary:{toolCount:1,added:0,removed:0},liveStatus:{id:"st-thinking",kind:"status",status:"running",label:"Thinking",startedAtMs:Date.now()-6100,tokens:{used:18240,size:2e5}},items:[{id:"th-grep",kind:"tool",name:"Grep",target:"rateLimit",toolKind:"search",status:"completed"}]}]};case"responding":return{surface:"thread",items:[...b(),{id:"turn-responding",kind:"turn",settled:!1,summary:{toolCount:1,added:0,removed:0},liveStatus:{id:"st-responding",kind:"status",status:"running",label:"Responding",startedAtMs:Date.now()-9300,tokens:{used:18240,size:2e5},selfTalk:"I found an existing ipRateLimit helper, so I'll extend it with a per-account token bucket keyed on the email address instead of adding a second limiter. The bucket refills at six requests a minute, matching the lockout policy the auth spec documents, and failed attempts drain it twice as fast so brute-force runs hit the ceiling quickly while a fat-fingered password barely registers."},items:[{id:"resp-read",kind:"tool",name:"Read",target:"server/src/routes/auth.ts",toolKind:"read",status:"completed"}]}]};case"responding-burst":return{surface:"thread",items:[...b(),{id:"turn-responding-burst",kind:"turn",settled:!1,summary:{toolCount:2,added:0,removed:0},liveStatus:{id:"st-responding-burst",kind:"status",status:"running",label:"Responding",startedAtMs:Date.now()-21400,tokens:{used:18240,size:2e5},selfTalk:`Found the existing ipRateLimit helper — extending it beats adding a second limiter.
|
|
2
2
|
|
|
3
3
|
Wiring a per-account token bucket keyed on the email address, refilling at six requests a minute per the auth spec.
|
|
4
4
|
|