@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,524 @@
1
+ /**
2
+ * Opportunity Presenter Agent
3
+ *
4
+ * Generates personalized, second-person explanations of why an opportunity
5
+ * matters to the viewing user. Uses full opportunity data (interpretation,
6
+ * actors, profiles, intents, index) to produce headline, personalizedSummary,
7
+ * and suggestedAction for chat tools and user-facing surfaces.
8
+ */
9
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
10
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
11
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
12
+ 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;
13
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
14
+ };
15
+ var __metadata = (this && this.__metadata) || function (k, v) {
16
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
17
+ };
18
+ import { HumanMessage, SystemMessage } from "@langchain/core/messages";
19
+ import { z } from "zod";
20
+ import { Timed } from "../support/performance.js";
21
+ import { protocolLogger } from "../support/protocol.logger.js";
22
+ import { createModel } from "./model.config.js";
23
+ import { viewerCentricCardSummary } from "../support/opportunity.card-text.js";
24
+ import { stripUuids, stripIntroducerMentions } from "../support/opportunity.sanitize.js";
25
+ const logger = protocolLogger("OpportunityPresenter");
26
+ const LLM_TIMEOUT_MS = 20000;
27
+ const model = createModel("opportunityPresenter");
28
+ // ──────────────────────────────────────────────────────────────
29
+ // SCHEMA & TYPES
30
+ // ──────────────────────────────────────────────────────────────
31
+ const PresentationSchema = z.object({
32
+ headline: z
33
+ .string()
34
+ .describe("Short, compelling headline for this opportunity (e.g., 'A React expert who needs your design skills')"),
35
+ personalizedSummary: z
36
+ .string()
37
+ .describe("2-3 sentence explanation using 'you' language, explaining why this opportunity is specifically valuable for the viewer based on their intents and profile"),
38
+ suggestedAction: z.string().describe("Brief suggested next step"),
39
+ });
40
+ const responseFormat = z.object({
41
+ presentation: PresentationSchema,
42
+ });
43
+ /** LLM-generated fields for home-card presentation (buttons are hardcoded by callers, not LLM-generated). */
44
+ export const HomeCardLLMSchema = z.object({
45
+ headline: z
46
+ .string()
47
+ .describe("Short, compelling headline for this opportunity"),
48
+ personalizedSummary: z
49
+ .string()
50
+ .describe("2-3 sentence explanation in 'you' language for the main card body"),
51
+ suggestedAction: z
52
+ .string()
53
+ .describe("Brief suggested next step (e.g. CTA line)"),
54
+ narratorRemark: z
55
+ .string()
56
+ .max(80)
57
+ .describe("One short sentence for the narrator chip, max ~80 chars (e.g. who is suggesting and why)"),
58
+ mutualIntentsLabel: z
59
+ .string()
60
+ .max(48)
61
+ .describe("Short line for the subtitle under the other party name (e.g. '3 mutual intents', 'Shared interests', 'Aligned goals'). NEVER output '0 mutual intents' — use a qualitative phrase like 'Shared interests' when no numeric count is available."),
62
+ });
63
+ const homeCardResponseFormat = z.object({
64
+ presentation: HomeCardLLMSchema,
65
+ });
66
+ // ──────────────────────────────────────────────────────────────
67
+ // SYSTEM PROMPT
68
+ // ──────────────────────────────────────────────────────────────
69
+ const systemPrompt = `
70
+ You are an expert at presenting connection opportunities to users in a way that feels personal and compelling.
71
+
72
+ Your goal: Given raw context about the viewer (their profile, intents), the other person(s), and why the system matched them, produce a short headline, a personalized summary, and a suggested action.
73
+
74
+ Rules:
75
+ 1. Address the VIEWER directly using "you" and "your". This is for them.
76
+ 2. Be concise and compelling — not analytical or third-party. No "The source user" or "The candidate"; use names or "they" where needed.
77
+ 3. Do not leak private or confidential details. Use only the context provided.
78
+ 4. Vary user-facing nouns naturally. Do not repeatedly use the same label in one response.
79
+ 5. If possible, avoid repeating "opportunity" in both headline and summary. Prefer alternatives like "connection", "thought partner", "mutual fit", "valuable conversation", or "peer".
80
+ 6. Prefer first names in user-facing copy. Do not repeatedly use full names unless needed to disambiguate.
81
+
82
+ **Introduction-originated opportunities:**
83
+ When INTRODUCTION CONTEXT is provided, this opportunity was explicitly created by an introducer (a real person who saw value in this connection). This is NOT an automatic system discovery — someone made a deliberate judgment.
84
+ - For ALL roles: acknowledge the introducer's role naturally. E.g., "[Introducer name] thinks you should meet [other person]" or "[Introducer name] connected you because..."
85
+ - The introduction itself is a strong signal — treat it with the weight of a personal recommendation.
86
+ - If the parties' intents don't obviously overlap, that's fine — the introducer saw something worth connecting. Focus on what the introducer likely saw.
87
+
88
+ **Role-Specific Presentation:**
89
+
90
+ **If viewer is "introducer":**
91
+ - The viewer suggested this connection between two (or more) OTHER people. The opportunity is NOT about the viewer's own needs.
92
+ - Headline: describe the connection between the parties (e.g., "Connecting a React expert with a startup founder").
93
+ - Personalized summary: explain why the people YOU are introducing should meet. Reference THEIR profiles and intents, not yours. Frame it as "you're connecting X and Y because..." rather than "this matches your intent".
94
+ - Suggested action: guide sharing (e.g., "Share this with [name] to get things started").
95
+ - CRITICAL: Do NOT reference the introducer's own intents, skills, or needs. The introducer is the matchmaker, not a party.
96
+
97
+ **If viewer is "patient" or "party":**
98
+ - Reference their specific intents, skills, or interests that align with this opportunity.
99
+ - If this is an introduction: mention who introduced them and frame it as a personal recommendation.
100
+ - Headline: one short line that hooks (e.g., "[Name] thinks you should meet [Other]" or "A React expert who needs your design skills").
101
+ - Personalized summary: 2-3 sentences. Why is this opportunity for *them*? If introduced, lead with the introduction.
102
+ - Suggested action: encourage action ("Send a message to start the conversation" or "Share this intro").
103
+
104
+ **If viewer is "agent":**
105
+ - They are seeing this because someone already reached out.
106
+ - If this is an introduction: mention who made the introduction.
107
+ - Reference their skills/expertise that make them a match.
108
+ - Headline: what the other person needs that they can provide.
109
+ - Personalized summary: 2-3 sentences. Why someone reached out to them.
110
+ - Suggested action: "Someone is interested in connecting — check their message" or "Review and respond".
111
+
112
+ **If viewer is "peer":**
113
+ - Mutual opportunity. Reference shared or complementary interests.
114
+ - If this is an introduction: mention who connected them.
115
+ - Headline: the mutual connection angle.
116
+ - Personalized summary: 2-3 sentences. Why this is mutually valuable.
117
+ - Suggested action: "Send an intro to connect" or "Start a conversation".
118
+ `;
119
+ const homeCardSystemPrompt = `
120
+ You are an expert at presenting connection opportunities for a home feed card.
121
+
122
+ Given context about the viewer, the other person, and why they were matched, produce:
123
+ 1. headline: one short hook line.
124
+ 2. personalizedSummary: 2-3 sentences in "you" language (main body text).
125
+ 3. suggestedAction: one brief suggested next step.
126
+ 4. narratorRemark: one short sentence for the narrator chip (who is suggesting and why; max ~80 chars).
127
+ 5. mutualIntentsLabel: short subtitle under the other party's name. Examples: "3 mutual intents", "Shared interests", "Aligned goals" — keep it brief. NEVER output "0 mutual intents" or any zero-count label; use a qualitative phrase instead.
128
+
129
+ Rules:
130
+ - Address the viewer with "you"/"your". Be concise and compelling.
131
+ - narratorRemark should feel like a single sentence from the narrator (Index or a person), not meta-commentary.
132
+ - narratorRemark is displayed with the narrator name prepended (e.g. "Index: …" or "Alice: …"). Do NOT start narratorRemark with the narrator's name or repeat it; write only the remark (e.g. "Based on your overlapping intents" or "introduced you two, sensing a valuable connection").
133
+ - Vary wording for the match itself. Do not repeat "opportunity" across headline, summary, and narratorRemark when alternatives fit.
134
+ - Prefer first names in user-facing copy. Avoid repeated full names unless disambiguation is necessary.
135
+
136
+ **Introduction-originated opportunities (ONLY when INTRODUCTION CONTEXT is provided):**
137
+ When INTRODUCTION CONTEXT is provided, this opportunity was explicitly created by an introducer. It was NOT automatically discovered.
138
+ - For parties/patients/agents/peers viewing an introduction: keep the introducer signal in narratorRemark (and narrator chip), not in personalizedSummary.
139
+ - For these introduced parties, personalizedSummary must focus ONLY on fit/value between viewer and counterpart. Do NOT mention the introducer there.
140
+ - narratorRemark should carry the introduction signal (e.g., "saw strong alignment between you two" or "thought this connection could be valuable"), without repeating the narrator name at the start.
141
+ - This is a personal recommendation, not an algorithm match. Frame it accordingly.
142
+
143
+ **CRITICAL: NEVER include introducer names in personalizedSummary. Examples:**
144
+ ❌ WRONG: "Seref introduced you to Lucy, who is actively seeking a product co-founder..."
145
+ ✅ CORRECT: "Lucy is actively seeking a product co-founder for a niche APAC marketplace. With your expertise in UX and AI, this could be an ideal collaboration."
146
+
147
+ ❌ WRONG: "Bob thinks you should meet Alice because your React skills align with her needs."
148
+ ✅ CORRECT: "Alice is building a React-based platform and needs frontend expertise. Your experience with component architecture makes you a strong fit."
149
+
150
+ ❌ WRONG: "Jane connected you to Mark, who is looking for a designer."
151
+ ✅ CORRECT: "Mark is building a consumer app and needs design expertise. Your background in user-centered design aligns well with what he's building."
152
+
153
+ Remember: The introducer's name goes ONLY in narratorRemark, NEVER in personalizedSummary.
154
+
155
+ **When INTRODUCTION CONTEXT is NOT provided (system-discovered match):**
156
+ - Do NOT use introducer-style wording. Do NOT say "you suggested", "this is an introduction you suggested", or "you suggested this connection". The system found this match; no human introducer was involved.
157
+ - Instead, narratorRemark should describe why the match is relevant (e.g. "Based on your overlapping intents", "Your skills align with what they need").
158
+
159
+ - Exception for connector/introducer: if viewer role is "introducer" (any status), this is a curation/connector card. Use:
160
+ - suggestedAction: one short line about sharing the intro or confirming the match.
161
+ - mutualIntentsLabel: a short connector label (e.g. "Connector match", "You can bridge this").
162
+ - headline: describe the connection between the parties (e.g., "Connecting a PhD researcher with a translator"). Do NOT reference the introducer's own needs.
163
+ - personalizedSummary: explain why the parties you're introducing should meet, referencing THEIR profiles and intents, not yours.
164
+ - Exception for new-connection reveal: if viewer role is "agent", status is "accepted", and there is an introducer, this is the agent's first time seeing this opportunity. Use:
165
+ - suggestedAction: a short line about joining the conversation.
166
+ `;
167
+ // ──────────────────────────────────────────────────────────────
168
+ // CLASS
169
+ // ──────────────────────────────────────────────────────────────
170
+ export class OpportunityPresenter {
171
+ constructor() {
172
+ this.model = model.withStructuredOutput(responseFormat, {
173
+ name: "opportunity_presenter",
174
+ });
175
+ this.homeCardModel = model.withStructuredOutput(homeCardResponseFormat, {
176
+ name: "opportunity_presenter_home_card",
177
+ });
178
+ }
179
+ async invokeWithTimeout(targetModel, messages) {
180
+ const timeoutReason = `LLM invoke timed out after ${LLM_TIMEOUT_MS}ms`;
181
+ const controller = new AbortController();
182
+ let timeoutId;
183
+ const invokePromise = targetModel.invoke(messages, {
184
+ signal: controller.signal,
185
+ });
186
+ const timeoutPromise = new Promise((_, reject) => {
187
+ timeoutId = setTimeout(() => {
188
+ controller.abort(timeoutReason);
189
+ reject(new Error(timeoutReason));
190
+ }, LLM_TIMEOUT_MS);
191
+ });
192
+ try {
193
+ return await Promise.race([invokePromise, timeoutPromise]);
194
+ }
195
+ finally {
196
+ if (timeoutId) {
197
+ clearTimeout(timeoutId);
198
+ }
199
+ }
200
+ }
201
+ /**
202
+ * Generate personalized presentation for a single opportunity.
203
+ */
204
+ async present(input) {
205
+ const introContext = input.isIntroduction
206
+ ? `\nINTRODUCTION CONTEXT: This opportunity was created by an explicit introduction from ${input.introducerName ?? "someone in the community"}. It was NOT discovered automatically — a real person made this connection.\n`
207
+ : "";
208
+ const humanContent = `
209
+ VIEWER (the person seeing this opportunity):
210
+ ${input.viewerContext}
211
+
212
+ OTHER PARTY:
213
+ ${input.otherPartyContext}
214
+
215
+ MATCH CONTEXT:
216
+ - Category: ${input.category}
217
+ - Confidence: ${input.confidence}
218
+ - Why we matched: ${input.matchReasoning}
219
+ - Signals: ${input.signalsSummary}
220
+ ${introContext}
221
+ COMMUNITY: ${input.indexName}
222
+ Viewer's role in this opportunity: ${input.viewerRole}
223
+
224
+ Produce headline, personalizedSummary (2-3 sentences in "you" language), and suggestedAction.
225
+ `;
226
+ try {
227
+ const messages = [
228
+ new SystemMessage(systemPrompt),
229
+ new HumanMessage(humanContent),
230
+ ];
231
+ const result = await this.invokeWithTimeout(this.model, messages);
232
+ const parsed = responseFormat.parse(result);
233
+ parsed.presentation.personalizedSummary = stripUuids(parsed.presentation.personalizedSummary);
234
+ return parsed.presentation;
235
+ }
236
+ catch (e) {
237
+ const message = e instanceof Error ? e.message : String(e);
238
+ const timeoutReason = message.includes("timed out") ? message : undefined;
239
+ logger.warn("[OpportunityPresenter.present] LLM failed, returning fallback", {
240
+ message,
241
+ timeoutReason,
242
+ });
243
+ return {
244
+ headline: "A promising connection",
245
+ personalizedSummary: stripUuids(input.matchReasoning.slice(0, 300)),
246
+ suggestedAction: "Take a look and decide whether to reach out.",
247
+ };
248
+ }
249
+ }
250
+ /**
251
+ * Generate LLM-powered home-card content (headline, body, narrator remark, mutual-intent label).
252
+ * Callers append button labels from opportunity.constants.
253
+ */
254
+ async presentHomeCard(input) {
255
+ const mutualHint = input.mutualIntentCount != null && input.mutualIntentCount > 0
256
+ ? `There are ${input.mutualIntentCount} overlapping intent(s) between viewer and other party.`
257
+ : "Match is based on profile and intent alignment. Do not cite a numeric intent count.";
258
+ const introContext = input.isIntroduction
259
+ ? `\nINTRODUCTION CONTEXT: This opportunity was created by an explicit introduction from ${input.introducerName ?? "someone in the community"}. It was NOT discovered automatically — a real person made this connection.\n`
260
+ : "";
261
+ const humanContent = `
262
+ VIEWER (the person seeing this opportunity):
263
+ ${input.viewerContext}
264
+
265
+ OTHER PARTY:
266
+ ${input.otherPartyContext}
267
+
268
+ MATCH CONTEXT:
269
+ - Category: ${input.category}
270
+ - Confidence: ${input.confidence}
271
+ - Why we matched: ${input.matchReasoning}
272
+ - Signals: ${input.signalsSummary}
273
+ - ${mutualHint}
274
+ ${introContext}
275
+ COMMUNITY: ${input.indexName}
276
+ Viewer's role in this opportunity: ${input.viewerRole}
277
+ Opportunity status: ${input.opportunityStatus ?? "pending"}
278
+
279
+ Produce headline, personalizedSummary, suggestedAction, narratorRemark, and mutualIntentsLabel.
280
+ `;
281
+ const isIntroducer = input.viewerRole === "introducer";
282
+ try {
283
+ const messages = [
284
+ new SystemMessage(homeCardSystemPrompt),
285
+ new HumanMessage(humanContent),
286
+ ];
287
+ const result = await this.invokeWithTimeout(this.homeCardModel, messages);
288
+ const parsed = homeCardResponseFormat.parse(result);
289
+ parsed.presentation.personalizedSummary = stripUuids(parsed.presentation.personalizedSummary);
290
+ parsed.presentation.narratorRemark = stripUuids(parsed.presentation.narratorRemark);
291
+ if (/^0\s+(mutual|overlapping)\s+intent/i.test(parsed.presentation.mutualIntentsLabel)) {
292
+ parsed.presentation.mutualIntentsLabel = "Shared interests";
293
+ }
294
+ if (input.isIntroduction && input.introducerName) {
295
+ parsed.presentation.personalizedSummary = stripIntroducerMentions(parsed.presentation.personalizedSummary, input.introducerName);
296
+ }
297
+ return parsed.presentation;
298
+ }
299
+ catch (e) {
300
+ const message = e instanceof Error ? e.message : String(e);
301
+ const timeoutReason = message.includes("timed out") ? message : undefined;
302
+ logger.warn("[OpportunityPresenter.presentHomeCard] LLM failed, returning fallback", {
303
+ message,
304
+ timeoutReason,
305
+ });
306
+ let fallbackSummary = stripUuids(input.matchReasoning.slice(0, 300));
307
+ if (input.isIntroduction && input.introducerName) {
308
+ fallbackSummary = stripIntroducerMentions(fallbackSummary, input.introducerName);
309
+ }
310
+ return {
311
+ headline: "A promising connection",
312
+ personalizedSummary: fallbackSummary,
313
+ suggestedAction: isIntroducer
314
+ ? "Share this introduction to get things started."
315
+ : "Take a look and decide whether to reach out.",
316
+ narratorRemark: "Worth a look.",
317
+ mutualIntentsLabel: isIntroducer
318
+ ? "Connector match"
319
+ : input.mutualIntentCount != null && input.mutualIntentCount > 0
320
+ ? `${input.mutualIntentCount} mutual intent${input.mutualIntentCount !== 1 ? "s" : ""}`
321
+ : "Shared interests",
322
+ };
323
+ }
324
+ }
325
+ /**
326
+ * Process multiple opportunities in parallel with bounded concurrency.
327
+ */
328
+ async presentBatch(inputs, options) {
329
+ const concurrency = options?.concurrency ?? 5;
330
+ const results = [];
331
+ for (let i = 0; i < inputs.length; i += concurrency) {
332
+ const chunk = inputs.slice(i, i + concurrency);
333
+ const chunkResults = await Promise.all(chunk.map((inp) => this.present(inp)));
334
+ results.push(...chunkResults);
335
+ }
336
+ return results;
337
+ }
338
+ /**
339
+ * Process multiple opportunities as home cards in parallel with bounded concurrency.
340
+ * Returns full home-card display contracts (headline, body, narrator remark, action labels, mutual-intent label).
341
+ */
342
+ async presentHomeCardBatch(inputs, options) {
343
+ const concurrency = options?.concurrency ?? 5;
344
+ const results = [];
345
+ for (let i = 0; i < inputs.length; i += concurrency) {
346
+ const chunk = inputs.slice(i, i + concurrency);
347
+ const chunkResults = await Promise.all(chunk.map((inp) => this.presentHomeCard(inp)));
348
+ results.push(...chunkResults);
349
+ }
350
+ return results;
351
+ }
352
+ }
353
+ __decorate([
354
+ Timed(),
355
+ __metadata("design:type", Function),
356
+ __metadata("design:paramtypes", [Object]),
357
+ __metadata("design:returntype", Promise)
358
+ ], OpportunityPresenter.prototype, "present", null);
359
+ __decorate([
360
+ Timed(),
361
+ __metadata("design:type", Function),
362
+ __metadata("design:paramtypes", [Object]),
363
+ __metadata("design:returntype", Promise)
364
+ ], OpportunityPresenter.prototype, "presentHomeCard", null);
365
+ __decorate([
366
+ Timed(),
367
+ __metadata("design:type", Function),
368
+ __metadata("design:paramtypes", [Array, Object]),
369
+ __metadata("design:returntype", Promise)
370
+ ], OpportunityPresenter.prototype, "presentBatch", null);
371
+ __decorate([
372
+ Timed(),
373
+ __metadata("design:type", Function),
374
+ __metadata("design:paramtypes", [Array, Object]),
375
+ __metadata("design:returntype", Promise)
376
+ ], OpportunityPresenter.prototype, "presentHomeCardBatch", null);
377
+ // ──────────────────────────────────────────────────────────────
378
+ // CONTEXT GATHERER (used by tools)
379
+ // ──────────────────────────────────────────────────────────────
380
+ /**
381
+ * Gather all context needed for the presenter from the database.
382
+ * Fetches viewer profile, viewer intents, other party profile(s), and index in parallel.
383
+ *
384
+ * @param displayCounterpartUserId - When set (e.g. for home card), only this counterpart is included in otherPartyContext so the presenter writes about the person on the card. Omitted for introducer view (card shows both parties).
385
+ */
386
+ export async function gatherPresenterContext(database, opportunity, viewerId, displayCounterpartUserId) {
387
+ const myActor = opportunity.actors.find((a) => a.userId === viewerId);
388
+ if (!myActor) {
389
+ throw new Error("Viewer is not an actor in this opportunity");
390
+ }
391
+ const isIntroducer = myActor.role === "introducer";
392
+ const otherActors = opportunity.actors.filter((a) => a.userId !== viewerId);
393
+ let otherPartyIds = [...new Set(otherActors.map((a) => a.userId))];
394
+ if (displayCounterpartUserId &&
395
+ !isIntroducer &&
396
+ otherPartyIds.includes(displayCounterpartUserId)) {
397
+ otherPartyIds = [displayCounterpartUserId];
398
+ }
399
+ const contextIndexId = opportunity.context?.indexId;
400
+ // For introducers: fetch profiles + intents for both parties; skip introducer's own intents.
401
+ // For other roles: fetch viewer's profile + intents and other party profiles.
402
+ const [viewerProfile, indexRecord, ...otherProfiles] = await Promise.all([
403
+ database.getProfile(viewerId),
404
+ contextIndexId ? database.getIndex(contextIndexId) : Promise.resolve(null),
405
+ ...otherPartyIds.map((uid) => database.getProfile(uid)),
406
+ ]);
407
+ // Fetch intents: for introducer, fetch each party's intents; otherwise fetch viewer's intents.
408
+ let viewerIntents;
409
+ let partyIntentsMap;
410
+ if (isIntroducer) {
411
+ const partyIntentResults = await Promise.all(otherPartyIds.map(async (uid) => ({
412
+ uid,
413
+ intents: await database.getActiveIntents(uid),
414
+ })));
415
+ partyIntentsMap = new Map(partyIntentResults.map((r) => [r.uid, r.intents]));
416
+ }
417
+ else {
418
+ viewerIntents = await database.getActiveIntents(viewerId);
419
+ }
420
+ let viewerContext;
421
+ let otherPartyContext;
422
+ if (isIntroducer) {
423
+ // Introducer view: minimal viewer context (just name + role), rich other-party context with intents
424
+ viewerContext = [
425
+ "Profile:",
426
+ `Name: ${viewerProfile?.identity?.name ?? "Unknown"}`,
427
+ "Role: You are the introducer who suggested this connection.",
428
+ ].join("\n");
429
+ const otherParts = otherPartyIds.map((uid, idx) => {
430
+ const profile = otherProfiles[idx];
431
+ const name = profile?.identity?.name ?? "Unknown";
432
+ const bio = profile?.identity?.bio ?? "";
433
+ const location = profile?.identity?.location ?? "";
434
+ const skills = profile?.attributes?.skills?.join(", ") ?? "";
435
+ const interests = profile?.attributes?.interests?.join(", ") ?? "";
436
+ const context = profile?.narrative?.context ?? "";
437
+ const intents = partyIntentsMap?.get(uid);
438
+ const intentLines = intents?.length
439
+ ? intents
440
+ .slice(0, 5)
441
+ .map((i) => ` - ${i.payload}${i.summary ? ` (${i.summary})` : ""}`)
442
+ : [" (no active intents)"];
443
+ return [
444
+ `${name}:`,
445
+ ` Bio: ${bio}`,
446
+ location ? ` Location: ${location}` : null,
447
+ skills ? ` Skills: ${skills}` : null,
448
+ interests ? ` Interests: ${interests}` : null,
449
+ context ? ` Context: ${context}` : null,
450
+ ` Active intents:`,
451
+ ...intentLines,
452
+ ]
453
+ .filter(Boolean)
454
+ .join("\n");
455
+ });
456
+ otherPartyContext =
457
+ otherParts.join("\n\n") || "Parties (details not available).";
458
+ }
459
+ else {
460
+ // Non-introducer view: full viewer profile + intents, other party profiles
461
+ const viewerContextLines = [
462
+ "Profile:",
463
+ `Name: ${viewerProfile?.identity?.name ?? "Unknown"}`,
464
+ `Bio: ${viewerProfile?.identity?.bio ?? ""}`,
465
+ `Location: ${viewerProfile?.identity?.location ?? ""}`,
466
+ `Skills: ${viewerProfile?.attributes?.skills?.join(", ") ?? ""}`,
467
+ `Interests: ${viewerProfile?.attributes?.interests?.join(", ") ?? ""}`,
468
+ `Context: ${viewerProfile?.narrative?.context ?? ""}`,
469
+ "Active intents:",
470
+ ...(viewerIntents?.length
471
+ ? viewerIntents.map((i) => `- ${i.payload}${i.summary ? ` (${i.summary})` : ""}`)
472
+ : ["(none listed)"]),
473
+ ];
474
+ viewerContext = viewerContextLines.join("\n");
475
+ const otherParts = otherPartyIds.map((uid, idx) => {
476
+ const profile = otherProfiles[idx];
477
+ const name = profile?.identity?.name ?? "Unknown";
478
+ const bio = profile?.identity?.bio ?? "";
479
+ const skills = profile?.attributes?.skills?.join(", ") ?? "";
480
+ const interests = profile?.attributes?.interests?.join(", ") ?? "";
481
+ return `${name}: ${bio}. Skills: ${skills}. Interests: ${interests}`;
482
+ });
483
+ otherPartyContext =
484
+ otherParts.join("\n\n") || "Other party (details not available).";
485
+ }
486
+ const interp = opportunity.interpretation;
487
+ const signalsSummary = interp.signals?.map((s) => `${s.type}: ${s.detail ?? s.type}`).join("; ") ??
488
+ "Match based on profile and intent alignment.";
489
+ // Detect introduction-originated opportunities: only when there is an explicit introducer actor.
490
+ // Do NOT use detection.source === "manual" alone — system-discovered opportunities can have manual source without an introducer.
491
+ const introducerActor = opportunity.actors.find((a) => a.role === "introducer");
492
+ const isIntroduction = !!introducerActor;
493
+ let introducerName;
494
+ if (introducerActor) {
495
+ introducerName = opportunity.detection.createdByName;
496
+ if (!introducerName) {
497
+ const introducerProfile = await database.getProfile(introducerActor.userId);
498
+ introducerName = introducerProfile?.identity?.name ?? undefined;
499
+ }
500
+ }
501
+ const counterpartName = otherPartyIds.length === 1 && otherProfiles[0]
502
+ ? otherProfiles[0]?.identity?.name?.trim()
503
+ : undefined;
504
+ const viewerNameForFilter = viewerProfile?.identity?.name?.trim();
505
+ const matchReasoning = counterpartName && interp.reasoning
506
+ ? viewerCentricCardSummary(interp.reasoning, counterpartName, 400, viewerNameForFilter, introducerName)
507
+ : stripUuids(interp.reasoning);
508
+ const result = {
509
+ viewerContext,
510
+ otherPartyContext,
511
+ matchReasoning,
512
+ category: interp.category ?? "connection",
513
+ confidence: typeof interp.confidence === "number"
514
+ ? interp.confidence
515
+ : parseFloat(String(interp.confidence ?? 0)) || 0,
516
+ signalsSummary,
517
+ indexName: indexRecord?.title ?? contextIndexId ?? "",
518
+ viewerRole: myActor.role ?? "party",
519
+ isIntroduction,
520
+ introducerName,
521
+ };
522
+ return result;
523
+ }
524
+ //# sourceMappingURL=opportunity.presenter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opportunity.presenter.js","sourceRoot":"","sources":["../../src/agents/opportunity.presenter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;;;;;;;;;AAGH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,mB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B,GAAG,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAClE,MAAM,cAAc,GAClB,eAAe,IAAI,MAAM,CAAC,SAAS;QACjC,CAAC,CAAC,wBAAwB,CACtB,MAAM,CAAC,SAAS,EAChB,eAAe,EACf,GAAG,EACH,mBAAmB,EACnB,cAAc,CACf;QACH,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAEnC,MAAM,MAAM,GAAmB;QAC7B,aAAa;QACb,iBAAiB;QACjB,cAAc;QACd,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,YAAY;QACzC,UAAU,EACR,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ;YACnC,CAAC,CAAC,MAAM,CAAC,UAAU;YACnB,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QACrD,cAAc;QACd,SAAS,EAAE,WAAW,EAAE,KAAK,IAAI,cAAc,IAAI,EAAE;QACrD,UAAU,EAAE,OAAO,CAAC,IAAI,IAAI,OAAO;QACnC,cAAc;QACd,cAAc;KACf,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { z } from "zod/v4";
2
+ declare const responseFormat: z.ZodObject<{
3
+ identity: z.ZodObject<{
4
+ name: z.ZodString;
5
+ bio: z.ZodString;
6
+ location: z.ZodString;
7
+ }, z.core.$strip>;
8
+ narrative: z.ZodObject<{
9
+ context: z.ZodString;
10
+ }, z.core.$strip>;
11
+ attributes: z.ZodObject<{
12
+ interests: z.ZodArray<z.ZodString>;
13
+ skills: z.ZodArray<z.ZodString>;
14
+ }, z.core.$strip>;
15
+ }, z.core.$strip>;
16
+ type Profile = z.infer<typeof responseFormat>;
17
+ export type ProfileDocument = Profile & {
18
+ userId: string;
19
+ embedding: number[] | number[][] | null;
20
+ };
21
+ export declare class ProfileGenerator {
22
+ private model;
23
+ constructor();
24
+ private toString;
25
+ invoke(input: string): Promise<{
26
+ output: {
27
+ identity: {
28
+ name: string;
29
+ bio: string;
30
+ location: string;
31
+ };
32
+ narrative: {
33
+ context: string;
34
+ };
35
+ attributes: {
36
+ interests: string[];
37
+ skills: string[];
38
+ };
39
+ };
40
+ textToEmbed: string;
41
+ }>;
42
+ static asTool(): import("@langchain/core/tools").DynamicStructuredTool<z.ZodObject<{
43
+ input: z.ZodString;
44
+ }, z.core.$strip>, {
45
+ input: string;
46
+ }, {
47
+ input: string;
48
+ }, {
49
+ output: {
50
+ identity: {
51
+ name: string;
52
+ bio: string;
53
+ location: string;
54
+ };
55
+ narrative: {
56
+ context: string;
57
+ };
58
+ attributes: {
59
+ interests: string[];
60
+ skills: string[];
61
+ };
62
+ };
63
+ textToEmbed: string;
64
+ }, unknown, "profileGenerator">;
65
+ }
66
+ export {};
67
+ //# sourceMappingURL=profile.generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.generator.d.ts","sourceRoot":"","sources":["../../src/agents/profile.generator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAsB3B,QAAA,MAAM,cAAc;;;;;;;;;;;;;iBAalB,CAAC;AAEH,KAAK,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9C,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,GAAG,IAAI,CAAA;CAAE,CAAC;AAEpG,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,KAAK,CAAM;;IAOnB,OAAO,CAAC,QAAQ;IAiBH,MAAM,CAAC,KAAK,EAAE,MAAM;;;;;;;;;;;;;;;;;WAgBnB,MAAM;;;;;;;;;;;;;;;;;;;;;;;CAerB"}