@hotmeshio/long-tail 0.22.2 → 0.23.0

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 (266) hide show
  1. package/build/api/escalations/accumulate.js +7 -1
  2. package/build/api/escalations/lookups.d.ts +9 -2
  3. package/build/api/escalations/lookups.js +15 -3
  4. package/build/api/escalations/metadata.d.ts +2 -0
  5. package/build/api/escalations/metadata.js +9 -0
  6. package/build/api/escalations/resolve-batch.d.ts +2 -1
  7. package/build/api/escalations/resolve-batch.js +6 -5
  8. package/build/api/scan-codes/locate.js +4 -0
  9. package/build/api/scan-codes/present.d.ts +1 -1
  10. package/build/api/scan-codes/present.js +43 -0
  11. package/build/api/scan-codes/verb-accumulate.js +5 -1
  12. package/build/api/scan-codes/verb-fill.js +4 -1
  13. package/build/api/scan-codes/verb-into-subject.d.ts +12 -0
  14. package/build/api/scan-codes/verb-into-subject.js +157 -0
  15. package/build/api/scan-codes/verbs-subject.d.ts +23 -4
  16. package/build/api/scan-codes/verbs-subject.js +32 -55
  17. package/build/api/scan-codes/verbs.d.ts +10 -8
  18. package/build/api/scan-codes/verbs.js +25 -16
  19. package/build/index.d.ts +1 -1
  20. package/build/index.js +3 -2
  21. package/build/sdk/index.d.ts +1 -0
  22. package/build/services/escalation/batch.d.ts +4 -4
  23. package/build/services/escalation/batch.js +7 -4
  24. package/build/services/escalation/claim-asserted.d.ts +10 -0
  25. package/build/services/escalation/claim-asserted.js +64 -0
  26. package/build/services/escalation/facets.d.ts +3 -1
  27. package/build/services/escalation/facets.js +7 -3
  28. package/build/services/escalation/index.d.ts +1 -0
  29. package/build/services/escalation/index.js +3 -1
  30. package/build/services/knowledge/lookup-cache.d.ts +16 -4
  31. package/build/services/knowledge/lookup-cache.js +53 -20
  32. package/build/services/knowledge/lookup-refs.d.ts +3 -2
  33. package/build/services/knowledge/lookup-refs.js +6 -4
  34. package/build/services/knowledge/sql.d.ts +2 -0
  35. package/build/services/knowledge/sql.js +9 -1
  36. package/build/services/mcp/server-tools.js +1 -1
  37. package/build/services/orchestrator/condition.d.ts +17 -11
  38. package/build/services/orchestrator/condition.js +12 -7
  39. package/build/services/scan-code/index.d.ts +1 -1
  40. package/build/services/scan-code/index.js +2 -1
  41. package/build/services/scan-code/validate-facts.d.ts +5 -0
  42. package/build/services/scan-code/validate-facts.js +24 -0
  43. package/build/services/scan-code/validate-query.d.ts +8 -0
  44. package/build/services/scan-code/validate-query.js +36 -0
  45. package/build/services/scan-code/validate-subject.js +29 -2
  46. package/build/services/scan-code/validate.js +17 -8
  47. package/build/shared/scan-code/gtin.d.ts +6 -0
  48. package/build/shared/scan-code/gtin.js +13 -0
  49. package/build/shared/scan-code/index.d.ts +1 -1
  50. package/build/shared/scan-code/index.js +2 -1
  51. package/build/system/mcp-servers/admin/schemas.d.ts +185 -5
  52. package/build/system/mcp-servers/admin/schemas.js +16 -3
  53. package/build/system/seed/tool-manifests-admin.d.ts +202 -1
  54. package/build/system/seed/tool-manifests-admin.js +2 -2
  55. package/build/tsconfig.tsbuildinfo +1 -1
  56. package/build/types/escalation.d.ts +23 -8
  57. package/build/types/escalation.js +18 -7
  58. package/build/types/index.d.ts +3 -3
  59. package/build/types/index.js +3 -1
  60. package/build/types/scan-code/response.d.ts +5 -0
  61. package/build/types/scan-code/rule.d.ts +32 -2
  62. package/dashboard/dist/assets/{AdminDashboard-DBW12qQt.js → AdminDashboard-DKrqLGjn.js} +2 -2
  63. package/dashboard/dist/assets/{AdminDashboard-DBW12qQt.js.map → AdminDashboard-DKrqLGjn.js.map} +1 -1
  64. package/dashboard/dist/assets/{AgentConfigPage-CmHv8U9M.js → AgentConfigPage-BoQhRW6U.js} +2 -2
  65. package/dashboard/dist/assets/{AgentConfigPage-CmHv8U9M.js.map → AgentConfigPage-BoQhRW6U.js.map} +1 -1
  66. package/dashboard/dist/assets/{AgentDetailPage-D1scIbz-.js → AgentDetailPage-DZhzuZmO.js} +2 -2
  67. package/dashboard/dist/assets/{AgentDetailPage-D1scIbz-.js.map → AgentDetailPage-DZhzuZmO.js.map} +1 -1
  68. package/dashboard/dist/assets/{AgentsPage-BA_ai9HJ.js → AgentsPage-5MynmbWX.js} +2 -2
  69. package/dashboard/dist/assets/{AgentsPage-BA_ai9HJ.js.map → AgentsPage-5MynmbWX.js.map} +1 -1
  70. package/dashboard/dist/assets/{AvailableEscalationsPage-C2_5aEFW.js → AvailableEscalationsPage-CWMyy3IL.js} +2 -2
  71. package/dashboard/dist/assets/{AvailableEscalationsPage-C2_5aEFW.js.map → AvailableEscalationsPage-CWMyy3IL.js.map} +1 -1
  72. package/dashboard/dist/assets/{BotPicker-BZo4Kp4a.js → BotPicker-C3LR6Sqy.js} +2 -2
  73. package/dashboard/dist/assets/{BotPicker-BZo4Kp4a.js.map → BotPicker-C3LR6Sqy.js.map} +1 -1
  74. package/dashboard/dist/assets/{BulkAssignModal-BFhyxY2T.js → BulkAssignModal-COjoOIIH.js} +2 -2
  75. package/dashboard/dist/assets/{BulkAssignModal-BFhyxY2T.js.map → BulkAssignModal-COjoOIIH.js.map} +1 -1
  76. package/dashboard/dist/assets/{CapabilitiesPage-CvOX6vAc.js → CapabilitiesPage-DKxLvOfB.js} +2 -2
  77. package/dashboard/dist/assets/{CapabilitiesPage-CvOX6vAc.js.map → CapabilitiesPage-DKxLvOfB.js.map} +1 -1
  78. package/dashboard/dist/assets/{CollapsibleSection-GCJsV9Oq.js → CollapsibleSection-Cz5sRx-r.js} +2 -2
  79. package/dashboard/dist/assets/{CollapsibleSection-GCJsV9Oq.js.map → CollapsibleSection-Cz5sRx-r.js.map} +1 -1
  80. package/dashboard/dist/assets/{ConfirmDeleteModal-CAgYLcef.js → ConfirmDeleteModal-Beq1vQtY.js} +2 -2
  81. package/dashboard/dist/assets/{ConfirmDeleteModal-CAgYLcef.js.map → ConfirmDeleteModal-Beq1vQtY.js.map} +1 -1
  82. package/dashboard/dist/assets/{CountdownTimer-Dik2z0M_.js → CountdownTimer-BUBl_4mP.js} +2 -2
  83. package/dashboard/dist/assets/{CountdownTimer-Dik2z0M_.js.map → CountdownTimer-BUBl_4mP.js.map} +1 -1
  84. package/dashboard/dist/assets/{CredentialsPage-twd2xCOW.js → CredentialsPage-DhiHiPsG.js} +2 -2
  85. package/dashboard/dist/assets/{CredentialsPage-twd2xCOW.js.map → CredentialsPage-DhiHiPsG.js.map} +1 -1
  86. package/dashboard/dist/assets/{CronLabel-DdnIuudX.js → CronLabel-C9SkawB-.js} +2 -2
  87. package/dashboard/dist/assets/{CronLabel-DdnIuudX.js.map → CronLabel-C9SkawB-.js.map} +1 -1
  88. package/dashboard/dist/assets/{ElapsedCell-DCctVv5R.js → ElapsedCell-BeK1SUDK.js} +2 -2
  89. package/dashboard/dist/assets/{ElapsedCell-DCctVv5R.js.map → ElapsedCell-BeK1SUDK.js.map} +1 -1
  90. package/dashboard/dist/assets/{EntityTimelinePanel-CMnskyWv.js → EntityTimelinePanel-BThdefKj.js} +2 -2
  91. package/dashboard/dist/assets/{EntityTimelinePanel-CMnskyWv.js.map → EntityTimelinePanel-BThdefKj.js.map} +1 -1
  92. package/dashboard/dist/assets/{EscalationListSchemaPage-VfCn6WDb.js → EscalationListSchemaPage-DlDIYb-p.js} +2 -2
  93. package/dashboard/dist/assets/{EscalationListSchemaPage-VfCn6WDb.js.map → EscalationListSchemaPage-DlDIYb-p.js.map} +1 -1
  94. package/dashboard/dist/assets/{EscalationListView-CGQZxcC-.js → EscalationListView-DTIVuym4.js} +2 -2
  95. package/dashboard/dist/assets/{EscalationListView-CGQZxcC-.js.map → EscalationListView-DTIVuym4.js.map} +1 -1
  96. package/dashboard/dist/assets/{EscalationSchemaPage-BX0tx-PM.js → EscalationSchemaPage-CQt-Embr.js} +2 -2
  97. package/dashboard/dist/assets/{EscalationSchemaPage-BX0tx-PM.js.map → EscalationSchemaPage-CQt-Embr.js.map} +1 -1
  98. package/dashboard/dist/assets/{EscalationTimeline-DKoSM56J.js → EscalationTimeline-DNKNp6pL.js} +2 -2
  99. package/dashboard/dist/assets/{EscalationTimeline-DKoSM56J.js.map → EscalationTimeline-DNKNp6pL.js.map} +1 -1
  100. package/dashboard/dist/assets/{EscalationTitleSelect-DWGLBOmS.js → EscalationTitleSelect-Dewrv8wX.js} +2 -2
  101. package/dashboard/dist/assets/{EscalationTitleSelect-DWGLBOmS.js.map → EscalationTitleSelect-Dewrv8wX.js.map} +1 -1
  102. package/dashboard/dist/assets/{EscalationsOverview-C2XoguaA.js → EscalationsOverview-BzH-Y-5x.js} +2 -2
  103. package/dashboard/dist/assets/{EscalationsOverview-C2XoguaA.js.map → EscalationsOverview-BzH-Y-5x.js.map} +1 -1
  104. package/dashboard/dist/assets/{EventTable-CBUWq7--.js → EventTable-C97m6IZv.js} +2 -2
  105. package/dashboard/dist/assets/{EventTable-CBUWq7--.js.map → EventTable-C97m6IZv.js.map} +1 -1
  106. package/dashboard/dist/assets/{FilterBar-8IdbleZ9.js → FilterBar-D-6xVHIw.js} +2 -2
  107. package/dashboard/dist/assets/{FilterBar-8IdbleZ9.js.map → FilterBar-D-6xVHIw.js.map} +1 -1
  108. package/dashboard/dist/assets/{GraphInvokePage-CUvoPzsW.js → GraphInvokePage-Bwi8EF9Y.js} +2 -2
  109. package/dashboard/dist/assets/{GraphInvokePage-CUvoPzsW.js.map → GraphInvokePage-Bwi8EF9Y.js.map} +1 -1
  110. package/dashboard/dist/assets/{HomePage-BP7v9GLJ.js → HomePage-Z_Q03C0z.js} +2 -2
  111. package/dashboard/dist/assets/{HomePage-BP7v9GLJ.js.map → HomePage-Z_Q03C0z.js.map} +1 -1
  112. package/dashboard/dist/assets/{ListToolbar-Cnacuwoy.js → ListToolbar-_jWTw5no.js} +2 -2
  113. package/dashboard/dist/assets/{ListToolbar-Cnacuwoy.js.map → ListToolbar-_jWTw5no.js.map} +1 -1
  114. package/dashboard/dist/assets/{McpOverview-C2JoNoDA.js → McpOverview-CjqTuP0N.js} +2 -2
  115. package/dashboard/dist/assets/{McpOverview-C2JoNoDA.js.map → McpOverview-CjqTuP0N.js.map} +1 -1
  116. package/dashboard/dist/assets/{McpQueryDetailPage-C_nih0w-.js → McpQueryDetailPage-leCsje1U.js} +2 -2
  117. package/dashboard/dist/assets/{McpQueryDetailPage-C_nih0w-.js.map → McpQueryDetailPage-leCsje1U.js.map} +1 -1
  118. package/dashboard/dist/assets/{McpQueryPage-U_wNXow2.js → McpQueryPage-C-PyXYX4.js} +2 -2
  119. package/dashboard/dist/assets/{McpQueryPage-U_wNXow2.js.map → McpQueryPage-C-PyXYX4.js.map} +1 -1
  120. package/dashboard/dist/assets/{McpRunDetailPage-DtKoJq6J.js → McpRunDetailPage-JDrr3uUQ.js} +2 -2
  121. package/dashboard/dist/assets/{McpRunDetailPage-DtKoJq6J.js.map → McpRunDetailPage-JDrr3uUQ.js.map} +1 -1
  122. package/dashboard/dist/assets/{McpRunsPage-CnYtfGhf.js → McpRunsPage-DERXQLgZ.js} +2 -2
  123. package/dashboard/dist/assets/{McpRunsPage-CnYtfGhf.js.map → McpRunsPage-DERXQLgZ.js.map} +1 -1
  124. package/dashboard/dist/assets/{OperationsPage-C7hupIer.js → OperationsPage-B2DA7n9m.js} +2 -2
  125. package/dashboard/dist/assets/{OperationsPage-C7hupIer.js.map → OperationsPage-B2DA7n9m.js.map} +1 -1
  126. package/dashboard/dist/assets/{OperatorDashboard-fVuLn2D5.js → OperatorDashboard-C8RtPv8P.js} +2 -2
  127. package/dashboard/dist/assets/{OperatorDashboard-fVuLn2D5.js.map → OperatorDashboard-C8RtPv8P.js.map} +1 -1
  128. package/dashboard/dist/assets/{PersonaDetailPage-C-4o8lPw.js → PersonaDetailPage-ChXwJ6u5.js} +2 -2
  129. package/dashboard/dist/assets/{PersonaDetailPage-C-4o8lPw.js.map → PersonaDetailPage-ChXwJ6u5.js.map} +1 -1
  130. package/dashboard/dist/assets/{PersonasPage-BL1FwLmv.js → PersonasPage-BFFxncSE.js} +2 -2
  131. package/dashboard/dist/assets/{PersonasPage-BL1FwLmv.js.map → PersonasPage-BFFxncSE.js.map} +1 -1
  132. package/dashboard/dist/assets/{PortalPage-tJG5sgb1.js → PortalPage-Xk1zVneM.js} +2 -2
  133. package/dashboard/dist/assets/{PortalPage-tJG5sgb1.js.map → PortalPage-Xk1zVneM.js.map} +1 -1
  134. package/dashboard/dist/assets/{ProcessDetailPage-Dz_jY4Yt.js → ProcessDetailPage-D7EYwW-j.js} +2 -2
  135. package/dashboard/dist/assets/{ProcessDetailPage-Dz_jY4Yt.js.map → ProcessDetailPage-D7EYwW-j.js.map} +1 -1
  136. package/dashboard/dist/assets/{ProcessesListPage-Cbn9cter.js → ProcessesListPage-CakYRtnE.js} +2 -2
  137. package/dashboard/dist/assets/{ProcessesListPage-Cbn9cter.js.map → ProcessesListPage-CakYRtnE.js.map} +1 -1
  138. package/dashboard/dist/assets/{ResolverForm-Bk8iXQ6-.js → ResolverForm-BwVOJUpJ.js} +6 -6
  139. package/dashboard/dist/assets/ResolverForm-BwVOJUpJ.js.map +1 -0
  140. package/dashboard/dist/assets/{RoleDetailPage-owPi6gI9.js → RoleDetailPage-CKbGwezP.js} +2 -2
  141. package/dashboard/dist/assets/{RoleDetailPage-owPi6gI9.js.map → RoleDetailPage-CKbGwezP.js.map} +1 -1
  142. package/dashboard/dist/assets/{RolesPage-NwmMvZFa.js → RolesPage-Czu7Zku4.js} +2 -2
  143. package/dashboard/dist/assets/{RolesPage-NwmMvZFa.js.map → RolesPage-Czu7Zku4.js.map} +1 -1
  144. package/dashboard/dist/assets/{RunAsSelector-tgEooTyU.js → RunAsSelector-6BLScYTX.js} +2 -2
  145. package/dashboard/dist/assets/{RunAsSelector-tgEooTyU.js.map → RunAsSelector-6BLScYTX.js.map} +1 -1
  146. package/dashboard/dist/assets/{ScanCodesPage-CUv_8ic6.js → ScanCodesPage-Cv9q8Bvt.js} +2 -2
  147. package/dashboard/dist/assets/{ScanCodesPage-CUv_8ic6.js.map → ScanCodesPage-Cv9q8Bvt.js.map} +1 -1
  148. package/dashboard/dist/assets/ScanSchemeDetailPage-BxazXYIc.js +2 -0
  149. package/dashboard/dist/assets/ScanSchemeDetailPage-BxazXYIc.js.map +1 -0
  150. package/dashboard/dist/assets/ScanStationPage-Cg8LCFR7.js +2 -0
  151. package/dashboard/dist/assets/ScanStationPage-Cg8LCFR7.js.map +1 -0
  152. package/dashboard/dist/assets/{StickyPagination-CsTI_gvJ.js → StickyPagination-DsdtYoXR.js} +2 -2
  153. package/dashboard/dist/assets/{StickyPagination-CsTI_gvJ.js.map → StickyPagination-DsdtYoXR.js.map} +1 -1
  154. package/dashboard/dist/assets/{StreamMessageDetail-auRlvjTh.js → StreamMessageDetail-CT3FQoT3.js} +2 -2
  155. package/dashboard/dist/assets/{StreamMessageDetail-auRlvjTh.js.map → StreamMessageDetail-CT3FQoT3.js.map} +1 -1
  156. package/dashboard/dist/assets/{SwimlaneTimeline-BLoVHYAd.js → SwimlaneTimeline-C8TjkJ10.js} +2 -2
  157. package/dashboard/dist/assets/{SwimlaneTimeline-BLoVHYAd.js.map → SwimlaneTimeline-C8TjkJ10.js.map} +1 -1
  158. package/dashboard/dist/assets/{TaskDetailPage-BPsZ1bK_.js → TaskDetailPage-DGUzdBFN.js} +2 -2
  159. package/dashboard/dist/assets/{TaskDetailPage-BPsZ1bK_.js.map → TaskDetailPage-DGUzdBFN.js.map} +1 -1
  160. package/dashboard/dist/assets/{TasksListPage-BNGM74yT.js → TasksListPage-BVIP6-EZ.js} +2 -2
  161. package/dashboard/dist/assets/{TasksListPage-BNGM74yT.js.map → TasksListPage-BVIP6-EZ.js.map} +1 -1
  162. package/dashboard/dist/assets/{TimeAgo-BnAHXGK7.js → TimeAgo-C-rd9F9g.js} +2 -2
  163. package/dashboard/dist/assets/{TimeAgo-BnAHXGK7.js.map → TimeAgo-C-rd9F9g.js.map} +1 -1
  164. package/dashboard/dist/assets/{TimestampCell-J4yae6mc.js → TimestampCell-DPbchDOI.js} +2 -2
  165. package/dashboard/dist/assets/{TimestampCell-J4yae6mc.js.map → TimestampCell-DPbchDOI.js.map} +1 -1
  166. package/dashboard/dist/assets/{ToolTestPanel-BdzzgXDu.js → ToolTestPanel-DAUC8DHK.js} +2 -2
  167. package/dashboard/dist/assets/{ToolTestPanel-BdzzgXDu.js.map → ToolTestPanel-DAUC8DHK.js.map} +1 -1
  168. package/dashboard/dist/assets/{TopicDetailPage-DJKg8lb7.js → TopicDetailPage-70mMKBzG.js} +2 -2
  169. package/dashboard/dist/assets/{TopicDetailPage-DJKg8lb7.js.map → TopicDetailPage-70mMKBzG.js.map} +1 -1
  170. package/dashboard/dist/assets/{TopicsPage-DQV0WxG6.js → TopicsPage-CE3hBthn.js} +2 -2
  171. package/dashboard/dist/assets/{TopicsPage-DQV0WxG6.js.map → TopicsPage-CE3hBthn.js.map} +1 -1
  172. package/dashboard/dist/assets/{UserName-Ct09nGh5.js → UserName-BDBDA-LR.js} +2 -2
  173. package/dashboard/dist/assets/{UserName-Ct09nGh5.js.map → UserName-BDBDA-LR.js.map} +1 -1
  174. package/dashboard/dist/assets/{WorkflowExecutionPage-B5WJOsee.js → WorkflowExecutionPage-BbkLZ1co.js} +2 -2
  175. package/dashboard/dist/assets/{WorkflowExecutionPage-B5WJOsee.js.map → WorkflowExecutionPage-BbkLZ1co.js.map} +1 -1
  176. package/dashboard/dist/assets/{WorkflowsDashboard-Hc87TRgD.js → WorkflowsDashboard-Bp1L7Ggz.js} +2 -2
  177. package/dashboard/dist/assets/{WorkflowsDashboard-Hc87TRgD.js.map → WorkflowsDashboard-Bp1L7Ggz.js.map} +1 -1
  178. package/dashboard/dist/assets/{WorkflowsOverview-CJQbyOj-.js → WorkflowsOverview-IeTKHAi4.js} +2 -2
  179. package/dashboard/dist/assets/{WorkflowsOverview-CJQbyOj-.js.map → WorkflowsOverview-IeTKHAi4.js.map} +1 -1
  180. package/dashboard/dist/assets/{YamlWorkflowDetailPage-BMeED677.js → YamlWorkflowDetailPage-DtKCXnKt.js} +2 -2
  181. package/dashboard/dist/assets/{YamlWorkflowDetailPage-BMeED677.js.map → YamlWorkflowDetailPage-DtKCXnKt.js.map} +1 -1
  182. package/dashboard/dist/assets/{YamlWorkflowsPage-BMMg0Id6.js → YamlWorkflowsPage-CEcZBV_3.js} +2 -2
  183. package/dashboard/dist/assets/{YamlWorkflowsPage-BMMg0Id6.js.map → YamlWorkflowsPage-CEcZBV_3.js.map} +1 -1
  184. package/dashboard/dist/assets/{agents-CdFkgFvg.js → agents-BT-sEk81.js} +2 -2
  185. package/dashboard/dist/assets/{agents-CdFkgFvg.js.map → agents-BT-sEk81.js.map} +1 -1
  186. package/dashboard/dist/assets/{bots-Mj3LHWWg.js → bots-DRoAdLek.js} +2 -2
  187. package/dashboard/dist/assets/{bots-Mj3LHWWg.js.map → bots-DRoAdLek.js.map} +1 -1
  188. package/dashboard/dist/assets/{capabilities-Dw1ObK2-.js → capabilities-Bc-nJk6y.js} +2 -2
  189. package/dashboard/dist/assets/{capabilities-Dw1ObK2-.js.map → capabilities-Bc-nJk6y.js.map} +1 -1
  190. package/dashboard/dist/assets/{controlplane-DcNE1APv.js → controlplane-aXceSIRf.js} +2 -2
  191. package/dashboard/dist/assets/{controlplane-DcNE1APv.js.map → controlplane-aXceSIRf.js.map} +1 -1
  192. package/dashboard/dist/assets/{escalation-columns-D364Trpy.js → escalation-columns-Bf09Q89t.js} +2 -2
  193. package/dashboard/dist/assets/{escalation-columns-D364Trpy.js.map → escalation-columns-Bf09Q89t.js.map} +1 -1
  194. package/dashboard/dist/assets/index-BCFEQEMC.js +2 -0
  195. package/dashboard/dist/assets/index-BCFEQEMC.js.map +1 -0
  196. package/dashboard/dist/assets/{index-Bd6-KmBE.js → index-BEPKAjna.js} +2 -2
  197. package/dashboard/dist/assets/{index-Bd6-KmBE.js.map → index-BEPKAjna.js.map} +1 -1
  198. package/dashboard/dist/assets/{index-BQeHJHYN.js → index-BUYokcrl.js} +25 -25
  199. package/dashboard/dist/assets/index-BUYokcrl.js.map +1 -0
  200. package/dashboard/dist/assets/{index-MDD4JYtu.js → index-Ba-s5Yb5.js} +2 -2
  201. package/dashboard/dist/assets/{index-MDD4JYtu.js.map → index-Ba-s5Yb5.js.map} +1 -1
  202. package/dashboard/dist/assets/{index-BRGTmoYY.js → index-C3VTJcrp.js} +2 -2
  203. package/dashboard/dist/assets/{index-BRGTmoYY.js.map → index-C3VTJcrp.js.map} +1 -1
  204. package/dashboard/dist/assets/{index-Dyotfa_k.js → index-CZyO9hRb.js} +2 -2
  205. package/dashboard/dist/assets/{index-Dyotfa_k.js.map → index-CZyO9hRb.js.map} +1 -1
  206. package/dashboard/dist/assets/{index-eDm6cz0F.js → index-CcgmR-7-.js} +2 -2
  207. package/dashboard/dist/assets/{index-eDm6cz0F.js.map → index-CcgmR-7-.js.map} +1 -1
  208. package/dashboard/dist/assets/{index-DkcI4V_H.js → index-CuBGGwXf.js} +2 -2
  209. package/dashboard/dist/assets/{index-DkcI4V_H.js.map → index-CuBGGwXf.js.map} +1 -1
  210. package/dashboard/dist/assets/index-D1mKf_qz.js +3 -0
  211. package/dashboard/dist/assets/index-D1mKf_qz.js.map +1 -0
  212. package/dashboard/dist/assets/{index-Bq5XNEzD.js → index-DBxpyIw5.js} +2 -2
  213. package/dashboard/dist/assets/{index-Bq5XNEzD.js.map → index-DBxpyIw5.js.map} +1 -1
  214. package/dashboard/dist/assets/{index-B3veJ698.js → index-DH03y-UT.js} +2 -2
  215. package/dashboard/dist/assets/{index-B3veJ698.js.map → index-DH03y-UT.js.map} +1 -1
  216. package/dashboard/dist/assets/{index-BiVce3n0.js → index-Djsoi8DI.js} +2 -2
  217. package/dashboard/dist/assets/{index-BiVce3n0.js.map → index-Djsoi8DI.js.map} +1 -1
  218. package/dashboard/dist/assets/{index-DPStdq4T.js → index-h2gX31B2.js} +2 -2
  219. package/dashboard/dist/assets/{index-DPStdq4T.js.map → index-h2gX31B2.js.map} +1 -1
  220. package/dashboard/dist/assets/{knowledge-Bafewjxk.js → knowledge-BhW8V-Hq.js} +2 -2
  221. package/dashboard/dist/assets/{knowledge-Bafewjxk.js.map → knowledge-BhW8V-Hq.js.map} +1 -1
  222. package/dashboard/dist/assets/{mcp-vLIutbnc.js → mcp-BYfSMQzh.js} +2 -2
  223. package/dashboard/dist/assets/{mcp-vLIutbnc.js.map → mcp-BYfSMQzh.js.map} +1 -1
  224. package/dashboard/dist/assets/{mcp-query-BzTtIG90.js → mcp-query-DUJoOk_q.js} +2 -2
  225. package/dashboard/dist/assets/{mcp-query-BzTtIG90.js.map → mcp-query-DUJoOk_q.js.map} +1 -1
  226. package/dashboard/dist/assets/metadata-display-B7X5hGxG.js +2 -0
  227. package/dashboard/dist/assets/metadata-display-B7X5hGxG.js.map +1 -0
  228. package/dashboard/dist/assets/{personas-WD40EDS_.js → personas-jT1O_SB4.js} +2 -2
  229. package/dashboard/dist/assets/{personas-WD40EDS_.js.map → personas-jT1O_SB4.js.map} +1 -1
  230. package/dashboard/dist/assets/{pipelines-DFwULWs3.js → pipelines-Bp-wIaz2.js} +2 -2
  231. package/dashboard/dist/assets/{pipelines-DFwULWs3.js.map → pipelines-Bp-wIaz2.js.map} +1 -1
  232. package/dashboard/dist/assets/{tasks-La_-WAUn.js → tasks-CCrvnXbz.js} +2 -2
  233. package/dashboard/dist/assets/{tasks-La_-WAUn.js.map → tasks-CCrvnXbz.js.map} +1 -1
  234. package/dashboard/dist/assets/{topics-CzYMlvqm.js → topics-Blft0I1L.js} +2 -2
  235. package/dashboard/dist/assets/{topics-CzYMlvqm.js.map → topics-Blft0I1L.js.map} +1 -1
  236. package/dashboard/dist/assets/{useDebouncedValue-C0FQyANW.js → useDebouncedValue-BYqbcism.js} +2 -2
  237. package/dashboard/dist/assets/{useDebouncedValue-C0FQyANW.js.map → useDebouncedValue-BYqbcism.js.map} +1 -1
  238. package/dashboard/dist/assets/{useNamespace-WW_XjAb3.js → useNamespace-BfxJAUgG.js} +2 -2
  239. package/dashboard/dist/assets/{useNamespace-WW_XjAb3.js.map → useNamespace-BfxJAUgG.js.map} +1 -1
  240. package/dashboard/dist/assets/{useYamlActivityEvents-B3YxPeFt.js → useYamlActivityEvents-BukJuWpb.js} +2 -2
  241. package/dashboard/dist/assets/{useYamlActivityEvents-B3YxPeFt.js.map → useYamlActivityEvents-BukJuWpb.js.map} +1 -1
  242. package/dashboard/dist/assets/{yaml-workflows-COHOjdhF.js → yaml-workflows-DeRWqMGk.js} +2 -2
  243. package/dashboard/dist/assets/{yaml-workflows-COHOjdhF.js.map → yaml-workflows-DeRWqMGk.js.map} +1 -1
  244. package/dashboard/dist/index.html +1 -1
  245. package/docs/accumulator.md +1 -1
  246. package/docs/api/sdk/escalations.md +1 -1
  247. package/docs/hitl/escalation.md +12 -0
  248. package/docs/hitl/lookups.md +27 -18
  249. package/docs/hitl/resolution.md +1 -1
  250. package/docs/hitl/x-lt-validation.md +1 -1
  251. package/docs/hitl/x-lt-widget.md +1 -1
  252. package/docs/hitl-guide.md +1 -1
  253. package/docs/scan-codes.md +86 -16
  254. package/package.json +2 -2
  255. package/dashboard/dist/assets/ResolverForm-Bk8iXQ6-.js.map +0 -1
  256. package/dashboard/dist/assets/ScanSchemeDetailPage-YHqbu7oK.js +0 -2
  257. package/dashboard/dist/assets/ScanSchemeDetailPage-YHqbu7oK.js.map +0 -1
  258. package/dashboard/dist/assets/ScanStationPage-B275l6r_.js +0 -2
  259. package/dashboard/dist/assets/ScanStationPage-B275l6r_.js.map +0 -1
  260. package/dashboard/dist/assets/index-BQeHJHYN.js.map +0 -1
  261. package/dashboard/dist/assets/index-BmNAVd4s.js +0 -2
  262. package/dashboard/dist/assets/index-BmNAVd4s.js.map +0 -1
  263. package/dashboard/dist/assets/index-WSm8bgE7.js +0 -3
  264. package/dashboard/dist/assets/index-WSm8bgE7.js.map +0 -1
  265. package/dashboard/dist/assets/metadata-display-COo3mMCr.js +0 -2
  266. package/dashboard/dist/assets/metadata-display-COo3mMCr.js.map +0 -1
@@ -493,9 +493,15 @@ function itemsView(escalation) {
493
493
  if (isBatch(escalation)) {
494
494
  const store = (envelope[escalation_1.ESCALATION_BATCH_KEYS.ITEMS] ?? {});
495
495
  const filledAt = (envelope[escalation_1.ESCALATION_BATCH_KEYS.FILLED_AT] ?? {});
496
+ const filledBy = (envelope[escalation_1.ESCALATION_BATCH_KEYS.FILLED_BY] ?? {});
496
497
  const keys = (metadata[escalation_1.ESCALATION_BATCH_KEYS.KEYS] ?? []);
497
498
  const items = Object.entries(store)
498
- .map(([itemKey, payload]) => ({ itemKey, payload: payload, at: filledAt[itemKey] ?? '' }))
499
+ .map(([itemKey, payload]) => ({
500
+ itemKey,
501
+ payload: payload,
502
+ at: filledAt[itemKey] ?? '',
503
+ ...(typeof filledBy[itemKey] === 'string' ? { actor: filledBy[itemKey] } : {}),
504
+ }))
499
505
  .sort((a, b) => a.at.localeCompare(b.at) || a.itemKey.localeCompare(b.itemKey));
500
506
  return {
501
507
  escalationId: escalation.id,
@@ -1,15 +1,22 @@
1
1
  import { type EscalationLookupRef } from '../../types/escalation';
2
+ import type { LTEscalationRecord } from '../../types';
2
3
  import type { LTApiResult, LTApiAuth } from '../../types/sdk';
3
4
  /** The refs riding the row's envelope under the reserved key, or []. */
4
5
  export declare function readLookupRefs(envelope: string | null | undefined): EscalationLookupRef[];
6
+ /**
7
+ * When a current ref is read: now for a pending row, the moment it closed
8
+ * otherwise, so a closed row shows the edition its work was done against.
9
+ */
10
+ export declare function lookupAsOf(escalation: Pick<LTEscalationRecord, 'status' | 'resolved_at' | 'updated_at'>): string | null;
5
11
  /**
6
12
  * Resolve an escalation's versioned knowledge lookups.
7
13
  *
8
14
  * The refs on `envelope.lookups` ARE the grant: any user who may read the
9
15
  * escalation may read exactly the pinned editions it names — nothing else in
10
16
  * the knowledge store. Snapshots are immutable, so responses are served from
11
- * an in-process cache after the first read; a ref whose snapshot does not
12
- * exist answers with `missing: true` rather than failing the batch.
17
+ * an in-process cache after the first read; a current ref reads the newest
18
+ * edition (as of the close, for a closed row). A ref with no edition answers
19
+ * with `missing: true` rather than failing the batch.
13
20
  *
14
21
  * @param input.id — escalation UUID
15
22
  * @param auth — authenticated user context (must hold the escalation's role)
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.readLookupRefs = readLookupRefs;
37
+ exports.lookupAsOf = lookupAsOf;
37
38
  exports.getEscalationLookups = getEscalationLookups;
38
39
  const escalationService = __importStar(require("../../services/escalation"));
39
40
  const knowledge_1 = require("../../services/knowledge");
@@ -55,14 +56,25 @@ function readLookupRefs(envelope) {
55
56
  return [];
56
57
  }
57
58
  }
59
+ /**
60
+ * When a current ref is read: now for a pending row, the moment it closed
61
+ * otherwise, so a closed row shows the edition its work was done against.
62
+ */
63
+ function lookupAsOf(escalation) {
64
+ if (escalation.status === 'pending')
65
+ return null;
66
+ const closed = escalation.resolved_at ?? escalation.updated_at;
67
+ return closed ? new Date(closed).toISOString() : null;
68
+ }
58
69
  /**
59
70
  * Resolve an escalation's versioned knowledge lookups.
60
71
  *
61
72
  * The refs on `envelope.lookups` ARE the grant: any user who may read the
62
73
  * escalation may read exactly the pinned editions it names — nothing else in
63
74
  * the knowledge store. Snapshots are immutable, so responses are served from
64
- * an in-process cache after the first read; a ref whose snapshot does not
65
- * exist answers with `missing: true` rather than failing the batch.
75
+ * an in-process cache after the first read; a current ref reads the newest
76
+ * edition (as of the close, for a closed row). A ref with no edition answers
77
+ * with `missing: true` rather than failing the batch.
66
78
  *
67
79
  * @param input.id — escalation UUID
68
80
  * @param auth — authenticated user context (must hold the escalation's role)
@@ -81,7 +93,7 @@ async function getEscalationLookups(input, auth) {
81
93
  if (refs.length === 0) {
82
94
  return { status: 200, data: { lookups: [] } };
83
95
  }
84
- const lookups = await (0, knowledge_1.resolveLookupRefs)(refs);
96
+ const lookups = await (0, knowledge_1.resolveLookupRefs)(refs, lookupAsOf(escalation));
85
97
  return { status: 200, data: { lookups } };
86
98
  }
87
99
  catch (err) {
@@ -37,6 +37,8 @@ export declare function claimByMetadata(input: {
37
37
  metadata?: Record<string, any>;
38
38
  provisionIfAbsent?: ProvisionIfAbsent;
39
39
  restrictRoles?: string[];
40
+ /** Claims only this row, when it still matches every other condition. */
41
+ assertId?: string;
40
42
  }, auth: LTApiAuth): Promise<LTApiResult>;
41
43
  /**
42
44
  * Resolve an escalation by metadata key-value pair.
@@ -94,6 +94,9 @@ async function claimByMetadata(input, auth) {
94
94
  if (!input.key || !input.value) {
95
95
  return { status: 400, error: 'key and value are required' };
96
96
  }
97
+ if (input.assertId !== undefined && !(0, uuid_1.isUuid)(input.assertId)) {
98
+ return { status: 404, error: 'No pending escalation found for this metadata' };
99
+ }
97
100
  const resolved = await (0, helpers_1.resolveAssignee)(input.assignee, auth, input.provisionIfAbsent);
98
101
  if ('error' in resolved)
99
102
  return resolved.error;
@@ -105,6 +108,12 @@ async function claimByMetadata(input, auth) {
105
108
  // (expected queues) intersects with the scope inside the same SQL filter.
106
109
  const writeScope = await (0, helpers_1.getEscalationWriteScope)(auth.userId);
107
110
  const allowedRoles = restrictScopeRoles(writeScope.allRoles, writeScope.global, input.restrictRoles);
111
+ if (input.assertId !== undefined) {
112
+ const asserted = await escalationService.claimAssertedByMetadata(input.assertId, input.key, input.value, claimUserId, input.durationMinutes, input.metadata, allowedRoles);
113
+ if (!asserted)
114
+ return { status: 404, error: 'No pending escalation found for this metadata' };
115
+ return { status: 200, data: asserted };
116
+ }
108
117
  const result = await escalationService.claimByMetadata(input.key, input.value, claimUserId, input.durationMinutes, input.metadata, allowedRoles);
109
118
  if (!result) {
110
119
  // No rows matched. Check if candidates existed (role mismatch vs no match).
@@ -8,7 +8,8 @@ import type { LTApiAuth, LTApiResult } from '../../types/sdk';
8
8
  *
9
9
  * Each item validates against the SAME versioned form schema a single-item
10
10
  * resolver gets (metadata.form_schema → pinned lt_role_schemas → live role
11
- * schema), including the submit guard.
11
+ * schema), including the submit guard. Every fill records the caller as the
12
+ * entry's actor (`envelope.batch_filled_by[itemKey]`).
12
13
  *
13
14
  * Claim semantics: claim-agnostic by default — a batch accumulates
14
15
  * contributions from multiple principals, so the single-owner claim lock is
@@ -52,7 +52,8 @@ const metadata_1 = require("./metadata");
52
52
  *
53
53
  * Each item validates against the SAME versioned form schema a single-item
54
54
  * resolver gets (metadata.form_schema → pinned lt_role_schemas → live role
55
- * schema), including the submit guard.
55
+ * schema), including the submit guard. Every fill records the caller as the
56
+ * entry's actor (`envelope.batch_filled_by[itemKey]`).
56
57
  *
57
58
  * Claim semantics: claim-agnostic by default — a batch accumulates
58
59
  * contributions from multiple principals, so the single-owner claim lock is
@@ -100,7 +101,7 @@ async function resolveBatchItem(input, auth) {
100
101
  // resolved_by merges on every fill; the completing fill's stamp is the
101
102
  // resolution provenance, matching single-resolve. $resolution rides the
102
103
  // completing item's signal only.
103
- const result = await escalationService.resolveBatchItem(escalation.id, itemKey, redacted, { ...metadata, resolved_by: auth.userId }, input.assertClaim ? auth.userId : undefined, await (0, resolve_1.resolverIdentity)(auth));
104
+ const result = await escalationService.resolveBatchItem(escalation.id, itemKey, redacted, { ...metadata, resolved_by: auth.userId }, input.assertClaim ? auth.userId : undefined, await (0, resolve_1.resolverIdentity)(auth), auth.userId);
104
105
  return batchOutcomeResult(result, itemKey, escalation.workflow_id);
105
106
  }
106
107
  catch (err) {
@@ -140,7 +141,7 @@ async function resolveBatchItemBySignalKey(input, auth) {
140
141
  if (violation)
141
142
  return (0, resolve_1.validationFailure)(violation);
142
143
  const redacted = await (0, resolve_1.redactPasswords)(resolverPayload, escalation.metadata?.form_schema);
143
- const result = await escalationService.resolveBatchItemBySignalKey(signalKey, itemKey, redacted, { ...metadata, resolved_by: auth.userId }, await (0, resolve_1.resolverIdentity)(auth));
144
+ const result = await escalationService.resolveBatchItemBySignalKey(signalKey, itemKey, redacted, { ...metadata, resolved_by: auth.userId }, await (0, resolve_1.resolverIdentity)(auth), auth.userId);
144
145
  return batchOutcomeResult(result, itemKey, escalation.workflow_id);
145
146
  }
146
147
  catch (err) {
@@ -176,7 +177,7 @@ async function resolveBatchItemByMetadata(input, auth) {
176
177
  if (enforcing.size === 0) {
177
178
  // Single atomic call — selection, fill, and (on the last item) the
178
179
  // resolve + wake all inside the SDK statement.
179
- const result = await escalationService.resolveBatchItemByMetadata(key, value, itemKey, resolverPayload, allowedRoles ?? undefined, outcome, resolvedBy);
180
+ const result = await escalationService.resolveBatchItemByMetadata(key, value, itemKey, resolverPayload, allowedRoles ?? undefined, outcome, resolvedBy, auth.userId);
180
181
  return batchOutcomeResult(result, itemKey, result.escalation?.workflow_id ?? null);
181
182
  }
182
183
  // Phase 1: pick the row the fill would target (scoped, priority-ordered)
@@ -194,7 +195,7 @@ async function resolveBatchItemByMetadata(input, auth) {
194
195
  // Phase 2: fill by asserted id. The SDK statement re-checks pending +
195
196
  // batch state; a row that went terminal between phases maps to 409.
196
197
  const redacted = await (0, resolve_1.redactPasswords)(resolverPayload, row.metadata?.form_schema);
197
- const result = await escalationService.resolveBatchItem(row.id, itemKey, redacted, outcome, undefined, resolvedBy);
198
+ const result = await escalationService.resolveBatchItem(row.id, itemKey, redacted, outcome, undefined, resolvedBy, auth.userId);
198
199
  if (result.outcome === 'not-found') {
199
200
  return { status: 409, error: 'A concurrent resolution is already in progress for this escalation' };
200
201
  }
@@ -61,6 +61,8 @@ async function locateForStep(step, ctx, limit) {
61
61
  return escalationService.listEscalations({
62
62
  metadata: facets,
63
63
  status,
64
+ type: step.query?.types?.[0],
65
+ subtype: step.query?.subtypes?.[0],
64
66
  assigned_to: ctx.auth.userId,
65
67
  visibleRoles: roles ?? undefined,
66
68
  limit,
@@ -71,6 +73,8 @@ async function locateForStep(step, ctx, limit) {
71
73
  return null;
72
74
  return escalationService.searchByFacets({
73
75
  roles: roles ?? undefined,
76
+ types: step.query?.types,
77
+ subtypes: step.query?.subtypes,
74
78
  facets,
75
79
  status,
76
80
  available: availability === types_1.SCAN_AVAILABILITY.AVAILABLE
@@ -1,6 +1,6 @@
1
1
  import { type ScanExecuteResponse, type ScanStep } from '../../types';
2
2
  import type { LTApiResult } from '../../types/sdk';
3
- import type { StepContext } from './context';
3
+ import { type StepContext } from './context';
4
4
  /**
5
5
  * Locate the target and present the step's choices. Choices whose identity
6
6
  * requirement is unsatisfied come back withheld — the screen renders the
@@ -1,10 +1,52 @@
1
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
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.presentStep = presentStep;
37
+ const scanCodeService = __importStar(require("../../services/scan-code"));
4
38
  const types_1 = require("../../types");
5
39
  const identity_1 = require("./identity");
6
40
  const locate_1 = require("./locate");
7
41
  const verbs_1 = require("./verbs");
42
+ const context_1 = require("./context");
43
+ /** The step's facts rendered against the presented row; unreadable tokens render empty. */
44
+ function renderFacts(step, ctx, row) {
45
+ if (!step.facts)
46
+ return undefined;
47
+ const tpl = { ...(0, context_1.templateContext)(ctx), item: row.metadata ?? {} };
48
+ return step.facts.map((fact) => ({ label: fact.label, value: scanCodeService.renderScanCopy(fact.value, tpl) }));
49
+ }
8
50
  // ── The info-choice outcome — locate → present reality + labeled choices ───
9
51
  //
10
52
  // Some objects carry one code for their whole life: the next action cannot be
@@ -52,6 +94,7 @@ async function presentStep(step, ctx) {
52
94
  verb: step.verb,
53
95
  escalation,
54
96
  choices,
97
+ ...(step.facts ? { facts: renderFacts(step, ctx, escalation) } : {}),
55
98
  notPrimed: ctx.rule.notPrimed,
56
99
  ...(autoSelect ? { autoSelect: true } : {}),
57
100
  },
@@ -41,6 +41,7 @@ const context_1 = require("./context");
41
41
  const grant_1 = require("./grant");
42
42
  const locate_1 = require("./locate");
43
43
  const verbs_subject_1 = require("./verbs-subject");
44
+ const verb_into_subject_1 = require("./verb-into-subject");
44
45
  /**
45
46
  * Adds the scanned item to an accumulator. Two modes, one atomic write:
46
47
  *
@@ -66,7 +67,7 @@ async function accumulateStep(step, ctx) {
66
67
  if (options?.from === 'subject')
67
68
  return (0, verbs_subject_1.accumulateFromSubject)(step, ctx);
68
69
  if (options?.into === 'subject')
69
- return (0, verbs_subject_1.accumulateIntoSubject)(step, ctx);
70
+ return (0, verb_into_subject_1.accumulateIntoSubject)(step, ctx);
70
71
  let item;
71
72
  if (options?.containerFacet) {
72
73
  const located = await (0, locate_1.locateForStep)(step, ctx, 1);
@@ -113,6 +114,9 @@ async function accumulateStep(step, ctx) {
113
114
  payload: rendered.payload,
114
115
  metadata: rendered.metadata,
115
116
  restrictRoles: step.query?.roles,
117
+ ...(step.query?.types || step.query?.subtypes
118
+ ? { container: { types: step.query.types, subtypes: step.query.subtypes } }
119
+ : {}),
116
120
  };
117
121
  }
118
122
  const notPrimed = await (0, grant_1.spendGrant)(ctx);
@@ -96,8 +96,11 @@ async function fillStep(step, ctx) {
96
96
  const markdown = declared.length
97
97
  ? `All ${declared.length} of these are already checked off.`
98
98
  : scanCodeService.renderScanCopy(step.refuse?.markdown ?? STOCK_UNEXPECTED, tpl);
99
+ const expected = ctx.scheme.encoding === types_1.SCAN_ENCODINGS.GTIN
100
+ ? tpl.fill.pending.map((code) => scanCodeService.displayGtin(code))
101
+ : tpl.fill.pending;
99
102
  return (0, context_1.refused)(markdown, {
100
- refusal: { markdown, expected: tpl.fill.pending },
103
+ refusal: { markdown, expected },
101
104
  progress: progress(batch, 0),
102
105
  });
103
106
  }
@@ -0,0 +1,12 @@
1
+ import { type ScanExecuteResponse, type ScanStep } from '../../types';
2
+ import type { LTApiResult } from '../../types/sdk';
3
+ import { type StepContext } from './context';
4
+ type ScanResult = LTApiResult<ScanExecuteResponse>;
5
+ /**
6
+ * The held subject's row collects the scanned code. With `accumulate.item`,
7
+ * the code's own pending row is located and written as the reciprocal in the
8
+ * same statement, so the item's record and the subject's entry land together
9
+ * or not at all.
10
+ */
11
+ export declare function accumulateIntoSubject(step: ScanStep, ctx: StepContext): Promise<ScanResult | null>;
12
+ export {};
@@ -0,0 +1,157 @@
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.accumulateIntoSubject = accumulateIntoSubject;
37
+ const scanCodeService = __importStar(require("../../services/scan-code"));
38
+ const escalationService = __importStar(require("../../services/escalation"));
39
+ const accumulate_1 = require("../escalations/accumulate");
40
+ const helpers_1 = require("../escalations/helpers");
41
+ const metadata_1 = require("../escalations/metadata");
42
+ const escalation_1 = require("../../types/escalation");
43
+ const types_1 = require("../../types");
44
+ const context_1 = require("./context");
45
+ const grant_1 = require("./grant");
46
+ const subject_1 = require("./subject");
47
+ const verbs_subject_1 = require("./verbs-subject");
48
+ const STOCK_MISSING = 'That one is not waiting here.';
49
+ const ITEM_GONE = ['reciprocal-not-found', 'reciprocal-not-accumulator'];
50
+ /**
51
+ * The scanned code's own pending row: an accumulator carrying the scheme's
52
+ * target facet = the scanned target, within the selector and the actor's
53
+ * read scope. The held subject's row is never a candidate.
54
+ */
55
+ async function locateItem(step, ctx) {
56
+ const selector = step.params.accumulate.item;
57
+ const scope = await (0, helpers_1.getEscalationReadScope)(ctx.auth.userId);
58
+ const roles = (0, metadata_1.restrictScopeRoles)(scope.allRoles, scope.global, selector.roles);
59
+ if (roles !== null && roles.length === 0)
60
+ return {};
61
+ const found = await escalationService.searchByFacets({
62
+ roles: roles ?? undefined,
63
+ types: selector.types,
64
+ subtypes: selector.subtypes,
65
+ facets: { ...selector.facets, [ctx.scheme.target_facet]: ctx.parsed.target },
66
+ status: 'pending',
67
+ exists: [escalation_1.ESCALATION_ACCUMULATE_KEYS.COUNT],
68
+ limit: 3,
69
+ }, { total: false });
70
+ const rows = found.escalations.filter((row) => row.id !== ctx.subject?.row.id);
71
+ return rows.length > 1 ? { ambiguous: true } : { row: rows[0] };
72
+ }
73
+ /** The missing-item answer: the rule's copy when declared, else fall through. */
74
+ function missing(step, ctx) {
75
+ if (!step.refuse?.missing)
76
+ return null;
77
+ const copy = scanCodeService.renderScanCopy(step.refuse.missing, (0, verbs_subject_1.bags)(ctx, ctx.subject?.row));
78
+ return (0, context_1.refused)(copy, { clearSubject: false });
79
+ }
80
+ /** Progress of a bounded accumulator after an add; unbounded rows report none. */
81
+ function progressOf(data) {
82
+ if (data.remaining === null || data.remaining === undefined)
83
+ return undefined;
84
+ return { filled: data.count, total: data.count + data.remaining, remaining: data.remaining };
85
+ }
86
+ /**
87
+ * The held subject's row collects the scanned code. With `accumulate.item`,
88
+ * the code's own pending row is located and written as the reciprocal in the
89
+ * same statement, so the item's record and the subject's entry land together
90
+ * or not at all.
91
+ */
92
+ async function accumulateIntoSubject(step, ctx) {
93
+ const subject = ctx.subject;
94
+ const claimed = await (0, verbs_subject_1.claimGuard)(step, ctx, subject);
95
+ if (claimed)
96
+ return claimed;
97
+ // 1. Locate the scanned item's own row when the step names one
98
+ let item;
99
+ const wantsItem = !!step.params?.accumulate?.item;
100
+ if (wantsItem) {
101
+ const located = await locateItem(step, ctx);
102
+ if ('ambiguous' in located) {
103
+ return (0, context_1.conflict)(`more than one pending row carries ${ctx.scheme.target_facet} = ${ctx.parsed.target}`);
104
+ }
105
+ item = located.row;
106
+ }
107
+ // 2. Check the pairing before anything is written
108
+ if (wantsItem && !item)
109
+ return missing(step, ctx);
110
+ const mismatch = (0, verbs_subject_1.matchGuard)(step, ctx, subject.row, item);
111
+ if (mismatch)
112
+ return mismatch;
113
+ if (item && step.subject?.claimedByOther !== 'allow') {
114
+ const other = await (0, subject_1.claimedByOther)(item, ctx.auth.userId);
115
+ if (other)
116
+ return (0, context_1.refused)(`Claimed by **${other.displayName}**.`, { clearSubject: false });
117
+ }
118
+ // 3. Spend the badge, then write both rows in one statement
119
+ const values = (0, verbs_subject_1.rendered)(step, ctx, '{scan.target}', item);
120
+ if (!values)
121
+ return null;
122
+ const notPrimed = (await (0, grant_1.identityGate)(step, ctx)) ?? (await (0, grant_1.spendGrant)(ctx));
123
+ if (notPrimed)
124
+ return notPrimed;
125
+ const result = await (0, accumulate_1.accumulateItem)({
126
+ id: subject.row.id,
127
+ itemKey: values.itemKey,
128
+ payload: values.payload,
129
+ metadata: values.metadata,
130
+ ...(item ? { reciprocal: { id: item.id } } : {}),
131
+ }, ctx.auth);
132
+ // 4. Report
133
+ if (result.status !== 200) {
134
+ const outcome = result.data?.outcome;
135
+ if (outcome === 'duplicate-item')
136
+ return (0, verbs_subject_1.already)(step, subject.row, true);
137
+ if (item && outcome && ITEM_GONE.includes(outcome))
138
+ return missing(step, ctx) ?? (0, context_1.refused)(STOCK_MISSING, { clearSubject: false });
139
+ return (0, verbs_subject_1.failedAdd)(step, ctx, result, subject.row, !!item);
140
+ }
141
+ const data = result.data;
142
+ const progress = progressOf(data);
143
+ return (0, context_1.withDone)({
144
+ status: 200,
145
+ data: {
146
+ outcome: types_1.SCAN_OUTCOMES.EXECUTED,
147
+ verb: step.verb,
148
+ escalation: { id: subject.row.id, ...result.data },
149
+ clearSubject: data.outcome === 'completed',
150
+ ...(progress ? { progress } : {}),
151
+ },
152
+ }, step, (0, verbs_subject_1.bags)(ctx, afterAdd(subject.row, values.metadata, data.count), item));
153
+ }
154
+ /** The subject's row as the add left it, for `{container.…}` copy, without a re-read. */
155
+ function afterAdd(row, patch, count) {
156
+ return { ...row, metadata: { ...(row.metadata ?? {}), ...patch, [escalation_1.ESCALATION_ACCUMULATE_KEYS.COUNT]: count } };
157
+ }
@@ -1,14 +1,33 @@
1
+ import * as scanCodeService from '../../services/scan-code';
1
2
  import { type LTEscalationRecord, type ScanExecuteResponse, type ScanStep } from '../../types';
2
3
  import type { LTApiResult } from '../../types/sdk';
3
- import { type StepContext } from './context';
4
+ import { type HeldSubject, type StepContext } from './context';
4
5
  type ScanResult = LTApiResult<ScanExecuteResponse>;
6
+ /** The step's template bags with the subject, the container, and the scanned item's row once located. */
7
+ export declare function bags(ctx: StepContext, container?: LTEscalationRecord, item?: LTEscalationRecord): scanCodeService.ScanTemplateContext;
8
+ /** Refuse the act when someone else holds a live claim on the subject. */
9
+ export declare function claimGuard(step: ScanStep, ctx: StepContext, subject: HeldSubject): Promise<ScanResult | null>;
5
10
  /**
6
11
  * The pre-write guard. Returns the refusal when the pairing is wrong, null
7
12
  * when it holds (or the step declares no match).
8
13
  */
9
- export declare function matchGuard(step: ScanStep, ctx: StepContext, container?: LTEscalationRecord): ScanResult | null;
14
+ export declare function matchGuard(step: ScanStep, ctx: StepContext, container?: LTEscalationRecord, item?: LTEscalationRecord): ScanResult | null;
15
+ /**
16
+ * Map a failed add onto what the bench says. 404 falls through. `keepSubject`
17
+ * leaves the hold in place when the reciprocal was already placed (the
18
+ * subject is the container the actor is still filling).
19
+ */
20
+ export declare function failedAdd(step: ScanStep, ctx: StepContext, result: LTApiResult, container?: LTEscalationRecord, keepSubject?: boolean): ScanResult | null;
21
+ /** The step's itemKey, payload and metadata, or null when a template token has nothing to read. */
22
+ export declare function rendered(step: ScanStep, ctx: StepContext, itemKeyDefault?: string, item?: LTEscalationRecord): {
23
+ itemKey: string;
24
+ payload: Record<string, any> | undefined;
25
+ metadata: {
26
+ [x: string]: any;
27
+ };
28
+ } | null;
10
29
  /** The subject joins the scanned container; the subject's row is the reciprocal. */
11
30
  export declare function accumulateFromSubject(step: ScanStep, ctx: StepContext): Promise<ScanResult | null>;
12
- /** The subject's own row collects the scanned code. */
13
- export declare function accumulateIntoSubject(step: ScanStep, ctx: StepContext): Promise<ScanResult | null>;
31
+ /** The item is already where the scan says: harmless, nothing written. */
32
+ export declare function already(step: ScanStep, row: LTEscalationRecord, keepSubject?: boolean): ScanResult;
14
33
  export {};