@indexnetwork/protocol 0.1.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 (365) hide show
  1. package/dist/agents/chat.agent.d.ts +218 -0
  2. package/dist/agents/chat.agent.d.ts.map +1 -0
  3. package/dist/agents/chat.agent.js +884 -0
  4. package/dist/agents/chat.agent.js.map +1 -0
  5. package/dist/agents/chat.prompt.d.ts +18 -0
  6. package/dist/agents/chat.prompt.d.ts.map +1 -0
  7. package/dist/agents/chat.prompt.js +372 -0
  8. package/dist/agents/chat.prompt.js.map +1 -0
  9. package/dist/agents/chat.prompt.modules.d.ts +61 -0
  10. package/dist/agents/chat.prompt.modules.d.ts.map +1 -0
  11. package/dist/agents/chat.prompt.modules.js +366 -0
  12. package/dist/agents/chat.prompt.modules.js.map +1 -0
  13. package/dist/agents/chat.title.generator.d.ts +20 -0
  14. package/dist/agents/chat.title.generator.d.ts.map +1 -0
  15. package/dist/agents/chat.title.generator.js +66 -0
  16. package/dist/agents/chat.title.generator.js.map +1 -0
  17. package/dist/agents/home.categorizer.d.ts +28 -0
  18. package/dist/agents/home.categorizer.d.ts.map +1 -0
  19. package/dist/agents/home.categorizer.js +170 -0
  20. package/dist/agents/home.categorizer.js.map +1 -0
  21. package/dist/agents/hyde.generator.d.ts +27 -0
  22. package/dist/agents/hyde.generator.d.ts.map +1 -0
  23. package/dist/agents/hyde.generator.js +75 -0
  24. package/dist/agents/hyde.generator.js.map +1 -0
  25. package/dist/agents/hyde.strategies.d.ts +17 -0
  26. package/dist/agents/hyde.strategies.d.ts.map +1 -0
  27. package/dist/agents/hyde.strategies.js +29 -0
  28. package/dist/agents/hyde.strategies.js.map +1 -0
  29. package/dist/agents/intent.clarifier.d.ts +29 -0
  30. package/dist/agents/intent.clarifier.d.ts.map +1 -0
  31. package/dist/agents/intent.clarifier.js +186 -0
  32. package/dist/agents/intent.clarifier.js.map +1 -0
  33. package/dist/agents/intent.indexer.d.ts +77 -0
  34. package/dist/agents/intent.indexer.d.ts.map +1 -0
  35. package/dist/agents/intent.indexer.js +164 -0
  36. package/dist/agents/intent.indexer.js.map +1 -0
  37. package/dist/agents/intent.inferrer.d.ts +95 -0
  38. package/dist/agents/intent.inferrer.d.ts.map +1 -0
  39. package/dist/agents/intent.inferrer.js +238 -0
  40. package/dist/agents/intent.inferrer.js.map +1 -0
  41. package/dist/agents/intent.reconciler.d.ts +106 -0
  42. package/dist/agents/intent.reconciler.d.ts.map +1 -0
  43. package/dist/agents/intent.reconciler.js +184 -0
  44. package/dist/agents/intent.reconciler.js.map +1 -0
  45. package/dist/agents/intent.verifier.d.ts +97 -0
  46. package/dist/agents/intent.verifier.d.ts.map +1 -0
  47. package/dist/agents/intent.verifier.js +234 -0
  48. package/dist/agents/intent.verifier.js.map +1 -0
  49. package/dist/agents/invite.generator.d.ts +47 -0
  50. package/dist/agents/invite.generator.d.ts.map +1 -0
  51. package/dist/agents/invite.generator.js +56 -0
  52. package/dist/agents/invite.generator.js.map +1 -0
  53. package/dist/agents/lens.inferrer.d.ts +37 -0
  54. package/dist/agents/lens.inferrer.d.ts.map +1 -0
  55. package/dist/agents/lens.inferrer.js +98 -0
  56. package/dist/agents/lens.inferrer.js.map +1 -0
  57. package/dist/agents/model.config.d.ts +120 -0
  58. package/dist/agents/model.config.d.ts.map +1 -0
  59. package/dist/agents/model.config.js +76 -0
  60. package/dist/agents/model.config.js.map +1 -0
  61. package/dist/agents/negotiation.insights.generator.d.ts +32 -0
  62. package/dist/agents/negotiation.insights.generator.d.ts.map +1 -0
  63. package/dist/agents/negotiation.insights.generator.js +105 -0
  64. package/dist/agents/negotiation.insights.generator.js.map +1 -0
  65. package/dist/agents/negotiation.proposer.d.ts +26 -0
  66. package/dist/agents/negotiation.proposer.d.ts.map +1 -0
  67. package/dist/agents/negotiation.proposer.js +67 -0
  68. package/dist/agents/negotiation.proposer.js.map +1 -0
  69. package/dist/agents/negotiation.responder.d.ts +26 -0
  70. package/dist/agents/negotiation.responder.d.ts.map +1 -0
  71. package/dist/agents/negotiation.responder.js +71 -0
  72. package/dist/agents/negotiation.responder.js.map +1 -0
  73. package/dist/agents/opportunity.evaluator.d.ts +253 -0
  74. package/dist/agents/opportunity.evaluator.d.ts.map +1 -0
  75. package/dist/agents/opportunity.evaluator.js +413 -0
  76. package/dist/agents/opportunity.evaluator.js.map +1 -0
  77. package/dist/agents/opportunity.presenter.d.ts +115 -0
  78. package/dist/agents/opportunity.presenter.d.ts.map +1 -0
  79. package/dist/agents/opportunity.presenter.js +524 -0
  80. package/dist/agents/opportunity.presenter.js.map +1 -0
  81. package/dist/agents/profile.generator.d.ts +67 -0
  82. package/dist/agents/profile.generator.d.ts.map +1 -0
  83. package/dist/agents/profile.generator.js +97 -0
  84. package/dist/agents/profile.generator.js.map +1 -0
  85. package/dist/agents/profile.hyde.generator.d.ts +43 -0
  86. package/dist/agents/profile.hyde.generator.d.ts.map +1 -0
  87. package/dist/agents/profile.hyde.generator.js +113 -0
  88. package/dist/agents/profile.hyde.generator.js.map +1 -0
  89. package/dist/agents/suggestion.generator.d.ts +24 -0
  90. package/dist/agents/suggestion.generator.d.ts.map +1 -0
  91. package/dist/agents/suggestion.generator.js +96 -0
  92. package/dist/agents/suggestion.generator.js.map +1 -0
  93. package/dist/graphs/chat.graph.d.ts +312 -0
  94. package/dist/graphs/chat.graph.d.ts.map +1 -0
  95. package/dist/graphs/chat.graph.js +267 -0
  96. package/dist/graphs/chat.graph.js.map +1 -0
  97. package/dist/graphs/home.graph.d.ts +180 -0
  98. package/dist/graphs/home.graph.d.ts.map +1 -0
  99. package/dist/graphs/home.graph.js +598 -0
  100. package/dist/graphs/home.graph.js.map +1 -0
  101. package/dist/graphs/hyde.graph.d.ts +110 -0
  102. package/dist/graphs/hyde.graph.d.ts.map +1 -0
  103. package/dist/graphs/hyde.graph.js +235 -0
  104. package/dist/graphs/hyde.graph.js.map +1 -0
  105. package/dist/graphs/index.graph.d.ts +620 -0
  106. package/dist/graphs/index.graph.d.ts.map +1 -0
  107. package/dist/graphs/index.graph.js +226 -0
  108. package/dist/graphs/index.graph.js.map +1 -0
  109. package/dist/graphs/index_membership.graph.d.ts +250 -0
  110. package/dist/graphs/index_membership.graph.d.ts.map +1 -0
  111. package/dist/graphs/index_membership.graph.js +204 -0
  112. package/dist/graphs/index_membership.graph.js.map +1 -0
  113. package/dist/graphs/intent.graph.d.ts +490 -0
  114. package/dist/graphs/intent.graph.d.ts.map +1 -0
  115. package/dist/graphs/intent.graph.js +787 -0
  116. package/dist/graphs/intent.graph.js.map +1 -0
  117. package/dist/graphs/intent_index.graph.d.ts +396 -0
  118. package/dist/graphs/intent_index.graph.d.ts.map +1 -0
  119. package/dist/graphs/intent_index.graph.js +331 -0
  120. package/dist/graphs/intent_index.graph.js.map +1 -0
  121. package/dist/graphs/maintenance.graph.d.ts +177 -0
  122. package/dist/graphs/maintenance.graph.d.ts.map +1 -0
  123. package/dist/graphs/maintenance.graph.js +173 -0
  124. package/dist/graphs/maintenance.graph.js.map +1 -0
  125. package/dist/graphs/negotiation.graph.d.ts +819 -0
  126. package/dist/graphs/negotiation.graph.d.ts.map +1 -0
  127. package/dist/graphs/negotiation.graph.js +255 -0
  128. package/dist/graphs/negotiation.graph.js.map +1 -0
  129. package/dist/graphs/opportunity.graph.d.ts +1082 -0
  130. package/dist/graphs/opportunity.graph.d.ts.map +1 -0
  131. package/dist/graphs/opportunity.graph.js +2534 -0
  132. package/dist/graphs/opportunity.graph.js.map +1 -0
  133. package/dist/graphs/profile.graph.d.ts +617 -0
  134. package/dist/graphs/profile.graph.d.ts.map +1 -0
  135. package/dist/graphs/profile.graph.js +839 -0
  136. package/dist/graphs/profile.graph.js.map +1 -0
  137. package/dist/graphs/tests/chat.graph.mocks.d.ts +104 -0
  138. package/dist/graphs/tests/chat.graph.mocks.d.ts.map +1 -0
  139. package/dist/graphs/tests/chat.graph.mocks.js +225 -0
  140. package/dist/graphs/tests/chat.graph.mocks.js.map +1 -0
  141. package/dist/index.d.ts +62 -0
  142. package/dist/index.d.ts.map +1 -0
  143. package/dist/index.js +44 -0
  144. package/dist/index.js.map +1 -0
  145. package/dist/interfaces/auth.interface.d.ts +15 -0
  146. package/dist/interfaces/auth.interface.d.ts.map +1 -0
  147. package/dist/interfaces/auth.interface.js +2 -0
  148. package/dist/interfaces/auth.interface.js.map +1 -0
  149. package/dist/interfaces/cache.interface.d.ts +43 -0
  150. package/dist/interfaces/cache.interface.d.ts.map +1 -0
  151. package/dist/interfaces/cache.interface.js +6 -0
  152. package/dist/interfaces/cache.interface.js.map +1 -0
  153. package/dist/interfaces/chat-session.interface.d.ts +11 -0
  154. package/dist/interfaces/chat-session.interface.d.ts.map +1 -0
  155. package/dist/interfaces/chat-session.interface.js +2 -0
  156. package/dist/interfaces/chat-session.interface.js.map +1 -0
  157. package/dist/interfaces/contact.interface.d.ts +48 -0
  158. package/dist/interfaces/contact.interface.d.ts.map +1 -0
  159. package/dist/interfaces/contact.interface.js +2 -0
  160. package/dist/interfaces/contact.interface.js.map +1 -0
  161. package/dist/interfaces/database.interface.d.ts +1495 -0
  162. package/dist/interfaces/database.interface.d.ts.map +1 -0
  163. package/dist/interfaces/database.interface.js +2 -0
  164. package/dist/interfaces/database.interface.js.map +1 -0
  165. package/dist/interfaces/embedder.interface.d.ts +85 -0
  166. package/dist/interfaces/embedder.interface.d.ts.map +1 -0
  167. package/dist/interfaces/embedder.interface.js +5 -0
  168. package/dist/interfaces/embedder.interface.js.map +1 -0
  169. package/dist/interfaces/enrichment.interface.d.ts +40 -0
  170. package/dist/interfaces/enrichment.interface.d.ts.map +1 -0
  171. package/dist/interfaces/enrichment.interface.js +2 -0
  172. package/dist/interfaces/enrichment.interface.js.map +1 -0
  173. package/dist/interfaces/integration.interface.d.ts +91 -0
  174. package/dist/interfaces/integration.interface.d.ts.map +1 -0
  175. package/dist/interfaces/integration.interface.js +2 -0
  176. package/dist/interfaces/integration.interface.js.map +1 -0
  177. package/dist/interfaces/queue.interface.d.ts +17 -0
  178. package/dist/interfaces/queue.interface.d.ts.map +1 -0
  179. package/dist/interfaces/queue.interface.js +5 -0
  180. package/dist/interfaces/queue.interface.js.map +1 -0
  181. package/dist/interfaces/scraper.interface.d.ts +31 -0
  182. package/dist/interfaces/scraper.interface.d.ts.map +1 -0
  183. package/dist/interfaces/scraper.interface.js +2 -0
  184. package/dist/interfaces/scraper.interface.js.map +1 -0
  185. package/dist/interfaces/storage.interface.d.ts +46 -0
  186. package/dist/interfaces/storage.interface.d.ts.map +1 -0
  187. package/dist/interfaces/storage.interface.js +6 -0
  188. package/dist/interfaces/storage.interface.js.map +1 -0
  189. package/dist/mcp/mcp.server.d.ts +29 -0
  190. package/dist/mcp/mcp.server.d.ts.map +1 -0
  191. package/dist/mcp/mcp.server.js +171 -0
  192. package/dist/mcp/mcp.server.js.map +1 -0
  193. package/dist/states/chat.state.d.ts +126 -0
  194. package/dist/states/chat.state.d.ts.map +1 -0
  195. package/dist/states/chat.state.js +112 -0
  196. package/dist/states/chat.state.js.map +1 -0
  197. package/dist/states/home.state.d.ts +100 -0
  198. package/dist/states/home.state.d.ts.map +1 -0
  199. package/dist/states/home.state.js +74 -0
  200. package/dist/states/home.state.js.map +1 -0
  201. package/dist/states/hyde.state.d.ts +54 -0
  202. package/dist/states/hyde.state.d.ts.map +1 -0
  203. package/dist/states/hyde.state.js +66 -0
  204. package/dist/states/hyde.state.js.map +1 -0
  205. package/dist/states/index.state.d.ts +179 -0
  206. package/dist/states/index.state.d.ts.map +1 -0
  207. package/dist/states/index.state.js +56 -0
  208. package/dist/states/index.state.js.map +1 -0
  209. package/dist/states/index_membership.state.d.ts +77 -0
  210. package/dist/states/index_membership.state.d.ts.map +1 -0
  211. package/dist/states/index_membership.state.js +43 -0
  212. package/dist/states/index_membership.state.js.map +1 -0
  213. package/dist/states/intent.state.d.ts +203 -0
  214. package/dist/states/intent.state.d.ts.map +1 -0
  215. package/dist/states/intent.state.js +153 -0
  216. package/dist/states/intent.state.js.map +1 -0
  217. package/dist/states/intent_index.state.d.ts +148 -0
  218. package/dist/states/intent_index.state.d.ts.map +1 -0
  219. package/dist/states/intent_index.state.js +100 -0
  220. package/dist/states/intent_index.state.js.map +1 -0
  221. package/dist/states/maintenance.state.d.ts +36 -0
  222. package/dist/states/maintenance.state.d.ts.map +1 -0
  223. package/dist/states/maintenance.state.js +56 -0
  224. package/dist/states/maintenance.state.js.map +1 -0
  225. package/dist/states/negotiation.state.d.ts +230 -0
  226. package/dist/states/negotiation.state.d.ts.map +1 -0
  227. package/dist/states/negotiation.state.js +82 -0
  228. package/dist/states/negotiation.state.js.map +1 -0
  229. package/dist/states/opportunity.state.d.ts +300 -0
  230. package/dist/states/opportunity.state.d.ts.map +1 -0
  231. package/dist/states/opportunity.state.js +207 -0
  232. package/dist/states/opportunity.state.js.map +1 -0
  233. package/dist/states/profile.state.d.ts +172 -0
  234. package/dist/states/profile.state.d.ts.map +1 -0
  235. package/dist/states/profile.state.js +133 -0
  236. package/dist/states/profile.state.js.map +1 -0
  237. package/dist/streamers/chat.streamer.d.ts +55 -0
  238. package/dist/streamers/chat.streamer.d.ts.map +1 -0
  239. package/dist/streamers/chat.streamer.js +186 -0
  240. package/dist/streamers/chat.streamer.js.map +1 -0
  241. package/dist/streamers/index.d.ts +3 -0
  242. package/dist/streamers/index.d.ts.map +1 -0
  243. package/dist/streamers/index.js +3 -0
  244. package/dist/streamers/index.js.map +1 -0
  245. package/dist/streamers/response.streamer.d.ts +36 -0
  246. package/dist/streamers/response.streamer.d.ts.map +1 -0
  247. package/dist/streamers/response.streamer.js +46 -0
  248. package/dist/streamers/response.streamer.js.map +1 -0
  249. package/dist/support/chat.utils.d.ts +42 -0
  250. package/dist/support/chat.utils.d.ts.map +1 -0
  251. package/dist/support/chat.utils.js +89 -0
  252. package/dist/support/chat.utils.js.map +1 -0
  253. package/dist/support/debug-meta.sanitizer.d.ts +18 -0
  254. package/dist/support/debug-meta.sanitizer.d.ts.map +1 -0
  255. package/dist/support/debug-meta.sanitizer.js +82 -0
  256. package/dist/support/debug-meta.sanitizer.js.map +1 -0
  257. package/dist/support/feed.health.d.ts +32 -0
  258. package/dist/support/feed.health.d.ts.map +1 -0
  259. package/dist/support/feed.health.js +76 -0
  260. package/dist/support/feed.health.js.map +1 -0
  261. package/dist/support/introducer.discovery.d.ts +78 -0
  262. package/dist/support/introducer.discovery.d.ts.map +1 -0
  263. package/dist/support/introducer.discovery.js +101 -0
  264. package/dist/support/introducer.discovery.js.map +1 -0
  265. package/dist/support/log.d.ts +65 -0
  266. package/dist/support/log.d.ts.map +1 -0
  267. package/dist/support/log.js +76 -0
  268. package/dist/support/log.js.map +1 -0
  269. package/dist/support/lucide.icon-catalog.d.ts +22 -0
  270. package/dist/support/lucide.icon-catalog.d.ts.map +1 -0
  271. package/dist/support/lucide.icon-catalog.js +101 -0
  272. package/dist/support/lucide.icon-catalog.js.map +1 -0
  273. package/dist/support/opportunity.card-text.d.ts +39 -0
  274. package/dist/support/opportunity.card-text.d.ts.map +1 -0
  275. package/dist/support/opportunity.card-text.js +333 -0
  276. package/dist/support/opportunity.card-text.js.map +1 -0
  277. package/dist/support/opportunity.constants.d.ts +9 -0
  278. package/dist/support/opportunity.constants.d.ts.map +1 -0
  279. package/dist/support/opportunity.constants.js +11 -0
  280. package/dist/support/opportunity.constants.js.map +1 -0
  281. package/dist/support/opportunity.discover.d.ts +144 -0
  282. package/dist/support/opportunity.discover.d.ts.map +1 -0
  283. package/dist/support/opportunity.discover.js +610 -0
  284. package/dist/support/opportunity.discover.js.map +1 -0
  285. package/dist/support/opportunity.enricher.d.ts +44 -0
  286. package/dist/support/opportunity.enricher.d.ts.map +1 -0
  287. package/dist/support/opportunity.enricher.js +245 -0
  288. package/dist/support/opportunity.enricher.js.map +1 -0
  289. package/dist/support/opportunity.persist.d.ts +39 -0
  290. package/dist/support/opportunity.persist.d.ts.map +1 -0
  291. package/dist/support/opportunity.persist.js +63 -0
  292. package/dist/support/opportunity.persist.js.map +1 -0
  293. package/dist/support/opportunity.presentation.d.ts +21 -0
  294. package/dist/support/opportunity.presentation.d.ts.map +1 -0
  295. package/dist/support/opportunity.presentation.js +75 -0
  296. package/dist/support/opportunity.presentation.js.map +1 -0
  297. package/dist/support/opportunity.sanitize.d.ts +18 -0
  298. package/dist/support/opportunity.sanitize.d.ts.map +1 -0
  299. package/dist/support/opportunity.sanitize.js +89 -0
  300. package/dist/support/opportunity.sanitize.js.map +1 -0
  301. package/dist/support/opportunity.utils.d.ts +99 -0
  302. package/dist/support/opportunity.utils.d.ts.map +1 -0
  303. package/dist/support/opportunity.utils.js +184 -0
  304. package/dist/support/opportunity.utils.js.map +1 -0
  305. package/dist/support/performance.d.ts +19 -0
  306. package/dist/support/performance.d.ts.map +1 -0
  307. package/dist/support/performance.js +43 -0
  308. package/dist/support/performance.js.map +1 -0
  309. package/dist/support/profile.enrichment-display-name.d.ts +16 -0
  310. package/dist/support/profile.enrichment-display-name.d.ts.map +1 -0
  311. package/dist/support/profile.enrichment-display-name.js +22 -0
  312. package/dist/support/profile.enrichment-display-name.js.map +1 -0
  313. package/dist/support/protocol.logger.d.ts +22 -0
  314. package/dist/support/protocol.logger.d.ts.map +1 -0
  315. package/dist/support/protocol.logger.js +44 -0
  316. package/dist/support/protocol.logger.js.map +1 -0
  317. package/dist/support/request-context.d.ts +19 -0
  318. package/dist/support/request-context.d.ts.map +1 -0
  319. package/dist/support/request-context.js +7 -0
  320. package/dist/support/request-context.js.map +1 -0
  321. package/dist/tools/contact.tools.d.ts +7 -0
  322. package/dist/tools/contact.tools.d.ts.map +1 -0
  323. package/dist/tools/contact.tools.js +115 -0
  324. package/dist/tools/contact.tools.js.map +1 -0
  325. package/dist/tools/index.d.ts +17 -0
  326. package/dist/tools/index.d.ts.map +1 -0
  327. package/dist/tools/index.js +140 -0
  328. package/dist/tools/index.js.map +1 -0
  329. package/dist/tools/index.tools.d.ts +3 -0
  330. package/dist/tools/index.tools.d.ts.map +1 -0
  331. package/dist/tools/index.tools.js +423 -0
  332. package/dist/tools/index.tools.js.map +1 -0
  333. package/dist/tools/integration.tools.d.ts +13 -0
  334. package/dist/tools/integration.tools.d.ts.map +1 -0
  335. package/dist/tools/integration.tools.js +77 -0
  336. package/dist/tools/integration.tools.js.map +1 -0
  337. package/dist/tools/intent.tools.d.ts +3 -0
  338. package/dist/tools/intent.tools.d.ts.map +1 -0
  339. package/dist/tools/intent.tools.js +458 -0
  340. package/dist/tools/intent.tools.js.map +1 -0
  341. package/dist/tools/opportunity.tools.d.ts +44 -0
  342. package/dist/tools/opportunity.tools.d.ts.map +1 -0
  343. package/dist/tools/opportunity.tools.js +814 -0
  344. package/dist/tools/opportunity.tools.js.map +1 -0
  345. package/dist/tools/profile.tools.d.ts +3 -0
  346. package/dist/tools/profile.tools.d.ts.map +1 -0
  347. package/dist/tools/profile.tools.js +513 -0
  348. package/dist/tools/profile.tools.js.map +1 -0
  349. package/dist/tools/tool.helpers.d.ts +225 -0
  350. package/dist/tools/tool.helpers.d.ts.map +1 -0
  351. package/dist/tools/tool.helpers.js +172 -0
  352. package/dist/tools/tool.helpers.js.map +1 -0
  353. package/dist/tools/tool.registry.d.ts +12 -0
  354. package/dist/tools/tool.registry.d.ts.map +1 -0
  355. package/dist/tools/tool.registry.js +62 -0
  356. package/dist/tools/tool.registry.js.map +1 -0
  357. package/dist/tools/utility.tools.d.ts +3 -0
  358. package/dist/tools/utility.tools.d.ts.map +1 -0
  359. package/dist/tools/utility.tools.js +107 -0
  360. package/dist/tools/utility.tools.js.map +1 -0
  361. package/dist/types/chat-streaming.types.d.ts +472 -0
  362. package/dist/types/chat-streaming.types.d.ts.map +1 -0
  363. package/dist/types/chat-streaming.types.js +260 -0
  364. package/dist/types/chat-streaming.types.js.map +1 -0
  365. package/package.json +32 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent.indexer.d.ts","sourceRoot":"","sources":["../../src/agents/intent.indexer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;EAIpC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAyD5E,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAAiD;;IAQ9D;;;OAGG;IACH,OAAO,CAAC,QAAQ;IAQhB;;;;;;;;OAQG;IAEU,MAAM,CACjB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,EAC3B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GACzB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAsCtC;;;OAGG;IAEU,QAAQ,CACnB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,EAC3B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GACzB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAItC;;;OAGG;WACW,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BrB"}
@@ -0,0 +1,164 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { HumanMessage, SystemMessage } from "@langchain/core/messages";
11
+ import { tool } from "@langchain/core/tools";
12
+ import { z } from "zod";
13
+ import { log } from "../support/log.js";
14
+ import { Timed } from "../support/performance.js";
15
+ import { createModel } from "./model.config.js";
16
+ // ──────────────────────────────────────────────────────────────
17
+ // Response schema
18
+ // ──────────────────────────────────────────────────────────────
19
+ export const IntentIndexerOutputSchema = z.object({
20
+ indexScore: z.number().min(0).max(1).describe("Score for index appropriateness (0.0-1.0)"),
21
+ memberScore: z.number().min(0).max(1).describe("Score for member preference match (0.0-1.0)"),
22
+ reasoning: z.string().describe("Brief reasoning for the scores"),
23
+ });
24
+ const logger = log.lib.from("IntentIndexer");
25
+ /**
26
+ * Config
27
+ */
28
+ import { config } from "dotenv";
29
+ config({ path: ".env.development", override: true });
30
+ const model = createModel("intentIndexer");
31
+ // ──────────────────────────────────────────────────────────────
32
+ // 1. SYSTEM PROMPT
33
+ // ──────────────────────────────────────────────────────────────
34
+ const systemPrompt = `
35
+ You are an expert Intent Evaluator for a social networking protocol.
36
+
37
+ TASK:
38
+ Determine if a User Intent is appropriate for a specific Index (community) and matches a Member's sharing preferences.
39
+
40
+ INPUTS:
41
+ 1. Intent: The content/action the user wants to perform.
42
+ 2. Index Prompt: The purpose/scope of the target community (Index).
43
+ 3. Member Prompt: The specific sharing preferences of the user in that community (optional).
44
+ 4. Source: Origin of the intent (file, link, etc.) (optional).
45
+
46
+ SCORING RUBRIC:
47
+ - 0.9-1.0: Highly appropriate, perfect match.
48
+ - 0.7-0.8: Good match, relevant.
49
+ - 0.5-0.6: Moderate, borderline.
50
+ - 0.3-0.4: Low appropriateness, poor fit.
51
+ - 0.0-0.2: Not appropriate.
52
+
53
+ OUTPUT RULES:
54
+ - Provide \`indexScore\` based on how well the Intent fits the Index Prompt.
55
+ - Provide \`memberScore\` based on how well the Intent fits the Member Prompt (if provided). If Member Prompt is missing/empty, return 0.0 for memberScore.
56
+ - Provide concise \`reasoning\`.
57
+ `;
58
+ // ──────────────────────────────────────────────────────────────
59
+ // 2. RESPONSE SCHEMA (Zod)
60
+ // ──────────────────────────────────────────────────────────────
61
+ const responseFormat = IntentIndexerOutputSchema;
62
+ // ──────────────────────────────────────────────────────────────
63
+ // 4. CLASS DEFINITION
64
+ // ──────────────────────────────────────────────────────────────
65
+ export class IntentIndexer {
66
+ constructor() {
67
+ this.model = model.withStructuredOutput(responseFormat, {
68
+ name: "intent_indexer",
69
+ });
70
+ }
71
+ /**
72
+ * Converts the structured response into a string for logging or embedding.
73
+ * Used when the output needs to be serialized (e.g. for traces).
74
+ */
75
+ toString(output) {
76
+ return [
77
+ `indexScore: ${output.indexScore}`,
78
+ `memberScore: ${output.memberScore}`,
79
+ `reasoning: ${output.reasoning}`,
80
+ ].join("\n");
81
+ }
82
+ /**
83
+ * Main entry point. Evaluates the appropriateness of an intent for a given index and member context.
84
+ *
85
+ * @param intent - The intent payload.
86
+ * @param indexPrompt - The purpose of the index (community).
87
+ * @param memberPrompt - The member's sharing preferences (optional).
88
+ * @param sourceName - Optional source name for context (e.g. file, link).
89
+ * @returns Structured output with indexScore, memberScore, and reasoning, or null on error.
90
+ */
91
+ async invoke(intent, indexPrompt, memberPrompt, sourceName) {
92
+ logger.verbose("[IntentIndexer.invoke] Evaluating intent");
93
+ const contextParts = [];
94
+ if (sourceName)
95
+ contextParts.push(`Source: ${sourceName}`);
96
+ contextParts.push(indexPrompt ? `Index Purpose: ${indexPrompt}` : "Index Purpose: (Not provided)");
97
+ contextParts.push(memberPrompt ? `Member Preferences: ${memberPrompt}` : "Member Preferences: (Not provided)");
98
+ const prompt = `
99
+ # Context
100
+ ${contextParts.join("\n")}
101
+
102
+ # Intent
103
+ ${intent}
104
+
105
+ Evaluate the appropriateness of this intent.
106
+ `;
107
+ const messages = [
108
+ new SystemMessage(systemPrompt),
109
+ new HumanMessage(prompt),
110
+ ];
111
+ try {
112
+ const result = await this.model.invoke(messages);
113
+ const output = responseFormat.parse(result);
114
+ logger.verbose("[IntentIndexer.invoke] Evaluation complete", {
115
+ indexScore: output.indexScore,
116
+ memberScore: output.memberScore,
117
+ });
118
+ return output;
119
+ }
120
+ catch (error) {
121
+ logger.error("[IntentIndexer] Error during execution", { error });
122
+ return null;
123
+ }
124
+ }
125
+ /**
126
+ * Alias for invoke. Evaluates the appropriateness of an intent for a given index and member context.
127
+ * Kept for compatibility with callers (e.g. Index Graph) that use evaluate().
128
+ */
129
+ async evaluate(intent, indexPrompt, memberPrompt, sourceName) {
130
+ return this.invoke(intent, indexPrompt, memberPrompt, sourceName);
131
+ }
132
+ /**
133
+ * Factory method to expose the agent as a LangChain tool.
134
+ * Useful for composing agents into larger graphs.
135
+ */
136
+ static asTool() {
137
+ return tool(async (args) => {
138
+ const agent = new IntentIndexer();
139
+ return await agent.invoke(args.intent, args.indexPrompt, args.memberPrompt, args.sourceName);
140
+ }, {
141
+ name: "intent_indexer",
142
+ description: "Evaluates whether an intent is appropriate for a specific index (community) and matches member sharing preferences.",
143
+ schema: z.object({
144
+ intent: z.string().describe("The intent payload to evaluate"),
145
+ indexPrompt: z.string().nullable().describe("The purpose of the index (community)"),
146
+ memberPrompt: z.string().nullable().describe("The member's sharing preferences"),
147
+ sourceName: z.string().nullable().optional().describe("Optional source name for context"),
148
+ }),
149
+ });
150
+ }
151
+ }
152
+ __decorate([
153
+ Timed(),
154
+ __metadata("design:type", Function),
155
+ __metadata("design:paramtypes", [String, Object, Object, Object]),
156
+ __metadata("design:returntype", Promise)
157
+ ], IntentIndexer.prototype, "invoke", null);
158
+ __decorate([
159
+ Timed(),
160
+ __metadata("design:type", Function),
161
+ __metadata("design:paramtypes", [String, Object, Object, Object]),
162
+ __metadata("design:returntype", Promise)
163
+ ], IntentIndexer.prototype, "evaluate", null);
164
+ //# sourceMappingURL=intent.indexer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent.indexer.js","sourceRoot":"","sources":["../../src/agents/intent.indexer.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0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,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;aAC1F,CAAC;SACH,CACF,CAAC;IACJ,CAAC;CACF;AA1Fc;IADZ,KAAK,EAAE;;;;2CA0CP;AAOY;IADZ,KAAK,EAAE;;;;6CAQP"}
@@ -0,0 +1,95 @@
1
+ import { BaseMessage } from "@langchain/core/messages";
2
+ import { z } from "zod";
3
+ /**
4
+ * Options to control inferrer behavior.
5
+ * Used to implement safety controls for read/write separation.
6
+ */
7
+ export interface InferrerOptions {
8
+ /**
9
+ * Whether to fallback to profile inference when content is empty.
10
+ * Should be TRUE for create operations without explicit content.
11
+ * Should be FALSE for query operations.
12
+ * Default: true (for backward compatibility).
13
+ */
14
+ allowProfileFallback?: boolean;
15
+ /**
16
+ * The operation mode for context.
17
+ * Helps inferrer understand the user's intent.
18
+ */
19
+ operationMode?: 'create' | 'update' | 'delete';
20
+ /**
21
+ * Conversation history for anaphoric resolution.
22
+ * Used to resolve references like "that intent", "this goal", etc.
23
+ * Optional - if not provided, inference uses only current content.
24
+ */
25
+ conversationContext?: BaseMessage[];
26
+ }
27
+ declare const InferredIntentSchema: z.ZodObject<{
28
+ type: z.ZodEnum<["goal", "tombstone"]>;
29
+ description: z.ZodString;
30
+ reasoning: z.ZodString;
31
+ confidence: z.ZodEnum<["high", "medium", "low"]>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ reasoning: string;
34
+ confidence: "low" | "medium" | "high";
35
+ type: "goal" | "tombstone";
36
+ description: string;
37
+ }, {
38
+ reasoning: string;
39
+ confidence: "low" | "medium" | "high";
40
+ type: "goal" | "tombstone";
41
+ description: string;
42
+ }>;
43
+ export type InferredIntent = z.infer<typeof InferredIntentSchema>;
44
+ export declare class ExplicitIntentInferrer {
45
+ private model;
46
+ constructor();
47
+ /**
48
+ * Main entry point. Invokes the agent with input and returns structured output.
49
+ * @param content - The raw string content to analyze.
50
+ * @param profileContext - The formatted profile context string.
51
+ * @param options - Options controlling inference behavior (fallback, operation mode, conversation context).
52
+ */
53
+ invoke(content: string | null, profileContext: string, options?: InferrerOptions): Promise<{
54
+ intents: {
55
+ reasoning: string;
56
+ confidence: "low" | "medium" | "high";
57
+ type: "goal" | "tombstone";
58
+ description: string;
59
+ }[];
60
+ }>;
61
+ /**
62
+ * Formats conversation history for inclusion in the prompt.
63
+ * Converts BaseMessage[] to readable string format.
64
+ */
65
+ private formatConversationHistory;
66
+ /**
67
+ * Factory method to expose the agent as a LangChain tool.
68
+ * Useful for composing agents into larger graphs.
69
+ */
70
+ static asTool(): import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
71
+ content: z.ZodNullable<z.ZodString>;
72
+ profileContext: z.ZodString;
73
+ }, "strip", z.ZodTypeAny, {
74
+ content: string | null;
75
+ profileContext: string;
76
+ }, {
77
+ content: string | null;
78
+ profileContext: string;
79
+ }>, {
80
+ content: string | null;
81
+ profileContext: string;
82
+ }, {
83
+ content: string | null;
84
+ profileContext: string;
85
+ }, {
86
+ intents: {
87
+ reasoning: string;
88
+ confidence: "low" | "medium" | "high";
89
+ type: "goal" | "tombstone";
90
+ description: string;
91
+ }[];
92
+ }, unknown, "explicit_intent_inferrer">;
93
+ }
94
+ export {};
95
+ //# sourceMappingURL=intent.inferrer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent.inferrer.d.ts","sourceRoot":"","sources":["../../src/agents/intent.inferrer.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEpF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoBxB;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;OAGG;IACH,aAAa,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAE/C;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,WAAW,EAAE,CAAC;CACrC;AA2ED,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;EAKxB,CAAC;AAWH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAMlE,qBAAa,sBAAsB;IACjC,OAAO,CAAC,KAAK,CAAM;;IAQnB;;;;;OAKG;IAEU,MAAM,CACjB,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,cAAc,EAAE,MAAM,EACtB,OAAO,GAAE,eAAoB;;;;;;;;IAuF/B;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAuBjC;;;OAGG;WACW,MAAM;;;;;;;;;;;;;;;;;;;;;;;CAgBrB"}
@@ -0,0 +1,238 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ 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;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { HumanMessage, SystemMessage } from "@langchain/core/messages";
11
+ import { tool } from "@langchain/core/tools";
12
+ import { z } from "zod";
13
+ import { protocolLogger } from "../support/protocol.logger.js";
14
+ import { Timed } from "../support/performance.js";
15
+ import { createModel } from "./model.config.js";
16
+ const logger = protocolLogger("ExplicitIntentInferrer");
17
+ /**
18
+ * Config
19
+ */
20
+ import { config } from "dotenv";
21
+ config({ path: '.env.development', override: true });
22
+ const model = createModel("intentInferrer");
23
+ // ──────────────────────────────────────────────────────────────
24
+ // 1. SYSTEM PROMPT
25
+ // ──────────────────────────────────────────────────────────────
26
+ const systemPrompt = `
27
+ You are an expert Intent Analyst. Your goal is to infer the user's current intentions based on their profile and new content.
28
+
29
+ You have access to:
30
+ 1. User Memory Profile (Identity, Narrative, Attributes) - The long-term context.
31
+ 2. New Content - What they just said/did.
32
+ 3. Conversation History (when available) - Recent messages for resolving references.
33
+ 4. Operation Context - What type of operation is being performed.
34
+
35
+ YOUR TASK:
36
+ Analyze the "New Content" in the context of the "Profile", "Conversation History", and "Operation Context".
37
+ Extract a list of **Inferred Intents**.
38
+
39
+ INTENT TYPES:
40
+ - 'goal': The user wants to start, continue, or achieve something. (e.g., "I want to learn Rust", "Looking for a co-founder")
41
+ - 'tombstone': The user explicitly states they have COMPLETED, stopped, or abandoned a goal. (e.g., "I finished the course", "I'm done with crypto", "Delete my running goal")
42
+
43
+ CRITICAL RULES:
44
+ - Only analyze the "New Content" section if it exists.
45
+ - If New Content says "Return empty intents list", you MUST return an empty intents array.
46
+ - If New Content says "No content to analyze", return an empty intents array.
47
+ - Be precise and self-contained in descriptions (e.g., "Learn Rust programming" instead of "Learn it").
48
+ - Do NOT try to manage existing IDs or check for duplicates.
49
+ - IGNORE purely phatic communication (e.g., "Hello", "Hi", "Good morning") - return empty intents.
50
+ - For CREATE operations: Extract what the user wants to ADD.
51
+ - For UPDATE operations: Extract what the user wants to CHANGE.
52
+ - For queries/questions: You should not see these - return empty intents.
53
+
54
+ CONTENT GROUNDING (CRITICAL):
55
+ - When New Content is present, EVERY inferred intent MUST be directly related to the New Content.
56
+ - The User Profile is ENRICHMENT CONTEXT ONLY — use it to add specificity or domain detail to content-derived intents.
57
+ - Do NOT generate intents from the profile that are unrelated to the New Content.
58
+ - If the New Content is a short phrase (e.g., "artist", "photographer"), treat it as the user's stated goal — infer what they want regarding that topic.
59
+ - Example: New Content = "artist", Profile = "Building a decentralized protocol" → Intent: "Find or connect with artists" (NOT "Secure partnerships for decentralized protocol")
60
+ - Example: New Content = "looking for a photographer", Profile = "AI startup founder" → Intent: "Find a photographer" (NOT "Recruit AI engineers")
61
+
62
+ CONCEPT EXTRACTION (CRITICAL FOR MATCHING):
63
+ - Intents must be SELF-CONTAINED and understandable to strangers with no prior context.
64
+ - When a document describes a project, the project's NAME is irrelevant - only WHAT IT DOES and WHAT TECH IT USES matters.
65
+ - STRIP OUT completely (do not include in any form):
66
+ * ANY project/company/product names from the source document - these mean nothing to outsiders
67
+ * URLs and links (https://..., http://...) - NEVER include URLs in intent descriptions
68
+ * Phrases that reference URLs: "More details at", "See ... for more", "Project details:", "mentioned in", "from the document", "as discussed"
69
+ * File names ("Claude.md", "README", "the PDF")
70
+ - Describe the WORK and TECHNOLOGIES, never the project name.
71
+ - Examples:
72
+ * Source mentions "FooBar Project" using React/Node → Intent: "Seeking React/Node.js developers for real-time web apps" (NO "FooBar")
73
+ * Source mentions "Index Network" with LangGraph → Intent: "Seeking LangGraph/PostgreSQL developers for AI agent systems" (NO "Index Network")
74
+ * Source mentions "Acme Corp" doing ML → Intent: "Seeking ML engineers for computer vision pipelines" (NO "Acme")
75
+
76
+ ANAPHORIC RESOLUTION (UPDATE operations):
77
+ - When conversation history is provided, use it to resolve references like "that intent", "this goal", "the project", etc.
78
+ - Look for previously mentioned intents in the conversation history.
79
+ - If the user says "make that intent X", find what "that intent" refers to in the history and include ALL its details.
80
+ - PRESERVE all existing details from the referenced intent and only MODIFY the specified parts.
81
+ - Example: If history mentions "text-based RPG game" and user says "make that intent have LLM narration",
82
+ the output should be "Create a text-based RPG game with LLM-enhanced narration" (preserving "text-based").
83
+
84
+ WHEN TO FALLBACK TO PROFILE:
85
+ - Only when explicitly instructed: "(No content provided. Please infer intents from Profile Narrative and Aspirations)"
86
+ - This should ONLY happen for CREATE operations with no explicit user input
87
+ - Never infer from profile for query operations
88
+ - When content IS present: profile may inform HOW to describe the intent (e.g., adding domain context), but must NOT change WHAT the intent is about
89
+ `;
90
+ // ──────────────────────────────────────────────────────────────
91
+ // 2. RESPONSE SCHEMA (Zod)
92
+ // ──────────────────────────────────────────────────────────────
93
+ const InferredIntentSchema = z.object({
94
+ type: z.enum(['goal', 'tombstone']).describe("The type of intent inferred"),
95
+ description: z.string().describe("Concise description of the intent"),
96
+ reasoning: z.string().describe("Why this intent was inferred"),
97
+ confidence: z.enum(['high', 'medium', 'low']).describe("Confidence level of the inference")
98
+ });
99
+ const responseFormat = z.object({
100
+ intents: z.array(InferredIntentSchema).describe("List of inferred intents")
101
+ });
102
+ // ──────────────────────────────────────────────────────────────
103
+ // 4. CLASS DEFINITION
104
+ // ──────────────────────────────────────────────────────────────
105
+ export class ExplicitIntentInferrer {
106
+ constructor() {
107
+ this.model = model.withStructuredOutput(responseFormat, {
108
+ name: "intent_inferrer"
109
+ });
110
+ }
111
+ /**
112
+ * Main entry point. Invokes the agent with input and returns structured output.
113
+ * @param content - The raw string content to analyze.
114
+ * @param profileContext - The formatted profile context string.
115
+ * @param options - Options controlling inference behavior (fallback, operation mode, conversation context).
116
+ */
117
+ async invoke(content, profileContext, options = {}) {
118
+ const { allowProfileFallback = true, // Default TRUE for backward compatibility
119
+ operationMode = 'create', conversationContext = undefined } = options;
120
+ logger.verbose("invoke: received input", {
121
+ contentPreview: content?.substring(0, 50),
122
+ allowProfileFallback,
123
+ operationMode,
124
+ hasConversationContext: !!conversationContext,
125
+ conversationMessageCount: conversationContext?.length || 0,
126
+ });
127
+ // CRITICAL: Don't fallback to profile when explicitly disabled
128
+ // This prevents auto-generation of intents from profile during query operations
129
+ if (!content && !allowProfileFallback) {
130
+ logger.verbose("invoke: no content and fallback disabled, returning empty");
131
+ return { intents: [] };
132
+ }
133
+ // Build conversation history section for anaphoric resolution
134
+ const formattedHistory = conversationContext && conversationContext.length > 0
135
+ ? this.formatConversationHistory(conversationContext)
136
+ : '';
137
+ const conversationSection = formattedHistory
138
+ ? `# Conversation History (for reference resolution)\n${formattedHistory}\n`
139
+ : '';
140
+ // Build content section based on fallback setting
141
+ const contentSection = content
142
+ ? `## New Content\n\n${content}`
143
+ : allowProfileFallback
144
+ ? '(No content provided. Please infer intents from Profile Narrative and Aspirations)'
145
+ : '(No content to analyze. Return empty intents list.)';
146
+ const prompt = `
147
+ Context:
148
+ # User Memory Profile
149
+ ${profileContext}
150
+
151
+ ${conversationSection}${contentSection}
152
+
153
+ # Operation Context
154
+ This analysis is for a ${operationMode} operation.
155
+ ${operationMode === 'create' ? 'Extract NEW intents the user wants to add.' : ''}
156
+ ${operationMode === 'update' ? 'Extract MODIFICATIONS to existing intents. Use conversation history to resolve references like "that intent".' : ''}
157
+ ${operationMode === 'delete' ? 'This should not execute - delete operations skip inference.' : ''}
158
+ `;
159
+ logger.debug("invoke: prompt details", {
160
+ hasConversationHistory: !!conversationSection,
161
+ conversationHistoryLength: formattedHistory.length,
162
+ conversationHistoryPreview: formattedHistory.substring(0, 300),
163
+ contentLength: content?.length ?? 0,
164
+ promptLength: prompt.length,
165
+ promptPreview: prompt.substring(0, 500),
166
+ });
167
+ const messages = [
168
+ new SystemMessage(systemPrompt),
169
+ new HumanMessage(prompt)
170
+ ];
171
+ try {
172
+ const result = await this.model.invoke(messages);
173
+ const output = responseFormat.parse(result);
174
+ logger.verbose(`invoke: found ${output.intents.length} intents`, {
175
+ operationMode,
176
+ allowedFallback: allowProfileFallback,
177
+ usedFallback: !content && allowProfileFallback,
178
+ });
179
+ return output;
180
+ }
181
+ catch (error) {
182
+ const err = error instanceof Error ? error : new Error(String(error));
183
+ logger.error("invoke: error during invocation", {
184
+ message: err.message,
185
+ stack: err.stack,
186
+ });
187
+ return { intents: [] };
188
+ }
189
+ }
190
+ /**
191
+ * Formats conversation history for inclusion in the prompt.
192
+ * Converts BaseMessage[] to readable string format.
193
+ */
194
+ formatConversationHistory(messages) {
195
+ const formatted = messages.map((msg, index) => {
196
+ const role = msg._getType() === 'human' ? 'User' : 'Assistant';
197
+ const content = typeof msg.content === 'string' ? msg.content : JSON.stringify(msg.content);
198
+ // Truncate long messages for token efficiency
199
+ const truncated = content.length > 200 ? content.substring(0, 200) + '...' : content;
200
+ return `[${index + 1}] ${role}: ${truncated}`;
201
+ }).join('\n');
202
+ logger.debug("formatConversationHistory: full conversation history", {
203
+ messageCount: messages.length,
204
+ fullHistory: messages
205
+ .map((msg, index) => {
206
+ const role = msg._getType() === "human" ? "User" : "Assistant";
207
+ const content = typeof msg.content === "string" ? msg.content : JSON.stringify(msg.content);
208
+ return `[${index + 1}] ${role}: ${content}`;
209
+ })
210
+ .join("\n"),
211
+ });
212
+ return formatted;
213
+ }
214
+ /**
215
+ * Factory method to expose the agent as a LangChain tool.
216
+ * Useful for composing agents into larger graphs.
217
+ */
218
+ static asTool() {
219
+ return tool(async (args) => {
220
+ const agent = new ExplicitIntentInferrer();
221
+ return await agent.invoke(args.content, args.profileContext);
222
+ }, {
223
+ name: 'explicit_intent_inferrer',
224
+ description: 'Extracts explicit intents from user content and profile context.',
225
+ schema: z.object({
226
+ content: z.string().nullable().describe('The new content to analyze'),
227
+ profileContext: z.string().describe('The user profile context')
228
+ })
229
+ });
230
+ }
231
+ }
232
+ __decorate([
233
+ Timed(),
234
+ __metadata("design:type", Function),
235
+ __metadata("design:paramtypes", [Object, String, Object]),
236
+ __metadata("design:returntype", Promise)
237
+ ], ExplicitIntentInferrer.prototype, "invoke", null);
238
+ //# sourceMappingURL=intent.inferrer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent.inferrer.js","sourceRoot":"","sources":["../../src/agents/intent.inferrer.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAe,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,WAAW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AG,CAAC,QAAQ,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC;gBAC/D,MAAM,OAAO,GAAG,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBAC5F,OAAO,IAAI,KAAK,GAAG,CAAC,KAAK,IAAI,KAAK,OAAO,EAAE,CAAC;YAC9C,CAAC,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC;SACd,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,MAAM;QAClB,OAAO,IAAI,CACT,KAAK,EAAE,IAAwD,EAAE,EAAE;YACjE,MAAM,KAAK,GAAG,IAAI,sBAAsB,EAAE,CAAC;YAC3C,OAAO,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAC/D,CAAC,EACD;YACE,IAAI,EAAE,0BAA0B;YAChC,WAAW,EAAE,kEAAkE;YAC/E,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;gBACf,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;gBACrE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;aAChE,CAAC;SACH,CACF,CAAC;IACJ,CAAC;CACF;AAzIc;IADZ,KAAK,EAAE;;;;oDAyFP"}
@@ -0,0 +1,106 @@
1
+ import { z } from "zod";
2
+ declare const CreateIntentActionSchema: z.ZodObject<{
3
+ type: z.ZodUnion<[z.ZodLiteral<"create">, z.ZodLiteral<"CREATE">]>;
4
+ payload: z.ZodString;
5
+ score: z.ZodNullable<z.ZodNumber>;
6
+ reasoning: z.ZodNullable<z.ZodString>;
7
+ intentMode: z.ZodNullable<z.ZodEnum<["REFERENTIAL", "ATTRIBUTIVE"]>>;
8
+ referentialAnchor: z.ZodNullable<z.ZodString>;
9
+ semanticEntropy: z.ZodNullable<z.ZodNumber>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ reasoning: string | null;
12
+ payload: string;
13
+ semanticEntropy: number | null;
14
+ referentialAnchor: string | null;
15
+ intentMode: "REFERENTIAL" | "ATTRIBUTIVE" | null;
16
+ type: "create" | "CREATE";
17
+ score: number | null;
18
+ }, {
19
+ reasoning: string | null;
20
+ payload: string;
21
+ semanticEntropy: number | null;
22
+ referentialAnchor: string | null;
23
+ intentMode: "REFERENTIAL" | "ATTRIBUTIVE" | null;
24
+ type: "create" | "CREATE";
25
+ score: number | null;
26
+ }>;
27
+ declare const UpdateIntentActionSchema: z.ZodObject<{
28
+ type: z.ZodUnion<[z.ZodLiteral<"update">, z.ZodLiteral<"UPDATE">]>;
29
+ id: z.ZodString;
30
+ payload: z.ZodString;
31
+ score: z.ZodNullable<z.ZodNumber>;
32
+ reasoning: z.ZodNullable<z.ZodString>;
33
+ intentMode: z.ZodNullable<z.ZodEnum<["REFERENTIAL", "ATTRIBUTIVE"]>>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ reasoning: string | null;
36
+ id: string;
37
+ payload: string;
38
+ intentMode: "REFERENTIAL" | "ATTRIBUTIVE" | null;
39
+ type: "update" | "UPDATE";
40
+ score: number | null;
41
+ }, {
42
+ reasoning: string | null;
43
+ id: string;
44
+ payload: string;
45
+ intentMode: "REFERENTIAL" | "ATTRIBUTIVE" | null;
46
+ type: "update" | "UPDATE";
47
+ score: number | null;
48
+ }>;
49
+ declare const ExpireIntentActionSchema: z.ZodObject<{
50
+ type: z.ZodUnion<[z.ZodLiteral<"expire">, z.ZodLiteral<"EXPIRE">]>;
51
+ id: z.ZodString;
52
+ reason: z.ZodString;
53
+ }, "strip", z.ZodTypeAny, {
54
+ id: string;
55
+ type: "expire" | "EXPIRE";
56
+ reason: string;
57
+ }, {
58
+ id: string;
59
+ type: "expire" | "EXPIRE";
60
+ reason: string;
61
+ }>;
62
+ export type NormalizedIntentAction = Omit<z.infer<typeof CreateIntentActionSchema>, "type"> & {
63
+ type: "create";
64
+ } | Omit<z.infer<typeof UpdateIntentActionSchema>, "type"> & {
65
+ type: "update";
66
+ } | Omit<z.infer<typeof ExpireIntentActionSchema>, "type"> & {
67
+ type: "expire";
68
+ };
69
+ export type IntentReconcilerOutput = {
70
+ actions: NormalizedIntentAction[];
71
+ };
72
+ export declare class IntentReconciler {
73
+ private model;
74
+ constructor();
75
+ /**
76
+ * Reconciles inferred intents with active intents.
77
+ * @param inferredIntentsFormatted - Formatted string of inferred intents.
78
+ * @param activeIntentsContext - Formatted string of active intents.
79
+ */
80
+ invoke(inferredIntentsFormatted: string, activeIntentsContext: string): Promise<{
81
+ actions: NormalizedIntentAction[];
82
+ }>;
83
+ /**
84
+ * Factory method to expose the agent as a LangChain tool.
85
+ */
86
+ static asTool(): import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
87
+ inferredIntents: z.ZodString;
88
+ activeIntents: z.ZodString;
89
+ }, "strip", z.ZodTypeAny, {
90
+ inferredIntents: string;
91
+ activeIntents: string;
92
+ }, {
93
+ inferredIntents: string;
94
+ activeIntents: string;
95
+ }>, {
96
+ inferredIntents: string;
97
+ activeIntents: string;
98
+ }, {
99
+ inferredIntents: string;
100
+ activeIntents: string;
101
+ }, {
102
+ actions: NormalizedIntentAction[];
103
+ }, unknown, "intent_reconciler">;
104
+ }
105
+ export {};
106
+ //# sourceMappingURL=intent.reconciler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent.reconciler.d.ts","sourceRoot":"","sources":["../../src/agents/intent.reconciler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAyExB,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;EAS5B,CAAC;AAEH,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;EAO5B,CAAC;AAEH,QAAA,MAAM,wBAAwB;;;;;;;;;;;;EAI5B,CAAC;AAcH,MAAM,MAAM,sBAAsB,GAC9B,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC3E,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC3E,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,EAAE,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC;AAEhF,MAAM,MAAM,sBAAsB,GAAG;IAAE,OAAO,EAAE,sBAAsB,EAAE,CAAA;CAAE,CAAC;AAe3E,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,KAAK,CAAM;;IAQnB;;;;OAIG;IAEU,MAAM,CAAC,wBAAwB,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM;;;IAqClF;;OAEG;WACW,MAAM;;;;;;;;;;;;;;;;;;CAgBrB"}