@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,71 @@
1
+ import { createModel } from "./model.config.js";
2
+ import { NegotiationTurnSchema } from "../states/negotiation.state.js";
3
+ const SYSTEM_PROMPT = `You are a negotiation agent representing your user in an opportunity matching system.
4
+ Your role is to EVALUATE proposals and PROTECT your user from poor matches.
5
+
6
+ You will receive:
7
+ - Your user's profile, intents, and context
8
+ - The other user's profile, intents, and context
9
+ - The proposal or counter-proposal from the other agent
10
+ - Full negotiation history
11
+
12
+ Your job:
13
+ 1. Critically evaluate whether this match genuinely serves YOUR user's intents.
14
+ 2. Respond with one of:
15
+ - "accept" — the match is genuinely valuable for your user. Both sides benefit.
16
+ - "reject" — the match does not serve your user's needs. Explain clearly why.
17
+ - "counter" — partially convinced but have specific objections. State what's missing or weak.
18
+
19
+ Rules:
20
+ - Be skeptical. Your job is to protect your user from noise.
21
+ - Don't accept just because the other agent is enthusiastic.
22
+ - Look for concrete intent alignment, not vague overlap.
23
+ - If the other agent addressed your previous objections well, acknowledge it.
24
+ - If their counter didn't address your concerns, reject.
25
+ - Your fitScore should reflect YOUR independent assessment.
26
+ - suggestedRoles: "agent" = can help, "patient" = seeks help, "peer" = mutual benefit.`;
27
+ /**
28
+ * Negotiation agent that evaluates proposals against its user's interests.
29
+ * @remarks Uses structured output to produce a NegotiationTurn.
30
+ */
31
+ export class NegotiationResponder {
32
+ constructor() {
33
+ this.model = createModel("negotiationResponder").withStructuredOutput(NegotiationTurnSchema, { name: "negotiation_responder" });
34
+ }
35
+ /**
36
+ * Evaluate a proposal/counter and respond.
37
+ * @param input - User contexts, seed assessment, and negotiation history
38
+ * @returns A structured NegotiationTurn (accept/reject/counter)
39
+ */
40
+ async invoke(input) {
41
+ const historyText = input.history
42
+ .map((t, i) => `Turn ${i + 1}: ${t.action} — fitScore: ${t.assessment.fitScore}, reasoning: ${t.assessment.reasoning}`)
43
+ .join("\n");
44
+ const userMessage = `YOUR USER:
45
+ Name: ${input.ownUser.profile.name ?? "Unknown"}
46
+ Bio: ${input.ownUser.profile.bio ?? "N/A"}
47
+ Skills: ${input.ownUser.profile.skills?.join(", ") ?? "N/A"}
48
+ Intents: ${input.ownUser.intents.map((i) => `- ${i.title}: ${i.description} (confidence: ${i.confidence})`).join("\n")}
49
+
50
+ OTHER USER (proposing the match):
51
+ Name: ${input.otherUser.profile.name ?? "Unknown"}
52
+ Bio: ${input.otherUser.profile.bio ?? "N/A"}
53
+ Skills: ${input.otherUser.profile.skills?.join(", ") ?? "N/A"}
54
+ Intents: ${input.otherUser.intents.map((i) => `- ${i.title}: ${i.description} (confidence: ${i.confidence})`).join("\n")}
55
+
56
+ INDEX CONTEXT: ${input.indexContext.prompt || "General discovery"}
57
+
58
+ EVALUATOR PRE-SCREEN: Score ${input.seedAssessment.score}/100 — ${input.seedAssessment.reasoning}
59
+
60
+ NEGOTIATION HISTORY:
61
+ ${historyText}
62
+
63
+ Evaluate the latest proposal/counter from the other agent. Does this match genuinely serve your user?`;
64
+ const result = await this.model.invoke([
65
+ { role: "system", content: SYSTEM_PROMPT },
66
+ { role: "user", content: userMessage },
67
+ ]);
68
+ return result;
69
+ }
70
+ }
71
+ //# sourceMappingURL=negotiation.responder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"negotiation.responder.js","sourceRoot":"","sources":["../../src/agents/negotiation.responder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAA0E,MAAM,gCAAgC,CAAC;AAE/I,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;uFAuBiE,CAAC;AAUxF;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAG/B;QACE,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,sBAAsB,CAAC,CAAC,oBAAoB,CACnE,qBAAqB,EACrB,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAClC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,KAAgC;QAC3C,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO;aAC9B,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CA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AE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE;YAC1C,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE;SACvC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,253 @@
1
+ import type { Runnable } from "@langchain/core/runnables";
2
+ import { z } from "zod";
3
+ import type { Lens } from "./lens.inferrer.js";
4
+ import type { OpportunityStatus } from "../interfaces/database.interface.js";
5
+ declare const OpportunitySchema: z.ZodObject<{
6
+ reasoning: z.ZodString;
7
+ score: z.ZodNumber;
8
+ valencyRole: z.ZodEnum<["Agent", "Patient", "Peer"]>;
9
+ sourceId: z.ZodString;
10
+ candidateId: z.ZodString;
11
+ }, "strip", z.ZodTypeAny, {
12
+ reasoning: string;
13
+ sourceId: string;
14
+ score: number;
15
+ valencyRole: "Agent" | "Patient" | "Peer";
16
+ candidateId: string;
17
+ }, {
18
+ reasoning: string;
19
+ sourceId: string;
20
+ score: number;
21
+ valencyRole: "Agent" | "Patient" | "Peer";
22
+ candidateId: string;
23
+ }>;
24
+ export interface EvaluatorEntity {
25
+ userId: string;
26
+ profile: {
27
+ name?: string;
28
+ bio?: string;
29
+ location?: string;
30
+ interests?: string[];
31
+ skills?: string[];
32
+ context?: string;
33
+ };
34
+ intents?: Array<{
35
+ intentId: string;
36
+ payload: string;
37
+ summary?: string;
38
+ }>;
39
+ indexId: string;
40
+ ragScore?: number;
41
+ matchedVia?: string;
42
+ }
43
+ export interface EvaluatorInput {
44
+ /** The user who triggered discovery (for context, not special treatment). */
45
+ discovererId: string;
46
+ /** All relevant entities. In introduction mode, only the people being introduced (no introducer). */
47
+ entities: EvaluatorEntity[];
48
+ /** Existing opportunities for deduplication. */
49
+ existingOpportunities?: string;
50
+ /** When true, DISCOVERER is the introducer; reasoning and actors must be only among ENTITIES. */
51
+ introductionMode?: boolean;
52
+ /** Name of the introducer (for attribution in reasoning when introductionMode is true). */
53
+ introducerName?: string;
54
+ /** Optional hint/context from the introducer about why these people should meet. */
55
+ introductionHint?: string;
56
+ /** Optional discovery query (e.g. from chat). When set, only suggest opportunities where candidates clearly match this request. */
57
+ discoveryQuery?: string;
58
+ }
59
+ declare const ActorSchema: z.ZodObject<{
60
+ userId: z.ZodString;
61
+ role: z.ZodEnum<["agent", "patient", "peer"]>;
62
+ intentId: z.ZodNullable<z.ZodString>;
63
+ }, "strip", z.ZodTypeAny, {
64
+ userId: string;
65
+ intentId: string | null;
66
+ role: "agent" | "patient" | "peer";
67
+ }, {
68
+ userId: string;
69
+ intentId: string | null;
70
+ role: "agent" | "patient" | "peer";
71
+ }>;
72
+ declare const OpportunityWithActorsSchema: z.ZodObject<{
73
+ reasoning: z.ZodString;
74
+ score: z.ZodNumber;
75
+ actors: z.ZodArray<z.ZodObject<{
76
+ userId: z.ZodString;
77
+ role: z.ZodEnum<["agent", "patient", "peer"]>;
78
+ intentId: z.ZodNullable<z.ZodString>;
79
+ }, "strip", z.ZodTypeAny, {
80
+ userId: string;
81
+ intentId: string | null;
82
+ role: "agent" | "patient" | "peer";
83
+ }, {
84
+ userId: string;
85
+ intentId: string | null;
86
+ role: "agent" | "patient" | "peer";
87
+ }>, "many">;
88
+ }, "strip", z.ZodTypeAny, {
89
+ reasoning: string;
90
+ score: number;
91
+ actors: {
92
+ userId: string;
93
+ intentId: string | null;
94
+ role: "agent" | "patient" | "peer";
95
+ }[];
96
+ }, {
97
+ reasoning: string;
98
+ score: number;
99
+ actors: {
100
+ userId: string;
101
+ intentId: string | null;
102
+ role: "agent" | "patient" | "peer";
103
+ }[];
104
+ }>;
105
+ declare const entityBundleResponseFormat: z.ZodObject<{
106
+ opportunities: z.ZodArray<z.ZodObject<{
107
+ reasoning: z.ZodString;
108
+ score: z.ZodNumber;
109
+ actors: z.ZodArray<z.ZodObject<{
110
+ userId: z.ZodString;
111
+ role: z.ZodEnum<["agent", "patient", "peer"]>;
112
+ intentId: z.ZodNullable<z.ZodString>;
113
+ }, "strip", z.ZodTypeAny, {
114
+ userId: string;
115
+ intentId: string | null;
116
+ role: "agent" | "patient" | "peer";
117
+ }, {
118
+ userId: string;
119
+ intentId: string | null;
120
+ role: "agent" | "patient" | "peer";
121
+ }>, "many">;
122
+ }, "strip", z.ZodTypeAny, {
123
+ reasoning: string;
124
+ score: number;
125
+ actors: {
126
+ userId: string;
127
+ intentId: string | null;
128
+ role: "agent" | "patient" | "peer";
129
+ }[];
130
+ }, {
131
+ reasoning: string;
132
+ score: number;
133
+ actors: {
134
+ userId: string;
135
+ intentId: string | null;
136
+ role: "agent" | "patient" | "peer";
137
+ }[];
138
+ }>, "many">;
139
+ }, "strip", z.ZodTypeAny, {
140
+ opportunities: {
141
+ reasoning: string;
142
+ score: number;
143
+ actors: {
144
+ userId: string;
145
+ intentId: string | null;
146
+ role: "agent" | "patient" | "peer";
147
+ }[];
148
+ }[];
149
+ }, {
150
+ opportunities: {
151
+ reasoning: string;
152
+ score: number;
153
+ actors: {
154
+ userId: string;
155
+ intentId: string | null;
156
+ role: "agent" | "patient" | "peer";
157
+ }[];
158
+ }[];
159
+ }>;
160
+ export type EvaluatorActor = z.infer<typeof ActorSchema>;
161
+ export type EvaluatedOpportunityWithActors = z.infer<typeof OpportunityWithActorsSchema>;
162
+ export type EvaluatorOutputBundle = z.infer<typeof entityBundleResponseFormat>;
163
+ type Opportunity = z.infer<typeof OpportunitySchema>;
164
+ export interface CandidateProfile {
165
+ userId: string;
166
+ identity?: {
167
+ name?: string;
168
+ bio?: string;
169
+ location?: string;
170
+ };
171
+ attributes?: {
172
+ interests?: string[];
173
+ skills?: string[];
174
+ };
175
+ narrative?: {
176
+ context?: string;
177
+ };
178
+ score?: number;
179
+ }
180
+ interface OpportunityEvaluatorOptions {
181
+ minScore?: number;
182
+ limit?: number;
183
+ hydeDescription?: string;
184
+ /** Pre-inferred lenses (if not provided, lens inference runs automatically in HyDE graph). */
185
+ lenses?: Lens[];
186
+ existingOpportunities?: string;
187
+ candidates?: CandidateProfile[];
188
+ filter?: Record<string, unknown>;
189
+ initialStatus?: OpportunityStatus;
190
+ }
191
+ /** Optional test double for entity-bundle model (avoids live LLM in unit tests). */
192
+ export type OpportunityEvaluatorOptionsConstructor = {
193
+ entityBundleModel?: Runnable;
194
+ };
195
+ export declare class OpportunityEvaluator {
196
+ private model;
197
+ private entityBundleModel;
198
+ constructor(options?: OpportunityEvaluatorOptionsConstructor);
199
+ /**
200
+ * Main Entry Point: Batch analysis of candidates.
201
+ *
202
+ * @param sourceProfileContext - The profile context string of the user we are finding opportunities FOR.
203
+ * @param candidates - List of potential matches to evaluate.
204
+ * @param options - Config (minScore, valid types, etc).
205
+ * @returns A sorted list of high-value `Opportunity` objects.
206
+ */
207
+ invoke(sourceProfileContext: string, candidates: CandidateProfile[], options: OpportunityEvaluatorOptions): Promise<Opportunity[]>;
208
+ /**
209
+ * Analyze a single match pair using the primary Agent model.
210
+ */
211
+ private analyzeMatch;
212
+ /**
213
+ * Entity-bundle entry point (C3): single LLM call with all entities, returns 0..N opportunities with actors.
214
+ */
215
+ invokeEntityBundle(input: EvaluatorInput, options?: {
216
+ minScore?: number;
217
+ returnAll?: boolean;
218
+ }): Promise<EvaluatedOpportunityWithActors[]>;
219
+ /**
220
+ * Factory method to expose the agent as a LangChain tool.
221
+ * Simplified to only accept direct evaluation arguments.
222
+ * PURE: Does not perform any database lookups.
223
+ */
224
+ static asTool(): import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
225
+ sourceProfileContext: z.ZodString;
226
+ candidatesJson: z.ZodOptional<z.ZodString>;
227
+ minScore: z.ZodOptional<z.ZodNumber>;
228
+ }, "strip", z.ZodTypeAny, {
229
+ sourceProfileContext: string;
230
+ minScore?: number | undefined;
231
+ candidatesJson?: string | undefined;
232
+ }, {
233
+ sourceProfileContext: string;
234
+ minScore?: number | undefined;
235
+ candidatesJson?: string | undefined;
236
+ }>, {
237
+ sourceProfileContext: string;
238
+ minScore?: number | undefined;
239
+ candidatesJson?: string | undefined;
240
+ }, {
241
+ sourceProfileContext: string;
242
+ minScore?: number | undefined;
243
+ candidatesJson?: string | undefined;
244
+ }, {
245
+ reasoning: string;
246
+ sourceId: string;
247
+ score: number;
248
+ valencyRole: "Agent" | "Patient" | "Peer";
249
+ candidateId: string;
250
+ }[], unknown, "opportunity_evaluator">;
251
+ }
252
+ export {};
253
+ //# sourceMappingURL=opportunity.evaluator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opportunity.evaluator.d.ts","sourceRoot":"","sources":["../../src/agents/opportunity.evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAG1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAyJ7E,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;EAMrB,CAAC;AAQH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,CAAC,EAAE,KAAK,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,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