@indexnetwork/protocol 1.25.1-rc.209.1 → 1.25.3-rc.211.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 (274) hide show
  1. package/dist/agent/agent.tools.d.ts.map +1 -1
  2. package/dist/agent/agent.tools.js.map +1 -1
  3. package/dist/agent/tests/fakes.d.ts.map +1 -1
  4. package/dist/agent/tests/fakes.js.map +1 -1
  5. package/dist/chat/chat-streaming.types.d.ts.map +1 -1
  6. package/dist/chat/chat-streaming.types.js.map +1 -1
  7. package/dist/chat/chat.agent.d.ts.map +1 -1
  8. package/dist/chat/chat.agent.js.map +1 -1
  9. package/dist/chat/chat.graph.d.ts.map +1 -1
  10. package/dist/chat/chat.graph.js.map +1 -1
  11. package/dist/chat/chat.prompt.d.ts.map +1 -1
  12. package/dist/chat/chat.prompt.js.map +1 -1
  13. package/dist/chat/chat.prompt.modules.d.ts.map +1 -1
  14. package/dist/chat/chat.prompt.modules.js.map +1 -1
  15. package/dist/chat/chat.question-dedup.d.ts.map +1 -1
  16. package/dist/chat/chat.question-dedup.js.map +1 -1
  17. package/dist/chat/chat.state.d.ts.map +1 -1
  18. package/dist/chat/chat.state.js.map +1 -1
  19. package/dist/chat/chat.streamer.d.ts.map +1 -1
  20. package/dist/chat/chat.streamer.js.map +1 -1
  21. package/dist/chat/chat.suggester.d.ts.map +1 -1
  22. package/dist/chat/chat.suggester.js.map +1 -1
  23. package/dist/chat/chat.summarizer.d.ts.map +1 -1
  24. package/dist/chat/chat.summarizer.js.map +1 -1
  25. package/dist/chat/chat.title.generator.d.ts.map +1 -1
  26. package/dist/chat/chat.title.generator.js.map +1 -1
  27. package/dist/chat/chat.tools.d.ts.map +1 -1
  28. package/dist/chat/chat.tools.js.map +1 -1
  29. package/dist/chat/chat.utils.d.ts.map +1 -1
  30. package/dist/chat/chat.utils.js.map +1 -1
  31. package/dist/chat/tests/chat.graph.mocks.d.ts.map +1 -1
  32. package/dist/chat/tests/chat.graph.mocks.js.map +1 -1
  33. package/dist/contact/contact.inviter.d.ts.map +1 -1
  34. package/dist/contact/contact.inviter.js.map +1 -1
  35. package/dist/contact/contact.tools.d.ts.map +1 -1
  36. package/dist/contact/contact.tools.js.map +1 -1
  37. package/dist/context/context.generator.d.ts.map +1 -1
  38. package/dist/context/context.generator.js.map +1 -1
  39. package/dist/index.d.ts +1 -0
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +1 -0
  42. package/dist/index.js.map +1 -1
  43. package/dist/integration/integration.tools.d.ts.map +1 -1
  44. package/dist/integration/integration.tools.js.map +1 -1
  45. package/dist/intent/intent.clarifier.d.ts.map +1 -1
  46. package/dist/intent/intent.clarifier.js.map +1 -1
  47. package/dist/intent/intent.graph.d.ts.map +1 -1
  48. package/dist/intent/intent.graph.js.map +1 -1
  49. package/dist/intent/intent.indexer.d.ts.map +1 -1
  50. package/dist/intent/intent.indexer.js.map +1 -1
  51. package/dist/intent/intent.inferrer.d.ts.map +1 -1
  52. package/dist/intent/intent.inferrer.js.map +1 -1
  53. package/dist/intent/intent.reconciler.d.ts.map +1 -1
  54. package/dist/intent/intent.reconciler.js.map +1 -1
  55. package/dist/intent/intent.state.d.ts.map +1 -1
  56. package/dist/intent/intent.state.js.map +1 -1
  57. package/dist/intent/intent.tools.d.ts.map +1 -1
  58. package/dist/intent/intent.tools.js.map +1 -1
  59. package/dist/intent/intent.verifier.d.ts.map +1 -1
  60. package/dist/intent/intent.verifier.js.map +1 -1
  61. package/dist/maintenance/maintenance.graph.d.ts.map +1 -1
  62. package/dist/maintenance/maintenance.graph.js.map +1 -1
  63. package/dist/maintenance/maintenance.state.d.ts.map +1 -1
  64. package/dist/maintenance/maintenance.state.js.map +1 -1
  65. package/dist/mcp/elicitation.builder.d.ts.map +1 -1
  66. package/dist/mcp/elicitation.builder.js.map +1 -1
  67. package/dist/mcp/elicitation.dispatcher.d.ts.map +1 -1
  68. package/dist/mcp/elicitation.dispatcher.js.map +1 -1
  69. package/dist/mcp/mcp.server.d.ts.map +1 -1
  70. package/dist/mcp/mcp.server.js.map +1 -1
  71. package/dist/negotiation/insight.generator.d.ts.map +1 -1
  72. package/dist/negotiation/insight.generator.js.map +1 -1
  73. package/dist/negotiation/negotiation.agent.d.ts.map +1 -1
  74. package/dist/negotiation/negotiation.agent.js.map +1 -1
  75. package/dist/negotiation/negotiation.graph.d.ts.map +1 -1
  76. package/dist/negotiation/negotiation.graph.js.map +1 -1
  77. package/dist/negotiation/negotiation.state.d.ts.map +1 -1
  78. package/dist/negotiation/negotiation.state.js.map +1 -1
  79. package/dist/negotiation/negotiation.summarizer.d.ts.map +1 -1
  80. package/dist/negotiation/negotiation.summarizer.js.map +1 -1
  81. package/dist/negotiation/negotiation.tools.d.ts.map +1 -1
  82. package/dist/negotiation/negotiation.tools.js.map +1 -1
  83. package/dist/network/indexer/indexer.graph.d.ts.map +1 -1
  84. package/dist/network/indexer/indexer.graph.js.map +1 -1
  85. package/dist/network/indexer/indexer.state.d.ts.map +1 -1
  86. package/dist/network/indexer/indexer.state.js.map +1 -1
  87. package/dist/network/membership/membership.graph.d.ts.map +1 -1
  88. package/dist/network/membership/membership.graph.js.map +1 -1
  89. package/dist/network/membership/membership.state.d.ts.map +1 -1
  90. package/dist/network/membership/membership.state.js.map +1 -1
  91. package/dist/network/network.graph.d.ts.map +1 -1
  92. package/dist/network/network.graph.js.map +1 -1
  93. package/dist/network/network.state.d.ts.map +1 -1
  94. package/dist/network/network.state.js.map +1 -1
  95. package/dist/network/network.tools.d.ts.map +1 -1
  96. package/dist/network/network.tools.js.map +1 -1
  97. package/dist/opportunity/delivery-card.cache.d.ts.map +1 -1
  98. package/dist/opportunity/delivery-card.cache.js.map +1 -1
  99. package/dist/opportunity/discovery-question.helper.d.ts.map +1 -1
  100. package/dist/opportunity/discovery-question.helper.js.map +1 -1
  101. package/dist/opportunity/feed/feed.categorizer.d.ts.map +1 -1
  102. package/dist/opportunity/feed/feed.categorizer.js.map +1 -1
  103. package/dist/opportunity/feed/feed.graph.d.ts.map +1 -1
  104. package/dist/opportunity/feed/feed.graph.js.map +1 -1
  105. package/dist/opportunity/feed/feed.health.d.ts.map +1 -1
  106. package/dist/opportunity/feed/feed.health.js.map +1 -1
  107. package/dist/opportunity/feed/feed.state.d.ts.map +1 -1
  108. package/dist/opportunity/feed/feed.state.js.map +1 -1
  109. package/dist/opportunity/negotiation-context.loader.d.ts.map +1 -1
  110. package/dist/opportunity/negotiation-context.loader.js.map +1 -1
  111. package/dist/opportunity/negotiation-summary.builder.d.ts.map +1 -1
  112. package/dist/opportunity/negotiation-summary.builder.js.map +1 -1
  113. package/dist/opportunity/opportunity.discover.d.ts.map +1 -1
  114. package/dist/opportunity/opportunity.discover.js.map +1 -1
  115. package/dist/opportunity/opportunity.enricher.d.ts.map +1 -1
  116. package/dist/opportunity/opportunity.enricher.js.map +1 -1
  117. package/dist/opportunity/opportunity.evaluator.d.ts.map +1 -1
  118. package/dist/opportunity/opportunity.evaluator.js.map +1 -1
  119. package/dist/opportunity/opportunity.graph.d.ts.map +1 -1
  120. package/dist/opportunity/opportunity.graph.js.map +1 -1
  121. package/dist/opportunity/opportunity.introducer.d.ts.map +1 -1
  122. package/dist/opportunity/opportunity.introducer.js.map +1 -1
  123. package/dist/opportunity/opportunity.labels.d.ts.map +1 -1
  124. package/dist/opportunity/opportunity.labels.js.map +1 -1
  125. package/dist/opportunity/opportunity.pending-questions.d.ts.map +1 -1
  126. package/dist/opportunity/opportunity.pending-questions.js.map +1 -1
  127. package/dist/opportunity/opportunity.persist.d.ts.map +1 -1
  128. package/dist/opportunity/opportunity.persist.js.map +1 -1
  129. package/dist/opportunity/opportunity.presentation.d.ts.map +1 -1
  130. package/dist/opportunity/opportunity.presentation.js.map +1 -1
  131. package/dist/opportunity/opportunity.presenter.d.ts.map +1 -1
  132. package/dist/opportunity/opportunity.presenter.js.map +1 -1
  133. package/dist/opportunity/opportunity.state.d.ts.map +1 -1
  134. package/dist/opportunity/opportunity.state.js.map +1 -1
  135. package/dist/opportunity/opportunity.tools.d.ts.map +1 -1
  136. package/dist/opportunity/opportunity.tools.js.map +1 -1
  137. package/dist/opportunity/opportunity.utils.d.ts.map +1 -1
  138. package/dist/opportunity/opportunity.utils.js.map +1 -1
  139. package/dist/opportunity/question.generator.d.ts.map +1 -1
  140. package/dist/opportunity/question.generator.js.map +1 -1
  141. package/dist/opportunity/question.prompt.d.ts.map +1 -1
  142. package/dist/opportunity/question.prompt.js.map +1 -1
  143. package/dist/premise/premise.analyzer.d.ts.map +1 -1
  144. package/dist/premise/premise.analyzer.js.map +1 -1
  145. package/dist/premise/premise.decomposer.d.ts.map +1 -1
  146. package/dist/premise/premise.decomposer.js.map +1 -1
  147. package/dist/premise/premise.graph.d.ts.map +1 -1
  148. package/dist/premise/premise.graph.js.map +1 -1
  149. package/dist/premise/premise.indexer.d.ts.map +1 -1
  150. package/dist/premise/premise.indexer.js.map +1 -1
  151. package/dist/premise/premise.state.d.ts.map +1 -1
  152. package/dist/premise/premise.state.js.map +1 -1
  153. package/dist/premise/premise.tools.d.ts.map +1 -1
  154. package/dist/premise/premise.tools.js.map +1 -1
  155. package/dist/profile/profile.enricher.d.ts.map +1 -1
  156. package/dist/profile/profile.enricher.js.map +1 -1
  157. package/dist/profile/profile.generator.d.ts.map +1 -1
  158. package/dist/profile/profile.generator.js.map +1 -1
  159. package/dist/profile/profile.graph.d.ts.map +1 -1
  160. package/dist/profile/profile.graph.js.map +1 -1
  161. package/dist/profile/profile.state.d.ts.map +1 -1
  162. package/dist/profile/profile.state.js.map +1 -1
  163. package/dist/profile/profile.tools.d.ts.map +1 -1
  164. package/dist/profile/profile.tools.js.map +1 -1
  165. package/dist/questioner/questioner.agent.d.ts.map +1 -1
  166. package/dist/questioner/questioner.agent.js.map +1 -1
  167. package/dist/questioner/questioner.presets.d.ts.map +1 -1
  168. package/dist/questioner/questioner.presets.js.map +1 -1
  169. package/dist/questioner/questioner.types.d.ts.map +1 -1
  170. package/dist/questioner/questioner.types.js.map +1 -1
  171. package/dist/shared/agent/model-signal.d.ts.map +1 -1
  172. package/dist/shared/agent/model-signal.js.map +1 -1
  173. package/dist/shared/agent/model.config.d.ts.map +1 -1
  174. package/dist/shared/agent/model.config.js.map +1 -1
  175. package/dist/shared/agent/response.streamer.d.ts.map +1 -1
  176. package/dist/shared/agent/response.streamer.js.map +1 -1
  177. package/dist/shared/agent/tests/llm-assert.d.ts.map +1 -1
  178. package/dist/shared/agent/tests/llm-assert.js.map +1 -1
  179. package/dist/shared/agent/tool.factory.d.ts.map +1 -1
  180. package/dist/shared/agent/tool.factory.js.map +1 -1
  181. package/dist/shared/agent/tool.helpers.d.ts.map +1 -1
  182. package/dist/shared/agent/tool.helpers.js.map +1 -1
  183. package/dist/shared/agent/tool.registry.d.ts.map +1 -1
  184. package/dist/shared/agent/tool.registry.js.map +1 -1
  185. package/dist/shared/agent/tool.runtime.d.ts.map +1 -1
  186. package/dist/shared/agent/tool.runtime.js +4 -0
  187. package/dist/shared/agent/tool.runtime.js.map +1 -1
  188. package/dist/shared/agent/utility.tools.d.ts.map +1 -1
  189. package/dist/shared/agent/utility.tools.js.map +1 -1
  190. package/dist/shared/hyde/hyde.generator.d.ts.map +1 -1
  191. package/dist/shared/hyde/hyde.generator.js.map +1 -1
  192. package/dist/shared/hyde/hyde.graph.d.ts.map +1 -1
  193. package/dist/shared/hyde/hyde.graph.js.map +1 -1
  194. package/dist/shared/hyde/hyde.state.d.ts.map +1 -1
  195. package/dist/shared/hyde/hyde.state.js.map +1 -1
  196. package/dist/shared/hyde/hyde.strategies.d.ts.map +1 -1
  197. package/dist/shared/hyde/hyde.strategies.js.map +1 -1
  198. package/dist/shared/hyde/lens.inferrer.d.ts.map +1 -1
  199. package/dist/shared/hyde/lens.inferrer.js.map +1 -1
  200. package/dist/shared/interfaces/agent-dispatcher.interface.d.ts.map +1 -1
  201. package/dist/shared/interfaces/agent-dispatcher.interface.js.map +1 -1
  202. package/dist/shared/interfaces/agent.interface.d.ts.map +1 -1
  203. package/dist/shared/interfaces/agent.interface.js.map +1 -1
  204. package/dist/shared/interfaces/auth.interface.d.ts.map +1 -1
  205. package/dist/shared/interfaces/auth.interface.js.map +1 -1
  206. package/dist/shared/interfaces/cache.interface.d.ts.map +1 -1
  207. package/dist/shared/interfaces/cache.interface.js.map +1 -1
  208. package/dist/shared/interfaces/chat-message-writer.interface.d.ts.map +1 -1
  209. package/dist/shared/interfaces/chat-message-writer.interface.js.map +1 -1
  210. package/dist/shared/interfaces/chat-session.interface.d.ts.map +1 -1
  211. package/dist/shared/interfaces/chat-session.interface.js.map +1 -1
  212. package/dist/shared/interfaces/chat-summary.interface.d.ts.map +1 -1
  213. package/dist/shared/interfaces/chat-summary.interface.js.map +1 -1
  214. package/dist/shared/interfaces/connect-link.interface.d.ts.map +1 -1
  215. package/dist/shared/interfaces/connect-link.interface.js.map +1 -1
  216. package/dist/shared/interfaces/contact.interface.d.ts.map +1 -1
  217. package/dist/shared/interfaces/contact.interface.js.map +1 -1
  218. package/dist/shared/interfaces/database.interface.d.ts.map +1 -1
  219. package/dist/shared/interfaces/database.interface.js.map +1 -1
  220. package/dist/shared/interfaces/delivery-ledger.interface.d.ts.map +1 -1
  221. package/dist/shared/interfaces/delivery-ledger.interface.js.map +1 -1
  222. package/dist/shared/interfaces/discovery-run.interface.d.ts.map +1 -1
  223. package/dist/shared/interfaces/discovery-run.interface.js.map +1 -1
  224. package/dist/shared/interfaces/embedder.interface.d.ts.map +1 -1
  225. package/dist/shared/interfaces/embedder.interface.js.map +1 -1
  226. package/dist/shared/interfaces/enrichment.interface.d.ts.map +1 -1
  227. package/dist/shared/interfaces/enrichment.interface.js.map +1 -1
  228. package/dist/shared/interfaces/integration.interface.d.ts.map +1 -1
  229. package/dist/shared/interfaces/integration.interface.js.map +1 -1
  230. package/dist/shared/interfaces/negotiation-events.interface.d.ts.map +1 -1
  231. package/dist/shared/interfaces/negotiation-events.interface.js.map +1 -1
  232. package/dist/shared/interfaces/negotiation-summary.interface.d.ts.map +1 -1
  233. package/dist/shared/interfaces/negotiation-summary.interface.js.map +1 -1
  234. package/dist/shared/interfaces/question-generator.interface.d.ts.map +1 -1
  235. package/dist/shared/interfaces/question-generator.interface.js.map +1 -1
  236. package/dist/shared/interfaces/questioner.interface.d.ts.map +1 -1
  237. package/dist/shared/interfaces/questioner.interface.js.map +1 -1
  238. package/dist/shared/interfaces/queue.interface.d.ts.map +1 -1
  239. package/dist/shared/interfaces/queue.interface.js.map +1 -1
  240. package/dist/shared/interfaces/scraper.interface.d.ts.map +1 -1
  241. package/dist/shared/interfaces/scraper.interface.js.map +1 -1
  242. package/dist/shared/interfaces/storage.interface.d.ts.map +1 -1
  243. package/dist/shared/interfaces/storage.interface.js.map +1 -1
  244. package/dist/shared/network/metadata.renderer.d.ts.map +1 -1
  245. package/dist/shared/network/metadata.renderer.js.map +1 -1
  246. package/dist/shared/observability/debug-meta.sanitizer.d.ts.map +1 -1
  247. package/dist/shared/observability/debug-meta.sanitizer.js.map +1 -1
  248. package/dist/shared/observability/log.d.ts.map +1 -1
  249. package/dist/shared/observability/log.js.map +1 -1
  250. package/dist/shared/observability/performance.d.ts +7 -0
  251. package/dist/shared/observability/performance.d.ts.map +1 -1
  252. package/dist/shared/observability/performance.js +22 -10
  253. package/dist/shared/observability/performance.js.map +1 -1
  254. package/dist/shared/observability/protocol.logger.d.ts.map +1 -1
  255. package/dist/shared/observability/protocol.logger.js.map +1 -1
  256. package/dist/shared/observability/request-context.d.ts.map +1 -1
  257. package/dist/shared/observability/request-context.js.map +1 -1
  258. package/dist/shared/observability/trace.d.ts.map +1 -1
  259. package/dist/shared/observability/trace.js.map +1 -1
  260. package/dist/shared/schemas/chat-context.schema.d.ts.map +1 -1
  261. package/dist/shared/schemas/chat-context.schema.js.map +1 -1
  262. package/dist/shared/schemas/negotiation-digest.schema.d.ts.map +1 -1
  263. package/dist/shared/schemas/negotiation-digest.schema.js.map +1 -1
  264. package/dist/shared/schemas/pending-question.schema.d.ts.map +1 -1
  265. package/dist/shared/schemas/pending-question.schema.js.map +1 -1
  266. package/dist/shared/schemas/question.schema.d.ts.map +1 -1
  267. package/dist/shared/schemas/question.schema.js.map +1 -1
  268. package/dist/shared/ui/lucide.icon-catalog.d.ts.map +1 -1
  269. package/dist/shared/ui/lucide.icon-catalog.js.map +1 -1
  270. package/dist/shared/utils/social-label.d.ts.map +1 -1
  271. package/dist/shared/utils/social-label.js.map +1 -1
  272. package/dist/shared/utils/telegram-handle.d.ts.map +1 -1
  273. package/dist/shared/utils/telegram-handle.js.map +1 -1
  274. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"tool.factory.js","sourceRoot":"","sources":["../../../src/shared/agent/tool.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAG7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAC;AAC7F,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE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,EAAE,QAAQ,CAAC,CAAC;IAE9D,oFAAoF;IACpF,uCAAuC;IACvC,MAAM,6BAA6B,GAAG,IAAI,GAAG,CAAC;QAC5C,8BAA8B;KAC/B,CAAC,CAAC;IACH,MAAM,uBAAuB,GAAG,gBAAgB,CAAC,MAAM,CACrD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,6BAA6B,CAAC,GAAG,CAAE,CAAsB,CAAC,IAAI,CAAC,CACxE,CAAC;IAEF,OAAO;QACL,GAAG,YAAY;QACf,GAAG,WAAW;QACd,GAAG,YAAY;QACf,GAAG,uBAAuB;QAC1B,GAAG,YAAY;QACf,GAAG,gBAAgB;QACnB,GAAG,YAAY;QACf,GAAG,UAAU;QACb,GAAG,gBAAgB;QACnB,GAAG,YAAY;KAChB,CAAC;AACJ,CAAC","sourcesContent":["import { tool } from \"@langchain/core/tools\";\nimport { z } from \"zod\";\nimport type { HydeGraphDatabase, PremiseGraphDatabase } from \"../interfaces/database.interface.js\";\nimport { IntentGraphFactory } from \"../../intent/intent.graph.js\";\nimport { ProfileGraphFactory } from \"../../profile/profile.graph.js\";\nimport { OpportunityGraphFactory } from \"../../opportunity/opportunity.graph.js\";\nimport { HydeGraphFactory } from \"../hyde/hyde.graph.js\";\nimport { HydeGenerator } from \"../hyde/hyde.generator.js\";\nimport { LensInferrer } from \"../hyde/lens.inferrer.js\";\nimport { NetworkGraphFactory } from \"../../network/network.graph.js\";\nimport { NetworkMembershipGraphFactory } from \"../../network/membership/membership.graph.js\";\nimport { IntentNetworkGraphFactory } from \"../../network/indexer/indexer.graph.js\";\nimport { IntentIndexer } from \"../../intent/intent.indexer.js\";\nimport { NegotiationGraphFactory } from \"../../negotiation/negotiation.graph.js\";\nimport { PremiseGraphFactory } from \"../../premise/premise.graph.js\";\nimport { protocolLogger } from \"../observability/protocol.logger.js\";\nimport { configureProtocol } from \"./model.config.js\";\n\nimport type { QuestionerEnqueueFn } from \"../../questioner/questioner.types.js\";\n\nimport {\n type ToolContext,\n type ResolvedToolContext,\n type ToolDeps,\n resolveChatContext,\n} from \"./tool.helpers.js\";\nimport { error, redactSensitiveFields } from \"./tool.helpers.js\";\nimport { invokeToolRuntime, toolRuntimeErrorToResult } from \"./tool.runtime.js\";\nimport { createProfileTools } from \"../../profile/profile.tools.js\";\nimport { createIntentTools } from \"../../intent/intent.tools.js\";\nimport { createNetworkTools } from \"../../network/network.tools.js\";\nimport { createOpportunityTools } from \"../../opportunity/opportunity.tools.js\";\nimport { createUtilityTools } from \"./utility.tools.js\";\nimport { createIntegrationTools } from \"../../integration/integration.tools.js\";\nimport { createContactTools } from \"../../contact/contact.tools.js\";\nimport { createAgentTools } from \"../../agent/agent.tools.js\";\nimport { createNegotiationTools } from \"../../negotiation/negotiation.tools.js\";\nimport { createPremiseTools } from \"../../premise/premise.tools.js\";\n\n// Re-export types for consumers\nexport type { ToolContext, ResolvedToolContext, ProtocolDeps } from \"./tool.helpers.js\";\nexport type { ToolDeps } from \"./tool.helpers.js\";\n\nconst logger = protocolLogger(\"ChatTools\");\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// TOOL FACTORY\n// ═══════════════════════════════════════════════════════════════════════════════\n\n/**\n * Creates all chat tools bound to a specific user context.\n * Resolves user/index identity from DB at init time.\n * Tools are created fresh for each user session to ensure proper isolation.\n *\n * All external dependencies (cache, integration, queue, etc.) are provided\n * via the `deps` parameter — the protocol lib never imports concrete adapters.\n */\nexport async function createChatTools(\n deps: ToolContext,\n preResolvedContext?: ResolvedToolContext\n) {\n // Apply model config so all agents created in this session use the right credentials.\n if (deps.modelConfig) {\n configureProtocol(deps.modelConfig);\n }\n\n const { database, embedder, scraper } = deps;\n\n // ─── Resolve context from DB ───────────────────────────────────────────────\n const resolvedContext =\n preResolvedContext ??\n (await resolveChatContext({\n database,\n userId: deps.userId,\n networkId: deps.networkId,\n sessionId: deps.sessionId,\n }));\n\n // Allow callers (e.g. MCP server, tests) to override the computed indexScope\n // without going through a full re-resolve. The MCP path sets this via\n // applyNetworkScopeToContext; ToolContext.indexScope provides the same override\n // when no preResolvedContext is given.\n if (!preResolvedContext && deps.indexScope !== undefined) {\n resolvedContext.indexScope = deps.indexScope;\n }\n\n // ─── Tool wrapper ──────────────────────────────────────────────────────────\n /**\n * Standardized tool factory. Auto-injects resolved context and\n * provides uniform logging / error handling for every tool.\n */\n function defineTool<T extends z.ZodType>(opts: {\n name: string;\n description: string;\n querySchema: T;\n handler: (input: { context: ResolvedToolContext; query: z.infer<T> }) => Promise<string>;\n }) {\n return tool(\n async (query: z.infer<T>) => {\n logger.info(`Tool: ${opts.name}`, {\n context: { userId: resolvedContext.userId, networkId: resolvedContext.networkId },\n query: redactSensitiveFields(query),\n });\n try {\n return await invokeToolRuntime({\n toolName: opts.name,\n tool: { handler: async ({ context, query }) => opts.handler({ context, query: query as z.infer<T> }) },\n context: resolvedContext,\n query,\n });\n } catch (err) {\n logger.error(`${opts.name} failed`, {\n error: err instanceof Error ? err.message : String(err),\n });\n const runtimeResult = toolRuntimeErrorToResult(err);\n if (runtimeResult) return runtimeResult;\n const reason = err instanceof Error ? err.message : String(err);\n return error(`Failed to execute ${opts.name}: ${reason}`);\n }\n },\n { name: opts.name, description: opts.description, schema: opts.querySchema }\n );\n }\n\n // ─── Compile subgraphs ─────────────────────────────────────────────────────\n\n // Wrap questionerEnqueue to include session context when available\n const sessionAwareEnqueue: QuestionerEnqueueFn | undefined = deps.questionerEnqueue\n ? (input) => deps.questionerEnqueue!({\n ...input,\n ...(resolvedContext.sessionId && !input.conversationId ? { conversationId: resolvedContext.sessionId } : {}),\n })\n : undefined;\n\n const intentGraph = new IntentGraphFactory(database, embedder, deps.intentQueue, sessionAwareEnqueue).createGraph();\n const premiseGraph = new PremiseGraphFactory(database as unknown as PremiseGraphDatabase, embedder).createGraph();\n const profileGraph = new ProfileGraphFactory(database, scraper, deps.enricher, sessionAwareEnqueue, premiseGraph).createGraph();\n const hydeCache = deps.hydeCache;\n const lensInferrer = new LensInferrer();\n const hydeGenerator = new HydeGenerator();\n const compiledHydeGraph = new HydeGraphFactory(\n database as unknown as HydeGraphDatabase,\n embedder,\n hydeCache,\n lensInferrer,\n hydeGenerator\n ).createGraph();\n const negotiationGraph = deps.agentDispatcher\n ? new NegotiationGraphFactory(\n deps.negotiationDatabase,\n deps.agentDispatcher,\n deps.negotiationTimeoutQueue,\n sessionAwareEnqueue,\n ).createGraph()\n : undefined;\n const opportunityGraph = new OpportunityGraphFactory(\n database,\n embedder,\n compiledHydeGraph,\n undefined, // evaluator (default)\n undefined, // queueNotification\n negotiationGraph,\n deps.agentDispatcher,\n deps.queueNegotiateExisting,\n ).createGraph();\n const networkGraph = new NetworkGraphFactory(database).createGraph();\n const networkMembershipGraph = new NetworkMembershipGraphFactory(database).createGraph();\n const intentNetworkGraph = new IntentNetworkGraphFactory(database, new IntentIndexer()).createGraph();\n\n // ─── Create context-bound databases ────────────────────────────────────────\n // Use injected instances when provided (e.g. tests). Otherwise create from the same\n // database used for graphs so that scope checks (e.g. ensureScopedMembership, opportunity\n // update) use the same adapter as the rest of the tool pipeline.\n //\n // The systemDb's DB-level clamp uses `resolvedContext.indexScope` — the same\n // set tools see — so the JSDoc claim that indexScope is \"the same set used\n // to clamp the DB-level systemDb\" holds for both the MCP path (where the\n // MCP server already populated indexScope via applyNetworkScopeToContext)\n // and the web-chat path (where resolveChatContext clamps to [bound, personal]\n // when networkId is set).\n const userDb = deps.userDb ?? deps.createUserDatabase(database, resolvedContext.userId);\n const systemDb = deps.systemDb ?? deps.createSystemDatabase(database, resolvedContext.userId, resolvedContext.indexScope, embedder);\n\n // ─── Assemble dependencies ─────────────────────────────────────────────────\n const cache = deps.cache;\n const integration = deps.integration;\n const toolDeps: ToolDeps = {\n database,\n userDb,\n systemDb,\n scraper,\n embedder,\n cache,\n integration,\n contactService: deps.contactService,\n integrationImporter: deps.integrationImporter,\n enricher: deps.enricher,\n negotiationDatabase: deps.negotiationDatabase,\n negotiationTimeoutQueue: deps.negotiationTimeoutQueue,\n agentDatabase: deps.agentDatabase,\n grantDefaultSystemPermissions: deps.grantDefaultSystemPermissions,\n agentDispatcher: deps.agentDispatcher,\n deliveryLedger: deps.deliveryLedger,\n discoveryRuns: deps.discoveryRuns,\n discoveryRunQueue: deps.discoveryRunQueue,\n mintConnectToken: deps.mintConnectToken,\n mintConnectLink: deps.mintConnectLink,\n frontendUrl: deps.frontendUrl,\n apiBaseUrl: deps.apiBaseUrl,\n ...(deps.premiseEvents && { premiseEvents: deps.premiseEvents }),\n ...(deps.chatSummary && { chatSummary: deps.chatSummary }),\n ...(deps.questionGenerator && { questionGenerator: deps.questionGenerator }),\n ...(sessionAwareEnqueue && { questionerEnqueue: sessionAwareEnqueue }),\n ...(deps.negotiationSummary && { negotiationSummary: deps.negotiationSummary }),\n graphs: {\n profile: profileGraph,\n intent: intentGraph,\n index: networkGraph,\n networkMembership: networkMembershipGraph,\n intentIndex: intentNetworkGraph,\n opportunity: opportunityGraph,\n premise: premiseGraph,\n },\n };\n\n // ─── Create domain tools ──────────────────────────────────────────────────\n const profileTools = createProfileTools(defineTool, toolDeps);\n const intentTools = createIntentTools(defineTool, toolDeps);\n const networkTools = createNetworkTools(defineTool, toolDeps);\n const opportunityTools = createOpportunityTools(defineTool, toolDeps);\n const utilityTools = createUtilityTools(defineTool, toolDeps);\n const contactTools = createContactTools(defineTool, toolDeps);\n const agentTools = createAgentTools(defineTool, toolDeps);\n const integrationTools = createIntegrationTools(defineTool, toolDeps);\n const negotiationTools = deps.agentDispatcher\n ? createNegotiationTools(defineTool, toolDeps)\n : [];\n const premiseTools = createPremiseTools(defineTool, toolDeps);\n\n // confirm_opportunity_delivery is an OpenClaw-delivery ledger write and must not be\n // callable from regular chat sessions.\n const chatOpportunityToolExclusions = new Set([\n \"confirm_opportunity_delivery\",\n ]);\n const opportunityToolsForChat = opportunityTools.filter(\n (t) => !chatOpportunityToolExclusions.has((t as { name: string }).name)\n );\n\n return [\n ...profileTools,\n ...intentTools,\n ...networkTools,\n ...opportunityToolsForChat,\n ...utilityTools,\n ...integrationTools,\n ...contactTools,\n ...agentTools,\n ...negotiationTools,\n ...premiseTools,\n ];\n}\n\n/**\n * Type for the tools array returned by createChatTools.\n */\nexport type ChatTools = Awaited<ReturnType<typeof createChatTools>>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tool.helpers.d.ts","sourceRoot":"","sources":["../../../src/shared/agent/tool.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EACV,0BAA0B,EAC1B,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,cAAc,EACd,wBAAwB,EACzB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AAC7F,OAAO,KAAK,EAAE,wB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,OAAO,CAAC,KAAgC,CAAC,EAAE,CAAC;QAC5E,MAAM,UAAU,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACvD,IAAI,oBAAoB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YACzC,GAAG,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,GAAG,CAAC,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import { z } from \"zod\";\nimport type { ModelConfig } from \"./model.config.js\";\nimport type { ProfileDocument } from \"../../profile/profile.generator.js\";\nimport type {\n ChatGraphCompositeDatabase,\n NetworkMembership,\n UserRecord,\n UserDatabase,\n SystemDatabase,\n NegotiationGraphDatabase,\n} from \"../interfaces/database.interface.js\";\nimport type { Scraper } from \"../interfaces/scraper.interface.js\";\nimport type { Cache, HydeCache } from \"../interfaces/cache.interface.js\";\nimport type { CompiledOpportunityGraph } from \"../../opportunity/opportunity.discover.js\";\nimport type { IntegrationAdapter } from \"../interfaces/integration.interface.js\";\nimport type { ContactServiceAdapter } from \"../interfaces/contact.interface.js\";\nimport type { ProfileEnricher } from \"../interfaces/enrichment.interface.js\";\nimport type { IntentGraphQueue } from \"../interfaces/queue.interface.js\";\nimport type { ChatSessionReader } from \"../interfaces/chat-session.interface.js\";\nimport type { ChatSummaryReader } from \"../interfaces/chat-summary.interface.js\";\nimport type { ChatMessageWriter } from \"../interfaces/chat-message-writer.interface.js\";\nimport type { QuestionGeneratorReader } from \"../interfaces/question-generator.interface.js\";\nimport type { NegotiationSummaryReader } from \"../interfaces/negotiation-summary.interface.js\";\nimport type { Embedder } from \"../interfaces/embedder.interface.js\";\nimport type { AgentDatabase } from \"../interfaces/agent.interface.js\";\nimport type { NegotiationTimeoutQueue } from \"../interfaces/negotiation-events.interface.js\";\nimport type { AgentDispatcher } from \"../interfaces/agent-dispatcher.interface.js\";\nimport type { DeliveryLedger } from \"../interfaces/delivery-ledger.interface.js\";\nimport type { MintConnectLink } from \"../interfaces/connect-link.interface.js\";\nimport type { QuestionerDatabase } from \"../interfaces/questioner.interface.js\";\nimport type { QuestionerEnqueueFn } from \"../../questioner/questioner.types.js\";\nimport type { PendingQuestionSummary } from \"../schemas/pending-question.schema.js\";\nimport type { DiscoveryRunQueue, DiscoveryRunStore } from \"../interfaces/discovery-run.interface.js\";\n\nexport type ProfileContext = ProfileDocument | null;\n\nexport interface ToolErrorReport {\n operation: string;\n subsystem?: string;\n toolName?: string;\n userId?: string;\n tags?: Record<string, string | number | boolean | null | undefined>;\n context?: Record<string, unknown>;\n}\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// COMPILED GRAPH TYPE\n// ═══════════════════════════════════════════════════════════════════════════════\n\n/** Minimal interface for an invokable compiled LangGraph. */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type CompiledGraph = { invoke: (input: any) => Promise<any> };\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// TOOL CONTEXT TYPES\n// ═══════════════════════════════════════════════════════════════════════════════\n\n/**\n * Resolved context available to every tool handler.\n * Contains the current user and optional index identity, resolved from DB at init.\n * The LLM can see this context (via system prompt) but cannot change it.\n */\nexport interface ResolvedToolContext {\n // Legacy flat fields (kept for backwards compatibility in tools/prompts).\n userId: string;\n userName: string;\n userEmail: string;\n networkId?: string;\n indexName?: string;\n /** True when chat is index-scoped and the user owns the index. */\n isOwner?: boolean;\n // Rich identity context for prompt/tool orchestration.\n user: UserRecord;\n userProfile: ProfileContext;\n userNetworks: NetworkMembership[];\n /**\n * The set of index IDs this caller can reach in the current request.\n * For unscoped chats: every index the user is a member of.\n * For network-scoped agents: `[boundNetwork, personalIndex]`.\n * This is the same set used to clamp the DB-level systemDb.\n * Tools that filter intents/profiles default to this set; `networkId` is\n * the \"primary focus\" hint, not a read filter.\n */\n indexScope: string[];\n scopedIndex?: {\n id: string;\n title: string;\n prompt: string | null;\n type?: string;\n metadata?: Record<string, unknown>;\n permissions?: Record<string, unknown>;\n };\n scopedMembershipRole?: \"owner\" | \"member\";\n /** True when user has not completed onboarding (onboarding.completedAt is null). */\n isOnboarding: boolean;\n /** True when the user has a non-empty name. */\n hasName: boolean;\n /** Chat session ID when tools are used in a chat; used for draft opportunities (context.conversationId). */\n sessionId?: string;\n /** True when the request originates from an MCP transport (no interactive UI available). */\n isMcp?: boolean;\n /** Agent ID when the request originates from an API key linked to an agent. */\n agentId?: string;\n /**\n * Receiver's rendering surface declared by the MCP client via the\n * `x-index-surface` request header. `'telegram'` means the MCP response is\n * being rendered inside a Telegram chat; anything\n * else (including `undefined`) is treated as web. Forwarded into\n * `mintConnectLink` so the click-time redirect can branch.\n */\n clientSurface?: 'telegram' | 'web';\n}\n\n/**\n * Dependencies passed when creating tools for a user session.\n * Includes DB adapters, embedder, and scraper.\n *\n * Note: userDb and systemDb are optional inputs - if not provided, createChatTools\n * will create them internally from the chatDatabaseAdapter singleton.\n */\nexport interface ToolContext {\n userId: string;\n /** @deprecated Use userDb or systemDb instead. Kept for backwards compatibility. */\n database: ChatGraphCompositeDatabase;\n /** Context-bound database for accessing the authenticated user's own resources. Created internally if not provided. */\n userDb?: UserDatabase;\n /** Context-bound database for LLM/system operations on cross-user resources within shared indexes. Created internally if not provided. */\n systemDb?: SystemDatabase;\n embedder: Embedder;\n scraper: Scraper;\n /** When set, chat is scoped to this index; tools use it as default for read_intents and create_intent. */\n networkId?: string;\n /**\n * Optional override of the resolved `indexScope`. `resolveChatContext` always\n * computes `indexScope` from the user's memberships (clamped to [bound,\n * personal] when `networkId` is set). When the caller has already computed\n * a clamped scope — notably the MCP server, which clamps via\n * `applyNetworkScopeToContext` for network-scoped agents — passing it on\n * `ToolContext.indexScope` causes `createChatTools` (in tool.factory.ts) to\n * override `resolvedContext.indexScope` with this value rather than the\n * freshly computed one. See ResolvedToolContext.indexScope for the\n * resolved-side semantics.\n */\n indexScope?: string[];\n /** Chat session ID when creating tools for a chat; enables draft opportunities with context.conversationId. */\n sessionId?: string;\n\n // ─── Protocol-level dependencies (injected by composition root) ──────────\n /** General-purpose cache (e.g. for tool results). */\n cache: Cache;\n /** Dedicated cache for HyDE graph (may be same instance as cache). */\n hydeCache: HydeCache;\n /** External integration platform adapter (OAuth, tool actions). */\n integration: IntegrationAdapter;\n /** Queue for enqueuing follow-up intent processing (HyDE generation/deletion). */\n intentQueue: IntentGraphQueue;\n /** Contact management operations. */\n contactService: ContactServiceAdapter;\n /** Chat session reader for loading conversation history. */\n chatSession: ChatSessionReader;\n /** Read-through chat-session digest. Optional; consumers fall back to undefined `chatContext`. */\n chatSummary?: ChatSummaryReader;\n /** Writes user messages into the user's most-recent chat session (Slice 5 MCP elicitation). */\n chatMessageWriter?: ChatMessageWriter;\n /** Decision-question generator. Optional; consumers fall back to no `questions`. */\n questionGenerator?: QuestionGeneratorReader;\n /**\n * Optional async question enqueue callback. When provided, question generation\n * is dispatched asynchronously to the QuestionerQueue instead of running inline.\n * Injected by the composition root when QUESTIONER_ENABLED=true.\n */\n questionerEnqueue?: QuestionerEnqueueFn;\n /** Negotiation-digest summarizer. Optional; consumers fall back to deterministic digests. */\n negotiationSummary?: NegotiationSummaryReader;\n /** Profile enrichment from external data sources. */\n enricher: ProfileEnricher;\n /** Database adapter for negotiation/conversation operations. */\n negotiationDatabase: NegotiationGraphDatabase;\n /** Integration importer for bulk contact import from toolkits. */\n integrationImporter: {\n importContacts(userId: string, toolkit: string): Promise<{\n imported: number;\n skipped: number;\n newContacts: number;\n existingContacts: number;\n }>;\n };\n /** Factory for user-scoped database access. */\n createUserDatabase: (db: ChatGraphCompositeDatabase, userId: string) => UserDatabase;\n /** Factory for system-scoped database access. */\n createSystemDatabase: (db: ChatGraphCompositeDatabase, userId: string, indexScope: string[], embedder?: Embedder) => SystemDatabase;\n /** Optional runtime LLM config. Pass to override env vars for API key, model, etc. */\n modelConfig?: ModelConfig;\n /** Manages negotiation timeout jobs (optional — enables AI fallback on external agent timeout). */\n negotiationTimeoutQueue?: NegotiationTimeoutQueue;\n /** Agent registry database adapter (optional — absent when host does not support agents). */\n agentDatabase?: AgentDatabase;\n /** Grants the default system-agent permissions after onboarding (optional). */\n grantDefaultSystemPermissions?: (userId: string) => Promise<void>;\n /** Dispatcher for routing negotiation turns to personal agents (optional — falls back to system AI). */\n agentDispatcher?: AgentDispatcher;\n /** Enqueue a negotiate_existing job after introducer approval (optional). */\n queueNegotiateExisting?: (opportunityId: string, userId: string) => Promise<void>;\n /** Delivery ledger for committing opportunity delivery rows (optional — absent in chat context). */\n deliveryLedger?: DeliveryLedger;\n /** Persistence for async MCP discovery runs (optional — absent in non-MCP/test contexts). */\n discoveryRuns?: DiscoveryRunStore;\n /** Queue for async MCP discovery run execution (optional — absent in non-MCP/test contexts). */\n discoveryRunQueue?: DiscoveryRunQueue;\n /** Mints a short-lived connect token for opportunity accept links (optional — absent in non-MCP contexts). */\n mintConnectToken?: (userId: string, opportunityId: string) => Promise<string>;\n /** Mints (or reuses) a short connect link, snapshotting the greeting (optional — absent in non-MCP contexts). */\n mintConnectLink?: MintConnectLink;\n /** Frontend base URL for building profile links (e.g. https://index.network, optional). */\n frontendUrl?: string;\n /** API base URL for building opportunity accept links (e.g. https://protocol.index.network, optional). */\n apiBaseUrl?: string;\n /** Persistence for structured questions generated by the QuestionerAgent (optional). */\n questionerDatabase?: QuestionerDatabase;\n /** Optional host-side error reporter for swallowed protocol/tool errors. */\n reportToolError?: (error: unknown, report: ToolErrorReport) => void;\n /** Optional premise lifecycle event callbacks. Fired by premise tools after successful operations. */\n premiseEvents?: {\n onCreated?: (premiseId: string, userId: string) => void;\n onUpdated?: (premiseId: string, userId: string) => void;\n onRetracted?: (premiseId: string, userId: string) => void;\n };\n}\n\n/**\n * All external dependencies needed to initialize the protocol tool engine.\n * The host application (composition root) must provide concrete implementations.\n * This is the subset of ToolContext that is NOT per-request (no userId, indexId, sessionId).\n */\nexport type ProtocolDeps = Omit<ToolContext, 'userId' | 'indexId' | 'sessionId' | 'userDb' | 'systemDb'>;\n\n/**\n * Thrown when a requested chat scope is invalid for the authenticated user.\n * Controllers can map this to an HTTP status code.\n */\nexport class ChatContextAccessError extends Error {\n constructor(\n message: string,\n public readonly statusCode: number,\n public readonly code: \"USER_NOT_FOUND\" | \"INDEX_NOT_FOUND\" | \"INDEX_MEMBERSHIP_REQUIRED\"\n ) {\n super(message);\n this.name = \"ChatContextAccessError\";\n }\n}\n\n/**\n * Resolve the canonical context used by chat tools and system prompt.\n * This preloads user identity, profile, index memberships, and scoped index role.\n */\nexport async function resolveChatContext(params: {\n database: Pick<\n ChatGraphCompositeDatabase,\n \"getUser\" | \"getProfile\" | \"getNetworkMemberships\" | \"getNetworkMembership\" | \"getNetwork\" | \"isIndexOwner\" | \"isNetworkMember\"\n >;\n userId: string;\n networkId?: string;\n /** Chat session ID for draft opportunities (stored as context.conversationId). */\n sessionId?: string;\n}): Promise<ResolvedToolContext> {\n const { database, userId, networkId, sessionId } = params;\n\n const [user, rawProfile, userNetworks] = await Promise.all([\n database.getUser(userId),\n database.getProfile(userId),\n database.getNetworkMemberships(userId),\n ]);\n\n const userProfile: ProfileContext = rawProfile ?? null;\n\n if (!user) {\n throw new ChatContextAccessError(\n \"User not found\",\n 404,\n \"USER_NOT_FOUND\"\n );\n }\n\n let scopedIndex: ResolvedToolContext[\"scopedIndex\"] = undefined;\n let scopedMembershipRole: ResolvedToolContext[\"scopedMembershipRole\"] = undefined;\n let isOwner = false;\n let indexName: string | undefined;\n\n if (networkId) {\n const [index, isMember, owner] = await Promise.all([\n database.getNetwork(networkId),\n database.isNetworkMember(networkId, userId),\n database.isIndexOwner(networkId, userId),\n ]);\n\n if (!index) {\n throw new ChatContextAccessError(\n \"Index not found\",\n 404,\n \"INDEX_NOT_FOUND\"\n );\n }\n\n if (!isMember) {\n throw new ChatContextAccessError(\n \"You are not a member of this index\",\n 403,\n \"INDEX_MEMBERSHIP_REQUIRED\"\n );\n }\n\n let membership = userNetworks.find((m) => m.networkId === index.id);\n if (membership === undefined) {\n membership = (await database.getNetworkMembership(index.id, userId)) ?? undefined;\n }\n scopedIndex = {\n id: index.id,\n title: index.title,\n prompt: membership?.indexPrompt ?? null,\n type: index.type ?? 'community',\n metadata: index.metadata ?? {},\n permissions: index.permissions ?? {},\n };\n isOwner = owner;\n indexName = index.title;\n scopedMembershipRole = owner ? \"owner\" : \"member\";\n }\n\n const userName = user.name ?? \"Unknown\";\n const userEmail = user.email ?? \"\";\n const hasName = !!user.name?.trim();\n\n // When scoped to an index, clamp the caller's reach to [scopedIndex, personalIndex]\n // so the chat's data model matches its \"focus\" semantic: a chat scoped to a\n // community sees that community plus the user's personal index, not their\n // other unrelated memberships. Mirrors the MCP path's clamp for network-scoped\n // agents (see applyNetworkScopeToContext / computeAgentIndexScope).\n const indexScope = networkId\n ? userNetworks\n .filter((m) => m.networkId === networkId || m.isPersonal === true)\n .map((m) => m.networkId)\n : userNetworks.map((m) => m.networkId);\n\n return {\n userId,\n userName,\n userEmail,\n networkId,\n indexName,\n isOwner,\n user,\n userProfile,\n userNetworks,\n indexScope,\n scopedIndex,\n scopedMembershipRole,\n isOnboarding: !(user.onboarding?.completedAt),\n hasName,\n ...(sessionId !== undefined ? { sessionId } : {}),\n };\n}\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// DEFINE TOOL TYPE\n// ═══════════════════════════════════════════════════════════════════════════════\n\n/**\n * Type for the `defineTool` closure created in `createChatTools`.\n * Auto-injects resolved context and provides uniform logging / error handling.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DefineTool = <T extends z.ZodType>(opts: {\n name: string;\n description: string;\n querySchema: T;\n handler: (input: { context: ResolvedToolContext; query: z.infer<T> }) => Promise<string>;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n}) => any;\n\n/**\n * A raw tool definition before LangChain wrapping.\n * Used by the tool registry for direct HTTP invocation.\n */\nexport interface RawToolDefinition {\n name: string;\n description: string;\n schema: z.ZodType;\n handler: (input: { context: ResolvedToolContext; query: unknown }) => Promise<string>;\n}\n\n/**\n * Registry mapping tool names to their raw definitions.\n */\nexport type ToolRegistry = Map<string, RawToolDefinition>;\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// TOOL DEPENDENCIES\n// ═══════════════════════════════════════════════════════════════════════════════\n\n/**\n * Shared dependencies available to all tool domain factories.\n * Passed by `createChatTools` after compiling all subgraphs.\n */\nexport interface ToolDeps {\n /** @deprecated Use userDb or systemDb instead. Kept for backwards compatibility. */\n database: ChatGraphCompositeDatabase;\n /** Context-bound database for accessing the authenticated user's own resources. */\n userDb: UserDatabase;\n /** Context-bound database for LLM/system operations on cross-user resources within shared indexes. */\n systemDb: SystemDatabase;\n scraper: Scraper;\n embedder: import('../interfaces/embedder.interface.js').Embedder;\n cache: Cache;\n integration: IntegrationAdapter;\n contactService: ContactServiceAdapter;\n integrationImporter: {\n importContacts(userId: string, toolkit: string): Promise<{\n imported: number;\n skipped: number;\n newContacts: number;\n existingContacts: number;\n }>;\n };\n enricher: ProfileEnricher;\n /** Database adapter for negotiation/conversation operations. */\n negotiationDatabase: NegotiationGraphDatabase;\n /** Chat session reader for exposing the caller's past conversations as MCP tools. */\n chatSession?: ChatSessionReader;\n /** Read-through chat-session digest. Optional; consumers fall back to undefined `chatContext`. */\n chatSummary?: ChatSummaryReader;\n /** Writes user messages into the user's most-recent chat session (Slice 5 MCP elicitation). */\n chatMessageWriter?: ChatMessageWriter;\n /** Decision-question generator. Optional; consumers fall back to no `questions`. */\n questionGenerator?: QuestionGeneratorReader;\n /**\n * Optional async question enqueue callback. When provided, question generation\n * is dispatched asynchronously to the QuestionerQueue instead of running inline\n * via the `questionGenerator`. Injected by the composition root when\n * QUESTIONER_ENABLED=true.\n */\n questionerEnqueue?: QuestionerEnqueueFn;\n /**\n * Lookup pending questions for a user, optionally filtered by source.\n * Used by tools to attach contextually relevant questions to their results.\n * Injected by the composition root — absent when question delivery is disabled.\n */\n findPendingQuestions?: (\n userId: string,\n filters?: { sourceType?: string; sourceId?: string },\n ) => Promise<PendingQuestionSummary[]>;\n /** Negotiation-digest summarizer. Optional; consumers fall back to deterministic digests. */\n negotiationSummary?: NegotiationSummaryReader;\n /** Manages negotiation timeout jobs (optional — enables AI fallback on external agent timeout). */\n negotiationTimeoutQueue?: NegotiationTimeoutQueue;\n /** Agent registry database adapter (optional — absent when host does not support agents). */\n agentDatabase?: AgentDatabase;\n /** Grants the default system-agent permissions after onboarding (optional). */\n grantDefaultSystemPermissions?: (userId: string) => Promise<void>;\n /** Dispatcher for routing negotiation turns to personal agents (optional — falls back to system AI). */\n agentDispatcher?: AgentDispatcher;\n /** Delivery ledger for committing opportunity delivery rows (optional — absent in chat context). */\n deliveryLedger?: DeliveryLedger;\n /** Persistence for async MCP discovery runs (optional — absent in non-MCP/test contexts). */\n discoveryRuns?: DiscoveryRunStore;\n /** Queue for async MCP discovery run execution (optional — absent in non-MCP/test contexts). */\n discoveryRunQueue?: DiscoveryRunQueue;\n /** Mints a short-lived connect token for opportunity accept links (optional — absent in non-MCP contexts). */\n mintConnectToken?: (userId: string, opportunityId: string) => Promise<string>;\n /** Mints (or reuses) a short connect link, snapshotting the greeting (optional — absent in non-MCP contexts). */\n mintConnectLink?: MintConnectLink;\n /** Frontend base URL for building profile links (e.g. https://index.network, optional). */\n frontendUrl?: string;\n /** API base URL for building opportunity accept links (e.g. https://protocol.index.network, optional). */\n apiBaseUrl?: string;\n /** Optional host-side error reporter for swallowed protocol/tool errors. */\n reportToolError?: (error: unknown, report: ToolErrorReport) => void;\n /** Optional premise lifecycle event callbacks. Fired by premise tools after successful operations. */\n premiseEvents?: {\n onCreated?: (premiseId: string, userId: string) => void;\n onUpdated?: (premiseId: string, userId: string) => void;\n onRetracted?: (premiseId: string, userId: string) => void;\n };\n graphs: {\n profile: CompiledGraph;\n intent: CompiledGraph;\n index: CompiledGraph;\n networkMembership: CompiledGraph;\n intentIndex: CompiledGraph;\n opportunity: CompiledOpportunityGraph;\n premise: CompiledGraph;\n };\n}\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// TOOL RESULT HELPERS\n// ═══════════════════════════════════════════════════════════════════════════════\n\nexport function success<T>(data: T): string {\n return JSON.stringify({ success: true, data });\n}\n\nexport function error(\n message: string,\n debugSteps?: Array<{ step: string; detail?: string; data?: Record<string, unknown> }>\n): string {\n return JSON.stringify({\n success: false,\n error: message,\n ...(debugSteps?.length ? { debugSteps } : {}),\n });\n}\n\n/** Return needsClarification for missing required fields. */\nexport function needsClarification(params: {\n missingFields: string[];\n message: string;\n}): string {\n return JSON.stringify({\n success: false,\n needsClarification: true,\n ...params,\n });\n}\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// CONSTANTS & UTILITIES\n// ═══════════════════════════════════════════════════════════════════════════════\n\n/** Matches http/https URLs in text; captures full URL. */\nconst URL_IN_TEXT_REGEX = /https?:\\/\\/[^\\s\"'<>)\\]]+/gi;\n\n/**\n * Matches bare domain URLs without protocol (e.g. github.com/foo, www.example.com).\n * Requires at least a SLD.TLD pattern followed by optional path.\n * Negative lookbehind ensures we don't double-match URLs already caught by URL_IN_TEXT_REGEX.\n */\nconst BARE_URL_REGEX = /(?<!\\w:\\/\\/)(?<![/\\w])(?:www\\.)?[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.(?:com|org|net|io|dev|co|ai|app|xyz|me|info|gg|so|sh|cc|ly|fm|tv|to|tech|design|network|world|edu|gov|mil|int|us|uk|eu|de|fr|ca|au|jp|cn|in|br|nl|se|no|fi|dk|ch|at|be|it|es|pt|pl|cz|ru|kr|tw|hk|sg|nz|za|mx|ar|cl|id|ph|th|vn|my|ie)(?:\\/[^\\s\"'<>)\\]]*)?/gi;\n\n/** UUID v4 format: 8-4-4-4-12 hex chars (e.g. c2505011-2e45-426e-81dd-b9abb9b72023) */\nexport const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n/**\n * Resolves an array of network IDs to their display titles.\n * Skips any IDs that don't resolve (deleted or invalid networks).\n */\nexport async function resolveIndexNames(\n database: { getNetwork(id: string): Promise<{ id: string; title: string } | null> },\n networkIds: string[]\n): Promise<string[]> {\n if (networkIds.length === 0) return [];\n const results = await Promise.all(\n networkIds.map(id => database.getNetwork(id))\n );\n return results.filter(Boolean).map(idx => idx!.title);\n}\n\n/**\n * Normalize a URL string: if it lacks a protocol, prepend \"https://\".\n * Returns the normalized URL or null if the result is not a valid URL.\n */\nexport function normalizeUrl(raw: string): string | null {\n let url = raw.replace(/[.,;:!?)]+$/, \"\").trim();\n if (!/^https?:\\/\\//i.test(url)) {\n url = `https://${url}`;\n }\n try {\n new URL(url);\n return url;\n } catch {\n return null;\n }\n}\n\n/**\n * Extract unique, valid URLs from a string (e.g. user message or details).\n * Handles both full URLs (https://...) and bare domains (github.com/...).\n */\nexport function extractUrls(text: string): string[] {\n if (!text || typeof text !== \"string\") return [];\n\n const seen = new Set<string>();\n const out: string[] = [];\n\n // Pass 1: full protocol URLs\n const fullMatches = text.match(URL_IN_TEXT_REGEX) ?? [];\n for (const raw of fullMatches) {\n const url = normalizeUrl(raw);\n if (url && !seen.has(url)) {\n seen.add(url);\n out.push(url);\n }\n }\n\n // Pass 2: bare domain URLs (e.g. github.com/foo)\n const bareMatches = text.match(BARE_URL_REGEX) ?? [];\n for (const raw of bareMatches) {\n const url = normalizeUrl(raw);\n if (url && !seen.has(url)) {\n seen.add(url);\n out.push(url);\n }\n }\n\n return out;\n}\n\nconst SENSITIVE_FIELD_KEYS = new Set([\n \"secret\",\n \"webhooksecret\",\n \"password\",\n \"apikey\",\n \"token\",\n \"accesstoken\",\n \"refreshtoken\",\n \"privatekey\",\n \"authtoken\",\n \"bearertoken\",\n \"clientsecret\",\n]);\n\n/**\n * Recursively redacts sensitive field values from an arbitrary payload before\n * it is passed to a structured logger. Matches field names case-insensitively\n * and ignoring underscores, so `api_key`, `apiKey`, and `API_KEY` all match.\n * Non-sensitive fields are passed through unchanged. Never mutates the input —\n * returns a new value.\n *\n * Intended for structured-log redaction only. Do NOT use as a security\n * boundary for data in motion.\n *\n * @param value - Arbitrary JSON-like payload (query object, config blob, etc.)\n * @returns A new value with sensitive fields replaced by `\"[redacted]\"`.\n */\nexport function redactSensitiveFields(value: unknown): unknown {\n if (value === null || typeof value !== \"object\") return value;\n if (Array.isArray(value)) {\n return value.map((item) => redactSensitiveFields(item));\n }\n const out: Record<string, unknown> = {};\n for (const [key, inner] of Object.entries(value as Record<string, unknown>)) {\n const normalized = key.toLowerCase().replace(/_/g, \"\");\n if (SENSITIVE_FIELD_KEYS.has(normalized)) {\n out[key] = \"[redacted]\";\n } else {\n out[key] = redactSensitiveFields(inner);\n }\n }\n return out;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tool.registry.d.ts","sourceRoot":"","sources":["../../../src/shared/agent/tool.registry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmC,QAAQ,EAAqB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAkBpH;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,GAAG,YAAY,CA4D/D"}
1
+ {"version":3,"file":"tool.registry.d.ts","sourceRoot":"/","sources":["shared/agent/tool.registry.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmC,QAAQ,EAAqB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAkBpH;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,GAAG,YAAY,CA4D/D"}
@@ -1 +1 @@
1
- {"version":3,"file":"tool.registry.js","sourceRoot":"","sources":["../../../src/shared/agent/tool.registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,g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AAQ,CAAC;AAClB,CAAC","sourcesContent":["import { z } from 'zod';\n\nimport type { DefineTool, ResolvedToolContext, ToolDeps, RawToolDefinition, ToolRegistry } from './tool.helpers.js';\nimport { error, redactSensitiveFields } from './tool.helpers.js';\nimport { createProfileTools } from '../../profile/profile.tools.js';\nimport { createIntentTools } from '../../intent/intent.tools.js';\nimport { createNetworkTools } from '../../network/network.tools.js';\nimport { createOpportunityTools } from '../../opportunity/opportunity.tools.js';\nimport { createUtilityTools } from './utility.tools.js';\nimport { createIntegrationTools } from '../../integration/integration.tools.js';\nimport { createContactTools } from '../../contact/contact.tools.js';\nimport { createAgentTools } from '../../agent/agent.tools.js';\nimport { createNegotiationTools } from '../../negotiation/negotiation.tools.js';\nimport { createChatTools } from '../../chat/chat.tools.js';\nimport { createPremiseTools } from '../../premise/premise.tools.js';\nimport { protocolLogger } from '../observability/protocol.logger.js';\nimport { requestContext } from '../observability/request-context.js';\n\nconst logger = protocolLogger('ToolRegistry');\n\n/**\n * Creates a tool registry containing all tool handlers indexed by name.\n * Handlers are raw async functions (not LangChain tool() wrappers) that\n * accept { context, query } and return a JSON string.\n *\n * @param deps - Shared tool dependencies (graphs, database, embedder, etc.)\n * @param context - Resolved user context for this request.\n * @returns Map of tool name to raw tool definition.\n */\nexport function createToolRegistry(deps: ToolDeps): ToolRegistry {\n const registry: ToolRegistry = new Map();\n\n // defineTool that captures raw handlers into the registry\n function defineTool<T extends z.ZodType>(opts: {\n name: string;\n description: string;\n querySchema: T;\n handler: (input: { context: ResolvedToolContext; query: z.infer<T> }) => Promise<string>;\n }) {\n const entry: RawToolDefinition = {\n name: opts.name,\n description: opts.description,\n schema: opts.querySchema,\n handler: async (input: { context: ResolvedToolContext; query: unknown }) => {\n logger.verbose(`Tool: ${opts.name}`, {\n context: { userId: input.context.userId, networkId: input.context.networkId },\n query: redactSensitiveFields(input.query),\n });\n try {\n return await opts.handler({ context: input.context, query: input.query as z.infer<T> });\n } catch (err) {\n const abortSignal = requestContext.getStore()?.abortSignal;\n if (abortSignal?.aborted) {\n throw err;\n }\n logger.error(`${opts.name} failed`, {\n error: err instanceof Error ? err.message : String(err),\n });\n return error(`Failed to execute ${opts.name}: ${err instanceof Error ? err.message : String(err)}`);\n }\n },\n };\n\n registry.set(opts.name, entry);\n\n // Return a dummy — create*Tools functions collect return values into arrays,\n // but for the registry path we only need the side-effect on the Map.\n return null as unknown;\n }\n\n // Create all tool domains -- each one calls defineTool() which populates the registry.\n // The local defineTool is compatible with DefineTool (which returns any).\n const dt = defineTool as DefineTool;\n createProfileTools(dt, deps);\n createIntentTools(dt, deps);\n createNetworkTools(dt, deps);\n createOpportunityTools(dt, deps);\n createUtilityTools(dt, deps);\n createIntegrationTools(dt, deps);\n createContactTools(dt, deps);\n createAgentTools(dt, deps);\n createNegotiationTools(dt, deps);\n createPremiseTools(dt, deps);\n if (deps.chatSession) {\n createChatTools(dt, deps);\n }\n\n logger.verbose(`Tool registry created with ${registry.size} tools`);\n return registry;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tool.runtime.d.ts","sourceRoot":"","sources":["../../../src/shared/agent/tool.runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAGxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEhF,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,cAAc,GAAG,iBAAiB,CAAC;AAC3E,MAAM,MAAM,oBAAoB,GAAG,cAAc,GAAG,gBAAgB,GAAG,uBAAuB,CAAC;AAE/F,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,gBAAgB,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAA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B,IAAI,EAAE,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;IACzC,OAAO,EAAE,mBAAmB,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAgED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAoBxE;AAED,qBAAa,gBAAiB,SAAQ,KAAK;aAEvB,IAAI,EAAE,oBAAoB;aAE1B,QAAQ,EAAE,MAAM;aAChB,MAAM,EAAE,iBAAiB;gBAHzB,IAAI,EAAE,oBAAoB,EAC1C,OAAO,EAAE,MAAM,EACC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,iBAAiB;CAK5C;AAkCD,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,CAE1F;AA4ED,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAapE"}
@@ -1,3 +1,4 @@
1
+ import { timed } from "../observability/performance.js";
1
2
  import { requestContext } from "../observability/request-context.js";
2
3
  const FAST_TIMEOUT_MS = 10000;
3
4
  const BOUNDED_SLOW_TIMEOUT_MS = 45000;
@@ -113,6 +114,9 @@ function combineSignals(signals) {
113
114
  };
114
115
  }
115
116
  export async function invokeToolRuntime(input) {
117
+ return timed(`ToolRuntime.${input.toolName}`, () => invokeToolRuntimeInner(input));
118
+ }
119
+ async function invokeToolRuntimeInner(input) {
116
120
  const basePolicy = getToolTimeoutPolicy(input.toolName);
117
121
  const policy = {
118
122
  ...basePolicy,
@@ -1 +1 @@
1
- {"version":3,"file":"tool.runtime.js","sourceRoot":"","sources":["../../../src/shared/agent/tool.runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,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AAE,GAAG,CAAC,MAAM,CAAC,cAAc;SAC1C;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { timed } from \"../observability/performance.js\";\nimport type { TraceEmitter } from \"../observability/request-context.js\";\nimport { requestContext } from \"../observability/request-context.js\";\n\nimport type { RawToolDefinition, ResolvedToolContext } from \"./tool.helpers.js\";\n\nexport type ToolTimeoutClass = \"fast\" | \"bounded_slow\" | \"async_candidate\";\nexport type ToolRuntimeErrorCode = \"TOOL_TIMEOUT\" | \"TOOL_CANCELLED\" | \"TOOL_OUTPUT_TOO_LARGE\";\n\nexport interface ToolTimeoutPolicy {\n class: ToolTimeoutClass;\n timeoutMs: number;\n maxOutputBytes: number;\n}\n\nexport interface ToolInvocationRuntimeInput {\n toolName: string;\n tool: Pick<RawToolDefinition, \"handler\">;\n context: ResolvedToolContext;\n query: unknown;\n signal?: AbortSignal;\n traceEmitter?: TraceEmitter;\n timeoutMs?: number;\n maxOutputBytes?: number;\n}\n\nconst FAST_TIMEOUT_MS = 10_000;\nconst BOUNDED_SLOW_TIMEOUT_MS = 45_000;\nconst ASYNC_CANDIDATE_TIMEOUT_MS = 50_000;\nconst DEFAULT_MAX_OUTPUT_BYTES = 1_000_000;\n\nconst FAST_TOOLS = new Set([\n \"record_onboarding_privacy_consent\",\n \"create_intent_index\",\n \"delete_intent_index\",\n \"search_intents\",\n \"read_networks\",\n \"update_network\",\n \"create_network\",\n \"delete_network\",\n \"create_network_membership\",\n \"delete_network_membership\",\n \"confirm_opportunity_delivery\",\n \"read_docs\",\n \"get_discovery_run\",\n \"cancel_discovery_run\",\n \"remove_contact\",\n \"register_agent\",\n \"list_agents\",\n \"update_agent\",\n \"delete_agent\",\n \"grant_agent_permission\",\n \"revoke_agent_permission\",\n \"retract_premise\",\n]);\n\nconst ASYNC_CANDIDATE_TOOLS = new Set([\n \"read_user_profiles\",\n \"preview_user_profile\",\n \"create_user_profile\",\n \"create_intent\",\n \"update_intent\",\n \"discover_opportunities\",\n \"scrape_url\",\n \"import_gmail_contacts\",\n \"import_contacts\",\n \"respond_to_negotiation\",\n \"create_premise\",\n \"update_premise\",\n]);\n\nfunction parsePositiveIntEnv(name: string, fallback: number): number {\n const raw = process.env[name];\n if (!raw) return fallback;\n const parsed = Number.parseInt(raw, 10);\n return Number.isFinite(parsed) && parsed > 0 && parsed <= Number.MAX_SAFE_INTEGER\n ? parsed\n : fallback;\n}\n\nfunction toolNameEnv(toolName: string): string {\n return `MCP_TOOL_TIMEOUT_${toolName.toUpperCase().replace(/[^A-Z0-9]+/g, \"_\")}_MS`;\n}\n\nfunction toolNameOutputEnv(toolName: string): string {\n return `MCP_TOOL_MAX_OUTPUT_${toolName.toUpperCase().replace(/[^A-Z0-9]+/g, \"_\")}_BYTES`;\n}\n\nexport function getToolTimeoutPolicy(toolName: string): ToolTimeoutPolicy {\n const classification: ToolTimeoutClass = FAST_TOOLS.has(toolName)\n ? \"fast\"\n : ASYNC_CANDIDATE_TOOLS.has(toolName)\n ? \"async_candidate\"\n : \"bounded_slow\";\n\n const classDefault = classification === \"fast\"\n ? parsePositiveIntEnv(\"MCP_TOOL_TIMEOUT_FAST_MS\", FAST_TIMEOUT_MS)\n : classification === \"async_candidate\"\n ? parsePositiveIntEnv(\"MCP_TOOL_TIMEOUT_ASYNC_CANDIDATE_MS\", ASYNC_CANDIDATE_TIMEOUT_MS)\n : parsePositiveIntEnv(\"MCP_TOOL_TIMEOUT_BOUNDED_SLOW_MS\", BOUNDED_SLOW_TIMEOUT_MS);\n\n const defaultMaxOutputBytes = parsePositiveIntEnv(\"MCP_TOOL_MAX_OUTPUT_BYTES\", DEFAULT_MAX_OUTPUT_BYTES);\n\n return {\n class: classification,\n timeoutMs: parsePositiveIntEnv(toolNameEnv(toolName), classDefault),\n maxOutputBytes: parsePositiveIntEnv(toolNameOutputEnv(toolName), defaultMaxOutputBytes),\n };\n}\n\nexport class ToolRuntimeError extends Error {\n constructor(\n public readonly code: ToolRuntimeErrorCode,\n message: string,\n public readonly toolName: string,\n public readonly policy: ToolTimeoutPolicy,\n ) {\n super(message);\n this.name = \"ToolRuntimeError\";\n }\n}\n\nfunction combineSignals(signals: Array<AbortSignal | undefined>): {\n signal: AbortSignal;\n abort: (reason?: unknown) => void;\n cleanup: () => void;\n} {\n const controller = new AbortController();\n const listeners: Array<() => void> = [];\n\n for (const source of signals) {\n if (!source) continue;\n if (source.aborted) {\n controller.abort(source.reason);\n break;\n }\n const onAbort = () => {\n if (!controller.signal.aborted) controller.abort(source.reason);\n };\n source.addEventListener(\"abort\", onAbort, { once: true });\n listeners.push(() => source.removeEventListener(\"abort\", onAbort));\n }\n\n return {\n signal: controller.signal,\n abort: (reason?: unknown) => {\n if (!controller.signal.aborted) controller.abort(reason);\n },\n cleanup: () => {\n for (const cleanup of listeners) cleanup();\n },\n };\n}\n\nexport async function invokeToolRuntime(input: ToolInvocationRuntimeInput): Promise<string> {\n return timed(`ToolRuntime.${input.toolName}`, () => invokeToolRuntimeInner(input));\n}\n\nasync function invokeToolRuntimeInner(input: ToolInvocationRuntimeInput): Promise<string> {\n const basePolicy = getToolTimeoutPolicy(input.toolName);\n const policy = {\n ...basePolicy,\n ...(input.timeoutMs !== undefined ? { timeoutMs: input.timeoutMs } : {}),\n ...(input.maxOutputBytes !== undefined ? { maxOutputBytes: input.maxOutputBytes } : {}),\n };\n const inherited = requestContext.getStore();\n const combined = combineSignals([input.signal, inherited?.abortSignal]);\n let timedOut = false;\n const timer = setTimeout(() => {\n timedOut = true;\n combined.abort(new Error(`Tool ${input.toolName} timed out after ${policy.timeoutMs}ms`));\n }, policy.timeoutMs);\n\n let removeAbortListener = () => {};\n const abortPromise = new Promise<never>((_, reject) => {\n const onAbort = () => {\n const code: ToolRuntimeErrorCode = timedOut ? \"TOOL_TIMEOUT\" : \"TOOL_CANCELLED\";\n reject(new ToolRuntimeError(\n code,\n code === \"TOOL_TIMEOUT\"\n ? `Tool ${input.toolName} timed out after ${policy.timeoutMs}ms.`\n : `Tool ${input.toolName} was cancelled before it completed.`,\n input.toolName,\n policy,\n ));\n };\n combined.signal.addEventListener(\"abort\", onAbort, { once: true });\n removeAbortListener = () => combined.signal.removeEventListener(\"abort\", onAbort);\n });\n\n try {\n const run = () => input.tool.handler({ context: input.context, query: input.query });\n const toolPromise = requestContext.run(\n {\n ...inherited,\n abortSignal: combined.signal,\n traceEmitter: input.traceEmitter ?? inherited?.traceEmitter,\n },\n run,\n );\n const result = await Promise.race([toolPromise, abortPromise]);\n const outputBytes = new TextEncoder().encode(result).byteLength;\n if (outputBytes > policy.maxOutputBytes) {\n throw new ToolRuntimeError(\n \"TOOL_OUTPUT_TOO_LARGE\",\n `Tool ${input.toolName} returned ${outputBytes} bytes, exceeding the ${policy.maxOutputBytes} byte limit.`,\n input.toolName,\n policy,\n );\n }\n return result;\n } catch (err) {\n if (err instanceof ToolRuntimeError) throw err;\n if (combined.signal.aborted) {\n const code: ToolRuntimeErrorCode = timedOut ? \"TOOL_TIMEOUT\" : \"TOOL_CANCELLED\";\n throw new ToolRuntimeError(\n code,\n code === \"TOOL_TIMEOUT\"\n ? `Tool ${input.toolName} timed out after ${policy.timeoutMs}ms.`\n : `Tool ${input.toolName} was cancelled before it completed.`,\n input.toolName,\n policy,\n );\n }\n throw err;\n } finally {\n clearTimeout(timer);\n removeAbortListener();\n combined.cleanup();\n }\n}\n\nexport function toolRuntimeErrorToResult(err: unknown): string | null {\n if (!(err instanceof ToolRuntimeError)) return null;\n return JSON.stringify({\n success: false,\n code: err.code,\n error: err.message,\n data: {\n tool: err.toolName,\n timeoutClass: err.policy.class,\n timeoutMs: err.policy.timeoutMs,\n maxOutputBytes: err.policy.maxOutputBytes,\n },\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"utility.tools.d.ts","sourceRoot":"","sources":["../../../src/shared/agent/utility.tools.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG9D,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,uBAsSxE"}
1
+ {"version":3,"file":"utility.tools.d.ts","sourceRoot":"/","sources":["shared/agent/utility.tools.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG9D,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,uBAsSxE"}
@@ -1 +1 @@
1
- {"version":3,"file":"utility.tools.js","sourceRoot":"","sources":["../../../src/shared/agent/utility.tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAGrE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjE,MAAM,UAAU,kBAAkB,CAAC,UAAsB,EAAE,IAAc;IACvE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEzB,MAAM,SAAS,GAAG,UAAU,CAAC;QAC3B,IAAI,EAAE,YAAY;QAClB,WAAW,EACT,gHAAgH;YAChH,iGAAiG;YACjG,oBAAoB;YACpB,+IAA+I;YAC/I,yHAAyH;YACzH,kDAAkD;YAClD,wHAAwH;YACxH,wFAAwF;YACxF,yFAAyF;QAC3F,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;YACpB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6IAA6I,CAAC;YACvK,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sRAAsR,CAAC;SAClU,CAAC;QACF,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE;YAC9C,MAAM,aAAa,GAAG,YAAY,CAAC,KAAK,CAAC,GA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AuBqE;gBAEpF,OAAO,EAAE;;;;;;;;;;;;;;;8EAe6D;gBAEtE,QAAQ,EAAE;;;;;;;;;;;;;;;;;wEAiBsD;gBAEhE,QAAQ,EAAE;;;;;;;;;;;;;;uDAcqC;gBAE/C,SAAS,EAAE;;;;;;;;;;;;;;;;;2FAiBwE;gBAEnF,SAAS,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6EA8B0D;gBAErE,cAAc,EAAE;;;;;;;;;;;;;;;;;;4DAkBoC;gBAEpD,eAAe,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;iGAyBwE;aAC1F,CAAC;YAEF,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;gBACrG,IAAI,OAAO,EAAE,CAAC;oBACZ,OAAO,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBAC7D,CAAC;gBACD,iCAAiC;YACnC,CAAC;YAED,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACrD,OAAO,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QACvC,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAU,CAAC;AACxC,CAAC","sourcesContent":["import { z } from \"zod\";\n\nimport { requestContext } from \"../observability/request-context.js\";\n\nimport type { DefineTool, ToolDeps } from \"./tool.helpers.js\";\nimport { success, error, normalizeUrl } from \"./tool.helpers.js\";\n\nexport function createUtilityTools(defineTool: DefineTool, deps: ToolDeps) {\n const { scraper } = deps;\n\n const scrapeUrl = defineTool({\n name: \"scrape_url\",\n description:\n \"Extracts text content from a web URL — articles, LinkedIn/GitHub profiles, documentation, project pages, etc. \" +\n \"Returns the page's text content (up to 10,000 characters) for use in subsequent tool calls.\\n\\n\" +\n \"**When to use:**\\n\" +\n \"- Before create_intent: when the user shares a URL and wants to create an intent from it. Scrape first, then synthesize into a description.\\n\" +\n \"- Before create_user_profile or update_user_profile: when the user shares a profile URL to update their profile from.\\n\" +\n \"- When the user asks about content at a URL.\\n\\n\" +\n \"**URL format:** Bare domains work fine (e.g. 'github.com/user/repo') — protocol (https://) is added automatically.\\n\\n\" +\n \"**Returns:** `{ url, contentLength, content }`. Content is truncated at 10,000 chars. \" +\n \"Returns an error if the URL is unreachable, requires login, or has no extractable text.\",\n querySchema: z.object({\n url: z.string().describe(\"The URL to extract content from. Protocol is optional — 'github.com/user/repo', 'linkedin.com/in/name', and 'https://example.com' all work.\"),\n objective: z.string().optional().describe(\"Why you're scraping — guides content extraction for better results. Examples: 'User wants to create an intent from this project page', 'User wants to update their profile from this LinkedIn page', 'Extract key information about this company'. Omit for generic text extraction.\"),\n }),\n handler: async ({ context: _context, query }) => {\n const normalizedUrl = normalizeUrl(query.url);\n if (!normalizedUrl) {\n return error(\"Invalid URL format. Please provide a valid URL (e.g. 'github.com/user/repo' or 'https://example.com').\");\n }\n\n const content = await scraper.extractUrlContent(normalizedUrl, {\n objective: query.objective?.trim() || undefined,\n signal: requestContext.getStore()?.abortSignal,\n });\n\n if (!content) {\n return error(\"Couldn't extract content from that URL. It may be blocked, require login, or have no extractable text.\");\n }\n\n const truncatedContent = content.length > 10000\n ? content.substring(0, 10000) + \"\\n\\n[Content truncated...]\"\n : content;\n\n return success({\n url: normalizedUrl,\n contentLength: content.length,\n content: truncatedContent,\n });\n },\n });\n\n const readDocs = defineTool({\n name: \"read_docs\",\n description:\n \"Returns comprehensive documentation about the Index Network protocol — entity model, workflows, tool usage guidance, and domain concepts. \" +\n \"This is the primary way for an external agent to bootstrap understanding of the system.\\n\\n\" +\n \"**When to use:** Call this FIRST when starting a new session. MCP agents MUST call read_docs(topic='mcp_agent_guide') at the start of every conversation to learn proper output formatting and workflow rules.\\n\" +\n \"Also call when you need to understand:\\n\" +\n \"- What entities exist and how they relate (intents, indexes, opportunities, profiles, contacts)\\n\" +\n \"- The discovery workflow (how intents become opportunities)\\n\" +\n \"- Which tools to call in what order for common tasks\\n\" +\n \"- Authentication and API patterns\\n\\n\" +\n \"**Returns:** Markdown documentation. Pass `topic` to get a specific section, or omit for the full reference.\\n\\n\" +\n \"**Available topics:** 'entities', 'intents', 'opportunities', 'indexes', 'profiles', 'contacts', 'discovery', 'workflows', 'authentication', 'mcp_agent_guide'\",\n querySchema: z.object({\n topic: z.string().optional().describe(\"Narrow to a specific topic: 'entities', 'intents', 'opportunities', 'indexes', 'profiles', 'contacts', 'discovery', 'workflows', or 'authentication'. Omit to get the full documentation.\"),\n }),\n handler: async ({ context: _context, query }) => {\n const topic = query.topic?.trim().toLowerCase();\n\n const sections: Record<string, string> = {\n entities: `## Entity Model & Relationships\n\n- **Users**: People on the platform. Authenticated via API key (X-API-Key header) for MCP/external agents, or session-based (Better Auth) for the web app.\n- **Profiles**: A user's identity — name, bio, skills, interests, location, social links. Generated from account data or social URLs via enrichment. One profile per user.\n- **Indexes** (also called \"networks\"): Communities or groups where members share intents and discover opportunities. Each has a title, optional prompt (purpose description), join policy (anyone or invite_only), and an owner. The user's **personal index** (isPersonal=true) stores their contacts.\n- **Index Members**: Junction between Users and Indexes. Tracks permissions (owner, member, contact), join date, auto-assign setting, and optional member prompt.\n- **Intents**: Signals of interest/need — what a user is looking for (e.g. \"Looking for a React developer in Berlin\"). Each has a description (payload), summary, confidence score (0-1), inferenceType (explicit/implicit), source tracking, and vector embedding.\n- **IntentNetworks**: Many-to-many junction between Intents and Indexes. An intent can be in multiple indexes. Has a relevancyScore (0-1) indicating how well the intent fits the index's purpose.\n- **Opportunities**: Discovered connections between users based on complementary intents within shared indexes. Have actors with roles (introducer, party), status lifecycle, match reasoning, confidence score, and presentation data.\n- **Contacts**: People in a user's personal network, stored as index members with 'contact' permission on the personal index. Can be real users or ghost users (placeholder accounts enriched from public data).\n- **Ghost Users**: Placeholder accounts created for contacts who aren't on the platform yet. Enriched with public profile data (LinkedIn, GitHub) and participate in opportunity matching.\n\n### Key Relationships\n- Users → Profiles (1:1)\n- Users → Indexes (many:many via Index Members)\n- Users → Intents (1:many, user owns intents)\n- Intents → Indexes (many:many via IntentNetworks with relevancyScore)\n- Opportunities → Users (many:many via actors with roles)\n- Opportunities → Indexes (scoped to shared index context)\n- Contacts → Personal Index (stored as members with 'contact' permission)`,\n\n intents: `## Intent Lifecycle\n\nIntents are the core unit of discovery — they represent what users are seeking and drive semantic matching.\n\n1. **Creation** (create_intent): User describes what they're looking for. The system runs inference (extracting structured intents from free text) and verification (checking specificity, speech-act type). Returns a proposal for user approval.\n2. **Confidence & Classification**: Each intent gets a confidence score (0-1), inferenceType (explicit = user stated directly, implicit = system inferred), and speech act classification (commissive, directive, assertive).\n3. **Index Assignment**: After creation, the intent is automatically evaluated against all indexes the user belongs to. The index's prompt is used as criteria. Matching indexes get linked via IntentNetworks with a relevancyScore (0-1).\n4. **Discovery Trigger**: Creating an intent triggers background opportunity detection — the system searches for other users in shared indexes whose intents complement this one.\n5. **Source Tracking**: Intents track their origin via sourceType (file, integration, link, discovery_form, enrichment) and sourceId.\n6. **Update** (update_intent): Re-processes through inference/verification, recalculates embeddings and index assignments.\n7. **Archive** (delete_intent): Soft-deletes the intent. It stops participating in discovery but is not permanently removed.\n\n### Intent Best Practices\n- Be specific: \"Looking for a senior React developer for a 3-month contract in Berlin\" > \"Need a developer\"\n- One intent per need: don't combine multiple requests into one intent\n- Update rather than delete+create to preserve history`,\n\n opportunities: `## Opportunity Lifecycle\n\nOpportunities represent discovered connections between users — potential matches worth pursuing.\n\n1. **Detection** (discover_opportunities): The opportunity graph finds users whose intents semantically complement each other within shared indexes. Uses HyDE embeddings for retrieval and an LLM evaluator for scoring.\n2. **Roles**: Each opportunity assigns roles to actors:\n - **introducer**: The person who triggered the introduction (may be the system or another user)\n - **party**: The people being connected (typically 2)\n3. **Status Flow**: draft → pending → accepted/rejected/expired\n - **draft**: Created but not sent. Only the creator/introducer sees it.\n - **pending**: Sent to the other party. They're notified and can respond.\n - **accepted**: Both parties agreed to connect.\n - **rejected**: One party declined.\n - **expired**: Timed out without response.\n4. **Creation Modes**:\n - **Discovery**: Automatic — system finds matches based on intent overlap (discover_opportunities with searchQuery)\n - **Introduction**: Manual — a user introduces two specific people (discover_opportunities with partyUserIds + entities)\n - **Direct**: One-to-one — connect with a specific person (discover_opportunities with targetUserId)\n5. **Presentation**: Each opportunity includes personalized match reasoning, confidence score, and suggested next action.\n\n### Opportunity Workflow\n1. discover_opportunities(searchQuery=\"AI engineers\") → returns draft opportunity cards\n2. update_opportunity(opportunityId, status=\"pending\") → sends to other party\n3. Other party sees opportunity → calls update_opportunity(status=\"accepted\" or \"rejected\")`,\n\n indexes: `## Index Mechanics\n\nIndexes (also called \"networks\") are communities where members share what they're looking for and the system discovers connections between them.\n\n- **Purpose prompt**: Each index has an optional prompt describing its purpose (e.g. \"AI/ML co-founders in Berlin\"). This prompt is used by the intent indexer to evaluate whether an intent belongs in this community. Indexes without prompts accept all intents (relevancyScore defaults to 1.0).\n- **Join policy**: \"anyone\" (open — any user can self-join) or \"invite_only\" (only the owner can add members).\n- **Personal index**: Each user has exactly one personal index (isPersonal=true) created on registration. It stores their contacts. Cannot be deleted, renamed, or listed publicly.\n- **Membership**: Members can see all intents in the index. The **auto-assign** setting on a membership means new intents by that user are automatically evaluated against the index.\n- **Owner permissions**: Index owners can update settings (title, prompt, joinPolicy), add/remove members, and delete the index (if sole member).\n- **Discovery scope**: Opportunities are discovered within index boundaries — the system matches intents of members who share at least one index.\n\n### Index Workflow\n1. create_network(title, prompt) → creates new community, you become owner\n2. create_network_membership(networkId, userId) → invite members\n3. Members create intents → auto-assigned to the index based on prompt\n4. discover_opportunities(networkId) → discover matches within this community`,\n\n profiles: `## Profile System\n\nProfiles are the user's identity on the platform, used for semantic matching in opportunity discovery.\n\n- **Structure**: name, bio, location, skills[], interests[], social links (LinkedIn, GitHub, Twitter, websites)\n- **Generation**: Auto-generated from account data (name, email, social links) via web enrichment. Can also be created from explicit user input (bioOrDescription).\n- **Enrichment**: The system scrapes public profiles (LinkedIn, GitHub, Twitter) to build a rich identity with skills, interests, and narrative context.\n- **Embeddings**: HyDE (Hypothetical Document Embedding) generates synthetic documents for semantic matching:\n - Mirror: self-description of the person\n - Reciprocal: what this person would look for in others\n - Neighborhood: related community context\n- **Onboarding flow**: create_user_profile() → preview → create_user_profile(confirm=true) → complete_onboarding()\n- **Updates**: Use update_user_profile for targeted changes, create_user_profile for full regeneration.\n\n### Profile Best Practices\n- Richer profiles produce better opportunity matches\n- Social links enable enrichment — encourage users to add LinkedIn/GitHub\n- Profiles are recalculated when updated, which may surface new matches`,\n\n contacts: `## Contact Management\n\nContacts are people in a user's personal network, stored as members of their personal index with 'contact' permission.\n\n- **Adding contacts**: Via import_contacts (bulk), add_contact (single email), or import_gmail_contacts (Google integration).\n- **Ghost users**: When a contact email doesn't match an existing account, a ghost user is created. Ghost users are enriched with public profile data and participate in opportunity matching — they can be discovered even before joining the platform.\n- **Personal index scope**: Pass the personal index networkId to discover_opportunities to scope discovery to just the user's contacts.\n- **Contact data**: Each contact has userId, name, email, avatar, and isGhost flag.\n\n### Contact Workflow\n1. import_contacts or import_gmail_contacts → bulk add to network\n2. list_contacts → view all contacts with userId\n3. discover_opportunities(networkId=personalIndexId) → find matches among contacts\n4. add_contact(email) → add individual contact\n5. remove_contact(contactUserId) → remove from network`,\n\n discovery: `## Discovery Mechanics\n\nDiscovery is the process of finding meaningful connections between users based on their intents and profiles.\n\n### How Discovery Works\n1. **Trigger**: Runs automatically when an intent is created, or explicitly when discover_opportunities is called.\n2. **Pipeline**: Preparation (gather user context) → Scope (determine which indexes to search) → Candidate retrieval (semantic matching via HyDE embeddings) → Evaluation (LLM scores relevance and complementarity) → Ranking → Persist as opportunities.\n3. **Semantic matching**: Uses HyDE (Hypothetical Document Embeddings) to find candidate intents that complement the source. This goes beyond keyword matching — it understands conceptual relationships.\n4. **Evaluation**: An LLM evaluator agent scores each candidate match on relevance, complementarity, and actionability. Low-scoring matches are filtered out.\n5. **Results**: Persisted as draft opportunities with roles, reasoning, and confidence scores.\n6. **Background processing**: After intent creation, a queue job continues looking for matches asynchronously.\n7. **Pagination**: Large result sets are paginated. Use continueFrom with the discoveryId to evaluate more candidates.\n\n### Discovery Best Practices\n- More specific intents produce more relevant matches\n- Richer profiles improve matching quality\n- Scope to a specific index (networkId) for more targeted results\n- After discovery returns no results, suggest creating an intent to attract future matches`,\n\n workflows: `## Common Tool Workflows\n\n### New User Setup\n1. create_user_profile(linkedinUrl/githubUrl) → generate profile from social data\n2. complete_onboarding() → unlock full access\n3. read_networks() → see available communities\n4. create_network_membership(networkId) → join a community\n5. create_intent(description) → post what you're looking for\n6. discover_opportunities(searchQuery) → find matches\n\n### Finding Connections\n1. read_networks() → list user's communities (get networkId)\n2. discover_opportunities(searchQuery, networkId) → discover matches\n3. Review opportunity cards → update_opportunity(opportunityId, status=\"pending\") to send\n\n### Making an Introduction\n1. read_network_memberships(networkId) → find members in shared community\n2. read_user_profiles(userId) → get profiles of both parties\n3. read_intents(networkId, userId) → get intents of both parties\n4. discover_opportunities(partyUserIds=[id1,id2], entities=[...], hint=\"reason\") → create introduction\n\n### Managing Contacts\n1. import_gmail_contacts() or import_contacts([...]) → add contacts\n2. list_contacts() → view network\n3. discover_opportunities(networkId=personalIndexId) → find matches among contacts\n\n### Creating a Community\n1. create_network(title, prompt) → create index\n2. create_network_membership(networkId, userId) → invite members\n3. Members create intents → auto-indexed\n4. discover_opportunities(networkId) → discover connections within community`,\n\n authentication: `## Authentication & API Access\n\n### For External AI Agents (MCP)\n- Authenticate via **X-API-Key** header with a valid API key\n- The API key is tied to a specific user account\n- All operations execute in the context of the authenticated user\n- Base URL: protocol.index.network/mcp\n\n### Key Constraints\n- Users can only read their own intents globally, or intents in indexes they belong to\n- Users can only read profiles of people in shared indexes\n- Index-scoped operations are restricted to that index\n- Personal indexes cannot be deleted or renamed\n- Only index owners can update settings, add/remove members (for invite_only indexes)\n\n### Rate Limits & Best Practices\n- Avoid unnecessary read_intents/read_networks calls — cache results within a conversation\n- Use pagination (limit/page) for large result sets\n- Call read_docs once at the start to understand the domain`,\n\n mcp_agent_guide: `## MCP Agent Integration Guide\n\n**IMPORTANT: Read this section if you are an AI agent accessing Index Network via MCP tools.**\n\n### Output Formatting\n- Tool results often contain structured JSON data (proposals, opportunities, cards). **Do NOT dump raw JSON to the user.** Parse the JSON and present information in natural language with clear formatting.\n- Some tool results contain interactive card markup (code blocks with \\`intent_proposal\\`, \\`opportunity_card\\` language tags). These are designed for the Index Network web UI. **As an MCP agent, ignore card markup.** Instead, extract the meaningful data from the JSON and present it conversationally.\n- When presenting opportunities or intents, use bullet points or short paragraphs — not raw JSON objects.\n\n### Intent Creation Workflow\n- **Always pass \\`autoApprove: true\\` when calling \\`create_intent\\`.** This persists intents directly without returning proposal cards that require manual UI approval.\n- The tool will return a list of created intents with their descriptions and confidence scores. Present these in natural language.\n- Do not tell the user to \"click on cards\" or \"approve above\" — there is no UI. Intents are created immediately with autoApprove.\n- After creating intents, proactively suggest or run discovery to find matches.\n\n### Discovery Workflow\n- After creating intents, proactively suggest running discovery: \\`discover_opportunities(searchQuery=...)\\`\n- Present discovered opportunities in natural language with the counterpart's name, match reasoning, and suggested next steps.\n- Do not reference \"cards\", \"panels\", or any web UI elements.\n\n### General MCP Agent Rules\n- You are operating via API tools, not a web interface. Never reference clicking, scrolling, cards, panels, or any visual UI elements.\n- Be proactive: if a logical next step exists (e.g., running discovery after creating intents), suggest or execute it.\n- Use \\`list_opportunities\\` to check existing matches, \\`list_negotiations\\` for ongoing negotiations.\n- Use \\`read_networks\\` to understand which communities the user belongs to before scoping operations.\n- When errors occur, provide clear technical context rather than vague \"backend issue\" messages.`,\n };\n\n if (topic) {\n const matched = Object.entries(sections).find(([key]) => key.includes(topic) || topic.includes(key));\n if (matched) {\n return success({ topic: matched[0], content: matched[1] });\n }\n // If topic not found, return all\n }\n\n const fullDoc = Object.values(sections).join(\"\\n\\n\");\n return success({ content: fullDoc });\n },\n });\n\n return [scrapeUrl, readDocs] as const;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"hyde.generator.d.ts","sourceRoot":"","sources":["../../../src/shared/hyde/hyde.generator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AA0B3D,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAEV;IAEH;;;;;OAKG;IAEG,QAAQ,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAoBvE"}
1
+ {"version":3,"file":"hyde.generator.d.ts","sourceRoot":"/","sources":["shared/hyde/hyde.generator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AA0B3D,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED;;;GAG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M,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,oBAAoB,EAAE,CAAC;SACpB,MAAM,EAAE;SACR,QAAQ,CAAC,0FAA0F,CAAC;CACxG,CAAC,CAAC;AAEH,MAAM,KAAK,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;AAe3C;;;GAGG;AACH,MAAM,OAAO,aAAa;IAA1B;QACU,UAAK,GAAG,KAAK,CAAC,oBAAoB,CAAC,cAAc,EAAE;YACzD,IAAI,EAAE,gBAAgB;SACvB,CAAC,CAAC;IA6BL,CAAC;IA3BC;;;;;OAKG;IAEG,AAAN,KAAK,CAAC,QAAQ,CAAC,KAAwB;QACrC,MAAM,UAAU,GAAG,mBAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAEnF,MAAM,QAAQ,GAAG;YACf,IAAI,aAAa,CAAC,aAAa,CAAC;YAChC,IAAI,YAAY,CAAC,UAAU,CAAC;SAC7B,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACjE,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC5C,MAAM,IAAI,GAAG,MAAM,CAAC,oBAAoB,IAAI,EAAE,CAAC;QAE/C,MAAM,CAAC,OAAO,CAAC,yBAAyB,EAAE;YACxC,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,UAAU,EAAE,IAAI,CAAC,MAAM;SACxB,CAAC,CAAC;QAEH,OAAO,EAAE,IAAI,EAAE,CAAC;IAClB,CAAC;CACF;AApBO;IADL,KAAK,EAAE;;;;6CAoBP","sourcesContent":["/**\n * HyDE Generator Agent: pure LLM agent for generating hypothetical documents\n * in the target corpus voice. Uses free-text lens labels instead of enum strategies.\n */\nimport { HumanMessage, SystemMessage } from '@langchain/core/messages';\nimport { z } from 'zod';\nimport { HYDE_CORPUS_PROMPTS } from './hyde.strategies.js';\nimport type { HydeTargetCorpus } from './lens.inferrer.js';\nimport { Timed } from \"../observability/performance.js\";\nimport { protocolLogger } from '../observability/protocol.logger.js';\nimport { createModel } from \"../agent/model.config.js\";\nimport { invokeWithAbortSignal } from \"../agent/model-signal.js\";\n\nconst logger = protocolLogger(\"HydeGenerator\");\n\nconst SYSTEM_PROMPT = `You are a Hypothetical Document Generator for semantic search.\n\nYour task: Given a source statement (e.g. an intent or goal), write a short hypothetical document in the voice of the TARGET side—the kind of person or statement that would be an ideal match for that source.\n\nRules:\n- Write in first person as the target.\n- Be concrete and specific so the text is good for vector similarity search.\n- Output only the hypothetical document text, no meta-commentary.\n- Keep length to a few sentences or one short paragraph.`;\n\nconst responseFormat = z.object({\n hypotheticalDocument: z\n .string()\n .describe('The hypothetical document text in the target voice, suitable for embedding and retrieval'),\n});\n\nconst model = createModel(\"hydeGenerator\");\n\nexport interface HydeGeneratorOutput {\n text: string;\n}\n\nexport interface HydeGenerateInput {\n /** Original intent or query text. */\n sourceText: string;\n /** Free-text lens label from LensInferrer (e.g. \"crypto infra VC\"). */\n lens: string;\n /** Which corpus voice to generate in. */\n corpus: HydeTargetCorpus;\n}\n\n/**\n * Generates hypothetical documents in a target corpus voice for semantic search.\n * Uses free-text lens labels (from LensInferrer) instead of enum strategies.\n */\nexport class HydeGenerator {\n private model = model.withStructuredOutput(responseFormat, {\n name: \"hyde_generator\",\n });\n\n /**\n * Generate a hypothetical document for the given source text and lens.\n *\n * @param input - Source text, lens label, and target corpus\n * @returns Generated hypothetical document text\n */\n @Timed()\n async generate(input: HydeGenerateInput): Promise<HydeGeneratorOutput> {\n const promptText = HYDE_CORPUS_PROMPTS[input.corpus](input.sourceText, input.lens);\n\n const messages = [\n new SystemMessage(SYSTEM_PROMPT),\n new HumanMessage(promptText),\n ];\n\n const result = await invokeWithAbortSignal(this.model, messages);\n const parsed = responseFormat.parse(result);\n const text = parsed.hypotheticalDocument ?? '';\n\n logger.verbose('Generated HyDE document', {\n lens: input.lens,\n corpus: input.corpus,\n textLength: text.length,\n });\n\n return { text };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"hyde.graph.d.ts","sourceRoot":"","sources":["../../../src/shared/hyde/hyde.graph.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAKlE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAyBzE;;;GAGG;AACH,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,SAAS;gBAJT,QAAQ,EAAE,iBAAiB,EAC3B,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,aAAa;IAGlC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoOZ"}
1
+ {"version":3,"file":"hyde.graph.d.ts","sourceRoot":"/","sources":["shared/hyde/hyde.graph.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,E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c,EAAE,aAAa,CAAC;aACtC,mBAAmB,CAAC,aAAa,EAAE,cAAc,EAAE;YAClD,QAAQ,EAAE,kBAAkB;YAC5B,IAAI,EAAE,OAAO;SACd,CAAC;aACD,OAAO,CAAC,kBAAkB,EAAE,OAAO,CAAC;aACpC,OAAO,CAAC,OAAO,EAAE,eAAe,CAAC;aACjC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;QAEjC,OAAO,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;CACF","sourcesContent":["/**\n * HyDE Graph: cache-aware hypothetical document generation with lens inference.\n *\n * Flow: infer_lenses → check_cache → (generate_missing if needed) → embed → cache_results.\n * Constructor injects Database, Embedder, Cache, LensInferrer, HydeGenerator.\n */\n\nimport { StateGraph, START, END } from '@langchain/langgraph';\nimport { createHash } from 'crypto';\n\nimport { getAbortSignalConfig } from '../agent/model-signal.js';\nimport { HydeGraphState, type HydeDocumentState } from './hyde.state.js';\nimport { LensInferrer } from './lens.inferrer.js';\nimport { HydeGenerator } from './hyde.generator.js';\nimport type { HydeGraphDatabase } from '../interfaces/database.interface.js';\nimport type { EmbeddingGenerator } from '../interfaces/embedder.interface.js';\nimport type { HydeCache } from '../interfaces/cache.interface.js';\nimport { HYDE_DEFAULT_CACHE_TTL } from './hyde.strategies.js';\nimport { protocolLogger } from '../observability/protocol.logger.js';\nimport { timed } from '../observability/performance.js';\nimport { requestContext } from \"../observability/request-context.js\";\nimport type { DebugMetaAgent } from '../../chat/chat-streaming.types.js';\n\nconst logger = protocolLogger(\"HyDEGraphFactory\");\n\n/** Hash a lens label (+ optional corpus) to a short key for cache/DB indexing. */\nfunction lensHash(label: string, corpus?: string): string {\n const input = corpus\n ? `${label.toLowerCase().trim()}:${corpus}`\n : label.toLowerCase().trim();\n return createHash('sha256').update(input).digest('hex').slice(0, 16);\n}\n\n/** Build cache key for a specific lens. */\nfunction cacheKey(\n sourceType: string,\n sourceId: string | undefined,\n sourceText: string,\n lens: string,\n corpus?: string,\n): string {\n const entityKey =\n sourceId ?? `q:${createHash('sha256').update(sourceText).digest('hex').slice(0, 16)}`;\n return `hyde:${sourceType}:${entityKey}:${lensHash(lens, corpus)}`;\n}\n\n/**\n * Factory for the HyDE generation graph.\n * Injects Database, Embedder, Cache, LensInferrer, and HydeGenerator.\n */\nexport class HydeGraphFactory {\n constructor(\n private database: HydeGraphDatabase,\n private embedder: EmbeddingGenerator,\n private cache: HydeCache,\n private inferrer: LensInferrer,\n private generator: HydeGenerator,\n ) {}\n\n createGraph() {\n const self = this;\n\n /** Node 1: Infer lenses from source text + optional profile context. */\n const inferLensesNode = async (state: typeof HydeGraphState.State) => {\n return timed(\"HydeGraph.inferLenses\", async () => {\n const { sourceText, profileContext, maxLenses } = state;\n\n logger.verbose('Inferring lenses', { sourceTextLength: sourceText.length, hasProfileContext: !!profileContext });\n\n const agentTimingsAccum: DebugMetaAgent[] = [];\n\n try {\n const _traceEmitterLens = requestContext.getStore()?.traceEmitter;\n const inferrerStart = Date.now();\n _traceEmitterLens?.({ type: \"agent_start\", name: \"lens-inferrer\" });\n const result = await self.inferrer.infer({\n sourceText,\n profileContext,\n maxLenses,\n });\n agentTimingsAccum.push({ name: 'lens.inferrer', durationMs: Date.now() - inferrerStart });\n _traceEmitterLens?.({ type: \"agent_end\", name: \"lens-inferrer\", durationMs: Date.now() - inferrerStart, summary: result.lenses.length > 0 ? `Inferred ${result.lenses.length} lens(es)` : \"lens-inferrer completed\" });\n\n logger.verbose('Lenses inferred', {\n count: result.lenses.length,\n lenses: result.lenses.map(l => ({ label: l.label, corpus: l.corpus })),\n });\n\n return { lenses: result.lenses, agentTimings: agentTimingsAccum };\n } catch (error) {\n logger.error('Lens inference failed in graph node', { error });\n return { lenses: [], agentTimings: agentTimingsAccum };\n }\n });\n };\n\n /** Node 2: Check cache/DB for existing HyDE docs matching inferred lenses. */\n const checkCacheNode = async (state: typeof HydeGraphState.State) => {\n return timed(\"HydeGraph.checkCache\", async () => {\n const { sourceType, sourceId, sourceText, lenses, forceRegenerate } = state;\n\n if (forceRegenerate) {\n logger.verbose('Force regenerate - skipping cache');\n return { hydeDocuments: {} };\n }\n\n const cached: Record<string, HydeDocumentState> = {};\n\n for (const lens of lenses) {\n const key = cacheKey(sourceType, sourceId ?? undefined, sourceText, lens.label, lens.corpus);\n\n const fromCache = await self.cache.get<HydeDocumentState>(key);\n if (fromCache?.hydeText && fromCache.hydeEmbedding?.length) {\n logger.verbose('Cache hit', { lens: lens.label });\n cached[lens.label] = fromCache;\n continue;\n }\n\n // For entity sources, check DB for persisted docs\n if (sourceId) {\n const fromDb = await self.database.getHydeDocument(\n sourceType,\n sourceId,\n lensHash(lens.label, lens.corpus),\n );\n if (fromDb) {\n logger.verbose('DB hit', { lens: lens.label });\n cached[lens.label] = {\n lens: lens.label,\n targetCorpus: fromDb.targetCorpus as 'profiles' | 'intents',\n hydeText: fromDb.hydeText,\n hydeEmbedding: fromDb.hydeEmbedding,\n };\n }\n }\n }\n\n logger.verbose('Check cache done', {\n found: Object.keys(cached).length,\n requested: lenses.length,\n });\n return { hydeDocuments: cached };\n });\n };\n\n /** Conditional: decide whether to generate or skip to embed. */\n const shouldGenerate = (state: typeof HydeGraphState.State): string => {\n const { lenses, hydeDocuments } = state;\n const missing = lenses.filter((l) => !hydeDocuments[l.label]);\n if (missing.length > 0) {\n logger.verbose('Need to generate', { missing: missing.map(l => l.label) });\n return 'generate';\n }\n logger.verbose('All lenses cached, skipping generation');\n return 'skip';\n };\n\n /** Node 3: Generate HyDE documents for lenses not in cache. */\n const generateMissingNode = async (state: typeof HydeGraphState.State) => {\n return timed(\"HydeGraph.generateMissing\", async () => {\n const { sourceText, lenses, hydeDocuments } = state;\n const missing = lenses.filter((l) => !hydeDocuments[l.label]);\n\n logger.verbose('Generating HyDE documents', {\n count: missing.length,\n lenses: missing.map(l => l.label),\n });\n\n const agentTimingsAccum: DebugMetaAgent[] = [];\n const generated: Record<string, HydeDocumentState> = {};\n\n await Promise.all(\n missing.map(async (lens) => {\n const _traceEmitterHyde = requestContext.getStore()?.traceEmitter;\n const generatorStart = Date.now();\n _traceEmitterHyde?.({ type: \"agent_start\", name: \"hyde-generator\" });\n const out = await self.generator.generate({\n sourceText,\n lens: lens.label,\n corpus: lens.corpus,\n });\n const _hydeDuration = Date.now() - generatorStart;\n agentTimingsAccum.push({ name: 'hyde.generator', durationMs: _hydeDuration });\n _traceEmitterHyde?.({ type: \"agent_end\", name: \"hyde-generator\", durationMs: _hydeDuration, summary: `Generated: ${lens.label}` });\n generated[lens.label] = {\n lens: lens.label,\n targetCorpus: lens.corpus,\n hydeText: out.text,\n hydeEmbedding: [],\n };\n })\n );\n\n return { hydeDocuments: { ...state.hydeDocuments, ...generated }, agentTimings: agentTimingsAccum };\n });\n };\n\n /** Node 4: Embed all HyDE documents that don't have embeddings yet. */\n const embedNode = async (state: typeof HydeGraphState.State) => {\n return timed(\"HydeGraph.embed\", async () => {\n const { hydeDocuments } = state;\n const lensLabels = Object.keys(hydeDocuments);\n const toEmbed: { label: string; doc: HydeDocumentState }[] = [];\n const updated: Record<string, HydeDocumentState> = {};\n const hydeEmbeddings: Record<string, number[]> = {};\n\n for (const label of lensLabels) {\n const doc = hydeDocuments[label];\n if (!doc) continue;\n if (doc.hydeEmbedding?.length) {\n updated[label] = doc;\n hydeEmbeddings[label] = doc.hydeEmbedding;\n } else {\n toEmbed.push({ label, doc });\n }\n }\n\n if (toEmbed.length > 0) {\n logger.verbose('Embedding documents', { count: toEmbed.length });\n const texts = toEmbed.map((t) => t.doc.hydeText);\n const embeddings = await self.embedder.generate(texts, undefined, getAbortSignalConfig());\n const embeddingArray = Array.isArray(embeddings[0])\n ? (embeddings as number[][])\n : [embeddings as number[]];\n\n for (let i = 0; i < toEmbed.length; i++) {\n const { label, doc } = toEmbed[i];\n const embedding = embeddingArray[i] ?? [];\n updated[label] = { ...doc, hydeEmbedding: embedding };\n hydeEmbeddings[label] = embedding;\n }\n }\n\n return { hydeDocuments: updated, hydeEmbeddings };\n });\n };\n\n /** Node 5: Cache results in Redis; persist to DB for entity sources. */\n const cacheResultsNode = async (state: typeof HydeGraphState.State) => {\n return timed(\"HydeGraph.cacheResults\", async () => {\n const { sourceType, sourceId, sourceText, hydeDocuments } = state;\n\n for (const label of Object.keys(hydeDocuments)) {\n const doc = hydeDocuments[label];\n if (!doc) continue;\n\n const key = cacheKey(sourceType, sourceId ?? undefined, sourceText, label, doc.targetCorpus);\n await self.cache.set(key, doc, { ttl: HYDE_DEFAULT_CACHE_TTL });\n\n // Persist to DB for entity sources (intent/profile)\n if (sourceId) {\n await self.database.saveHydeDocument({\n sourceType,\n sourceId,\n strategy: lensHash(label, doc.targetCorpus),\n targetCorpus: doc.targetCorpus,\n hydeText: doc.hydeText,\n hydeEmbedding: doc.hydeEmbedding,\n });\n }\n }\n\n logger.verbose('Cached results', {\n count: Object.keys(hydeDocuments).length,\n });\n return {};\n });\n };\n\n const workflow = new StateGraph(HydeGraphState)\n .addNode('infer_lenses', inferLensesNode)\n .addNode('check_cache', checkCacheNode)\n .addNode('generate_missing', generateMissingNode)\n .addNode('embed', embedNode)\n .addNode('cache_results', cacheResultsNode)\n .addEdge(START, 'infer_lenses')\n .addEdge('infer_lenses', 'check_cache')\n .addConditionalEdges('check_cache', shouldGenerate, {\n generate: 'generate_missing',\n skip: 'embed',\n })\n .addEdge('generate_missing', 'embed')\n .addEdge('embed', 'cache_results')\n .addEdge('cache_results', END);\n\n return workflow.compile();\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"hyde.state.d.ts","sourceRoot":"","sources":["../../../src/shared/hyde/hyde.state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE,4DAA4D;AAC5D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,2CAA2C;AAC3C,eAAO,MAAM,cAAc;IAGzB,mEAAmE;;;;;;IAGnE,4EAA4E;;IAM5E,qFAAqF;;;;;;IAGrF,4EAA4E;;IAM5E,qDAAqD;;IAMrD,0DAA0D;;IAQ1D,mDAAmD;;IAMnD;;;OAGG;;IAMH;;;OAGG;;IAMH,+BAA+B;;IAM/B,sEAAsE;;EAKtE,CAAC"}
1
+ {"version":3,"file":"hyde.state.d.ts","sourceRoot":"/","sources":["shared/hyde/hyde.state.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,qCAAqC,CAAC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE,4DAA4D;AAC5D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,gBAAgB,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,2CAA2C;AAC3C,eAAO,MAAM,cAAc;IAGzB,mEAAmE;;;;;;IAGnE,4EAA4E;;IAM5E,qFAAqF;;;;;;IAGrF,4EAA4E;;IAM5E,qDAAqD;;IAMrD,0DAA0D;;IAQ1D,mDAAmD;;IAMnD;;;OAGG;;IAMH;;;OAGG;;IAMH,+BAA+B;;IAM/B,sEAAsE;;EAKtE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"hyde.state.js","sourceRoot":"","sources":["../../../src/shared/hyde/hyde.state.ts"],"names":[],"mappings":"AAAA;;;GAGG;A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CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAC7D,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;KACpB,CAAC;IAEF,+BAA+B;IAC/B,KAAK,EAAE,UAAU,CAAqB;QACpC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,IAAI;QACrC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS;KACzB,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":["/**\n * HyDE Graph state: cache-aware hypothetical document generation.\n * Used by the HyDE graph for infer_lenses → check_cache → generate_missing → embed → cache_results.\n */\n\nimport { Annotation } from '@langchain/langgraph';\nimport type { Id } from '../interfaces/database.interface.js';\nimport type { Lens, HydeTargetCorpus } from './lens.inferrer.js';\nimport type { DebugMetaAgent } from '../../chat/chat-streaming.types.js';\n\n/** Single HyDE document (text + embedding) for one lens. */\nexport interface HydeDocumentState {\n lens: string;\n targetCorpus: HydeTargetCorpus;\n hydeText: string;\n hydeEmbedding: number[];\n}\n\n/** State for the HyDE generation graph. */\nexport const HydeGraphState = Annotation.Root({\n // ─── Inputs ─────────────────────────────────────────────────────────────\n\n /** Source type: intent, profile, user context, or ad-hoc query. */\n sourceType: Annotation<'intent' | 'profile' | 'query' | 'context'>,\n\n /** Source entity ID (e.g. intent ID, user ID). Omitted for ad-hoc query. */\n sourceId: Annotation<Id<'intents'> | Id<'users'> | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n\n /** Source text to generate HyDE from (intent payload, profile summary, or query). */\n sourceText: Annotation<string>,\n\n /** Optional profile context for lens inference (user's profile summary). */\n profileContext: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n\n /** Maximum number of lenses to infer (default 3). */\n maxLenses: Annotation<number>({\n reducer: (curr, next) => next ?? curr,\n default: () => 3,\n }),\n\n /** When true, skip cache/DB and regenerate all lenses. */\n forceRegenerate: Annotation<boolean>({\n reducer: (curr, next) => next ?? curr,\n default: () => false,\n }),\n\n // ─── Intermediate / output ─────────────────────────────────────────────\n\n /** Inferred lenses from the LensInferrer agent. */\n lenses: Annotation<Lens[]>({\n reducer: (curr, next) => next ?? curr,\n default: () => [],\n }),\n\n /**\n * HyDE documents per lens (from cache, DB, or newly generated).\n * Keyed by lens label; values include hydeText and hydeEmbedding.\n */\n hydeDocuments: Annotation<Record<string, HydeDocumentState>>({\n reducer: (curr, next) => (next ? { ...curr, ...next } : curr),\n default: () => ({}),\n }),\n\n /**\n * Final embeddings per lens (convenience output for search).\n * Populated by embed node; used by opportunity graph.\n */\n hydeEmbeddings: Annotation<Record<string, number[]>>({\n reducer: (curr, next) => (next ? { ...curr, ...next } : curr),\n default: () => ({}),\n }),\n\n /** Non-fatal error message. */\n error: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\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 +1 @@
1
- {"version":3,"file":"hyde.strategies.d.ts","sourceRoot":"","sources":["../../../src/shared/hyde/hyde.strategies.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE1G,+DAA+D;AAC/D,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,UAAU,GAAG,SAAS,GAAG,UAAU,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAmBzH,CAAC"}
1
+ {"version":3,"file":"hyde.strategies.d.ts","sourceRoot":"/","sources":["shared/hyde/hyde.strategies.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE1G,+DAA+D;AAC/D,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,UAAU,GAAG,SAAS,GAAG,UAAU,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAmBzH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"hyde.strategies.js","sourceRoot":"","sources":["../../../src/shared/hyde/hyde.strategies.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA8F;IAC5H,QAAQ,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;+EAC6C,UAAU;0EACf,IAAI;;;GAG3E;IACD,OAAO,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;+DAC8B,IAAI;6CACtB,UAAU;;;GAGpD;IACD,QAAQ,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;oGACkE,UAAU;0CACpE,IAAI;;;GAG3C;CACF,CAAC"}
1
+ {"version":3,"file":"hyde.strategies.js","sourceRoot":"/","sources":["shared/hyde/hyde.strategies.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA8F;IAC5H,QAAQ,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;+EAC6C,UAAU;0EACf,IAAI;;;GAG3E;IACD,OAAO,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;+DAC8B,IAAI;6CACtB,UAAU;;;GAGpD;IACD,QAAQ,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;oGACkE,UAAU;0CACpE,IAAI;;;GAG3C;CACF,CAAC","sourcesContent":["/**\n * HyDE (Hypothetical Document Embeddings) type definitions.\n *\n * The system is now role-agnostic: instead of hardcoded strategy names\n * (mirror, reciprocal, mentor, investor, collaborator, hiree), an LLM\n * infers free-text \"lenses\" dynamically. This file re-exports the lens\n * types and provides constants for the HyDE pipeline.\n */\n\nexport type { Lens, HydeTargetCorpus, LensInferenceInput, LensInferenceOutput } from './lens.inferrer.js';\n\n/** Default cache TTL for ephemeral HyDE documents (1 hour). */\nexport const HYDE_DEFAULT_CACHE_TTL = 3600;\n\n/**\n * Prompt templates for HyDE document generation.\n * Keyed by target corpus — the lens label provides the semantic specificity.\n */\nexport const HYDE_CORPUS_PROMPTS: Record<'profiles' | 'intents' | 'premises', (sourceText: string, lens: string) => string> = {\n profiles: (sourceText, lens) => `\n Write a professional biography for someone who could fulfill this need: \"${sourceText}\".\n Focus on the specific expertise, background, and role described by: ${lens}.\n\n Write in first person. Include concrete skills, domain experience, and current professional focus that would make them a strong match.\n `,\n intents: (sourceText, lens) => `\n Write a goal or aspiration statement for someone who is: ${lens}.\n This person's needs would complement: \"${sourceText}\".\n\n Write in first person as if stating their own goal.\n `,\n premises: (sourceText, lens) => `\n Write a short self-description for someone whose identity, values, or worldview aligns with: \"${sourceText}\".\n Reflect the character described by: ${lens}.\n\n Write in first person as a stable statement of who this person is, not what they want.\n `,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"lens.inferrer.d.ts","sourceRoot":"","sources":["../../../src/shared/hyde/lens.inferrer.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAEnE,iFAAiF;AACjF,MAAM,WAAW,IAAI;IACnB,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,MAAM,EAAE,gBAAgB,CAAC;IACzB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,IAAI,EAAE,CAAC;CAChB;AA8BD;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAEV;IAEH;;;;;OAKG;IAEG,KAAK,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAoCrE"}
1
+ {"version":3,"file":"lens.inferrer.d.ts","sourceRoot":"/","sources":["shared/hyde/lens.inferrer.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAEnE,iFAAiF;AACjF,MAAM,WAAW,IAAI;IACnB,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,MAAM,EAAE,gBAAgB,CAAC;IACzB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,4DAA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