@hotmeshio/long-tail 0.30.3 → 0.30.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/build/api/escalations/index.d.ts +1 -0
  2. package/build/api/escalations/index.js +5 -2
  3. package/build/api/escalations/roster-action.d.ts +11 -0
  4. package/build/api/escalations/roster-action.js +47 -30
  5. package/build/api/escalations/roster-scan.d.ts +26 -0
  6. package/build/api/escalations/roster-scan.js +114 -0
  7. package/build/api/scan-codes/context.d.ts +9 -1
  8. package/build/api/scan-codes/context.js +16 -1
  9. package/build/api/scan-codes/execute.js +6 -1
  10. package/build/api/scan-codes/fill-labels.d.ts +8 -0
  11. package/build/api/scan-codes/fill-labels.js +23 -2
  12. package/build/api/scan-codes/hold.js +2 -0
  13. package/build/api/scan-codes/located.d.ts +10 -0
  14. package/build/api/scan-codes/located.js +74 -0
  15. package/build/api/scan-codes/open.d.ts +9 -0
  16. package/build/api/scan-codes/open.js +99 -0
  17. package/build/api/scan-codes/present.js +1 -0
  18. package/build/api/scan-codes/verb-fill.js +1 -1
  19. package/build/api/scan-codes/verbs-subject.d.ts +3 -1
  20. package/build/api/scan-codes/verbs-subject.js +7 -4
  21. package/build/routes/escalations/resolve.js +18 -0
  22. package/build/services/role/index.d.ts +2 -0
  23. package/build/services/role/index.js +7 -0
  24. package/build/services/role/scan-done.js +4 -1
  25. package/build/services/role/sql.d.ts +1 -0
  26. package/build/services/role/sql.js +3 -1
  27. package/build/services/role/types.d.ts +2 -0
  28. package/build/services/scan-code/index.d.ts +1 -1
  29. package/build/services/scan-code/index.js +2 -1
  30. package/build/services/scan-code/parse.d.ts +5 -1
  31. package/build/services/scan-code/parse.js +8 -2
  32. package/build/services/scan-code/validate-station.d.ts +13 -0
  33. package/build/services/scan-code/validate-station.js +81 -0
  34. package/build/services/scan-code/validate-subject.js +33 -6
  35. package/build/services/scan-code/validate.js +12 -18
  36. package/build/system/mcp-servers/admin/schemas.d.ts +471 -4
  37. package/build/system/mcp-servers/admin/schemas.js +32 -4
  38. package/build/system/mcp-servers/human-queue-lookups.d.ts +7 -0
  39. package/build/system/mcp-servers/human-queue-lookups.js +31 -0
  40. package/build/system/mcp-servers/human-queue-schemas.d.ts +7 -0
  41. package/build/system/mcp-servers/human-queue-schemas.js +4 -1
  42. package/build/system/mcp-servers/human-queue.d.ts +1 -0
  43. package/build/system/mcp-servers/human-queue.js +3 -0
  44. package/build/system/seed/tool-manifests-escalation.js +2 -2
  45. package/build/tsconfig.tsbuildinfo +1 -1
  46. package/build/types/index.d.ts +1 -1
  47. package/build/types/scan-choice.d.ts +2 -4
  48. package/build/types/scan-code/constants.d.ts +1 -0
  49. package/build/types/scan-code/constants.js +1 -0
  50. package/build/types/scan-code/response.d.ts +22 -4
  51. package/build/types/scan-code/rule.d.ts +62 -4
  52. package/dashboard/dist/assets/{AdminDashboard-VQ1fhhJP.js → AdminDashboard-D12QiMM5.js} +2 -2
  53. package/dashboard/dist/assets/{AdminDashboard-VQ1fhhJP.js.map → AdminDashboard-D12QiMM5.js.map} +1 -1
  54. package/dashboard/dist/assets/{AgentConfigPage-BOe_W2Ij.js → AgentConfigPage-BKQd9b8m.js} +2 -2
  55. package/dashboard/dist/assets/{AgentConfigPage-BOe_W2Ij.js.map → AgentConfigPage-BKQd9b8m.js.map} +1 -1
  56. package/dashboard/dist/assets/{AgentDetailPage-5ov5D9V2.js → AgentDetailPage-ie-DxsIj.js} +3 -3
  57. package/dashboard/dist/assets/{AgentDetailPage-5ov5D9V2.js.map → AgentDetailPage-ie-DxsIj.js.map} +1 -1
  58. package/dashboard/dist/assets/{AgentsPage-DDFMKHhI.js → AgentsPage-Nqm2DxCP.js} +2 -2
  59. package/dashboard/dist/assets/{AgentsPage-DDFMKHhI.js.map → AgentsPage-Nqm2DxCP.js.map} +1 -1
  60. package/dashboard/dist/assets/{AvailableEscalationsPage-GFn8Sgg1.js → AvailableEscalationsPage-BRKyG5qZ.js} +2 -2
  61. package/dashboard/dist/assets/{AvailableEscalationsPage-GFn8Sgg1.js.map → AvailableEscalationsPage-BRKyG5qZ.js.map} +1 -1
  62. package/dashboard/dist/assets/{BotPicker-Dqpo36dM.js → BotPicker-BizdmeJp.js} +2 -2
  63. package/dashboard/dist/assets/{BotPicker-Dqpo36dM.js.map → BotPicker-BizdmeJp.js.map} +1 -1
  64. package/dashboard/dist/assets/{BulkAssignModal-CmLVxkz-.js → BulkAssignModal-BWfzPrRk.js} +2 -2
  65. package/dashboard/dist/assets/{BulkAssignModal-CmLVxkz-.js.map → BulkAssignModal-BWfzPrRk.js.map} +1 -1
  66. package/dashboard/dist/assets/{CapabilitiesPage-Dfkip6_b.js → CapabilitiesPage-DT8q7Zlh.js} +2 -2
  67. package/dashboard/dist/assets/{CapabilitiesPage-Dfkip6_b.js.map → CapabilitiesPage-DT8q7Zlh.js.map} +1 -1
  68. package/dashboard/dist/assets/{CollapsibleSection-CYNYMYSa.js → CollapsibleSection-al5mqR4O.js} +2 -2
  69. package/dashboard/dist/assets/{CollapsibleSection-CYNYMYSa.js.map → CollapsibleSection-al5mqR4O.js.map} +1 -1
  70. package/dashboard/dist/assets/{ConfirmDeleteModal-CpJNP-8w.js → ConfirmDeleteModal-BrlVktv2.js} +2 -2
  71. package/dashboard/dist/assets/{ConfirmDeleteModal-CpJNP-8w.js.map → ConfirmDeleteModal-BrlVktv2.js.map} +1 -1
  72. package/dashboard/dist/assets/{ConnectedAppsPage-DXIp2Dpl.js → ConnectedAppsPage-CLAsJ2yQ.js} +2 -2
  73. package/dashboard/dist/assets/{ConnectedAppsPage-DXIp2Dpl.js.map → ConnectedAppsPage-CLAsJ2yQ.js.map} +1 -1
  74. package/dashboard/dist/assets/{CountdownTimer-CuPY7zkb.js → CountdownTimer-D2D68exl.js} +2 -2
  75. package/dashboard/dist/assets/{CountdownTimer-CuPY7zkb.js.map → CountdownTimer-D2D68exl.js.map} +1 -1
  76. package/dashboard/dist/assets/{CredentialsPage-CtrnkHcj.js → CredentialsPage-DWrZbEI0.js} +2 -2
  77. package/dashboard/dist/assets/{CredentialsPage-CtrnkHcj.js.map → CredentialsPage-DWrZbEI0.js.map} +1 -1
  78. package/dashboard/dist/assets/{CronLabel-DVjTw5Ri.js → CronLabel-DuXR8iWq.js} +2 -2
  79. package/dashboard/dist/assets/{CronLabel-DVjTw5Ri.js.map → CronLabel-DuXR8iWq.js.map} +1 -1
  80. package/dashboard/dist/assets/{ElapsedCell-gY_mGMTF.js → ElapsedCell-ronqG5-E.js} +2 -2
  81. package/dashboard/dist/assets/{ElapsedCell-gY_mGMTF.js.map → ElapsedCell-ronqG5-E.js.map} +1 -1
  82. package/dashboard/dist/assets/{EntityTimelinePanel-DJN_ZEQa.js → EntityTimelinePanel-CKsktd84.js} +2 -2
  83. package/dashboard/dist/assets/{EntityTimelinePanel-DJN_ZEQa.js.map → EntityTimelinePanel-CKsktd84.js.map} +1 -1
  84. package/dashboard/dist/assets/{EscalationListSchemaPage-A4KpTdJA.js → EscalationListSchemaPage-C954ngy3.js} +3 -3
  85. package/dashboard/dist/assets/{EscalationListSchemaPage-A4KpTdJA.js.map → EscalationListSchemaPage-C954ngy3.js.map} +1 -1
  86. package/dashboard/dist/assets/{EscalationSchemaPage-nfCn42hT.js → EscalationSchemaPage-Dij9K0ON.js} +2 -2
  87. package/dashboard/dist/assets/{EscalationSchemaPage-nfCn42hT.js.map → EscalationSchemaPage-Dij9K0ON.js.map} +1 -1
  88. package/dashboard/dist/assets/{EscalationTimeline-CLvSr1SD.js → EscalationTimeline-DT2Owdl0.js} +2 -2
  89. package/dashboard/dist/assets/{EscalationTimeline-CLvSr1SD.js.map → EscalationTimeline-DT2Owdl0.js.map} +1 -1
  90. package/dashboard/dist/assets/{EscalationTitleSelect-CT7mYHkb.js → EscalationTitleSelect-BdbfMA98.js} +2 -2
  91. package/dashboard/dist/assets/{EscalationTitleSelect-CT7mYHkb.js.map → EscalationTitleSelect-BdbfMA98.js.map} +1 -1
  92. package/dashboard/dist/assets/{EscalationsOverview-CKaGRh-E.js → EscalationsOverview-niahs84P.js} +2 -2
  93. package/dashboard/dist/assets/{EscalationsOverview-CKaGRh-E.js.map → EscalationsOverview-niahs84P.js.map} +1 -1
  94. package/dashboard/dist/assets/{EventTable-2ywJsOLy.js → EventTable-DuLMBrSx.js} +2 -2
  95. package/dashboard/dist/assets/{EventTable-2ywJsOLy.js.map → EventTable-DuLMBrSx.js.map} +1 -1
  96. package/dashboard/dist/assets/{FilterBar-Dy0b7wwf.js → FilterBar-jtY6KNpL.js} +2 -2
  97. package/dashboard/dist/assets/{FilterBar-Dy0b7wwf.js.map → FilterBar-jtY6KNpL.js.map} +1 -1
  98. package/dashboard/dist/assets/{GraphInvokePage-yOVpraAy.js → GraphInvokePage-DSRAI0Zt.js} +2 -2
  99. package/dashboard/dist/assets/{GraphInvokePage-yOVpraAy.js.map → GraphInvokePage-DSRAI0Zt.js.map} +1 -1
  100. package/dashboard/dist/assets/{HomePage-67xXjKjN.js → HomePage-BUlSnCg8.js} +2 -2
  101. package/dashboard/dist/assets/{HomePage-67xXjKjN.js.map → HomePage-BUlSnCg8.js.map} +1 -1
  102. package/dashboard/dist/assets/{LinePage-CMsYtukW.js → LinePage-BJKhVM9Y.js} +3 -3
  103. package/dashboard/dist/assets/{LinePage-CMsYtukW.js.map → LinePage-BJKhVM9Y.js.map} +1 -1
  104. package/dashboard/dist/assets/{LinesPage-pwL46mOS.js → LinesPage-CrpJua3_.js} +3 -3
  105. package/dashboard/dist/assets/{LinesPage-pwL46mOS.js.map → LinesPage-CrpJua3_.js.map} +1 -1
  106. package/dashboard/dist/assets/{ListToolbar-CJmvGy2B.js → ListToolbar-BN0UPt0L.js} +2 -2
  107. package/dashboard/dist/assets/{ListToolbar-CJmvGy2B.js.map → ListToolbar-BN0UPt0L.js.map} +1 -1
  108. package/dashboard/dist/assets/{McpOverview-DA9LLvNG.js → McpOverview-BgbJXYPh.js} +2 -2
  109. package/dashboard/dist/assets/{McpOverview-DA9LLvNG.js.map → McpOverview-BgbJXYPh.js.map} +1 -1
  110. package/dashboard/dist/assets/{McpQueryDetailPage-N7qLmfE8.js → McpQueryDetailPage-BNjm2nrc.js} +2 -2
  111. package/dashboard/dist/assets/{McpQueryDetailPage-N7qLmfE8.js.map → McpQueryDetailPage-BNjm2nrc.js.map} +1 -1
  112. package/dashboard/dist/assets/{McpQueryPage-CpsP3w7x.js → McpQueryPage-DplR8wP9.js} +2 -2
  113. package/dashboard/dist/assets/{McpQueryPage-CpsP3w7x.js.map → McpQueryPage-DplR8wP9.js.map} +1 -1
  114. package/dashboard/dist/assets/{McpRunDetailPage-qHRQ1pEY.js → McpRunDetailPage-BHVEcKV5.js} +2 -2
  115. package/dashboard/dist/assets/{McpRunDetailPage-qHRQ1pEY.js.map → McpRunDetailPage-BHVEcKV5.js.map} +1 -1
  116. package/dashboard/dist/assets/{McpRunsPage-BRDDYpTM.js → McpRunsPage-CtlLagcs.js} +2 -2
  117. package/dashboard/dist/assets/{McpRunsPage-BRDDYpTM.js.map → McpRunsPage-CtlLagcs.js.map} +1 -1
  118. package/dashboard/dist/assets/{OperationsPage-zUaab-CL.js → OperationsPage-DH67bcW9.js} +3 -3
  119. package/dashboard/dist/assets/{OperationsPage-zUaab-CL.js.map → OperationsPage-DH67bcW9.js.map} +1 -1
  120. package/dashboard/dist/assets/{OperatorDashboard-el5BquXN.js → OperatorDashboard-CMkgMewd.js} +2 -2
  121. package/dashboard/dist/assets/{OperatorDashboard-el5BquXN.js.map → OperatorDashboard-CMkgMewd.js.map} +1 -1
  122. package/dashboard/dist/assets/{PersonaDetailPage-B_tb8gfl.js → PersonaDetailPage-Cs1FFdNq.js} +2 -2
  123. package/dashboard/dist/assets/{PersonaDetailPage-B_tb8gfl.js.map → PersonaDetailPage-Cs1FFdNq.js.map} +1 -1
  124. package/dashboard/dist/assets/{PersonasPage-BPI7mqM8.js → PersonasPage-CHTRdneF.js} +2 -2
  125. package/dashboard/dist/assets/{PersonasPage-BPI7mqM8.js.map → PersonasPage-CHTRdneF.js.map} +1 -1
  126. package/dashboard/dist/assets/{PortalPage-e_rBb1do.js → PortalPage-ChB5pBTZ.js} +2 -2
  127. package/dashboard/dist/assets/{PortalPage-e_rBb1do.js.map → PortalPage-ChB5pBTZ.js.map} +1 -1
  128. package/dashboard/dist/assets/{ProcessDetailPage-D35RX1bB.js → ProcessDetailPage-CzyqSfal.js} +2 -2
  129. package/dashboard/dist/assets/{ProcessDetailPage-D35RX1bB.js.map → ProcessDetailPage-CzyqSfal.js.map} +1 -1
  130. package/dashboard/dist/assets/{ProcessesListPage-CT81miI5.js → ProcessesListPage-rOwNkaU9.js} +2 -2
  131. package/dashboard/dist/assets/{ProcessesListPage-CT81miI5.js.map → ProcessesListPage-rOwNkaU9.js.map} +1 -1
  132. package/dashboard/dist/assets/{ResolverForm-BxJkoKAO.js → ResolverForm-DibnlZ-A.js} +2 -2
  133. package/dashboard/dist/assets/{ResolverForm-BxJkoKAO.js.map → ResolverForm-DibnlZ-A.js.map} +1 -1
  134. package/dashboard/dist/assets/{RoleDetailPage-DtU7vsJm.js → RoleDetailPage-Bv9R7iQC.js} +3 -3
  135. package/dashboard/dist/assets/{RoleDetailPage-DtU7vsJm.js.map → RoleDetailPage-Bv9R7iQC.js.map} +1 -1
  136. package/dashboard/dist/assets/{RolesPage-BE7RWt9q.js → RolesPage-CUP7EH5U.js} +2 -2
  137. package/dashboard/dist/assets/{RolesPage-BE7RWt9q.js.map → RolesPage-CUP7EH5U.js.map} +1 -1
  138. package/dashboard/dist/assets/{RosterWidget-BJMx0a8Z.js → RosterWidget-DZtmQcjU.js} +2 -2
  139. package/dashboard/dist/assets/RosterWidget-DZtmQcjU.js.map +1 -0
  140. package/dashboard/dist/assets/{RunAsSelector-Co6s9bqA.js → RunAsSelector-B9-1vgZr.js} +2 -2
  141. package/dashboard/dist/assets/{RunAsSelector-Co6s9bqA.js.map → RunAsSelector-B9-1vgZr.js.map} +1 -1
  142. package/dashboard/dist/assets/{ScanCodesPage-C2TETaj5.js → ScanCodesPage-KN_e2rJl.js} +2 -2
  143. package/dashboard/dist/assets/{ScanCodesPage-C2TETaj5.js.map → ScanCodesPage-KN_e2rJl.js.map} +1 -1
  144. package/dashboard/dist/assets/{ScanSchemeDetailPage-C2UgU8l-.js → ScanSchemeDetailPage-CqItQ67Y.js} +4 -4
  145. package/dashboard/dist/assets/{ScanSchemeDetailPage-C2UgU8l-.js.map → ScanSchemeDetailPage-CqItQ67Y.js.map} +1 -1
  146. package/dashboard/dist/assets/ScanStationPage-B0qbUOwc.js +2 -0
  147. package/dashboard/dist/assets/ScanStationPage-B0qbUOwc.js.map +1 -0
  148. package/dashboard/dist/assets/{SchemeMatchFields-9H7SmbED.js → SchemeMatchFields-CL7TKnw3.js} +2 -2
  149. package/dashboard/dist/assets/{SchemeMatchFields-9H7SmbED.js.map → SchemeMatchFields-CL7TKnw3.js.map} +1 -1
  150. package/dashboard/dist/assets/{StickyPagination-miUdVAKw.js → StickyPagination-CUwxfBQH.js} +2 -2
  151. package/dashboard/dist/assets/{StickyPagination-miUdVAKw.js.map → StickyPagination-CUwxfBQH.js.map} +1 -1
  152. package/dashboard/dist/assets/{StreamMessageDetail-D5Rk7pn7.js → StreamMessageDetail-DOjcO7d2.js} +2 -2
  153. package/dashboard/dist/assets/{StreamMessageDetail-D5Rk7pn7.js.map → StreamMessageDetail-DOjcO7d2.js.map} +1 -1
  154. package/dashboard/dist/assets/{SwimlaneTimeline-B1QY1ZzH.js → SwimlaneTimeline-SPMpoLHP.js} +2 -2
  155. package/dashboard/dist/assets/{SwimlaneTimeline-B1QY1ZzH.js.map → SwimlaneTimeline-SPMpoLHP.js.map} +1 -1
  156. package/dashboard/dist/assets/{TaskDetailPage-DKUM37o8.js → TaskDetailPage-DvfzR2IQ.js} +2 -2
  157. package/dashboard/dist/assets/{TaskDetailPage-DKUM37o8.js.map → TaskDetailPage-DvfzR2IQ.js.map} +1 -1
  158. package/dashboard/dist/assets/{TasksListPage-CUulwvm-.js → TasksListPage-Jp6wmL7t.js} +2 -2
  159. package/dashboard/dist/assets/{TasksListPage-CUulwvm-.js.map → TasksListPage-Jp6wmL7t.js.map} +1 -1
  160. package/dashboard/dist/assets/{TimeAgo-CHTelacB.js → TimeAgo-BCQA0Gb_.js} +2 -2
  161. package/dashboard/dist/assets/{TimeAgo-CHTelacB.js.map → TimeAgo-BCQA0Gb_.js.map} +1 -1
  162. package/dashboard/dist/assets/{TimestampCell-NanLWLKo.js → TimestampCell-xhdMHDQt.js} +2 -2
  163. package/dashboard/dist/assets/{TimestampCell-NanLWLKo.js.map → TimestampCell-xhdMHDQt.js.map} +1 -1
  164. package/dashboard/dist/assets/{ToolTestPanel-CF1CHzgz.js → ToolTestPanel-D8M3ITrJ.js} +2 -2
  165. package/dashboard/dist/assets/{ToolTestPanel-CF1CHzgz.js.map → ToolTestPanel-D8M3ITrJ.js.map} +1 -1
  166. package/dashboard/dist/assets/{TopicDetailPage-CGO8XV_a.js → TopicDetailPage-DdBJQp31.js} +2 -2
  167. package/dashboard/dist/assets/{TopicDetailPage-CGO8XV_a.js.map → TopicDetailPage-DdBJQp31.js.map} +1 -1
  168. package/dashboard/dist/assets/{TopicsPage-Bt8gOKYr.js → TopicsPage-vpvsynD9.js} +2 -2
  169. package/dashboard/dist/assets/{TopicsPage-Bt8gOKYr.js.map → TopicsPage-vpvsynD9.js.map} +1 -1
  170. package/dashboard/dist/assets/{UserName-DKXnK7DD.js → UserName-BK6Lzsdw.js} +2 -2
  171. package/dashboard/dist/assets/{UserName-DKXnK7DD.js.map → UserName-BK6Lzsdw.js.map} +1 -1
  172. package/dashboard/dist/assets/{WorkflowExecutionPage-Crf7AIFc.js → WorkflowExecutionPage-DkM1TS4I.js} +2 -2
  173. package/dashboard/dist/assets/{WorkflowExecutionPage-Crf7AIFc.js.map → WorkflowExecutionPage-DkM1TS4I.js.map} +1 -1
  174. package/dashboard/dist/assets/{WorkflowsDashboard--isjt06C.js → WorkflowsDashboard-g_N4y3QS.js} +2 -2
  175. package/dashboard/dist/assets/{WorkflowsDashboard--isjt06C.js.map → WorkflowsDashboard-g_N4y3QS.js.map} +1 -1
  176. package/dashboard/dist/assets/{WorkflowsOverview-D7Oqf4-V.js → WorkflowsOverview-Drjo-Lu-.js} +2 -2
  177. package/dashboard/dist/assets/{WorkflowsOverview-D7Oqf4-V.js.map → WorkflowsOverview-Drjo-Lu-.js.map} +1 -1
  178. package/dashboard/dist/assets/{YamlWorkflowDetailPage-B0wxgrGP.js → YamlWorkflowDetailPage-CLltNHjZ.js} +2 -2
  179. package/dashboard/dist/assets/{YamlWorkflowDetailPage-B0wxgrGP.js.map → YamlWorkflowDetailPage-CLltNHjZ.js.map} +1 -1
  180. package/dashboard/dist/assets/{YamlWorkflowsPage-BVdLnm6K.js → YamlWorkflowsPage-CxQCB-Zi.js} +2 -2
  181. package/dashboard/dist/assets/{YamlWorkflowsPage-BVdLnm6K.js.map → YamlWorkflowsPage-CxQCB-Zi.js.map} +1 -1
  182. package/dashboard/dist/assets/{agents-CHjbjHXA.js → agents-Dk25jjhj.js} +2 -2
  183. package/dashboard/dist/assets/{agents-CHjbjHXA.js.map → agents-Dk25jjhj.js.map} +1 -1
  184. package/dashboard/dist/assets/{bots-WrUhEPWs.js → bots-bRkCqhlq.js} +2 -2
  185. package/dashboard/dist/assets/{bots-WrUhEPWs.js.map → bots-bRkCqhlq.js.map} +1 -1
  186. package/dashboard/dist/assets/{capabilities-CunMmkj8.js → capabilities-DARawLry.js} +2 -2
  187. package/dashboard/dist/assets/{capabilities-CunMmkj8.js.map → capabilities-DARawLry.js.map} +1 -1
  188. package/dashboard/dist/assets/{controlplane-D6IZIZoh.js → controlplane-DKccxxs6.js} +2 -2
  189. package/dashboard/dist/assets/{controlplane-D6IZIZoh.js.map → controlplane-DKccxxs6.js.map} +1 -1
  190. package/dashboard/dist/assets/{escalation-columns-Bvo6JI4Z.js → escalation-columns-BaYuzMYf.js} +2 -2
  191. package/dashboard/dist/assets/{escalation-columns-Bvo6JI4Z.js.map → escalation-columns-BaYuzMYf.js.map} +1 -1
  192. package/dashboard/dist/assets/{escalation-items-DFGRwo49.js → escalation-items-CwbNFnsH.js} +2 -2
  193. package/dashboard/dist/assets/{escalation-items-DFGRwo49.js.map → escalation-items-CwbNFnsH.js.map} +1 -1
  194. package/dashboard/dist/assets/{index-B8qrHwp9.js → index-BZgtzkkG.js} +2 -2
  195. package/dashboard/dist/assets/{index-B8qrHwp9.js.map → index-BZgtzkkG.js.map} +1 -1
  196. package/dashboard/dist/assets/{index-DRw0FXdX.js → index-Bx9HVzuT.js} +2 -2
  197. package/dashboard/dist/assets/{index-DRw0FXdX.js.map → index-Bx9HVzuT.js.map} +1 -1
  198. package/dashboard/dist/assets/{index-ygxyAKcc.js → index-CU2UW2y6.js} +14 -14
  199. package/dashboard/dist/assets/index-CU2UW2y6.js.map +1 -0
  200. package/dashboard/dist/assets/{index-OuKQ_0eB.js → index-Cf6qCgTf.js} +2 -2
  201. package/dashboard/dist/assets/{index-OuKQ_0eB.js.map → index-Cf6qCgTf.js.map} +1 -1
  202. package/dashboard/dist/assets/{index-DRK7M1_9.js → index-CtrSYqmL.js} +2 -2
  203. package/dashboard/dist/assets/{index-DRK7M1_9.js.map → index-CtrSYqmL.js.map} +1 -1
  204. package/dashboard/dist/assets/{index-Bo8QU31k.js → index-D1uliPqS.js} +2 -2
  205. package/dashboard/dist/assets/{index-Bo8QU31k.js.map → index-D1uliPqS.js.map} +1 -1
  206. package/dashboard/dist/assets/{index-B95LbYhW.js → index-DU-1gMks.js} +2 -2
  207. package/dashboard/dist/assets/{index-B95LbYhW.js.map → index-DU-1gMks.js.map} +1 -1
  208. package/dashboard/dist/assets/{index-CpCchhQv.js → index-DU2QCbgH.js} +2 -2
  209. package/dashboard/dist/assets/{index-CpCchhQv.js.map → index-DU2QCbgH.js.map} +1 -1
  210. package/dashboard/dist/assets/{index-BZFSXEkr.js → index-DgpL_Lgc.js} +2 -2
  211. package/dashboard/dist/assets/{index-BZFSXEkr.js.map → index-DgpL_Lgc.js.map} +1 -1
  212. package/dashboard/dist/assets/{index-boT612Jo.js → index-E_hJ7vtX.js} +2 -2
  213. package/dashboard/dist/assets/{index-boT612Jo.js.map → index-E_hJ7vtX.js.map} +1 -1
  214. package/dashboard/dist/assets/{index-DCJ483vt.js → index-dShcvdg3.js} +2 -2
  215. package/dashboard/dist/assets/{index-DCJ483vt.js.map → index-dShcvdg3.js.map} +1 -1
  216. package/dashboard/dist/assets/{index-C7EIu1mG.js → index-hKOlahpE.js} +2 -2
  217. package/dashboard/dist/assets/{index-C7EIu1mG.js.map → index-hKOlahpE.js.map} +1 -1
  218. package/dashboard/dist/assets/index-kzifJWbM.js +3 -0
  219. package/dashboard/dist/assets/index-kzifJWbM.js.map +1 -0
  220. package/dashboard/dist/assets/{knowledge-BubJBTwg.js → knowledge-DOe5ks-E.js} +2 -2
  221. package/dashboard/dist/assets/{knowledge-BubJBTwg.js.map → knowledge-DOe5ks-E.js.map} +1 -1
  222. package/dashboard/dist/assets/{machines-DSm5NFgs.js → machines-Zq_00v7k.js} +2 -2
  223. package/dashboard/dist/assets/{machines-DSm5NFgs.js.map → machines-Zq_00v7k.js.map} +1 -1
  224. package/dashboard/dist/assets/{mcp-D6MckqOV.js → mcp-BL8kD0oh.js} +2 -2
  225. package/dashboard/dist/assets/{mcp-D6MckqOV.js.map → mcp-BL8kD0oh.js.map} +1 -1
  226. package/dashboard/dist/assets/{mcp-query-VyCdOag6.js → mcp-query-BpokmJWi.js} +2 -2
  227. package/dashboard/dist/assets/{mcp-query-VyCdOag6.js.map → mcp-query-BpokmJWi.js.map} +1 -1
  228. package/dashboard/dist/assets/{personas-CyJc10xe.js → personas-BubCnQZ8.js} +2 -2
  229. package/dashboard/dist/assets/{personas-CyJc10xe.js.map → personas-BubCnQZ8.js.map} +1 -1
  230. package/dashboard/dist/assets/{pipelines-B2inDtx3.js → pipelines--DUoMx7K.js} +2 -2
  231. package/dashboard/dist/assets/{pipelines-B2inDtx3.js.map → pipelines--DUoMx7K.js.map} +1 -1
  232. package/dashboard/dist/assets/{tasks-DOP4d3M6.js → tasks-CJXN4OB4.js} +2 -2
  233. package/dashboard/dist/assets/{tasks-DOP4d3M6.js.map → tasks-CJXN4OB4.js.map} +1 -1
  234. package/dashboard/dist/assets/{topics-CNOjSWpX.js → topics-CAG08Ruo.js} +2 -2
  235. package/dashboard/dist/assets/{topics-CNOjSWpX.js.map → topics-CAG08Ruo.js.map} +1 -1
  236. package/dashboard/dist/assets/{useDebouncedValue-CgO0TGMd.js → useDebouncedValue-DQ2D8cm2.js} +2 -2
  237. package/dashboard/dist/assets/{useDebouncedValue-CgO0TGMd.js.map → useDebouncedValue-DQ2D8cm2.js.map} +1 -1
  238. package/dashboard/dist/assets/{useNamespace-BWHvUKtK.js → useNamespace-DjEVAlJQ.js} +2 -2
  239. package/dashboard/dist/assets/{useNamespace-BWHvUKtK.js.map → useNamespace-DjEVAlJQ.js.map} +1 -1
  240. package/dashboard/dist/assets/{useYamlActivityEvents-BZQ__ZGD.js → useYamlActivityEvents-etcpfIwo.js} +2 -2
  241. package/dashboard/dist/assets/{useYamlActivityEvents-BZQ__ZGD.js.map → useYamlActivityEvents-etcpfIwo.js.map} +1 -1
  242. package/dashboard/dist/assets/{validate-CAin6WM_.js → validate-YJK_6a7m.js} +2 -2
  243. package/dashboard/dist/assets/{validate-CAin6WM_.js.map → validate-YJK_6a7m.js.map} +1 -1
  244. package/dashboard/dist/assets/{yaml-workflows-Dyln3od-.js → yaml-workflows-D97Bz6li.js} +2 -2
  245. package/dashboard/dist/assets/{yaml-workflows-Dyln3od-.js.map → yaml-workflows-D97Bz6li.js.map} +1 -1
  246. package/dashboard/dist/index.html +1 -1
  247. package/docs/api/http/escalations.md +15 -0
  248. package/docs/api/mcp/human-queue.md +5 -1
  249. package/docs/dashboard.md +3 -3
  250. package/docs/hitl/lookups.md +2 -0
  251. package/docs/hitl/x-lt-roster.md +2 -0
  252. package/docs/hitl/x-lt-scan.md +12 -0
  253. package/docs/mcp.md +2 -0
  254. package/docs/scan-codes.md +87 -5
  255. package/package.json +1 -1
  256. package/dashboard/dist/assets/RosterWidget-BJMx0a8Z.js.map +0 -1
  257. package/dashboard/dist/assets/ScanStationPage-nWYz-OD3.js +0 -2
  258. package/dashboard/dist/assets/ScanStationPage-nWYz-OD3.js.map +0 -1
  259. package/dashboard/dist/assets/index-P-DlgAWj.js +0 -3
  260. package/dashboard/dist/assets/index-P-DlgAWj.js.map +0 -1
  261. package/dashboard/dist/assets/index-ygxyAKcc.js.map +0 -1
@@ -8,6 +8,7 @@ export { resolveEscalation, resolveBySignalKey, resolveByIds, resolveAllOrNone }
8
8
  export { resolveBatchItem, resolveBatchItemBySignalKey, resolveBatchItemByMetadata } from './resolve-batch';
9
9
  export { flagBatchItem, unflagBatchItem } from './batch-flag';
10
10
  export { runRosterAction, ROSTER_ACTION_OUTCOMES } from './roster-action';
11
+ export { runRosterScan, ROSTER_SCAN_OUTCOMES } from './roster-scan';
11
12
  export { accumulateItem, accumulateItemBySignalKey, accumulateItemByMetadata, removeItem, removeItemBySignalKey, removeItemByMetadata, getEscalationItems, getEscalationItemsBySignalKey, itemsView, } from './accumulate';
12
13
  export { findByMetadata, claimByMetadata, resolveByMetadata } from './metadata';
13
14
  export { cancelSingleEscalation, bulkCancel } from './cancel';
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.aggregateByFacets = exports.claimByFacets = exports.claimGroups = exports.searchByFacets = exports.bulkCancel = exports.cancelSingleEscalation = exports.resolveByMetadata = exports.claimByMetadata = exports.findByMetadata = exports.itemsView = exports.getEscalationItemsBySignalKey = exports.getEscalationItems = exports.removeItemByMetadata = exports.removeItemBySignalKey = exports.removeItem = exports.accumulateItemByMetadata = exports.accumulateItemBySignalKey = exports.accumulateItem = exports.ROSTER_ACTION_OUTCOMES = exports.runRosterAction = exports.unflagBatchItem = exports.flagBatchItem = exports.resolveBatchItemByMetadata = exports.resolveBatchItemBySignalKey = exports.resolveBatchItem = exports.resolveAllOrNone = exports.resolveByIds = exports.resolveBySignalKey = exports.resolveEscalation = exports.bulkTriage = exports.bulkEscalate = exports.bulkUnassign = exports.bulkAssign = exports.bulkClaim = exports.updatePriority = exports.releaseExpiredClaims = exports.releaseEscalation = exports.claimEscalation = exports.getEscalationLookups = exports.escalateToRole = exports.getEscalationsByWorkflowId = exports.getEscalation = exports.getStationMetrics = exports.getEscalationStats = exports.listFacetValues = exports.listFacetKeys = exports.listDistinctTypes = exports.listAvailableEscalations = exports.listEscalations = exports.createEscalation = void 0;
4
- exports.getRelatedRows = exports.getRelatedAggregates = exports.timelineByFacet = void 0;
3
+ exports.claimGroups = exports.searchByFacets = exports.bulkCancel = exports.cancelSingleEscalation = exports.resolveByMetadata = exports.claimByMetadata = exports.findByMetadata = exports.itemsView = exports.getEscalationItemsBySignalKey = exports.getEscalationItems = exports.removeItemByMetadata = exports.removeItemBySignalKey = exports.removeItem = exports.accumulateItemByMetadata = exports.accumulateItemBySignalKey = exports.accumulateItem = exports.ROSTER_SCAN_OUTCOMES = exports.runRosterScan = exports.ROSTER_ACTION_OUTCOMES = exports.runRosterAction = exports.unflagBatchItem = exports.flagBatchItem = exports.resolveBatchItemByMetadata = exports.resolveBatchItemBySignalKey = exports.resolveBatchItem = exports.resolveAllOrNone = exports.resolveByIds = exports.resolveBySignalKey = exports.resolveEscalation = exports.bulkTriage = exports.bulkEscalate = exports.bulkUnassign = exports.bulkAssign = exports.bulkClaim = exports.updatePriority = exports.releaseExpiredClaims = exports.releaseEscalation = exports.claimEscalation = exports.getEscalationLookups = exports.escalateToRole = exports.getEscalationsByWorkflowId = exports.getEscalation = exports.getStationMetrics = exports.getEscalationStats = exports.listFacetValues = exports.listFacetKeys = exports.listDistinctTypes = exports.listAvailableEscalations = exports.listEscalations = exports.createEscalation = void 0;
4
+ exports.getRelatedRows = exports.getRelatedAggregates = exports.timelineByFacet = exports.aggregateByFacets = exports.claimByFacets = void 0;
5
5
  var create_1 = require("./create");
6
6
  Object.defineProperty(exports, "createEscalation", { enumerable: true, get: function () { return create_1.createEscalation; } });
7
7
  var list_1 = require("./list");
@@ -44,6 +44,9 @@ Object.defineProperty(exports, "unflagBatchItem", { enumerable: true, get: funct
44
44
  var roster_action_1 = require("./roster-action");
45
45
  Object.defineProperty(exports, "runRosterAction", { enumerable: true, get: function () { return roster_action_1.runRosterAction; } });
46
46
  Object.defineProperty(exports, "ROSTER_ACTION_OUTCOMES", { enumerable: true, get: function () { return roster_action_1.ROSTER_ACTION_OUTCOMES; } });
47
+ var roster_scan_1 = require("./roster-scan");
48
+ Object.defineProperty(exports, "runRosterScan", { enumerable: true, get: function () { return roster_scan_1.runRosterScan; } });
49
+ Object.defineProperty(exports, "ROSTER_SCAN_OUTCOMES", { enumerable: true, get: function () { return roster_scan_1.ROSTER_SCAN_OUTCOMES; } });
47
50
  var accumulate_1 = require("./accumulate");
48
51
  Object.defineProperty(exports, "accumulateItem", { enumerable: true, get: function () { return accumulate_1.accumulateItem; } });
49
52
  Object.defineProperty(exports, "accumulateItemBySignalKey", { enumerable: true, get: function () { return accumulate_1.accumulateItemBySignalKey; } });
@@ -1,4 +1,5 @@
1
1
  import type { LTApiAuth, LTApiResult } from '../../types/sdk';
2
+ import type { LTEscalationRecord } from '../../types';
2
3
  /** Outcomes a roster action answers with besides the act's own result. */
3
4
  export declare const ROSTER_ACTION_OUTCOMES: {
4
5
  /** The action is limited to roles the person acting does not hold, and no badge rode the request. */
@@ -35,3 +36,13 @@ export interface RosterActionInput {
35
36
  * act that does not land returns the use.
36
37
  */
37
38
  export declare function runRosterAction(input: RosterActionInput, auth: LTApiAuth): Promise<LTApiResult>;
39
+ /** The host row and one field of its pinned form, or null when the row is gone or unreadable. */
40
+ export declare function loadHostField(id: string, field: string, auth: LTApiAuth): Promise<{
41
+ host: LTEscalationRecord;
42
+ fieldSchema: Record<string, unknown> | undefined;
43
+ } | null>;
44
+ /** Spend the badge, run the act, and return the use when the act does not land. */
45
+ export declare function spendAndRun(actingToken: string | undefined, run: () => Promise<LTApiResult>): Promise<LTApiResult>;
46
+ /** The person acting: the badge's person when one rides the request, read without spending it. */
47
+ export declare function actorFor(actingToken: string | undefined, auth: LTApiAuth): Promise<LTApiAuth | LTApiResult>;
48
+ export declare function refusal(status: number, outcome: string, error: string): LTApiResult;
@@ -35,6 +35,10 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.ROSTER_ACTION_OUTCOMES = void 0;
37
37
  exports.runRosterAction = runRosterAction;
38
+ exports.loadHostField = loadHostField;
39
+ exports.spendAndRun = spendAndRun;
40
+ exports.actorFor = actorFor;
41
+ exports.refusal = refusal;
38
42
  const escalationService = __importStar(require("../../services/escalation"));
39
43
  const userService = __importStar(require("../../services/user"));
40
44
  const roster_1 = require("../../services/escalation/roster");
@@ -77,14 +81,10 @@ async function runRosterAction(input, auth) {
77
81
  return { status: 400, error: 'id, field, action and entry are required' };
78
82
  }
79
83
  // 1. The host row and its form, as the page that offered the action read them
80
- const detail = await escalationService.getEscalationWithFormSchema(input.id);
81
- if (!detail || (await (0, helpers_1.assertReadAccess)(auth.userId, detail.escalation))) {
84
+ const loaded = await loadHostField(input.id, input.field, auth);
85
+ if (!loaded)
82
86
  return { status: 404, error: 'Escalation not found' };
83
- }
84
- const host = detail.escalation;
85
- const embedded = host.metadata?.form_schema;
86
- const schema = (embedded && typeof embedded === 'object' ? embedded : detail.form_schema);
87
- const fieldSchema = schema?.properties?.[input.field];
87
+ const { host, fieldSchema } = loaded;
88
88
  const def = (0, form_validation_1.readRosterDef)(fieldSchema);
89
89
  const action = (0, form_validation_1.readRosterActions)(fieldSchema)[input.action];
90
90
  if (!def || !action)
@@ -104,40 +104,57 @@ async function runRosterAction(input, auth) {
104
104
  return { status: 422, error, data: { error, outcome: 'code_mismatch' } };
105
105
  }
106
106
  // 3. The person acting: the badge's person when one rides the request, read without spending it
107
- let actor = auth;
108
- if (input.actingToken) {
109
- const peeked = await (0, acting_identity_1.peekActingAuth)(input.actingToken);
110
- if (!peeked.ok)
111
- return refusal(401, exports.ROSTER_ACTION_OUTCOMES.NOT_PRIMED, peeked.error);
112
- actor = peeked.auth;
113
- }
107
+ const actor = await actorFor(input.actingToken, auth);
108
+ if ('status' in actor)
109
+ return actor;
114
110
  if (!(await holdsRole(action, actor.userId))) {
115
111
  return input.actingToken
116
112
  ? refusal(403, exports.ROSTER_ACTION_OUTCOMES.ROLE_REFUSED, (0, form_validation_1.actionRefusal)(action))
117
113
  : refusal(403, exports.ROSTER_ACTION_OUTCOMES.NEEDS_BADGE, (0, form_validation_1.actionRefusal)(action));
118
114
  }
119
115
  // 4. Spend the badge, run the act, and return the use when it does not land
120
- let remaining;
121
- if (input.actingToken) {
122
- const spent = await (0, acting_identity_1.consumeActingGrant)(input.actingToken);
123
- if (!spent.ok)
124
- return refusal(401, exports.ROSTER_ACTION_OUTCOMES.NOT_PRIMED, spent.error);
125
- remaining = spent.grant.remaining;
126
- }
127
- const result = await runAct(kind, action, entry, host.id, ctx, input.code, actor);
128
- if (input.actingToken && result.status >= 300) {
129
- await (0, acting_identity_1.refundActingGrant)(input.actingToken, false);
130
- return result;
131
- }
132
- if (input.actingToken && result.data && typeof result.data === 'object') {
133
- result.data = { ...result.data, acting: { remaining } };
134
- }
135
- return result;
116
+ return spendAndRun(input.actingToken, () => runAct(kind, action, entry, host.id, ctx, input.code, actor));
136
117
  }
137
118
  catch (err) {
138
119
  return { status: 500, error: err.message };
139
120
  }
140
121
  }
122
+ /** The host row and one field of its pinned form, or null when the row is gone or unreadable. */
123
+ async function loadHostField(id, field, auth) {
124
+ const detail = await escalationService.getEscalationWithFormSchema(id);
125
+ if (!detail || (await (0, helpers_1.assertReadAccess)(auth.userId, detail.escalation)))
126
+ return null;
127
+ const host = detail.escalation;
128
+ const embedded = host.metadata?.form_schema;
129
+ const schema = (embedded && typeof embedded === 'object' ? embedded : detail.form_schema);
130
+ return { host, fieldSchema: schema?.properties?.[field] };
131
+ }
132
+ /** Spend the badge, run the act, and return the use when the act does not land. */
133
+ async function spendAndRun(actingToken, run) {
134
+ let remaining;
135
+ if (actingToken) {
136
+ const spent = await (0, acting_identity_1.consumeActingGrant)(actingToken);
137
+ if (!spent.ok)
138
+ return refusal(401, exports.ROSTER_ACTION_OUTCOMES.NOT_PRIMED, spent.error);
139
+ remaining = spent.grant.remaining;
140
+ }
141
+ const result = await run();
142
+ if (actingToken && result.status >= 300) {
143
+ await (0, acting_identity_1.refundActingGrant)(actingToken, false);
144
+ return result;
145
+ }
146
+ if (actingToken && result.data && typeof result.data === 'object') {
147
+ result.data = { ...result.data, acting: { remaining } };
148
+ }
149
+ return result;
150
+ }
151
+ /** The person acting: the badge's person when one rides the request, read without spending it. */
152
+ async function actorFor(actingToken, auth) {
153
+ if (!actingToken)
154
+ return auth;
155
+ const peeked = await (0, acting_identity_1.peekActingAuth)(actingToken);
156
+ return peeked.ok ? peeked.auth : refusal(401, exports.ROSTER_ACTION_OUTCOMES.NOT_PRIMED, peeked.error);
157
+ }
141
158
  async function holdsRole(action, userId) {
142
159
  if (!action.roles?.length)
143
160
  return true;
@@ -0,0 +1,26 @@
1
+ import type { LTApiAuth, LTApiResult } from '../../types/sdk';
2
+ /** Outcomes a roster scan answers with besides the fill's own result. */
3
+ export declare const ROSTER_SCAN_OUTCOMES: {
4
+ /** The field takes no scans, or not this code's scheme. */
5
+ readonly NOT_ACCEPTED: "not_accepted";
6
+ /** No open entry on the list is this code. */
7
+ readonly UNEXPECTED: "unexpected";
8
+ };
9
+ export interface RosterScanInput {
10
+ /** The host row: the escalation whose form declares the roster. */
11
+ id: string;
12
+ /** The roster field. */
13
+ field: string;
14
+ /** The code as scanned. */
15
+ code: string;
16
+ /** A badge grant: the fill runs as its person. */
17
+ actingToken?: string;
18
+ }
19
+ /**
20
+ * A scan into a batch roster on an open form. The field must declare
21
+ * `x-lt-scan` accepting the code's scheme; the scan fills the first open
22
+ * entry whose key is that code, as the person acting, with `scannedCode` as
23
+ * the entry's payload. Nothing about the request is trusted: the roster and
24
+ * its entries are re-read from the host row.
25
+ */
26
+ export declare function runRosterScan(input: RosterScanInput, auth: LTApiAuth): Promise<LTApiResult>;
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ROSTER_SCAN_OUTCOMES = void 0;
37
+ exports.runRosterScan = runRosterScan;
38
+ const scanCodeService = __importStar(require("../../services/scan-code"));
39
+ const roster_1 = require("../../services/escalation/roster");
40
+ const form_validation_1 = require("../../shared/form-validation");
41
+ const types_1 = require("../../types");
42
+ const roster_action_1 = require("./roster-action");
43
+ const resolve_batch_1 = require("./resolve-batch");
44
+ /** Outcomes a roster scan answers with besides the fill's own result. */
45
+ exports.ROSTER_SCAN_OUTCOMES = {
46
+ /** The field takes no scans, or not this code's scheme. */
47
+ NOT_ACCEPTED: 'not_accepted',
48
+ /** No open entry on the list is this code. */
49
+ UNEXPECTED: 'unexpected',
50
+ };
51
+ const STOCK_UNEXPECTED = 'Not one of the items expected here.';
52
+ /** A batch fill whose key was filled since the roster was read. */
53
+ const DUPLICATE_ITEM = 'duplicate-item';
54
+ function refused(status, outcome, error) {
55
+ return { status, error, data: { error, outcome } };
56
+ }
57
+ /**
58
+ * A scan into a batch roster on an open form. The field must declare
59
+ * `x-lt-scan` accepting the code's scheme; the scan fills the first open
60
+ * entry whose key is that code, as the person acting, with `scannedCode` as
61
+ * the entry's payload. Nothing about the request is trusted: the roster and
62
+ * its entries are re-read from the host row.
63
+ */
64
+ async function runRosterScan(input, auth) {
65
+ try {
66
+ if (!input?.id || typeof input.field !== 'string' || typeof input.code !== 'string' || !input.code.trim()) {
67
+ return { status: 400, error: 'id, field and code are required' };
68
+ }
69
+ // 1. The host row and a batch roster that takes this code's scheme
70
+ const loaded = await (0, roster_action_1.loadHostField)(input.id, input.field, auth);
71
+ if (!loaded)
72
+ return { status: 404, error: 'Escalation not found' };
73
+ const def = (0, form_validation_1.readRosterDef)(loaded.fieldSchema);
74
+ const sink = (0, form_validation_1.readScanSink)(loaded.fieldSchema);
75
+ if (!def || !('batch' in def.expected) || !sink) {
76
+ return refused(409, exports.ROSTER_SCAN_OUTCOMES.NOT_ACCEPTED, 'This list takes no scans');
77
+ }
78
+ const parsed = scanCodeService.parseScanCode(input.code.trim(), await scanCodeService.listScanSchemes());
79
+ if (!parsed.ok || parsed.scheme.kind !== types_1.SCAN_SCHEME_KINDS.ACTION || !sink.schemes.includes(parsed.parsed.version)) {
80
+ return refused(422, exports.ROSTER_SCAN_OUTCOMES.NOT_ACCEPTED, 'This list takes no code like that');
81
+ }
82
+ const value = sink.value === 'code' ? (parsed.parsed.raw ?? input.code.trim()) : parsed.parsed.target;
83
+ // 2. The open entries this code names, on the roster the server computes
84
+ const { escalation, metadata, envelope, payload } = (0, form_validation_1.rosterRowContext)(loaded.host);
85
+ const ctx = { escalation, metadata, envelope, payload };
86
+ const roster = await (0, roster_1.loadRoster)(def, ctx);
87
+ const named = roster.entries.filter((e) => (0, form_validation_1.enteredCodeMatches)(value, e.key, def.countedBy));
88
+ const open = named.filter((e) => e.state !== form_validation_1.ROSTER_STATES.IN);
89
+ if (open.length === 0) {
90
+ const error = named.length ? `All ${named.length} of these are already checked off.` : STOCK_UNEXPECTED;
91
+ return refused(422, exports.ROSTER_SCAN_OUTCOMES.UNEXPECTED, error);
92
+ }
93
+ // 3. Fill as the person acting; an entry taken since the read moves to the next
94
+ const actor = await (0, roster_action_1.actorFor)(input.actingToken, auth);
95
+ if ('status' in actor)
96
+ return actor;
97
+ return (0, roster_action_1.spendAndRun)(input.actingToken, async () => {
98
+ let result = { status: 409, error: 'Those entries were just checked off' };
99
+ for (const entry of open) {
100
+ result = await (0, resolve_batch_1.resolveBatchItem)({
101
+ id: loaded.host.id,
102
+ itemKey: entry.key,
103
+ resolverPayload: { scannedCode: input.code.trim() },
104
+ }, actor);
105
+ if (result.data?.outcome !== DUPLICATE_ITEM)
106
+ return result;
107
+ }
108
+ return result;
109
+ });
110
+ }
111
+ catch (err) {
112
+ return { status: 500, error: err.message };
113
+ }
114
+ }
@@ -1,5 +1,5 @@
1
1
  import * as scanCodeService from '../../services/scan-code';
2
- import { type LTEscalationRecord, type ParsedScanCode, type ScanExecuteResponse, type ScanRule, type ScanScheme, type ScanStep } from '../../types';
2
+ import { type LTEscalationRecord, type ParsedScanCode, type ScanDoneCopy, type ScanExecuteResponse, type ScanRule, type ScanScheme, type ScanStep } from '../../types';
3
3
  import type { LTApiAuth, LTApiResult } from '../../types/sdk';
4
4
  /** The held subject, re-derived from the client's pointer on this request. */
5
5
  export interface HeldSubject {
@@ -42,6 +42,10 @@ export interface StepContext {
42
42
  subject?: HeldSubject;
43
43
  /** The station sent a subject pointer that no longer checks out. */
44
44
  subjectStale?: boolean;
45
+ /** The scanned code's own pending row, read once a step's copy or Open asks for it; null when none. */
46
+ located?: LTEscalationRecord | null;
47
+ /** The located row's role title. */
48
+ locatedTitle?: string | null;
45
49
  }
46
50
  export declare function targetFilter(step: ScanStep, ctx: StepContext): Record<string, any>;
47
51
  /**
@@ -51,6 +55,8 @@ export declare function targetFilter(step: ScanStep, ctx: StepContext): Record<s
51
55
  */
52
56
  export declare function targetValue(ctx: Pick<StepContext, 'scheme' | 'parsed'>): string | string[];
53
57
  export declare function templateContext(ctx: StepContext): scanCodeService.ScanTemplateContext;
58
+ /** The `{located.x}` bag: the row's metadata plus its id, role and role title. */
59
+ export declare function locatedBag(row: LTEscalationRecord, title?: string | null): Record<string, unknown>;
54
60
  /** The `{subject.x}` bag: the held row's metadata plus its id. */
55
61
  export declare function subjectBag(row: LTEscalationRecord): Record<string, unknown>;
56
62
  /**
@@ -85,6 +91,8 @@ export declare function templated<T>(step: ScanStep, ctx: StepContext, render: (
85
91
  * batch); an unreadable token renders empty rather than failing the act.
86
92
  */
87
93
  export declare function withDone(result: LTApiResult<ScanExecuteResponse>, step: Pick<ScanStep, 'done'>, tpl: scanCodeService.ScanTemplateContext): LTApiResult<ScanExecuteResponse>;
94
+ /** A done copy rendered for the station: the markdown, its pause, and the line under it. */
95
+ export declare function renderDone(done: ScanDoneCopy, tpl: scanCodeService.ScanTemplateContext): ScanDoneCopy;
88
96
  /**
89
97
  * Attach the step's `follow` to a write that completed the held subject: the
90
98
  * code the station replays and the target it waits for, so the subject's
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.targetFilter = targetFilter;
37
37
  exports.targetValue = targetValue;
38
38
  exports.templateContext = templateContext;
39
+ exports.locatedBag = locatedBag;
39
40
  exports.subjectBag = subjectBag;
40
41
  exports.liveClaimMetadata = liveClaimMetadata;
41
42
  exports.stepTemplate = stepTemplate;
@@ -48,6 +49,7 @@ exports.notPrimed = notPrimed;
48
49
  exports.refused = refused;
49
50
  exports.templated = templated;
50
51
  exports.withDone = withDone;
52
+ exports.renderDone = renderDone;
51
53
  exports.withFollow = withFollow;
52
54
  const scanCodeService = __importStar(require("../../services/scan-code"));
53
55
  const escalationService = __importStar(require("../../services/escalation"));
@@ -70,8 +72,13 @@ function templateContext(ctx) {
70
72
  scannedAt: ctx.scannedAt,
71
73
  code: ctx.parsed.raw ?? ctx.parsed.target,
72
74
  ...(ctx.subject ? { subject: subjectBag(ctx.subject.row) } : {}),
75
+ ...(ctx.located ? { located: locatedBag(ctx.located, ctx.locatedTitle) } : {}),
73
76
  };
74
77
  }
78
+ /** The `{located.x}` bag: the row's metadata plus its id, role and role title. */
79
+ function locatedBag(row, title) {
80
+ return { ...(row.metadata ?? {}), id: row.id, role: row.role, roleTitle: title || row.role };
81
+ }
75
82
  /** The `{subject.x}` bag: the held row's metadata plus its id. */
76
83
  function subjectBag(row) {
77
84
  return { ...(row.metadata ?? {}), id: row.id };
@@ -168,7 +175,15 @@ function withDone(result, step, tpl) {
168
175
  const data = result.data;
169
176
  if (!step.done || !data || data.outcome !== types_1.SCAN_OUTCOMES.EXECUTED || data.already || data.done)
170
177
  return result;
171
- return { ...result, data: { ...data, done: { markdown: scanCodeService.renderScanCopy(step.done.markdown, tpl) } } };
178
+ return { ...result, data: { ...data, done: renderDone(step.done, tpl) } };
179
+ }
180
+ /** A done copy rendered for the station: the markdown, its pause, and the line under it. */
181
+ function renderDone(done, tpl) {
182
+ return {
183
+ markdown: scanCodeService.renderScanCopy(done.markdown, tpl),
184
+ ...(done.afterSeconds !== undefined ? { afterSeconds: done.afterSeconds } : {}),
185
+ ...(done.nextPrompt ? { nextPrompt: scanCodeService.renderScanCopy(done.nextPrompt, tpl) } : {}),
186
+ };
172
187
  }
173
188
  /**
174
189
  * Attach the step's `follow` to a write that completed the held subject: the
@@ -39,7 +39,9 @@ const identity_1 = require("./identity");
39
39
  const context_1 = require("./context");
40
40
  const grant_1 = require("./grant");
41
41
  const hold_1 = require("./hold");
42
+ const located_1 = require("./located");
42
43
  const locate_1 = require("./locate");
44
+ const open_1 = require("./open");
43
45
  const present_1 = require("./present");
44
46
  const subject_1 = require("./subject");
45
47
  const verb_fill_1 = require("./verb-fill");
@@ -116,7 +118,8 @@ async function executeScanCode(input, auth) {
116
118
  const stepResult = await executeStep(rule.steps[i], ctx);
117
119
  if (stepResult) {
118
120
  const step = rule.steps[i];
119
- result = decorate((0, context_1.withFollow)((0, context_1.withDone)(stepResult, step, (0, context_1.templateContext)(ctx)), step, ctx), ctx, i);
121
+ const answered = (0, context_1.withFollow)((0, context_1.withDone)(stepResult, step, (0, context_1.templateContext)(ctx)), step, ctx);
122
+ result = decorate(await (0, open_1.withOpen)(answered, step, ctx), ctx, i);
120
123
  }
121
124
  }
122
125
  // 4. Nothing matched: a stale subject, or the fallback screen
@@ -177,6 +180,8 @@ function subjectGateOpen(step, ctx) {
177
180
  async function executeStep(step, ctx) {
178
181
  if (!subjectGateOpen(step, ctx))
179
182
  return null;
183
+ if ((0, located_1.readsLocated)(step))
184
+ await (0, located_1.loadLocated)(ctx);
180
185
  // The identity pre-condition: the effective actor must be a real acting
181
186
  // identity — a badge grant, or an authenticated user whose own write scope
182
187
  // covers the step. A write-incapable shared account can never self-satisfy,
@@ -3,6 +3,14 @@ import { type LTEscalationRecord, type ScanFillParams, type ScanScheme } from '.
3
3
  export type EntryLabeler = (key: string, code: string) => string;
4
4
  /** The code as the package prints it on a GTIN scheme, as scanned otherwise. */
5
5
  export declare function printedCode(code: string, scheme: ScanScheme): string;
6
+ /** A per-key map the batch row carries (`envelope.<map>` or `metadata.<map>`); empty when absent. */
7
+ export declare function rowMap(path: string, row: LTEscalationRecord): Record<string, unknown>;
8
+ /**
9
+ * The open keys in the order a fill tries them. With `prefer`, the keys whose
10
+ * mapped value equals (or, for a list, contains) the held subject's target
11
+ * come first; the rest keep the row's order.
12
+ */
13
+ export declare function preferredKeys(keys: string[], fill: ScanFillParams, row: LTEscalationRecord, heldTarget: string | undefined): string[];
6
14
  /**
7
15
  * The labeler a fill step declares, or null without `labels`. The map is
8
16
  * read from the batch row (`envelope.<map>` or `metadata.<map>`) and keyed by
@@ -34,6 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.printedCode = printedCode;
37
+ exports.rowMap = rowMap;
38
+ exports.preferredKeys = preferredKeys;
37
39
  exports.entryLabeler = entryLabeler;
38
40
  exports.pendingLabels = pendingLabels;
39
41
  const scanCodeService = __importStar(require("../../services/scan-code"));
@@ -63,6 +65,26 @@ function asObject(v) {
63
65
  function printedCode(code, scheme) {
64
66
  return scheme.encoding === types_1.SCAN_ENCODINGS.GTIN ? scanCodeService.displayGtin(code) : code;
65
67
  }
68
+ /** A per-key map the batch row carries (`envelope.<map>` or `metadata.<map>`); empty when absent. */
69
+ function rowMap(path, row) {
70
+ const map = (0, ctx_path_1.resolveCtxPath)(path, { envelope: asObject(row.envelope), metadata: asObject(row.metadata) });
71
+ return isRecord(map) ? map : {};
72
+ }
73
+ /**
74
+ * The open keys in the order a fill tries them. With `prefer`, the keys whose
75
+ * mapped value equals (or, for a list, contains) the held subject's target
76
+ * come first; the rest keep the row's order.
77
+ */
78
+ function preferredKeys(keys, fill, row, heldTarget) {
79
+ if (!fill.prefer || heldTarget === undefined)
80
+ return keys;
81
+ const owners = rowMap(fill.prefer, row);
82
+ const owns = (key) => {
83
+ const value = owners[key];
84
+ return (Array.isArray(value) ? value : [value]).some((v) => v !== null && v !== undefined && String(v) === heldTarget);
85
+ };
86
+ return [...keys.filter(owns), ...keys.filter((key) => !owns(key))];
87
+ }
66
88
  /**
67
89
  * The labeler a fill step declares, or null without `labels`. The map is
68
90
  * read from the batch row (`envelope.<map>` or `metadata.<map>`) and keyed by
@@ -73,8 +95,7 @@ function printedCode(code, scheme) {
73
95
  function entryLabeler(fill, row, scheme) {
74
96
  if (!fill.labels)
75
97
  return null;
76
- const map = (0, ctx_path_1.resolveCtxPath)(fill.labels, { envelope: asObject(row.envelope), metadata: asObject(row.metadata) });
77
- const labels = isRecord(map) ? map : {};
98
+ const labels = rowMap(fill.labels, row);
78
99
  return (key, code) => {
79
100
  const printed = printedCode(code, scheme);
80
101
  const value = labels[key];
@@ -79,6 +79,8 @@ async function heldSubject(step, ctx, row) {
79
79
  } : {}),
80
80
  ...(claimant ? { claimedBy: claimant } : {}),
81
81
  ...(hold.show ? { show: hold.show } : {}),
82
+ ...(hold.release ? { release: hold.release } : {}),
83
+ ...(hold.whenAllIn ? { whenAllIn: (0, context_1.renderDone)(hold.whenAllIn, tpl) } : {}),
82
84
  };
83
85
  }
84
86
  /** The canonical code for the held row, as the station would scan it. */
@@ -0,0 +1,10 @@
1
+ import type { ScanStep } from '../../types';
2
+ import { type StepContext } from './context';
3
+ /** True when the step's copy or Open reads the scanned code's own pending row. */
4
+ export declare function readsLocated(step: ScanStep): boolean;
5
+ /**
6
+ * The scanned code's own pending row, read once per request: the newest
7
+ * pending row whose scheme facet holds the scanned target, in any role the
8
+ * actor may read, other than the held subject. Sets null when there is none.
9
+ */
10
+ export declare function loadLocated(ctx: StepContext): Promise<void>;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.readsLocated = readsLocated;
37
+ exports.loadLocated = loadLocated;
38
+ const scanCodeService = __importStar(require("../../services/scan-code"));
39
+ const escalationService = __importStar(require("../../services/escalation"));
40
+ const role_1 = require("../../services/role");
41
+ const helpers_1 = require("../escalations/helpers");
42
+ const metadata_1 = require("../escalations/metadata");
43
+ const context_1 = require("./context");
44
+ /** True when the step's copy or Open reads the scanned code's own pending row. */
45
+ function readsLocated(step) {
46
+ return step.open?.target === 'located'
47
+ || scanCodeService.mentionsLocatedToken(step.refuse)
48
+ || scanCodeService.mentionsLocatedToken(step.done);
49
+ }
50
+ /**
51
+ * The scanned code's own pending row, read once per request: the newest
52
+ * pending row whose scheme facet holds the scanned target, in any role the
53
+ * actor may read, other than the held subject. Sets null when there is none.
54
+ */
55
+ async function loadLocated(ctx) {
56
+ if (ctx.located !== undefined)
57
+ return;
58
+ const scope = await (0, helpers_1.getEscalationReadScope)(ctx.auth.userId);
59
+ const roles = (0, metadata_1.restrictScopeRoles)(scope.allRoles, scope.global);
60
+ if (roles !== null && roles.length === 0) {
61
+ ctx.located = null;
62
+ return;
63
+ }
64
+ const found = await escalationService.searchByFacets({
65
+ roles: roles ?? undefined,
66
+ facets: { [ctx.scheme.target_facet]: (0, context_1.targetValue)(ctx) },
67
+ status: 'pending',
68
+ orderBy: [{ field: 'created_at', direction: 'desc' }],
69
+ limit: 2,
70
+ }, { total: false });
71
+ const row = found.escalations.find((r) => r.id !== ctx.subject?.row.id) ?? null;
72
+ ctx.located = row;
73
+ ctx.locatedTitle = row ? await (0, role_1.getRoleTitle)(row.role) : null;
74
+ }
@@ -0,0 +1,9 @@
1
+ import { type ScanExecuteResponse, type ScanStep } from '../../types';
2
+ import type { LTApiResult } from '../../types/sdk';
3
+ import type { StepContext } from './context';
4
+ /**
5
+ * Attach the step's Open button to the answer: on the held subject for a
6
+ * hold, so it stays while the row is held, else on the response. A target
7
+ * with no row, or a list facet the row does not carry, offers no button.
8
+ */
9
+ export declare function withOpen(result: LTApiResult<ScanExecuteResponse>, step: Pick<ScanStep, 'open'>, ctx: StepContext): Promise<LTApiResult<ScanExecuteResponse>>;