@hotmeshio/long-tail 0.10.10 → 0.10.13
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/api/escalations/list.d.ts +1 -0
- package/build/api/escalations/list.js +12 -4
- package/build/api/escalations/metadata.d.ts +11 -0
- package/build/api/escalations/metadata.js +27 -7
- package/build/api/roles.d.ts +2 -0
- package/build/api/roles.js +4 -0
- package/build/api/scan-codes/config.d.ts +22 -0
- package/build/api/scan-codes/config.js +136 -0
- package/build/api/scan-codes/execute.d.ts +9 -0
- package/build/api/scan-codes/execute.js +372 -0
- package/build/api/scan-codes/index.d.ts +2 -0
- package/build/api/scan-codes/index.js +14 -0
- package/build/lib/db/schemas/025_ops_home_default.sql +11 -0
- package/build/lib/db/schemas/026_scan_codes.sql +51 -0
- package/build/lib/db/schemas/027_scan_codes_reindex.sql +23 -0
- package/build/lib/events/system-events.js +4 -0
- package/build/modules/features.d.ts +17 -0
- package/build/modules/features.js +2 -0
- package/build/routes/escalations/list.js +1 -0
- package/build/routes/index.js +2 -0
- package/build/routes/scan-codes.d.ts +2 -0
- package/build/routes/scan-codes.js +138 -0
- package/build/sdk/index.d.ts +4 -0
- package/build/services/escalation/crud.d.ts +1 -1
- package/build/services/escalation/crud.js +4 -2
- package/build/services/escalation/queries.d.ts +1 -0
- package/build/services/escalation/queries.js +2 -0
- package/build/services/escalation/sql.d.ts +11 -6
- package/build/services/escalation/sql.js +20 -20
- package/build/services/role/index.js +1 -0
- package/build/services/role/sql.d.ts +6 -2
- package/build/services/role/sql.js +11 -2
- package/build/services/role/types.d.ts +9 -0
- package/build/services/scan-code/index.d.ts +4 -0
- package/build/services/scan-code/index.js +21 -0
- package/build/services/scan-code/parse.d.ts +35 -0
- package/build/services/scan-code/parse.js +108 -0
- package/build/services/scan-code/read.d.ts +5 -0
- package/build/services/scan-code/read.js +50 -0
- package/build/services/scan-code/sql.d.ts +10 -0
- package/build/services/scan-code/sql.js +57 -0
- package/build/services/scan-code/validate.d.ts +12 -0
- package/build/services/scan-code/validate.js +78 -0
- package/build/services/scan-code/write.d.ts +26 -0
- package/build/services/scan-code/write.js +71 -0
- package/build/shared/form-validation/index.d.ts +1 -0
- package/build/shared/form-validation/index.js +1 -0
- package/build/shared/form-validation/x-lt-transition.d.ts +47 -0
- package/build/shared/form-validation/x-lt-transition.js +65 -0
- package/build/system/mcp-servers/admin/index.d.ts +1 -0
- package/build/system/mcp-servers/admin/index.js +5 -2
- package/build/system/mcp-servers/admin/scan-codes.d.ts +10 -0
- package/build/system/mcp-servers/admin/scan-codes.js +111 -0
- package/build/system/mcp-servers/admin/schemas.d.ts +235 -14
- package/build/system/mcp-servers/admin/schemas.js +51 -0
- package/build/system/mcp-servers/admin/users.js +1 -0
- package/build/system/seed/tool-manifests-admin.d.ts +1462 -0
- package/build/system/seed/tool-manifests-admin.js +7 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/events.d.ts +9 -0
- package/build/types/index.d.ts +2 -0
- package/build/types/index.js +10 -1
- package/build/types/scan-code.d.ts +183 -0
- package/build/types/scan-code.js +80 -0
- package/build/types/startup.d.ts +14 -0
- package/dashboard/dist/assets/{AdminDashboard-cGYuppUP.js → AdminDashboard-Bv3pHBzn.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-cGYuppUP.js.map → AdminDashboard-Bv3pHBzn.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-DwaUyoCy.js → AgentConfigPage-Dk2zlvDb.js} +6 -6
- package/dashboard/dist/assets/{AgentConfigPage-DwaUyoCy.js.map → AgentConfigPage-Dk2zlvDb.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-DxpFaltM.js → AgentDetailPage-DUno6EGs.js} +2 -2
- package/dashboard/dist/assets/{AgentDetailPage-DxpFaltM.js.map → AgentDetailPage-DUno6EGs.js.map} +1 -1
- package/dashboard/dist/assets/{AgentsPage-ByOoA8oT.js → AgentsPage-CToVu1qj.js} +2 -2
- package/dashboard/dist/assets/{AgentsPage-ByOoA8oT.js.map → AgentsPage-CToVu1qj.js.map} +1 -1
- package/dashboard/dist/assets/{AutoGrowTextarea-y-oNY51_.js → AutoGrowTextarea-DgEQeRQw.js} +2 -2
- package/dashboard/dist/assets/{AutoGrowTextarea-y-oNY51_.js.map → AutoGrowTextarea-DgEQeRQw.js.map} +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-DldboL4W.js +2 -0
- package/dashboard/dist/assets/AvailableEscalationsPage-DldboL4W.js.map +1 -0
- package/dashboard/dist/assets/BotPicker-DQOpVB4M.js +2 -0
- package/dashboard/dist/assets/{BotPicker-Dohv8dhR.js.map → BotPicker-DQOpVB4M.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-DeijFG3J.js → CapabilitiesPage-Dmf46PUJ.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-DeijFG3J.js.map → CapabilitiesPage-Dmf46PUJ.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-BPNwS4eO.js → CollapsibleSection-CDADefUY.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-BPNwS4eO.js.map → CollapsibleSection-CDADefUY.js.map} +1 -1
- package/dashboard/dist/assets/{ConfirmDeleteModal-DD7SEMeX.js → ConfirmDeleteModal-CQsJUzEa.js} +2 -2
- package/dashboard/dist/assets/{ConfirmDeleteModal-DD7SEMeX.js.map → ConfirmDeleteModal-CQsJUzEa.js.map} +1 -1
- package/dashboard/dist/assets/{CopyableId-BpB-NvDh.js → CopyableId-4Lqlc5cU.js} +2 -2
- package/dashboard/dist/assets/{CopyableId-BpB-NvDh.js.map → CopyableId-4Lqlc5cU.js.map} +1 -1
- package/dashboard/dist/assets/CountdownTimer-DPjIkerB.js +2 -0
- package/dashboard/dist/assets/{CountdownTimer-BF71ldGF.js.map → CountdownTimer-DPjIkerB.js.map} +1 -1
- package/dashboard/dist/assets/{CredentialsPage-oeNmMzTM.js → CredentialsPage-8LIEvomi.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-oeNmMzTM.js.map → CredentialsPage-8LIEvomi.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-CebR1m2k.js → CronLabel-CK3WSsM5.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-CebR1m2k.js.map → CronLabel-CK3WSsM5.js.map} +1 -1
- package/dashboard/dist/assets/{CustomDurationPicker-Bh9QdBVw.js → CustomDurationPicker-FPmlA6cE.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-Bh9QdBVw.js.map → CustomDurationPicker-FPmlA6cE.js.map} +1 -1
- package/dashboard/dist/assets/{DataTable-BTu2AaEl.js → DataTable-Bir0Xs1p.js} +2 -2
- package/dashboard/dist/assets/{DataTable-BTu2AaEl.js.map → DataTable-Bir0Xs1p.js.map} +1 -1
- package/dashboard/dist/assets/{DropZone-Bavzt2QR.js → DropZone-CL9gA7pu.js} +2 -2
- package/dashboard/dist/assets/{DropZone-Bavzt2QR.js.map → DropZone-CL9gA7pu.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-Caa6CU_y.js → ElapsedCell-BZVkVxE0.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-Caa6CU_y.js.map → ElapsedCell-BZVkVxE0.js.map} +1 -1
- package/dashboard/dist/assets/{EmptyState-BcsfPq9T.js → EmptyState-lpUFYfun.js} +2 -2
- package/dashboard/dist/assets/{EmptyState-BcsfPq9T.js.map → EmptyState-lpUFYfun.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationListSchemaPage-CAGfq0eK.js → EscalationListSchemaPage-kYLdUtZX.js} +3 -3
- package/dashboard/dist/assets/{EscalationListSchemaPage-CAGfq0eK.js.map → EscalationListSchemaPage-kYLdUtZX.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationSchemaPage-qDD4ur6P.js → EscalationSchemaPage-kUmCDivo.js} +3 -3
- package/dashboard/dist/assets/{EscalationSchemaPage-qDD4ur6P.js.map → EscalationSchemaPage-kUmCDivo.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-CC1wRTzy.js → EscalationsOverview-D17auO-m.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-CC1wRTzy.js.map → EscalationsOverview-D17auO-m.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-4JeTcXr_.js → EventTable-CwPWl163.js} +2 -2
- package/dashboard/dist/assets/{EventTable-4JeTcXr_.js.map → EventTable-CwPWl163.js.map} +1 -1
- package/dashboard/dist/assets/{FilterBar-BOV8DWIO.js → FilterBar-D7GghUsU.js} +2 -2
- package/dashboard/dist/assets/{FilterBar-BOV8DWIO.js.map → FilterBar-D7GghUsU.js.map} +1 -1
- package/dashboard/dist/assets/{GraphInvokePage-C0i1speW.js → GraphInvokePage-D11uOnZi.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage-C0i1speW.js.map → GraphInvokePage-D11uOnZi.js.map} +1 -1
- package/dashboard/dist/assets/HomePage-Bcq10Bxx.js +2 -0
- package/dashboard/dist/assets/HomePage-Bcq10Bxx.js.map +1 -0
- package/dashboard/dist/assets/ListToolbar-IPXsTb3Q.js +2 -0
- package/dashboard/dist/assets/ListToolbar-IPXsTb3Q.js.map +1 -0
- package/dashboard/dist/assets/{McpOverview-Chn2zIXr.js → McpOverview-Dx2j0KkF.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-Chn2zIXr.js.map → McpOverview-Dx2j0KkF.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-Cv1FKrvw.js → McpQueryDetailPage-CzF_bna8.js} +3 -3
- package/dashboard/dist/assets/{McpQueryDetailPage-Cv1FKrvw.js.map → McpQueryDetailPage-CzF_bna8.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryPage-Dzn8JE4E.js → McpQueryPage-CNsuiw_q.js} +2 -2
- package/dashboard/dist/assets/{McpQueryPage-Dzn8JE4E.js.map → McpQueryPage-CNsuiw_q.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunDetailPage-CuNtR4Ed.js → McpRunDetailPage-BJguEMS0.js} +2 -2
- package/dashboard/dist/assets/{McpRunDetailPage-CuNtR4Ed.js.map → McpRunDetailPage-BJguEMS0.js.map} +1 -1
- package/dashboard/dist/assets/{McpRunsPage-C8iifeKN.js → McpRunsPage-CK96s3Nt.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-C8iifeKN.js.map → McpRunsPage-CK96s3Nt.js.map} +1 -1
- package/dashboard/dist/assets/{Modal-CA2Iv02H.js → Modal-BU7No9NH.js} +2 -2
- package/dashboard/dist/assets/{Modal-CA2Iv02H.js.map → Modal-BU7No9NH.js.map} +1 -1
- package/dashboard/dist/assets/{NamespacePill-ep9Zmokr.js → NamespacePill-B9Vc_Pz2.js} +2 -2
- package/dashboard/dist/assets/{NamespacePill-ep9Zmokr.js.map → NamespacePill-B9Vc_Pz2.js.map} +1 -1
- package/dashboard/dist/assets/OperationsPage-DvWrLuH6.js +2 -0
- package/dashboard/dist/assets/OperationsPage-DvWrLuH6.js.map +1 -0
- package/dashboard/dist/assets/OperatorDashboard-C-jE0IRA.js +2 -0
- package/dashboard/dist/assets/OperatorDashboard-C-jE0IRA.js.map +1 -0
- package/dashboard/dist/assets/{PageHeader-Bw8RNkqR.js → PageHeader-Ce4GcIYo.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-Bw8RNkqR.js.map → PageHeader-Ce4GcIYo.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-NR_4idn6.js → PageHeaderWithStats-Ck0KZvXD.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-NR_4idn6.js.map → PageHeaderWithStats-Ck0KZvXD.js.map} +1 -1
- package/dashboard/dist/assets/{PersonaDetailPage-DKILoUqL.js → PersonaDetailPage-CJ6jqo7h.js} +2 -2
- package/dashboard/dist/assets/{PersonaDetailPage-DKILoUqL.js.map → PersonaDetailPage-CJ6jqo7h.js.map} +1 -1
- package/dashboard/dist/assets/{PersonasPage-qvzHTrFw.js → PersonasPage-D8hL3kL5.js} +2 -2
- package/dashboard/dist/assets/{PersonasPage-qvzHTrFw.js.map → PersonasPage-D8hL3kL5.js.map} +1 -1
- package/dashboard/dist/assets/{PriorityBadge-CCERr9vQ.js → PriorityBadge-BETdj4M-.js} +2 -2
- package/dashboard/dist/assets/{PriorityBadge-CCERr9vQ.js.map → PriorityBadge-BETdj4M-.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessDetailPage-C3LfeKvi.js → ProcessDetailPage-Vnx8Z5_y.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-C3LfeKvi.js.map → ProcessDetailPage-Vnx8Z5_y.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-OoZ_u4ty.js → ProcessesListPage-DRYtvS3N.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-OoZ_u4ty.js.map → ProcessesListPage-DRYtvS3N.js.map} +1 -1
- package/dashboard/dist/assets/RoleDetailPage-BKkUvTO-.js +8 -0
- package/dashboard/dist/assets/RoleDetailPage-BKkUvTO-.js.map +1 -0
- package/dashboard/dist/assets/{RolePill-TySZq7dB.js → RolePill-CnuBPhPw.js} +2 -2
- package/dashboard/dist/assets/{RolePill-TySZq7dB.js.map → RolePill-CnuBPhPw.js.map} +1 -1
- package/dashboard/dist/assets/RolesPage-BHzWK9n6.js +2 -0
- package/dashboard/dist/assets/{RolesPage-CNueMVuJ.js.map → RolesPage-BHzWK9n6.js.map} +1 -1
- package/dashboard/dist/assets/{RowActions-BA9L9djf.js → RowActions-eYrzgQSj.js} +2 -2
- package/dashboard/dist/assets/{RowActions-BA9L9djf.js.map → RowActions-eYrzgQSj.js.map} +1 -1
- package/dashboard/dist/assets/{RunAsSelector-CwWEpiSF.js → RunAsSelector-CS3KQ-BF.js} +2 -2
- package/dashboard/dist/assets/{RunAsSelector-CwWEpiSF.js.map → RunAsSelector-CS3KQ-BF.js.map} +1 -1
- package/dashboard/dist/assets/ScanCodesPage-BW4P4zWf.js +2 -0
- package/dashboard/dist/assets/ScanCodesPage-BW4P4zWf.js.map +1 -0
- package/dashboard/dist/assets/ScanSchemeDetailPage-BLykA4j-.js +2 -0
- package/dashboard/dist/assets/ScanSchemeDetailPage-BLykA4j-.js.map +1 -0
- package/dashboard/dist/assets/{ScopeBadge-C7Uixtmk.js → ScopeBadge-BUpYpS3x.js} +2 -2
- package/dashboard/dist/assets/{ScopeBadge-C7Uixtmk.js.map → ScopeBadge-BUpYpS3x.js.map} +1 -1
- package/dashboard/dist/assets/{StatCard-Ca-ngCaD.js → StatCard-BXQ8dD9Y.js} +2 -2
- package/dashboard/dist/assets/{StatCard-Ca-ngCaD.js.map → StatCard-BXQ8dD9Y.js.map} +1 -1
- package/dashboard/dist/assets/{StatusBadge-BwUvykDo.js → StatusBadge-DkgllZHv.js} +2 -2
- package/dashboard/dist/assets/{StatusBadge-BwUvykDo.js.map → StatusBadge-DkgllZHv.js.map} +1 -1
- package/dashboard/dist/assets/{StickyPagination-DvIF3kQK.js → StickyPagination-hMrnLXde.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-DvIF3kQK.js.map → StickyPagination-hMrnLXde.js.map} +1 -1
- package/dashboard/dist/assets/{StreamMessageDetail-DkFK_XGD.js → StreamMessageDetail-DyJyZwBl.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-DkFK_XGD.js.map → StreamMessageDetail-DyJyZwBl.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-CMw-Et6h.js → SwimlaneTimeline-BlzV74V5.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-CMw-Et6h.js.map → SwimlaneTimeline-BlzV74V5.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-D8gSp48D.js → TagInput-BbZ25nNe.js} +2 -2
- package/dashboard/dist/assets/{TagInput-D8gSp48D.js.map → TagInput-BbZ25nNe.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-BhXuChOf.js → TaskDetailPage-B0p_Z4J_.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-BhXuChOf.js.map → TaskDetailPage-B0p_Z4J_.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-CHqolBmU.js → TaskQueuePill-D0QKBrN3.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-CHqolBmU.js.map → TaskQueuePill-D0QKBrN3.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-6JHQQ5QZ.js → TasksListPage-CiGR2QiQ.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-6JHQQ5QZ.js.map → TasksListPage-CiGR2QiQ.js.map} +1 -1
- package/dashboard/dist/assets/TimeAgo-D_DA9ucC.js +2 -0
- package/dashboard/dist/assets/{TimeAgo-CInx-vzY.js.map → TimeAgo-D_DA9ucC.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-Fq17Zrsu.js → TimestampCell-C7rkC9nh.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-Fq17Zrsu.js.map → TimestampCell-C7rkC9nh.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-BbgMDhaE.js → ToolPill-8xY9rkoc.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-BbgMDhaE.js.map → ToolPill-8xY9rkoc.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-DhjEe59s.js → ToolTestPanel-E8efYGYs.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-DhjEe59s.js.map → ToolTestPanel-E8efYGYs.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-DbIdmQpQ.js → TopicDetailPage-B455XrRc.js} +3 -3
- package/dashboard/dist/assets/{TopicDetailPage-DbIdmQpQ.js.map → TopicDetailPage-B455XrRc.js.map} +1 -1
- package/dashboard/dist/assets/{TopicsPage-CAP-GUbr.js → TopicsPage-1VAc29Qw.js} +2 -2
- package/dashboard/dist/assets/{TopicsPage-CAP-GUbr.js.map → TopicsPage-1VAc29Qw.js.map} +1 -1
- package/dashboard/dist/assets/UserName-DikzjQHJ.js +2 -0
- package/dashboard/dist/assets/{UserName-DggcLkSc.js.map → UserName-DikzjQHJ.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowExecutionPage-Bmra5fVt.js → WorkflowExecutionPage-C15GSAoe.js} +2 -2
- package/dashboard/dist/assets/{WorkflowExecutionPage-Bmra5fVt.js.map → WorkflowExecutionPage-C15GSAoe.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowPill-CcUUVugA.js → WorkflowPill-Da406nEj.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPill-CcUUVugA.js.map → WorkflowPill-Da406nEj.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsDashboard-BQsZAGYU.js → WorkflowsDashboard-BMQd_0tW.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsDashboard-BQsZAGYU.js.map → WorkflowsDashboard-BMQd_0tW.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-CeliraHZ.js → WorkflowsOverview-CdxjVifp.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-CeliraHZ.js.map → WorkflowsOverview-CdxjVifp.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-DGxlonrV.js → YamlWorkflowDetailPage-DNVffIXa.js} +13 -13
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-DGxlonrV.js.map → YamlWorkflowDetailPage-DNVffIXa.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-DnT8UiyQ.js → YamlWorkflowsPage-BGP8wuos.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-DnT8UiyQ.js.map → YamlWorkflowsPage-BGP8wuos.js.map} +1 -1
- package/dashboard/dist/assets/{agents-mRV7m4sh.js → agents-BZJLIJ4h.js} +2 -2
- package/dashboard/dist/assets/{agents-mRV7m4sh.js.map → agents-BZJLIJ4h.js.map} +1 -1
- package/dashboard/dist/assets/{bots-SONCZlCM.js → bots-ClLcDGJb.js} +2 -2
- package/dashboard/dist/assets/{bots-SONCZlCM.js.map → bots-ClLcDGJb.js.map} +1 -1
- package/dashboard/dist/assets/capabilities-IaCcS7ge.js +2 -0
- package/dashboard/dist/assets/{capabilities-DZjCMN32.js.map → capabilities-IaCcS7ge.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-RQNXjna2.js → controlplane-Zi4m_MSx.js} +2 -2
- package/dashboard/dist/assets/{controlplane-RQNXjna2.js.map → controlplane-Zi4m_MSx.js.map} +1 -1
- package/dashboard/dist/assets/escalation-columns-BY2mg9DY.js +2 -0
- package/dashboard/dist/assets/escalation-columns-BY2mg9DY.js.map +1 -0
- package/dashboard/dist/assets/{index-ymm58cTW.js → index-BqGnhkh0.js} +2 -2
- package/dashboard/dist/assets/{index-ymm58cTW.js.map → index-BqGnhkh0.js.map} +1 -1
- package/dashboard/dist/assets/index-BzkE48xJ.js +6 -0
- package/dashboard/dist/assets/index-BzkE48xJ.js.map +1 -0
- package/dashboard/dist/assets/{index-CkeSxuZ0.js → index-C3o4OisO.js} +2 -2
- package/dashboard/dist/assets/{index-CkeSxuZ0.js.map → index-C3o4OisO.js.map} +1 -1
- package/dashboard/dist/assets/{index-DY_hlZCQ.js → index-CJu2PBNx.js} +2 -2
- package/dashboard/dist/assets/{index-DY_hlZCQ.js.map → index-CJu2PBNx.js.map} +1 -1
- package/dashboard/dist/assets/{index-DYKRtstT.js → index-CLmZaNTK.js} +2 -2
- package/dashboard/dist/assets/{index-DYKRtstT.js.map → index-CLmZaNTK.js.map} +1 -1
- package/dashboard/dist/assets/index-CfAi1OsI.js +65 -0
- package/dashboard/dist/assets/index-CfAi1OsI.js.map +1 -0
- package/dashboard/dist/assets/{index-CK-6m8e_.js → index-CmnNqpWg.js} +2 -2
- package/dashboard/dist/assets/{index-CK-6m8e_.js.map → index-CmnNqpWg.js.map} +1 -1
- package/dashboard/dist/assets/{index-DFJF8aWz.js → index-CvNBdkB1.js} +3 -3
- package/dashboard/dist/assets/{index-DFJF8aWz.js.map → index-CvNBdkB1.js.map} +1 -1
- package/dashboard/dist/assets/{index-DbZpL10z.js → index-D0zFReGL.js} +2 -2
- package/dashboard/dist/assets/{index-DbZpL10z.js.map → index-D0zFReGL.js.map} +1 -1
- package/dashboard/dist/assets/{index-C6GsrvX1.js → index-Dldi3Q3M.js} +2 -2
- package/dashboard/dist/assets/{index-C6GsrvX1.js.map → index-Dldi3Q3M.js.map} +1 -1
- package/dashboard/dist/assets/{index-DqsLfO-0.js → index-kiKZresb.js} +2 -2
- package/dashboard/dist/assets/{index-DqsLfO-0.js.map → index-kiKZresb.js.map} +1 -1
- package/dashboard/dist/assets/index-mKcQGi2B.js +3 -0
- package/dashboard/dist/assets/index-mKcQGi2B.js.map +1 -0
- package/dashboard/dist/assets/{index-CxVGlkK6.js → index-yGNt29V9.js} +2 -2
- package/dashboard/dist/assets/{index-CxVGlkK6.js.map → index-yGNt29V9.js.map} +1 -1
- package/dashboard/dist/assets/index-zQiUPfxA.css +1 -0
- package/dashboard/dist/assets/{knowledge-Bawo8u7l.js → knowledge-DWLxGTib.js} +2 -2
- package/dashboard/dist/assets/{knowledge-Bawo8u7l.js.map → knowledge-DWLxGTib.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-CKIpbpRZ.js → mcp-B6AARZ2I.js} +2 -2
- package/dashboard/dist/assets/{mcp-CKIpbpRZ.js.map → mcp-B6AARZ2I.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-vld4hYxQ.js → mcp-query-DrkvBU3a.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-vld4hYxQ.js.map → mcp-query-DrkvBU3a.js.map} +1 -1
- package/dashboard/dist/assets/{personas-BsARc3df.js → personas-Cmz2SAEU.js} +2 -2
- package/dashboard/dist/assets/{personas-BsARc3df.js.map → personas-Cmz2SAEU.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-BTSL-5ko.js → pipelines-CSgfVCMy.js} +2 -2
- package/dashboard/dist/assets/{pipelines-BTSL-5ko.js.map → pipelines-CSgfVCMy.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-DggQdNbj.js → tasks-UOtUkDk-.js} +2 -2
- package/dashboard/dist/assets/{tasks-DggQdNbj.js.map → tasks-UOtUkDk-.js.map} +1 -1
- package/dashboard/dist/assets/{topics-DzAKa34X.js → topics-Df5hGh6o.js} +2 -2
- package/dashboard/dist/assets/{topics-DzAKa34X.js.map → topics-Df5hGh6o.js.map} +1 -1
- package/dashboard/dist/assets/{useDebouncedValue-BA5S7V54.js → useDebouncedValue-C4P2jQuh.js} +2 -2
- package/dashboard/dist/assets/{useDebouncedValue-BA5S7V54.js.map → useDebouncedValue-C4P2jQuh.js.map} +1 -1
- package/dashboard/dist/assets/{useEventHooks-5uI9oI5W.js → useEventHooks-PDbuSJ12.js} +2 -2
- package/dashboard/dist/assets/{useEventHooks-5uI9oI5W.js.map → useEventHooks-PDbuSJ12.js.map} +1 -1
- package/dashboard/dist/assets/{useFilterParams-CvRyYHJN.js → useFilterParams-crmlBw_l.js} +2 -2
- package/dashboard/dist/assets/{useFilterParams-CvRyYHJN.js.map → useFilterParams-crmlBw_l.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-CEKzFIqe.js → useNamespace-tZSOlge3.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-CEKzFIqe.js.map → useNamespace-tZSOlge3.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-hHgX1Z50.js → useYamlActivityEvents-CINLzE32.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-hHgX1Z50.js.map → useYamlActivityEvents-CINLzE32.js.map} +1 -1
- package/dashboard/dist/assets/{users-AO8lUyNr.js → users-G8qwyZKS.js} +2 -2
- package/dashboard/dist/assets/{users-AO8lUyNr.js.map → users-G8qwyZKS.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-DN9yGSuM.js → vendor-icons-BpZiWH2f.js} +40 -40
- package/dashboard/dist/assets/vendor-icons-BpZiWH2f.js.map +1 -0
- package/dashboard/dist/assets/{vendor-query-B2UbickB.js → vendor-query-RUZdMvN6.js} +2 -2
- package/dashboard/dist/assets/{vendor-query-B2UbickB.js.map → vendor-query-RUZdMvN6.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-react-BpdAFEQc.js → vendor-react-CdqEC2zv.js} +3 -3
- package/dashboard/dist/assets/{vendor-react-BpdAFEQc.js.map → vendor-react-CdqEC2zv.js.map} +1 -1
- package/dashboard/dist/assets/{workflows-PtnlRK09.js → workflows-DbPqi1TW.js} +2 -2
- package/dashboard/dist/assets/{workflows-PtnlRK09.js.map → workflows-DbPqi1TW.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-DPu3Y8vG.js → yaml-workflows-DozD8hpR.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-DPu3Y8vG.js.map → yaml-workflows-DozD8hpR.js.map} +1 -1
- package/dashboard/dist/index.html +5 -5
- package/docs/dashboard.md +9 -2
- package/docs/design-principles.md +4 -0
- package/docs/hitl/pinned-views.md +3 -3
- package/docs/hitl/x-lt-transition.md +105 -0
- package/docs/operations.md +1 -1
- package/docs/scan-codes.md +243 -0
- package/package.json +2 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-C1vtTvqP.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-C1vtTvqP.js.map +0 -1
- package/dashboard/dist/assets/BotPicker-Dohv8dhR.js +0 -2
- package/dashboard/dist/assets/CountdownTimer-BF71ldGF.js +0 -2
- package/dashboard/dist/assets/HomePage-HPCd8SjF.js +0 -2
- package/dashboard/dist/assets/HomePage-HPCd8SjF.js.map +0 -1
- package/dashboard/dist/assets/ListToolbar-BFHVOba6.js +0 -2
- package/dashboard/dist/assets/ListToolbar-BFHVOba6.js.map +0 -1
- package/dashboard/dist/assets/OperationsPage-flrZ-EJ9.js +0 -2
- package/dashboard/dist/assets/OperationsPage-flrZ-EJ9.js.map +0 -1
- package/dashboard/dist/assets/OperatorDashboard-Dhs2eo8p.js +0 -2
- package/dashboard/dist/assets/OperatorDashboard-Dhs2eo8p.js.map +0 -1
- package/dashboard/dist/assets/RoleDetailPage-D70jTLZm.js +0 -8
- package/dashboard/dist/assets/RoleDetailPage-D70jTLZm.js.map +0 -1
- package/dashboard/dist/assets/RolesPage-CNueMVuJ.js +0 -2
- package/dashboard/dist/assets/TimeAgo-CInx-vzY.js +0 -2
- package/dashboard/dist/assets/UserName-DggcLkSc.js +0 -2
- package/dashboard/dist/assets/capabilities-DZjCMN32.js +0 -2
- package/dashboard/dist/assets/escalation-columns-XLEcZRCg.js +0 -2
- package/dashboard/dist/assets/escalation-columns-XLEcZRCg.js.map +0 -1
- package/dashboard/dist/assets/index-2BwHxjCw.css +0 -1
- package/dashboard/dist/assets/index-D2CfSx_x.js +0 -5
- package/dashboard/dist/assets/index-D2CfSx_x.js.map +0 -1
- package/dashboard/dist/assets/index-Dh3CVChT.js +0 -63
- package/dashboard/dist/assets/index-Dh3CVChT.js.map +0 -1
- package/dashboard/dist/assets/index-iHV3d7o3.js +0 -6
- package/dashboard/dist/assets/index-iHV3d7o3.js.map +0 -1
- package/dashboard/dist/assets/role-display-Dvo2lDpU.js +0 -2
- package/dashboard/dist/assets/role-display-Dvo2lDpU.js.map +0 -1
- package/dashboard/dist/assets/vendor-icons-DN9yGSuM.js.map +0 -1
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{j as t,a as f,b as Qe}from"./vendor-query-B2UbickB.js";import{M as Tt,Q as Pt,J as gt,R as Ze,T as Ke,U as tt,b as $t,m as ae,k as qt,K as je,V as be,P as Vt,h as ye,g as ts,W as es,X as ss,Y as ns,u as rs,t as as,j as is,Z as os}from"./index-Dh3CVChT.js";import{u as Ne,C as ve,a as ls}from"./CustomDurationPicker-Bh9QdBVw.js";import{P as cs}from"./PageHeader-Bw8RNkqR.js";import{L as ds}from"./ListToolbar-BFHVOba6.js";import{i as we,b as xs,d as us,C as Jt,H as ps,g as Ht,c as ot,m as ms,r as Ut,e as ke}from"./CountdownTimer-BF71ldGF.js";import{u as fs}from"./workflows-PtnlRK09.js";import{g as hs}from"./useEventHooks-5uI9oI5W.js";import{S as Ce}from"./StatusBadge-BwUvykDo.js";import{R as gs}from"./RolePill-TySZq7dB.js";import{C as rt}from"./CopyableId-BpB-NvDh.js";import{U as _e}from"./UserName-DggcLkSc.js";import{V as Ee,an as js,S as bs,ao as ys,J as Ns,n as vs,a9 as Ae,U as ws,ac as ks,ad as Cs,a2 as _s,ap as Es,aq as As,ar as Wt,as as ie,at as Ts,au as oe,av as le,aw as $s,X as Rs}from"./vendor-icons-DN9yGSuM.js";import{a as Te,L as it,e as Os}from"./vendor-react-BpdAFEQc.js";import{M as Ds}from"./Modal-CA2Iv02H.js";import"./constants-BHkpVaqx.js";import"./DataTable-BTu2AaEl.js";import"./EmptyState-BcsfPq9T.js";import"./StickyPagination-DvIF3kQK.js";import"./users-AO8lUyNr.js";const Is={SCHEMA_VALIDATION:"schema_validation"};function Ms(e){return typeof e=="object"&&e!==null&&e.code===Is.SCHEMA_VALIDATION&&Array.isArray(e.violations)}const Nt={pending:"rgb(var(--lt-status-queued-graphic))",claimed:"rgb(var(--lt-status-claimed-graphic))",resolved:"rgb(var(--lt-status-success-graphic))",cancelled:"rgb(var(--lt-status-error))"},Rt=5;function ce({pct:e,place:s,label:a,title:r,emphasis:n}){const i=t.jsx("span",{className:"w-px h-1.5 bg-text-quaternary","aria-hidden":!0}),d=t.jsx("span",{className:`whitespace-nowrap leading-none tabular-nums ${n?"text-text-secondary":"text-text-tertiary"}`,children:a});return t.jsx("div",{title:r,className:`absolute ${s==="above"?"bottom-0":"top-0"} flex flex-col items-center gap-0 -translate-x-1/2 cursor-help`,style:{left:`${e}%`},children:s==="above"?t.jsxs(t.Fragment,{children:[d,i]}):t.jsxs(t.Fragment,{children:[i,d]})})}function Ls({esc:e,className:s=""}){const a=new Date(e.created_at).getTime(),r=e.claimed_at?new Date(e.claimed_at).getTime():null,n=e.status==="resolved",i=e.status==="cancelled"||e.status==="expired",d=n||i,l=we(e),c=!!r&&(l||d),u=n&&e.resolved_at?new Date(e.resolved_at).getTime():i?new Date(e.updated_at).getTime():Date.now(),o=Math.max(u-a,1),x=c&&r?Math.max(r-a,0):o,p=c&&r?Math.max(u-r,0):0,h=Math.min(100,Math.max(0,x/o*100)),y=c?Math.max(0,100-h):0,g=n?Nt.resolved:i?Nt.cancelled:Nt.claimed,m=n?"Resolved after":i?"Cancelled after":"In progress",b=Tt(x),_=Tt(o),j=n?`Resolved in ${_} total`:i?`Cancelled after ${_}`:`Open ${_} so far`,k=`Lifecycle bar: blue = time waiting to be claimed, ${n?"green":i?"red":"orange"} = ${m.toLowerCase()} the claim.`;return t.jsxs("div",{className:s,title:k,children:[t.jsx("div",{className:"relative h-3 text-2xs font-mono",children:c&&t.jsx(ce,{pct:h,place:"above",label:b,title:`Time to claim: ${b}`})}),t.jsxs("div",{className:"flex w-full rounded-full overflow-hidden",style:{height:Rt,backgroundColor:"rgb(var(--lt-surface-sunken))"},title:k,children:[t.jsx("div",{style:{width:`${h}%`,minWidth:Rt,backgroundColor:Nt.pending,opacity:.75},title:`Waiting ${b} — created → claimed`}),c&&y>0&&t.jsx("div",{style:{width:`${y}%`,minWidth:Rt,backgroundColor:g,opacity:.75},title:`${m} ${Tt(p)}`})]}),t.jsx("div",{className:"relative h-3 text-2xs font-mono",children:t.jsx(ce,{pct:100,place:"below",emphasis:!0,label:_,title:j})})]})}function Ps({triage:e,payload:s}){const a=e.confidence??0,r=a>=.8?"text-status-success":a>=.5?"text-status-pending":"text-status-error",n=Ws(e.originalData,s);return t.jsxs("div",{className:"space-y-5",children:[e.diagnosis&&t.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:e.diagnosis}),t.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-text-tertiary",children:[e.tool_calls_made!=null&&t.jsxs("span",{children:[e.tool_calls_made," tool call",e.tool_calls_made!==1?"s":""]}),e.tool_calls_made!=null&&t.jsx("span",{className:"text-text-quaternary",children:"·"}),t.jsxs("span",{className:`font-medium ${r}`,children:[Math.round(a*100),"% confidence"]})]}),e.actions_taken&&e.actions_taken.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.actions_taken.map((i,d)=>t.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 text-2xs
|
|
2
|
-
text-text-secondary`,children:[t.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:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),i]},d))}),e.recommendation&&t.jsx("p",{className:"text-2xs text-text-tertiary italic",children:e.recommendation}),n.length>0&&t.jsx("div",{className:"space-y-4 pt-2",children:n.map(i=>t.jsx(Fs,{diff:i},i.key))})]})}function Ws(e,s){if(!e)return[];const a=[];for(const r of Object.keys(e)){if(r.startsWith("_"))continue;const n=e[r],i=s[r];i!==void 0&&JSON.stringify(n)!==JSON.stringify(i)&&a.push({key:r,label:r.replace(/[_-]/g," "),original:n,corrected:i})}return a}function Fs({diff:e}){const s=de(e.original),a=de(e.corrected);return s!==null&&a!==null?t.jsx("div",{className:"@container",children:t.jsxs("div",{className:"grid grid-cols-1 @form-cols:grid-cols-2 gap-x-8 gap-y-3",children:[t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[e.label," ",t.jsx("span",{className:"normal-case font-normal",children:"(original)"})]}),t.jsx("p",{className:"text-sm text-text-tertiary leading-relaxed line-through decoration-text-tertiary/30",children:s})]}),t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[e.label," ",t.jsx("span",{className:"normal-case font-normal text-status-success",children:"(corrected)"})]}),t.jsx("p",{className:"text-sm text-text-primary leading-relaxed",children:a})]})]})}):t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[e.label," ",t.jsx("span",{className:"normal-case font-normal",children:"(original)"})]}),t.jsx("pre",{className:"text-xs text-text-tertiary font-mono whitespace-pre-wrap leading-relaxed",children:typeof e.original=="object"?JSON.stringify(e.original,null,2):String(e.original)})]}),t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1",children:[e.label," ",t.jsx("span",{className:"normal-case font-normal text-status-success",children:"(corrected)"})]}),t.jsx("pre",{className:"text-xs text-text-primary font-mono whitespace-pre-wrap leading-relaxed",children:typeof e.corrected=="object"?JSON.stringify(e.corrected,null,2):String(e.corrected)})]})]})}function de(e){return e==null?"null":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):null}function X(e,s){const a=s==null?void 0:s.title;if(typeof a=="string"&&a.trim().length>0)return a.trim();const r=e.split(/[_-]+/).filter(Boolean);return r.length<=1?e:r.map(n=>Ss(n)?n:n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function Ss(e){return e.length>1&&e===e.toUpperCase()&&/[A-Z]/.test(e)}const Y={HELP:"help",DETAILS:"details",TRIAGE:"triage",METADATA:"metadata",CONTEXT:"context",RECORD:"record",ERRORS:"errors"},$e="lt:escalation:panel:view";function qs(e){try{const s=localStorage.getItem($e);if(s&&e.includes(s))return s}catch{}return Y.HELP}const Vs=new Set(["form_schema"]);function Js({metadata:e,role:s}){const a=Object.entries(e??{}).filter(([r])=>!r.startsWith("_")&&!Vs.has(r));return a.length===0?t.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No metadata on this escalation."}):t.jsx("dl",{className:"space-y-3.5",children:a.map(([r,n])=>{const i=typeof n=="object"&&n!==null?JSON.stringify(n):String(n),d=ae(r,n,s),l=ae(r,n);return t.jsxs("div",{className:"group relative",children:[t.jsx("dt",{className:"text-2xs font-medium text-text-secondary uppercase tracking-wide",children:X(r)}),t.jsxs("dd",{className:"mt-0.5 flex items-center gap-1",children:[t.jsx("span",{className:"text-xs text-text-primary font-mono break-all flex-1",children:i}),t.jsx(it,{to:d,title:`Filter this queue: ${r} = ${i}`,className:"opacity-50 group-hover:opacity-100 transition-opacity shrink-0 p-0.5 text-text-quaternary hover:text-accent",children:t.jsx(ks,{className:"w-3 h-3"})}),t.jsx(it,{to:l,title:`Search all queues: ${r} = ${i}`,className:"opacity-50 group-hover:opacity-100 transition-opacity shrink-0 p-0.5 text-text-quaternary hover:text-accent",children:t.jsx(Cs,{className:"w-3 h-3"})})]})]},r)})})}function Hs({esc:e,claimed:s,isTerminal:a,isBuilder:r,traceUrl:n}){return t.jsxs("div",{className:"space-y-5",children:[t.jsxs("dl",{className:"space-y-3.5",children:[t.jsx(tt,{label:"Status",children:t.jsx(Ce,{status:e.status})}),t.jsx(tt,{label:"Assigned to Role",children:t.jsx(gs,{role:e.role,size:"md"})}),t.jsxs(tt,{label:"Priority",children:["P",e.priority]}),(s||a)&&e.assigned_to&&t.jsx(tt,{label:"Claimed By",children:t.jsxs("span",{className:"inline-flex items-center gap-1.5 font-medium text-text-primary",children:[t.jsx(ws,{className:"w-3 h-3 shrink-0 text-accent/75"}),t.jsx(_e,{userId:e.assigned_to})]})}),t.jsx(tt,{label:"Created",children:t.jsx($t,{date:e.created_at})}),(s||a)&&e.claimed_at&&t.jsx(tt,{label:"Claimed",children:t.jsx($t,{date:e.claimed_at})}),s&&!a&&e.assigned_until&&t.jsx(tt,{label:"Time Remaining",children:t.jsx(Jt,{until:e.assigned_until})}),e.resolved_at&&t.jsx(tt,{label:"Completed",children:t.jsx("span",{className:"text-status-success",children:t.jsx($t,{date:e.resolved_at})})})]}),r&&t.jsxs(t.Fragment,{children:[t.jsx("hr",{className:"border-surface-border/60"}),t.jsxs("div",{className:"space-y-3.5",children:[t.jsx(rt,{label:"Escalation ID",value:e.id}),e.task_id&&t.jsx(rt,{label:"Task ID",value:e.task_id,href:`/workflows/tasks/detail/${e.task_id}`}),e.workflow_type&&t.jsx(rt,{label:"Workflow Name",value:e.workflow_type,href:`/workflows/executions?entity=${encodeURIComponent(e.workflow_type)}`}),e.workflow_id&&t.jsx(rt,{label:"Workflow ID",value:e.workflow_id,href:`/workflows/executions/${e.workflow_id}`}),e.task_queue&&t.jsx(rt,{label:"Task Queue",value:e.task_queue,href:`/admin/controlplane?queue=${encodeURIComponent(e.task_queue)}`}),e.origin_id&&e.origin_id!==e.workflow_id&&t.jsx(rt,{label:"Origin",value:e.origin_id,href:`/processes/detail/${e.origin_id}`}),e.trace_id&&t.jsx(rt,{label:"Trace",value:e.trace_id,href:n?n.replace("{traceId}",e.trace_id):void 0,external:!0})]})]})]})}function Us({errors:e,schema:s}){const a=r=>{const n=document.querySelector(`[data-field-key="${r}"]`);n&&(n.scrollIntoView({behavior:"smooth",block:"center"}),n.focus({preventScroll:!0}))};return e.length===0?t.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No errors to display."}):t.jsxs("div",{className:"space-y-1",role:"alert","aria-live":"polite",children:[t.jsxs("p",{className:"text-2xs font-semibold uppercase tracking-wider text-status-error mb-4",children:[e.length," ",e.length===1?"issue":"issues"," to resolve"]}),t.jsx("div",{className:"space-y-1.5",children:e.map(({field:r,message:n})=>{var i;return t.jsxs("button",{onClick:()=>a(r),className:"w-full text-left flex items-start gap-3 px-3 py-2.5 rounded hover:bg-status-error/5 transition-colors group",children:[t.jsx(Ae,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-status-error/60 group-hover:text-status-error transition-colors"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-2xs font-semibold text-text-primary leading-snug",children:X(r,(i=s==null?void 0:s.properties)==null?void 0:i[r])}),t.jsx("p",{className:"text-2xs text-text-tertiary group-hover:text-text-secondary transition-colors leading-snug mt-0.5",children:n})]})]},r)})}),t.jsx("p",{className:"text-2xs text-text-quaternary mt-4 px-3",children:"Click an issue to scroll to and focus the field."})]})}function zs({esc:e,schema:s,envelope:a,payload:r,resolver:n,triage:i,hasAI:d,claimed:l,claimedByMe:c,isTerminal:u,isBuilder:o,traceUrl:x,open:p,noGutter:h,formErrors:y,activePanel:g,onPanelChange:m}){const b=Te(),_=Object.values(Y),[j,k]=f.useState(()=>qs(_)),T=g??j,M=f.useCallback(E=>{try{localStorage.setItem($e,E)}catch{}k(E),m==null||m(E)},[m]);f.useEffect(()=>{g&&g!==j&&k(g)},[g]);const I=f.useMemo(()=>xs(s,{escalation:e,metadata:e.metadata??null,envelope:a,payload:r,resolver:n})??us({isTerminal:u,status:e.status,claimed:l,claimedByMe:c}),[s,e,a,r,n,u,l,c]),C=f.useCallback(E=>{const D=E.target.closest("a"),P=D==null?void 0:D.getAttribute("href");P!=null&&P.startsWith("/")&&(E.preventDefault(),b(P))},[b]),O=[{id:Y.HELP,icon:Ee,label:"Instructions",content:t.jsx(Pt,{content:I,onClick:C})},{id:Y.DETAILS,icon:js,label:"Details",content:t.jsx(Hs,{esc:e,claimed:l,isTerminal:u,isBuilder:o,traceUrl:x})},...d&&i?[{id:Y.TRIAGE,icon:bs,label:"AI Analysis",content:t.jsx(Ps,{triage:i,payload:r??{}})}]:[],{id:Y.METADATA,icon:ys,label:"Metadata",content:t.jsx(Js,{metadata:e.metadata,role:e.role})},{id:Y.CONTEXT,icon:Ns,label:"Context",content:t.jsxs("div",{className:"space-y-5",children:[a!=null&&t.jsx(gt,{data:a,label:"Input Envelope"}),r!=null&&t.jsx(gt,{data:r,label:"Escalation Context"}),n!=null&&t.jsx(gt,{data:n,label:"Resolver Payload"}),a==null&&r==null&&n==null&&t.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No context on this escalation."})]})},...o?[{id:Y.RECORD,icon:vs,label:"Record",content:t.jsx(gt,{data:e,label:"Escalation Record"})}]:[],...y&&y.length>0?[{id:Y.ERRORS,icon:(({className:E})=>t.jsx(Ae,{className:`${E??""} text-status-error`})),label:"Errors",content:t.jsx(Us,{errors:y,schema:s})}]:[]];return t.jsx(Ze,{open:p,width:384,className:"h-full",children:t.jsx("div",{className:`h-full${h?"":" pl-6"}`,children:t.jsxs("div",{className:"h-full flex flex-col bg-surface-hover",children:[t.jsx("div",{className:"shrink-0 pt-1.5 pb-0.5 flex justify-center",children:t.jsx(Ls,{esc:e,className:"w-[80%]"})}),t.jsx("div",{className:"flex-1 min-h-0",children:t.jsx(Ke,{views:O,activeId:T,onViewChange:M,stickyClassName:"h-full min-h-0"})})]})})})}function Ys(e,s){if(typeof e!="string"||!s)return[];const a=e.indexOf(".");if(a===-1)return[];const r=s[e.slice(0,a)];if(!r||typeof r!="object")return[];let n=r;for(const i of e.slice(a+1).split("."))if(n=n[i],n===void 0)return[];return Array.isArray(n)?n:[]}function Bs(e,s,a){if((s==null?void 0:s["x-lt-widget"])!=="checklist"||s["x-lt-require-all"]!==!0)return;const n=Ys(s["x-lt-source"],a).filter(l=>l.required!==!1);if(n.length===0)return;const i=typeof e=="object"&&e!==null&&!Array.isArray(e)?e:{},d=n.filter(l=>!i[l.id]).length;if(d!==0)return`${d} of ${n.length} checks incomplete`}function Gs(e,s){const a=s==null?void 0:s.type;if(typeof a=="string"&&!(e==null||e===""))switch(a){case"string":return typeof e=="string"?void 0:"Expected text";case"number":return typeof e=="number"&&Number.isFinite(e)?void 0:"Expected a number";case"integer":return typeof e=="number"&&Number.isInteger(e)?void 0:"Expected a whole number";case"boolean":return typeof e=="boolean"?void 0:"Expected true or false";case"array":return Array.isArray(e)?void 0:"Expected a list";case"object":return typeof e=="object"&&!Array.isArray(e)?void 0:"Expected an object";default:return}}function Xs(e,s,a){if(!s)return;const r=s.enum;if(Array.isArray(r)&&r.length>0&&e!==void 0&&e!==null&&e!==""&&!r.includes(e))return`Must be one of: ${r.map(n=>String(n)).join(", ")}`;if(typeof e=="string"){const n=e.trim();if(n==="")return;const i=ut(s.minLength,s["x-lt-min-length"],a);if(i!==void 0&&n.length<i)return`Minimum ${i} character${i===1?"":"s"}`;const d=ut(s.maxLength,s["x-lt-max-length"],a);if(d!==void 0&&n.length>d)return`Maximum ${d} characters (${n.length} entered)`;const l=s.pattern;if(l)try{if(!new RegExp(l).test(n))return s["x-lt-pattern-error"]??"Invalid format"}catch{}const c=s.format;if(c==="email"&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n))return"Enter a valid email address";if(c==="uri"&&!/^https?:\/\/.+/.test(n))return"Enter a valid URL"}if(typeof e=="number"){const n=ut(s.minimum,s["x-lt-minimum"],a),i=ut(s.exclusiveMinimum,void 0,a),d=ut(s.maximum,s["x-lt-maximum"],a),l=ut(s.exclusiveMaximum,void 0,a);if(n!==void 0&&e<n)return`Minimum value is ${n}`;if(i!==void 0&&e<=i)return`Must be greater than ${i}`;if(d!==void 0&&e>d)return`Maximum value is ${d}`;if(l!==void 0&&e>=l)return`Must be less than ${l}`}}function ut(e,s,a){if(typeof e=="number")return e;if(typeof s=="string"&&a){const r=s.indexOf(".");if(r!==-1){const n=s.slice(0,r),i=s.slice(r+1),d=a[n];if(d&&typeof d=="object"){const l=i.split(".");let c=d;for(const u of l)if(c=c[u],c===void 0)break;if(typeof c=="number")return c;if(typeof c=="string"){const u=Number(c);if(!Number.isNaN(u))return u}}}}}function Re(e,s,a,r,n){if(!r)return;if(a){if(e==null||typeof e=="boolean"&&!e||typeof e=="string"&&e.trim()==="")return"Required";if(typeof e=="object"&&!Array.isArray(e)&&e!==null){const l=Object.values(e);if(l.length===0||l.every(c=>!c))return"Required"}}const i=Gs(e,s);if(i)return i;const d=Bs(e,s,n);return d||Xs(e,s,n)}function xe(e){return e!=null&&e!==""&&e!==!1&&e!==0}function Qs(e){return e==null?"":typeof e=="object"?JSON.stringify(e):String(e)}function ue(e,s){const a=e.indexOf("."),r=a===-1?e:e.slice(0,a);if(!ps.includes(r))return{known:!1,value:void 0};const n=s[r];if(a===-1)return{known:!0,value:n};try{return{known:!0,value:Ht(n,e.slice(a+1))}}catch{return{known:!0,value:void 0}}}function Oe(e,s){if(typeof e!="string"||e.length===0||!s)return!0;const a=e.startsWith("!"),r=a?e.slice(1):e,n=r.indexOf("!="),i=r.indexOf("=");if(n!==-1||i!==-1&&i!==n+1){const c=n!==-1&&(i===-1||n<i),u=c?n:i,o=r.slice(0,u).trim(),x=r.slice(u+(c?2:1)).trim(),{known:p,value:h}=ue(o,s);if(!p)return!0;const y=Qs(h)===x,g=c?!y:y;return a?!g:g}const{known:d,value:l}=ue(r,s);return d?a?!xe(l):xe(l):!0}function De(e,s,a){if(!e)return[];const r=e.properties??{},n=new Set(e.required??[]),i={...a??{},resolver:s},d=[];for(const[l,c]of Object.entries(r)){if(!Oe(c["x-lt-showIf"],i))continue;const u=Re(s[l],c,n.has(l),!0,i);u&&d.push({field:l,message:u})}return d}function Zs(e,s){if(!e)return{};const a={};for(const[r,n]of Object.entries(e))a[r]=typeof n=="string"?ot(n,s):n;return a}function Ie(e,s,a){const r=Zs(e.facets,s),n={role:e.role,status:e.status??"pending",facets:r,limit:e.limit,enabled:!!(e.role||Object.keys(r).length)};return e.assigned==="me"?{...n,assigned_to:a,available:!1,enabled:n.enabled&&!!a}:e.assigned==="any"?n:{...n,available:e.available??!0}}const Ks="{{count}} related items are still pending";function tn(e,s){const{user:a}=qt(),r=Ie((e==null?void 0:e.query)??{},s??{},a==null?void 0:a.userId),{data:n}=je({role:r.role,status:r.status,facets:r.facets,assigned_to:r.assigned_to,available:r.available,limit:1,enabled:!!e&&r.enabled}),i=(n==null?void 0:n.total)??0,d=!!e&&e.mustBeEmpty!==!1&&i>0,l=(e==null?void 0:e.message)??Ks,c=d?ot(l.replace(/\{\{count\}\}/g,String(i)),s??{}):"";return{blocked:d,count:i,message:c}}function en(e){const{mode:s,activeView:a,onActiveViewChange:r,onClaim:n,claimPending:i,claimNudge:d,workflowType:l,json:c,onResolve:u,resolvePending:o,resolveError:x,requestTriage:p,triageNotes:h,currentRole:y,escalationTargets:g,onEscalate:m,escalatePending:b,escalateError:_,onRelease:j,releasePending:k,onCancel:T,assignedTo:M,assignedUntil:I,onSubmitAttempt:C,onValidationErrors:O,escalationContext:E}=e,D=Ne(),[P,S]=f.useState("30"),[L,J]=f.useState(0),[Q,q]=f.useState(""),[v,$]=f.useState(""),N=P==="custom",R=f.useCallback(A=>J(A),[]),F=f.useMemo(()=>{var A;try{const z=(A=JSON.parse(c))==null?void 0:A._form_schema;return z==null?void 0:z["x-lt-submit-guard"]}catch{return}},[c]),st=tn(F,E),lt=st.blocked&&!p;if(s==="terminal")return null;const Z=()=>{const A=N?L:parseInt(P);!A||A<=0||n(A)},B=()=>{if(q(""),p){const U={_lt:{needsTriage:!0}};h.trim()&&(U.notes=h.trim()),u(U);return}let A;try{A=JSON.parse(c)}catch{q("Invalid JSON");return}const z=A._form_schema;if(z){const U=De(z,A,E);if(U.length>0){C==null||C(),O==null||O(U);return}}const{_form_schema:Yt,...pt}=A;u(ms(pt,z))},V=A=>`text-xs transition-colors ${A?"text-accent font-medium":"text-text-tertiary hover:text-accent"}`;return t.jsxs("div",{className:"shrink-0 h-[80px] bg-surface/95 backdrop-blur-sm border-t border-surface-border -ml-10 pl-10 pr-10 pt-3 pb-5","data-testid":"escalation-action-bar",children:[s==="available"&&t.jsxs("div",{"data-testid":"claim-bar",children:[t.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[D.map(A=>t.jsx("button",{onClick:()=>{S(A.value),J(0)},className:V(!N&&P===A.value),children:A.label},A.value)),t.jsx("button",{onClick:()=>S("custom"),className:V(N),children:"Other"})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("button",{onClick:T,className:"text-xs text-text-tertiary hover:text-status-error transition-colors",children:"Cancel escalation"}),t.jsx("div",{className:"flex-1"}),N&&t.jsx(ve,{onChange:R,compact:!0,autoFocus:!0}),t.jsx("button",{onClick:Z,disabled:i||N&&L<=0,className:`btn-primary text-xs ${d?"animate-[field-shake_0.4s_ease-in-out]":""}`,"data-testid":"claim-button",children:i?"Claiming...":"Claim"},d)]})]}),s==="claimed_by_other"&&t.jsxs("div",{className:"flex items-center gap-4","data-testid":"claimed-other-bar",children:[t.jsxs("p",{className:"text-sm text-text-secondary",children:["Claimed by ",t.jsx("span",{className:"font-medium text-text-primary",children:M?t.jsx(_e,{userId:M}):"unknown"})]}),I&&t.jsx(Jt,{until:I})]}),s==="claimed_by_me"&&t.jsxs("div",{"data-testid":"action-bar",children:[t.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[t.jsx("button",{onClick:()=>r("resolve"),className:V(a==="resolve"),children:l?"Resolve":"Acknowledge"}),g.length>0&&t.jsx("button",{onClick:()=>r("escalate"),className:V(a==="escalate"),children:"Escalate"}),t.jsx("button",{onClick:()=>r("release"),className:`text-xs transition-colors ${a==="release"?"text-status-error font-medium":"text-text-tertiary hover:text-status-error"}`,children:"Release"}),t.jsx("button",{onClick:T,className:"text-xs transition-colors text-text-tertiary hover:text-status-error",children:"Cancel"})]}),a==="resolve"&&t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx("div",{className:"flex-1"}),Q&&t.jsx("span",{className:"text-xs text-status-error",children:Q}),x&&t.jsx("span",{className:"text-xs text-status-error",children:x.message}),lt&&t.jsx("span",{className:"text-xs text-status-pending","data-testid":"submit-guard-message",children:st.message}),t.jsx("button",{onClick:B,disabled:o||lt,className:"btn-primary text-xs",children:o?l?"Submitting...":"Acknowledging...":p?"Send to Triage":l?"Submit":"Acknowledge"})]}),a==="escalate"&&t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs("span",{className:"text-xs text-text-secondary",children:["From ",t.jsx("span",{className:"font-medium text-text-primary",children:y})," to"]}),t.jsxs("select",{value:v,onChange:A=>$(A.target.value),className:"select text-xs","data-testid":"escalate-select",children:[t.jsx("option",{value:"",children:"Select role..."}),g.map(A=>t.jsx("option",{value:A,children:A},A))]}),t.jsx("div",{className:"flex-1"}),_&&t.jsx("span",{className:"text-xs text-status-error",children:_.message}),t.jsx("button",{onClick:()=>m(v),disabled:!v||b,className:"btn-primary text-xs",children:b?"Escalating...":"Escalate"})]}),a==="release"&&t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"text-xs text-text-secondary",children:"Release back to pool?"}),t.jsx("div",{className:"flex-1"}),t.jsx("button",{onClick:()=>r("resolve"),className:"btn-secondary text-xs",children:"Back"}),t.jsx("button",{onClick:j,disabled:k,className:"btn-primary text-xs bg-status-error hover:bg-status-error/80",children:k?"Releasing...":"Yes, Release"})]})]})]})}function et(e){return e.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 Ot({content:e,compact:s}){const a=[],r=/^```(\w*)\n([\s\S]*?)^```$/gm;let n=0,i;for(;(i=r.exec(e))!==null;)i.index>n&&a.push({type:"text",text:e.slice(n,i.index)}),a.push({type:"code",lang:i[1],code:i[2].replace(/\n$/,"")}),n=i.index+i[0].length;n<e.length&&a.push({type:"text",text:e.slice(n)});const d=s?{text:"text-xs",heading:"text-xs",list:"text-xs",code:"text-2xs"}:{text:"text-sm",heading:"text-sm",list:"text-sm",code:"text-xs"},l=[];for(const c of a){if(c.type==="code"){const u=c.code.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");l.push(`<pre class="my-2 p-2.5 bg-surface-sunken rounded-md overflow-x-auto"><code class="${d.code} font-mono text-text-secondary leading-relaxed">${u}</code></pre>`);continue}l.push(...sn(c.text,d))}return t.jsx("div",{className:"prose-sm",dangerouslySetInnerHTML:{__html:l.join(`
|
|
3
|
-
`)}})}function sn(e,s){const a=e.split(`
|
|
4
|
-
`),r=[];let n=!1,i=!1,d=[];for(const l of a){const c=l.trim();if(c.startsWith("|")&&c.endsWith("|")){const u=c.slice(1,-1).split("|").map(o=>o.trim());if(u.every(o=>/^[-:]+$/.test(o)))continue;i||(i=!0,d=[]),d.push(u);continue}if(i){i=!1;const[u,...o]=d;r.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const x of u)r.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${et(x)}</th>`);r.push("</tr></thead><tbody>");for(const x of o){r.push("<tr>");for(const p of x)r.push(`<td class="py-1 px-2 border-b border-border/50">${et(p)}</td>`);r.push("</tr>")}r.push("</tbody></table></div>"),d=[]}if(!c){n&&(r.push("</ul>"),n=!1);continue}if(c.startsWith("### ")){n&&(r.push("</ul>"),n=!1),r.push(`<h4 class="${s.heading} font-semibold text-text-primary mt-3 mb-1">${et(c.slice(4))}</h4>`);continue}if(c.startsWith("## ")){n&&(r.push("</ul>"),n=!1),r.push(`<h3 class="${s.heading} font-semibold text-text-primary mt-3 mb-1">${et(c.slice(3))}</h3>`);continue}if(/^[-*_]{3,}$/.test(c)){n&&(r.push("</ul>"),n=!1),r.push('<hr class="border-border my-3" />');continue}if(/^[-*] /.test(c)){n||(r.push('<ul class="space-y-1 my-1">'),n=!0),r.push(`<li class="${s.list} text-text-secondary flex gap-2"><span class="text-text-tertiary shrink-0">-</span><span>${et(c.slice(2))}</span></li>`);continue}n&&(r.push("</ul>"),n=!1),r.push(`<p class="${s.text} text-text-secondary my-1">${et(c)}</p>`)}if(i&&d.length){const[l,...c]=d;r.push('<div class="overflow-x-auto my-2"><table class="text-xs w-full"><thead><tr>');for(const u of l)r.push(`<th class="text-left py-1 px-2 border-b border-border text-text-secondary font-medium">${et(u)}</th>`);r.push("</tr></thead><tbody>");for(const u of c){r.push("<tr>");for(const o of u)r.push(`<td class="py-1 px-2 border-b border-border/50">${et(o)}</td>`);r.push("</tr>")}r.push("</tbody></table></div>")}return n&&r.push("</ul>"),r}function Dt({children:e}){return t.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-1.5",children:e})}function nn({payload:e,isTerminal:s,resolverPayload:a,onRetryTriage:r,isRetrying:n}){const i=e.title,d=e.summary,l=e.diagnosis,c=e.tool_calls_made,u=e.result,o=a==null?void 0:a._lt,x=(o==null?void 0:o.triaged)===!0,p=o==null?void 0:o.triageWorkflowId,h=s&&x,[y,g]=f.useState(!1);return h?t.jsxs("div",{className:"rounded-md border border-status-success/30 bg-surface-raised",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("svg",{className:"w-4 h-4 text-status-success shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:t.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"})}),t.jsx("span",{className:"text-xs font-medium text-status-success",children:"Resolved by AI Triage"})]}),typeof c=="number"&&t.jsxs("span",{className:"text-2xs font-mono px-2 py-0.5 rounded-full bg-status-success/10 text-status-success",children:[c," tool calls used"]})]}),t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[i&&t.jsx("p",{className:"text-sm font-medium text-text-primary",children:i}),l&&t.jsxs("div",{children:[t.jsx(Dt,{children:"Triage diagnosis"}),t.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:t.jsx(Ot,{content:l})})]}),t.jsx("div",{className:"flex items-center gap-3",children:p&&t.jsx(it,{to:`/workflows/executions/${p}`,className:"text-2xs text-accent hover:underline",children:"View triage execution"})})]})]}):t.jsxs("div",{className:"rounded-md border border-status-warning/30 bg-surface-raised",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-surface-border",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("svg",{className:"w-4 h-4 text-status-warning shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:t.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"})}),t.jsx("span",{className:"text-xs font-medium text-status-warning",children:"Tool Rounds Exhausted"})]}),typeof c=="number"&&t.jsxs("span",{className:"text-2xs font-mono px-2 py-0.5 rounded-full bg-status-warning/10 text-status-warning",children:[c," tool calls used"]})]}),t.jsxs("div",{className:"px-4 py-4 space-y-4",children:[i&&t.jsx("p",{className:"text-sm font-medium text-text-primary",children:i}),d&&t.jsxs("div",{children:[t.jsx(Dt,{children:"What happened"}),t.jsx("div",{className:"text-xs text-text-secondary leading-relaxed",children:t.jsx(Ot,{content:d})})]}),l&&t.jsxs("div",{children:[t.jsx(Dt,{children:"What went wrong"}),t.jsx("div",{className:"text-xs text-text-primary leading-relaxed",children:t.jsx(Ot,{content:l})})]}),u!=null&&t.jsxs("div",{children:[t.jsxs("button",{onClick:()=>g(!y),className:"flex items-center gap-1 text-2xs font-semibold uppercase tracking-widest text-text-tertiary hover:text-text-secondary transition-colors",children:[t.jsx("svg",{className:`w-3 h-3 transition-transform ${y?"rotate-90":""}`,viewBox:"0 0 12 12",fill:"currentColor",children:t.jsx("path",{d:"M4.5 2l4 4-4 4"})}),"Partial results"]}),y&&t.jsx("div",{className:"mt-2",children:t.jsx(gt,{data:u,defaultMode:"tree"})})]}),r&&!s&&t.jsx("div",{className:"pt-2",children:t.jsxs("button",{onClick:r,disabled:n,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:[t.jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 14 14",fill:"currentColor",children:t.jsx("path",{d:"M7 1a6 6 0 100 12A6 6 0 007 1zm2.5 6.5l-3.5 2V5.5l3.5 2z"})}),n?"Sending to triage...":"Retry with AI Triage"]})})]})]})}function pe(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function Me({src:e,escalation:s,schema:a,onResolve:r,onEscalate:n,submitAttempted:i,fill:d}){const l=f.useRef(null),c=f.useRef("");f.useEffect(()=>{try{const o=new URL(e);c.current=o.origin}catch{c.current=""}},[e]);const u=f.useCallback(()=>{const o=l.current;if(!(o!=null&&o.contentWindow)||!c.current)return;const p={type:"lt:init",escalation:{id:s.id,type:s.type,subtype:s.subtype,description:s.description,status:s.status,priority:s.priority,role:s.role,workflow_type:s.workflow_type,envelope:pe(s.envelope),metadata:s.metadata??null,escalation_payload:pe(s.escalation_payload)},schema:a};o.contentWindow.postMessage(p,c.current)},[s,a]);return f.useEffect(()=>{const o=x=>{if(x.origin!==c.current)return;const p=x.data;if(!(!p||typeof p!="object"||typeof p.type!="string"))switch(p.type){case"lt:ready":u();break;case"lt:submit":p.payload&&typeof p.payload=="object"&&r(p.payload);break;case"lt:escalate":typeof p.target=="string"&&p.target&&n(p.target);break;case"lt:resize":{const h=l.current;h&&typeof p.height=="number"&&p.height>0&&(h.style.height=`${Math.min(p.height,2e3)}px`);break}}};return window.addEventListener("message",o),()=>window.removeEventListener("message",o)},[u,r,n]),f.useEffect(()=>{if(!i)return;const o=l.current;o!=null&&o.contentWindow&&c.current&&o.contentWindow.postMessage({type:"lt:validate"},c.current)},[i]),d?t.jsx("div",{className:"absolute inset-0 overflow-hidden",children:t.jsx("iframe",{ref:l,src:e,sandbox:"allow-scripts allow-same-origin allow-forms allow-pointer-lock allow-downloads",className:"w-full h-full border-0 block",title:"HITL Viewport",onLoad:u})}):t.jsx("div",{className:"rounded-md border border-surface-border overflow-hidden bg-white",children:t.jsx("iframe",{ref:l,src:e,sandbox:"allow-scripts allow-same-origin allow-forms allow-pointer-lock allow-downloads",className:"w-full border-0",style:{minHeight:"600px"},title:"HITL Viewport",onLoad:u})})}function W({children:e,isRequired:s,htmlFor:a}){return t.jsxs("label",{htmlFor:a,className:"block text-2xs font-semibold uppercase tracking-wider text-text-secondary",children:[e,s&&t.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]})}function G({id:e,children:s}){return t.jsx("p",{id:e,className:"text-2xs text-text-tertiary mt-0.5 leading-snug",children:s})}function at({error:e,id:s}){return e?t.jsx("p",{id:s,role:"alert",className:"text-2xs text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:e}):null}function ft(e){return e?"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 rn(e){return e?"select text-sm mt-1 min-w-[min(16rem,100%)] max-w-full border-status-error/50 focus:border-status-error animate-[field-shake_0.4s_ease-in-out]":"select text-sm mt-1 min-w-[min(16rem,100%)] max-w-full"}function an({fieldKey:e,value:s,onChange:a,schema:r,isRequired:n}){const i=f.useRef(null),d=(r==null?void 0:r.accept)??void 0,l=X(e,r),c=r==null?void 0:r.description,u=f.useCallback(x=>{var y;const p=(y=x.target.files)==null?void 0:y[0];if(!p)return;const h=new FileReader;h.onload=()=>{typeof h.result=="string"&&a(h.result)},h.readAsDataURL(p)},[a]),o=s.startsWith("data:");return t.jsxs("div",{children:[t.jsx(W,{isRequired:n,children:l}),c&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:c}),t.jsxs("div",{className:"mt-1",children:[t.jsx("input",{ref:i,type:"file",accept:d,onChange:u,className:"hidden"}),t.jsx("button",{type:"button",onClick:()=>{var x;return(x=i.current)==null?void 0:x.click()},className:"btn-secondary text-xs px-3 py-1.5",children:o?"Replace file":"Choose file"}),o&&t.jsx("span",{className:"ml-2 text-xs text-status-success",children:"File attached"})]})]})}function on({fieldKey:e,value:s,onChange:a,schema:r,isRequired:n}){const i=X(e,r),d=r==null?void 0:r.description,l=(r==null?void 0:r["x-lt-language"])??"",c=f.useCallback(u=>{if(u.key==="Tab"){u.preventDefault();const o=u.currentTarget,x=o.selectionStart,p=o.selectionEnd,h=s.substring(0,x)+" "+s.substring(p);a(h),requestAnimationFrame(()=>{o.selectionStart=o.selectionEnd=x+2})}},[s,a]);return t.jsxs("div",{children:[t.jsxs(W,{isRequired:n,children:[i,l&&t.jsx("span",{className:"ml-2 text-text-tertiary/60 normal-case font-normal",children:l})]}),d&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:d}),t.jsx("textarea",{value:s,onChange:u=>a(u.target.value),onKeyDown:c,className:"input w-full mt-1 font-mono text-xs leading-relaxed",rows:10,spellCheck:!1})]})}function ln({fieldKey:e,value:s,onChange:a,schema:r,isRequired:n}){const i=f.useRef(null),[d,l]=f.useState(!1),c=X(e,r),u=r==null?void 0:r.description;f.useEffect(()=>{const g=i.current;if(!g)return;const m=g.getContext("2d");if(m&&(m.lineWidth=2,m.lineCap="round",m.strokeStyle="#1E1535",s&&s.startsWith("data:"))){const b=new Image;b.onload=()=>m.drawImage(b,0,0),b.src=s}},[]);const o=f.useCallback(g=>{const m=i.current,b=m.getBoundingClientRect(),_=b.width>0?m.width/b.width:1,j=b.height>0?m.height/b.height:1;return"touches"in g?{x:(g.touches[0].clientX-b.left)*_,y:(g.touches[0].clientY-b.top)*j}:{x:(g.clientX-b.left)*_,y:(g.clientY-b.top)*j}},[]),x=f.useCallback(g=>{var _;l(!0);const m=(_=i.current)==null?void 0:_.getContext("2d");if(!m)return;const b=o(g);m.beginPath(),m.moveTo(b.x,b.y)},[o]),p=f.useCallback(g=>{var _;if(!d)return;const m=(_=i.current)==null?void 0:_.getContext("2d");if(!m)return;const b=o(g);m.lineTo(b.x,b.y),m.stroke()},[d,o]),h=f.useCallback(()=>{l(!1);const g=i.current;g&&a(g.toDataURL("image/png"))},[a]),y=f.useCallback(()=>{const g=i.current;if(!g)return;const m=g.getContext("2d");m&&(m.clearRect(0,0,g.width,g.height),a(""))},[a]);return t.jsxs("div",{children:[t.jsx(W,{isRequired:n,children:c}),u&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:u}),t.jsx("div",{className:"mt-1 max-w-[25rem] border border-surface-border rounded-md overflow-hidden bg-white",children:t.jsx("canvas",{ref:i,width:400,height:150,className:"w-full cursor-crosshair touch-none",onMouseDown:x,onMouseMove:p,onMouseUp:h,onMouseLeave:h,onTouchStart:x,onTouchMove:p,onTouchEnd:h})}),t.jsx("button",{type:"button",onClick:y,className:"mt-1 text-2xs text-text-tertiary hover:text-accent transition-colors",children:"Clear"})]})}function cn({fieldKey:e,value:s,onChange:a,schema:r,isRequired:n}){const i=X(e,r),d=r==null?void 0:r.description;return t.jsxs("div",{children:[t.jsx(W,{isRequired:n,children:i}),d&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:d}),t.jsx("textarea",{value:s,onChange:l=>a(l.target.value),className:"input w-full mt-1 text-sm leading-relaxed",rows:8,placeholder:"Supports plain text. Markdown formatting is preserved."})]})}function dn({fieldKey:e,value:s,onChange:a,schema:r,isRequired:n}){const[i,d]=f.useState("write"),l=X(e,r),c=r==null?void 0:r.description;return(r==null?void 0:r.readOnly)===!0?t.jsx(Pt,{content:s,className:"my-1"}):t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(W,{isRequired:n,children:l}),t.jsx("div",{className:"flex items-center gap-0.5",children:["write","preview"].map(o=>t.jsx("button",{type:"button",onClick:()=>d(o),className:`px-2 py-0.5 text-2xs rounded transition-colors ${i===o?"bg-accent/10 text-accent font-semibold":"text-text-quaternary hover:text-text-secondary"}`,children:o==="write"?"Write":"Preview"},o))})]}),c&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:c}),i==="write"?t.jsx("textarea",{value:s,onChange:o=>a(o.target.value),className:"input w-full mt-1 text-sm font-mono leading-relaxed",rows:10,placeholder:"Write markdown — headings, lists, tables, code blocks, and links all render."}):t.jsx("div",{className:"mt-1 px-3 py-2 border border-surface-border rounded min-h-[120px]",children:s.trim()?t.jsx(Pt,{content:s}):t.jsx("p",{className:"text-xs text-text-quaternary italic",children:"Nothing to preview."})})]})}const xn=28;function un({fieldKey:e,value:s,onChange:a,schema:r,escalationContext:n,isRequired:i,submitAttempted:d,error:l}){const c=r==null?void 0:r["x-lt-source"],u=(r==null?void 0:r["x-lt-require-all"])===!0,o=[];if(c&&n){const j=c.indexOf(".");if(j!==-1){const k=c.slice(0,j),T=c.slice(j+1);try{const M=Ht(n[k],T);Array.isArray(M)&&o.push(...M)}catch{}}}let x={};try{s&&(x=JSON.parse(s))}catch{}const p=j=>a(JSON.stringify({...x,[j]:!x[j]})),h=X(e,r),y=r==null?void 0:r.description;if(o.length===0)return t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-xs text-text-tertiary italic mt-1",children:"No checklist items. Provide checklist_items in the escalation envelope or metadata."}),l&&t.jsx("p",{className:"text-2xs text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:l})]});const g=r==null?void 0:r["x-lt-variant"],m=g==="chips"||g==="rows"?g:u||o.some(j=>j.label.length>xn)?"rows":"chips",b=o.filter(j=>x[j.id]).length,_=(o.find(j=>!x[j.id]&&j.required!==!1)??o[0]).id;return t.jsxs("div",{role:"group","aria-label":h,"aria-required":i||void 0,"aria-invalid":l?!0:void 0,children:[t.jsx(W,{isRequired:i,children:h}),y&&t.jsx(G,{children:y}),m==="chips"?t.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:o.map(j=>{const k=x[j.id]??!1,T=!k&&!!d&&b===0&&(j.required||i);return t.jsxs("label",{className:`inline-flex items-center gap-1.5 cursor-pointer select-none px-3.5 py-2 text-sm border transition-colors rounded-[var(--lt-radius-field)] ${k?"bg-accent border-accent text-text-inverse":T?"bg-surface-field border-status-error/60 text-status-error":"bg-surface-field border-surface-field-border text-text-secondary hover:border-accent hover:text-text-primary"}`,children:[t.jsx("input",{type:"checkbox",checked:k,onChange:()=>p(j.id),className:"sr-only","data-testid":`checklist-item-${j.id}`,...j.id===_?{"data-field-key":e}:{}}),k&&t.jsx(_s,{className:"w-3.5 h-3.5 shrink-0",strokeWidth:2.5}),j.label]},j.id)})}):t.jsx("div",{className:"space-y-2.5 mt-2",children:o.map(j=>{const k=x[j.id]??!1,T=!k&&!!d&&(u?j.required!==!1:b===0&&(j.required||i));return t.jsxs("label",{className:`flex items-start gap-3 cursor-pointer group select-none rounded px-2 py-1 -mx-2 transition-colors ${T?"bg-status-error/5":"hover:bg-surface-hover"}`,children:[t.jsx("input",{type:"checkbox",checked:k,onChange:()=>p(j.id),className:`mt-0.5 w-3.5 h-3.5 shrink-0 rounded ${T?"accent-status-error":"accent-accent"}`,"data-testid":`checklist-item-${j.id}`,...j.id===_?{"data-field-key":e}:{}}),t.jsxs("span",{className:`text-sm leading-snug transition-colors ${T?"text-status-error":"text-text-secondary group-hover:text-text-primary"}`,children:[j.label,j.required&&t.jsx("span",{className:`ml-0.5 text-2xs ${T?"text-status-error":"text-text-quaternary"}`,children:"*"})]})]},j.id)})}),t.jsx("p",{className:"text-2xs text-text-quaternary mt-3 tabular-nums",children:m==="chips"?t.jsxs(t.Fragment,{children:[b," selected",i&&b===0&&!!d&&t.jsx("span",{className:"ml-1 text-text-quaternary/60",children:"(check at least one)"})]}):t.jsxs(t.Fragment,{children:[b," / ",o.length," confirmed",u?t.jsxs("span",{className:"ml-1 text-text-quaternary/60",children:["(all required",o.some(j=>j.required===!1)?" except optional":"",")"]}):i&&b===0&&!!d&&t.jsx("span",{className:"ml-1 text-text-quaternary/60",children:"(at least one required)"})]})}),l&&t.jsx("p",{role:"alert",className:"text-2xs text-status-error mt-1 animate-[field-error-in_0.3s_ease-out]",children:l})]})}const pn=/\.(png|jpe?g|gif|webp|avif|bmp|svg)(\?.*)?$/i;function mn(e){var r,n,i,d;const s=e.trim();if(!s)return{kind:"none"};const a=(n=(r=/^data:([^;,]+)[;,]/.exec(s))==null?void 0:r[1])==null?void 0:n.toLowerCase();if(a)return a.startsWith("image/")?{kind:"image",src:s}:{kind:"file",href:s,label:a==="application/pdf"?"PDF":a,isData:!0};if(/^https?:\/\//i.test(s)){if(pn.test(s))return{kind:"image",src:s};const l=(d=(i=/\.([a-z0-9]{2,5})(\?.*)?$/i.exec(s))==null?void 0:i[1])==null?void 0:d.toUpperCase();return{kind:"file",href:s,label:l??"attachment",isData:!1}}return{kind:"none"}}function me({fieldKey:e,value:s,schema:a}){const[r,n]=f.useState(!1),i=mn(s??""),d=e.replace(/[_-]/g," "),l=a==null?void 0:a.description,c=t.jsxs(t.Fragment,{children:[t.jsx("label",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:d}),l&&t.jsx("p",{className:"text-2xs text-text-tertiary mt-0.5",children:l})]});return i.kind==="none"?t.jsxs("div",{children:[c,t.jsx("p",{className:"text-xs text-text-quaternary italic mt-1",children:"No attachment"})]}):i.kind==="image"?t.jsxs("div",{children:[c,t.jsxs("div",{className:"mt-1",children:[t.jsx("button",{type:"button",onClick:()=>n(!0),className:"block rounded-[0.125em] border border-surface-border overflow-hidden hover:border-accent transition-colors",title:"View full size",children:t.jsx("img",{src:i.src,alt:e.replace(/[_-]/g," "),className:"max-h-48 max-w-full object-contain","data-testid":`attachment-image-${e}`})}),r&&t.jsx("div",{className:"fixed inset-0 z-[100] bg-text-primary/60 backdrop-blur-sm flex items-center justify-center p-8 cursor-zoom-out",onClick:()=>n(!1),role:"dialog","aria-modal":"true","aria-label":`${d} — full size`,children:t.jsx("img",{src:i.src,alt:d,className:"max-h-[90vh] max-w-[90vw] object-contain"})})]})]}):t.jsxs("div",{children:[c,t.jsx("div",{className:"mt-1",children:t.jsxs("a",{href:i.href,...i.isData?{download:`${e}.${i.label==="PDF"?"pdf":"bin"}`}:{target:"_blank",rel:"noopener noreferrer"},className:"inline-flex items-center gap-1.5 text-xs text-accent hover:text-accent-hover transition-colors","data-testid":`attachment-link-${e}`,children:[t.jsx(Es,{className:"w-3.5 h-3.5",strokeWidth:1.5}),i.isData?`Download ${i.label}`:`Open ${i.label}`,i.isData?t.jsx(As,{className:"w-3 h-3",strokeWidth:1.5}):t.jsx(Wt,{className:"w-3 h-3",strokeWidth:1.5})]})})]})}function fn({fieldKey:e,schema:s,escalationContext:a}){const r=(s==null?void 0:s["x-lt-href"])??"",n=r&&a?ot(r,a):r,i=(s==null?void 0:s.title)??(s==null?void 0:s.description)??"Open",d=s==null?void 0:s.description,l=n.startsWith("/"),c=!n.trim();return t.jsxs("div",{"data-field-key":e,children:[t.jsx(W,{children:i}),d&&t.jsx(G,{children:d}),t.jsx("div",{className:"mt-1",children:c?t.jsx("span",{className:"text-xs text-text-quaternary italic",children:"No link configured"}):l?t.jsxs(it,{to:n,className:"inline-flex items-center gap-1 text-xs text-accent hover:text-accent-hover transition-colors","data-testid":`link-widget-${e}`,children:[i,t.jsx(Wt,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]}):t.jsxs("a",{href:n,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-accent hover:text-accent-hover transition-colors","data-testid":`link-widget-${e}`,children:[i,t.jsx(Wt,{className:"w-3 h-3 shrink-0",strokeWidth:1.5})]})})]})}const fe="—";function hn(e,s){if(!e||!s)return"";const a=e.indexOf(".");if(a===-1)return"";const r=e.slice(0,a),n=e.slice(a+1);try{const i=Ht(s[r],n);return typeof i=="string"?i:""}catch{return""}}function gn(e,s){if(!e||e===fe)return fe;if(s==="age"){const a=new Date(e);return Number.isNaN(a.getTime())?e:Vt(e)}return e}function jn({fieldKey:e,schema:s,escalationContext:a}){const r=s==null?void 0:s["x-lt-source"],n=(s==null?void 0:s["x-lt-fields"])??[],i=(s==null?void 0:s.title)??"Linked escalation",d=s==null?void 0:s.description,l=hn(r,a),{data:c,isLoading:u,isError:o}=be(l);return t.jsxs("div",{"data-field-key":e,children:[t.jsx(W,{children:i}),d&&t.jsx(G,{children:d}),t.jsx("div",{className:"mt-1",children:!l||o?t.jsx("p",{className:"text-xs text-text-quaternary italic","data-testid":`escalation-widget-empty-${e}`,children:"No linked record"}):u?t.jsx(yn,{}):c?t.jsx(bn,{esc:c,fields:n,fieldKey:e}):t.jsx("p",{className:"text-xs text-text-quaternary italic",children:"No linked record"})})]})}function bn({esc:e,fields:s,fieldKey:a}){if(!e)return null;const r=Ut(e);return t.jsxs("div",{className:"border-l-2 border-accent-faint pl-3 py-2 space-y-2","data-testid":`escalation-widget-card-${a}`,children:[t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsxs("span",{className:"text-2xs font-semibold uppercase tracking-wider text-text-secondary",children:[e.type,e.subtype&&e.subtype!==e.type?` · ${e.subtype}`:""]}),t.jsx(Ce,{status:e.status})]}),e.description&&t.jsx("p",{className:"text-xs text-text-primary leading-snug",children:e.description}),s.length>0&&t.jsx("dl",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-0.5",children:s.map(n=>{const i=ot(n.value,r),d=gn(i,n.format);return t.jsxs("div",{className:"contents",children:[t.jsx("dt",{className:"text-2xs text-text-tertiary whitespace-nowrap",children:n.label}),t.jsx("dd",{className:"text-2xs text-text-primary",children:d})]},n.label)})}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("span",{className:"text-2xs text-text-quaternary",children:[e.role," · ",Vt(e.created_at)]}),t.jsx(it,{to:`/escalations/detail/${e.id}`,className:"text-2xs text-accent hover:text-accent-hover transition-colors",title:"Open escalation detail",children:"Detail"})]})]})}function yn(){return t.jsxs("div",{className:"border-l-2 border-accent-faint pl-3 py-2 space-y-2 animate-pulse",children:[t.jsx("div",{className:"h-3 w-32 bg-surface-sunken rounded"}),t.jsx("div",{className:"h-3 w-48 bg-surface-sunken rounded"}),t.jsx("div",{className:"h-3 w-24 bg-surface-sunken rounded"})]})}const Nn=[{label:"Description",value:"{{escalation.description}}"},{label:"Role",value:"{{escalation.role}}"},{label:"Age",value:"{{escalation.created_at}}",format:"age"}],he="—";function vn(e,s){if(!e||e===he)return he;if(s==="age"){const a=new Date(e);return Number.isNaN(a.getTime())?e:Vt(e)}return e}function Ft(e,s){return typeof e=="string"?ot(e,s):Array.isArray(e)?e.map(a=>Ft(a,s)):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([a,r])=>[a,Ft(r,s)])):e}function wn({fieldKey:e,schema:s,escalationContext:a}){const r=(s==null?void 0:s["x-lt-query"])??{},n=(s==null?void 0:s["x-lt-columns"])??Nn,i=(s==null?void 0:s["x-lt-actions"])??[],d=(s==null?void 0:s.title)??"Related items",l=s==null?void 0:s.description,c=a??{},{user:u}=qt(),o=Ie(r,c,u==null?void 0:u.userId),{data:x,isLoading:p}=je({role:o.role,status:o.status,facets:o.facets,assigned_to:o.assigned_to,available:o.available,limit:o.limit??5,enabled:o.enabled}),h=(x==null?void 0:x.escalations)??[],y=ye(),[g,m]=f.useState({}),[b,_]=f.useState(null),j=async(k,T)=>{const M=Ut(k);if(!(T.confirm&&!window.confirm(ot(T.confirm,M)))){_(k.id),m(I=>({...I,[k.id]:""}));try{await y.mutateAsync({id:k.id,resolverPayload:Ft(T.resolverPayload,M)})}catch(I){m(C=>({...C,[k.id]:I.message}))}finally{_(null)}}};return t.jsxs("div",{"data-field-key":e,children:[t.jsx(W,{children:d}),l&&t.jsx(G,{children:l}),t.jsx("div",{className:"mt-1","data-testid":`escalation-list-widget-${e}`,children:p?t.jsx(Cn,{columns:n.length}):t.jsx(kn,{escalations:h,columns:n,fieldKey:e,actions:i,onAction:j,pendingRow:b,rowErrors:g})})]})}function kn({escalations:e,columns:s,fieldKey:a,actions:r,onAction:n,pendingRow:i,rowErrors:d}){return e.length===0?t.jsx("p",{className:"text-xs text-text-quaternary italic py-1","data-testid":`escalation-list-empty-${a}`,children:"No items found"}):t.jsxs("table",{className:"w-full text-xs border-collapse","data-testid":`escalation-list-table-${a}`,children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-surface-border",children:[s.map(l=>t.jsx("th",{className:"text-left text-2xs font-semibold uppercase tracking-wider text-text-tertiary pb-1 pr-3 last:pr-0",children:l.label},l.label)),r.length>0&&t.jsx("th",{className:"w-px"}),t.jsx("th",{className:"w-4"})]})}),t.jsx("tbody",{children:e.map(l=>{const c=Ut(l),u=d[l.id];return t.jsxs("tr",{className:"border-b border-surface-border/50 last:border-0 hover:bg-surface-sunken/50 transition-colors",children:[s.map(o=>{const x=ot(o.value,c),p=vn(x,o.format);return t.jsx("td",{className:"py-1 pr-3 last:pr-0 text-text-primary align-top",children:p},o.label)}),r.length>0&&t.jsxs("td",{className:"py-1 pr-2 align-top whitespace-nowrap",children:[r.map(o=>t.jsx("button",{type:"button",onClick:()=>n(l,o),disabled:i===l.id,className:"px-2 py-0.5 text-2xs font-medium text-accent border border-accent/40 rounded hover:bg-accent/10 disabled:opacity-40 disabled:cursor-default transition-colors ml-1 first:ml-0","data-testid":`escalation-list-action-${l.id}`,children:o.label},o.label)),u&&t.jsx("p",{className:"text-2xs text-status-error mt-0.5 whitespace-normal max-w-[16rem]","data-testid":`escalation-list-action-error-${l.id}`,children:u})]}),t.jsx("td",{className:"py-1 align-top",children:t.jsx(it,{to:`/escalations/detail/${l.id}`,className:"text-accent hover:text-accent-hover transition-colors",title:"Open escalation detail",tabIndex:-1,children:"→"})})]},l.id)})})]})}function Cn({columns:e}){return t.jsx("div",{className:"space-y-1.5 animate-pulse",children:[0,1,2].map(s=>t.jsx("div",{className:"flex gap-4",children:Array.from({length:e},(a,r)=>t.jsx("div",{className:"h-3 bg-surface-sunken rounded flex-1"},r))},s))})}const It={"file-upload":an,"code-editor":on,signature:ln,"rich-text":cn,markdown:dn,checklist:un,attachment:me,image:me,link:fn,escalation:jn,"escalation-list":wn};function Le({fieldKey:e,value:s,onChange:a,onBlur:r,schema:n,isRequired:i,isReadOnly:d,error:l,escalationContext:c,submitAttempted:u}){var I;const o=(I=n==null?void 0:n.properties)==null?void 0:I[e],x=X(e,o),p=o==null?void 0:o["x-lt-widget"],h=`lt-field-${e}`,y=`${h}-error`,g=`${h}-help`,m=typeof(o==null?void 0:o.description)=="string"&&o.description.length>0?o.description:void 0,j={id:h,"aria-required":i||void 0,"aria-invalid":l?!0:void 0,"aria-describedby":l?y:m!==void 0?g:void 0},k=p==="markdown"&&typeof s=="string",T=(p==="attachment"||p==="image")&&typeof s=="string",M=!!(p&&p in It);if(d&&!k&&!T&&!M){const C=s===null?"null":typeof s=="object"?JSON.stringify(s,null,2):String(s);return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,children:x}),t.jsx("p",{className:"text-sm text-text-secondary mt-0.5 whitespace-pre-wrap",children:C})]})}if(p&&p in It){const C=It[p],O=i||(o==null?void 0:o["x-lt-require-all"])===!0,E={fieldKey:e,schema:o,escalationContext:c,isRequired:O,submitAttempted:u,error:l};if((o==null?void 0:o.type)==="object"){const D=typeof s=="string"?s:typeof s=="object"&&s!==null&&!Array.isArray(s)?JSON.stringify(s):"";return t.jsx(C,{...E,value:D,onChange:P=>{try{a(JSON.parse(P))}catch{a(P)}}})}if(typeof s=="string")return t.jsx(C,{...E,value:s,onChange:D=>a(D)});if(typeof s=="object"&&s!==null&&!Array.isArray(s))return t.jsx(C,{...E,value:JSON.stringify(s),onChange:D=>{try{a(JSON.parse(D))}catch{a(D)}}})}if(typeof s=="boolean")return t.jsxs("div",{children:[t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[t.jsx("input",{type:"checkbox",checked:s,onChange:C=>{a(C.target.checked),r==null||r()},className:"w-3.5 h-3.5 rounded accent-accent","data-field-key":e,...j}),t.jsxs("span",{className:"text-2xs font-semibold uppercase tracking-wider text-text-secondary",children:[x,i&&t.jsx("span",{className:"text-status-error ml-0.5",children:"*"})]})]}),m&&t.jsx(G,{id:g,children:m}),t.jsx(at,{error:l,id:y})]});if(typeof s=="number")return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,htmlFor:h,children:x}),m&&t.jsx(G,{id:g,children:m}),t.jsx("input",{type:"number",value:s,onChange:C=>a(parseFloat(C.target.value)||0),onBlur:r,step:"any","data-field-key":e,className:`${ft(!!l)} max-w-48`,...j}),t.jsx(at,{error:l,id:y})]});if(typeof s=="string"){const C=(o==null?void 0:o.format)==="password",O=o==null?void 0:o.enum;if(O!=null&&O.length){const S=s===""&&!O.includes("");return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,htmlFor:h,children:x}),m&&t.jsx(G,{id:g,children:m}),t.jsxs("select",{value:s,onChange:L=>a(L.target.value),onBlur:r,"data-field-key":e,className:rn(!!l),...j,children:[S&&t.jsx("option",{value:"",disabled:!0,children:"Choose…"}),O.map(L=>t.jsx("option",{value:L,children:L},L))]}),t.jsx(at,{error:l,id:y})]})}if(C)return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,htmlFor:h,children:x}),m&&t.jsx(G,{id:g,children:m}),t.jsx("input",{type:"password",value:s,onChange:S=>a(S.target.value),onBlur:r,"data-field-key":e,className:ft(!!l),autoComplete:"off",...j}),t.jsx(at,{error:l,id:y})]});const E=o==null?void 0:o.format,D={date:"date","date-time":"datetime-local",email:"email",uri:"url"},P={date:"max-w-48","date-time":"max-w-64"};if(E&&E in D)return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,htmlFor:h,children:x}),m&&t.jsx(G,{id:g,children:m}),t.jsx("input",{type:D[E],value:s,onChange:S=>a(S.target.value),onBlur:r,"data-field-key":e,className:`${ft(!!l)} ${P[E]??""}`,...j}),t.jsx(at,{error:l,id:y})]});if(E==="textarea"||s.length>80){const S=o==null?void 0:o.maxLength,L=o==null?void 0:o["x-lt-max-length"];let J=S;if(J===void 0&&L&&c){const q=L.indexOf(".");if(q!==-1){const v=L.slice(0,q),$=L.slice(q+1),N=c[v];if(N&&typeof N=="object"){let R=N;for(const F of $.split("."))if(R=R[F],R===void 0)break;if(typeof R=="number")J=R;else if(typeof R=="string"){const F=Number(R);Number.isNaN(F)||(J=F)}}}}const Q=J!==void 0&&s.length>J;return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,htmlFor:h,children:x}),m&&t.jsx(G,{id:g,children:m}),t.jsx("textarea",{value:s,onChange:q=>{a(q.target.value),r==null||r()},onBlur:r,"data-field-key":e,className:`${ft(!!l)} leading-relaxed`,rows:Math.min(6,Math.max(3,Math.ceil(s.length/60))),...j}),J!==void 0&&t.jsxs("p",{className:`text-2xs mt-0.5 text-right tabular-nums ${Q?"text-status-error font-medium":"text-text-quaternary"}`,children:[s.length," / ",J]}),t.jsx(at,{error:l,id:y})]})}return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,htmlFor:h,children:x}),m&&t.jsx(G,{id:g,children:m}),t.jsx("input",{type:"text",value:s,onChange:S=>a(S.target.value),onBlur:r,"data-field-key":e,className:ft(!!l),...j}),t.jsx(at,{error:l,id:y})]})}if(s===null)return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,children:x}),t.jsx("p",{className:"text-xs text-text-tertiary italic mt-1",children:"null"})]});if(Array.isArray(s))return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,children:x}),t.jsx("div",{className:"flex flex-wrap gap-1.5 mt-1",children:s.map((C,O)=>t.jsx("span",{className:"px-2 py-0.5 text-2xs font-mono bg-surface-sunken rounded text-text-secondary",children:String(C)},O))})]});if(typeof s=="object"){const C=Object.entries(s);return t.jsxs("div",{children:[t.jsx(W,{isRequired:i,children:x}),t.jsx("div",{className:"ml-4 mt-2 pl-4 border-l border-accent-faint space-y-3",children:C.map(([O,E])=>t.jsx(Le,{fieldKey:O,value:E,onChange:D=>a({...s,[O]:D})},O))})]})}return null}function _n({items:e,columns:s=1}){if(e.length===0)return null;const a=s>=2&&e.length>1?"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr] @dict-pairs:grid-cols-[max-content_1fr_max-content_1fr]":"grid-cols-1 @dict-inline:grid-cols-[max-content_1fr]";return t.jsx("div",{className:"@container",children:t.jsx("dl",{className:`grid ${a} items-baseline gap-x-6 @dict-pairs:gap-x-8 gap-y-1.5`,children:e.map(({key:r,label:n,value:i})=>t.jsxs(f.Fragment,{children:[t.jsx("dt",{className:"text-2xs font-semibold uppercase tracking-wide text-text-secondary mt-2 first:mt-0 @dict-inline:mt-0",children:n}),t.jsx("dd",{className:"text-sm text-text-primary break-words min-w-0","data-field-key":r,children:En(i)})]},r))})})}function En(e){return e==null||e===""?"—":typeof e=="boolean"?e?"Yes":"No":typeof e=="object"?JSON.stringify(e):String(e)}const Mt="dictionary",An=new Set(["markdown","attachment","image"]);function Pe(e,s){if(!s)return;const a=e==null?void 0:e["x-lt-section-options"],r=a==null?void 0:a[s];return r&&typeof r=="object"?r:void 0}function Tn(e,s,a){var l,c;const r=(l=e==null?void 0:e.properties)==null?void 0:l[a];if((r==null?void 0:r.readOnly)!==!0)return!1;const n=r==null?void 0:r["x-lt-widget"];if(typeof n=="string"&&An.has(n))return!1;const i=r==null?void 0:r["x-lt-display"];if(typeof i=="string")return i===Mt;const d=(c=Pe(e,s))==null?void 0:c.display;return typeof d=="string"?d===Mt:(e==null?void 0:e["x-lt-display"])===Mt}function $n(e,s,a,r){var i;const n=[];for(const d of e){const[l]=d,c=n[n.length-1];if(Tn(s,a,l)){(c==null?void 0:c.kind)==="dictionary"?c.entries.push(d):n.push({kind:"dictionary",entries:[d]});continue}const u=(i=s==null?void 0:s.properties)==null?void 0:i[l],o=u==null?void 0:u["x-lt-column-group"];if(r==="two-column"&&typeof o=="string"&&o.trim()){(c==null?void 0:c.kind)==="column-group"&&c.name===o?c.entries.push(d):n.push({kind:"column-group",name:o,entries:[d]});continue}n.push({kind:"field",entry:d})}return n}function Rn({name:e,entries:s,formSchema:a,layout:r,renderField:n}){const i=$n(s,a,e,r),d=Pe(a,e),l=(d==null?void 0:d.columns)??(r==="two-column"?2:1),c=o=>o.map(([x,p])=>{var h;return{key:x,label:X(x,(h=a==null?void 0:a.properties)==null?void 0:h[x]),value:p}}),u=()=>i.map((o,x)=>o.kind==="dictionary"?t.jsx("div",{className:r==="two-column"?"col-span-full":"",children:t.jsx(_n,{items:c(o.entries),columns:l})},`dict-${x}`):o.kind==="column-group"?t.jsx("div",{className:"@container",children:t.jsx("div",{className:"grid grid-cols-1 @grp-cols:grid-cols-2 gap-x-4 gap-y-5",children:o.entries.map(p=>n(p))})},`group-${o.name}-${x}`):n(o.entry));return t.jsxs("div",{className:e?"border border-surface-border/60 bg-surface-sunken rounded-[0.25em] p-4 animate-[section-enter_0.25s_ease-out]":"",children:[e&&t.jsx("p",{className:"mb-4 text-[1.40625rem] font-semibold tracking-wider text-heading [font-variant-caps:small-caps]",children:e}),r==="two-column"?t.jsx("div",{className:"@container",children:t.jsx("div",{className:"grid grid-cols-1 @form-cols:grid-cols-2 gap-x-col-gap gap-y-5",children:u()})}):t.jsx("div",{className:"space-y-5",children:u()})]})}function We({value:e,onChange:s,disabled:a,submitAttempted:r,escalationContext:n,onOpenHelp:i,onDisabledClick:d}){var Q,q;const[l,c]=f.useState({}),[u,o]=f.useState({}),[x,p]=f.useState(null),[h,y]=f.useState(!1),[g,m]=f.useState(new Set);f.useEffect(()=>{try{const v=JSON.parse(e);if(typeof v=="object"&&v!==null&&!Array.isArray(v)){const $={},N={};for(const[R,F]of Object.entries(v))R.startsWith("_")?N[R]=F:$[R]=F;c($),o(N),p(N._form_schema&&typeof N._form_schema=="object"?N._form_schema:null),y(!1)}}catch{y(!0)}},[e]);const b=f.useCallback(v=>{c(v),s(JSON.stringify({...v,...u},null,2))},[u,s]),_=f.useCallback((v,$)=>{b({...l,[v]:$})},[l,b]),j=f.useCallback(v=>{m($=>{if($.has(v))return $;const N=new Set($);return N.add(v),N})},[]);if(h)return t.jsx("p",{className:"text-xs text-status-error",children:"Unable to parse resolver data as form. Use the JSON editor below."});const k=Object.entries(l);if(k.length===0)return t.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No resolver fields defined."});const T=x==null?void 0:x["x-lt-order"],M=T?[...k].sort((v,$)=>{const N=T.indexOf(v[0]),R=T.indexOf($[0]);return(N===-1?1/0:N)-(R===-1?1/0:R)}):k,I={...n??{},resolver:l},C=M.filter(([v,$])=>{var R;const N=(R=x==null?void 0:x.properties)==null?void 0:R[v];return!(!Oe(N==null?void 0:N["x-lt-showIf"],I)||(N==null?void 0:N["x-lt-hide-if-empty"])===!0&&($==null||$===""||$===!1||$===0))}),O=new Set((x==null?void 0:x.required)??[]),E=x==null?void 0:x["x-lt-layout"],D=x==null?void 0:x.title,P=x==null?void 0:x.description,S=typeof(x==null?void 0:x["x-lt-help"])=="string"||typeof(x==null?void 0:x["x-lt-context"])=="string",L=[];for(const v of C){const[$]=v,N=(Q=x==null?void 0:x.properties)==null?void 0:Q[$],R=((q=N==null?void 0:N["x-lt-section"])==null?void 0:q.trim())||null,F=L[L.length-1];!F||F.name!==R?L.push({name:R,entries:[v]}):F.entries.push(v)}const J=([v,$])=>{var B;const N=(B=x==null?void 0:x.properties)==null?void 0:B[v],R=(N==null?void 0:N.readOnly)===!0,F=(N==null?void 0:N["x-lt-span"])??1,st=O.has(v),lt=g.has(v)||!!r,Z=Re($,N,st,lt,I);return t.jsx("div",{className:`animate-[field-enter_0.2s_ease-out] ${E==="two-column"&&F>=2?"col-span-full":""}`,children:t.jsx(Le,{fieldKey:v,value:$,onChange:V=>_(v,V),onBlur:()=>j(v),schema:x,isRequired:st,isReadOnly:R,error:Z,escalationContext:I,submitAttempted:!!r})},v)};return t.jsx("div",{className:"pb-8 max-w-form",onClick:a?d:void 0,children:t.jsxs("div",{className:a?"pointer-events-none":void 0,inert:a||void 0,"aria-disabled":a||void 0,children:[D&&t.jsxs("div",{className:"mb-1 flex items-center gap-1.5",children:[t.jsx("h3",{className:"heading-3",children:D}),S&&i&&t.jsx("button",{type:"button",onClick:i,title:"Open instructions","aria-label":"Open instructions",className:"p-1 rounded-md text-text-tertiary hover:text-accent hover:bg-surface-hover transition-colors",children:t.jsx(Ee,{className:"w-4 h-4",strokeWidth:1.5})})]}),P&&t.jsx("p",{className:"text-sm text-text-secondary leading-relaxed mb-6",children:P}),t.jsx("div",{className:"space-y-8",children:L.map((v,$)=>t.jsx(Rn,{name:v.name,entries:v.entries,formSchema:x,layout:E,renderField:J},v.name??`__s${$}`))})]})})}function On({json:e,onJsonChange:s,requestTriage:a,onRequestTriageChange:r,triageNotes:n,onTriageNotesChange:i,disabled:d=!1,submitAttempted:l=!1,showTriage:c=!1,escalationContext:u,onOpenHelp:o,onDisabledClick:x}){return t.jsxs(t.Fragment,{children:[c&&t.jsx("div",{className:"flex items-center justify-between mb-3",children:a?t.jsxs("button",{onClick:()=>r(!1),className:"group flex items-center gap-2 text-left","data-testid":"triage-cancel",children:[t.jsx("span",{className:"flex items-center justify-center w-5 h-5 rounded-full bg-accent/10 text-accent shrink-0",children:t.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),t.jsxs("span",{className:"text-xs text-text-secondary group-hover:text-text-primary transition-colors",children:["AI Triage active."," ",t.jsx("span",{className:"text-accent group-hover:underline",children:"Cancel"})]})]}):t.jsxs("button",{onClick:()=>r(!0),className:"group flex items-center gap-2.5 text-left my-4","data-testid":"triage-callout",children:[t.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:t.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:t.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"})})}),t.jsxs("span",{className:"text-sm text-text-secondary group-hover:text-text-primary transition-colors",children:["This form doesn't capture the issue?"," ",t.jsx("span",{className:"text-accent group-hover:underline",children:"Request AI Triage"})]})]})}),t.jsxs("div",{className:"relative min-h-[200px]",children:[t.jsx("div",{className:a?"pointer-events-none select-none":"",children:t.jsx(We,{value:e,onChange:s,disabled:d,submitAttempted:l,escalationContext:u,onOpenHelp:o,onDisabledClick:x})}),a&&t.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:[t.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."}),t.jsx("textarea",{value:n,onChange:p=>i(p.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 Fe(e,s){if(!e.includes("{"))return e;try{const a=n=>{if(!n)return{};try{return JSON.parse(n)}catch{return{}}},r={...s.metadata??{},...a(s.envelope),...a(s.escalation_payload)};return e.replace(/\{([^}]+)\}/g,(n,i)=>Object.prototype.hasOwnProperty.call(r,i)?String(r[i]):`{${i}}`)}catch{return e}}function ge(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function St(e){return{escalation:e,metadata:e.metadata??null,envelope:ge(e.envelope),payload:ge(e.escalation_payload),resolver:null}}function Dn({isRoundsExhausted:e,payloadObj:s,isTerminal:a,resolverPayload:r,onRetryTriage:n,isRetrying:i}){return t.jsxs(t.Fragment,{children:[e&&s&&t.jsx("div",{className:"mt-8",children:t.jsx(nn,{payload:s,isTerminal:a,resolverPayload:r,onRetryTriage:n,isRetrying:i})}),(s==null?void 0:s.category)==="missing_credential"&&t.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:[t.jsx(ie,{size:20,className:"text-status-warning mt-0.5 shrink-0"}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-text-primary mb-1",children:"Missing Credential"}),t.jsxs("p",{className:"text-xs text-text-secondary mb-3",children:["This workflow requires a ",t.jsx("span",{className:"font-medium capitalize",children:String(s.provider)})," credential to continue. Register one and then resolve this escalation to retry."]}),t.jsxs(it,{to:"/credentials",className:"btn-primary text-xs inline-flex items-center gap-1.5",children:[t.jsx(ie,{size:12}),"Go to Credentials"]})]})]})]})}function In({esc:e,resolverPayload:s,isTerminal:a,claimedByMe:r,activeView:n,metadataFormSchema:i,effectiveSchema:d,json:l,onJsonChange:c,requestTriage:u,onRequestTriageChange:o,triageNotes:x,onTriageNotesChange:p,onResolve:h,onEscalate:y,onClaim:g,submitAttempted:m,isCertified:b,hasAI:_,onOpenHelp:j,onDisabledClick:k}){const T=d,M=St(e);if(a){if(s==null)return null;const E=typeof s=="object"&&s!==null?s:{},D=d??i,P=D!=null&&D.properties?{...ke(E,D),_form_schema:D}:E;return t.jsx("div",{className:"mt-3",children:t.jsx(We,{value:JSON.stringify(P,null,2),onChange:()=>{},disabled:!0,escalationContext:M})})}if(n!=="resolve"||!(e.workflow_type||d))return null;const I=T==null?void 0:T["x-lt-viewport"],C=(I==null?void 0:I.type)==="iframe"&&!!I.src&&h&&y;if(C&&!r)return t.jsxs("button",{onClick:()=>g==null?void 0:g(),disabled:!g,className:"flex flex-col items-center justify-center min-h-[55vh] w-full gap-3 text-center group disabled:opacity-50 disabled:cursor-default",children:[t.jsx(Ts,{className:"w-10 h-10 text-text-tertiary group-hover:text-accent transition-colors",strokeWidth:1}),t.jsx("p",{className:"text-base font-medium text-text-primary group-hover:text-accent transition-colors",children:"Claim to launch the editor"})]});const O=C?Fe(I.src,e):"";return t.jsx("div",{className:"mt-3",children:C?t.jsx(Me,{src:O,escalation:e,schema:T,onResolve:h,onEscalate:y,submitAttempted:m}):t.jsx(On,{json:l,onJsonChange:c,requestTriage:u,onRequestTriageChange:o,triageNotes:x,onTriageNotesChange:p,disabled:!r,submitAttempted:m,showTriage:!!b&&!!_,escalationContext:M,onOpenHelp:j,onDisabledClick:k})})}function Mn({open:e,assignedUntil:s,onClose:a,onExtend:r,isPending:n}){const i=Ne(),[d,l]=f.useState("30"),[c,u]=f.useState(0),o=d==="custom",x=o?c:parseInt(d),p=f.useCallback(h=>u(h),[]);return t.jsx(Ds,{open:e,onClose:a,title:"Claim Expiring",children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("p",{className:"text-sm text-text-secondary",children:["Your claim on this escalation expires in"," ",t.jsx(Jt,{until:s}),". When it lapses, the form locks and the item returns to the queue — your edits are kept as a draft. Extend to keep working."]}),t.jsxs("select",{value:d,onChange:h=>{l(h.target.value),u(0)},className:"select w-full text-sm","aria-label":"Extension duration",children:[i.map(h=>t.jsx("option",{value:h.value,children:h.label},h.value)),t.jsx("option",{value:"custom",children:"Other..."})]}),o&&t.jsx(ve,{onChange:p,autoFocus:!0}),t.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[t.jsx("button",{onClick:a,className:"btn-secondary text-xs",children:"Dismiss"}),t.jsx("button",{onClick:()=>r(x),className:"btn-primary text-xs",disabled:n||!x||x<=0,children:n?"Extending...":"Extend Claim"})]})]})})}const Ln=9e4;function Pn(e,s=Ln){const[,a]=f.useState(0);if(f.useEffect(()=>{if(!e)return;const n=new Date(e).getTime()-Date.now();if(n<=0)return;const i=()=>a(c=>c+1),d=[],l=n-s;return l>0&&d.push(window.setTimeout(i,l)),d.push(window.setTimeout(i,n)),()=>d.forEach(c=>window.clearTimeout(c))},[e,s]),!e)return{expired:!1,expiringSoon:!1,msRemaining:0};const r=Math.max(0,new Date(e).getTime()-Date.now());return{expired:r<=0,expiringSoon:r>0&&r<=s,msRemaining:r}}const Wn="lt:escalation:draft:";function zt(e){return`${Wn}${e}`}function Fn(e){try{return localStorage.getItem(zt(e))}catch{return null}}function Sn(e,s){try{localStorage.setItem(zt(e),s)}catch{}}function Lt(e){try{localStorage.removeItem(zt(e))}catch{}}const Se="lt:escalation:panel:open";function qn(){try{const e=localStorage.getItem(Se);return e===null?!0:e==="true"}catch{return!0}}function vt(e){try{localStorage.setItem(Se,String(e))}catch{}}function ht(e){if(!e)return null;try{return JSON.parse(e)}catch{return e}}function dr(){const{id:e}=Os();return t.jsx(Vn,{id:e},e)}function Vn({id:e}){var Qt,Zt,Kt,te;const{user:s}=qt(),a=Te(),r=Qe(),{data:n,isLoading:i,refetch:d,isFetching:l}=be(e);hs(e);const c=ts(),u=ye(),o=es(),x=ss(),[p,h]=f.useState(!1),{data:y}=ns((n==null?void 0:n.role)??""),{data:g}=fs(),{data:m}=rs(),{isBuilder:b}=as(),_=g==null?void 0:g.find(w=>w.workflow_type===(n==null?void 0:n.workflow_type)),j=((Qt=m==null?void 0:m.telemetry)==null?void 0:Qt.traceUrl)??null,[k,T]=f.useState("resolve"),[M,I]=f.useState("{}"),[C,O]=f.useState(qn),[E,D]=f.useState(!1),[P,S]=f.useState(""),[L,J]=f.useState(!1),[Q,q]=f.useState([]),[v,$]=f.useState(0),[N,R]=f.useState(void 0),F=Pn(n==null?void 0:n.assigned_until),[st,lt]=f.useState(null);f.useEffect(()=>{if(!(!L||!n))try{const w=JSON.parse(M),H=w._form_schema;if(!H){q([]);return}q(De(H,w,St(n)))}catch{}},[M,L,n]);const Z=((Zt=n==null?void 0:n.metadata)==null?void 0:Zt.form_schema)??null,B=(n==null?void 0:n.form_schema)??(_==null?void 0:_.resolver_schema)??null,V=Z??B,A=f.useRef(!1),z=f.useRef(null);f.useEffect(()=>{if(A.current)return;const w=Z??(B!=null&&B.properties?B:null);if(w!=null&&w.properties){A.current=!0;const H=ht(n==null?void 0:n.envelope),xt=H==null?void 0:H.formDefaults,Et={...(n==null?void 0:n.metadata)??{},...typeof xt=="object"&&xt!==null?xt:{}},At=ke(Et,w),ee={_form_schema:w};for(const[ne,Ge]of Object.entries(w.properties)){const re=Ge,Xe=re.type==="object"?{}:"";ee[ne]=At[ne]??re.default??Xe}z.current=JSON.stringify(ee,null,2);const se=!((n==null?void 0:n.status)==="resolved"||(n==null?void 0:n.status)==="cancelled")&&(n!=null&&n.id)?Fn(n.id):null,yt=se?ht(se):null;yt&&typeof yt=="object"&&!Array.isArray(yt)?I(JSON.stringify({...yt,_form_schema:w},null,2)):I(z.current)}else V&&(A.current=!0,I(JSON.stringify(V,null,2)))},[V,Z,B,n==null?void 0:n.envelope,n==null?void 0:n.metadata,n==null?void 0:n.id,n==null?void 0:n.status]),f.useEffect(()=>{if(!A.current||z.current===null||!(n!=null&&n.id)||n.status!=="pending")return;const w=n.id,H=window.setTimeout(()=>{M===z.current?Lt(w):Sn(w,M)},400);return()=>window.clearTimeout(H)},[M,n==null?void 0:n.id,n==null?void 0:n.status]);const Yt=(n==null?void 0:n.subtype)==="rounds_exhausted";if(i)return t.jsxs("div",{className:"animate-pulse space-y-8",children:[t.jsx("div",{className:"h-8 bg-surface-sunken rounded w-64"}),t.jsx("div",{className:"h-32 bg-surface-sunken rounded w-full"})]});if(!n)return t.jsx("p",{className:"text-sm text-text-secondary",children:"Escalation not found."});const pt=we(n),U=pt&&n.assigned_to===(s==null?void 0:s.userId),qe=pt&&!U,ct=n.status==="resolved"||n.status==="cancelled",nt=V==null?void 0:V["x-lt-viewport"],wt=(nt==null?void 0:nt.type)==="iframe"&&!!(nt!=null&&nt.src)&&U&&!ct,jt=ht(n.escalation_payload),dt=ht(n.resolver_payload),bt=ht(n.envelope),Ve=!!((Kt=bt==null?void 0:bt.metadata)!=null&&Kt.certified),Bt=is(),Gt=Bt!==null?Bt:!!((te=m==null?void 0:m.ai)!=null&&te.enabled),K=typeof jt=="object"&&jt!==null&&!Array.isArray(jt)?jt:null,Je=K==null?void 0:K._triage,He=typeof dt=="object"&&dt!==null&&!Array.isArray(dt)?dt:null,Ue=ct?"terminal":U?"claimed_by_me":qe?"claimed_by_other":"available",kt=w=>{c.mutate({id:e,durationMinutes:w})},mt=()=>{r.resetQueries({queryKey:["escalations"]}),r.resetQueries({queryKey:["escalationStats"]}),a(-1)},Ct=async w=>{try{await u.mutateAsync({id:e,resolverPayload:w})}catch(H){if(H instanceof os&&Ms(H.body)){J(!0),q(H.body.violations),R(Y.ERRORS);return}throw H}Lt(e),mt()},_t=async w=>{w&&(await o.mutateAsync({id:e,targetRole:w}),mt())},ze=async()=>{U||await c.mutateAsync({id:e,durationMinutes:30});const w=(K==null?void 0:K.diagnosis)||n.description||"";await u.mutateAsync({id:e,resolverPayload:{_lt:{needsTriage:!0},notes:w}}),mt()},Xt=async()=>{await c.mutateAsync({id:e,durationMinutes:0}),mt()},Ye=async()=>{await x.mutateAsync(e),Lt(e),h(!1),mt()},Be=t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ds,{onRefresh:()=>d(),isFetching:l,apiPath:`/escalations/${n.id}`,standalone:!0}),t.jsx("button",{onClick:()=>O(w=>(vt(!w),!w)),className:"ml-2 text-text-tertiary hover:text-accent transition-colors",title:C?"Hide side panel":"Show side panel",children:C?t.jsx(oe,{className:"w-5 h-5",strokeWidth:1.5}):t.jsx(le,{className:"w-5 h-5",strokeWidth:1.5})})]});return t.jsxs("div",{className:"flex-1 min-h-0 min-w-0 flex items-stretch -mt-8 -mr-page-x -mb-16",children:[t.jsxs("div",{className:"flex-1 min-w-0 flex flex-col min-h-0",children:[wt?t.jsxs("div",{className:"relative flex-1 min-h-0 -ml-page-x",children:[t.jsx("div",{className:"absolute top-3 right-3 z-50 flex items-center gap-0.5 bg-surface/90 backdrop-blur-sm rounded-lg px-1.5 py-1 shadow-sm border border-surface-border/40",children:[{onClick:Xt,disabled:c.isPending,label:"Release",hoverClass:"hover:text-accent",icon:t.jsx($s,{className:"w-4 h-4",strokeWidth:1.5})},{onClick:()=>h(!0),disabled:!1,label:"Cancel",hoverClass:"hover:text-status-error",icon:t.jsx(Rs,{className:"w-4 h-4",strokeWidth:1.5})},{onClick:()=>O(w=>(vt(!w),!w)),disabled:!1,label:C?"Hide panel":"Show panel",hoverClass:"hover:text-accent",icon:C?t.jsx(oe,{className:"w-4 h-4",strokeWidth:1.5}):t.jsx(le,{className:"w-4 h-4",strokeWidth:1.5})}].map(({onClick:w,disabled:H,label:xt,hoverClass:Et,icon:At})=>t.jsxs("div",{className:"relative group/tip",children:[t.jsx("button",{onClick:w,disabled:H,className:`text-text-tertiary ${Et} transition-colors disabled:opacity-40 disabled:cursor-default p-1.5 rounded-md`,children:At}),t.jsx("span",{className:"pointer-events-none absolute top-full left-1/2 -translate-x-1/2 mt-1.5 px-2 py-0.5 rounded text-2xs bg-surface-sunken text-text-primary whitespace-nowrap opacity-0 group-hover/tip:opacity-100 transition-opacity",children:xt})]},xt))}),t.jsx(Me,{src:Fe(nt.src,n),escalation:n,schema:V,onResolve:Ct,onEscalate:_t,submitAttempted:L,fill:!0})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"shrink-0 pt-8 pr-page-x",children:t.jsx(cs,{title:n.description||"Escalation",actions:Be})}),t.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto pr-page-x",children:[t.jsx(Dn,{isRoundsExhausted:Yt,payloadObj:K,isTerminal:ct,resolverPayload:dt,onRetryTriage:ze,isRetrying:c.isPending||u.isPending}),t.jsx(In,{esc:n,resolverPayload:dt,isTerminal:ct,claimedByMe:U,activeView:k,metadataFormSchema:Z,effectiveSchema:V,json:M,onJsonChange:I,requestTriage:E,onRequestTriageChange:D,triageNotes:P,onTriageNotesChange:S,onResolve:Ct,onEscalate:_t,onClaim:()=>kt(30),submitAttempted:L,isCertified:Ve,hasAI:Gt,onOpenHelp:()=>{O(!0),vt(!0),R(Y.HELP)},onDisabledClick:()=>$(w=>w+1)}),t.jsx("div",{className:"h-10"})]})]}),!wt&&t.jsx(en,{escalationContext:St(n),mode:Ue,activeView:k,onActiveViewChange:T,onClaim:kt,claimPending:c.isPending,claimNudge:v,workflowType:n.workflow_type,json:M,onResolve:Ct,resolvePending:u.isPending||u.isSuccess,resolveError:u.error,requestTriage:E,triageNotes:P,currentRole:n.role,escalationTargets:((y==null?void 0:y.targets)??[]).filter(w=>w!==n.role),onEscalate:_t,escalatePending:o.isPending,escalateError:o.error,onRelease:Xt,releasePending:c.isPending,onCancel:()=>h(!0),assignedTo:n.assigned_to,assignedUntil:n.assigned_until,onSubmitAttempt:()=>J(!0),onValidationErrors:w=>{q(w),O(!0),vt(!0),R(Y.ERRORS)}})]}),t.jsx(zs,{esc:n,schema:V,envelope:bt,payload:K,resolver:He,triage:Je??null,hasAI:Gt,claimed:pt,claimedByMe:U,isTerminal:ct,isBuilder:b,traceUrl:j,open:C,noGutter:wt,formErrors:Q,activePanel:N,onPanelChange:R}),t.jsx(ls,{open:p,onClose:()=>h(!1),onConfirm:Ye,isPending:x.isPending,error:x.error}),U&&!ct&&n.assigned_until&&t.jsx(Mn,{open:F.expiringSoon&&n.assigned_until!==st,assignedUntil:n.assigned_until,onClose:()=>lt(n.assigned_until??null),onExtend:kt,isPending:c.isPending})]})}export{dr as EscalationDetailPage};
|
|
5
|
-
//# sourceMappingURL=index-D2CfSx_x.js.map
|