@indexnetwork/protocol 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (365) hide show
  1. package/dist/agents/chat.agent.d.ts +218 -0
  2. package/dist/agents/chat.agent.d.ts.map +1 -0
  3. package/dist/agents/chat.agent.js +884 -0
  4. package/dist/agents/chat.agent.js.map +1 -0
  5. package/dist/agents/chat.prompt.d.ts +18 -0
  6. package/dist/agents/chat.prompt.d.ts.map +1 -0
  7. package/dist/agents/chat.prompt.js +372 -0
  8. package/dist/agents/chat.prompt.js.map +1 -0
  9. package/dist/agents/chat.prompt.modules.d.ts +61 -0
  10. package/dist/agents/chat.prompt.modules.d.ts.map +1 -0
  11. package/dist/agents/chat.prompt.modules.js +366 -0
  12. package/dist/agents/chat.prompt.modules.js.map +1 -0
  13. package/dist/agents/chat.title.generator.d.ts +20 -0
  14. package/dist/agents/chat.title.generator.d.ts.map +1 -0
  15. package/dist/agents/chat.title.generator.js +66 -0
  16. package/dist/agents/chat.title.generator.js.map +1 -0
  17. package/dist/agents/home.categorizer.d.ts +28 -0
  18. package/dist/agents/home.categorizer.d.ts.map +1 -0
  19. package/dist/agents/home.categorizer.js +170 -0
  20. package/dist/agents/home.categorizer.js.map +1 -0
  21. package/dist/agents/hyde.generator.d.ts +27 -0
  22. package/dist/agents/hyde.generator.d.ts.map +1 -0
  23. package/dist/agents/hyde.generator.js +75 -0
  24. package/dist/agents/hyde.generator.js.map +1 -0
  25. package/dist/agents/hyde.strategies.d.ts +17 -0
  26. package/dist/agents/hyde.strategies.d.ts.map +1 -0
  27. package/dist/agents/hyde.strategies.js +29 -0
  28. package/dist/agents/hyde.strategies.js.map +1 -0
  29. package/dist/agents/intent.clarifier.d.ts +29 -0
  30. package/dist/agents/intent.clarifier.d.ts.map +1 -0
  31. package/dist/agents/intent.clarifier.js +186 -0
  32. package/dist/agents/intent.clarifier.js.map +1 -0
  33. package/dist/agents/intent.indexer.d.ts +77 -0
  34. package/dist/agents/intent.indexer.d.ts.map +1 -0
  35. package/dist/agents/intent.indexer.js +164 -0
  36. package/dist/agents/intent.indexer.js.map +1 -0
  37. package/dist/agents/intent.inferrer.d.ts +95 -0
  38. package/dist/agents/intent.inferrer.d.ts.map +1 -0
  39. package/dist/agents/intent.inferrer.js +238 -0
  40. package/dist/agents/intent.inferrer.js.map +1 -0
  41. package/dist/agents/intent.reconciler.d.ts +106 -0
  42. package/dist/agents/intent.reconciler.d.ts.map +1 -0
  43. package/dist/agents/intent.reconciler.js +184 -0
  44. package/dist/agents/intent.reconciler.js.map +1 -0
  45. package/dist/agents/intent.verifier.d.ts +97 -0
  46. package/dist/agents/intent.verifier.d.ts.map +1 -0
  47. package/dist/agents/intent.verifier.js +234 -0
  48. package/dist/agents/intent.verifier.js.map +1 -0
  49. package/dist/agents/invite.generator.d.ts +47 -0
  50. package/dist/agents/invite.generator.d.ts.map +1 -0
  51. package/dist/agents/invite.generator.js +56 -0
  52. package/dist/agents/invite.generator.js.map +1 -0
  53. package/dist/agents/lens.inferrer.d.ts +37 -0
  54. package/dist/agents/lens.inferrer.d.ts.map +1 -0
  55. package/dist/agents/lens.inferrer.js +98 -0
  56. package/dist/agents/lens.inferrer.js.map +1 -0
  57. package/dist/agents/model.config.d.ts +120 -0
  58. package/dist/agents/model.config.d.ts.map +1 -0
  59. package/dist/agents/model.config.js +76 -0
  60. package/dist/agents/model.config.js.map +1 -0
  61. package/dist/agents/negotiation.insights.generator.d.ts +32 -0
  62. package/dist/agents/negotiation.insights.generator.d.ts.map +1 -0
  63. package/dist/agents/negotiation.insights.generator.js +105 -0
  64. package/dist/agents/negotiation.insights.generator.js.map +1 -0
  65. package/dist/agents/negotiation.proposer.d.ts +26 -0
  66. package/dist/agents/negotiation.proposer.d.ts.map +1 -0
  67. package/dist/agents/negotiation.proposer.js +67 -0
  68. package/dist/agents/negotiation.proposer.js.map +1 -0
  69. package/dist/agents/negotiation.responder.d.ts +26 -0
  70. package/dist/agents/negotiation.responder.d.ts.map +1 -0
  71. package/dist/agents/negotiation.responder.js +71 -0
  72. package/dist/agents/negotiation.responder.js.map +1 -0
  73. package/dist/agents/opportunity.evaluator.d.ts +253 -0
  74. package/dist/agents/opportunity.evaluator.d.ts.map +1 -0
  75. package/dist/agents/opportunity.evaluator.js +413 -0
  76. package/dist/agents/opportunity.evaluator.js.map +1 -0
  77. package/dist/agents/opportunity.presenter.d.ts +115 -0
  78. package/dist/agents/opportunity.presenter.d.ts.map +1 -0
  79. package/dist/agents/opportunity.presenter.js +524 -0
  80. package/dist/agents/opportunity.presenter.js.map +1 -0
  81. package/dist/agents/profile.generator.d.ts +67 -0
  82. package/dist/agents/profile.generator.d.ts.map +1 -0
  83. package/dist/agents/profile.generator.js +97 -0
  84. package/dist/agents/profile.generator.js.map +1 -0
  85. package/dist/agents/profile.hyde.generator.d.ts +43 -0
  86. package/dist/agents/profile.hyde.generator.d.ts.map +1 -0
  87. package/dist/agents/profile.hyde.generator.js +113 -0
  88. package/dist/agents/profile.hyde.generator.js.map +1 -0
  89. package/dist/agents/suggestion.generator.d.ts +24 -0
  90. package/dist/agents/suggestion.generator.d.ts.map +1 -0
  91. package/dist/agents/suggestion.generator.js +96 -0
  92. package/dist/agents/suggestion.generator.js.map +1 -0
  93. package/dist/graphs/chat.graph.d.ts +312 -0
  94. package/dist/graphs/chat.graph.d.ts.map +1 -0
  95. package/dist/graphs/chat.graph.js +267 -0
  96. package/dist/graphs/chat.graph.js.map +1 -0
  97. package/dist/graphs/home.graph.d.ts +180 -0
  98. package/dist/graphs/home.graph.d.ts.map +1 -0
  99. package/dist/graphs/home.graph.js +598 -0
  100. package/dist/graphs/home.graph.js.map +1 -0
  101. package/dist/graphs/hyde.graph.d.ts +110 -0
  102. package/dist/graphs/hyde.graph.d.ts.map +1 -0
  103. package/dist/graphs/hyde.graph.js +235 -0
  104. package/dist/graphs/hyde.graph.js.map +1 -0
  105. package/dist/graphs/index.graph.d.ts +620 -0
  106. package/dist/graphs/index.graph.d.ts.map +1 -0
  107. package/dist/graphs/index.graph.js +226 -0
  108. package/dist/graphs/index.graph.js.map +1 -0
  109. package/dist/graphs/index_membership.graph.d.ts +250 -0
  110. package/dist/graphs/index_membership.graph.d.ts.map +1 -0
  111. package/dist/graphs/index_membership.graph.js +204 -0
  112. package/dist/graphs/index_membership.graph.js.map +1 -0
  113. package/dist/graphs/intent.graph.d.ts +490 -0
  114. package/dist/graphs/intent.graph.d.ts.map +1 -0
  115. package/dist/graphs/intent.graph.js +787 -0
  116. package/dist/graphs/intent.graph.js.map +1 -0
  117. package/dist/graphs/intent_index.graph.d.ts +396 -0
  118. package/dist/graphs/intent_index.graph.d.ts.map +1 -0
  119. package/dist/graphs/intent_index.graph.js +331 -0
  120. package/dist/graphs/intent_index.graph.js.map +1 -0
  121. package/dist/graphs/maintenance.graph.d.ts +177 -0
  122. package/dist/graphs/maintenance.graph.d.ts.map +1 -0
  123. package/dist/graphs/maintenance.graph.js +173 -0
  124. package/dist/graphs/maintenance.graph.js.map +1 -0
  125. package/dist/graphs/negotiation.graph.d.ts +819 -0
  126. package/dist/graphs/negotiation.graph.d.ts.map +1 -0
  127. package/dist/graphs/negotiation.graph.js +255 -0
  128. package/dist/graphs/negotiation.graph.js.map +1 -0
  129. package/dist/graphs/opportunity.graph.d.ts +1082 -0
  130. package/dist/graphs/opportunity.graph.d.ts.map +1 -0
  131. package/dist/graphs/opportunity.graph.js +2534 -0
  132. package/dist/graphs/opportunity.graph.js.map +1 -0
  133. package/dist/graphs/profile.graph.d.ts +617 -0
  134. package/dist/graphs/profile.graph.d.ts.map +1 -0
  135. package/dist/graphs/profile.graph.js +839 -0
  136. package/dist/graphs/profile.graph.js.map +1 -0
  137. package/dist/graphs/tests/chat.graph.mocks.d.ts +104 -0
  138. package/dist/graphs/tests/chat.graph.mocks.d.ts.map +1 -0
  139. package/dist/graphs/tests/chat.graph.mocks.js +225 -0
  140. package/dist/graphs/tests/chat.graph.mocks.js.map +1 -0
  141. package/dist/index.d.ts +62 -0
  142. package/dist/index.d.ts.map +1 -0
  143. package/dist/index.js +44 -0
  144. package/dist/index.js.map +1 -0
  145. package/dist/interfaces/auth.interface.d.ts +15 -0
  146. package/dist/interfaces/auth.interface.d.ts.map +1 -0
  147. package/dist/interfaces/auth.interface.js +2 -0
  148. package/dist/interfaces/auth.interface.js.map +1 -0
  149. package/dist/interfaces/cache.interface.d.ts +43 -0
  150. package/dist/interfaces/cache.interface.d.ts.map +1 -0
  151. package/dist/interfaces/cache.interface.js +6 -0
  152. package/dist/interfaces/cache.interface.js.map +1 -0
  153. package/dist/interfaces/chat-session.interface.d.ts +11 -0
  154. package/dist/interfaces/chat-session.interface.d.ts.map +1 -0
  155. package/dist/interfaces/chat-session.interface.js +2 -0
  156. package/dist/interfaces/chat-session.interface.js.map +1 -0
  157. package/dist/interfaces/contact.interface.d.ts +48 -0
  158. package/dist/interfaces/contact.interface.d.ts.map +1 -0
  159. package/dist/interfaces/contact.interface.js +2 -0
  160. package/dist/interfaces/contact.interface.js.map +1 -0
  161. package/dist/interfaces/database.interface.d.ts +1495 -0
  162. package/dist/interfaces/database.interface.d.ts.map +1 -0
  163. package/dist/interfaces/database.interface.js +2 -0
  164. package/dist/interfaces/database.interface.js.map +1 -0
  165. package/dist/interfaces/embedder.interface.d.ts +85 -0
  166. package/dist/interfaces/embedder.interface.d.ts.map +1 -0
  167. package/dist/interfaces/embedder.interface.js +5 -0
  168. package/dist/interfaces/embedder.interface.js.map +1 -0
  169. package/dist/interfaces/enrichment.interface.d.ts +40 -0
  170. package/dist/interfaces/enrichment.interface.d.ts.map +1 -0
  171. package/dist/interfaces/enrichment.interface.js +2 -0
  172. package/dist/interfaces/enrichment.interface.js.map +1 -0
  173. package/dist/interfaces/integration.interface.d.ts +91 -0
  174. package/dist/interfaces/integration.interface.d.ts.map +1 -0
  175. package/dist/interfaces/integration.interface.js +2 -0
  176. package/dist/interfaces/integration.interface.js.map +1 -0
  177. package/dist/interfaces/queue.interface.d.ts +17 -0
  178. package/dist/interfaces/queue.interface.d.ts.map +1 -0
  179. package/dist/interfaces/queue.interface.js +5 -0
  180. package/dist/interfaces/queue.interface.js.map +1 -0
  181. package/dist/interfaces/scraper.interface.d.ts +31 -0
  182. package/dist/interfaces/scraper.interface.d.ts.map +1 -0
  183. package/dist/interfaces/scraper.interface.js +2 -0
  184. package/dist/interfaces/scraper.interface.js.map +1 -0
  185. package/dist/interfaces/storage.interface.d.ts +46 -0
  186. package/dist/interfaces/storage.interface.d.ts.map +1 -0
  187. package/dist/interfaces/storage.interface.js +6 -0
  188. package/dist/interfaces/storage.interface.js.map +1 -0
  189. package/dist/mcp/mcp.server.d.ts +29 -0
  190. package/dist/mcp/mcp.server.d.ts.map +1 -0
  191. package/dist/mcp/mcp.server.js +171 -0
  192. package/dist/mcp/mcp.server.js.map +1 -0
  193. package/dist/states/chat.state.d.ts +126 -0
  194. package/dist/states/chat.state.d.ts.map +1 -0
  195. package/dist/states/chat.state.js +112 -0
  196. package/dist/states/chat.state.js.map +1 -0
  197. package/dist/states/home.state.d.ts +100 -0
  198. package/dist/states/home.state.d.ts.map +1 -0
  199. package/dist/states/home.state.js +74 -0
  200. package/dist/states/home.state.js.map +1 -0
  201. package/dist/states/hyde.state.d.ts +54 -0
  202. package/dist/states/hyde.state.d.ts.map +1 -0
  203. package/dist/states/hyde.state.js +66 -0
  204. package/dist/states/hyde.state.js.map +1 -0
  205. package/dist/states/index.state.d.ts +179 -0
  206. package/dist/states/index.state.d.ts.map +1 -0
  207. package/dist/states/index.state.js +56 -0
  208. package/dist/states/index.state.js.map +1 -0
  209. package/dist/states/index_membership.state.d.ts +77 -0
  210. package/dist/states/index_membership.state.d.ts.map +1 -0
  211. package/dist/states/index_membership.state.js +43 -0
  212. package/dist/states/index_membership.state.js.map +1 -0
  213. package/dist/states/intent.state.d.ts +203 -0
  214. package/dist/states/intent.state.d.ts.map +1 -0
  215. package/dist/states/intent.state.js +153 -0
  216. package/dist/states/intent.state.js.map +1 -0
  217. package/dist/states/intent_index.state.d.ts +148 -0
  218. package/dist/states/intent_index.state.d.ts.map +1 -0
  219. package/dist/states/intent_index.state.js +100 -0
  220. package/dist/states/intent_index.state.js.map +1 -0
  221. package/dist/states/maintenance.state.d.ts +36 -0
  222. package/dist/states/maintenance.state.d.ts.map +1 -0
  223. package/dist/states/maintenance.state.js +56 -0
  224. package/dist/states/maintenance.state.js.map +1 -0
  225. package/dist/states/negotiation.state.d.ts +230 -0
  226. package/dist/states/negotiation.state.d.ts.map +1 -0
  227. package/dist/states/negotiation.state.js +82 -0
  228. package/dist/states/negotiation.state.js.map +1 -0
  229. package/dist/states/opportunity.state.d.ts +300 -0
  230. package/dist/states/opportunity.state.d.ts.map +1 -0
  231. package/dist/states/opportunity.state.js +207 -0
  232. package/dist/states/opportunity.state.js.map +1 -0
  233. package/dist/states/profile.state.d.ts +172 -0
  234. package/dist/states/profile.state.d.ts.map +1 -0
  235. package/dist/states/profile.state.js +133 -0
  236. package/dist/states/profile.state.js.map +1 -0
  237. package/dist/streamers/chat.streamer.d.ts +55 -0
  238. package/dist/streamers/chat.streamer.d.ts.map +1 -0
  239. package/dist/streamers/chat.streamer.js +186 -0
  240. package/dist/streamers/chat.streamer.js.map +1 -0
  241. package/dist/streamers/index.d.ts +3 -0
  242. package/dist/streamers/index.d.ts.map +1 -0
  243. package/dist/streamers/index.js +3 -0
  244. package/dist/streamers/index.js.map +1 -0
  245. package/dist/streamers/response.streamer.d.ts +36 -0
  246. package/dist/streamers/response.streamer.d.ts.map +1 -0
  247. package/dist/streamers/response.streamer.js +46 -0
  248. package/dist/streamers/response.streamer.js.map +1 -0
  249. package/dist/support/chat.utils.d.ts +42 -0
  250. package/dist/support/chat.utils.d.ts.map +1 -0
  251. package/dist/support/chat.utils.js +89 -0
  252. package/dist/support/chat.utils.js.map +1 -0
  253. package/dist/support/debug-meta.sanitizer.d.ts +18 -0
  254. package/dist/support/debug-meta.sanitizer.d.ts.map +1 -0
  255. package/dist/support/debug-meta.sanitizer.js +82 -0
  256. package/dist/support/debug-meta.sanitizer.js.map +1 -0
  257. package/dist/support/feed.health.d.ts +32 -0
  258. package/dist/support/feed.health.d.ts.map +1 -0
  259. package/dist/support/feed.health.js +76 -0
  260. package/dist/support/feed.health.js.map +1 -0
  261. package/dist/support/introducer.discovery.d.ts +78 -0
  262. package/dist/support/introducer.discovery.d.ts.map +1 -0
  263. package/dist/support/introducer.discovery.js +101 -0
  264. package/dist/support/introducer.discovery.js.map +1 -0
  265. package/dist/support/log.d.ts +65 -0
  266. package/dist/support/log.d.ts.map +1 -0
  267. package/dist/support/log.js +76 -0
  268. package/dist/support/log.js.map +1 -0
  269. package/dist/support/lucide.icon-catalog.d.ts +22 -0
  270. package/dist/support/lucide.icon-catalog.d.ts.map +1 -0
  271. package/dist/support/lucide.icon-catalog.js +101 -0
  272. package/dist/support/lucide.icon-catalog.js.map +1 -0
  273. package/dist/support/opportunity.card-text.d.ts +39 -0
  274. package/dist/support/opportunity.card-text.d.ts.map +1 -0
  275. package/dist/support/opportunity.card-text.js +333 -0
  276. package/dist/support/opportunity.card-text.js.map +1 -0
  277. package/dist/support/opportunity.constants.d.ts +9 -0
  278. package/dist/support/opportunity.constants.d.ts.map +1 -0
  279. package/dist/support/opportunity.constants.js +11 -0
  280. package/dist/support/opportunity.constants.js.map +1 -0
  281. package/dist/support/opportunity.discover.d.ts +144 -0
  282. package/dist/support/opportunity.discover.d.ts.map +1 -0
  283. package/dist/support/opportunity.discover.js +610 -0
  284. package/dist/support/opportunity.discover.js.map +1 -0
  285. package/dist/support/opportunity.enricher.d.ts +44 -0
  286. package/dist/support/opportunity.enricher.d.ts.map +1 -0
  287. package/dist/support/opportunity.enricher.js +245 -0
  288. package/dist/support/opportunity.enricher.js.map +1 -0
  289. package/dist/support/opportunity.persist.d.ts +39 -0
  290. package/dist/support/opportunity.persist.d.ts.map +1 -0
  291. package/dist/support/opportunity.persist.js +63 -0
  292. package/dist/support/opportunity.persist.js.map +1 -0
  293. package/dist/support/opportunity.presentation.d.ts +21 -0
  294. package/dist/support/opportunity.presentation.d.ts.map +1 -0
  295. package/dist/support/opportunity.presentation.js +75 -0
  296. package/dist/support/opportunity.presentation.js.map +1 -0
  297. package/dist/support/opportunity.sanitize.d.ts +18 -0
  298. package/dist/support/opportunity.sanitize.d.ts.map +1 -0
  299. package/dist/support/opportunity.sanitize.js +89 -0
  300. package/dist/support/opportunity.sanitize.js.map +1 -0
  301. package/dist/support/opportunity.utils.d.ts +99 -0
  302. package/dist/support/opportunity.utils.d.ts.map +1 -0
  303. package/dist/support/opportunity.utils.js +184 -0
  304. package/dist/support/opportunity.utils.js.map +1 -0
  305. package/dist/support/performance.d.ts +19 -0
  306. package/dist/support/performance.d.ts.map +1 -0
  307. package/dist/support/performance.js +43 -0
  308. package/dist/support/performance.js.map +1 -0
  309. package/dist/support/profile.enrichment-display-name.d.ts +16 -0
  310. package/dist/support/profile.enrichment-display-name.d.ts.map +1 -0
  311. package/dist/support/profile.enrichment-display-name.js +22 -0
  312. package/dist/support/profile.enrichment-display-name.js.map +1 -0
  313. package/dist/support/protocol.logger.d.ts +22 -0
  314. package/dist/support/protocol.logger.d.ts.map +1 -0
  315. package/dist/support/protocol.logger.js +44 -0
  316. package/dist/support/protocol.logger.js.map +1 -0
  317. package/dist/support/request-context.d.ts +19 -0
  318. package/dist/support/request-context.d.ts.map +1 -0
  319. package/dist/support/request-context.js +7 -0
  320. package/dist/support/request-context.js.map +1 -0
  321. package/dist/tools/contact.tools.d.ts +7 -0
  322. package/dist/tools/contact.tools.d.ts.map +1 -0
  323. package/dist/tools/contact.tools.js +115 -0
  324. package/dist/tools/contact.tools.js.map +1 -0
  325. package/dist/tools/index.d.ts +17 -0
  326. package/dist/tools/index.d.ts.map +1 -0
  327. package/dist/tools/index.js +140 -0
  328. package/dist/tools/index.js.map +1 -0
  329. package/dist/tools/index.tools.d.ts +3 -0
  330. package/dist/tools/index.tools.d.ts.map +1 -0
  331. package/dist/tools/index.tools.js +423 -0
  332. package/dist/tools/index.tools.js.map +1 -0
  333. package/dist/tools/integration.tools.d.ts +13 -0
  334. package/dist/tools/integration.tools.d.ts.map +1 -0
  335. package/dist/tools/integration.tools.js +77 -0
  336. package/dist/tools/integration.tools.js.map +1 -0
  337. package/dist/tools/intent.tools.d.ts +3 -0
  338. package/dist/tools/intent.tools.d.ts.map +1 -0
  339. package/dist/tools/intent.tools.js +458 -0
  340. package/dist/tools/intent.tools.js.map +1 -0
  341. package/dist/tools/opportunity.tools.d.ts +44 -0
  342. package/dist/tools/opportunity.tools.d.ts.map +1 -0
  343. package/dist/tools/opportunity.tools.js +814 -0
  344. package/dist/tools/opportunity.tools.js.map +1 -0
  345. package/dist/tools/profile.tools.d.ts +3 -0
  346. package/dist/tools/profile.tools.d.ts.map +1 -0
  347. package/dist/tools/profile.tools.js +513 -0
  348. package/dist/tools/profile.tools.js.map +1 -0
  349. package/dist/tools/tool.helpers.d.ts +225 -0
  350. package/dist/tools/tool.helpers.d.ts.map +1 -0
  351. package/dist/tools/tool.helpers.js +172 -0
  352. package/dist/tools/tool.helpers.js.map +1 -0
  353. package/dist/tools/tool.registry.d.ts +12 -0
  354. package/dist/tools/tool.registry.d.ts.map +1 -0
  355. package/dist/tools/tool.registry.js +62 -0
  356. package/dist/tools/tool.registry.js.map +1 -0
  357. package/dist/tools/utility.tools.d.ts +3 -0
  358. package/dist/tools/utility.tools.d.ts.map +1 -0
  359. package/dist/tools/utility.tools.js +107 -0
  360. package/dist/tools/utility.tools.js.map +1 -0
  361. package/dist/types/chat-streaming.types.d.ts +472 -0
  362. package/dist/types/chat-streaming.types.d.ts.map +1 -0
  363. package/dist/types/chat-streaming.types.js +260 -0
  364. package/dist/types/chat-streaming.types.js.map +1 -0
  365. package/package.json +32 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opportunity.sanitize.js","sourceRoot":"","sources":["../../src/support/opportunity.sanitize.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,YAAY,GAAG,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CAAC,OAAO,CACrB,IAAI,MAAM,CAAC,mBAAmB,WAAW,MAAM,EAAE,IAAI,CAAC,EACtD,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;gBAChB,IAAI,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;oBAC1C,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC3C,CAAC;gBACD,OAAO,KAAK,CAAC;YACf,CAAC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,gFAAgF;IAChF,MAAM,GAAG,MAAM;SACZ,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,+BAA+B;SACvD,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,4BAA4B;SACpD,IAAI,EAAE,CAAC;IAEV,mDAAmD;IACnD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,kBAAkB;AAClB,SAAS,WAAW,CAAC,CAAS;IAC5B,OAAO,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Opportunity graph utilities: role derivation from corpus type.
3
+ * Used by the opportunity graph to map lens corpus to opportunity actor roles.
4
+ *
5
+ * With lens-based HyDE, strategy selection is handled automatically by the
6
+ * LensInferrer agent. This file provides corpus-to-role mapping for opportunity actors.
7
+ */
8
+ import type { HydeTargetCorpus } from '../agents/lens.inferrer.js';
9
+ /** Actor roles in the opportunity model (agent / patient / peer). */
10
+ export type OpportunityActorRole = 'agent' | 'patient' | 'peer';
11
+ /** Result of mapping a corpus to source and candidate roles. */
12
+ export interface DerivedRoles {
13
+ sourceRole: OpportunityActorRole;
14
+ candidateRole: OpportunityActorRole;
15
+ }
16
+ /**
17
+ * Derive actor roles from the corpus type of a lens match.
18
+ *
19
+ * When a candidate is found via:
20
+ * - "profiles" corpus → found by who they are → candidate can help → agent
21
+ * - "intents" corpus → found by what they need → candidate needs something → patient
22
+ *
23
+ * @param corpus - The target corpus that produced the match ('profiles' | 'intents')
24
+ * @returns Roles for the source (intent owner) and the candidate (matched user/intent)
25
+ */
26
+ export declare function deriveRolesFromCorpus(corpus: HydeTargetCorpus): DerivedRoles;
27
+ /**
28
+ * Validates opportunity actors: if an opportunity has an introducer, it must have
29
+ * one or two non-introducer actors (1 = 1:1 intro e.g. "I want to connect with X";
30
+ * 2 = introducer connecting two others).
31
+ *
32
+ * @param actors - Array of actors with at least a role and optional userId
33
+ * @throws Error when the actor set is invalid
34
+ */
35
+ export declare function validateOpportunityActors(actors: Array<{
36
+ userId?: string;
37
+ role: string;
38
+ }>): void;
39
+ /**
40
+ * Role-based visibility (Latent Opportunity Lifecycle).
41
+ * A user can see an opportunity iff they are an actor and the rule below allows it.
42
+ *
43
+ * Compact Visibility Rule (from lifecycle doc):
44
+ * - Introducer or peer: always see.
45
+ * - Patient or party: see if (status is not latent, or there is no introducer).
46
+ * - Agent: see if (status is accepted/rejected/expired, or (status is not latent and there is no introducer)).
47
+ */
48
+ export declare function canUserSeeOpportunity(actors: Array<{
49
+ userId: string;
50
+ role: string;
51
+ }>, status: string, userId: string): boolean;
52
+ /**
53
+ * Whether an opportunity should appear on the Home feed for the viewer (actionable = has a pending action).
54
+ * Encodes the role-visibility matrix from the Latent Opportunity Lifecycle.
55
+ */
56
+ export declare function isActionableForViewer(actors: Array<{
57
+ userId: string;
58
+ role: string;
59
+ }>, status: string, viewerId: string): boolean;
60
+ /** Feed category for home composition. */
61
+ export type FeedCategory = 'connection' | 'connector-flow' | 'expired';
62
+ /** Soft targets for home feed composition. */
63
+ export declare const FEED_SOFT_TARGETS: {
64
+ readonly connection: 3;
65
+ readonly connectorFlow: 2;
66
+ readonly expired: 2;
67
+ };
68
+ /**
69
+ * Classify an actionable opportunity into a feed category.
70
+ * Assumes the opportunity already passed isActionableForViewer or is expired.
71
+ *
72
+ * @param opp - Opportunity with actors and status
73
+ * @param viewerId - The viewing user's ID
74
+ * @returns Feed category
75
+ */
76
+ export declare function classifyOpportunity(opp: {
77
+ actors: Array<{
78
+ userId: string;
79
+ role: string;
80
+ }>;
81
+ status: string;
82
+ }, viewerId: string): FeedCategory;
83
+ /**
84
+ * Select opportunities for the home feed using soft composition targets.
85
+ * Fills each category up to its target, then redistributes unused slots
86
+ * to categories that have more items available. Preserves input order.
87
+ *
88
+ * @param opportunities - Pre-sorted opportunities (by confidence/recency)
89
+ * @param viewerId - The viewing user's ID
90
+ * @returns Composition-balanced subset
91
+ */
92
+ export declare function selectByComposition<T extends {
93
+ actors: Array<{
94
+ userId: string;
95
+ role: string;
96
+ }>;
97
+ status: string;
98
+ }>(opportunities: T[], viewerId: string): T[];
99
+ //# sourceMappingURL=opportunity.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opportunity.utils.d.ts","sourceRoot":"","sources":["../../src/support/opportunity.utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAKnE,qEAAqE;AACrE,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEhE,gEAAgE;AAChE,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,oBAAoB,CAAC;IACjC,aAAa,EAAE,oBAAoB,CAAC;CACrC;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,gBAAgB,GAAG,YAAY,CAW5E;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EA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 * Opportunity graph utilities: role derivation from corpus type.
3
+ * Used by the opportunity graph to map lens corpus to opportunity actor roles.
4
+ *
5
+ * With lens-based HyDE, strategy selection is handled automatically by the
6
+ * LensInferrer agent. This file provides corpus-to-role mapping for opportunity actors.
7
+ */
8
+ import { log } from './log.js';
9
+ const logger = log.graph.from('SelectByComposition');
10
+ /**
11
+ * Derive actor roles from the corpus type of a lens match.
12
+ *
13
+ * When a candidate is found via:
14
+ * - "profiles" corpus → found by who they are → candidate can help → agent
15
+ * - "intents" corpus → found by what they need → candidate needs something → patient
16
+ *
17
+ * @param corpus - The target corpus that produced the match ('profiles' | 'intents')
18
+ * @returns Roles for the source (intent owner) and the candidate (matched user/intent)
19
+ */
20
+ export function deriveRolesFromCorpus(corpus) {
21
+ switch (corpus) {
22
+ case 'profiles':
23
+ // Source seeks someone who can help → source is patient, candidate can help → agent
24
+ return { sourceRole: 'patient', candidateRole: 'agent' };
25
+ case 'intents':
26
+ // Source offers or needs; candidate has complementary goal → source is agent, candidate is patient
27
+ return { sourceRole: 'agent', candidateRole: 'patient' };
28
+ default:
29
+ return { sourceRole: 'peer', candidateRole: 'peer' };
30
+ }
31
+ }
32
+ /**
33
+ * Validates opportunity actors: if an opportunity has an introducer, it must have
34
+ * one or two non-introducer actors (1 = 1:1 intro e.g. "I want to connect with X";
35
+ * 2 = introducer connecting two others).
36
+ *
37
+ * @param actors - Array of actors with at least a role and optional userId
38
+ * @throws Error when the actor set is invalid
39
+ */
40
+ export function validateOpportunityActors(actors) {
41
+ const introducerCount = actors.filter((a) => a.role === 'introducer').length;
42
+ const nonIntroducerCount = actors.filter((a) => a.role !== 'introducer').length;
43
+ if (introducerCount > 0 && (nonIntroducerCount < 1 || nonIntroducerCount > 2)) {
44
+ throw new Error('An opportunity with an introducer must have one or two other actors.');
45
+ }
46
+ }
47
+ /**
48
+ * Role-based visibility (Latent Opportunity Lifecycle).
49
+ * A user can see an opportunity iff they are an actor and the rule below allows it.
50
+ *
51
+ * Compact Visibility Rule (from lifecycle doc):
52
+ * - Introducer or peer: always see.
53
+ * - Patient or party: see if (status is not latent, or there is no introducer).
54
+ * - Agent: see if (status is accepted/rejected/expired, or (status is not latent and there is no introducer)).
55
+ */
56
+ export function canUserSeeOpportunity(actors, status, userId) {
57
+ const hasIntroducer = actors.some((a) => a.role === 'introducer');
58
+ const userRoles = actors.filter((a) => a.userId === userId).map((a) => a.role);
59
+ if (userRoles.length === 0)
60
+ return false;
61
+ return userRoles.some((role) => {
62
+ if (role === 'introducer')
63
+ return true;
64
+ if (role === 'peer')
65
+ return true;
66
+ if (role === 'patient' || role === 'party')
67
+ return status !== 'latent' || !hasIntroducer;
68
+ if (role === 'agent')
69
+ return (['accepted', 'rejected', 'expired'].includes(status) ||
70
+ (status !== 'latent' && !hasIntroducer));
71
+ return false;
72
+ });
73
+ }
74
+ /**
75
+ * Whether an opportunity should appear on the Home feed for the viewer (actionable = has a pending action).
76
+ * Encodes the role-visibility matrix from the Latent Opportunity Lifecycle.
77
+ */
78
+ export function isActionableForViewer(actors, status, viewerId) {
79
+ const viewerActors = actors.filter((a) => a.userId === viewerId);
80
+ if (viewerActors.length === 0)
81
+ return false;
82
+ const hasIntroducer = actors.some((a) => a.role === 'introducer');
83
+ return viewerActors.some(({ role }) => {
84
+ switch (role) {
85
+ case 'introducer':
86
+ return status === 'latent';
87
+ case 'patient':
88
+ case 'party':
89
+ return hasIntroducer
90
+ ? status === 'pending'
91
+ : status === 'latent';
92
+ case 'agent':
93
+ return hasIntroducer
94
+ ? status === 'accepted'
95
+ : status === 'pending';
96
+ case 'peer':
97
+ return status === 'latent' || status === 'pending';
98
+ default:
99
+ return false;
100
+ }
101
+ });
102
+ }
103
+ /** Soft targets for home feed composition. */
104
+ export const FEED_SOFT_TARGETS = {
105
+ connection: 3,
106
+ connectorFlow: 2,
107
+ expired: 2,
108
+ };
109
+ /**
110
+ * Classify an actionable opportunity into a feed category.
111
+ * Assumes the opportunity already passed isActionableForViewer or is expired.
112
+ *
113
+ * @param opp - Opportunity with actors and status
114
+ * @param viewerId - The viewing user's ID
115
+ * @returns Feed category
116
+ */
117
+ export function classifyOpportunity(opp, viewerId) {
118
+ if (opp.status === 'expired')
119
+ return 'expired';
120
+ const viewerIsIntroducer = opp.actors.some((a) => a.userId === viewerId && a.role === 'introducer');
121
+ if (viewerIsIntroducer)
122
+ return 'connector-flow';
123
+ return 'connection';
124
+ }
125
+ /**
126
+ * Select opportunities for the home feed using soft composition targets.
127
+ * Fills each category up to its target, then redistributes unused slots
128
+ * to categories that have more items available. Preserves input order.
129
+ *
130
+ * @param opportunities - Pre-sorted opportunities (by confidence/recency)
131
+ * @param viewerId - The viewing user's ID
132
+ * @returns Composition-balanced subset
133
+ */
134
+ export function selectByComposition(opportunities, viewerId) {
135
+ const buckets = {
136
+ connection: [],
137
+ 'connector-flow': [],
138
+ expired: [],
139
+ };
140
+ for (const opp of opportunities) {
141
+ const category = classifyOpportunity(opp, viewerId);
142
+ buckets[category].push(opp);
143
+ }
144
+ const targets = {
145
+ connection: FEED_SOFT_TARGETS.connection,
146
+ 'connector-flow': FEED_SOFT_TARGETS.connectorFlow,
147
+ expired: FEED_SOFT_TARGETS.expired,
148
+ };
149
+ // First pass: fill each category up to its target
150
+ const selected = {
151
+ connection: buckets.connection.slice(0, targets.connection),
152
+ 'connector-flow': buckets['connector-flow'].slice(0, targets['connector-flow']),
153
+ expired: buckets.expired.slice(0, targets.expired),
154
+ };
155
+ // Calculate unused slots and remaining items
156
+ const totalTarget = targets.connection + targets['connector-flow'] + targets.expired;
157
+ const usedSlots = selected.connection.length + selected['connector-flow'].length + selected.expired.length;
158
+ let unusedSlots = totalTarget - usedSlots;
159
+ // Second pass: redistribute unused slots to categories with remaining items
160
+ // Priority: connection > connector-flow > expired
161
+ const redistOrder = ['connection', 'connector-flow', 'expired'];
162
+ for (const category of redistOrder) {
163
+ if (unusedSlots <= 0)
164
+ break;
165
+ const remaining = buckets[category].slice(selected[category].length);
166
+ const take = Math.min(remaining.length, unusedSlots);
167
+ selected[category].push(...remaining.slice(0, take));
168
+ unusedSlots -= take;
169
+ }
170
+ // Merge in category priority order: connection > connector-flow > expired
171
+ // Within each category, preserve original input order
172
+ const indexMap = new Map(opportunities.map((opp, i) => [opp, i]));
173
+ const sortByOriginal = (a, b) => (indexMap.get(a) ?? 0) - (indexMap.get(b) ?? 0);
174
+ selected.connection.sort(sortByOriginal);
175
+ selected['connector-flow'].sort(sortByOriginal);
176
+ selected.expired.sort(sortByOriginal);
177
+ logger.info(`[selectByComposition] input=${opportunities.length} buckets: connection=${buckets.connection.length} connector-flow=${buckets['connector-flow'].length} expired=${buckets.expired.length} → selected: connection=${selected.connection.length} connector-flow=${selected['connector-flow'].length} expired=${selected.expired.length}`);
178
+ return [
179
+ ...selected.connection,
180
+ ...selected['connector-flow'],
181
+ ...selected.expired,
182
+ ];
183
+ }
184
+ //# sourceMappingURL=opportunity.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opportunity.utils.js","sourceRoot":"","sources":["../../src/support/opportunity.utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAWrD;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAwB;IAC5D,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,UAAU;YACb,oFAAoF;YACpF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC;QAC3D,KAAK,SAAS;YACZ,mGAAmG;YACnG,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;QAC3D;YACE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC;IACzD,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;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,MAAM,cAAc,GAAG,CAAC,CAAI,EAAE,CAAI,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACvF,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACzC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAChD,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAEtC,MAAM,CAAC,IAAI,CAAC,+BAA+B,aAAa,CAAC,MAAM,wBAAwB,OAAO,CAAC,UAAU,CAAC,MAAM,mBAAmB,OAAO,CAAC,gBAAgB,CAAC,CAAC,MAAM,YAAY,OAAO,CAAC,OAAO,CAAC,MAAM,2BAA2B,QAAQ,CAAC,UAAU,CAAC,MAAM,mBAAmB,QAAQ,CAAC,gBAAgB,CAAC,CAAC,MAAM,YAAY,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAErV,OAAO;QACL,GAAG,QAAQ,CAAC,UAAU;QACtB,GAAG,QAAQ,CAAC,gBAAgB,CAAC;QAC7B,GAAG,QAAQ,CAAC,OAAO;KACpB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Simple performance timing utilities for the protocol library.
3
+ * Standalone — no external dependencies.
4
+ */
5
+ type TimingCallback = (name: string, durationMs: number) => void;
6
+ /** Set a global callback for timing events (e.g. for aggregation/logging). */
7
+ export declare function setTimingCallback(cb: TimingCallback | undefined): void;
8
+ /**
9
+ * Wraps an async function with timing measurement.
10
+ * Reports duration to the global timing callback if set.
11
+ */
12
+ export declare function timed<T>(name: string, fn: () => Promise<T>): Promise<T>;
13
+ /**
14
+ * Method decorator that wraps an async method with timing measurement.
15
+ * Uses `ClassName.methodName` as the timing label.
16
+ */
17
+ export declare function Timed(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void;
18
+ export {};
19
+ //# sourceMappingURL=performance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"performance.d.ts","sourceRoot":"","sources":["../../src/support/performance.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,KAAK,cAAc,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;AAIjE,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,cAAc,GAAG,SAAS,QAE/D;AAED;;;GAGG;AACH,wBAAsB,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAU7E;AAED;;;GAGG;AAEH,wBAAgB,KAAK,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,kBAAkB,KAAK,IAAI,CAWlG"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Simple performance timing utilities for the protocol library.
3
+ * Standalone — no external dependencies.
4
+ */
5
+ let onTiming;
6
+ /** Set a global callback for timing events (e.g. for aggregation/logging). */
7
+ export function setTimingCallback(cb) {
8
+ onTiming = cb;
9
+ }
10
+ /**
11
+ * Wraps an async function with timing measurement.
12
+ * Reports duration to the global timing callback if set.
13
+ */
14
+ export async function timed(name, fn) {
15
+ const start = performance.now();
16
+ try {
17
+ const result = await fn();
18
+ onTiming?.(name, performance.now() - start);
19
+ return result;
20
+ }
21
+ catch (err) {
22
+ onTiming?.(name, performance.now() - start);
23
+ throw err;
24
+ }
25
+ }
26
+ /**
27
+ * Method decorator that wraps an async method with timing measurement.
28
+ * Uses `ClassName.methodName` as the timing label.
29
+ */
30
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
+ export function Timed() {
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+ return function (_target, propertyKey, descriptor) {
34
+ const original = descriptor.value;
35
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
+ descriptor.value = function (...args) {
37
+ const className = this.constructor.name;
38
+ const name = `${className}.${propertyKey}`;
39
+ return timed(name, () => original.apply(this, args));
40
+ };
41
+ };
42
+ }
43
+ //# sourceMappingURL=performance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"performance.js","sourceRoot":"","sources":["../../src/support/performance.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,IAAI,QAAoC,CAAC;AAEzC,8EAA8E;AAC9E,MAAM,UAAU,iBAAiB,CAAC,EAA8B;IAC9D,QAAQ,GAAG,EAAE,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAI,IAAY,EAAE,EAAoB;IAC/D,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAChC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;QAC1B,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC;QAC5C,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC;QAC5C,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,8DAA8D;AAC9D,MAAM,UAAU,KAAK;IACnB,8DAA8D;IAC9D,OAAO,UAAU,OAAY,EAAE,WAAmB,EAAE,UAA8B;QAChF,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;QAClC,8DAA8D;QAC9D,UAAU,CAAC,KAAK,GAAG,UAAqB,GAAG,IAAW;YACpD,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;YACxC,MAAM,IAAI,GAAG,GAAG,SAAS,IAAI,WAAW,EAAE,CAAC;YAC3C,OAAO,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QACvD,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Decides whether to set {@link users.name} from Parallel `enrichment.identity.name` for ghost users.
3
+ * @remarks Real users (Google login, etc.) are never touched. Ghost users always get
4
+ * their name enriched when Parallel returns a non-empty name that isn't an email.
5
+ */
6
+ /**
7
+ * @param user - Current user row (must include `email`, `name`, `isGhost`)
8
+ * @param enrichedName - `enrichment.identity.name` from Parallel (may be untrimmed)
9
+ * @returns True if `users.name` should be updated to the enriched full name
10
+ */
11
+ export declare function shouldEnrichGhostDisplayNameFromParallel(user: {
12
+ name: string;
13
+ email: string;
14
+ isGhost?: boolean | null;
15
+ }, enrichedName: string): boolean;
16
+ //# sourceMappingURL=profile.enrichment-display-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.enrichment-display-name.d.ts","sourceRoot":"","sources":["../../src/support/profile.enrichment-display-name.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,wBAAgB,wCAAwC,CACtD,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;CAAE,EAC/D,YAAY,EAAE,MAAM,GACnB,OAAO,CAST"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Decides whether to set {@link users.name} from Parallel `enrichment.identity.name` for ghost users.
3
+ * @remarks Real users (Google login, etc.) are never touched. Ghost users always get
4
+ * their name enriched when Parallel returns a non-empty name that isn't an email.
5
+ */
6
+ /**
7
+ * @param user - Current user row (must include `email`, `name`, `isGhost`)
8
+ * @param enrichedName - `enrichment.identity.name` from Parallel (may be untrimmed)
9
+ * @returns True if `users.name` should be updated to the enriched full name
10
+ */
11
+ export function shouldEnrichGhostDisplayNameFromParallel(user, enrichedName) {
12
+ if (!user.isGhost)
13
+ return false;
14
+ const trimmed = enrichedName.trim();
15
+ if (!trimmed || trimmed.includes("@"))
16
+ return false;
17
+ const current = user.name.trim();
18
+ if (current === trimmed.toLowerCase())
19
+ return false;
20
+ return true;
21
+ }
22
+ //# sourceMappingURL=profile.enrichment-display-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.enrichment-display-name.js","sourceRoot":"","sources":["../../src/support/profile.enrichment-display-name.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,UAAU,wCAAwC,CACtD,IAA+D,EAC/D,YAAoB;IAEpB,IAAI,CAAC,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAChC,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,EAAE,CAAC;IACpC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IAEpD,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACjC,IAAI,OAAO,KAAK,OAAO,CAAC,WAAW,EAAE;QAAE,OAAO,KAAK,CAAC;IAEpD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Protocol-layer logging: call-scoped inputs, outputs, and context for debugging.
3
+ * Use protocolLogger('ComponentName') for the logger, then wrap calls with
4
+ * withCallLogging. All protocol code should log inputs at call start and
5
+ * outputs (or summary) + duration at end.
6
+ */
7
+ import type { LoggerWithSource } from "./log.js";
8
+ export type { LoggerWithSource };
9
+ /** Create a protocol logger for a given source (e.g. "ChatTools", "DiscoverNodes"). */
10
+ export declare function protocolLogger(source: string): LoggerWithSource;
11
+ export interface CallLogOptions {
12
+ /** Log full output on success (default: true). Set false for very large payloads. */
13
+ logOutput?: boolean;
14
+ /** Extra context to include in both start and end (e.g. userId, indexId). */
15
+ context?: Record<string, unknown>;
16
+ }
17
+ /**
18
+ * Wraps an async call with consistent logging: inputs at start, outputs + duration at end,
19
+ * error + duration on failure. All payloads are sanitized (embeddings redacted).
20
+ */
21
+ export declare function withCallLogging<T>(logger: LoggerWithSource, callName: string, inputs: Record<string, unknown>, fn: () => Promise<T>, options?: CallLogOptions): Promise<T>;
22
+ //# sourceMappingURL=protocol.logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.logger.d.ts","sourceRoot":"","sources":["../../src/support/protocol.logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAEjC,uFAAuF;AACvF,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAE/D;AAED,MAAM,WAAW,cAAc;IAC7B,qFAAqF;IACrF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,CAAC,EACrC,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,CAAC,CAAC,CA2BZ"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Protocol-layer logging: call-scoped inputs, outputs, and context for debugging.
3
+ * Use protocolLogger('ComponentName') for the logger, then wrap calls with
4
+ * withCallLogging. All protocol code should log inputs at call start and
5
+ * outputs (or summary) + duration at end.
6
+ */
7
+ import { log, sanitizeForLog } from "./log.js";
8
+ /** Create a protocol logger for a given source (e.g. "ChatTools", "DiscoverNodes"). */
9
+ export function protocolLogger(source) {
10
+ return log.protocol.from(source);
11
+ }
12
+ /**
13
+ * Wraps an async call with consistent logging: inputs at start, outputs + duration at end,
14
+ * error + duration on failure. All payloads are sanitized (embeddings redacted).
15
+ */
16
+ export async function withCallLogging(logger, callName, inputs, fn, options = {}) {
17
+ const { logOutput = true, context = {} } = options;
18
+ const start = Date.now();
19
+ const sanitizedInputs = sanitizeForLog(inputs);
20
+ logger.verbose(`[Call] ${callName} start`, { inputs: sanitizedInputs, ...context });
21
+ try {
22
+ const result = await fn();
23
+ const durationMs = Date.now() - start;
24
+ const outMeta = {
25
+ durationMs,
26
+ ...context,
27
+ };
28
+ if (logOutput) {
29
+ outMeta.output = sanitizeForLog(result);
30
+ }
31
+ logger.verbose(`[Call] ${callName} end`, outMeta);
32
+ return result;
33
+ }
34
+ catch (err) {
35
+ const durationMs = Date.now() - start;
36
+ logger.error(`[Call] ${callName} failed`, {
37
+ error: err,
38
+ durationMs,
39
+ ...context,
40
+ });
41
+ throw err;
42
+ }
43
+ }
44
+ //# sourceMappingURL=protocol.logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.logger.js","sourceRoot":"","sources":["../../src/support/protocol.logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAK/C,uFAAuF;AACvF,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC;AASD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAwB,EACxB,QAAgB,EAChB,MAA+B,EAC/B,EAAoB,EACpB,UAA0B,EAAE;IAE5B,MAAM,EAAE,SAAS,GAAG,IAAI,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IACnD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACzB,MAAM,eAAe,GAAG,cAAc,CAAC,MAAM,CAA4B,CAAC;IAC1E,MAAM,CAAC,OAAO,CAAC,UAAU,QAAQ,QAAQ,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAEpF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;QAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;QACtC,MAAM,OAAO,GAA4B;YACvC,UAAU;YACV,GAAG,OAAO;SACX,CAAC;QACF,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QAC1C,CAAC;QACD,MAAM,CAAC,OAAO,CAAC,UAAU,QAAQ,MAAM,EAAE,OAAO,CAAC,CAAC;QAClD,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;QACtC,MAAM,CAAC,KAAK,CAAC,UAAU,QAAQ,SAAS,EAAE;YACxC,KAAK,EAAE,GAAG;YACV,UAAU;YACV,GAAG,OAAO;SACX,CAAC,CAAC;QACH,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { AsyncLocalStorage } from "async_hooks";
2
+ /** Callback for streaming graph/agent trace events from deep inside graph nodes. */
3
+ export type TraceEmitter = (event: {
4
+ type: "graph_start" | "graph_end" | "agent_start" | "agent_end";
5
+ name: string;
6
+ durationMs?: number;
7
+ summary?: string;
8
+ }) => void;
9
+ interface RequestContext {
10
+ originUrl?: string;
11
+ traceEmitter?: TraceEmitter;
12
+ }
13
+ /**
14
+ * AsyncLocalStorage for propagating request-scoped context through the protocol layer.
15
+ * The host application is responsible for calling `requestContext.run()` to set the context.
16
+ */
17
+ export declare const requestContext: AsyncLocalStorage<RequestContext>;
18
+ export {};
19
+ //# sourceMappingURL=request-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-context.d.ts","sourceRoot":"","sources":["../../src/support/request-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,oFAAoF;AACpF,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE;IACjC,IAAI,EAAE,aAAa,GAAG,WAAW,GAAG,aAAa,GAAG,WAAW,CAAC;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,KAAK,IAAI,CAAC;AAEX,UAAU,cAAc;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,mCAA0C,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { AsyncLocalStorage } from "async_hooks";
2
+ /**
3
+ * AsyncLocalStorage for propagating request-scoped context through the protocol layer.
4
+ * The host application is responsible for calling `requestContext.run()` to set the context.
5
+ */
6
+ export const requestContext = new AsyncLocalStorage();
7
+ //# sourceMappingURL=request-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-context.js","sourceRoot":"","sources":["../../src/support/request-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAehD;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,iBAAiB,EAAkB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { DefineTool, ToolDeps } from './tool.helpers.js';
2
+ /**
3
+ * Creates contact management tools for the chat agent.
4
+ * Enables importing, listing, and managing the user's network.
5
+ */
6
+ export declare function createContactTools(defineTool: DefineTool, deps: ToolDeps): any[];
7
+ //# sourceMappingURL=contact.tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contact.tools.d.ts","sourceRoot":"","sources":["../../src/tools/contact.tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG9D;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,SAkHxE"}