@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
|
@@ -0,0 +1,736 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Opportunity Presenter Agent
|
|
3
|
+
*
|
|
4
|
+
* Generates personalized, second-person explanations of why an opportunity
|
|
5
|
+
* matters to the viewing user. Uses full opportunity data (interpretation,
|
|
6
|
+
* actors, profiles, intents, index) to produce headline, personalizedSummary,
|
|
7
|
+
* and suggestedAction for chat tools and user-facing surfaces.
|
|
8
|
+
*/
|
|
9
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
10
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
12
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
13
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
|
+
};
|
|
15
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
17
|
+
};
|
|
18
|
+
import { HumanMessage, SystemMessage } from "@langchain/core/messages";
|
|
19
|
+
import { z } from "zod";
|
|
20
|
+
import { Timed } from "../../shared/observability/performance.js";
|
|
21
|
+
import { protocolLogger } from "../../shared/observability/protocol.logger.js";
|
|
22
|
+
import { createStructuredModel } from "../../shared/agent/model.config.js";
|
|
23
|
+
import { viewerCentricCardSummary } from "../domain/opportunity.presentation.js";
|
|
24
|
+
import { stripUuids, stripIntroducerMentions } from "../domain/opportunity.presentation.js";
|
|
25
|
+
import { stripUnsupportedOpportunityClaims } from "../domain/opportunity.claim-safety.js";
|
|
26
|
+
import { DEFAULT_EMPTY_FALLBACK_TEXT, DEFAULT_FALLBACK_ACTION, DEFAULT_FALLBACK_HEADLINE, safeFallbackSummary } from "../domain/opportunity.safe-presentation.js";
|
|
27
|
+
const presentLog = protocolLogger("OpportunityPresenter:present");
|
|
28
|
+
const presentHomeCardLog = protocolLogger("OpportunityPresenter:presentHomeCard");
|
|
29
|
+
const LLM_TIMEOUT_MS = 20000;
|
|
30
|
+
const GREETING_DESCRIPTION = "A 2-4 sentence first-person message the viewer could send to the counterpart, in the viewer's voice, referencing what they have in common. Plain prose only — no markdown, no greeting prefix like 'Hey {Name},'. Example body: 'Saw we're both working on regenerative coordination tooling — your post on consent flows resonated. Would love to compare notes if you have time this week.'";
|
|
31
|
+
// ──────────────────────────────────────────────────────────────
|
|
32
|
+
// SCHEMA & TYPES
|
|
33
|
+
// ──────────────────────────────────────────────────────────────
|
|
34
|
+
const PresentationSchema = z.object({
|
|
35
|
+
headline: z
|
|
36
|
+
.string()
|
|
37
|
+
.describe("Short, compelling headline for this opportunity (e.g., 'A React expert who needs your design skills')"),
|
|
38
|
+
personalizedSummary: z
|
|
39
|
+
.string()
|
|
40
|
+
.describe("2-3 sentence explanation using 'you' language, explaining why this opportunity is specifically valuable for the viewer based on their intents and profile"),
|
|
41
|
+
suggestedAction: z.string().describe("Brief suggested next step"),
|
|
42
|
+
greeting: z.string().max(500).describe(GREETING_DESCRIPTION),
|
|
43
|
+
});
|
|
44
|
+
const responseFormat = z.object({
|
|
45
|
+
presentation: PresentationSchema,
|
|
46
|
+
});
|
|
47
|
+
/** LLM-generated fields for home-card presentation (buttons are hardcoded by callers, not LLM-generated). */
|
|
48
|
+
export const HomeCardLLMSchema = z.object({
|
|
49
|
+
headline: z
|
|
50
|
+
.string()
|
|
51
|
+
.describe("Short, compelling headline for this opportunity"),
|
|
52
|
+
personalizedSummary: z
|
|
53
|
+
.string()
|
|
54
|
+
.describe("2-3 sentence explanation in 'you' language for the main card body"),
|
|
55
|
+
digestSummary: z
|
|
56
|
+
.string()
|
|
57
|
+
.max(220)
|
|
58
|
+
.describe("One concise digest-ready sentence for a morning brief. It must be addressed to the viewer and mention the counterpart by name, e.g. 'You might like meeting Paul because ...'. No markdown."),
|
|
59
|
+
suggestedAction: z
|
|
60
|
+
.string()
|
|
61
|
+
.describe("Brief suggested next step (e.g. CTA line)"),
|
|
62
|
+
narratorRemark: z
|
|
63
|
+
.string()
|
|
64
|
+
.max(80)
|
|
65
|
+
.describe("One short sentence for the narrator chip, max ~80 chars (e.g. who is suggesting and why)"),
|
|
66
|
+
mutualIntentsLabel: z
|
|
67
|
+
.string()
|
|
68
|
+
.max(48)
|
|
69
|
+
.describe("Short line for the subtitle under the other party name (e.g. '3 mutual intents', 'Shared interests', 'Aligned goals'). NEVER output '0 mutual intents' — use a qualitative phrase like 'Shared interests' when no numeric count is available."),
|
|
70
|
+
greeting: z.string().max(500).describe(GREETING_DESCRIPTION),
|
|
71
|
+
});
|
|
72
|
+
const homeCardResponseFormat = z.object({
|
|
73
|
+
presentation: HomeCardLLMSchema,
|
|
74
|
+
});
|
|
75
|
+
// ──────────────────────────────────────────────────────────────
|
|
76
|
+
// SYSTEM PROMPT
|
|
77
|
+
// ──────────────────────────────────────────────────────────────
|
|
78
|
+
const systemPrompt = `
|
|
79
|
+
You are an expert at presenting connection opportunities to users in a way that feels personal and compelling.
|
|
80
|
+
|
|
81
|
+
Your goal: Given raw context about the viewer (their profile, intents), the other person(s), and why the system matched them, produce a short headline, a personalized summary, and a suggested action.
|
|
82
|
+
|
|
83
|
+
Rules:
|
|
84
|
+
1. Address the VIEWER directly using "you" and "your". This is for them.
|
|
85
|
+
2. Be concise and compelling — not analytical or third-party. No "The source user" or "The candidate"; use names or "they" where needed.
|
|
86
|
+
3. Do not leak private or confidential details. Use only the context provided.
|
|
87
|
+
4. Vary user-facing nouns naturally. Do not repeatedly use the same label in one response.
|
|
88
|
+
5. If possible, avoid repeating "opportunity" in both headline and summary. Prefer alternatives like "connection", "thought partner", "mutual fit", "valuable conversation", or "peer".
|
|
89
|
+
6. Prefer first names in user-facing copy. Do not repeatedly use full names unless needed to disambiguate.
|
|
90
|
+
7. Network assignment, network title/type, and network/event metadata are retrieval context only. They are NEVER proof that a person attended or will attend, belongs to a group, resides in a place, knows anyone from the network, or shared a session, time, place, or location with anyone. Do not make co-attendance, membership, residence, shared-session, or same-place/same-time claims from network co-membership.
|
|
91
|
+
|
|
92
|
+
**Introduction-originated opportunities:**
|
|
93
|
+
When INTRODUCTION CONTEXT is provided, this opportunity was explicitly created by an introducer (a real person who saw value in this connection). This is NOT an automatic system discovery — someone made a deliberate judgment.
|
|
94
|
+
- For ALL roles: acknowledge the introducer's role naturally. E.g., "[Introducer name] thinks you should meet [other person]" or "[Introducer name] connected you because..."
|
|
95
|
+
- The introduction itself is a strong signal — treat it with the weight of a personal recommendation.
|
|
96
|
+
- If the parties' intents don't obviously overlap, that's fine — the introducer saw something worth connecting. Focus on what the introducer likely saw.
|
|
97
|
+
|
|
98
|
+
**Role-Specific Presentation:**
|
|
99
|
+
|
|
100
|
+
**If viewer is "introducer":**
|
|
101
|
+
- The viewer suggested this connection between two (or more) OTHER people. The opportunity is NOT about the viewer's own needs.
|
|
102
|
+
- Headline: describe the connection between the parties (e.g., "Connecting a React expert with a startup founder").
|
|
103
|
+
- Personalized summary: explain why the people YOU are introducing should meet. Reference THEIR profiles and intents, not yours. Frame it as "you're connecting X and Y because..." rather than "this matches your intent".
|
|
104
|
+
- Suggested action: guide sharing (e.g., "Share this with [name] to get things started").
|
|
105
|
+
- CRITICAL: Do NOT reference the introducer's own intents, skills, or needs. The introducer is the matchmaker, not a party.
|
|
106
|
+
|
|
107
|
+
**If viewer is "patient" or "party":**
|
|
108
|
+
- Reference their specific intents, skills, or interests that align with this opportunity.
|
|
109
|
+
- If this is an introduction: mention who introduced them and frame it as a personal recommendation.
|
|
110
|
+
- Headline: one short line that hooks (e.g., "[Name] thinks you should meet [Other]" or "A React expert who needs your design skills").
|
|
111
|
+
- Personalized summary: 2-3 sentences. Why is this opportunity for *them*? If introduced, lead with the introduction.
|
|
112
|
+
- Suggested action: encourage action ("Send a message to start the conversation" or "Share this intro").
|
|
113
|
+
|
|
114
|
+
**If viewer is "agent":**
|
|
115
|
+
- They are seeing this because someone already reached out.
|
|
116
|
+
- If this is an introduction: mention who made the introduction.
|
|
117
|
+
- Reference their skills/expertise that make them a match.
|
|
118
|
+
- Headline: what the other person needs that they can provide.
|
|
119
|
+
- Personalized summary: 2-3 sentences. Why someone reached out to them.
|
|
120
|
+
- Suggested action: "Someone is interested in connecting — check their message" or "Review and respond".
|
|
121
|
+
|
|
122
|
+
**If viewer is "peer":**
|
|
123
|
+
- Mutual opportunity. Reference shared or complementary interests.
|
|
124
|
+
- If this is an introduction: mention who connected them.
|
|
125
|
+
- Headline: the mutual connection angle.
|
|
126
|
+
- Personalized summary: 2-3 sentences. Why this is mutually valuable.
|
|
127
|
+
- Suggested action: "Send an intro to connect" or "Start a conversation".
|
|
128
|
+
`;
|
|
129
|
+
const homeCardSystemPrompt = `
|
|
130
|
+
You are an expert at presenting connection opportunities for a home feed card.
|
|
131
|
+
|
|
132
|
+
Given context about the viewer, the other person, and why they were matched, produce:
|
|
133
|
+
1. headline: one short hook line.
|
|
134
|
+
2. personalizedSummary: 2-3 sentences in "you" language (main body text).
|
|
135
|
+
3. digestSummary: one polished morning-brief sentence that can be printed directly after the person's linked name. No markdown, no field labels.
|
|
136
|
+
4. suggestedAction: one brief suggested next step.
|
|
137
|
+
5. narratorRemark: one short sentence for the narrator chip (who is suggesting and why; max ~80 chars).
|
|
138
|
+
6. greeting: a 2-4 sentence first-person message the viewer could send to the counterpart. Plain prose, no greeting prefix, no markdown.
|
|
139
|
+
7. mutualIntentsLabel: short subtitle under the other party's name. Examples: "3 mutual intents", "Shared interests", "Aligned goals" — keep it brief. NEVER output "0 mutual intents" or any zero-count label; use a qualitative phrase instead.
|
|
140
|
+
|
|
141
|
+
Rules:
|
|
142
|
+
- Address the viewer with "you"/"your". Be concise and compelling.
|
|
143
|
+
- narratorRemark should feel like a single sentence from the narrator (Index or a person), not meta-commentary.
|
|
144
|
+
- narratorRemark is displayed with the narrator name prepended (e.g. "Index: …" or "Alice: …"). Do NOT start narratorRemark with the narrator's name or repeat it; write only the remark (e.g. "Based on your overlapping intents" or "introduced you two, sensing a valuable connection").
|
|
145
|
+
- Vary wording for the match itself. Do not repeat "opportunity" across headline, summary, and narratorRemark when alternatives fit.
|
|
146
|
+
- Prefer first names in user-facing copy. Avoid repeated full names unless disambiguation is necessary.
|
|
147
|
+
- Network assignment, network title/type, and network/event metadata are retrieval context only. They are NEVER proof that a person attended or will attend, belongs to a group, resides in a place, knows anyone from the network, or shared a session, time, place, or location with anyone. Do not make co-attendance, membership, residence, shared-session, or same-place/same-time claims from network co-membership.
|
|
148
|
+
- digestSummary must be grammatically complete as a standalone sentence. It should usually start with "You might like meeting {Name} because ..." for direct connections, or "You may be able to help {Name} because ..." for connector/introducer cards.
|
|
149
|
+
- digestSummary must NOT use awkward third-person fragments like "Name is...", "they're ..., and is...", "you is...", or "the discoverer's query".
|
|
150
|
+
- digestSummary must be one sentence, MUST fit within 180 characters when possible, and MUST contain no markdown links; the caller will attach links.
|
|
151
|
+
- If you cannot fit every detail, choose one clear reason and stop. Do not rely on downstream truncation.
|
|
152
|
+
|
|
153
|
+
**Introduction-originated opportunities (ONLY when INTRODUCTION CONTEXT is provided):**
|
|
154
|
+
When INTRODUCTION CONTEXT is provided, this opportunity was explicitly created by an introducer. It was NOT automatically discovered.
|
|
155
|
+
- For parties/patients/agents/peers viewing an introduction: keep the introducer signal in narratorRemark (and narrator chip), not in personalizedSummary.
|
|
156
|
+
- For these introduced parties, personalizedSummary must focus ONLY on fit/value between viewer and counterpart. Do NOT mention the introducer there.
|
|
157
|
+
- narratorRemark should carry the introduction signal (e.g., "saw strong alignment between you two" or "thought this connection could be valuable"), without repeating the narrator name at the start.
|
|
158
|
+
- This is a personal recommendation, not an algorithm match. Frame it accordingly.
|
|
159
|
+
|
|
160
|
+
**CRITICAL: NEVER include introducer names in personalizedSummary. Examples:**
|
|
161
|
+
❌ WRONG: "Seref introduced you to Lucy, who is actively seeking a product co-founder..."
|
|
162
|
+
✅ CORRECT: "Lucy is actively seeking a product co-founder for a niche APAC marketplace. With your expertise in UX and AI, this could be an ideal collaboration."
|
|
163
|
+
|
|
164
|
+
❌ WRONG: "Bob thinks you should meet Alice because your React skills align with her needs."
|
|
165
|
+
✅ CORRECT: "Alice is building a React-based platform and needs frontend expertise. Your experience with component architecture makes you a strong fit."
|
|
166
|
+
|
|
167
|
+
❌ WRONG: "Jane connected you to Mark, who is looking for a designer."
|
|
168
|
+
✅ CORRECT: "Mark is building a consumer app and needs design expertise. Your background in user-centered design aligns well with what he's building."
|
|
169
|
+
|
|
170
|
+
Remember: The introducer's name goes ONLY in narratorRemark, NEVER in personalizedSummary.
|
|
171
|
+
|
|
172
|
+
**When INTRODUCTION CONTEXT is NOT provided (system-discovered match):**
|
|
173
|
+
- Do NOT use introducer-style wording. Do NOT say "you suggested", "this is an introduction you suggested", or "you suggested this connection". The system found this match; no human introducer was involved.
|
|
174
|
+
- Instead, narratorRemark should describe why the match is relevant (e.g. "Based on your overlapping intents", "Your skills align with what they need").
|
|
175
|
+
|
|
176
|
+
**Negotiation-grounded explanations (ONLY when NEGOTIATION CONTEXT is provided):**
|
|
177
|
+
When NEGOTIATION CONTEXT is provided, this opportunity passed through an agent-to-agent negotiation. Use the transcript to ground your explanation in the concrete reasoning the agents exchanged.
|
|
178
|
+
- Personalize the summary with *why* the negotiation produced this match — reference the roles the agents agreed on, the specific concerns raised, and how they were resolved.
|
|
179
|
+
- For status "stalled" with reason "turn_cap": the agents hit the turn limit without reaching agreement. Frame the card as a hedged possibility rather than a confident match; narratorRemark should signal "agents couldn't fully converge" without sounding negative.
|
|
180
|
+
- For status "stalled" with reason "timeout": one side went silent. Suggest the user re-engage if interested.
|
|
181
|
+
- For status "accepted": the agents agreed; the card should confidently explain *why* they agreed.
|
|
182
|
+
- For status "rejected": the agents declined. The card should explain the reason briefly so the user understands — not dwell on it.
|
|
183
|
+
- Do NOT invent turn content. Only reference what is in the NEGOTIATION CONTEXT block.
|
|
184
|
+
|
|
185
|
+
- Exception for connector/introducer: if viewer role is "introducer" (any status), this is a curation/connector card. Use:
|
|
186
|
+
- suggestedAction: one short line about sharing the intro or confirming the match.
|
|
187
|
+
- mutualIntentsLabel: a short connector label (e.g. "Connector match", "You can bridge this").
|
|
188
|
+
- headline: describe the connection between the parties (e.g., "Connecting a PhD researcher with a translator"). Do NOT reference the introducer's own needs.
|
|
189
|
+
- personalizedSummary: explain why the parties you're introducing should meet, referencing THEIR profiles and intents, not yours.
|
|
190
|
+
|
|
191
|
+
**CRITICAL for latent introducer cards (opportunity status is "latent"):**
|
|
192
|
+
When the viewer is the introducer and the opportunity status is "latent", the introducer has NOT yet approved this match. They are evaluating whether to make the introduction.
|
|
193
|
+
- narratorRemark MUST use evaluation/curation language (e.g. "Could be a strong match", "Worth introducing?", "Interesting overlap here").
|
|
194
|
+
- Do NOT say "you suggested", "you introduced", "you connected", or any past-tense language implying the introduction was already made.
|
|
195
|
+
- suggestedAction should encourage evaluation (e.g. "Approve if you see the fit").
|
|
196
|
+
- Exception for new-connection reveal: if viewer role is "agent", status is "accepted", and there is an introducer, this is the agent's first time seeing this opportunity. Use:
|
|
197
|
+
- suggestedAction: a short line about joining the conversation.
|
|
198
|
+
`;
|
|
199
|
+
// ──────────────────────────────────────────────────────────────
|
|
200
|
+
// DETERMINISTIC OUTPUT VALIDATION
|
|
201
|
+
// ──────────────────────────────────────────────────────────────
|
|
202
|
+
function sanitizePresenterField(value, fallback, allowEmpty = fallback === "") {
|
|
203
|
+
const cleaned = stripUnsupportedOpportunityClaims(stripUuids(value));
|
|
204
|
+
if (cleaned || allowEmpty) {
|
|
205
|
+
return { value: cleaned, usedFallback: false };
|
|
206
|
+
}
|
|
207
|
+
return { value: fallback, usedFallback: true };
|
|
208
|
+
}
|
|
209
|
+
// ──────────────────────────────────────────────────────────────
|
|
210
|
+
// CLASS
|
|
211
|
+
// ──────────────────────────────────────────────────────────────
|
|
212
|
+
export class OpportunityPresenter {
|
|
213
|
+
constructor() {
|
|
214
|
+
this.model = createStructuredModel("opportunityPresenter", responseFormat, {
|
|
215
|
+
name: "opportunity_presenter",
|
|
216
|
+
});
|
|
217
|
+
this.homeCardModel = createStructuredModel("opportunityPresenter", homeCardResponseFormat, {
|
|
218
|
+
name: "opportunity_presenter_home_card",
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
async invokeWithTimeout(targetModel, messages, signal) {
|
|
222
|
+
const timeoutReason = `LLM invoke timed out after ${LLM_TIMEOUT_MS}ms`;
|
|
223
|
+
const controller = new AbortController();
|
|
224
|
+
let timeoutId;
|
|
225
|
+
const combinedSignal = signal ? AbortSignal.any([signal, controller.signal]) : controller.signal;
|
|
226
|
+
const invokePromise = targetModel.invoke(messages, { signal: combinedSignal });
|
|
227
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
228
|
+
timeoutId = setTimeout(() => {
|
|
229
|
+
controller.abort(timeoutReason);
|
|
230
|
+
reject(new Error(timeoutReason));
|
|
231
|
+
}, LLM_TIMEOUT_MS);
|
|
232
|
+
});
|
|
233
|
+
try {
|
|
234
|
+
return await Promise.race([invokePromise, timeoutPromise]);
|
|
235
|
+
}
|
|
236
|
+
finally {
|
|
237
|
+
if (timeoutId) {
|
|
238
|
+
clearTimeout(timeoutId);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Generate personalized presentation for a single opportunity.
|
|
244
|
+
*/
|
|
245
|
+
async present(input, options = {}) {
|
|
246
|
+
const introContext = input.isIntroduction
|
|
247
|
+
? `\nINTRODUCTION CONTEXT: This opportunity was created by an explicit introduction from ${input.introducerName ?? "someone in the community"}. It was NOT discovered automatically — a real person made this connection.\n`
|
|
248
|
+
: "";
|
|
249
|
+
const humanContent = `
|
|
250
|
+
VIEWER (the person seeing this opportunity):
|
|
251
|
+
${input.viewerContext}
|
|
252
|
+
|
|
253
|
+
OTHER PARTY:
|
|
254
|
+
${input.otherPartyContext}
|
|
255
|
+
|
|
256
|
+
MATCH CONTEXT:
|
|
257
|
+
- Category: ${input.category}
|
|
258
|
+
- Confidence: ${input.confidence}
|
|
259
|
+
- Why we matched: ${input.matchReasoning}
|
|
260
|
+
- Signals: ${input.signalsSummary}
|
|
261
|
+
${introContext}
|
|
262
|
+
COMMUNITY: ${input.indexName}
|
|
263
|
+
Viewer's role in this opportunity: ${input.viewerRole}
|
|
264
|
+
|
|
265
|
+
Produce headline, personalizedSummary (2-3 sentences in "you" language), suggestedAction, and greeting.
|
|
266
|
+
`;
|
|
267
|
+
try {
|
|
268
|
+
const messages = [
|
|
269
|
+
new SystemMessage(systemPrompt),
|
|
270
|
+
new HumanMessage(humanContent),
|
|
271
|
+
];
|
|
272
|
+
const result = await this.invokeWithTimeout(this.model, messages, options.signal);
|
|
273
|
+
const parsed = responseFormat.parse(result);
|
|
274
|
+
const headline = sanitizePresenterField(parsed.presentation.headline, DEFAULT_FALLBACK_HEADLINE);
|
|
275
|
+
const summary = sanitizePresenterField(parsed.presentation.personalizedSummary, DEFAULT_EMPTY_FALLBACK_TEXT);
|
|
276
|
+
const action = sanitizePresenterField(parsed.presentation.suggestedAction, DEFAULT_FALLBACK_ACTION);
|
|
277
|
+
const greeting = sanitizePresenterField(parsed.presentation.greeting, "");
|
|
278
|
+
const usedFallback = headline.usedFallback || summary.usedFallback || action.usedFallback || greeting.usedFallback;
|
|
279
|
+
return {
|
|
280
|
+
headline: headline.value,
|
|
281
|
+
personalizedSummary: summary.value,
|
|
282
|
+
suggestedAction: action.value,
|
|
283
|
+
greeting: greeting.value,
|
|
284
|
+
...(usedFallback ? { isFallback: true, fallbackReason: "sanitization" } : {}),
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
catch (e) {
|
|
288
|
+
if (options.signal?.aborted)
|
|
289
|
+
throw e;
|
|
290
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
291
|
+
const timeoutReason = message.includes("timed out") ? message : undefined;
|
|
292
|
+
presentLog.warn("LLM failed, returning fallback", {
|
|
293
|
+
event: "presenter_fallback",
|
|
294
|
+
presenter: "opportunity",
|
|
295
|
+
reason: timeoutReason ? "timeout" : "parse_error",
|
|
296
|
+
message,
|
|
297
|
+
timeoutReason,
|
|
298
|
+
});
|
|
299
|
+
return {
|
|
300
|
+
headline: DEFAULT_FALLBACK_HEADLINE,
|
|
301
|
+
personalizedSummary: safeFallbackSummary(input.matchReasoning),
|
|
302
|
+
suggestedAction: DEFAULT_FALLBACK_ACTION,
|
|
303
|
+
greeting: "",
|
|
304
|
+
isFallback: true,
|
|
305
|
+
fallbackReason: timeoutReason ? "timeout" : "error",
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Generate LLM-powered home-card content (headline, body, narrator remark, mutual-intent label).
|
|
311
|
+
* Callers append button labels from opportunity.constants.
|
|
312
|
+
*
|
|
313
|
+
* When `negotiationContext.status === 'negotiating'`, returns a templated
|
|
314
|
+
* chip synchronously without invoking the LLM — the card just reflects
|
|
315
|
+
* "negotiation in progress" at that point.
|
|
316
|
+
*/
|
|
317
|
+
async presentHomeCard(input) {
|
|
318
|
+
if (input.negotiationContext?.status === 'negotiating') {
|
|
319
|
+
return buildNegotiatingChip(input);
|
|
320
|
+
}
|
|
321
|
+
const mutualHint = input.mutualIntentCount != null && input.mutualIntentCount > 0
|
|
322
|
+
? `There are ${input.mutualIntentCount} overlapping intent(s) between viewer and other party.`
|
|
323
|
+
: "Match is based on profile and intent alignment. Do not cite a numeric intent count.";
|
|
324
|
+
const introContext = input.isIntroduction
|
|
325
|
+
? `\nINTRODUCTION CONTEXT: This opportunity was created by an explicit introduction from ${input.introducerName ?? "someone in the community"}. It was NOT discovered automatically — a real person made this connection.\n`
|
|
326
|
+
: "";
|
|
327
|
+
const negotiationBlock = buildNegotiationPromptBlock(input.negotiationContext);
|
|
328
|
+
// When negotiation context exists, lead with it — these cards exist
|
|
329
|
+
// *because* the negotiation happened. Trailing the block lets weaker
|
|
330
|
+
// models lean on surface signals and ignore the transcript entirely.
|
|
331
|
+
const negotiationDirective = negotiationBlock
|
|
332
|
+
? `\nIMPORTANT: This opportunity surfaced because the agents negotiated and converged. Both your personalizedSummary AND your digestSummary MUST reference at least one specific signal from the NEGOTIATION CONTEXT block below — what concern was raised, what was confirmed, what the agents agreed on. The digestSummary is the one-line morning-brief sentence a user reads before deciding to act, so it must communicate *why this specific match* surfaced now (the negotiation that led to it), not a generic skill-complementarity line. Do not produce the generic summary every card looked like before this negotiation happened.\n`
|
|
333
|
+
: "";
|
|
334
|
+
const humanContent = `
|
|
335
|
+
${negotiationBlock}${negotiationDirective}
|
|
336
|
+
VIEWER (the person seeing this opportunity):
|
|
337
|
+
${input.viewerContext}
|
|
338
|
+
|
|
339
|
+
OTHER PARTY:
|
|
340
|
+
${input.otherPartyContext}
|
|
341
|
+
|
|
342
|
+
MATCH CONTEXT:
|
|
343
|
+
- Category: ${input.category}
|
|
344
|
+
- Confidence: ${input.confidence}
|
|
345
|
+
- Why we matched: ${input.matchReasoning}
|
|
346
|
+
- Signals: ${input.signalsSummary}
|
|
347
|
+
- ${mutualHint}
|
|
348
|
+
${introContext}
|
|
349
|
+
COMMUNITY: ${input.indexName}
|
|
350
|
+
Viewer's role in this opportunity: ${input.viewerRole}
|
|
351
|
+
Opportunity status: ${input.opportunityStatus ?? "pending"}
|
|
352
|
+
|
|
353
|
+
Produce headline, personalizedSummary, digestSummary, suggestedAction, narratorRemark, greeting, and mutualIntentsLabel.
|
|
354
|
+
`;
|
|
355
|
+
const isIntroducer = input.viewerRole === "introducer";
|
|
356
|
+
try {
|
|
357
|
+
const messages = [
|
|
358
|
+
new SystemMessage(homeCardSystemPrompt),
|
|
359
|
+
new HumanMessage(humanContent),
|
|
360
|
+
];
|
|
361
|
+
const result = await this.invokeWithTimeout(this.homeCardModel, messages);
|
|
362
|
+
const parsed = homeCardResponseFormat.parse(result);
|
|
363
|
+
if (/^0\s+(mutual|overlapping)\s+intent/i.test(parsed.presentation.mutualIntentsLabel)) {
|
|
364
|
+
parsed.presentation.mutualIntentsLabel = "Shared interests";
|
|
365
|
+
}
|
|
366
|
+
if (input.isIntroduction && input.introducerName) {
|
|
367
|
+
parsed.presentation.personalizedSummary = stripIntroducerMentions(parsed.presentation.personalizedSummary, input.introducerName);
|
|
368
|
+
parsed.presentation.digestSummary = stripIntroducerMentions(parsed.presentation.digestSummary, input.introducerName);
|
|
369
|
+
}
|
|
370
|
+
const fields = {
|
|
371
|
+
headline: sanitizePresenterField(parsed.presentation.headline, DEFAULT_FALLBACK_HEADLINE),
|
|
372
|
+
personalizedSummary: sanitizePresenterField(parsed.presentation.personalizedSummary, DEFAULT_EMPTY_FALLBACK_TEXT),
|
|
373
|
+
digestSummary: sanitizePresenterField(parsed.presentation.digestSummary, isIntroducer
|
|
374
|
+
? "You may be able to help make a useful introduction here."
|
|
375
|
+
: "You might like meeting them based on your current interests."),
|
|
376
|
+
suggestedAction: sanitizePresenterField(parsed.presentation.suggestedAction, DEFAULT_FALLBACK_ACTION),
|
|
377
|
+
narratorRemark: sanitizePresenterField(parsed.presentation.narratorRemark, "Worth a look."),
|
|
378
|
+
mutualIntentsLabel: sanitizePresenterField(parsed.presentation.mutualIntentsLabel, isIntroducer ? "Connector match" : "Shared interests"),
|
|
379
|
+
greeting: sanitizePresenterField(parsed.presentation.greeting, ""),
|
|
380
|
+
};
|
|
381
|
+
const usedFallback = Object.values(fields).some((field) => field.usedFallback);
|
|
382
|
+
return {
|
|
383
|
+
headline: fields.headline.value,
|
|
384
|
+
personalizedSummary: fields.personalizedSummary.value,
|
|
385
|
+
digestSummary: fields.digestSummary.value,
|
|
386
|
+
suggestedAction: fields.suggestedAction.value,
|
|
387
|
+
narratorRemark: fields.narratorRemark.value,
|
|
388
|
+
mutualIntentsLabel: fields.mutualIntentsLabel.value,
|
|
389
|
+
greeting: fields.greeting.value,
|
|
390
|
+
...(usedFallback ? { isFallback: true } : {}),
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
catch (e) {
|
|
394
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
395
|
+
const timeoutReason = message.includes("timed out") ? message : undefined;
|
|
396
|
+
presentHomeCardLog.warn("LLM failed, returning fallback", {
|
|
397
|
+
event: "presenter_fallback",
|
|
398
|
+
presenter: "home_card",
|
|
399
|
+
reason: timeoutReason ? "timeout" : "parse_error",
|
|
400
|
+
message,
|
|
401
|
+
timeoutReason,
|
|
402
|
+
});
|
|
403
|
+
const fallbackSummary = safeFallbackSummary(input.matchReasoning, {
|
|
404
|
+
introducerName: input.isIntroduction ? input.introducerName : undefined,
|
|
405
|
+
});
|
|
406
|
+
return {
|
|
407
|
+
headline: "A promising connection",
|
|
408
|
+
personalizedSummary: fallbackSummary,
|
|
409
|
+
digestSummary: isIntroducer
|
|
410
|
+
? "You may be able to help make a useful introduction here."
|
|
411
|
+
: "You might like meeting them based on your current interests.",
|
|
412
|
+
suggestedAction: isIntroducer
|
|
413
|
+
? "Share this introduction to get things started."
|
|
414
|
+
: "Take a look and decide whether to reach out.",
|
|
415
|
+
narratorRemark: "Worth a look.",
|
|
416
|
+
mutualIntentsLabel: isIntroducer
|
|
417
|
+
? "Connector match"
|
|
418
|
+
: input.mutualIntentCount != null && input.mutualIntentCount > 0
|
|
419
|
+
? `${input.mutualIntentCount} mutual intent${input.mutualIntentCount !== 1 ? "s" : ""}`
|
|
420
|
+
: "Shared interests",
|
|
421
|
+
greeting: "",
|
|
422
|
+
isFallback: true,
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Process multiple opportunities in parallel with bounded concurrency.
|
|
428
|
+
*/
|
|
429
|
+
async presentBatch(inputs, options) {
|
|
430
|
+
const concurrency = options?.concurrency ?? 5;
|
|
431
|
+
const results = [];
|
|
432
|
+
for (let i = 0; i < inputs.length; i += concurrency) {
|
|
433
|
+
const chunk = inputs.slice(i, i + concurrency);
|
|
434
|
+
const chunkResults = await Promise.all(chunk.map((inp) => this.present(inp)));
|
|
435
|
+
results.push(...chunkResults);
|
|
436
|
+
}
|
|
437
|
+
return results;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Process multiple opportunities as home cards in parallel with bounded concurrency.
|
|
441
|
+
* Returns full home-card display contracts (headline, body, narrator remark, action labels, mutual-intent label).
|
|
442
|
+
*/
|
|
443
|
+
async presentHomeCardBatch(inputs, options) {
|
|
444
|
+
const concurrency = options?.concurrency ?? 5;
|
|
445
|
+
const results = [];
|
|
446
|
+
for (let i = 0; i < inputs.length; i += concurrency) {
|
|
447
|
+
const chunk = inputs.slice(i, i + concurrency);
|
|
448
|
+
const chunkResults = await Promise.all(chunk.map((inp) => this.presentHomeCard(inp)));
|
|
449
|
+
results.push(...chunkResults);
|
|
450
|
+
}
|
|
451
|
+
return results;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
__decorate([
|
|
455
|
+
Timed(),
|
|
456
|
+
__metadata("design:type", Function),
|
|
457
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
458
|
+
__metadata("design:returntype", Promise)
|
|
459
|
+
], OpportunityPresenter.prototype, "present", null);
|
|
460
|
+
__decorate([
|
|
461
|
+
Timed(),
|
|
462
|
+
__metadata("design:type", Function),
|
|
463
|
+
__metadata("design:paramtypes", [Object]),
|
|
464
|
+
__metadata("design:returntype", Promise)
|
|
465
|
+
], OpportunityPresenter.prototype, "presentHomeCard", null);
|
|
466
|
+
__decorate([
|
|
467
|
+
Timed(),
|
|
468
|
+
__metadata("design:type", Function),
|
|
469
|
+
__metadata("design:paramtypes", [Array, Object]),
|
|
470
|
+
__metadata("design:returntype", Promise)
|
|
471
|
+
], OpportunityPresenter.prototype, "presentBatch", null);
|
|
472
|
+
__decorate([
|
|
473
|
+
Timed(),
|
|
474
|
+
__metadata("design:type", Function),
|
|
475
|
+
__metadata("design:paramtypes", [Array, Object]),
|
|
476
|
+
__metadata("design:returntype", Promise)
|
|
477
|
+
], OpportunityPresenter.prototype, "presentHomeCardBatch", null);
|
|
478
|
+
// ──────────────────────────────────────────────────────────────
|
|
479
|
+
// NEGOTIATION CONTEXT HELPERS
|
|
480
|
+
// ──────────────────────────────────────────────────────────────
|
|
481
|
+
/**
|
|
482
|
+
* Builds a "NEGOTIATION CONTEXT:" block for the home-card prompt. Returns an
|
|
483
|
+
* empty string when the opportunity has no meaningful negotiation context
|
|
484
|
+
* (draft/latent) or when the opportunity is still negotiating (handled via
|
|
485
|
+
* the templated chip, not the LLM).
|
|
486
|
+
*/
|
|
487
|
+
function buildNegotiationPromptBlock(context) {
|
|
488
|
+
if (!context || context.status === 'negotiating')
|
|
489
|
+
return "";
|
|
490
|
+
const turnCapLabel = context.turnCap > 0 ? `${context.turnCap}` : "unlimited";
|
|
491
|
+
const reason = context.outcome?.reason;
|
|
492
|
+
const reasonLabel = reason === 'turn_cap'
|
|
493
|
+
? "agents hit the turn cap without converging"
|
|
494
|
+
: reason === 'timeout'
|
|
495
|
+
? "counterpart went silent before responding"
|
|
496
|
+
: undefined;
|
|
497
|
+
const turnLines = (context.turns ?? []).map((turn, index) => {
|
|
498
|
+
const action = turn.action;
|
|
499
|
+
const reasoning = turn.assessment?.reasoning ?? "(no reasoning)";
|
|
500
|
+
const message = turn.message ? ` — said: "${turn.message}"` : "";
|
|
501
|
+
return `Turn ${index + 1} (${action}): ${reasoning}${message}`;
|
|
502
|
+
});
|
|
503
|
+
const outcomeSummary = context.outcome
|
|
504
|
+
? `Final outcome: ${context.outcome.hasOpportunity ? "agreed" : "declined"} — ${context.outcome.reasoning}`
|
|
505
|
+
: "Final outcome: not recorded.";
|
|
506
|
+
return `
|
|
507
|
+
NEGOTIATION CONTEXT:
|
|
508
|
+
- Negotiation status: ${context.status}${reasonLabel ? ` (${reasonLabel})` : ""}
|
|
509
|
+
- Turns exchanged: ${context.turnCount} of ${turnCapLabel}
|
|
510
|
+
- Transcript:
|
|
511
|
+
${turnLines.length > 0 ? turnLines.map((l) => ` ${l}`).join("\n") : " (no turns recorded)"}
|
|
512
|
+
- ${outcomeSummary}
|
|
513
|
+
`;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Builds a templated home-card result for an opportunity whose negotiation
|
|
517
|
+
* is still in progress. Bypasses the LLM so users see a stable "currently
|
|
518
|
+
* negotiating" chip while turns are still being exchanged.
|
|
519
|
+
*/
|
|
520
|
+
function buildNegotiatingChip(input) {
|
|
521
|
+
const ctx = input.negotiationContext;
|
|
522
|
+
const turnCount = ctx?.turnCount ?? 0;
|
|
523
|
+
const turnCap = ctx?.turnCap && ctx.turnCap > 0 ? ctx.turnCap : undefined;
|
|
524
|
+
const narratorRemark = turnCap
|
|
525
|
+
? `Currently negotiating · turn ${turnCount} of ${turnCap}`
|
|
526
|
+
: `Currently negotiating · turn ${turnCount}`;
|
|
527
|
+
return {
|
|
528
|
+
headline: "Negotiation in progress",
|
|
529
|
+
personalizedSummary: "Your agent is still talking with theirs to see if this connection makes sense. We'll surface the full match as soon as they converge.",
|
|
530
|
+
digestSummary: "Your agent is still checking whether this connection makes sense.",
|
|
531
|
+
suggestedAction: "Check back shortly — no action needed yet.",
|
|
532
|
+
narratorRemark,
|
|
533
|
+
mutualIntentsLabel: input.mutualIntentCount && input.mutualIntentCount > 0
|
|
534
|
+
? `${input.mutualIntentCount} mutual intent${input.mutualIntentCount !== 1 ? "s" : ""}`
|
|
535
|
+
: "Shared interests",
|
|
536
|
+
greeting: "",
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
// ──────────────────────────────────────────────────────────────
|
|
540
|
+
// CONTEXT GATHERER (used by tools)
|
|
541
|
+
// ──────────────────────────────────────────────────────────────
|
|
542
|
+
/**
|
|
543
|
+
* Build the LLM-facing signal summary while excluding pool adjustments. Pool
|
|
544
|
+
* disposition is rendered deterministically by the card chip; asking the
|
|
545
|
+
* presenter to interpret it could turn a demotion into a positive rationale.
|
|
546
|
+
*/
|
|
547
|
+
export function summarizeSignalsForPresenter(signals) {
|
|
548
|
+
const safeSignals = signals?.filter((signal) => signal.type !== 'pool_discriminator') ?? [];
|
|
549
|
+
if (safeSignals.length === 0)
|
|
550
|
+
return 'Match based on profile and intent alignment.';
|
|
551
|
+
return safeSignals.map((signal) => `${signal.type}: ${signal.detail ?? signal.type}`).join('; ');
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Gather all context needed for the presenter from the database.
|
|
555
|
+
* Fetches viewer profile, viewer intents, other party profile(s), and index in parallel.
|
|
556
|
+
*
|
|
557
|
+
* @param displayCounterpartUserId - When set (e.g. for home card), only this counterpart is included in otherPartyContext so the presenter writes about the person on the card. Omitted for introducer view (card shows both parties).
|
|
558
|
+
*/
|
|
559
|
+
export async function gatherPresenterContext(database, opportunity, viewerId, displayCounterpartUserId) {
|
|
560
|
+
const myActor = opportunity.actors.find((a) => a.userId === viewerId);
|
|
561
|
+
if (!myActor) {
|
|
562
|
+
throw new Error("Viewer is not an actor in this opportunity");
|
|
563
|
+
}
|
|
564
|
+
const isIntroducer = myActor.role === "introducer";
|
|
565
|
+
const otherActors = opportunity.actors.filter((a) => a.userId !== viewerId);
|
|
566
|
+
let otherPartyIds = [...new Set(otherActors.map((a) => a.userId))];
|
|
567
|
+
if (displayCounterpartUserId &&
|
|
568
|
+
!isIntroducer &&
|
|
569
|
+
otherPartyIds.includes(displayCounterpartUserId)) {
|
|
570
|
+
otherPartyIds = [displayCounterpartUserId];
|
|
571
|
+
}
|
|
572
|
+
const contextIndexId = opportunity.context?.networkId;
|
|
573
|
+
// For introducers: fetch profiles + intents for both parties; skip introducer's own intents.
|
|
574
|
+
// For other roles: fetch viewer's profile + intents and other party profiles.
|
|
575
|
+
const [viewerProfile, indexRecord, ...otherProfiles] = await Promise.all([
|
|
576
|
+
database.getProfile(viewerId),
|
|
577
|
+
contextIndexId ? database.getNetwork(contextIndexId) : Promise.resolve(null),
|
|
578
|
+
...otherPartyIds.map((uid) => database.getProfile(uid)),
|
|
579
|
+
]);
|
|
580
|
+
// Fetch intents: for introducer, fetch each party's intents; otherwise fetch viewer's intents.
|
|
581
|
+
let viewerIntents;
|
|
582
|
+
let partyIntentsMap;
|
|
583
|
+
if (isIntroducer) {
|
|
584
|
+
const partyIntentResults = await Promise.all(otherPartyIds.map(async (uid) => ({
|
|
585
|
+
uid,
|
|
586
|
+
intents: await database.getActiveIntents(uid),
|
|
587
|
+
})));
|
|
588
|
+
partyIntentsMap = new Map(partyIntentResults.map((r) => [r.uid, r.intents]));
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
viewerIntents = await database.getActiveIntents(viewerId);
|
|
592
|
+
}
|
|
593
|
+
// Fetch premises when any actor is premise-grounded
|
|
594
|
+
const premiseGroundedActors = opportunity.actors.filter((a) => a.premise);
|
|
595
|
+
let viewerPremiseContext = '';
|
|
596
|
+
let otherPremiseContext = '';
|
|
597
|
+
if (premiseGroundedActors.length > 0) {
|
|
598
|
+
// Only fetch premises for actors that are actually premise-grounded, not all parties
|
|
599
|
+
const groundedOtherIds = premiseGroundedActors
|
|
600
|
+
.filter((a) => a.userId !== viewerId)
|
|
601
|
+
.map((a) => a.userId);
|
|
602
|
+
const viewerIsGrounded = premiseGroundedActors.some((a) => a.userId === viewerId);
|
|
603
|
+
const results = await Promise.all([
|
|
604
|
+
...(viewerIsGrounded ? [database.getPremisesForUser(viewerId, 'ACTIVE')] : []),
|
|
605
|
+
...groundedOtherIds.map((uid) => database.getPremisesForUser(uid, 'ACTIVE')),
|
|
606
|
+
]);
|
|
607
|
+
let idx = 0;
|
|
608
|
+
if (viewerIsGrounded) {
|
|
609
|
+
const viewerPremises = results[idx++];
|
|
610
|
+
if (viewerPremises?.length) {
|
|
611
|
+
viewerPremiseContext =
|
|
612
|
+
'\nPremises (self-descriptions):\n' +
|
|
613
|
+
viewerPremises
|
|
614
|
+
.slice(0, 5)
|
|
615
|
+
.map((p) => `- ${p.assertion.text}`)
|
|
616
|
+
.join('\n');
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
const otherPremiseLines = [];
|
|
620
|
+
for (let i = 0; i < groundedOtherIds.length; i++) {
|
|
621
|
+
const premises = results[idx++];
|
|
622
|
+
if (premises?.length) {
|
|
623
|
+
for (const p of premises.slice(0, 3)) {
|
|
624
|
+
otherPremiseLines.push(`- ${p.assertion.text}`);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
if (otherPremiseLines.length > 0) {
|
|
629
|
+
otherPremiseContext = '\nPremises (self-descriptions):\n' + otherPremiseLines.join('\n');
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
let viewerContext;
|
|
633
|
+
let otherPartyContext;
|
|
634
|
+
if (isIntroducer) {
|
|
635
|
+
// Introducer view: minimal viewer context (just name + role), rich other-party context with intents
|
|
636
|
+
const introducerApproved = opportunity.actors.find(a => a.role === 'introducer')?.approved === true;
|
|
637
|
+
const hasApproved = introducerApproved || opportunity.status !== 'latent';
|
|
638
|
+
viewerContext = [
|
|
639
|
+
"Profile:",
|
|
640
|
+
`Name: ${viewerProfile?.identity?.name ?? "Unknown"}`,
|
|
641
|
+
hasApproved
|
|
642
|
+
? "Role: You are the introducer who suggested this connection."
|
|
643
|
+
: "Role: You are being asked whether these two people would benefit from meeting. You have NOT yet approved this introduction.",
|
|
644
|
+
].join("\n");
|
|
645
|
+
const otherParts = otherPartyIds.map((uid, idx) => {
|
|
646
|
+
const profile = otherProfiles[idx];
|
|
647
|
+
const name = profile?.identity?.name ?? "Unknown";
|
|
648
|
+
const bio = profile?.identity?.bio ?? "";
|
|
649
|
+
const location = profile?.identity?.location ?? "";
|
|
650
|
+
const context = profile?.context ?? "";
|
|
651
|
+
const intents = partyIntentsMap?.get(uid);
|
|
652
|
+
const intentLines = intents?.length
|
|
653
|
+
? intents
|
|
654
|
+
.slice(0, 5)
|
|
655
|
+
.map((i) => ` - ${i.payload}${i.summary ? ` (${i.summary})` : ""}`)
|
|
656
|
+
: [" (no active intents)"];
|
|
657
|
+
return [
|
|
658
|
+
`${name}:`,
|
|
659
|
+
` Bio: ${bio}`,
|
|
660
|
+
location ? ` Location: ${location}` : null,
|
|
661
|
+
context ? ` Context: ${context}` : null,
|
|
662
|
+
` Active intents:`,
|
|
663
|
+
...intentLines,
|
|
664
|
+
]
|
|
665
|
+
.filter(Boolean)
|
|
666
|
+
.join("\n");
|
|
667
|
+
});
|
|
668
|
+
otherPartyContext =
|
|
669
|
+
otherParts.join("\n\n") || "Parties (details not available).";
|
|
670
|
+
}
|
|
671
|
+
else {
|
|
672
|
+
// Non-introducer view: full viewer profile + intents, other party profiles
|
|
673
|
+
const viewerContextLines = [
|
|
674
|
+
"Profile:",
|
|
675
|
+
`Name: ${viewerProfile?.identity?.name ?? "Unknown"}`,
|
|
676
|
+
`Bio: ${viewerProfile?.identity?.bio ?? ""}`,
|
|
677
|
+
`Location: ${viewerProfile?.identity?.location ?? ""}`,
|
|
678
|
+
`Context: ${viewerProfile?.context ?? ""}`,
|
|
679
|
+
"Active intents:",
|
|
680
|
+
...(viewerIntents?.length
|
|
681
|
+
? viewerIntents.map((i) => `- ${i.payload}${i.summary ? ` (${i.summary})` : ""}`)
|
|
682
|
+
: ["(none listed)"]),
|
|
683
|
+
];
|
|
684
|
+
viewerContext = viewerContextLines.join("\n");
|
|
685
|
+
const otherParts = otherPartyIds.map((uid, idx) => {
|
|
686
|
+
const profile = otherProfiles[idx];
|
|
687
|
+
const name = profile?.identity?.name ?? "Unknown";
|
|
688
|
+
const bio = profile?.identity?.bio ?? "";
|
|
689
|
+
return `${name}: ${bio}`;
|
|
690
|
+
});
|
|
691
|
+
otherPartyContext =
|
|
692
|
+
otherParts.join("\n\n") || "Other party (details not available).";
|
|
693
|
+
}
|
|
694
|
+
const interp = opportunity.interpretation;
|
|
695
|
+
const signalsSummary = summarizeSignalsForPresenter(interp.signals);
|
|
696
|
+
// Detect introduction-originated opportunities: only when there is an explicit introducer actor.
|
|
697
|
+
// Do NOT use detection.source === "manual" alone — system-discovered opportunities can have manual source without an introducer.
|
|
698
|
+
const introducerActor = opportunity.actors.find((a) => a.role === "introducer");
|
|
699
|
+
const isIntroduction = !!introducerActor;
|
|
700
|
+
let introducerName;
|
|
701
|
+
if (introducerActor) {
|
|
702
|
+
introducerName = opportunity.detection.createdByName;
|
|
703
|
+
if (!introducerName) {
|
|
704
|
+
const introducerProfile = await database.getProfile(introducerActor.userId);
|
|
705
|
+
introducerName = introducerProfile?.identity?.name ?? undefined;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
const counterpartName = otherPartyIds.length === 1 && otherProfiles[0]
|
|
709
|
+
? otherProfiles[0]?.identity?.name?.trim()
|
|
710
|
+
: undefined;
|
|
711
|
+
const viewerNameForFilter = viewerProfile?.identity?.name?.trim();
|
|
712
|
+
const matchReasoning = counterpartName && interp.reasoning
|
|
713
|
+
? viewerCentricCardSummary(interp.reasoning, counterpartName, 400, viewerNameForFilter, introducerName)
|
|
714
|
+
: stripUuids(interp.reasoning);
|
|
715
|
+
if (viewerPremiseContext) {
|
|
716
|
+
viewerContext += viewerPremiseContext;
|
|
717
|
+
}
|
|
718
|
+
if (otherPremiseContext) {
|
|
719
|
+
otherPartyContext += otherPremiseContext;
|
|
720
|
+
}
|
|
721
|
+
const result = {
|
|
722
|
+
viewerContext,
|
|
723
|
+
otherPartyContext,
|
|
724
|
+
matchReasoning,
|
|
725
|
+
category: interp.category ?? "connection",
|
|
726
|
+
confidence: typeof interp.confidence === "number"
|
|
727
|
+
? interp.confidence
|
|
728
|
+
: parseFloat(String(interp.confidence ?? 0)) || 0,
|
|
729
|
+
signalsSummary,
|
|
730
|
+
indexName: indexRecord?.title ?? contextIndexId ?? "",
|
|
731
|
+
viewerRole: myActor.role ?? "party",
|
|
732
|
+
isIntroduction,
|
|
733
|
+
introducerName,
|
|
734
|
+
};
|
|
735
|
+
return result;
|
|
736
|
+
}
|