@carlonicora/nestjs-neo4jsonapi 1.63.0 → 1.65.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 (288) hide show
  1. package/dist/agents/agents.modules.js +3 -3
  2. package/dist/agents/agents.modules.js.map +1 -1
  3. package/dist/agents/graph/graph.module.d.ts +3 -0
  4. package/dist/agents/graph/graph.module.d.ts.map +1 -0
  5. package/dist/agents/{chatbot/chatbot.module.js → graph/graph.module.js} +12 -16
  6. package/dist/agents/graph/graph.module.js.map +1 -0
  7. package/dist/agents/{chatbot → graph}/interfaces/graph.catalog.interface.d.ts +4 -0
  8. package/dist/agents/graph/interfaces/graph.catalog.interface.d.ts.map +1 -0
  9. package/dist/agents/graph/interfaces/graph.catalog.interface.js.map +1 -0
  10. package/dist/agents/graph/interfaces/graph.node.output.interface.d.ts +30 -0
  11. package/dist/agents/graph/interfaces/graph.node.output.interface.d.ts.map +1 -0
  12. package/dist/agents/graph/interfaces/graph.node.output.interface.js +3 -0
  13. package/dist/agents/graph/interfaces/graph.node.output.interface.js.map +1 -0
  14. package/dist/agents/graph/prompts/graph.node.system.prompt.d.ts +3 -0
  15. package/dist/agents/graph/prompts/graph.node.system.prompt.d.ts.map +1 -0
  16. package/dist/agents/graph/prompts/graph.node.system.prompt.js +66 -0
  17. package/dist/agents/graph/prompts/graph.node.system.prompt.js.map +1 -0
  18. package/dist/agents/graph/repositories/user-modules.repository.d.ts.map +1 -0
  19. package/dist/agents/graph/repositories/user-modules.repository.js.map +1 -0
  20. package/dist/agents/{chatbot → graph}/services/descriptor.source.d.ts +2 -0
  21. package/dist/agents/graph/services/descriptor.source.d.ts.map +1 -0
  22. package/dist/agents/{chatbot → graph}/services/descriptor.source.js +18 -3
  23. package/dist/agents/graph/services/descriptor.source.js.map +1 -0
  24. package/dist/agents/graph/services/field-formatting.d.ts.map +1 -0
  25. package/dist/agents/graph/services/field-formatting.js.map +1 -0
  26. package/dist/agents/{chatbot → graph}/services/graph.catalog.service.d.ts +16 -0
  27. package/dist/agents/graph/services/graph.catalog.service.d.ts.map +1 -0
  28. package/dist/agents/{chatbot → graph}/services/graph.catalog.service.js +63 -1
  29. package/dist/agents/graph/services/graph.catalog.service.js.map +1 -0
  30. package/dist/agents/{chatbot/services/chatbot.index.manager.d.ts → graph/services/graph.index.manager.d.ts} +2 -2
  31. package/dist/agents/graph/services/graph.index.manager.d.ts.map +1 -0
  32. package/dist/agents/{chatbot/services/chatbot.index.manager.js → graph/services/graph.index.manager.js} +9 -9
  33. package/dist/agents/graph/services/graph.index.manager.js.map +1 -0
  34. package/dist/agents/graph/services/graph.search.service.d.ts +69 -0
  35. package/dist/agents/graph/services/graph.search.service.d.ts.map +1 -0
  36. package/dist/agents/graph/services/graph.search.service.js +230 -0
  37. package/dist/agents/graph/services/graph.search.service.js.map +1 -0
  38. package/dist/agents/graph/services/humanize-tool.d.ts.map +1 -0
  39. package/dist/agents/graph/services/humanize-tool.js.map +1 -0
  40. package/dist/agents/graph/services/materialise-bridge.d.ts +36 -0
  41. package/dist/agents/graph/services/materialise-bridge.d.ts.map +1 -0
  42. package/dist/agents/graph/services/materialise-bridge.js +69 -0
  43. package/dist/agents/graph/services/materialise-bridge.js.map +1 -0
  44. package/dist/agents/graph/tools/describe-entity.tool.d.ts.map +1 -0
  45. package/dist/agents/{chatbot → graph}/tools/describe-entity.tool.js +1 -0
  46. package/dist/agents/graph/tools/describe-entity.tool.js.map +1 -0
  47. package/dist/agents/{chatbot → graph}/tools/read-entity.tool.d.ts +5 -1
  48. package/dist/agents/graph/tools/read-entity.tool.d.ts.map +1 -0
  49. package/dist/agents/{chatbot → graph}/tools/read-entity.tool.js +37 -8
  50. package/dist/agents/graph/tools/read-entity.tool.js.map +1 -0
  51. package/dist/agents/{chatbot → graph}/tools/resolve-entity.tool.d.ts +2 -2
  52. package/dist/agents/graph/tools/resolve-entity.tool.d.ts.map +1 -0
  53. package/dist/agents/{chatbot → graph}/tools/resolve-entity.tool.js +2 -2
  54. package/dist/agents/graph/tools/resolve-entity.tool.js.map +1 -0
  55. package/dist/agents/{chatbot → graph}/tools/search-entities.tool.d.ts +6 -2
  56. package/dist/agents/graph/tools/search-entities.tool.d.ts.map +1 -0
  57. package/dist/agents/{chatbot → graph}/tools/search-entities.tool.js +36 -12
  58. package/dist/agents/graph/tools/search-entities.tool.js.map +1 -0
  59. package/dist/agents/{chatbot → graph}/tools/tool.factory.d.ts +7 -0
  60. package/dist/agents/graph/tools/tool.factory.d.ts.map +1 -0
  61. package/dist/agents/{chatbot → graph}/tools/tool.factory.js +57 -3
  62. package/dist/agents/graph/tools/tool.factory.js.map +1 -0
  63. package/dist/agents/{chatbot → graph}/tools/traverse.tool.d.ts +5 -1
  64. package/dist/agents/graph/tools/traverse.tool.d.ts.map +1 -0
  65. package/dist/agents/{chatbot → graph}/tools/traverse.tool.js +38 -15
  66. package/dist/agents/graph/tools/traverse.tool.js.map +1 -0
  67. package/dist/agents/index.d.ts +6 -9
  68. package/dist/agents/index.d.ts.map +1 -1
  69. package/dist/agents/index.js +13 -15
  70. package/dist/agents/index.js.map +1 -1
  71. package/dist/agents/responder/contexts/responder.context.d.ts +75 -1
  72. package/dist/agents/responder/contexts/responder.context.d.ts.map +1 -1
  73. package/dist/agents/responder/contexts/responder.context.js +29 -4
  74. package/dist/agents/responder/contexts/responder.context.js.map +1 -1
  75. package/dist/agents/responder/factories/responder.context.factory.d.ts +4 -5
  76. package/dist/agents/responder/factories/responder.context.factory.d.ts.map +1 -1
  77. package/dist/agents/responder/factories/responder.context.factory.js +28 -8
  78. package/dist/agents/responder/factories/responder.context.factory.js.map +1 -1
  79. package/dist/agents/responder/interfaces/entity.reference.interface.d.ts +7 -0
  80. package/dist/agents/responder/interfaces/entity.reference.interface.d.ts.map +1 -0
  81. package/dist/agents/{chatbot/interfaces/chatbot.response.interface.js → responder/interfaces/entity.reference.interface.js} +1 -1
  82. package/dist/agents/responder/interfaces/entity.reference.interface.js.map +1 -0
  83. package/dist/agents/responder/interfaces/responder.response.interface.d.ts +12 -3
  84. package/dist/agents/responder/interfaces/responder.response.interface.d.ts.map +1 -1
  85. package/dist/agents/responder/interfaces/unified.trace.interface.d.ts +64 -0
  86. package/dist/agents/responder/interfaces/unified.trace.interface.d.ts.map +1 -0
  87. package/dist/agents/responder/interfaces/unified.trace.interface.js +3 -0
  88. package/dist/agents/responder/interfaces/unified.trace.interface.js.map +1 -0
  89. package/dist/agents/responder/nodes/graph.node.service.d.ts +31 -0
  90. package/dist/agents/responder/nodes/graph.node.service.d.ts.map +1 -0
  91. package/dist/agents/responder/nodes/graph.node.service.js +319 -0
  92. package/dist/agents/responder/nodes/graph.node.service.js.map +1 -0
  93. package/dist/agents/responder/nodes/planner.node.service.d.ts +14 -0
  94. package/dist/agents/responder/nodes/planner.node.service.d.ts.map +1 -0
  95. package/dist/agents/responder/nodes/planner.node.service.js +121 -0
  96. package/dist/agents/responder/nodes/planner.node.service.js.map +1 -0
  97. package/dist/agents/responder/nodes/responder.answer.node.service.d.ts +5 -23
  98. package/dist/agents/responder/nodes/responder.answer.node.service.d.ts.map +1 -1
  99. package/dist/agents/responder/nodes/responder.answer.node.service.js +257 -432
  100. package/dist/agents/responder/nodes/responder.answer.node.service.js.map +1 -1
  101. package/dist/agents/responder/responder.module.d.ts.map +1 -1
  102. package/dist/agents/responder/responder.module.js +12 -3
  103. package/dist/agents/responder/responder.module.js.map +1 -1
  104. package/dist/agents/responder/services/responder.service.d.ts +15 -22
  105. package/dist/agents/responder/services/responder.service.d.ts.map +1 -1
  106. package/dist/agents/responder/services/responder.service.js +116 -89
  107. package/dist/agents/responder/services/responder.service.js.map +1 -1
  108. package/dist/bootstrap/bootstrap.options.d.ts +7 -0
  109. package/dist/bootstrap/bootstrap.options.d.ts.map +1 -1
  110. package/dist/common/helpers/define-entity.d.ts.map +1 -1
  111. package/dist/common/helpers/define-entity.js +16 -1
  112. package/dist/common/helpers/define-entity.js.map +1 -1
  113. package/dist/common/interfaces/entity.schema.interface.d.ts +15 -0
  114. package/dist/common/interfaces/entity.schema.interface.d.ts.map +1 -1
  115. package/dist/core/llm/interfaces/llm-call-metadata.interface.d.ts +19 -0
  116. package/dist/core/llm/interfaces/llm-call-metadata.interface.d.ts.map +1 -0
  117. package/dist/core/llm/interfaces/llm-call-metadata.interface.js +3 -0
  118. package/dist/core/llm/interfaces/llm-call-metadata.interface.js.map +1 -0
  119. package/dist/core/llm/llm.module.d.ts +1 -0
  120. package/dist/core/llm/llm.module.d.ts.map +1 -1
  121. package/dist/core/llm/llm.module.js +3 -1
  122. package/dist/core/llm/llm.module.js.map +1 -1
  123. package/dist/core/llm/services/llm-call-dumper.service.d.ts +64 -0
  124. package/dist/core/llm/services/llm-call-dumper.service.d.ts.map +1 -0
  125. package/dist/core/llm/services/llm-call-dumper.service.js +204 -0
  126. package/dist/core/llm/services/llm-call-dumper.service.js.map +1 -0
  127. package/dist/core/llm/services/llm.service.d.ts +4 -1
  128. package/dist/core/llm/services/llm.service.d.ts.map +1 -1
  129. package/dist/core/llm/services/llm.service.js +304 -220
  130. package/dist/core/llm/services/llm.service.js.map +1 -1
  131. package/dist/foundations/assistant/assistant.module.d.ts.map +1 -1
  132. package/dist/foundations/assistant/assistant.module.js +3 -2
  133. package/dist/foundations/assistant/assistant.module.js.map +1 -1
  134. package/dist/foundations/assistant/entities/assistant.d.ts +15 -16
  135. package/dist/foundations/assistant/entities/assistant.d.ts.map +1 -1
  136. package/dist/foundations/assistant/entities/assistant.js +21 -9
  137. package/dist/foundations/assistant/entities/assistant.js.map +1 -1
  138. package/dist/foundations/assistant/repositories/assistant.repository.d.ts +13 -0
  139. package/dist/foundations/assistant/repositories/assistant.repository.d.ts.map +1 -1
  140. package/dist/foundations/assistant/services/assistant.service.d.ts +35 -10
  141. package/dist/foundations/assistant/services/assistant.service.d.ts.map +1 -1
  142. package/dist/foundations/assistant/services/assistant.service.js +132 -17
  143. package/dist/foundations/assistant/services/assistant.service.js.map +1 -1
  144. package/dist/foundations/assistant-message/entities/assistant-message.d.ts +30 -10
  145. package/dist/foundations/assistant-message/entities/assistant-message.d.ts.map +1 -1
  146. package/dist/foundations/assistant-message/entities/assistant-message.js +19 -4
  147. package/dist/foundations/assistant-message/entities/assistant-message.js.map +1 -1
  148. package/dist/foundations/assistant-message/repositories/assistant-message.repository.d.ts +53 -4
  149. package/dist/foundations/assistant-message/repositories/assistant-message.repository.d.ts.map +1 -1
  150. package/dist/foundations/assistant-message/repositories/assistant-message.repository.js +43 -3
  151. package/dist/foundations/assistant-message/repositories/assistant-message.repository.js.map +1 -1
  152. package/dist/foundations/assistant-message/services/assistant-message.service.d.ts +26 -0
  153. package/dist/foundations/assistant-message/services/assistant-message.service.d.ts.map +1 -1
  154. package/dist/foundations/chunk/chunk.module.d.ts.map +1 -1
  155. package/dist/foundations/chunk/chunk.module.js +4 -5
  156. package/dist/foundations/chunk/chunk.module.js.map +1 -1
  157. package/dist/foundations/chunk/entities/chunk.entity.d.ts +19 -4
  158. package/dist/foundations/chunk/entities/chunk.entity.d.ts.map +1 -1
  159. package/dist/foundations/chunk/entities/chunk.entity.js +48 -0
  160. package/dist/foundations/chunk/entities/chunk.entity.js.map +1 -1
  161. package/dist/foundations/chunk/index.d.ts +1 -2
  162. package/dist/foundations/chunk/index.d.ts.map +1 -1
  163. package/dist/foundations/chunk/index.js +3 -3
  164. package/dist/foundations/chunk/index.js.map +1 -1
  165. package/dist/foundations/chunk/repositories/chunk.repository.d.ts.map +1 -1
  166. package/dist/foundations/chunk/repositories/chunk.repository.js +8 -8
  167. package/dist/foundations/chunk/repositories/chunk.repository.js.map +1 -1
  168. package/dist/foundations/chunk/services/chunk.service.d.ts.map +1 -1
  169. package/dist/foundations/chunk/services/chunk.service.js +2 -2
  170. package/dist/foundations/chunk/services/chunk.service.js.map +1 -1
  171. package/dist/foundations/rbac/controllers/rbac-dev.controller.d.ts +50 -0
  172. package/dist/foundations/rbac/controllers/rbac-dev.controller.d.ts.map +1 -0
  173. package/dist/foundations/rbac/controllers/rbac-dev.controller.js +172 -0
  174. package/dist/foundations/rbac/controllers/rbac-dev.controller.js.map +1 -0
  175. package/dist/foundations/rbac/dsl/define-rbac.d.ts +15 -0
  176. package/dist/foundations/rbac/dsl/define-rbac.d.ts.map +1 -0
  177. package/dist/foundations/rbac/dsl/define-rbac.js +19 -0
  178. package/dist/foundations/rbac/dsl/define-rbac.js.map +1 -0
  179. package/dist/foundations/rbac/dsl/index.d.ts +6 -0
  180. package/dist/foundations/rbac/dsl/index.d.ts.map +1 -0
  181. package/dist/foundations/rbac/dsl/index.js +30 -0
  182. package/dist/foundations/rbac/dsl/index.js.map +1 -0
  183. package/dist/foundations/rbac/dsl/perm.d.ts +15 -0
  184. package/dist/foundations/rbac/dsl/perm.d.ts.map +1 -0
  185. package/dist/foundations/rbac/dsl/perm.js +24 -0
  186. package/dist/foundations/rbac/dsl/perm.js.map +1 -0
  187. package/dist/foundations/rbac/dsl/resolver.d.ts +24 -0
  188. package/dist/foundations/rbac/dsl/resolver.d.ts.map +1 -0
  189. package/dist/foundations/rbac/dsl/resolver.js +55 -0
  190. package/dist/foundations/rbac/dsl/resolver.js.map +1 -0
  191. package/dist/foundations/rbac/dsl/to-permissions-json.d.ts +13 -0
  192. package/dist/foundations/rbac/dsl/to-permissions-json.d.ts.map +1 -0
  193. package/dist/foundations/rbac/dsl/to-permissions-json.js +43 -0
  194. package/dist/foundations/rbac/dsl/to-permissions-json.js.map +1 -0
  195. package/dist/foundations/rbac/dsl/types.d.ts +55 -0
  196. package/dist/foundations/rbac/dsl/types.d.ts.map +1 -0
  197. package/dist/foundations/rbac/dsl/types.js +6 -0
  198. package/dist/foundations/rbac/dsl/types.js.map +1 -0
  199. package/dist/foundations/rbac/dump.d.ts +116 -0
  200. package/dist/foundations/rbac/dump.d.ts.map +1 -0
  201. package/dist/foundations/rbac/dump.js +154 -0
  202. package/dist/foundations/rbac/dump.js.map +1 -0
  203. package/dist/foundations/rbac/index.d.ts +6 -0
  204. package/dist/foundations/rbac/index.d.ts.map +1 -1
  205. package/dist/foundations/rbac/index.js +23 -1
  206. package/dist/foundations/rbac/index.js.map +1 -1
  207. package/dist/foundations/rbac/rbac.module.d.ts +4 -1
  208. package/dist/foundations/rbac/rbac.module.d.ts.map +1 -1
  209. package/dist/foundations/rbac/rbac.module.js +25 -11
  210. package/dist/foundations/rbac/rbac.module.js.map +1 -1
  211. package/dist/foundations/rbac/rbac.tokens.d.ts +11 -0
  212. package/dist/foundations/rbac/rbac.tokens.d.ts.map +1 -0
  213. package/dist/foundations/rbac/rbac.tokens.js +14 -0
  214. package/dist/foundations/rbac/rbac.tokens.js.map +1 -0
  215. package/dist/foundations/rbac/serializer/matrix-to-ts.d.ts +13 -0
  216. package/dist/foundations/rbac/serializer/matrix-to-ts.d.ts.map +1 -0
  217. package/dist/foundations/rbac/serializer/matrix-to-ts.js +74 -0
  218. package/dist/foundations/rbac/serializer/matrix-to-ts.js.map +1 -0
  219. package/dist/foundations/rbac/services/rbac-reconciler.service.d.ts +30 -0
  220. package/dist/foundations/rbac/services/rbac-reconciler.service.d.ts.map +1 -0
  221. package/dist/foundations/rbac/services/rbac-reconciler.service.js +192 -0
  222. package/dist/foundations/rbac/services/rbac-reconciler.service.js.map +1 -0
  223. package/dist/tools/generate-rbac-paths/index.js +24 -19
  224. package/package.json +1 -1
  225. package/dist/agents/chatbot/chatbot.module.d.ts +0 -3
  226. package/dist/agents/chatbot/chatbot.module.d.ts.map +0 -1
  227. package/dist/agents/chatbot/chatbot.module.js.map +0 -1
  228. package/dist/agents/chatbot/interfaces/chatbot.response.interface.d.ts +0 -25
  229. package/dist/agents/chatbot/interfaces/chatbot.response.interface.d.ts.map +0 -1
  230. package/dist/agents/chatbot/interfaces/chatbot.response.interface.js.map +0 -1
  231. package/dist/agents/chatbot/interfaces/graph.catalog.interface.d.ts.map +0 -1
  232. package/dist/agents/chatbot/interfaces/graph.catalog.interface.js.map +0 -1
  233. package/dist/agents/chatbot/prompts/chatbot.system.prompt.d.ts +0 -3
  234. package/dist/agents/chatbot/prompts/chatbot.system.prompt.d.ts.map +0 -1
  235. package/dist/agents/chatbot/prompts/chatbot.system.prompt.js +0 -60
  236. package/dist/agents/chatbot/prompts/chatbot.system.prompt.js.map +0 -1
  237. package/dist/agents/chatbot/repositories/user-modules.repository.d.ts.map +0 -1
  238. package/dist/agents/chatbot/repositories/user-modules.repository.js.map +0 -1
  239. package/dist/agents/chatbot/services/chatbot.index.manager.d.ts.map +0 -1
  240. package/dist/agents/chatbot/services/chatbot.index.manager.js.map +0 -1
  241. package/dist/agents/chatbot/services/chatbot.search.service.d.ts +0 -46
  242. package/dist/agents/chatbot/services/chatbot.search.service.d.ts.map +0 -1
  243. package/dist/agents/chatbot/services/chatbot.search.service.js +0 -148
  244. package/dist/agents/chatbot/services/chatbot.search.service.js.map +0 -1
  245. package/dist/agents/chatbot/services/chatbot.service.d.ts +0 -36
  246. package/dist/agents/chatbot/services/chatbot.service.d.ts.map +0 -1
  247. package/dist/agents/chatbot/services/chatbot.service.js +0 -220
  248. package/dist/agents/chatbot/services/chatbot.service.js.map +0 -1
  249. package/dist/agents/chatbot/services/descriptor.source.d.ts.map +0 -1
  250. package/dist/agents/chatbot/services/descriptor.source.js.map +0 -1
  251. package/dist/agents/chatbot/services/field-formatting.d.ts.map +0 -1
  252. package/dist/agents/chatbot/services/field-formatting.js.map +0 -1
  253. package/dist/agents/chatbot/services/graph.catalog.service.d.ts.map +0 -1
  254. package/dist/agents/chatbot/services/graph.catalog.service.js.map +0 -1
  255. package/dist/agents/chatbot/services/humanize-tool.d.ts.map +0 -1
  256. package/dist/agents/chatbot/services/humanize-tool.js.map +0 -1
  257. package/dist/agents/chatbot/tools/describe-entity.tool.d.ts.map +0 -1
  258. package/dist/agents/chatbot/tools/describe-entity.tool.js.map +0 -1
  259. package/dist/agents/chatbot/tools/read-entity.tool.d.ts.map +0 -1
  260. package/dist/agents/chatbot/tools/read-entity.tool.js.map +0 -1
  261. package/dist/agents/chatbot/tools/resolve-entity.tool.d.ts.map +0 -1
  262. package/dist/agents/chatbot/tools/resolve-entity.tool.js.map +0 -1
  263. package/dist/agents/chatbot/tools/search-entities.tool.d.ts.map +0 -1
  264. package/dist/agents/chatbot/tools/search-entities.tool.js.map +0 -1
  265. package/dist/agents/chatbot/tools/tool.factory.d.ts.map +0 -1
  266. package/dist/agents/chatbot/tools/tool.factory.js.map +0 -1
  267. package/dist/agents/chatbot/tools/traverse.tool.d.ts.map +0 -1
  268. package/dist/agents/chatbot/tools/traverse.tool.js.map +0 -1
  269. package/dist/foundations/chunk/entities/chunk.map.d.ts +0 -8
  270. package/dist/foundations/chunk/entities/chunk.map.d.ts.map +0 -1
  271. package/dist/foundations/chunk/entities/chunk.map.js +0 -31
  272. package/dist/foundations/chunk/entities/chunk.map.js.map +0 -1
  273. package/dist/foundations/chunk/entities/chunk.model.d.ts +0 -4
  274. package/dist/foundations/chunk/entities/chunk.model.d.ts.map +0 -1
  275. package/dist/foundations/chunk/entities/chunk.model.js +0 -13
  276. package/dist/foundations/chunk/entities/chunk.model.js.map +0 -1
  277. package/dist/foundations/chunk/serialisers/chunk.serialiser.d.ts +0 -14
  278. package/dist/foundations/chunk/serialisers/chunk.serialiser.d.ts.map +0 -1
  279. package/dist/foundations/chunk/serialisers/chunk.serialiser.js +0 -54
  280. package/dist/foundations/chunk/serialisers/chunk.serialiser.js.map +0 -1
  281. /package/dist/agents/{chatbot → graph}/interfaces/graph.catalog.interface.js +0 -0
  282. /package/dist/agents/{chatbot → graph}/repositories/user-modules.repository.d.ts +0 -0
  283. /package/dist/agents/{chatbot → graph}/repositories/user-modules.repository.js +0 -0
  284. /package/dist/agents/{chatbot → graph}/services/field-formatting.d.ts +0 -0
  285. /package/dist/agents/{chatbot → graph}/services/field-formatting.js +0 -0
  286. /package/dist/agents/{chatbot → graph}/services/humanize-tool.d.ts +0 -0
  287. /package/dist/agents/{chatbot → graph}/services/humanize-tool.js +0 -0
  288. /package/dist/agents/{chatbot → graph}/tools/describe-entity.tool.d.ts +0 -0
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RBAC_MATRIX_TOKEN = void 0;
4
+ /**
5
+ * DI token for the declarative RBAC matrix.
6
+ *
7
+ * Applications provide an `RbacMatrix` under this token; `RbacReconcilerService`
8
+ * reads it at bootstrap and reconciles Neo4j against it.
9
+ *
10
+ * Note: `MODULE_USER_PATHS_TOKEN` already lives in `rbac.constants.ts` — import
11
+ * it from there rather than duplicating it here.
12
+ */
13
+ exports.RBAC_MATRIX_TOKEN = Symbol("RBAC_MATRIX_TOKEN");
14
+ //# sourceMappingURL=rbac.tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rbac.tokens.js","sourceRoot":"","sources":["../../../src/foundations/rbac/rbac.tokens.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACU,QAAA,iBAAiB,GAAG,MAAM,CAAC,mBAAmB,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { RbacMatrix } from "../dsl/types";
2
+ interface Options {
3
+ roleNames: Record<string, string>;
4
+ moduleNames: Record<string, string>;
5
+ }
6
+ /**
7
+ * Serialise an RbacMatrix to formatted TypeScript source.
8
+ * Deterministic: module and role keys are sorted by UUID; tokens are
9
+ * normalised per action.
10
+ */
11
+ export declare function serializeMatrixToTs(matrix: RbacMatrix, opts: Options): Promise<string>;
12
+ export {};
13
+ //# sourceMappingURL=matrix-to-ts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matrix-to-ts.d.ts","sourceRoot":"","sources":["../../../../src/foundations/rbac/serializer/matrix-to-ts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,cAAc,CAAC;AAE1D,UAAU,OAAO;IACf,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAmC5F"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.serializeMatrixToTs = serializeMatrixToTs;
7
+ // packages/nestjs-neo4jsonapi/src/foundations/rbac/serializer/matrix-to-ts.ts
8
+ const prettier_1 = __importDefault(require("prettier"));
9
+ /**
10
+ * Serialise an RbacMatrix to formatted TypeScript source.
11
+ * Deterministic: module and role keys are sorted by UUID; tokens are
12
+ * normalised per action.
13
+ */
14
+ async function serializeMatrixToTs(matrix, opts) {
15
+ const moduleIds = Object.keys(matrix).sort();
16
+ const lines = [];
17
+ lines.push(`// Auto-maintained by the RBAC UI. Edit via \`pnpm dev\` + UI, or by hand.`);
18
+ lines.push(``);
19
+ lines.push(`import { RoleId, ModuleId } from "@neural-erp/shared";`);
20
+ lines.push(`import { perm, defineRbac } from "@carlonicora/nestjs-neo4jsonapi";`);
21
+ lines.push(`import { MODULE_USER_PATHS } from "../features/rbac/module-relationships.map";`);
22
+ lines.push(``);
23
+ lines.push(`export const rbac = defineRbac<typeof MODULE_USER_PATHS>({`);
24
+ for (const moduleId of moduleIds) {
25
+ const block = matrix[moduleId];
26
+ if (!block)
27
+ continue;
28
+ const moduleName = opts.moduleNames[moduleId];
29
+ if (!moduleName) {
30
+ throw new Error(`Unknown module UUID: ${moduleId}. Check module-id.map.json.`);
31
+ }
32
+ lines.push(` [ModuleId.${moduleName}]: {`);
33
+ lines.push(` default: ${renderTokens(block.default)},`);
34
+ const roleIds = Object.keys(block)
35
+ .filter((k) => k !== "default")
36
+ .sort();
37
+ for (const roleId of roleIds) {
38
+ const roleName = opts.roleNames[roleId];
39
+ if (!roleName)
40
+ throw new Error(`Unknown role UUID: ${roleId}`);
41
+ lines.push(` [RoleId.${roleName}]: ${renderTokens(block[roleId])},`);
42
+ }
43
+ lines.push(` },`);
44
+ }
45
+ lines.push(`});`);
46
+ lines.push(``);
47
+ const raw = lines.join("\n");
48
+ return prettier_1.default.format(raw, { parser: "typescript" });
49
+ }
50
+ function renderTokens(tokens) {
51
+ // `scope === false` has no emission (absence of a token is the "deny"
52
+ // semantics). Drop defensively before any shape-checking so malformed state
53
+ // never leaks to disk as `perm.X("false")`.
54
+ const valid = tokens.filter((t) => t.scope === true || (typeof t.scope === "string" && t.scope.length > 0));
55
+ // perm.full collapse
56
+ const isFull = valid.length === 4 && valid.every((t) => t.scope === true) && new Set(valid.map((t) => t.action)).size === 4;
57
+ if (isFull)
58
+ return "perm.full";
59
+ if (valid.length === 0)
60
+ return "[]";
61
+ // Render each token
62
+ const parts = [...valid]
63
+ .sort((a, b) => {
64
+ const order = { read: 0, create: 1, update: 2, delete: 3 };
65
+ return order[a.action] - order[b.action];
66
+ })
67
+ .map((t) => {
68
+ if (t.scope === true)
69
+ return `perm.${t.action}`;
70
+ return `perm.${t.action}("${t.scope}")`;
71
+ });
72
+ return `[${parts.join(", ")}]`;
73
+ }
74
+ //# sourceMappingURL=matrix-to-ts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matrix-to-ts.js","sourceRoot":"","sources":["../../../../src/foundations/rbac/serializer/matrix-to-ts.ts"],"names":[],"mappings":";;;;;AAcA,kDAmCC;AAjDD,8EAA8E;AAC9E,wDAAgC;AAQhC;;;;GAIG;AACI,KAAK,UAAU,mBAAmB,CAAC,MAAkB,EAAE,IAAa;IACzE,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,4EAA4E,CAAC,CAAC;IACzF,KAAK,CAAC,IAA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E,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QACnF,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACT,IAAI,CAAC,CAAC,KAAK,KAAK,IAAI;YAAE,OAAO,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;QAChD,OAAO,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC;IAC1C,CAAC,CAAC,CAAC;IACL,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AACjC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { OnApplicationBootstrap } from "@nestjs/common";
2
+ import { Neo4jService } from "../../../core/neo4j/services/neo4j.service";
3
+ import { AppLoggingService } from "../../../core/logging/services/logging.service";
4
+ import type { RbacMatrix } from "../dsl/types";
5
+ /**
6
+ * Applies the declared `RbacMatrix` to Neo4j at application bootstrap.
7
+ *
8
+ * Behaviour (per spec §6.3):
9
+ * - Administrator role is never written as an HAS_PERMISSIONS edge — the
10
+ * security layer short-circuits for it.
11
+ * - Module defaults are stored on `Module.permissions`.
12
+ * - Role-specific permissions are stored on `(Role)-[:HAS_PERMISSIONS]->(Module)`.
13
+ * - Deletions are scoped to modules declared in the matrix: edges for
14
+ * undeclared modules are left untouched.
15
+ * - Preflight aborts with a clear error if any referenced role or module is
16
+ * missing from the DB (seed migrations must run first).
17
+ */
18
+ export declare class RbacReconcilerService implements OnApplicationBootstrap {
19
+ private readonly neo4j;
20
+ private readonly matrix;
21
+ private readonly logger;
22
+ constructor(neo4j: Neo4jService, matrix: RbacMatrix | null, logger: AppLoggingService);
23
+ onApplicationBootstrap(): Promise<void>;
24
+ private preflight;
25
+ private findMissing;
26
+ private readActualState;
27
+ private computeDiff;
28
+ private apply;
29
+ }
30
+ //# sourceMappingURL=rbac-reconciler.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rbac-reconciler.service.d.ts","sourceRoot":"","sources":["../../../../src/foundations/rbac/services/rbac-reconciler.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAGnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAe/C;;;;;;;;;;;;GAYG;AACH,qBACa,qBAAsB,YAAW,sBAAsB;IAEhE,OAAO,CAAC,QAAQ,CAAC,KAAK;IACiB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAC9D,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAFN,KAAK,EAAE,YAAY,EACoB,MAAM,EAAE,UAAU,GAAG,IAAI,EAChE,MAAM,EAAE,iBAAiB;IAGtC,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;YAsB/B,SAAS;YAyBT,WAAW;YAOX,eAAe;IAsB7B,OAAO,CAAC,WAAW;YAkEL,KAAK;CA4BpB"}
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.RbacReconcilerService = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const neo4j_service_1 = require("../../../core/neo4j/services/neo4j.service");
18
+ const logging_service_1 = require("../../../core/logging/services/logging.service");
19
+ const system_roles_1 = require("../../../common/constants/system.roles");
20
+ const rbac_tokens_1 = require("../rbac.tokens");
21
+ const resolver_1 = require("../dsl/resolver");
22
+ const ADMINISTRATOR_ID = system_roles_1.SystemRoles.Administrator;
23
+ /**
24
+ * Applies the declared `RbacMatrix` to Neo4j at application bootstrap.
25
+ *
26
+ * Behaviour (per spec §6.3):
27
+ * - Administrator role is never written as an HAS_PERMISSIONS edge — the
28
+ * security layer short-circuits for it.
29
+ * - Module defaults are stored on `Module.permissions`.
30
+ * - Role-specific permissions are stored on `(Role)-[:HAS_PERMISSIONS]->(Module)`.
31
+ * - Deletions are scoped to modules declared in the matrix: edges for
32
+ * undeclared modules are left untouched.
33
+ * - Preflight aborts with a clear error if any referenced role or module is
34
+ * missing from the DB (seed migrations must run first).
35
+ */
36
+ let RbacReconcilerService = class RbacReconcilerService {
37
+ constructor(neo4j, matrix, logger) {
38
+ this.neo4j = neo4j;
39
+ this.matrix = matrix;
40
+ this.logger = logger;
41
+ }
42
+ async onApplicationBootstrap() {
43
+ if (!this.matrix) {
44
+ this.logger.log("RBAC reconciler: no matrix configured, skipping");
45
+ return;
46
+ }
47
+ await this.preflight();
48
+ const actual = await this.readActualState();
49
+ const diff = this.computeDiff(actual);
50
+ if (diff.operations.length === 0) {
51
+ this.logger.log("RBAC reconcile: no changes");
52
+ return;
53
+ }
54
+ await this.apply(diff.operations);
55
+ this.logger.log(`RBAC reconcile: ${diff.defaultsChanged} defaults changed, ${diff.edgesUpserted} edges upserted, ${diff.edgesRemoved} edges removed`);
56
+ }
57
+ async preflight() {
58
+ const moduleIds = new Set();
59
+ const roleIds = new Set();
60
+ for (const moduleId of (0, resolver_1.iterateDeclaredModules)(this.matrix)) {
61
+ moduleIds.add(moduleId);
62
+ }
63
+ for (const { roleId } of (0, resolver_1.iterateDeclaredEdges)(this.matrix)) {
64
+ if (roleId === ADMINISTRATOR_ID)
65
+ continue;
66
+ roleIds.add(roleId);
67
+ }
68
+ const missingRoles = await this.findMissing("Role", Array.from(roleIds));
69
+ const missingModules = await this.findMissing("Module", Array.from(moduleIds));
70
+ if (missingRoles.length > 0 || missingModules.length > 0) {
71
+ throw new Error(`RBAC reconcile aborted - referenced entities not found in DB. ` +
72
+ `Roles missing: ${missingRoles.join(", ") || "none"}. ` +
73
+ `Modules missing: ${missingModules.join(", ") || "none"}. ` +
74
+ `Apply seed migrations before declaring these in the matrix.`);
75
+ }
76
+ }
77
+ async findMissing(label, ids) {
78
+ if (ids.length === 0)
79
+ return [];
80
+ const result = await this.neo4j.read(`MATCH (n:${label}) WHERE n.id IN $ids RETURN n.id AS id`, { ids });
81
+ const found = new Set(result.records.map((r) => r.get("id")));
82
+ return ids.filter((id) => !found.has(id));
83
+ }
84
+ async readActualState() {
85
+ const modulesResult = await this.neo4j.read(`MATCH (m:Module) RETURN m.id AS id, m.permissions AS permissions`, {});
86
+ const edgesResult = await this.neo4j.read(`MATCH (r:Role)-[p:HAS_PERMISSIONS]->(m:Module) RETURN r.id AS roleId, m.id AS moduleId, p.permissions AS permissions`, {});
87
+ const moduleDefaults = {};
88
+ for (const rec of modulesResult.records) {
89
+ moduleDefaults[rec.get("id")] = rec.get("permissions");
90
+ }
91
+ const edges = [];
92
+ for (const rec of edgesResult.records) {
93
+ edges.push({
94
+ roleId: rec.get("roleId"),
95
+ moduleId: rec.get("moduleId"),
96
+ permissions: rec.get("permissions"),
97
+ });
98
+ }
99
+ return { moduleDefaults, edges };
100
+ }
101
+ computeDiff(actual) {
102
+ const operations = [];
103
+ let defaultsChanged = 0;
104
+ let edgesUpserted = 0;
105
+ let edgesRemoved = 0;
106
+ const declaredModules = new Set(Array.from((0, resolver_1.iterateDeclaredModules)(this.matrix)));
107
+ const sortedModules = Array.from(declaredModules).sort();
108
+ // Defaults
109
+ for (const moduleId of sortedModules) {
110
+ const expected = (0, resolver_1.resolveDefault)(this.matrix, moduleId);
111
+ if (expected === undefined)
112
+ continue;
113
+ if (actual.moduleDefaults[moduleId] !== expected) {
114
+ operations.push({ kind: "setDefault", params: { moduleId, permissions: expected } });
115
+ defaultsChanged++;
116
+ }
117
+ }
118
+ // Edges — expected (Administrator excluded)
119
+ const expectedEdgeKeys = new Set();
120
+ const sortedEdges = Array.from((0, resolver_1.iterateDeclaredEdges)(this.matrix))
121
+ .filter((e) => e.roleId !== ADMINISTRATOR_ID)
122
+ .sort((a, b) => (a.moduleId + a.roleId).localeCompare(b.moduleId + b.roleId));
123
+ const actualByKey = new Map();
124
+ for (const edge of actual.edges) {
125
+ actualByKey.set(`${edge.roleId}|${edge.moduleId}`, edge.permissions);
126
+ }
127
+ for (const { roleId, moduleId } of sortedEdges) {
128
+ const expected = (0, resolver_1.resolveForRole)(this.matrix, roleId, moduleId);
129
+ if (expected === undefined)
130
+ continue;
131
+ const key = `${roleId}|${moduleId}`;
132
+ expectedEdgeKeys.add(key);
133
+ if (actualByKey.get(key) !== expected) {
134
+ operations.push({
135
+ kind: "upsertEdge",
136
+ params: { roleId, moduleId, permissions: expected },
137
+ });
138
+ edgesUpserted++;
139
+ }
140
+ }
141
+ // Edges — to delete (scoped to declared modules only; Administrator never managed)
142
+ for (const edge of actual.edges) {
143
+ if (!declaredModules.has(edge.moduleId))
144
+ continue;
145
+ if (edge.roleId === ADMINISTRATOR_ID)
146
+ continue;
147
+ const key = `${edge.roleId}|${edge.moduleId}`;
148
+ if (!expectedEdgeKeys.has(key)) {
149
+ operations.push({
150
+ kind: "deleteEdge",
151
+ params: { roleId: edge.roleId, moduleId: edge.moduleId },
152
+ });
153
+ edgesRemoved++;
154
+ }
155
+ }
156
+ return { operations, defaultsChanged, edgesUpserted, edgesRemoved };
157
+ }
158
+ async apply(operations) {
159
+ const queries = operations.map((op) => {
160
+ if (op.kind === "setDefault") {
161
+ return {
162
+ query: `MATCH (m:Module {id: $moduleId}) SET m.permissions = $permissions`,
163
+ params: op.params,
164
+ };
165
+ }
166
+ if (op.kind === "upsertEdge") {
167
+ return {
168
+ query: `MATCH (role:Role {id: $roleId}) ` +
169
+ `MATCH (module:Module {id: $moduleId}) ` +
170
+ `MERGE (role)-[permissions:HAS_PERMISSIONS]->(module) ` +
171
+ `ON CREATE SET permissions.permissions = $permissions ` +
172
+ `ON MATCH SET permissions.permissions = $permissions`,
173
+ params: op.params,
174
+ };
175
+ }
176
+ // deleteEdge
177
+ return {
178
+ query: `MATCH (role:Role {id: $roleId})-[p:HAS_PERMISSIONS]->(module:Module {id: $moduleId}) DELETE p`,
179
+ params: op.params,
180
+ };
181
+ });
182
+ await this.neo4j.executeInTransaction(queries);
183
+ }
184
+ };
185
+ exports.RbacReconcilerService = RbacReconcilerService;
186
+ exports.RbacReconcilerService = RbacReconcilerService = __decorate([
187
+ (0, common_1.Injectable)(),
188
+ __param(1, (0, common_1.Optional)()),
189
+ __param(1, (0, common_1.Inject)(rbac_tokens_1.RBAC_MATRIX_TOKEN)),
190
+ __metadata("design:paramtypes", [neo4j_service_1.Neo4jService, Object, logging_service_1.AppLoggingService])
191
+ ], RbacReconcilerService);
192
+ //# sourceMappingURL=rbac-reconciler.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rbac-reconciler.service.js","sourceRoot":"","sources":["../../../../src/foundations/rbac/services/rbac-reconciler.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAsF;AACtF,8EAA0E;AAC1E,oFAAmF;AACnF,yEAAqE;AACrE,gDAAmD;AAEnD,8CAA+G;AAE/G,MAAM,gBAAgB,GAAW,0BAAW,CAAC,aAAa,CAAC;AAY3D;;;;;;;;;;;;GAYG;AAEI,IAAM,qBAAqB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AAC,EAAE,EAAE,EAAE;YACpC,IAAI,EAAE,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBAC7B,OAAO;oBACL,KAAK,EAAE,mEAAmE;oBAC1E,MAAM,EAAE,EAAE,CAAC,MAAM;iBAClB,CAAC;YACJ,CAAC;YACD,IAAI,EAAE,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBAC7B,OAAO;oBACL,KAAK,EACH,kCAAkC;wBAClC,wCAAwC;wBACxC,uDAAuD;wBACvD,uDAAuD;wBACvD,qDAAqD;oBACvD,MAAM,EAAE,EAAE,CAAC,MAAM;iBAClB,CAAC;YACJ,CAAC;YACD,aAAa;YACb,OAAO;gBACL,KAAK,EAAE,+FAA+F;gBACtG,MAAM,EAAE,EAAE,CAAC,MAAM;aAClB,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,MAAM,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;CACF,CAAA;AAjLY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;IAIR,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,+BAAiB,CAAC,CAAA;qCADd,4BAAY,UAEX,mCAAiB;GAJjC,qBAAqB,CAiLjC"}
@@ -50,6 +50,7 @@ program
50
50
  .option("--output <path>", "Output file path", "src/features/rbac/module-relationships.map.ts")
51
51
  .option("--skip <names>", "Comma-separated entity names to skip", "")
52
52
  .option("--max-depth <n>", "BFS max depth", "4")
53
+ .option("--module-id-map <path>", "Path to labelName→UUID JSON map (required for UUID-keyed output)", "")
53
54
  .parse();
54
55
  function scanDescriptors(dir, skipEntities) {
55
56
  const entities = [];
@@ -141,19 +142,6 @@ function bfsToUser(graph, startEntity, maxDepth) {
141
142
  }
142
143
  return paths;
143
144
  }
144
- function generateOutput(moduleUserPaths) {
145
- const entries = Object.entries(moduleUserPaths)
146
- .sort(([a], [b]) => a.localeCompare(b))
147
- .map(([key, paths]) => ` ${JSON.stringify(key)}: ${JSON.stringify(paths)}`)
148
- .join(",\n");
149
- return `// Auto-generated by generate-rbac-paths CLI tool
150
- // Do not edit manually - regenerate with: pnpm generate:rbac-paths
151
-
152
- export const MODULE_USER_PATHS: Record<string, string[]> = {
153
- ${entries}
154
- };
155
- `;
156
- }
157
145
  async function main() {
158
146
  const options = program.opts();
159
147
  const dir = options.dir;
@@ -164,31 +152,48 @@ async function main() {
164
152
  .map((s) => s.trim())
165
153
  .filter(Boolean);
166
154
  const skipEntities = [...DEFAULT_SKIP_ENTITIES, ...extraSkip];
155
+ const moduleIdMapPath = options.moduleIdMap;
156
+ if (!moduleIdMapPath) {
157
+ console.error("--module-id-map is required. See apps/api/scripts/build-module-id-map.ts.");
158
+ process.exit(1);
159
+ }
160
+ const moduleIdMap = JSON.parse(fs.readFileSync(moduleIdMapPath, "utf8"));
167
161
  console.info("\nRBAC Path Generation CLI");
168
162
  console.info("========================\n");
169
163
  console.info(`Scanning: ${dir}`);
170
164
  console.info(`Output: ${output}`);
171
165
  console.info(`Max depth: ${maxDepth}`);
166
+ console.info(`Module id map: ${moduleIdMapPath}`);
172
167
  console.info(`Skip entities: ${skipEntities.join(", ")}\n`);
173
168
  const entities = scanDescriptors(dir, skipEntities);
174
169
  console.info(`Found ${entities.length} entities\n`);
175
170
  const graph = buildGraph(entities);
176
- const moduleUserPaths = {};
171
+ const entitiesByLabel = new Map();
172
+ const pathsByEntity = new Map();
177
173
  for (const entity of entities) {
178
- const normalizedName = entity.labelName.charAt(0).toLowerCase() + entity.labelName.slice(1);
174
+ entitiesByLabel.set(entity.labelName, entity);
179
175
  const paths = bfsToUser(graph, entity.labelName, maxDepth);
176
+ pathsByEntity.set(entity.labelName, paths);
180
177
  if (paths.length > 0) {
181
- moduleUserPaths[normalizedName] = paths;
182
- console.info(` ${normalizedName}: [${paths.join(", ")}]`);
178
+ console.info(` ${entity.labelName}: [${paths.join(", ")}]`);
183
179
  }
184
180
  }
185
- const content = generateOutput(moduleUserPaths);
181
+ // Ensure every mapped module has an entry (possibly empty)
182
+ const finalMap = {};
183
+ for (const [labelName, uuid] of Object.entries(moduleIdMap)) {
184
+ const entity = entitiesByLabel.get(labelName);
185
+ finalMap[uuid] = entity ? Array.from(pathsByEntity.get(labelName) ?? []) : [];
186
+ }
187
+ const content = `// Auto-generated by generate-rbac-paths CLI tool\n` +
188
+ `// Do not edit manually - regenerate with: pnpm generate:rbac-paths\n\n` +
189
+ `export const MODULE_USER_PATHS = ${JSON.stringify(finalMap, null, 2)} as const;\n\n` +
190
+ `export type ModuleUserPathsType = typeof MODULE_USER_PATHS;\n`;
186
191
  const outputDir = path.dirname(output);
187
192
  if (!fs.existsSync(outputDir)) {
188
193
  fs.mkdirSync(outputDir, { recursive: true });
189
194
  }
190
195
  fs.writeFileSync(output, content, "utf-8");
191
- console.info(`\nGenerated ${output} with ${Object.keys(moduleUserPaths).length} entity paths\n`);
196
+ console.info(`\nGenerated ${output} with ${Object.keys(finalMap).length} module entries\n`);
192
197
  }
193
198
  main().catch((error) => {
194
199
  console.error("\nGeneration failed:", error.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carlonicora/nestjs-neo4jsonapi",
3
- "version": "1.63.0",
3
+ "version": "1.65.0",
4
4
  "description": "NestJS foundation package with JSON:API, Neo4j, Redis, LangChain agents, and common utilities",
5
5
  "author": "Carlo Nicora",
6
6
  "license": "GPL-3.0-or-later",
@@ -1,3 +0,0 @@
1
- export declare class ChatbotModule {
2
- }
3
- //# sourceMappingURL=chatbot.module.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chatbot.module.d.ts","sourceRoot":"","sources":["../../../src/agents/chatbot/chatbot.module.ts"],"names":[],"mappings":"AAeA,qBAsCa,aAAa;CAAG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"chatbot.module.js","sourceRoot":"","sources":["../../../src/agents/chatbot/chatbot.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,0DAAsD;AACtD,oFAA+E;AAC/E,4EAAuE;AACvE,8EAAyE;AACzE,gEAA4D;AAC5D,oEAAuE;AACvE,4EAAuE;AACvE,uEAAkE;AAClE,+DAA0D;AAC1D,qEAAgE;AAChE,uEAAkE;AAClE,uDAAmD;AACnD,yDAAqD;AAwC9C,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IAtCzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,sBAAS,CAAC;QACpB,SAAS,EAAE;YACT,2CAAuB;YACvB;gBACE,OAAO,EAAE,2CAAmB;gBAC5B,UAAU,EAAE,CAAC,GAA4B,EAAE,EAAE,CAAC,IAAI,2CAAmB,CAAC,GAAG,CAAC;gBAC1E,MAAM,EAAE,CAAC,2CAAuB,CAAC;aAClC;YACD,0BAAW;YACX,uCAAiB;YACjB,yCAAkB;YAClB,yCAAkB;YAClB,iCAAc;YACd,4BAAY;YACZ,+CAAqB;YACrB,gCAAc;YAEd,wEAAwE;YACxE,2CAAmB;YAEnB,wEAAwE;YACxE,6CAAoB;SACrB;QACD,OAAO,EAAE;YACP,gCAAc;YACd,2CAAuB;YACvB,2CAAmB;YACnB,+CAAqB;YACrB,0BAAW;YACX,uCAAiB;YACjB,yCAAkB;YAClB,yCAAkB;YAClB,iCAAc;YACd,4BAAY;YACZ,6CAAoB;SACrB;KACF,CAAC;GACW,aAAa,CAAG"}
@@ -1,25 +0,0 @@
1
- import { AgentMessageType } from "../../../common/enums/agentmessage.type";
2
- export interface ChatbotReference {
3
- type: string;
4
- id: string;
5
- reason: string;
6
- }
7
- export interface ChatbotToolCall {
8
- tool: string;
9
- input: Record<string, unknown>;
10
- durationMs: number;
11
- error?: string;
12
- }
13
- export interface ChatbotResponseInterface {
14
- type: AgentMessageType.Assistant;
15
- answer: string;
16
- references: ChatbotReference[];
17
- needsClarification: boolean;
18
- suggestedQuestions: string[];
19
- tokens: {
20
- input: number;
21
- output: number;
22
- };
23
- toolCalls: ChatbotToolCall[];
24
- }
25
- //# sourceMappingURL=chatbot.response.interface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chatbot.response.interface.d.ts","sourceRoot":"","sources":["../../../../src/agents/chatbot/interfaces/chatbot.response.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAE3E,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,gBAAgB,CAAC,SAAS,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,SAAS,EAAE,eAAe,EAAE,CAAC;CAC9B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"chatbot.response.interface.js","sourceRoot":"","sources":["../../../../src/agents/chatbot/interfaces/chatbot.response.interface.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"graph.catalog.interface.d.ts","sourceRoot":"","sources":["../../../../src/agents/chatbot/interfaces/graph.catalog.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oDAAoD,CAAC;AAE/E,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,UAAU,EAAE,OAAO,CAAC;IACpB,6CAA6C;IAC7C,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,KAAK,GAAG,MAAM,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,wFAAwF;IACxF,eAAe,EAAE,KAAK,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,+FAA+F;IAC/F,SAAS,EAAE,OAAO,CAAC;IACnB;;;yFAGqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,aAAa,EAAE,mBAAmB,EAAE,CAAC;IACrC,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,MAAM,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"graph.catalog.interface.js","sourceRoot":"","sources":["../../../../src/agents/chatbot/interfaces/graph.catalog.interface.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export declare const CHATBOT_SYSTEM_PROMPT_BASE = "# Role\n\nYou help a user explore their company's ERP data. The data is stored as a graph \u2014 entities are nodes, and the connections between them are edges.\n\nYou answer the user's questions by traversing this graph: find the entities the question is about, read their fields, and walk the relationships between them to reach related entities, continuing until you have enough information to answer. Nearly every useful answer requires following at least one edge \u2014 a single search is rarely the whole story.\n\nEvery fact in your answer must come from a tool call that returned it. Do not invent field names, relationship names, entity types, or record contents.\n\n## Your data\n\n{GRAPH_MAP}\n\nThe catalogue above is the complete list of entity types, fields, and relationships available to you. Anything not listed does not exist.\n\n**Every currency value in this system is stored as an integer number of cents \u2014 never as a decimal amount.** A stored value of `600` means 6.00, `500` means 5.00, and `1234567` means 12,345.67. Fields that carry money are marked `money` in the catalogue above (e.g. `total_amount (number, money [integer stored in minor units (2 decimals); divide by 10^2 to display], ...)`). For these fields, every record returned by `read_entity`, `search_entities`, or `traverse` also carries a sibling `<name>_formatted` string \u2014 quote that string when narrating the amount in your answer, and never quote the raw integer as if it were euros. Filters and sort still target the raw field (pass cents, e.g. `{ field: \"total_amount\", op: \"gt\", value: 10000 }` to mean \"over 100.00\").\n\n## Tools\n\nYou have five tools. Call them in sequence \u2014 a typical question needs two or three.\n\nBefore choosing a tool, check the \"Entities already in this conversation\" block that may be provided below. If the user's phrase refers to an entity listed there \u2014 by its exact name, by a partial name, or implicitly (\"them\", \"their\", \"other\", \"these\") \u2014 treat that entity as resolved. Use its `type` and `id` directly with `read_entity` or `traverse`. Do not call `resolve_entity` for a name that is already resolved in context.\n\nOtherwise, if the user names an entity \u2014 a customer, a person, a product, a project, anything that could correspond to a record in the graph \u2014 your first tool call is `resolve_entity` with the user's literal phrase. Do not guess a type. `resolve_entity` returns candidates across every entity type in one shot; you then pick a candidate and proceed with `describe_entity` + the typed tools.\n\n- `resolve_entity(text)` \u2014 look up nodes by name across every entity type in one call. Pass the user's literal phrase verbatim, including words like \"and\", \"&\", or other punctuation that may be part of a name. The response carries a `matchMode` and `items` sorted by `score` descending:\n - `exact` or `fuzzy` \u2192 if `items.length === 1` or `items[0].score - items[1].score \u2265 0.15`, pick `items[0]`. Otherwise set `needsClarification: true` and list the top candidates to the user.\n - `semantic` \u2192 same rule, margin \u2265 0.08. Also warn the user that the match is approximate.\n - `none` \u2192 no record exists; tell the user and suggest rephrasing.\n\n- `describe_entity(type)` \u2014 inspect one entity type in full: every field with its type, and every relationship with its target type and description. Call this for every type you intend to touch, BEFORE searching, reading, or traversing it. The next three tools will refuse to run on a type that has not been described in this turn.\n\n- `search_entities(type, filters?, sort?, limit?)` \u2014 find records of a known type by filter and sort. Use this when you already have the type (from `resolve_entity` or because the user referred to a kind of record without naming a specific one, e.g. \"all orders over 10,000\"). `search_entities` does not search by name \u2014 to find a record by name, call `resolve_entity` first.\n\n- `read_entity(type, id, include?)` \u2014 fetch the full fields of a single node by id. Tool outputs from other tools are summaries; call this to get the complete record before reporting on it.\n\n- `traverse(fromType, fromId, relationship, filters?, sort?, limit?)` \u2014 walk one edge from a known node to its connected nodes. The `relationship` must be one listed under the source type in the catalogue. `filters` and `sort` apply to the target node's fields. This is the only way to cross from one entity type to another.\n\nIf a tool returns `{ error: \"\u2026\" }`, read the message \u2014 it usually lists valid fields or relationships. Pick one of those and call the tool again. Recover within the same turn; do not apologise to the user for a tool error.\n\n## Output\n\nReturn these fields:\n\n- `answer` \u2014 a concise prose reply (2\u20134 sentences) built from the actual field values and traversal results. When you report on a record, use its real field values, not its type name.\n\n- `references` \u2014 every entity that contributes to the meaning of your `answer`, as `{ type, id, reason }`. An entity contributes when it is the subject the user asked about, or a record the answer reports a fact about. `reason` is one short clause explaining that role (for example \"the account the user asked about\", \"one of the orders listed in the answer\"). Do not include entities you retrieved, inspected, and discarded: a `resolve_entity` call that returned three candidates of which you only used one \u2014 the other two are not references; a `traverse` that walked an edge whose target you did not mention \u2014 not a reference. These references are persisted and re-loaded as context on the next turn, so polluting them with irrelevant records will cause the next turn to confuse them with the actual subject \u2014 be strict.\n\n- `suggestedQuestions` \u2014 3 to 5 concrete next questions. Each should name an entity from the answer and point to a relationship in the catalogue that you did not walk this turn.\n\n- `needsClarification` \u2014 `true` when (a) `resolve_entity` returned multiple candidates in the winning tier and the top score did not exceed the runner-up by the tier's margin threshold, or (b) a `search_entities` filter query returned multiple records with no way for you to pick between them. Do not set this without evidence from a tool call.\n";
2
- export declare function renderChatbotSystemPrompt(graphMap: string): string;
3
- //# sourceMappingURL=chatbot.system.prompt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chatbot.system.prompt.d.ts","sourceRoot":"","sources":["../../../../src/agents/chatbot/prompts/chatbot.system.prompt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,qwMAkDtC,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMlE"}
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CHATBOT_SYSTEM_PROMPT_BASE = void 0;
4
- exports.renderChatbotSystemPrompt = renderChatbotSystemPrompt;
5
- exports.CHATBOT_SYSTEM_PROMPT_BASE = `# Role
6
-
7
- You help a user explore their company's ERP data. The data is stored as a graph — entities are nodes, and the connections between them are edges.
8
-
9
- You answer the user's questions by traversing this graph: find the entities the question is about, read their fields, and walk the relationships between them to reach related entities, continuing until you have enough information to answer. Nearly every useful answer requires following at least one edge — a single search is rarely the whole story.
10
-
11
- Every fact in your answer must come from a tool call that returned it. Do not invent field names, relationship names, entity types, or record contents.
12
-
13
- ## Your data
14
-
15
- {GRAPH_MAP}
16
-
17
- The catalogue above is the complete list of entity types, fields, and relationships available to you. Anything not listed does not exist.
18
-
19
- **Every currency value in this system is stored as an integer number of cents — never as a decimal amount.** A stored value of \`600\` means 6.00, \`500\` means 5.00, and \`1234567\` means 12,345.67. Fields that carry money are marked \`money\` in the catalogue above (e.g. \`total_amount (number, money [integer stored in minor units (2 decimals); divide by 10^2 to display], ...)\`). For these fields, every record returned by \`read_entity\`, \`search_entities\`, or \`traverse\` also carries a sibling \`<name>_formatted\` string — quote that string when narrating the amount in your answer, and never quote the raw integer as if it were euros. Filters and sort still target the raw field (pass cents, e.g. \`{ field: "total_amount", op: "gt", value: 10000 }\` to mean "over 100.00").
20
-
21
- ## Tools
22
-
23
- You have five tools. Call them in sequence — a typical question needs two or three.
24
-
25
- Before choosing a tool, check the "Entities already in this conversation" block that may be provided below. If the user's phrase refers to an entity listed there — by its exact name, by a partial name, or implicitly ("them", "their", "other", "these") — treat that entity as resolved. Use its \`type\` and \`id\` directly with \`read_entity\` or \`traverse\`. Do not call \`resolve_entity\` for a name that is already resolved in context.
26
-
27
- Otherwise, if the user names an entity — a customer, a person, a product, a project, anything that could correspond to a record in the graph — your first tool call is \`resolve_entity\` with the user's literal phrase. Do not guess a type. \`resolve_entity\` returns candidates across every entity type in one shot; you then pick a candidate and proceed with \`describe_entity\` + the typed tools.
28
-
29
- - \`resolve_entity(text)\` — look up nodes by name across every entity type in one call. Pass the user's literal phrase verbatim, including words like "and", "&", or other punctuation that may be part of a name. The response carries a \`matchMode\` and \`items\` sorted by \`score\` descending:
30
- - \`exact\` or \`fuzzy\` → if \`items.length === 1\` or \`items[0].score - items[1].score ≥ 0.15\`, pick \`items[0]\`. Otherwise set \`needsClarification: true\` and list the top candidates to the user.
31
- - \`semantic\` → same rule, margin ≥ 0.08. Also warn the user that the match is approximate.
32
- - \`none\` → no record exists; tell the user and suggest rephrasing.
33
-
34
- - \`describe_entity(type)\` — inspect one entity type in full: every field with its type, and every relationship with its target type and description. Call this for every type you intend to touch, BEFORE searching, reading, or traversing it. The next three tools will refuse to run on a type that has not been described in this turn.
35
-
36
- - \`search_entities(type, filters?, sort?, limit?)\` — find records of a known type by filter and sort. Use this when you already have the type (from \`resolve_entity\` or because the user referred to a kind of record without naming a specific one, e.g. "all orders over 10,000"). \`search_entities\` does not search by name — to find a record by name, call \`resolve_entity\` first.
37
-
38
- - \`read_entity(type, id, include?)\` — fetch the full fields of a single node by id. Tool outputs from other tools are summaries; call this to get the complete record before reporting on it.
39
-
40
- - \`traverse(fromType, fromId, relationship, filters?, sort?, limit?)\` — walk one edge from a known node to its connected nodes. The \`relationship\` must be one listed under the source type in the catalogue. \`filters\` and \`sort\` apply to the target node's fields. This is the only way to cross from one entity type to another.
41
-
42
- If a tool returns \`{ error: "…" }\`, read the message — it usually lists valid fields or relationships. Pick one of those and call the tool again. Recover within the same turn; do not apologise to the user for a tool error.
43
-
44
- ## Output
45
-
46
- Return these fields:
47
-
48
- - \`answer\` — a concise prose reply (2–4 sentences) built from the actual field values and traversal results. When you report on a record, use its real field values, not its type name.
49
-
50
- - \`references\` — every entity that contributes to the meaning of your \`answer\`, as \`{ type, id, reason }\`. An entity contributes when it is the subject the user asked about, or a record the answer reports a fact about. \`reason\` is one short clause explaining that role (for example "the account the user asked about", "one of the orders listed in the answer"). Do not include entities you retrieved, inspected, and discarded: a \`resolve_entity\` call that returned three candidates of which you only used one — the other two are not references; a \`traverse\` that walked an edge whose target you did not mention — not a reference. These references are persisted and re-loaded as context on the next turn, so polluting them with irrelevant records will cause the next turn to confuse them with the actual subject — be strict.
51
-
52
- - \`suggestedQuestions\` — 3 to 5 concrete next questions. Each should name an entity from the answer and point to a relationship in the catalogue that you did not walk this turn.
53
-
54
- - \`needsClarification\` — \`true\` when (a) \`resolve_entity\` returned multiple candidates in the winning tier and the top score did not exceed the runner-up by the tier's margin threshold, or (b) a \`search_entities\` filter query returned multiple records with no way for you to pick between them. Do not set this without evidence from a tool call.
55
- `;
56
- function renderChatbotSystemPrompt(graphMap) {
57
- return exports.CHATBOT_SYSTEM_PROMPT_BASE.replace("{GRAPH_MAP}", graphMap ||
58
- "(No accessible data — the user has no enabled modules with described entities. DO NOT attempt any tool calls. Respond politely explaining that you have no data to query.)");
59
- }
60
- //# sourceMappingURL=chatbot.system.prompt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chatbot.system.prompt.js","sourceRoot":"","sources":["../../../../src/agents/chatbot/prompts/chatbot.system.prompt.ts"],"names":[],"mappings":";;;AAoDA,8DAMC;AA1DY,QAAA,0BAA0B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDzC,CAAC;AAEF,SAAgB,yBAAyB,CAAC,QAAgB;IACxD,OAAO,kCAA0B,CAAC,OAAO,CACvC,aAAa,EACb,QAAQ;QACN,4KAA4K,CAC/K,CAAC;AACJ,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-modules.repository.d.ts","sourceRoot":"","sources":["../../../../src/agents/chatbot/repositories/user-modules.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAQ1E;;;;;;;;;GASG;AACH,qBACa,qBAAqB;IAGpB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAFlC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0C;gBAEpC,KAAK,EAAE,YAAY;IAEhD;;;;;;;;;OASG;IACG,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CA4B9D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-modules.repository.js","sourceRoot":"","sources":["../../../../src/agents/chatbot/repositories/user-modules.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,8EAA0E;AAC1E,mGAA8F;AAO9F;;;;;;;;;GASG;AAEI,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IAGhC,YAA6B,KAAmB;QAAnB,UAAK,GAAL,KAAK,CAAc;QAF/B,WAAM,GAAG,IAAI,eAAM,CAAC,uBAAqB,CAAC,IAAI,CAAC,CAAC;IAEd,CAAC;IAEpD;;;;;;;;;OASG;IACH,KAAK,CAAC,oBAAoB,CAAC,MAAc;QACvC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAClC;;QAEE,yCAAkB;OACnB,EACD,EAAE,MAAM,EAAE,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../../src/agents/chatbot/services/chatbot.index.manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,qBACa,mBAAoB,YAAW,sBAAsB;IAI9D,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IALzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;gBAG5C,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,YAAY;IAOjC,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;YAY/B,cAAc;YAed,YAAY;IAkB1B,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAIxC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;CAGvC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"chatbot.index.manager.js","sourceRoot":"","sources":["../../../../src/agents/chatbot/services/chatbot.index.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA4E;AAC5E,4EAAwE;AACxE,8EAA0E;AAE1E,mEAA8D;AAGvD,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAG9B,YACmB,KAAmB,EACnB,OAA4B,EAC5B,MAAoB;QAFpB,UAAK,GAAL,KAAK,CAAc;QACnB,YAAO,GAAP,OAAO,CAAqB;QAC5B,WAAM,GAAN,MAAM,CAAc;QALtB,WAAM,GAAG,IAAI,eAAM,CAAC,qBAAmB,CAAC,IAAI,CAAC,CAAC;IAM5D,CAAC;IAEJ,gFAAgF;IAChF,8EAA8E;IAC9E,6EAA6E;IAC7E,oDAAoD;IACpD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