@indexnetwork/protocol 6.12.0-rc.403.1 → 6.13.22-rc.405.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +241 -0
- package/IMPLEMENTATION.md +20 -0
- package/STABILITY.md +4 -0
- package/dist/agent/agent.tools.d.ts +11 -3
- package/dist/agent/agent.tools.js +11 -301
- package/dist/capabilities/communities.facade.d.ts +13 -0
- package/dist/capabilities/communities.facade.js +12 -0
- package/dist/capabilities/communities.tools.port.d.ts +5 -0
- package/dist/capabilities/communities.tools.port.js +1 -0
- package/dist/capabilities/contacts.facade.d.ts +9 -0
- package/dist/capabilities/contacts.facade.js +8 -0
- package/dist/capabilities/contacts.tools.port.d.ts +9 -0
- package/dist/capabilities/contacts.tools.port.js +1 -0
- package/dist/capabilities/integrations.facade.d.ts +8 -0
- package/dist/capabilities/integrations.facade.js +7 -0
- package/dist/capabilities/integrations.tools.port.d.ts +9 -0
- package/dist/capabilities/integrations.tools.port.js +1 -0
- package/dist/capabilities/interaction-composition.facade.d.ts +10 -0
- package/dist/capabilities/interaction-composition.facade.js +9 -0
- package/dist/capabilities/negotiation.discovery.facade.d.ts +9 -0
- package/dist/capabilities/negotiation.discovery.facade.js +7 -0
- package/dist/capabilities/negotiation.facade.d.ts +23 -0
- package/dist/capabilities/negotiation.facade.js +17 -0
- package/dist/capabilities/negotiation.memory.facade.d.ts +6 -0
- package/dist/capabilities/negotiation.memory.facade.js +5 -0
- package/dist/capabilities/negotiation.questions.facade.d.ts +6 -0
- package/dist/capabilities/negotiation.questions.facade.js +5 -0
- package/dist/capabilities/negotiation.state.facade.d.ts +5 -0
- package/dist/capabilities/negotiation.state.facade.js +1 -0
- package/dist/capabilities/negotiation.summary.facade.d.ts +5 -0
- package/dist/capabilities/negotiation.summary.facade.js +5 -0
- package/dist/capabilities/negotiation.tools.port.d.ts +5 -0
- package/dist/capabilities/negotiation.tools.port.js +1 -0
- package/dist/capabilities/opportunities.facade.d.ts +50 -0
- package/dist/capabilities/opportunities.facade.js +50 -0
- package/dist/capabilities/opportunities.safety.facade.d.ts +2 -0
- package/dist/capabilities/opportunities.safety.facade.js +2 -0
- package/dist/capabilities/opportunities.tools.port.d.ts +5 -0
- package/dist/capabilities/opportunities.tools.port.js +1 -0
- package/dist/capabilities/participant-agents.debug.facade.d.ts +2 -0
- package/dist/capabilities/participant-agents.debug.facade.js +1 -0
- package/dist/capabilities/participant-agents.facade.d.ts +35 -0
- package/dist/capabilities/participant-agents.facade.js +35 -0
- package/dist/capabilities/participant-agents.tools.facade.d.ts +8 -0
- package/dist/capabilities/participant-agents.tools.facade.js +8 -0
- package/dist/capabilities/participant-agents.tools.port.d.ts +9 -0
- package/dist/capabilities/participant-agents.tools.port.js +1 -0
- package/dist/capabilities/participant-context.facade.d.ts +13 -0
- package/dist/capabilities/participant-context.facade.js +14 -0
- package/dist/capabilities/participant-context.tools.port.d.ts +9 -0
- package/dist/capabilities/participant-context.tools.port.js +1 -0
- package/dist/capabilities/questions.enqueue.facade.d.ts +5 -0
- package/dist/capabilities/questions.enqueue.facade.js +1 -0
- package/dist/capabilities/questions.facade.d.ts +8 -0
- package/dist/capabilities/questions.facade.js +7 -0
- package/dist/capabilities/questions.runtime.facade.d.ts +5 -0
- package/dist/capabilities/questions.runtime.facade.js +5 -0
- package/dist/capabilities/questions.tools.port.d.ts +5 -0
- package/dist/capabilities/questions.tools.port.js +1 -0
- package/dist/capabilities/signals.facade.d.ts +16 -0
- package/dist/capabilities/signals.facade.js +14 -0
- package/dist/capabilities/signals.indexing.facade.d.ts +12 -0
- package/dist/capabilities/signals.indexing.facade.js +11 -0
- package/dist/capabilities/signals.tools.port.d.ts +5 -0
- package/dist/capabilities/signals.tools.port.js +1 -0
- package/dist/chat/chat-streaming.types.d.ts +0 -1
- package/dist/chat/chat-streaming.types.js +1 -2
- package/dist/chat/chat.agent.d.ts +0 -1
- package/dist/chat/chat.agent.js +0 -1
- package/dist/chat/chat.graph.d.ts +0 -1
- package/dist/chat/chat.graph.js +0 -1
- package/dist/chat/chat.interrupt.classifier.d.ts +0 -1
- package/dist/chat/chat.interrupt.classifier.js +0 -1
- package/dist/chat/chat.persona.d.ts +0 -1
- package/dist/chat/chat.persona.js +0 -1
- package/dist/chat/chat.prompt.d.ts +0 -1
- package/dist/chat/chat.prompt.js +0 -1
- package/dist/chat/chat.prompt.modules.d.ts +0 -1
- package/dist/chat/chat.prompt.modules.js +0 -1
- package/dist/chat/chat.question-dedup.d.ts +0 -1
- package/dist/chat/chat.question-dedup.js +0 -1
- package/dist/chat/chat.state.d.ts +0 -1
- package/dist/chat/chat.state.js +0 -1
- package/dist/chat/chat.streamer.d.ts +0 -1
- package/dist/chat/chat.streamer.js +0 -1
- package/dist/chat/chat.suggester.d.ts +0 -1
- package/dist/chat/chat.suggester.js +0 -1
- package/dist/chat/chat.summarizer.d.ts +0 -1
- package/dist/chat/chat.summarizer.js +0 -1
- package/dist/chat/chat.title.generator.d.ts +0 -1
- package/dist/chat/chat.title.generator.js +0 -1
- package/dist/chat/chat.tools.d.ts +0 -1
- package/dist/chat/chat.tools.js +0 -1
- package/dist/chat/chat.utils.d.ts +0 -1
- package/dist/chat/chat.utils.js +0 -1
- package/dist/chat/negotiator.persona.d.ts +0 -1
- package/dist/chat/negotiator.persona.js +0 -1
- package/dist/chat/negotiator.prompt.d.ts +1 -2
- package/dist/chat/negotiator.prompt.js +1 -2
- package/dist/chat/negotiator.tools.d.ts +0 -1
- package/dist/chat/negotiator.tools.js +0 -1
- package/dist/chat/onboarding.persona.d.ts +0 -1
- package/dist/chat/onboarding.persona.js +0 -1
- package/dist/chat/onboarding.prompt.d.ts +0 -1
- package/dist/chat/onboarding.prompt.js +0 -1
- package/dist/chat/reporter.action.contracts.d.ts +36 -0
- package/dist/chat/reporter.action.contracts.js +1 -0
- package/dist/chat/reporter.action.tools.d.ts +2 -37
- package/dist/chat/reporter.action.tools.js +0 -1
- package/dist/chat/reporter.persona.d.ts +0 -1
- package/dist/chat/reporter.persona.js +0 -1
- package/dist/chat/reporter.prompt.d.ts +0 -1
- package/dist/chat/reporter.prompt.js +0 -1
- package/dist/chat/signal.persona.d.ts +0 -1
- package/dist/chat/signal.persona.js +0 -1
- package/dist/chat/signal.prompt.d.ts +0 -1
- package/dist/chat/signal.prompt.js +0 -1
- package/dist/communities/application/index.d.ts +45 -0
- package/dist/communities/application/index.js +50 -0
- package/dist/communities/application/indexer.graph.d.ts +446 -0
- package/dist/communities/application/indexer.graph.js +420 -0
- package/dist/communities/application/indexer.state.d.ts +172 -0
- package/dist/communities/application/indexer.state.js +116 -0
- package/dist/communities/application/membership.graph.d.ts +270 -0
- package/dist/communities/application/membership.graph.js +229 -0
- package/dist/communities/application/network.graph.d.ts +648 -0
- package/dist/communities/application/network.graph.js +303 -0
- package/dist/communities/application/network.recommender.d.ts +44 -0
- package/dist/communities/application/network.recommender.js +113 -0
- package/dist/communities/application/network.tools.d.ts +35 -0
- package/dist/communities/application/network.tools.js +578 -0
- package/dist/communities/domain/index.d.ts +29 -0
- package/dist/communities/domain/index.js +31 -0
- package/dist/communities/domain/membership.state.d.ts +87 -0
- package/dist/communities/domain/membership.state.js +53 -0
- package/dist/communities/domain/network.state.d.ts +192 -0
- package/dist/communities/domain/network.state.js +66 -0
- package/dist/communities/index.d.ts +14 -0
- package/dist/communities/index.js +14 -0
- package/dist/communities/ports/index.d.ts +25 -0
- package/dist/communities/ports/index.js +27 -0
- package/dist/communities/public/index.d.ts +30 -0
- package/dist/communities/public/index.js +33 -0
- package/dist/contact/contact.inviter.d.ts +7 -44
- package/dist/contact/contact.inviter.js +6 -59
- package/dist/contact/contact.tools.d.ts +7 -5
- package/dist/contact/contact.tools.js +7 -177
- package/dist/contacts/application/contact.inviter.d.ts +49 -0
- package/dist/contacts/application/contact.inviter.js +64 -0
- package/dist/contacts/application/contact.tools.d.ts +20 -0
- package/dist/contacts/application/contact.tools.js +191 -0
- package/dist/contacts/application/index.d.ts +22 -0
- package/dist/contacts/application/index.js +21 -0
- package/dist/contacts/domain/contact.types.d.ts +51 -0
- package/dist/contacts/domain/contact.types.js +10 -0
- package/dist/contacts/domain/index.d.ts +18 -0
- package/dist/contacts/domain/index.js +1 -0
- package/dist/contacts/index.d.ts +24 -0
- package/dist/contacts/index.js +24 -0
- package/dist/contacts/ports/contact.repository.port.d.ts +28 -0
- package/dist/contacts/ports/contact.repository.port.js +14 -0
- package/dist/contacts/ports/contact.tools.port.d.ts +26 -0
- package/dist/contacts/ports/contact.tools.port.js +21 -0
- package/dist/contacts/ports/index.d.ts +22 -0
- package/dist/contacts/ports/index.js +21 -0
- package/dist/contacts/public/index.d.ts +36 -0
- package/dist/contacts/public/index.js +33 -0
- package/dist/context/context.generator.d.ts +0 -1
- package/dist/context/context.generator.js +0 -1
- package/dist/enrichment/enrichment.enricher.d.ts +0 -1
- package/dist/enrichment/enrichment.enricher.js +0 -1
- package/dist/enrichment/enrichment.generator.d.ts +0 -1
- package/dist/enrichment/enrichment.generator.js +0 -1
- package/dist/enrichment/enrichment.graph.d.ts +6 -7
- package/dist/enrichment/enrichment.graph.js +0 -1
- package/dist/enrichment/enrichment.state.d.ts +2 -3
- package/dist/enrichment/enrichment.state.js +0 -1
- package/dist/enrichment/enrichment.tools.d.ts +3 -3
- package/dist/enrichment/enrichment.tools.js +0 -1
- package/dist/index.d.ts +106 -91
- package/dist/index.js +79 -71
- package/dist/integration/integration.tools.d.ts +6 -10
- package/dist/integration/integration.tools.js +6 -82
- package/dist/integrations/application/index.d.ts +14 -0
- package/dist/integrations/application/index.js +14 -0
- package/dist/integrations/application/integration.tools.d.ts +27 -0
- package/dist/integrations/application/integration.tools.js +98 -0
- package/dist/integrations/domain/index.d.ts +18 -0
- package/dist/integrations/domain/index.js +1 -0
- package/dist/integrations/domain/integration.types.d.ts +53 -0
- package/dist/integrations/domain/integration.types.js +11 -0
- package/dist/integrations/index.d.ts +27 -0
- package/dist/integrations/index.js +27 -0
- package/dist/integrations/ports/index.d.ts +28 -0
- package/dist/integrations/ports/index.js +26 -0
- package/dist/integrations/ports/integration.adapter.port.d.ts +62 -0
- package/dist/integrations/ports/integration.adapter.port.js +15 -0
- package/dist/integrations/ports/integration.importer.port.d.ts +31 -0
- package/dist/integrations/ports/integration.importer.port.js +15 -0
- package/dist/integrations/ports/integration.tools.port.d.ts +28 -0
- package/dist/integrations/ports/integration.tools.port.js +21 -0
- package/dist/integrations/public/index.d.ts +37 -0
- package/dist/integrations/public/index.js +34 -0
- package/dist/intent/intent.clarifier.d.ts +3 -52
- package/dist/intent/intent.clarifier.js +2 -202
- package/dist/intent/intent.graph.d.ts +3 -551
- package/dist/intent/intent.graph.js +3 -937
- package/dist/intent/intent.indexer.d.ts +2 -83
- package/dist/intent/intent.indexer.js +2 -171
- package/dist/intent/intent.inferrer.d.ts +2 -95
- package/dist/intent/intent.inferrer.js +2 -234
- package/dist/intent/intent.reconciler.d.ts +2 -106
- package/dist/intent/intent.reconciler.js +2 -187
- package/dist/intent/intent.specificity.d.ts +2 -3
- package/dist/intent/intent.specificity.js +2 -3
- package/dist/intent/intent.state.d.ts +8 -229
- package/dist/intent/intent.state.js +8 -189
- package/dist/intent/intent.tools.d.ts +6 -24
- package/dist/intent/intent.tools.js +4 -788
- package/dist/intent/intent.verifier.d.ts +2 -116
- package/dist/intent/intent.verifier.js +2 -263
- package/dist/maintenance/maintenance.graph.d.ts +0 -1
- package/dist/maintenance/maintenance.graph.js +0 -1
- package/dist/maintenance/maintenance.state.d.ts +0 -1
- package/dist/maintenance/maintenance.state.js +0 -1
- package/dist/mcp/elicitation.builder.d.ts +0 -1
- package/dist/mcp/elicitation.builder.js +0 -1
- package/dist/mcp/elicitation.dispatcher.d.ts +0 -1
- package/dist/mcp/elicitation.dispatcher.js +0 -1
- package/dist/mcp/mcp.server.d.ts +0 -1
- package/dist/mcp/mcp.server.js +1 -2
- package/dist/negotiation/application/index.d.ts +48 -0
- package/dist/negotiation/application/index.js +49 -0
- package/dist/negotiation/application/insight.generator.d.ts +31 -0
- package/dist/negotiation/application/insight.generator.js +105 -0
- package/dist/negotiation/application/negotiation.agent.d.ts +110 -0
- package/dist/negotiation/application/negotiation.agent.js +244 -0
- package/dist/negotiation/application/negotiation.detail-reader.d.ts +94 -0
- package/dist/negotiation/application/negotiation.detail-reader.js +91 -0
- package/dist/negotiation/application/negotiation.graph.d.ts +664 -0
- package/dist/negotiation/application/negotiation.graph.js +1393 -0
- package/dist/negotiation/application/negotiation.reflect.d.ts +194 -0
- package/dist/negotiation/application/negotiation.reflect.js +145 -0
- package/dist/negotiation/application/negotiation.screen.d.ts +78 -0
- package/dist/negotiation/application/negotiation.screen.js +108 -0
- package/dist/negotiation/application/negotiation.summarizer.d.ts +25 -0
- package/dist/negotiation/application/negotiation.summarizer.js +101 -0
- package/dist/negotiation/application/negotiation.tools.d.ts +18 -0
- package/dist/negotiation/application/negotiation.tools.js +782 -0
- package/dist/negotiation/domain/index.d.ts +48 -0
- package/dist/negotiation/domain/index.js +50 -0
- package/dist/negotiation/domain/negotiation.consultation-policy.d.ts +39 -0
- package/dist/negotiation/domain/negotiation.consultation-policy.js +68 -0
- package/dist/negotiation/domain/negotiation.deadlock.contracts.d.ts +10 -0
- package/dist/negotiation/domain/negotiation.deadlock.contracts.js +1 -0
- package/dist/negotiation/domain/negotiation.deadlock.d.ts +81 -0
- package/dist/negotiation/domain/negotiation.deadlock.js +103 -0
- package/dist/negotiation/domain/negotiation.intent-snapshot-provenance.d.ts +21 -0
- package/dist/negotiation/domain/negotiation.intent-snapshot-provenance.js +28 -0
- package/dist/negotiation/domain/negotiation.lifecycle-narration.d.ts +18 -0
- package/dist/negotiation/domain/negotiation.lifecycle-narration.js +87 -0
- package/dist/negotiation/domain/negotiation.memory.d.ts +65 -0
- package/dist/negotiation/domain/negotiation.memory.js +83 -0
- package/dist/negotiation/domain/negotiation.protocol.d.ts +536 -0
- package/dist/negotiation/domain/negotiation.protocol.js +202 -0
- package/dist/negotiation/domain/negotiation.question-safety.d.ts +25 -0
- package/dist/negotiation/domain/negotiation.question-safety.js +55 -0
- package/dist/negotiation/domain/negotiation.screen.contracts.d.ts +88 -0
- package/dist/negotiation/domain/negotiation.screen.contracts.js +58 -0
- package/dist/negotiation/domain/negotiation.state.d.ts +497 -0
- package/dist/negotiation/domain/negotiation.state.js +288 -0
- package/dist/negotiation/domain/negotiation.task-lock-policy.d.ts +10 -0
- package/dist/negotiation/domain/negotiation.task-lock-policy.js +22 -0
- package/dist/negotiation/index.d.ts +49 -0
- package/dist/negotiation/index.js +49 -0
- package/dist/negotiation/insight.generator.d.ts +3 -30
- package/dist/negotiation/insight.generator.js +3 -104
- package/dist/negotiation/negotiation.agent.d.ts +3 -109
- package/dist/negotiation/negotiation.agent.js +3 -248
- package/dist/negotiation/negotiation.attribution.d.ts +0 -1
- package/dist/negotiation/negotiation.attribution.js +0 -1
- package/dist/negotiation/negotiation.consultation-policy.d.ts +3 -38
- package/dist/negotiation/negotiation.consultation-policy.js +3 -67
- package/dist/negotiation/negotiation.deadlock.contracts.d.ts +5 -0
- package/dist/negotiation/negotiation.deadlock.contracts.js +5 -0
- package/dist/negotiation/negotiation.deadlock.d.ts +3 -94
- package/dist/negotiation/negotiation.deadlock.js +3 -101
- package/dist/negotiation/negotiation.detail-reader.d.ts +5 -0
- package/dist/negotiation/negotiation.detail-reader.js +5 -0
- package/dist/negotiation/negotiation.graph.d.ts +3 -663
- package/dist/negotiation/negotiation.graph.js +3 -1459
- package/dist/negotiation/negotiation.intent-snapshot-provenance.d.ts +5 -0
- package/dist/negotiation/negotiation.intent-snapshot-provenance.js +5 -0
- package/dist/negotiation/negotiation.lifecycle-narration.d.ts +5 -0
- package/dist/negotiation/negotiation.lifecycle-narration.js +5 -0
- package/dist/negotiation/negotiation.memory.d.ts +5 -56
- package/dist/negotiation/negotiation.memory.js +5 -69
- package/dist/negotiation/negotiation.protocol.d.ts +3 -535
- package/dist/negotiation/negotiation.protocol.js +3 -201
- package/dist/negotiation/negotiation.question-safety.d.ts +3 -24
- package/dist/negotiation/negotiation.question-safety.js +3 -54
- package/dist/negotiation/negotiation.reflect.d.ts +4 -197
- package/dist/negotiation/negotiation.reflect.js +4 -151
- package/dist/negotiation/negotiation.screen.d.ts +6 -159
- package/dist/negotiation/negotiation.screen.js +6 -152
- package/dist/negotiation/negotiation.state.d.ts +3 -495
- package/dist/negotiation/negotiation.state.js +3 -284
- package/dist/negotiation/negotiation.summarizer.d.ts +3 -24
- package/dist/negotiation/negotiation.summarizer.js +3 -100
- package/dist/negotiation/negotiation.task-lock-policy.d.ts +5 -0
- package/dist/negotiation/negotiation.task-lock-policy.js +5 -0
- package/dist/negotiation/negotiation.tools.d.ts +3 -15
- package/dist/negotiation/negotiation.tools.js +3 -946
- package/dist/negotiation/ports/index.d.ts +18 -0
- package/dist/negotiation/ports/index.js +18 -0
- package/dist/negotiation/ports/negotiation.tools.port.d.ts +18 -0
- package/dist/negotiation/ports/negotiation.tools.port.js +1 -0
- package/dist/negotiation/public/index.d.ts +58 -0
- package/dist/negotiation/public/index.js +60 -0
- package/dist/network/indexer/indexer.graph.d.ts +3 -413
- package/dist/network/indexer/indexer.graph.js +3 -375
- package/dist/network/indexer/indexer.state.d.ts +3 -149
- package/dist/network/indexer/indexer.state.js +3 -98
- package/dist/network/membership/membership.graph.d.ts +3 -248
- package/dist/network/membership/membership.graph.js +3 -202
- package/dist/network/membership/membership.state.d.ts +3 -75
- package/dist/network/membership/membership.state.js +3 -41
- package/dist/network/network.graph.d.ts +3 -629
- package/dist/network/network.graph.js +3 -267
- package/dist/network/network.recommender.d.ts +3 -40
- package/dist/network/network.recommender.js +3 -109
- package/dist/network/network.state.d.ts +3 -180
- package/dist/network/network.state.js +3 -54
- package/dist/network/network.tools.d.ts +5 -3
- package/dist/network/network.tools.js +5 -566
- package/dist/opportunity/application/delivery-card.cache.d.ts +25 -0
- package/dist/opportunity/application/delivery-card.cache.js +43 -0
- package/dist/opportunity/application/index.d.ts +63 -0
- package/dist/opportunity/application/index.js +68 -0
- package/dist/opportunity/application/negotiation-context.loader.d.ts +59 -0
- package/dist/opportunity/application/negotiation-context.loader.js +88 -0
- package/dist/opportunity/application/opportunity.card-presentation.d.ts +44 -0
- package/dist/opportunity/application/opportunity.card-presentation.js +104 -0
- package/dist/opportunity/application/opportunity.discover.d.ts +215 -0
- package/dist/opportunity/application/opportunity.discover.js +793 -0
- package/dist/opportunity/application/opportunity.discovery-continuation-finalization.d.ts +34 -0
- package/dist/opportunity/application/opportunity.discovery-continuation-finalization.js +74 -0
- package/dist/opportunity/application/opportunity.discovery-mcp-lifecycle-finalization.d.ts +44 -0
- package/dist/opportunity/application/opportunity.discovery-mcp-lifecycle-finalization.js +92 -0
- package/dist/opportunity/application/opportunity.discovery-negotiation-summary.d.ts +14 -0
- package/dist/opportunity/application/opportunity.discovery-negotiation-summary.js +46 -0
- package/dist/opportunity/application/opportunity.enricher.d.ts +71 -0
- package/dist/opportunity/application/opportunity.enricher.js +280 -0
- package/dist/opportunity/application/opportunity.evaluator.d.ts +275 -0
- package/dist/opportunity/application/opportunity.evaluator.js +459 -0
- package/dist/opportunity/application/opportunity.existing-negotiation.d.ts +77 -0
- package/dist/opportunity/application/opportunity.existing-negotiation.js +109 -0
- package/dist/opportunity/application/opportunity.feed-selection.d.ts +30 -0
- package/dist/opportunity/application/opportunity.feed-selection.js +96 -0
- package/dist/opportunity/application/opportunity.graph.d.ts +1427 -0
- package/dist/opportunity/application/opportunity.graph.js +3693 -0
- package/dist/opportunity/application/opportunity.introducer.d.ts +77 -0
- package/dist/opportunity/application/opportunity.introducer.js +99 -0
- package/dist/opportunity/application/opportunity.lifecycle.d.ts +63 -0
- package/dist/opportunity/application/opportunity.lifecycle.js +181 -0
- package/dist/opportunity/application/opportunity.newborn-stamping.d.ts +41 -0
- package/dist/opportunity/application/opportunity.newborn-stamping.js +81 -0
- package/dist/opportunity/application/opportunity.pending-questions.d.ts +33 -0
- package/dist/opportunity/application/opportunity.pending-questions.js +42 -0
- package/dist/opportunity/application/opportunity.persist.d.ts +58 -0
- package/dist/opportunity/application/opportunity.persist.js +145 -0
- package/dist/opportunity/application/opportunity.persistence-admission.d.ts +39 -0
- package/dist/opportunity/application/opportunity.persistence-admission.js +59 -0
- package/dist/opportunity/application/opportunity.presenter.d.ts +156 -0
- package/dist/opportunity/application/opportunity.presenter.js +736 -0
- package/dist/opportunity/application/opportunity.tools.d.ts +131 -0
- package/dist/opportunity/application/opportunity.tools.js +1834 -0
- package/dist/opportunity/application/opportunity.update-admission.d.ts +24 -0
- package/dist/opportunity/application/opportunity.update-admission.js +38 -0
- package/dist/opportunity/delivery-card.cache.d.ts +5 -26
- package/dist/opportunity/delivery-card.cache.js +5 -44
- package/dist/opportunity/discovery-question.helper.d.ts +3 -17
- package/dist/opportunity/discovery-question.helper.js +3 -14
- package/dist/opportunity/discriminator/discriminator.adjustments.d.ts +0 -1
- package/dist/opportunity/discriminator/discriminator.adjustments.js +0 -1
- package/dist/opportunity/discriminator/discriminator.assigner.d.ts +4 -5
- package/dist/opportunity/discriminator/discriminator.assigner.js +0 -1
- package/dist/opportunity/discriminator/discriminator.env.d.ts +0 -1
- package/dist/opportunity/discriminator/discriminator.env.js +0 -1
- package/dist/opportunity/discriminator/discriminator.miner.d.ts +0 -1
- package/dist/opportunity/discriminator/discriminator.miner.js +0 -1
- package/dist/opportunity/discriminator/discriminator.push.d.ts +0 -1
- package/dist/opportunity/discriminator/discriminator.push.js +0 -1
- package/dist/opportunity/discriminator/discriminator.question.d.ts +0 -1
- package/dist/opportunity/discriminator/discriminator.question.js +0 -1
- package/dist/opportunity/discriminator/discriminator.scorer.d.ts +0 -1
- package/dist/opportunity/discriminator/discriminator.scorer.js +0 -1
- package/dist/opportunity/discriminator/discriminator.shadow.d.ts +0 -1
- package/dist/opportunity/discriminator/discriminator.shadow.js +0 -1
- package/dist/opportunity/discriminator/discriminator.types.d.ts +0 -1
- package/dist/opportunity/discriminator/discriminator.types.js +0 -1
- package/dist/opportunity/domain/discovery-question.helper.d.ts +18 -0
- package/dist/opportunity/domain/discovery-question.helper.js +15 -0
- package/dist/opportunity/domain/index.d.ts +55 -0
- package/dist/opportunity/domain/index.js +52 -0
- package/dist/opportunity/domain/negotiation-summary.builder.d.ts +37 -0
- package/dist/opportunity/domain/negotiation-summary.builder.js +66 -0
- package/dist/opportunity/domain/opportunity.actor.d.ts +15 -0
- package/dist/opportunity/domain/opportunity.actor.js +39 -0
- package/dist/opportunity/domain/opportunity.claim-safety.d.ts +24 -0
- package/dist/opportunity/domain/opportunity.claim-safety.js +88 -0
- package/dist/opportunity/domain/opportunity.discovery-run-coalescing.d.ts +33 -0
- package/dist/opportunity/domain/opportunity.discovery-run-coalescing.js +33 -0
- package/dist/opportunity/domain/opportunity.discovery.contracts.d.ts +45 -0
- package/dist/opportunity/domain/opportunity.discovery.contracts.js +1 -0
- package/dist/opportunity/domain/opportunity.evidence.d.ts +21 -0
- package/dist/opportunity/domain/opportunity.evidence.js +78 -0
- package/dist/opportunity/domain/opportunity.labels.d.ts +8 -0
- package/dist/opportunity/domain/opportunity.labels.js +10 -0
- package/dist/opportunity/domain/opportunity.presentation-cache.d.ts +6 -0
- package/dist/opportunity/domain/opportunity.presentation-cache.js +14 -0
- package/dist/opportunity/domain/opportunity.presentation.d.ts +76 -0
- package/dist/opportunity/domain/opportunity.presentation.js +516 -0
- package/dist/opportunity/domain/opportunity.safe-presentation.d.ts +104 -0
- package/dist/opportunity/domain/opportunity.safe-presentation.js +102 -0
- package/dist/opportunity/domain/opportunity.state.d.ts +519 -0
- package/dist/opportunity/domain/opportunity.state.js +309 -0
- package/dist/opportunity/domain/opportunity.utils.d.ts +217 -0
- package/dist/opportunity/domain/opportunity.utils.js +395 -0
- package/dist/opportunity/feed/feed.categorizer.d.ts +0 -1
- package/dist/opportunity/feed/feed.categorizer.js +0 -1
- package/dist/opportunity/feed/feed.graph.d.ts +1 -2
- package/dist/opportunity/feed/feed.graph.js +0 -1
- package/dist/opportunity/feed/feed.health.d.ts +0 -1
- package/dist/opportunity/feed/feed.health.js +0 -1
- package/dist/opportunity/feed/feed.state.d.ts +1 -2
- package/dist/opportunity/feed/feed.state.js +0 -1
- package/dist/opportunity/index.d.ts +37 -0
- package/dist/opportunity/index.js +37 -0
- package/dist/opportunity/negotiation-context.loader.d.ts +3 -58
- package/dist/opportunity/negotiation-context.loader.js +3 -87
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.env.d.ts +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.env.js +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.extractor.d.ts +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.extractor.js +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.miner.d.ts +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.miner.js +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.shadow.d.ts +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.shadow.js +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.types.d.ts +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.types.js +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.verifier.d.ts +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.verifier.js +0 -1
- package/dist/opportunity/negotiation-summary.builder.d.ts +3 -36
- package/dist/opportunity/negotiation-summary.builder.js +3 -65
- package/dist/opportunity/opportunity.actor.d.ts +3 -14
- package/dist/opportunity/opportunity.actor.js +3 -38
- package/dist/opportunity/opportunity.card-presentation.d.ts +5 -0
- package/dist/opportunity/opportunity.card-presentation.js +5 -0
- package/dist/opportunity/opportunity.claim-safety.d.ts +3 -23
- package/dist/opportunity/opportunity.claim-safety.js +3 -87
- package/dist/opportunity/opportunity.discover.d.ts +3 -218
- package/dist/opportunity/opportunity.discover.js +3 -917
- package/dist/opportunity/opportunity.discovery-continuation-finalization.d.ts +5 -0
- package/dist/opportunity/opportunity.discovery-continuation-finalization.js +5 -0
- package/dist/opportunity/opportunity.discovery-mcp-lifecycle-finalization.d.ts +5 -0
- package/dist/opportunity/opportunity.discovery-mcp-lifecycle-finalization.js +5 -0
- package/dist/opportunity/opportunity.discovery-negotiation-summary.d.ts +5 -0
- package/dist/opportunity/opportunity.discovery-negotiation-summary.js +5 -0
- package/dist/opportunity/opportunity.discovery-run-coalescing.d.ts +5 -0
- package/dist/opportunity/opportunity.discovery-run-coalescing.js +5 -0
- package/dist/opportunity/opportunity.discovery.contracts.d.ts +5 -0
- package/dist/opportunity/opportunity.discovery.contracts.js +5 -0
- package/dist/opportunity/opportunity.enricher.d.ts +3 -70
- package/dist/opportunity/opportunity.enricher.js +3 -279
- package/dist/opportunity/opportunity.evaluator.d.ts +5 -276
- package/dist/opportunity/opportunity.evaluator.js +5 -460
- package/dist/opportunity/opportunity.evidence.d.ts +5 -22
- package/dist/opportunity/opportunity.evidence.js +5 -79
- package/dist/opportunity/opportunity.existing-negotiation.d.ts +5 -0
- package/dist/opportunity/opportunity.existing-negotiation.js +5 -0
- package/dist/opportunity/opportunity.feed-selection.d.ts +5 -0
- package/dist/opportunity/opportunity.feed-selection.js +5 -0
- package/dist/opportunity/opportunity.graph.d.ts +3 -1489
- package/dist/opportunity/opportunity.graph.js +3 -4071
- package/dist/opportunity/opportunity.introducer.d.ts +3 -76
- package/dist/opportunity/opportunity.introducer.js +3 -98
- package/dist/opportunity/opportunity.labels.d.ts +5 -9
- package/dist/opportunity/opportunity.labels.js +5 -11
- package/dist/opportunity/opportunity.lifecycle.d.ts +5 -0
- package/dist/opportunity/opportunity.lifecycle.js +5 -0
- package/dist/opportunity/opportunity.newborn-stamping.d.ts +5 -0
- package/dist/opportunity/opportunity.newborn-stamping.js +5 -0
- package/dist/opportunity/opportunity.pending-questions.d.ts +3 -32
- package/dist/opportunity/opportunity.pending-questions.js +3 -41
- package/dist/opportunity/opportunity.persist.d.ts +3 -57
- package/dist/opportunity/opportunity.persist.js +3 -144
- package/dist/opportunity/opportunity.persistence-admission.d.ts +5 -0
- package/dist/opportunity/opportunity.persistence-admission.js +5 -0
- package/dist/opportunity/opportunity.presentation-cache.d.ts +5 -7
- package/dist/opportunity/opportunity.presentation-cache.js +5 -15
- package/dist/opportunity/opportunity.presentation.d.ts +3 -75
- package/dist/opportunity/opportunity.presentation.js +3 -515
- package/dist/opportunity/opportunity.presenter.d.ts +10 -155
- package/dist/opportunity/opportunity.presenter.js +10 -735
- package/dist/opportunity/opportunity.safe-presentation.d.ts +3 -103
- package/dist/opportunity/opportunity.safe-presentation.js +3 -101
- package/dist/opportunity/opportunity.state.d.ts +3 -518
- package/dist/opportunity/opportunity.state.js +3 -308
- package/dist/opportunity/opportunity.tools.d.ts +3 -157
- package/dist/opportunity/opportunity.tools.js +3 -2238
- package/dist/opportunity/opportunity.update-admission.d.ts +5 -0
- package/dist/opportunity/opportunity.update-admission.js +5 -0
- package/dist/opportunity/opportunity.utils.d.ts +3 -216
- package/dist/opportunity/opportunity.utils.js +3 -394
- package/dist/opportunity/outcome/outcome.env.d.ts +0 -1
- package/dist/opportunity/outcome/outcome.env.js +0 -1
- package/dist/opportunity/outcome/outcome.hypotheses.d.ts +0 -1
- package/dist/opportunity/outcome/outcome.hypotheses.js +0 -1
- package/dist/opportunity/outcome/outcome.shadow.d.ts +0 -1
- package/dist/opportunity/outcome/outcome.shadow.js +0 -1
- package/dist/opportunity/outcome/outcome.types.d.ts +0 -1
- package/dist/opportunity/outcome/outcome.types.js +0 -1
- package/dist/opportunity/ports/index.d.ts +5 -0
- package/dist/opportunity/ports/index.js +1 -0
- package/dist/opportunity/ports/opportunity.tools.port.d.ts +5 -0
- package/dist/opportunity/ports/opportunity.tools.port.js +1 -0
- package/dist/opportunity/public/index.d.ts +58 -0
- package/dist/opportunity/public/index.js +51 -0
- package/dist/participant-agents/application/agent.tools.d.ts +16 -0
- package/dist/participant-agents/application/agent.tools.js +313 -0
- package/dist/participant-agents/application/index.d.ts +21 -0
- package/dist/participant-agents/application/index.js +22 -0
- package/dist/participant-agents/domain/agent.types.d.ts +76 -0
- package/dist/participant-agents/domain/agent.types.js +22 -0
- package/dist/participant-agents/domain/index.d.ts +20 -0
- package/dist/participant-agents/domain/index.js +1 -0
- package/dist/participant-agents/index.d.ts +24 -0
- package/dist/participant-agents/index.js +24 -0
- package/dist/participant-agents/ports/agent.dispatcher.port.d.ts +25 -0
- package/dist/participant-agents/ports/agent.dispatcher.port.js +1 -0
- package/dist/participant-agents/ports/agent.repository.port.d.ts +118 -0
- package/dist/participant-agents/ports/agent.repository.port.js +10 -0
- package/dist/participant-agents/ports/agent.tools.port.d.ts +24 -0
- package/dist/participant-agents/ports/agent.tools.port.js +20 -0
- package/dist/participant-agents/ports/index.d.ts +29 -0
- package/dist/participant-agents/ports/index.js +27 -0
- package/dist/participant-agents/public/index.d.ts +39 -0
- package/dist/participant-agents/public/index.js +36 -0
- package/dist/participant-context/application/index.d.ts +73 -0
- package/dist/participant-context/application/index.js +83 -0
- package/dist/participant-context/domain/index.d.ts +67 -0
- package/dist/participant-context/domain/index.js +68 -0
- package/dist/participant-context/index.d.ts +16 -0
- package/dist/participant-context/index.js +16 -0
- package/dist/participant-context/ports/index.d.ts +37 -0
- package/dist/participant-context/ports/index.js +34 -0
- package/dist/participant-context/public/index.d.ts +48 -0
- package/dist/participant-context/public/index.js +55 -0
- package/dist/platform/index.d.ts +19 -0
- package/dist/platform/index.js +23 -0
- package/dist/premise/premise.analyzer.d.ts +0 -1
- package/dist/premise/premise.analyzer.js +0 -2
- package/dist/premise/premise.decomposer.d.ts +0 -1
- package/dist/premise/premise.decomposer.js +0 -2
- package/dist/premise/premise.graph.d.ts +1 -2
- package/dist/premise/premise.graph.js +0 -2
- package/dist/premise/premise.indexer.d.ts +0 -1
- package/dist/premise/premise.indexer.js +0 -2
- package/dist/premise/premise.state.d.ts +1 -2
- package/dist/premise/premise.state.js +0 -1
- package/dist/premise/premise.tools.d.ts +3 -3
- package/dist/premise/premise.tools.js +0 -2
- package/dist/public/index.d.ts +17 -0
- package/dist/public/index.js +17 -0
- package/dist/questioner/questioner.agent.d.ts +4 -27
- package/dist/questioner/questioner.agent.js +3 -133
- package/dist/questioner/questioner.ask.tool.d.ts +3 -12
- package/dist/questioner/questioner.ask.tool.js +3 -299
- package/dist/questioner/questioner.discovery.prompt.d.ts +3 -7
- package/dist/questioner/questioner.discovery.prompt.js +3 -180
- package/dist/questioner/questioner.env.d.ts +3 -57
- package/dist/questioner/questioner.env.js +3 -93
- package/dist/questioner/questioner.presets.d.ts +4 -19
- package/dist/questioner/questioner.presets.js +3 -465
- package/dist/questioner/questioner.qud.d.ts +3 -6
- package/dist/questioner/questioner.qud.js +3 -10
- package/dist/questioner/questioner.tools.d.ts +3 -15
- package/dist/questioner/questioner.tools.js +3 -186
- package/dist/questioner/questioner.types.d.ts +4 -218
- package/dist/questioner/questioner.types.js +5 -62
- package/dist/questions/application/index.d.ts +39 -0
- package/dist/questions/application/index.js +41 -0
- package/dist/questions/application/question.agent.d.ts +28 -0
- package/dist/questions/application/question.agent.js +139 -0
- package/dist/questions/application/question.ask.tool.d.ts +12 -0
- package/dist/questions/application/question.ask.tool.js +300 -0
- package/dist/questions/application/question.discovery.prompt.d.ts +8 -0
- package/dist/questions/application/question.discovery.prompt.js +181 -0
- package/dist/questions/application/question.env.d.ts +61 -0
- package/dist/questions/application/question.env.js +97 -0
- package/dist/questions/application/question.input.d.ts +237 -0
- package/dist/questions/application/question.input.js +61 -0
- package/dist/questions/application/question.presets.d.ts +24 -0
- package/dist/questions/application/question.presets.js +445 -0
- package/dist/questions/application/question.qud.d.ts +12 -0
- package/dist/questions/application/question.qud.js +16 -0
- package/dist/questions/application/question.tools.d.ts +15 -0
- package/dist/questions/application/question.tools.js +190 -0
- package/dist/questions/domain/index.d.ts +25 -0
- package/dist/questions/domain/index.js +25 -0
- package/dist/questions/domain/question.schema.d.ts +1537 -0
- package/dist/questions/domain/question.schema.js +422 -0
- package/dist/questions/index.d.ts +22 -0
- package/dist/questions/index.js +22 -0
- package/dist/questions/ports/index.d.ts +29 -0
- package/dist/questions/ports/index.js +27 -0
- package/dist/questions/ports/question.generator.port.d.ts +34 -0
- package/dist/questions/ports/question.generator.port.js +1 -0
- package/dist/questions/ports/question.persistence.port.d.ts +87 -0
- package/dist/questions/ports/question.persistence.port.js +1 -0
- package/dist/questions/ports/question.tools.port.d.ts +15 -0
- package/dist/questions/ports/question.tools.port.js +1 -0
- package/dist/questions/public/index.d.ts +47 -0
- package/dist/questions/public/index.js +49 -0
- package/dist/runtime/background/index.d.ts +14 -0
- package/dist/runtime/background/index.js +14 -0
- package/dist/runtime/foreground/composition/tool.factory.d.ts +16 -0
- package/dist/runtime/foreground/composition/tool.factory.js +224 -0
- package/dist/runtime/foreground/composition/tool.registry.d.ts +11 -0
- package/dist/runtime/foreground/composition/tool.registry.js +106 -0
- package/dist/runtime/foreground/index.d.ts +13 -0
- package/dist/runtime/foreground/index.js +13 -0
- package/dist/runtime/foreground/signals/intent.tools.d.ts +13 -0
- package/dist/runtime/foreground/signals/intent.tools.js +13 -0
- package/dist/shared/agent/model-signal.d.ts +0 -1
- package/dist/shared/agent/model-signal.js +0 -1
- package/dist/shared/agent/model.config.d.ts +0 -1
- package/dist/shared/agent/model.config.js +0 -1
- package/dist/shared/agent/tool.factory.d.ts +4 -15
- package/dist/shared/agent/tool.factory.js +4 -226
- package/dist/shared/agent/tool.helpers.d.ts +51 -12
- package/dist/shared/agent/tool.helpers.js +0 -1
- package/dist/shared/agent/tool.registry.d.ts +9 -9
- package/dist/shared/agent/tool.registry.js +9 -104
- package/dist/shared/agent/tool.runtime.d.ts +0 -1
- package/dist/shared/agent/tool.runtime.js +0 -1
- package/dist/shared/agent/tool.scope.d.ts +0 -1
- package/dist/shared/agent/tool.scope.js +0 -1
- package/dist/shared/agent/utility.tools.d.ts +5 -3
- package/dist/shared/agent/utility.tools.js +0 -1
- package/dist/shared/assignment/network-assignment.policy.d.ts +0 -1
- package/dist/shared/assignment/network-assignment.policy.js +0 -1
- package/dist/shared/hyde/hyde.documents.d.ts +0 -1
- package/dist/shared/hyde/hyde.documents.js +0 -1
- package/dist/shared/hyde/hyde.env.d.ts +0 -1
- package/dist/shared/hyde/hyde.env.js +0 -1
- package/dist/shared/hyde/hyde.frame.d.ts +4 -5
- package/dist/shared/hyde/hyde.frame.js +0 -1
- package/dist/shared/hyde/hyde.generator.d.ts +0 -1
- package/dist/shared/hyde/hyde.generator.js +0 -1
- package/dist/shared/hyde/hyde.graph.d.ts +0 -1
- package/dist/shared/hyde/hyde.graph.js +0 -1
- package/dist/shared/hyde/hyde.state.d.ts +0 -1
- package/dist/shared/hyde/hyde.state.js +0 -1
- package/dist/shared/hyde/hyde.strategies.d.ts +0 -1
- package/dist/shared/hyde/hyde.strategies.js +0 -1
- package/dist/shared/hyde/hyde.validator.d.ts +0 -1
- package/dist/shared/hyde/hyde.validator.js +0 -1
- package/dist/shared/hyde/lens.inferrer.d.ts +6 -7
- package/dist/shared/hyde/lens.inferrer.js +0 -1
- package/dist/shared/interfaces/agent-dispatcher.interface.d.ts +4 -1
- package/dist/shared/interfaces/agent-dispatcher.interface.js +4 -1
- package/dist/shared/interfaces/agent.interface.d.ts +13 -173
- package/dist/shared/interfaces/agent.interface.js +12 -12
- package/dist/shared/interfaces/auth.interface.d.ts +0 -1
- package/dist/shared/interfaces/auth.interface.js +0 -1
- package/dist/shared/interfaces/cache.interface.d.ts +0 -1
- package/dist/shared/interfaces/cache.interface.js +0 -1
- package/dist/shared/interfaces/chat-message-writer.interface.d.ts +0 -1
- package/dist/shared/interfaces/chat-message-writer.interface.js +0 -1
- package/dist/shared/interfaces/chat-session.interface.d.ts +0 -1
- package/dist/shared/interfaces/chat-session.interface.js +0 -1
- package/dist/shared/interfaces/chat-summary.interface.d.ts +0 -1
- package/dist/shared/interfaces/chat-summary.interface.js +0 -1
- package/dist/shared/interfaces/connect-link.interface.d.ts +0 -1
- package/dist/shared/interfaces/connect-link.interface.js +0 -1
- package/dist/shared/interfaces/contact.interface.d.ts +7 -55
- package/dist/shared/interfaces/contact.interface.js +7 -1
- package/dist/shared/interfaces/database.interface.d.ts +0 -1
- package/dist/shared/interfaces/database.interface.js +0 -1
- package/dist/shared/interfaces/delivery-ledger.interface.d.ts +0 -1
- package/dist/shared/interfaces/delivery-ledger.interface.js +0 -1
- package/dist/shared/interfaces/discovery-run.interface.d.ts +2 -3
- package/dist/shared/interfaces/discovery-run.interface.js +0 -1
- package/dist/shared/interfaces/embedder.interface.d.ts +0 -1
- package/dist/shared/interfaces/embedder.interface.js +0 -1
- package/dist/shared/interfaces/enrichment-run.interface.d.ts +2 -3
- package/dist/shared/interfaces/enrichment-run.interface.js +0 -1
- package/dist/shared/interfaces/enrichment.interface.d.ts +0 -1
- package/dist/shared/interfaces/enrichment.interface.js +0 -1
- package/dist/shared/interfaces/integration.interface.d.ts +6 -88
- package/dist/shared/interfaces/integration.interface.js +7 -1
- package/dist/shared/interfaces/negotiation-events.interface.d.ts +0 -1
- package/dist/shared/interfaces/negotiation-events.interface.js +0 -1
- package/dist/shared/interfaces/negotiation-summary.interface.d.ts +0 -1
- package/dist/shared/interfaces/negotiation-summary.interface.js +0 -1
- package/dist/shared/interfaces/negotiator-memory.interface.d.ts +0 -1
- package/dist/shared/interfaces/negotiator-memory.interface.js +0 -1
- package/dist/shared/interfaces/question-generator.interface.d.ts +3 -28
- package/dist/shared/interfaces/question-generator.interface.js +0 -1
- package/dist/shared/interfaces/questioner.interface.d.ts +3 -77
- package/dist/shared/interfaces/questioner.interface.js +0 -1
- package/dist/shared/interfaces/queue.interface.d.ts +0 -1
- package/dist/shared/interfaces/queue.interface.js +0 -1
- package/dist/shared/interfaces/scraper.interface.d.ts +0 -1
- package/dist/shared/interfaces/scraper.interface.js +0 -1
- package/dist/shared/interfaces/tool-request-context.interface.d.ts +12 -0
- package/dist/shared/interfaces/tool-request-context.interface.js +1 -0
- package/dist/shared/network/metadata.renderer.d.ts +0 -1
- package/dist/shared/network/metadata.renderer.js +0 -1
- package/dist/shared/observability/debug-meta.sanitizer.d.ts +0 -1
- package/dist/shared/observability/debug-meta.sanitizer.js +0 -1
- package/dist/shared/observability/log.d.ts +0 -1
- package/dist/shared/observability/log.js +0 -1
- package/dist/shared/observability/performance.d.ts +0 -1
- package/dist/shared/observability/performance.js +0 -1
- package/dist/shared/observability/protocol.logger.d.ts +0 -1
- package/dist/shared/observability/protocol.logger.js +0 -1
- package/dist/shared/observability/request-context.d.ts +0 -1
- package/dist/shared/observability/request-context.js +0 -1
- package/dist/shared/observability/trace.d.ts +0 -1
- package/dist/shared/observability/trace.js +0 -1
- package/dist/shared/schemas/chat-context.schema.d.ts +0 -1
- package/dist/shared/schemas/chat-context.schema.js +0 -1
- package/dist/shared/schemas/discovery-question.schema.d.ts +17 -18
- package/dist/shared/schemas/discovery-question.schema.js +0 -1
- package/dist/shared/schemas/identity.schema.d.ts +0 -1
- package/dist/shared/schemas/identity.schema.js +0 -1
- package/dist/shared/schemas/mcp-auth.schema.d.ts +0 -1
- package/dist/shared/schemas/mcp-auth.schema.js +0 -1
- package/dist/shared/schemas/negotiation-digest.schema.d.ts +5 -6
- package/dist/shared/schemas/negotiation-digest.schema.js +0 -1
- package/dist/shared/schemas/negotiation-state.schema.d.ts +4 -5
- package/dist/shared/schemas/negotiation-state.schema.js +0 -1
- package/dist/shared/schemas/network-assignment.schema.d.ts +0 -1
- package/dist/shared/schemas/network-assignment.schema.js +0 -1
- package/dist/shared/schemas/pending-question.schema.d.ts +0 -1
- package/dist/shared/schemas/pending-question.schema.js +0 -1
- package/dist/shared/schemas/question.schema.d.ts +3 -1505
- package/dist/shared/schemas/question.schema.js +3 -410
- package/dist/shared/ui/lucide.icon-catalog.d.ts +0 -1
- package/dist/shared/ui/lucide.icon-catalog.js +0 -1
- package/dist/shared/utils/social-label.d.ts +0 -1
- package/dist/shared/utils/social-label.js +0 -1
- package/dist/shared/utils/telegram-handle.d.ts +0 -1
- package/dist/shared/utils/telegram-handle.js +0 -1
- package/dist/signals/application/index.d.ts +19 -0
- package/dist/signals/application/index.js +22 -0
- package/dist/signals/application/intent.clarifier.d.ts +51 -0
- package/dist/signals/application/intent.clarifier.js +201 -0
- package/dist/signals/application/intent.graph.d.ts +552 -0
- package/dist/signals/application/intent.graph.js +938 -0
- package/dist/signals/application/intent.indexer.d.ts +82 -0
- package/dist/signals/application/intent.indexer.js +170 -0
- package/dist/signals/application/intent.inferrer.d.ts +94 -0
- package/dist/signals/application/intent.inferrer.js +233 -0
- package/dist/signals/application/intent.reconciler.d.ts +105 -0
- package/dist/signals/application/intent.reconciler.js +186 -0
- package/dist/signals/application/intent.tools.d.ts +24 -0
- package/dist/signals/application/intent.tools.js +789 -0
- package/dist/signals/application/intent.verifier.d.ts +115 -0
- package/dist/signals/application/intent.verifier.js +262 -0
- package/dist/signals/domain/index.d.ts +9 -0
- package/dist/signals/domain/index.js +11 -0
- package/dist/signals/domain/intent.state.d.ts +230 -0
- package/dist/signals/domain/intent.state.js +190 -0
- package/dist/signals/domain/signal.specificity.d.ts +2 -0
- package/dist/signals/domain/signal.specificity.js +2 -0
- package/dist/signals/index.d.ts +13 -0
- package/dist/signals/index.js +13 -0
- package/dist/signals/ports/index.d.ts +15 -0
- package/dist/signals/ports/index.js +13 -0
- package/dist/signals/public/index.d.ts +15 -0
- package/dist/signals/public/index.js +16 -0
- package/package.json +14 -3
- package/dist/agent/agent.tools.d.ts.map +0 -1
- package/dist/agent/agent.tools.js.map +0 -1
- package/dist/agent/tests/fakes.d.ts +0 -25
- package/dist/agent/tests/fakes.d.ts.map +0 -1
- package/dist/agent/tests/fakes.js +0 -178
- package/dist/agent/tests/fakes.js.map +0 -1
- package/dist/chat/chat-streaming.types.d.ts.map +0 -1
- package/dist/chat/chat-streaming.types.js.map +0 -1
- package/dist/chat/chat.agent.d.ts.map +0 -1
- package/dist/chat/chat.agent.js.map +0 -1
- package/dist/chat/chat.graph.d.ts.map +0 -1
- package/dist/chat/chat.graph.js.map +0 -1
- package/dist/chat/chat.interrupt.classifier.d.ts.map +0 -1
- package/dist/chat/chat.interrupt.classifier.js.map +0 -1
- package/dist/chat/chat.persona.d.ts.map +0 -1
- package/dist/chat/chat.persona.js.map +0 -1
- package/dist/chat/chat.prompt.d.ts.map +0 -1
- package/dist/chat/chat.prompt.js.map +0 -1
- package/dist/chat/chat.prompt.modules.d.ts.map +0 -1
- package/dist/chat/chat.prompt.modules.js.map +0 -1
- package/dist/chat/chat.question-dedup.d.ts.map +0 -1
- package/dist/chat/chat.question-dedup.js.map +0 -1
- package/dist/chat/chat.state.d.ts.map +0 -1
- package/dist/chat/chat.state.js.map +0 -1
- package/dist/chat/chat.streamer.d.ts.map +0 -1
- package/dist/chat/chat.streamer.js.map +0 -1
- package/dist/chat/chat.suggester.d.ts.map +0 -1
- package/dist/chat/chat.suggester.js.map +0 -1
- package/dist/chat/chat.summarizer.d.ts.map +0 -1
- package/dist/chat/chat.summarizer.js.map +0 -1
- package/dist/chat/chat.title.generator.d.ts.map +0 -1
- package/dist/chat/chat.title.generator.js.map +0 -1
- package/dist/chat/chat.tools.d.ts.map +0 -1
- package/dist/chat/chat.tools.js.map +0 -1
- package/dist/chat/chat.utils.d.ts.map +0 -1
- package/dist/chat/chat.utils.js.map +0 -1
- package/dist/chat/negotiator.persona.d.ts.map +0 -1
- package/dist/chat/negotiator.persona.js.map +0 -1
- package/dist/chat/negotiator.prompt.d.ts.map +0 -1
- package/dist/chat/negotiator.prompt.js.map +0 -1
- package/dist/chat/negotiator.tools.d.ts.map +0 -1
- package/dist/chat/negotiator.tools.js.map +0 -1
- package/dist/chat/onboarding.persona.d.ts.map +0 -1
- package/dist/chat/onboarding.persona.js.map +0 -1
- package/dist/chat/onboarding.prompt.d.ts.map +0 -1
- package/dist/chat/onboarding.prompt.js.map +0 -1
- package/dist/chat/reporter.action.tools.d.ts.map +0 -1
- package/dist/chat/reporter.action.tools.js.map +0 -1
- package/dist/chat/reporter.persona.d.ts.map +0 -1
- package/dist/chat/reporter.persona.js.map +0 -1
- package/dist/chat/reporter.prompt.d.ts.map +0 -1
- package/dist/chat/reporter.prompt.js.map +0 -1
- package/dist/chat/signal.persona.d.ts.map +0 -1
- package/dist/chat/signal.persona.js.map +0 -1
- package/dist/chat/signal.prompt.d.ts.map +0 -1
- package/dist/chat/signal.prompt.js.map +0 -1
- package/dist/chat/tests/chat.graph.mocks.d.ts +0 -98
- package/dist/chat/tests/chat.graph.mocks.d.ts.map +0 -1
- package/dist/chat/tests/chat.graph.mocks.js +0 -225
- package/dist/chat/tests/chat.graph.mocks.js.map +0 -1
- package/dist/contact/contact.inviter.d.ts.map +0 -1
- package/dist/contact/contact.inviter.js.map +0 -1
- package/dist/contact/contact.tools.d.ts.map +0 -1
- package/dist/contact/contact.tools.js.map +0 -1
- package/dist/context/context.generator.d.ts.map +0 -1
- package/dist/context/context.generator.js.map +0 -1
- package/dist/enrichment/enrichment.enricher.d.ts.map +0 -1
- package/dist/enrichment/enrichment.enricher.js.map +0 -1
- package/dist/enrichment/enrichment.generator.d.ts.map +0 -1
- package/dist/enrichment/enrichment.generator.js.map +0 -1
- package/dist/enrichment/enrichment.graph.d.ts.map +0 -1
- package/dist/enrichment/enrichment.graph.js.map +0 -1
- package/dist/enrichment/enrichment.state.d.ts.map +0 -1
- package/dist/enrichment/enrichment.state.js.map +0 -1
- package/dist/enrichment/enrichment.tools.d.ts.map +0 -1
- package/dist/enrichment/enrichment.tools.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/integration/integration.tools.d.ts.map +0 -1
- package/dist/integration/integration.tools.js.map +0 -1
- package/dist/intent/intent.clarifier.d.ts.map +0 -1
- package/dist/intent/intent.clarifier.js.map +0 -1
- package/dist/intent/intent.graph.d.ts.map +0 -1
- package/dist/intent/intent.graph.js.map +0 -1
- package/dist/intent/intent.indexer.d.ts.map +0 -1
- package/dist/intent/intent.indexer.js.map +0 -1
- package/dist/intent/intent.inferrer.d.ts.map +0 -1
- package/dist/intent/intent.inferrer.js.map +0 -1
- package/dist/intent/intent.reconciler.d.ts.map +0 -1
- package/dist/intent/intent.reconciler.js.map +0 -1
- package/dist/intent/intent.specificity.d.ts.map +0 -1
- package/dist/intent/intent.specificity.js.map +0 -1
- package/dist/intent/intent.state.d.ts.map +0 -1
- package/dist/intent/intent.state.js.map +0 -1
- package/dist/intent/intent.tools.d.ts.map +0 -1
- package/dist/intent/intent.tools.js.map +0 -1
- package/dist/intent/intent.verifier.d.ts.map +0 -1
- package/dist/intent/intent.verifier.js.map +0 -1
- package/dist/maintenance/maintenance.graph.d.ts.map +0 -1
- package/dist/maintenance/maintenance.graph.js.map +0 -1
- package/dist/maintenance/maintenance.state.d.ts.map +0 -1
- package/dist/maintenance/maintenance.state.js.map +0 -1
- package/dist/mcp/elicitation.builder.d.ts.map +0 -1
- package/dist/mcp/elicitation.builder.js.map +0 -1
- package/dist/mcp/elicitation.dispatcher.d.ts.map +0 -1
- package/dist/mcp/elicitation.dispatcher.js.map +0 -1
- package/dist/mcp/mcp.server.d.ts.map +0 -1
- package/dist/mcp/mcp.server.js.map +0 -1
- package/dist/negotiation/insight.generator.d.ts.map +0 -1
- package/dist/negotiation/insight.generator.js.map +0 -1
- package/dist/negotiation/negotiation.agent.d.ts.map +0 -1
- package/dist/negotiation/negotiation.agent.js.map +0 -1
- package/dist/negotiation/negotiation.attribution.d.ts.map +0 -1
- package/dist/negotiation/negotiation.attribution.js.map +0 -1
- package/dist/negotiation/negotiation.consultation-policy.d.ts.map +0 -1
- package/dist/negotiation/negotiation.consultation-policy.js.map +0 -1
- package/dist/negotiation/negotiation.deadlock.d.ts.map +0 -1
- package/dist/negotiation/negotiation.deadlock.js.map +0 -1
- package/dist/negotiation/negotiation.graph.d.ts.map +0 -1
- package/dist/negotiation/negotiation.graph.js.map +0 -1
- package/dist/negotiation/negotiation.memory.d.ts.map +0 -1
- package/dist/negotiation/negotiation.memory.js.map +0 -1
- package/dist/negotiation/negotiation.protocol.d.ts.map +0 -1
- package/dist/negotiation/negotiation.protocol.js.map +0 -1
- package/dist/negotiation/negotiation.question-safety.d.ts.map +0 -1
- package/dist/negotiation/negotiation.question-safety.js.map +0 -1
- package/dist/negotiation/negotiation.reflect.d.ts.map +0 -1
- package/dist/negotiation/negotiation.reflect.js.map +0 -1
- package/dist/negotiation/negotiation.screen.d.ts.map +0 -1
- package/dist/negotiation/negotiation.screen.js.map +0 -1
- package/dist/negotiation/negotiation.state.d.ts.map +0 -1
- package/dist/negotiation/negotiation.state.js.map +0 -1
- package/dist/negotiation/negotiation.summarizer.d.ts.map +0 -1
- package/dist/negotiation/negotiation.summarizer.js.map +0 -1
- package/dist/negotiation/negotiation.tools.d.ts.map +0 -1
- package/dist/negotiation/negotiation.tools.js.map +0 -1
- package/dist/network/indexer/indexer.graph.d.ts.map +0 -1
- package/dist/network/indexer/indexer.graph.js.map +0 -1
- package/dist/network/indexer/indexer.state.d.ts.map +0 -1
- package/dist/network/indexer/indexer.state.js.map +0 -1
- package/dist/network/membership/membership.graph.d.ts.map +0 -1
- package/dist/network/membership/membership.graph.js.map +0 -1
- package/dist/network/membership/membership.state.d.ts.map +0 -1
- package/dist/network/membership/membership.state.js.map +0 -1
- package/dist/network/network.graph.d.ts.map +0 -1
- package/dist/network/network.graph.js.map +0 -1
- package/dist/network/network.recommender.d.ts.map +0 -1
- package/dist/network/network.recommender.js.map +0 -1
- package/dist/network/network.state.d.ts.map +0 -1
- package/dist/network/network.state.js.map +0 -1
- package/dist/network/network.tools.d.ts.map +0 -1
- package/dist/network/network.tools.js.map +0 -1
- package/dist/opportunity/delivery-card.cache.d.ts.map +0 -1
- package/dist/opportunity/delivery-card.cache.js.map +0 -1
- package/dist/opportunity/discovery-question.helper.d.ts.map +0 -1
- package/dist/opportunity/discovery-question.helper.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.adjustments.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.adjustments.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.assigner.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.assigner.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.env.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.env.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.miner.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.miner.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.push.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.push.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.question.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.question.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.scorer.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.scorer.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.shadow.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.shadow.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.types.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.types.js.map +0 -1
- package/dist/opportunity/feed/feed.categorizer.d.ts.map +0 -1
- package/dist/opportunity/feed/feed.categorizer.js.map +0 -1
- package/dist/opportunity/feed/feed.graph.d.ts.map +0 -1
- package/dist/opportunity/feed/feed.graph.js.map +0 -1
- package/dist/opportunity/feed/feed.health.d.ts.map +0 -1
- package/dist/opportunity/feed/feed.health.js.map +0 -1
- package/dist/opportunity/feed/feed.state.d.ts.map +0 -1
- package/dist/opportunity/feed/feed.state.js.map +0 -1
- package/dist/opportunity/negotiation-context.loader.d.ts.map +0 -1
- package/dist/opportunity/negotiation-context.loader.js.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.env.d.ts.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.env.js.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.extractor.d.ts.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.extractor.js.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.miner.d.ts.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.miner.js.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.shadow.d.ts.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.shadow.js.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.types.d.ts.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.types.js.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.verifier.d.ts.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.verifier.js.map +0 -1
- package/dist/opportunity/negotiation-summary.builder.d.ts.map +0 -1
- package/dist/opportunity/negotiation-summary.builder.js.map +0 -1
- package/dist/opportunity/opportunity.actor.d.ts.map +0 -1
- package/dist/opportunity/opportunity.actor.js.map +0 -1
- package/dist/opportunity/opportunity.claim-safety.d.ts.map +0 -1
- package/dist/opportunity/opportunity.claim-safety.js.map +0 -1
- package/dist/opportunity/opportunity.discover.d.ts.map +0 -1
- package/dist/opportunity/opportunity.discover.js.map +0 -1
- package/dist/opportunity/opportunity.enricher.d.ts.map +0 -1
- package/dist/opportunity/opportunity.enricher.js.map +0 -1
- package/dist/opportunity/opportunity.evaluator.d.ts.map +0 -1
- package/dist/opportunity/opportunity.evaluator.js.map +0 -1
- package/dist/opportunity/opportunity.evidence.d.ts.map +0 -1
- package/dist/opportunity/opportunity.evidence.js.map +0 -1
- package/dist/opportunity/opportunity.graph.d.ts.map +0 -1
- package/dist/opportunity/opportunity.graph.js.map +0 -1
- package/dist/opportunity/opportunity.introducer.d.ts.map +0 -1
- package/dist/opportunity/opportunity.introducer.js.map +0 -1
- package/dist/opportunity/opportunity.labels.d.ts.map +0 -1
- package/dist/opportunity/opportunity.labels.js.map +0 -1
- package/dist/opportunity/opportunity.pending-questions.d.ts.map +0 -1
- package/dist/opportunity/opportunity.pending-questions.js.map +0 -1
- package/dist/opportunity/opportunity.persist.d.ts.map +0 -1
- package/dist/opportunity/opportunity.persist.js.map +0 -1
- package/dist/opportunity/opportunity.presentation-cache.d.ts.map +0 -1
- package/dist/opportunity/opportunity.presentation-cache.js.map +0 -1
- package/dist/opportunity/opportunity.presentation.d.ts.map +0 -1
- package/dist/opportunity/opportunity.presentation.js.map +0 -1
- package/dist/opportunity/opportunity.presenter.d.ts.map +0 -1
- package/dist/opportunity/opportunity.presenter.js.map +0 -1
- package/dist/opportunity/opportunity.safe-presentation.d.ts.map +0 -1
- package/dist/opportunity/opportunity.safe-presentation.js.map +0 -1
- package/dist/opportunity/opportunity.state.d.ts.map +0 -1
- package/dist/opportunity/opportunity.state.js.map +0 -1
- package/dist/opportunity/opportunity.tools.d.ts.map +0 -1
- package/dist/opportunity/opportunity.tools.js.map +0 -1
- package/dist/opportunity/opportunity.utils.d.ts.map +0 -1
- package/dist/opportunity/opportunity.utils.js.map +0 -1
- package/dist/opportunity/outcome/outcome.env.d.ts.map +0 -1
- package/dist/opportunity/outcome/outcome.env.js.map +0 -1
- package/dist/opportunity/outcome/outcome.hypotheses.d.ts.map +0 -1
- package/dist/opportunity/outcome/outcome.hypotheses.js.map +0 -1
- package/dist/opportunity/outcome/outcome.shadow.d.ts.map +0 -1
- package/dist/opportunity/outcome/outcome.shadow.js.map +0 -1
- package/dist/opportunity/outcome/outcome.types.d.ts.map +0 -1
- package/dist/opportunity/outcome/outcome.types.js.map +0 -1
- package/dist/premise/premise.analyzer.d.ts.map +0 -1
- package/dist/premise/premise.analyzer.js.map +0 -1
- package/dist/premise/premise.decomposer.d.ts.map +0 -1
- package/dist/premise/premise.decomposer.js.map +0 -1
- package/dist/premise/premise.graph.d.ts.map +0 -1
- package/dist/premise/premise.graph.js.map +0 -1
- package/dist/premise/premise.indexer.d.ts.map +0 -1
- package/dist/premise/premise.indexer.js.map +0 -1
- package/dist/premise/premise.state.d.ts.map +0 -1
- package/dist/premise/premise.state.js.map +0 -1
- package/dist/premise/premise.tools.d.ts.map +0 -1
- package/dist/premise/premise.tools.js.map +0 -1
- package/dist/questioner/questioner.agent.d.ts.map +0 -1
- package/dist/questioner/questioner.agent.js.map +0 -1
- package/dist/questioner/questioner.ask.tool.d.ts.map +0 -1
- package/dist/questioner/questioner.ask.tool.js.map +0 -1
- package/dist/questioner/questioner.discovery.prompt.d.ts.map +0 -1
- package/dist/questioner/questioner.discovery.prompt.js.map +0 -1
- package/dist/questioner/questioner.env.d.ts.map +0 -1
- package/dist/questioner/questioner.env.js.map +0 -1
- package/dist/questioner/questioner.presets.d.ts.map +0 -1
- package/dist/questioner/questioner.presets.js.map +0 -1
- package/dist/questioner/questioner.qud.d.ts.map +0 -1
- package/dist/questioner/questioner.qud.js.map +0 -1
- package/dist/questioner/questioner.tools.d.ts.map +0 -1
- package/dist/questioner/questioner.tools.js.map +0 -1
- package/dist/questioner/questioner.types.d.ts.map +0 -1
- package/dist/questioner/questioner.types.js.map +0 -1
- package/dist/shared/agent/model-signal.d.ts.map +0 -1
- package/dist/shared/agent/model-signal.js.map +0 -1
- package/dist/shared/agent/model.config.d.ts.map +0 -1
- package/dist/shared/agent/model.config.js.map +0 -1
- package/dist/shared/agent/tests/llm-assert.d.ts +0 -11
- package/dist/shared/agent/tests/llm-assert.d.ts.map +0 -1
- package/dist/shared/agent/tests/llm-assert.js +0 -43
- package/dist/shared/agent/tests/llm-assert.js.map +0 -1
- package/dist/shared/agent/tool.factory.d.ts.map +0 -1
- package/dist/shared/agent/tool.factory.js.map +0 -1
- package/dist/shared/agent/tool.helpers.d.ts.map +0 -1
- package/dist/shared/agent/tool.helpers.js.map +0 -1
- package/dist/shared/agent/tool.registry.d.ts.map +0 -1
- package/dist/shared/agent/tool.registry.js.map +0 -1
- package/dist/shared/agent/tool.runtime.d.ts.map +0 -1
- package/dist/shared/agent/tool.runtime.js.map +0 -1
- package/dist/shared/agent/tool.scope.d.ts.map +0 -1
- package/dist/shared/agent/tool.scope.js.map +0 -1
- package/dist/shared/agent/utility.tools.d.ts.map +0 -1
- package/dist/shared/agent/utility.tools.js.map +0 -1
- package/dist/shared/assignment/network-assignment.policy.d.ts.map +0 -1
- package/dist/shared/assignment/network-assignment.policy.js.map +0 -1
- package/dist/shared/hyde/hyde.documents.d.ts.map +0 -1
- package/dist/shared/hyde/hyde.documents.js.map +0 -1
- package/dist/shared/hyde/hyde.env.d.ts.map +0 -1
- package/dist/shared/hyde/hyde.env.js.map +0 -1
- package/dist/shared/hyde/hyde.frame.d.ts.map +0 -1
- package/dist/shared/hyde/hyde.frame.js.map +0 -1
- package/dist/shared/hyde/hyde.generator.d.ts.map +0 -1
- package/dist/shared/hyde/hyde.generator.js.map +0 -1
- package/dist/shared/hyde/hyde.graph.d.ts.map +0 -1
- package/dist/shared/hyde/hyde.graph.js.map +0 -1
- package/dist/shared/hyde/hyde.state.d.ts.map +0 -1
- package/dist/shared/hyde/hyde.state.js.map +0 -1
- package/dist/shared/hyde/hyde.strategies.d.ts.map +0 -1
- package/dist/shared/hyde/hyde.strategies.js.map +0 -1
- package/dist/shared/hyde/hyde.validator.d.ts.map +0 -1
- package/dist/shared/hyde/hyde.validator.js.map +0 -1
- package/dist/shared/hyde/lens.inferrer.d.ts.map +0 -1
- package/dist/shared/hyde/lens.inferrer.js.map +0 -1
- package/dist/shared/interfaces/agent-dispatcher.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/agent-dispatcher.interface.js.map +0 -1
- package/dist/shared/interfaces/agent.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/agent.interface.js.map +0 -1
- package/dist/shared/interfaces/auth.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/auth.interface.js.map +0 -1
- package/dist/shared/interfaces/cache.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/cache.interface.js.map +0 -1
- package/dist/shared/interfaces/chat-message-writer.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/chat-message-writer.interface.js.map +0 -1
- package/dist/shared/interfaces/chat-session.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/chat-session.interface.js.map +0 -1
- package/dist/shared/interfaces/chat-summary.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/chat-summary.interface.js.map +0 -1
- package/dist/shared/interfaces/connect-link.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/connect-link.interface.js.map +0 -1
- package/dist/shared/interfaces/contact.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/contact.interface.js.map +0 -1
- package/dist/shared/interfaces/database.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/database.interface.js.map +0 -1
- package/dist/shared/interfaces/delivery-ledger.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/delivery-ledger.interface.js.map +0 -1
- package/dist/shared/interfaces/discovery-run.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/discovery-run.interface.js.map +0 -1
- package/dist/shared/interfaces/embedder.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/embedder.interface.js.map +0 -1
- package/dist/shared/interfaces/enrichment-run.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/enrichment-run.interface.js.map +0 -1
- package/dist/shared/interfaces/enrichment.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/enrichment.interface.js.map +0 -1
- package/dist/shared/interfaces/integration.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/integration.interface.js.map +0 -1
- package/dist/shared/interfaces/negotiation-events.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/negotiation-events.interface.js.map +0 -1
- package/dist/shared/interfaces/negotiation-summary.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/negotiation-summary.interface.js.map +0 -1
- package/dist/shared/interfaces/negotiator-memory.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/negotiator-memory.interface.js.map +0 -1
- package/dist/shared/interfaces/question-generator.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/question-generator.interface.js.map +0 -1
- package/dist/shared/interfaces/questioner.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/questioner.interface.js.map +0 -1
- package/dist/shared/interfaces/queue.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/queue.interface.js.map +0 -1
- package/dist/shared/interfaces/scraper.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/scraper.interface.js.map +0 -1
- package/dist/shared/network/metadata.renderer.d.ts.map +0 -1
- package/dist/shared/network/metadata.renderer.js.map +0 -1
- package/dist/shared/observability/debug-meta.sanitizer.d.ts.map +0 -1
- package/dist/shared/observability/debug-meta.sanitizer.js.map +0 -1
- package/dist/shared/observability/log.d.ts.map +0 -1
- package/dist/shared/observability/log.js.map +0 -1
- package/dist/shared/observability/performance.d.ts.map +0 -1
- package/dist/shared/observability/performance.js.map +0 -1
- package/dist/shared/observability/protocol.logger.d.ts.map +0 -1
- package/dist/shared/observability/protocol.logger.js.map +0 -1
- package/dist/shared/observability/request-context.d.ts.map +0 -1
- package/dist/shared/observability/request-context.js.map +0 -1
- package/dist/shared/observability/trace.d.ts.map +0 -1
- package/dist/shared/observability/trace.js.map +0 -1
- package/dist/shared/schemas/chat-context.schema.d.ts.map +0 -1
- package/dist/shared/schemas/chat-context.schema.js.map +0 -1
- package/dist/shared/schemas/discovery-question.schema.d.ts.map +0 -1
- package/dist/shared/schemas/discovery-question.schema.js.map +0 -1
- package/dist/shared/schemas/identity.schema.d.ts.map +0 -1
- package/dist/shared/schemas/identity.schema.js.map +0 -1
- package/dist/shared/schemas/mcp-auth.schema.d.ts.map +0 -1
- package/dist/shared/schemas/mcp-auth.schema.js.map +0 -1
- package/dist/shared/schemas/negotiation-digest.schema.d.ts.map +0 -1
- package/dist/shared/schemas/negotiation-digest.schema.js.map +0 -1
- package/dist/shared/schemas/negotiation-state.schema.d.ts.map +0 -1
- package/dist/shared/schemas/negotiation-state.schema.js.map +0 -1
- package/dist/shared/schemas/network-assignment.schema.d.ts.map +0 -1
- package/dist/shared/schemas/network-assignment.schema.js.map +0 -1
- package/dist/shared/schemas/pending-question.schema.d.ts.map +0 -1
- package/dist/shared/schemas/pending-question.schema.js.map +0 -1
- package/dist/shared/schemas/question.schema.d.ts.map +0 -1
- package/dist/shared/schemas/question.schema.js.map +0 -1
- package/dist/shared/ui/lucide.icon-catalog.d.ts.map +0 -1
- package/dist/shared/ui/lucide.icon-catalog.js.map +0 -1
- package/dist/shared/utils/social-label.d.ts.map +0 -1
- package/dist/shared/utils/social-label.js.map +0 -1
- package/dist/shared/utils/telegram-handle.d.ts.map +0 -1
- package/dist/shared/utils/telegram-handle.js.map +0 -1
|
@@ -1,919 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Invokes the opportunity graph with the query as sourceText. The HyDE graph's
|
|
5
|
-
* LensInferrer automatically infers search lenses from the query, replacing the
|
|
6
|
-
* old hardcoded strategy selection. Returns formatted candidates (enriched with
|
|
7
|
-
* profile name/bio) for chat display.
|
|
8
|
-
*
|
|
9
|
-
* Used by the discover_opportunities chat tool.
|
|
2
|
+
* Thin backward-compat shim — IND-551.
|
|
3
|
+
* Canonical location: opportunity/application/opportunity.discover.ts
|
|
10
4
|
*/
|
|
11
|
-
|
|
12
|
-
import { gatherPresenterContext } from "./opportunity.presenter.js";
|
|
13
|
-
import { MINIMAL_MAIN_TEXT_MAX_CHARS, getPrimaryActionLabel, SECONDARY_ACTION_LABEL } from "./opportunity.labels.js";
|
|
14
|
-
import { narratorRemarkFromReasoning } from "./opportunity.presentation.js";
|
|
15
|
-
import { safeFallbackSummary } from "./opportunity.safe-presentation.js";
|
|
16
|
-
import { protocolLogger, withCallLogging } from "../shared/observability/protocol.logger.js";
|
|
17
|
-
import { buildFallbackDigest } from "../negotiation/negotiation.summarizer.js";
|
|
18
|
-
import { traceAgent, tracePhase } from "../shared/observability/trace.js";
|
|
19
|
-
import { requestContext } from "../shared/observability/request-context.js";
|
|
20
|
-
import { buildDiscoveryQuestionInput } from "./discovery-question.helper.js";
|
|
21
|
-
import { invokeWithAbortSignal } from "../shared/agent/model-signal.js";
|
|
22
|
-
const logger = protocolLogger("OpportunityDiscover");
|
|
23
|
-
const discoverFromQueryLog = protocolLogger("OpportunityDiscover:runDiscoverFromQuery");
|
|
24
|
-
const enrichLog = protocolLogger("OpportunityDiscover:enrichOpportunities");
|
|
25
|
-
/**
|
|
26
|
-
* Per-negotiation summarizer budget. The summarizer fires one LLM call per
|
|
27
|
-
* partial-or-full negotiation (concurrently via Promise.all). Without a cap
|
|
28
|
-
* one slow OpenRouter route dominates the post-discovery tail and pushes the
|
|
29
|
-
* whole MCP response past Railway's ~60 s no-upstream-bytes timeout. Falls
|
|
30
|
-
* back to a deterministic digest when the deadline fires, so question
|
|
31
|
-
* generation still has structured input.
|
|
32
|
-
*/
|
|
33
|
-
const NEGOTIATION_SUMMARY_TIMEOUT_MS_DEFAULT = 5000;
|
|
34
|
-
/**
|
|
35
|
-
* Parse a positive integer env var, clamped to the safe-integer range so a
|
|
36
|
-
* malformed env value cannot crash `AbortSignal.timeout` (which throws on
|
|
37
|
-
* values outside `[0, MAX_SAFE_INTEGER]`). Mirrors the precedent in
|
|
38
|
-
* `negotiation.agent.ts` (`isValidTimeoutMs`).
|
|
39
|
-
*/
|
|
40
|
-
function parsePositiveIntEnv(name, fallback) {
|
|
41
|
-
const raw = process.env[name];
|
|
42
|
-
if (!raw)
|
|
43
|
-
return fallback;
|
|
44
|
-
const n = Number.parseInt(raw, 10);
|
|
45
|
-
if (!Number.isFinite(n) || n <= 0 || n > Number.MAX_SAFE_INTEGER)
|
|
46
|
-
return fallback;
|
|
47
|
-
return n;
|
|
48
|
-
}
|
|
49
|
-
function combineWithDeadline(callerSignal, deadlineMs) {
|
|
50
|
-
const deadline = AbortSignal.timeout(deadlineMs);
|
|
51
|
-
if (!callerSignal)
|
|
52
|
-
return deadline;
|
|
53
|
-
return AbortSignal.any([callerSignal, deadline]);
|
|
54
|
-
}
|
|
55
|
-
/** Max chars for bio and matchReason in chat tool results to keep context manageable. */
|
|
56
|
-
const MAX_FIELD_CHARS = 100;
|
|
57
|
-
function truncateForChat(s, max = MAX_FIELD_CHARS) {
|
|
58
|
-
if (s == null || s === "")
|
|
59
|
-
return undefined;
|
|
60
|
-
const trimmed = s.trim();
|
|
61
|
-
if (trimmed.length <= max)
|
|
62
|
-
return trimmed;
|
|
63
|
-
return trimmed.slice(0, max) + "...";
|
|
64
|
-
}
|
|
65
|
-
/** Statuses for which an existing connection may be shown as a card; others (accepted, rejected, expired) are only mentioned in text. */
|
|
66
|
-
const EXISTING_CONNECTION_CARD_STATUSES = ['draft', 'latent', 'pending'];
|
|
67
|
-
/**
|
|
68
|
-
* Enrich raw opportunities with profile data, presentation (LLM or minimal),
|
|
69
|
-
* and narrator chips. Shared by both `runDiscoverFromQuery` and `continueDiscovery`
|
|
70
|
-
* to avoid duplicating the profile-lookup / presenter / card-formatting logic.
|
|
71
|
-
*
|
|
72
|
-
* @param input - Enrichment context (opportunities, database, viewer, presentation options).
|
|
73
|
-
* @returns Formatted discovery candidates ready for chat or home card display.
|
|
74
|
-
*/
|
|
75
|
-
async function enrichOpportunities(input) {
|
|
76
|
-
const { opportunities, database, userId, chatSessionId, minimalForChat, presenter, useHomeCardFormat, debugSteps, existingOpportunityIds, preserveLifecycleStatus, targetUserId, } = input;
|
|
77
|
-
const baseEnrichedRaw = await Promise.all(opportunities.map(async (opp) => {
|
|
78
|
-
const viewerIsIntroducer = opp.actors.some((a) => a.role === 'introducer' && a.userId === userId);
|
|
79
|
-
// When the viewer is the introducer, the "candidate" for the card is the agent
|
|
80
|
-
// (the discovered person), not the patient (the intro target / onBehalfOfUserId).
|
|
81
|
-
// For non-introducer views, pick the first non-viewer, non-introducer actor.
|
|
82
|
-
const nonViewerNonIntroducerActors = opp.actors.filter((a) => a.userId !== userId && a.role !== 'introducer');
|
|
83
|
-
const candidateActor = viewerIsIntroducer
|
|
84
|
-
? (nonViewerNonIntroducerActors.find((a) => a.role === 'agent') ?? nonViewerNonIntroducerActors[0])
|
|
85
|
-
: nonViewerNonIntroducerActors[0];
|
|
86
|
-
const candidateUserId = candidateActor?.userId ?? "";
|
|
87
|
-
const viewerActor = opp.actors.find((a) => a.userId === userId);
|
|
88
|
-
const [profile, candidateUser] = candidateUserId
|
|
89
|
-
? await Promise.all([database.getProfile(candidateUserId), database.getUser(candidateUserId)])
|
|
90
|
-
: [null, null];
|
|
91
|
-
// Skip soft-deleted users (deletedAt is set)
|
|
92
|
-
if (candidateUser && 'deletedAt' in candidateUser && candidateUser.deletedAt)
|
|
93
|
-
return null;
|
|
94
|
-
const isDirectTarget = targetUserId && candidateUserId === targetUserId;
|
|
95
|
-
if (!isDirectTarget && !candidateUser?.isGhost && !profile)
|
|
96
|
-
return null;
|
|
97
|
-
const confidence = typeof opp.interpretation?.confidence === "number"
|
|
98
|
-
? opp.interpretation.confidence
|
|
99
|
-
: parseFloat(String(opp.interpretation?.confidence ?? 0)) || 0;
|
|
100
|
-
return {
|
|
101
|
-
opportunity: opp,
|
|
102
|
-
candidateUserId,
|
|
103
|
-
viewerRole: viewerActor?.role ?? "party",
|
|
104
|
-
viewerApproved: viewerActor?.approved === true,
|
|
105
|
-
viewerActedAt: viewerActor?.actedAt ?? null,
|
|
106
|
-
candidateUser,
|
|
107
|
-
profile,
|
|
108
|
-
confidence,
|
|
109
|
-
};
|
|
110
|
-
}));
|
|
111
|
-
const baseEnriched = baseEnrichedRaw.filter((item) => item !== null);
|
|
112
|
-
debugSteps.push({
|
|
113
|
-
step: "enrich_profiles",
|
|
114
|
-
detail: `${baseEnriched.length} profile(s)`,
|
|
115
|
-
});
|
|
116
|
-
// Batch-fetch user records (candidates, introducers, and other party actors) for name/avatar fallback.
|
|
117
|
-
const allActorUserIds = new Set();
|
|
118
|
-
for (const item of baseEnriched) {
|
|
119
|
-
for (const actor of item.opportunity.actors) {
|
|
120
|
-
if (actor.userId && actor.userId !== userId) {
|
|
121
|
-
allActorUserIds.add(actor.userId);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
const candidateUserIds = [...allActorUserIds];
|
|
126
|
-
const [viewerUser, ...userResults] = await Promise.all([
|
|
127
|
-
database.getUser(userId),
|
|
128
|
-
...candidateUserIds.map((id) => database.getUser(id)),
|
|
129
|
-
]);
|
|
130
|
-
const avatarByUserId = new Map();
|
|
131
|
-
const nameByUserId = new Map();
|
|
132
|
-
const isGhostByUserId = new Map();
|
|
133
|
-
candidateUserIds.forEach((id, i) => {
|
|
134
|
-
const user = userResults[i] ?? null;
|
|
135
|
-
avatarByUserId.set(id, user?.avatar ?? null);
|
|
136
|
-
nameByUserId.set(id, user?.name ?? null);
|
|
137
|
-
isGhostByUserId.set(id, user?.isGhost ?? false);
|
|
138
|
-
});
|
|
139
|
-
const viewerName = viewerUser?.name ?? undefined;
|
|
140
|
-
// Retry name resolution for candidates whose name is still missing.
|
|
141
|
-
// The profile or user record may not have been ready on the first fetch
|
|
142
|
-
// (e.g. profile generation still in flight). One retry covers transient gaps.
|
|
143
|
-
const missingNameIds = baseEnriched
|
|
144
|
-
.map((item) => item.candidateUserId)
|
|
145
|
-
.filter((id) => id && !nameByUserId.get(id) && !baseEnriched.find((b) => b.candidateUserId === id && b.profile?.identity?.name));
|
|
146
|
-
if (missingNameIds.length > 0) {
|
|
147
|
-
const retried = await Promise.all(missingNameIds.map(async (id) => {
|
|
148
|
-
const [profile, user] = await Promise.all([
|
|
149
|
-
database.getProfile(id),
|
|
150
|
-
database.getUser(id),
|
|
151
|
-
]);
|
|
152
|
-
return { id, profile, user };
|
|
153
|
-
}));
|
|
154
|
-
for (const r of retried) {
|
|
155
|
-
const name = r.profile?.identity?.name ?? r.user?.name ?? null;
|
|
156
|
-
if (name)
|
|
157
|
-
nameByUserId.set(r.id, name);
|
|
158
|
-
// Also update the baseEnriched profile so counterpartName picks it up
|
|
159
|
-
if (r.profile) {
|
|
160
|
-
const item = baseEnriched.find((b) => b.candidateUserId === r.id);
|
|
161
|
-
if (item && !item.profile)
|
|
162
|
-
item.profile = r.profile;
|
|
163
|
-
}
|
|
164
|
-
if (r.user?.avatar && !avatarByUserId.get(r.id)) {
|
|
165
|
-
avatarByUserId.set(r.id, r.user.avatar);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
enrichLog.verbose("Retried name lookup for candidates with missing names", {
|
|
169
|
-
attempted: missingNameIds.length,
|
|
170
|
-
resolved: retried.filter((r) => r.profile?.identity?.name ?? r.user?.name).length,
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
let presentations;
|
|
174
|
-
let homeCardPresentations;
|
|
175
|
-
let presenterContexts;
|
|
176
|
-
if (minimalForChat && baseEnriched.length > 0) {
|
|
177
|
-
// Minimal path: no LLM, viewer-centric card text (introduce counterpart to viewer)
|
|
178
|
-
const counterpartName = (n) => n.profile?.identity?.name ?? nameByUserId.get(n.candidateUserId) ?? "";
|
|
179
|
-
homeCardPresentations = baseEnriched.map((item) => {
|
|
180
|
-
const name = counterpartName(item)?.trim();
|
|
181
|
-
const reasoning = item.opportunity.interpretation?.reasoning ?? "";
|
|
182
|
-
const introducerName = item.opportunity.detection?.createdByName ?? undefined;
|
|
183
|
-
const viewerIsIntroducer = item.opportunity.actors.some((a) => a.role === "introducer" && a.userId === userId);
|
|
184
|
-
// For introducer view, find the second party (target user) name
|
|
185
|
-
let secondPartyName;
|
|
186
|
-
if (viewerIsIntroducer) {
|
|
187
|
-
const otherPartyActors = item.opportunity.actors.filter((a) => a.role !== "introducer" && a.userId !== item.candidateUserId);
|
|
188
|
-
if (otherPartyActors.length > 0) {
|
|
189
|
-
const otherUserId = otherPartyActors[0].userId;
|
|
190
|
-
secondPartyName = nameByUserId.get(otherUserId) ?? undefined;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
const isCounterpartGhost = isGhostByUserId.get(item.candidateUserId) ?? false;
|
|
194
|
-
// Shared sanitization standard — see opportunity.safe-presentation.ts.
|
|
195
|
-
const personalizedSummary = safeFallbackSummary(reasoning, {
|
|
196
|
-
counterpartName: name,
|
|
197
|
-
viewerName,
|
|
198
|
-
introducerName,
|
|
199
|
-
maxChars: MINIMAL_MAIN_TEXT_MAX_CHARS,
|
|
200
|
-
emptyText: "A suggested connection.",
|
|
201
|
-
});
|
|
202
|
-
return {
|
|
203
|
-
headline: viewerIsIntroducer && secondPartyName
|
|
204
|
-
? `${name} → ${secondPartyName}`
|
|
205
|
-
: (name ? `Connection with ${name}` : "Suggested connection"),
|
|
206
|
-
personalizedSummary,
|
|
207
|
-
digestSummary: name
|
|
208
|
-
? `You might like meeting ${name} based on your current interests.`
|
|
209
|
-
: "This connection may be relevant to your current interests.",
|
|
210
|
-
suggestedAction: "Start a conversation to connect.",
|
|
211
|
-
narratorRemark: narratorRemarkFromReasoning(reasoning, name, viewerName),
|
|
212
|
-
primaryActionLabel: getPrimaryActionLabel(viewerIsIntroducer ? "introducer" : "party"),
|
|
213
|
-
secondaryActionLabel: SECONDARY_ACTION_LABEL,
|
|
214
|
-
mutualIntentsLabel: "Suggested connection",
|
|
215
|
-
greeting: "",
|
|
216
|
-
};
|
|
217
|
-
});
|
|
218
|
-
presenterContexts = baseEnriched.map((item) => ({
|
|
219
|
-
introducerName: item.opportunity.detection.createdByName ?? undefined,
|
|
220
|
-
}));
|
|
221
|
-
}
|
|
222
|
-
else if (presenter && baseEnriched.length > 0) {
|
|
223
|
-
try {
|
|
224
|
-
presenterContexts = await Promise.all(baseEnriched.map(({ opportunity }) => gatherPresenterContext(database, opportunity, userId)));
|
|
225
|
-
if (useHomeCardFormat) {
|
|
226
|
-
// Use full home card format with action labels, narrator remark, etc.
|
|
227
|
-
const fullContexts = presenterContexts;
|
|
228
|
-
const homeCardInputs = fullContexts.map((ctx, idx) => ({
|
|
229
|
-
...ctx,
|
|
230
|
-
mutualIntentCount: undefined,
|
|
231
|
-
opportunityStatus: baseEnriched[idx].opportunity.status,
|
|
232
|
-
}));
|
|
233
|
-
const llmResults = await presenter.presentHomeCardBatch(homeCardInputs, { concurrency: 5 });
|
|
234
|
-
// Append hardcoded button labels to LLM results
|
|
235
|
-
homeCardPresentations = llmResults.map((llm, idx) => ({
|
|
236
|
-
...llm,
|
|
237
|
-
primaryActionLabel: getPrimaryActionLabel(baseEnriched[idx].viewerRole),
|
|
238
|
-
secondaryActionLabel: SECONDARY_ACTION_LABEL,
|
|
239
|
-
}));
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
// Use basic presentation format
|
|
243
|
-
presentations = await presenter.presentBatch(presenterContexts, {
|
|
244
|
-
concurrency: 5,
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
catch (error) {
|
|
249
|
-
logger.warn("Presenter enrichment failed during opportunity discovery; returning base results without presentations", {
|
|
250
|
-
userId,
|
|
251
|
-
opportunitiesCount: baseEnriched.length,
|
|
252
|
-
useHomeCardFormat,
|
|
253
|
-
error: error instanceof Error ? error.message : String(error),
|
|
254
|
-
});
|
|
255
|
-
presentations = undefined;
|
|
256
|
-
homeCardPresentations = undefined;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
const enriched = baseEnriched.map((item, idx) => {
|
|
260
|
-
const homeCard = homeCardPresentations?.[idx];
|
|
261
|
-
const ctx = presenterContexts?.[idx];
|
|
262
|
-
// Build narrator chip for home card format
|
|
263
|
-
let narratorChip;
|
|
264
|
-
if (homeCard) {
|
|
265
|
-
const viewerIsIntroducer = item.opportunity.actors.some((a) => a.role === "introducer" && a.userId === userId);
|
|
266
|
-
if (viewerIsIntroducer) {
|
|
267
|
-
narratorChip = {
|
|
268
|
-
name: "You",
|
|
269
|
-
text: homeCard.narratorRemark,
|
|
270
|
-
userId: userId,
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
else {
|
|
274
|
-
const introducerActor = item.opportunity.actors.find((a) => a.role === "introducer" && a.userId !== userId);
|
|
275
|
-
if (introducerActor) {
|
|
276
|
-
const introducerName = ctx?.introducerName ??
|
|
277
|
-
nameByUserId.get(introducerActor.userId) ??
|
|
278
|
-
"Someone";
|
|
279
|
-
narratorChip = {
|
|
280
|
-
name: introducerName,
|
|
281
|
-
text: homeCard.narratorRemark,
|
|
282
|
-
userId: introducerActor.userId,
|
|
283
|
-
avatar: avatarByUserId.get(introducerActor.userId) ?? null,
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
else {
|
|
287
|
-
narratorChip = {
|
|
288
|
-
name: "Index",
|
|
289
|
-
text: homeCard.narratorRemark,
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
const isGhost = isGhostByUserId.get(item.candidateUserId) ?? false;
|
|
295
|
-
// Build secondParty for introducer view (the other non-introducer party)
|
|
296
|
-
let secondParty;
|
|
297
|
-
const viewerIsIntroducerForCard = item.opportunity.actors.some((a) => a.role === "introducer" && a.userId === userId);
|
|
298
|
-
if (viewerIsIntroducerForCard) {
|
|
299
|
-
const otherPartyActor = item.opportunity.actors.find((a) => a.role !== "introducer" && a.userId !== item.candidateUserId);
|
|
300
|
-
if (otherPartyActor) {
|
|
301
|
-
const otherName = nameByUserId.get(otherPartyActor.userId) ?? undefined;
|
|
302
|
-
if (otherName) {
|
|
303
|
-
secondParty = {
|
|
304
|
-
name: otherName,
|
|
305
|
-
avatar: avatarByUserId.get(otherPartyActor.userId) ?? null,
|
|
306
|
-
userId: otherPartyActor.userId,
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
return {
|
|
312
|
-
opportunityId: item.opportunity.id,
|
|
313
|
-
userId: item.candidateUserId,
|
|
314
|
-
name: item.profile?.identity?.name ?? nameByUserId.get(item.candidateUserId) ?? undefined,
|
|
315
|
-
avatar: avatarByUserId.get(item.candidateUserId) ?? null,
|
|
316
|
-
bio: truncateForChat(item.profile?.identity?.bio),
|
|
317
|
-
matchReason: safeFallbackSummary(item.opportunity.interpretation?.reasoning, {
|
|
318
|
-
counterpartName: item.profile?.identity?.name ?? nameByUserId.get(item.candidateUserId) ?? undefined,
|
|
319
|
-
viewerName,
|
|
320
|
-
maxChars: MAX_FIELD_CHARS,
|
|
321
|
-
emptyText: "A suggested connection.",
|
|
322
|
-
}),
|
|
323
|
-
score: item.confidence,
|
|
324
|
-
status: !preserveLifecycleStatus && chatSessionId && !existingOpportunityIds?.has(item.opportunity.id)
|
|
325
|
-
? "draft"
|
|
326
|
-
: item.opportunity.status,
|
|
327
|
-
viewerRole: item.viewerRole,
|
|
328
|
-
viewerApproved: item.viewerApproved,
|
|
329
|
-
viewerActedAt: item.viewerActedAt,
|
|
330
|
-
candidateUser: item.candidateUser,
|
|
331
|
-
isGhost,
|
|
332
|
-
...(presentations?.[idx] && { presentation: presentations[idx] }),
|
|
333
|
-
...(homeCard && {
|
|
334
|
-
homeCardPresentation: homeCard,
|
|
335
|
-
}),
|
|
336
|
-
...(narratorChip && { narratorChip }),
|
|
337
|
-
...(secondParty && { secondParty }),
|
|
338
|
-
};
|
|
339
|
-
});
|
|
340
|
-
debugSteps.push({
|
|
341
|
-
step: "format_cards",
|
|
342
|
-
detail: `${enriched.length} card(s)`,
|
|
343
|
-
});
|
|
344
|
-
return enriched;
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Run discovery from an ad-hoc query (e.g. "find me a mentor", "who needs a React developer").
|
|
348
|
-
* The HyDE graph's LensInferrer automatically infers search lenses from the query.
|
|
349
|
-
* Invokes the opportunity graph and returns formatted candidates suitable for chat display.
|
|
350
|
-
*/
|
|
351
|
-
export async function runDiscoverFromQuery(input) {
|
|
352
|
-
const { opportunityGraph, database, userId, query, indexScope, limit = 5, triggerIntentId, targetUserId, onBehalfOfUserId, chatSessionId, trigger, negotiateTimeoutMs, } = input;
|
|
353
|
-
if (indexScope.length === 0) {
|
|
354
|
-
return {
|
|
355
|
-
found: false,
|
|
356
|
-
count: 0,
|
|
357
|
-
message: "You need to join at least one network (community) to discover opportunities. Use read_networks to see available networks, or create one.",
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
const debugSteps = [];
|
|
361
|
-
// When query is empty, the opportunity graph uses the user's intents in scope (indexedIntents[0].payload)
|
|
362
|
-
// Lens inference is handled automatically by the HyDE graph's LensInferrer
|
|
363
|
-
const queryOrEmpty = query?.trim() ?? "";
|
|
364
|
-
// Orchestrator discovery defers the initial status to the graph's
|
|
365
|
-
// trigger-aware `resolveInitialStatus`, which opens at 'negotiating' so
|
|
366
|
-
// the accepted-draft streaming flow can run. Ambient chat discovery still
|
|
367
|
-
// wants the legacy 'draft' status so the chat-only lifecycle holds; other
|
|
368
|
-
// ambient callers keep 'latent'.
|
|
369
|
-
const isOrchestrator = trigger === 'orchestrator';
|
|
370
|
-
const options = {
|
|
371
|
-
limit,
|
|
372
|
-
...(!isOrchestrator && { initialStatus: chatSessionId ? "draft" : "latent" }),
|
|
373
|
-
...(chatSessionId ? { conversationId: chatSessionId } : {}),
|
|
374
|
-
...(negotiateTimeoutMs !== undefined && { negotiateTimeoutMs }),
|
|
375
|
-
};
|
|
376
|
-
return withCallLogging(logger, "runDiscoverFromQuery", {
|
|
377
|
-
userId,
|
|
378
|
-
queryPreview: queryOrEmpty
|
|
379
|
-
? queryOrEmpty.substring(0, 50)
|
|
380
|
-
: "(using user intents in scope)",
|
|
381
|
-
indexScopeCount: indexScope.length,
|
|
382
|
-
limit,
|
|
383
|
-
}, async () => {
|
|
384
|
-
const result = await invokeWithAbortSignal(opportunityGraph, {
|
|
385
|
-
userId,
|
|
386
|
-
searchQuery: queryOrEmpty || undefined,
|
|
387
|
-
// A single index resolves to the strict networkId override (membership-
|
|
388
|
-
// validated in the scope node). Multiple indexes (e.g. a network-scoped
|
|
389
|
-
// agent's bound network + personal network) pass through as indexScope so
|
|
390
|
-
// the graph stays bounded instead of falling back to all networks.
|
|
391
|
-
networkId: indexScope.length === 1 ? indexScope[0] : undefined,
|
|
392
|
-
...(indexScope.length > 1 ? { indexScope } : {}),
|
|
393
|
-
triggerIntentId,
|
|
394
|
-
targetUserId,
|
|
395
|
-
onBehalfOfUserId,
|
|
396
|
-
options,
|
|
397
|
-
...(trigger && { trigger }),
|
|
398
|
-
});
|
|
399
|
-
// Extract trace from graph and append to debugSteps
|
|
400
|
-
const graphTrace = Array.isArray(result.trace) ? result.trace : [];
|
|
401
|
-
for (const t of graphTrace) {
|
|
402
|
-
debugSteps.push({
|
|
403
|
-
step: t.node,
|
|
404
|
-
detail: t.detail,
|
|
405
|
-
...(t.data ? { data: t.data } : {}),
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
// Bail early if the graph returned an error
|
|
409
|
-
if (result.error) {
|
|
410
|
-
logger.warn("runDiscoverFromQuery graph returned error", { error: result.error });
|
|
411
|
-
return {
|
|
412
|
-
found: false,
|
|
413
|
-
count: 0,
|
|
414
|
-
message: "Failed to find opportunities. Please try again.",
|
|
415
|
-
debugSteps,
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
// Cache remaining candidates for pagination
|
|
419
|
-
let pagination;
|
|
420
|
-
const remainingCandidates = result.remainingCandidates || [];
|
|
421
|
-
if (remainingCandidates.length > 0 && input.cache) {
|
|
422
|
-
try {
|
|
423
|
-
const discoveryId = crypto.randomUUID();
|
|
424
|
-
const cacheKey = `discovery:${userId}:${discoveryId}`;
|
|
425
|
-
await input.cache.set(cacheKey, {
|
|
426
|
-
candidates: remainingCandidates,
|
|
427
|
-
userId,
|
|
428
|
-
onBehalfOfUserId,
|
|
429
|
-
query: queryOrEmpty,
|
|
430
|
-
indexScope,
|
|
431
|
-
options,
|
|
432
|
-
...(trigger && { trigger }),
|
|
433
|
-
}, { ttl: 1800 }); // 30 minutes
|
|
434
|
-
pagination = {
|
|
435
|
-
discoveryId,
|
|
436
|
-
evaluated: (result.candidates?.length ?? 0) - remainingCandidates.length,
|
|
437
|
-
remaining: remainingCandidates.length,
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
catch (cacheErr) {
|
|
441
|
-
logger.warn("Failed to cache discovery pagination", {
|
|
442
|
-
userId,
|
|
443
|
-
error: cacheErr instanceof Error ? cacheErr.message : String(cacheErr),
|
|
444
|
-
});
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
// Refine phase: a sibling of the opportunity graph in the trace tree.
|
|
448
|
-
// Holds the three post-discovery summarization steps. Each step is its
|
|
449
|
-
// own traced agent so it appears as a leaf in the trace UI.
|
|
450
|
-
//
|
|
451
|
-
// Negotiation summary: compress each raw negotiation into a fixed-size
|
|
452
|
-
// structured digest so the question generator's prompt stays small
|
|
453
|
-
// (a 10-candidate turn used to balloon past 60 KB and stall upstream).
|
|
454
|
-
// Decision questions: generate up to 3 clarifying questions from the
|
|
455
|
-
// digests + chat context.
|
|
456
|
-
const { questionPayload } = await tracePhase("Refine", async () => {
|
|
457
|
-
const negotiationDigests = await summarizeNegotiations({
|
|
458
|
-
negotiations: result.discoveryNegotiations ?? [],
|
|
459
|
-
summarizer: input.negotiationSummary,
|
|
460
|
-
enableQuestions: input.enableQuestions ?? false,
|
|
461
|
-
trigger,
|
|
462
|
-
});
|
|
463
|
-
const questionPayload = await maybeBuildQuestions({
|
|
464
|
-
trigger,
|
|
465
|
-
enableQuestions: input.enableQuestions ?? false,
|
|
466
|
-
chatSummary: input.chatSummary,
|
|
467
|
-
questionGenerator: input.questionGenerator,
|
|
468
|
-
chatSessionId,
|
|
469
|
-
graphResult: result,
|
|
470
|
-
negotiationDigests,
|
|
471
|
-
query: queryOrEmpty,
|
|
472
|
-
questionerEnqueue: input.questionerEnqueue,
|
|
473
|
-
userId: input.userId,
|
|
474
|
-
scopeType: input.scopeType,
|
|
475
|
-
scopeId: input.scopeId,
|
|
476
|
-
triggerIntentId,
|
|
477
|
-
userContext: input.userId
|
|
478
|
-
? ((await input.database.getUserContext(input.userId, null))?.text ?? '')
|
|
479
|
-
: '',
|
|
480
|
-
});
|
|
481
|
-
return { negotiationDigests, questionPayload };
|
|
482
|
-
});
|
|
483
|
-
if (result.createIntentSuggested && result.suggestedIntentDescription) {
|
|
484
|
-
if (chatSessionId) {
|
|
485
|
-
return {
|
|
486
|
-
found: false,
|
|
487
|
-
count: 0,
|
|
488
|
-
message: "No matching opportunities found. Try a different query.",
|
|
489
|
-
pagination,
|
|
490
|
-
...(questionPayload.questions !== undefined ? { questions: questionPayload.questions } : {}),
|
|
491
|
-
...(questionPayload.debug !== undefined ? { discoveryQuestionsDebug: questionPayload.debug } : {}),
|
|
492
|
-
};
|
|
493
|
-
}
|
|
494
|
-
return {
|
|
495
|
-
found: false,
|
|
496
|
-
count: 0,
|
|
497
|
-
createIntentSuggested: true,
|
|
498
|
-
suggestedIntentDescription: result.suggestedIntentDescription,
|
|
499
|
-
message: "No matching opportunities; add an intent with the suggested description to improve discovery.",
|
|
500
|
-
debugSteps,
|
|
501
|
-
pagination,
|
|
502
|
-
...(questionPayload.questions !== undefined ? { questions: questionPayload.questions } : {}),
|
|
503
|
-
...(questionPayload.debug !== undefined ? { discoveryQuestionsDebug: questionPayload.debug } : {}),
|
|
504
|
-
};
|
|
505
|
-
}
|
|
506
|
-
let opportunities = Array.isArray(result.opportunities)
|
|
507
|
-
? result.opportunities
|
|
508
|
-
: [];
|
|
509
|
-
let existingOpportunityIds;
|
|
510
|
-
const rawExistingBetweenActors = Array.isArray(result.existingBetweenActors)
|
|
511
|
-
? result.existingBetweenActors
|
|
512
|
-
: [];
|
|
513
|
-
// Orchestrator trigger populates this; ambient returns []. Kept as a
|
|
514
|
-
// loosely-typed pass-through because DiscoverResult is consumed by
|
|
515
|
-
// callers (chat tool, tests) that already model the narrower shape.
|
|
516
|
-
const alreadyAcceptedPairs = Array.isArray(result
|
|
517
|
-
.dedupAlreadyAccepted)
|
|
518
|
-
? result
|
|
519
|
-
.dedupAlreadyAccepted
|
|
520
|
-
: [];
|
|
521
|
-
// Enrich existing-between-actors with names so the tool can say "You already have a connection with X (pending)."
|
|
522
|
-
const existingConnections = await Promise.all(rawExistingBetweenActors.map(async (item) => {
|
|
523
|
-
const user = await database.getUser(item.candidateUserId);
|
|
524
|
-
return {
|
|
525
|
-
userId: item.candidateUserId,
|
|
526
|
-
name: user?.name ?? "Someone",
|
|
527
|
-
...(item.existingStatus ? { status: item.existingStatus } : {}),
|
|
528
|
-
...(item.existingOpportunityId ? { opportunityId: item.existingOpportunityId } : {}),
|
|
529
|
-
};
|
|
530
|
-
}));
|
|
531
|
-
if (existingConnections.length > 0) {
|
|
532
|
-
discoverFromQueryLog.verbose("Skipped duplicates; existing connections", {
|
|
533
|
-
count: existingConnections.length,
|
|
534
|
-
userIds: existingConnections.map((c) => c.userId),
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
// Only expose existing connections as cards when status is in EXISTING_CONNECTION_CARD_STATUSES (draft, latent, pending); others are mention-only.
|
|
538
|
-
const existingConnectionsForCards = existingConnections.filter((c) => c.status != null && EXISTING_CONNECTION_CARD_STATUSES.includes(c.status));
|
|
539
|
-
// Fetch full opportunity data for existing connections that should be shown as cards
|
|
540
|
-
// and merge them with the newly created opportunities
|
|
541
|
-
if (existingConnectionsForCards.length > 0) {
|
|
542
|
-
const existingOpps = await Promise.all(existingConnectionsForCards
|
|
543
|
-
.filter((c) => c.opportunityId)
|
|
544
|
-
.map((c) => database.getOpportunity(c.opportunityId)));
|
|
545
|
-
const validExistingOpps = existingOpps.filter((o) => o != null);
|
|
546
|
-
if (validExistingOpps.length > 0) {
|
|
547
|
-
discoverFromQueryLog.verbose("Including existing opportunities as cards", {
|
|
548
|
-
count: validExistingOpps.length,
|
|
549
|
-
ids: validExistingOpps.map((o) => o.id),
|
|
550
|
-
});
|
|
551
|
-
existingOpportunityIds = new Set(validExistingOpps.map((o) => o.id));
|
|
552
|
-
opportunities = [...opportunities, ...validExistingOpps];
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
// Chat discovery: when we have chatSessionId we just invoked the graph; all result.opportunities
|
|
556
|
-
// were created in this call and belong to this session. Do not filter by status: the enricher
|
|
557
|
-
// may set status to pending/latent when merging with related opportunities, so filtering to
|
|
558
|
-
// "draft" would incorrectly drop them.
|
|
559
|
-
if (chatSessionId && (result.opportunities?.length ?? 0) > 0) {
|
|
560
|
-
discoverFromQueryLog.verbose("Chat session opportunities from graph", {
|
|
561
|
-
count: opportunities.length,
|
|
562
|
-
statuses: opportunities.map((o) => o.status),
|
|
563
|
-
});
|
|
564
|
-
}
|
|
565
|
-
debugSteps.push({
|
|
566
|
-
step: "opportunity_graph",
|
|
567
|
-
detail: `${opportunities.length} opportunity(ies)${existingConnections.length > 0 ? `, ${existingConnections.length} existing` : ""}`,
|
|
568
|
-
});
|
|
569
|
-
if (opportunities.length === 0) {
|
|
570
|
-
if (existingConnections.length > 0) {
|
|
571
|
-
return {
|
|
572
|
-
found: true,
|
|
573
|
-
count: 0,
|
|
574
|
-
message: "No new opportunities created; you already have a connection with: " +
|
|
575
|
-
existingConnections.map((c) => `${c.name}${c.status ? ` (${c.status})` : ""}`).join(", ") +
|
|
576
|
-
". View on your home page.",
|
|
577
|
-
existingConnections: existingConnectionsForCards,
|
|
578
|
-
existingConnectionsForMention: existingConnections,
|
|
579
|
-
...(alreadyAcceptedPairs.length > 0 && { alreadyAcceptedPairs }),
|
|
580
|
-
debugSteps,
|
|
581
|
-
pagination,
|
|
582
|
-
...(questionPayload.questions !== undefined ? { questions: questionPayload.questions } : {}),
|
|
583
|
-
...(questionPayload.debug !== undefined ? { discoveryQuestionsDebug: questionPayload.debug } : {}),
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
return {
|
|
587
|
-
found: false,
|
|
588
|
-
count: 0,
|
|
589
|
-
message: "No matching opportunities found. Try a different query or create intents to improve matching.",
|
|
590
|
-
...(alreadyAcceptedPairs.length > 0 && { alreadyAcceptedPairs }),
|
|
591
|
-
debugSteps,
|
|
592
|
-
pagination,
|
|
593
|
-
...(questionPayload.questions !== undefined ? { questions: questionPayload.questions } : {}),
|
|
594
|
-
...(questionPayload.debug !== undefined ? { discoveryQuestionsDebug: questionPayload.debug } : {}),
|
|
595
|
-
};
|
|
596
|
-
}
|
|
597
|
-
const enriched = await enrichOpportunities({
|
|
598
|
-
opportunities,
|
|
599
|
-
database,
|
|
600
|
-
userId,
|
|
601
|
-
chatSessionId,
|
|
602
|
-
minimalForChat: input.minimalForChat,
|
|
603
|
-
presenter: input.presenter,
|
|
604
|
-
useHomeCardFormat: input.useHomeCardFormat,
|
|
605
|
-
debugSteps,
|
|
606
|
-
existingOpportunityIds,
|
|
607
|
-
targetUserId,
|
|
608
|
-
});
|
|
609
|
-
return {
|
|
610
|
-
found: true,
|
|
611
|
-
count: enriched.length,
|
|
612
|
-
opportunities: enriched,
|
|
613
|
-
...(existingConnectionsForCards.length > 0 ? { existingConnections: existingConnectionsForCards } : {}),
|
|
614
|
-
...(existingConnections.length > 0 ? { existingConnectionsForMention: existingConnections } : {}),
|
|
615
|
-
...(alreadyAcceptedPairs.length > 0 ? { alreadyAcceptedPairs } : {}),
|
|
616
|
-
debugSteps,
|
|
617
|
-
pagination,
|
|
618
|
-
...(questionPayload.questions !== undefined ? { questions: questionPayload.questions } : {}),
|
|
619
|
-
...(questionPayload.debug !== undefined ? { discoveryQuestionsDebug: questionPayload.debug } : {}),
|
|
620
|
-
};
|
|
621
|
-
}, { context: { userId }, logOutput: false }).catch((err) => {
|
|
622
|
-
return {
|
|
623
|
-
found: false,
|
|
624
|
-
count: 0,
|
|
625
|
-
message: "Failed to find opportunities. Please try again.",
|
|
626
|
-
};
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
/**
|
|
630
|
-
* Run the negotiation summarizer over every negotiation in this discovery turn.
|
|
631
|
-
* Each summarization is independent — run them concurrently via Promise.all.
|
|
632
|
-
* When the summarizer is missing (no LLM available) or fails for an individual
|
|
633
|
-
* negotiation, fall back to a deterministic digest so the downstream generator
|
|
634
|
-
* still has structured input.
|
|
635
|
-
*/
|
|
636
|
-
async function summarizeNegotiations(args) {
|
|
637
|
-
// Skip the LLM round-trip entirely when questions won't be built.
|
|
638
|
-
if (!args.enableQuestions || args.trigger !== 'orchestrator')
|
|
639
|
-
return [];
|
|
640
|
-
if (args.negotiations.length === 0)
|
|
641
|
-
return [];
|
|
642
|
-
const perNegTimeoutMs = parsePositiveIntEnv("NEGOTIATION_SUMMARY_TIMEOUT_MS", NEGOTIATION_SUMMARY_TIMEOUT_MS_DEFAULT);
|
|
643
|
-
const callerSignal = requestContext.getStore()?.abortSignal;
|
|
644
|
-
return traceAgent(`Negotiation summary (${args.negotiations.length})`, () => Promise.all(args.negotiations.map(async (n) => {
|
|
645
|
-
if (!args.summarizer)
|
|
646
|
-
return buildFallbackDigest(n);
|
|
647
|
-
// Per-negotiation deadline: one slow OpenRouter route used to
|
|
648
|
-
// dominate the post-discovery tail. With a cap, an aborted
|
|
649
|
-
// summarizer falls back to a deterministic digest so the
|
|
650
|
-
// question generator still has structured input.
|
|
651
|
-
const signal = combineWithDeadline(callerSignal, perNegTimeoutMs);
|
|
652
|
-
try {
|
|
653
|
-
const d = await args.summarizer.summarize(n, { signal });
|
|
654
|
-
return d ?? buildFallbackDigest(n);
|
|
655
|
-
}
|
|
656
|
-
catch (err) {
|
|
657
|
-
// Attribute cause from err.name (AbortError), not from
|
|
658
|
-
// signal.aborted — the latter is read post-catch and can race a
|
|
659
|
-
// deadline-trip-after-unrelated-error, producing a misleading log.
|
|
660
|
-
const aborted = err instanceof Error && err.name === "AbortError";
|
|
661
|
-
logger.warn("negotiationSummary.summarize threw — using fallback digest", {
|
|
662
|
-
counterpartyHint: n.counterpartyHint,
|
|
663
|
-
aborted,
|
|
664
|
-
error: err instanceof Error ? err.message : String(err),
|
|
665
|
-
});
|
|
666
|
-
return buildFallbackDigest(n);
|
|
667
|
-
}
|
|
668
|
-
})), (digests) => `${digests.length} digest${digests.length === 1 ? "" : "s"}`);
|
|
669
|
-
}
|
|
670
|
-
async function maybeBuildQuestions(args) {
|
|
671
|
-
if (!args.enableQuestions)
|
|
672
|
-
return {};
|
|
673
|
-
if (args.trigger !== 'orchestrator')
|
|
674
|
-
return {};
|
|
675
|
-
// Hardcoded — `insights` mode is planned for a later slice. Warn if the env
|
|
676
|
-
// var is set so operators aren't surprised when reporting still says
|
|
677
|
-
// "transcripts".
|
|
678
|
-
if (discoveryQuestionsInputMode() === "insights") {
|
|
679
|
-
logger.warn("QUESTIONER_DISCOVERY_INPUT_MODE=insights is not yet implemented; falling back to transcripts");
|
|
680
|
-
}
|
|
681
|
-
const inputMode = "transcripts";
|
|
682
|
-
let chatContext;
|
|
683
|
-
if (args.chatSummary && args.chatSessionId) {
|
|
684
|
-
const sessionId = args.chatSessionId;
|
|
685
|
-
const summary = args.chatSummary;
|
|
686
|
-
chatContext = await traceAgent("Chat summary", async () => {
|
|
687
|
-
try {
|
|
688
|
-
return (await summary.getDigest(sessionId)) ?? undefined;
|
|
689
|
-
}
|
|
690
|
-
catch (err) {
|
|
691
|
-
logger.warn("chatSummary.getDigest threw — proceeding without digest", {
|
|
692
|
-
sessionId,
|
|
693
|
-
error: err instanceof Error ? err.message : String(err),
|
|
694
|
-
});
|
|
695
|
-
return undefined;
|
|
696
|
-
}
|
|
697
|
-
}, (digest) => (digest ? "loaded" : "empty"));
|
|
698
|
-
}
|
|
699
|
-
// ── Async enqueue path ──────────────────────────────────────────────────
|
|
700
|
-
// When questionerEnqueue is provided, dispatch question generation
|
|
701
|
-
// asynchronously to the background QuestionerQueue. This replaces the
|
|
702
|
-
// inline generator path. Questions will be persisted to DB by the queue
|
|
703
|
-
// worker and served via GET /api/questions.
|
|
704
|
-
if (args.questionerEnqueue && args.userId) {
|
|
705
|
-
const summary = args.graphResult.discoverySummary ?? {
|
|
706
|
-
totalCandidates: 0,
|
|
707
|
-
opportunitiesFound: 0,
|
|
708
|
-
noOpportunityCount: 0,
|
|
709
|
-
timeoutCount: 0,
|
|
710
|
-
roleDistribution: {},
|
|
711
|
-
};
|
|
712
|
-
const enqueueInput = buildDiscoveryQuestionInput({
|
|
713
|
-
query: args.query,
|
|
714
|
-
userContext: args.userContext ?? '',
|
|
715
|
-
negotiationDigests: args.negotiationDigests,
|
|
716
|
-
summary,
|
|
717
|
-
chatContext,
|
|
718
|
-
now: new Date().toISOString(),
|
|
719
|
-
});
|
|
720
|
-
try {
|
|
721
|
-
await args.questionerEnqueue({
|
|
722
|
-
mode: 'discovery',
|
|
723
|
-
userId: args.userId,
|
|
724
|
-
sourceType: 'discovery',
|
|
725
|
-
sourceId: args.chatSessionId ?? crypto.randomUUID(),
|
|
726
|
-
context: enqueueInput,
|
|
727
|
-
...(args.scopeType && args.scopeId ? { scopeType: args.scopeType, scopeId: args.scopeId } : {}),
|
|
728
|
-
...(args.triggerIntentId ? { triggeredByIntentId: args.triggerIntentId } : {}),
|
|
729
|
-
conversationId: args.chatSessionId,
|
|
730
|
-
});
|
|
731
|
-
logger.info("Question generation enqueued to QuestionerQueue", {
|
|
732
|
-
userId: args.userId,
|
|
733
|
-
trigger: args.trigger,
|
|
734
|
-
});
|
|
735
|
-
}
|
|
736
|
-
catch (err) {
|
|
737
|
-
logger.warn("Failed to enqueue question generation", {
|
|
738
|
-
error: err instanceof Error ? err.message : String(err),
|
|
739
|
-
});
|
|
740
|
-
}
|
|
741
|
-
return {};
|
|
742
|
-
}
|
|
743
|
-
// ── Inline generator path (backward compat) ────────────────────────────
|
|
744
|
-
if (!args.questionGenerator)
|
|
745
|
-
return {};
|
|
746
|
-
const negotiationDigests = args.negotiationDigests;
|
|
747
|
-
const summary = args.graphResult.discoverySummary ?? {
|
|
748
|
-
totalCandidates: 0,
|
|
749
|
-
opportunitiesFound: 0,
|
|
750
|
-
noOpportunityCount: 0,
|
|
751
|
-
timeoutCount: 0,
|
|
752
|
-
roleDistribution: {},
|
|
753
|
-
};
|
|
754
|
-
const input = buildDiscoveryQuestionInput({
|
|
755
|
-
query: args.query,
|
|
756
|
-
userContext: args.userContext ?? '',
|
|
757
|
-
negotiationDigests,
|
|
758
|
-
summary,
|
|
759
|
-
chatContext,
|
|
760
|
-
now: new Date().toISOString(),
|
|
761
|
-
});
|
|
762
|
-
const questionGenerator = args.questionGenerator;
|
|
763
|
-
const generatorStart = Date.now();
|
|
764
|
-
const questionsTimeoutMs = discoveryQuestionsTimeoutMs();
|
|
765
|
-
const questionsSignal = combineWithDeadline(requestContext.getStore()?.abortSignal, questionsTimeoutMs);
|
|
766
|
-
const genResult = await traceAgent("Decision questions", async () => {
|
|
767
|
-
try {
|
|
768
|
-
return await questionGenerator.generate(input, { signal: questionsSignal });
|
|
769
|
-
}
|
|
770
|
-
catch (err) {
|
|
771
|
-
logger.warn("questionGenerator.generate threw — suppressing questions", {
|
|
772
|
-
error: err instanceof Error ? err.message : String(err),
|
|
773
|
-
});
|
|
774
|
-
return null;
|
|
775
|
-
}
|
|
776
|
-
}, (r) => {
|
|
777
|
-
const count = r?.questions?.length ?? 0;
|
|
778
|
-
return `${count} question${count === 1 ? "" : "s"}`;
|
|
779
|
-
});
|
|
780
|
-
const durationMs = Date.now() - generatorStart;
|
|
781
|
-
const finalCount = genResult?.questions?.length ?? 0;
|
|
782
|
-
const strategies = genResult?.strategies ?? [];
|
|
783
|
-
return {
|
|
784
|
-
...(genResult && genResult.questions.length > 0 ? { questions: genResult.questions } : {}),
|
|
785
|
-
debug: {
|
|
786
|
-
inputMode,
|
|
787
|
-
finalCount,
|
|
788
|
-
strategies,
|
|
789
|
-
durationMs,
|
|
790
|
-
},
|
|
791
|
-
};
|
|
792
|
-
}
|
|
793
|
-
/**
|
|
794
|
-
* Continue a paginated discovery by evaluating the next batch of cached candidates.
|
|
795
|
-
* Loads candidates from Redis, invokes the opportunity graph in continue_discovery mode,
|
|
796
|
-
* then enriches and returns the results with updated pagination metadata.
|
|
797
|
-
*
|
|
798
|
-
* @param input - Continuation context (graph, database, cache, discoveryId, etc.).
|
|
799
|
-
* @returns Discovery result with enriched opportunities and pagination state.
|
|
800
|
-
*/
|
|
801
|
-
export async function continueDiscovery(input) {
|
|
802
|
-
const { opportunityGraph, database, cache, userId, discoveryId, expectedIndexId, limit = 20, chatSessionId, } = input;
|
|
803
|
-
const cacheKey = `discovery:${userId}:${discoveryId}`;
|
|
804
|
-
const cached = await cache.get(cacheKey);
|
|
805
|
-
if (!cached) {
|
|
806
|
-
return {
|
|
807
|
-
found: false,
|
|
808
|
-
count: 0,
|
|
809
|
-
message: "Discovery session expired or not found. Please start a new search.",
|
|
810
|
-
};
|
|
811
|
-
}
|
|
812
|
-
// Validate that the cached session's scope matches the current chat context
|
|
813
|
-
if (expectedIndexId && !cached.indexScope.includes(expectedIndexId)) {
|
|
814
|
-
return {
|
|
815
|
-
found: false,
|
|
816
|
-
count: 0,
|
|
817
|
-
message: "Discovery session was created in a different context. Please start a new search.",
|
|
818
|
-
};
|
|
819
|
-
}
|
|
820
|
-
const debugSteps = [];
|
|
821
|
-
const result = await invokeWithAbortSignal(opportunityGraph, {
|
|
822
|
-
userId,
|
|
823
|
-
searchQuery: cached.query || undefined,
|
|
824
|
-
candidates: cached.candidates,
|
|
825
|
-
operationMode: 'continue_discovery',
|
|
826
|
-
onBehalfOfUserId: cached.onBehalfOfUserId,
|
|
827
|
-
// Carry the original trigger so page 2+ stays on the same flow as page
|
|
828
|
-
// 1 (orchestrator negotiations with 60s park window + accepted-pair
|
|
829
|
-
// dedup, or ambient with 5-min park window).
|
|
830
|
-
...(cached.trigger && { trigger: cached.trigger }),
|
|
831
|
-
options: {
|
|
832
|
-
...cached.options,
|
|
833
|
-
limit,
|
|
834
|
-
...(chatSessionId ? { conversationId: chatSessionId } : {}),
|
|
835
|
-
},
|
|
836
|
-
});
|
|
837
|
-
// Extract trace from graph and append to debugSteps
|
|
838
|
-
const graphTrace = result.trace || [];
|
|
839
|
-
for (const t of graphTrace) {
|
|
840
|
-
debugSteps.push({
|
|
841
|
-
step: t.node,
|
|
842
|
-
detail: t.detail,
|
|
843
|
-
...(t.data ? { data: t.data } : {}),
|
|
844
|
-
});
|
|
845
|
-
}
|
|
846
|
-
// Bail early if the graph returned an error
|
|
847
|
-
if (result.error) {
|
|
848
|
-
logger.warn("continueDiscovery graph returned error", { error: result.error });
|
|
849
|
-
return {
|
|
850
|
-
found: false,
|
|
851
|
-
count: 0,
|
|
852
|
-
message: "Discovery continuation failed. Please start a new search.",
|
|
853
|
-
debugSteps,
|
|
854
|
-
};
|
|
855
|
-
}
|
|
856
|
-
// Update cache with remaining candidates or delete if exhausted
|
|
857
|
-
const remaining = result.remainingCandidates || [];
|
|
858
|
-
let pagination;
|
|
859
|
-
try {
|
|
860
|
-
if (remaining.length > 0) {
|
|
861
|
-
await cache.set(cacheKey, {
|
|
862
|
-
...cached,
|
|
863
|
-
candidates: remaining,
|
|
864
|
-
}, { ttl: 1800 });
|
|
865
|
-
pagination = {
|
|
866
|
-
discoveryId,
|
|
867
|
-
evaluated: cached.candidates.length - remaining.length,
|
|
868
|
-
remaining: remaining.length,
|
|
869
|
-
};
|
|
870
|
-
}
|
|
871
|
-
else {
|
|
872
|
-
await cache.delete(cacheKey);
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
catch (cacheErr) {
|
|
876
|
-
logger.warn("Failed to update discovery pagination cache", {
|
|
877
|
-
userId,
|
|
878
|
-
discoveryId,
|
|
879
|
-
error: cacheErr instanceof Error ? cacheErr.message : String(cacheErr),
|
|
880
|
-
});
|
|
881
|
-
}
|
|
882
|
-
// Check for opportunities in result. Negotiation mutates lifecycle state after
|
|
883
|
-
// persistence, so continuation must refresh before enrichment/presentation rather
|
|
884
|
-
// than returning the graph state's persist-time `negotiating` snapshots.
|
|
885
|
-
const opportunities = Array.isArray(result.opportunities) ? result.opportunities : [];
|
|
886
|
-
const refreshed = opportunities.length > 0
|
|
887
|
-
? await database.getOpportunitiesByIds(opportunities.map((opportunity) => opportunity.id))
|
|
888
|
-
: [];
|
|
889
|
-
const refreshedById = new Map(refreshed.map((opportunity) => [opportunity.id, opportunity]));
|
|
890
|
-
const currentOpportunities = opportunities.map((opportunity) => refreshedById.get(opportunity.id) ?? opportunity);
|
|
891
|
-
if (currentOpportunities.length === 0) {
|
|
892
|
-
return {
|
|
893
|
-
found: false,
|
|
894
|
-
count: 0,
|
|
895
|
-
message: "No more matching opportunities found in the remaining candidates.",
|
|
896
|
-
debugSteps,
|
|
897
|
-
pagination,
|
|
898
|
-
};
|
|
899
|
-
}
|
|
900
|
-
const enriched = await enrichOpportunities({
|
|
901
|
-
opportunities: currentOpportunities,
|
|
902
|
-
database,
|
|
903
|
-
userId,
|
|
904
|
-
chatSessionId,
|
|
905
|
-
minimalForChat: input.minimalForChat,
|
|
906
|
-
presenter: input.presenter,
|
|
907
|
-
useHomeCardFormat: input.useHomeCardFormat,
|
|
908
|
-
debugSteps,
|
|
909
|
-
preserveLifecycleStatus: true,
|
|
910
|
-
});
|
|
911
|
-
return {
|
|
912
|
-
found: true,
|
|
913
|
-
count: enriched.length,
|
|
914
|
-
opportunities: enriched,
|
|
915
|
-
debugSteps,
|
|
916
|
-
pagination,
|
|
917
|
-
};
|
|
918
|
-
}
|
|
919
|
-
//# sourceMappingURL=opportunity.discover.js.map
|
|
5
|
+
export * from "./application/opportunity.discover.js";
|