@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
@@ -1,21 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getKnowledgeSnapshot = getKnowledgeSnapshot;
4
+ exports.resolveRefEdition = resolveRefEdition;
4
5
  exports.resolveLookupContext = resolveLookupContext;
5
6
  exports.resolveLookupRefs = resolveLookupRefs;
6
7
  /**
7
8
  * Lookup snapshot cache — keeps escalation lookup resolution off the SQL hot
8
- * path. A lookup ref pins {domain, key, version}; the snapshot behind it is
9
- * immutable by design, so entries cache indefinitely under an LRU bound.
10
- * Thousands of escalations sharing the same refs resolve from memory after
11
- * the first read. Missing snapshots are never cached — a later seed or
12
- * republish must become visible.
9
+ * path. An edition {domain, key, version} is immutable, so snapshots cache
10
+ * indefinitely under an LRU bound. A pinned ref resolves from memory after
11
+ * the first read; a current ref costs one indexed read to learn which
12
+ * edition is newest, then shares the same cache. Missing snapshots are never
13
+ * cached — a later seed or republish must become visible.
13
14
  */
14
15
  const db_1 = require("../../lib/db");
16
+ const escalation_1 = require("../../types/escalation");
15
17
  const sql_1 = require("./sql");
16
18
  const SNAPSHOT_CACHE_MAX_ENTRIES = 256;
17
19
  // Map preserves insertion order — delete+set on read keeps it LRU.
18
20
  const snapshotCache = new Map();
21
+ function remember(cacheKey, snapshot) {
22
+ snapshotCache.set(cacheKey, snapshot);
23
+ while (snapshotCache.size > SNAPSHOT_CACHE_MAX_ENTRIES) {
24
+ const oldest = snapshotCache.keys().next().value;
25
+ snapshotCache.delete(oldest);
26
+ }
27
+ }
19
28
  /** The immutable snapshot at (domain, key, version), or null when absent. */
20
29
  async function getKnowledgeSnapshot(domain, key, version) {
21
30
  const cacheKey = `${domain} ${key} ${version}`;
@@ -33,13 +42,35 @@ async function getKnowledgeSnapshot(domain, key, version) {
33
42
  data: rows[0].data ?? {},
34
43
  tags: rows[0].tags ?? [],
35
44
  };
36
- snapshotCache.set(cacheKey, snapshot);
37
- while (snapshotCache.size > SNAPSHOT_CACHE_MAX_ENTRIES) {
38
- const oldest = snapshotCache.keys().next().value;
39
- snapshotCache.delete(oldest);
40
- }
45
+ remember(cacheKey, snapshot);
41
46
  return snapshot;
42
47
  }
48
+ /**
49
+ * The edition a ref names: its pin, or for a current ref the newest edition
50
+ * (the newest at `asOf` when given, so a closed row reads what was current
51
+ * when it closed). Null when there is none.
52
+ */
53
+ async function resolveRefEdition(ref, asOf) {
54
+ if (!(0, escalation_1.isCurrentLookupRef)(ref)) {
55
+ const version = ref.version;
56
+ const snapshot = await getKnowledgeSnapshot(ref.domain, ref.key, version);
57
+ return snapshot ? { version, snapshot } : null;
58
+ }
59
+ const { rows } = await (0, db_1.getPool)().query(sql_1.GET_LATEST_KNOWLEDGE_VERSION, [ref.domain, ref.key, asOf ?? null]);
60
+ if (!rows[0])
61
+ return null;
62
+ const version = Number(rows[0].version);
63
+ const cacheKey = `${ref.domain} ${ref.key} ${version}`;
64
+ const cached = snapshotCache.get(cacheKey);
65
+ if (cached)
66
+ return { version, snapshot: cached };
67
+ const snapshot = {
68
+ data: rows[0].data ?? {},
69
+ tags: rows[0].tags ?? [],
70
+ };
71
+ remember(cacheKey, snapshot);
72
+ return { version, snapshot };
73
+ }
43
74
  /** Structural check for one ref — malformed entries in stored metadata are skipped, not fatal. */
44
75
  function isLookupRef(ref) {
45
76
  if (!ref || typeof ref !== 'object')
@@ -47,7 +78,7 @@ function isLookupRef(ref) {
47
78
  const r = ref;
48
79
  return typeof r.domain === 'string' && r.domain.length > 0
49
80
  && typeof r.key === 'string' && r.key.length > 0
50
- && typeof r.version === 'number' && Number.isInteger(r.version) && r.version >= 1
81
+ && ((0, escalation_1.isCurrentLookupRef)(r) || (typeof r.version === 'number' && Number.isInteger(r.version) && r.version >= 1))
51
82
  && (r.as === undefined || (typeof r.as === 'string' && r.as.length > 0));
52
83
  }
53
84
  /**
@@ -56,7 +87,7 @@ function isLookupRef(ref) {
56
87
  * escalations without refs cost zero SQL. Missing snapshots are omitted —
57
88
  * interpolated selects then fail closed rather than render the wrong list.
58
89
  */
59
- async function resolveLookupContext(refs) {
90
+ async function resolveLookupContext(refs, asOf) {
60
91
  if (!Array.isArray(refs) || refs.length === 0)
61
92
  return null;
62
93
  const valid = refs.filter(isLookupRef);
@@ -64,9 +95,9 @@ async function resolveLookupContext(refs) {
64
95
  return null;
65
96
  const ctx = {};
66
97
  for (const ref of valid) {
67
- const snapshot = await getKnowledgeSnapshot(ref.domain, ref.key, ref.version);
68
- if (snapshot)
69
- ctx[ref.as ?? ref.key] = snapshot.data;
98
+ const edition = await resolveRefEdition(ref, asOf);
99
+ if (edition)
100
+ ctx[ref.as ?? ref.key] = edition.snapshot.data;
70
101
  }
71
102
  return ctx;
72
103
  }
@@ -75,19 +106,21 @@ async function resolveLookupContext(refs) {
75
106
  * `missing: true` marking a pin that has no snapshot — fail-visible per ref
76
107
  * without failing the batch.
77
108
  */
78
- async function resolveLookupRefs(refs) {
109
+ async function resolveLookupRefs(refs, asOf) {
79
110
  const resolved = [];
80
111
  for (const ref of refs) {
81
112
  if (!isLookupRef(ref))
82
113
  continue;
83
- const snapshot = await getKnowledgeSnapshot(ref.domain, ref.key, ref.version);
114
+ const current = (0, escalation_1.isCurrentLookupRef)(ref);
115
+ const edition = await resolveRefEdition(ref, asOf);
84
116
  resolved.push({
85
117
  domain: ref.domain,
86
118
  key: ref.key,
87
- version: ref.version,
119
+ version: edition?.version ?? (current ? null : ref.version),
120
+ ...(current ? { current: true } : {}),
88
121
  ...(ref.as ? { as: ref.as } : {}),
89
- data: snapshot ? snapshot.data : null,
90
- ...(snapshot ? {} : { missing: true }),
122
+ data: edition ? edition.snapshot.data : null,
123
+ ...(edition ? {} : { missing: true }),
91
124
  });
92
125
  }
93
126
  return resolved;
@@ -1,6 +1,7 @@
1
- import type { EscalationLookupRef } from '../../types/escalation';
1
+ import { type EscalationLookupRef } from '../../types/escalation';
2
2
  /**
3
- * One message per ref whose pinned edition does not exist, naming what does.
3
+ * One message per ref with no edition behind it (a pin that does not exist,
4
+ * or a current ref to an entry with no editions), naming what does.
4
5
  * Shape is the caller's job (assertLookupRefs); this answers the second
5
6
  * question a saver has: is there an edition behind the pin.
6
7
  */
@@ -2,25 +2,27 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.describeMissingLookupRefs = describeMissingLookupRefs;
4
4
  const db_1 = require("../../lib/db");
5
+ const escalation_1 = require("../../types/escalation");
5
6
  const lookup_cache_1 = require("./lookup-cache");
6
7
  const sql_1 = require("./sql");
7
8
  /**
8
- * One message per ref whose pinned edition does not exist, naming what does.
9
+ * One message per ref with no edition behind it (a pin that does not exist,
10
+ * or a current ref to an entry with no editions), naming what does.
9
11
  * Shape is the caller's job (assertLookupRefs); this answers the second
10
12
  * question a saver has: is there an edition behind the pin.
11
13
  */
12
14
  async function describeMissingLookupRefs(refs) {
13
15
  const problems = [];
14
16
  for (const ref of refs) {
15
- const snapshot = await (0, lookup_cache_1.getKnowledgeSnapshot)(ref.domain, ref.key, ref.version);
16
- if (snapshot)
17
+ if (await (0, lookup_cache_1.resolveRefEdition)(ref))
17
18
  continue;
18
19
  const { rows } = await (0, db_1.getPool)().query(sql_1.LIST_KNOWLEDGE_VERSIONS, [ref.domain, ref.key]);
19
20
  const versions = rows.map((r) => Number(r.version)).sort((a, b) => a - b);
20
21
  const where = versions.length
21
22
  ? `editions: ${versions.map((v) => `v${v}`).join(', ')}`
22
23
  : `no knowledge entry ${ref.domain}/${ref.key}`;
23
- problems.push(`Lookup ref ${ref.domain}/${ref.key} v${ref.version} names no edition (${where})`);
24
+ const named = (0, escalation_1.isCurrentLookupRef)(ref) ? 'current' : `v${ref.version}`;
25
+ problems.push(`Lookup ref ${ref.domain}/${ref.key} ${named} names no edition (${where})`);
24
26
  }
25
27
  return problems;
26
28
  }
@@ -1,2 +1,4 @@
1
1
  export declare const GET_KNOWLEDGE_VERSION = "\n SELECT domain, key, version, data, tags, change_summary, created_at\n FROM lt_knowledge_versions\n WHERE domain = $1 AND key = $2 AND version = $3";
2
2
  export declare const LIST_KNOWLEDGE_VERSIONS = "\n SELECT v.version, v.change_summary, v.created_at,\n (v.version = k.current_version) AS is_current\n FROM lt_knowledge_versions v\n JOIN lt_knowledge k ON k.domain = v.domain AND k.key = v.key\n WHERE v.domain = $1 AND v.key = $2\n ORDER BY v.version DESC";
3
+ /** The newest edition, or the newest created at or before $3 when it is set. */
4
+ export declare const GET_LATEST_KNOWLEDGE_VERSION = "\n SELECT version, data, tags\n FROM lt_knowledge_versions\n WHERE domain = $1 AND key = $2\n AND ($3::timestamptz IS NULL OR created_at <= $3)\n ORDER BY version DESC\n LIMIT 1";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LIST_KNOWLEDGE_VERSIONS = exports.GET_KNOWLEDGE_VERSION = void 0;
3
+ exports.GET_LATEST_KNOWLEDGE_VERSION = exports.LIST_KNOWLEDGE_VERSIONS = exports.GET_KNOWLEDGE_VERSION = void 0;
4
4
  exports.GET_KNOWLEDGE_VERSION = `
5
5
  SELECT domain, key, version, data, tags, change_summary, created_at
6
6
  FROM lt_knowledge_versions
@@ -12,3 +12,11 @@ exports.LIST_KNOWLEDGE_VERSIONS = `
12
12
  JOIN lt_knowledge k ON k.domain = v.domain AND k.key = v.key
13
13
  WHERE v.domain = $1 AND v.key = $2
14
14
  ORDER BY v.version DESC`;
15
+ /** The newest edition, or the newest created at or before $3 when it is set. */
16
+ exports.GET_LATEST_KNOWLEDGE_VERSION = `
17
+ SELECT version, data, tags
18
+ FROM lt_knowledge_versions
19
+ WHERE domain = $1 AND key = $2
20
+ AND ($3::timestamptz IS NULL OR created_at <= $3)
21
+ ORDER BY version DESC
22
+ LIMIT 1`;
@@ -175,7 +175,7 @@ function registerHumanQueueTools(server) {
175
175
  };
176
176
  }
177
177
  const refs = (0, lookups_1.readLookupRefs)(escalation.envelope);
178
- const lookups = refs.length > 0 ? await (0, knowledge_1.resolveLookupRefs)(refs) : [];
178
+ const lookups = refs.length > 0 ? await (0, knowledge_1.resolveLookupRefs)(refs, (0, lookups_1.lookupAsOf)(escalation)) : [];
179
179
  return {
180
180
  content: [{
181
181
  type: 'text',
@@ -2,10 +2,11 @@ import type { Types } from '@hotmeshio/hotmesh';
2
2
  import { type AccumulateConfig, type AccumulatorResult, type EscalationLookupRef } from '../../types/escalation';
3
3
  /**
4
4
  * HotMesh's escalation config plus long-tail sugar. `schemaVersion` pins the
5
- * role form version (lt_role_schemas) the resolve UI renders; `lookups` pins
6
- * versioned knowledge editions the form may read (the `lookup.*` context
7
- * domain — see docs/hitl/lookups.md). Both are compile-time LITERALS the
8
- * workflow author sets, folded before the config reaches the engine:
5
+ * role form version (lt_role_schemas) the resolve UI renders; `lookups` names
6
+ * the knowledge entries the form may read (the `lookup.*` context domain, see
7
+ * docs/hitl/lookups.md), each pinned to an edition or following the current
8
+ * one. Both are LITERALS the workflow author sets, folded before the config
9
+ * reaches the engine:
9
10
  * schemaVersion into the GIN-indexed metadata (a queryable facet), lookups
10
11
  * into the unindexed envelope (form plumbing, never a facet). Folding is a
11
12
  * pure transform — no query, no activity — so a pinned `conditional` costs
@@ -57,17 +58,19 @@ export type ConditionEscalationConfig = Types.ConditionQueueConfig & {
57
58
  * });
58
59
  * ```
59
60
  *
60
- * **Pin versioned knowledge lookups — option lists the form reads.** Each ref
61
- * names an immutable knowledge edition; the resolve UI fetches them once and
62
- * the form addresses the content as the `lookup.*` context domain
63
- * (`x-lt-options: "lookup.materials.items"`). Evolve the list by writing the
64
- * entry (a new version mints automatically) and repinning the literal here.
61
+ * **Knowledge lookups — option lists the form reads.** Each ref names a
62
+ * knowledge entry; the resolve UI fetches it and the form addresses the
63
+ * content as the `lookup.*` context domain (`x-lt-options:
64
+ * "lookup.materials.items"`). Leave `version` out (or set `'current'`) and
65
+ * the form reads the newest edition, so a long-open row sees today's list
66
+ * and a closed row the list current when it closed. Pin a `version` when the
67
+ * form must read one exact edition.
65
68
  *
66
69
  * ```typescript
67
70
  * const decision = await conditional<PickerResolverV1>(signalId, {
68
71
  * role: 'catalog-picker',
69
72
  * description: instructions,
70
- * lookups: [{ domain: 'catalog', key: 'materials', version: 2 }],
73
+ * lookups: [{ domain: 'catalog', key: 'materials' }],
71
74
  * });
72
75
  * ```
73
76
  *
@@ -119,7 +122,10 @@ export type ConditionEscalationConfig = Types.ConditionQueueConfig & {
119
122
  * items persist on the terminal row for audit. Add `partialOnTimeout: true`
120
123
  * (hotmesh 0.29.0+) and the timer instead resumes with the items filled so
121
124
  * far plus `$trigger: 'timeout'`. A plain resolve on a batch row remains an
122
- * admin override that resolves the whole row with its payload.
125
+ * admin override that resolves the whole row with its payload. Entries
126
+ * already satisfied go in `filled` (hotmesh 0.31.0+), keyed by item key
127
+ * with `payload`, `at` from the source of record, and an optional `actor`;
128
+ * the row starts with that progress and delivers them with the collection.
123
129
  *
124
130
  * **Open accumulation — items arrive over time (hotmesh 0.29.0+).** Declare
125
131
  * `accumulate` and the escalation holds items added via `accumulateItem`
@@ -104,17 +104,19 @@ function toEngineConfig(escalation) {
104
104
  * });
105
105
  * ```
106
106
  *
107
- * **Pin versioned knowledge lookups — option lists the form reads.** Each ref
108
- * names an immutable knowledge edition; the resolve UI fetches them once and
109
- * the form addresses the content as the `lookup.*` context domain
110
- * (`x-lt-options: "lookup.materials.items"`). Evolve the list by writing the
111
- * entry (a new version mints automatically) and repinning the literal here.
107
+ * **Knowledge lookups — option lists the form reads.** Each ref names a
108
+ * knowledge entry; the resolve UI fetches it and the form addresses the
109
+ * content as the `lookup.*` context domain (`x-lt-options:
110
+ * "lookup.materials.items"`). Leave `version` out (or set `'current'`) and
111
+ * the form reads the newest edition, so a long-open row sees today's list
112
+ * and a closed row the list current when it closed. Pin a `version` when the
113
+ * form must read one exact edition.
112
114
  *
113
115
  * ```typescript
114
116
  * const decision = await conditional<PickerResolverV1>(signalId, {
115
117
  * role: 'catalog-picker',
116
118
  * description: instructions,
117
- * lookups: [{ domain: 'catalog', key: 'materials', version: 2 }],
119
+ * lookups: [{ domain: 'catalog', key: 'materials' }],
118
120
  * });
119
121
  * ```
120
122
  *
@@ -166,7 +168,10 @@ function toEngineConfig(escalation) {
166
168
  * items persist on the terminal row for audit. Add `partialOnTimeout: true`
167
169
  * (hotmesh 0.29.0+) and the timer instead resumes with the items filled so
168
170
  * far plus `$trigger: 'timeout'`. A plain resolve on a batch row remains an
169
- * admin override that resolves the whole row with its payload.
171
+ * admin override that resolves the whole row with its payload. Entries
172
+ * already satisfied go in `filled` (hotmesh 0.31.0+), keyed by item key
173
+ * with `payload`, `at` from the source of record, and an optional `actor`;
174
+ * the row starts with that progress and delivers them with the collection.
170
175
  *
171
176
  * **Open accumulation — items arrive over time (hotmesh 0.29.0+).** Declare
172
177
  * `accumulate` and the escalation holds items added via `accumulateItem`
@@ -2,4 +2,4 @@ export { listScanSchemes, getScanScheme, listScanRules, getScanRule, } from './r
2
2
  export { upsertScanScheme, deleteScanScheme, upsertScanRule, deleteScanRule, seedScanScheme, seedScanRule, applyScanScheme, applyScanRule, type ScanSchemeInput, type ScanRuleInput, } from './write';
3
3
  export { parseScanCode, interpolateScanTemplate, mentionsClaimToken, renderScanCopy, ScanTemplateError, type ScanParseResult, type ScanParseFailure, type ScanTemplateContext, } from './parse';
4
4
  export { assertValidScheme, assertValidSteps, assertValidIdentityRule, assertSchemesCoexist, } from './validate';
5
- export { isValidGtin, normalizeGtin } from '../../shared/scan-code';
5
+ export { isValidGtin, normalizeGtin, displayGtin } from '../../shared/scan-code';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeGtin = exports.isValidGtin = exports.assertSchemesCoexist = exports.assertValidIdentityRule = exports.assertValidSteps = exports.assertValidScheme = exports.ScanTemplateError = exports.renderScanCopy = exports.mentionsClaimToken = exports.interpolateScanTemplate = exports.parseScanCode = exports.applyScanRule = exports.applyScanScheme = exports.seedScanRule = exports.seedScanScheme = exports.deleteScanRule = exports.upsertScanRule = exports.deleteScanScheme = exports.upsertScanScheme = exports.getScanRule = exports.listScanRules = exports.getScanScheme = exports.listScanSchemes = void 0;
3
+ exports.displayGtin = exports.normalizeGtin = exports.isValidGtin = exports.assertSchemesCoexist = exports.assertValidIdentityRule = exports.assertValidSteps = exports.assertValidScheme = exports.ScanTemplateError = exports.renderScanCopy = exports.mentionsClaimToken = exports.interpolateScanTemplate = exports.parseScanCode = exports.applyScanRule = exports.applyScanScheme = exports.seedScanRule = exports.seedScanScheme = exports.deleteScanRule = exports.upsertScanRule = exports.deleteScanScheme = exports.upsertScanScheme = exports.getScanRule = exports.listScanRules = exports.getScanScheme = exports.listScanSchemes = void 0;
4
4
  var read_1 = require("./read");
5
5
  Object.defineProperty(exports, "listScanSchemes", { enumerable: true, get: function () { return read_1.listScanSchemes; } });
6
6
  Object.defineProperty(exports, "getScanScheme", { enumerable: true, get: function () { return read_1.getScanScheme; } });
@@ -29,3 +29,4 @@ Object.defineProperty(exports, "assertSchemesCoexist", { enumerable: true, get:
29
29
  var scan_code_1 = require("../../shared/scan-code");
30
30
  Object.defineProperty(exports, "isValidGtin", { enumerable: true, get: function () { return scan_code_1.isValidGtin; } });
31
31
  Object.defineProperty(exports, "normalizeGtin", { enumerable: true, get: function () { return scan_code_1.normalizeGtin; } });
32
+ Object.defineProperty(exports, "displayGtin", { enumerable: true, get: function () { return scan_code_1.displayGtin; } });
@@ -0,0 +1,5 @@
1
+ import { type ScanStep } from '../../types';
2
+ /** The most facts a station screen states before it reads as a data dump. */
3
+ export declare const SCAN_FACTS_MAX = 12;
4
+ /** `facts` on a present step: labeled template values the station states. */
5
+ export declare function assertValidFacts(step: ScanStep, at: string): void;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SCAN_FACTS_MAX = void 0;
4
+ exports.assertValidFacts = assertValidFacts;
5
+ const types_1 = require("../../types");
6
+ /** The most facts a station screen states before it reads as a data dump. */
7
+ exports.SCAN_FACTS_MAX = 12;
8
+ /** `facts` on a present step: labeled template values the station states. */
9
+ function assertValidFacts(step, at) {
10
+ if (step.facts === undefined)
11
+ return;
12
+ if (step.verb !== types_1.SCAN_VERBS.PRESENT)
13
+ throw new Error(`${at}: facts apply only to present steps`);
14
+ if (!Array.isArray(step.facts) || step.facts.length === 0 || step.facts.length > exports.SCAN_FACTS_MAX) {
15
+ throw new Error(`${at}: facts must be an array of 1-${exports.SCAN_FACTS_MAX} { label, value } entries`);
16
+ }
17
+ step.facts.forEach((fact, i) => {
18
+ if (!fact || typeof fact !== 'object' || typeof fact.label !== 'string' || !fact.label.trim()) {
19
+ throw new Error(`${at}: facts[${i}].label must be non-empty text`);
20
+ }
21
+ if (typeof fact.value !== 'string')
22
+ throw new Error(`${at}: facts[${i}].value must be a template string`);
23
+ });
24
+ }
@@ -0,0 +1,8 @@
1
+ import { type ScanStep } from '../../types';
2
+ /**
3
+ * query.types / query.subtypes narrow a locate that is followed by a write
4
+ * by id. Every present choice writes the row it showed, so a present step
5
+ * takes them with any choice; claim, cancel, release, resolve and escalate
6
+ * steps do not.
7
+ */
8
+ export declare function assertValidQueryKinds(step: ScanStep, at: string): void;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertValidQueryKinds = assertValidQueryKinds;
4
+ const types_1 = require("../../types");
5
+ // Verbs whose atomic statement locates by the target facet alone when they
6
+ // run as a step; a type/subtype guard on the step would never reach it.
7
+ const RELOCATING_VERBS = [
8
+ types_1.SCAN_VERBS.CLAIM, types_1.SCAN_VERBS.CLAIM_SHOW_DETAIL, types_1.SCAN_VERBS.CANCEL,
9
+ types_1.SCAN_VERBS.RELEASE, types_1.SCAN_VERBS.ESCALATE, types_1.SCAN_VERBS.RESOLVE,
10
+ ];
11
+ /**
12
+ * query.types / query.subtypes narrow a locate that is followed by a write
13
+ * by id. Every present choice writes the row it showed, so a present step
14
+ * takes them with any choice; claim, cancel, release, resolve and escalate
15
+ * steps do not.
16
+ */
17
+ function assertValidQueryKinds(step, at) {
18
+ const { types, subtypes } = step.query ?? {};
19
+ if (types === undefined && subtypes === undefined)
20
+ return;
21
+ for (const [name, list] of [['types', types], ['subtypes', subtypes]]) {
22
+ if (list !== undefined && (!Array.isArray(list) || list.length === 0
23
+ || !list.every((v) => typeof v === 'string' && v))) {
24
+ throw new Error(`${at}: query.${name} must be a non-empty array of strings`);
25
+ }
26
+ }
27
+ if (RELOCATING_VERBS.includes(step.verb)) {
28
+ throw new Error(`${at}: query.types/subtypes are not supported on ${step.verb} steps (the write re-locates by the target facet)`);
29
+ }
30
+ if (step.subject) {
31
+ throw new Error(`${at}: a subject step narrows with params.accumulate.container or item, not query.types/subtypes`);
32
+ }
33
+ if (step.query?.availability === types_1.SCAN_AVAILABILITY.MINE && ((types?.length ?? 0) > 1 || (subtypes?.length ?? 0) > 1)) {
34
+ throw new Error(`${at}: with availability 'mine', query.types and query.subtypes take at most one entry each`);
35
+ }
36
+ }
@@ -67,6 +67,8 @@ function assertValidSubjectStep(step, at) {
67
67
  if ((accumulate?.from || accumulate?.into) && accumulate.containerFacet) {
68
68
  throw new Error(`${at}: params.accumulate.containerFacet is item mode; drop it for from/into 'subject'`);
69
69
  }
70
+ if (accumulate?.item !== undefined)
71
+ assertValidItemSelector(accumulate, at);
70
72
  if (accumulate?.from && !step.params?.itemKey) {
71
73
  throw new Error(`${at}: from-subject accumulate requires params.itemKey (e.g. '{subject.<facet>}')`);
72
74
  }
@@ -101,8 +103,8 @@ function assertValidSubjectStep(step, at) {
101
103
  if (typeof step.refuse.missing !== 'string' || !step.refuse.missing) {
102
104
  throw new Error(`${at}: refuse.missing must be markdown`);
103
105
  }
104
- if (accumulate?.from !== 'subject') {
105
- throw new Error(`${at}: refuse.missing applies only to a from-subject accumulate`);
106
+ if (accumulate?.from !== 'subject' && !(accumulate?.into === 'subject' && accumulate.item)) {
107
+ throw new Error(`${at}: refuse.missing applies only to a from-subject accumulate, or an into-subject accumulate with item`);
106
108
  }
107
109
  }
108
110
  }
@@ -115,6 +117,31 @@ function assertValidSubjectStep(step, at) {
115
117
  else if (step.params?.fill !== undefined)
116
118
  throw new Error(`${at}: params.fill applies only to fill steps`);
117
119
  }
120
+ function assertValidItemSelector(accumulate, at) {
121
+ const item = accumulate.item;
122
+ if (accumulate.into !== 'subject') {
123
+ throw new Error(`${at}: params.accumulate.item applies only to an into-subject accumulate`);
124
+ }
125
+ if (!isPlainObject(item))
126
+ throw new Error(`${at}: params.accumulate.item must be an object`);
127
+ if (item.roles !== undefined && !isStringList(item.roles)) {
128
+ throw new Error(`${at}: params.accumulate.item.roles must be a non-empty array of roles`);
129
+ }
130
+ if (item.types !== undefined && !isStringList(item.types)) {
131
+ throw new Error(`${at}: params.accumulate.item.types must be a non-empty array of strings`);
132
+ }
133
+ if (item.subtypes !== undefined && !isStringList(item.subtypes)) {
134
+ throw new Error(`${at}: params.accumulate.item.subtypes must be a non-empty array of strings`);
135
+ }
136
+ if (item.facets !== undefined) {
137
+ if (!isPlainObject(item.facets))
138
+ throw new Error(`${at}: params.accumulate.item.facets must be an object`);
139
+ for (const key of Object.keys(item.facets)) {
140
+ if (!facet_sql_1.FACET_KEY.test(key))
141
+ throw new Error(`${at}: params.accumulate.item.facets key "${key}" must be a facet key`);
142
+ }
143
+ }
144
+ }
118
145
  function assertValidHold(step, at) {
119
146
  if (step.cardinality === 'many')
120
147
  throw new Error(`${at}: hold locates a single row (cardinality first)`);
@@ -8,6 +8,8 @@ const types_1 = require("../../types");
8
8
  const scan_code_1 = require("../../shared/scan-code");
9
9
  const facet_sql_1 = require("../escalation/facet-sql");
10
10
  const validate_subject_1 = require("./validate-subject");
11
+ const validate_query_1 = require("./validate-query");
12
+ const validate_facts_1 = require("./validate-facts");
11
13
  const VALID_VERBS = new Set(Object.values(types_1.SCAN_VERBS));
12
14
  /** Double-scan selection tokens — short, label-printable, never scheme-shaped. */
13
15
  const CHOICE_CODE = /^[A-Za-z0-9_-]{1,32}$/;
@@ -242,6 +244,8 @@ function assertValidSteps(steps) {
242
244
  if (step.query && step.query.roles && !Array.isArray(step.query.roles)) {
243
245
  throw new Error(`${at}: query.roles must be an array`);
244
246
  }
247
+ (0, validate_query_1.assertValidQueryKinds)(step, at);
248
+ (0, validate_facts_1.assertValidFacts)(step, at);
245
249
  // Claim and cancel lock via claim-by-metadata, whose SQL filter is the
246
250
  // target facet + roles only — extra facet guards would be silently
247
251
  // ignored there, so reject them at write time. (Locate, resolve, and
@@ -259,28 +263,32 @@ function assertValidSteps(steps) {
259
263
  const BAG_TOKEN = /\{(claim|item|subject|container|fill)\.([^}]*)\}/g;
260
264
  /**
261
265
  * Bag tokens name facet keys and may only read what the step has:
262
- * `{item.…}` the row an item-mode accumulate or a hold located,
266
+ * `{item.…}` the row an item-mode accumulate, an into-subject accumulate
267
+ * with `item`, or a hold located (and, in a present step's facts, the row it
268
+ * presents),
263
269
  * `{subject.…}` the held subject (steps with a subject gate), and
264
270
  * `{container.…}` / `{fill.…}` only inside refusal and done copy, where a
265
- * subject accumulate or a fill has read them.
271
+ * subject accumulate or a fill has read them (into-subject: the held row).
266
272
  */
267
273
  function assertValidTemplateTokens(step, at) {
268
- const itemRow = (step.verb === types_1.SCAN_VERBS.ACCUMULATE && !!step.params?.accumulate?.containerFacet)
274
+ const accumulate = step.verb === types_1.SCAN_VERBS.ACCUMULATE ? step.params?.accumulate : undefined;
275
+ const itemRow = !!accumulate?.containerFacet || (accumulate?.into === 'subject' && !!accumulate.item)
269
276
  || step.verb === types_1.SCAN_VERBS.HOLD;
270
- const check = (value, inRefusal) => {
277
+ const containerCopy = accumulate?.from === 'subject' || accumulate?.into === 'subject';
278
+ const check = (value, inRefusal, inFacts = false) => {
271
279
  for (const match of JSON.stringify(value ?? {}).matchAll(BAG_TOKEN)) {
272
280
  const [token, bag, facet] = match;
273
281
  if (!facet_sql_1.FACET_KEY.test(facet)) {
274
282
  throw new Error(`${at}: template token ${token} must name a facet key`);
275
283
  }
276
- if (bag === 'item' && !itemRow) {
277
- throw new Error(`${at}: ${token} reads the located item row, which only an item-mode accumulate or a hold step has`);
284
+ if (bag === 'item' && !itemRow && !inFacts) {
285
+ throw new Error(`${at}: ${token} reads the located item row, which only an item-mode accumulate, an into-subject accumulate with item, or a hold step has`);
278
286
  }
279
287
  if (bag === 'subject' && !step.subject) {
280
288
  throw new Error(`${at}: ${token} reads the held subject, which only a step with a subject gate has`);
281
289
  }
282
- if (bag === 'container' && !(inRefusal && step.params?.accumulate?.from === 'subject')) {
283
- throw new Error(`${at}: ${token} is readable only in the refusal or done copy of a from-subject accumulate step`);
290
+ if (bag === 'container' && !(inRefusal && containerCopy)) {
291
+ throw new Error(`${at}: ${token} is readable only in the refusal or done copy of a subject accumulate step`);
284
292
  }
285
293
  if (bag === 'fill' && !(inRefusal && step.verb === types_1.SCAN_VERBS.FILL)) {
286
294
  throw new Error(`${at}: ${token} is readable only in the refusal or done copy of a fill step`);
@@ -291,4 +299,5 @@ function assertValidTemplateTokens(step, at) {
291
299
  check(step.match, false);
292
300
  check(step.refuse, true);
293
301
  check(step.done, true);
302
+ check(step.facts, false, true);
294
303
  }
@@ -3,3 +3,9 @@ export declare const GTIN_CODE_LENGTHS: readonly number[];
3
3
  export declare function isValidGtin(code: string): boolean;
4
4
  /** The 14-digit form of a valid GTIN: UPC-A, EAN-13 and EAN-8 left-padded with zeros. */
5
5
  export declare function normalizeGtin(code: string): string;
6
+ /**
7
+ * A stored 14-digit GTIN as the package prints it: EAN-8 when it was padded
8
+ * from eight digits, otherwise EAN-13 (a UPC-A reads as its EAN-13 with a
9
+ * leading zero). Anything else comes back unchanged.
10
+ */
11
+ export declare function displayGtin(code: string): string;
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.GTIN_CODE_LENGTHS = void 0;
6
6
  exports.isValidGtin = isValidGtin;
7
7
  exports.normalizeGtin = normalizeGtin;
8
+ exports.displayGtin = displayGtin;
8
9
  exports.GTIN_CODE_LENGTHS = [8, 12, 13, 14];
9
10
  /** True when `code` is all digits, a GTIN length, and its mod-10 check digit holds. */
10
11
  function isValidGtin(code) {
@@ -23,3 +24,15 @@ function isValidGtin(code) {
23
24
  function normalizeGtin(code) {
24
25
  return code.padStart(14, '0');
25
26
  }
27
+ /**
28
+ * A stored 14-digit GTIN as the package prints it: EAN-8 when it was padded
29
+ * from eight digits, otherwise EAN-13 (a UPC-A reads as its EAN-13 with a
30
+ * leading zero). Anything else comes back unchanged.
31
+ */
32
+ function displayGtin(code) {
33
+ if (code.length !== 14 || !isValidGtin(code))
34
+ return code;
35
+ if (code.startsWith('000000') && isValidGtin(code.slice(6)))
36
+ return code.slice(6);
37
+ return code.startsWith('0') ? code.slice(1) : code;
38
+ }
@@ -1,2 +1,2 @@
1
1
  export { parseScanCode, fixedCodeLengths, type ParseableScheme, type ParsedCode, type ScanParseFailure, type ScanParseResult, } from './parse';
2
- export { isValidGtin, normalizeGtin, GTIN_CODE_LENGTHS } from './gtin';
2
+ export { isValidGtin, normalizeGtin, displayGtin, GTIN_CODE_LENGTHS } from './gtin';
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GTIN_CODE_LENGTHS = exports.normalizeGtin = exports.isValidGtin = exports.fixedCodeLengths = exports.parseScanCode = void 0;
3
+ exports.GTIN_CODE_LENGTHS = exports.displayGtin = exports.normalizeGtin = exports.isValidGtin = exports.fixedCodeLengths = exports.parseScanCode = void 0;
4
4
  var parse_1 = require("./parse");
5
5
  Object.defineProperty(exports, "parseScanCode", { enumerable: true, get: function () { return parse_1.parseScanCode; } });
6
6
  Object.defineProperty(exports, "fixedCodeLengths", { enumerable: true, get: function () { return parse_1.fixedCodeLengths; } });
7
7
  var gtin_1 = require("./gtin");
8
8
  Object.defineProperty(exports, "isValidGtin", { enumerable: true, get: function () { return gtin_1.isValidGtin; } });
9
9
  Object.defineProperty(exports, "normalizeGtin", { enumerable: true, get: function () { return gtin_1.normalizeGtin; } });
10
+ Object.defineProperty(exports, "displayGtin", { enumerable: true, get: function () { return gtin_1.displayGtin; } });
10
11
  Object.defineProperty(exports, "GTIN_CODE_LENGTHS", { enumerable: true, get: function () { return gtin_1.GTIN_CODE_LENGTHS; } });