@indexnetwork/protocol 6.12.0-rc.403.1 → 6.13.22-rc.405.1

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 (1180) hide show
  1. package/CHANGELOG.md +241 -0
  2. package/IMPLEMENTATION.md +20 -0
  3. package/STABILITY.md +4 -0
  4. package/dist/agent/agent.tools.d.ts +11 -3
  5. package/dist/agent/agent.tools.js +11 -301
  6. package/dist/capabilities/communities.facade.d.ts +13 -0
  7. package/dist/capabilities/communities.facade.js +12 -0
  8. package/dist/capabilities/communities.tools.port.d.ts +5 -0
  9. package/dist/capabilities/communities.tools.port.js +1 -0
  10. package/dist/capabilities/contacts.facade.d.ts +9 -0
  11. package/dist/capabilities/contacts.facade.js +8 -0
  12. package/dist/capabilities/contacts.tools.port.d.ts +9 -0
  13. package/dist/capabilities/contacts.tools.port.js +1 -0
  14. package/dist/capabilities/integrations.facade.d.ts +8 -0
  15. package/dist/capabilities/integrations.facade.js +7 -0
  16. package/dist/capabilities/integrations.tools.port.d.ts +9 -0
  17. package/dist/capabilities/integrations.tools.port.js +1 -0
  18. package/dist/capabilities/interaction-composition.facade.d.ts +10 -0
  19. package/dist/capabilities/interaction-composition.facade.js +9 -0
  20. package/dist/capabilities/negotiation.discovery.facade.d.ts +9 -0
  21. package/dist/capabilities/negotiation.discovery.facade.js +7 -0
  22. package/dist/capabilities/negotiation.facade.d.ts +23 -0
  23. package/dist/capabilities/negotiation.facade.js +17 -0
  24. package/dist/capabilities/negotiation.memory.facade.d.ts +6 -0
  25. package/dist/capabilities/negotiation.memory.facade.js +5 -0
  26. package/dist/capabilities/negotiation.questions.facade.d.ts +6 -0
  27. package/dist/capabilities/negotiation.questions.facade.js +5 -0
  28. package/dist/capabilities/negotiation.state.facade.d.ts +5 -0
  29. package/dist/capabilities/negotiation.state.facade.js +1 -0
  30. package/dist/capabilities/negotiation.summary.facade.d.ts +5 -0
  31. package/dist/capabilities/negotiation.summary.facade.js +5 -0
  32. package/dist/capabilities/negotiation.tools.port.d.ts +5 -0
  33. package/dist/capabilities/negotiation.tools.port.js +1 -0
  34. package/dist/capabilities/opportunities.facade.d.ts +50 -0
  35. package/dist/capabilities/opportunities.facade.js +50 -0
  36. package/dist/capabilities/opportunities.safety.facade.d.ts +2 -0
  37. package/dist/capabilities/opportunities.safety.facade.js +2 -0
  38. package/dist/capabilities/opportunities.tools.port.d.ts +5 -0
  39. package/dist/capabilities/opportunities.tools.port.js +1 -0
  40. package/dist/capabilities/participant-agents.debug.facade.d.ts +2 -0
  41. package/dist/capabilities/participant-agents.debug.facade.js +1 -0
  42. package/dist/capabilities/participant-agents.facade.d.ts +35 -0
  43. package/dist/capabilities/participant-agents.facade.js +35 -0
  44. package/dist/capabilities/participant-agents.tools.facade.d.ts +8 -0
  45. package/dist/capabilities/participant-agents.tools.facade.js +8 -0
  46. package/dist/capabilities/participant-agents.tools.port.d.ts +9 -0
  47. package/dist/capabilities/participant-agents.tools.port.js +1 -0
  48. package/dist/capabilities/participant-context.facade.d.ts +13 -0
  49. package/dist/capabilities/participant-context.facade.js +14 -0
  50. package/dist/capabilities/participant-context.tools.port.d.ts +9 -0
  51. package/dist/capabilities/participant-context.tools.port.js +1 -0
  52. package/dist/capabilities/questions.enqueue.facade.d.ts +5 -0
  53. package/dist/capabilities/questions.enqueue.facade.js +1 -0
  54. package/dist/capabilities/questions.facade.d.ts +8 -0
  55. package/dist/capabilities/questions.facade.js +7 -0
  56. package/dist/capabilities/questions.runtime.facade.d.ts +5 -0
  57. package/dist/capabilities/questions.runtime.facade.js +5 -0
  58. package/dist/capabilities/questions.tools.port.d.ts +5 -0
  59. package/dist/capabilities/questions.tools.port.js +1 -0
  60. package/dist/capabilities/signals.facade.d.ts +16 -0
  61. package/dist/capabilities/signals.facade.js +14 -0
  62. package/dist/capabilities/signals.indexing.facade.d.ts +12 -0
  63. package/dist/capabilities/signals.indexing.facade.js +11 -0
  64. package/dist/capabilities/signals.tools.port.d.ts +5 -0
  65. package/dist/capabilities/signals.tools.port.js +1 -0
  66. package/dist/chat/chat-streaming.types.d.ts +0 -1
  67. package/dist/chat/chat-streaming.types.js +1 -2
  68. package/dist/chat/chat.agent.d.ts +0 -1
  69. package/dist/chat/chat.agent.js +0 -1
  70. package/dist/chat/chat.graph.d.ts +0 -1
  71. package/dist/chat/chat.graph.js +0 -1
  72. package/dist/chat/chat.interrupt.classifier.d.ts +0 -1
  73. package/dist/chat/chat.interrupt.classifier.js +0 -1
  74. package/dist/chat/chat.persona.d.ts +0 -1
  75. package/dist/chat/chat.persona.js +0 -1
  76. package/dist/chat/chat.prompt.d.ts +0 -1
  77. package/dist/chat/chat.prompt.js +0 -1
  78. package/dist/chat/chat.prompt.modules.d.ts +0 -1
  79. package/dist/chat/chat.prompt.modules.js +0 -1
  80. package/dist/chat/chat.question-dedup.d.ts +0 -1
  81. package/dist/chat/chat.question-dedup.js +0 -1
  82. package/dist/chat/chat.state.d.ts +0 -1
  83. package/dist/chat/chat.state.js +0 -1
  84. package/dist/chat/chat.streamer.d.ts +0 -1
  85. package/dist/chat/chat.streamer.js +0 -1
  86. package/dist/chat/chat.suggester.d.ts +0 -1
  87. package/dist/chat/chat.suggester.js +0 -1
  88. package/dist/chat/chat.summarizer.d.ts +0 -1
  89. package/dist/chat/chat.summarizer.js +0 -1
  90. package/dist/chat/chat.title.generator.d.ts +0 -1
  91. package/dist/chat/chat.title.generator.js +0 -1
  92. package/dist/chat/chat.tools.d.ts +0 -1
  93. package/dist/chat/chat.tools.js +0 -1
  94. package/dist/chat/chat.utils.d.ts +0 -1
  95. package/dist/chat/chat.utils.js +0 -1
  96. package/dist/chat/negotiator.persona.d.ts +0 -1
  97. package/dist/chat/negotiator.persona.js +0 -1
  98. package/dist/chat/negotiator.prompt.d.ts +1 -2
  99. package/dist/chat/negotiator.prompt.js +1 -2
  100. package/dist/chat/negotiator.tools.d.ts +0 -1
  101. package/dist/chat/negotiator.tools.js +0 -1
  102. package/dist/chat/onboarding.persona.d.ts +0 -1
  103. package/dist/chat/onboarding.persona.js +0 -1
  104. package/dist/chat/onboarding.prompt.d.ts +0 -1
  105. package/dist/chat/onboarding.prompt.js +0 -1
  106. package/dist/chat/reporter.action.contracts.d.ts +36 -0
  107. package/dist/chat/reporter.action.contracts.js +1 -0
  108. package/dist/chat/reporter.action.tools.d.ts +2 -37
  109. package/dist/chat/reporter.action.tools.js +0 -1
  110. package/dist/chat/reporter.persona.d.ts +0 -1
  111. package/dist/chat/reporter.persona.js +0 -1
  112. package/dist/chat/reporter.prompt.d.ts +0 -1
  113. package/dist/chat/reporter.prompt.js +0 -1
  114. package/dist/chat/signal.persona.d.ts +0 -1
  115. package/dist/chat/signal.persona.js +0 -1
  116. package/dist/chat/signal.prompt.d.ts +0 -1
  117. package/dist/chat/signal.prompt.js +0 -1
  118. package/dist/communities/application/index.d.ts +45 -0
  119. package/dist/communities/application/index.js +50 -0
  120. package/dist/communities/application/indexer.graph.d.ts +446 -0
  121. package/dist/communities/application/indexer.graph.js +420 -0
  122. package/dist/communities/application/indexer.state.d.ts +172 -0
  123. package/dist/communities/application/indexer.state.js +116 -0
  124. package/dist/communities/application/membership.graph.d.ts +270 -0
  125. package/dist/communities/application/membership.graph.js +229 -0
  126. package/dist/communities/application/network.graph.d.ts +648 -0
  127. package/dist/communities/application/network.graph.js +303 -0
  128. package/dist/communities/application/network.recommender.d.ts +44 -0
  129. package/dist/communities/application/network.recommender.js +113 -0
  130. package/dist/communities/application/network.tools.d.ts +35 -0
  131. package/dist/communities/application/network.tools.js +578 -0
  132. package/dist/communities/domain/index.d.ts +29 -0
  133. package/dist/communities/domain/index.js +31 -0
  134. package/dist/communities/domain/membership.state.d.ts +87 -0
  135. package/dist/communities/domain/membership.state.js +53 -0
  136. package/dist/communities/domain/network.state.d.ts +192 -0
  137. package/dist/communities/domain/network.state.js +66 -0
  138. package/dist/communities/index.d.ts +14 -0
  139. package/dist/communities/index.js +14 -0
  140. package/dist/communities/ports/index.d.ts +25 -0
  141. package/dist/communities/ports/index.js +27 -0
  142. package/dist/communities/public/index.d.ts +30 -0
  143. package/dist/communities/public/index.js +33 -0
  144. package/dist/contact/contact.inviter.d.ts +7 -44
  145. package/dist/contact/contact.inviter.js +6 -59
  146. package/dist/contact/contact.tools.d.ts +7 -5
  147. package/dist/contact/contact.tools.js +7 -177
  148. package/dist/contacts/application/contact.inviter.d.ts +49 -0
  149. package/dist/contacts/application/contact.inviter.js +64 -0
  150. package/dist/contacts/application/contact.tools.d.ts +20 -0
  151. package/dist/contacts/application/contact.tools.js +191 -0
  152. package/dist/contacts/application/index.d.ts +22 -0
  153. package/dist/contacts/application/index.js +21 -0
  154. package/dist/contacts/domain/contact.types.d.ts +51 -0
  155. package/dist/contacts/domain/contact.types.js +10 -0
  156. package/dist/contacts/domain/index.d.ts +18 -0
  157. package/dist/contacts/domain/index.js +1 -0
  158. package/dist/contacts/index.d.ts +24 -0
  159. package/dist/contacts/index.js +24 -0
  160. package/dist/contacts/ports/contact.repository.port.d.ts +28 -0
  161. package/dist/contacts/ports/contact.repository.port.js +14 -0
  162. package/dist/contacts/ports/contact.tools.port.d.ts +26 -0
  163. package/dist/contacts/ports/contact.tools.port.js +21 -0
  164. package/dist/contacts/ports/index.d.ts +22 -0
  165. package/dist/contacts/ports/index.js +21 -0
  166. package/dist/contacts/public/index.d.ts +36 -0
  167. package/dist/contacts/public/index.js +33 -0
  168. package/dist/context/context.generator.d.ts +0 -1
  169. package/dist/context/context.generator.js +0 -1
  170. package/dist/enrichment/enrichment.enricher.d.ts +0 -1
  171. package/dist/enrichment/enrichment.enricher.js +0 -1
  172. package/dist/enrichment/enrichment.generator.d.ts +0 -1
  173. package/dist/enrichment/enrichment.generator.js +0 -1
  174. package/dist/enrichment/enrichment.graph.d.ts +6 -7
  175. package/dist/enrichment/enrichment.graph.js +0 -1
  176. package/dist/enrichment/enrichment.state.d.ts +2 -3
  177. package/dist/enrichment/enrichment.state.js +0 -1
  178. package/dist/enrichment/enrichment.tools.d.ts +3 -3
  179. package/dist/enrichment/enrichment.tools.js +0 -1
  180. package/dist/index.d.ts +106 -91
  181. package/dist/index.js +79 -71
  182. package/dist/integration/integration.tools.d.ts +6 -10
  183. package/dist/integration/integration.tools.js +6 -82
  184. package/dist/integrations/application/index.d.ts +14 -0
  185. package/dist/integrations/application/index.js +14 -0
  186. package/dist/integrations/application/integration.tools.d.ts +27 -0
  187. package/dist/integrations/application/integration.tools.js +98 -0
  188. package/dist/integrations/domain/index.d.ts +18 -0
  189. package/dist/integrations/domain/index.js +1 -0
  190. package/dist/integrations/domain/integration.types.d.ts +53 -0
  191. package/dist/integrations/domain/integration.types.js +11 -0
  192. package/dist/integrations/index.d.ts +27 -0
  193. package/dist/integrations/index.js +27 -0
  194. package/dist/integrations/ports/index.d.ts +28 -0
  195. package/dist/integrations/ports/index.js +26 -0
  196. package/dist/integrations/ports/integration.adapter.port.d.ts +62 -0
  197. package/dist/integrations/ports/integration.adapter.port.js +15 -0
  198. package/dist/integrations/ports/integration.importer.port.d.ts +31 -0
  199. package/dist/integrations/ports/integration.importer.port.js +15 -0
  200. package/dist/integrations/ports/integration.tools.port.d.ts +28 -0
  201. package/dist/integrations/ports/integration.tools.port.js +21 -0
  202. package/dist/integrations/public/index.d.ts +37 -0
  203. package/dist/integrations/public/index.js +34 -0
  204. package/dist/intent/intent.clarifier.d.ts +3 -52
  205. package/dist/intent/intent.clarifier.js +2 -202
  206. package/dist/intent/intent.graph.d.ts +3 -551
  207. package/dist/intent/intent.graph.js +3 -937
  208. package/dist/intent/intent.indexer.d.ts +2 -83
  209. package/dist/intent/intent.indexer.js +2 -171
  210. package/dist/intent/intent.inferrer.d.ts +2 -95
  211. package/dist/intent/intent.inferrer.js +2 -234
  212. package/dist/intent/intent.reconciler.d.ts +2 -106
  213. package/dist/intent/intent.reconciler.js +2 -187
  214. package/dist/intent/intent.specificity.d.ts +2 -3
  215. package/dist/intent/intent.specificity.js +2 -3
  216. package/dist/intent/intent.state.d.ts +8 -229
  217. package/dist/intent/intent.state.js +8 -189
  218. package/dist/intent/intent.tools.d.ts +6 -24
  219. package/dist/intent/intent.tools.js +4 -788
  220. package/dist/intent/intent.verifier.d.ts +2 -116
  221. package/dist/intent/intent.verifier.js +2 -263
  222. package/dist/maintenance/maintenance.graph.d.ts +0 -1
  223. package/dist/maintenance/maintenance.graph.js +0 -1
  224. package/dist/maintenance/maintenance.state.d.ts +0 -1
  225. package/dist/maintenance/maintenance.state.js +0 -1
  226. package/dist/mcp/elicitation.builder.d.ts +0 -1
  227. package/dist/mcp/elicitation.builder.js +0 -1
  228. package/dist/mcp/elicitation.dispatcher.d.ts +0 -1
  229. package/dist/mcp/elicitation.dispatcher.js +0 -1
  230. package/dist/mcp/mcp.server.d.ts +0 -1
  231. package/dist/mcp/mcp.server.js +1 -2
  232. package/dist/negotiation/application/index.d.ts +48 -0
  233. package/dist/negotiation/application/index.js +49 -0
  234. package/dist/negotiation/application/insight.generator.d.ts +31 -0
  235. package/dist/negotiation/application/insight.generator.js +105 -0
  236. package/dist/negotiation/application/negotiation.agent.d.ts +110 -0
  237. package/dist/negotiation/application/negotiation.agent.js +244 -0
  238. package/dist/negotiation/application/negotiation.detail-reader.d.ts +94 -0
  239. package/dist/negotiation/application/negotiation.detail-reader.js +91 -0
  240. package/dist/negotiation/application/negotiation.graph.d.ts +664 -0
  241. package/dist/negotiation/application/negotiation.graph.js +1393 -0
  242. package/dist/negotiation/application/negotiation.reflect.d.ts +194 -0
  243. package/dist/negotiation/application/negotiation.reflect.js +145 -0
  244. package/dist/negotiation/application/negotiation.screen.d.ts +78 -0
  245. package/dist/negotiation/application/negotiation.screen.js +108 -0
  246. package/dist/negotiation/application/negotiation.summarizer.d.ts +25 -0
  247. package/dist/negotiation/application/negotiation.summarizer.js +101 -0
  248. package/dist/negotiation/application/negotiation.tools.d.ts +18 -0
  249. package/dist/negotiation/application/negotiation.tools.js +782 -0
  250. package/dist/negotiation/domain/index.d.ts +48 -0
  251. package/dist/negotiation/domain/index.js +50 -0
  252. package/dist/negotiation/domain/negotiation.consultation-policy.d.ts +39 -0
  253. package/dist/negotiation/domain/negotiation.consultation-policy.js +68 -0
  254. package/dist/negotiation/domain/negotiation.deadlock.contracts.d.ts +10 -0
  255. package/dist/negotiation/domain/negotiation.deadlock.contracts.js +1 -0
  256. package/dist/negotiation/domain/negotiation.deadlock.d.ts +81 -0
  257. package/dist/negotiation/domain/negotiation.deadlock.js +103 -0
  258. package/dist/negotiation/domain/negotiation.intent-snapshot-provenance.d.ts +21 -0
  259. package/dist/negotiation/domain/negotiation.intent-snapshot-provenance.js +28 -0
  260. package/dist/negotiation/domain/negotiation.lifecycle-narration.d.ts +18 -0
  261. package/dist/negotiation/domain/negotiation.lifecycle-narration.js +87 -0
  262. package/dist/negotiation/domain/negotiation.memory.d.ts +65 -0
  263. package/dist/negotiation/domain/negotiation.memory.js +83 -0
  264. package/dist/negotiation/domain/negotiation.protocol.d.ts +536 -0
  265. package/dist/negotiation/domain/negotiation.protocol.js +202 -0
  266. package/dist/negotiation/domain/negotiation.question-safety.d.ts +25 -0
  267. package/dist/negotiation/domain/negotiation.question-safety.js +55 -0
  268. package/dist/negotiation/domain/negotiation.screen.contracts.d.ts +88 -0
  269. package/dist/negotiation/domain/negotiation.screen.contracts.js +58 -0
  270. package/dist/negotiation/domain/negotiation.state.d.ts +497 -0
  271. package/dist/negotiation/domain/negotiation.state.js +288 -0
  272. package/dist/negotiation/domain/negotiation.task-lock-policy.d.ts +10 -0
  273. package/dist/negotiation/domain/negotiation.task-lock-policy.js +22 -0
  274. package/dist/negotiation/index.d.ts +49 -0
  275. package/dist/negotiation/index.js +49 -0
  276. package/dist/negotiation/insight.generator.d.ts +3 -30
  277. package/dist/negotiation/insight.generator.js +3 -104
  278. package/dist/negotiation/negotiation.agent.d.ts +3 -109
  279. package/dist/negotiation/negotiation.agent.js +3 -248
  280. package/dist/negotiation/negotiation.attribution.d.ts +0 -1
  281. package/dist/negotiation/negotiation.attribution.js +0 -1
  282. package/dist/negotiation/negotiation.consultation-policy.d.ts +3 -38
  283. package/dist/negotiation/negotiation.consultation-policy.js +3 -67
  284. package/dist/negotiation/negotiation.deadlock.contracts.d.ts +5 -0
  285. package/dist/negotiation/negotiation.deadlock.contracts.js +5 -0
  286. package/dist/negotiation/negotiation.deadlock.d.ts +3 -94
  287. package/dist/negotiation/negotiation.deadlock.js +3 -101
  288. package/dist/negotiation/negotiation.detail-reader.d.ts +5 -0
  289. package/dist/negotiation/negotiation.detail-reader.js +5 -0
  290. package/dist/negotiation/negotiation.graph.d.ts +3 -663
  291. package/dist/negotiation/negotiation.graph.js +3 -1459
  292. package/dist/negotiation/negotiation.intent-snapshot-provenance.d.ts +5 -0
  293. package/dist/negotiation/negotiation.intent-snapshot-provenance.js +5 -0
  294. package/dist/negotiation/negotiation.lifecycle-narration.d.ts +5 -0
  295. package/dist/negotiation/negotiation.lifecycle-narration.js +5 -0
  296. package/dist/negotiation/negotiation.memory.d.ts +5 -56
  297. package/dist/negotiation/negotiation.memory.js +5 -69
  298. package/dist/negotiation/negotiation.protocol.d.ts +3 -535
  299. package/dist/negotiation/negotiation.protocol.js +3 -201
  300. package/dist/negotiation/negotiation.question-safety.d.ts +3 -24
  301. package/dist/negotiation/negotiation.question-safety.js +3 -54
  302. package/dist/negotiation/negotiation.reflect.d.ts +4 -197
  303. package/dist/negotiation/negotiation.reflect.js +4 -151
  304. package/dist/negotiation/negotiation.screen.d.ts +6 -159
  305. package/dist/negotiation/negotiation.screen.js +6 -152
  306. package/dist/negotiation/negotiation.state.d.ts +3 -495
  307. package/dist/negotiation/negotiation.state.js +3 -284
  308. package/dist/negotiation/negotiation.summarizer.d.ts +3 -24
  309. package/dist/negotiation/negotiation.summarizer.js +3 -100
  310. package/dist/negotiation/negotiation.task-lock-policy.d.ts +5 -0
  311. package/dist/negotiation/negotiation.task-lock-policy.js +5 -0
  312. package/dist/negotiation/negotiation.tools.d.ts +3 -15
  313. package/dist/negotiation/negotiation.tools.js +3 -946
  314. package/dist/negotiation/ports/index.d.ts +18 -0
  315. package/dist/negotiation/ports/index.js +18 -0
  316. package/dist/negotiation/ports/negotiation.tools.port.d.ts +18 -0
  317. package/dist/negotiation/ports/negotiation.tools.port.js +1 -0
  318. package/dist/negotiation/public/index.d.ts +58 -0
  319. package/dist/negotiation/public/index.js +60 -0
  320. package/dist/network/indexer/indexer.graph.d.ts +3 -413
  321. package/dist/network/indexer/indexer.graph.js +3 -375
  322. package/dist/network/indexer/indexer.state.d.ts +3 -149
  323. package/dist/network/indexer/indexer.state.js +3 -98
  324. package/dist/network/membership/membership.graph.d.ts +3 -248
  325. package/dist/network/membership/membership.graph.js +3 -202
  326. package/dist/network/membership/membership.state.d.ts +3 -75
  327. package/dist/network/membership/membership.state.js +3 -41
  328. package/dist/network/network.graph.d.ts +3 -629
  329. package/dist/network/network.graph.js +3 -267
  330. package/dist/network/network.recommender.d.ts +3 -40
  331. package/dist/network/network.recommender.js +3 -109
  332. package/dist/network/network.state.d.ts +3 -180
  333. package/dist/network/network.state.js +3 -54
  334. package/dist/network/network.tools.d.ts +5 -3
  335. package/dist/network/network.tools.js +5 -566
  336. package/dist/opportunity/application/delivery-card.cache.d.ts +25 -0
  337. package/dist/opportunity/application/delivery-card.cache.js +43 -0
  338. package/dist/opportunity/application/index.d.ts +63 -0
  339. package/dist/opportunity/application/index.js +68 -0
  340. package/dist/opportunity/application/negotiation-context.loader.d.ts +59 -0
  341. package/dist/opportunity/application/negotiation-context.loader.js +88 -0
  342. package/dist/opportunity/application/opportunity.card-presentation.d.ts +44 -0
  343. package/dist/opportunity/application/opportunity.card-presentation.js +104 -0
  344. package/dist/opportunity/application/opportunity.discover.d.ts +215 -0
  345. package/dist/opportunity/application/opportunity.discover.js +793 -0
  346. package/dist/opportunity/application/opportunity.discovery-continuation-finalization.d.ts +34 -0
  347. package/dist/opportunity/application/opportunity.discovery-continuation-finalization.js +74 -0
  348. package/dist/opportunity/application/opportunity.discovery-mcp-lifecycle-finalization.d.ts +44 -0
  349. package/dist/opportunity/application/opportunity.discovery-mcp-lifecycle-finalization.js +92 -0
  350. package/dist/opportunity/application/opportunity.discovery-negotiation-summary.d.ts +14 -0
  351. package/dist/opportunity/application/opportunity.discovery-negotiation-summary.js +46 -0
  352. package/dist/opportunity/application/opportunity.enricher.d.ts +71 -0
  353. package/dist/opportunity/application/opportunity.enricher.js +280 -0
  354. package/dist/opportunity/application/opportunity.evaluator.d.ts +275 -0
  355. package/dist/opportunity/application/opportunity.evaluator.js +459 -0
  356. package/dist/opportunity/application/opportunity.existing-negotiation.d.ts +77 -0
  357. package/dist/opportunity/application/opportunity.existing-negotiation.js +109 -0
  358. package/dist/opportunity/application/opportunity.feed-selection.d.ts +30 -0
  359. package/dist/opportunity/application/opportunity.feed-selection.js +96 -0
  360. package/dist/opportunity/application/opportunity.graph.d.ts +1427 -0
  361. package/dist/opportunity/application/opportunity.graph.js +3693 -0
  362. package/dist/opportunity/application/opportunity.introducer.d.ts +77 -0
  363. package/dist/opportunity/application/opportunity.introducer.js +99 -0
  364. package/dist/opportunity/application/opportunity.lifecycle.d.ts +63 -0
  365. package/dist/opportunity/application/opportunity.lifecycle.js +181 -0
  366. package/dist/opportunity/application/opportunity.newborn-stamping.d.ts +41 -0
  367. package/dist/opportunity/application/opportunity.newborn-stamping.js +81 -0
  368. package/dist/opportunity/application/opportunity.pending-questions.d.ts +33 -0
  369. package/dist/opportunity/application/opportunity.pending-questions.js +42 -0
  370. package/dist/opportunity/application/opportunity.persist.d.ts +58 -0
  371. package/dist/opportunity/application/opportunity.persist.js +145 -0
  372. package/dist/opportunity/application/opportunity.persistence-admission.d.ts +39 -0
  373. package/dist/opportunity/application/opportunity.persistence-admission.js +59 -0
  374. package/dist/opportunity/application/opportunity.presenter.d.ts +156 -0
  375. package/dist/opportunity/application/opportunity.presenter.js +736 -0
  376. package/dist/opportunity/application/opportunity.tools.d.ts +131 -0
  377. package/dist/opportunity/application/opportunity.tools.js +1834 -0
  378. package/dist/opportunity/application/opportunity.update-admission.d.ts +24 -0
  379. package/dist/opportunity/application/opportunity.update-admission.js +38 -0
  380. package/dist/opportunity/delivery-card.cache.d.ts +5 -26
  381. package/dist/opportunity/delivery-card.cache.js +5 -44
  382. package/dist/opportunity/discovery-question.helper.d.ts +3 -17
  383. package/dist/opportunity/discovery-question.helper.js +3 -14
  384. package/dist/opportunity/discriminator/discriminator.adjustments.d.ts +0 -1
  385. package/dist/opportunity/discriminator/discriminator.adjustments.js +0 -1
  386. package/dist/opportunity/discriminator/discriminator.assigner.d.ts +4 -5
  387. package/dist/opportunity/discriminator/discriminator.assigner.js +0 -1
  388. package/dist/opportunity/discriminator/discriminator.env.d.ts +0 -1
  389. package/dist/opportunity/discriminator/discriminator.env.js +0 -1
  390. package/dist/opportunity/discriminator/discriminator.miner.d.ts +0 -1
  391. package/dist/opportunity/discriminator/discriminator.miner.js +0 -1
  392. package/dist/opportunity/discriminator/discriminator.push.d.ts +0 -1
  393. package/dist/opportunity/discriminator/discriminator.push.js +0 -1
  394. package/dist/opportunity/discriminator/discriminator.question.d.ts +0 -1
  395. package/dist/opportunity/discriminator/discriminator.question.js +0 -1
  396. package/dist/opportunity/discriminator/discriminator.scorer.d.ts +0 -1
  397. package/dist/opportunity/discriminator/discriminator.scorer.js +0 -1
  398. package/dist/opportunity/discriminator/discriminator.shadow.d.ts +0 -1
  399. package/dist/opportunity/discriminator/discriminator.shadow.js +0 -1
  400. package/dist/opportunity/discriminator/discriminator.types.d.ts +0 -1
  401. package/dist/opportunity/discriminator/discriminator.types.js +0 -1
  402. package/dist/opportunity/domain/discovery-question.helper.d.ts +18 -0
  403. package/dist/opportunity/domain/discovery-question.helper.js +15 -0
  404. package/dist/opportunity/domain/index.d.ts +55 -0
  405. package/dist/opportunity/domain/index.js +52 -0
  406. package/dist/opportunity/domain/negotiation-summary.builder.d.ts +37 -0
  407. package/dist/opportunity/domain/negotiation-summary.builder.js +66 -0
  408. package/dist/opportunity/domain/opportunity.actor.d.ts +15 -0
  409. package/dist/opportunity/domain/opportunity.actor.js +39 -0
  410. package/dist/opportunity/domain/opportunity.claim-safety.d.ts +24 -0
  411. package/dist/opportunity/domain/opportunity.claim-safety.js +88 -0
  412. package/dist/opportunity/domain/opportunity.discovery-run-coalescing.d.ts +33 -0
  413. package/dist/opportunity/domain/opportunity.discovery-run-coalescing.js +33 -0
  414. package/dist/opportunity/domain/opportunity.discovery.contracts.d.ts +45 -0
  415. package/dist/opportunity/domain/opportunity.discovery.contracts.js +1 -0
  416. package/dist/opportunity/domain/opportunity.evidence.d.ts +21 -0
  417. package/dist/opportunity/domain/opportunity.evidence.js +78 -0
  418. package/dist/opportunity/domain/opportunity.labels.d.ts +8 -0
  419. package/dist/opportunity/domain/opportunity.labels.js +10 -0
  420. package/dist/opportunity/domain/opportunity.presentation-cache.d.ts +6 -0
  421. package/dist/opportunity/domain/opportunity.presentation-cache.js +14 -0
  422. package/dist/opportunity/domain/opportunity.presentation.d.ts +76 -0
  423. package/dist/opportunity/domain/opportunity.presentation.js +516 -0
  424. package/dist/opportunity/domain/opportunity.safe-presentation.d.ts +104 -0
  425. package/dist/opportunity/domain/opportunity.safe-presentation.js +102 -0
  426. package/dist/opportunity/domain/opportunity.state.d.ts +519 -0
  427. package/dist/opportunity/domain/opportunity.state.js +309 -0
  428. package/dist/opportunity/domain/opportunity.utils.d.ts +217 -0
  429. package/dist/opportunity/domain/opportunity.utils.js +395 -0
  430. package/dist/opportunity/feed/feed.categorizer.d.ts +0 -1
  431. package/dist/opportunity/feed/feed.categorizer.js +0 -1
  432. package/dist/opportunity/feed/feed.graph.d.ts +1 -2
  433. package/dist/opportunity/feed/feed.graph.js +0 -1
  434. package/dist/opportunity/feed/feed.health.d.ts +0 -1
  435. package/dist/opportunity/feed/feed.health.js +0 -1
  436. package/dist/opportunity/feed/feed.state.d.ts +1 -2
  437. package/dist/opportunity/feed/feed.state.js +0 -1
  438. package/dist/opportunity/index.d.ts +37 -0
  439. package/dist/opportunity/index.js +37 -0
  440. package/dist/opportunity/negotiation-context.loader.d.ts +3 -58
  441. package/dist/opportunity/negotiation-context.loader.js +3 -87
  442. package/dist/opportunity/negotiation-evidence/negotiation-evidence.env.d.ts +0 -1
  443. package/dist/opportunity/negotiation-evidence/negotiation-evidence.env.js +0 -1
  444. package/dist/opportunity/negotiation-evidence/negotiation-evidence.extractor.d.ts +0 -1
  445. package/dist/opportunity/negotiation-evidence/negotiation-evidence.extractor.js +0 -1
  446. package/dist/opportunity/negotiation-evidence/negotiation-evidence.miner.d.ts +0 -1
  447. package/dist/opportunity/negotiation-evidence/negotiation-evidence.miner.js +0 -1
  448. package/dist/opportunity/negotiation-evidence/negotiation-evidence.shadow.d.ts +0 -1
  449. package/dist/opportunity/negotiation-evidence/negotiation-evidence.shadow.js +0 -1
  450. package/dist/opportunity/negotiation-evidence/negotiation-evidence.types.d.ts +0 -1
  451. package/dist/opportunity/negotiation-evidence/negotiation-evidence.types.js +0 -1
  452. package/dist/opportunity/negotiation-evidence/negotiation-evidence.verifier.d.ts +0 -1
  453. package/dist/opportunity/negotiation-evidence/negotiation-evidence.verifier.js +0 -1
  454. package/dist/opportunity/negotiation-summary.builder.d.ts +3 -36
  455. package/dist/opportunity/negotiation-summary.builder.js +3 -65
  456. package/dist/opportunity/opportunity.actor.d.ts +3 -14
  457. package/dist/opportunity/opportunity.actor.js +3 -38
  458. package/dist/opportunity/opportunity.card-presentation.d.ts +5 -0
  459. package/dist/opportunity/opportunity.card-presentation.js +5 -0
  460. package/dist/opportunity/opportunity.claim-safety.d.ts +3 -23
  461. package/dist/opportunity/opportunity.claim-safety.js +3 -87
  462. package/dist/opportunity/opportunity.discover.d.ts +3 -218
  463. package/dist/opportunity/opportunity.discover.js +3 -917
  464. package/dist/opportunity/opportunity.discovery-continuation-finalization.d.ts +5 -0
  465. package/dist/opportunity/opportunity.discovery-continuation-finalization.js +5 -0
  466. package/dist/opportunity/opportunity.discovery-mcp-lifecycle-finalization.d.ts +5 -0
  467. package/dist/opportunity/opportunity.discovery-mcp-lifecycle-finalization.js +5 -0
  468. package/dist/opportunity/opportunity.discovery-negotiation-summary.d.ts +5 -0
  469. package/dist/opportunity/opportunity.discovery-negotiation-summary.js +5 -0
  470. package/dist/opportunity/opportunity.discovery-run-coalescing.d.ts +5 -0
  471. package/dist/opportunity/opportunity.discovery-run-coalescing.js +5 -0
  472. package/dist/opportunity/opportunity.discovery.contracts.d.ts +5 -0
  473. package/dist/opportunity/opportunity.discovery.contracts.js +5 -0
  474. package/dist/opportunity/opportunity.enricher.d.ts +3 -70
  475. package/dist/opportunity/opportunity.enricher.js +3 -279
  476. package/dist/opportunity/opportunity.evaluator.d.ts +5 -276
  477. package/dist/opportunity/opportunity.evaluator.js +5 -460
  478. package/dist/opportunity/opportunity.evidence.d.ts +5 -22
  479. package/dist/opportunity/opportunity.evidence.js +5 -79
  480. package/dist/opportunity/opportunity.existing-negotiation.d.ts +5 -0
  481. package/dist/opportunity/opportunity.existing-negotiation.js +5 -0
  482. package/dist/opportunity/opportunity.feed-selection.d.ts +5 -0
  483. package/dist/opportunity/opportunity.feed-selection.js +5 -0
  484. package/dist/opportunity/opportunity.graph.d.ts +3 -1489
  485. package/dist/opportunity/opportunity.graph.js +3 -4071
  486. package/dist/opportunity/opportunity.introducer.d.ts +3 -76
  487. package/dist/opportunity/opportunity.introducer.js +3 -98
  488. package/dist/opportunity/opportunity.labels.d.ts +5 -9
  489. package/dist/opportunity/opportunity.labels.js +5 -11
  490. package/dist/opportunity/opportunity.lifecycle.d.ts +5 -0
  491. package/dist/opportunity/opportunity.lifecycle.js +5 -0
  492. package/dist/opportunity/opportunity.newborn-stamping.d.ts +5 -0
  493. package/dist/opportunity/opportunity.newborn-stamping.js +5 -0
  494. package/dist/opportunity/opportunity.pending-questions.d.ts +3 -32
  495. package/dist/opportunity/opportunity.pending-questions.js +3 -41
  496. package/dist/opportunity/opportunity.persist.d.ts +3 -57
  497. package/dist/opportunity/opportunity.persist.js +3 -144
  498. package/dist/opportunity/opportunity.persistence-admission.d.ts +5 -0
  499. package/dist/opportunity/opportunity.persistence-admission.js +5 -0
  500. package/dist/opportunity/opportunity.presentation-cache.d.ts +5 -7
  501. package/dist/opportunity/opportunity.presentation-cache.js +5 -15
  502. package/dist/opportunity/opportunity.presentation.d.ts +3 -75
  503. package/dist/opportunity/opportunity.presentation.js +3 -515
  504. package/dist/opportunity/opportunity.presenter.d.ts +10 -155
  505. package/dist/opportunity/opportunity.presenter.js +10 -735
  506. package/dist/opportunity/opportunity.safe-presentation.d.ts +3 -103
  507. package/dist/opportunity/opportunity.safe-presentation.js +3 -101
  508. package/dist/opportunity/opportunity.state.d.ts +3 -518
  509. package/dist/opportunity/opportunity.state.js +3 -308
  510. package/dist/opportunity/opportunity.tools.d.ts +3 -157
  511. package/dist/opportunity/opportunity.tools.js +3 -2238
  512. package/dist/opportunity/opportunity.update-admission.d.ts +5 -0
  513. package/dist/opportunity/opportunity.update-admission.js +5 -0
  514. package/dist/opportunity/opportunity.utils.d.ts +3 -216
  515. package/dist/opportunity/opportunity.utils.js +3 -394
  516. package/dist/opportunity/outcome/outcome.env.d.ts +0 -1
  517. package/dist/opportunity/outcome/outcome.env.js +0 -1
  518. package/dist/opportunity/outcome/outcome.hypotheses.d.ts +0 -1
  519. package/dist/opportunity/outcome/outcome.hypotheses.js +0 -1
  520. package/dist/opportunity/outcome/outcome.shadow.d.ts +0 -1
  521. package/dist/opportunity/outcome/outcome.shadow.js +0 -1
  522. package/dist/opportunity/outcome/outcome.types.d.ts +0 -1
  523. package/dist/opportunity/outcome/outcome.types.js +0 -1
  524. package/dist/opportunity/ports/index.d.ts +5 -0
  525. package/dist/opportunity/ports/index.js +1 -0
  526. package/dist/opportunity/ports/opportunity.tools.port.d.ts +5 -0
  527. package/dist/opportunity/ports/opportunity.tools.port.js +1 -0
  528. package/dist/opportunity/public/index.d.ts +58 -0
  529. package/dist/opportunity/public/index.js +51 -0
  530. package/dist/participant-agents/application/agent.tools.d.ts +16 -0
  531. package/dist/participant-agents/application/agent.tools.js +313 -0
  532. package/dist/participant-agents/application/index.d.ts +21 -0
  533. package/dist/participant-agents/application/index.js +22 -0
  534. package/dist/participant-agents/domain/agent.types.d.ts +76 -0
  535. package/dist/participant-agents/domain/agent.types.js +22 -0
  536. package/dist/participant-agents/domain/index.d.ts +20 -0
  537. package/dist/participant-agents/domain/index.js +1 -0
  538. package/dist/participant-agents/index.d.ts +24 -0
  539. package/dist/participant-agents/index.js +24 -0
  540. package/dist/participant-agents/ports/agent.dispatcher.port.d.ts +25 -0
  541. package/dist/participant-agents/ports/agent.dispatcher.port.js +1 -0
  542. package/dist/participant-agents/ports/agent.repository.port.d.ts +118 -0
  543. package/dist/participant-agents/ports/agent.repository.port.js +10 -0
  544. package/dist/participant-agents/ports/agent.tools.port.d.ts +24 -0
  545. package/dist/participant-agents/ports/agent.tools.port.js +20 -0
  546. package/dist/participant-agents/ports/index.d.ts +29 -0
  547. package/dist/participant-agents/ports/index.js +27 -0
  548. package/dist/participant-agents/public/index.d.ts +39 -0
  549. package/dist/participant-agents/public/index.js +36 -0
  550. package/dist/participant-context/application/index.d.ts +73 -0
  551. package/dist/participant-context/application/index.js +83 -0
  552. package/dist/participant-context/domain/index.d.ts +67 -0
  553. package/dist/participant-context/domain/index.js +68 -0
  554. package/dist/participant-context/index.d.ts +16 -0
  555. package/dist/participant-context/index.js +16 -0
  556. package/dist/participant-context/ports/index.d.ts +37 -0
  557. package/dist/participant-context/ports/index.js +34 -0
  558. package/dist/participant-context/public/index.d.ts +48 -0
  559. package/dist/participant-context/public/index.js +55 -0
  560. package/dist/platform/index.d.ts +19 -0
  561. package/dist/platform/index.js +23 -0
  562. package/dist/premise/premise.analyzer.d.ts +0 -1
  563. package/dist/premise/premise.analyzer.js +0 -2
  564. package/dist/premise/premise.decomposer.d.ts +0 -1
  565. package/dist/premise/premise.decomposer.js +0 -2
  566. package/dist/premise/premise.graph.d.ts +1 -2
  567. package/dist/premise/premise.graph.js +0 -2
  568. package/dist/premise/premise.indexer.d.ts +0 -1
  569. package/dist/premise/premise.indexer.js +0 -2
  570. package/dist/premise/premise.state.d.ts +1 -2
  571. package/dist/premise/premise.state.js +0 -1
  572. package/dist/premise/premise.tools.d.ts +3 -3
  573. package/dist/premise/premise.tools.js +0 -2
  574. package/dist/public/index.d.ts +17 -0
  575. package/dist/public/index.js +17 -0
  576. package/dist/questioner/questioner.agent.d.ts +4 -27
  577. package/dist/questioner/questioner.agent.js +3 -133
  578. package/dist/questioner/questioner.ask.tool.d.ts +3 -12
  579. package/dist/questioner/questioner.ask.tool.js +3 -299
  580. package/dist/questioner/questioner.discovery.prompt.d.ts +3 -7
  581. package/dist/questioner/questioner.discovery.prompt.js +3 -180
  582. package/dist/questioner/questioner.env.d.ts +3 -57
  583. package/dist/questioner/questioner.env.js +3 -93
  584. package/dist/questioner/questioner.presets.d.ts +4 -19
  585. package/dist/questioner/questioner.presets.js +3 -465
  586. package/dist/questioner/questioner.qud.d.ts +3 -6
  587. package/dist/questioner/questioner.qud.js +3 -10
  588. package/dist/questioner/questioner.tools.d.ts +3 -15
  589. package/dist/questioner/questioner.tools.js +3 -186
  590. package/dist/questioner/questioner.types.d.ts +4 -218
  591. package/dist/questioner/questioner.types.js +5 -62
  592. package/dist/questions/application/index.d.ts +39 -0
  593. package/dist/questions/application/index.js +41 -0
  594. package/dist/questions/application/question.agent.d.ts +28 -0
  595. package/dist/questions/application/question.agent.js +139 -0
  596. package/dist/questions/application/question.ask.tool.d.ts +12 -0
  597. package/dist/questions/application/question.ask.tool.js +300 -0
  598. package/dist/questions/application/question.discovery.prompt.d.ts +8 -0
  599. package/dist/questions/application/question.discovery.prompt.js +181 -0
  600. package/dist/questions/application/question.env.d.ts +61 -0
  601. package/dist/questions/application/question.env.js +97 -0
  602. package/dist/questions/application/question.input.d.ts +237 -0
  603. package/dist/questions/application/question.input.js +61 -0
  604. package/dist/questions/application/question.presets.d.ts +24 -0
  605. package/dist/questions/application/question.presets.js +445 -0
  606. package/dist/questions/application/question.qud.d.ts +12 -0
  607. package/dist/questions/application/question.qud.js +16 -0
  608. package/dist/questions/application/question.tools.d.ts +15 -0
  609. package/dist/questions/application/question.tools.js +190 -0
  610. package/dist/questions/domain/index.d.ts +25 -0
  611. package/dist/questions/domain/index.js +25 -0
  612. package/dist/questions/domain/question.schema.d.ts +1537 -0
  613. package/dist/questions/domain/question.schema.js +422 -0
  614. package/dist/questions/index.d.ts +22 -0
  615. package/dist/questions/index.js +22 -0
  616. package/dist/questions/ports/index.d.ts +29 -0
  617. package/dist/questions/ports/index.js +27 -0
  618. package/dist/questions/ports/question.generator.port.d.ts +34 -0
  619. package/dist/questions/ports/question.generator.port.js +1 -0
  620. package/dist/questions/ports/question.persistence.port.d.ts +87 -0
  621. package/dist/questions/ports/question.persistence.port.js +1 -0
  622. package/dist/questions/ports/question.tools.port.d.ts +15 -0
  623. package/dist/questions/ports/question.tools.port.js +1 -0
  624. package/dist/questions/public/index.d.ts +47 -0
  625. package/dist/questions/public/index.js +49 -0
  626. package/dist/runtime/background/index.d.ts +14 -0
  627. package/dist/runtime/background/index.js +14 -0
  628. package/dist/runtime/foreground/composition/tool.factory.d.ts +16 -0
  629. package/dist/runtime/foreground/composition/tool.factory.js +224 -0
  630. package/dist/runtime/foreground/composition/tool.registry.d.ts +11 -0
  631. package/dist/runtime/foreground/composition/tool.registry.js +106 -0
  632. package/dist/runtime/foreground/index.d.ts +13 -0
  633. package/dist/runtime/foreground/index.js +13 -0
  634. package/dist/runtime/foreground/signals/intent.tools.d.ts +13 -0
  635. package/dist/runtime/foreground/signals/intent.tools.js +13 -0
  636. package/dist/shared/agent/model-signal.d.ts +0 -1
  637. package/dist/shared/agent/model-signal.js +0 -1
  638. package/dist/shared/agent/model.config.d.ts +0 -1
  639. package/dist/shared/agent/model.config.js +0 -1
  640. package/dist/shared/agent/tool.factory.d.ts +4 -15
  641. package/dist/shared/agent/tool.factory.js +4 -226
  642. package/dist/shared/agent/tool.helpers.d.ts +51 -12
  643. package/dist/shared/agent/tool.helpers.js +0 -1
  644. package/dist/shared/agent/tool.registry.d.ts +9 -9
  645. package/dist/shared/agent/tool.registry.js +9 -104
  646. package/dist/shared/agent/tool.runtime.d.ts +0 -1
  647. package/dist/shared/agent/tool.runtime.js +0 -1
  648. package/dist/shared/agent/tool.scope.d.ts +0 -1
  649. package/dist/shared/agent/tool.scope.js +0 -1
  650. package/dist/shared/agent/utility.tools.d.ts +5 -3
  651. package/dist/shared/agent/utility.tools.js +0 -1
  652. package/dist/shared/assignment/network-assignment.policy.d.ts +0 -1
  653. package/dist/shared/assignment/network-assignment.policy.js +0 -1
  654. package/dist/shared/hyde/hyde.documents.d.ts +0 -1
  655. package/dist/shared/hyde/hyde.documents.js +0 -1
  656. package/dist/shared/hyde/hyde.env.d.ts +0 -1
  657. package/dist/shared/hyde/hyde.env.js +0 -1
  658. package/dist/shared/hyde/hyde.frame.d.ts +4 -5
  659. package/dist/shared/hyde/hyde.frame.js +0 -1
  660. package/dist/shared/hyde/hyde.generator.d.ts +0 -1
  661. package/dist/shared/hyde/hyde.generator.js +0 -1
  662. package/dist/shared/hyde/hyde.graph.d.ts +0 -1
  663. package/dist/shared/hyde/hyde.graph.js +0 -1
  664. package/dist/shared/hyde/hyde.state.d.ts +0 -1
  665. package/dist/shared/hyde/hyde.state.js +0 -1
  666. package/dist/shared/hyde/hyde.strategies.d.ts +0 -1
  667. package/dist/shared/hyde/hyde.strategies.js +0 -1
  668. package/dist/shared/hyde/hyde.validator.d.ts +0 -1
  669. package/dist/shared/hyde/hyde.validator.js +0 -1
  670. package/dist/shared/hyde/lens.inferrer.d.ts +6 -7
  671. package/dist/shared/hyde/lens.inferrer.js +0 -1
  672. package/dist/shared/interfaces/agent-dispatcher.interface.d.ts +4 -1
  673. package/dist/shared/interfaces/agent-dispatcher.interface.js +4 -1
  674. package/dist/shared/interfaces/agent.interface.d.ts +13 -173
  675. package/dist/shared/interfaces/agent.interface.js +12 -12
  676. package/dist/shared/interfaces/auth.interface.d.ts +0 -1
  677. package/dist/shared/interfaces/auth.interface.js +0 -1
  678. package/dist/shared/interfaces/cache.interface.d.ts +0 -1
  679. package/dist/shared/interfaces/cache.interface.js +0 -1
  680. package/dist/shared/interfaces/chat-message-writer.interface.d.ts +0 -1
  681. package/dist/shared/interfaces/chat-message-writer.interface.js +0 -1
  682. package/dist/shared/interfaces/chat-session.interface.d.ts +0 -1
  683. package/dist/shared/interfaces/chat-session.interface.js +0 -1
  684. package/dist/shared/interfaces/chat-summary.interface.d.ts +0 -1
  685. package/dist/shared/interfaces/chat-summary.interface.js +0 -1
  686. package/dist/shared/interfaces/connect-link.interface.d.ts +0 -1
  687. package/dist/shared/interfaces/connect-link.interface.js +0 -1
  688. package/dist/shared/interfaces/contact.interface.d.ts +7 -55
  689. package/dist/shared/interfaces/contact.interface.js +7 -1
  690. package/dist/shared/interfaces/database.interface.d.ts +0 -1
  691. package/dist/shared/interfaces/database.interface.js +0 -1
  692. package/dist/shared/interfaces/delivery-ledger.interface.d.ts +0 -1
  693. package/dist/shared/interfaces/delivery-ledger.interface.js +0 -1
  694. package/dist/shared/interfaces/discovery-run.interface.d.ts +2 -3
  695. package/dist/shared/interfaces/discovery-run.interface.js +0 -1
  696. package/dist/shared/interfaces/embedder.interface.d.ts +0 -1
  697. package/dist/shared/interfaces/embedder.interface.js +0 -1
  698. package/dist/shared/interfaces/enrichment-run.interface.d.ts +2 -3
  699. package/dist/shared/interfaces/enrichment-run.interface.js +0 -1
  700. package/dist/shared/interfaces/enrichment.interface.d.ts +0 -1
  701. package/dist/shared/interfaces/enrichment.interface.js +0 -1
  702. package/dist/shared/interfaces/integration.interface.d.ts +6 -88
  703. package/dist/shared/interfaces/integration.interface.js +7 -1
  704. package/dist/shared/interfaces/negotiation-events.interface.d.ts +0 -1
  705. package/dist/shared/interfaces/negotiation-events.interface.js +0 -1
  706. package/dist/shared/interfaces/negotiation-summary.interface.d.ts +0 -1
  707. package/dist/shared/interfaces/negotiation-summary.interface.js +0 -1
  708. package/dist/shared/interfaces/negotiator-memory.interface.d.ts +0 -1
  709. package/dist/shared/interfaces/negotiator-memory.interface.js +0 -1
  710. package/dist/shared/interfaces/question-generator.interface.d.ts +3 -28
  711. package/dist/shared/interfaces/question-generator.interface.js +0 -1
  712. package/dist/shared/interfaces/questioner.interface.d.ts +3 -77
  713. package/dist/shared/interfaces/questioner.interface.js +0 -1
  714. package/dist/shared/interfaces/queue.interface.d.ts +0 -1
  715. package/dist/shared/interfaces/queue.interface.js +0 -1
  716. package/dist/shared/interfaces/scraper.interface.d.ts +0 -1
  717. package/dist/shared/interfaces/scraper.interface.js +0 -1
  718. package/dist/shared/interfaces/tool-request-context.interface.d.ts +12 -0
  719. package/dist/shared/interfaces/tool-request-context.interface.js +1 -0
  720. package/dist/shared/network/metadata.renderer.d.ts +0 -1
  721. package/dist/shared/network/metadata.renderer.js +0 -1
  722. package/dist/shared/observability/debug-meta.sanitizer.d.ts +0 -1
  723. package/dist/shared/observability/debug-meta.sanitizer.js +0 -1
  724. package/dist/shared/observability/log.d.ts +0 -1
  725. package/dist/shared/observability/log.js +0 -1
  726. package/dist/shared/observability/performance.d.ts +0 -1
  727. package/dist/shared/observability/performance.js +0 -1
  728. package/dist/shared/observability/protocol.logger.d.ts +0 -1
  729. package/dist/shared/observability/protocol.logger.js +0 -1
  730. package/dist/shared/observability/request-context.d.ts +0 -1
  731. package/dist/shared/observability/request-context.js +0 -1
  732. package/dist/shared/observability/trace.d.ts +0 -1
  733. package/dist/shared/observability/trace.js +0 -1
  734. package/dist/shared/schemas/chat-context.schema.d.ts +0 -1
  735. package/dist/shared/schemas/chat-context.schema.js +0 -1
  736. package/dist/shared/schemas/discovery-question.schema.d.ts +17 -18
  737. package/dist/shared/schemas/discovery-question.schema.js +0 -1
  738. package/dist/shared/schemas/identity.schema.d.ts +0 -1
  739. package/dist/shared/schemas/identity.schema.js +0 -1
  740. package/dist/shared/schemas/mcp-auth.schema.d.ts +0 -1
  741. package/dist/shared/schemas/mcp-auth.schema.js +0 -1
  742. package/dist/shared/schemas/negotiation-digest.schema.d.ts +5 -6
  743. package/dist/shared/schemas/negotiation-digest.schema.js +0 -1
  744. package/dist/shared/schemas/negotiation-state.schema.d.ts +4 -5
  745. package/dist/shared/schemas/negotiation-state.schema.js +0 -1
  746. package/dist/shared/schemas/network-assignment.schema.d.ts +0 -1
  747. package/dist/shared/schemas/network-assignment.schema.js +0 -1
  748. package/dist/shared/schemas/pending-question.schema.d.ts +0 -1
  749. package/dist/shared/schemas/pending-question.schema.js +0 -1
  750. package/dist/shared/schemas/question.schema.d.ts +3 -1505
  751. package/dist/shared/schemas/question.schema.js +3 -410
  752. package/dist/shared/ui/lucide.icon-catalog.d.ts +0 -1
  753. package/dist/shared/ui/lucide.icon-catalog.js +0 -1
  754. package/dist/shared/utils/social-label.d.ts +0 -1
  755. package/dist/shared/utils/social-label.js +0 -1
  756. package/dist/shared/utils/telegram-handle.d.ts +0 -1
  757. package/dist/shared/utils/telegram-handle.js +0 -1
  758. package/dist/signals/application/index.d.ts +19 -0
  759. package/dist/signals/application/index.js +22 -0
  760. package/dist/signals/application/intent.clarifier.d.ts +51 -0
  761. package/dist/signals/application/intent.clarifier.js +201 -0
  762. package/dist/signals/application/intent.graph.d.ts +552 -0
  763. package/dist/signals/application/intent.graph.js +938 -0
  764. package/dist/signals/application/intent.indexer.d.ts +82 -0
  765. package/dist/signals/application/intent.indexer.js +170 -0
  766. package/dist/signals/application/intent.inferrer.d.ts +94 -0
  767. package/dist/signals/application/intent.inferrer.js +233 -0
  768. package/dist/signals/application/intent.reconciler.d.ts +105 -0
  769. package/dist/signals/application/intent.reconciler.js +186 -0
  770. package/dist/signals/application/intent.tools.d.ts +24 -0
  771. package/dist/signals/application/intent.tools.js +789 -0
  772. package/dist/signals/application/intent.verifier.d.ts +115 -0
  773. package/dist/signals/application/intent.verifier.js +262 -0
  774. package/dist/signals/domain/index.d.ts +9 -0
  775. package/dist/signals/domain/index.js +11 -0
  776. package/dist/signals/domain/intent.state.d.ts +230 -0
  777. package/dist/signals/domain/intent.state.js +190 -0
  778. package/dist/signals/domain/signal.specificity.d.ts +2 -0
  779. package/dist/signals/domain/signal.specificity.js +2 -0
  780. package/dist/signals/index.d.ts +13 -0
  781. package/dist/signals/index.js +13 -0
  782. package/dist/signals/ports/index.d.ts +15 -0
  783. package/dist/signals/ports/index.js +13 -0
  784. package/dist/signals/public/index.d.ts +15 -0
  785. package/dist/signals/public/index.js +16 -0
  786. package/package.json +14 -3
  787. package/dist/agent/agent.tools.d.ts.map +0 -1
  788. package/dist/agent/agent.tools.js.map +0 -1
  789. package/dist/agent/tests/fakes.d.ts +0 -25
  790. package/dist/agent/tests/fakes.d.ts.map +0 -1
  791. package/dist/agent/tests/fakes.js +0 -178
  792. package/dist/agent/tests/fakes.js.map +0 -1
  793. package/dist/chat/chat-streaming.types.d.ts.map +0 -1
  794. package/dist/chat/chat-streaming.types.js.map +0 -1
  795. package/dist/chat/chat.agent.d.ts.map +0 -1
  796. package/dist/chat/chat.agent.js.map +0 -1
  797. package/dist/chat/chat.graph.d.ts.map +0 -1
  798. package/dist/chat/chat.graph.js.map +0 -1
  799. package/dist/chat/chat.interrupt.classifier.d.ts.map +0 -1
  800. package/dist/chat/chat.interrupt.classifier.js.map +0 -1
  801. package/dist/chat/chat.persona.d.ts.map +0 -1
  802. package/dist/chat/chat.persona.js.map +0 -1
  803. package/dist/chat/chat.prompt.d.ts.map +0 -1
  804. package/dist/chat/chat.prompt.js.map +0 -1
  805. package/dist/chat/chat.prompt.modules.d.ts.map +0 -1
  806. package/dist/chat/chat.prompt.modules.js.map +0 -1
  807. package/dist/chat/chat.question-dedup.d.ts.map +0 -1
  808. package/dist/chat/chat.question-dedup.js.map +0 -1
  809. package/dist/chat/chat.state.d.ts.map +0 -1
  810. package/dist/chat/chat.state.js.map +0 -1
  811. package/dist/chat/chat.streamer.d.ts.map +0 -1
  812. package/dist/chat/chat.streamer.js.map +0 -1
  813. package/dist/chat/chat.suggester.d.ts.map +0 -1
  814. package/dist/chat/chat.suggester.js.map +0 -1
  815. package/dist/chat/chat.summarizer.d.ts.map +0 -1
  816. package/dist/chat/chat.summarizer.js.map +0 -1
  817. package/dist/chat/chat.title.generator.d.ts.map +0 -1
  818. package/dist/chat/chat.title.generator.js.map +0 -1
  819. package/dist/chat/chat.tools.d.ts.map +0 -1
  820. package/dist/chat/chat.tools.js.map +0 -1
  821. package/dist/chat/chat.utils.d.ts.map +0 -1
  822. package/dist/chat/chat.utils.js.map +0 -1
  823. package/dist/chat/negotiator.persona.d.ts.map +0 -1
  824. package/dist/chat/negotiator.persona.js.map +0 -1
  825. package/dist/chat/negotiator.prompt.d.ts.map +0 -1
  826. package/dist/chat/negotiator.prompt.js.map +0 -1
  827. package/dist/chat/negotiator.tools.d.ts.map +0 -1
  828. package/dist/chat/negotiator.tools.js.map +0 -1
  829. package/dist/chat/onboarding.persona.d.ts.map +0 -1
  830. package/dist/chat/onboarding.persona.js.map +0 -1
  831. package/dist/chat/onboarding.prompt.d.ts.map +0 -1
  832. package/dist/chat/onboarding.prompt.js.map +0 -1
  833. package/dist/chat/reporter.action.tools.d.ts.map +0 -1
  834. package/dist/chat/reporter.action.tools.js.map +0 -1
  835. package/dist/chat/reporter.persona.d.ts.map +0 -1
  836. package/dist/chat/reporter.persona.js.map +0 -1
  837. package/dist/chat/reporter.prompt.d.ts.map +0 -1
  838. package/dist/chat/reporter.prompt.js.map +0 -1
  839. package/dist/chat/signal.persona.d.ts.map +0 -1
  840. package/dist/chat/signal.persona.js.map +0 -1
  841. package/dist/chat/signal.prompt.d.ts.map +0 -1
  842. package/dist/chat/signal.prompt.js.map +0 -1
  843. package/dist/chat/tests/chat.graph.mocks.d.ts +0 -98
  844. package/dist/chat/tests/chat.graph.mocks.d.ts.map +0 -1
  845. package/dist/chat/tests/chat.graph.mocks.js +0 -225
  846. package/dist/chat/tests/chat.graph.mocks.js.map +0 -1
  847. package/dist/contact/contact.inviter.d.ts.map +0 -1
  848. package/dist/contact/contact.inviter.js.map +0 -1
  849. package/dist/contact/contact.tools.d.ts.map +0 -1
  850. package/dist/contact/contact.tools.js.map +0 -1
  851. package/dist/context/context.generator.d.ts.map +0 -1
  852. package/dist/context/context.generator.js.map +0 -1
  853. package/dist/enrichment/enrichment.enricher.d.ts.map +0 -1
  854. package/dist/enrichment/enrichment.enricher.js.map +0 -1
  855. package/dist/enrichment/enrichment.generator.d.ts.map +0 -1
  856. package/dist/enrichment/enrichment.generator.js.map +0 -1
  857. package/dist/enrichment/enrichment.graph.d.ts.map +0 -1
  858. package/dist/enrichment/enrichment.graph.js.map +0 -1
  859. package/dist/enrichment/enrichment.state.d.ts.map +0 -1
  860. package/dist/enrichment/enrichment.state.js.map +0 -1
  861. package/dist/enrichment/enrichment.tools.d.ts.map +0 -1
  862. package/dist/enrichment/enrichment.tools.js.map +0 -1
  863. package/dist/index.d.ts.map +0 -1
  864. package/dist/index.js.map +0 -1
  865. package/dist/integration/integration.tools.d.ts.map +0 -1
  866. package/dist/integration/integration.tools.js.map +0 -1
  867. package/dist/intent/intent.clarifier.d.ts.map +0 -1
  868. package/dist/intent/intent.clarifier.js.map +0 -1
  869. package/dist/intent/intent.graph.d.ts.map +0 -1
  870. package/dist/intent/intent.graph.js.map +0 -1
  871. package/dist/intent/intent.indexer.d.ts.map +0 -1
  872. package/dist/intent/intent.indexer.js.map +0 -1
  873. package/dist/intent/intent.inferrer.d.ts.map +0 -1
  874. package/dist/intent/intent.inferrer.js.map +0 -1
  875. package/dist/intent/intent.reconciler.d.ts.map +0 -1
  876. package/dist/intent/intent.reconciler.js.map +0 -1
  877. package/dist/intent/intent.specificity.d.ts.map +0 -1
  878. package/dist/intent/intent.specificity.js.map +0 -1
  879. package/dist/intent/intent.state.d.ts.map +0 -1
  880. package/dist/intent/intent.state.js.map +0 -1
  881. package/dist/intent/intent.tools.d.ts.map +0 -1
  882. package/dist/intent/intent.tools.js.map +0 -1
  883. package/dist/intent/intent.verifier.d.ts.map +0 -1
  884. package/dist/intent/intent.verifier.js.map +0 -1
  885. package/dist/maintenance/maintenance.graph.d.ts.map +0 -1
  886. package/dist/maintenance/maintenance.graph.js.map +0 -1
  887. package/dist/maintenance/maintenance.state.d.ts.map +0 -1
  888. package/dist/maintenance/maintenance.state.js.map +0 -1
  889. package/dist/mcp/elicitation.builder.d.ts.map +0 -1
  890. package/dist/mcp/elicitation.builder.js.map +0 -1
  891. package/dist/mcp/elicitation.dispatcher.d.ts.map +0 -1
  892. package/dist/mcp/elicitation.dispatcher.js.map +0 -1
  893. package/dist/mcp/mcp.server.d.ts.map +0 -1
  894. package/dist/mcp/mcp.server.js.map +0 -1
  895. package/dist/negotiation/insight.generator.d.ts.map +0 -1
  896. package/dist/negotiation/insight.generator.js.map +0 -1
  897. package/dist/negotiation/negotiation.agent.d.ts.map +0 -1
  898. package/dist/negotiation/negotiation.agent.js.map +0 -1
  899. package/dist/negotiation/negotiation.attribution.d.ts.map +0 -1
  900. package/dist/negotiation/negotiation.attribution.js.map +0 -1
  901. package/dist/negotiation/negotiation.consultation-policy.d.ts.map +0 -1
  902. package/dist/negotiation/negotiation.consultation-policy.js.map +0 -1
  903. package/dist/negotiation/negotiation.deadlock.d.ts.map +0 -1
  904. package/dist/negotiation/negotiation.deadlock.js.map +0 -1
  905. package/dist/negotiation/negotiation.graph.d.ts.map +0 -1
  906. package/dist/negotiation/negotiation.graph.js.map +0 -1
  907. package/dist/negotiation/negotiation.memory.d.ts.map +0 -1
  908. package/dist/negotiation/negotiation.memory.js.map +0 -1
  909. package/dist/negotiation/negotiation.protocol.d.ts.map +0 -1
  910. package/dist/negotiation/negotiation.protocol.js.map +0 -1
  911. package/dist/negotiation/negotiation.question-safety.d.ts.map +0 -1
  912. package/dist/negotiation/negotiation.question-safety.js.map +0 -1
  913. package/dist/negotiation/negotiation.reflect.d.ts.map +0 -1
  914. package/dist/negotiation/negotiation.reflect.js.map +0 -1
  915. package/dist/negotiation/negotiation.screen.d.ts.map +0 -1
  916. package/dist/negotiation/negotiation.screen.js.map +0 -1
  917. package/dist/negotiation/negotiation.state.d.ts.map +0 -1
  918. package/dist/negotiation/negotiation.state.js.map +0 -1
  919. package/dist/negotiation/negotiation.summarizer.d.ts.map +0 -1
  920. package/dist/negotiation/negotiation.summarizer.js.map +0 -1
  921. package/dist/negotiation/negotiation.tools.d.ts.map +0 -1
  922. package/dist/negotiation/negotiation.tools.js.map +0 -1
  923. package/dist/network/indexer/indexer.graph.d.ts.map +0 -1
  924. package/dist/network/indexer/indexer.graph.js.map +0 -1
  925. package/dist/network/indexer/indexer.state.d.ts.map +0 -1
  926. package/dist/network/indexer/indexer.state.js.map +0 -1
  927. package/dist/network/membership/membership.graph.d.ts.map +0 -1
  928. package/dist/network/membership/membership.graph.js.map +0 -1
  929. package/dist/network/membership/membership.state.d.ts.map +0 -1
  930. package/dist/network/membership/membership.state.js.map +0 -1
  931. package/dist/network/network.graph.d.ts.map +0 -1
  932. package/dist/network/network.graph.js.map +0 -1
  933. package/dist/network/network.recommender.d.ts.map +0 -1
  934. package/dist/network/network.recommender.js.map +0 -1
  935. package/dist/network/network.state.d.ts.map +0 -1
  936. package/dist/network/network.state.js.map +0 -1
  937. package/dist/network/network.tools.d.ts.map +0 -1
  938. package/dist/network/network.tools.js.map +0 -1
  939. package/dist/opportunity/delivery-card.cache.d.ts.map +0 -1
  940. package/dist/opportunity/delivery-card.cache.js.map +0 -1
  941. package/dist/opportunity/discovery-question.helper.d.ts.map +0 -1
  942. package/dist/opportunity/discovery-question.helper.js.map +0 -1
  943. package/dist/opportunity/discriminator/discriminator.adjustments.d.ts.map +0 -1
  944. package/dist/opportunity/discriminator/discriminator.adjustments.js.map +0 -1
  945. package/dist/opportunity/discriminator/discriminator.assigner.d.ts.map +0 -1
  946. package/dist/opportunity/discriminator/discriminator.assigner.js.map +0 -1
  947. package/dist/opportunity/discriminator/discriminator.env.d.ts.map +0 -1
  948. package/dist/opportunity/discriminator/discriminator.env.js.map +0 -1
  949. package/dist/opportunity/discriminator/discriminator.miner.d.ts.map +0 -1
  950. package/dist/opportunity/discriminator/discriminator.miner.js.map +0 -1
  951. package/dist/opportunity/discriminator/discriminator.push.d.ts.map +0 -1
  952. package/dist/opportunity/discriminator/discriminator.push.js.map +0 -1
  953. package/dist/opportunity/discriminator/discriminator.question.d.ts.map +0 -1
  954. package/dist/opportunity/discriminator/discriminator.question.js.map +0 -1
  955. package/dist/opportunity/discriminator/discriminator.scorer.d.ts.map +0 -1
  956. package/dist/opportunity/discriminator/discriminator.scorer.js.map +0 -1
  957. package/dist/opportunity/discriminator/discriminator.shadow.d.ts.map +0 -1
  958. package/dist/opportunity/discriminator/discriminator.shadow.js.map +0 -1
  959. package/dist/opportunity/discriminator/discriminator.types.d.ts.map +0 -1
  960. package/dist/opportunity/discriminator/discriminator.types.js.map +0 -1
  961. package/dist/opportunity/feed/feed.categorizer.d.ts.map +0 -1
  962. package/dist/opportunity/feed/feed.categorizer.js.map +0 -1
  963. package/dist/opportunity/feed/feed.graph.d.ts.map +0 -1
  964. package/dist/opportunity/feed/feed.graph.js.map +0 -1
  965. package/dist/opportunity/feed/feed.health.d.ts.map +0 -1
  966. package/dist/opportunity/feed/feed.health.js.map +0 -1
  967. package/dist/opportunity/feed/feed.state.d.ts.map +0 -1
  968. package/dist/opportunity/feed/feed.state.js.map +0 -1
  969. package/dist/opportunity/negotiation-context.loader.d.ts.map +0 -1
  970. package/dist/opportunity/negotiation-context.loader.js.map +0 -1
  971. package/dist/opportunity/negotiation-evidence/negotiation-evidence.env.d.ts.map +0 -1
  972. package/dist/opportunity/negotiation-evidence/negotiation-evidence.env.js.map +0 -1
  973. package/dist/opportunity/negotiation-evidence/negotiation-evidence.extractor.d.ts.map +0 -1
  974. package/dist/opportunity/negotiation-evidence/negotiation-evidence.extractor.js.map +0 -1
  975. package/dist/opportunity/negotiation-evidence/negotiation-evidence.miner.d.ts.map +0 -1
  976. package/dist/opportunity/negotiation-evidence/negotiation-evidence.miner.js.map +0 -1
  977. package/dist/opportunity/negotiation-evidence/negotiation-evidence.shadow.d.ts.map +0 -1
  978. package/dist/opportunity/negotiation-evidence/negotiation-evidence.shadow.js.map +0 -1
  979. package/dist/opportunity/negotiation-evidence/negotiation-evidence.types.d.ts.map +0 -1
  980. package/dist/opportunity/negotiation-evidence/negotiation-evidence.types.js.map +0 -1
  981. package/dist/opportunity/negotiation-evidence/negotiation-evidence.verifier.d.ts.map +0 -1
  982. package/dist/opportunity/negotiation-evidence/negotiation-evidence.verifier.js.map +0 -1
  983. package/dist/opportunity/negotiation-summary.builder.d.ts.map +0 -1
  984. package/dist/opportunity/negotiation-summary.builder.js.map +0 -1
  985. package/dist/opportunity/opportunity.actor.d.ts.map +0 -1
  986. package/dist/opportunity/opportunity.actor.js.map +0 -1
  987. package/dist/opportunity/opportunity.claim-safety.d.ts.map +0 -1
  988. package/dist/opportunity/opportunity.claim-safety.js.map +0 -1
  989. package/dist/opportunity/opportunity.discover.d.ts.map +0 -1
  990. package/dist/opportunity/opportunity.discover.js.map +0 -1
  991. package/dist/opportunity/opportunity.enricher.d.ts.map +0 -1
  992. package/dist/opportunity/opportunity.enricher.js.map +0 -1
  993. package/dist/opportunity/opportunity.evaluator.d.ts.map +0 -1
  994. package/dist/opportunity/opportunity.evaluator.js.map +0 -1
  995. package/dist/opportunity/opportunity.evidence.d.ts.map +0 -1
  996. package/dist/opportunity/opportunity.evidence.js.map +0 -1
  997. package/dist/opportunity/opportunity.graph.d.ts.map +0 -1
  998. package/dist/opportunity/opportunity.graph.js.map +0 -1
  999. package/dist/opportunity/opportunity.introducer.d.ts.map +0 -1
  1000. package/dist/opportunity/opportunity.introducer.js.map +0 -1
  1001. package/dist/opportunity/opportunity.labels.d.ts.map +0 -1
  1002. package/dist/opportunity/opportunity.labels.js.map +0 -1
  1003. package/dist/opportunity/opportunity.pending-questions.d.ts.map +0 -1
  1004. package/dist/opportunity/opportunity.pending-questions.js.map +0 -1
  1005. package/dist/opportunity/opportunity.persist.d.ts.map +0 -1
  1006. package/dist/opportunity/opportunity.persist.js.map +0 -1
  1007. package/dist/opportunity/opportunity.presentation-cache.d.ts.map +0 -1
  1008. package/dist/opportunity/opportunity.presentation-cache.js.map +0 -1
  1009. package/dist/opportunity/opportunity.presentation.d.ts.map +0 -1
  1010. package/dist/opportunity/opportunity.presentation.js.map +0 -1
  1011. package/dist/opportunity/opportunity.presenter.d.ts.map +0 -1
  1012. package/dist/opportunity/opportunity.presenter.js.map +0 -1
  1013. package/dist/opportunity/opportunity.safe-presentation.d.ts.map +0 -1
  1014. package/dist/opportunity/opportunity.safe-presentation.js.map +0 -1
  1015. package/dist/opportunity/opportunity.state.d.ts.map +0 -1
  1016. package/dist/opportunity/opportunity.state.js.map +0 -1
  1017. package/dist/opportunity/opportunity.tools.d.ts.map +0 -1
  1018. package/dist/opportunity/opportunity.tools.js.map +0 -1
  1019. package/dist/opportunity/opportunity.utils.d.ts.map +0 -1
  1020. package/dist/opportunity/opportunity.utils.js.map +0 -1
  1021. package/dist/opportunity/outcome/outcome.env.d.ts.map +0 -1
  1022. package/dist/opportunity/outcome/outcome.env.js.map +0 -1
  1023. package/dist/opportunity/outcome/outcome.hypotheses.d.ts.map +0 -1
  1024. package/dist/opportunity/outcome/outcome.hypotheses.js.map +0 -1
  1025. package/dist/opportunity/outcome/outcome.shadow.d.ts.map +0 -1
  1026. package/dist/opportunity/outcome/outcome.shadow.js.map +0 -1
  1027. package/dist/opportunity/outcome/outcome.types.d.ts.map +0 -1
  1028. package/dist/opportunity/outcome/outcome.types.js.map +0 -1
  1029. package/dist/premise/premise.analyzer.d.ts.map +0 -1
  1030. package/dist/premise/premise.analyzer.js.map +0 -1
  1031. package/dist/premise/premise.decomposer.d.ts.map +0 -1
  1032. package/dist/premise/premise.decomposer.js.map +0 -1
  1033. package/dist/premise/premise.graph.d.ts.map +0 -1
  1034. package/dist/premise/premise.graph.js.map +0 -1
  1035. package/dist/premise/premise.indexer.d.ts.map +0 -1
  1036. package/dist/premise/premise.indexer.js.map +0 -1
  1037. package/dist/premise/premise.state.d.ts.map +0 -1
  1038. package/dist/premise/premise.state.js.map +0 -1
  1039. package/dist/premise/premise.tools.d.ts.map +0 -1
  1040. package/dist/premise/premise.tools.js.map +0 -1
  1041. package/dist/questioner/questioner.agent.d.ts.map +0 -1
  1042. package/dist/questioner/questioner.agent.js.map +0 -1
  1043. package/dist/questioner/questioner.ask.tool.d.ts.map +0 -1
  1044. package/dist/questioner/questioner.ask.tool.js.map +0 -1
  1045. package/dist/questioner/questioner.discovery.prompt.d.ts.map +0 -1
  1046. package/dist/questioner/questioner.discovery.prompt.js.map +0 -1
  1047. package/dist/questioner/questioner.env.d.ts.map +0 -1
  1048. package/dist/questioner/questioner.env.js.map +0 -1
  1049. package/dist/questioner/questioner.presets.d.ts.map +0 -1
  1050. package/dist/questioner/questioner.presets.js.map +0 -1
  1051. package/dist/questioner/questioner.qud.d.ts.map +0 -1
  1052. package/dist/questioner/questioner.qud.js.map +0 -1
  1053. package/dist/questioner/questioner.tools.d.ts.map +0 -1
  1054. package/dist/questioner/questioner.tools.js.map +0 -1
  1055. package/dist/questioner/questioner.types.d.ts.map +0 -1
  1056. package/dist/questioner/questioner.types.js.map +0 -1
  1057. package/dist/shared/agent/model-signal.d.ts.map +0 -1
  1058. package/dist/shared/agent/model-signal.js.map +0 -1
  1059. package/dist/shared/agent/model.config.d.ts.map +0 -1
  1060. package/dist/shared/agent/model.config.js.map +0 -1
  1061. package/dist/shared/agent/tests/llm-assert.d.ts +0 -11
  1062. package/dist/shared/agent/tests/llm-assert.d.ts.map +0 -1
  1063. package/dist/shared/agent/tests/llm-assert.js +0 -43
  1064. package/dist/shared/agent/tests/llm-assert.js.map +0 -1
  1065. package/dist/shared/agent/tool.factory.d.ts.map +0 -1
  1066. package/dist/shared/agent/tool.factory.js.map +0 -1
  1067. package/dist/shared/agent/tool.helpers.d.ts.map +0 -1
  1068. package/dist/shared/agent/tool.helpers.js.map +0 -1
  1069. package/dist/shared/agent/tool.registry.d.ts.map +0 -1
  1070. package/dist/shared/agent/tool.registry.js.map +0 -1
  1071. package/dist/shared/agent/tool.runtime.d.ts.map +0 -1
  1072. package/dist/shared/agent/tool.runtime.js.map +0 -1
  1073. package/dist/shared/agent/tool.scope.d.ts.map +0 -1
  1074. package/dist/shared/agent/tool.scope.js.map +0 -1
  1075. package/dist/shared/agent/utility.tools.d.ts.map +0 -1
  1076. package/dist/shared/agent/utility.tools.js.map +0 -1
  1077. package/dist/shared/assignment/network-assignment.policy.d.ts.map +0 -1
  1078. package/dist/shared/assignment/network-assignment.policy.js.map +0 -1
  1079. package/dist/shared/hyde/hyde.documents.d.ts.map +0 -1
  1080. package/dist/shared/hyde/hyde.documents.js.map +0 -1
  1081. package/dist/shared/hyde/hyde.env.d.ts.map +0 -1
  1082. package/dist/shared/hyde/hyde.env.js.map +0 -1
  1083. package/dist/shared/hyde/hyde.frame.d.ts.map +0 -1
  1084. package/dist/shared/hyde/hyde.frame.js.map +0 -1
  1085. package/dist/shared/hyde/hyde.generator.d.ts.map +0 -1
  1086. package/dist/shared/hyde/hyde.generator.js.map +0 -1
  1087. package/dist/shared/hyde/hyde.graph.d.ts.map +0 -1
  1088. package/dist/shared/hyde/hyde.graph.js.map +0 -1
  1089. package/dist/shared/hyde/hyde.state.d.ts.map +0 -1
  1090. package/dist/shared/hyde/hyde.state.js.map +0 -1
  1091. package/dist/shared/hyde/hyde.strategies.d.ts.map +0 -1
  1092. package/dist/shared/hyde/hyde.strategies.js.map +0 -1
  1093. package/dist/shared/hyde/hyde.validator.d.ts.map +0 -1
  1094. package/dist/shared/hyde/hyde.validator.js.map +0 -1
  1095. package/dist/shared/hyde/lens.inferrer.d.ts.map +0 -1
  1096. package/dist/shared/hyde/lens.inferrer.js.map +0 -1
  1097. package/dist/shared/interfaces/agent-dispatcher.interface.d.ts.map +0 -1
  1098. package/dist/shared/interfaces/agent-dispatcher.interface.js.map +0 -1
  1099. package/dist/shared/interfaces/agent.interface.d.ts.map +0 -1
  1100. package/dist/shared/interfaces/agent.interface.js.map +0 -1
  1101. package/dist/shared/interfaces/auth.interface.d.ts.map +0 -1
  1102. package/dist/shared/interfaces/auth.interface.js.map +0 -1
  1103. package/dist/shared/interfaces/cache.interface.d.ts.map +0 -1
  1104. package/dist/shared/interfaces/cache.interface.js.map +0 -1
  1105. package/dist/shared/interfaces/chat-message-writer.interface.d.ts.map +0 -1
  1106. package/dist/shared/interfaces/chat-message-writer.interface.js.map +0 -1
  1107. package/dist/shared/interfaces/chat-session.interface.d.ts.map +0 -1
  1108. package/dist/shared/interfaces/chat-session.interface.js.map +0 -1
  1109. package/dist/shared/interfaces/chat-summary.interface.d.ts.map +0 -1
  1110. package/dist/shared/interfaces/chat-summary.interface.js.map +0 -1
  1111. package/dist/shared/interfaces/connect-link.interface.d.ts.map +0 -1
  1112. package/dist/shared/interfaces/connect-link.interface.js.map +0 -1
  1113. package/dist/shared/interfaces/contact.interface.d.ts.map +0 -1
  1114. package/dist/shared/interfaces/contact.interface.js.map +0 -1
  1115. package/dist/shared/interfaces/database.interface.d.ts.map +0 -1
  1116. package/dist/shared/interfaces/database.interface.js.map +0 -1
  1117. package/dist/shared/interfaces/delivery-ledger.interface.d.ts.map +0 -1
  1118. package/dist/shared/interfaces/delivery-ledger.interface.js.map +0 -1
  1119. package/dist/shared/interfaces/discovery-run.interface.d.ts.map +0 -1
  1120. package/dist/shared/interfaces/discovery-run.interface.js.map +0 -1
  1121. package/dist/shared/interfaces/embedder.interface.d.ts.map +0 -1
  1122. package/dist/shared/interfaces/embedder.interface.js.map +0 -1
  1123. package/dist/shared/interfaces/enrichment-run.interface.d.ts.map +0 -1
  1124. package/dist/shared/interfaces/enrichment-run.interface.js.map +0 -1
  1125. package/dist/shared/interfaces/enrichment.interface.d.ts.map +0 -1
  1126. package/dist/shared/interfaces/enrichment.interface.js.map +0 -1
  1127. package/dist/shared/interfaces/integration.interface.d.ts.map +0 -1
  1128. package/dist/shared/interfaces/integration.interface.js.map +0 -1
  1129. package/dist/shared/interfaces/negotiation-events.interface.d.ts.map +0 -1
  1130. package/dist/shared/interfaces/negotiation-events.interface.js.map +0 -1
  1131. package/dist/shared/interfaces/negotiation-summary.interface.d.ts.map +0 -1
  1132. package/dist/shared/interfaces/negotiation-summary.interface.js.map +0 -1
  1133. package/dist/shared/interfaces/negotiator-memory.interface.d.ts.map +0 -1
  1134. package/dist/shared/interfaces/negotiator-memory.interface.js.map +0 -1
  1135. package/dist/shared/interfaces/question-generator.interface.d.ts.map +0 -1
  1136. package/dist/shared/interfaces/question-generator.interface.js.map +0 -1
  1137. package/dist/shared/interfaces/questioner.interface.d.ts.map +0 -1
  1138. package/dist/shared/interfaces/questioner.interface.js.map +0 -1
  1139. package/dist/shared/interfaces/queue.interface.d.ts.map +0 -1
  1140. package/dist/shared/interfaces/queue.interface.js.map +0 -1
  1141. package/dist/shared/interfaces/scraper.interface.d.ts.map +0 -1
  1142. package/dist/shared/interfaces/scraper.interface.js.map +0 -1
  1143. package/dist/shared/network/metadata.renderer.d.ts.map +0 -1
  1144. package/dist/shared/network/metadata.renderer.js.map +0 -1
  1145. package/dist/shared/observability/debug-meta.sanitizer.d.ts.map +0 -1
  1146. package/dist/shared/observability/debug-meta.sanitizer.js.map +0 -1
  1147. package/dist/shared/observability/log.d.ts.map +0 -1
  1148. package/dist/shared/observability/log.js.map +0 -1
  1149. package/dist/shared/observability/performance.d.ts.map +0 -1
  1150. package/dist/shared/observability/performance.js.map +0 -1
  1151. package/dist/shared/observability/protocol.logger.d.ts.map +0 -1
  1152. package/dist/shared/observability/protocol.logger.js.map +0 -1
  1153. package/dist/shared/observability/request-context.d.ts.map +0 -1
  1154. package/dist/shared/observability/request-context.js.map +0 -1
  1155. package/dist/shared/observability/trace.d.ts.map +0 -1
  1156. package/dist/shared/observability/trace.js.map +0 -1
  1157. package/dist/shared/schemas/chat-context.schema.d.ts.map +0 -1
  1158. package/dist/shared/schemas/chat-context.schema.js.map +0 -1
  1159. package/dist/shared/schemas/discovery-question.schema.d.ts.map +0 -1
  1160. package/dist/shared/schemas/discovery-question.schema.js.map +0 -1
  1161. package/dist/shared/schemas/identity.schema.d.ts.map +0 -1
  1162. package/dist/shared/schemas/identity.schema.js.map +0 -1
  1163. package/dist/shared/schemas/mcp-auth.schema.d.ts.map +0 -1
  1164. package/dist/shared/schemas/mcp-auth.schema.js.map +0 -1
  1165. package/dist/shared/schemas/negotiation-digest.schema.d.ts.map +0 -1
  1166. package/dist/shared/schemas/negotiation-digest.schema.js.map +0 -1
  1167. package/dist/shared/schemas/negotiation-state.schema.d.ts.map +0 -1
  1168. package/dist/shared/schemas/negotiation-state.schema.js.map +0 -1
  1169. package/dist/shared/schemas/network-assignment.schema.d.ts.map +0 -1
  1170. package/dist/shared/schemas/network-assignment.schema.js.map +0 -1
  1171. package/dist/shared/schemas/pending-question.schema.d.ts.map +0 -1
  1172. package/dist/shared/schemas/pending-question.schema.js.map +0 -1
  1173. package/dist/shared/schemas/question.schema.d.ts.map +0 -1
  1174. package/dist/shared/schemas/question.schema.js.map +0 -1
  1175. package/dist/shared/ui/lucide.icon-catalog.d.ts.map +0 -1
  1176. package/dist/shared/ui/lucide.icon-catalog.js.map +0 -1
  1177. package/dist/shared/utils/social-label.d.ts.map +0 -1
  1178. package/dist/shared/utils/social-label.js.map +0 -1
  1179. package/dist/shared/utils/telegram-handle.d.ts.map +0 -1
  1180. package/dist/shared/utils/telegram-handle.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"opportunity.discover.js","sourceRoot":"/","sources":["opportunity/opportunity.discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAE3G,OAAO,EAAwB,sBAAsB,EAA4H,MAAM,4BAA4B,CAAC;AACpN,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACrH,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,C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BAAiB,EAAE,KAAK,CAAC,iBAAiB;QAC1C,UAAU;QACV,uBAAuB,EAAE,IAAI;KAC9B,CAAC,CAAC;IAEH,OAAO;QACL,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,QAAQ,CAAC,MAAM;QACtB,aAAa,EAAE,QAAQ;QACvB,UAAU;QACV,UAAU;KACX,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Run discovery from an ad-hoc query (e.g. chat \"find me a mentor\", \"who needs a React developer\").\n *\n * Invokes the opportunity graph with the query as sourceText. The HyDE graph's\n * LensInferrer automatically infers search lenses from the query, replacing the\n * old hardcoded strategy selection. Returns formatted candidates (enriched with\n * profile name/bio) for chat display.\n *\n * Used by the discover_opportunities chat tool.\n */\n\nimport type { Opportunity, ChatGraphCompositeDatabase, UserRecord } from \"../shared/interfaces/database.interface.js\";\nimport type { Cache } from \"../shared/interfaces/cache.interface.js\";\nimport type { OpportunityGraphOptions, CandidateMatch, SourceProfileData } from \"./opportunity.state.js\";\nimport type { DiscoveryNegotiation, DiscoverySummary } from \"../shared/schemas/discovery-question.schema.js\";\nimport type { QuestionerEnqueueFn } from \"../questioner/questioner.types.js\";\nimport { discoveryQuestionsInputMode, discoveryQuestionsTimeoutMs } from \"../questioner/questioner.env.js\";\nimport type { ToolScopeType } from \"../shared/agent/tool.scope.js\";\nimport { OpportunityPresenter, gatherPresenterContext, type OpportunityPresentationResult, type HomeCardPresentationResult, type HomeCardLLMResult, type HomeCardPresenterInput } from \"./opportunity.presenter.js\";\nimport { MINIMAL_MAIN_TEXT_MAX_CHARS, getPrimaryActionLabel, SECONDARY_ACTION_LABEL } from \"./opportunity.labels.js\";\nimport { narratorRemarkFromReasoning } from \"./opportunity.presentation.js\";\nimport { safeFallbackSummary } from \"./opportunity.safe-presentation.js\";\nimport { protocolLogger, withCallLogging } from \"../shared/observability/protocol.logger.js\";\nimport type { ChatSummaryReader } from \"../shared/interfaces/chat-summary.interface.js\";\nimport type { ChatContextDigest } from \"../shared/schemas/chat-context.schema.js\";\nimport type { QuestionGeneratorReader } from \"../shared/interfaces/question-generator.interface.js\";\nimport type { NegotiationSummaryReader } from \"../shared/interfaces/negotiation-summary.interface.js\";\nimport type { DiscoveryNegotiationDigest } from \"../shared/schemas/negotiation-digest.schema.js\";\nimport { buildFallbackDigest } from \"../negotiation/negotiation.summarizer.js\";\nimport type { Question, QuestionStrategy } from \"../shared/schemas/question.schema.js\";\nimport { traceAgent, tracePhase } from \"../shared/observability/trace.js\";\nimport { requestContext } from \"../shared/observability/request-context.js\";\nimport { buildDiscoveryQuestionInput } from \"./discovery-question.helper.js\";\nimport { invokeWithAbortSignal } from \"../shared/agent/model-signal.js\";\n\nconst logger = protocolLogger(\"OpportunityDiscover\");\nconst discoverFromQueryLog = protocolLogger(\"OpportunityDiscover:runDiscoverFromQuery\");\nconst enrichLog = protocolLogger(\"OpportunityDiscover:enrichOpportunities\");\n\n/**\n * Per-negotiation summarizer budget. The summarizer fires one LLM call per\n * partial-or-full negotiation (concurrently via Promise.all). Without a cap\n * one slow OpenRouter route dominates the post-discovery tail and pushes the\n * whole MCP response past Railway's ~60 s no-upstream-bytes timeout. Falls\n * back to a deterministic digest when the deadline fires, so question\n * generation still has structured input.\n */\nconst NEGOTIATION_SUMMARY_TIMEOUT_MS_DEFAULT = 5_000;\n\n/**\n * Parse a positive integer env var, clamped to the safe-integer range so a\n * malformed env value cannot crash `AbortSignal.timeout` (which throws on\n * values outside `[0, MAX_SAFE_INTEGER]`). Mirrors the precedent in\n * `negotiation.agent.ts` (`isValidTimeoutMs`).\n */\nfunction parsePositiveIntEnv(name: string, fallback: number): number {\n const raw = process.env[name];\n if (!raw) return fallback;\n const n = Number.parseInt(raw, 10);\n if (!Number.isFinite(n) || n <= 0 || n > Number.MAX_SAFE_INTEGER) return fallback;\n return n;\n}\n\nfunction combineWithDeadline(\n callerSignal: AbortSignal | undefined,\n deadlineMs: number,\n): AbortSignal {\n const deadline = AbortSignal.timeout(deadlineMs);\n if (!callerSignal) return deadline;\n return AbortSignal.any([callerSignal, deadline]);\n}\n\n/** Compiled opportunity graph (from OpportunityGraphFactory.createGraph()). */\nexport type CompiledOpportunityGraph = ReturnType<\n import(\"./opportunity.graph.js\").OpportunityGraphFactory[\"createGraph\"]\n>;\n\nexport interface DiscoverInput {\n /** Compiled opportunity graph (already has DB, embedder, cache, HyDE graph). */\n opportunityGraph: CompiledOpportunityGraph;\n /** Database for enriching candidates with profile (getProfile). */\n database: ChatGraphCompositeDatabase;\n userId: string;\n query: string;\n indexScope: string[];\n limit?: number;\n /** Optional intent to use as discovery source and for triggeredBy (e.g. from opportunity queue). */\n triggerIntentId?: string;\n /** When set, filter discovery candidates to this specific user only (direct connection). */\n targetUserId?: string;\n /** When set, discover on behalf of this user (introducer flow). The caller (userId) becomes the introducer. */\n onBehalfOfUserId?: string;\n /** When provided, each opportunity is enriched with personalized presentation (headline, personalizedSummary, suggestedAction). */\n presenter?: OpportunityPresenter;\n /**\n * When true, use the full home card presentation format (with narratorRemark, action labels, mutualIntentsLabel).\n * This enables rendering the same rich opportunity cards in chat as on the home page.\n */\n useHomeCardFormat?: boolean;\n /**\n * When true, skip the LLM presenter and return minimal card data only (faster for chat).\n * Sets homeCardPresentation and narratorChip from static labels and match reason.\n */\n minimalForChat?: boolean;\n /** When set (e.g. from chat), create opportunities as draft with context.conversationId = chatSessionId. */\n chatSessionId?: string;\n /** Redis cache for discovery pagination. When provided, remaining candidates are cached for continuation. */\n cache?: Cache;\n /**\n * Which flow is invoking discovery. Drives the graph's trigger-aware branches\n * in persist (initial status) and negotiate (park window + streaming). When\n * omitted, the graph defaults to 'ambient'. Pass 'orchestrator' from the\n * chat `discover_opportunities` tool so users see drafts stream in and the\n * accepted-pair lookup surfaces existing connections.\n */\n trigger?: 'ambient' | 'orchestrator';\n /**\n * MCP-only. When set, the opportunity graph's negotiate phase is capped at\n * this many milliseconds; on timeout the caller gets whichever candidates\n * finished, the rest stay in `negotiating` and finalize in the background.\n * Chat, ambient queue, and all other callers omit this — existing behavior.\n */\n negotiateTimeoutMs?: number;\n /** Optional read-through chat-session digest reader. Required for chatContext enrichment. */\n chatSummary?: ChatSummaryReader;\n /**\n * Optional negotiation summarizer. When provided, each post-negotiation digest\n * replaces the raw negotiation in the decision-question generator's input,\n * keeping that prompt small and predictable regardless of candidate count.\n * When omitted, a deterministic fallback digest is built per negotiation.\n */\n negotiationSummary?: NegotiationSummaryReader;\n /** Optional decision-question generator. When omitted, no questions are produced. */\n questionGenerator?: QuestionGeneratorReader;\n /**\n * Master switch for decision-question generation. When false, this code path\n * is skipped entirely regardless of trigger. The composition root passes\n * `isDiscoveryQuestionsEnabled()` (QUESTIONER_ENABLED + QUESTIONER_DISCOVERY_ENABLED).\n */\n enableQuestions?: boolean;\n /**\n * Optional async question enqueue callback. When provided, question generation\n * is dispatched asynchronously to the QuestionerQueue instead of running inline\n * via the `questionGenerator`. The callback receives an enqueue payload and\n * returns a promise that resolves when the job is enqueued (not when generation\n * completes).\n */\n questionerEnqueue?: QuestionerEnqueueFn;\n /** Focused request scope type for generated discovery questions. */\n scopeType?: ToolScopeType;\n /** Focused request scope id. When `scopeType === 'network'`, persisted as actor networkId. */\n scopeId?: string;\n}\n\n/** Context used by the minimal (no-LLM) path; only introducerName is needed for narrator chip. */\ntype MinimalPresenterContext = { introducerName?: string };\n\n/** Max chars for bio and matchReason in chat tool results to keep context manageable. */\nconst MAX_FIELD_CHARS = 100;\n\nfunction truncateForChat(\n s: string | undefined,\n max = MAX_FIELD_CHARS,\n): string | undefined {\n if (s == null || s === \"\") return undefined;\n const trimmed = s.trim();\n if (trimmed.length <= max) return trimmed;\n return trimmed.slice(0, max) + \"...\";\n}\n\n/** One formatted opportunity for chat (candidate-facing). */\nexport interface FormattedDiscoveryCandidate {\n opportunityId: string;\n userId: string;\n name?: string;\n avatar?: string | null;\n bio?: string;\n matchReason: string;\n score: number;\n status?: string;\n /** Present when DiscoverInput.presenter was provided (basic presentation). */\n presentation?: OpportunityPresentationResult;\n /** Present when DiscoverInput.useHomeCardFormat is true (full home card contract). */\n homeCardPresentation?: HomeCardPresentationResult;\n /** Viewer's role in this opportunity. */\n viewerRole?: string;\n /** Whether the viewer (as introducer) has approved the introduction. */\n viewerApproved?: boolean;\n /** Timestamp set once this viewer has already acted on the opportunity. */\n viewerActedAt?: string | null;\n /** Full user record for the candidate (needed for socials / Telegram fallback). */\n candidateUser?: UserRecord | null;\n /** Whether the counterpart is a ghost (not yet onboarded) user. */\n isGhost?: boolean;\n /** Narrator chip for home card display (name + remark, with optional avatar/userId for introducer). */\n narratorChip?: {\n name: string;\n text: string;\n avatar?: string | null;\n userId?: string;\n };\n /** Second party in introducer arrow layout (candidate -> secondParty). Present when viewer is introducer. */\n secondParty?: {\n name: string;\n avatar?: string | null;\n userId?: string;\n };\n}\n\n/** One step for debug visibility (subgraph/subtask). */\nexport interface DiscoverDebugStep {\n step: string;\n detail?: string;\n /** Structured data for rich display (e.g., candidate counts, scores). */\n data?: Record<string, unknown>;\n}\n\n/** One existing connection (no new opportunity created; user already has one with this person). */\nexport interface ExistingConnection {\n userId: string;\n name: string;\n status?: string;\n opportunityId?: string;\n}\n\n/** Statuses for which an existing connection may be shown as a card; others (accepted, rejected, expired) are only mentioned in text. */\nconst EXISTING_CONNECTION_CARD_STATUSES = ['draft', 'latent', 'pending'] as const;\n\nexport interface DiscoverResult {\n found: boolean;\n count: number;\n message?: string;\n opportunities?: FormattedDiscoveryCandidate[];\n /** Existing connections eligible for card display (draft, latent, or pending). Others are mention-only. */\n existingConnections?: ExistingConnection[];\n /** All existing connections for mention text (e.g. \"You already have a connection with: X (pending), Y (draft).\"). */\n existingConnectionsForMention?: ExistingConnection[];\n /**\n * Orchestrator-only: accepted opportunities the persist step found between the\n * discoverer and a candidate counterparty (status='accepted'). Populated from\n * OpportunityGraphState.dedupAlreadyAccepted. Used by the discover_opportunities\n * tool to tell the LLM \"this pair is already connected — open the existing\n * chat rather than creating a new draft\". Empty for the ambient trigger.\n */\n alreadyAcceptedPairs?: Array<{ opportunityId: string; counterpartyUserId: string }>;\n /** When true, the chat agent should call create_intent(suggestedIntentDescription) and retry discovery. */\n createIntentSuggested?: boolean;\n /** Description to pass to create_intent when createIntentSuggested is true. */\n suggestedIntentDescription?: string;\n /** Internal steps for copy-debug (select_strategies, opportunity_graph, enrich, etc.). */\n debugSteps?: DiscoverDebugStep[];\n /** Pagination metadata -- present when there are more unevaluated candidates. */\n pagination?: {\n discoveryId: string;\n evaluated: number;\n remaining: number;\n };\n /** 0–3 decision questions produced by the orchestrator path. Omitted when none. */\n questions?: Question[];\n /** Debug metadata for `debugMeta.discoveryQuestions` plumbing. */\n discoveryQuestionsDebug?: {\n inputMode: \"transcripts\" | \"insights\";\n finalCount: number;\n strategies: QuestionStrategy[];\n durationMs: number;\n };\n}\n\n/** Input for the shared enrichment helper. */\ninterface EnrichOpportunitiesInput {\n opportunities: Opportunity[];\n database: ChatGraphCompositeDatabase;\n userId: string;\n chatSessionId?: string;\n minimalForChat?: boolean;\n presenter?: OpportunityPresenter;\n useHomeCardFormat?: boolean;\n debugSteps: DiscoverDebugStep[];\n /** IDs of pre-existing opportunities merged into the list; these preserve their real status. */\n existingOpportunityIds?: Set<string>;\n /** Preserve refreshed lifecycle status instead of applying the chat-session draft projection. */\n preserveLifecycleStatus?: boolean;\n /** When set, bypass the embedding filter for this specific user (direct connection mode). */\n targetUserId?: string;\n}\n\n/**\n * Enrich raw opportunities with profile data, presentation (LLM or minimal),\n * and narrator chips. Shared by both `runDiscoverFromQuery` and `continueDiscovery`\n * to avoid duplicating the profile-lookup / presenter / card-formatting logic.\n *\n * @param input - Enrichment context (opportunities, database, viewer, presentation options).\n * @returns Formatted discovery candidates ready for chat or home card display.\n */\nasync function enrichOpportunities(\n input: EnrichOpportunitiesInput,\n): Promise<FormattedDiscoveryCandidate[]> {\n const {\n opportunities,\n database,\n userId,\n chatSessionId,\n minimalForChat,\n presenter,\n useHomeCardFormat,\n debugSteps,\n existingOpportunityIds,\n preserveLifecycleStatus,\n targetUserId,\n } = input;\n\n const baseEnrichedRaw = await Promise.all(\n opportunities.map(async (opp) => {\n const viewerIsIntroducer = opp.actors.some((a) => a.role === 'introducer' && a.userId === userId);\n // When the viewer is the introducer, the \"candidate\" for the card is the agent\n // (the discovered person), not the patient (the intro target / onBehalfOfUserId).\n // For non-introducer views, pick the first non-viewer, non-introducer actor.\n const nonViewerNonIntroducerActors = opp.actors.filter((a) => a.userId !== userId && a.role !== 'introducer');\n const candidateActor = viewerIsIntroducer\n ? (nonViewerNonIntroducerActors.find((a) => a.role === 'agent') ?? nonViewerNonIntroducerActors[0])\n : nonViewerNonIntroducerActors[0];\n const candidateUserId = candidateActor?.userId ?? \"\";\n const viewerActor = opp.actors.find((a) => a.userId === userId);\n const [profile, candidateUser] = candidateUserId\n ? await Promise.all([database.getProfile(candidateUserId), database.getUser(candidateUserId)])\n : [null, null];\n // Skip soft-deleted users (deletedAt is set)\n if (candidateUser && 'deletedAt' in candidateUser && candidateUser.deletedAt) return null;\n const isDirectTarget = targetUserId && candidateUserId === targetUserId;\n if (!isDirectTarget && !candidateUser?.isGhost && !profile) return null;\n const confidence =\n typeof opp.interpretation?.confidence === \"number\"\n ? opp.interpretation.confidence\n : parseFloat(String(opp.interpretation?.confidence ?? 0)) || 0;\n return {\n opportunity: opp,\n candidateUserId,\n viewerRole: viewerActor?.role ?? \"party\",\n viewerApproved: viewerActor?.approved === true,\n viewerActedAt: viewerActor?.actedAt ?? null,\n candidateUser,\n profile,\n confidence,\n };\n }),\n );\n const baseEnriched = baseEnrichedRaw.filter((item): item is NonNullable<typeof item> => item !== null);\n debugSteps.push({\n step: \"enrich_profiles\",\n detail: `${baseEnriched.length} profile(s)`,\n });\n\n // Batch-fetch user records (candidates, introducers, and other party actors) for name/avatar fallback.\n const allActorUserIds = new Set<string>();\n for (const item of baseEnriched) {\n for (const actor of item.opportunity.actors) {\n if (actor.userId && actor.userId !== userId) {\n allActorUserIds.add(actor.userId);\n }\n }\n }\n const candidateUserIds = [...allActorUserIds];\n const [viewerUser, ...userResults] = await Promise.all([\n database.getUser(userId),\n ...candidateUserIds.map((id) => database.getUser(id)),\n ]);\n const avatarByUserId = new Map<string, string | null>();\n const nameByUserId = new Map<string, string | null>();\n const isGhostByUserId = new Map<string, boolean>();\n candidateUserIds.forEach((id, i) => {\n const user = userResults[i] ?? null;\n avatarByUserId.set(id, user?.avatar ?? null);\n nameByUserId.set(id, user?.name ?? null);\n isGhostByUserId.set(id, user?.isGhost ?? false);\n });\n const viewerName = viewerUser?.name ?? undefined;\n\n // Retry name resolution for candidates whose name is still missing.\n // The profile or user record may not have been ready on the first fetch\n // (e.g. profile generation still in flight). One retry covers transient gaps.\n const missingNameIds = baseEnriched\n .map((item) => item.candidateUserId)\n .filter((id) => id && !nameByUserId.get(id) && !baseEnriched.find((b) => b.candidateUserId === id && b.profile?.identity?.name));\n if (missingNameIds.length > 0) {\n const retried = await Promise.all(\n missingNameIds.map(async (id) => {\n const [profile, user] = await Promise.all([\n database.getProfile(id),\n database.getUser(id),\n ]);\n return { id, profile, user };\n }),\n );\n for (const r of retried) {\n const name = r.profile?.identity?.name ?? r.user?.name ?? null;\n if (name) nameByUserId.set(r.id, name);\n // Also update the baseEnriched profile so counterpartName picks it up\n if (r.profile) {\n const item = baseEnriched.find((b) => b.candidateUserId === r.id);\n if (item && !item.profile) item.profile = r.profile;\n }\n if (r.user?.avatar && !avatarByUserId.get(r.id)) {\n avatarByUserId.set(r.id, r.user.avatar);\n }\n }\n enrichLog.verbose(\"Retried name lookup for candidates with missing names\", {\n attempted: missingNameIds.length,\n resolved: retried.filter((r) => r.profile?.identity?.name ?? r.user?.name).length,\n });\n }\n\n let presentations: OpportunityPresentationResult[] | undefined;\n let homeCardPresentations: HomeCardPresentationResult[] | undefined;\n let presenterContexts:\n | (Awaited<ReturnType<typeof gatherPresenterContext>> | MinimalPresenterContext)[]\n | undefined;\n\n if (minimalForChat && baseEnriched.length > 0) {\n // Minimal path: no LLM, viewer-centric card text (introduce counterpart to viewer)\n const counterpartName = (n: {\n profile?: { identity?: { name?: string } } | null;\n candidateUserId: string;\n }) => n.profile?.identity?.name ?? nameByUserId.get(n.candidateUserId) ?? \"\";\n homeCardPresentations = baseEnriched.map((item) => {\n const name = counterpartName(item)?.trim();\n const reasoning = item.opportunity.interpretation?.reasoning ?? \"\";\n const introducerName = item.opportunity.detection?.createdByName ?? undefined;\n const viewerIsIntroducer = item.opportunity.actors.some(\n (a) => a.role === \"introducer\" && a.userId === userId,\n );\n\n // For introducer view, find the second party (target user) name\n let secondPartyName: string | undefined;\n if (viewerIsIntroducer) {\n const otherPartyActors = item.opportunity.actors.filter(\n (a) => a.role !== \"introducer\" && a.userId !== item.candidateUserId,\n );\n if (otherPartyActors.length > 0) {\n const otherUserId = otherPartyActors[0].userId;\n secondPartyName = nameByUserId.get(otherUserId) ?? undefined;\n }\n }\n\n const isCounterpartGhost = isGhostByUserId.get(item.candidateUserId) ?? false;\n // Shared sanitization standard — see opportunity.safe-presentation.ts.\n const personalizedSummary = safeFallbackSummary(reasoning, {\n counterpartName: name,\n viewerName,\n introducerName,\n maxChars: MINIMAL_MAIN_TEXT_MAX_CHARS,\n emptyText: \"A suggested connection.\",\n });\n return {\n headline: viewerIsIntroducer && secondPartyName\n ? `${name} → ${secondPartyName}`\n : (name ? `Connection with ${name}` : \"Suggested connection\"),\n personalizedSummary,\n digestSummary: name\n ? `You might like meeting ${name} based on your current interests.`\n : \"This connection may be relevant to your current interests.\",\n suggestedAction: \"Start a conversation to connect.\",\n narratorRemark: narratorRemarkFromReasoning(reasoning, name, viewerName),\n primaryActionLabel: getPrimaryActionLabel(viewerIsIntroducer ? \"introducer\" : \"party\"),\n secondaryActionLabel: SECONDARY_ACTION_LABEL,\n mutualIntentsLabel: \"Suggested connection\",\n greeting: \"\",\n };\n });\n presenterContexts = baseEnriched.map((item) => ({\n introducerName: item.opportunity.detection.createdByName ?? undefined,\n })) as MinimalPresenterContext[];\n } else if (presenter && baseEnriched.length > 0) {\n try {\n presenterContexts = await Promise.all(\n baseEnriched.map(({ opportunity }) =>\n gatherPresenterContext(database, opportunity, userId),\n ),\n );\n\n if (useHomeCardFormat) {\n // Use full home card format with action labels, narrator remark, etc.\n const fullContexts = presenterContexts as Awaited<\n ReturnType<typeof gatherPresenterContext>\n >[];\n const homeCardInputs: HomeCardPresenterInput[] = fullContexts.map(\n (ctx, idx) => ({\n ...ctx,\n mutualIntentCount: undefined,\n opportunityStatus: baseEnriched[idx].opportunity.status,\n }),\n );\n const llmResults = await presenter.presentHomeCardBatch(\n homeCardInputs,\n { concurrency: 5 },\n );\n // Append hardcoded button labels to LLM results\n homeCardPresentations = llmResults.map((llm, idx) => ({\n ...llm,\n primaryActionLabel: getPrimaryActionLabel(baseEnriched[idx].viewerRole),\n secondaryActionLabel: SECONDARY_ACTION_LABEL,\n }));\n } else {\n // Use basic presentation format\n presentations = await presenter.presentBatch(\n presenterContexts as Awaited<\n ReturnType<typeof gatherPresenterContext>\n >[],\n {\n concurrency: 5,\n },\n );\n }\n } catch (error) {\n logger.warn(\n \"Presenter enrichment failed during opportunity discovery; returning base results without presentations\",\n {\n userId,\n opportunitiesCount: baseEnriched.length,\n useHomeCardFormat,\n error: error instanceof Error ? error.message : String(error),\n },\n );\n presentations = undefined;\n homeCardPresentations = undefined;\n }\n }\n\n const enriched: FormattedDiscoveryCandidate[] = baseEnriched.map(\n (item, idx) => {\n const homeCard = homeCardPresentations?.[idx];\n const ctx = presenterContexts?.[idx];\n\n // Build narrator chip for home card format\n let narratorChip: FormattedDiscoveryCandidate[\"narratorChip\"];\n if (homeCard) {\n const viewerIsIntroducer = item.opportunity.actors.some(\n (a) => a.role === \"introducer\" && a.userId === userId,\n );\n if (viewerIsIntroducer) {\n narratorChip = {\n name: \"You\",\n text: homeCard.narratorRemark,\n userId: userId,\n };\n } else {\n const introducerActor = item.opportunity.actors.find(\n (a) => a.role === \"introducer\" && a.userId !== userId,\n );\n if (introducerActor) {\n const introducerName =\n ctx?.introducerName ??\n nameByUserId.get(introducerActor.userId) ??\n \"Someone\";\n narratorChip = {\n name: introducerName,\n text: homeCard.narratorRemark,\n userId: introducerActor.userId,\n avatar: avatarByUserId.get(introducerActor.userId) ?? null,\n };\n } else {\n narratorChip = {\n name: \"Index\",\n text: homeCard.narratorRemark,\n };\n }\n }\n }\n\n const isGhost = isGhostByUserId.get(item.candidateUserId) ?? false;\n\n // Build secondParty for introducer view (the other non-introducer party)\n let secondParty: FormattedDiscoveryCandidate[\"secondParty\"];\n const viewerIsIntroducerForCard = item.opportunity.actors.some(\n (a) => a.role === \"introducer\" && a.userId === userId,\n );\n if (viewerIsIntroducerForCard) {\n const otherPartyActor = item.opportunity.actors.find(\n (a) => a.role !== \"introducer\" && a.userId !== item.candidateUserId,\n );\n if (otherPartyActor) {\n const otherName = nameByUserId.get(otherPartyActor.userId) ?? undefined;\n if (otherName) {\n secondParty = {\n name: otherName,\n avatar: avatarByUserId.get(otherPartyActor.userId) ?? null,\n userId: otherPartyActor.userId,\n };\n }\n }\n }\n\n return {\n opportunityId: item.opportunity.id,\n userId: item.candidateUserId,\n name: item.profile?.identity?.name ?? nameByUserId.get(item.candidateUserId) ?? undefined,\n avatar: avatarByUserId.get(item.candidateUserId) ?? null,\n bio: truncateForChat(item.profile?.identity?.bio),\n matchReason: safeFallbackSummary(\n item.opportunity.interpretation?.reasoning,\n {\n counterpartName: item.profile?.identity?.name ?? nameByUserId.get(item.candidateUserId) ?? undefined,\n viewerName,\n maxChars: MAX_FIELD_CHARS,\n emptyText: \"A suggested connection.\",\n },\n ),\n score: item.confidence,\n status: !preserveLifecycleStatus && chatSessionId && !existingOpportunityIds?.has(item.opportunity.id)\n ? \"draft\"\n : item.opportunity.status,\n viewerRole: item.viewerRole,\n viewerApproved: item.viewerApproved,\n viewerActedAt: item.viewerActedAt,\n candidateUser: item.candidateUser,\n isGhost,\n ...(presentations?.[idx] && { presentation: presentations[idx] }),\n ...(homeCard && {\n homeCardPresentation: homeCard,\n }),\n ...(narratorChip && { narratorChip }),\n ...(secondParty && { secondParty }),\n };\n },\n );\n debugSteps.push({\n step: \"format_cards\",\n detail: `${enriched.length} card(s)`,\n });\n\n return enriched;\n}\n\n/** Cached discovery session data stored in Redis. */\ninterface CachedDiscoverySession {\n candidates: CandidateMatch[];\n userId: string;\n onBehalfOfUserId?: string;\n query: string;\n indexScope: string[];\n options: OpportunityGraphOptions;\n /**\n * Carried across pagination so page 2+ stays on the same flow as page 1.\n * Without this, orchestrator runs would fall back to the 'ambient' default\n * mid-search and lose the shorter park window + accepted-pair dedup.\n */\n trigger?: 'ambient' | 'orchestrator';\n}\n\n/**\n * Run discovery from an ad-hoc query (e.g. \"find me a mentor\", \"who needs a React developer\").\n * The HyDE graph's LensInferrer automatically infers search lenses from the query.\n * Invokes the opportunity graph and returns formatted candidates suitable for chat display.\n */\nexport async function runDiscoverFromQuery(\n input: DiscoverInput,\n): Promise<DiscoverResult> {\n const {\n opportunityGraph,\n database,\n userId,\n query,\n indexScope,\n limit = 5,\n triggerIntentId,\n targetUserId,\n onBehalfOfUserId,\n chatSessionId,\n trigger,\n negotiateTimeoutMs,\n } = input;\n\n if (indexScope.length === 0) {\n return {\n found: false,\n count: 0,\n message:\n \"You need to join at least one network (community) to discover opportunities. Use read_networks to see available networks, or create one.\",\n };\n }\n\n const debugSteps: DiscoverDebugStep[] = [];\n\n // When query is empty, the opportunity graph uses the user's intents in scope (indexedIntents[0].payload)\n // Lens inference is handled automatically by the HyDE graph's LensInferrer\n const queryOrEmpty = query?.trim() ?? \"\";\n // Orchestrator discovery defers the initial status to the graph's\n // trigger-aware `resolveInitialStatus`, which opens at 'negotiating' so\n // the accepted-draft streaming flow can run. Ambient chat discovery still\n // wants the legacy 'draft' status so the chat-only lifecycle holds; other\n // ambient callers keep 'latent'.\n const isOrchestrator = trigger === 'orchestrator';\n const options: OpportunityGraphOptions = {\n limit,\n ...(!isOrchestrator && { initialStatus: chatSessionId ? \"draft\" : \"latent\" }),\n ...(chatSessionId ? { conversationId: chatSessionId } : {}),\n ...(negotiateTimeoutMs !== undefined && { negotiateTimeoutMs }),\n };\n\n return withCallLogging(\n logger,\n \"runDiscoverFromQuery\",\n {\n userId,\n queryPreview: queryOrEmpty\n ? queryOrEmpty.substring(0, 50)\n : \"(using user intents in scope)\",\n indexScopeCount: indexScope.length,\n limit,\n },\n async () => {\n const result = await invokeWithAbortSignal(opportunityGraph, {\n userId,\n searchQuery: queryOrEmpty || undefined,\n // A single index resolves to the strict networkId override (membership-\n // validated in the scope node). Multiple indexes (e.g. a network-scoped\n // agent's bound network + personal network) pass through as indexScope so\n // the graph stays bounded instead of falling back to all networks.\n networkId: indexScope.length === 1 ? indexScope[0] : undefined,\n ...(indexScope.length > 1 ? { indexScope } : {}),\n triggerIntentId,\n targetUserId,\n onBehalfOfUserId,\n options,\n ...(trigger && { trigger }),\n });\n\n // Extract trace from graph and append to debugSteps\n const graphTrace = Array.isArray(result.trace) ? result.trace : [];\n for (const t of graphTrace) {\n debugSteps.push({\n step: t.node,\n detail: t.detail,\n ...(t.data ? { data: t.data } : {}),\n });\n }\n\n // Bail early if the graph returned an error\n if (result.error) {\n logger.warn(\"runDiscoverFromQuery graph returned error\", { error: result.error });\n return {\n found: false,\n count: 0,\n message: \"Failed to find opportunities. Please try again.\",\n debugSteps,\n };\n }\n\n // Cache remaining candidates for pagination\n let pagination: DiscoverResult['pagination'] | undefined;\n const remainingCandidates: CandidateMatch[] = result.remainingCandidates || [];\n if (remainingCandidates.length > 0 && input.cache) {\n try {\n const discoveryId = crypto.randomUUID();\n const cacheKey = `discovery:${userId}:${discoveryId}`;\n await input.cache.set(cacheKey, {\n candidates: remainingCandidates,\n userId,\n onBehalfOfUserId,\n query: queryOrEmpty,\n indexScope,\n options,\n ...(trigger && { trigger }),\n } satisfies CachedDiscoverySession, { ttl: 1800 }); // 30 minutes\n pagination = {\n discoveryId,\n evaluated: (result.candidates?.length ?? 0) - remainingCandidates.length,\n remaining: remainingCandidates.length,\n };\n } catch (cacheErr) {\n logger.warn(\"Failed to cache discovery pagination\", {\n userId,\n error: cacheErr instanceof Error ? cacheErr.message : String(cacheErr),\n });\n }\n }\n\n // Refine phase: a sibling of the opportunity graph in the trace tree.\n // Holds the three post-discovery summarization steps. Each step is its\n // own traced agent so it appears as a leaf in the trace UI.\n //\n // Negotiation summary: compress each raw negotiation into a fixed-size\n // structured digest so the question generator's prompt stays small\n // (a 10-candidate turn used to balloon past 60 KB and stall upstream).\n // Decision questions: generate up to 3 clarifying questions from the\n // digests + chat context.\n const { questionPayload } = await tracePhase(\"Refine\", async () => {\n const negotiationDigests = await summarizeNegotiations({\n negotiations: result.discoveryNegotiations ?? [],\n summarizer: input.negotiationSummary,\n enableQuestions: input.enableQuestions ?? false,\n trigger,\n });\n const questionPayload = await maybeBuildQuestions({\n trigger,\n enableQuestions: input.enableQuestions ?? false,\n chatSummary: input.chatSummary,\n questionGenerator: input.questionGenerator,\n chatSessionId,\n graphResult: result,\n negotiationDigests,\n query: queryOrEmpty,\n questionerEnqueue: input.questionerEnqueue,\n userId: input.userId,\n scopeType: input.scopeType,\n scopeId: input.scopeId,\n triggerIntentId,\n userContext: input.userId\n ? ((await input.database.getUserContext(input.userId, null))?.text ?? '')\n : '',\n });\n return { negotiationDigests, questionPayload };\n });\n\n if (result.createIntentSuggested && result.suggestedIntentDescription) {\n if (chatSessionId) {\n return {\n found: false,\n count: 0,\n message: \"No matching opportunities found. Try a different query.\",\n pagination,\n ...(questionPayload.questions !== undefined ? { questions: questionPayload.questions } : {}),\n ...(questionPayload.debug !== undefined ? { discoveryQuestionsDebug: questionPayload.debug } : {}),\n };\n }\n return {\n found: false,\n count: 0,\n createIntentSuggested: true,\n suggestedIntentDescription: result.suggestedIntentDescription,\n message:\n \"No matching opportunities; add an intent with the suggested description to improve discovery.\",\n debugSteps,\n pagination,\n ...(questionPayload.questions !== undefined ? { questions: questionPayload.questions } : {}),\n ...(questionPayload.debug !== undefined ? { discoveryQuestionsDebug: questionPayload.debug } : {}),\n };\n }\n\n let opportunities: Opportunity[] = Array.isArray(result.opportunities)\n ? result.opportunities\n : [];\n let existingOpportunityIds: Set<string> | undefined;\n const rawExistingBetweenActors = Array.isArray(result.existingBetweenActors)\n ? result.existingBetweenActors\n : [];\n // Orchestrator trigger populates this; ambient returns []. Kept as a\n // loosely-typed pass-through because DiscoverResult is consumed by\n // callers (chat tool, tests) that already model the narrower shape.\n const alreadyAcceptedPairs = Array.isArray(\n (result as { dedupAlreadyAccepted?: Array<{ opportunityId: string; counterpartyUserId: string }> })\n .dedupAlreadyAccepted,\n )\n ? (result as { dedupAlreadyAccepted: Array<{ opportunityId: string; counterpartyUserId: string }> })\n .dedupAlreadyAccepted\n : [];\n // Enrich existing-between-actors with names so the tool can say \"You already have a connection with X (pending).\"\n const existingConnections: ExistingConnection[] = await Promise.all(\n rawExistingBetweenActors.map(async (item) => {\n const user = await database.getUser(item.candidateUserId);\n return {\n userId: item.candidateUserId,\n name: user?.name ?? \"Someone\",\n ...(item.existingStatus ? { status: item.existingStatus } : {}),\n ...(item.existingOpportunityId ? { opportunityId: item.existingOpportunityId } : {}),\n };\n }),\n );\n if (existingConnections.length > 0) {\n discoverFromQueryLog.verbose(\"Skipped duplicates; existing connections\", {\n count: existingConnections.length,\n userIds: existingConnections.map((c) => c.userId),\n });\n }\n // Only expose existing connections as cards when status is in EXISTING_CONNECTION_CARD_STATUSES (draft, latent, pending); others are mention-only.\n const existingConnectionsForCards = existingConnections.filter((c) =>\n c.status != null && EXISTING_CONNECTION_CARD_STATUSES.includes(c.status as typeof EXISTING_CONNECTION_CARD_STATUSES[number])\n );\n\n // Fetch full opportunity data for existing connections that should be shown as cards\n // and merge them with the newly created opportunities\n if (existingConnectionsForCards.length > 0) {\n const existingOpps = await Promise.all(\n existingConnectionsForCards\n .filter((c) => c.opportunityId)\n .map((c) => database.getOpportunity(c.opportunityId!))\n );\n const validExistingOpps = existingOpps.filter((o): o is Opportunity => o != null);\n if (validExistingOpps.length > 0) {\n discoverFromQueryLog.verbose(\"Including existing opportunities as cards\", {\n count: validExistingOpps.length,\n ids: validExistingOpps.map((o) => o.id),\n });\n existingOpportunityIds = new Set(validExistingOpps.map((o) => o.id));\n opportunities = [...opportunities, ...validExistingOpps];\n }\n }\n\n // Chat discovery: when we have chatSessionId we just invoked the graph; all result.opportunities\n // were created in this call and belong to this session. Do not filter by status: the enricher\n // may set status to pending/latent when merging with related opportunities, so filtering to\n // \"draft\" would incorrectly drop them.\n if (chatSessionId && (result.opportunities?.length ?? 0) > 0) {\n discoverFromQueryLog.verbose(\"Chat session opportunities from graph\", {\n count: opportunities.length,\n statuses: opportunities.map((o) => o.status),\n });\n }\n debugSteps.push({\n step: \"opportunity_graph\",\n detail: `${opportunities.length} opportunity(ies)${existingConnections.length > 0 ? `, ${existingConnections.length} existing` : \"\"}`,\n });\n\n if (opportunities.length === 0) {\n if (existingConnections.length > 0) {\n return {\n found: true,\n count: 0,\n message:\n \"No new opportunities created; you already have a connection with: \" +\n existingConnections.map((c) => `${c.name}${c.status ? ` (${c.status})` : \"\"}`).join(\", \") +\n \". View on your home page.\",\n existingConnections: existingConnectionsForCards,\n existingConnectionsForMention: existingConnections,\n ...(alreadyAcceptedPairs.length > 0 && { alreadyAcceptedPairs }),\n debugSteps,\n pagination,\n ...(questionPayload.questions !== undefined ? { questions: questionPayload.questions } : {}),\n ...(questionPayload.debug !== undefined ? { discoveryQuestionsDebug: questionPayload.debug } : {}),\n };\n }\n return {\n found: false,\n count: 0,\n message:\n \"No matching opportunities found. Try a different query or create intents to improve matching.\",\n ...(alreadyAcceptedPairs.length > 0 && { alreadyAcceptedPairs }),\n debugSteps,\n pagination,\n ...(questionPayload.questions !== undefined ? { questions: questionPayload.questions } : {}),\n ...(questionPayload.debug !== undefined ? { discoveryQuestionsDebug: questionPayload.debug } : {}),\n };\n }\n\n const enriched = await enrichOpportunities({\n opportunities,\n database,\n userId,\n chatSessionId,\n minimalForChat: input.minimalForChat,\n presenter: input.presenter,\n useHomeCardFormat: input.useHomeCardFormat,\n debugSteps,\n existingOpportunityIds,\n targetUserId,\n });\n\n return {\n found: true,\n count: enriched.length,\n opportunities: enriched,\n ...(existingConnectionsForCards.length > 0 ? { existingConnections: existingConnectionsForCards } : {}),\n ...(existingConnections.length > 0 ? { existingConnectionsForMention: existingConnections } : {}),\n ...(alreadyAcceptedPairs.length > 0 ? { alreadyAcceptedPairs } : {}),\n debugSteps,\n pagination,\n ...(questionPayload.questions !== undefined ? { questions: questionPayload.questions } : {}),\n ...(questionPayload.debug !== undefined ? { discoveryQuestionsDebug: questionPayload.debug } : {}),\n };\n },\n { context: { userId }, logOutput: false },\n ).catch((err) => {\n return {\n found: false,\n count: 0,\n message: \"Failed to find opportunities. Please try again.\",\n };\n });\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// DECISION-QUESTION HELPER\n// ─────────────────────────────────────────────────────────────────────────────\n\ntype GraphResultLike = {\n sourceProfile?: SourceProfileData | null;\n discoveryNegotiations?: DiscoveryNegotiation[];\n discoverySummary?: DiscoverySummary | null;\n};\n\ninterface MaybeBuildQuestionsInput {\n trigger: 'ambient' | 'orchestrator' | undefined;\n enableQuestions: boolean;\n chatSummary: ChatSummaryReader | undefined;\n questionGenerator: QuestionGeneratorReader | undefined;\n chatSessionId: string | undefined;\n graphResult: GraphResultLike;\n /** Pre-built per-negotiation digests. Pass [] when summarization is unavailable or disabled. */\n negotiationDigests: DiscoveryNegotiationDigest[];\n query: string;\n /** Optional async enqueue callback for background question generation. */\n questionerEnqueue?: DiscoverInput['questionerEnqueue'];\n /** User ID needed for the enqueue payload. */\n userId?: string;\n /** Focused request scope type for generated discovery questions. */\n scopeType?: ToolScopeType;\n /** Focused request scope id. When `scopeType === 'network'`, persisted as actor networkId. */\n scopeId?: string;\n /** Intent that triggered this discovery run. Stamped as `detection.triggeredBy` on generated questions. */\n triggerIntentId?: string;\n /** The seeker's global user_context paragraph (profile-replacing identity text). */\n userContext?: string;\n}\n\n/**\n * Run the negotiation summarizer over every negotiation in this discovery turn.\n * Each summarization is independent — run them concurrently via Promise.all.\n * When the summarizer is missing (no LLM available) or fails for an individual\n * negotiation, fall back to a deterministic digest so the downstream generator\n * still has structured input.\n */\nasync function summarizeNegotiations(args: {\n negotiations: DiscoveryNegotiation[];\n summarizer: NegotiationSummaryReader | undefined;\n enableQuestions: boolean;\n trigger: 'ambient' | 'orchestrator' | undefined;\n}): Promise<DiscoveryNegotiationDigest[]> {\n // Skip the LLM round-trip entirely when questions won't be built.\n if (!args.enableQuestions || args.trigger !== 'orchestrator') return [];\n if (args.negotiations.length === 0) return [];\n\n const perNegTimeoutMs = parsePositiveIntEnv(\n \"NEGOTIATION_SUMMARY_TIMEOUT_MS\",\n NEGOTIATION_SUMMARY_TIMEOUT_MS_DEFAULT,\n );\n const callerSignal = requestContext.getStore()?.abortSignal;\n\n return traceAgent(\n `Negotiation summary (${args.negotiations.length})`,\n () =>\n Promise.all(\n args.negotiations.map(async (n) => {\n if (!args.summarizer) return buildFallbackDigest(n);\n // Per-negotiation deadline: one slow OpenRouter route used to\n // dominate the post-discovery tail. With a cap, an aborted\n // summarizer falls back to a deterministic digest so the\n // question generator still has structured input.\n const signal = combineWithDeadline(callerSignal, perNegTimeoutMs);\n try {\n const d = await args.summarizer.summarize(n, { signal });\n return d ?? buildFallbackDigest(n);\n } catch (err) {\n // Attribute cause from err.name (AbortError), not from\n // signal.aborted — the latter is read post-catch and can race a\n // deadline-trip-after-unrelated-error, producing a misleading log.\n const aborted = err instanceof Error && err.name === \"AbortError\";\n logger.warn(\"negotiationSummary.summarize threw — using fallback digest\", {\n counterpartyHint: n.counterpartyHint,\n aborted,\n error: err instanceof Error ? err.message : String(err),\n });\n return buildFallbackDigest(n);\n }\n }),\n ),\n (digests) => `${digests.length} digest${digests.length === 1 ? \"\" : \"s\"}`,\n );\n}\n\nasync function maybeBuildQuestions(args: MaybeBuildQuestionsInput): Promise<{\n questions?: Question[];\n debug?: DiscoverResult[\"discoveryQuestionsDebug\"];\n}> {\n if (!args.enableQuestions) return {};\n if (args.trigger !== 'orchestrator') return {};\n\n // Hardcoded — `insights` mode is planned for a later slice. Warn if the env\n // var is set so operators aren't surprised when reporting still says\n // \"transcripts\".\n if (discoveryQuestionsInputMode() === \"insights\") {\n logger.warn(\"QUESTIONER_DISCOVERY_INPUT_MODE=insights is not yet implemented; falling back to transcripts\");\n }\n const inputMode: \"transcripts\" | \"insights\" = \"transcripts\";\n\n let chatContext: ChatContextDigest | undefined;\n if (args.chatSummary && args.chatSessionId) {\n const sessionId = args.chatSessionId;\n const summary = args.chatSummary;\n chatContext = await traceAgent(\n \"Chat summary\",\n async () => {\n try {\n return (await summary.getDigest(sessionId)) ?? undefined;\n } catch (err) {\n logger.warn(\"chatSummary.getDigest threw — proceeding without digest\", {\n sessionId,\n error: err instanceof Error ? err.message : String(err),\n });\n return undefined;\n }\n },\n (digest) => (digest ? \"loaded\" : \"empty\"),\n );\n }\n\n // ── Async enqueue path ──────────────────────────────────────────────────\n // When questionerEnqueue is provided, dispatch question generation\n // asynchronously to the background QuestionerQueue. This replaces the\n // inline generator path. Questions will be persisted to DB by the queue\n // worker and served via GET /api/questions.\n if (args.questionerEnqueue && args.userId) {\n const summary = args.graphResult.discoverySummary ?? {\n totalCandidates: 0,\n opportunitiesFound: 0,\n noOpportunityCount: 0,\n timeoutCount: 0,\n roleDistribution: {},\n };\n\n const enqueueInput = buildDiscoveryQuestionInput({\n query: args.query,\n userContext: args.userContext ?? '',\n negotiationDigests: args.negotiationDigests,\n summary,\n chatContext,\n now: new Date().toISOString(),\n });\n\n try {\n await args.questionerEnqueue({\n mode: 'discovery',\n userId: args.userId,\n sourceType: 'discovery',\n sourceId: args.chatSessionId ?? crypto.randomUUID(),\n context: enqueueInput,\n ...(args.scopeType && args.scopeId ? { scopeType: args.scopeType, scopeId: args.scopeId } : {}),\n ...(args.triggerIntentId ? { triggeredByIntentId: args.triggerIntentId } : {}),\n conversationId: args.chatSessionId,\n });\n logger.info(\"Question generation enqueued to QuestionerQueue\", {\n userId: args.userId,\n trigger: args.trigger,\n });\n } catch (err) {\n logger.warn(\"Failed to enqueue question generation\", {\n error: err instanceof Error ? err.message : String(err),\n });\n }\n return {};\n }\n\n // ── Inline generator path (backward compat) ────────────────────────────\n if (!args.questionGenerator) return {};\n\n const negotiationDigests = args.negotiationDigests;\n const summary = args.graphResult.discoverySummary ?? {\n totalCandidates: 0,\n opportunitiesFound: 0,\n noOpportunityCount: 0,\n timeoutCount: 0,\n roleDistribution: {},\n };\n\n const input = buildDiscoveryQuestionInput({\n query: args.query,\n userContext: args.userContext ?? '',\n negotiationDigests,\n summary,\n chatContext,\n now: new Date().toISOString(),\n });\n\n const questionGenerator = args.questionGenerator;\n const generatorStart = Date.now();\n const questionsTimeoutMs = discoveryQuestionsTimeoutMs();\n const questionsSignal = combineWithDeadline(\n requestContext.getStore()?.abortSignal,\n questionsTimeoutMs,\n );\n const genResult = await traceAgent(\n \"Decision questions\",\n async () => {\n try {\n return await questionGenerator.generate(input, { signal: questionsSignal });\n } catch (err) {\n logger.warn(\"questionGenerator.generate threw — suppressing questions\", {\n error: err instanceof Error ? err.message : String(err),\n });\n return null;\n }\n },\n (r) => {\n const count = r?.questions?.length ?? 0;\n return `${count} question${count === 1 ? \"\" : \"s\"}`;\n },\n );\n const durationMs = Date.now() - generatorStart;\n\n const finalCount = genResult?.questions?.length ?? 0;\n const strategies: QuestionStrategy[] = genResult?.strategies ?? [];\n\n return {\n ...(genResult && genResult.questions.length > 0 ? { questions: genResult.questions } : {}),\n debug: {\n inputMode,\n finalCount,\n strategies,\n durationMs,\n },\n };\n}\n\n/**\n * Continue a paginated discovery by evaluating the next batch of cached candidates.\n * Loads candidates from Redis, invokes the opportunity graph in continue_discovery mode,\n * then enriches and returns the results with updated pagination metadata.\n *\n * @param input - Continuation context (graph, database, cache, discoveryId, etc.).\n * @returns Discovery result with enriched opportunities and pagination state.\n */\nexport async function continueDiscovery(input: {\n opportunityGraph: CompiledOpportunityGraph;\n database: ChatGraphCompositeDatabase;\n cache: Cache;\n userId: string;\n discoveryId: string;\n /** If provided, validates the cached session's indexScope contains this network. */\n expectedIndexId?: string;\n limit?: number;\n chatSessionId?: string;\n minimalForChat?: boolean;\n presenter?: OpportunityPresenter;\n useHomeCardFormat?: boolean;\n}): Promise<DiscoverResult> {\n const {\n opportunityGraph,\n database,\n cache,\n userId,\n discoveryId,\n expectedIndexId,\n limit = 20,\n chatSessionId,\n } = input;\n const cacheKey = `discovery:${userId}:${discoveryId}`;\n\n const cached = await cache.get<CachedDiscoverySession>(cacheKey);\n\n if (!cached) {\n return {\n found: false,\n count: 0,\n message: \"Discovery session expired or not found. Please start a new search.\",\n };\n }\n\n // Validate that the cached session's scope matches the current chat context\n if (expectedIndexId && !cached.indexScope.includes(expectedIndexId)) {\n return {\n found: false,\n count: 0,\n message: \"Discovery session was created in a different context. Please start a new search.\",\n };\n }\n\n const debugSteps: DiscoverDebugStep[] = [];\n\n const result = await invokeWithAbortSignal(opportunityGraph, {\n userId,\n searchQuery: cached.query || undefined,\n candidates: cached.candidates,\n operationMode: 'continue_discovery' as const,\n onBehalfOfUserId: cached.onBehalfOfUserId,\n // Carry the original trigger so page 2+ stays on the same flow as page\n // 1 (orchestrator negotiations with 60s park window + accepted-pair\n // dedup, or ambient with 5-min park window).\n ...(cached.trigger && { trigger: cached.trigger }),\n options: {\n ...cached.options,\n limit,\n ...(chatSessionId ? { conversationId: chatSessionId } : {}),\n },\n });\n\n // Extract trace from graph and append to debugSteps\n const graphTrace = result.trace || [];\n for (const t of graphTrace) {\n debugSteps.push({\n step: t.node,\n detail: t.detail,\n ...(t.data ? { data: t.data } : {}),\n });\n }\n\n // Bail early if the graph returned an error\n if (result.error) {\n logger.warn(\"continueDiscovery graph returned error\", { error: result.error });\n return {\n found: false,\n count: 0,\n message: \"Discovery continuation failed. Please start a new search.\",\n debugSteps,\n };\n }\n\n // Update cache with remaining candidates or delete if exhausted\n const remaining: CandidateMatch[] = result.remainingCandidates || [];\n let pagination: DiscoverResult['pagination'] | undefined;\n try {\n if (remaining.length > 0) {\n await cache.set(cacheKey, {\n ...cached,\n candidates: remaining,\n } satisfies CachedDiscoverySession, { ttl: 1800 });\n pagination = {\n discoveryId,\n evaluated: cached.candidates.length - remaining.length,\n remaining: remaining.length,\n };\n } else {\n await cache.delete(cacheKey);\n }\n } catch (cacheErr) {\n logger.warn(\"Failed to update discovery pagination cache\", {\n userId,\n discoveryId,\n error: cacheErr instanceof Error ? cacheErr.message : String(cacheErr),\n });\n }\n\n // Check for opportunities in result. Negotiation mutates lifecycle state after\n // persistence, so continuation must refresh before enrichment/presentation rather\n // than returning the graph state's persist-time `negotiating` snapshots.\n const opportunities: Opportunity[] = Array.isArray(result.opportunities) ? result.opportunities : [];\n const refreshed = opportunities.length > 0\n ? await database.getOpportunitiesByIds(opportunities.map((opportunity) => opportunity.id))\n : [];\n const refreshedById = new Map(refreshed.map((opportunity) => [opportunity.id, opportunity] as const));\n const currentOpportunities = opportunities.map((opportunity) =>\n refreshedById.get(opportunity.id) ?? opportunity);\n\n if (currentOpportunities.length === 0) {\n return {\n found: false,\n count: 0,\n message: \"No more matching opportunities found in the remaining candidates.\",\n debugSteps,\n pagination,\n };\n }\n\n const enriched = await enrichOpportunities({\n opportunities: currentOpportunities,\n database,\n userId,\n chatSessionId,\n minimalForChat: input.minimalForChat,\n presenter: input.presenter,\n useHomeCardFormat: input.useHomeCardFormat,\n debugSteps,\n preserveLifecycleStatus: true,\n });\n\n return {\n found: true,\n count: enriched.length,\n opportunities: enriched,\n debugSteps,\n pagination,\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"opportunity.enricher.d.ts","sourceRoot":"/","sources":["opportunity/opportunity.enricher.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,WAAW,EAAkE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAExL,OAAO,KAAK,EAAE,QAAQ,EAAE,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CAAC","sourcesContent":["/**\n * Opportunity enricher: when creating an opportunity, find overlapping existing\n * opportunities (by non-introducer actor userId), check semantic relatedness, and\n * optionally merge into a single enriched opportunity and expire the old one(s).\n */\n\nimport type { CreateOpportunityData, Opportunity, OpportunityActor, OpportunityInterpretation, OpportunitySignal, OpportunityStatus } from '../shared/interfaces/database.interface.js';\nimport { getAbortSignalConfig } from '../shared/agent/model-signal.js';\nimport type { Embedder } from '../shared/interfaces/embedder.interface.js';\nimport type { Id } from '../shared/interfaces/database.interface.js';\nimport { protocolLogger } from '../shared/observability/protocol.logger.js';\n\nconst logger = protocolLogger('OpportunityEnricher');\n\nconst DEFAULT_SIMILARITY_THRESHOLD = 0.7;\nconst MIN_REASONING_LENGTH_FOR_EMBEDDING = 10;\n\n/**\n * Statuses excluded from the merge-candidate pool by default.\n *\n * - 'accepted': the pair already connected — do NOT fold a new discovery into\n * the historical opp. IND-237 surfaces the existing conversation separately.\n * - 'negotiating': a negotiation is in-flight for this pair; rolling a new\n * candidate into it would blur the outcome of the active turn. Wait for the\n * negotiation to finalize (→ draft/pending/rejected/stalled) first, then\n * enrichment can pick it up on the next pass.\n * - 'expired': already superseded by a later enriched opportunity. Without this\n * exclusion, each enrichment cycle re-merges previously-expired enriched\n * opportunities, compounding their actor arrays into 100+ entries.\n *\n * Exported for callers that want to extend rather than replace the default.\n */\nexport const DEFAULT_ENRICHER_EXCLUDE_STATUSES: OpportunityStatus[] = ['accepted', 'negotiating', 'expired'];\n\nexport type EnricherDatabase = {\n findOpportunitiesByActors(\n actorIds: string[],\n options?: { includeIntroducers?: boolean; statuses?: OpportunityStatus[]; excludeStatuses?: OpportunityStatus[] }\n ): Promise<Opportunity[]>;\n};\n\nexport type EnrichmentResult =\n | { enriched: false; data: CreateOpportunityData }\n | { enriched: true; data: CreateOpportunityData; expiredIds: string[]; resolvedStatus: OpportunityStatus };\n\nexport type EnrichOrCreateOptions = {\n similarityThreshold?: number;\n /**\n * Statuses to exclude from the merge-candidate pool. Defaults to\n * {@link DEFAULT_ENRICHER_EXCLUDE_STATUSES} (`['accepted', 'negotiating']`).\n * Pass an empty array `[]` to consider all statuses.\n */\n excludeStatuses?: OpportunityStatus[];\n /** Restrict merge/expiration candidates to the authoritative owned intent. */\n ownedIntentScope?: { triggerIntentId: string; ownerUserId: string };\n};\n\n/**\n * Cosine similarity between two vectors (0–1).\n */\nfunction cosineSimilarity(a: number[], b: number[]): number {\n if (a.length !== b.length || a.length === 0) return 0;\n let dot = 0;\n let normA = 0;\n let normB = 0;\n for (let i = 0; i < a.length; i++) {\n dot += a[i] * b[i];\n normA += a[i] * a[i];\n normB += b[i] * b[i];\n }\n const denom = Math.sqrt(normA) * Math.sqrt(normB);\n if (denom === 0) return 0;\n const sim = dot / denom;\n return Math.max(0, Math.min(1, sim));\n}\n\n/**\n * Resolve enriched opportunity status from related opportunities' statuses and the incoming status.\n * Priority: accepted > pending > rejected > stalled > draft (only when incoming is draft) > latent.\n * The incoming status is included so we do not wrongly downgrade when the new opportunity has a higher-priority status.\n * When incoming is 'draft' (e.g. from in-chat discovery), we preserve draft so the opportunity stays chat-only and\n * does not appear on the home view (home excludes draft).\n * When incoming is NOT draft (e.g. 'latent' from the background broker), existing draft status does NOT contaminate\n * the result — the broker-created opportunity retains its own status and can appear on the home view.\n */\nfunction resolveEnrichedStatus(relatedStatuses: string[], incomingStatus?: string): OpportunityStatus {\n const statuses = incomingStatus ? [...relatedStatuses, incomingStatus] : relatedStatuses;\n if (statuses.includes('accepted')) return 'accepted';\n if (statuses.includes('pending')) return 'pending';\n if (statuses.includes('rejected')) return 'rejected';\n if (statuses.includes('stalled')) return 'stalled';\n if (incomingStatus === 'draft') return 'draft';\n return 'latent';\n}\n\n/**\n * Extract non-introducer actor userIds from create data.\n */\nfunction getNonIntroducerUserIds(data: CreateOpportunityData): Id<'users'>[] {\n const ids = data.actors\n .filter((a) => a.role !== 'introducer')\n .map((a) => a.userId);\n return [...new Set(ids)];\n}\n\n/**\n * Extract intent IDs from actors.\n */\nfunction belongsToOwnedIntent(\n opportunity: Opportunity,\n scope: { triggerIntentId: string; ownerUserId: string },\n): boolean {\n if (opportunity.detection.triggeredBy === scope.triggerIntentId) return true;\n return opportunity.actors.some((actor) =>\n actor.userId === scope.ownerUserId && actor.intent === scope.triggerIntentId);\n}\n\nfunction getIntentIdsFromActors(actors: OpportunityActor[]): Set<string> {\n const ids = new Set<string>();\n for (const a of actors) {\n if (a.intent) ids.add(a.intent);\n }\n return ids;\n}\n\n/**\n * Check if two opportunities share at least one intent ID.\n */\nfunction shareIntentIds(\n newData: CreateOpportunityData,\n existing: Opportunity\n): boolean {\n const newIntents = getIntentIdsFromActors(newData.actors);\n const existingIntents = getIntentIdsFromActors(existing.actors);\n for (const id of newIntents) {\n if (existingIntents.has(id)) return true;\n }\n return false;\n}\n\n/**\n * Merge actors from new data and existing opportunities: union by (networkId, userId, intent),\n * preserving all unique introducers and preferring newer role on conflict.\n */\nfunction mergeActors(\n newData: CreateOpportunityData,\n existingList: Opportunity[]\n): OpportunityActor[] {\n const key = (a: OpportunityActor) =>\n `${a.networkId}:${a.userId}:${a.intent ?? ''}`;\n const map = new Map<string, OpportunityActor>();\n\n // Add all from existing first (older)\n for (const opp of existingList) {\n for (const a of opp.actors) {\n map.set(key(a), a);\n }\n }\n // Add/overwrite with new (newer wins for same key, e.g. role)\n for (const a of newData.actors) {\n map.set(key(a), a);\n }\n\n return [...map.values()];\n}\n\n/**\n * Merge interpretation: single reasoning (new data only), max confidence, merged signals.\n * We use only the new opportunity's reasoning to avoid repetitive concatenation when\n * multiple overlapping opportunities share the same or similar text (e.g. same pair\n * across indexes), which previously produced long duplicated paragraphs in chat cards.\n */\nfunction mergeInterpretation(\n newData: CreateOpportunityData,\n existingList: Opportunity[]\n): OpportunityInterpretation {\n const reasoning = newData.interpretation.reasoning;\n\n let maxConf =\n typeof newData.interpretation.confidence === 'number'\n ? newData.interpretation.confidence\n : parseFloat(String(newData.interpretation.confidence ?? 0));\n for (const o of existingList) {\n const c = o.interpretation?.confidence;\n const cNum = typeof c === 'number' ? c : parseFloat(String(c ?? 0));\n if (cNum > maxConf) maxConf = cNum;\n }\n const confidence = maxConf;\n\n const signals: OpportunitySignal[] = [\n ...(newData.interpretation.signals ?? []),\n ...existingList.flatMap((o) => o.interpretation?.signals ?? []),\n ];\n const seen = new Set<string>();\n const dedupedSignals = signals.filter((s) => {\n const k = `${s.type}:${s.detail ?? ''}`;\n if (seen.has(k)) return false;\n seen.add(k);\n return true;\n });\n\n return {\n category: newData.interpretation.category,\n reasoning,\n confidence: typeof confidence === 'string' ? parseFloat(confidence) : confidence,\n signals: dedupedSignals.length > 0 ? dedupedSignals : newData.interpretation.signals,\n };\n}\n\n/**\n * Enrich or create: find overlapping opportunities, filter by semantic relatedness\n * using a two-phase approach, merge actors and interpretation into a single\n * CreateOpportunityData, and return the data plus IDs to expire. If no related\n * overlap, return original data unchanged.\n *\n * Phase 1 — Intent check (free, no API call):\n * Shared intent IDs mean the same declared user goal drove both opportunities.\n * This is rare because the IntentReconciler already deduplicates intents per-user\n * upstream, but when it fires it is definitive.\n *\n * Phase 2 — Batched embedding similarity (one API call for all remaining):\n * For opportunities without shared intents, embed all reasoning texts in a single\n * batch call and compare cosine similarity. Cross-user intent comparison (e.g.\n * Alice's \"find ML co-founder\" vs Bob's \"join ML startup\") is implicitly handled\n * here since reasoning text synthesizes both users' intents.\n */\nexport async function enrichOrCreate(\n database: EnricherDatabase,\n embedder: Embedder,\n newData: CreateOpportunityData,\n options?: EnrichOrCreateOptions\n): Promise<EnrichmentResult> {\n const actorUserIds = getNonIntroducerUserIds(newData);\n if (actorUserIds.length === 0) {\n return { enriched: false, data: newData };\n }\n\n const excludeStatuses = options?.excludeStatuses ?? DEFAULT_ENRICHER_EXCLUDE_STATUSES;\n const pairOverlaps = await database.findOpportunitiesByActors(actorUserIds, { excludeStatuses });\n const ownedIntentScope = options?.ownedIntentScope;\n const overlapping = ownedIntentScope\n ? pairOverlaps.filter((opportunity) => belongsToOwnedIntent(opportunity, ownedIntentScope))\n : pairOverlaps;\n if (ownedIntentScope && pairOverlaps.length > overlapping.length) {\n logger.info('Excluded cross-trigger overlaps from owned-intent enrichment', {\n triggerIntentId: ownedIntentScope.triggerIntentId,\n pairOverlapCount: pairOverlaps.length,\n sameTriggerOverlapCount: overlapping.length,\n });\n }\n if (overlapping.length === 0) {\n return { enriched: false, data: newData };\n }\n\n const threshold = options?.similarityThreshold ?? DEFAULT_SIMILARITY_THRESHOLD;\n\n // Phase 1: Intent-based relatedness (free, strongest signal)\n const related: Opportunity[] = [];\n const remaining: Opportunity[] = [];\n for (const opp of overlapping) {\n if (shareIntentIds(newData, opp)) {\n related.push(opp);\n } else {\n remaining.push(opp);\n }\n }\n\n // Phase 2: Batched embedding similarity (one API call for all remaining)\n if (remaining.length > 0) {\n const newReasoning = (newData.interpretation?.reasoning ?? '').trim();\n\n // Only embed opps where both reasonings are long enough\n const embeddable: Opportunity[] = [];\n for (const opp of remaining) {\n const existingReasoning = (opp.interpretation?.reasoning ?? '').trim();\n if (\n newReasoning.length >= MIN_REASONING_LENGTH_FOR_EMBEDDING &&\n existingReasoning.length >= MIN_REASONING_LENGTH_FOR_EMBEDDING\n ) {\n embeddable.push(opp);\n }\n // Short reasoning + no shared intents (Phase 1 missed) → not related\n }\n\n if (embeddable.length > 0) {\n try {\n const textsToEmbed = [\n newReasoning,\n ...embeddable.map((o) => (o.interpretation?.reasoning ?? '').trim()),\n ];\n const vectors = (await embedder.generate(textsToEmbed, undefined, getAbortSignalConfig())) as number[][];\n const newVec = vectors[0];\n if (newVec?.length) {\n for (let i = 0; i < embeddable.length; i++) {\n const existingVec = vectors[i + 1];\n if (existingVec?.length && cosineSimilarity(newVec, existingVec) >= threshold) {\n related.push(embeddable[i]);\n }\n }\n }\n } catch (e) {\n logger.warn('Embedding check failed; intent-matched opportunities already captured', { error: e });\n // Phase 1 matches are preserved; remaining opps without shared intents are not related\n }\n }\n }\n\n if (related.length === 0) {\n return { enriched: false, data: newData };\n }\n\n const mergedActors = mergeActors(newData, related);\n const mergedInterpretation = mergeInterpretation(newData, related);\n const enrichedFrom = related.map((o) => o.id);\n const mergedConfidence =\n typeof mergedInterpretation.confidence === 'number'\n ? String(mergedInterpretation.confidence)\n : mergedInterpretation.confidence;\n\n const enrichedData: CreateOpportunityData = {\n ...newData,\n detection: {\n ...newData.detection,\n source: 'enrichment',\n enrichedFrom,\n },\n actors: mergedActors,\n interpretation: mergedInterpretation,\n confidence: mergedConfidence,\n };\n\n const resolvedStatus = resolveEnrichedStatus(related.map((o) => o.status), newData.status);\n\n logger.verbose('Enriched opportunity', {\n enrichedFrom,\n actorCount: mergedActors.length,\n });\n\n return {\n enriched: true,\n data: enrichedData,\n expiredIds: enrichedFrom,\n resolvedStatus,\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"opportunity.evaluator.d.ts","sourceRoot":"/","sources":["opportunity/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,iCAAiC,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAKpF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AA4J1F,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,EA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WAAW,EAAE,yFAAyF;YACtG,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;gBACf,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;gBACrF,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;gBAChF,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;aAC5E,CAAC;SACH,CACF,CAAC;IACJ,CAAC;CACF;AAvRc;IADZ,KAAK,EAAE;;;;kDAmCP;AA0DY;IADZ,KAAK,EAAE;;;;8DAgJP","sourcesContent":["import type { Runnable } from \"@langchain/core/runnables\";\nimport { HumanMessage, SystemMessage } from \"@langchain/core/messages\";\nimport { tool } from \"@langchain/core/tools\";\nimport { z } from \"zod\";\nimport { protocolLogger } from \"../shared/observability/protocol.logger.js\";\nimport type { Lens } from \"../shared/hyde/lens.inferrer.js\";\nimport type { OpportunityStatus } from \"../shared/interfaces/database.interface.js\";\nimport { Timed } from \"../shared/observability/performance.js\";\nimport { stripUuids } from \"./opportunity.presentation.js\";\nimport { createStructuredModel } from \"../shared/agent/model.config.js\";\nimport { invokeWithAbortSignal } from \"../shared/agent/model-signal.js\";\nimport type { OpportunityEvidence } from '../shared/schemas/network-assignment.schema.js';\nimport { renderOpportunityEvidenceForPrompt } from './opportunity.evidence.js';\nimport { hasUnsupportedOpportunityClaim } from './opportunity.claim-safety.js';\nimport { normalizeOpportunityActorIntent } from './opportunity.actor.js';\n\nconst logger = protocolLogger(\"OpportunityEvaluator\");\nconst invokeLog = protocolLogger(\"OpportunityEvaluator:invoke\");\nconst invokeEntityBundleLog = protocolLogger(\"OpportunityEvaluator:invokeEntityBundle\");\n\n\n// ──────────────────────────────────────────────────────────────\n// 1. SYSTEM PROMPT\n// ──────────────────────────────────────────────────────────────\n\n\nconst systemPrompt = `\n You are an expert \"Opportunity Matcher\" and super-connector.\n Your Goal: Analyze a Source User's profile against a Candidate User's profile to identify A SINGLE HIGH-VALUE opportunity.\n\n Input:\n - Source Context: The Source User's own Profile.\n - Candidate Profile (JSON)\n - Existing Opportunities (Context of matches already made)\n\n Output:\n - A list containing EXACTLY ONE \"Opportunity\" if a match exists.\n - If NO match exists, return an empty list.\n - Score (0-100): How strong is this match?\n - 90-100: \"Must Meet\" (Perfect alignment).\n - 70-89: \"Should Meet\" (Strong overlaps, clear potential).\n - <70: No opportunity (Return empty list).\n\n **CRITICAL: VALENCY & REASONING**\n \n 1. **Valency Analysis**:\n - Determine the semantic role of the Candidate relative to the Source's goal.\n - \"Agent\": The Candidate CAN DO something for the Source (e.g., Source needs a dev, Candidate IS a dev).\n - \"Patient\": The Candidate NEEDS something from the Source (e.g., Source is a mentor, Candidate needs mentoring).\n - \"Peer\": Symmetric collaboration.\n\n 2. **Reasoning (Third-Party Analytical Perspective)**:\n - **reasoning**: A neutral, third-party explanation of why this opportunity exists. Written for other LLM agents to read and understand.\n - Mention BOTH users by their roles (e.g. \"The source user\" and \"The candidate\") and explain why they are a match.\n - Do NOT address either user as \"you\". Write from an objective observer's perspective.\n - Include what each side brings to the connection and why it is mutually valuable.\n - NEVER leak private intents. If someone's intent is confidential, describe their relevant attributes instead.\n\n **VISIBILITY IMPLICATIONS OF ROLE ASSIGNMENT**\n\n The valency role you assign directly controls who sees the opportunity and when:\n - \"Agent\" (helper/provider): LAST to see the opportunity — only after the Patient has committed to reaching out. Agents are protected from noise; they only see high-intent connections.\n - \"Patient\" (seeker/requester): Sees the opportunity early and decides whether to reach out.\n - \"Peer\" (symmetric): Both parties see the opportunity immediately and either can initiate.\n\n Choose the role carefully — it determines the entire flow of how the connection unfolds.\n\n Rules:\n 1. SYNTHESIS (CRITICAL): If multiple distinct match angles exist, SYNTHESIZE them into a SINGLE, robust opportunity.\n 2. NEVER address either user directly — always use third-party references (\"the source\", \"the candidate\").\n 3. COMPREHENSIVE: The single opportunity must capture ALL the value of the connection.\n 4. Be specific about the \"Why\" for BOTH sides in the reasoning.\n 5. DEDUPLICATION: Do NOT suggest opportunities that duplicate \"Existing Opportunities\".\n 6. Do not suggest an opportunity if the source and candidate clearly already know each other (e.g. same company, co-founders, same team).\n 7. SAME-SIDE MATCHING: If both the source and candidate are SEEKING the same resource (e.g., both looking for investors, both seeking a co-founder), this is not an opportunity. Return an empty list unless one side clearly OFFERS what the other SEEKS.\n 8. NETWORK CONTEXT IS NOT PERSON EVIDENCE: A network assignment, title, type, or metadata is retrieval and thematic context only. It is never proof that a person attended an event, belongs to a group, resides in a place, knows anyone else from the network, or shared a session, time, or location with anyone. Do not state or infer those claims in opportunity reasoning.\n`;\n\n// Entity-bundle system prompt (C2): entities + four match patterns + actors output\n// NOTE: entityBundleSystemPrompt uses a >= 30 threshold (permissive) while\n// systemPrompt uses >= 70 (strict). This is intentional: batch mode casts a wide\n// net so the calling pipeline can apply its own filters; pairwise mode is strict\n// because it returns a single yes/no decision per candidate pair.\nconst entityBundleSystemPrompt = `\nYou are an expert \"Opportunity Matcher\" and super-connector.\nYour Goal: Analyze a set of entities (people), each with a profile and optional intents, and identify HIGH-VALUE opportunities among them.\n\nInput:\n- DISCOVERER: The user ID who triggered discovery (for context; they may or may not be in the entity list).\n- ENTITIES: A set of entities. Each entity has:\n - userId, networkId (the index through which they were found)\n - evidenceKey (stable key for the matched resource when available)\n - profile: name, bio, location, interests, skills, context\n - intents (optional): list of { intentId, payload, summary } — some entities are profile-only, some have intents\n - ragScore, matchedVia (how they were found)\n - evidence (typed retrieval evidence: discovery kind, network, score, lens, source/candidate ids)\n- EXISTING OPPORTUNITIES: Context of matches already made (for deduplication).\n\nBEFORE SCORING — determine role satisfiability:\n\nDefinitions:\n SUBSTITUTIVE ROLE: The candidate can directly fill the open position in the discoverer's intent. The candidate IS the person/entity the discoverer is seeking. Example: discoverer seeks \"co-founder\" → candidate is an engineer willing to co-found.\n COMPLEMENTARY ROLE: The candidate's contribution is defined relative to the seeker-sought relation from the outside — they fund, advise, recruit for, or enable the sought relationship rather than participating in it as the target. Example: discoverer seeks \"co-founder\" → candidate is a VC (funds the company, does not co-found it).\n\nStep 1 — Identify the open argument in each discoverer intent: what type of person or entity would satisfy the intent if found?\nStep 2 — For each candidate, ask: can this candidate directly fill that open argument position?\n YES → substitutive role. Proceed to scoring.\n NO → complementary role. Apply Rule 7 (score ≤ 30, return no opportunity).\nStep 3 — Contextual override: if the candidate's profile contains explicit evidence that they currently function in the substitutive role (e.g., a former investor who is now building full-time as a technical co-founder), re-evaluate Step 2 against their current role, not their categorical label.\n\nMatch patterns to consider:\n1. Profile-to-profile: Complementary backgrounds (skills, interests, location).\n2. Profile-to-intents+profile: Someone's skills/background match another's stated goals (intents).\n3. Intents+profile-to-profile: Someone's stated goals match another's skills/background.\n4. Intents+profile-to-intents+profile: Complementary or reciprocal goals between two or more people.\n\nOutput:\n- A list of 0..N opportunities. Each opportunity has:\n - reasoning: Third-party analytical explanation (for other LLM agents). Mention entities by role. Do NOT use \"you\". Never leak private intents.\n - score: 0-100.\n - 90-100: Must Meet — candidate's PRIMARY role directly matches what the discoverer seeks.\n Example: discoverer seeks \"AI/ML co-founder\" → candidate IS an AI/ML engineer who wants to co-found.\n - 70-89: Should Meet — meaningful overlap on role type AND complementary intent.\n - 50-69: Worth Considering — tangential overlap only.\n - <30 (return empty): Complementary-role mismatch (candidate cannot fill the discoverer's open argument position), same-side match, or already acquainted.\n Example: discoverer seeks \"co-founder\" → candidate is a VC investor. The investor's contribution is external to the co-founding relation; they cannot substitute into it. Score 0.\n - IMPORTANT: Include ALL reasonable matches with scores >= 30, and ONLY those. Any candidate you would reject (complementary-role mismatch, same-side, already-acquainted, or a hard location mismatch) must score strictly below 30 and be omitted entirely — the surfacing threshold is 30, so a rejected candidate parked at exactly 30 would be wrongly surfaced.\n - actors: At least 2 actors per opportunity. Each actor has:\n - userId\n - role: \"agent\" (can do something for others), \"patient\" (needs something from others), \"peer\" (symmetric collaboration)\n - intentId (optional): if the match is intent-driven, the specific intent ID for that user\n - evidenceKey (optional): copy the entity evidenceKey when the actor is driven by a specific listed entity\n\nVISIBILITY (role controls who sees the opportunity when):\n- agent: Last to see — after the patient has committed to reaching out.\n- patient: Sees early and decides whether to reach out.\n- peer: Both see immediately; either can initiate.\n\nRules:\n1. ONE OPPORTUNITY PER CANDIDATE: Create a SEPARATE opportunity for EACH candidate who matches. Do NOT combine multiple candidates into one opportunity. Each opportunity should have exactly 2 actors: the DISCOVERER and ONE candidate.\n2. INDIVIDUAL REASONING: Write specific reasoning for EACH candidate individually. Do NOT mention other candidates in the reasoning. Focus on why THIS specific candidate matches THIS specific discoverer.\n3. DEDUPLICATION: Do not suggest opportunities that duplicate Existing Opportunities.\n4. Write reasoning from an objective observer's perspective; be specific about the \"Why\" for each side.\n5. When in introduction mode, each opportunity must have exactly two actors — the two people being introduced. The discoverer (introducer) is added by the system and must not be included in your actors list.\n6. ALREADY KNOW EACH OTHER: Do NOT suggest an opportunity if the entities clearly already know each other. Examples: co-founders of the same company, same team at the same organization, same employer, or any relationship that is obviously existing from their profiles (bio, context). When in doubt, if both profiles mention the same company/org/team in a way that implies they work together, return an empty list for that pair.\n7. ROLE-SATISFIABILITY (evaluate before scoring): A candidate satisfies a discoverer's intent only if they can fill the SUBSTITUTIVE ROLE — the open argument position in the intent (the type of person the discoverer is seeking). A candidate in a COMPLEMENTARY ROLE (one that funds, advises, recruits for, or otherwise enables the sought relation from outside it) does not satisfy the intent, regardless of how closely associated their domain is.\n COMPLEMENTARY-ROLE CAP: If the candidate occupies a complementary rather than substitutive role relative to the discoverer's intent, score below 30 (e.g. 0–20). Return no opportunity. A \"reject\" score must be strictly below 30 so the candidate is not surfaced — never park a rejected candidate at exactly 30.\n CONTEXTUAL OVERRIDE: If the candidate's profile contains explicit evidence that they currently function in the substitutive role (not merely historically or tangentially), treat them as substitutive and score normally.\n8. SAME-SIDE MATCHING: Before scoring, check whether the DISCOVERER and CANDIDATE are both SEEKING the same thing. Look at both parties' intents for directionality:\n - SEEKING signals: \"looking for\", \"seeking\", \"want to find\", \"need\", \"raising\", \"hiring\"\n - OFFERING signals: \"can offer\", \"expert in\", \"investing in\", \"mentoring\", \"available for\"\n If both parties have SEEKING intents targeting the same resource (e.g., both seeking investors, both seeking co-founders, both seeking mentorship), this is NOT an opportunity — score <30. An opportunity requires one side to OFFER what the other SEEKS.\n9. LOCATION MATCHING: When the DISCOVERY REQUEST mentions a specific location (city, region, or country):\n a. If a candidate's profile.location is KNOWN and clearly does NOT match the requested location (different city/region), score below 30 (e.g. 0–25) and return no opportunity. An explicitly requested location is a hard constraint: a known geographic mismatch excludes the candidate.\n b. If a candidate's profile.location is UNKNOWN, EMPTY, or AMBIGUOUS, do NOT penalize — allow them through and score based on other factors. Note in reasoning that their location is unverified.\n c. If a candidate's profile.location matches or is reasonably close (e.g., \"Bay Area\" matches \"San Francisco\", \"Remote\" matches any location), score normally.\n d. \"Remote\" or \"Global\" locations are compatible with any requested location.\n10. EVENT NETWORK CONTEXT: When NETWORK CONTEXTS includes an event-type network (identified by dates, location, schedule, or themes):\n a. TEMPORAL RELEVANCE: Event start/end dates may affect whether an explicitly stated event-related intent is timely. After an event ends, event-specific intents lose relevance unless the connection has lasting value.\n b. THEME ALIGNMENT: Event themes or tracks may be used as thematic retrieval context when a person's own profile or intent independently aligns with them.\n c. PROHIBITED INFERENCE: Network assignment, title, type, schedule, location, and metadata are retrieval context only. They are never proof that any person attended or will attend, belongs to the event or network, resides in its location, knows another person from it, or shared a session, time, place, or location with anyone. Do not infer co-attendance, same-place/same-time presence, session attendance, or peer roles from network co-membership.\n`;\n\n// ──────────────────────────────────────────────────────────────\n// 2. RESPONSE SCHEMA (Zod)\n// ──────────────────────────────────────────────────────────────\n\nconst OpportunitySchema = z.object({\n reasoning: z.string().describe('Third-party analytical explanation of why this opportunity exists. Mentions both users by role. Written for other LLM agents to understand the match.'),\n score: z.number().min(0).max(100).describe('Relevance score 0-100'),\n valencyRole: z.enum(['Agent', 'Patient', 'Peer']).describe(\"The semantic role of the Candidate relative to the Source\"),\n sourceId: z.string().describe('The user ID of the source'),\n candidateId: z.string().describe('The user ID of the candidate'),\n});\n\nconst responseFormat = z.object({\n opportunities: z.array(OpportunitySchema).describe(\"List of opportunities identified\"),\n});\n\n// ─── Entity-bundle evaluator (C1): types and output schema with actors ───\n\nexport interface EvaluatorEntity {\n userId: string;\n profile: {\n name?: string;\n bio?: string;\n location?: string;\n interests?: string[];\n skills?: string[];\n context?: string;\n };\n intents?: Array<{\n intentId: string;\n payload: string;\n summary?: string;\n }>;\n networkId: string;\n evidenceKey?: string;\n ragScore?: number;\n matchedVia?: string;\n evidence?: OpportunityEvidence[];\n}\n\nexport interface EvaluatorInput {\n /** The user who triggered discovery (for context, not special treatment). */\n discovererId: string;\n /** All relevant entities. In introduction mode, only the people being introduced (no introducer). */\n entities: EvaluatorEntity[];\n /** Existing opportunities for deduplication. */\n existingOpportunities?: string;\n /** When true, DISCOVERER is the introducer; reasoning and actors must be only among ENTITIES. */\n introductionMode?: boolean;\n /** Name of the introducer (for attribution in reasoning when introductionMode is true). */\n introducerName?: string;\n /** Optional hint/context from the introducer about why these people should meet. */\n introductionHint?: string;\n /** Optional discovery query (e.g. from chat). When set, only suggest opportunities where candidates clearly match this request. */\n discoveryQuery?: string;\n /** Pre-rendered network context markdown, keyed by networkId. */\n networkContexts?: Record<string, string>;\n}\n\nconst ActorSchema = z.object({\n userId: z.string(),\n role: z.enum(['agent', 'patient', 'peer']),\n intentId: z.string().nullable()\n .transform((value) => normalizeOpportunityActorIntent(value) ?? null)\n .describe('If the match is intent-driven, the specific intent ID; null otherwise'),\n evidenceKey: z.string().nullable().optional().describe('Stable evidence key for the matched entity; null if unknown'),\n});\n\nconst OpportunityWithActorsSchema = z.object({\n reasoning: z.string(),\n score: z.number().min(0).max(100),\n actors: z.array(ActorSchema).min(2).describe('All actors in this opportunity with their roles'),\n});\n\nconst entityBundleResponseFormat = z.object({\n opportunities: z.array(OpportunityWithActorsSchema).describe('List of opportunities (0..N)'),\n});\n\nexport type EvaluatorActor = z.infer<typeof ActorSchema>;\nexport type EvaluatedOpportunityWithActors = z.infer<typeof OpportunityWithActorsSchema>;\nexport type EvaluatorOutputBundle = z.infer<typeof entityBundleResponseFormat>;\n\n// ──────────────────────────────────────────────────────────────\n// 3. TYPE DEFINITIONS\n// ──────────────────────────────────────────────────────────────\n\ntype Opportunity = z.infer<typeof OpportunitySchema>;\ntype EvaluatorOutput = z.infer<typeof responseFormat>;\n\n// Define CandidateProfile type (simplified for now, ideally imported from shared types)\nexport interface CandidateProfile {\n userId: string;\n identity?: { name?: string; bio?: string; location?: string };\n attributes?: { interests?: string[]; skills?: string[] };\n narrative?: { context?: string };\n score?: number; // Search score\n}\n\ninterface OpportunityEvaluatorOptions {\n minScore?: number;\n limit?: number;\n hydeDescription?: string;\n /** Pre-inferred lenses (if not provided, lens inference runs automatically in HyDE graph). */\n lenses?: Lens[];\n existingOpportunities?: string;\n candidates?: CandidateProfile[]; // For direct evaluation\n filter?: Record<string, unknown>;\n initialStatus?: OpportunityStatus;\n /** Optional caller cancellation; does not change retry/fallback policy. */\n signal?: AbortSignal;\n}\n\n// ──────────────────────────────────────────────────────────────\n// 4. CLASS DEFINITION\n// ──────────────────────────────────────────────────────────────\n\n/** Optional test double for entity-bundle model (avoids live LLM in unit tests). */\nexport type OpportunityEvaluatorOptionsConstructor = {\n entityBundleModel?: Runnable;\n};\n\nexport class OpportunityEvaluator {\n private model: Runnable;\n private entityBundleModel: Runnable;\n\n constructor(options?: OpportunityEvaluatorOptionsConstructor) {\n this.model = createStructuredModel(\"opportunityEvaluator\", responseFormat, {\n name: \"opportunity_evaluator\"\n });\n this.entityBundleModel = options?.entityBundleModel ?? createStructuredModel(\"opportunityEvaluator\", entityBundleResponseFormat, {\n name: \"opportunity_evaluator_entity_bundle\"\n });\n }\n\n /**\n * Main Entry Point: Batch analysis of candidates.\n * \n * @param sourceProfileContext - The profile context string of the user we are finding opportunities FOR.\n * @param candidates - List of potential matches to evaluate.\n * @param options - Config (minScore, valid types, etc).\n * @returns A sorted list of high-value `Opportunity` objects.\n */\n @Timed()\n public async invoke(\n sourceProfileContext: string,\n candidates: CandidateProfile[],\n options: OpportunityEvaluatorOptions\n ): Promise<Opportunity[]> {\n const minScore = options.minScore || 70;\n\n invokeLog.verbose('Analyzing candidates', { count: candidates.length });\n\n if (candidates.length === 0) {\n logger.verbose('No candidates provided.');\n return [];\n }\n\n const opportunities: Opportunity[] = [];\n\n // Analyze each candidate in parallel (bounded)\n const promises = candidates.map(async (candidate) => {\n // Pass existing opportunities context if provided\n const existingContext = options.existingOpportunities || '';\n return this.analyzeMatch(sourceProfileContext, candidate, candidate.userId, existingContext, options.signal);\n });\n\n const results = await Promise.all(promises);\n results.flat().forEach(op => {\n if (op.score >= minScore) {\n opportunities.push(op as Opportunity);\n }\n });\n\n // Sort by score and take top 1\n const out = opportunities.sort((a, b) => b.score - a.score).slice(0, 1);\n invokeLog.verbose('Done', { accepted: out.length });\n return out;\n }\n\n /**\n * Analyze a single match pair using the primary Agent model.\n */\n private async analyzeMatch(\n sourceProfileContext: string,\n candidateProfile: CandidateProfile,\n candidateUserId: string,\n existingOpportunities: string,\n signal?: AbortSignal,\n ): Promise<Opportunity[]> {\n try {\n // Construct the source context part of the prompt\n const sourceContext = `SOURCE PROFILE:\\n${sourceProfileContext}`;\n\n const existingContextPart = existingOpportunities\n ? `\\nEXISTING OPPORTUNITIES (Deduplication Context):\\n${existingOpportunities}\\n`\n : '';\n\n // Create candidate context using template string\n const candidateContext = `\n ID: ${candidateUserId}\n Name: ${candidateProfile.identity?.name || 'Unknown'}\n Bio: ${candidateProfile.identity?.bio || ''}\n Location: ${candidateProfile.identity?.location || ''}\n Interests: ${candidateProfile.attributes?.interests?.join(', ') || ''}\n Skills: ${candidateProfile.attributes?.skills?.join(', ') || ''}\n\n Context: ${candidateProfile.narrative?.context || ''}\n `;\n\n const messages = [\n new SystemMessage(systemPrompt),\n new HumanMessage(`${sourceContext}\\n${existingContextPart}\\nCANDIDATE PROFILE:\\n${candidateContext}`)\n ];\n\n const result = await invokeWithAbortSignal(this.model, messages, signal);\n const output = responseFormat.parse(result);\n\n const mappedOpportunities = output.opportunities.map((op: Opportunity) => ({\n ...op,\n reasoning: stripUuids(op.reasoning),\n candidateId: candidateUserId,\n }));\n\n return mappedOpportunities;\n } catch (e: unknown) {\n const message = e instanceof Error ? e.message : String(e);\n logger.warn('Analysis failed for candidate', { candidateUserId, message });\n throw e;\n }\n }\n\n /**\n * Entity-bundle entry point (C3): single LLM call with all entities, returns 0..N opportunities with actors.\n */\n @Timed()\n public async invokeEntityBundle(\n input: EvaluatorInput,\n options: { minScore?: number; returnAll?: boolean; signal?: AbortSignal } = {}\n ): Promise<EvaluatedOpportunityWithActors[]> {\n const minScore = options.minScore ?? 70;\n const returnAll = options.returnAll ?? false;\n const totalEntities = input.entities?.length ?? 0;\n if (!input.entities?.length) {\n invokeEntityBundleLog.verbose('No entities.');\n return [];\n }\n const existingPart = input.existingOpportunities\n ? `\\nEXISTING OPPORTUNITIES:\\n${input.existingOpportunities}\\n`\n : '';\n const introModePart = input.introductionMode\n ? `\\nINTRODUCTION MODE: This is a human-curated introduction. ${input.introducerName ?? 'The introducer'} (DISCOVERER: ${input.discovererId}) explicitly wants these people to connect. This is NOT an automatic discovery — a real person saw value in this connection.\n\nCRITICAL REASONING INSTRUCTIONS FOR INTRODUCTIONS:\n- Your reasoning MUST acknowledge that this is an introduction initiated by ${input.introducerName ?? 'the introducer'}, not a system-discovered match.\n- Start reasoning with something like \"${input.introducerName ?? 'The introducer'} is connecting [Name A] and [Name B] because...\" or \"This introduction by ${input.introducerName ?? 'the introducer'} brings together...\"\n- Even if the parties' intents or profiles don't obviously overlap, the introduction is still valid because the introducer saw the connection. Explain what the introducer likely sees in this match.\n- If explicit intents align, mention them — but frame it as supporting the introducer's judgment, not as the primary reason.${input.introductionHint ? `\\nINTRODUCER'S CONTEXT: \"${input.introductionHint}\" — use this to inform your reasoning about why the introducer made this connection.` : ''}\n- Actors must refer ONLY to the ENTITIES below (the people being introduced). Do not include the DISCOVERER as an actor.\n- You must output exactly two actors per opportunity (the two people being introduced). The introducer is added separately; do not include them in actors.\n- Be generous with scoring (70+ for any introduction with a plausible basis, since a human made the judgment).\n`\n : '';\n const discoveryQueryPart = input.discoveryQuery?.trim()\n ? `\\nDISCOVERY REQUEST: The user asked: \"${input.discoveryQuery.trim()}\"\n\nCRITICAL SCORING RULES FOR DISCOVERY REQUESTS:\n\n0. QUERY IS PRIMARY: The DISCOVERY REQUEST above is the primary evaluation criterion. The source user's stored INTENTS (if listed below) are background context — use them ONLY to fill in blanks when the query is too broad or vague to evaluate on its own. If the query is specific enough to score candidates, score strictly against the query and IGNORE stored intents. Never let a stored intent override or replace the query as the basis for scoring. When a specific query imposes a hard identity, role, capability, or location constraint, candidates that only match background context or thematic adjacency must score strictly below 30 and be omitted.\n\n1. CLASSIFY THE QUERY TYPE — determine the predication type before scoring:\n\n IDENTITY/ROLE QUERY: The query term is a count noun or sortal that can serve as a predicate nominal — \"X IS A [query]\" is grammatical and meaningful. Examples: \"samurai\", \"investors\", \"designers\", \"nurses\", \"founders\". The user wants someone who IS that thing — not someone who works with, creates content about, or is tangentially associated with it.\n → Test: Can you say \"this person IS a [query term]\"? If yes, this is an identity query.\n → CRITICAL: Subject-matter contact is NOT identity. A character designer who draws samurai IS NOT a samurai. An engineer who raised funding IS NOT an investor. A journalist who covers finance IS NOT an investor. IS-A is not transitive through creative subject matter, professional adjacency, or domain familiarity.\n\n TOPICAL/DOMAIN QUERY: The query is a field, domain, or abstract topic — \"X IS A [query]\" is ungrammatical. Examples: \"machine learning\", \"sustainability\", \"blockchain\". The user wants someone who works in or has expertise in this domain.\n → Test: \"This person IS a machine learning\" makes no sense → topical query.\n\n NEED/CAPABILITY QUERY: The query contains a purposive frame — \"someone to help with X\", \"need a Y\", \"looking for Z\". The user describes a specific need.\n\n2. APPLY TYPE-SPECIFIC SCORING:\n\n For IDENTITY/ROLE queries — apply a categorical gate:\n - First, make a binary IS-A judgment for each candidate: does this person's PRIMARY professional identity or self-description place them within the extension of the query term?\n - IS-A = TRUE → score 75-100 (modulated by intent alignment and profile richness)\n - IS-A = FALSE → score <30. Hard ceiling. Return no opportunity. Do NOT award surfacing credit for subject-matter adjacency, thematic association, creative output involving the query term, having received the thing, or being adjacent to people who are the thing.\n - Do NOT rescue a failed IS-A judgment with background intents. If the user searched \"samurai\" and the candidate is a visual artist (IS-A = false), the candidate's alignment with a background intent like \"connect with visual artists\" does not matter — the explicit query takes priority. If the user searched \"investors\" and the candidate merely raised money, score <30. If the user searched \"scouts\" and the candidate was scouted, score <30. If the user searched \"art director\", a solo illustrator is not enough: require explicit evidence that the candidate owns visual direction, leads/briefs other artists, manages a visual system, or is described as an art/creative director. General visual taste, composition skill, or illustration output alone is a failed IS-A judgment and must score <30.\n\n For TOPICAL/DOMAIN queries — apply gradient scoring:\n - 90-100: Deep expertise, primary focus area\n - 70-89: Substantial engagement, meaningful work in the domain\n - 50-69: Peripheral involvement, tangential connection\n - <50: No meaningful engagement\n\n For NEED/CAPABILITY queries — apply capability + availability scoring:\n - Score based on both capability match AND openness to the described collaboration\n - 90-100: Perfect capability match with explicit availability\n - 70-89: Strong capability, plausible availability\n\n3. SAME-SIDE CHECK: If the candidate's intents show they are ALSO SEEKING what the discoverer is seeking (e.g., both looking for investors, both looking for co-founders), this is a same-side match. Score <30 regardless of keyword overlap in bios. The candidate must BE or OFFER what the discoverer is looking for, not also be looking for it.\n\n4. LOCATION ENFORCEMENT: If the discovery request mentions a specific location (e.g., \"in SF\", \"based in London\", \"Istanbul\"), check each candidate's profile.location:\n - KNOWN MISMATCH (e.g., request says \"SF\" but candidate is \"New York\"): Score <30 and return no opportunity. State the mismatch in reasoning if returning diagnostic output. A known location mismatch is a hard query failure, even when the candidate otherwise matches the source's background interests.\n - UNKNOWN/EMPTY location: Do not penalize, and do NOT reject solely because the query contains a location. Treat location as unverified/missing evidence, then score on the non-location parts of the query. If the candidate strongly satisfies the requested role/domain (e.g., query \"Unreal Engine developers in SF\" and candidate is clearly an Unreal Engine developer with empty location), score normally enough to surface (typically 60-89) and note that location is unverified.\n - MATCH or COMPATIBLE (e.g., \"Bay Area\" ≈ \"SF\", \"Remote\" ≈ any): Score normally.\n`\n : '';\n const hasDiscoveryQuery = !!input.discoveryQuery?.trim();\n const entitiesBlock = input.entities.map((e) => {\n const isSource = e.userId === input.discovererId;\n // When an explicit discovery query is active, label the source user's stored\n // intents as background context so the LLM treats the query as primary.\n const intentsLabel = isSource && hasDiscoveryQuery ? 'BACKGROUND INTENTS (use only if query is too vague)' : 'INTENTS';\n const intentsPart = e.intents?.length\n ? `\\n ${intentsLabel}:\\n${e.intents.map((i) => ` - ${i.intentId}: ${i.payload}`).join('\\n')}`\n : '';\n // Mask the discoverer's name so the LLM cannot leak it into reasoning.\n // The system prompt already says \"use third-party references\", but the LLM\n // ignores this when the actual name is visible. Masking it forces role-based\n // language (\"the source user is looking…\" instead of \"Alice is looking…\").\n const displayName = e.userId === input.discovererId\n ? '(source user)'\n : (e.profile.name ?? '');\n return `\n USER: ${e.userId}\n INDEX: ${e.networkId}\n EVIDENCE KEY: ${e.evidenceKey ?? '—'}\n PROFILE: Name: ${displayName} | Bio: ${e.profile.bio ?? ''} | Location: ${e.profile.location ?? ''} | Interests: ${e.profile.interests?.join(', ') ?? ''} | Skills: ${e.profile.skills?.join(', ') ?? ''} | Context: ${e.profile.context ?? ''}${intentsPart}\n RAG SCORE: ${e.ragScore ?? '—'}\n MATCHED VIA: ${e.matchedVia ?? '—'}\n EVIDENCE:\n${renderOpportunityEvidenceForPrompt(e.evidence ?? [])}`;\n }).join('\\n');\n const networkContextPart = input.networkContexts && Object.keys(input.networkContexts).length > 0\n ? `\\n\\nNETWORK CONTEXTS:\\n${Object.entries(input.networkContexts).map(([nid, ctx]) => `[INDEX: ${nid}]\\n${ctx}`).join('\\n\\n')}`\n : '';\n const humanContent = `DISCOVERER: ${input.discovererId}${introModePart}${discoveryQueryPart}${networkContextPart}\\n\\nENTITIES:\\n${entitiesBlock}${existingPart}`;\n const messages = [\n new SystemMessage(entityBundleSystemPrompt),\n new HumanMessage(humanContent),\n ];\n let parsedTotal = 0;\n try {\n const result = await invokeWithAbortSignal(this.entityBundleModel, messages, options.signal);\n const parsed = entityBundleResponseFormat.parse(result);\n for (const op of parsed.opportunities) {\n op.reasoning = stripUuids(op.reasoning);\n }\n parsedTotal = parsed.opportunities.length;\n // Persistence safety is deterministic and precedes every score/returnAll\n // path. Network/context placement is not typed support provenance, so an\n // unsupported affiliation or presence claim rejects the whole result.\n const claimSafe = parsed.opportunities.filter(\n (op) => !hasUnsupportedOpportunityClaim(op.reasoning),\n );\n const introGuard =\n input.introductionMode\n ? claimSafe.filter((op) => op.actors.length === 2)\n : claimSafe;\n const filtered = introGuard.filter((op) => op.score >= minScore);\n invokeEntityBundleLog.verbose('Done', {\n total: parsed.opportunities.length,\n afterClaimGuard: claimSafe.length,\n afterIntroGuard: introGuard.length,\n accepted: filtered.length,\n returnAll,\n });\n return returnAll ? introGuard : filtered;\n } catch (llmError) {\n invokeEntityBundleLog.error('Failed', {\n discovererId: input.discovererId,\n totalEntities,\n parsedTotal,\n minScore,\n llmError,\n });\n throw llmError;\n }\n }\n\n /**\n * Factory method to expose the agent as a LangChain tool.\n * Simplified to only accept direct evaluation arguments.\n * PURE: Does not perform any database lookups.\n */\n public static asTool() {\n return tool(\n async (args: {\n sourceProfileContext: string;\n candidatesJson?: string;\n minScore?: number;\n }) => {\n const agent = new OpportunityEvaluator();\n\n const sourceProfileContext = args.sourceProfileContext;\n\n let candidates: CandidateProfile[] = [];\n if (args.candidatesJson) {\n try {\n candidates = JSON.parse(args.candidatesJson);\n } catch (e) {\n logger.error(\"Failed to parse candidates JSON\");\n }\n }\n\n const options: OpportunityEvaluatorOptions = {\n minScore: args.minScore,\n };\n\n return await agent.invoke(sourceProfileContext, candidates, options);\n },\n {\n name: 'opportunity_evaluator',\n description: 'Evaluates candidates against a source profile. SOURCE PROFILE CONTEXT MUST BE PROVIDED.',\n schema: z.object({\n sourceProfileContext: z.string().describe('The resolved source user profile context'),\n candidatesJson: z.string().optional().describe('JSON string list of Candidates'),\n minScore: z.number().optional().describe('Minimum score to accept a match')\n })\n }\n );\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"opportunity.evidence.d.ts","sourceRoot":"/","sources":["opportunity/opportunity.evidence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAE1F,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,OAAO,GAAG,oBAAoB,GAAG,mBAAmB,CAAC;IACvE,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,sBAAsB,GAAG,mBAAmB,CAiB7F;AAED,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,sBAAsB,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC,GAAG;IAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAA;CAAE,CAE7H;AAED,wBAAgB,wBAAwB,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,mBAAmB,EAAE,GAAG,SAAS,CAAC,GAAG,mBAAmB,EAAE,CAgBnH;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAA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,EAAE,GAAG,aAAa,EAAE,CAAC;IAC7L,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,SAAS,mBAAmB,CAAC,SAAiC;IAC5D,IAAI,SAAS,CAAC,eAAe,KAAK,oBAAoB;QAAE,OAAO,oBAAoB,CAAC;IACpF,IAAI,SAAS,CAAC,eAAe,KAAK,mBAAmB;QAAE,OAAO,mBAAmB,CAAC;IAClF,IAAI,SAAS,CAAC,kBAAkB;QAAE,OAAO,eAAe,CAAC;IACzD,IAAI,SAAS,CAAC,iBAAiB;QAAE,OAAO,cAAc,CAAC;IACvD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import type { OpportunityEvidence } from '../shared/schemas/network-assignment.schema.js';\n\nexport interface EvidenceCandidateInput {\n networkId: string;\n similarity: number;\n lens: string;\n discoverySource?: 'query' | 'premise-similarity' | 'context-to-intent';\n matchedStrategies?: string[];\n sourcePremiseId?: string;\n candidatePremiseId?: string;\n candidateIntentId?: string;\n sourceContextId?: string;\n candidatePayload?: string;\n candidateSummary?: string;\n}\n\nexport function buildCandidateEvidence(candidate: EvidenceCandidateInput): OpportunityEvidence {\n const kind = resolveEvidenceKind(candidate);\n return {\n kind,\n networkId: candidate.networkId,\n score: candidate.similarity,\n lens: candidate.lens,\n discoverySource: candidate.discoverySource,\n matchedStrategies: candidate.matchedStrategies,\n sourcePremiseId: candidate.sourcePremiseId,\n candidatePremiseId: candidate.candidatePremiseId,\n candidateIntentId: candidate.candidateIntentId,\n sourceContextId: candidate.sourceContextId,\n payload: candidate.candidatePayload,\n summary: candidate.candidateSummary,\n assertionText: candidate.candidatePremiseId ? candidate.candidatePayload : undefined,\n };\n}\n\nexport function withCandidateEvidence<T extends EvidenceCandidateInput>(candidate: T): T & { evidence: OpportunityEvidence[] } {\n return { ...candidate, evidence: [buildCandidateEvidence(candidate)] };\n}\n\nexport function mergeOpportunityEvidence(...groups: Array<OpportunityEvidence[] | undefined>): OpportunityEvidence[] {\n const byKey = new Map<string, OpportunityEvidence>();\n for (const evidence of groups.flatMap((group) => group ?? [])) {\n const key = [\n evidence.kind,\n evidence.networkId,\n evidence.sourcePremiseId ?? '',\n evidence.candidatePremiseId ?? '',\n evidence.candidateIntentId ?? '',\n evidence.sourceContextId ?? '',\n evidence.lens ?? '',\n ].join('|');\n const existing = byKey.get(key);\n if (!existing || (evidence.score ?? 0) > (existing.score ?? 0)) byKey.set(key, evidence);\n }\n return Array.from(byKey.values());\n}\n\nexport function withMatchedStrategies(evidence: OpportunityEvidence[], strategies: string[]): OpportunityEvidence[] {\n return evidence.map((item) => ({\n ...item,\n matchedStrategies: Array.from(new Set([...(item.matchedStrategies ?? []), ...strategies])),\n }));\n}\n\nexport function renderOpportunityEvidenceForPrompt(evidence: OpportunityEvidence[]): string {\n if (evidence.length === 0) return ' —';\n return evidence.map((item) => {\n const refs = [\n item.sourcePremiseId ? `sourcePremise=${item.sourcePremiseId}` : undefined,\n item.candidatePremiseId ? `candidatePremise=${item.candidatePremiseId}` : undefined,\n item.candidateIntentId ? `candidateIntent=${item.candidateIntentId}` : undefined,\n item.sourceContextId ? `sourceContext=${item.sourceContextId}` : undefined,\n item.matchedStrategies?.length ? `strategies=${item.matchedStrategies.join(',')}` : undefined,\n ].filter(Boolean).join(', ');\n const text = item.summary ?? item.payload ?? item.assertionText ?? '';\n // IND-567 Fix B: when a query_premise entry has no text, warn the evaluator\n // so it does not treat a high RAG score as domain confirmation.\n // (text should be populated by Fix A; this fallback fires if the DB fetch\n // failed or the adapter omitted getPremise).\n const domainCaution =\n item.kind === 'query_premise' && !text\n ? ' [premise text unavailable — do NOT infer domain match from RAG score alone; verify domain alignment from profile]'\n : '';\n return ` - ${item.kind} on ${item.networkId} via ${item.lens ?? 'unknown'} score=${item.score?.toFixed(3) ?? '—'}${refs ? ` (${refs})` : ''}${text ? `: ${text}` : ''}${domainCaution}`;\n }).join('\\n');\n}\n\nfunction resolveEvidenceKind(candidate: EvidenceCandidateInput): OpportunityEvidence['kind'] {\n if (candidate.discoverySource === 'premise-similarity') return 'premise_similarity';\n if (candidate.discoverySource === 'context-to-intent') return 'context_to_intent';\n if (candidate.candidatePremiseId) return 'query_premise';\n if (candidate.candidateIntentId) return 'query_intent';\n return 'profile';\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"opportunity.graph.d.ts","sourceRoot":"/","sources":["opportunity/opportunity.graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AACrG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAyB,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAExO,OAAO,EAAwB,KAAK,gBAAgB,EAAuC,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACzK,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAS3F,yDAAyD;AACzD,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,CAAC,EAAE,CACP,oBAAoB,EAAE,MAAM,EAC5B,UAAU,EAAE,gBAAgB,EAAE,EAC9B,OAAO,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,KAC3B,OAAO,CAAC,KAAK,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;KAC3C,CAAC,CAAC,CAAC;IACJ,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,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