@indexnetwork/protocol 6.12.1-rc.404.1 → 6.14.0-rc.406.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 +249 -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 +666 -0
  241. package/dist/negotiation/application/negotiation.graph.js +1394 -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 +79 -0
  357. package/dist/opportunity/application/opportunity.existing-negotiation.js +118 -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 +3707 -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 -1535
  751. package/dist/shared/schemas/question.schema.js +3 -420
  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":"feed.graph.js","sourceRoot":"/","sources":["opportunity/feed/feed.graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAI9D,OAAO,EAAE,cAAc,EAAuF,MAAM,iBAAiB,CAAC;AACtI,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAA0B,MAAM,6BAA6B,CAAC;AACnH,OA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C,uBAAuB,EAAE,uBAAuB,CAAC;aACzD,mBAAmB,CAAC,uBAAuB,EAAE,gBAAgB,EAAE;YAC9D,UAAU,EAAE,uBAAuB;YACnC,IAAI,EAAE,kBAAkB;SACzB,CAAC;aACD,OAAO,CAAC,uBAAuB,EAAE,yBAAyB,CAAC;aAC3D,OAAO,CAAC,yBAAyB,EAAE,kBAAkB,CAAC;aACtD,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;QAEpC,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["/**\n * Home Graph: Build the opportunity home view with dynamic sections.\n *\n * Independent of ChatGraph. Flow:\n * loadOpportunities → checkPresenterCache → [generateCardText if misses] → cachePresenterResults\n * → checkCategorizerCache → [categorizeDynamically if miss] → cacheCategorizerResults → normalizeAndSort\n *\n * Uses OpportunityPresenter for card text and an LLM to categorize cards into dynamic sections\n * with titles and Lucide icon names. Caches presenter and categorizer results via OpportunityCache.\n */\n\nimport { createHash } from 'crypto';\n\nimport { StateGraph, START, END } from '@langchain/langgraph';\n\nimport type { HomeGraphDatabase, OpportunityStatus } from '../../shared/interfaces/database.interface.js';\nimport type { OpportunityCache } from '../../shared/interfaces/cache.interface.js';\nimport { HomeGraphState, type HomeCardItem, type HomeSection, type HomeSectionProposal, type HomeSectionItem } from './feed.state.js';\nimport { OpportunityPresenter, gatherPresenterContext, type PresenterDatabase } from '../opportunity.presenter.js';\nimport { loadNegotiationContext } from '../negotiation-context.loader.js';\nimport { HomeCategorizerAgent } from './feed.categorizer.js';\nimport { canUserSeeOpportunity, isActionableForViewer, selectByComposition } from '../opportunity.utils.js';\nimport { resolveHomeSectionIcon, DEFAULT_HOME_SECTION_ICON } from '../../shared/ui/lucide.icon-catalog.js';\nimport { getPrimaryActionLabel, SECONDARY_ACTION_LABEL } from '../opportunity.labels.js';\nimport { safeFallbackSummary } from '../opportunity.safe-presentation.js';\nimport { buildHomeCardPresentationCacheKey, buildHomeCategoryPresentationCacheKey } from '../opportunity.presentation-cache.js';\nimport type { DebugMetaAgent } from '../../chat/chat-streaming.types.js';\nimport { protocolLogger } from '../../shared/observability/protocol.logger.js';\nimport { timed } from '../../shared/observability/performance.js';\nimport { requestContext } from \"../../shared/observability/request-context.js\";\nimport { adjustedConfidence, latestPoolDemotionDetail, readActivePoolAdjustments } from '../discriminator/discriminator.adjustments.js';\nimport type { PoolAdjustmentProvenance } from '../discriminator/discriminator.adjustments.js';\nimport { poolQuestionsRanking } from '../discriminator/discriminator.env.js';\n\nconst logger = protocolLogger('HomeGraph');\nconst checkCategorizerCacheLog = protocolLogger('HomeGraph:checkCategorizerCache');\nconst cacheCategorizerResultsLog = protocolLogger('HomeGraph:cacheCategorizerResults');\nconst checkPresenterCacheLog = protocolLogger('HomeGraph:checkPresenterCache');\nconst cachePresenterResultsLog = protocolLogger('HomeGraph:cachePresenterResults');\nconst categorizeDynamicallyLog = protocolLogger('HomeGraph:categorizeDynamically');\nconst normalizeAndSortLog = protocolLogger('HomeGraph:normalizeAndSort');\nconst generateCardTextLog = protocolLogger('HomeGraph:generateCardText');\n\n/** Database must satisfy both HomeGraphDatabase and presenter context (getProfile, getActiveIntents, getNetwork, getUser). */\ntype HomeGraphDb = HomeGraphDatabase;\n\nexport type HomeGraphInvokeInput = {\n userId: string;\n networkId?: string;\n scopeType?: 'intent';\n scopeId?: string;\n limit?: number;\n noCache?: boolean;\n /**\n * 'skeleton' returns immediately without LLM work: cached cards complete,\n * uncached cards with identity fields only + `presentationPending: true`,\n * single flat section (no categorizer). Meant as the fast first phase of a\n * two-phase fetch — follow up with a full request to fill in the text.\n */\n presentation?: 'full' | 'skeleton';\n /**\n * When set, filter loaded opportunities to these lifecycle statuses. Defaults to `DEFAULT_HOME_STATUSES`.\n * Explicit statuses switch the graph to \"lifecycle view\" mode: terminal/internal\n * statuses pass through (only latent/pending stay gated by viewer actionability),\n * ordering is newest-first, and feed composition capping is skipped.\n */\n statuses?: OpportunityStatus[];\n};\n\nexport type HomeGraphInvokeResult = {\n sections: HomeSection[];\n meta: { totalOpportunities: number; totalSections: number };\n error?: string;\n};\n\n/** Default home-feed statuses: the lifecycle stages a viewer can act on today. */\nexport const DEFAULT_HOME_STATUSES: OpportunityStatus[] = ['latent', 'pending'];\n\n// Exhaustive registry — keys must cover every OpportunityStatus union member.\n// Adding a new status to OpportunityStatus without adding a key here is a TS error,\n// which is the whole point: prevents ALL_OPPORTUNITY_STATUSES from silently drifting.\nconst OPPORTUNITY_STATUS_REGISTRY: Record<OpportunityStatus, true> = {\n latent: true,\n draft: true,\n negotiating: true,\n pending: true,\n stalled: true,\n accepted: true,\n rejected: true,\n expired: true,\n};\n\n/** Full status enumeration. Pass this to `HomeGraphInvokeInput.statuses` to restore pre-Issue-3 (unfiltered) behavior. */\nexport const ALL_OPPORTUNITY_STATUSES: OpportunityStatus[] = Object.keys(\n OPPORTUNITY_STATUS_REGISTRY,\n) as OpportunityStatus[];\n\nconst MAX_ITEMS_PER_SECTION = 20;\nconst PRESENTATION_CONCURRENCY = 50;\nconst MAX_REASONING_SNIPPET_LENGTH = 240;\nconst HOME_CACHE_TTL = 24 * 60 * 60; // 24 hours in seconds\n\n/** Pure cache policy for presenter cards; degraded current-request copy retries later. */\nexport function isHomePresentationCacheable(\n card: Pick<HomeCardItem, 'presentationPending' | '_presentationFallback' | 'name'>,\n status: OpportunityStatus | undefined,\n): boolean {\n return Boolean(\n status &&\n status !== 'negotiating' &&\n !card.presentationPending &&\n !card._presentationFallback &&\n card.name &&\n card.name !== 'Unknown',\n );\n}\n\n/** Redis key for the categorizer cache, derived from the user and the ordered opportunity-id set. */\nfunction buildCategorizerCacheKey(userId: string, cards: HomeCardItem[]): string {\n const oppIds = cards.map((c) => c.opportunityId).join(',');\n const hash = createHash('sha256').update(oppIds).digest('hex').slice(0, 16);\n return buildHomeCategoryPresentationCacheKey(userId, hash);\n}\n\n/**\n * Strip leading narrator name from remark when the UI already prepends \"Name: \" to the chip.\n * Avoids duplication like \"Yankı Ekin Yüksel: Yankı Ekin Yüksel introduced you two...\"\n * Repeats until no leading name (handles \"Name: Name rest\").\n */\nexport function stripLeadingNarratorName(remark: string, narratorName: string): string {\n let t = remark.trim();\n if (!t || !narratorName.trim()) return remark;\n const name = narratorName.trim();\n const nameLower = name.toLowerCase();\n for (;;) {\n const lower = t.toLowerCase();\n if (!lower.startsWith(nameLower)) break;\n const rest = t.slice(name.length).replace(/^\\s*[:,\\-–—]\\s*/i, '').trim();\n if (rest.length === 0 || rest === t) break;\n t = rest;\n }\n return t;\n}\n\n/** Normalize timestamp for sorting; returns numeric ms or 0 for invalid/missing. */\nconst safeParseDate = (value: unknown): number => {\n if (value == null) return 0;\n if (value instanceof Date) {\n const t = value.getTime();\n return Number.isFinite(t) ? t : 0;\n }\n if (typeof value === 'number' && Number.isFinite(value)) return value;\n if (typeof value === 'string') {\n const t = new Date(value).getTime();\n return Number.isFinite(t) ? t : 0;\n }\n return 0;\n};\n\n/** Confidence score for sorting (interpretation.confidence or opportunity.confidence). */\nconst getRawConfidence = (opp: typeof HomeGraphState.State['opportunities'][number]): number => {\n const fromInterp = opp.interpretation?.confidence;\n if (typeof fromInterp === 'number' && !Number.isNaN(fromInterp)) return fromInterp;\n if (typeof fromInterp === 'string') {\n const n = parseFloat(fromInterp);\n if (!Number.isNaN(n)) return n;\n }\n const fromRow = opp.confidence;\n if (typeof fromRow === 'number' && !Number.isNaN(fromRow)) return fromRow;\n if (typeof fromRow === 'string') {\n const n = parseFloat(fromRow);\n if (!Number.isNaN(n)) return n;\n }\n return 0;\n};\n\n/**\n * Sort confidence, optionally pool-adjusted (IND-419): when\n * POOL_QUESTIONS_RANKING=on, answered discriminators multiply confidence by\n * their stored factors (floor 0.3) so the user's answers re-rank the feed.\n * Flag off → identical to raw confidence (adjustments are write-only).\n */\nconst getPoolRankingProvenance = (\n state: typeof HomeGraphState.State,\n): PoolAdjustmentProvenance | null => {\n if (\n poolQuestionsRanking() !== 'on' ||\n !state.userId ||\n state.scopeType !== 'intent' ||\n !state.scopeId\n ) return null;\n return { recipientUserId: state.userId, intentId: state.scopeId };\n};\n\nconst hasPoolAdjustment = (\n opp: typeof HomeGraphState.State['opportunities'][number],\n provenance: PoolAdjustmentProvenance,\n): boolean => readActivePoolAdjustments(\n (opp as { metadata?: Record<string, unknown> | null }).metadata,\n provenance,\n).length > 0;\n\nconst getConfidence = (\n opp: typeof HomeGraphState.State['opportunities'][number],\n provenance: PoolAdjustmentProvenance | null,\n): number => {\n const raw = getRawConfidence(opp);\n if (!provenance) return raw;\n return adjustedConfidence(\n raw,\n (opp as { metadata?: Record<string, unknown> | null }).metadata,\n provenance,\n );\n};\n\n/** Unique non-introducer, non-viewer userIds for an opportunity (actors can repeat). */\nconst getUniqueCounterpartUserIds = (\n opp: typeof HomeGraphState.State['opportunities'][number],\n viewerId: string\n): Set<string> => {\n const ids = new Set<string>();\n for (const a of opp.actors) {\n if (a.role !== 'introducer' && a.userId !== viewerId && a.userId) {\n ids.add(a.userId);\n }\n }\n return ids;\n};\n\nconst pickDisplayCounterpartActor = (\n opportunity: typeof HomeGraphState.State['opportunities'][number],\n viewerId: string\n): { userId: string; role: string } | null => {\n const candidates = opportunity.actors.filter(\n (actor) => actor.userId !== viewerId && actor.role !== 'introducer'\n );\n if (candidates.length === 0) {\n return null;\n }\n\n // Prefer direct counterpart roles when available, then stable sort by user id.\n const rolePriority = new Map<string, number>([\n ['patient', 0],\n ['party', 1],\n ['agent', 2],\n ['peer', 3],\n ]);\n\n const sorted = [...candidates].sort((a, b) => {\n const aPriority = rolePriority.get(a.role) ?? 99;\n const bPriority = rolePriority.get(b.role) ?? 99;\n if (aPriority !== bPriority) return aPriority - bPriority;\n return a.userId.localeCompare(b.userId);\n });\n return sorted[0] ?? null;\n};\n\nexport class HomeGraphFactory {\n constructor(private database: HomeGraphDb, private cache: OpportunityCache) {}\n\n createGraph() {\n const presenter = new OpportunityPresenter();\n const categorizer = new HomeCategorizerAgent();\n\n const loadOpportunitiesNode = async (state: typeof HomeGraphState.State) => {\n return timed(\"HomeGraph.loadOpportunities\", async () => {\n if (!state.userId) {\n return { error: 'userId is required' };\n }\n try {\n // Minimum of 50 ensures enough candidates across all feed categories\n // (connection, connector-flow, expired) for selectByComposition to fill\n // its soft targets, even after visibility filtering and dedup.\n const fetchLimit = Math.min(150, Math.max(50, state.limit * 3));\n const statuses = state.statuses ?? DEFAULT_HOME_STATUSES;\n const poolRankingProvenance = getPoolRankingProvenance(state);\n const options: { limit?: number; networkId?: string; scopeType?: 'intent'; scopeId?: string; statuses?: OpportunityStatus[] } = {\n limit: fetchLimit,\n statuses,\n };\n if (state.networkId) options.networkId = state.networkId;\n if (state.scopeType === 'intent' && state.scopeId) {\n options.scopeType = 'intent';\n options.scopeId = state.scopeId;\n }\n // Do not pass conversationId: home view excludes draft opportunities (chat-only drafts).\n const raw = await this.database.getOpportunitiesForUser(state.userId, options);\n const visible = raw.filter((opp) =>\n canUserSeeOpportunity(opp.actors, opp.status, state.userId)\n );\n // Actionability only gates the live statuses a viewer could act on:\n // latent/pending cards the viewer cannot act on are noise, but\n // terminal/internal statuses (accepted, rejected, expired, negotiating,\n // stalled, draft) are deliberate history — when a caller explicitly\n // requests them via `statuses`, they must pass through (they are never\n // actionable by rule 5, so filtering them here would return nothing).\n // The requested-status membership check is defense-in-depth: rows\n // outside the requested set are dropped even if the adapter drifts.\n const requestedStatuses = new Set<OpportunityStatus>(statuses);\n const visibleForFeed = visible.filter((opp) => {\n if (!requestedStatuses.has(opp.status)) return false;\n if (opp.status === 'latent' || opp.status === 'pending') {\n return isActionableForViewer(opp.actors, opp.status, state.userId);\n }\n return true;\n });\n const explicitStatuses = (state.statuses?.length ?? 0) > 0;\n if (explicitStatuses) {\n // Lifecycle view (e.g. intent radar): newest-first so counterpart\n // dedup keeps each person's most recent state (an accepted\n // opportunity supersedes an older pending one), no composition\n // capping — the caller wants the full pipeline up to `limit`.\n const newestFirst = [...visibleForFeed].sort(\n (a, b) => safeParseDate(b.updatedAt) - safeParseDate(a.updatedAt)\n );\n const seenIds = new Set<string>();\n const dedupedByCounterpart = newestFirst.filter((opp) => {\n const counterpartIds = getUniqueCounterpartUserIds(opp, state.userId);\n const hasOverlap = [...counterpartIds].some((id) => seenIds.has(id));\n if (hasOverlap) return false;\n for (const id of counterpartIds) seenIds.add(id);\n return true;\n });\n // Preserve byte-identical newest-first behavior while the flag is\n // off. When on, re-order the already-deduped lifecycle set by\n // adjusted confidence so each client-side radar bucket reflects\n // pool answers immediately.\n if (\n !poolRankingProvenance ||\n !dedupedByCounterpart.some((opportunity) => hasPoolAdjustment(opportunity, poolRankingProvenance))\n ) {\n return { opportunities: dedupedByCounterpart.slice(0, state.limit) };\n }\n const adjustedOrder = [...dedupedByCounterpart].sort((a, b) => {\n const confidenceDelta = getConfidence(b, poolRankingProvenance) - getConfidence(a, poolRankingProvenance);\n if (confidenceDelta !== 0) return confidenceDelta;\n return safeParseDate(b.updatedAt) - safeParseDate(a.updatedAt);\n });\n return { opportunities: adjustedOrder.slice(0, state.limit) };\n }\n const sorted = [...visibleForFeed].sort((a, b) => {\n // Connections before connector-flow so dedup claims counterpart IDs\n // for direct connections first — prevents introducer cards from\n // shadowing a user's own connection opportunities.\n const aIsIntroducer = a.actors.some((ac) => ac.userId === state.userId && ac.role === 'introducer');\n const bIsIntroducer = b.actors.some((ac) => ac.userId === state.userId && ac.role === 'introducer');\n if (aIsIntroducer !== bIsIntroducer) return aIsIntroducer ? 1 : -1;\n const confA = getConfidence(a, poolRankingProvenance);\n const confB = getConfidence(b, poolRankingProvenance);\n if (confB !== confA) return confB - confA;\n const aTime = safeParseDate(a.updatedAt);\n const bTime = safeParseDate(b.updatedAt);\n return bTime - aTime;\n });\n const seenUserIds = new Set<string>();\n const deduped = sorted.filter((opp) => {\n const counterpartIds = getUniqueCounterpartUserIds(opp, state.userId);\n const hasOverlap = [...counterpartIds].some((id) => seenUserIds.has(id));\n if (hasOverlap) return false;\n for (const id of counterpartIds) seenUserIds.add(id);\n return true;\n });\n const opportunities = selectByComposition(deduped, state.userId);\n return { opportunities };\n } catch (e) {\n logger.error('HomeGraph loadOpportunities failed', { error: e });\n return { error: 'Failed to load opportunities', opportunities: [] };\n }\n });\n };\n\n const checkPresenterCacheNode = async (state: typeof HomeGraphState.State) => {\n return timed(\"HomeGraph.checkPresenterCache\", async () => {\n const { opportunities, userId } = state;\n const poolRankingProvenance = getPoolRankingProvenance(state);\n if (opportunities.length === 0) {\n return { cachedCards: new Map(), uncachedOpportunities: [] };\n }\n\n if (state.noCache) {\n checkPresenterCacheLog.verbose('noCache=true, skipping cache');\n return { cachedCards: new Map(), uncachedOpportunities: opportunities };\n }\n\n try {\n // Negotiating cards are templated (no LLM call) and their text\n // depends on the live turn count, which changes between requests\n // without changing the opportunity status. Skip cache entirely\n // for them so each render reflects the current turn.\n //\n // For all other statuses, include status in the key so status\n // transitions (e.g. negotiating → pending) don't serve stale cards.\n const cacheable = opportunities.filter((opp) => opp.status !== 'negotiating');\n const liveNegotiating = opportunities.filter((opp) => opp.status === 'negotiating');\n\n const keys = cacheable.map((opp) =>\n buildHomeCardPresentationCacheKey(opp.id, opp.status, userId)\n );\n const results = keys.length > 0 ? await this.cache.mget<HomeCardItem>(keys) : [];\n\n const cachedCards = new Map<string, HomeCardItem>();\n const uncachedOpportunities: typeof opportunities = [...liveNegotiating];\n\n for (let i = 0; i < cacheable.length; i++) {\n const cached = results[i];\n if (cached) {\n const originalIndex = opportunities.indexOf(cacheable[i]);\n // Stamp the live status: pre-status cache entries lack the field,\n // and the key already guarantees it matches the current status.\n const deprioritizedReason = poolRankingProvenance\n ? latestPoolDemotionDetail(\n (cacheable[i] as { metadata?: Record<string, unknown> | null }).metadata,\n poolRankingProvenance,\n )\n : undefined;\n cachedCards.set(cacheable[i].id, {\n ...cached,\n status: cacheable[i].status,\n deprioritizedReason,\n _cardIndex: originalIndex,\n });\n } else {\n uncachedOpportunities.push(cacheable[i]);\n }\n }\n\n checkPresenterCacheLog.verbose('', {\n total: opportunities.length,\n cacheHits: cachedCards.size,\n cacheMisses: uncachedOpportunities.length,\n });\n\n return { cachedCards, uncachedOpportunities };\n } catch (e) {\n checkPresenterCacheLog.warn('cache unavailable, skipping', { error: e });\n return { cachedCards: new Map(), uncachedOpportunities: opportunities };\n }\n });\n };\n\n const shouldGenerateCards = (state: typeof HomeGraphState.State): string => {\n if (state.uncachedOpportunities.length > 0) {\n return 'generate';\n }\n logger.verbose('All presenter results cached, skipping generation');\n return 'skip';\n };\n\n const generateCardTextNode = async (state: typeof HomeGraphState.State) => {\n return timed(\"HomeGraph.generateCardText\", async () => {\n const opportunities = state.uncachedOpportunities.length > 0\n ? state.uncachedOpportunities\n : state.opportunities;\n generateCardTextLog.verbose('entry', { opportunitiesLength: opportunities.length, userId: state.userId });\n if (opportunities.length === 0) {\n generateCardTextLog.verbose('exit', { totalOpportunities: 0, totalSections: 0 });\n return { cards: [], agentTimings: [], meta: { totalOpportunities: 0, totalSections: 0 } };\n }\n const db = this.database as PresenterDatabase & HomeGraphDb;\n const cards: HomeCardItem[] = [];\n const relevantActorIds = new Set<string>();\n for (const opp of opportunities) {\n for (const a of opp.actors) {\n if (a.userId) relevantActorIds.add(a.userId);\n }\n }\n\n const userEntries = await Promise.all(\n Array.from(relevantActorIds).map(async (userId) => {\n try {\n const user = await this.database.getUser(userId);\n return [userId, user ?? null] as const;\n } catch {\n return [userId, null] as const;\n }\n })\n );\n const userMap = new Map(userEntries);\n\n const oppIndexMap = new Map(\n state.opportunities.map((opp, idx) => [opp.id, idx])\n );\n\n const agentTimingsAccum: DebugMetaAgent[] = [];\n\n for (let i = 0; i < opportunities.length; i += PRESENTATION_CONCURRENCY) {\n const chunk = opportunities.slice(i, i + PRESENTATION_CONCURRENCY);\n const chunkCards = await Promise.all(\n chunk.map(async (opportunity, offset) => {\n const cardIndex = oppIndexMap.get(opportunity.id) ?? (i + offset);\n const viewerActor = opportunity.actors.find((a) => a.userId === state.userId);\n const viewerRole = viewerActor?.role ?? 'party';\n const isIntroducer = viewerRole === 'introducer';\n const preferredActor = pickDisplayCounterpartActor(opportunity, state.userId)\n ?? opportunity.actors.find((a) => a.userId !== state.userId && a.role !== 'introducer');\n const actorWithProfile = opportunity.actors.find(\n (a) => a.userId !== state.userId && a.role !== 'introducer' && !!userMap.get(a.userId)\n );\n const introducer = opportunity.actors.find((a) => a.role === 'introducer');\n let otherActor = (preferredActor && userMap.get(preferredActor.userId))\n ? preferredActor\n : (actorWithProfile ?? preferredActor);\n // When the only other participant is the introducer (no separate party), use introducer as display counterpart so the card shows a name instead of \"Unknown\"\n if (!otherActor && introducer && introducer.userId !== state.userId && introducer.userId) {\n otherActor = { userId: introducer.userId, role: introducer.role };\n }\n const otherUser = otherActor ? userMap.get(otherActor.userId) ?? null : null;\n const introducerCounterparts = opportunity.actors.filter(\n (a) => a.userId !== state.userId && a.role !== 'introducer'\n );\n // Deduplicate by userId — actors array can contain multiple rows per user\n // (e.g. from different intents), which would produce repeated names.\n const uniqueCounterpartIds = [...new Set(introducerCounterparts.map((a) => a.userId))];\n const participantNames = uniqueCounterpartIds\n .map((uid) => userMap.get(uid)?.name ?? 'Unknown')\n .sort();\n // When secondPartyData will be present (2+ counterparts), use single counterpart name\n // because the frontend arrow layout renders \"card.name → secondParty.name\".\n // Using the joined \"A ↔ B\" format here would produce redundant \"A ↔ B → B\".\n // Only use the joined format when there is a single counterpart (no arrow layout).\n const willHaveSecondParty = isIntroducer && uniqueCounterpartIds.length > 1;\n let userName = isIntroducer && participantNames.length > 0 && !willHaveSecondParty\n ? participantNames.join(' ↔ ')\n : (otherUser?.name ?? 'Unknown');\n // Fallback to profile identity name when users.name is missing (e.g. profile has display name, users row does not)\n if ((userName === 'Unknown' || !userName?.trim()) && otherActor?.userId && db.getProfile) {\n const profile = await db.getProfile(otherActor.userId).catch((err) => {\n logger.debug('getProfile fallback failed', { otherActorUserId: otherActor.userId, error: err });\n return null;\n });\n const profileName = profile?.identity?.name?.trim();\n if (profileName) userName = profileName;\n }\n // Unresolvable display counterpart (deleted user: no users row, no\n // profile fallback). Drop the card entirely instead of rendering an\n // \"Unknown\" placeholder: such cards are unusable, excluded from the\n // presenter cache (see cachePresenterResults), and would otherwise\n // trigger a fresh presenter LLM call on every request — a permanent\n // cache miss that keeps the whole feed slow (~9s per load).\n if (userName === 'Unknown' || !userName?.trim()) {\n logger.verbose('[HomeGraph:generateCardText] dropping card with unresolvable counterpart', {\n opportunityId: opportunity.id,\n otherActorUserId: otherActor?.userId,\n });\n return null;\n }\n const userAvatar = otherUser?.avatar ?? null;\n // Shared sanitization standard (UUID strip, viewer-centric rewrite,\n // boundary truncation) — raw reasoning must never render verbatim.\n const reasoningSnippet = safeFallbackSummary(\n typeof opportunity.interpretation?.reasoning === 'string'\n ? opportunity.interpretation.reasoning\n : '',\n {\n counterpartName: userName !== 'Unknown' ? userName : undefined,\n maxChars: MAX_REASONING_SNIPPET_LENGTH,\n emptyText: 'A promising connection.',\n },\n );\n\n // Build secondParty for introducer arrow layout (the party that isn't the display counterpart)\n let secondPartyData: { name: string; avatar?: string | null; userId?: string } | undefined;\n if (isIntroducer && introducerCounterparts.length > 1 && otherActor) {\n const secondActor = introducerCounterparts.find((a) => a.userId !== otherActor.userId);\n if (secondActor) {\n const secondUser = userMap.get(secondActor.userId) ?? null;\n secondPartyData = {\n name: secondUser?.name ?? 'Unknown',\n avatar: secondUser?.avatar ?? null,\n userId: secondActor.userId,\n };\n }\n }\n\n const isCounterpartGhost = otherUser?.isGhost ?? false;\n // Skeleton presentation: return an identity-only card without the\n // presenter LLM or negotiation-context load. Name resolution and\n // the unresolvable-counterpart drop above still apply, so the card\n // set matches what the follow-up full request will return.\n if (state.presentation === 'skeleton') {\n return {\n opportunityId: opportunity.id,\n status: opportunity.status,\n userId: otherActor?.userId ?? '',\n name: userName,\n avatar: userAvatar,\n mainText: '',\n cta: '',\n primaryActionLabel: getPrimaryActionLabel(viewerRole),\n secondaryActionLabel: SECONDARY_ACTION_LABEL,\n mutualIntentsLabel: isIntroducer ? 'Connector match' : 'Shared interests',\n viewerRole,\n isGhost: isCounterpartGhost,\n ...(secondPartyData ? { secondParty: secondPartyData } : {}),\n presentationPending: true,\n _cardIndex: cardIndex,\n } satisfies HomeCardItem;\n }\n const isPendingIntroducerFallback = isIntroducer && opportunity.status !== 'latent';\n const fallbackCard = (): HomeCardItem => ({\n opportunityId: opportunity.id,\n status: opportunity.status,\n userId: otherActor?.userId ?? '',\n name: userName,\n avatar: userAvatar,\n mainText: reasoningSnippet,\n cta: isIntroducer\n ? (isPendingIntroducerFallback ? 'Share this introduction to get things started.' : 'Take a look and decide if this is a good match.')\n : 'Take a look and decide whether to reach out.',\n primaryActionLabel: getPrimaryActionLabel(viewerRole),\n secondaryActionLabel: SECONDARY_ACTION_LABEL,\n mutualIntentsLabel: isIntroducer ? 'Connector match' : 'Shared interests',\n narratorChip: isIntroducer\n ? { name: 'You', text: 'Worth a look.', userId: state.userId }\n : { name: 'Index', text: 'Worth a look.' },\n viewerRole,\n isGhost: isCounterpartGhost,\n ...(secondPartyData ? { secondParty: secondPartyData } : {}),\n _presentationFallback: true,\n _cardIndex: cardIndex,\n });\n\n try {\n const [ctx, negotiationContext] = await Promise.all([\n gatherPresenterContext(\n db,\n opportunity,\n state.userId,\n otherActor?.userId,\n ),\n loadNegotiationContext(db, opportunity.id, opportunity.status),\n ]);\n const homeInput = {\n ...ctx,\n mutualIntentCount: undefined,\n opportunityStatus: opportunity.status,\n ...(negotiationContext ? { negotiationContext } : {}),\n };\n const _traceEmitterPresenter = requestContext.getStore()?.traceEmitter;\n const presenterStart = Date.now();\n _traceEmitterPresenter?.({ type: \"agent_start\", name: \"opportunity-presenter\" });\n const presentation = await presenter.presentHomeCard(homeInput);\n const _presenterDuration = Date.now() - presenterStart;\n agentTimingsAccum.push({ name: 'opportunity.presenter', durationMs: _presenterDuration });\n _traceEmitterPresenter?.({ type: \"agent_end\", name: \"opportunity-presenter\", durationMs: _presenterDuration, summary: `Presented: ${userName}` });\n if (presentation.isFallback) {\n return fallbackCard();\n }\n let narratorChip: { name: string; text: string; avatar?: string | null; userId?: string } | undefined;\n // Only show a person as narrator when they are the introducer and not the display counterpart\n // (bad data can have same user as introducer and party, e.g. \"Amina introduced you to Amina\")\n const introducerIsCounterpart = introducer && otherActor && introducer.userId === otherActor.userId;\n if (introducer && introducer.userId !== state.userId && !introducerIsCounterpart) {\n const introUser = userMap.get(introducer.userId) ?? null;\n const narratorName = introUser?.name ?? 'Someone';\n narratorChip = {\n name: narratorName,\n text: stripLeadingNarratorName(presentation.narratorRemark, narratorName),\n avatar: introUser?.avatar ?? null,\n userId: introducer.userId,\n };\n } else if (introducer?.userId === state.userId) {\n narratorChip = { name: 'You', text: presentation.narratorRemark, userId: state.userId };\n } else {\n narratorChip = { name: 'Index', text: presentation.narratorRemark };\n }\n return {\n opportunityId: opportunity.id,\n status: opportunity.status,\n userId: otherActor?.userId ?? '',\n name: userName,\n avatar: userAvatar,\n mainText: presentation.personalizedSummary,\n cta: presentation.suggestedAction,\n headline: presentation.headline,\n primaryActionLabel: getPrimaryActionLabel(viewerRole),\n secondaryActionLabel: SECONDARY_ACTION_LABEL,\n mutualIntentsLabel: presentation.mutualIntentsLabel,\n narratorChip,\n viewerRole,\n isGhost: isCounterpartGhost,\n ...(secondPartyData ? { secondParty: secondPartyData } : {}),\n _cardIndex: cardIndex,\n } satisfies HomeCardItem;\n } catch (e) {\n logger.warn('HomeGraph presenter failed for opportunity', { opportunityId: opportunity.id, error: e });\n return fallbackCard();\n }\n })\n );\n cards.push(...chunkCards.filter((c): c is HomeCardItem => c !== null));\n }\n generateCardTextLog.verbose('exit', { totalOpportunities: state.opportunities.length, totalSections: 0 });\n return {\n cards,\n agentTimings: agentTimingsAccum,\n meta: { totalOpportunities: state.opportunities.length, totalSections: 0 },\n };\n });\n };\n\n const cachePresenterResultsNode = async (state: typeof HomeGraphState.State) => {\n return timed(\"HomeGraph.cachePresenterResults\", async () => {\n const { cards, cachedCards, userId, opportunities } = state;\n const poolRankingProvenance = getPoolRankingProvenance(state);\n const liveById = new Map(opportunities.map((opportunity) => [opportunity.id, opportunity]));\n const cardsWithAdjustments = cards.map((card) => {\n const opportunity = liveById.get(card.opportunityId);\n const deprioritizedReason = poolRankingProvenance\n ? latestPoolDemotionDetail(\n (opportunity as { metadata?: Record<string, unknown> | null } | undefined)?.metadata,\n poolRankingProvenance,\n )\n : undefined;\n return { ...card, deprioritizedReason };\n });\n\n // Only cache cards that weren't already from cache\n const newCards = cardsWithAdjustments.filter((card) => !cachedCards.has(card.opportunityId));\n const statusById = new Map(opportunities.map((opp) => [opp.id, opp.status]));\n\n try {\n await Promise.all(\n newCards.map((card) => {\n const status = statusById.get(card.opportunityId);\n // Negotiating, skeleton, fallback, and unresolved-name cards are\n // safe for the current response but must not become 24h entries.\n if (!status || !isHomePresentationCacheable(card, status)) return Promise.resolve();\n return this.cache.set(\n buildHomeCardPresentationCacheKey(card.opportunityId, status, userId),\n card,\n { ttl: HOME_CACHE_TTL }\n );\n })\n );\n } catch (e) {\n cachePresenterResultsLog.warn('cache write failed, continuing', { error: e });\n }\n\n // Merge cached cards into full card list\n const allCards: HomeCardItem[] = [...cardsWithAdjustments];\n for (const [oppId, cachedCard] of cachedCards) {\n if (!cardsWithAdjustments.some((card) => card.opportunityId === oppId)) {\n allCards.push(cachedCard);\n }\n }\n\n // Re-sort by _cardIndex to maintain original ordering\n allCards.sort((a, b) => a._cardIndex - b._cardIndex);\n\n cachePresenterResultsLog.verbose('', {\n newlyCached: newCards.length,\n totalCards: allCards.length,\n });\n\n return {\n cards: allCards,\n meta: { totalOpportunities: state.opportunities.length, totalSections: 0 },\n };\n });\n };\n\n const checkCategorizerCacheNode = async (state: typeof HomeGraphState.State) => {\n return timed(\"HomeGraph.checkCategorizerCache\", async () => {\n if (state.cards.length === 0) {\n return { categoryCacheHit: false };\n }\n\n // Skeleton runs never categorize (some cards have no text to categorize\n // and the response must stay LLM-free). Ranking-enabled lifecycle views\n // also stay flat: the intent Radar flattens sections and buckets by\n // status, so dynamic categorization would erase the adjusted order on\n // the full second-phase response. Flag off retains the legacy path.\n // Chunk by MAX_ITEMS_PER_SECTION because normalizeAndSort caps sections.\n const poolRankingProvenance = getPoolRankingProvenance(state);\n const preserveAdjustedLifecycleOrder =\n (state.statuses?.length ?? 0) > 0 &&\n poolRankingProvenance !== null &&\n state.opportunities.some((opportunity) => hasPoolAdjustment(opportunity, poolRankingProvenance));\n if (state.presentation === 'skeleton' || preserveAdjustedLifecycleOrder) {\n const sectionProposals: HomeSectionProposal[] = [];\n for (let start = 0; start < state.cards.length; start += MAX_ITEMS_PER_SECTION) {\n sectionProposals.push({\n id: `all-${sectionProposals.length + 1}`,\n title: 'All matches',\n iconName: DEFAULT_HOME_SECTION_ICON,\n itemIndices: state.cards.slice(start, start + MAX_ITEMS_PER_SECTION).map((_, i) => start + i),\n });\n }\n return { sectionProposals, categoryCacheHit: true };\n }\n\n if (state.noCache) {\n checkCategorizerCacheLog.verbose('noCache=true, skipping cache');\n return { categoryCacheHit: false };\n }\n\n try {\n const key = buildCategorizerCacheKey(state.userId, state.cards);\n\n const cached = await this.cache.get<HomeSectionProposal[]>(key);\n if (cached) {\n checkCategorizerCacheLog.verbose('cache hit');\n return { sectionProposals: cached, categoryCacheHit: true };\n }\n\n checkCategorizerCacheLog.verbose('cache miss');\n } catch (e) {\n checkCategorizerCacheLog.warn('cache unavailable, skipping', { error: e });\n }\n return { categoryCacheHit: false };\n });\n };\n\n const shouldCategorize = (state: typeof HomeGraphState.State): string => {\n if (state.categoryCacheHit) {\n logger.verbose('Categorizer results cached, skipping');\n return 'skip';\n }\n return 'categorize';\n };\n\n const categorizeDynamicallyNode = async (state: typeof HomeGraphState.State) => {\n return timed(\"HomeGraph.categorizeDynamically\", async () => {\n categorizeDynamicallyLog.verbose('entry', { cardsLength: state.cards.length });\n if (state.cards.length === 0) {\n categorizeDynamicallyLog.verbose('exit', { sectionProposalsCount: 0 });\n return { sectionProposals: [], agentTimings: [] };\n }\n const agentTimingsAccum: DebugMetaAgent[] = [];\n const categorizerInput = state.cards.map((c) => ({\n index: c._cardIndex,\n headline: c.headline,\n mainText: c.mainText,\n name: c.name,\n viewerRole: c.viewerRole === 'introducer' ? 'introducer' : undefined,\n opportunityStatus: c.viewerRole === 'introducer' ? 'pending' : undefined,\n }));\n const _traceEmitterCategorizer = requestContext.getStore()?.traceEmitter;\n const categorizerStart = Date.now();\n _traceEmitterCategorizer?.({ type: \"agent_start\", name: \"home-categorizer\" });\n const { sections } = await categorizer.categorize(categorizerInput);\n const _categorizerDuration = Date.now() - categorizerStart;\n agentTimingsAccum.push({ name: 'home.categorizer', durationMs: _categorizerDuration });\n _traceEmitterCategorizer?.({ type: \"agent_end\", name: \"home-categorizer\", durationMs: _categorizerDuration, summary: `Categorized into ${sections.length} section(s)` });\n const proposals: HomeSectionProposal[] = sections.map((s) => ({\n ...s,\n itemIndices: s.itemIndices.filter((i) => i >= 0 && i < state.cards.length),\n }));\n categorizeDynamicallyLog.verbose('exit', { sectionProposalsCount: proposals.length });\n return { sectionProposals: proposals, agentTimings: agentTimingsAccum };\n });\n };\n\n const cacheCategorizerResultsNode = async (state: typeof HomeGraphState.State) => {\n return timed(\"HomeGraph.cacheCategorizerResults\", async () => {\n if (\n state.categoryCacheHit ||\n state.sectionProposals.length === 0 ||\n state.cards.some((card) => card._presentationFallback)\n ) {\n return {};\n }\n\n try {\n const key = buildCategorizerCacheKey(state.userId, state.cards);\n\n await this.cache.set(key, state.sectionProposals, { ttl: HOME_CACHE_TTL });\n\n cacheCategorizerResultsLog.verbose('cached', {\n sectionCount: state.sectionProposals.length,\n });\n } catch (e) {\n cacheCategorizerResultsLog.warn('cache write failed, continuing', { error: e });\n }\n\n return {};\n });\n };\n\n const normalizeAndSortNode = async (state: typeof HomeGraphState.State) => {\n return timed(\"HomeGraph.normalizeAndSort\", async () => {\n const cards = state.cards;\n const proposals = state.sectionProposals;\n normalizeAndSortLog.verbose('entry', { cardsLength: cards.length, proposalsLength: proposals.length });\n if (cards.length === 0) {\n normalizeAndSortLog.verbose('exit', { totalOpportunities: 0, totalSections: 0 });\n return { sections: [], meta: { totalOpportunities: 0, totalSections: 0 } };\n }\n const usedIndices = new Set<number>();\n const sections: HomeSection[] = proposals.map((p) => {\n const iconName = resolveHomeSectionIcon(p.iconName);\n const items: HomeSectionItem[] = p.itemIndices\n .filter((i) => i >= 0 && i < cards.length && !usedIndices.has(i))\n .slice(0, MAX_ITEMS_PER_SECTION)\n .map((i) => {\n usedIndices.add(i);\n const card = cards[i];\n const { _cardIndex, _presentationFallback, ...rest } = card;\n return rest;\n });\n return {\n id: p.id,\n title: p.title,\n subtitle: p.subtitle,\n iconName,\n items,\n };\n });\n\n // Enforce category ordering: sections with connections first, then\n // connector-flow only, then expired only. This prevents the LLM\n // categorizer from placing introducer sections before connection sections.\n const sectionCategoryPriority = (section: HomeSection): number => {\n const hasConnection = section.items.some((item) => item.viewerRole !== 'introducer');\n if (hasConnection) return 0; // mixed or connection-only sections first\n const hasConnectorFlow = section.items.some((item) => item.viewerRole === 'introducer');\n if (hasConnectorFlow) return 1; // connector-flow only sections next\n return 2; // empty or expired sections last\n };\n sections.sort((a, b) => sectionCategoryPriority(a) - sectionCategoryPriority(b));\n const meta = {\n totalOpportunities: state.opportunities.length,\n totalSections: sections.length,\n };\n normalizeAndSortLog.verbose('exit', { totalOpportunities: meta.totalOpportunities, totalSections: meta.totalSections });\n return { sections, meta };\n });\n };\n\n const graph = new StateGraph(HomeGraphState)\n .addNode('loadOpportunities', loadOpportunitiesNode)\n .addNode('checkPresenterCache', checkPresenterCacheNode)\n .addNode('generateCardText', generateCardTextNode)\n .addNode('cachePresenterResults', cachePresenterResultsNode)\n .addNode('checkCategorizerCache', checkCategorizerCacheNode)\n .addNode('categorizeDynamically', categorizeDynamicallyNode)\n .addNode('cacheCategorizerResults', cacheCategorizerResultsNode)\n .addNode('normalizeAndSort', normalizeAndSortNode)\n .addEdge(START, 'loadOpportunities')\n .addEdge('loadOpportunities', 'checkPresenterCache')\n .addConditionalEdges('checkPresenterCache', shouldGenerateCards, {\n generate: 'generateCardText',\n skip: 'cachePresenterResults',\n })\n .addEdge('generateCardText', 'cachePresenterResults')\n .addEdge('cachePresenterResults', 'checkCategorizerCache')\n .addConditionalEdges('checkCategorizerCache', shouldCategorize, {\n categorize: 'categorizeDynamically',\n skip: 'normalizeAndSort',\n })\n .addEdge('categorizeDynamically', 'cacheCategorizerResults')\n .addEdge('cacheCategorizerResults', 'normalizeAndSort')\n .addEdge('normalizeAndSort', END);\n\n return graph.compile();\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"feed.health.d.ts","sourceRoot":"/","sources":["opportunity/feed/feed.health.ts"],"names":[],"mappings":"AAEA,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,sEAAsE;IACtE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,yCAAyC;AACzC,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE;QACT,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,cAAc,EAAE,OAAO,CAAC;CACzB;AAiDD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB,CAkC1E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"feed.health.js","sourceRoot":"/","sources":["opportunity/feed/feed.health.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EA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S } from '../opportunity.utils.js';\n\n/** Input for computing feed health score. */\nexport interface FeedHealthInput {\n connectionCount: number;\n connectorFlowCount: number;\n expiredCount: number;\n totalActionable: number;\n /** Unix ms timestamp of last rediscovery, or null if never. */\n lastRediscoveryAt: number | null;\n /** Window in ms over which freshness decays from 1 → 0 (e.g. 12h). */\n freshnessWindowMs: number;\n /** Score threshold below which shouldMaintain is true. Default 0.5. */\n threshold?: number;\n}\n\n/** Output of feed health computation. */\nexport interface FeedHealthResult {\n score: number;\n breakdown: {\n composition: number;\n freshness: number;\n expirationRatio: number;\n };\n shouldMaintain: boolean;\n}\n\nconst WEIGHT_COMPOSITION = 0.4;\nconst WEIGHT_FRESHNESS = 0.3;\nconst WEIGHT_EXPIRATION = 0.3;\nconst DEFAULT_THRESHOLD = 0.5;\n\n/**\n * Compute composition sub-score: how close current counts are to soft targets.\n * Uses normalized distance: 1 - (|actual - target| / max(target, actual, 1)) per category,\n * then averages across categories.\n */\nfunction scoreComposition(connectionCount: number, connectorFlowCount: number, expiredCount: number): number {\n const categories = [\n { actual: connectionCount, target: FEED_SOFT_TARGETS.connection },\n { actual: connectorFlowCount, target: FEED_SOFT_TARGETS.connectorFlow },\n { actual: expiredCount, target: FEED_SOFT_TARGETS.expired },\n ];\n\n let totalScore = 0;\n for (const { actual, target } of categories) {\n const diff = Math.abs(actual - target);\n const denom = Math.max(target, actual, 1);\n totalScore += 1 - diff / denom;\n }\n\n return totalScore / categories.length;\n}\n\n/**\n * Compute freshness sub-score: linear decay from 1 → 0 over freshnessWindowMs.\n */\nfunction scoreFreshness(lastRediscoveryAt: number | null, freshnessWindowMs: number): number {\n if (lastRediscoveryAt == null) return 0;\n const elapsed = Date.now() - lastRediscoveryAt;\n if (elapsed <= 0) return 1;\n if (elapsed >= freshnessWindowMs) return 0;\n return 1 - elapsed / freshnessWindowMs;\n}\n\n/**\n * Compute expiration ratio sub-score: 1 - (expired / total).\n */\nfunction scoreExpirationRatio(expiredCount: number, totalActionable: number): number {\n const total = totalActionable + expiredCount;\n if (total === 0) return 0;\n return 1 - expiredCount / total;\n}\n\n/**\n * Compute feed health score (0–1) from current feed state.\n * Pure function, no side effects.\n *\n * @param input - Current feed composition and timing data\n * @returns Health score with breakdown and maintenance recommendation\n */\nexport function computeFeedHealth(input: FeedHealthInput): FeedHealthResult {\n const {\n connectionCount,\n connectorFlowCount,\n expiredCount,\n totalActionable,\n lastRediscoveryAt,\n freshnessWindowMs,\n threshold = DEFAULT_THRESHOLD,\n } = input;\n\n // Empty feed is always unhealthy\n if (totalActionable === 0 && expiredCount === 0) {\n return {\n score: 0,\n breakdown: { composition: 0, freshness: 0, expirationRatio: 0 },\n shouldMaintain: true,\n };\n }\n\n const composition = scoreComposition(connectionCount, connectorFlowCount, expiredCount);\n const freshness = scoreFreshness(lastRediscoveryAt, freshnessWindowMs);\n const expirationRatio = scoreExpirationRatio(expiredCount, totalActionable);\n\n const score =\n WEIGHT_COMPOSITION * composition +\n WEIGHT_FRESHNESS * freshness +\n WEIGHT_EXPIRATION * expirationRatio;\n\n return {\n score,\n breakdown: { composition, freshness, expirationRatio },\n shouldMaintain: score < threshold,\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"feed.state.d.ts","sourceRoot":"/","sources":["opportunity/feed/feed.state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AACpG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,2GAA2G;IAC3G,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,QA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AC;KAC7D,CAAC;IAEF,sEAAsE;IACtE,YAAY,EAAE,UAAU,CAAmB;QACzC,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,GAAG,CAAC;QACvC,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE;KAClB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { Annotation } from '@langchain/langgraph';\nimport type { Opportunity, OpportunityStatus } from '../../shared/interfaces/database.interface.js';\nimport type { DebugMetaAgent } from '../../chat/chat-streaming.types.js';\n\n/**\n * Home view card item: one opportunity with full presenter-driven display contract.\n */\nexport interface HomeCardItem {\n opportunityId: string;\n /** Lifecycle status of the underlying opportunity at render time (client bucketing, e.g. intent radar). */\n status?: OpportunityStatus;\n userId: string;\n name: string;\n avatar: string | null;\n mainText: string;\n cta: string;\n headline?: string;\n /** Presenter-generated; primary button (accept) and secondary button (dismiss). */\n primaryActionLabel: string;\n secondaryActionLabel: string;\n /** Presenter-generated subtitle under the other party name (e.g. \"1 mutual intent\"). */\n mutualIntentsLabel: string;\n /** Narrator chip for human-introduced opportunities; avatar set when narrator is a user */\n narratorChip?: { name: string; text: string; avatar?: string | null; userId?: string };\n /** Viewer's role in this opportunity (e.g. 'introducer', 'party', 'agent', 'patient', 'peer'). */\n viewerRole?: string;\n /** Whether the counterpart is a ghost (not yet onboarded) user. */\n isGhost?: boolean;\n /** Template-only explanation for a pool-answer demotion (never evaluator reasoning). */\n deprioritizedReason?: string;\n /** Second party in introducer arrow layout. Present when viewerRole is 'introducer'. */\n secondParty?: { name: string; avatar?: string | null; userId?: string };\n /**\n * True when this card was produced by a skeleton-presentation run: identity\n * fields (name/avatar/status) are real but mainText/cta are empty because the\n * presenter LLM was skipped. Clients render a shimmer body and re-fetch the\n * full view. Skeleton cards are never written to the presenter cache.\n */\n presentationPending?: boolean;\n /** Internal marker: safe deterministic fallback rendered, but must not be cached. */\n _presentationFallback?: boolean;\n /** For section assignment from LLM */\n _cardIndex: number;\n}\n\n/**\n * Dynamic section from LLM categorization.\n */\nexport interface HomeSectionProposal {\n id: string;\n title: string;\n subtitle?: string;\n iconName: string;\n itemIndices: number[];\n}\n\n/** Card item as returned in API (no internal _cardIndex). */\nexport type HomeSectionItem = Omit<HomeCardItem, '_cardIndex' | '_presentationFallback'>;\n\n/**\n * Final section for API response.\n */\nexport interface HomeSection {\n id: string;\n title: string;\n subtitle?: string;\n iconName: string;\n items: HomeSectionItem[];\n}\n\n/**\n * Home Graph State (Annotation-based).\n * Flow: loadOpportunities → generateCardText → categorizeDynamically → normalizeAndSort → finalizeResponse.\n */\nexport const HomeGraphState = Annotation.Root({\n userId: Annotation<string>({\n reducer: (curr, next) => next ?? curr,\n default: () => '',\n }),\n networkId: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n scopeType: Annotation<'intent' | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n scopeId: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n limit: Annotation<number>({\n reducer: (curr, next) => next ?? curr,\n default: () => 50,\n }),\n\n /** When true, bypass presenter and categorizer Redis caches. */\n noCache: Annotation<boolean>({\n reducer: (curr, next) => next ?? curr,\n default: () => false,\n }),\n\n /**\n * Presentation depth. 'full' (default) runs the presenter LLM and categorizer.\n * 'skeleton' skips both for cache misses: uncached cards come back with\n * resolved identity (name/avatar/status) and `presentationPending: true`,\n * cached cards come back complete, and all cards land in one flat section.\n */\n presentation: Annotation<'full' | 'skeleton'>({\n reducer: (curr, next) => next ?? curr,\n default: () => 'full',\n }),\n\n /** Optional status filter. When undefined, the graph uses `DEFAULT_HOME_STATUSES`. */\n statuses: Annotation<OpportunityStatus[] | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n\n /** Raw opportunities visible to the viewer (after visibility filter). */\n opportunities: Annotation<Opportunity[]>({\n reducer: (curr, next) => next ?? curr,\n default: () => [],\n }),\n\n /** Cards with presenter output and narrator chip. */\n cards: Annotation<HomeCardItem[]>({\n reducer: (curr, next) => next ?? curr,\n default: () => [],\n }),\n\n /** LLM output: dynamic sections with icon and item indices. */\n sectionProposals: Annotation<HomeSectionProposal[]>({\n reducer: (curr, next) => next ?? curr,\n default: () => [],\n }),\n\n /** Final sections for response. */\n sections: Annotation<HomeSection[]>({\n reducer: (curr, next) => next ?? curr,\n default: () => [],\n }),\n\n /** Presenter results retrieved from cache (opportunityId → HomeCardItem). */\n cachedCards: Annotation<Map<string, HomeCardItem>>({\n reducer: (curr, next) => next ?? curr,\n default: () => new Map(),\n }),\n\n /** Opportunities that had no cache hit and need presenter generation. */\n uncachedOpportunities: Annotation<Opportunity[]>({\n reducer: (curr, next) => next ?? curr,\n default: () => [],\n }),\n\n /** Whether categorizer results were found in cache. */\n categoryCacheHit: Annotation<boolean>({\n reducer: (curr, next) => next ?? curr,\n default: () => false,\n }),\n\n error: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n\n /** Meta for response (e.g. totalOpportunities, totalSections). */\n meta: Annotation<{ totalOpportunities: number; totalSections: number }>({\n reducer: (curr, next) => next ?? curr,\n default: () => ({ totalOpportunities: 0, totalSections: 0 }),\n }),\n\n /** Timing records for each agent invocation within this graph run. */\n agentTimings: Annotation<DebugMetaAgent[]>({\n reducer: (acc, val) => [...acc, ...val],\n default: () => [],\n }),\n});\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"negotiation-context.loader.d.ts","sourceRoot":"/","sources":["opportunity/negotiation-context.loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC9G,OAAO,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAK/F;;;GAGG;AACH,MAAM,MAAM,0BAA0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KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC;AAED,SAAS,YAAY,CAAC,QAAqC;IACzD,MAAM,KAAK,GAAsB,EAAE,CAAC;IACpC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,QAAQ,GAAI,OAAO,CAAC,KAAkD,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;QAC5G,IAAI,QAAQ,EAAE,IAAI,EAAE,CAAC;YACnB,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAuB,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,cAAc,CACrB,SAA2D;IAE3D,MAAM,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,iCAAiC,CAAC,CAAC;IAC5F,IAAI,CAAC,eAAe;QAAE,OAAO,SAAS,CAAC;IAEvC,MAAM,QAAQ,GAAI,eAAe,CAAC,KAAkD,CAAC,IAAI,CACvF,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CACzB,CAAC;IACF,OAAO,QAAQ,EAAE,IAAsC,CAAC;AAC1D,CAAC","sourcesContent":["/**\n * Negotiation context loader: given an opportunity, fetches the attached\n * negotiation task's transcript and outcome so the home-card presenter can\n * explain *why* the opportunity surfaced.\n *\n * For `draft`, `latent`, and `expired` opportunities, no negotiation has\n * happened (or no longer matters) so the loader returns null.\n *\n * For `negotiating` opportunities, only `turnCount` / `turnCap` are returned\n * — the presenter renders a templated chip without invoking the LLM.\n *\n * For `pending`, `stalled`, `accepted`, and `rejected` opportunities, the\n * full transcript and outcome are included so the prompt can ground its\n * explanation in concrete turn content.\n *\n * Screened-out negotiations (P2.2 — the client's own outreach gate declined\n * before any turn was exchanged) return null: presentation treats them as\n * never-happened, so no card, feed, or digest surface can frame the client's\n * private gate decision as a \"counterparty declined\" event.\n */\n\nimport type { NegotiationGraphDatabase, OpportunityStatus } from '../shared/interfaces/database.interface.js';\nimport type { NegotiationOutcome, NegotiationTurn } from '../negotiation/negotiation.state.js';\nimport { protocolLogger } from '../shared/observability/protocol.logger.js';\n\nconst logger = protocolLogger('NegotiationContextLoader');\n\n/**\n * Narrow slice of {@link NegotiationGraphDatabase} required by the loader. Kept\n * minimal so call sites can opt into a smaller surface.\n */\nexport type NegotiationContextDatabase = Pick<\n NegotiationGraphDatabase,\n 'getNegotiationTaskForOpportunity' | 'getMessagesForConversation' | 'getArtifactsForTask'\n>;\n\n/**\n * Snapshot of a negotiation surfaced to the presenter. `turns` and `outcome`\n * are only populated for post-negotiation statuses (pending/stalled/\n * accepted/rejected); `negotiating` gets only the counters.\n */\nexport interface NegotiationContext {\n status: OpportunityStatus;\n /**\n * Conversation/task id of the A2A negotiation that produced this opportunity.\n * Lets callers deep-link to the negotiation trace (e.g. `/chat/:conversationId`).\n * Present whenever a negotiation task exists (i.e. context is non-null).\n */\n conversationId: string;\n turnCount: number;\n /** Max turns allowed for this negotiation (0 = unlimited). */\n turnCap: number;\n /** Only present when status is not `negotiating`. */\n outcome?: NegotiationOutcome;\n /** Only present when status is not `negotiating`. */\n turns?: NegotiationTurn[];\n}\n\nconst STATUSES_WITH_NO_NEGOTIATION: ReadonlyArray<OpportunityStatus> = ['draft', 'latent', 'expired'];\nconst NEGOTIATION_OUTCOME_ARTIFACT_NAME = 'negotiation-outcome';\n\n/**\n * Loads the negotiation context for an opportunity.\n *\n * @param db - Narrow slice of NegotiationGraphDatabase.\n * @param opportunityId - Opportunity to load negotiation context for.\n * @param opportunityStatus - Current opportunity status. Used to gate loading\n * and to decide which fields to populate.\n * @returns NegotiationContext, or null when no meaningful negotiation exists\n * (draft/latent/expired) or when the task lookup fails.\n */\nexport async function loadNegotiationContext(\n db: NegotiationContextDatabase,\n opportunityId: string,\n opportunityStatus: OpportunityStatus,\n): Promise<NegotiationContext | null> {\n if (STATUSES_WITH_NO_NEGOTIATION.includes(opportunityStatus)) {\n return null;\n }\n\n const task = await db.getNegotiationTaskForOpportunity(opportunityId);\n if (!task) {\n logger.verbose('No negotiation task found for opportunity', { opportunityId, opportunityStatus });\n return null;\n }\n\n const turnCap = readNumber(task.metadata, 'maxTurns') ?? 0;\n\n const messages = await db.getMessagesForConversation(task.conversationId);\n const turns = extractTurns(messages);\n const turnCount = turns.length;\n\n if (opportunityStatus === 'negotiating') {\n return { status: opportunityStatus, conversationId: task.conversationId, turnCount, turnCap };\n }\n\n const artifacts = await db.getArtifactsForTask(task.id);\n const outcome = extractOutcome(artifacts);\n\n // P2.2: screened_out is the client's private gate decision, not a negotiation.\n if (outcome?.reason === 'screened_out') {\n return null;\n }\n\n return {\n status: opportunityStatus,\n conversationId: task.conversationId,\n turnCount,\n turnCap,\n ...(outcome ? { outcome } : {}),\n turns,\n };\n}\n\nfunction readNumber(metadata: Record<string, unknown> | null, key: string): number | undefined {\n if (!metadata) return undefined;\n const value = metadata[key];\n return typeof value === 'number' ? value : undefined;\n}\n\nfunction extractTurns(messages: Array<{ parts: unknown[] }>): NegotiationTurn[] {\n const turns: NegotiationTurn[] = [];\n for (const message of messages) {\n const dataPart = (message.parts as Array<{ kind?: string; data?: unknown }>).find((p) => p.kind === 'data');\n if (dataPart?.data) {\n turns.push(dataPart.data as NegotiationTurn);\n }\n }\n return turns;\n}\n\nfunction extractOutcome(\n artifacts: Array<{ name: string | null; parts: unknown[] }>,\n): NegotiationOutcome | undefined {\n const outcomeArtifact = artifacts.find((a) => a.name === NEGOTIATION_OUTCOME_ARTIFACT_NAME);\n if (!outcomeArtifact) return undefined;\n\n const dataPart = (outcomeArtifact.parts as Array<{ kind?: string; data?: unknown }>).find(\n (p) => p.kind === 'data',\n );\n return dataPart?.data as NegotiationOutcome | undefined;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"negotiation-evidence.env.d.ts","sourceRoot":"/","sources":["opportunity/negotiation-evidence/negotiation-evidence.env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,8EAA8E;AAC9E,eAAO,MAAM,oCAAoC,kCAAmC,CAAC;AAErF,kEAAkE;AAClE,MAAM,MAAM,gCAAgC,GAAG,CAAC,OAAO,oCAAoC,CAAC,CAAC,MAAM,CAAC,CAAC;AAErG;;;;GAIG;AACH,wBAAgB,gCAAgC,IAAI,gCAAgC,CAGnF;AAED;;;;;;GAMG;AACH,eAAO,MAAM,+CAA+C,IAAI,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,sCAAsC,KAAK,CAAC;AAEzD,4EAA4E;AAC5E,eAAO,MAAM,sCAAsC,MAAM,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"negotiation-evidence.env.js","sourceRoot":"/","sources":["opportunity/negotiation-evidence/negotiation-evidence.env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,8EAA8E;AAC9E,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAU,CAAC;AAKrF;;;;GAIG;AACH,MAAM,UAAU,gCAAgC;IAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,IAAI,EAAE,CAAC;IACpE,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;AACxD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,+CAA+C,GAAG,CAAC,CAAC;AAEjE;;;;GAIG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,EAAE,CAAC;AAEzD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,sCAAsC,GAAG,GAAG,CAAC","sourcesContent":["/**\n * Centralized accessor + constants for the Lens C negotiation-evidence\n * question producer (IND-433).\n *\n * NEGOTIATION_EVIDENCE_QUESTIONS_MODE off | shadow | on — default off.\n * - off (default): the lens never runs; zero reads, zero telemetry.\n * - shadow (this issue): mine + verify neutral hypotheses over allowlisted\n * negotiation evidence, emit AGGREGATE telemetry only. Persists no\n * questions and changes no ranking, intent, premise, memory, policy,\n * newborn-stamping, or push behavior.\n * - on (future, IND-437): additionally synthesize/enqueue questions and\n * suppress the older IND-296–299 transcript-question producer.\n *\n * All reads go through this module — do not read the variable via\n * `process.env` elsewhere. The value is read on every call (no caching) so\n * tests and long-lived processes observe changes.\n */\n\n/** Documented modes for the Lens C negotiation-evidence question producer. */\nexport const NEGOTIATION_EVIDENCE_QUESTIONS_MODES = [\"off\", \"shadow\", \"on\"] as const;\n\n/** Mode for the Lens C negotiation-evidence question producer. */\nexport type NegotiationEvidenceQuestionsMode = (typeof NEGOTIATION_EVIDENCE_QUESTIONS_MODES)[number];\n\n/**\n * Current NEGOTIATION_EVIDENCE_QUESTIONS_MODE (default off). Any value other\n * than an exact documented mode (after trimming) coerces to off — an\n * unrecognized flag must never silently enable the lens.\n */\nexport function negotiationEvidenceQuestionsMode(): NegotiationEvidenceQuestionsMode {\n const raw = process.env.NEGOTIATION_EVIDENCE_QUESTIONS_MODE?.trim();\n return raw === \"shadow\" || raw === \"on\" ? raw : \"off\";\n}\n\n/**\n * Recurrence floor: a mined hypothesis is only retained when its verified\n * support spans at least this many DISTINCT opportunities (IND-433 `k=5`).\n * Continuation segments of one opportunity are grouped and count once, so this\n * is genuinely a cross-opportunity threshold — same-pair repetition cannot\n * inflate it.\n */\nexport const NEGOTIATION_EVIDENCE_MIN_DISTINCT_OPPORTUNITIES = 5;\n\n/**\n * Max opportunities (already grouped, one per opportunity) whose allowlisted\n * evidence is sent to the miner in one pass. Bounds prompt size the same way\n * the Lens A miner caps its candidate pool.\n */\nexport const NEGOTIATION_EVIDENCE_MAX_OPPORTUNITIES = 24;\n\n/** Max chars of allowlisted evidence content retained per evidence unit. */\nexport const NEGOTIATION_EVIDENCE_MAX_CONTENT_CHARS = 400;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"negotiation-evidence.extractor.d.ts","sourceRoot":"/","sources":["opportunity/negotiation-evidence/negotiation-evidence.extractor.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,mBAAmB,EAAmB,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAEnJ,wEAAwE;AACxE,MAAM,WAAW,gBAAgB;IAC/B,8EAA8E;IAC9E,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAChC,uEAAuE;IACvE,qBAAqB,EAAE,MAAM,CAAC;IAC9B,8EAA8E;IAC9E,eAAe,EAAE,MAAM,CAAC;IACxB,iDAAiD;IACjD,cAAc,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;CAC9C;AA+CD;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,mBAAmB,EAC1B,QAAQ,EAAE,kBAAkB,EAAE,GAC7B,gBAAgB,CAsIlB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"negotiation-evidence.extractor.js","sourceRoot":"/","sources":["opportunity/negotiation-evidence/negotiation-evidence.extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,sCAAsC,EAAE,sCAAsC,EAAE,MAAM,+BAA+B,CAAC;AAe/H,MAAM,YAAY,GAAG,GAAiC,EAAE,CAAC,CAAC;IACxD,YAAY,EAAE,CAAC;IACf,gBAAgB,EAAE,CAAC;IACnB,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,CAAC;CAClB,CAAC,CAAC;AAEH,+EAA+E;AAC/E,SAAS,QAAQ,CAAC,IAAkB,EAAE,OAAwB,EAAE,OAAe;IAC7E,OAAO,GAAG,IAAI,SAAS,OAAO,SAAS,OAAO,CAAC,WAAW,E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OAAO,CAAC;yBACf,IAAI,CAAC,GAAG,CAAC,CAAC;oBACb,IAAI,CAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;gBACrD,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAE/C,qBAAqB,IAAI,CAAC,CAAC;QAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACvB,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE;YACzC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5B,QAAQ,CAAC,IAAI,CAAC;gBACZ,UAAU,EAAE,GAAG,CAAC,CAAC,IAAI,IAAI,aAAa,IAAI,OAAO,EAAE;gBACnD,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,OAAO,EAAE,CAAC,CAAC,OAAO;gBAClB,OAAO,EAAE,CAAC,CAAC,OAAO;gBAClB,eAAe,EAAE,KAAK,CAAC,eAAe;gBACtC,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;gBAC1C,aAAa;gBACb,MAAM,EAAE,CAAC,CAAC,MAAM;gBAChB,cAAc,EAAE,CAAC,CAAC,cAAc;gBAChC,SAAS,EAAE,KAAK,CAAC,SAAS;aAC3B,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC;AAC9E,CAAC","sourcesContent":["/**\n * Lens C in-place evidence extraction (IND-433).\n *\n * Reads raw negotiation segments and projects ONLY the allowlist:\n * - authoritative owner answers (answerer === recipient),\n * - structured bilateral actions and coarse outcomes,\n * - explicitly shared (tagged) message content.\n *\n * Everything else is dropped by construction. The function is pure and\n * deterministic so adversarial fixtures can prove that every excluded source\n * and every recipient / intent / opportunity / network / task / speaker\n * mismatch is rejected, and that same-pair continuations cannot inflate the\n * distinct-opportunity count.\n */\nimport { NEGOTIATION_EVIDENCE_MAX_CONTENT_CHARS, NEGOTIATION_EVIDENCE_MAX_OPPORTUNITIES } from \"./negotiation-evidence.env.js\";\nimport type { AllowlistedEvidence, EvidenceKind, EvidenceMiningScope, EvidenceSpeaker, RawEvidenceSegment } from \"./negotiation-evidence.types.js\";\n\n/** Result of one extraction pass over a recipient+intent's segments. */\nexport interface ExtractionResult {\n /** Allowlisted evidence, grouped/deduped, one logical set per opportunity. */\n evidence: AllowlistedEvidence[];\n /** Distinct opportunities that produced at least one evidence unit. */\n distinctOpportunities: number;\n /** Candidate records rejected by allowlist / exclusion / provenance rules. */\n excludedRecords: number;\n /** Allowlisted evidence unit counts, by kind. */\n evidenceCounts: Record<EvidenceKind, number>;\n}\n\nconst EMPTY_COUNTS = (): Record<EvidenceKind, number> => ({\n owner_answer: 0,\n bilateral_action: 0,\n coarse_outcome: 0,\n shared_message: 0,\n});\n\n/** Collapse whitespace + lowercase for dedup only (not for stored content). */\nfunction dedupKey(kind: EvidenceKind, speaker: EvidenceSpeaker, content: string): string {\n return `${kind}\\u0000${speaker}\\u0000${content.toLowerCase().replace(/\\s+/g, \" \").trim()}`;\n}\n\n/** Bound + whitespace-normalize stored content. */\nfunction boundContent(raw: string): string {\n return raw.replace(/\\s+/g, \" \").trim().slice(0, NEGOTIATION_EVIDENCE_MAX_CONTENT_CHARS);\n}\n\n/**\n * A segment matches the pass scope only when EVERY provenance field is exactly\n * equal. A single mismatch rejects the whole segment (cross-recipient,\n * cross-intent, cross-fingerprint, or cross-network contamination).\n */\nfunction segmentMatchesScope(segment: RawEvidenceSegment, scope: EvidenceMiningScope): boolean {\n return (\n segment.recipientUserId === scope.recipientUserId &&\n segment.intentId === scope.intentId &&\n segment.intentFingerprint === scope.intentFingerprint &&\n segment.networkId === scope.networkId\n );\n}\n\n/** Map a turn sender to owner/counterparty, or null when it is neither. */\nfunction mapSpeaker(senderUserId: string, segment: RawEvidenceSegment): EvidenceSpeaker | null {\n if (senderUserId === segment.recipientUserId) return \"owner\";\n if (senderUserId === segment.counterpartyUserId) return \"counterparty\";\n return null;\n}\n\n/** Count every raw record a segment carries (for excluded-record accounting). */\nfunction countSegmentRecords(segment: RawEvidenceSegment): number {\n let n = segment.turns.length + (segment.ownerAnswers?.length ?? 0);\n if (segment.outcome) n += 1;\n return n;\n}\n\n/**\n * Extract allowlisted evidence for one (recipient, intent) mining scope.\n *\n * Continuation grouping: segments are grouped by `opportunityId`; a single\n * opportunity contributes ONE deduped evidence set regardless of how many\n * continuation tasks it spans, so an opportunity counts once toward recurrence.\n *\n * Contamination guard: a segment whose recipient / intent / fingerprint /\n * network do not match the scope, or whose own recipient equals its\n * counterparty, is rejected wholesale (all records counted as excluded).\n */\nexport function extractAllowlistedEvidence(\n scope: EvidenceMiningScope,\n segments: RawEvidenceSegment[],\n): ExtractionResult {\n const evidenceCounts = EMPTY_COUNTS();\n let excludedRecords = 0;\n\n // Group in-scope segments by opportunity (continuation grouping).\n const byOpportunity = new Map<string, RawEvidenceSegment[]>();\n for (const segment of segments) {\n if (!segmentMatchesScope(segment, scope) || segment.recipientUserId === segment.counterpartyUserId) {\n excludedRecords += countSegmentRecords(segment);\n continue;\n }\n const group = byOpportunity.get(segment.opportunityId);\n if (group) group.push(segment);\n else byOpportunity.set(segment.opportunityId, [segment]);\n }\n\n const evidence: AllowlistedEvidence[] = [];\n let distinctOpportunities = 0;\n\n for (const [opportunityId, group] of byOpportunity) {\n if (distinctOpportunities >= NEGOTIATION_EVIDENCE_MAX_OPPORTUNITIES) {\n // Cap opportunities per pass; remaining segments simply are not mined.\n excludedRecords += group.reduce((n, s) => n + countSegmentRecords(s), 0);\n continue;\n }\n\n const seen = new Set<string>();\n const opportunityEvidence: Array<{\n kind: EvidenceKind;\n speaker: EvidenceSpeaker;\n content: string;\n taskId: string;\n conversationId: string;\n }> = [];\n\n const push = (\n segment: RawEvidenceSegment,\n kind: EvidenceKind,\n speaker: EvidenceSpeaker,\n rawContent: string,\n ): boolean => {\n const content = boundContent(rawContent);\n if (content.length === 0) return false;\n const key = dedupKey(kind, speaker, content);\n if (seen.has(key)) return true; // duplicate continuation content retains its first source\n seen.add(key);\n opportunityEvidence.push({\n kind,\n speaker,\n content,\n taskId: segment.taskId,\n conversationId: segment.conversationId,\n });\n return true;\n };\n\n for (const segment of group) {\n // Authoritative owner answers — answerer MUST be the recipient.\n for (const answer of segment.ownerAnswers ?? []) {\n if (answer.answererUserId !== segment.recipientUserId) {\n excludedRecords += 1;\n continue;\n }\n const parts = [...answer.selectedOptions, ...(answer.freeText ? [answer.freeText] : [])];\n const content = parts.join(\" | \");\n if (!push(segment, \"owner_answer\", \"owner\", content)) excludedRecords += 1;\n }\n\n // Turns → structured bilateral action + explicitly shared message.\n for (const turn of segment.turns) {\n const speaker = mapSpeaker(turn.senderUserId, segment);\n if (speaker === null) {\n // Speaker mismatch: neither owner nor counterparty. Nothing from\n // this turn (action AND message) may be trusted.\n excludedRecords += 1;\n continue;\n }\n // Structured bilateral action (label only; reasoning never read).\n const action = turn.action?.trim();\n if (action) push(segment, \"bilateral_action\", \"system\", action);\n\n // Explicitly shared message content only. Untagged → excluded.\n const message = turn.message?.trim();\n if (message) {\n if (turn.sharedTagged === true) push(segment, \"shared_message\", speaker, message);\n else excludedRecords += 1;\n }\n }\n\n // Coarse outcome. `screened_out` is a private client gate → excluded.\n const outcome = segment.outcome;\n if (outcome) {\n if (outcome.reason === \"screened_out\") {\n excludedRecords += 1;\n } else {\n const roles = (outcome.agreedRoles ?? [])\n .map((r) => `${r.role}`)\n .sort()\n .join(\",\");\n const content = [\n `hasOpportunity=${outcome.hasOpportunity}`,\n outcome.reason ? `reason=${outcome.reason}` : \"\",\n roles ? `roles=${roles}` : \"\",\n ]\n .filter(Boolean)\n .join(\" \");\n push(segment, \"coarse_outcome\", \"system\", content);\n }\n }\n }\n\n if (opportunityEvidence.length === 0) continue;\n\n distinctOpportunities += 1;\n const first = group[0];\n opportunityEvidence.forEach((e, ordinal) => {\n evidenceCounts[e.kind] += 1;\n evidence.push({\n evidenceId: `${e.kind}:${opportunityId}:${ordinal}`,\n kind: e.kind,\n speaker: e.speaker,\n content: e.content,\n recipientUserId: first.recipientUserId,\n intentId: first.intentId,\n intentFingerprint: first.intentFingerprint,\n opportunityId,\n taskId: e.taskId,\n conversationId: e.conversationId,\n networkId: first.networkId,\n });\n });\n }\n\n return { evidence, distinctOpportunities, excludedRecords, evidenceCounts };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"negotiation-evidence.miner.d.ts","sourceRoot":"/","sources":["opportunity/negotiation-evidence/negotiation-evidence.miner.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAI3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAsDpG,wDAAwD;AACxD,MAAM,WAAW,8BAA8B;IAC7C,mEAAmE;IACnE,WAAW,CAAC,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3D;AAED;;;GAGG;AACH,qBAAa,wBAAwB;IACnC,OAAO,CAAC,KAAK,CAAqE;gBAEtE,MAAM,CAAC,EAAE,8BAA8B;IASnD;;;;;OAKG;IAEG,IAAI,CACR,QAAQ,EAAE,mBAAmB,EAAE,EAC/B,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GACjC,OAAO,CAAC,uBAAuB,EAAE,CAAC;CAmBtC;AAED,yEAAyE;AACzE,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,mBAAmB,EAAE,GAAG,MAAM,CAK3E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"negotiation-evidence.miner.js","sourceRoot":"/","sources":["opportunity/negotiation-evidence/negotiation-evidence.miner.ts"],"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AE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;SACpF,CAAC,CAAC,CAAC;IACN,CAAC;CACF;AAtBO;IADL,KAAK,EAAE;;;;oDAsBP;AAGH,yEAAyE;AACzE,MAAM,UAAU,mBAAmB,CAAC,QAA+B;IACjE,MAAM,MAAM,GAAG,QAAQ;SACpB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;SACvE,IAAI,CAAC,MAAM,CAAC,CAAC;IAChB,OAAO,yBAAyB,QAAQ,CAAC,MAAM,+BAA+B,MAAM,EAAE,CAAC;AACzF,CAAC","sourcesContent":["/**\n * NegotiationEvidenceMiner — one structured LLM pass that proposes neutral\n * clarification hypotheses over ALLOWLISTED negotiation evidence, with\n * code-side support verification delegated to the verifier (IND-433).\n *\n * The miner only ever sees the allowlisted projection (owner answers, bilateral\n * actions, coarse outcomes, explicitly shared messages) — never reasoning,\n * memories, disclosure subjects, or provenance. Every proposed hypothesis must\n * cite the `evidenceId`s that support it and quote a verbatim span from each;\n * unsupported or hallucinated references are discarded in code, not trusted\n * from the prompt.\n *\n * Follows the Lens A `PoolDiscriminatorMiner` pattern: constructor binds the\n * structured model once; a single public `mine()` per call.\n */\nimport { HumanMessage, SystemMessage } from \"@langchain/core/messages\";\nimport { z } from \"zod\";\n\nimport { createStructuredModel } from \"../../shared/agent/model.config.js\";\nimport { invokeWithAbortSignal } from \"../../shared/agent/model-signal.js\";\nimport { protocolLogger } from \"../../shared/observability/protocol.logger.js\";\nimport { Timed } from \"../../shared/observability/performance.js\";\nimport type { AllowlistedEvidence, MinedEvidenceHypothesis } from \"./negotiation-evidence.types.js\";\n\nconst logger = protocolLogger(\"NegotiationEvidenceMiner\");\n\n/** Max hypotheses requested from (and accepted out of) one mining pass. */\nconst MAX_HYPOTHESES = 8;\n\nconst HypothesisMiningResponseSchema = z.object({\n hypotheses: z\n .array(\n z.object({\n statement: z\n .string()\n .describe(\n \"A neutral, non-identifying clarification hypothesis about the intent owner's preferences or context\",\n ),\n claimType: z\n .enum([\"observation\", \"recipient_fact\", \"recipient_preference\"])\n .describe(\n \"observation = a neutral pattern; recipient_fact/recipient_preference = a claim ABOUT the intent owner (needs owner-authored or structured support)\",\n ),\n supportRefs: z\n .array(\n z.object({\n evidenceId: z.string().describe(\"An evidenceId exactly as given in the evidence list\"),\n span: z\n .string()\n .max(200)\n .describe(\"VERBATIM span (<=120 chars) copied from that evidence's content\"),\n }),\n )\n .min(1)\n .describe(\"One or more support references; every hypothesis must be grounded\"),\n }),\n )\n .max(MAX_HYPOTHESES),\n});\n\ntype HypothesisMiningResponse = z.infer<typeof HypothesisMiningResponseSchema>;\n\nconst SYSTEM_PROMPT = `You review ALLOWLISTED evidence gathered from a user's past negotiations and propose neutral clarification hypotheses about that user's (the \"intent owner\") preferences or context.\n\nYou are given only a safe projection of evidence: the owner's own answers, structured bilateral actions, coarse outcomes, and explicitly shared messages. Each item has an id, a kind, and a speaker (owner | counterparty | system).\n\nRules for every hypothesis:\n- State it neutrally and at an aggregate level. NEVER name or describe any specific person, and NEVER infer protected attributes (race, ethnicity, religion, gender, age, nationality, disability, politics, sexual orientation).\n- Ground it: cite the evidenceId(s) that support it and copy a short (<=120 chars) VERBATIM substring of that evidence's content as the span. Copy it exactly — spans are checked mechanically and paraphrased spans are discarded.\n- claimType:\n - Use \"recipient_fact\" or \"recipient_preference\" only for a claim ABOUT the intent owner. Such claims may ONLY be supported by owner or system evidence — a counterparty statement can never establish a fact or preference about the owner.\n - Use \"observation\" for a neutral pattern that a counterparty statement may also support.\n- Do not speculate beyond the evidence. If an item does not support a distinct hypothesis, ignore it.\n\nPrefer a few well-supported hypotheses over many weak ones. Propose at most ${MAX_HYPOTHESES}.`;\n\n/** Config for NegotiationEvidenceMiner construction. */\nexport interface NegotiationEvidenceMinerConfig {\n /** Optional model config override (API key / base URL / model). */\n modelConfig?: Parameters<typeof createStructuredModel>[3];\n}\n\n/**\n * Stateless hypothesis-mining agent. One `mine()` call = one structured LLM\n * pass. All support verification happens later, in the verifier.\n */\nexport class NegotiationEvidenceMiner {\n private model: ReturnType<typeof createStructuredModel<HypothesisMiningResponse>>;\n\n constructor(config?: NegotiationEvidenceMinerConfig) {\n this.model = createStructuredModel<HypothesisMiningResponse>(\n \"negotiationEvidenceMiner\",\n HypothesisMiningResponseSchema,\n { name: \"negotiation_evidence_hypotheses\" },\n config?.modelConfig,\n );\n }\n\n /**\n * Mine neutral hypotheses for one allowlisted evidence set.\n *\n * @returns Proposed hypotheses (may be empty). Throws on LLM failure —\n * callers run this fire-and-forget and must catch.\n */\n @Timed()\n async mine(\n evidence: AllowlistedEvidence[],\n options?: { signal?: AbortSignal },\n ): Promise<MinedEvidenceHypothesis[]> {\n if (evidence.length === 0) return [];\n const prompt = buildEvidencePrompt(evidence);\n const raw = await invokeWithAbortSignal(\n this.model,\n [new SystemMessage(SYSTEM_PROMPT), new HumanMessage(prompt)],\n options?.signal,\n );\n const parsed = HypothesisMiningResponseSchema.safeParse(raw);\n if (!parsed.success) {\n logger.warn(\"Mining response failed schema validation\", { issues: parsed.error.issues.length });\n return [];\n }\n return parsed.data.hypotheses.slice(0, MAX_HYPOTHESES).map((h) => ({\n statement: h.statement,\n claimType: h.claimType,\n supportRefs: h.supportRefs.map((r) => ({ evidenceId: r.evidenceId, span: r.span })),\n }));\n }\n}\n\n/** Builds the human message: one block per allowlisted evidence unit. */\nexport function buildEvidencePrompt(evidence: AllowlistedEvidence[]): string {\n const blocks = evidence\n .map((e) => `[${e.evidenceId}] (${e.kind}, ${e.speaker})\\n${e.content}`)\n .join(\"\\n\\n\");\n return `Allowlisted evidence (${evidence.length} items, id in brackets):\\n\\n${blocks}`;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"negotiation-evidence.shadow.d.ts","sourceRoot":"/","sources":["opportunity/negotiation-evidence/negotiation-evidence.shadow.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,OAAO,KAAK,EAAE,mBAAmB,EAAE,+BAA+B,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAEhI,wCAAwC;AACxC,MAAM,WAAW,8BAA8B;IAC7C,gFAAgF;IAChF,KAAK,EAAE,mBAAmB,CAAC;IAC3B,4EAA4E;IAC5E,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,qDAAqD;IACrD,KAAK,EAAE,IAAI,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;IAC9C,qEAAqE;IACrE,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAsB,4BAA4B,CAChD,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,+BAA+B,CAAC,CA+C1C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"negotiation-evidence.shadow.js","sourceRoot":"/","sources":["opportunity/negotiation-evidence/negotiation-evidence.shadow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,+CAA+C,EAAE,MAAM,+BAA+B,CAAC;AAChG,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAgBtE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,KAAqC;IAErC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAClC,MAAM,WAAW,GAAG,KAAK,CAAC,wBAAwB,IAAI,+CAA+C,CAAC;IAEtG,MAAM,UAAU,GAAG,0BAA0B,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAE/D,MAAM,aAAa,GAAG;QACpB,eAAe,EAAE,KAAK,CAAC,eAAe;QACtC,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,QAAQ,CAAC,MAAM;QACzB,qBAAqB,EAAE,UAAU,CAAC,qBAAqB;QACvD,cAAc,EAAE,UAAU,CAAC,cAAc;QACzC,eAAe,EAAE,UAAU,CAAC,eAAe;KACnC,CAAC;IAEX,6EAA6E;IAC7E,2DAA2D;IAC3D,IAAI,UAAU,CAAC,qBAAqB,GAAG,WAAW,EAAE,CAAC;QACnD,OAAO;YACL,SAAS,EAAE;gBACT,GAAG,aAAa;gBAChB,eAAe,EAAE,CAAC;gBAClB,mBAAmB,EAAE,CAAC;gBACtB,mBAAmB,EAAE,CAAC;gBACtB,mBAAmB,EAAE,CAAC;aACvB;YACD,UAAU,EAAE,EAAE;SACf,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,IAAI,CAClC,UAAU,CAAC,QAAQ,EACnB,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CACpD,CAAC;IAEF,MAAM,YAAY,GAAG,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAE/E,OAAO;QACL,SAAS,EAAE;YACT,GAAG,aAAa;YAChB,eAAe,EAAE,KAAK,CAAC,MAAM;YAC7B,mBAAmB,EAAE,YAAY,CAAC,SAAS;YAC3C,mBAAmB,EAAE,YAAY,CAAC,SAAS;YAC3C,mBAAmB,EAAE,YAAY,CAAC,SAAS;SAC5C;QACD,UAAU,EAAE,YAAY,CAAC,QAAQ;KAClC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Lens C shadow orchestrator (IND-433).\n *\n * extract (allowlist, in place) → mine (neutral hypotheses) → verify (support\n * resolves to allowlisted evidence + speaker constraint) → recurrence gate\n * (>= k distinct opportunities). Returns aggregate telemetry plus the retained\n * hypotheses for OFFLINE review.\n *\n * This function performs NO persistence and NO user-visible action. It does\n * not create questions and changes no ranking, intent, premise, memory,\n * policy, newborn-stamping, or push behavior — those belong to the future\n * `on` mode (IND-437). Callers in shadow mode must log only\n * {@link NegotiationEvidenceShadowResult.telemetry} (aggregate-only) and must\n * not persist or route the retained hypotheses.\n */\nimport { NEGOTIATION_EVIDENCE_MIN_DISTINCT_OPPORTUNITIES } from \"./negotiation-evidence.env.js\";\nimport { extractAllowlistedEvidence } from \"./negotiation-evidence.extractor.js\";\nimport type { NegotiationEvidenceMiner } from \"./negotiation-evidence.miner.js\";\nimport { verifyHypotheses } from \"./negotiation-evidence.verifier.js\";\nimport type { EvidenceMiningScope, NegotiationEvidenceShadowResult, RawEvidenceSegment } from \"./negotiation-evidence.types.js\";\n\n/** Input for one shadow mining pass. */\nexport interface NegotiationEvidenceShadowInput {\n /** The exact recipient + intent/fingerprint + network this pass is bound to. */\n scope: EvidenceMiningScope;\n /** Raw negotiation segments read in place (one or more per opportunity). */\n segments: RawEvidenceSegment[];\n /** Structured hypothesis miner (injectable seam). */\n miner: Pick<NegotiationEvidenceMiner, \"mine\">;\n /** Override the recurrence floor (defaults to the IND-433 `k=5`). */\n minDistinctOpportunities?: number;\n signal?: AbortSignal;\n}\n\n/**\n * Run one Lens C shadow pass. Throws only when *mining* fails (callers run\n * fire-and-forget and must catch); extraction and verification are pure.\n */\nexport async function runNegotiationEvidenceShadow(\n input: NegotiationEvidenceShadowInput,\n): Promise<NegotiationEvidenceShadowResult> {\n const { scope, segments } = input;\n const minDistinct = input.minDistinctOpportunities ?? NEGOTIATION_EVIDENCE_MIN_DISTINCT_OPPORTUNITIES;\n\n const extraction = extractAllowlistedEvidence(scope, segments);\n\n const baseTelemetry = {\n recipientUserId: scope.recipientUserId,\n intentId: scope.intentId,\n segments: segments.length,\n distinctOpportunities: extraction.distinctOpportunities,\n evidenceCounts: extraction.evidenceCounts,\n excludedRecords: extraction.excludedRecords,\n } as const;\n\n // Cheap exit: recurrence is impossible below the distinct-opportunity floor,\n // so never spend an LLM call that could only be discarded.\n if (extraction.distinctOpportunities < minDistinct) {\n return {\n telemetry: {\n ...baseTelemetry,\n hypothesesMined: 0,\n hypothesesSupported: 0,\n hypothesesRecurrent: 0,\n hypothesesDiscarded: 0,\n },\n hypotheses: [],\n };\n }\n\n const mined = await input.miner.mine(\n extraction.evidence,\n input.signal ? { signal: input.signal } : undefined,\n );\n\n const verification = verifyHypotheses(mined, extraction.evidence, minDistinct);\n\n return {\n telemetry: {\n ...baseTelemetry,\n hypothesesMined: mined.length,\n hypothesesSupported: verification.supported,\n hypothesesRecurrent: verification.recurrent,\n hypothesesDiscarded: verification.discarded,\n },\n hypotheses: verification.retained,\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"negotiation-evidence.types.d.ts","sourceRoot":"/","sources":["opportunity/negotiation-evidence/negotiation-evidence.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,4EAA4E;AAC5E,MAAM,MAAM,YAAY,GACpB,cAAc,GACd,kBAAkB,GAClB,gBAAgB,GAChB,gBAAgB,CAAC;AAErB;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,cAAc,GAAG,QAAQ,CAAC;AAElE;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,8FAA8F;IAC9F,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,eAAe,CAAC;IACzB,iFAAiF;IACjF,OAAO,EAAE,MAAM,CAAC;IAEhB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AAC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,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC7C,sEAAsE;IACtE,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yEAAyE;IACzE,mBAAmB,EAAE,MAAM,CAAC;IAC5B,8EAA8E;IAC9E,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,wCAAwC;AACxC,MAAM,WAAW,+BAA+B;IAC9C,oCAAoC;IACpC,SAAS,EAAE,4BAA4B,CAAC;IACxC;;;OAGG;IACH,UAAU,EAAE,0BAA0B,EAAE,CAAC;CAC1C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"negotiation-evidence.types.js","sourceRoot":"/","sources":["opportunity/negotiation-evidence/negotiation-evidence.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG","sourcesContent":["/**\n * Lens C negotiation-evidence — shared types (IND-433).\n *\n * Lens C mines neutral clarification hypotheses from RECURRING negotiation\n * evidence, read in place at mining time. It never builds a durable transcript\n * projection and never summarizes an entire pair DM; the only content it will\n * ever touch is a narrow, positively-constructed allowlist:\n *\n * - authoritative owner answers (the recipient's own answers),\n * - structured bilateral actions / coarse outcomes, and\n * - explicitly shared message content.\n *\n * Everything else — screen/evaluator reasoning, agent chain-of-thought,\n * `memoryHints`, private negotiator memories/reflections, disclosure subjects,\n * untagged shared answers, and old synthesized digests — is excluded by\n * construction (never mapped into an {@link AllowlistedEvidence}).\n */\n\n/** The four allowlisted evidence families. Nothing else may be surfaced. */\nexport type EvidenceKind =\n | \"owner_answer\"\n | \"bilateral_action\"\n | \"coarse_outcome\"\n | \"shared_message\";\n\n/**\n * Who authored an evidence unit. `system` covers structured bilateral facts\n * (actions/outcomes) that belong to neither party's voice. The distinction is\n * load-bearing: a counterparty statement may support an OBSERVATION but never\n * a fact or preference ABOUT the recipient (IND-433).\n */\nexport type EvidenceSpeaker = \"owner\" | \"counterparty\" | \"system\";\n\n/**\n * One unit of allowlisted evidence, extracted in place for exactly one\n * (recipient, intent, opportunity, task) tuple. Provenance travels with the\n * unit so cross-recipient / cross-intent / cross-opportunity / cross-network /\n * cross-task / cross-speaker contamination is a pure-function rejection rather\n * than a downstream concern.\n */\nexport interface AllowlistedEvidence {\n /** Deterministic id, unique within one mining pass: `${kind}:${opportunityId}:${ordinal}`. */\n evidenceId: string;\n kind: EvidenceKind;\n speaker: EvidenceSpeaker;\n /** The only text a support reference may quote — bounded, exclusion-scrubbed. */\n content: string;\n // Provenance (used for keying + contamination rejection; never sent to the LLM).\n recipientUserId: string;\n intentId: string;\n intentFingerprint: string;\n opportunityId: string;\n taskId: string;\n conversationId: string;\n networkId: string;\n}\n\n/**\n * One raw negotiation turn as read in place. Untrusted: it still carries the\n * fields Lens C must EXCLUDE (`reasoning`, `askUser`/disclosure). The extractor\n * maps only the allowlisted projection of this record.\n */\nexport interface RawEvidenceTurn {\n /** Turn author user id — mapped to owner/counterparty against the segment. */\n senderUserId: string;\n /** Structured bilateral action (propose/accept/counter/decline/...). */\n action: string;\n /** Free-text message body, if any. */\n message?: string | null;\n /**\n * True only when this message was EXPLICITLY shared/consented for reuse.\n * Untagged messages are excluded — Lens C never mines an untagged answer.\n */\n sharedTagged?: boolean;\n /** Chain-of-thought — EXCLUDED. Present here only to prove it is dropped. */\n reasoning?: string | null;\n /** Disclosure subject — EXCLUDED. Present here only to prove it is dropped. */\n disclosureSubject?: string | null;\n}\n\n/** Coarse, structured outcome facts (no evaluator reasoning). */\nexport interface RawEvidenceOutcome {\n hasOpportunity: boolean;\n /** `turn_cap | timeout` are coarse; `screened_out` is a private gate → dropped. */\n reason?: \"turn_cap\" | \"timeout\" | \"screened_out\";\n /** Agreed collaboration roles, if any. */\n agreedRoles?: Array<{ userId: string; role: string }>;\n /** Evaluator reasoning — EXCLUDED. Present here only to prove it is dropped. */\n reasoning?: string | null;\n}\n\n/** Authoritative owner answer (the recipient's own answer to a question). */\nexport interface RawEvidenceOwnerAnswer {\n /** Answerer user id — must equal the segment recipient to be authoritative. */\n answererUserId: string;\n selectedOptions: string[];\n freeText?: string;\n}\n\n/**\n * All in-place negotiation data for ONE opportunity segment, scoped to an\n * exact recipient + intent/fingerprint + opportunity + task. Continuations of\n * the same opportunity arrive as separate segments sharing `opportunityId`;\n * the extractor groups them and counts the opportunity once.\n */\nexport interface RawEvidenceSegment {\n recipientUserId: string;\n intentId: string;\n intentFingerprint: string;\n opportunityId: string;\n taskId: string;\n conversationId: string;\n networkId: string;\n /** The counterparty in this bilateral negotiation. */\n counterpartyUserId: string;\n turns: RawEvidenceTurn[];\n outcome?: RawEvidenceOutcome | null;\n ownerAnswers?: RawEvidenceOwnerAnswer[];\n}\n\n/** The scope a mining pass is bound to — every segment must match it exactly. */\nexport interface EvidenceMiningScope {\n recipientUserId: string;\n intentId: string;\n intentFingerprint: string;\n networkId: string;\n}\n\n/**\n * The three claim shapes a hypothesis may take. The speaker constraint is\n * enforced against these: `recipient_fact` / `recipient_preference` require\n * owner-authored (or structured bilateral) support; `observation` may also be\n * supported by counterparty statements.\n */\nexport type HypothesisClaimType =\n | \"observation\"\n | \"recipient_fact\"\n | \"recipient_preference\";\n\n/** A support reference proposed by the miner (before code-side verification). */\nexport interface ProposedSupportRef {\n /** Must resolve to an {@link AllowlistedEvidence} in the pass. */\n evidenceId: string;\n /** Verbatim span the miner copied from that evidence's content. */\n span: string;\n}\n\n/** One hypothesis proposed by the miner. */\nexport interface MinedEvidenceHypothesis {\n /** Neutral, non-identifying clarification hypothesis. */\n statement: string;\n claimType: HypothesisClaimType;\n supportRefs: ProposedSupportRef[];\n}\n\n/** A support reference that resolved against the allowlist. */\nexport interface VerifiedSupportRef {\n evidenceId: string;\n kind: EvidenceKind;\n speaker: EvidenceSpeaker;\n opportunityId: string;\n}\n\n/**\n * A hypothesis after verification + the recurrence gate. Retained hypotheses\n * are returned for OFFLINE review only — shadow mode never persists or logs\n * their text (see {@link NegotiationEvidenceTelemetry}).\n */\nexport interface RetainedEvidenceHypothesis {\n statement: string;\n claimType: HypothesisClaimType;\n support: VerifiedSupportRef[];\n /** Count of DISTINCT opportunities in `support` — the recurrence measure. */\n distinctOpportunities: number;\n}\n\n/**\n * Aggregate-only telemetry. Deliberately carries NO evidence content, NO\n * hypothesis text, and NO spans — only counts — so it is safe to emit to\n * routine logs without leaking internal negotiation content.\n */\nexport interface NegotiationEvidenceTelemetry {\n recipientUserId: string;\n intentId: string;\n /** Raw segments supplied to the pass (pre-grouping). */\n segments: number;\n /** Distinct opportunities after continuation grouping. */\n distinctOpportunities: number;\n /** Allowlisted evidence unit counts, by kind. */\n evidenceCounts: Record<EvidenceKind, number>;\n /** Records dropped by allowlist / exclusion / provenance mismatch. */\n excludedRecords: number;\n hypothesesMined: number;\n /** Hypotheses whose every support ref verified against the allowlist. */\n hypothesesSupported: number;\n /** Supported hypotheses that also met the distinct-opportunity floor. */\n hypothesesRecurrent: number;\n /** Hypotheses discarded (unsupported ref, speaker violation, or too rare). */\n hypothesesDiscarded: number;\n}\n\n/** Result of one shadow mining pass. */\nexport interface NegotiationEvidenceShadowResult {\n /** Safe-to-log aggregate counts. */\n telemetry: NegotiationEvidenceTelemetry;\n /**\n * Retained recurrent hypotheses for offline eval. In shadow mode the caller\n * MUST NOT persist these or write them to routine logs.\n */\n hypotheses: RetainedEvidenceHypothesis[];\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"negotiation-evidence.verifier.d.ts","sourceRoot":"/","sources":["opportunity/negotiation-evidence/negotiation-evidence.verifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAuB,uBAAuB,EAAE,0BAA0B,EAAsB,MAAM,iCAAiC,CAAC;AAEzK,uDAAuD;AACvD,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,QAAQ,EAAE,0BAA0B,EAAE,CAAC;IACvC,oEAAoE;IACpE,SAAS,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAC;CACnB;AAwBD,wEAAwE;AACxE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAI1E;AAqCD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,uBAAuB,EAAE,EACrC,QAAQ,EAAE,mBAAmB,EAAE,EAC/B,wBAAwB,EAAE,MAAM,GAC/B,kBAAkB,CA6BpB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"negotiation-evidence.verifier.js","sourceRoot":"/","sources":["opportunity/negotiation-evidence/negotiation-evidence.verifier.ts"],"names":[],"mappings":"AA6BA,kFAAkF;AAClF,MAAM,cAAc,GAAG,CAAC,CAAC;AAEzB,oEAAoE;AACpE,SAAS,iBAAiB,CAAC,CAAS;IAClC,OAAO,CAAC;SACL,WAAW,EAAE;SACb,OAAO,CAAC,uBAAuB,EAAE,GAAG,CAAC;SACrC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC;SAC/B,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC;SAC/B,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC;SACzB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE,CAAC;AACZ,CAAC;AAED,wEAAwE;AACxE,SAAS,oBAAoB,CAAC,CAAS;IACrC,OAAO,CAAC;SACL,OAAO,CAAC,0CAA0C,EAAE,EAAE,CAAC;SACvD,OAAO,CAAC,0CAA0C,EAAE,EAAE,CAAC,CAAC;AAC7D,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,IAAY;IAC/D,MAAM,QAAQ,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,iBAAiB,CAAC,oBAAoB,CAAC,IAAI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AU,gBAAgB,CAC9B,UAAqC,EACrC,QAA+B,EAC/B,wBAAgC;IAEhC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,MAAM,QAAQ,GAAiC,EAAE,CAAC;IAClD,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,KAAK,MAAM,UAAU,IAAI,UAAU,EAAE,CAAC;QACpC,MAAM,OAAO,GAAG,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACnD,IAAI,CAAC,OAAO;YAAE,SAAS;QACvB,SAAS,IAAI,CAAC,CAAC;QAEf,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC;QAChF,IAAI,qBAAqB,GAAG,wBAAwB;YAAE,SAAS;QAC/D,SAAS,IAAI,CAAC,CAAC;QAEf,QAAQ,CAAC,IAAI,CAAC;YACZ,SAAS,EAAE,UAAU,CAAC,SAAS;YAC/B,SAAS,EAAE,UAAU,CAAC,SAAS;YAC/B,OAAO;YACP,qBAAqB;SACtB,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,QAAQ;QACR,SAAS;QACT,SAAS;QACT,SAAS,EAAE,UAAU,CAAC,MAAM,GAAG,SAAS;KACzC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Lens C support-reference verification + recurrence gate (IND-433).\n *\n * A mined hypothesis is retained ONLY when:\n * 1. it carries at least one support reference,\n * 2. EVERY support reference resolves to an allowlisted evidence unit in\n * this pass AND quotes a verbatim span of that unit's content,\n * 3. the speaker constraint holds — a claim that is a fact or preference\n * ABOUT the recipient may never rest on a counterparty statement, and\n * 4. its verified support spans at least `minDistinctOpportunities` DISTINCT\n * opportunities (recurrence). Continuations were already grouped upstream,\n * so same-pair repetition cannot inflate this.\n *\n * Any failure discards the whole hypothesis — there is no partial retention.\n */\nimport type { AllowlistedEvidence, HypothesisClaimType, MinedEvidenceHypothesis, RetainedEvidenceHypothesis, VerifiedSupportRef } from \"./negotiation-evidence.types.js\";\n\n/** Result of verifying a batch of mined hypotheses. */\nexport interface VerificationResult {\n /** Hypotheses that passed verification AND the recurrence gate. */\n retained: RetainedEvidenceHypothesis[];\n /** Hypotheses whose every support ref verified (pre-recurrence). */\n supported: number;\n /** Supported hypotheses that also met the distinct-opportunity floor. */\n recurrent: number;\n /** Hypotheses discarded for any reason (mined − recurrent). */\n discarded: number;\n}\n\n/** Minimum normalized span length that counts as meaningful verbatim evidence. */\nconst MIN_SPAN_CHARS = 8;\n\n/** Lowercase, fold typographic punctuation, collapse whitespace. */\nfunction normalizeForMatch(s: string): string {\n return s\n .toLowerCase()\n .replace(/[\\u2018\\u2019\\u02bc]/g, \"'\")\n .replace(/[\\u201c\\u201d]/g, '\"')\n .replace(/[\\u2013\\u2014]/g, \"-\")\n .replace(/\\u2026/g, \"...\")\n .replace(/\\s+/g, \" \")\n .trim();\n}\n\n/** Strip wrapping quotes / edge punctuation the LLM habitually adds. */\nfunction stripEdgePunctuation(s: string): string {\n return s\n .replace(/^[\\s\"'.,;:!?()\\u2018\\u2019\\u201c\\u201d]+/, \"\")\n .replace(/[\\s\"'.,;:!?()\\u2018\\u2019\\u201c\\u201d]+$/, \"\");\n}\n\n/** True when `span` is a meaningful verbatim substring of `content`. */\nexport function evidenceSpanMatches(content: string, span: string): boolean {\n const haystack = normalizeForMatch(content);\n const needle = normalizeForMatch(stripEdgePunctuation(span));\n return needle.length >= MIN_SPAN_CHARS && haystack.includes(needle);\n}\n\n/**\n * A `recipient_fact` / `recipient_preference` claim must not lean on a\n * counterparty statement. `observation` claims accept any speaker.\n */\nfunction speakerAllowedForClaim(claimType: HypothesisClaimType, evidence: AllowlistedEvidence): boolean {\n if (claimType === \"observation\") return true;\n return evidence.speaker !== \"counterparty\";\n}\n\n/**\n * Verify one hypothesis. Returns the verified support (deduped) when every\n * reference resolves and satisfies the speaker constraint; otherwise null.\n */\nfunction verifyHypothesis(\n hypothesis: MinedEvidenceHypothesis,\n byId: Map<string, AllowlistedEvidence>,\n): VerifiedSupportRef[] | null {\n if (hypothesis.supportRefs.length === 0) return null;\n\n const verified = new Map<string, VerifiedSupportRef>();\n for (const ref of hypothesis.supportRefs) {\n const evidence = byId.get(ref.evidenceId);\n if (!evidence) return null; // reference to non-allowlisted / hallucinated id\n if (!speakerAllowedForClaim(hypothesis.claimType, evidence)) return null;\n if (!evidenceSpanMatches(evidence.content, ref.span)) return null;\n verified.set(evidence.evidenceId, {\n evidenceId: evidence.evidenceId,\n kind: evidence.kind,\n speaker: evidence.speaker,\n opportunityId: evidence.opportunityId,\n });\n }\n return [...verified.values()];\n}\n\n/**\n * Verify + recurrence-gate a batch of mined hypotheses against the allowlisted\n * evidence produced for the same pass.\n */\nexport function verifyHypotheses(\n hypotheses: MinedEvidenceHypothesis[],\n evidence: AllowlistedEvidence[],\n minDistinctOpportunities: number,\n): VerificationResult {\n const byId = new Map(evidence.map((e) => [e.evidenceId, e]));\n const retained: RetainedEvidenceHypothesis[] = [];\n let supported = 0;\n let recurrent = 0;\n\n for (const hypothesis of hypotheses) {\n const support = verifyHypothesis(hypothesis, byId);\n if (!support) continue;\n supported += 1;\n\n const distinctOpportunities = new Set(support.map((s) => s.opportunityId)).size;\n if (distinctOpportunities < minDistinctOpportunities) continue;\n recurrent += 1;\n\n retained.push({\n statement: hypothesis.statement,\n claimType: hypothesis.claimType,\n support,\n distinctOpportunities,\n });\n }\n\n return {\n retained,\n supported,\n recurrent,\n discarded: hypotheses.length - recurrent,\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"negotiation-summary.builder.d.ts","sourceRoot":"/","sources":["opportunity/negotiation-summary.builder.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC/F,OAAO,KAAK,EAAE,oBAAoB,EAAoB,gBAAgB,EAAkC,MAAM,gDAAgD,CAAC;AAE/J;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,eAAe,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,gBAAgB,EAAE,MAAM,CAAC;IACzB,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,uDAAuD;IACvD,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,qBAAqB,GAAG,oBAAoB,CAyBrF;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,qBAAqB,EAAE,GAAG,gBAAgB,CA4B5F"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"negotiation-summary.builder.js","sourceRoot":"/","sources":["opportunity/negotiation-summary.builder.ts"],"names":[],"mappings":"AAyBA;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,CAAwB;IAC7D,MAAM,KAAK,GAAoB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACjD,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC,SAAS;QACjC,cAAc,EAAE;YACd,OAAO,EAAE,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,OAA0B;YAC/D,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,SAA4B;SACpE;KACF,CAAC,CAAC,CAAC;IACJ,MAAM,OAAO,GAAqB;QAChC,cAAc,EAAE,CAAC,CAAC,OAAO,CA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AAC,CAAC;YACxB,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;gBACzC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAuB,CAAC;gBACzC,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;aAAM,CAAC;YACN,kBAAkB,IAAI,CAAC,CAAC;YACxB,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBACtE,YAAY,IAAI,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,eAAe,EAAE,WAAW,CAAC,MAAM;QACnC,kBAAkB;QAClB,kBAAkB;QAClB,YAAY;QACZ,gBAAgB;KACjB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Pure mappers from raw per-candidate negotiation data to the protocol's\n * `DiscoveryNegotiation` / `DiscoverySummary` shapes consumed by the question\n * generator. No DB access, no LLM — safe to import from anywhere.\n */\nimport type { NegotiationTurn, NegotiationOutcome } from \"../negotiation/negotiation.state.js\";\nimport type { DiscoveryNegotiation, DiscoveryOutcome, DiscoverySummary, DiscoveryTurn, NegotiationRole } from \"../shared/schemas/discovery-question.schema.js\";\n\n/**\n * The input shape collected by the opportunity graph's negotiate node for\n * each candidate that completed a negotiation attempt (accepted, rejected,\n * stalled, or errored).\n */\nexport interface NegotiationResolution {\n candidateUserId: string;\n /** Abstract profile slice for the LLM (e.g. \"AI infra founder, Berlin\"). */\n counterpartyHint: string;\n /** Network/community prompt for the negotiation. */\n indexContext: string;\n turns: NegotiationTurn[];\n outcome: NegotiationOutcome;\n /** Optional pre-negotiation evaluator score (0..1). */\n seedAssessmentScore?: number;\n}\n\n/**\n * Convert one negotiation resolution to `DiscoveryNegotiation`.\n *\n * @param r - The raw resolution from the negotiate node.\n * @returns A `DiscoveryNegotiation` ready for the question generator.\n */\nexport function toDiscoveryNegotiation(r: NegotiationResolution): DiscoveryNegotiation {\n const turns: DiscoveryTurn[] = r.turns.map((t) => ({\n action: t.action,\n reasoning: t.assessment.reasoning,\n suggestedRoles: {\n ownUser: t.assessment.suggestedRoles.ownUser as NegotiationRole,\n otherUser: t.assessment.suggestedRoles.otherUser as NegotiationRole,\n },\n }));\n const outcome: DiscoveryOutcome = {\n hasOpportunity: r.outcome.hasOpportunity,\n reasoning: r.outcome.reasoning,\n ...(r.outcome.hasOpportunity && r.outcome.agreedRoles.length > 0\n ? { agreedRoles: r.outcome.agreedRoles.map((a) => ({ userId: a.userId, role: a.role as NegotiationRole })) }\n : {}),\n ...(r.outcome.reason ? { reason: r.outcome.reason } : {}),\n };\n return {\n counterpartyId: r.candidateUserId,\n counterpartyHint: r.counterpartyHint,\n indexContext: r.indexContext,\n turns,\n outcome,\n ...(r.seedAssessmentScore !== undefined ? { seedAssessmentScore: r.seedAssessmentScore } : {}),\n };\n}\n\n/**\n * Aggregate counters across all negotiations in a single discovery turn.\n *\n * @param resolutions - All resolved negotiations from the negotiate node.\n * @returns A `DiscoverySummary` with totals and role distribution.\n */\nexport function buildDiscoverySummary(resolutions: NegotiationResolution[]): DiscoverySummary {\n const roleDistribution: Partial<Record<NegotiationRole, number>> = {};\n let opportunitiesFound = 0;\n let noOpportunityCount = 0;\n let timeoutCount = 0;\n\n for (const r of resolutions) {\n if (r.outcome.hasOpportunity) {\n opportunitiesFound += 1;\n for (const role of r.outcome.agreedRoles) {\n const key = role.role as NegotiationRole;\n roleDistribution[key] = (roleDistribution[key] ?? 0) + 1;\n }\n } else {\n noOpportunityCount += 1;\n if (r.outcome.reason === \"turn_cap\" || r.outcome.reason === \"timeout\") {\n timeoutCount += 1;\n }\n }\n }\n\n return {\n totalCandidates: resolutions.length,\n opportunitiesFound,\n noOpportunityCount,\n timeoutCount,\n roleDistribution,\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"opportunity.actor.d.ts","sourceRoot":"/","sources":["opportunity/opportunity.actor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAE1G;;;GAGG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAalF;AAED,qFAAqF;AACrF,wBAAgB,6BAA6B,CAAC,KAAK,EAAE;IACnD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,GAAG,MAAM,GAAG,SAAS,CAGrB;AAED,yEAAyE;AACzE,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,SAAS,gBAAgB,EAAE,GAClC,gBAAgB,EAAE,CAYpB;AAED,yEAAyE;AACzE,wBAAgB,sCAAsC,CACpD,IAAI,EAAE,qBAAqB,GAC1B,qBAAqB,CAKvB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"opportunity.actor.js","sourceRoot":"/","sources":["opportunity/opportunity.actor.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,+BAA+B,CAAC,KAAc;IAC5D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAEhD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAChC,IACE,UAAU,CAAC,MAAM,KAAK,CAAC;WACpB,UAAU,CAAC,WAAW,EAAE,KAAK,MAAM;WACnC,UAAU,CAAC,WAAW,EAAE,KAAK,WAAW,EAC3C,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,6BAA6B,CAAC,KAG7C;IACC,OAAO,+BAA+B,CAAC,KAAK,CAAC,QAAQ,CAAC;WACjD,+BAA+B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACrD,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,0BAA0B,CACxC,MAAmC;IAEnC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1B,MAAM,eAAe,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;QACrC,MAAM,gBAAgB,GAAG,+BAA+B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEvE,OAAO,eAAe,CAAC,MAAM,CAAC;QAC9B,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACnC,eAAe,CAAC,MAAM,GAAG,gBAA2D,CAAC;QACvF,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,sCAAsC,CACpD,IAA2B;IAE3B,OAAO;QACL,GAAG,IAAI;QACP,MAAM,EAAE,0BAA0B,CAAC,IAAI,CAAC,MAAM,CAAC;KAChD,CAAC;AACJ,CAAC","sourcesContent":["import type { CreateOpportunityData, OpportunityActor } from '../shared/interfaces/database.interface.js';\n\n/**\n * Normalize an actor intent value while preserving protocol string IDs.\n * Null-like model sentinels are represented by absence in persisted actors.\n */\nexport function normalizeOpportunityActorIntent(value: unknown): string | undefined {\n if (typeof value !== 'string') return undefined;\n\n const normalized = value.trim();\n if (\n normalized.length === 0\n || normalized.toLowerCase() === 'null'\n || normalized.toLowerCase() === 'undefined'\n ) {\n return undefined;\n }\n\n return normalized;\n}\n\n/** Resolve the normalized intent from either evaluator or persisted actor fields. */\nexport function resolveOpportunityActorIntent(actor: {\n intentId?: unknown;\n intent?: unknown;\n}): string | undefined {\n return normalizeOpportunityActorIntent(actor.intentId)\n ?? normalizeOpportunityActorIntent(actor.intent);\n}\n\n/** Return a non-mutating actor copy with a canonical optional intent. */\nexport function normalizeOpportunityActors(\n actors: readonly OpportunityActor[],\n): OpportunityActor[] {\n return actors.map((actor) => {\n const normalizedActor = { ...actor };\n const normalizedIntent = normalizeOpportunityActorIntent(actor.intent);\n\n delete normalizedActor.intent;\n if (normalizedIntent !== undefined) {\n normalizedActor.intent = normalizedIntent as NonNullable<OpportunityActor['intent']>;\n }\n\n return normalizedActor;\n });\n}\n\n/** Return non-mutating create data whose actor intents are canonical. */\nexport function normalizeCreateOpportunityActorIntents(\n data: CreateOpportunityData,\n): CreateOpportunityData {\n return {\n ...data,\n actors: normalizeOpportunityActors(data.actors),\n };\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"opportunity.claim-safety.d.ts","sourceRoot":"/","sources":["opportunity/opportunity.claim-safety.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAkDH,iFAAiF;AACjF,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAGvF;AAED,2EAA2E;AAC3E,wBAAgB,qCAAqC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE/E;AAED;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAOzF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"opportunity.claim-safety.js","sourceRoot":"/","sources":["opportunity/opportunity.claim-safety.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,0BAA0B,GAAsB;IACpD,yEAAyE;IACzE,yCAAyC;IACzC,0KAA0K;IAC1K,gFAAgF;IAChF,gDAAgD;IAChD,6GAA6G;IAC7G,yIAAyI;IACzI,mKAAmK;IACnK,oLAAoL;IACpL,wHAAwH;IAExH,wEAAwE;IACxE,sEAAsE;IACtE,2IAA2I;IAC3I,+DAA+D;IAC/D,+DAA+D;IAC/D,8DAA8D;IAC9D,qJAAqJ;IAErJ,yEAAyE;IACzE,uEAAuE;IACvE,yGAAyG;IACzG,oCAAoC;IACpC,+FAA+F;IAC/F,4DAA4D;IAC5D,s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,CAAC,CAAC;AACrB,CAAC","sourcesContent":["/**\n * Deterministic guard for unsupported person-affiliation and presence claims.\n *\n * Opportunity presentation contracts currently do not carry typed provenance\n * proving attendance, membership, residence, or shared presence. The guard\n * therefore fails closed: a sentence making one of those claims is rejected\n * rather than loosely \"grounded\" against network/context text.\n *\n * The patterns are deliberately phrase-based. They target factual claims such\n * as \"Alice is a member of...\" while leaving generic domain phrases such as\n * \"membership model\" and \"team members\" alone. This is not a general factuality\n * checker and does not attempt semantic inference beyond the listed claim\n * families.\n */\n\nconst UNSUPPORTED_CLAIM_PATTERNS: readonly RegExp[] = [\n // Attendance and co-attendance claims. Relational grammar avoids product\n // phrases such as \"attendee management\".\n /\\b(?:co[-\\s]?attendance|co[-\\s]?attendee(?:s)?|co[-\\s]?attend(?:ed|ing)?|(?:another|fellow)\\s+(?:(?:event|session|conference|summit|gathering|meetup)\\s+)?attendees?)\\b/i,\n /\\b(?:is|are|was|were|will be|has been|have been|as)\\s+(?:an?\\s+)?attendees?\\b/i,\n /\\b(?:a|an|this|that)\\s+attendee\\s+(?:of|at)\\b/i,\n /\\b(?:will\\s+|plans?\\s+to\\s+)?attend(?:ed|ing)?\\s+(?!to\\b)(?:(?:at|in)\\s+)?(?:the\\s+)?[\\p{L}\\p{N}&'’.-]+\\b/iu,\n /\\b(?:is|are|was|were|will be)\\s+going\\s+to\\s+(?:the\\s+)?(?:event|session|conference|summit|gathering|meetup|[A-Z][\\p{L}\\p{N}&'’.-]*)\\b/u,\n /\\b(?:[Pp]articipat(?:ed|ing)|[Pp]articipants?)\\b(?=.{0,40}\\b(?:in|at)\\s+(?:the\\s+)?(?:event|session|conference|summit|gathering|meetup|[A-Z][\\p{L}\\p{N}&'’.-]*))/u,\n /\\b(?:[Ww]ent\\s+to|[Tt]ook\\s+part\\s+in|(?:[Ww]as|[Ww]ere|[Ii]s|[Aa]re)\\s+present\\s+at)\\s+(?:the\\s+)?(?:event|session|conference|summit|gathering|meetup|[A-Z][\\p{L}\\p{N}&'’.-]*)\\b/u,\n /\\b(?:session\\s+attendance|attendance\\s+(?:at|in)\\s+(?:the\\s+)?(?:event|session|conference|summit|gathering|meetup))\\b/i,\n\n // Shared event/session/place/time claims, including \"both were at ...\".\n /\\b(?:same|the same)\\s+(?:event|session|place|location|venue|time)\\b/i,\n /\\b(?:share|shared|sharing)\\s+(?:an?\\s+|the\\s+)?(?:event|session|workshop|conference|summit|gathering|meetup|place|location|venue|time)\\b/i,\n /\\bboth\\s+(?:were|are|will be|have been)\\s+(?:at|in|during)\\b/i,\n /\\b(?:were|are|will be|have been)\\s+both\\s+(?:at|in|during)\\b/i,\n /\\b(?:will|would|are|were)\\s+both\\s+be?\\s*(?:at|in|during)\\b/i,\n /\\bboth\\b.{0,80}\\b(?:attend(?:ed|ing)?|participat(?:e|ed|ing)|met|meet|meeting|stayed|stay)\\b.{0,60}\\b(?:event|session|place|location|venue|time)\\b/i,\n\n // Factual membership/affiliation claims. Generic descriptions of product\n // users (\"members of cooperatives\") and \"team members\" stay untouched.\n /\\b(?:is|are|was|were|be|being|been|became|become|as)\\s+(?:an?\\s+)?(?:fellow\\s+)?members?\\s+(?:of|in)\\b/i,\n /\\b(?:another|fellow)\\s+members?\\b/i,\n /\\b(?:is|are|was|were|be|being|been|as)\\s+(?:an?\\s+)?(?:community|network|event)\\s+members?\\b/i,\n /\\b(?:a|an|this|that)\\s+(?:fellow\\s+)?member\\s+(?:of|in)\\b/i,\n /\\b(?:is|are|was|were|be|being|been)\\s+(?:an?\\s+)?part\\s+of\\s+(?:the\\s+)?[^.!?]{0,60}\\b(?:community|network|event)\\b/i,\n /\\bfellow\\s+members?\\s+(?:of|in)\\b/i,\n /\\b(?:a|an)\\s+(?:[A-Z][\\p{L}\\p{N}&'’.-]*\\s+){1,6}(?:community\\s+|network\\s+)?member\\b/u,\n /\\b(?:[Bb]elongs?|[Bb]elonged)\\s+to\\s+(?:the\\s+)?(?:[Nn]etwork|[Cc]ommunity|[Ee]vent|(?:[A-Z][\\p{L}\\p{N}&'’.-]*\\s+){1,5}[A-Z][\\p{L}\\p{N}&'’.-]*)\\b/u,\n /\\b[Jj]oined\\s+(?:the\\s+)?(?:[Nn]etwork|[Cc]ommunity|[Ee]vent|(?:[A-Z][\\p{L}\\p{N}&'’.-]*\\s+){1,5}[A-Z][\\p{L}\\p{N}&'’.-]*)\\b/u,\n /\\b[Aa]ffiliated\\s+with\\s+(?:the\\s+)?(?:[Nn]etwork|[Cc]ommunity|[Ee]vent|[A-Z][\\p{L}\\p{N}&'’.-]*)\\b/u,\n\n // Residence/co-residence claims. Require person-claim grammar so generic\n // audience descriptions such as \"tools for residents of Berlin\" survive.\n /\\b(?:is|are|was|were|be|being|been|as)\\s+(?:an?\\s+)?(?:local\\s+|long[-\\s]?time\\s+|co[-\\s]?)?residents?\\b/i,\n /\\bco[-\\s]?(?:reside|resides|resided|residing)\\b/i,\n /\\b(?:another|fellow)\\s+residents?\\b/i,\n /\\b(?:a|an|this|that)\\s+(?:co[-\\s]?)?resident\\s+(?:of|in)\\b/i,\n /\\b(?:a|an)\\s+(?:[A-Z][\\p{L}\\p{N}&'’.-]*\\s+){1,6}(?:co[-\\s]?)?resident\\b/u,\n /\\b(?:[Hh]e|[Ss]he|[Tt]hey|[A-Z][\\p{L}'’.-]+)\\s+(?:reside|resides|resided|residing|live|lives|lived|living|(?:is|are|was|were)\\s+based)\\s+in\\b/u,\n /\\b(?:[Hh]e|[Ss]he|[Tt]hey|[A-Z][\\p{L}'’.-]+)\\s+calls?\\s+[A-Z][\\p{L}\\p{N}&'’.-]*(?:\\s+[A-Z][\\p{L}\\p{N}&'’.-]*){0,5}\\s+home\\b/u,\n\n // Relationship claims inferred from shared network/event placement.\n /\\b(?:know|knows|knew|met|meet)\\b.{0,60}\\b(?:through|from|at)\\s+(?:the\\s+)?(?:network|community|event|session)\\b/i,\n /\\bcrossed\\s+paths\\s+(?:at|during)\\b/i,\n];\n\n/** Returns true when text contains an unsupported affiliation/presence claim. */\nexport function hasUnsupportedOpportunityClaim(text: string | null | undefined): boolean {\n if (!text?.trim()) return false;\n return splitClaimSentences(text).some(isUnsupportedOpportunityClaimSentence);\n}\n\n/** Returns true when one sentence contains an unsupported claim family. */\nexport function isUnsupportedOpportunityClaimSentence(sentence: string): boolean {\n return UNSUPPORTED_CLAIM_PATTERNS.some((pattern) => pattern.test(sentence));\n}\n\n/**\n * Removes complete sentences containing unsupported claims and preserves the\n * remaining sentence order. An all-unsafe input becomes an empty string so the\n * caller can apply a field-specific deterministic default.\n */\nexport function stripUnsupportedOpportunityClaims(text: string | null | undefined): string {\n if (!text?.trim()) return \"\";\n return splitClaimSentences(text)\n .filter((sentence) => !isUnsupportedOpportunityClaimSentence(sentence))\n .join(\" \")\n .replace(/\\s+/g, \" \")\n .trim();\n}\n\nfunction splitClaimSentences(text: string): string[] {\n return text\n .trim()\n .split(/(?<=[.!?])\\s+|\\n+/)\n .map((sentence) => sentence.trim())\n .filter(Boolean);\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"opportunity.discover.d.ts","sourceRoot":"/","sources":["opportunity/opportunity.discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAe,0BAA0B,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACtH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yCAAyC,CAAC;AAGrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAA0B,KAAK,6BAA6B,EAAE,KAAK,0BAA0B,EAAuD,MAAM,4BAA4B,CAAC;AAKpN,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAExF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sDAAsD,CAAC;AACpG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uDAAuD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