@hotmeshio/long-tail 0.10.11 → 0.10.14
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/README.md +2 -4
- package/build/api/escalations/list.d.ts +1 -0
- package/build/api/escalations/list.js +1 -0
- package/build/api/escalations/metadata.d.ts +11 -0
- package/build/api/escalations/metadata.js +28 -8
- package/build/api/escalations/resolve.js +4 -4
- 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/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 +8 -0
- package/build/modules/features.js +1 -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/resolver-validation.d.ts +1 -1
- package/build/services/escalation/resolver-validation.js +12 -5
- package/build/services/escalation/sql.d.ts +11 -6
- package/build/services/escalation/sql.js +20 -20
- package/build/services/escalation/submit-guard.d.ts +29 -0
- package/build/services/escalation/submit-guard.js +57 -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 +5 -0
- package/build/shared/form-validation/index.js +5 -0
- package/build/shared/form-validation/x-lt-labels.d.ts +28 -0
- package/build/shared/form-validation/x-lt-labels.js +42 -0
- package/build/shared/form-validation/x-lt-query.d.ts +56 -0
- package/build/shared/form-validation/x-lt-query.js +49 -0
- package/build/shared/form-validation/x-lt-submit-guard.d.ts +46 -0
- package/build/shared/form-validation/x-lt-submit-guard.js +25 -0
- package/build/shared/form-validation/x-lt-submit-on-claim.d.ts +22 -0
- package/build/shared/form-validation/x-lt-submit-on-claim.js +28 -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 +232 -14
- package/build/system/mcp-servers/admin/schemas.js +50 -0
- package/build/system/seed/tool-manifests-admin.d.ts +1380 -0
- package/build/system/seed/tool-manifests-admin.js +6 -0
- 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 +6 -0
- package/dashboard/dist/assets/{AdminDashboard-CkTbRfY9.js → AdminDashboard-Chg69wlx.js} +2 -2
- package/dashboard/dist/assets/{AdminDashboard-CkTbRfY9.js.map → AdminDashboard-Chg69wlx.js.map} +1 -1
- package/dashboard/dist/assets/{AgentConfigPage-Cm8FRpXi.js → AgentConfigPage-DRTFwbfC.js} +6 -6
- package/dashboard/dist/assets/{AgentConfigPage-Cm8FRpXi.js.map → AgentConfigPage-DRTFwbfC.js.map} +1 -1
- package/dashboard/dist/assets/{AgentDetailPage-sQ1-UT46.js → AgentDetailPage-JKByfFIi.js} +3 -3
- package/dashboard/dist/assets/{AgentDetailPage-sQ1-UT46.js.map → AgentDetailPage-JKByfFIi.js.map} +1 -1
- package/dashboard/dist/assets/AgentsPage-BlgEmKhA.js +2 -0
- package/dashboard/dist/assets/{AgentsPage-bSx_mdae.js.map → AgentsPage-BlgEmKhA.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-C_7y692Q.js +2 -0
- package/dashboard/dist/assets/{AvailableEscalationsPage-8pMC7Xv6.js.map → AvailableEscalationsPage-C_7y692Q.js.map} +1 -1
- package/dashboard/dist/assets/BotPicker-CCVcz4Cq.js +2 -0
- package/dashboard/dist/assets/{BotPicker-C4uGH2x9.js.map → BotPicker-CCVcz4Cq.js.map} +1 -1
- package/dashboard/dist/assets/{CapabilitiesPage-BRoOeKcc.js → CapabilitiesPage-Czi9jUwD.js} +2 -2
- package/dashboard/dist/assets/{CapabilitiesPage-BRoOeKcc.js.map → CapabilitiesPage-Czi9jUwD.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-CIj8Adc9.js → CollapsibleSection-8YE965QX.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-CIj8Adc9.js.map → CollapsibleSection-8YE965QX.js.map} +1 -1
- package/dashboard/dist/assets/{ConfirmDeleteModal-Ugi_9Ukq.js → ConfirmDeleteModal-CQsJUzEa.js} +2 -2
- package/dashboard/dist/assets/{ConfirmDeleteModal-Ugi_9Ukq.js.map → ConfirmDeleteModal-CQsJUzEa.js.map} +1 -1
- package/dashboard/dist/assets/{CopyableId-GUEdiiL5.js → CopyableId-4Lqlc5cU.js} +2 -2
- package/dashboard/dist/assets/{CopyableId-GUEdiiL5.js.map → CopyableId-4Lqlc5cU.js.map} +1 -1
- package/dashboard/dist/assets/CountdownTimer-Bxvq3D7j.js +2 -0
- package/dashboard/dist/assets/CountdownTimer-Bxvq3D7j.js.map +1 -0
- package/dashboard/dist/assets/{CredentialsPage-B73Si6K1.js → CredentialsPage-Bn7_SX6-.js} +2 -2
- package/dashboard/dist/assets/{CredentialsPage-B73Si6K1.js.map → CredentialsPage-Bn7_SX6-.js.map} +1 -1
- package/dashboard/dist/assets/{CronLabel-Ca1aHolt.js → CronLabel-Bn4mX_Yn.js} +2 -2
- package/dashboard/dist/assets/{CronLabel-Ca1aHolt.js.map → CronLabel-Bn4mX_Yn.js.map} +1 -1
- package/dashboard/dist/assets/{CustomDurationPicker-_9E9x1YN.js → CustomDurationPicker-pMcrFyW6.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-_9E9x1YN.js.map → CustomDurationPicker-pMcrFyW6.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-NYn6TWHz.js → DropZone-zCEGjjk-.js} +2 -2
- package/dashboard/dist/assets/{DropZone-NYn6TWHz.js.map → DropZone-zCEGjjk-.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-karxia93.js → ElapsedCell-BGO7IXEg.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-karxia93.js.map → ElapsedCell-BGO7IXEg.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-CDaNmbUA.js → EscalationListSchemaPage-CFDxbd50.js} +3 -3
- package/dashboard/dist/assets/{EscalationListSchemaPage-CDaNmbUA.js.map → EscalationListSchemaPage-CFDxbd50.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationSchemaPage-k-2hFT2t.js → EscalationSchemaPage-DnXPnDkz.js} +3 -3
- package/dashboard/dist/assets/{EscalationSchemaPage-k-2hFT2t.js.map → EscalationSchemaPage-DnXPnDkz.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-C1e7IPn_.js → EscalationsOverview-BZMVXrkK.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-C1e7IPn_.js.map → EscalationsOverview-BZMVXrkK.js.map} +1 -1
- package/dashboard/dist/assets/EventTable-Bfi-f8as.js +2 -0
- package/dashboard/dist/assets/EventTable-Bfi-f8as.js.map +1 -0
- package/dashboard/dist/assets/FilterBar-Do7yR4xM.js +2 -0
- package/dashboard/dist/assets/FilterBar-Do7yR4xM.js.map +1 -0
- package/dashboard/dist/assets/{GraphInvokePage-LMpWw8z1.js → GraphInvokePage-d1ie4T7f.js} +2 -2
- package/dashboard/dist/assets/{GraphInvokePage-LMpWw8z1.js.map → GraphInvokePage-d1ie4T7f.js.map} +1 -1
- package/dashboard/dist/assets/{HomePage-Kl2DBG6l.js → HomePage-BEeodImU.js} +2 -2
- package/dashboard/dist/assets/{HomePage-Kl2DBG6l.js.map → HomePage-BEeodImU.js.map} +1 -1
- package/dashboard/dist/assets/ListToolbar-CLtw-1QN.js +2 -0
- package/dashboard/dist/assets/{ListToolbar-B2fub0DY.js.map → ListToolbar-CLtw-1QN.js.map} +1 -1
- package/dashboard/dist/assets/{McpOverview-odYnCZCC.js → McpOverview-DIsy9TB3.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-odYnCZCC.js.map → McpOverview-DIsy9TB3.js.map} +1 -1
- package/dashboard/dist/assets/{McpQueryDetailPage-BtqwHUAg.js → McpQueryDetailPage-6PomdsyD.js} +3 -3
- package/dashboard/dist/assets/{McpQueryDetailPage-BtqwHUAg.js.map → McpQueryDetailPage-6PomdsyD.js.map} +1 -1
- package/dashboard/dist/assets/McpQueryPage-YMdQCXm9.js +2 -0
- package/dashboard/dist/assets/{McpQueryPage-CPkVwNIK.js.map → McpQueryPage-YMdQCXm9.js.map} +1 -1
- package/dashboard/dist/assets/McpRunDetailPage-DsD1Gm2o.js +2 -0
- package/dashboard/dist/assets/McpRunDetailPage-DsD1Gm2o.js.map +1 -0
- package/dashboard/dist/assets/{McpRunsPage-rdpZ2yMh.js → McpRunsPage--a5Jgb33.js} +2 -2
- package/dashboard/dist/assets/{McpRunsPage-rdpZ2yMh.js.map → McpRunsPage--a5Jgb33.js.map} +1 -1
- package/dashboard/dist/assets/{Modal-Dr1Xy0j0.js → Modal-BU7No9NH.js} +2 -2
- package/dashboard/dist/assets/{Modal-Dr1Xy0j0.js.map → Modal-BU7No9NH.js.map} +1 -1
- package/dashboard/dist/assets/{NamespacePill-GwO-WfhX.js → NamespacePill-wV6L4VW1.js} +2 -2
- package/dashboard/dist/assets/{NamespacePill-GwO-WfhX.js.map → NamespacePill-wV6L4VW1.js.map} +1 -1
- package/dashboard/dist/assets/OperationsPage-B2v9k3DT.js +2 -0
- package/dashboard/dist/assets/{OperationsPage-DlyGLPAs.js.map → OperationsPage-B2v9k3DT.js.map} +1 -1
- package/dashboard/dist/assets/{OperatorDashboard-Csei5vj-.js → OperatorDashboard-CkLfbxEh.js} +2 -2
- package/dashboard/dist/assets/{OperatorDashboard-Csei5vj-.js.map → OperatorDashboard-CkLfbxEh.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeader-Bo9BU9pK.js → PageHeader-BtIr6r-8.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-Bo9BU9pK.js.map → PageHeader-BtIr6r-8.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-8_5cOSKL.js → PageHeaderWithStats-C2sGqFQG.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-8_5cOSKL.js.map → PageHeaderWithStats-C2sGqFQG.js.map} +1 -1
- package/dashboard/dist/assets/{PersonaDetailPage--ZL6Or6v.js → PersonaDetailPage-CCmOgKQb.js} +2 -2
- package/dashboard/dist/assets/{PersonaDetailPage--ZL6Or6v.js.map → PersonaDetailPage-CCmOgKQb.js.map} +1 -1
- package/dashboard/dist/assets/{PersonasPage-Bdcoay3P.js → PersonasPage-BJkSuDTN.js} +2 -2
- package/dashboard/dist/assets/{PersonasPage-Bdcoay3P.js.map → PersonasPage-BJkSuDTN.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-HrmVQq7S.js → ProcessDetailPage-DT9BlJXK.js} +2 -2
- package/dashboard/dist/assets/{ProcessDetailPage-HrmVQq7S.js.map → ProcessDetailPage-DT9BlJXK.js.map} +1 -1
- package/dashboard/dist/assets/{ProcessesListPage-_xmj6Bo-.js → ProcessesListPage-DgSGzTDT.js} +2 -2
- package/dashboard/dist/assets/{ProcessesListPage-_xmj6Bo-.js.map → ProcessesListPage-DgSGzTDT.js.map} +1 -1
- package/dashboard/dist/assets/{RoleDetailPage-C0ju2-4K.js → RoleDetailPage-DMphTvro.js} +3 -3
- package/dashboard/dist/assets/{RoleDetailPage-C0ju2-4K.js.map → RoleDetailPage-DMphTvro.js.map} +1 -1
- package/dashboard/dist/assets/{RolePill-CQlnEWkK.js → RolePill-BBYjhAPj.js} +2 -2
- package/dashboard/dist/assets/{RolePill-CQlnEWkK.js.map → RolePill-BBYjhAPj.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-CKluVSpB.js → RolesPage-gi_kaot1.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-CKluVSpB.js.map → RolesPage-gi_kaot1.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-CateuvcC.js +2 -0
- package/dashboard/dist/assets/{RunAsSelector-DdfecQ1U.js.map → RunAsSelector-CateuvcC.js.map} +1 -1
- package/dashboard/dist/assets/ScanCodesPage-CQ8RxMug.js +2 -0
- package/dashboard/dist/assets/ScanCodesPage-CQ8RxMug.js.map +1 -0
- package/dashboard/dist/assets/ScanSchemeDetailPage-puSbuxcV.js +2 -0
- package/dashboard/dist/assets/ScanSchemeDetailPage-puSbuxcV.js.map +1 -0
- package/dashboard/dist/assets/{ScopeBadge-BBYkevuR.js → ScopeBadge-xs2Nhjy4.js} +2 -2
- package/dashboard/dist/assets/{ScopeBadge-BBYkevuR.js.map → ScopeBadge-xs2Nhjy4.js.map} +1 -1
- package/dashboard/dist/assets/SegmentedTabs-DXNzY05q.js +2 -0
- package/dashboard/dist/assets/SegmentedTabs-DXNzY05q.js.map +1 -0
- 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-Cg-QdYWL.js +2 -0
- package/dashboard/dist/assets/StickyPagination-Cg-QdYWL.js.map +1 -0
- package/dashboard/dist/assets/{StreamMessageDetail-CZXWDawC.js → StreamMessageDetail-DEeuh4_-.js} +2 -2
- package/dashboard/dist/assets/{StreamMessageDetail-CZXWDawC.js.map → StreamMessageDetail-DEeuh4_-.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-fWY0gaf3.js → SwimlaneTimeline-DMY0jL2F.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-fWY0gaf3.js.map → SwimlaneTimeline-DMY0jL2F.js.map} +1 -1
- package/dashboard/dist/assets/{TagInput-CDKbslLx.js → TagInput-BMmiV-MD.js} +2 -2
- package/dashboard/dist/assets/{TagInput-CDKbslLx.js.map → TagInput-BMmiV-MD.js.map} +1 -1
- package/dashboard/dist/assets/{TaskDetailPage-BjE4G2yn.js → TaskDetailPage-CPbkIvfF.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-BjE4G2yn.js.map → TaskDetailPage-CPbkIvfF.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-G3RuYRNZ.js → TaskQueuePill-DLgYaw1x.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-G3RuYRNZ.js.map → TaskQueuePill-DLgYaw1x.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-KAhmCWB2.js → TasksListPage-CtHudKhQ.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-KAhmCWB2.js.map → TasksListPage-CtHudKhQ.js.map} +1 -1
- package/dashboard/dist/assets/TimeAgo-BdHOizWg.js +2 -0
- package/dashboard/dist/assets/{TimeAgo-C_H2TyZw.js.map → TimeAgo-BdHOizWg.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-COG_4Flg.js → TimestampCell-FVukzKRe.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-COG_4Flg.js.map → TimestampCell-FVukzKRe.js.map} +1 -1
- package/dashboard/dist/assets/{ToolPill-ChSyRJZC.js → ToolPill-BvS53hxP.js} +2 -2
- package/dashboard/dist/assets/{ToolPill-ChSyRJZC.js.map → ToolPill-BvS53hxP.js.map} +1 -1
- package/dashboard/dist/assets/{ToolTestPanel-BPdJECW0.js → ToolTestPanel-HN0OCYTL.js} +2 -2
- package/dashboard/dist/assets/{ToolTestPanel-BPdJECW0.js.map → ToolTestPanel-HN0OCYTL.js.map} +1 -1
- package/dashboard/dist/assets/{TopicDetailPage-DAqx5JqA.js → TopicDetailPage-DHdSpN61.js} +4 -4
- package/dashboard/dist/assets/{TopicDetailPage-DAqx5JqA.js.map → TopicDetailPage-DHdSpN61.js.map} +1 -1
- package/dashboard/dist/assets/TopicsPage-Clr6Tl5P.js +2 -0
- package/dashboard/dist/assets/{TopicsPage-DoGqAdPm.js.map → TopicsPage-Clr6Tl5P.js.map} +1 -1
- package/dashboard/dist/assets/UserName-BUVYyIAS.js +2 -0
- package/dashboard/dist/assets/{UserName-CKO_rk1R.js.map → UserName-BUVYyIAS.js.map} +1 -1
- package/dashboard/dist/assets/WorkflowExecutionPage-kncWFfe5.js +2 -0
- package/dashboard/dist/assets/WorkflowExecutionPage-kncWFfe5.js.map +1 -0
- package/dashboard/dist/assets/{WorkflowPill-CNbwug5p.js → WorkflowPill-BPC_Dc_I.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPill-CNbwug5p.js.map → WorkflowPill-BPC_Dc_I.js.map} +1 -1
- package/dashboard/dist/assets/WorkflowsDashboard-4ypPDGKx.js +2 -0
- package/dashboard/dist/assets/{WorkflowsDashboard-DdJ86We6.js.map → WorkflowsDashboard-4ypPDGKx.js.map} +1 -1
- package/dashboard/dist/assets/{WorkflowsOverview-ZfFBzePp.js → WorkflowsOverview-CeQlZkkd.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-ZfFBzePp.js.map → WorkflowsOverview-CeQlZkkd.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-4bd5yXdA.js → YamlWorkflowDetailPage-DLAlEzwT.js} +13 -13
- package/dashboard/dist/assets/{YamlWorkflowDetailPage-4bd5yXdA.js.map → YamlWorkflowDetailPage-DLAlEzwT.js.map} +1 -1
- package/dashboard/dist/assets/{YamlWorkflowsPage-iHPNXjQj.js → YamlWorkflowsPage-DQhenKFT.js} +2 -2
- package/dashboard/dist/assets/{YamlWorkflowsPage-iHPNXjQj.js.map → YamlWorkflowsPage-DQhenKFT.js.map} +1 -1
- package/dashboard/dist/assets/{agents-DjD5U3Wb.js → agents-s3feet3W.js} +2 -2
- package/dashboard/dist/assets/{agents-DjD5U3Wb.js.map → agents-s3feet3W.js.map} +1 -1
- package/dashboard/dist/assets/{bots-DiljVapH.js → bots-CkSd2rn9.js} +2 -2
- package/dashboard/dist/assets/{bots-DiljVapH.js.map → bots-CkSd2rn9.js.map} +1 -1
- package/dashboard/dist/assets/capabilities-DA_r09tM.js +2 -0
- package/dashboard/dist/assets/{capabilities-DV_5ghHT.js.map → capabilities-DA_r09tM.js.map} +1 -1
- package/dashboard/dist/assets/{controlplane-BKMvfWCB.js → controlplane-C9c25q21.js} +2 -2
- package/dashboard/dist/assets/{controlplane-BKMvfWCB.js.map → controlplane-C9c25q21.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-BQpCaJId.js → escalation-columns-Cp3UrT48.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-BQpCaJId.js.map → escalation-columns-Cp3UrT48.js.map} +1 -1
- package/dashboard/dist/assets/{index-BO-7S9Xw.js → index--7Vdkzwd.js} +2 -2
- package/dashboard/dist/assets/{index-BO-7S9Xw.js.map → index--7Vdkzwd.js.map} +1 -1
- package/dashboard/dist/assets/index--DG-qQBT.js +65 -0
- package/dashboard/dist/assets/index--DG-qQBT.js.map +1 -0
- package/dashboard/dist/assets/{index-BaV3l0UE.js → index-BIcYbDVf.js} +2 -2
- package/dashboard/dist/assets/{index-BaV3l0UE.js.map → index-BIcYbDVf.js.map} +1 -1
- package/dashboard/dist/assets/index-BU5FFAJo.js +2 -0
- package/dashboard/dist/assets/{index-CItsikDw.js.map → index-BU5FFAJo.js.map} +1 -1
- package/dashboard/dist/assets/{index-BsOxMMmb.js → index-Bo5TtX9l.js} +2 -2
- package/dashboard/dist/assets/{index-BsOxMMmb.js.map → index-Bo5TtX9l.js.map} +1 -1
- package/dashboard/dist/assets/{index-Tx_ETzcH.js → index-C-MmR-jf.js} +2 -2
- package/dashboard/dist/assets/{index-Tx_ETzcH.js.map → index-C-MmR-jf.js.map} +1 -1
- package/dashboard/dist/assets/index-C7ABSOU2.js +6 -0
- package/dashboard/dist/assets/index-C7ABSOU2.js.map +1 -0
- package/dashboard/dist/assets/index-Cmxzk4ay.js +5 -0
- package/dashboard/dist/assets/{index-nIrYejxe.js.map → index-Cmxzk4ay.js.map} +1 -1
- package/dashboard/dist/assets/{index-CI8rrKjx.js → index-Cw9poaez.js} +2 -2
- package/dashboard/dist/assets/{index-CI8rrKjx.js.map → index-Cw9poaez.js.map} +1 -1
- package/dashboard/dist/assets/index-DEbY57_c.js +3 -0
- package/dashboard/dist/assets/index-DEbY57_c.js.map +1 -0
- package/dashboard/dist/assets/index-DnV6LSeY.css +1 -0
- package/dashboard/dist/assets/{index-xZqQxqu2.js → index-DvoMXQqO.js} +2 -2
- package/dashboard/dist/assets/{index-xZqQxqu2.js.map → index-DvoMXQqO.js.map} +1 -1
- package/dashboard/dist/assets/{index-DhATO1cS.js → index-S13oPvuS.js} +2 -2
- package/dashboard/dist/assets/{index-DhATO1cS.js.map → index-S13oPvuS.js.map} +1 -1
- package/dashboard/dist/assets/index-WxE3ONia.js +2 -0
- package/dashboard/dist/assets/{index-CStR4uIU.js.map → index-WxE3ONia.js.map} +1 -1
- package/dashboard/dist/assets/{knowledge-BocTnSiA.js → knowledge-Bpln0zy_.js} +2 -2
- package/dashboard/dist/assets/{knowledge-BocTnSiA.js.map → knowledge-Bpln0zy_.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-C1KBjKQ_.js → mcp-BqDq3RZH.js} +2 -2
- package/dashboard/dist/assets/{mcp-C1KBjKQ_.js.map → mcp-BqDq3RZH.js.map} +1 -1
- package/dashboard/dist/assets/{mcp-query-B3cjukkA.js → mcp-query-DGue75R6.js} +2 -2
- package/dashboard/dist/assets/{mcp-query-B3cjukkA.js.map → mcp-query-DGue75R6.js.map} +1 -1
- package/dashboard/dist/assets/{personas-DiA2bJaX.js → personas-B8z_sTiJ.js} +2 -2
- package/dashboard/dist/assets/{personas-DiA2bJaX.js.map → personas-B8z_sTiJ.js.map} +1 -1
- package/dashboard/dist/assets/{pipelines-Dt2d2EFR.js → pipelines-DYgNd9nB.js} +2 -2
- package/dashboard/dist/assets/{pipelines-Dt2d2EFR.js.map → pipelines-DYgNd9nB.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-cDh2hNml.js → tasks-CJdjjhgO.js} +2 -2
- package/dashboard/dist/assets/{tasks-cDh2hNml.js.map → tasks-CJdjjhgO.js.map} +1 -1
- package/dashboard/dist/assets/{topics-yFlGF-u1.js → topics-DPrL8Dtq.js} +2 -2
- package/dashboard/dist/assets/{topics-yFlGF-u1.js.map → topics-DPrL8Dtq.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-D2R_ckS8.js → useEventHooks-DXCgDgiu.js} +2 -2
- package/dashboard/dist/assets/{useEventHooks-D2R_ckS8.js.map → useEventHooks-DXCgDgiu.js.map} +1 -1
- package/dashboard/dist/assets/{useFilterParams-B7suPsIK.js → useFilterParams-crmlBw_l.js} +2 -2
- package/dashboard/dist/assets/{useFilterParams-B7suPsIK.js.map → useFilterParams-crmlBw_l.js.map} +1 -1
- package/dashboard/dist/assets/{useNamespace-u-V1GVUD.js → useNamespace-DnFZfy7N.js} +2 -2
- package/dashboard/dist/assets/{useNamespace-u-V1GVUD.js.map → useNamespace-DnFZfy7N.js.map} +1 -1
- package/dashboard/dist/assets/{useYamlActivityEvents-BhOZeqgE.js → useYamlActivityEvents-kx5CLENv.js} +2 -2
- package/dashboard/dist/assets/{useYamlActivityEvents-BhOZeqgE.js.map → useYamlActivityEvents-kx5CLENv.js.map} +1 -1
- package/dashboard/dist/assets/{users-BoXPwdee.js → users-DKng7vAG.js} +2 -2
- package/dashboard/dist/assets/{users-BoXPwdee.js.map → users-DKng7vAG.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-D71XjkNy.js → vendor-icons-CN-bAo9U.js} +144 -134
- package/dashboard/dist/assets/vendor-icons-CN-bAo9U.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-C1YOyCSV.js → vendor-react-CdqEC2zv.js} +2 -2
- package/dashboard/dist/assets/{vendor-react-C1YOyCSV.js.map → vendor-react-CdqEC2zv.js.map} +1 -1
- package/dashboard/dist/assets/{workflows-mCoyKuLZ.js → workflows-C4V0rMkM.js} +2 -2
- package/dashboard/dist/assets/{workflows-mCoyKuLZ.js.map → workflows-C4V0rMkM.js.map} +1 -1
- package/dashboard/dist/assets/{yaml-workflows-CWxXGDpn.js → yaml-workflows-D3PAiJ9d.js} +2 -2
- package/dashboard/dist/assets/{yaml-workflows-CWxXGDpn.js.map → yaml-workflows-D3PAiJ9d.js.map} +1 -1
- package/dashboard/dist/index.html +5 -5
- package/docs/design-principles.md +9 -7
- package/docs/hitl/x-lt-embed.md +8 -4
- package/docs/hitl/x-lt-footer.md +68 -0
- package/docs/hitl/x-lt-list-schema.md +10 -3
- package/docs/hitl/x-lt-transition.md +105 -0
- package/docs/hitl-guide.md +9 -0
- package/docs/scan-codes.md +243 -0
- package/package.json +2 -2
- package/dashboard/dist/assets/AgentsPage-bSx_mdae.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-8pMC7Xv6.js +0 -2
- package/dashboard/dist/assets/BotPicker-C4uGH2x9.js +0 -2
- package/dashboard/dist/assets/CountdownTimer-D3t0XMhE.js +0 -2
- package/dashboard/dist/assets/CountdownTimer-D3t0XMhE.js.map +0 -1
- package/dashboard/dist/assets/EventTable-CIrrtL7_.js +0 -2
- package/dashboard/dist/assets/EventTable-CIrrtL7_.js.map +0 -1
- package/dashboard/dist/assets/FilterBar-CzjtH74v.js +0 -2
- package/dashboard/dist/assets/FilterBar-CzjtH74v.js.map +0 -1
- package/dashboard/dist/assets/ListToolbar-B2fub0DY.js +0 -2
- package/dashboard/dist/assets/McpQueryPage-CPkVwNIK.js +0 -2
- package/dashboard/dist/assets/McpRunDetailPage-D-Rz9MRw.js +0 -2
- package/dashboard/dist/assets/McpRunDetailPage-D-Rz9MRw.js.map +0 -1
- package/dashboard/dist/assets/OperationsPage-DlyGLPAs.js +0 -2
- package/dashboard/dist/assets/RunAsSelector-DdfecQ1U.js +0 -2
- package/dashboard/dist/assets/StickyPagination-cLddIdtT.js +0 -2
- package/dashboard/dist/assets/StickyPagination-cLddIdtT.js.map +0 -1
- package/dashboard/dist/assets/TimeAgo-C_H2TyZw.js +0 -2
- package/dashboard/dist/assets/TopicsPage-DoGqAdPm.js +0 -2
- package/dashboard/dist/assets/UserName-CKO_rk1R.js +0 -2
- package/dashboard/dist/assets/WorkflowExecutionPage-D3VQ9iQV.js +0 -2
- package/dashboard/dist/assets/WorkflowExecutionPage-D3VQ9iQV.js.map +0 -1
- package/dashboard/dist/assets/WorkflowsDashboard-DdJ86We6.js +0 -2
- package/dashboard/dist/assets/capabilities-DV_5ghHT.js +0 -2
- package/dashboard/dist/assets/index-B-WkiNRN.js +0 -6
- package/dashboard/dist/assets/index-B-WkiNRN.js.map +0 -1
- package/dashboard/dist/assets/index-CItsikDw.js +0 -2
- package/dashboard/dist/assets/index-CStR4uIU.js +0 -2
- package/dashboard/dist/assets/index-DbTD-dio.js +0 -63
- package/dashboard/dist/assets/index-DbTD-dio.js.map +0 -1
- package/dashboard/dist/assets/index-DnlsDaAw.css +0 -1
- package/dashboard/dist/assets/index-kzIIeVbx.js +0 -5
- package/dashboard/dist/assets/index-kzIIeVbx.js.map +0 -1
- package/dashboard/dist/assets/index-nIrYejxe.js +0 -5
- package/dashboard/dist/assets/vendor-icons-D71XjkNy.js.map +0 -1
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Scan Codes
|
|
2
|
+
|
|
3
|
+
A code printed on a physical object drives the platform from the factory
|
|
4
|
+
floor. Scanning it locates the object's digital twin — the escalation row
|
|
5
|
+
that represents it — checks the twin is in an expected queue and state, and
|
|
6
|
+
runs a configured action: open it, claim it, resolve it with a canned
|
|
7
|
+
payload, re-home it to another queue, or cancel it. The whole gesture is one
|
|
8
|
+
scan on an iPad with a paired scanner.
|
|
9
|
+
|
|
10
|
+
The escalation surface makes this tractable. Every work item lives in a role
|
|
11
|
+
queue with a small set of states, a universal metadata query language, and a
|
|
12
|
+
canonical action surface. A scan is an **ECA rule** over that surface:
|
|
13
|
+
|
|
14
|
+
- **Event** — a code arrives from an input source.
|
|
15
|
+
- **Condition** — an ordered list of queries against the queue
|
|
16
|
+
(role, status, availability, metadata facets).
|
|
17
|
+
- **Action** — the platform verb the first matching query runs.
|
|
18
|
+
|
|
19
|
+
## Contents
|
|
20
|
+
|
|
21
|
+
- [The code](#the-code)
|
|
22
|
+
- [Schemes](#schemes)
|
|
23
|
+
- [Rules and steps](#rules-and-steps)
|
|
24
|
+
- [Confirmation](#confirmation)
|
|
25
|
+
- [The fallback screen](#the-fallback-screen)
|
|
26
|
+
- [Executing a scan](#executing-a-scan)
|
|
27
|
+
- [Capture on the dashboard](#capture-on-the-dashboard)
|
|
28
|
+
- [Scanner setup](#scanner-setup)
|
|
29
|
+
- [Admin configuration](#admin-configuration)
|
|
30
|
+
- [The printer demo](#the-printer-demo)
|
|
31
|
+
|
|
32
|
+
## The code
|
|
33
|
+
|
|
34
|
+
A scan code encodes three parts: `version : category : target`.
|
|
35
|
+
|
|
36
|
+
| Part | Width | Meaning |
|
|
37
|
+
|------|-------|---------|
|
|
38
|
+
| version | 2 digits (10–99) | Selects the **scheme** — what the target identifies and how the code parses. Two digits so a code never starts with a leading zero. |
|
|
39
|
+
| category | 1 digit (0–9) | Selects the **rule** — what scanning this code does |
|
|
40
|
+
| target | scheme-defined | The value matched against the scheme's metadata facet |
|
|
41
|
+
|
|
42
|
+
`10:1:75949975930` reads: scheme 10, rule 1, target `75949975930`.
|
|
43
|
+
|
|
44
|
+
Both indices are assigned automatically as you add named entries — operators
|
|
45
|
+
name schemes and actions, never pick numbers.
|
|
46
|
+
|
|
47
|
+
## Schemes
|
|
48
|
+
|
|
49
|
+
A scheme (`lt_config_scan_schemes`, indexed 10–99) declares:
|
|
50
|
+
|
|
51
|
+
- **`target_facet`** — the escalation metadata key the target resolves
|
|
52
|
+
against (`serialNumber`, `assetTag`, `batchId`…). The physical label and
|
|
53
|
+
the digital twin share this value; the scan is the join.
|
|
54
|
+
- **`encoding`** — how the code string parses:
|
|
55
|
+
- `delimited` — text separated by a single character (default `:`), e.g.
|
|
56
|
+
`10:1:SN-123`. Use with Code 128, QR, or DataMatrix labels; targets may
|
|
57
|
+
be any text.
|
|
58
|
+
- `fixed` — digits only with a declared target width, e.g.
|
|
59
|
+
`1015949975930`. Fits UPC-A/EAN/ITF labels; a trailing check digit is
|
|
60
|
+
accepted. Two digits of version + one of category + `target_length`
|
|
61
|
+
digits of target.
|
|
62
|
+
|
|
63
|
+
## Rules and steps
|
|
64
|
+
|
|
65
|
+
A rule (`lt_config_scan_actions`) is a friendly name — print it beside the
|
|
66
|
+
physical code — plus an **ordered list of steps** and a fallback. Execution
|
|
67
|
+
walks the steps; the first step whose query matches runs its verb and
|
|
68
|
+
answers.
|
|
69
|
+
|
|
70
|
+
Each step:
|
|
71
|
+
|
|
72
|
+
```jsonc
|
|
73
|
+
{
|
|
74
|
+
"query": {
|
|
75
|
+
"roles": ["printer-fleet"], // expected queue(s)
|
|
76
|
+
"status": "pending", // pending | resolved | cancelled
|
|
77
|
+
"availability": "available", // available | claimed | mine | any
|
|
78
|
+
"facets": { "state": "printing" } // extra metadata guards
|
|
79
|
+
},
|
|
80
|
+
"cardinality": "first", // first | many
|
|
81
|
+
"verb": "resolve",
|
|
82
|
+
"confirm": { "prompt": "…?" }, // optional user confirmation
|
|
83
|
+
"params": { /* verb-specific */ }
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Verbs are the canonical escalation actions:
|
|
88
|
+
|
|
89
|
+
| Verb | Effect | Params |
|
|
90
|
+
|------|--------|--------|
|
|
91
|
+
| `show-detail` | Open the item's detail page | — |
|
|
92
|
+
| `show-list` | Open the list filtered to all matches | — |
|
|
93
|
+
| `claim` / `claim-show-detail` | Atomic claim (and open) | `durationMinutes`, `metadata` |
|
|
94
|
+
| `release` | Release the caller's own claim | — |
|
|
95
|
+
| `resolve` | Atomic claim + resolve with a canned payload | `resolverPayload`, `metadata` |
|
|
96
|
+
| `escalate` | Create an escalation in another queue, optionally closing the located one | `targetRole`, `closeCurrent`, `escalationType`, `description`, `metadata` |
|
|
97
|
+
| `cancel` | Claim-as-lock, then cancel | — |
|
|
98
|
+
|
|
99
|
+
String values inside `resolverPayload` and `metadata` interpolate
|
|
100
|
+
`{scan.target}`, `{scan.category}`, and `{scan.scannedAt}`. Every mutating
|
|
101
|
+
verb stamps provenance facets onto the row it touches — `scanScheme`,
|
|
102
|
+
`scanCategory`, `scanActionName`, `scannedAt` — so scan-driven transitions
|
|
103
|
+
stay queryable.
|
|
104
|
+
|
|
105
|
+
Ordering is the power move: put the expected state first and a broad
|
|
106
|
+
`show-detail` last. A machine whose twin is in the wrong queue still answers
|
|
107
|
+
the scan — with where the twin actually is. **The scan is also a state
|
|
108
|
+
query.**
|
|
109
|
+
|
|
110
|
+
Mutations are atomic. Claim, resolve, and cancel ride the single-statement
|
|
111
|
+
by-metadata operations; the caller's role scope folds into the same SQL
|
|
112
|
+
filter as the step's role guard. Two people scanning the same code
|
|
113
|
+
concurrently produce exactly one transition — the second scan reports a
|
|
114
|
+
conflict or falls through to the locator step.
|
|
115
|
+
|
|
116
|
+
## Confirmation
|
|
117
|
+
|
|
118
|
+
A step carrying `confirm` locates instead of acting. The scan answers
|
|
119
|
+
`confirm_required` with the located escalation and a pending-action
|
|
120
|
+
descriptor; the dashboard opens the item's detail page and raises the
|
|
121
|
+
rule's prompt ("Cancel this printer's current state and send it home to
|
|
122
|
+
servicing?"). Confirming fires the standard per-id endpoint — the same
|
|
123
|
+
guarded call every other surface uses.
|
|
124
|
+
|
|
125
|
+
## The fallback screen
|
|
126
|
+
|
|
127
|
+
When no step matches, the response carries the rule's `fallback`: markdown
|
|
128
|
+
for the operator ("**No twin found for this serial.** Register it through
|
|
129
|
+
the onboarding surface…") and optionally a route to land on. The scan panel
|
|
130
|
+
renders the markdown; a configured route navigates.
|
|
131
|
+
|
|
132
|
+
## Executing a scan
|
|
133
|
+
|
|
134
|
+
`POST /api/scan-codes/execute` takes `{ "code": "10:1:SN-123" }` and runs
|
|
135
|
+
as the calling user under normal RBAC. Every terminal state is a structured
|
|
136
|
+
200 outcome:
|
|
137
|
+
|
|
138
|
+
| Outcome | Meaning |
|
|
139
|
+
|---------|---------|
|
|
140
|
+
| `executed` | A step matched and its action ran |
|
|
141
|
+
| `matched_list` | A `show-list` step matched; `escalations` + `listQuery` included |
|
|
142
|
+
| `confirm_required` | A confirm step located its target; `pendingAction` included |
|
|
143
|
+
| `no_match_fallback` | No step matched; `fallback` included |
|
|
144
|
+
| `unconfigured` | Unknown or disabled scheme version / category |
|
|
145
|
+
| `invalid_code` | The string parses under no enabled scheme |
|
|
146
|
+
| `forbidden` | The caller's roles bar the matched action |
|
|
147
|
+
| `conflict` | A concurrent actor won the row |
|
|
148
|
+
|
|
149
|
+
The endpoint is source-agnostic — anything that produces a string can drive
|
|
150
|
+
it: a barcode scanner, an RFID reader, a camera decode, an MCP tool
|
|
151
|
+
(`execute_scan_code`), or a curl.
|
|
152
|
+
|
|
153
|
+
## Capture on the dashboard
|
|
154
|
+
|
|
155
|
+
Scan surfaces are **opt-in**. The deployment turns them on with
|
|
156
|
+
`features.scanCodes: true` in the `start()` config (default false, like every
|
|
157
|
+
`features` flag surfaced through `/api/settings`); when on, every persona
|
|
158
|
+
gets the header scan affordance, the panel, and the global capture. The
|
|
159
|
+
easter-egg Features panel carries a local **Scan input** override to test
|
|
160
|
+
either state on one browser. The execute and config APIs work regardless —
|
|
161
|
+
the flag gates the dashboard surface.
|
|
162
|
+
|
|
163
|
+
When enabled, the dashboard listens for scans globally — any page, any focus
|
|
164
|
+
state. A scanner paired as an HID keyboard "types" its decode and finishes
|
|
165
|
+
with Enter; capture is **pattern-anchored**: a capture-phase window listener
|
|
166
|
+
accumulates keystrokes freely, and when the terminator arrives it checks
|
|
167
|
+
whether the recent keys end with a scan-code shape
|
|
168
|
+
(`[1-9][0-9]:[0-9]:target` or the digits-only fixed form).
|
|
169
|
+
|
|
170
|
+
- On a match, the terminator is swallowed, the code's characters are
|
|
171
|
+
stripped back out of whatever editable held focus (byte-exact, at the
|
|
172
|
+
cursor), and the code executes. Cursor focus never diverts a scan.
|
|
173
|
+
- Scanner pacing is irrelevant: slow Bluetooth HID links, Shift-chorded
|
|
174
|
+
capitals and colons, and mid-burst stalls all capture, because nothing has
|
|
175
|
+
to be recognized mid-flight. The one tunable is the **key gap limit**
|
|
176
|
+
(default 500 ms in the scan panel) separating distinct typing episodes.
|
|
177
|
+
- Typing a valid code and pressing Enter fires it too, anywhere — that is
|
|
178
|
+
the contract: the scanner is a keyboard, so the keyboard is a scanner.
|
|
179
|
+
- Scanners with no suffix programmed work through **quiet-period auto-fire**:
|
|
180
|
+
a full code shape typed at scanner speed (avg ≤ 50 ms/key) followed by
|
|
181
|
+
300 ms of silence fires without a terminator. Hand-typed codes never
|
|
182
|
+
auto-fire — humans type slower than the ceiling; they submit on Enter.
|
|
183
|
+
- Delimited targets carry `a-z A-Z 0-9 . _ -`; lowercase is the recommended
|
|
184
|
+
label vocabulary. Case is preserved — metadata matching is case-sensitive.
|
|
185
|
+
|
|
186
|
+
Capture sources are pluggable (`dashboard/src/lib/scan-sources/`): the
|
|
187
|
+
keyboard wedge is one provider behind a `ScanSource` contract; an RFID or
|
|
188
|
+
camera provider plugs into the same dispatch pipeline.
|
|
189
|
+
|
|
190
|
+
The **scan panel** (barcode button in the header) carries a manual entry
|
|
191
|
+
field — type or paste a code to execute it with zero hardware — the last
|
|
192
|
+
scan's outcome, and the capture settings.
|
|
193
|
+
|
|
194
|
+
## Scanner setup
|
|
195
|
+
|
|
196
|
+
Any keyboard-wedge scanner works as shipped, over USB or Bluetooth HID, with
|
|
197
|
+
any symbology it decodes (UPC-A/EAN, Code 128, QR, DataMatrix, PDF417). The
|
|
198
|
+
decoded string arrives as keystrokes regardless of symbology, so `delimited`
|
|
199
|
+
codes print colons literally.
|
|
200
|
+
|
|
201
|
+
An **Enter suffix** on the scanner gives the crispest capture (the code
|
|
202
|
+
fires the instant the suffix arrives); scanners without one fire after the
|
|
203
|
+
quiet period. The scan panel's diagnostics view traces every keydown the
|
|
204
|
+
capture sees — the tool for pinning any scanner's stream shape.
|
|
205
|
+
|
|
206
|
+
Label guidance: QR or DataMatrix survive small corner labels and floor
|
|
207
|
+
grime best; Code 128 suits wider flat labels; `fixed` encoding packs into
|
|
208
|
+
UPC-A where numeric-only labels are already in circulation.
|
|
209
|
+
|
|
210
|
+
## Admin configuration
|
|
211
|
+
|
|
212
|
+
**Admin → Scan Codes** lists your schemes. Add a scheme, name it, and point it
|
|
213
|
+
at a target facet — its two-digit index is assigned for you. A scheme's detail
|
|
214
|
+
page lists its actions; **Add an action** opens the rule editor:
|
|
215
|
+
|
|
216
|
+
1. **Name it** — the friendly label printed beside the physical code.
|
|
217
|
+
2. **Order the conditions** — each step picks a queue, a held-by filter,
|
|
218
|
+
and its action; steps reorder with arrows. First match wins.
|
|
219
|
+
3. **Set the fallback** — markdown for the no-match screen.
|
|
220
|
+
|
|
221
|
+
The same CRUD rides `PUT/GET/DELETE /api/scan-codes/schemes/:version[/actions/:category]`
|
|
222
|
+
(admin) and the admin MCP tools `list_scan_schemes`, `upsert_scan_scheme`,
|
|
223
|
+
`upsert_scan_rule`, `delete_scan_rule`, `execute_scan_code`. Incoherent
|
|
224
|
+
rules fail the write with the exact problem — an `escalate` step names its
|
|
225
|
+
`targetRole`, a `resolve` step carries its payload.
|
|
226
|
+
|
|
227
|
+
## The printer demo
|
|
228
|
+
|
|
229
|
+
The example seed (`examples/seed-scan-codes.ts`) configures scheme 10 over
|
|
230
|
+
the [printer-twin](../examples/workflows/printer-twin/) farm: the target
|
|
231
|
+
facet is the twin's `serialNumber`, and four rules map to the four corners
|
|
232
|
+
of each machine:
|
|
233
|
+
|
|
234
|
+
| Corner | Code | Rule |
|
|
235
|
+
|--------|------|------|
|
|
236
|
+
| upper-left | `10:0:<serial>` | **Send Printer Home** — cancel the twin's fleet row (confirmed); the twin escalates to its service surface |
|
|
237
|
+
| upper-right | `10:1:<serial>` | **Collect Print** — resolve the in-flight `printing` row as success |
|
|
238
|
+
| lower-right | `10:2:<serial>` | **Print Failed** — resolve the `printing` row as fail; plate cleared, machine reset |
|
|
239
|
+
| lower-left | `10:3:<serial>` | **Offline for Service** — cancel the fleet row and open a service item in the servicer queue |
|
|
240
|
+
|
|
241
|
+
Each rule ends on a broad `show-detail` and the "no twin found" fallback.
|
|
242
|
+
Walk it hardware-free: run the twin farm, open the scan panel, and paste
|
|
243
|
+
`10:1:<a-printing-serial>`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hotmeshio/long-tail",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.14",
|
|
4
4
|
"description": "Long Tail Workflows — Durable AI workflows with human-in-the-loop escalation. Powered by PostgreSQL.",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@anthropic-ai/sdk": "^0.92.0",
|
|
73
73
|
"@aws-sdk/client-s3": "^3.1017.0",
|
|
74
74
|
"@aws-sdk/s3-request-presigner": "^3.1045.0",
|
|
75
|
-
"@hotmeshio/hotmesh": "^0.
|
|
75
|
+
"@hotmeshio/hotmesh": "^0.27.0",
|
|
76
76
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
77
77
|
"@opentelemetry/exporter-trace-otlp-proto": "^0.215.0",
|
|
78
78
|
"@opentelemetry/resources": "^2.5.1",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./vendor-query-B2UbickB.js";import{u as f}from"./agents-DjD5U3Wb.js";import{u as b,j,b as v}from"./index-DbTD-dio.js";import{j as N}from"./useEventHooks-D2R_ckS8.js";import{u as y}from"./useFilterParams-B7suPsIK.js";import{b as P}from"./api-path-u2Jf9QXS.js";import{D as w}from"./DataTable-BTu2AaEl.js";import{S}from"./StickyPagination-cLddIdtT.js";import{F as k,b as A}from"./FilterBar-CzjtH74v.js";import{P as _}from"./PageHeader-Bo9BU9pK.js";import{L as C}from"./ListToolbar-B2fub0DY.js";import{d as F}from"./vendor-icons-D71XjkNy.js";import{u as z}from"./vendor-react-C1YOyCSV.js";import"./EmptyState-BcsfPq9T.js";const L=[{value:"active",label:"Active"},{value:"inactive",label:"Inactive"},{value:"paused",label:"Paused"},{value:"error",label:"Error"}],T=[{key:"name",label:"Agent",render:e=>t.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[t.jsx("span",{className:`w-2.5 h-2.5 rounded-full dot-ring shrink-0 ${e.status==="active"?"bg-status-success":e.status==="paused"?"bg-status-warning":e.status==="error"?"bg-status-error":"bg-surface-border"}`}),t.jsx("span",{className:"text-xs font-medium text-text-primary whitespace-nowrap",children:e.id}),e.description&&t.jsx("p",{className:"flex-1 min-w-0 truncate text-2xs text-text-tertiary",children:e.description})]})},{key:"knowledge_domain",label:"Knowledge",render:e=>e.knowledge_domain?t.jsx("span",{className:"text-2xs font-mono text-text-secondary whitespace-nowrap",children:e.knowledge_domain}):t.jsx("span",{className:"text-text-quaternary",children:"—"}),className:"w-28"},{key:"schedules",label:"Schedules",render:e=>{var r,o;const s=(r=e.behaviors)==null?void 0:r.schedules,a=s!=null&&s.length?s.map(c=>c.cron):(o=e.behaviors)!=null&&o.cron?[e.behaviors.cron]:[];return a.length?t.jsxs("span",{className:"text-2xs font-mono text-text-secondary whitespace-nowrap",children:[a[0],a.length>1?` +${a.length-1}`:""]}):t.jsx("span",{className:"text-text-quaternary",children:"—"})},className:"w-28"},{key:"subscriptions",label:"Subscriptions",render:e=>{var o;const s=e.subscription_count??0,a=e.sub_topics??[];if(!s)return t.jsx("span",{className:"text-text-quaternary",children:"—"});const r=((o=a[0])==null?void 0:o.replace(/^lt\.events\./,""))??"";return t.jsxs("span",{className:"text-2xs font-mono text-text-secondary whitespace-nowrap",children:[r,s>1?` +${s-1}`:""]})},className:"w-36"},{key:"last_run_at",label:"Last Run",render:e=>e.last_run_at?t.jsx("span",{className:"whitespace-nowrap",children:t.jsx(v,{date:e.last_run_at})}):t.jsx("span",{className:"text-text-quaternary",children:"—"}),className:"w-32"}];function J(){var p;const e=z(),{data:s}=b(),a=j(),r=a!==null?a:!!((p=s==null?void 0:s.ai)!=null&&p.enabled),o=r?"Agent":"Automation",c=r?"Agents":"Automations";N();const{filters:u,setFilter:d,pagination:n}=y({filters:{status:""}}),{data:i,isLoading:x,refetch:g,isFetching:h}=f({status:u.status||void 0,limit:n.pageSize,offset:n.offset}),m=(i==null?void 0:i.total)??0;return t.jsxs("div",{children:[t.jsx(_,{title:c,docsHash:"#docs:agents.md",actions:t.jsxs("button",{onClick:()=>e("/agents/new"),className:"flex items-center gap-2 px-4 py-2 text-sm rounded-md bg-accent text-text-inverse hover:bg-accent-hover transition-colors",children:[t.jsx(F,{className:"w-4 h-4"})," Create ",o]})}),t.jsx(k,{actions:t.jsx(C,{onRefresh:()=>g(),isFetching:h,apiPath:P("/agents",{limit:n.pageSize,offset:n.offset,status:u.status||void 0})}),children:t.jsx(A,{label:"Status",value:u.status,onChange:l=>d("status",l),options:L})}),t.jsx(w,{columns:T,data:(i==null?void 0:i.agents)??[],keyFn:l=>l.id,onRowClick:l=>e(`/agents/${l.id}`),isLoading:x,emptyMessage:`No ${c.toLowerCase()} found`}),t.jsx(S,{page:n.page,totalPages:n.totalPages(m),onPageChange:n.setPage,total:m,pageSize:n.pageSize,onPageSizeChange:n.setPageSize})]})}export{J as AgentsPage};
|
|
2
|
-
//# sourceMappingURL=AgentsPage-bSx_mdae.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as e,a as g}from"./vendor-query-B2UbickB.js";import{u as Tt,j as Ot,k as Ke,m as Re,p as Ft,w as _t,l as $t,n as Bt,o as Lt,q as Rt,r as zt,s as qt,t as Dt,g as It,v as Vt,x as Ut,y as Gt,z as Ht,A as Jt,B as Qt,E as Kt,G as Wt,H as Xt,I as Yt,K as Zt,L as es,M as ts,O as ss}from"./index-DbTD-dio.js";import{i as as}from"./task-queues-7-sHKPsN.js";import{f as ns}from"./useEventHooks-D2R_ckS8.js";import{X as ae,aa as rs,ab as ls,C as is,a as os,ac as cs,ad as ds,s as us,r as xs,ae as ms,B as hs,af as ze,ag as ps,ah as fs,P as gs,f as bs,ai as ys}from"./vendor-icons-D71XjkNy.js";import{u as pe,C as We,a as js}from"./CustomDurationPicker-_9E9x1YN.js";import{m as vs,E as Ns,a as Cs}from"./escalation-columns-BQpCaJId.js";import{i as ks,E as ws}from"./CountdownTimer-D3t0XMhE.js";import{u as Ss}from"./useFilterParams-B7suPsIK.js";import{u as Xe}from"./useDebouncedValue-BA5S7V54.js";import{b as Ps}from"./api-path-u2Jf9QXS.js";import{D as Ms}from"./DataTable-BTu2AaEl.js";import{S as Es}from"./StickyPagination-cLddIdtT.js";import{P as As}from"./constants-BHkpVaqx.js";import{M as fe}from"./Modal-Dr1Xy0j0.js";import{u as Ts}from"./users-BoXPwdee.js";import{R as Os,a as Fs}from"./RowActions-BA9L9djf.js";import{L as _s}from"./ListToolbar-B2fub0DY.js";import{L as qe,u as $s,f as Bs,a as Ls}from"./vendor-react-C1YOyCSV.js";import"./FilterBar-CzjtH74v.js";import"./PriorityBadge-CCERr9vQ.js";import"./RolePill-CQlnEWkK.js";import"./WorkflowPill-CNbwug5p.js";import"./StatusBadge-BwUvykDo.js";import"./EmptyState-BcsfPq9T.js";const Rs=["<","<=",">",">=","="],zs=["priority","created_at","updated_at","status","role"],D="input text-xs py-1",De="select text-xs py-1",te="text-text-tertiary hover:text-text-primary transition-colors";function Ie(t){return t==="true"?!0:t==="false"?!1:t.trim()!==""&&!Number.isNaN(Number(t))?Number(t):t}const qs=t=>Object.entries(t??{}).map(([s,o])=>({key:s,value:String(o)})),Ds=t=>(t??[]).map(s=>{const[o,l]=Object.entries(s)[0]??["",""];return{key:o,value:String(l)}});function z({title:t,hint:s,children:o}){return e.jsxs("div",{className:"border-t border-surface-border/50 py-3 first:border-t-0 first:pt-1",children:[e.jsxs("div",{className:"mb-1.5 flex items-baseline justify-between",children:[e.jsx("span",{className:"text-2xs font-medium uppercase tracking-wide text-text-tertiary",children:t}),s&&e.jsx("span",{className:"text-2xs font-mono text-text-tertiary/70",children:s})]}),o]})}function se({value:t,onChange:s,placeholder:o}){return e.jsx("input",{list:"lt-facet-keys",className:`${D} w-40`,placeholder:o,value:t,onChange:l=>s(l.target.value)})}function Is({value:t,onChange:s,facetKeys:o=[],search:l="",onSearchChange:p}){const x=qs(t.facets),m=Ds(t.block),h=t.range??[],i=t.exists??[],f=t.orderBy??[],C=r=>{const u={};for(const c of r)c.key&&(u[c.key]=Ie(c.value));s({...t,facets:Object.keys(u).length?u:void 0})},S=r=>{const u=r.filter(c=>c.key).map(c=>({[c.key]:Ie(c.value)}));s({...t,block:u.length?u:void 0})},M=r=>s({...t,range:r.length?r:void 0}),j=r=>s({...t,exists:r.length?r:void 0}),k=r=>s({...t,orderBy:r.length?r:void 0});return e.jsxs("div",{className:"text-xs",children:[e.jsx("datalist",{id:"lt-facet-keys",children:o.map(r=>e.jsx("option",{value:r},r))}),e.jsxs("datalist",{id:"lt-sort-fields",children:[zs.map(r=>e.jsx("option",{value:r},r)),o.map(r=>e.jsx("option",{value:`metadata.${r}`},r))]}),p&&e.jsx(z,{title:"Match id",hint:"id · workflow · origin",children:e.jsx("input",{className:`${D} w-full`,placeholder:"Exact escalation, workflow, or origin id…",value:l,onChange:r=>p(r.target.value)})}),e.jsx(z,{title:"Has facet",hint:"metadata @>",children:[...x,{key:"",value:""}].map((r,u)=>e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx(se,{value:r.key,placeholder:"key",onChange:c=>{const d=[...x];d[u]={...r,key:c},C(d)}}),e.jsx("span",{className:"text-text-tertiary",children:"="}),e.jsx("input",{className:`${D} w-40`,placeholder:"value",value:r.value,onChange:c=>{const d=[...x];d[u]={...r,value:c.target.value},C(d)}}),u<x.length&&e.jsx("button",{className:te,onClick:()=>C(x.filter((c,d)=>d!==u)),children:"×"})]},u))}),e.jsx(z,{title:"Range",hint:"numeric",children:[...h,{facet:"",op:"<=",value:0}].map((r,u)=>e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx(se,{value:r.facet,placeholder:"numeric facet",onChange:c=>{const d=[...h];d[u]={...r,facet:c},M(d.filter(a=>a.facet))}}),e.jsx("select",{className:De,value:r.op,onChange:c=>{const d=[...h];d[u]={...r,op:c.target.value},M(d.filter(a=>a.facet))},children:Rs.map(c=>e.jsx("option",{value:c,children:c},c))}),e.jsx("input",{type:"number",className:`${D} w-24`,value:r.value,onChange:c=>{const d=[...h];d[u]={...r,value:Number(c.target.value)},M(d.filter(a=>a.facet))}}),u<h.length&&e.jsx("button",{className:te,onClick:()=>M(h.filter((c,d)=>d!==u)),children:"×"})]},u))}),e.jsx(z,{title:"Has key",hint:"metadata ? key",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[i.map(r=>e.jsxs("span",{className:"flex items-center gap-1 rounded bg-accent/15 px-1.5 py-0.5 text-accent",children:[r,e.jsx("button",{className:"text-accent/70 hover:text-accent",onClick:()=>j(i.filter(u=>u!==r)),children:"×"})]},r)),e.jsx(se,{value:"",placeholder:"+ key",onChange:r=>{r&&!i.includes(r)&&j([...i,r])}})]})}),e.jsx(z,{title:"Exclude",hint:"NOT @>",children:[...m,{key:"",value:""}].map((r,u)=>e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx(se,{value:r.key,placeholder:"key",onChange:c=>{const d=[...m];d[u]={...r,key:c},S(d)}}),e.jsx("span",{className:"text-text-tertiary",children:"="}),e.jsx("input",{className:`${D} w-40`,placeholder:"value",value:r.value,onChange:c=>{const d=[...m];d[u]={...r,value:c.target.value},S(d)}}),u<m.length&&e.jsx("button",{className:te,onClick:()=>S(m.filter((c,d)=>d!==u)),children:"×"})]},u))}),e.jsx(z,{title:"Sort by",children:[...f,{field:"",direction:"asc"}].map((r,u)=>e.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[e.jsx("input",{list:"lt-sort-fields",className:`${D} w-44`,placeholder:"column or metadata.key",value:r.field,onChange:c=>{const d=[...f];d[u]={...r,field:c.target.value},k(d.filter(a=>a.field))}}),e.jsxs("select",{className:De,value:r.direction??"asc",onChange:c=>{const d=[...f];d[u]={...r,direction:c.target.value},k(d.filter(a=>a.field))},children:[e.jsx("option",{value:"asc",children:"asc"}),e.jsx("option",{value:"desc",children:"desc"})]}),e.jsxs("label",{className:"flex items-center gap-1 text-text-tertiary",children:[e.jsx("input",{type:"checkbox",checked:!!r.numeric,onChange:c=>{const d=[...f];d[u]={...r,numeric:c.target.checked},k(d.filter(a=>a.field))}}),"num"]}),u<f.length&&e.jsx("button",{className:te,onClick:()=>k(f.filter((c,d)=>d!==u)),children:"×"})]},u))})]})}function Vs({value:t,onChange:s,facetKeys:o,search:l,onSearchChange:p,activeFacetCount:x,onClear:m,onClose:h}){return e.jsxs("div",{className:"h-full overflow-y-auto",children:[e.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between px-4 py-3 bg-surface-raised border-b border-surface-border/50",children:[e.jsx("span",{className:"text-xs font-semibold text-text-primary",children:"Faceted query"}),e.jsxs("div",{className:"flex items-center gap-2",children:[x>0&&e.jsx("button",{onClick:m,className:"text-2xs text-text-tertiary hover:text-text-primary transition-colors",children:"Clear"}),e.jsx("button",{onClick:h,className:"p-1 rounded hover:bg-surface-hover text-text-tertiary hover:text-text-primary transition-colors",title:"Close",children:e.jsx(ae,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"px-4 py-2",children:[e.jsxs("p",{className:"mb-2 text-2xs leading-snug text-text-tertiary",children:["Precise metadata facets plus exact correlation-id lookup — they compose in one SQL query. Facet keys are the ones that actually exist in your visible escalations. Set status to ",e.jsx("span",{className:"font-medium",children:"All"})," to find an order across every status; the whole query is shareable via the URL."]}),e.jsx(Is,{value:t,onChange:s,facetKeys:o,search:l,onSearchChange:p})]})]})}const Ve="created_at";function xe(t){return t.replace(/^metadata\./,"")}function Us({orderBy:t,onChange:s}){const o=t==null?void 0:t[0],l=(o==null?void 0:o.field)??Ve,p=(o==null?void 0:o.direction)??"desc",x=l===Ve,m=h=>s([{...o??{},field:l,direction:h}]);return e.jsxs("div",{className:"flex items-center gap-1.5",children:[!x&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-accent/25 bg-accent/8 px-2 py-0.5 text-2xs font-medium text-accent/90",children:[e.jsx("span",{className:"text-text-quaternary",children:"sort"}),e.jsx("span",{className:"font-mono max-w-[120px] truncate",title:l,children:xe(l)}),e.jsx("button",{onClick:()=>s(void 0),className:"ml-0.5 -mr-0.5 flex items-center text-text-quaternary hover:text-status-error transition-colors","aria-label":"Reset sort to created date",children:e.jsx(ae,{className:"w-2.5 h-2.5"})})]}),e.jsxs("div",{className:"flex items-center rounded overflow-hidden border border-surface-border",role:"radiogroup","aria-label":"Sort direction",children:[e.jsx("button",{type:"button",role:"radio","aria-checked":p==="desc",onClick:()=>m("desc"),className:`px-1.5 py-1 transition-colors ${p==="desc"?"bg-accent text-text-inverse":"icon-link hover:bg-surface-hover"}`,title:x?"Newest first":`${xe(l)} descending`,children:e.jsx(rs,{className:"w-3.5 h-3.5"})}),e.jsx("button",{type:"button",role:"radio","aria-checked":p==="asc",onClick:()=>m("asc"),className:`px-1.5 py-1 border-l border-surface-border transition-colors ${p==="asc"?"bg-accent text-text-inverse":"icon-link hover:bg-surface-hover"}`,title:x?"Oldest first":`${xe(l)} ascending`,children:e.jsx(ls,{className:"w-3.5 h-3.5"})})]})]})}const Gs=t=>t.isPriorityPending||t.isClaimPending||t.isAssignPending||t.isEscalatePending||t.isTriagePending||t.isCancelPending,he="inline-flex items-center h-7 px-2.5 text-2xs font-medium text-text-secondary bg-surface border border-surface-border rounded-[4px] hover:border-accent/50 hover:text-text-primary transition-colors disabled:opacity-50 disabled:hover:border-surface-border",me=`${he} appearance-none cursor-pointer`,Hs="inline-flex items-center h-7 px-2.5 text-2xs font-medium text-status-error bg-surface border border-status-error/30 rounded-[4px] hover:border-status-error hover:bg-status-error/5 transition-colors disabled:opacity-50";function Js(t){var h;const s=Gs(t),o=pe(),{data:l}=Tt(),p=Ot(),x=p!==null?p:((h=l==null?void 0:l.ai)==null?void 0:h.enabled)===!0,m=t.selectedCount>0;return e.jsx("div",{className:`grid transition-all duration-200 ease-in-out ${m?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-0 pointer-events-none"}`,children:e.jsx("div",{className:"overflow-hidden",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2 py-2.5 pl-3 pr-2 mt-4 mb-3 bg-surface-sunken/60 border-l-2 border-l-accent",children:[e.jsxs("span",{className:"text-2xs font-semibold uppercase tracking-wider text-accent tabular-nums",children:[t.selectedCount," selected"]}),e.jsx("div",{className:"mx-1 h-4 w-px bg-surface-border"}),e.jsxs("select",{onChange:i=>{i.target.value&&(t.onSetPriority(parseInt(i.target.value)),i.target.value="")},disabled:s,className:me,defaultValue:"",children:[e.jsx("option",{value:"",disabled:!0,children:"Priority…"}),As.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))]}),e.jsxs("select",{onChange:i=>{i.target.value&&(t.onClaim(parseInt(i.target.value)),i.target.value="")},disabled:s,className:me,defaultValue:"",children:[e.jsx("option",{value:"",disabled:!0,children:"Claim for…"}),o.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))]}),e.jsx("button",{onClick:t.onAssign,disabled:s,className:he,children:t.isAssignPending?"Assigning…":"Assign to…"}),t.availableRoles.length>0&&e.jsxs("select",{onChange:i=>{i.target.value&&(t.onEscalate(i.target.value),i.target.value="")},disabled:s,className:me,defaultValue:"",children:[e.jsx("option",{value:"",disabled:!0,children:"Escalate to…"}),t.availableRoles.map(i=>e.jsx("option",{value:i,children:i},i))]}),x&&e.jsx("button",{onClick:t.onTriage,disabled:s,className:he,children:t.isTriagePending?"Triaging…":"Triage"}),e.jsx("button",{onClick:t.onCancel,disabled:s,className:Hs,children:t.isCancelPending?"Cancelling…":"Cancel"}),e.jsx("div",{className:"flex-1"}),s&&e.jsx("span",{className:"text-2xs text-text-tertiary animate-pulse",children:"Processing…"}),e.jsx("button",{onClick:t.onClearSelection,className:"px-1 text-2xs font-medium text-text-tertiary hover:text-text-primary transition-colors",children:"Clear"})]})})})}function Qs({open:t,onClose:s,selectedCount:o,selectedRoles:l,onSubmit:p,isPending:x}){const{isSuperAdmin:m}=Ke(),h=pe(),[i,f]=g.useState("user"),[C,S]=g.useState(null),[M,j]=g.useState(""),[k,r]=g.useState("30"),[u,c]=g.useState(0),d=g.useCallback(y=>c(y),[]),a=!m&&l.length===1?l[0]:void 0,N=Xe(M,250),{data:w,isLoading:P}=Ts({role:a,status:"active",search:N.trim()||void 0,limit:200}),E=(w==null?void 0:w.users)??[],A=()=>{f("user"),S(null),j(""),r("30"),c(0),s()},T=y=>{S(y),f("duration")},I=()=>{f("user")},V=()=>{if(!C)return;const y=k==="custom"?u:parseInt(k);!y||y<=0||p(C.id,y)};return e.jsx(fe,{open:t,onClose:A,title:"Assign Escalations",children:e.jsxs("div",{className:"space-y-4",children:[i==="user"&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-text-secondary",children:["Select a user to assign"," ",e.jsx("span",{className:"font-medium text-text-primary",children:o})," ","escalation(s) to:"]}),e.jsx("input",{type:"text",value:M,onChange:y=>j(y.target.value),placeholder:"Search by name or email...",className:"input text-xs w-full",autoFocus:!0}),e.jsxs("div",{className:"max-h-60 overflow-y-auto border border-surface-border rounded-lg divide-y divide-surface-border",children:[P&&e.jsx("p",{className:"text-xs text-text-tertiary p-3",children:"Loading users..."}),!P&&E.length===0&&e.jsx("p",{className:"text-xs text-text-tertiary p-3",children:"No users found"}),E.map(y=>e.jsxs("button",{onClick:()=>T(y),className:"w-full text-left px-3 py-2 hover:bg-surface-hover transition-colors",children:[e.jsx("p",{className:"text-xs font-medium text-text-primary",children:y.display_name||y.external_id}),y.email&&e.jsx("p",{className:"text-2xs text-text-tertiary",children:y.email})]},y.id))]}),e.jsx("div",{className:"flex justify-end pt-2",children:e.jsx("button",{onClick:A,className:"btn-secondary text-xs",children:"Cancel"})})]}),i==="duration"&&C&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-text-secondary",children:["Assign to"," ",e.jsx("span",{className:"font-medium text-text-primary",children:C.display_name||C.external_id})," ","for:"]}),e.jsxs("select",{value:k,onChange:y=>{r(y.target.value),c(0)},className:"select w-full text-sm",children:[h.map(y=>e.jsx("option",{value:y.value,children:y.label},y.value)),e.jsx("option",{value:"custom",children:"Other..."})]}),k==="custom"&&e.jsx(We,{onChange:d,autoFocus:!0}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:I,className:"btn-secondary text-xs",children:"Back"}),e.jsx("button",{onClick:V,disabled:x,className:"btn-primary text-xs",children:x?"Assigning...":"Assign"})]})]})]})})}function Ks({open:t,onClose:s,selectedCount:o,onSubmit:l,isPending:p}){const[x,m]=g.useState(""),h=()=>{l(x||void 0)};return e.jsx(fe,{open:t,onClose:s,title:"Submit for AI Triage",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-text-secondary",children:["Submit ",e.jsx("span",{className:"font-medium text-text-primary",children:o})," escalation(s) for AI triage? The triage orchestrator will take over resolution."]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-xs font-medium text-text-secondary block mb-1",children:["Triage hint ",e.jsx("span",{className:"text-text-tertiary",children:"(optional)"})]}),e.jsx("input",{type:"text",value:x,onChange:i=>m(i.target.value),placeholder:"e.g., image_orientation",className:"input text-xs font-mono w-full"}),e.jsx("p",{className:"text-2xs text-text-tertiary mt-1",children:"Guides the triage workflow on what remediation to apply"})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:s,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:h,disabled:p,className:"btn-primary text-xs",children:p?"Submitting...":"Submit for Triage"})]})]})})}function q(t,s,o){return l=>{t.mutate(l,{onSuccess:()=>{s(),o==null||o()}})}}function Ws(t){const s=()=>[...t.selectedIds];return{handleSetPriority:i=>{q(t.setPriority,t.clearSelection)({ids:s(),priority:i})},handleBulkClaim:i=>{q(t.bulkClaim,t.clearSelection)({ids:s(),durationMinutes:i})},handleBulkEscalate:i=>{q(t.bulkEscalate,t.clearSelection)({ids:s(),targetRole:i})},handleBulkTriage:i=>{q(t.bulkTriage,t.clearSelection,t.closeTriageModal)({ids:s(),hint:i})},handleBulkAssign:(i,f)=>{q(t.bulkAssign,t.clearSelection,t.closeAssignModal)({ids:s(),targetUserId:i,durationMinutes:f})},handleBulkCancel:()=>{q(t.bulkCancel,t.clearSelection,t.closeCancelModal)({ids:s()})}}}function Xs({claimTarget:t,onClose:s,claimDuration:o,onDurationChange:l,claimDurations:p,onCustomClaimChange:x,onClaim:m,isPending:h}){return e.jsx(fe,{open:!!t,onClose:s,title:"Claim Escalation",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-text-secondary",children:["Claim ",e.jsx("span",{className:"font-medium text-text-primary",children:t==null?void 0:t.type})," for:"]}),e.jsxs("select",{value:o,onChange:i=>{l(i.target.value)},className:"select w-full text-sm",children:[p.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value)),e.jsx("option",{value:"custom",children:"Other..."})]}),o==="custom"&&e.jsx(We,{onChange:x,autoFocus:!0}),e.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[e.jsx("button",{onClick:s,className:"btn-secondary text-xs",children:"Cancel"}),e.jsx("button",{onClick:m,className:"btn-primary text-xs",disabled:h,children:h?"Claiming...":"Claim"})]})]})})}const Ye={pending:"--lt-status-queued-graphic",claimed:"--lt-status-claimed-graphic",resolved:"--lt-status-success-graphic",cancelled:"--lt-text-quaternary",expired:"--lt-text-tertiary"},Ze="--lt-text-quaternary";function Ys(t){return Ye[t]??Ze}const H=Object.fromEntries(Object.entries(Ye).map(([t,s])=>[t,`rgb(var(${s}))`])),Ue=40,Zs=64,ea=24,Ge=3;function et(t){return t<6e4?`${Math.round(t/1e3)}s`:t<36e5?`${Math.round(t/6e4)}m`:t<864e5?`${(t/36e5).toFixed(1)}h`:`${(t/864e5).toFixed(1)}d`}function He(t){const s=Date.now()-t;return s<6e4?"just now":s<36e5?`${Math.round(s/6e4)}m ago`:s<864e5?`${Math.round(s/36e5)}h ago`:`${Math.round(s/864e5)}d ago`}function Je(t){return t.replace(/-/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function ta(t,s){return t?[...s.filter(l=>l in t),...Object.keys(t).filter(l=>!s.includes(l))].map(l=>[l,t[l]]):[]}function sa({e:t}){const s=t.endMs-t.startMs;if(s<=0)return null;const o=H.pending,l=H.claimed,p=t.status==="cancelled"||t.status==="expired"?H.cancelled:H.resolved;let x=100,m=0,h=0;return t.claimedMs!==null?(x=Math.max(0,Math.min(100,(t.claimedMs-t.startMs)/s*100)),t.isOpen?m=100-x:(m=Math.max(0,Math.min(100-x,(t.endMs-t.claimedMs)/s*100)),h=Math.max(0,100-x-m))):t.isOpen||(h=100,x=0),e.jsxs("div",{className:"mt-2 h-0.5 rounded-full overflow-hidden flex bg-surface-sunken",children:[x>0&&e.jsx("div",{style:{width:`${x}%`,backgroundColor:o,opacity:.6}}),m>0&&e.jsx("div",{style:{width:`${m}%`,backgroundColor:l,opacity:.6}}),h>0&&e.jsx("div",{style:{width:`${h}%`,backgroundColor:p,opacity:.6}})]})}function aa({gapMs:t,heightPx:s}){return e.jsx("div",{className:"relative flex items-center justify-center",style:{height:s},children:t>=6e4&&e.jsx("span",{className:"text-2xs text-text-quaternary font-mono bg-surface px-2 relative z-10",children:et(t)})})}function Qe({e:t,highlightKeys:s,onRowClick:o}){const[l,p]=g.useState(!1),x=H[t.displayStatus]??`rgb(var(${Ze}))`,m=ta(t.metadata,s),h=l?m:m.slice(0,Ge),i=m.length-Ge;return e.jsxs("div",{className:"cursor-pointer max-w-[460px] min-w-[260px] w-full bg-surface-raised rounded-lg shadow-sm border border-surface-border/60 px-3.5 pt-2.5 pb-2 hover:shadow-md hover:border-surface-border transition-all duration-150",style:{borderTopWidth:"3px",borderTopColor:x},onClick:()=>o==null?void 0:o(t),children:[e.jsxs("div",{className:"flex items-baseline gap-2 mb-1.5",children:[e.jsx("span",{className:"text-2xs font-bold uppercase tracking-widest text-text-quaternary shrink-0",children:Je(t.role)}),e.jsxs("span",{className:"text-xs font-semibold text-text-primary truncate",title:t.type,children:[t.type,t.subtype&&t.subtype!==t.type&&t.subtype!==""&&e.jsxs("span",{className:"font-normal text-text-tertiary",children:[" · ",t.subtype]})]})]}),h.length>0&&e.jsxs("div",{className:"border-t border-surface-border/40 pt-1 space-y-px",children:[h.map(([f,C])=>{const S=String(C),M=s.includes(f);return e.jsxs("div",{className:"group/row flex items-center gap-1.5 -mx-1 px-1 py-[2px] rounded",children:[e.jsx("span",{className:`shrink-0 w-[60px] text-2xs font-mono uppercase tracking-wide truncate ${M?"text-accent":"text-text-quaternary"}`,title:f,children:f}),e.jsx("span",{className:`flex-1 min-w-0 text-2xs font-medium truncate ${M?"text-text-primary":"text-text-tertiary"}`,title:S,children:S}),e.jsxs("span",{className:"flex items-center gap-px shrink-0 opacity-0 group-hover/row:opacity-100 transition-opacity",children:[e.jsx(qe,{to:Re(f,C,t.role),className:"p-0.5 rounded text-text-quaternary hover:text-accent transition-colors",title:`Filter ${Je(t.role)}: ${f} = ${S}`,onClick:j=>j.stopPropagation(),children:e.jsx(cs,{className:"w-2.5 h-2.5"})}),e.jsx(qe,{to:Re(f,C),className:"p-0.5 rounded text-text-quaternary hover:text-accent transition-colors",title:`Search all: ${f} = ${S}`,onClick:j=>j.stopPropagation(),children:e.jsx(ds,{className:"w-2.5 h-2.5"})})]})]},f)}),i>0&&e.jsx("button",{className:"flex items-center gap-0.5 text-2xs text-text-quaternary hover:text-accent transition-colors mt-0.5 -mx-1 px-1 py-px",onClick:f=>{f.stopPropagation(),p(C=>!C)},children:l?e.jsxs(e.Fragment,{children:[e.jsx(us,{className:"w-2.5 h-2.5"})," less"]}):e.jsxs(e.Fragment,{children:[e.jsx(xs,{className:"w-2.5 h-2.5"})," ",i," more"]})})]}),e.jsx(sa,{e:t})]})}function na({escalations:t,highlightKeys:s=[],onRowClick:o,total:l,page:p,totalPages:x,onPageChange:m}){var c,d;const h=Date.now(),f=t.map(a=>{const N=new Date(a.created_at).getTime(),w=a.resolved_at?new Date(a.resolved_at).getTime():null,P=a.claimed_at?new Date(a.claimed_at).getTime():null,E=!w&&a.status!=="cancelled"&&a.status!=="expired",A=w??(E?h:N+3e4),T=a.status==="pending"&&ks(a)?"claimed":a.status;return{...a,startMs:N,claimedMs:P,endMs:A,isOpen:E,displayStatus:T}});if(f.length===0)return e.jsx("p",{className:"mt-12 text-center text-sm text-text-tertiary",children:"No escalations matched."});const C=f.length,M=Math.max(Math.abs((((c=f[C-1])==null?void 0:c.startMs)??0)-(((d=f[0])==null?void 0:d.startMs)??0)),1)/Math.max(C-1,1),j=Zs/Math.max(M,1),r=new Set(f.map(a=>new Date(a.startMs).toDateString())).size>1;function u(a){const N=new Date(a),w=N.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return r?N.toLocaleDateString([],{month:"short",day:"numeric"})+" "+w:w}return e.jsxs("div",{className:"mt-4 pb-24",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute left-1/2 -translate-x-px inset-y-0 w-px bg-surface-border/80"}),f.map((a,N)=>{const w=f[N-1],P=w?Math.abs(a.startMs-w.startMs):null,E=P!==null?Math.max(ea,Math.round(P*j)):0,A=N%2===0,T=Ys(a.displayStatus),I=`rgb(var(${T}))`,V=a.endMs-a.startMs,y=a.isOpen?He(a.startMs):`${He(a.startMs)} · ${et(V)}`;return e.jsxs("div",{children:[N>0&&e.jsx(aa,{gapMs:P,heightPx:E}),e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex-1 flex justify-end items-center",children:A?e.jsxs("div",{className:"flex items-center",children:[e.jsx(Qe,{e:a,highlightKeys:s,onRowClick:o}),e.jsx("div",{className:"flex-shrink-0 h-px bg-surface-border/70",style:{width:Ue}})]}):e.jsx("span",{className:"text-2xs text-text-quaternary font-mono tabular-nums pr-3",children:y})}),e.jsx("div",{className:"relative z-10 flex-shrink-0 w-3.5 h-3.5 rounded-full border-2 border-surface cursor-pointer transition-all duration-150 hover:scale-[1.5]",style:{backgroundColor:I,boxShadow:`0 0 0 3px rgb(var(${T}) / 0.16), 0 1px 3px rgb(var(${T}) / 0.19)`},onClick:()=>o==null?void 0:o(a)}),e.jsx("div",{className:"flex-1 flex justify-start items-center",children:A?e.jsx("span",{className:"text-2xs text-text-quaternary font-mono tabular-nums pl-3",children:y}):e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex-shrink-0 h-px bg-surface-border/70",style:{width:Ue}}),e.jsx(Qe,{e:a,highlightKeys:s,onRowClick:o})]})})]}),e.jsx("div",{className:"flex justify-center relative z-10 mt-0.5",children:e.jsx("span",{className:"text-2xs text-text-quaternary font-mono tabular-nums bg-surface px-1.5",children:u(a.startMs)})})]},a.id)})]}),x>1&&e.jsxs("div",{className:"sticky bottom-0 z-20 bg-surface/95 backdrop-blur-sm border-t border-surface-border -mx-page-x px-page-x pt-2 pb-4 flex items-center justify-between mt-10",children:[e.jsxs("span",{className:"text-2xs text-text-tertiary",children:["Page ",e.jsx("span",{className:"font-medium text-text-secondary",children:p})," ","of ",e.jsx("span",{className:"font-medium text-text-secondary",children:x})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>m(p-1),disabled:p<=1,className:"p-1.5 rounded hover:bg-surface-hover disabled:opacity-30 text-text-tertiary hover:text-text-primary transition-colors disabled:cursor-not-allowed",children:e.jsx(is,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>m(p+1),disabled:p>=x,className:"p-1.5 rounded hover:bg-surface-hover disabled:opacity-30 text-text-tertiary hover:text-text-primary transition-colors disabled:cursor-not-allowed",children:e.jsx(os,{className:"w-4 h-4"})})]})]})]})}function Ta(){var Te,Oe,Fe,_e,$e,Be,Le;const t=$s(),{filters:s,setFilter:o,pagination:l}=Ss({filters:{role:"",type:"",priority:"",status:"available",search:""}});ns({role:s.role||null,verbs:["created","claimed"]});const p=Xe(s.search,300),x=pe(),[m,h]=g.useState(null),[i,f]=g.useState("30"),[C,S]=g.useState(0),M=g.useCallback(n=>S(n),[]),[j,k]=g.useState(new Set),[r,u]=g.useState(!1),[c,d]=Bs(),a=g.useMemo(()=>Ft(c),[c]),N=g.useCallback(n=>{d(b=>{const v=new URLSearchParams(b);return _t(v,n),v.delete("page"),v})},[d]),{data:w}=$t(r),P=Bt(a)+(s.search?1:0),E="facet-query",{setPanel:A,closePanel:T,open:I,ownerKey:V}=Lt();g.useEffect(()=>{if(!r){T(E);return}A(e.jsx(Vs,{value:a,onChange:N,facetKeys:(w==null?void 0:w.keys)??[],search:s.search??"",onSearchChange:n=>o("search",n),activeFacetCount:P,onClear:()=>{N({}),o("search","")},onClose:()=>u(!1)}),{width:420,key:E})},[r,a,N,w,s.search,o,P,A,T]);const y=I&&V===E,ne=g.useRef(!1);g.useEffect(()=>{if(y){ne.current=!0;return}ne.current&&(ne.current=!1,u(!1))},[y]);const[tt,re]=g.useState(!1),[st,le]=g.useState(!1),[at,ie]=g.useState(!1),nt=g.useCallback(n=>N({...a,orderBy:n}),[a,N]),J=Ls(),{data:Q}=Rt(),ge=zt(),rt=g.useCallback(()=>{var v;const n=window.prompt("Pin label:");if(!(n!=null&&n.trim()))return;const b=((v=Q==null?void 0:Q.preferences)==null?void 0:v.pinnedViews)??[];ge.mutate({pinnedViews:[...b,{id:qt(),label:n.trim(),url:J.pathname+J.search,badge:!0}]})},[J.pathname,J.search,Q,ge]),{canBulk:lt}=Dt(),be=a.facets?Object.keys(a.facets):[],K=c.get("view"),ye=g.useCallback(n=>{d(b=>{const v=new URLSearchParams(b);return n?v.set("view",n):v.delete("view"),v},{replace:!0})},[d]),_=K?K==="timeline":P>0,it=g.useCallback(n=>{const{[n]:b,...v}=a.facets??{};N({...a,facets:Object.keys(v).length>0?v:void 0})},[a,N]),je=It(),ve=Vt(),Ne=Ut(),oe=Gt(),Ce=Ht(),ce=Jt(),W=Qt(),{data:L}=Kt(),{data:$}=Wt(),{data:de}=Xt(),{user:X,isSuperAdmin:ot,hasRoleType:ct}=Ke(),ke=ot||ct("admin"),we=g.useMemo(()=>new Set(((X==null?void 0:X.roles)??[]).map(n=>n.role)),[X]),dt=g.useMemo(()=>{const n=($==null?void 0:$.roles)??[];return(ke?n:n.filter(v=>we.has(v.role)&&!as(v.role))).map(v=>({value:v.role,label:Yt(v)})).sort((v,At)=>v.label.localeCompare(At.label))},[$,ke,we]);g.useEffect(()=>{k(new Set)},[s.role,s.type,s.priority,s.status,p,l.page,l.pageSize]);const U=s.status||"",G=U==="available",ue=U==="claimed",Se=ue?"pending":U==="resolved"?"resolved":U==="cancelled"?"cancelled":U==="expired"?"expired":void 0,Pe=100,Me={role:s.role||void 0,type:s.type||void 0,priority:s.priority?parseInt(s.priority):void 0,limit:_?Pe:l.pageSize,offset:l.offset,sort_by:"created_at",order:"desc",search:p||void 0,...a},ut=Zt({...Me,enabled:G}),xt=es({status:Se,claimed:ue||void 0,...Me,enabled:!G}),mt=G?ut:xt,{data:R,isLoading:ht,error:Y,refetch:pt,isFetching:ft}=mt,gt=Ps(`/escalations${G?"/available":""}`,{status:Se,claimed:ue||void 0,role:s.role||void 0,type:s.type||void 0,priority:s.priority||void 0,search:p||void 0,sort_by:"created_at",order:"desc",limit:l.pageSize,offset:l.offset,facets:a.facets&&Object.keys(a.facets).length?JSON.stringify(a.facets):void 0,block:(Te=a.block)!=null&&Te.length?JSON.stringify(a.block):void 0,range:(Oe=a.range)!=null&&Oe.length?JSON.stringify(a.range):void 0,exists:(Fe=a.exists)!=null&&Fe.length?JSON.stringify(a.exists):void 0,roles:(_e=a.roles)!=null&&_e.length?JSON.stringify(a.roles):void 0,orderBy:($e=a.orderBy)!=null&&$e.length?JSON.stringify(a.orderBy):void 0,available:a.available!=null?String(a.available):void 0}),F=(R==null?void 0:R.escalations)??[],O=(R==null?void 0:R.total)??0,B=s.role||(((Be=a.roles)==null?void 0:Be.length)===1?a.roles[0]:null),Z=((Le=ts(B??"",void 0,!!B).data)==null?void 0:Le.list_schema)??null,Ee=!!B&&!!Z&&!!Z["x-lt-layout"]&&Z["x-lt-layout"]!=="table",ee=Ee&&!_&&(K?K==="rich":!0),Ae=g.useMemo(()=>{if(!a.jeopardy||!B)return null;const n=(($==null?void 0:$.roles)??[]).find(v=>v.role===B),b=(n==null?void 0:n.priority_threshold_minutes)??(n==null?void 0:n.sla_minutes)??null;return b!=null?ss(b*6e4):null},[a.jeopardy,B,$]),bt=g.useMemo(()=>{const n=new Set;for(const b of F)j.has(b.id)&&n.add(b.role);return[...n]},[F,j]),yt=g.useCallback(()=>k(new Set),[]),jt=()=>{if(!m)return;const n=i==="custom"?C:parseInt(i);!n||n<=0||je.mutate({id:m.id,durationMinutes:n},{onSuccess:()=>{h(null),t(`/escalations/detail/${m.id}`)}})},{handleSetPriority:vt,handleBulkClaim:Nt,handleBulkEscalate:Ct,handleBulkTriage:kt,handleBulkAssign:wt,handleBulkCancel:St}=Ws({selectedIds:j,clearSelection:yt,setPriority:ve,bulkClaim:Ne,bulkEscalate:Ce,bulkTriage:ce,bulkAssign:oe,bulkCancel:W,closeTriageModal:()=>re(!1),closeAssignModal:()=>le(!1),closeCancelModal:()=>ie(!1)}),Pt=n=>{const b=new Set(j);b.has(n)?b.delete(n):b.add(n),k(b)},Mt=()=>{j.size===F.length?k(new Set):k(new Set(F.map(n=>n.id)))},Et=[lt?{key:"select",label:e.jsx("input",{type:"checkbox",checked:F.length>0&&j.size===F.length,onChange:Mt,className:"rounded"}),render:n=>e.jsx("input",{type:"checkbox",checked:j.has(n.id),onChange:b=>{b.stopPropagation(),Pt(n.id)},onClick:b=>b.stopPropagation(),className:"rounded"}),className:"w-10",priority:1}:{key:"spacer",label:"",render:()=>null,className:"w-10",priority:3},...vs({highlightKeys:be}),{key:"actions",label:"",render:n=>e.jsx(Os,{children:e.jsx(Fs,{icon:ms,title:"Claim escalation",onClick:()=>h(n),alwaysVisible:!0,colorClass:"text-accent/40 hover:text-accent",size:"sm"})}),className:"w-10 text-right"}];return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-10 min-w-0",children:[e.jsx(Ns,{role:s.role,options:dt,onChange:n=>o("role",n)}),e.jsx("button",{onClick:()=>{window.location.hash="#docs:dashboard.md:all-escalations"},className:"text-text-quaternary hover:text-accent transition-colors mt-1 shrink-0",title:"Open docs for this page",children:e.jsx(hs,{className:"w-4 h-4",strokeWidth:1.5})})]}),e.jsx(Cs,{filters:s,setFilter:o,roles:(L==null?void 0:L.roles)??[],types:(de==null?void 0:de.types)??[],showStatus:!0,showSearch:!1,actions:e.jsxs(e.Fragment,{children:[_&&e.jsxs("span",{className:"text-2xs text-text-tertiary whitespace-nowrap",children:[O>100&&e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"font-medium text-text-secondary",children:[(l.page-1)*100+1,"–",Math.min(l.page*100,O)]})," of "]}),e.jsx("span",{className:"font-medium text-text-secondary",children:O})," ",O===1?"escalation":"escalations"]}),e.jsx(Us,{orderBy:a.orderBy,onChange:nt}),e.jsx("span",{className:"h-3.5 w-px bg-surface-border shrink-0"}),e.jsx(_s,{onRefresh:()=>pt(),isFetching:ft,apiPath:gt}),Ee&&!_&&e.jsx("button",{onClick:()=>ye(ee?"table":"rich"),className:"ml-2 inline-flex h-7 w-7 items-center justify-center rounded icon-link hover:bg-surface-hover",title:ee?"Table view":"Rich view",children:ee?e.jsx(ze,{className:"w-4 h-4"}):e.jsx(ps,{className:"w-4 h-4"})}),P>0&&e.jsx("button",{onClick:()=>ye(_?"table":"timeline"),className:"ml-2 inline-flex h-7 w-7 items-center justify-center rounded icon-link hover:bg-surface-hover",title:_?"Table view":"Timeline view",children:_?e.jsx(ze,{className:"w-4 h-4"}):e.jsx(fs,{className:"w-4 h-4"})}),e.jsx("button",{onClick:rt,className:"ml-2 inline-flex h-7 w-7 items-center justify-center rounded icon-link hover:bg-surface-hover",title:"Pin this view — save the current filters to your Pinned section","data-testid":"pin-current-view",children:e.jsx(gs,{className:"w-4 h-4"})}),e.jsxs("button",{onClick:()=>u(n=>!n),className:"relative ml-2 inline-flex h-7 w-7 items-center justify-center rounded icon-link hover:bg-surface-hover",title:"Faceted query",children:[e.jsx(bs,{className:"w-4 h-4"}),P>0&&e.jsx("span",{className:"absolute -right-1 -top-1 flex h-3.5 min-w-[14px] items-center justify-center rounded-full bg-accent px-0.5 text-2xs font-medium text-text-inverse",children:P})]})]})}),e.jsx(Js,{selectedCount:j.size,onClearSelection:()=>k(new Set),onSetPriority:vt,onClaim:Nt,onAssign:()=>le(!0),onEscalate:Ct,onTriage:()=>re(!0),onCancel:()=>ie(!0),isPriorityPending:ve.isPending,isClaimPending:Ne.isPending,isAssignPending:oe.isPending,isEscalatePending:Ce.isPending,isTriagePending:ce.isPending,isCancelPending:W.isPending,availableRoles:(L==null?void 0:L.roles)??[]}),(a.facets&&Object.keys(a.facets).length>0||a.jeopardy)&&e.jsxs("div",{className:"sticky top-14 z-30 bg-surface/98 backdrop-blur-sm border-b border-surface-border/30 -mx-page-x px-page-x py-2 flex items-center gap-1.5 flex-wrap",children:[a.jeopardy&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-status-error px-2.5 py-0.5 text-2xs font-semibold text-text-inverse",children:[e.jsx(ys,{className:"w-2.5 h-2.5",strokeWidth:2.5}),"in jeopardy",Ae&&e.jsxs("span",{className:"font-mono font-normal opacity-90",children:["> ",Ae]}),e.jsx("button",{onClick:()=>N({...a,jeopardy:void 0}),className:"ml-0.5 -mr-0.5 flex items-center text-text-inverse/70 hover:text-text-inverse transition-colors","aria-label":"Clear jeopardy filter",children:e.jsx(ae,{className:"w-2.5 h-2.5"})})]}),Object.entries(a.facets??{}).map(([n,b])=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-accent/25 bg-accent/8 px-2.5 py-0.5 text-2xs font-medium text-accent/90",children:[e.jsx("span",{className:"font-mono text-text-tertiary",children:n}),e.jsx("span",{className:"text-text-quaternary",children:"="}),e.jsx("span",{className:"font-mono max-w-[160px] truncate",title:String(b),children:String(b)}),e.jsx("button",{onClick:()=>it(n),className:"ml-0.5 -mr-0.5 flex items-center text-text-quaternary hover:text-status-error transition-colors","aria-label":`Remove ${n} filter`,children:e.jsx(ae,{className:"w-2.5 h-2.5"})})]},n)),Object.keys(a.facets??{}).length>1&&e.jsx("button",{onClick:()=>N({...a,facets:void 0}),className:"text-2xs text-text-quaternary hover:text-text-secondary transition-colors px-1",children:"clear all"})]}),Y&&e.jsx("div",{className:"mb-4 px-4 py-3 rounded-md bg-status-error/10 border border-status-error/20 text-xs text-status-error",children:Y.message==="Session expired"?"Your session has expired. Please log in again.":`Failed to load escalations: ${Y.message}`}),_?e.jsx(na,{escalations:F,highlightKeys:be,onRowClick:n=>t(`/escalations/detail/${n.id}`,{state:{from:"/escalations/available"}}),total:O,page:l.page,totalPages:Math.ceil(O/Pe),onPageChange:l.setPage}):ee?e.jsx(ws,{role:B,listSchema:Z,activeEscalations:F,onRowClick:n=>t(`/escalations/detail/${n.id}`,{state:{from:"/escalations/available"}}),onOpenGroup:n=>t(n),onAddFacet:(n,b)=>N({...a,facets:{...a.facets??{},[n]:typeof b=="object"&&b!==null?JSON.stringify(b):b}}),total:O,page:l.page,totalPages:l.totalPages(O),pageSize:l.pageSize,onPageChange:l.setPage,onPageSizeChange:l.setPageSize}):e.jsxs(e.Fragment,{children:[e.jsx(Ms,{columns:Et,data:F,layout:"fixed",keyFn:n=>n.id,onRowClick:n=>t(`/escalations/detail/${n.id}`,{state:{from:"/escalations/available"}}),isLoading:ht,emptyMessage:Y?"Unable to load data":"No escalations"}),e.jsx(Es,{page:l.page,totalPages:l.totalPages(O),onPageChange:l.setPage,total:O,pageSize:l.pageSize,onPageSizeChange:l.setPageSize})]}),e.jsx(Xs,{claimTarget:m,onClose:()=>h(null),claimDuration:i,onDurationChange:n=>{f(n),S(0)},claimDurations:x,customClaimMinutes:C,onCustomClaimChange:M,onClaim:jt,isPending:je.isPending}),e.jsx(Ks,{open:tt,onClose:()=>re(!1),selectedCount:j.size,onSubmit:kt,isPending:ce.isPending}),e.jsx(Qs,{open:st,onClose:()=>le(!1),selectedCount:j.size,selectedRoles:bt,onSubmit:wt,isPending:oe.isPending}),e.jsx(js,{open:at,onClose:()=>ie(!1),onConfirm:St,selectedCount:j.size,isPending:W.isPending,error:W.error})]})}export{Ta as AvailableEscalationsPage};
|
|
2
|
-
//# sourceMappingURL=AvailableEscalationsPage-8pMC7Xv6.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as m,j as e}from"./vendor-query-B2UbickB.js";import{h as j}from"./bots-DiljVapH.js";import{c as d,X as y,ay as u,r as N,a2 as p}from"./vendor-icons-D71XjkNy.js";function v({selected:s,onChange:r,placeholder:h}){const{data:l}=j({limit:100}),c=((l==null?void 0:l.bots)??[]).filter(t=>t.status==="active"),[i,a]=m.useState(!1),o=m.useRef(null);m.useEffect(()=>{const t=n=>{o.current&&!o.current.contains(n.target)&&a(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[]);const x=c.find(t=>t.external_id===s),f=h??"Invoking user (default)";return e.jsxs("div",{ref:o,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>a(!i),className:"field flex items-center gap-1.5 text-left cursor-pointer hover:border-accent",children:[s&&x?e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-lg bg-accent/[0.08] text-text-secondary text-2xs",children:[e.jsx(d,{className:"w-2.5 h-2.5 shrink-0 text-accent/75"}),x.display_name||x.external_id,e.jsx("span",{role:"button",onClick:t=>{t.stopPropagation(),r("")},className:"ml-0.5 hover:text-status-error transition-colors",children:e.jsx(y,{className:"w-2.5 h-2.5"})})]}):e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-text-tertiary",children:[e.jsx(u,{className:"w-3 h-3 shrink-0"}),f]}),e.jsx(N,{className:`w-3.5 h-3.5 ml-auto shrink-0 text-text-tertiary transition-transform ${i?"rotate-180":""}`})]}),i&&e.jsxs("div",{className:"absolute z-[100] mt-1 w-full bg-surface-raised border border-surface-border rounded-md shadow-lg max-h-48 overflow-y-auto",children:[e.jsxs("button",{type:"button",onClick:()=>{r(""),a(!1)},className:`flex items-center gap-2 w-full px-3 py-1.5 text-left text-xs transition-colors ${s?"text-text-primary hover:bg-surface-sunken":"bg-accent/[0.06] text-accent"}`,children:[e.jsx(u,{className:"w-3 h-3 shrink-0 text-text-tertiary"}),e.jsx("span",{className:"flex-1",children:"Invoking user"}),!s&&e.jsx(p,{className:"w-3 h-3 shrink-0"})]}),c.length===0?e.jsx("p",{className:"px-3 py-2 text-xs text-text-tertiary",children:"No bot accounts"}):c.map(t=>{const n=s===t.external_id;return e.jsxs("button",{type:"button",onClick:()=>{r(t.external_id),a(!1)},className:`flex items-center gap-2 w-full px-3 py-1.5 text-left text-xs transition-colors ${n?"bg-accent/[0.06] text-accent":"text-text-primary hover:bg-surface-sunken"}`,children:[e.jsx(d,{className:"w-3 h-3 shrink-0 text-accent/60"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{children:t.display_name||t.external_id}),t.display_name&&t.display_name!==t.external_id&&e.jsx("span",{className:"ml-1 text-text-tertiary font-mono",children:t.external_id})]}),n&&e.jsx(p,{className:"w-3 h-3 shrink-0"})]},t.id)})]})]})}export{v as B};
|
|
2
|
-
//# sourceMappingURL=BotPicker-C4uGH2x9.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as j,j as s}from"./vendor-query-B2UbickB.js";import{D as Q}from"./DataTable-BTu2AaEl.js";import{a0 as C,T as I,L as X,b as P,R as tt,g as et,a1 as st,a2 as nt,a3 as rt}from"./index-DbTD-dio.js";import{a as W}from"./StatusBadge-BwUvykDo.js";import{S as $}from"./StickyPagination-cLddIdtT.js";import{M as at}from"./Modal-Dr1Xy0j0.js";import{a2 as it,ad as ot}from"./vendor-icons-D71XjkNy.js";import{u as R}from"./vendor-react-C1YOyCSV.js";const lt=new Set(["__proto__","constructor","prototype"]);function G(t){const e=[];for(const n of t.split(".")){const r=n.match(/^([^[\]]*)((?:\[\d+\])*)$/);if(!r)throw new Error(`invalid x-lt-bind path segment: "${n}"`);const[,a,o]=r;if(a){if(lt.has(a))throw new Error(`x-lt-bind path may not target "${a}"`);e.push({key:a})}for(const i of o.match(/\d+/g)??[])e.push({index:Number(i)})}if(e.length===0)throw new Error(`empty x-lt-bind path: "${t}"`);return e}function ct(t,e,n){const r=G(e);let a=t;for(let i=0;i<r.length-1;i++){const d=r[i],l=r[i+1],c="key"in d?d.key:d.index,b="index"in l;(a[c]==null||typeof a[c]!="object")&&(a[c]=b?[]:{}),a=a[c]}const o=r[r.length-1];a["key"in o?o.key:o.index]=n}function L(t,e){let n=t;for(const r of G(e)){if(n==null||typeof n!="object")return;n=n["key"in r?r.key:r.index]}return n}function Y(t,e){const n=e==null?void 0:e["x-lt-bind"];return typeof n=="string"&&n.length>0?n:t}function Ot(t,e){const n=e==null?void 0:e.properties;if(!n)return{...t};const r={};for(const[a,o]of Object.entries(n))a in t&&ct(r,Y(a,o),t[a]);return r}function Ht(t,e){const n=e==null?void 0:e.properties;if(!n)return t?{...t}:{};const r={};for(const[a,o]of Object.entries(n)){const i=L(t,Y(a,o));i!==void 0&&(r[a]=i)}return r}const dt=["escalation","metadata","envelope","payload","resolver"],xt=/\{\{\s*([^{}]+?)\s*\}\}/g,A="—";function F(t){if(t==null)return A;if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);try{return JSON.stringify(t)}catch{return A}}function y(t,e){return t.replace(xt,(n,r)=>{const a=r.indexOf("."),o=a===-1?r:r.slice(0,a);if(!dt.includes(o))return A;const i=e[o];if(a===-1)return F(i);try{return F(L(i,r.slice(a+1)))}catch{return A}})}function ut(t){const e=t==null?void 0:t["x-lt-help"];if(typeof e=="string"&&e.trim().length>0)return e;const n=t==null?void 0:t["x-lt-context"];return typeof n=="string"&&n.trim().length>0?n:null}function Ct(t,e){const n=ut(t);return n?y(n,e):null}function $t({isTerminal:t,status:e,claimed:n,claimedByMe:r}){return t?e==="cancelled"?"This escalation was cancelled. The record is shown for reference.":"This escalation has been resolved. The submitted form is shown for reference.":r?"You have claimed this escalation. Fill out the form and submit to resolve it.":n?"Another user has claimed this escalation. It unlocks if their claim expires or is released.":"Claim this escalation to enable the form."}function ft(t){return!!(t.assigned_to&&t.assigned_until&&new Date(t.assigned_until)>new Date)}function Ft(t){return!t.workflow_type}const K=[{text:"text-rose-400",bg:"bg-rose-400/[0.08]"},{text:"text-pink-400",bg:"bg-pink-400/[0.08]"},{text:"text-fuchsia-400",bg:"bg-fuchsia-400/[0.08]"},{text:"text-purple-400",bg:"bg-purple-400/[0.08]"},{text:"text-violet-400",bg:"bg-violet-400/[0.08]"},{text:"text-indigo-400",bg:"bg-indigo-400/[0.08]"},{text:"text-blue-400",bg:"bg-blue-400/[0.08]"},{text:"text-sky-400",bg:"bg-sky-400/[0.08]"},{text:"text-cyan-400",bg:"bg-cyan-400/[0.08]"},{text:"text-teal-400",bg:"bg-teal-400/[0.08]"},{text:"text-emerald-400",bg:"bg-emerald-400/[0.08]"},{text:"text-green-400",bg:"bg-green-400/[0.08]"},{text:"text-lime-400",bg:"bg-lime-400/[0.08]"},{text:"text-yellow-400",bg:"bg-yellow-400/[0.08]"},{text:"text-amber-400",bg:"bg-amber-400/[0.08]"},{text:"text-orange-400",bg:"bg-orange-400/[0.08]"},{text:"text-red-400",bg:"bg-red-400/[0.08]"},{text:"text-stone-400",bg:"bg-stone-400/[0.08]"},{text:"text-rose-300",bg:"bg-rose-300/[0.08]"},{text:"text-violet-300",bg:"bg-violet-300/[0.08]"},{text:"text-sky-300",bg:"bg-sky-300/[0.08]"},{text:"text-teal-300",bg:"bg-teal-300/[0.08]"},{text:"text-amber-300",bg:"bg-amber-300/[0.08]"},{text:"text-pink-300",bg:"bg-pink-300/[0.08]"}];function mt(t){let e=0;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n)|0;return Math.abs(e)}function bt(t){return K[mt(t)%K.length]}function J({open:t,onClose:e,role:n,pairs:r,onNavigate:a,onAddFacet:o}){const[i,d]=j.useState(new Set),[l,c]=j.useState(t);t!==l&&(c(t),t&&d(new Set(r.length===1?[r[0].key]:[])));const b=m=>{d(x=>{const h=new Set(x);return h.has(m)?h.delete(m):h.add(m),h})},u=r.filter(m=>i.has(m.key)),f=Object.fromEntries(u.map(m=>[m.key,m.value])),p=u.length===0,v=m=>{e(),a(m)};return s.jsx(at,{open:t,onClose:e,title:"Refine",children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-2xs text-text-tertiary",children:"Pick the facts to match — several combine into one narrower query."}),s.jsx("div",{className:"divide-y divide-surface-border/40 -mx-1",children:r.map(m=>{const x=i.has(m.key);return s.jsxs("button",{type:"button",onClick:()=>b(m.key),"aria-pressed":x,className:"w-full flex items-center gap-3 px-1 py-2.5 text-left group min-w-0","data-testid":"refine-pair",children:[s.jsx("span",{className:`w-4 h-4 rounded-[3px] border flex items-center justify-center shrink-0 transition-colors ${x?"bg-accent border-accent":"border-surface-border group-hover:border-accent/50"}`,"aria-hidden":!0,children:x&&s.jsx(it,{className:"w-3 h-3 text-text-inverse",strokeWidth:3})}),s.jsx("span",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary w-28 shrink-0 truncate",title:m.key,children:m.label}),s.jsx("span",{className:"text-xs text-text-primary truncate flex-1 min-w-0",title:String(m.value),children:String(m.value)})]},m.key)})}),s.jsxs("div",{className:"flex items-center justify-end gap-3 pt-2 flex-wrap",children:[o&&s.jsx("button",{onClick:()=>{u.forEach(m=>o(m.key,m.value)),e()},disabled:p,className:"text-xs text-text-secondary hover:text-accent transition-colors disabled:opacity-40 disabled:cursor-not-allowed mr-auto","data-testid":"refine-add-filters",children:"Add to filters"}),s.jsx("button",{onClick:()=>v(C(f)),disabled:p,className:"btn-secondary text-xs disabled:opacity-40 disabled:cursor-not-allowed","data-testid":"refine-search-all",children:"Search everywhere"}),s.jsxs("button",{onClick:()=>v(C(f,n)),disabled:p,className:"btn-primary text-xs disabled:opacity-40 disabled:cursor-not-allowed","data-testid":"refine-filter-role",children:["Filter ",n]})]})]})})}function pt(t){const[,e]=j.useState(0);j.useEffect(()=>{if(!t)return;const n=window.setInterval(()=>e(r=>r+1),6e4);return()=>window.clearInterval(n)},[t])}function ht(t){var e;return[...t["x-lt-columns"]??[],...((e=t["x-lt-card"])==null?void 0:e.fields)??[]].some(n=>n.format==="age")}function S(t){const e=n=>{if(!n)return null;try{const r=JSON.parse(n);return r&&typeof r=="object"?r:null}catch{return null}};return{escalation:t,metadata:t.metadata??null,envelope:e(t.envelope),payload:e(t.escalation_payload),resolver:e(t.resolver_payload)}}const gt=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/,D="—";function O({raw:t,format:e}){if(!t||t===D)return s.jsx("span",{className:"text-text-quaternary",children:D});if(e==="age"){const n=new Date(t);if(!Number.isNaN(n.getTime()))return s.jsx("span",{title:n.toLocaleString(),className:"tabular-nums whitespace-nowrap",children:tt(t)})}return gt.test(t)?s.jsx(P,{date:t,format:"datetime",className:"text-text-primary"}):s.jsx(s.Fragment,{children:t})}const yt=30;function z(t){return t.status==="pending"&&!ft(t)}function H({row:t,def:e,onView:n,prominent:r,forceView:a}){const o=(e==null?void 0:e.action)??"claim",i=a?"view":o,d=o===i&&(e!=null&&e.label)?e.label:i==="claim"?"Claim":"View",l=et(),[c,b]=j.useState("");if(i==="claim"&&!z(t))return null;const u=p=>{if(p.stopPropagation(),i==="view"){n==null||n();return}b(""),l.mutate({id:t.id,durationMinutes:(e==null?void 0:e.durationMinutes)??yt},{onSuccess:()=>n==null?void 0:n(),onError:v=>b(v.message)})},f=r?"btn-primary text-xs shrink-0 disabled:opacity-50":"px-2 py-0.5 rounded text-2xs font-medium text-accent/70 border border-accent/30 hover:text-accent hover:border-accent/60 hover:bg-accent/5 transition-colors disabled:opacity-40 whitespace-nowrap";return s.jsxs("span",{className:"inline-flex flex-col items-end gap-0.5",children:[s.jsx("button",{type:"button",onClick:u,disabled:l.isPending,className:f,"data-testid":"row-action-button",children:l.isPending?"Claiming…":d}),c&&s.jsx("span",{className:"text-2xs text-status-error","data-testid":"row-action-error",children:c})]})}function vt({esc:t,card:e,rowAction:n,onOpen:r,forceView:a}){const o=S(t),i=e.title?y(e.title,o):t.type;return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-start justify-between gap-6",children:[s.jsxs("button",{onClick:r,className:"text-left group min-w-0",children:[s.jsx("h3",{className:"heading-2 group-hover:text-accent transition-colors leading-tight",children:i}),e.subtitle&&s.jsx("p",{className:"text-xs text-text-tertiary mt-1.5",children:y(e.subtitle,o)})]}),s.jsx(H,{row:t,def:n,onView:r,prominent:!0,forceView:a})]}),e.fields&&e.fields.length>0&&s.jsx("dl",{className:"flex flex-wrap gap-x-10 gap-y-4 mt-6",children:e.fields.map((d,l)=>s.jsxs("div",{children:[s.jsx("dt",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary",children:d.label}),s.jsx("dd",{className:"text-xs text-text-primary mt-1",children:s.jsx(O,{raw:y(d.value,o)})})]},l))}),e.body&&s.jsx("div",{className:"mt-7 pt-6 border-t border-surface-border/50",children:s.jsx(I,{content:y(e.body,o)})})]})}function jt({role:t,def:e,onRowClick:n}){var c,b;const[r,a]=j.useState(!1),o=X({role:t,status:e.status??"resolved",sort_by:"resolved_at",order:"desc",limit:e.limit??25,enabled:r}),i=((c=o.data)==null?void 0:c.escalations)??[],d=((b=o.data)==null?void 0:b.total)??0,l=e.row??{};return r?o.isLoading?s.jsx("p",{className:"text-xs text-text-tertiary italic",children:"Loading history…"}):i.length===0?s.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No past revisions."}):s.jsxs("div",{children:[s.jsx("div",{className:"divide-y divide-surface-border/40",children:i.map(u=>{const f=S(u);return s.jsxs("button",{onClick:()=>n==null?void 0:n(u),className:"w-full text-left py-2.5 group flex items-center gap-3",children:[s.jsx("span",{className:`w-2.5 h-2.5 shrink-0 rounded-full dot-ring ${W[u.status]??"bg-status-pending"}`,title:u.status}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block text-xs text-text-primary group-hover:text-accent transition-colors truncate",children:l.title?y(l.title,f):u.type}),l.subtitle&&s.jsx("span",{className:"block text-2xs text-text-tertiary truncate",children:y(l.subtitle,f)})]}),l.meta?s.jsx("span",{className:"text-2xs text-text-tertiary shrink-0",children:y(l.meta,f)}):u.resolved_at&&s.jsx(P,{date:u.resolved_at,format:"relative",className:"text-2xs text-text-tertiary shrink-0 whitespace-nowrap"})]},u.id)})}),d>i.length&&s.jsxs("p",{className:"text-2xs text-text-quaternary mt-3",children:["Showing ",i.length," of ",d,"."]})]}):s.jsx("button",{onClick:()=>a(!0),className:"text-xs text-accent hover:underline","data-testid":"load-history",children:"Load full history →"})}function U(t,e){var a,o;const n=[],r=new Set;for(const i of e){const d=(a=i.value.match(V))==null?void 0:a[1];if(!d||r.has(d))continue;const l=(o=t.metadata)==null?void 0:o[d];l==null||l===""||(r.add(d),n.push({key:d,label:i.label,value:l}))}return n}function B({onOpen:t,className:e=""}){return s.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),t()},className:`p-1.5 rounded text-text-quaternary/70 hover:text-accent hover:bg-surface-hover transition-colors ${e}`,title:"Refine — filter or search by this row's values","aria-label":"Refine — filter or search by this row's values","data-testid":"row-refine",children:s.jsx(ot,{className:"w-3.5 h-3.5",strokeWidth:1.5})})}function Nt({schema:t,rows:e,role:n,onRowClick:r,onAddFacet:a,forceView:o}){const i=R(),d=t["x-lt-columns"]??[],l=t["x-lt-row-action"],[c,b]=j.useState(null),u=[{key:"_status",label:"",priority:1,className:"w-10",render:f=>s.jsx("span",{className:`w-2.5 h-2.5 inline-block rounded-full dot-ring ${W[f.status]??"bg-status-pending"}`,title:f.status})},...d.map((f,p)=>({key:`col-${p}`,label:f.label,priority:f.priority??(p===0?1:2),render:v=>{const m=S(v),x=y(f.value,m);return s.jsx("span",{className:"block truncate",title:x&&x!==D?x:void 0,children:s.jsx(O,{raw:x,format:f.format})})}})),{key:"_refine",label:"",priority:1,className:"w-9",render:f=>U(f,d).length>0?s.jsx(B,{onOpen:()=>b(f)}):null},{key:"_action",label:"",priority:1,className:"w-24 text-right",render:f=>s.jsx(H,{row:f,def:l,onView:()=>r==null?void 0:r(f),forceView:o})}];return s.jsxs(s.Fragment,{children:[s.jsx(Q,{columns:u,data:e,layout:"fixed",keyFn:f=>f.id,onRowClick:r,emptyMessage:"No pending items."}),s.jsx(J,{open:!!c,onClose:()=>b(null),role:n,pairs:c?U(c,d):[],onNavigate:i,onAddFacet:a})]})}function q({children:t}){return s.jsx("p",{className:"text-2xs font-semibold uppercase tracking-widest text-text-tertiary mb-3",children:t})}function wt(t,e){var o;const n=e.indexOf("."),r=e.startsWith("metadata.")?e.slice(9):null,a=new Map;for(const i of t){const d=S(i);let l;try{l=n===-1?d[e]:L(d[e.slice(0,n)],e.slice(n+1))}catch{l=void 0}if(l==null||l==="")continue;const c=String(l),b=r?((o=i.metadata)==null?void 0:o[r])??l:l,u=a.get(c);u?(u.count+=1,new Date(i.created_at)>new Date(u.latest.created_at)&&(u.latest=i)):a.set(c,{key:c,rawValue:b,latest:i,count:1})}return[...a.values()].sort((i,d)=>i.key.localeCompare(d.key))}const V=/^\{\{\s*metadata\.([a-zA-Z0-9_]+)\s*\}\}$/;function kt({schema:t,rows:e,role:n,onOpenDetail:r,onOpenGroup:a,onAddFacet:o,forceView:i}){const d=R(),l=t["x-lt-group-by"],c=t["x-lt-card"]??{},b=t["x-lt-row-action"],[u,f]=j.useState(null);if(!l)return s.jsx("p",{className:"text-xs text-text-tertiary italic",children:"facet-board needs an x-lt-group-by path."});const p=l.startsWith("metadata.")?l.slice(9):null,v=wt(e,l);if(v.length===0)return s.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No entities in scope."});const m=x=>{var N,T;const h=[];p&&h.push({key:p,label:p,value:x.rawValue});const k=new Set(h.map(_=>_.key));for(const _ of c.fields??[]){const w=(N=_.value.match(V))==null?void 0:N[1];if(!w||k.has(w))continue;const g=(T=x.latest.metadata)==null?void 0:T[w];g==null||g===""||(k.add(w),h.push({key:w,label:_.label,value:g}))}return h};return s.jsxs("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(15rem,1fr))] gap-4","data-testid":"facet-board",children:[v.map(x=>{const h=S(x.latest),k=c.title?y(c.title,h):x.key,N=c.state?y(c.state,h):x.latest.subtype||x.latest.status,T=bt(N),_=m(x).length>0,w=g=>{if(g.shiftKey&&p&&o){o(p,x.rawValue);return}r==null||r(x.latest)};return s.jsxs("div",{role:"button",tabIndex:0,onClick:w,onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),w(g))},title:p?"Open the latest item · ⇧ click to filter the board":"Open the latest item",className:"group/card border-l-2 border-accent/30 bg-surface-sunken/40 rounded-[0.125em] px-4 py-3.5 cursor-pointer transition-colors hover:bg-surface-sunken/70 focus:outline-none focus-visible:ring-1 focus-visible:ring-accent/40","data-testid":"facet-board-card",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 mb-2.5",children:[s.jsx("span",{className:"text-2xs font-semibold uppercase tracking-wider text-text-secondary truncate",children:k}),s.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[s.jsx("span",{className:"px-1.5 py-0.5 rounded text-2xs font-mono font-medium",style:{color:T.text,backgroundColor:T.bg},title:N,children:N}),_&&s.jsx(B,{onOpen:()=>f(x),className:"-my-1 -mr-1"})]})]}),c.fields&&c.fields.length>0&&s.jsx("dl",{className:"space-y-1",children:c.fields.map((g,Z)=>{const E=y(g.value,h);return s.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[s.jsx("dt",{className:"text-2xs uppercase tracking-wider text-text-quaternary shrink-0",children:g.label}),s.jsx("dd",{className:"min-w-0 truncate text-2xs text-text-primary",title:E&&E!==D?E:void 0,children:s.jsx(O,{raw:E,format:g.format})})]},Z)})}),(i||((b==null?void 0:b.action)??"claim")==="view"||z(x.latest))&&s.jsx("div",{className:"mt-3 flex justify-end",children:s.jsx(H,{row:x.latest,def:b,onView:()=>r==null?void 0:r(x.latest),forceView:i})})]},x.key)}),s.jsx(J,{open:!!u,onClose:()=>f(null),role:n,pairs:u?m(u):[],onNavigate:a??d,onAddFacet:o})]})}function Kt({role:t,listSchema:e,activeEscalations:n,onRowClick:r,onOpenGroup:a,onAddFacet:o,forceViewAction:i,total:d,page:l,totalPages:c,pageSize:b,onPageChange:u,onPageSizeChange:f}){const p=e["x-lt-layout"],v=e["x-lt-active"]??{},m=e["x-lt-row-action"],x=n[0],h=e["x-lt-help"];pt(ht(e));const k=s.jsxs("div",{className:"border border-surface-border/60 bg-surface-sunken rounded-[0.25em] p-4",children:[s.jsx(q,{children:"Active"}),x?s.jsx(vt,{esc:x,card:v,rowAction:m,onOpen:()=>r==null?void 0:r(x),forceView:i}):s.jsx("p",{className:"text-xs text-text-tertiary italic",children:"No active item right now."})]}),N=h&&x?s.jsx("div",{className:"mb-8",children:s.jsx(I,{content:y(h,S(x))})}):h?s.jsx("div",{className:"mb-8",children:s.jsx(I,{content:h})}):null;if(p==="facet-table"){const T=d??n.length;return s.jsxs("div",{children:[s.jsx(Nt,{schema:e,rows:n,role:t,onRowClick:r,onAddFacet:o,forceView:i}),l!==void 0&&c!==void 0&&u&&s.jsx($,{page:l,totalPages:c,onPageChange:u,total:T,pageSize:b??25,onPageSizeChange:f})]})}return p==="facet-board"?s.jsxs("div",{children:[N,s.jsx(kt,{schema:e,rows:n,role:t,onOpenDetail:r,onOpenGroup:a,onAddFacet:o,forceView:i}),l!==void 0&&c!==void 0&&u&&c>1&&s.jsx($,{page:l,totalPages:c,onPageChange:u,total:d??n.length,pageSize:b??25,onPageSizeChange:f})]}):p==="active-history"?s.jsxs("div",{children:[N,s.jsxs("div",{className:"grid grid-cols-1 @split:grid-cols-[1.6fr_1fr] gap-8 @split:gap-12 items-start",children:[k,s.jsxs("div",{className:"@split:pt-4",children:[s.jsx(q,{children:"History"}),s.jsx(jt,{role:t,def:e["x-lt-history"]??{},onRowClick:r})]})]})]}):s.jsxs("div",{children:[N,k]})}const M=[{maxMs:0,color:"text-status-error"},{maxMs:300*1e3,color:"text-status-error"},{maxMs:900*1e3,color:"text-status-warning"},{maxMs:1/0,color:"text-text-secondary"}];function Tt(t){if(t<=0)return M[0].color;for(const e of M)if(t<e.maxMs)return e.color;return M[M.length-1].color}function Ut({until:t}){const[e,n]=j.useState(()=>new Date(t).getTime()-Date.now());j.useEffect(()=>{const a=setInterval(()=>{n(new Date(t).getTime()-Date.now())},1e3);return()=>clearInterval(a)},[t]);const r=j.useMemo(()=>{const a=new Date(t);return[{label:"ms",value:String(Math.max(0,e))},{label:"until",value:a.toISOString()},{label:"local",value:st(a,"MMM d, yyyy h:mm:ss a")}]},[t,e]);return s.jsx(nt,{options:r,children:s.jsx("span",{className:`text-xs font-mono ${Tt(e)}`,children:rt(e)})})}export{Ut as C,Kt as E,dt as H,Ft as a,Ct as b,y as c,$t as d,Ht as e,L as g,ft as i,Ot as m,S as r};
|
|
2
|
-
//# sourceMappingURL=CountdownTimer-D3t0XMhE.js.map
|