@hotmeshio/long-tail 0.4.14 → 0.4.16
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/build/adapters/express.js +14 -0
- package/build/api/escalations/claim.js +1 -10
- package/build/api/escalations/create.js +1 -11
- package/build/api/escalations/metadata.d.ts +2 -0
- package/build/api/escalations/metadata.js +6 -12
- package/build/api/escalations/resolve.js +4 -23
- package/build/api/settings.js +5 -6
- package/build/bin/ltc.js +2 -0
- package/build/index.js +2 -2
- package/build/lib/cli/commands/escalations.d.ts +2 -0
- package/build/lib/cli/commands/escalations.js +4 -0
- package/build/lib/events/nats-ws-proxy.d.ts +19 -0
- package/build/lib/events/nats-ws-proxy.js +68 -0
- package/build/lib/events/nats.d.ts +16 -0
- package/build/lib/events/nats.js +23 -1
- package/build/lib/events/publish.js +2 -0
- package/build/modules/config.d.ts +3 -0
- package/build/modules/config.js +3 -0
- package/build/routes/escalations/metadata.js +4 -2
- package/build/routes/nats-credentials.js +4 -4
- package/build/sdk/index.d.ts +2 -0
- package/build/services/escalation/crud.d.ts +1 -1
- package/build/services/escalation/crud.js +56 -6
- package/build/services/escalation/sql.d.ts +2 -2
- package/build/services/escalation/sql.js +5 -2
- package/build/services/interceptor/activities/escalation.js +1 -11
- package/build/services/interceptor/activities/task.js +2 -23
- package/build/services/interceptor/completion.js +2 -22
- package/build/services/interceptor/escalation.js +5 -44
- package/build/services/interceptor/index.js +26 -2
- package/build/services/interceptor/lifecycle.d.ts +1 -1
- package/build/services/interceptor/lifecycle.js +18 -32
- package/build/services/task/crud.js +36 -2
- package/build/start/index.js +14 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/startup.d.ts +3 -0
- package/dashboard/dist/assets/{AdminDashboard-BuqyRY2r.js → AdminDashboard-Cfo0mwL2.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-BuqyRY2r.js.map → AdminDashboard-Cfo0mwL2.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-Bum1dUIi.js → AgentConfigPage-DBtvb2x5.js} +2 -2
- package/dashboard/dist/assets/{AgentConfigPage-Bum1dUIi.js.map → AgentConfigPage-DBtvb2x5.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-0Kq-tBF2.js → AgentDetailPage-3mZA7SOb.js} +2 -2
- package/dashboard/dist/assets/{AgentDetailPage-0Kq-tBF2.js.map → AgentDetailPage-3mZA7SOb.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-B5gYDSOX.js → AgentsPage-CTVocfBb.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-B5gYDSOX.js.map → AgentsPage-CTVocfBb.js.map} +1 -1
- package/dashboard/dist/assets/{AvailableEscalationsPage-BWHThQDC.js → AvailableEscalationsPage-CA9x9o5s.js} +2 -2
- package/dashboard/dist/assets/{AvailableEscalationsPage-BWHThQDC.js.map → AvailableEscalationsPage-CA9x9o5s.js.map} +1 -1
- package/dashboard/dist/assets/{BotPicker-BQ336piW.js → BotPicker-BQp_Vs73.js} +2 -2
- package/dashboard/dist/assets/{BotPicker-BQ336piW.js.map → BotPicker-BQp_Vs73.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-CkiJROX-.js → CapabilitiesPage-wpVtkGeU.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-CkiJROX-.js.map → CapabilitiesPage-wpVtkGeU.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-SM8_UjNe.js → CollapsibleSection-2eZMMZiG.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-SM8_UjNe.js.map → CollapsibleSection-2eZMMZiG.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-f6niro9_.js → CredentialsPage-DJGLssm0.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-f6niro9_.js.map → CredentialsPage-DJGLssm0.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-DINmdqoe.js → CronLabel-DY8VdTS9.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-DINmdqoe.js.map → CronLabel-DY8VdTS9.js.map} +1 -1
- package/dashboard/dist/assets/{CustomDurationPicker-BCUcYxfB.js → CustomDurationPicker-DbyqfK35.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-BCUcYxfB.js.map → CustomDurationPicker-DbyqfK35.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-DPYZnXsX.js → ElapsedCell-BPYm8RA7.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-DPYZnXsX.js.map → ElapsedCell-BPYm8RA7.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-CTB8AEBd.js → EscalationsOverview-kYGHfnLf.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-CTB8AEBd.js.map → EscalationsOverview-kYGHfnLf.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-8_r3Tg09.js → EventTable-DSDzJMer.js} +2 -2
- package/dashboard/dist/assets/{EventTable-8_r3Tg09.js.map → EventTable-DSDzJMer.js.map} +1 -1
- package/dashboard/dist/assets/{HomePage-Bjxnjv6p.js → HomePage-CwRebzmO.js} +2 -2
- package/dashboard/dist/assets/{HomePage-Bjxnjv6p.js.map → HomePage-CwRebzmO.js.map} +1 -1
- package/dashboard/dist/assets/{ListToolbar-B60JrvJ9.js → ListToolbar-DEef1_-T.js} +2 -2
- package/dashboard/dist/assets/{ListToolbar-B60JrvJ9.js.map → ListToolbar-DEef1_-T.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-whVRP_Nj.js → McpOverview-CZFW5qMb.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-whVRP_Nj.js.map → McpOverview-CZFW5qMb.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-DPuujJkH.js → McpQueryDetailPage-q9xH-QRo.js} +2 -2
- package/dashboard/dist/assets/{McpQueryDetailPage-DPuujJkH.js.map → McpQueryDetailPage-q9xH-QRo.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-DciK6r7r.js → McpQueryPage-D14466yi.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-DciK6r7r.js.map → McpQueryPage-D14466yi.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-QEz8BCTu.js → McpRunDetailPage-X0sfRFTk.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-QEz8BCTu.js.map → McpRunDetailPage-X0sfRFTk.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-BA6AVpi_.js → McpRunsPage-aZg057y3.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-BA6AVpi_.js.map → McpRunsPage-aZg057y3.js.map} +1 -1
- package/dashboard/dist/assets/{OperatorDashboard-DrUMzwnl.js → OperatorDashboard-iZEHnndU.js} +2 -2
- package/dashboard/dist/assets/{OperatorDashboard-DrUMzwnl.js.map → OperatorDashboard-iZEHnndU.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-Dc5ASJpQ.js → ProcessDetailPage-DyzNjwu8.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-Dc5ASJpQ.js.map → ProcessDetailPage-DyzNjwu8.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-Sa-bjC-g.js → ProcessesListPage-CT_3b5Wt.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-Sa-bjC-g.js.map → ProcessesListPage-CT_3b5Wt.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-DmO8Jlbw.js → RolesPage-CpRJq-sg.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-DmO8Jlbw.js.map → RolesPage-CpRJq-sg.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-yWEwIZRe.js → RunAsSelector-C20rdNsC.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-yWEwIZRe.js.map → RunAsSelector-C20rdNsC.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-CmzfFQ09.js → SwimlaneTimeline-CbFaU4bq.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-CmzfFQ09.js.map → SwimlaneTimeline-CbFaU4bq.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-CI4JTC62.js → TaskDetailPage-22cJsFmM.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-CI4JTC62.js.map → TaskDetailPage-22cJsFmM.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-xdNmQsNE.js → TasksListPage-BDmaUIKu.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-xdNmQsNE.js.map → TasksListPage-BDmaUIKu.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-B_um9BWR.js → TimeAgo-7wqEp87-.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-B_um9BWR.js.map → TimeAgo-7wqEp87-.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-BJ6trAqW.js → TimestampCell-BBCf8zsN.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-BJ6trAqW.js.map → TimestampCell-BBCf8zsN.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-DMQhLDES.js → ToolTestPanel-Dosq1cqG.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-DMQhLDES.js.map → ToolTestPanel-Dosq1cqG.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-YeGQA0vD.js → TopicDetailPage-DW97-YHQ.js} +2 -2
- package/dashboard/dist/assets/{TopicDetailPage-YeGQA0vD.js.map → TopicDetailPage-DW97-YHQ.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-B3QZNlWz.js → TopicsPage-tVPdz-k0.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-B3QZNlWz.js.map → TopicsPage-tVPdz-k0.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-MpSZ2_EH.js → UserName-DX7IBjFn.js} +2 -2
- package/dashboard/dist/assets/{UserName-MpSZ2_EH.js.map → UserName-DX7IBjFn.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-DqMqDb1h.js → WorkflowExecutionPage-BjC0j9_L.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-DqMqDb1h.js.map → WorkflowExecutionPage-BjC0j9_L.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-BF7FpMmk.js → WorkflowsDashboard-eCH4gpAk.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-BF7FpMmk.js.map → WorkflowsDashboard-eCH4gpAk.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-YFc_KBMS.js → WorkflowsOverview-DaJRDkNy.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-YFc_KBMS.js.map → WorkflowsOverview-DaJRDkNy.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-BOLs5KTB.js → YamlWorkflowsPage-CkpQaUmz.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-BOLs5KTB.js.map → YamlWorkflowsPage-CkpQaUmz.js.map} +1 -1
- package/dashboard/dist/assets/{agents-CPYVSCQ3.js → agents-B-P5MlEx.js} +2 -2
- package/dashboard/dist/assets/{agents-CPYVSCQ3.js.map → agents-B-P5MlEx.js.map} +1 -1
- package/dashboard/dist/assets/{bots-DCXjHjID.js → bots-CZz9iVys.js} +2 -2
- package/dashboard/dist/assets/{bots-DCXjHjID.js.map → bots-CZz9iVys.js.map} +1 -1
- package/dashboard/dist/assets/{capabilities-CreogBYU.js → capabilities-DrZ8Vw_v.js} +2 -2
- package/dashboard/dist/assets/{capabilities-CreogBYU.js.map → capabilities-DrZ8Vw_v.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-Cm_-Gb1x.js → controlplane-cj-1c-1C.js} +2 -2
- package/dashboard/dist/assets/{controlplane-Cm_-Gb1x.js.map → controlplane-cj-1c-1C.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-ulsBFHVb.js → escalation-BEVFyQnE.js} +2 -2
- package/dashboard/dist/assets/{escalation-ulsBFHVb.js.map → escalation-BEVFyQnE.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-CLqe28Ba.js → escalation-columns-Beox3TXH.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-CLqe28Ba.js.map → escalation-columns-Beox3TXH.js.map} +1 -1
- package/dashboard/dist/assets/{helpers-etjHeZEI.js → helpers-B4gzNq9h.js} +2 -2
- package/dashboard/dist/assets/{helpers-etjHeZEI.js.map → helpers-B4gzNq9h.js.map} +1 -1
- package/dashboard/dist/assets/{index-BkOv2dQA.js → index-3n5VREXN.js} +2 -2
- package/dashboard/dist/assets/{index-BkOv2dQA.js.map → index-3n5VREXN.js.map} +1 -1
- package/dashboard/dist/assets/{index-CKDOaej4.js → index-BAXzN-QB.js} +2 -2
- package/dashboard/dist/assets/{index-CKDOaej4.js.map → index-BAXzN-QB.js.map} +1 -1
- package/dashboard/dist/assets/{index-DVqtJBno.js → index-BCQ65lNu.js} +2 -2
- package/dashboard/dist/assets/{index-DVqtJBno.js.map → index-BCQ65lNu.js.map} +1 -1
- package/dashboard/dist/assets/{index-BkCkBW_D.js → index-BYXiz05a.js} +2 -2
- package/dashboard/dist/assets/{index-BkCkBW_D.js.map → index-BYXiz05a.js.map} +1 -1
- package/dashboard/dist/assets/{index-CcvHiZW-.js → index-Bh-PnP17.js} +2 -2
- package/dashboard/dist/assets/{index-CcvHiZW-.js.map → index-Bh-PnP17.js.map} +1 -1
- package/dashboard/dist/assets/{index-DYmrNJ_H.js → index-BpN31nuC.js} +17 -17
- package/dashboard/dist/assets/index-BpN31nuC.js.map +1 -0
- package/dashboard/dist/assets/{index-DT68ewTC.js → index-C5dHozmW.js} +2 -2
- package/dashboard/dist/assets/{index-DT68ewTC.js.map → index-C5dHozmW.js.map} +1 -1
- package/dashboard/dist/assets/{index-7Fbktqcl.js → index-D1MywQ2z.js} +2 -2
- package/dashboard/dist/assets/{index-7Fbktqcl.js.map → index-D1MywQ2z.js.map} +1 -1
- package/dashboard/dist/assets/{index-Cnpo94XG.js → index-D4KGadbW.js} +2 -2
- package/dashboard/dist/assets/{index-Cnpo94XG.js.map → index-D4KGadbW.js.map} +1 -1
- package/dashboard/dist/assets/{index-DT0JeuiL.js → index-DdKbIZNE.js} +2 -2
- package/dashboard/dist/assets/{index-DT0JeuiL.js.map → index-DdKbIZNE.js.map} +1 -1
- package/dashboard/dist/assets/{index-DFuHrLll.js → index-UtAfnStw.js} +2 -2
- package/dashboard/dist/assets/{index-DFuHrLll.js.map → index-UtAfnStw.js.map} +1 -1
- package/dashboard/dist/assets/{index-DGpIF_Td.js → index-_DfbFHXk.js} +2 -2
- package/dashboard/dist/assets/{index-DGpIF_Td.js.map → index-_DfbFHXk.js.map} +1 -1
- package/dashboard/dist/assets/{index-CihScSLF.js → index-aJRDh4zW.js} +2 -2
- package/dashboard/dist/assets/{index-CihScSLF.js.map → index-aJRDh4zW.js.map} +1 -1
- package/dashboard/dist/assets/{knowledge-CXA2DJwY.js → knowledge-DhtKWMON.js} +2 -2
- package/dashboard/dist/assets/{knowledge-CXA2DJwY.js.map → knowledge-DhtKWMON.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-DeC-PpeL.js → mcp-BXN7-wGF.js} +2 -2
- package/dashboard/dist/assets/{mcp-DeC-PpeL.js.map → mcp-BXN7-wGF.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-DldD_RPZ.js → mcp-query-BIJP4mQJ.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-DldD_RPZ.js.map → mcp-query-BIJP4mQJ.js.map} +1 -1
- package/dashboard/dist/assets/{namespaces-BIGZ6exX.js → namespaces-ne_yDQZX.js} +2 -2
- package/dashboard/dist/assets/{namespaces-BIGZ6exX.js.map → namespaces-ne_yDQZX.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-BtihifKT.js → pipelines-Bcz62DoS.js} +2 -2
- package/dashboard/dist/assets/{pipelines-BtihifKT.js.map → pipelines-Bcz62DoS.js.map} +1 -1
- package/dashboard/dist/assets/{roles-4DocbpKy.js → roles-De2CzGCy.js} +2 -2
- package/dashboard/dist/assets/{roles-4DocbpKy.js.map → roles-De2CzGCy.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-B9P_7SR_.js → tasks-4yL5EfxI.js} +2 -2
- package/dashboard/dist/assets/{tasks-B9P_7SR_.js.map → tasks-4yL5EfxI.js.map} +1 -1
- package/dashboard/dist/assets/{topics-CcLT-IrY.js → topics-DDKHpRwP.js} +2 -2
- package/dashboard/dist/assets/{topics-CcLT-IrY.js.map → topics-DDKHpRwP.js.map} +1 -1
- package/dashboard/dist/assets/{useEventHooks-B9UOxef_.js → useEventHooks-NzIyvoGY.js} +2 -2
- package/dashboard/dist/assets/{useEventHooks-B9UOxef_.js.map → useEventHooks-NzIyvoGY.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-V_MENSI5.js → useYamlActivityEvents-Dv6GhDkh.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-V_MENSI5.js.map → useYamlActivityEvents-Dv6GhDkh.js.map} +1 -1
- package/dashboard/dist/assets/{users-BHF3YOU1.js → users-pSMWP58G.js} +2 -2
- package/dashboard/dist/assets/{users-BHF3YOU1.js.map → users-pSMWP58G.js.map} +1 -1
- package/dashboard/dist/assets/{workflows-DorgmYSk.js → workflows-COYPOe2I.js} +2 -2
- package/dashboard/dist/assets/{workflows-DorgmYSk.js.map → workflows-COYPOe2I.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-DTGpqnEG.js → yaml-workflows-1dF3ig6u.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-DTGpqnEG.js.map → yaml-workflows-1dF3ig6u.js.map} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/docs/api/http/escalations.md +6 -4
- package/docs/api/http/settings.md +1 -1
- package/docs/api/sdk/escalations.md +6 -4
- package/package.json +3 -2
- package/dashboard/dist/assets/index-DYmrNJ_H.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as h,j as e}from"./vendor-query-B2UbickB.js";import{d as J,C as Ue,J as te,j as ze,t as Be,g as He,h as Ke,v as Ye,u as qe}from"./index-DYmrNJ_H.js";import{u as Ge}from"./useCollapsedSections-BU5HULGs.js";import{a as Qe}from"./roles-4DocbpKy.js";import{P as Xe}from"./PageHeader-CR6TpJG_.js";import{C as oe,i as Ze,a as et}from"./escalation-ulsBFHVb.js";import{u as tt}from"./workflows-DorgmYSk.js";import{g as st}from"./useEventHooks-B9UOxef_.js";import{U as de}from"./UserName-MpSZ2_EH.js";import{u as at,C as rt}from"./CustomDurationPicker-BCUcYxfB.js";import{S as be}from"./StatusBadge-XQlNFwmH.js";import{R as ye}from"./RolePill-BC54Vn-U.js";import{C as E}from"./CopyableId-DaT0ZRHg.js";import{U as Ne,ad as nt,ab as it,ae as ve}from"./vendor-icons-CrrAvF2g.js";import{C as ae}from"./CollapsibleSection-SM8_UjNe.js";import{L as Se,e as lt,c as ct}from"./vendor-react-CXumBFUA.js";import"./users-BHF3YOU1.js";import"./constants-BHkpVaqx.js";const we="lt_view_mode";function ot(t){const[a,i]=h.useState(()=>{try{const l=localStorage.getItem(we);if(l!==null)return l==="dev"}catch{}return t}),r=h.useCallback(()=>{i(l=>{const s=!l;try{localStorage.setItem(we,s?"dev":"user")}catch{}return s})},[]);return{isDevMode:a,toggleMode:r}}function dt(t){const{mode:a,activeView:i,onActiveViewChange:r,onClaim:l,claimPending:s,workflowType:m,json:o,onResolve:n,resolvePending:c,resolveError:d,requestTriage:p,triageNotes:u,currentRole:y,escalationTargets:x,onEscalate:g,escalatePending:j,escalateError:f,onRelease:S,releasePending:R,assignedTo:$,assignedUntil:A,onSubmitAttempt:M}=t,C=at(),[k,b]=h.useState("30"),[v,w]=h.useState(0),[I,L]=h.useState(""),[V,Q]=h.useState(""),_=k==="custom",W=h.useCallback(N=>w(N),[]);if(a==="terminal")return null;const O=()=>{const N=_?v:parseInt(k);!N||N<=0||l(N)},ee=()=>{if(L(""),p){const P={_lt:{needsTriage:!0}};u.trim()&&(P.notes=u.trim()),n(P);return}let N;try{N=JSON.parse(o)}catch{L("Invalid JSON");return}const X=N._form_schema,U=X==null?void 0:X.required;if(U!=null&&U.length){const P=U.filter(Y=>{const D=N[Y];return D==null||typeof D=="string"&&D.trim()===""});if(P.length>0){M==null||M();const Y=P.map(q=>q.replace(/[_-]/g," ")),D=Y.length<=2?Y.join(", "):`${Y.slice(0,2).join(", ")}...`;L(`Required: ${D}`);return}}n(N)},K=N=>`text-xs transition-colors ${N?"text-accent font-medium":"text-text-tertiary hover:text-accent"}`;return e.jsxs("div",{className:"sticky bottom-0 h-[80px] bg-surface/95 backdrop-blur-sm border-t border-surface-border -mx-10 px-10 pt-3 pb-5 z-10","data-testid":"escalation-action-bar",children:[a==="available"&&e.jsxs("div",{"data-testid":"claim-bar",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[C.map(N=>e.jsx("button",{onClick:()=>{b(N.value),w(0)},className:K(!_&&k===N.value),children:N.label},N.value)),e.jsx("button",{onClick:()=>b("custom"),className:K(_),children:"Other"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex-1"}),_&&e.jsx(rt,{onChange:W,compact:!0,autoFocus:!0}),e.jsx("button",{onClick:O,disabled:s||_&&v<=0,className:"btn-primary text-xs",children:s?"Claiming...":"Claim"})]})]}),a==="claimed_by_other"&&e.jsxs("div",{className:"flex items-center gap-4","data-testid":"claimed-other-bar",children:[e.jsxs("p",{className:"text-sm text-text-secondary",children:["Claimed by ",e.jsx("span",{className:"font-medium text-text-primary",children:$?e.jsx(de,{userId:$}):"unknown"})]}),A&&e.jsx(oe,{until:A})]}),a==="claimed_by_me"&&e.jsxs("div",{"data-testid":"action-bar",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[e.jsx("button",{onClick:()=>r("resolve"),className:K(i==="resolve"),children:m?"Resolve":"Acknowledge"}),x.length>0&&e.jsx("button",{onClick:()=>r("escalate"),className:K(i==="escalate"),children:"Escalate"}),e.jsx("button",{onClick:()=>r("release"),className:`text-xs transition-colors ${i==="release"?"text-status-error font-medium":"text-text-tertiary hover:text-status-error"}`,children:"Release"})]}),i==="resolve"&&(m?e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex-1"}),I&&e.jsx("span",{className:"text-xs text-status-error",children:I}),d&&e.jsx("span",{className:"text-xs text-status-error",children:d.message}),e.jsx("button",{onClick:ee,disabled:c,className:"btn-primary text-xs",children:c?"Submitting...":p?"Send to Triage":"Submit"})]}):e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:"Notification — acknowledge to resolve"}),e.jsx("div",{className:"flex-1"}),d&&e.jsx("span",{className:"text-xs text-status-error mr-3",children:d.message}),e.jsx("button",{onClick:()=>n({acknowledged:!0}),disabled:c,className:"btn-primary text-xs",children:c?"Acknowledging...":"Acknowledge"})]})),i==="escalate"&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-xs text-text-secondary",children:["From ",e.jsx("span",{className:"font-medium text-text-primary",children:y})," to"]}),e.jsxs("select",{value:V,onChange:N=>Q(N.target.value),className:"select text-xs","data-testid":"escalate-select",children:[e.jsx("option",{value:"",children:"Select role..."}),x.map(N=>e.jsx("option",{value:N,children:N},N))]}),e.jsx("div",{className:"flex-1"}),f&&e.jsx("span",{className:"text-xs text-status-error",children:f.message}),e.jsx("button",{onClick:()=>g(V),disabled:!V||j,className:"btn-primary text-xs",children:j?"Escalating...":"Escalate"})]}),i==="release"&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:"Release back to pool?"}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>r("resolve"),className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:S,disabled:R,className:"btn-primary text-xs bg-status-error hover:bg-status-error/80",children:R?"Releasing...":"Yes, Release"})]})]})]})}const ke=48;function xt({label:t,value:a}){const[i,r]=h.useState(!1),l=typeof a=="object"?JSON.stringify(a):String(a??""),s=l.length>ke;return e.jsxs("div",{className:"text-left max-w-xs",children:[e.jsx("span",{className:"text-[9px] text-text-quaternary",children:t}),s&&!i?e.jsxs("button",{onClick:()=>r(!0),className:"block text-[11px] font-mono text-text-secondary hover:text-accent transition-colors text-left",title:l,children:[l.slice(0,ke),"…"]}):s&&i?e.jsx("button",{onClick:()=>r(!1),className:"block text-[11px] font-mono text-text-secondary break-all text-left",children:l}):e.jsx("p",{className:"text-[11px] font-mono text-text-secondary",children:l})]})}function ut({esc:t,claimedByMe:a,claimed:i,isTerminal:r,traceUrl:l,isDevMode:s,showDetails:m,onToggleDetails:o}){const n=Ze(t);return s?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[n&&e.jsx(it,{className:"w-5 h-5 text-text-tertiary shrink-0"}),e.jsxs("p",{className:"text-[1.5rem] leading-snug font-light text-text-secondary",children:[t.type,t.subtype?` / ${t.subtype}`:""]})]}),t.description&&e.jsx("p",{className:"text-sm leading-relaxed text-text-tertiary mb-4",children:t.description}),e.jsxs("div",{className:"flex flex-wrap items-end gap-x-6 gap-y-3 mt-4 mb-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Status"}),e.jsx("span",{className:"mb-1 inline-block",children:e.jsx(be,{status:t.status})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Role"}),e.jsx(ye,{role:t.role,size:"md"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Created"}),e.jsx("span",{className:"inline-flex items-center mb-1 text-xs text-text-secondary",children:e.jsx(J,{date:t.created_at})})]}),t.assigned_to&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Claimed by"}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-text-primary",children:[e.jsx(Ne,{className:"w-3 h-3 shrink-0 text-accent/75"}),e.jsx(de,{userId:t.assigned_to})]})]}),i&&!r&&t.assigned_until&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Time left"}),e.jsx("span",{className:"inline-flex items-center h-5",children:e.jsx(oe,{until:t.assigned_until})})]}),t.resolved_at&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Resolved"}),e.jsx("span",{className:"inline-flex items-center h-5 text-xs text-text-secondary",children:e.jsx(J,{date:t.resolved_at})})]})]})]}):e.jsxs("div",{className:"-mt-6 mb-2",children:[t.description&&e.jsx("p",{className:"text-2xl font-light text-text-primary leading-relaxed mb-5",children:t.description}),e.jsxs("div",{className:"bg-surface-sunken/50 rounded-md px-5 py-4 flex flex-wrap gap-x-8 gap-y-4 items-end",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Status"}),e.jsx(be,{status:t.status})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Assigned to Role"}),e.jsx(ye,{role:t.role,size:"md"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Created"}),e.jsx("span",{className:"text-xs text-text-secondary",children:e.jsx(J,{date:t.created_at})})]}),i&&t.assigned_to&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Claimed By"}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-text-primary",children:[e.jsx(Ne,{className:"w-3 h-3 text-accent/75"}),e.jsx(de,{userId:t.assigned_to})]})]}),i&&t.claimed_at&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Claimed"}),e.jsx("span",{className:"text-xs text-text-secondary",children:e.jsx(J,{date:t.claimed_at})})]}),i&&!r&&t.assigned_until&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Time Remaining"}),e.jsx("span",{className:"text-xs",children:e.jsx(oe,{until:t.assigned_until})})]}),t.resolved_at&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Completed"}),e.jsx("span",{className:"text-xs text-status-success",children:e.jsx(J,{date:t.resolved_at})})]}),e.jsx("div",{children:e.jsx("button",{onClick:o,className:"text-text-tertiary/50 hover:text-accent transition-colors",title:m?"Hide details":"Show details",children:e.jsx(nt,{className:`w-3.5 h-3.5 transition-opacity duration-200 ${m?"opacity-100 text-accent":"opacity-60"}`})})})]}),e.jsxs(Ue,{open:m,children:[e.jsxs("div",{className:"mt-px bg-surface-sunken/30 rounded-b-md px-5 py-4 flex flex-wrap gap-x-8 gap-y-4 border-t border-surface-border/30",children:[e.jsxs("div",{className:"text-left",children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Priority"}),e.jsxs("p",{className:"text-[12px] text-text-secondary mt-0.5",children:["P",t.priority]})]}),e.jsx(E,{label:"Escalation ID",value:t.id}),t.task_id&&e.jsx(E,{label:"Task ID",value:t.task_id,href:`/workflows/tasks/detail/${t.task_id}`}),e.jsx(E,{label:"Workflow Name",value:t.workflow_type,href:t.workflow_type?`/workflows/registry/${t.workflow_type}`:void 0}),e.jsx(E,{label:"Workflow ID",value:t.workflow_id,href:t.workflow_id?`/workflows/executions/${t.workflow_id}`:void 0}),e.jsx(E,{label:"Task Queue",value:t.task_queue}),t.origin_id&&t.origin_id!==t.workflow_id&&e.jsx(E,{label:"Origin",value:t.origin_id,href:`/processes/detail/${t.origin_id}`}),t.trace_id&&e.jsx(E,{label:"Trace",value:t.trace_id,href:l?l.replace("{traceId}",t.trace_id):void 0,external:!0})]}),t.metadata&&Object.keys(t.metadata).length>0&&e.jsxs("div",{className:"px-5 py-3 border-t border-surface-border/20",children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Metadata"}),e.jsx("div",{className:"flex flex-wrap gap-x-6 gap-y-2",children:Object.entries(t.metadata).filter(([c])=>!c.startsWith("_")).map(([c,d])=>e.jsx(xt,{label:c,value:d},c))})]})]})]})}function B(t){return t.replace(/`([^`]+)`/g,'<code class="px-1 py-0.5 bg-surface-sunken rounded text-xs font-mono">$1</code>').replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent-primary hover:underline" target="_blank" rel="noopener noreferrer">$1</a>')}function ie({content:t,compact:a}){const i=[],r=/^```(\w*)\n([\s\S]*?)^```$/gm;let l=0,s;for(;(s=r.exec(t))!==null;)s.index>l&&i.push({type:"text",text:t.slice(l,s.index)}),i.push({type:"code",lang:s[1],code:s[2].replace(/\n$/,"")}),l=s.index+s[0].length;l<t.length&&i.push({type:"text",text:t.slice(l)});const m=a?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-[11px]"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs"},o=[];for(const n of i){if(n.type==="code"){const c=n.code.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");o.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${m.code} font-mono text-text-secondary leading-relaxed">${c}</code></pre>`);continue}o.push(...mt(n.text,m))}return e.jsx("div",{className:"prose-sm",dangerouslySetInnerHTML:{__html:o.join(`
|
|
1
|
+
import{a as h,j as e}from"./vendor-query-B2UbickB.js";import{d as J,C as Ue,J as te,j as ze,t as Be,g as He,h as Ke,v as Ye,u as qe}from"./index-BpN31nuC.js";import{u as Ge}from"./useCollapsedSections-BU5HULGs.js";import{a as Qe}from"./roles-De2CzGCy.js";import{P as Xe}from"./PageHeader-CR6TpJG_.js";import{C as oe,i as Ze,a as et}from"./escalation-BEVFyQnE.js";import{u as tt}from"./workflows-COYPOe2I.js";import{g as st}from"./useEventHooks-NzIyvoGY.js";import{U as de}from"./UserName-DX7IBjFn.js";import{u as at,C as rt}from"./CustomDurationPicker-DbyqfK35.js";import{S as be}from"./StatusBadge-XQlNFwmH.js";import{R as ye}from"./RolePill-BC54Vn-U.js";import{C as E}from"./CopyableId-DaT0ZRHg.js";import{U as Ne,ad as nt,ab as it,ae as ve}from"./vendor-icons-CrrAvF2g.js";import{C as ae}from"./CollapsibleSection-2eZMMZiG.js";import{L as Se,e as lt,c as ct}from"./vendor-react-CXumBFUA.js";import"./users-pSMWP58G.js";import"./constants-BHkpVaqx.js";const we="lt_view_mode";function ot(t){const[a,i]=h.useState(()=>{try{const l=localStorage.getItem(we);if(l!==null)return l==="dev"}catch{}return t}),r=h.useCallback(()=>{i(l=>{const s=!l;try{localStorage.setItem(we,s?"dev":"user")}catch{}return s})},[]);return{isDevMode:a,toggleMode:r}}function dt(t){const{mode:a,activeView:i,onActiveViewChange:r,onClaim:l,claimPending:s,workflowType:m,json:o,onResolve:n,resolvePending:c,resolveError:d,requestTriage:p,triageNotes:u,currentRole:y,escalationTargets:x,onEscalate:g,escalatePending:j,escalateError:f,onRelease:S,releasePending:R,assignedTo:$,assignedUntil:A,onSubmitAttempt:M}=t,C=at(),[k,b]=h.useState("30"),[v,w]=h.useState(0),[I,L]=h.useState(""),[V,Q]=h.useState(""),_=k==="custom",W=h.useCallback(N=>w(N),[]);if(a==="terminal")return null;const O=()=>{const N=_?v:parseInt(k);!N||N<=0||l(N)},ee=()=>{if(L(""),p){const P={_lt:{needsTriage:!0}};u.trim()&&(P.notes=u.trim()),n(P);return}let N;try{N=JSON.parse(o)}catch{L("Invalid JSON");return}const X=N._form_schema,U=X==null?void 0:X.required;if(U!=null&&U.length){const P=U.filter(Y=>{const D=N[Y];return D==null||typeof D=="string"&&D.trim()===""});if(P.length>0){M==null||M();const Y=P.map(q=>q.replace(/[_-]/g," ")),D=Y.length<=2?Y.join(", "):`${Y.slice(0,2).join(", ")}...`;L(`Required: ${D}`);return}}n(N)},K=N=>`text-xs transition-colors ${N?"text-accent font-medium":"text-text-tertiary hover:text-accent"}`;return e.jsxs("div",{className:"sticky bottom-0 h-[80px] bg-surface/95 backdrop-blur-sm border-t border-surface-border -mx-10 px-10 pt-3 pb-5 z-10","data-testid":"escalation-action-bar",children:[a==="available"&&e.jsxs("div",{"data-testid":"claim-bar",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[C.map(N=>e.jsx("button",{onClick:()=>{b(N.value),w(0)},className:K(!_&&k===N.value),children:N.label},N.value)),e.jsx("button",{onClick:()=>b("custom"),className:K(_),children:"Other"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex-1"}),_&&e.jsx(rt,{onChange:W,compact:!0,autoFocus:!0}),e.jsx("button",{onClick:O,disabled:s||_&&v<=0,className:"btn-primary text-xs",children:s?"Claiming...":"Claim"})]})]}),a==="claimed_by_other"&&e.jsxs("div",{className:"flex items-center gap-4","data-testid":"claimed-other-bar",children:[e.jsxs("p",{className:"text-sm text-text-secondary",children:["Claimed by ",e.jsx("span",{className:"font-medium text-text-primary",children:$?e.jsx(de,{userId:$}):"unknown"})]}),A&&e.jsx(oe,{until:A})]}),a==="claimed_by_me"&&e.jsxs("div",{"data-testid":"action-bar",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[e.jsx("button",{onClick:()=>r("resolve"),className:K(i==="resolve"),children:m?"Resolve":"Acknowledge"}),x.length>0&&e.jsx("button",{onClick:()=>r("escalate"),className:K(i==="escalate"),children:"Escalate"}),e.jsx("button",{onClick:()=>r("release"),className:`text-xs transition-colors ${i==="release"?"text-status-error font-medium":"text-text-tertiary hover:text-status-error"}`,children:"Release"})]}),i==="resolve"&&(m?e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex-1"}),I&&e.jsx("span",{className:"text-xs text-status-error",children:I}),d&&e.jsx("span",{className:"text-xs text-status-error",children:d.message}),e.jsx("button",{onClick:ee,disabled:c,className:"btn-primary text-xs",children:c?"Submitting...":p?"Send to Triage":"Submit"})]}):e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:"Notification — acknowledge to resolve"}),e.jsx("div",{className:"flex-1"}),d&&e.jsx("span",{className:"text-xs text-status-error mr-3",children:d.message}),e.jsx("button",{onClick:()=>n({acknowledged:!0}),disabled:c,className:"btn-primary text-xs",children:c?"Acknowledging...":"Acknowledge"})]})),i==="escalate"&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-xs text-text-secondary",children:["From ",e.jsx("span",{className:"font-medium text-text-primary",children:y})," to"]}),e.jsxs("select",{value:V,onChange:N=>Q(N.target.value),className:"select text-xs","data-testid":"escalate-select",children:[e.jsx("option",{value:"",children:"Select role..."}),x.map(N=>e.jsx("option",{value:N,children:N},N))]}),e.jsx("div",{className:"flex-1"}),f&&e.jsx("span",{className:"text-xs text-status-error",children:f.message}),e.jsx("button",{onClick:()=>g(V),disabled:!V||j,className:"btn-primary text-xs",children:j?"Escalating...":"Escalate"})]}),i==="release"&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-text-secondary",children:"Release back to pool?"}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>r("resolve"),className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:S,disabled:R,className:"btn-primary text-xs bg-status-error hover:bg-status-error/80",children:R?"Releasing...":"Yes, Release"})]})]})]})}const ke=48;function xt({label:t,value:a}){const[i,r]=h.useState(!1),l=typeof a=="object"?JSON.stringify(a):String(a??""),s=l.length>ke;return e.jsxs("div",{className:"text-left max-w-xs",children:[e.jsx("span",{className:"text-[9px] text-text-quaternary",children:t}),s&&!i?e.jsxs("button",{onClick:()=>r(!0),className:"block text-[11px] font-mono text-text-secondary hover:text-accent transition-colors text-left",title:l,children:[l.slice(0,ke),"…"]}):s&&i?e.jsx("button",{onClick:()=>r(!1),className:"block text-[11px] font-mono text-text-secondary break-all text-left",children:l}):e.jsx("p",{className:"text-[11px] font-mono text-text-secondary",children:l})]})}function ut({esc:t,claimedByMe:a,claimed:i,isTerminal:r,traceUrl:l,isDevMode:s,showDetails:m,onToggleDetails:o}){const n=Ze(t);return s?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[n&&e.jsx(it,{className:"w-5 h-5 text-text-tertiary shrink-0"}),e.jsxs("p",{className:"text-[1.5rem] leading-snug font-light text-text-secondary",children:[t.type,t.subtype?` / ${t.subtype}`:""]})]}),t.description&&e.jsx("p",{className:"text-sm leading-relaxed text-text-tertiary mb-4",children:t.description}),e.jsxs("div",{className:"flex flex-wrap items-end gap-x-6 gap-y-3 mt-4 mb-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Status"}),e.jsx("span",{className:"mb-1 inline-block",children:e.jsx(be,{status:t.status})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Role"}),e.jsx(ye,{role:t.role,size:"md"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Created"}),e.jsx("span",{className:"inline-flex items-center mb-1 text-xs text-text-secondary",children:e.jsx(J,{date:t.created_at})})]}),t.assigned_to&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Claimed by"}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-text-primary",children:[e.jsx(Ne,{className:"w-3 h-3 shrink-0 text-accent/75"}),e.jsx(de,{userId:t.assigned_to})]})]}),i&&!r&&t.assigned_until&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Time left"}),e.jsx("span",{className:"inline-flex items-center h-5",children:e.jsx(oe,{until:t.assigned_until})})]}),t.resolved_at&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:"Resolved"}),e.jsx("span",{className:"inline-flex items-center h-5 text-xs text-text-secondary",children:e.jsx(J,{date:t.resolved_at})})]})]})]}):e.jsxs("div",{className:"-mt-6 mb-2",children:[t.description&&e.jsx("p",{className:"text-2xl font-light text-text-primary leading-relaxed mb-5",children:t.description}),e.jsxs("div",{className:"bg-surface-sunken/50 rounded-md px-5 py-4 flex flex-wrap gap-x-8 gap-y-4 items-end",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Status"}),e.jsx(be,{status:t.status})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Assigned to Role"}),e.jsx(ye,{role:t.role,size:"md"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Created"}),e.jsx("span",{className:"text-xs text-text-secondary",children:e.jsx(J,{date:t.created_at})})]}),i&&t.assigned_to&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Claimed By"}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-text-primary",children:[e.jsx(Ne,{className:"w-3 h-3 text-accent/75"}),e.jsx(de,{userId:t.assigned_to})]})]}),i&&t.claimed_at&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Claimed"}),e.jsx("span",{className:"text-xs text-text-secondary",children:e.jsx(J,{date:t.claimed_at})})]}),i&&!r&&t.assigned_until&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Time Remaining"}),e.jsx("span",{className:"text-xs",children:e.jsx(oe,{until:t.assigned_until})})]}),t.resolved_at&&e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:"Completed"}),e.jsx("span",{className:"text-xs text-status-success",children:e.jsx(J,{date:t.resolved_at})})]}),e.jsx("div",{children:e.jsx("button",{onClick:o,className:"text-text-tertiary/50 hover:text-accent transition-colors",title:m?"Hide details":"Show details",children:e.jsx(nt,{className:`w-3.5 h-3.5 transition-opacity duration-200 ${m?"opacity-100 text-accent":"opacity-60"}`})})})]}),e.jsxs(Ue,{open:m,children:[e.jsxs("div",{className:"mt-px bg-surface-sunken/30 rounded-b-md px-5 py-4 flex flex-wrap gap-x-8 gap-y-4 border-t border-surface-border/30",children:[e.jsxs("div",{className:"text-left",children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary",children:"Priority"}),e.jsxs("p",{className:"text-[12px] text-text-secondary mt-0.5",children:["P",t.priority]})]}),e.jsx(E,{label:"Escalation ID",value:t.id}),t.task_id&&e.jsx(E,{label:"Task ID",value:t.task_id,href:`/workflows/tasks/detail/${t.task_id}`}),e.jsx(E,{label:"Workflow Name",value:t.workflow_type,href:t.workflow_type?`/workflows/registry/${t.workflow_type}`:void 0}),e.jsx(E,{label:"Workflow ID",value:t.workflow_id,href:t.workflow_id?`/workflows/executions/${t.workflow_id}`:void 0}),e.jsx(E,{label:"Task Queue",value:t.task_queue}),t.origin_id&&t.origin_id!==t.workflow_id&&e.jsx(E,{label:"Origin",value:t.origin_id,href:`/processes/detail/${t.origin_id}`}),t.trace_id&&e.jsx(E,{label:"Trace",value:t.trace_id,href:l?l.replace("{traceId}",t.trace_id):void 0,external:!0})]}),t.metadata&&Object.keys(t.metadata).length>0&&e.jsxs("div",{className:"px-5 py-3 border-t border-surface-border/20",children:[e.jsx("p",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary mb-2",children:"Metadata"}),e.jsx("div",{className:"flex flex-wrap gap-x-6 gap-y-2",children:Object.entries(t.metadata).filter(([c])=>!c.startsWith("_")).map(([c,d])=>e.jsx(xt,{label:c,value:d},c))})]})]})]})}function B(t){return t.replace(/`([^`]+)`/g,'<code class="px-1 py-0.5 bg-surface-sunken rounded text-xs font-mono">$1</code>').replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2" class="text-accent-primary hover:underline" target="_blank" rel="noopener noreferrer">$1</a>')}function ie({content:t,compact:a}){const i=[],r=/^```(\w*)\n([\s\S]*?)^```$/gm;let l=0,s;for(;(s=r.exec(t))!==null;)s.index>l&&i.push({type:"text",text:t.slice(l,s.index)}),i.push({type:"code",lang:s[1],code:s[2].replace(/\n$/,"")}),l=s.index+s[0].length;l<t.length&&i.push({type:"text",text:t.slice(l)});const m=a?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-[11px]"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs"},o=[];for(const n of i){if(n.type==="code"){const c=n.code.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");o.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${m.code} font-mono text-text-secondary leading-relaxed">${c}</code></pre>`);continue}o.push(...mt(n.text,m))}return e.jsx("div",{className:"prose-sm",dangerouslySetInnerHTML:{__html:o.join(`
|
|
2
2
|
`)}})}function mt(t,a){const i=t.split(`
|
|
3
3
|
`),r=[];let l=!1,s=!1,m=[];for(const o of i){const n=o.trim();if(n.startsWith("|")&&n.endsWith("|")){const c=n.slice(1,-1).split("|").map(d=>d.trim());if(c.every(d=>/^[-:]+$/.test(d)))continue;s||(s=!0,m=[]),m.push(c);continue}if(s){s=!1;const[c,...d]=m;r.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const p of c)r.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${B(p)}</th>`);r.push("</tr></thead><tbody>");for(const p of d){r.push("<tr>");for(const u of p)r.push(`<td class="py-1 px-2 border-b border-border/50">${B(u)}</td>`);r.push("</tr>")}r.push("</tbody></table></div>"),m=[]}if(!n){l&&(r.push("</ul>"),l=!1);continue}if(n.startsWith("### ")){l&&(r.push("</ul>"),l=!1),r.push(`<h4 class="${a.heading} font-semibold text-text-primary mt-3 mb-1">${B(n.slice(4))}</h4>`);continue}if(n.startsWith("## ")){l&&(r.push("</ul>"),l=!1),r.push(`<h3 class="${a.heading} font-semibold text-text-primary mt-3 mb-1">${B(n.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(n)){l&&(r.push("</ul>"),l=!1),r.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(n)){l||(r.push('<ul class="space-y-1 my-1">'),l=!0),r.push(`<li class="${a.list} text-text-secondary flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${B(n.slice(2))}</span></li>`);continue}l&&(r.push("</ul>"),l=!1),r.push(`<p class="${a.text} text-text-secondary my-1">${B(n)}</p>`)}if(s&&m.length){const[o,...n]=m;r.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const c of o)r.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${B(c)}</th>`);r.push("</tr></thead><tbody>");for(const c of n){r.push("<tr>");for(const d of c)r.push(`<td class="py-1 px-2 border-b border-border/50">${B(d)}</td>`);r.push("</tr>")}r.push("</tbody></table></div>")}return l&&r.push("</ul>"),r}function le({children:t}){return e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:t})}function pt({payload:t,isTerminal:a,resolverPayload:i,onRetryTriage:r,isRetrying:l}){const s=t.title,m=t.summary,o=t.diagnosis,n=t.tool_calls_made,c=t.result,d=i==null?void 0:i._lt,p=(d==null?void 0:d.triaged)===!0,u=d==null?void 0:d.triageWorkflowId,y=a&&p,[x,g]=h.useState(!1);return y?e.jsxs("div",{className:"rounded-md border border-status-success/30 bg-surface-raised",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-status-success shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:e.jsx("path",{d:"M8 1a7 7 0 110 14A7 7 0 018 1zm3.36 4.65a.5.5 0 00-.72 0L7 9.29 5.36 7.65a.5.5 0 10-.72.7l2 2a.5.5 0 00.72 0l4-4a.5.5 0 000-.7z"})}),e.jsx("span",{className:"text-xs font-medium text-status-success",children:"Resolved by AI Triage"})]}),typeof n=="number"&&e.jsxs("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded-full bg-status-success/10 text-status-success",children:[n," tool calls used"]})]}),e.jsxs("div",{className:"px-4 py-4 space-y-4",children:[s&&e.jsx("p",{className:"text-sm font-medium text-text-primary",children:s}),o&&e.jsxs("div",{children:[e.jsx(le,{children:"Triage diagnosis"}),e.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:e.jsx(ie,{content:o})})]}),e.jsx("div",{className:"flex items-center gap-3",children:u&&e.jsx(Se,{to:`/workflows/executions/${u}`,className:"text-[10px] text-accent hover:underline",children:"View triage execution"})})]})]}):e.jsxs("div",{className:"rounded-md border border-status-warning/30 bg-surface-raised",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-status-warning shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:e.jsx("path",{d:"M8 1a7 7 0 110 14A7 7 0 018 1zm0 3a.75.75 0 00-.75.75v3.5a.75.75 0 001.5 0v-3.5A.75.75 0 008 4zm0 7a.75.75 0 100-1.5.75.75 0 000 1.5z"})}),e.jsx("span",{className:"text-xs font-medium text-status-warning",children:"Tool Rounds Exhausted"})]}),typeof n=="number"&&e.jsxs("span",{className:"text-[10px] font-mono px-2 py-0.5 rounded-full bg-status-warning/10 text-status-warning",children:[n," tool calls used"]})]}),e.jsxs("div",{className:"px-4 py-4 space-y-4",children:[s&&e.jsx("p",{className:"text-sm font-medium text-text-primary",children:s}),m&&e.jsxs("div",{children:[e.jsx(le,{children:"What happened"}),e.jsx("div",{className:"text-xs text-text-secondary leading-relaxed",children:e.jsx(ie,{content:m})})]}),o&&e.jsxs("div",{children:[e.jsx(le,{children:"What went wrong"}),e.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:e.jsx(ie,{content:o})})]}),c!=null&&e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>g(!x),className:"flex items-center gap-1 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary hover:text-text-secondary transition-colors",children:[e.jsx("svg",{className:`w-3 h-3 transition-transform ${x?"rotate-90":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:e.jsx("path",{d:"M4.5 2l4 4-4 4"})}),"Partial results"]}),x&&e.jsx("div",{className:"mt-2",children:e.jsx(te,{data:c,defaultMode:"tree"})})]}),r&&!a&&e.jsx("div",{className:"pt-2",children:e.jsxs("button",{onClick:r,disabled:l,className:"inline-flex items-center gap-2 px-4 py-2 text-xs font-medium bg-accent text-text-inverse rounded-md hover:bg-accent/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 14 14",fill:"currentColor",children:e.jsx("path",{d:"M7 1a6 6 0 100 12A6 6 0 007 1zm2.5 6.5l-3.5 2V5.5l3.5 2z"})}),l?"Sending to triage...":"Retry with AI Triage"]})})]})]})}function ht({triage:t,payload:a}){const i=t.confidence??0,r=i>=.8?"text-status-success":i>=.5?"text-status-pending":"text-status-error",l=ft(t.originalData,a);return e.jsxs("div",{className:"space-y-5",children:[t.diagnosis&&e.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:t.diagnosis}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-text-tertiary",children:[t.tool_calls_made!=null&&e.jsxs("span",{children:[t.tool_calls_made," tool call",t.tool_calls_made!==1?"s":""]}),t.tool_calls_made!=null&&e.jsx("span",{className:"text-text-quaternary",children:"·"}),e.jsxs("span",{className:`font-medium ${r}`,children:[Math.round(i*100),"% confidence"]})]}),t.actions_taken&&t.actions_taken.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.actions_taken.map((s,m)=>e.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-[11px]
|
|
4
4
|
text-text-secondary`,children:[e.jsx("svg",{className:"w-3 h-3 text-status-success shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),s]},m))}),t.recommendation&&e.jsx("p",{className:"text-[11px] text-text-tertiary italic",children:t.recommendation}),l.length>0&&e.jsx("div",{className:"space-y-4 pt-2",children:l.map(s=>e.jsx(jt,{diff:s},s.key))})]})}function ft(t,a){if(!t)return[];const i=[];for(const r of Object.keys(t)){if(r.startsWith("_"))continue;const l=t[r],s=a[r];s!==void 0&&JSON.stringify(l)!==JSON.stringify(s)&&i.push({key:r,label:r.replace(/[_-]/g," "),original:l,corrected:s})}return i}function jt({diff:t}){const a=_e(t.original),i=_e(t.corrected);return a!==null&&i!==null?e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal",children:"(original)"})]}),e.jsx("p",{className:"text-sm text-text-tertiary leading-relaxed line-through decoration-text-tertiary/30",children:a})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal text-status-success",children:"(corrected)"})]}),e.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:i})]})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal",children:"(original)"})]}),e.jsx("pre",{className:"text-xs text-text-tertiary font-mono whitespace-pre-wrap leading-relaxed",children:typeof t.original=="object"?JSON.stringify(t.original,null,2):String(t.original)})]}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[t.label," ",e.jsx("span",{className:"normal-case font-normal text-status-success",children:"(corrected)"})]}),e.jsx("pre",{className:"text-xs text-text-primary font-mono whitespace-pre-wrap leading-relaxed",children:typeof t.corrected=="object"?JSON.stringify(t.corrected,null,2):String(t.corrected)})]})]})}function _e(t){return t==null?"null":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):null}function Ce({src:t,escalation:a,schema:i,onResolve:r,onEscalate:l,submitAttempted:s}){const m=h.useRef(null),o=h.useRef("");h.useEffect(()=>{try{const c=new URL(t);o.current=c.origin}catch{o.current=""}},[t]);const n=h.useCallback(()=>{const c=m.current;if(!(c!=null&&c.contentWindow)||!o.current)return;const p={type:"lt:init",escalation:{id:a.id,type:a.type,subtype:a.subtype,description:a.description,status:a.status,priority:a.priority,role:a.role,workflow_type:a.workflow_type},schema:i};c.contentWindow.postMessage(p,o.current)},[a,i]);return h.useEffect(()=>{const c=d=>{if(d.origin!==o.current)return;const p=d.data;if(!(!p||typeof p!="object"||typeof p.type!="string"))switch(p.type){case"lt:ready":n();break;case"lt:submit":p.payload&&typeof p.payload=="object"&&r(p.payload);break;case"lt:escalate":typeof p.target=="string"&&p.target&&l(p.target);break;case"lt:resize":{const u=m.current;u&&typeof p.height=="number"&&p.height>0&&(u.style.height=`${Math.min(p.height,2e3)}px`);break}}};return window.addEventListener("message",c),()=>window.removeEventListener("message",c)},[n,r,l]),h.useEffect(()=>{if(!s)return;const c=m.current;c!=null&&c.contentWindow&&o.current&&c.contentWindow.postMessage({type:"lt:validate"},o.current)},[s]),e.jsx("div",{className:"rounded-md border border-surface-border overflow-hidden bg-white",children:e.jsx("iframe",{ref:m,src:t,sandbox:"allow-scripts allow-same-origin allow-forms",className:"w-full border-0",style:{minHeight:"400px"},title:"HITL Viewport",onLoad:n})})}function gt({fieldKey:t,value:a,onChange:i,schema:r}){const l=h.useRef(null),s=(r==null?void 0:r.accept)??void 0,m=t.replace(/[_-]/g," "),o=r==null?void 0:r.description,n=h.useCallback(d=>{var y;const p=(y=d.target.files)==null?void 0:y[0];if(!p)return;const u=new FileReader;u.onload=()=>{typeof u.result=="string"&&i(u.result)},u.readAsDataURL(p)},[i]),c=a.startsWith("data:");return e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:m}),o&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:o}),e.jsxs("div",{className:"mt-1",children:[e.jsx("input",{ref:l,type:"file",accept:s,onChange:n,className:"hidden"}),e.jsx("button",{type:"button",onClick:()=>{var d;return(d=l.current)==null?void 0:d.click()},className:"btn-secondary text-xs px-3 py-1.5",children:c?"Replace file":"Choose file"}),c&&e.jsx("span",{className:"ml-2 text-xs text-status-success",children:"File attached"})]})]})}function bt({fieldKey:t,value:a,onChange:i,schema:r}){const l=t.replace(/[_-]/g," "),s=r==null?void 0:r.description,m=(r==null?void 0:r["x-lt-language"])??"",o=h.useCallback(n=>{if(n.key==="Tab"){n.preventDefault();const c=n.currentTarget,d=c.selectionStart,p=c.selectionEnd,u=a.substring(0,d)+" "+a.substring(p);i(u),requestAnimationFrame(()=>{c.selectionStart=c.selectionEnd=d+2})}},[a,i]);return e.jsxs("div",{children:[e.jsxs("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:[l,m&&e.jsx("span",{className:"ml-2 text-text-tertiary/60 normal-case font-normal",children:m})]}),s&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:s}),e.jsx("textarea",{value:a,onChange:n=>i(n.target.value),onKeyDown:o,className:"input w-full mt-1 font-mono text-xs leading-relaxed",rows:10,spellCheck:!1})]})}function yt({fieldKey:t,value:a,onChange:i,schema:r}){const l=h.useRef(null),[s,m]=h.useState(!1),o=t.replace(/[_-]/g," "),n=r==null?void 0:r.description;h.useEffect(()=>{const x=l.current;if(!x)return;const g=x.getContext("2d");if(g&&(g.lineWidth=2,g.lineCap="round",g.strokeStyle="#1E1535",a&&a.startsWith("data:"))){const j=new Image;j.onload=()=>g.drawImage(j,0,0),j.src=a}},[]);const c=h.useCallback(x=>{const j=l.current.getBoundingClientRect();return"touches"in x?{x:x.touches[0].clientX-j.left,y:x.touches[0].clientY-j.top}:{x:x.clientX-j.left,y:x.clientY-j.top}},[]),d=h.useCallback(x=>{var f;m(!0);const g=(f=l.current)==null?void 0:f.getContext("2d");if(!g)return;const j=c(x);g.beginPath(),g.moveTo(j.x,j.y)},[c]),p=h.useCallback(x=>{var f;if(!s)return;const g=(f=l.current)==null?void 0:f.getContext("2d");if(!g)return;const j=c(x);g.lineTo(j.x,j.y),g.stroke()},[s,c]),u=h.useCallback(()=>{m(!1);const x=l.current;x&&i(x.toDataURL("image/png"))},[i]),y=h.useCallback(()=>{const x=l.current;if(!x)return;const g=x.getContext("2d");g&&(g.clearRect(0,0,x.width,x.height),i(""))},[i]);return e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:o}),n&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:n}),e.jsx("div",{className:"mt-1 border border-surface-border rounded-md overflow-hidden bg-white",children:e.jsx("canvas",{ref:l,width:400,height:150,className:"w-full cursor-crosshair touch-none",onMouseDown:d,onMouseMove:p,onMouseUp:u,onMouseLeave:u,onTouchStart:d,onTouchMove:p,onTouchEnd:u})}),e.jsx("button",{type:"button",onClick:y,className:"mt-1 text-[10px] text-text-tertiary hover:text-accent transition-colors",children:"Clear"})]})}function Nt({fieldKey:t,value:a,onChange:i,schema:r}){const l=t.replace(/[_-]/g," "),s=r==null?void 0:r.description;return e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary",children:l}),s&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:s}),e.jsx("textarea",{value:a,onChange:m=>i(m.target.value),className:"input w-full mt-1 text-sm leading-relaxed",rows:8,placeholder:"Supports plain text. Markdown formatting is preserved."})]})}const Te={"file-upload":gt,"code-editor":bt,signature:yt,"rich-text":Nt};function Re({value:t,onChange:a,disabled:i,submitAttempted:r}){const[l,s]=h.useState({}),[m,o]=h.useState({}),[n,c]=h.useState(null),[d,p]=h.useState(!1),[u,y]=h.useState(new Set);h.useEffect(()=>{try{const b=JSON.parse(t);if(typeof b=="object"&&b!==null&&!Array.isArray(b)){const v={},w={};for(const[I,L]of Object.entries(b))I.startsWith("_")?w[I]=L:v[I]=L;s(v),o(w),c(w._form_schema&&typeof w._form_schema=="object"?w._form_schema:null),p(!1)}}catch{p(!0)}},[t]);const x=h.useCallback(b=>{s(b),a(JSON.stringify({...b,...m},null,2))},[m,a]),g=h.useCallback((b,v)=>{x({...l,[b]:v})},[l,x]),j=h.useCallback(b=>{y(v=>{if(v.has(b))return v;const w=new Set(v);return w.add(b),w})},[]);if(d)return e.jsx("p",{className:"text-xs text-status-error",children:"Unable to parse resolver data as form. Use the JSON editor below."});const f=Object.entries(l);if(f.length===0)return e.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No resolver fields defined."});const S=n==null?void 0:n["x-lt-order"],R=S?[...f].sort((b,v)=>{const w=S.indexOf(b[0]),I=S.indexOf(v[0]);return(w===-1?1/0:w)-(I===-1?1/0:I)}):f,$=new Set((n==null?void 0:n.required)??[]),A=n==null?void 0:n["x-lt-layout"],M=n==null?void 0:n.title,C=n==null?void 0:n.description,k=R.map(([b,v])=>{var W;const w=(W=n==null?void 0:n.properties)==null?void 0:W[b],I=(w==null?void 0:w.readOnly)===!0,L=(w==null?void 0:w["x-lt-span"])??1,V=$.has(b),Q=u.has(b)||!!r;let _;if(V&&Q&&(v==null||typeof v=="string"&&v.trim()==="")&&(_="Required"),Q&&typeof v=="string"&&v.trim()!==""&&w){const O=w.format;O==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v)&&(_="Enter a valid email address"),O==="uri"&&!/^https?:\/\/.+/.test(v)&&(_="Enter a valid URL")}return e.jsx("div",{className:A==="two-column"&&L>=2?"col-span-2":"",children:e.jsx(Ie,{fieldKey:b,value:v,onChange:O=>g(b,O),onBlur:()=>j(b),schema:n,isRequired:V,isReadOnly:I,error:_})},b)});return e.jsxs("div",{className:`pb-8 ${i?"opacity-60 pointer-events-none":""}`,children:[M&&e.jsx("h3",{className:"text-lg font-light text-text-primary mb-1",children:M}),C&&e.jsx("p",{className:"text-sm text-text-secondary leading-relaxed mb-6",children:C}),A==="two-column"?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-14 gap-y-6",children:k}):e.jsx("div",{className:"space-y-6",children:k})]})}function Ie({fieldKey:t,value:a,onChange:i,onBlur:r,schema:l,isRequired:s,isReadOnly:m,error:o}){var p;const n=t.replace(/[_-]/g," "),c=(p=l==null?void 0:l.properties)==null?void 0:p[t];if(m){const u=a===null?"null":typeof a=="object"?JSON.stringify(a,null,2):String(a);return e.jsxs("div",{children:[e.jsx(F,{isRequired:s,children:n}),e.jsx("p",{className:"text-sm text-text-secondary mt-0.5 whitespace-pre-wrap",children:u})]})}const d=c==null?void 0:c["x-lt-widget"];if(d&&d in Te&&typeof a=="string"){const u=Te[d];return e.jsx(u,{fieldKey:t,value:a,onChange:y=>i(y),schema:c})}if(typeof a=="boolean")return e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:a,onChange:u=>{i(u.target.checked),r==null||r()},className:"w-3.5 h-3.5 rounded accent-accent"}),e.jsxs("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-text-secondary",children:[n,s&&e.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]})]}),e.jsx(G,{error:o})]});if(typeof a=="number")return e.jsxs("div",{children:[e.jsx(F,{isRequired:s,children:n}),e.jsx("input",{type:"number",value:a,onChange:u=>i(parseFloat(u.target.value)||0),onBlur:r,step:"any",className:Z(!!o)}),e.jsx(G,{error:o})]});if(typeof a=="string"){const u=(c==null?void 0:c.format)==="password",y=c==null?void 0:c.enum,x=c==null?void 0:c.description;if(y!=null&&y.length)return e.jsxs("div",{children:[e.jsx(F,{isRequired:s,children:n}),x&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:x}),e.jsx("select",{value:a,onChange:f=>i(f.target.value),onBlur:r,className:Z(!!o),children:y.map(f=>e.jsx("option",{value:f,children:f},f))}),e.jsx(G,{error:o})]});if(u)return e.jsxs("div",{children:[e.jsx(F,{isRequired:s,children:n}),x&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:x}),e.jsx("input",{type:"password",value:a,onChange:f=>i(f.target.value),onBlur:r,className:Z(!!o),autoComplete:"off"}),e.jsx(G,{error:o})]});const g=c==null?void 0:c.format,j={date:"date","date-time":"datetime-local",email:"email",uri:"url"};return g&&g in j?e.jsxs("div",{children:[e.jsx(F,{isRequired:s,children:n}),x&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:x}),e.jsx("input",{type:j[g],value:a,onChange:f=>i(f.target.value),onBlur:r,className:Z(!!o)}),e.jsx(G,{error:o})]}):g==="textarea"||a.length>80?e.jsxs("div",{children:[e.jsx(F,{isRequired:s,children:n}),x&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:x}),e.jsx("textarea",{value:a,onChange:f=>i(f.target.value),onBlur:r,className:`${Z(!!o)} leading-relaxed`,rows:Math.min(6,Math.max(3,Math.ceil(a.length/60)))}),e.jsx(G,{error:o})]}):e.jsxs("div",{children:[e.jsx(F,{isRequired:s,children:n}),x&&e.jsx("p",{className:"text-[10px] text-text-tertiary mt-0.5",children:x}),e.jsx("input",{type:"text",value:a,onChange:f=>i(f.target.value),onBlur:r,className:Z(!!o)}),e.jsx(G,{error:o})]})}if(a===null)return e.jsxs("div",{children:[e.jsx(F,{isRequired:s,children:n}),e.jsx("p",{className:"text-xs text-text-tertiary italic mt-1",children:"null"})]});if(Array.isArray(a))return e.jsxs("div",{children:[e.jsx(F,{isRequired:s,children:n}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:a.map((u,y)=>e.jsx("span",{className:"px-2 py-0.5 text-[11px] font-mono bg-surface-sunken rounded text-text-secondary",children:String(u)},y))})]});if(typeof a=="object"){const u=Object.entries(a);return e.jsxs("div",{children:[e.jsx(F,{isRequired:s,children:n}),e.jsx("div",{className:"ml-4 mt-2 pl-4 border-l border-accent-faint space-y-3",children:u.map(([y,x])=>e.jsx(Ie,{fieldKey:y,value:x,onChange:g=>i({...a,[y]:g})},y))})]})}return null}function F({children:t,isRequired:a}){return e.jsxs("label",{className:"text-[11px] font-semibold uppercase tracking-wider text-text-secondary",children:[t,a&&e.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]})}function G({error:t}){return t?e.jsx("p",{className:"text-[10px] text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:t}):null}function Z(t){return t?"input text-sm w-full mt-1 border-status-error/50 focus:border-status-error animate-[field-shake_0.4s_ease-in-out]":"input text-sm w-full mt-1"}function Ee({json:t,onJsonChange:a,requestTriage:i,onRequestTriageChange:r,triageNotes:l,onTriageNotesChange:s,isDevMode:m=!0,disabled:o=!1,submitAttempted:n=!1,showTriage:c=!1}){const[d,p]=h.useState("form"),{visibleJson:u,hiddenFields:y}=h.useMemo(()=>{try{const j=JSON.parse(t);if(typeof j=="object"&&j!==null&&!Array.isArray(j)){const f={},S={};for(const[R,$]of Object.entries(j))R.startsWith("_")?f[R]=$:S[R]=$;return{visibleJson:JSON.stringify(S,null,2),hiddenFields:f}}}catch{}return{visibleJson:t,hiddenFields:{}}},[t]),x=h.useCallback(j=>{try{const f=JSON.parse(j);a(JSON.stringify({...f,...y},null,2))}catch{a(j)}},[y,a]),g=Object.keys(y).length>0;return e.jsxs(e.Fragment,{children:[(c||m)&&e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[c?i?e.jsxs("button",{onClick:()=>r(!1),className:"group flex items-center gap-2 text-left","data-testid":"triage-cancel",children:[e.jsx("span",{className:"flex items-center justify-center w-5 h-5 rounded-full bg-accent/10 text-accent shrink-0",children:e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),e.jsxs("span",{className:"text-xs text-text-secondary group-hover:text-text-primary transition-colors",children:["AI Triage active."," ",e.jsx("span",{className:"text-accent group-hover:underline",children:"Cancel"})]})]}):e.jsxs("button",{onClick:()=>r(!0),className:"group flex items-center gap-2.5 text-left my-4","data-testid":"triage-callout",children:[e.jsx("span",{className:"flex items-center justify-center w-6 h-6 rounded-full bg-accent/10 text-accent shrink-0 animate-[triage-glow_6s_ease-in-out_infinite]",children:e.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.663 17h4.674M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})})}),e.jsxs("span",{className:"text-[13px] text-text-secondary group-hover:text-text-primary transition-colors",children:["This form doesn't capture the issue?"," ",e.jsx("span",{className:"text-accent group-hover:underline",children:"Request AI Triage"})]})]}):e.jsx("span",{}),m&&!i&&e.jsx("button",{onClick:()=>p(d==="form"?"json":"form"),className:"text-[10px] text-text-tertiary hover:text-accent transition-colors",children:d==="form"?"Raw JSON":"Form"})]}),e.jsxs("div",{className:"relative min-h-[200px]",children:[e.jsx("div",{className:i?"pointer-events-none select-none":"",children:d==="form"?e.jsx(Re,{value:t,onChange:a,disabled:o,submitAttempted:n}):e.jsxs("div",{children:[g&&e.jsx("p",{className:"text-[10px] text-text-quaternary mb-2 italic",children:"Form schema hidden. Edit the resolver values below — they will be merged with the schema on submit."}),e.jsx("textarea",{value:u,onChange:j=>x(j.target.value),className:"input-json w-full",rows:Math.max(8,u.split(`
|
|
5
5
|
`).length+2),spellCheck:!1,"data-testid":"resolve-json"})]})}),i&&e.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col bg-surface/90 backdrop-blur-[2px] rounded-md border border-accent/20 p-5","data-testid":"triage-overlay",children:[e.jsx("p",{className:"text-xs text-text-secondary mb-3 leading-relaxed",children:"The resolution form will not be submitted. Describe the issue so AI triage can diagnose and fix it using available tools. The corrected result will come back as a new escalation for your review."}),e.jsx("textarea",{value:l,onChange:j=>s(j.target.value),placeholder:"e.g. Content is in Spanish — needs translation to English before review...",className:"input text-xs w-full flex-1 min-h-[80px] resize-none",autoFocus:!0,"data-testid":"triage-notes"})]})]})]})}function H({children:t}){return e.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-tertiary",children:t})}function re({children:t}){return e.jsx("p",{className:"text-[12px] text-text-secondary mt-0.5 font-mono",children:t})}function vt({esc:t}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-accent/60 mb-3",children:"Classification"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-x-8 gap-y-4",children:[e.jsxs("div",{children:[e.jsx(H,{children:"Type"}),e.jsx(re,{children:t.type})]}),t.subtype&&e.jsxs("div",{children:[e.jsx(H,{children:"Subtype"}),e.jsx(re,{children:t.subtype})]}),e.jsxs("div",{children:[e.jsx(H,{children:"Priority"}),e.jsxs(re,{children:["P",t.priority]})]}),e.jsxs("div",{children:[e.jsx(H,{children:"Status"}),e.jsx(re,{children:t.status})]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-accent/60 mb-3",children:"References"}),e.jsxs("div",{className:"flex flex-wrap gap-x-8 gap-y-4",children:[e.jsx(E,{label:"Escalation ID",value:t.id}),t.task_id&&e.jsx(E,{label:"Task ID",value:t.task_id,href:`/workflows/tasks/detail/${t.task_id}`}),t.workflow_type&&e.jsx(E,{label:"Workflow Name",value:t.workflow_type,href:`/workflows/registry/${t.workflow_type}`}),t.workflow_id&&e.jsx(E,{label:"Workflow ID",value:t.workflow_id,href:`/workflows/executions/${t.workflow_id}`}),t.task_queue&&e.jsx(E,{label:"Task Queue",value:t.task_queue}),t.origin_id&&t.origin_id!==t.workflow_id&&e.jsx(E,{label:"Origin ID",value:t.origin_id}),t.parent_id&&e.jsx(E,{label:"Parent ID",value:t.parent_id}),t.trace_id&&e.jsx(E,{label:"Trace ID",value:t.trace_id}),t.span_id&&e.jsx(E,{label:"Span ID",value:t.span_id})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-accent/60 mb-3",children:"Timeline"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-x-8 gap-y-4",children:[e.jsxs("div",{children:[e.jsx(H,{children:"Created"}),e.jsx("p",{className:"text-[12px] text-text-secondary mt-0.5",children:e.jsx(J,{date:t.created_at})})]}),t.claimed_at&&e.jsxs("div",{children:[e.jsx(H,{children:"Claimed"}),e.jsx("p",{className:"text-[12px] text-text-secondary mt-0.5",children:e.jsx(J,{date:t.claimed_at})})]}),t.resolved_at&&e.jsxs("div",{children:[e.jsx(H,{children:"Resolved"}),e.jsx("p",{className:"text-[12px] text-text-secondary mt-0.5",children:e.jsx(J,{date:t.resolved_at})})]}),e.jsxs("div",{children:[e.jsx(H,{children:"Updated"}),e.jsx("p",{className:"text-[12px] text-text-secondary mt-0.5",children:e.jsx(J,{date:t.updated_at})})]})]})]}),t.metadata&&Object.keys(t.metadata).length>0&&e.jsx("div",{children:e.jsx(te,{data:t.metadata,label:"Metadata"})})]})}function wt({isRoundsExhausted:t,payloadObj:a,isTerminal:i,resolverPayload:r,onRetryTriage:l,isRetrying:s}){return e.jsxs(e.Fragment,{children:[t&&a&&e.jsx("div",{className:"mt-8",children:e.jsx(pt,{payload:a,isTerminal:i,resolverPayload:r,onRetryTriage:l,isRetrying:s})}),(a==null?void 0:a.category)==="missing_credential"&&e.jsxs("div",{className:"mt-8 bg-status-warning/10 border border-status-warning/30 rounded-md px-5 py-4 flex items-start gap-3",children:[e.jsx(ve,{size:20,className:"text-status-warning mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-text-primary mb-1",children:"Missing Credential"}),e.jsxs("p",{className:"text-xs text-text-secondary mb-3",children:["This workflow requires a ",e.jsx("span",{className:"font-medium capitalize",children:String(a.provider)})," credential to continue. Register one and then resolve this escalation to retry."]}),e.jsxs(Se,{to:"/credentials",className:"btn-primary text-xs inline-flex items-center gap-1.5",children:[e.jsx(ve,{size:12}),"Go to Credentials"]})]})]})]})}function kt({isCollapsed:t,toggleSection:a,esc:i,escalationPayload:r,resolverPayload:l,triageData:s,payloadObj:m,isTerminal:o,claimedByMe:n,activeView:c,metadataFormSchema:d,json:p,onJsonChange:u,requestTriage:y,onRequestTriageChange:x,triageNotes:g,onTriageNotesChange:j,isDevMode:f,onResolve:S,onEscalate:R,submitAttempted:$,isCertified:A,hasAI:M}){return e.jsxs("div",{className:"mt-8 space-y-6",children:[f&&e.jsx(ae,{title:"Escalation Record",sectionKey:"record",isCollapsed:t("record"),onToggle:a,contentClassName:"mt-4 ml-9",children:e.jsx(vt,{esc:i})}),f&&e.jsx(ae,{title:"Input / Output",sectionKey:"context",isCollapsed:t("context"),onToggle:a,contentClassName:"mt-4 ml-9",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[!!i.envelope&&e.jsx("div",{children:e.jsx(te,{data:i.envelope,label:"Input Envelope"})}),r!=null&&e.jsx("div",{children:e.jsx(te,{data:r,label:"Escalation Context"})})]}),l!=null&&e.jsx("div",{className:"max-w-xl",children:e.jsx(te,{data:l,label:"Resolver Payload"})})]})}),f&&s&&m&&e.jsx(ae,{title:"AI Triage",sectionKey:"triage",isCollapsed:t("triage"),onToggle:a,contentClassName:"mt-4 ml-9",children:e.jsx(ht,{triage:s,payload:m})}),!f&&o&&l!=null&&(()=>{const C=typeof l=="object"&&l!==null?l:{},k=d,b=k?{...C,_form_schema:k}:C;return e.jsx("div",{className:"pt-6",children:e.jsx(Re,{value:JSON.stringify(b,null,2),onChange:()=>{},disabled:!0})})})(),!o&&(n||!f)&&c==="resolve"&&!!(i.workflow_type||d)&&(()=>{const C=d,k=C==null?void 0:C["x-lt-viewport"],b=(k==null?void 0:k.type)==="iframe"&&!!k.src&&S&&R;return f?e.jsx(ae,{title:"Submit Your Resolution",sectionKey:"resolver",isCollapsed:t("resolver"),onToggle:a,contentClassName:"mt-4 ml-9",children:b?e.jsx(Ce,{src:k.src,escalation:i,schema:C,onResolve:S,onEscalate:R}):e.jsx(Ee,{json:p,onJsonChange:u,requestTriage:y,onRequestTriageChange:x,triageNotes:g,onTriageNotesChange:j,isDevMode:f,submitAttempted:$,showTriage:!!A&&!!M})}):e.jsx("div",{className:"pt-6",children:b?e.jsx(Ce,{src:k.src,escalation:i,schema:C,onResolve:S,onEscalate:R}):e.jsx(Ee,{json:p,onJsonChange:u,requestTriage:y,onRequestTriageChange:x,triageNotes:g,onTriageNotesChange:j,isDevMode:f,disabled:!n,submitAttempted:$,showTriage:!!A&&!!M})})})()]})}function ce(t){if(!t)return null;try{return JSON.parse(t)}catch{return t}}function _t(t){if(!t)return!1;try{const a=JSON.parse(t);return!!(a&&typeof a=="object"&&a._triage)}catch{return!1}}function zt(){var pe,he,fe,je;const{id:t}=lt(),{user:a,hasRoleType:i,hasRole:r}=ze(),l=ct(),{data:s,isLoading:m}=Be(t);st(t);const o=He(),n=Ke(),c=Ye(),{data:d}=Qe((s==null?void 0:s.role)??""),{data:p}=tt(),{data:u}=qe(),y=i("admin")||i("superadmin")||r("engineer"),{isDevMode:x,toggleMode:g}=ot(!1),j=p==null?void 0:p.find(T=>T.workflow_type===(s==null?void 0:s.workflow_type)),f=((pe=u==null?void 0:u.telemetry)==null?void 0:pe.traceUrl)??null,[S,R]=h.useState("resolve"),[$,A]=h.useState("{}"),{isCollapsed:M,toggle:C,collapse:k,expand:b}=Ge("escalation-detail"),[v,w]=h.useState(!1),[I,L]=h.useState(""),[V,Q]=h.useState(!1),_=(j==null?void 0:j.resolver_schema)??null,W=((he=s==null?void 0:s.metadata)==null?void 0:he.form_schema)??null,O=W??_,ee=h.useRef(!1);h.useEffect(()=>{if(ee.current)return;const T=W??(_!=null&&_.properties?_:null);if(T!=null&&T.properties){ee.current=!0;const ge={_form_schema:T};for(const[Fe,Je]of Object.entries(T.properties)){const Ve=Je;ge[Fe]=Ve.default??""}A(JSON.stringify(ge,null,2))}else O&&(ee.current=!0,A(JSON.stringify(O,null,2)))},[O,W,_]);const K=_t(s==null?void 0:s.escalation_payload),N=(s==null?void 0:s.subtype)==="rounds_exhausted",X=(s==null?void 0:s.subtype)==="wait_for_human";if(h.useEffect(()=>{(K||N)&&k("context"),X&&W&&(k("context"),b("resolver"))},[K,N,X,W,k,b]),m)return e.jsxs("div",{className:"animate-pulse space-y-8",children:[e.jsx("div",{className:"h-8 bg-surface-sunken rounded w-64"}),e.jsx("div",{className:"h-32 bg-surface-sunken rounded w-full"})]});if(!s)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Escalation not found."});const U=et(s),P=U&&s.assigned_to===(a==null?void 0:a.userId),Y=U&&!P,D=s.status==="resolved"||s.status==="cancelled",q=ce(s.escalation_payload),xe=ce(s.resolver_payload),ne=ce(s.envelope),$e=!!((fe=ne==null?void 0:ne.metadata)!=null&&fe.certified),Ae=!!((je=u==null?void 0:u.ai)!=null&&je.enabled),z=typeof q=="object"&&q!==null&&!Array.isArray(q)?q:null,Me=z==null?void 0:z._triage,We=D?"terminal":P?"claimed_by_me":Y?"claimed_by_other":"available",Pe=T=>{o.mutate({id:s.id,durationMinutes:T}),k("context"),k("triage"),b("resolver")},se=()=>l(-1),ue=async T=>{await n.mutateAsync({id:s.id,resolverPayload:T}),se()},me=async T=>{T&&(await c.mutateAsync({id:s.id,targetRole:T}),se())},De=async()=>{P||await o.mutateAsync({id:s.id,durationMinutes:30});const T=(z==null?void 0:z.diagnosis)||s.description||"";await n.mutateAsync({id:s.id,resolverPayload:{_lt:{needsTriage:!0},notes:T}}),se()},Le=async()=>{await o.mutateAsync({id:s.id,durationMinutes:0}),se()},Oe=y?e.jsx("button",{onClick:g,className:"text-text-tertiary hover:text-accent transition-colors",title:x?"Switch to user view":"Switch to developer view",children:x?e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17.25 6.75L22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3l-4.5 16.5"})}):e.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}):void 0;return e.jsxs("div",{className:"min-h-[calc(100vh-9rem)] flex flex-col",children:[e.jsx(Xe,{title:"Escalation",actions:Oe}),e.jsx(ut,{esc:s,claimedByMe:P,claimed:U,isTerminal:D,traceUrl:f,isDevMode:x,showDetails:!M("details"),onToggleDetails:()=>C("details")}),e.jsx(wt,{isRoundsExhausted:N,payloadObj:z,isTerminal:D,resolverPayload:xe,onRetryTriage:De,isRetrying:o.isPending||n.isPending}),e.jsx(kt,{isCollapsed:M,toggleSection:C,esc:s,escalationPayload:q,resolverPayload:xe,triageData:Me,payloadObj:z,isTerminal:D,claimedByMe:P,activeView:S,metadataFormSchema:W,json:$,onJsonChange:A,requestTriage:v,onRequestTriageChange:w,triageNotes:I,onTriageNotesChange:L,isDevMode:x,onResolve:ue,onEscalate:me,submitAttempted:V,isCertified:$e,hasAI:Ae}),e.jsx("div",{className:"flex-1"}),e.jsx(dt,{mode:We,activeView:S,onActiveViewChange:R,onClaim:Pe,claimPending:o.isPending,workflowType:s.workflow_type,json:$,onResolve:ue,resolvePending:n.isPending,resolveError:n.error,requestTriage:v,triageNotes:I,currentRole:s.role,escalationTargets:(d==null?void 0:d.targets)??[],onEscalate:me,escalatePending:c.isPending,escalateError:c.error,onRelease:Le,releasePending:o.isPending,assignedTo:s.assigned_to,assignedUntil:s.assigned_until,onSubmitAttempt:()=>Q(!0)})]})}export{zt as EscalationDetailPage};
|
|
6
|
-
//# sourceMappingURL=index-
|
|
6
|
+
//# sourceMappingURL=index-BAXzN-QB.js.map
|