@indexnetwork/protocol 6.12.0-rc.403.1 → 6.13.22-rc.405.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +241 -0
- package/IMPLEMENTATION.md +20 -0
- package/STABILITY.md +4 -0
- package/dist/agent/agent.tools.d.ts +11 -3
- package/dist/agent/agent.tools.js +11 -301
- package/dist/capabilities/communities.facade.d.ts +13 -0
- package/dist/capabilities/communities.facade.js +12 -0
- package/dist/capabilities/communities.tools.port.d.ts +5 -0
- package/dist/capabilities/communities.tools.port.js +1 -0
- package/dist/capabilities/contacts.facade.d.ts +9 -0
- package/dist/capabilities/contacts.facade.js +8 -0
- package/dist/capabilities/contacts.tools.port.d.ts +9 -0
- package/dist/capabilities/contacts.tools.port.js +1 -0
- package/dist/capabilities/integrations.facade.d.ts +8 -0
- package/dist/capabilities/integrations.facade.js +7 -0
- package/dist/capabilities/integrations.tools.port.d.ts +9 -0
- package/dist/capabilities/integrations.tools.port.js +1 -0
- package/dist/capabilities/interaction-composition.facade.d.ts +10 -0
- package/dist/capabilities/interaction-composition.facade.js +9 -0
- package/dist/capabilities/negotiation.discovery.facade.d.ts +9 -0
- package/dist/capabilities/negotiation.discovery.facade.js +7 -0
- package/dist/capabilities/negotiation.facade.d.ts +23 -0
- package/dist/capabilities/negotiation.facade.js +17 -0
- package/dist/capabilities/negotiation.memory.facade.d.ts +6 -0
- package/dist/capabilities/negotiation.memory.facade.js +5 -0
- package/dist/capabilities/negotiation.questions.facade.d.ts +6 -0
- package/dist/capabilities/negotiation.questions.facade.js +5 -0
- package/dist/capabilities/negotiation.state.facade.d.ts +5 -0
- package/dist/capabilities/negotiation.state.facade.js +1 -0
- package/dist/capabilities/negotiation.summary.facade.d.ts +5 -0
- package/dist/capabilities/negotiation.summary.facade.js +5 -0
- package/dist/capabilities/negotiation.tools.port.d.ts +5 -0
- package/dist/capabilities/negotiation.tools.port.js +1 -0
- package/dist/capabilities/opportunities.facade.d.ts +50 -0
- package/dist/capabilities/opportunities.facade.js +50 -0
- package/dist/capabilities/opportunities.safety.facade.d.ts +2 -0
- package/dist/capabilities/opportunities.safety.facade.js +2 -0
- package/dist/capabilities/opportunities.tools.port.d.ts +5 -0
- package/dist/capabilities/opportunities.tools.port.js +1 -0
- package/dist/capabilities/participant-agents.debug.facade.d.ts +2 -0
- package/dist/capabilities/participant-agents.debug.facade.js +1 -0
- package/dist/capabilities/participant-agents.facade.d.ts +35 -0
- package/dist/capabilities/participant-agents.facade.js +35 -0
- package/dist/capabilities/participant-agents.tools.facade.d.ts +8 -0
- package/dist/capabilities/participant-agents.tools.facade.js +8 -0
- package/dist/capabilities/participant-agents.tools.port.d.ts +9 -0
- package/dist/capabilities/participant-agents.tools.port.js +1 -0
- package/dist/capabilities/participant-context.facade.d.ts +13 -0
- package/dist/capabilities/participant-context.facade.js +14 -0
- package/dist/capabilities/participant-context.tools.port.d.ts +9 -0
- package/dist/capabilities/participant-context.tools.port.js +1 -0
- package/dist/capabilities/questions.enqueue.facade.d.ts +5 -0
- package/dist/capabilities/questions.enqueue.facade.js +1 -0
- package/dist/capabilities/questions.facade.d.ts +8 -0
- package/dist/capabilities/questions.facade.js +7 -0
- package/dist/capabilities/questions.runtime.facade.d.ts +5 -0
- package/dist/capabilities/questions.runtime.facade.js +5 -0
- package/dist/capabilities/questions.tools.port.d.ts +5 -0
- package/dist/capabilities/questions.tools.port.js +1 -0
- package/dist/capabilities/signals.facade.d.ts +16 -0
- package/dist/capabilities/signals.facade.js +14 -0
- package/dist/capabilities/signals.indexing.facade.d.ts +12 -0
- package/dist/capabilities/signals.indexing.facade.js +11 -0
- package/dist/capabilities/signals.tools.port.d.ts +5 -0
- package/dist/capabilities/signals.tools.port.js +1 -0
- package/dist/chat/chat-streaming.types.d.ts +0 -1
- package/dist/chat/chat-streaming.types.js +1 -2
- package/dist/chat/chat.agent.d.ts +0 -1
- package/dist/chat/chat.agent.js +0 -1
- package/dist/chat/chat.graph.d.ts +0 -1
- package/dist/chat/chat.graph.js +0 -1
- package/dist/chat/chat.interrupt.classifier.d.ts +0 -1
- package/dist/chat/chat.interrupt.classifier.js +0 -1
- package/dist/chat/chat.persona.d.ts +0 -1
- package/dist/chat/chat.persona.js +0 -1
- package/dist/chat/chat.prompt.d.ts +0 -1
- package/dist/chat/chat.prompt.js +0 -1
- package/dist/chat/chat.prompt.modules.d.ts +0 -1
- package/dist/chat/chat.prompt.modules.js +0 -1
- package/dist/chat/chat.question-dedup.d.ts +0 -1
- package/dist/chat/chat.question-dedup.js +0 -1
- package/dist/chat/chat.state.d.ts +0 -1
- package/dist/chat/chat.state.js +0 -1
- package/dist/chat/chat.streamer.d.ts +0 -1
- package/dist/chat/chat.streamer.js +0 -1
- package/dist/chat/chat.suggester.d.ts +0 -1
- package/dist/chat/chat.suggester.js +0 -1
- package/dist/chat/chat.summarizer.d.ts +0 -1
- package/dist/chat/chat.summarizer.js +0 -1
- package/dist/chat/chat.title.generator.d.ts +0 -1
- package/dist/chat/chat.title.generator.js +0 -1
- package/dist/chat/chat.tools.d.ts +0 -1
- package/dist/chat/chat.tools.js +0 -1
- package/dist/chat/chat.utils.d.ts +0 -1
- package/dist/chat/chat.utils.js +0 -1
- package/dist/chat/negotiator.persona.d.ts +0 -1
- package/dist/chat/negotiator.persona.js +0 -1
- package/dist/chat/negotiator.prompt.d.ts +1 -2
- package/dist/chat/negotiator.prompt.js +1 -2
- package/dist/chat/negotiator.tools.d.ts +0 -1
- package/dist/chat/negotiator.tools.js +0 -1
- package/dist/chat/onboarding.persona.d.ts +0 -1
- package/dist/chat/onboarding.persona.js +0 -1
- package/dist/chat/onboarding.prompt.d.ts +0 -1
- package/dist/chat/onboarding.prompt.js +0 -1
- package/dist/chat/reporter.action.contracts.d.ts +36 -0
- package/dist/chat/reporter.action.contracts.js +1 -0
- package/dist/chat/reporter.action.tools.d.ts +2 -37
- package/dist/chat/reporter.action.tools.js +0 -1
- package/dist/chat/reporter.persona.d.ts +0 -1
- package/dist/chat/reporter.persona.js +0 -1
- package/dist/chat/reporter.prompt.d.ts +0 -1
- package/dist/chat/reporter.prompt.js +0 -1
- package/dist/chat/signal.persona.d.ts +0 -1
- package/dist/chat/signal.persona.js +0 -1
- package/dist/chat/signal.prompt.d.ts +0 -1
- package/dist/chat/signal.prompt.js +0 -1
- package/dist/communities/application/index.d.ts +45 -0
- package/dist/communities/application/index.js +50 -0
- package/dist/communities/application/indexer.graph.d.ts +446 -0
- package/dist/communities/application/indexer.graph.js +420 -0
- package/dist/communities/application/indexer.state.d.ts +172 -0
- package/dist/communities/application/indexer.state.js +116 -0
- package/dist/communities/application/membership.graph.d.ts +270 -0
- package/dist/communities/application/membership.graph.js +229 -0
- package/dist/communities/application/network.graph.d.ts +648 -0
- package/dist/communities/application/network.graph.js +303 -0
- package/dist/communities/application/network.recommender.d.ts +44 -0
- package/dist/communities/application/network.recommender.js +113 -0
- package/dist/communities/application/network.tools.d.ts +35 -0
- package/dist/communities/application/network.tools.js +578 -0
- package/dist/communities/domain/index.d.ts +29 -0
- package/dist/communities/domain/index.js +31 -0
- package/dist/communities/domain/membership.state.d.ts +87 -0
- package/dist/communities/domain/membership.state.js +53 -0
- package/dist/communities/domain/network.state.d.ts +192 -0
- package/dist/communities/domain/network.state.js +66 -0
- package/dist/communities/index.d.ts +14 -0
- package/dist/communities/index.js +14 -0
- package/dist/communities/ports/index.d.ts +25 -0
- package/dist/communities/ports/index.js +27 -0
- package/dist/communities/public/index.d.ts +30 -0
- package/dist/communities/public/index.js +33 -0
- package/dist/contact/contact.inviter.d.ts +7 -44
- package/dist/contact/contact.inviter.js +6 -59
- package/dist/contact/contact.tools.d.ts +7 -5
- package/dist/contact/contact.tools.js +7 -177
- package/dist/contacts/application/contact.inviter.d.ts +49 -0
- package/dist/contacts/application/contact.inviter.js +64 -0
- package/dist/contacts/application/contact.tools.d.ts +20 -0
- package/dist/contacts/application/contact.tools.js +191 -0
- package/dist/contacts/application/index.d.ts +22 -0
- package/dist/contacts/application/index.js +21 -0
- package/dist/contacts/domain/contact.types.d.ts +51 -0
- package/dist/contacts/domain/contact.types.js +10 -0
- package/dist/contacts/domain/index.d.ts +18 -0
- package/dist/contacts/domain/index.js +1 -0
- package/dist/contacts/index.d.ts +24 -0
- package/dist/contacts/index.js +24 -0
- package/dist/contacts/ports/contact.repository.port.d.ts +28 -0
- package/dist/contacts/ports/contact.repository.port.js +14 -0
- package/dist/contacts/ports/contact.tools.port.d.ts +26 -0
- package/dist/contacts/ports/contact.tools.port.js +21 -0
- package/dist/contacts/ports/index.d.ts +22 -0
- package/dist/contacts/ports/index.js +21 -0
- package/dist/contacts/public/index.d.ts +36 -0
- package/dist/contacts/public/index.js +33 -0
- package/dist/context/context.generator.d.ts +0 -1
- package/dist/context/context.generator.js +0 -1
- package/dist/enrichment/enrichment.enricher.d.ts +0 -1
- package/dist/enrichment/enrichment.enricher.js +0 -1
- package/dist/enrichment/enrichment.generator.d.ts +0 -1
- package/dist/enrichment/enrichment.generator.js +0 -1
- package/dist/enrichment/enrichment.graph.d.ts +6 -7
- package/dist/enrichment/enrichment.graph.js +0 -1
- package/dist/enrichment/enrichment.state.d.ts +2 -3
- package/dist/enrichment/enrichment.state.js +0 -1
- package/dist/enrichment/enrichment.tools.d.ts +3 -3
- package/dist/enrichment/enrichment.tools.js +0 -1
- package/dist/index.d.ts +106 -91
- package/dist/index.js +79 -71
- package/dist/integration/integration.tools.d.ts +6 -10
- package/dist/integration/integration.tools.js +6 -82
- package/dist/integrations/application/index.d.ts +14 -0
- package/dist/integrations/application/index.js +14 -0
- package/dist/integrations/application/integration.tools.d.ts +27 -0
- package/dist/integrations/application/integration.tools.js +98 -0
- package/dist/integrations/domain/index.d.ts +18 -0
- package/dist/integrations/domain/index.js +1 -0
- package/dist/integrations/domain/integration.types.d.ts +53 -0
- package/dist/integrations/domain/integration.types.js +11 -0
- package/dist/integrations/index.d.ts +27 -0
- package/dist/integrations/index.js +27 -0
- package/dist/integrations/ports/index.d.ts +28 -0
- package/dist/integrations/ports/index.js +26 -0
- package/dist/integrations/ports/integration.adapter.port.d.ts +62 -0
- package/dist/integrations/ports/integration.adapter.port.js +15 -0
- package/dist/integrations/ports/integration.importer.port.d.ts +31 -0
- package/dist/integrations/ports/integration.importer.port.js +15 -0
- package/dist/integrations/ports/integration.tools.port.d.ts +28 -0
- package/dist/integrations/ports/integration.tools.port.js +21 -0
- package/dist/integrations/public/index.d.ts +37 -0
- package/dist/integrations/public/index.js +34 -0
- package/dist/intent/intent.clarifier.d.ts +3 -52
- package/dist/intent/intent.clarifier.js +2 -202
- package/dist/intent/intent.graph.d.ts +3 -551
- package/dist/intent/intent.graph.js +3 -937
- package/dist/intent/intent.indexer.d.ts +2 -83
- package/dist/intent/intent.indexer.js +2 -171
- package/dist/intent/intent.inferrer.d.ts +2 -95
- package/dist/intent/intent.inferrer.js +2 -234
- package/dist/intent/intent.reconciler.d.ts +2 -106
- package/dist/intent/intent.reconciler.js +2 -187
- package/dist/intent/intent.specificity.d.ts +2 -3
- package/dist/intent/intent.specificity.js +2 -3
- package/dist/intent/intent.state.d.ts +8 -229
- package/dist/intent/intent.state.js +8 -189
- package/dist/intent/intent.tools.d.ts +6 -24
- package/dist/intent/intent.tools.js +4 -788
- package/dist/intent/intent.verifier.d.ts +2 -116
- package/dist/intent/intent.verifier.js +2 -263
- package/dist/maintenance/maintenance.graph.d.ts +0 -1
- package/dist/maintenance/maintenance.graph.js +0 -1
- package/dist/maintenance/maintenance.state.d.ts +0 -1
- package/dist/maintenance/maintenance.state.js +0 -1
- package/dist/mcp/elicitation.builder.d.ts +0 -1
- package/dist/mcp/elicitation.builder.js +0 -1
- package/dist/mcp/elicitation.dispatcher.d.ts +0 -1
- package/dist/mcp/elicitation.dispatcher.js +0 -1
- package/dist/mcp/mcp.server.d.ts +0 -1
- package/dist/mcp/mcp.server.js +1 -2
- package/dist/negotiation/application/index.d.ts +48 -0
- package/dist/negotiation/application/index.js +49 -0
- package/dist/negotiation/application/insight.generator.d.ts +31 -0
- package/dist/negotiation/application/insight.generator.js +105 -0
- package/dist/negotiation/application/negotiation.agent.d.ts +110 -0
- package/dist/negotiation/application/negotiation.agent.js +244 -0
- package/dist/negotiation/application/negotiation.detail-reader.d.ts +94 -0
- package/dist/negotiation/application/negotiation.detail-reader.js +91 -0
- package/dist/negotiation/application/negotiation.graph.d.ts +664 -0
- package/dist/negotiation/application/negotiation.graph.js +1393 -0
- package/dist/negotiation/application/negotiation.reflect.d.ts +194 -0
- package/dist/negotiation/application/negotiation.reflect.js +145 -0
- package/dist/negotiation/application/negotiation.screen.d.ts +78 -0
- package/dist/negotiation/application/negotiation.screen.js +108 -0
- package/dist/negotiation/application/negotiation.summarizer.d.ts +25 -0
- package/dist/negotiation/application/negotiation.summarizer.js +101 -0
- package/dist/negotiation/application/negotiation.tools.d.ts +18 -0
- package/dist/negotiation/application/negotiation.tools.js +782 -0
- package/dist/negotiation/domain/index.d.ts +48 -0
- package/dist/negotiation/domain/index.js +50 -0
- package/dist/negotiation/domain/negotiation.consultation-policy.d.ts +39 -0
- package/dist/negotiation/domain/negotiation.consultation-policy.js +68 -0
- package/dist/negotiation/domain/negotiation.deadlock.contracts.d.ts +10 -0
- package/dist/negotiation/domain/negotiation.deadlock.contracts.js +1 -0
- package/dist/negotiation/domain/negotiation.deadlock.d.ts +81 -0
- package/dist/negotiation/domain/negotiation.deadlock.js +103 -0
- package/dist/negotiation/domain/negotiation.intent-snapshot-provenance.d.ts +21 -0
- package/dist/negotiation/domain/negotiation.intent-snapshot-provenance.js +28 -0
- package/dist/negotiation/domain/negotiation.lifecycle-narration.d.ts +18 -0
- package/dist/negotiation/domain/negotiation.lifecycle-narration.js +87 -0
- package/dist/negotiation/domain/negotiation.memory.d.ts +65 -0
- package/dist/negotiation/domain/negotiation.memory.js +83 -0
- package/dist/negotiation/domain/negotiation.protocol.d.ts +536 -0
- package/dist/negotiation/domain/negotiation.protocol.js +202 -0
- package/dist/negotiation/domain/negotiation.question-safety.d.ts +25 -0
- package/dist/negotiation/domain/negotiation.question-safety.js +55 -0
- package/dist/negotiation/domain/negotiation.screen.contracts.d.ts +88 -0
- package/dist/negotiation/domain/negotiation.screen.contracts.js +58 -0
- package/dist/negotiation/domain/negotiation.state.d.ts +497 -0
- package/dist/negotiation/domain/negotiation.state.js +288 -0
- package/dist/negotiation/domain/negotiation.task-lock-policy.d.ts +10 -0
- package/dist/negotiation/domain/negotiation.task-lock-policy.js +22 -0
- package/dist/negotiation/index.d.ts +49 -0
- package/dist/negotiation/index.js +49 -0
- package/dist/negotiation/insight.generator.d.ts +3 -30
- package/dist/negotiation/insight.generator.js +3 -104
- package/dist/negotiation/negotiation.agent.d.ts +3 -109
- package/dist/negotiation/negotiation.agent.js +3 -248
- package/dist/negotiation/negotiation.attribution.d.ts +0 -1
- package/dist/negotiation/negotiation.attribution.js +0 -1
- package/dist/negotiation/negotiation.consultation-policy.d.ts +3 -38
- package/dist/negotiation/negotiation.consultation-policy.js +3 -67
- package/dist/negotiation/negotiation.deadlock.contracts.d.ts +5 -0
- package/dist/negotiation/negotiation.deadlock.contracts.js +5 -0
- package/dist/negotiation/negotiation.deadlock.d.ts +3 -94
- package/dist/negotiation/negotiation.deadlock.js +3 -101
- package/dist/negotiation/negotiation.detail-reader.d.ts +5 -0
- package/dist/negotiation/negotiation.detail-reader.js +5 -0
- package/dist/negotiation/negotiation.graph.d.ts +3 -663
- package/dist/negotiation/negotiation.graph.js +3 -1459
- package/dist/negotiation/negotiation.intent-snapshot-provenance.d.ts +5 -0
- package/dist/negotiation/negotiation.intent-snapshot-provenance.js +5 -0
- package/dist/negotiation/negotiation.lifecycle-narration.d.ts +5 -0
- package/dist/negotiation/negotiation.lifecycle-narration.js +5 -0
- package/dist/negotiation/negotiation.memory.d.ts +5 -56
- package/dist/negotiation/negotiation.memory.js +5 -69
- package/dist/negotiation/negotiation.protocol.d.ts +3 -535
- package/dist/negotiation/negotiation.protocol.js +3 -201
- package/dist/negotiation/negotiation.question-safety.d.ts +3 -24
- package/dist/negotiation/negotiation.question-safety.js +3 -54
- package/dist/negotiation/negotiation.reflect.d.ts +4 -197
- package/dist/negotiation/negotiation.reflect.js +4 -151
- package/dist/negotiation/negotiation.screen.d.ts +6 -159
- package/dist/negotiation/negotiation.screen.js +6 -152
- package/dist/negotiation/negotiation.state.d.ts +3 -495
- package/dist/negotiation/negotiation.state.js +3 -284
- package/dist/negotiation/negotiation.summarizer.d.ts +3 -24
- package/dist/negotiation/negotiation.summarizer.js +3 -100
- package/dist/negotiation/negotiation.task-lock-policy.d.ts +5 -0
- package/dist/negotiation/negotiation.task-lock-policy.js +5 -0
- package/dist/negotiation/negotiation.tools.d.ts +3 -15
- package/dist/negotiation/negotiation.tools.js +3 -946
- package/dist/negotiation/ports/index.d.ts +18 -0
- package/dist/negotiation/ports/index.js +18 -0
- package/dist/negotiation/ports/negotiation.tools.port.d.ts +18 -0
- package/dist/negotiation/ports/negotiation.tools.port.js +1 -0
- package/dist/negotiation/public/index.d.ts +58 -0
- package/dist/negotiation/public/index.js +60 -0
- package/dist/network/indexer/indexer.graph.d.ts +3 -413
- package/dist/network/indexer/indexer.graph.js +3 -375
- package/dist/network/indexer/indexer.state.d.ts +3 -149
- package/dist/network/indexer/indexer.state.js +3 -98
- package/dist/network/membership/membership.graph.d.ts +3 -248
- package/dist/network/membership/membership.graph.js +3 -202
- package/dist/network/membership/membership.state.d.ts +3 -75
- package/dist/network/membership/membership.state.js +3 -41
- package/dist/network/network.graph.d.ts +3 -629
- package/dist/network/network.graph.js +3 -267
- package/dist/network/network.recommender.d.ts +3 -40
- package/dist/network/network.recommender.js +3 -109
- package/dist/network/network.state.d.ts +3 -180
- package/dist/network/network.state.js +3 -54
- package/dist/network/network.tools.d.ts +5 -3
- package/dist/network/network.tools.js +5 -566
- package/dist/opportunity/application/delivery-card.cache.d.ts +25 -0
- package/dist/opportunity/application/delivery-card.cache.js +43 -0
- package/dist/opportunity/application/index.d.ts +63 -0
- package/dist/opportunity/application/index.js +68 -0
- package/dist/opportunity/application/negotiation-context.loader.d.ts +59 -0
- package/dist/opportunity/application/negotiation-context.loader.js +88 -0
- package/dist/opportunity/application/opportunity.card-presentation.d.ts +44 -0
- package/dist/opportunity/application/opportunity.card-presentation.js +104 -0
- package/dist/opportunity/application/opportunity.discover.d.ts +215 -0
- package/dist/opportunity/application/opportunity.discover.js +793 -0
- package/dist/opportunity/application/opportunity.discovery-continuation-finalization.d.ts +34 -0
- package/dist/opportunity/application/opportunity.discovery-continuation-finalization.js +74 -0
- package/dist/opportunity/application/opportunity.discovery-mcp-lifecycle-finalization.d.ts +44 -0
- package/dist/opportunity/application/opportunity.discovery-mcp-lifecycle-finalization.js +92 -0
- package/dist/opportunity/application/opportunity.discovery-negotiation-summary.d.ts +14 -0
- package/dist/opportunity/application/opportunity.discovery-negotiation-summary.js +46 -0
- package/dist/opportunity/application/opportunity.enricher.d.ts +71 -0
- package/dist/opportunity/application/opportunity.enricher.js +280 -0
- package/dist/opportunity/application/opportunity.evaluator.d.ts +275 -0
- package/dist/opportunity/application/opportunity.evaluator.js +459 -0
- package/dist/opportunity/application/opportunity.existing-negotiation.d.ts +77 -0
- package/dist/opportunity/application/opportunity.existing-negotiation.js +109 -0
- package/dist/opportunity/application/opportunity.feed-selection.d.ts +30 -0
- package/dist/opportunity/application/opportunity.feed-selection.js +96 -0
- package/dist/opportunity/application/opportunity.graph.d.ts +1427 -0
- package/dist/opportunity/application/opportunity.graph.js +3693 -0
- package/dist/opportunity/application/opportunity.introducer.d.ts +77 -0
- package/dist/opportunity/application/opportunity.introducer.js +99 -0
- package/dist/opportunity/application/opportunity.lifecycle.d.ts +63 -0
- package/dist/opportunity/application/opportunity.lifecycle.js +181 -0
- package/dist/opportunity/application/opportunity.newborn-stamping.d.ts +41 -0
- package/dist/opportunity/application/opportunity.newborn-stamping.js +81 -0
- package/dist/opportunity/application/opportunity.pending-questions.d.ts +33 -0
- package/dist/opportunity/application/opportunity.pending-questions.js +42 -0
- package/dist/opportunity/application/opportunity.persist.d.ts +58 -0
- package/dist/opportunity/application/opportunity.persist.js +145 -0
- package/dist/opportunity/application/opportunity.persistence-admission.d.ts +39 -0
- package/dist/opportunity/application/opportunity.persistence-admission.js +59 -0
- package/dist/opportunity/application/opportunity.presenter.d.ts +156 -0
- package/dist/opportunity/application/opportunity.presenter.js +736 -0
- package/dist/opportunity/application/opportunity.tools.d.ts +131 -0
- package/dist/opportunity/application/opportunity.tools.js +1834 -0
- package/dist/opportunity/application/opportunity.update-admission.d.ts +24 -0
- package/dist/opportunity/application/opportunity.update-admission.js +38 -0
- package/dist/opportunity/delivery-card.cache.d.ts +5 -26
- package/dist/opportunity/delivery-card.cache.js +5 -44
- package/dist/opportunity/discovery-question.helper.d.ts +3 -17
- package/dist/opportunity/discovery-question.helper.js +3 -14
- package/dist/opportunity/discriminator/discriminator.adjustments.d.ts +0 -1
- package/dist/opportunity/discriminator/discriminator.adjustments.js +0 -1
- package/dist/opportunity/discriminator/discriminator.assigner.d.ts +4 -5
- package/dist/opportunity/discriminator/discriminator.assigner.js +0 -1
- package/dist/opportunity/discriminator/discriminator.env.d.ts +0 -1
- package/dist/opportunity/discriminator/discriminator.env.js +0 -1
- package/dist/opportunity/discriminator/discriminator.miner.d.ts +0 -1
- package/dist/opportunity/discriminator/discriminator.miner.js +0 -1
- package/dist/opportunity/discriminator/discriminator.push.d.ts +0 -1
- package/dist/opportunity/discriminator/discriminator.push.js +0 -1
- package/dist/opportunity/discriminator/discriminator.question.d.ts +0 -1
- package/dist/opportunity/discriminator/discriminator.question.js +0 -1
- package/dist/opportunity/discriminator/discriminator.scorer.d.ts +0 -1
- package/dist/opportunity/discriminator/discriminator.scorer.js +0 -1
- package/dist/opportunity/discriminator/discriminator.shadow.d.ts +0 -1
- package/dist/opportunity/discriminator/discriminator.shadow.js +0 -1
- package/dist/opportunity/discriminator/discriminator.types.d.ts +0 -1
- package/dist/opportunity/discriminator/discriminator.types.js +0 -1
- package/dist/opportunity/domain/discovery-question.helper.d.ts +18 -0
- package/dist/opportunity/domain/discovery-question.helper.js +15 -0
- package/dist/opportunity/domain/index.d.ts +55 -0
- package/dist/opportunity/domain/index.js +52 -0
- package/dist/opportunity/domain/negotiation-summary.builder.d.ts +37 -0
- package/dist/opportunity/domain/negotiation-summary.builder.js +66 -0
- package/dist/opportunity/domain/opportunity.actor.d.ts +15 -0
- package/dist/opportunity/domain/opportunity.actor.js +39 -0
- package/dist/opportunity/domain/opportunity.claim-safety.d.ts +24 -0
- package/dist/opportunity/domain/opportunity.claim-safety.js +88 -0
- package/dist/opportunity/domain/opportunity.discovery-run-coalescing.d.ts +33 -0
- package/dist/opportunity/domain/opportunity.discovery-run-coalescing.js +33 -0
- package/dist/opportunity/domain/opportunity.discovery.contracts.d.ts +45 -0
- package/dist/opportunity/domain/opportunity.discovery.contracts.js +1 -0
- package/dist/opportunity/domain/opportunity.evidence.d.ts +21 -0
- package/dist/opportunity/domain/opportunity.evidence.js +78 -0
- package/dist/opportunity/domain/opportunity.labels.d.ts +8 -0
- package/dist/opportunity/domain/opportunity.labels.js +10 -0
- package/dist/opportunity/domain/opportunity.presentation-cache.d.ts +6 -0
- package/dist/opportunity/domain/opportunity.presentation-cache.js +14 -0
- package/dist/opportunity/domain/opportunity.presentation.d.ts +76 -0
- package/dist/opportunity/domain/opportunity.presentation.js +516 -0
- package/dist/opportunity/domain/opportunity.safe-presentation.d.ts +104 -0
- package/dist/opportunity/domain/opportunity.safe-presentation.js +102 -0
- package/dist/opportunity/domain/opportunity.state.d.ts +519 -0
- package/dist/opportunity/domain/opportunity.state.js +309 -0
- package/dist/opportunity/domain/opportunity.utils.d.ts +217 -0
- package/dist/opportunity/domain/opportunity.utils.js +395 -0
- package/dist/opportunity/feed/feed.categorizer.d.ts +0 -1
- package/dist/opportunity/feed/feed.categorizer.js +0 -1
- package/dist/opportunity/feed/feed.graph.d.ts +1 -2
- package/dist/opportunity/feed/feed.graph.js +0 -1
- package/dist/opportunity/feed/feed.health.d.ts +0 -1
- package/dist/opportunity/feed/feed.health.js +0 -1
- package/dist/opportunity/feed/feed.state.d.ts +1 -2
- package/dist/opportunity/feed/feed.state.js +0 -1
- package/dist/opportunity/index.d.ts +37 -0
- package/dist/opportunity/index.js +37 -0
- package/dist/opportunity/negotiation-context.loader.d.ts +3 -58
- package/dist/opportunity/negotiation-context.loader.js +3 -87
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.env.d.ts +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.env.js +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.extractor.d.ts +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.extractor.js +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.miner.d.ts +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.miner.js +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.shadow.d.ts +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.shadow.js +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.types.d.ts +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.types.js +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.verifier.d.ts +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.verifier.js +0 -1
- package/dist/opportunity/negotiation-summary.builder.d.ts +3 -36
- package/dist/opportunity/negotiation-summary.builder.js +3 -65
- package/dist/opportunity/opportunity.actor.d.ts +3 -14
- package/dist/opportunity/opportunity.actor.js +3 -38
- package/dist/opportunity/opportunity.card-presentation.d.ts +5 -0
- package/dist/opportunity/opportunity.card-presentation.js +5 -0
- package/dist/opportunity/opportunity.claim-safety.d.ts +3 -23
- package/dist/opportunity/opportunity.claim-safety.js +3 -87
- package/dist/opportunity/opportunity.discover.d.ts +3 -218
- package/dist/opportunity/opportunity.discover.js +3 -917
- package/dist/opportunity/opportunity.discovery-continuation-finalization.d.ts +5 -0
- package/dist/opportunity/opportunity.discovery-continuation-finalization.js +5 -0
- package/dist/opportunity/opportunity.discovery-mcp-lifecycle-finalization.d.ts +5 -0
- package/dist/opportunity/opportunity.discovery-mcp-lifecycle-finalization.js +5 -0
- package/dist/opportunity/opportunity.discovery-negotiation-summary.d.ts +5 -0
- package/dist/opportunity/opportunity.discovery-negotiation-summary.js +5 -0
- package/dist/opportunity/opportunity.discovery-run-coalescing.d.ts +5 -0
- package/dist/opportunity/opportunity.discovery-run-coalescing.js +5 -0
- package/dist/opportunity/opportunity.discovery.contracts.d.ts +5 -0
- package/dist/opportunity/opportunity.discovery.contracts.js +5 -0
- package/dist/opportunity/opportunity.enricher.d.ts +3 -70
- package/dist/opportunity/opportunity.enricher.js +3 -279
- package/dist/opportunity/opportunity.evaluator.d.ts +5 -276
- package/dist/opportunity/opportunity.evaluator.js +5 -460
- package/dist/opportunity/opportunity.evidence.d.ts +5 -22
- package/dist/opportunity/opportunity.evidence.js +5 -79
- package/dist/opportunity/opportunity.existing-negotiation.d.ts +5 -0
- package/dist/opportunity/opportunity.existing-negotiation.js +5 -0
- package/dist/opportunity/opportunity.feed-selection.d.ts +5 -0
- package/dist/opportunity/opportunity.feed-selection.js +5 -0
- package/dist/opportunity/opportunity.graph.d.ts +3 -1489
- package/dist/opportunity/opportunity.graph.js +3 -4071
- package/dist/opportunity/opportunity.introducer.d.ts +3 -76
- package/dist/opportunity/opportunity.introducer.js +3 -98
- package/dist/opportunity/opportunity.labels.d.ts +5 -9
- package/dist/opportunity/opportunity.labels.js +5 -11
- package/dist/opportunity/opportunity.lifecycle.d.ts +5 -0
- package/dist/opportunity/opportunity.lifecycle.js +5 -0
- package/dist/opportunity/opportunity.newborn-stamping.d.ts +5 -0
- package/dist/opportunity/opportunity.newborn-stamping.js +5 -0
- package/dist/opportunity/opportunity.pending-questions.d.ts +3 -32
- package/dist/opportunity/opportunity.pending-questions.js +3 -41
- package/dist/opportunity/opportunity.persist.d.ts +3 -57
- package/dist/opportunity/opportunity.persist.js +3 -144
- package/dist/opportunity/opportunity.persistence-admission.d.ts +5 -0
- package/dist/opportunity/opportunity.persistence-admission.js +5 -0
- package/dist/opportunity/opportunity.presentation-cache.d.ts +5 -7
- package/dist/opportunity/opportunity.presentation-cache.js +5 -15
- package/dist/opportunity/opportunity.presentation.d.ts +3 -75
- package/dist/opportunity/opportunity.presentation.js +3 -515
- package/dist/opportunity/opportunity.presenter.d.ts +10 -155
- package/dist/opportunity/opportunity.presenter.js +10 -735
- package/dist/opportunity/opportunity.safe-presentation.d.ts +3 -103
- package/dist/opportunity/opportunity.safe-presentation.js +3 -101
- package/dist/opportunity/opportunity.state.d.ts +3 -518
- package/dist/opportunity/opportunity.state.js +3 -308
- package/dist/opportunity/opportunity.tools.d.ts +3 -157
- package/dist/opportunity/opportunity.tools.js +3 -2238
- package/dist/opportunity/opportunity.update-admission.d.ts +5 -0
- package/dist/opportunity/opportunity.update-admission.js +5 -0
- package/dist/opportunity/opportunity.utils.d.ts +3 -216
- package/dist/opportunity/opportunity.utils.js +3 -394
- package/dist/opportunity/outcome/outcome.env.d.ts +0 -1
- package/dist/opportunity/outcome/outcome.env.js +0 -1
- package/dist/opportunity/outcome/outcome.hypotheses.d.ts +0 -1
- package/dist/opportunity/outcome/outcome.hypotheses.js +0 -1
- package/dist/opportunity/outcome/outcome.shadow.d.ts +0 -1
- package/dist/opportunity/outcome/outcome.shadow.js +0 -1
- package/dist/opportunity/outcome/outcome.types.d.ts +0 -1
- package/dist/opportunity/outcome/outcome.types.js +0 -1
- package/dist/opportunity/ports/index.d.ts +5 -0
- package/dist/opportunity/ports/index.js +1 -0
- package/dist/opportunity/ports/opportunity.tools.port.d.ts +5 -0
- package/dist/opportunity/ports/opportunity.tools.port.js +1 -0
- package/dist/opportunity/public/index.d.ts +58 -0
- package/dist/opportunity/public/index.js +51 -0
- package/dist/participant-agents/application/agent.tools.d.ts +16 -0
- package/dist/participant-agents/application/agent.tools.js +313 -0
- package/dist/participant-agents/application/index.d.ts +21 -0
- package/dist/participant-agents/application/index.js +22 -0
- package/dist/participant-agents/domain/agent.types.d.ts +76 -0
- package/dist/participant-agents/domain/agent.types.js +22 -0
- package/dist/participant-agents/domain/index.d.ts +20 -0
- package/dist/participant-agents/domain/index.js +1 -0
- package/dist/participant-agents/index.d.ts +24 -0
- package/dist/participant-agents/index.js +24 -0
- package/dist/participant-agents/ports/agent.dispatcher.port.d.ts +25 -0
- package/dist/participant-agents/ports/agent.dispatcher.port.js +1 -0
- package/dist/participant-agents/ports/agent.repository.port.d.ts +118 -0
- package/dist/participant-agents/ports/agent.repository.port.js +10 -0
- package/dist/participant-agents/ports/agent.tools.port.d.ts +24 -0
- package/dist/participant-agents/ports/agent.tools.port.js +20 -0
- package/dist/participant-agents/ports/index.d.ts +29 -0
- package/dist/participant-agents/ports/index.js +27 -0
- package/dist/participant-agents/public/index.d.ts +39 -0
- package/dist/participant-agents/public/index.js +36 -0
- package/dist/participant-context/application/index.d.ts +73 -0
- package/dist/participant-context/application/index.js +83 -0
- package/dist/participant-context/domain/index.d.ts +67 -0
- package/dist/participant-context/domain/index.js +68 -0
- package/dist/participant-context/index.d.ts +16 -0
- package/dist/participant-context/index.js +16 -0
- package/dist/participant-context/ports/index.d.ts +37 -0
- package/dist/participant-context/ports/index.js +34 -0
- package/dist/participant-context/public/index.d.ts +48 -0
- package/dist/participant-context/public/index.js +55 -0
- package/dist/platform/index.d.ts +19 -0
- package/dist/platform/index.js +23 -0
- package/dist/premise/premise.analyzer.d.ts +0 -1
- package/dist/premise/premise.analyzer.js +0 -2
- package/dist/premise/premise.decomposer.d.ts +0 -1
- package/dist/premise/premise.decomposer.js +0 -2
- package/dist/premise/premise.graph.d.ts +1 -2
- package/dist/premise/premise.graph.js +0 -2
- package/dist/premise/premise.indexer.d.ts +0 -1
- package/dist/premise/premise.indexer.js +0 -2
- package/dist/premise/premise.state.d.ts +1 -2
- package/dist/premise/premise.state.js +0 -1
- package/dist/premise/premise.tools.d.ts +3 -3
- package/dist/premise/premise.tools.js +0 -2
- package/dist/public/index.d.ts +17 -0
- package/dist/public/index.js +17 -0
- package/dist/questioner/questioner.agent.d.ts +4 -27
- package/dist/questioner/questioner.agent.js +3 -133
- package/dist/questioner/questioner.ask.tool.d.ts +3 -12
- package/dist/questioner/questioner.ask.tool.js +3 -299
- package/dist/questioner/questioner.discovery.prompt.d.ts +3 -7
- package/dist/questioner/questioner.discovery.prompt.js +3 -180
- package/dist/questioner/questioner.env.d.ts +3 -57
- package/dist/questioner/questioner.env.js +3 -93
- package/dist/questioner/questioner.presets.d.ts +4 -19
- package/dist/questioner/questioner.presets.js +3 -465
- package/dist/questioner/questioner.qud.d.ts +3 -6
- package/dist/questioner/questioner.qud.js +3 -10
- package/dist/questioner/questioner.tools.d.ts +3 -15
- package/dist/questioner/questioner.tools.js +3 -186
- package/dist/questioner/questioner.types.d.ts +4 -218
- package/dist/questioner/questioner.types.js +5 -62
- package/dist/questions/application/index.d.ts +39 -0
- package/dist/questions/application/index.js +41 -0
- package/dist/questions/application/question.agent.d.ts +28 -0
- package/dist/questions/application/question.agent.js +139 -0
- package/dist/questions/application/question.ask.tool.d.ts +12 -0
- package/dist/questions/application/question.ask.tool.js +300 -0
- package/dist/questions/application/question.discovery.prompt.d.ts +8 -0
- package/dist/questions/application/question.discovery.prompt.js +181 -0
- package/dist/questions/application/question.env.d.ts +61 -0
- package/dist/questions/application/question.env.js +97 -0
- package/dist/questions/application/question.input.d.ts +237 -0
- package/dist/questions/application/question.input.js +61 -0
- package/dist/questions/application/question.presets.d.ts +24 -0
- package/dist/questions/application/question.presets.js +445 -0
- package/dist/questions/application/question.qud.d.ts +12 -0
- package/dist/questions/application/question.qud.js +16 -0
- package/dist/questions/application/question.tools.d.ts +15 -0
- package/dist/questions/application/question.tools.js +190 -0
- package/dist/questions/domain/index.d.ts +25 -0
- package/dist/questions/domain/index.js +25 -0
- package/dist/questions/domain/question.schema.d.ts +1537 -0
- package/dist/questions/domain/question.schema.js +422 -0
- package/dist/questions/index.d.ts +22 -0
- package/dist/questions/index.js +22 -0
- package/dist/questions/ports/index.d.ts +29 -0
- package/dist/questions/ports/index.js +27 -0
- package/dist/questions/ports/question.generator.port.d.ts +34 -0
- package/dist/questions/ports/question.generator.port.js +1 -0
- package/dist/questions/ports/question.persistence.port.d.ts +87 -0
- package/dist/questions/ports/question.persistence.port.js +1 -0
- package/dist/questions/ports/question.tools.port.d.ts +15 -0
- package/dist/questions/ports/question.tools.port.js +1 -0
- package/dist/questions/public/index.d.ts +47 -0
- package/dist/questions/public/index.js +49 -0
- package/dist/runtime/background/index.d.ts +14 -0
- package/dist/runtime/background/index.js +14 -0
- package/dist/runtime/foreground/composition/tool.factory.d.ts +16 -0
- package/dist/runtime/foreground/composition/tool.factory.js +224 -0
- package/dist/runtime/foreground/composition/tool.registry.d.ts +11 -0
- package/dist/runtime/foreground/composition/tool.registry.js +106 -0
- package/dist/runtime/foreground/index.d.ts +13 -0
- package/dist/runtime/foreground/index.js +13 -0
- package/dist/runtime/foreground/signals/intent.tools.d.ts +13 -0
- package/dist/runtime/foreground/signals/intent.tools.js +13 -0
- package/dist/shared/agent/model-signal.d.ts +0 -1
- package/dist/shared/agent/model-signal.js +0 -1
- package/dist/shared/agent/model.config.d.ts +0 -1
- package/dist/shared/agent/model.config.js +0 -1
- package/dist/shared/agent/tool.factory.d.ts +4 -15
- package/dist/shared/agent/tool.factory.js +4 -226
- package/dist/shared/agent/tool.helpers.d.ts +51 -12
- package/dist/shared/agent/tool.helpers.js +0 -1
- package/dist/shared/agent/tool.registry.d.ts +9 -9
- package/dist/shared/agent/tool.registry.js +9 -104
- package/dist/shared/agent/tool.runtime.d.ts +0 -1
- package/dist/shared/agent/tool.runtime.js +0 -1
- package/dist/shared/agent/tool.scope.d.ts +0 -1
- package/dist/shared/agent/tool.scope.js +0 -1
- package/dist/shared/agent/utility.tools.d.ts +5 -3
- package/dist/shared/agent/utility.tools.js +0 -1
- package/dist/shared/assignment/network-assignment.policy.d.ts +0 -1
- package/dist/shared/assignment/network-assignment.policy.js +0 -1
- package/dist/shared/hyde/hyde.documents.d.ts +0 -1
- package/dist/shared/hyde/hyde.documents.js +0 -1
- package/dist/shared/hyde/hyde.env.d.ts +0 -1
- package/dist/shared/hyde/hyde.env.js +0 -1
- package/dist/shared/hyde/hyde.frame.d.ts +4 -5
- package/dist/shared/hyde/hyde.frame.js +0 -1
- package/dist/shared/hyde/hyde.generator.d.ts +0 -1
- package/dist/shared/hyde/hyde.generator.js +0 -1
- package/dist/shared/hyde/hyde.graph.d.ts +0 -1
- package/dist/shared/hyde/hyde.graph.js +0 -1
- package/dist/shared/hyde/hyde.state.d.ts +0 -1
- package/dist/shared/hyde/hyde.state.js +0 -1
- package/dist/shared/hyde/hyde.strategies.d.ts +0 -1
- package/dist/shared/hyde/hyde.strategies.js +0 -1
- package/dist/shared/hyde/hyde.validator.d.ts +0 -1
- package/dist/shared/hyde/hyde.validator.js +0 -1
- package/dist/shared/hyde/lens.inferrer.d.ts +6 -7
- package/dist/shared/hyde/lens.inferrer.js +0 -1
- package/dist/shared/interfaces/agent-dispatcher.interface.d.ts +4 -1
- package/dist/shared/interfaces/agent-dispatcher.interface.js +4 -1
- package/dist/shared/interfaces/agent.interface.d.ts +13 -173
- package/dist/shared/interfaces/agent.interface.js +12 -12
- package/dist/shared/interfaces/auth.interface.d.ts +0 -1
- package/dist/shared/interfaces/auth.interface.js +0 -1
- package/dist/shared/interfaces/cache.interface.d.ts +0 -1
- package/dist/shared/interfaces/cache.interface.js +0 -1
- package/dist/shared/interfaces/chat-message-writer.interface.d.ts +0 -1
- package/dist/shared/interfaces/chat-message-writer.interface.js +0 -1
- package/dist/shared/interfaces/chat-session.interface.d.ts +0 -1
- package/dist/shared/interfaces/chat-session.interface.js +0 -1
- package/dist/shared/interfaces/chat-summary.interface.d.ts +0 -1
- package/dist/shared/interfaces/chat-summary.interface.js +0 -1
- package/dist/shared/interfaces/connect-link.interface.d.ts +0 -1
- package/dist/shared/interfaces/connect-link.interface.js +0 -1
- package/dist/shared/interfaces/contact.interface.d.ts +7 -55
- package/dist/shared/interfaces/contact.interface.js +7 -1
- package/dist/shared/interfaces/database.interface.d.ts +0 -1
- package/dist/shared/interfaces/database.interface.js +0 -1
- package/dist/shared/interfaces/delivery-ledger.interface.d.ts +0 -1
- package/dist/shared/interfaces/delivery-ledger.interface.js +0 -1
- package/dist/shared/interfaces/discovery-run.interface.d.ts +2 -3
- package/dist/shared/interfaces/discovery-run.interface.js +0 -1
- package/dist/shared/interfaces/embedder.interface.d.ts +0 -1
- package/dist/shared/interfaces/embedder.interface.js +0 -1
- package/dist/shared/interfaces/enrichment-run.interface.d.ts +2 -3
- package/dist/shared/interfaces/enrichment-run.interface.js +0 -1
- package/dist/shared/interfaces/enrichment.interface.d.ts +0 -1
- package/dist/shared/interfaces/enrichment.interface.js +0 -1
- package/dist/shared/interfaces/integration.interface.d.ts +6 -88
- package/dist/shared/interfaces/integration.interface.js +7 -1
- package/dist/shared/interfaces/negotiation-events.interface.d.ts +0 -1
- package/dist/shared/interfaces/negotiation-events.interface.js +0 -1
- package/dist/shared/interfaces/negotiation-summary.interface.d.ts +0 -1
- package/dist/shared/interfaces/negotiation-summary.interface.js +0 -1
- package/dist/shared/interfaces/negotiator-memory.interface.d.ts +0 -1
- package/dist/shared/interfaces/negotiator-memory.interface.js +0 -1
- package/dist/shared/interfaces/question-generator.interface.d.ts +3 -28
- package/dist/shared/interfaces/question-generator.interface.js +0 -1
- package/dist/shared/interfaces/questioner.interface.d.ts +3 -77
- package/dist/shared/interfaces/questioner.interface.js +0 -1
- package/dist/shared/interfaces/queue.interface.d.ts +0 -1
- package/dist/shared/interfaces/queue.interface.js +0 -1
- package/dist/shared/interfaces/scraper.interface.d.ts +0 -1
- package/dist/shared/interfaces/scraper.interface.js +0 -1
- package/dist/shared/interfaces/tool-request-context.interface.d.ts +12 -0
- package/dist/shared/interfaces/tool-request-context.interface.js +1 -0
- package/dist/shared/network/metadata.renderer.d.ts +0 -1
- package/dist/shared/network/metadata.renderer.js +0 -1
- package/dist/shared/observability/debug-meta.sanitizer.d.ts +0 -1
- package/dist/shared/observability/debug-meta.sanitizer.js +0 -1
- package/dist/shared/observability/log.d.ts +0 -1
- package/dist/shared/observability/log.js +0 -1
- package/dist/shared/observability/performance.d.ts +0 -1
- package/dist/shared/observability/performance.js +0 -1
- package/dist/shared/observability/protocol.logger.d.ts +0 -1
- package/dist/shared/observability/protocol.logger.js +0 -1
- package/dist/shared/observability/request-context.d.ts +0 -1
- package/dist/shared/observability/request-context.js +0 -1
- package/dist/shared/observability/trace.d.ts +0 -1
- package/dist/shared/observability/trace.js +0 -1
- package/dist/shared/schemas/chat-context.schema.d.ts +0 -1
- package/dist/shared/schemas/chat-context.schema.js +0 -1
- package/dist/shared/schemas/discovery-question.schema.d.ts +17 -18
- package/dist/shared/schemas/discovery-question.schema.js +0 -1
- package/dist/shared/schemas/identity.schema.d.ts +0 -1
- package/dist/shared/schemas/identity.schema.js +0 -1
- package/dist/shared/schemas/mcp-auth.schema.d.ts +0 -1
- package/dist/shared/schemas/mcp-auth.schema.js +0 -1
- package/dist/shared/schemas/negotiation-digest.schema.d.ts +5 -6
- package/dist/shared/schemas/negotiation-digest.schema.js +0 -1
- package/dist/shared/schemas/negotiation-state.schema.d.ts +4 -5
- package/dist/shared/schemas/negotiation-state.schema.js +0 -1
- package/dist/shared/schemas/network-assignment.schema.d.ts +0 -1
- package/dist/shared/schemas/network-assignment.schema.js +0 -1
- package/dist/shared/schemas/pending-question.schema.d.ts +0 -1
- package/dist/shared/schemas/pending-question.schema.js +0 -1
- package/dist/shared/schemas/question.schema.d.ts +3 -1505
- package/dist/shared/schemas/question.schema.js +3 -410
- package/dist/shared/ui/lucide.icon-catalog.d.ts +0 -1
- package/dist/shared/ui/lucide.icon-catalog.js +0 -1
- package/dist/shared/utils/social-label.d.ts +0 -1
- package/dist/shared/utils/social-label.js +0 -1
- package/dist/shared/utils/telegram-handle.d.ts +0 -1
- package/dist/shared/utils/telegram-handle.js +0 -1
- package/dist/signals/application/index.d.ts +19 -0
- package/dist/signals/application/index.js +22 -0
- package/dist/signals/application/intent.clarifier.d.ts +51 -0
- package/dist/signals/application/intent.clarifier.js +201 -0
- package/dist/signals/application/intent.graph.d.ts +552 -0
- package/dist/signals/application/intent.graph.js +938 -0
- package/dist/signals/application/intent.indexer.d.ts +82 -0
- package/dist/signals/application/intent.indexer.js +170 -0
- package/dist/signals/application/intent.inferrer.d.ts +94 -0
- package/dist/signals/application/intent.inferrer.js +233 -0
- package/dist/signals/application/intent.reconciler.d.ts +105 -0
- package/dist/signals/application/intent.reconciler.js +186 -0
- package/dist/signals/application/intent.tools.d.ts +24 -0
- package/dist/signals/application/intent.tools.js +789 -0
- package/dist/signals/application/intent.verifier.d.ts +115 -0
- package/dist/signals/application/intent.verifier.js +262 -0
- package/dist/signals/domain/index.d.ts +9 -0
- package/dist/signals/domain/index.js +11 -0
- package/dist/signals/domain/intent.state.d.ts +230 -0
- package/dist/signals/domain/intent.state.js +190 -0
- package/dist/signals/domain/signal.specificity.d.ts +2 -0
- package/dist/signals/domain/signal.specificity.js +2 -0
- package/dist/signals/index.d.ts +13 -0
- package/dist/signals/index.js +13 -0
- package/dist/signals/ports/index.d.ts +15 -0
- package/dist/signals/ports/index.js +13 -0
- package/dist/signals/public/index.d.ts +15 -0
- package/dist/signals/public/index.js +16 -0
- package/package.json +14 -3
- package/dist/agent/agent.tools.d.ts.map +0 -1
- package/dist/agent/agent.tools.js.map +0 -1
- package/dist/agent/tests/fakes.d.ts +0 -25
- package/dist/agent/tests/fakes.d.ts.map +0 -1
- package/dist/agent/tests/fakes.js +0 -178
- package/dist/agent/tests/fakes.js.map +0 -1
- package/dist/chat/chat-streaming.types.d.ts.map +0 -1
- package/dist/chat/chat-streaming.types.js.map +0 -1
- package/dist/chat/chat.agent.d.ts.map +0 -1
- package/dist/chat/chat.agent.js.map +0 -1
- package/dist/chat/chat.graph.d.ts.map +0 -1
- package/dist/chat/chat.graph.js.map +0 -1
- package/dist/chat/chat.interrupt.classifier.d.ts.map +0 -1
- package/dist/chat/chat.interrupt.classifier.js.map +0 -1
- package/dist/chat/chat.persona.d.ts.map +0 -1
- package/dist/chat/chat.persona.js.map +0 -1
- package/dist/chat/chat.prompt.d.ts.map +0 -1
- package/dist/chat/chat.prompt.js.map +0 -1
- package/dist/chat/chat.prompt.modules.d.ts.map +0 -1
- package/dist/chat/chat.prompt.modules.js.map +0 -1
- package/dist/chat/chat.question-dedup.d.ts.map +0 -1
- package/dist/chat/chat.question-dedup.js.map +0 -1
- package/dist/chat/chat.state.d.ts.map +0 -1
- package/dist/chat/chat.state.js.map +0 -1
- package/dist/chat/chat.streamer.d.ts.map +0 -1
- package/dist/chat/chat.streamer.js.map +0 -1
- package/dist/chat/chat.suggester.d.ts.map +0 -1
- package/dist/chat/chat.suggester.js.map +0 -1
- package/dist/chat/chat.summarizer.d.ts.map +0 -1
- package/dist/chat/chat.summarizer.js.map +0 -1
- package/dist/chat/chat.title.generator.d.ts.map +0 -1
- package/dist/chat/chat.title.generator.js.map +0 -1
- package/dist/chat/chat.tools.d.ts.map +0 -1
- package/dist/chat/chat.tools.js.map +0 -1
- package/dist/chat/chat.utils.d.ts.map +0 -1
- package/dist/chat/chat.utils.js.map +0 -1
- package/dist/chat/negotiator.persona.d.ts.map +0 -1
- package/dist/chat/negotiator.persona.js.map +0 -1
- package/dist/chat/negotiator.prompt.d.ts.map +0 -1
- package/dist/chat/negotiator.prompt.js.map +0 -1
- package/dist/chat/negotiator.tools.d.ts.map +0 -1
- package/dist/chat/negotiator.tools.js.map +0 -1
- package/dist/chat/onboarding.persona.d.ts.map +0 -1
- package/dist/chat/onboarding.persona.js.map +0 -1
- package/dist/chat/onboarding.prompt.d.ts.map +0 -1
- package/dist/chat/onboarding.prompt.js.map +0 -1
- package/dist/chat/reporter.action.tools.d.ts.map +0 -1
- package/dist/chat/reporter.action.tools.js.map +0 -1
- package/dist/chat/reporter.persona.d.ts.map +0 -1
- package/dist/chat/reporter.persona.js.map +0 -1
- package/dist/chat/reporter.prompt.d.ts.map +0 -1
- package/dist/chat/reporter.prompt.js.map +0 -1
- package/dist/chat/signal.persona.d.ts.map +0 -1
- package/dist/chat/signal.persona.js.map +0 -1
- package/dist/chat/signal.prompt.d.ts.map +0 -1
- package/dist/chat/signal.prompt.js.map +0 -1
- package/dist/chat/tests/chat.graph.mocks.d.ts +0 -98
- package/dist/chat/tests/chat.graph.mocks.d.ts.map +0 -1
- package/dist/chat/tests/chat.graph.mocks.js +0 -225
- package/dist/chat/tests/chat.graph.mocks.js.map +0 -1
- package/dist/contact/contact.inviter.d.ts.map +0 -1
- package/dist/contact/contact.inviter.js.map +0 -1
- package/dist/contact/contact.tools.d.ts.map +0 -1
- package/dist/contact/contact.tools.js.map +0 -1
- package/dist/context/context.generator.d.ts.map +0 -1
- package/dist/context/context.generator.js.map +0 -1
- package/dist/enrichment/enrichment.enricher.d.ts.map +0 -1
- package/dist/enrichment/enrichment.enricher.js.map +0 -1
- package/dist/enrichment/enrichment.generator.d.ts.map +0 -1
- package/dist/enrichment/enrichment.generator.js.map +0 -1
- package/dist/enrichment/enrichment.graph.d.ts.map +0 -1
- package/dist/enrichment/enrichment.graph.js.map +0 -1
- package/dist/enrichment/enrichment.state.d.ts.map +0 -1
- package/dist/enrichment/enrichment.state.js.map +0 -1
- package/dist/enrichment/enrichment.tools.d.ts.map +0 -1
- package/dist/enrichment/enrichment.tools.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/integration/integration.tools.d.ts.map +0 -1
- package/dist/integration/integration.tools.js.map +0 -1
- package/dist/intent/intent.clarifier.d.ts.map +0 -1
- package/dist/intent/intent.clarifier.js.map +0 -1
- package/dist/intent/intent.graph.d.ts.map +0 -1
- package/dist/intent/intent.graph.js.map +0 -1
- package/dist/intent/intent.indexer.d.ts.map +0 -1
- package/dist/intent/intent.indexer.js.map +0 -1
- package/dist/intent/intent.inferrer.d.ts.map +0 -1
- package/dist/intent/intent.inferrer.js.map +0 -1
- package/dist/intent/intent.reconciler.d.ts.map +0 -1
- package/dist/intent/intent.reconciler.js.map +0 -1
- package/dist/intent/intent.specificity.d.ts.map +0 -1
- package/dist/intent/intent.specificity.js.map +0 -1
- package/dist/intent/intent.state.d.ts.map +0 -1
- package/dist/intent/intent.state.js.map +0 -1
- package/dist/intent/intent.tools.d.ts.map +0 -1
- package/dist/intent/intent.tools.js.map +0 -1
- package/dist/intent/intent.verifier.d.ts.map +0 -1
- package/dist/intent/intent.verifier.js.map +0 -1
- package/dist/maintenance/maintenance.graph.d.ts.map +0 -1
- package/dist/maintenance/maintenance.graph.js.map +0 -1
- package/dist/maintenance/maintenance.state.d.ts.map +0 -1
- package/dist/maintenance/maintenance.state.js.map +0 -1
- package/dist/mcp/elicitation.builder.d.ts.map +0 -1
- package/dist/mcp/elicitation.builder.js.map +0 -1
- package/dist/mcp/elicitation.dispatcher.d.ts.map +0 -1
- package/dist/mcp/elicitation.dispatcher.js.map +0 -1
- package/dist/mcp/mcp.server.d.ts.map +0 -1
- package/dist/mcp/mcp.server.js.map +0 -1
- package/dist/negotiation/insight.generator.d.ts.map +0 -1
- package/dist/negotiation/insight.generator.js.map +0 -1
- package/dist/negotiation/negotiation.agent.d.ts.map +0 -1
- package/dist/negotiation/negotiation.agent.js.map +0 -1
- package/dist/negotiation/negotiation.attribution.d.ts.map +0 -1
- package/dist/negotiation/negotiation.attribution.js.map +0 -1
- package/dist/negotiation/negotiation.consultation-policy.d.ts.map +0 -1
- package/dist/negotiation/negotiation.consultation-policy.js.map +0 -1
- package/dist/negotiation/negotiation.deadlock.d.ts.map +0 -1
- package/dist/negotiation/negotiation.deadlock.js.map +0 -1
- package/dist/negotiation/negotiation.graph.d.ts.map +0 -1
- package/dist/negotiation/negotiation.graph.js.map +0 -1
- package/dist/negotiation/negotiation.memory.d.ts.map +0 -1
- package/dist/negotiation/negotiation.memory.js.map +0 -1
- package/dist/negotiation/negotiation.protocol.d.ts.map +0 -1
- package/dist/negotiation/negotiation.protocol.js.map +0 -1
- package/dist/negotiation/negotiation.question-safety.d.ts.map +0 -1
- package/dist/negotiation/negotiation.question-safety.js.map +0 -1
- package/dist/negotiation/negotiation.reflect.d.ts.map +0 -1
- package/dist/negotiation/negotiation.reflect.js.map +0 -1
- package/dist/negotiation/negotiation.screen.d.ts.map +0 -1
- package/dist/negotiation/negotiation.screen.js.map +0 -1
- package/dist/negotiation/negotiation.state.d.ts.map +0 -1
- package/dist/negotiation/negotiation.state.js.map +0 -1
- package/dist/negotiation/negotiation.summarizer.d.ts.map +0 -1
- package/dist/negotiation/negotiation.summarizer.js.map +0 -1
- package/dist/negotiation/negotiation.tools.d.ts.map +0 -1
- package/dist/negotiation/negotiation.tools.js.map +0 -1
- package/dist/network/indexer/indexer.graph.d.ts.map +0 -1
- package/dist/network/indexer/indexer.graph.js.map +0 -1
- package/dist/network/indexer/indexer.state.d.ts.map +0 -1
- package/dist/network/indexer/indexer.state.js.map +0 -1
- package/dist/network/membership/membership.graph.d.ts.map +0 -1
- package/dist/network/membership/membership.graph.js.map +0 -1
- package/dist/network/membership/membership.state.d.ts.map +0 -1
- package/dist/network/membership/membership.state.js.map +0 -1
- package/dist/network/network.graph.d.ts.map +0 -1
- package/dist/network/network.graph.js.map +0 -1
- package/dist/network/network.recommender.d.ts.map +0 -1
- package/dist/network/network.recommender.js.map +0 -1
- package/dist/network/network.state.d.ts.map +0 -1
- package/dist/network/network.state.js.map +0 -1
- package/dist/network/network.tools.d.ts.map +0 -1
- package/dist/network/network.tools.js.map +0 -1
- package/dist/opportunity/delivery-card.cache.d.ts.map +0 -1
- package/dist/opportunity/delivery-card.cache.js.map +0 -1
- package/dist/opportunity/discovery-question.helper.d.ts.map +0 -1
- package/dist/opportunity/discovery-question.helper.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.adjustments.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.adjustments.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.assigner.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.assigner.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.env.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.env.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.miner.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.miner.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.push.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.push.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.question.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.question.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.scorer.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.scorer.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.shadow.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.shadow.js.map +0 -1
- package/dist/opportunity/discriminator/discriminator.types.d.ts.map +0 -1
- package/dist/opportunity/discriminator/discriminator.types.js.map +0 -1
- package/dist/opportunity/feed/feed.categorizer.d.ts.map +0 -1
- package/dist/opportunity/feed/feed.categorizer.js.map +0 -1
- package/dist/opportunity/feed/feed.graph.d.ts.map +0 -1
- package/dist/opportunity/feed/feed.graph.js.map +0 -1
- package/dist/opportunity/feed/feed.health.d.ts.map +0 -1
- package/dist/opportunity/feed/feed.health.js.map +0 -1
- package/dist/opportunity/feed/feed.state.d.ts.map +0 -1
- package/dist/opportunity/feed/feed.state.js.map +0 -1
- package/dist/opportunity/negotiation-context.loader.d.ts.map +0 -1
- package/dist/opportunity/negotiation-context.loader.js.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.env.d.ts.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.env.js.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.extractor.d.ts.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.extractor.js.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.miner.d.ts.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.miner.js.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.shadow.d.ts.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.shadow.js.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.types.d.ts.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.types.js.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.verifier.d.ts.map +0 -1
- package/dist/opportunity/negotiation-evidence/negotiation-evidence.verifier.js.map +0 -1
- package/dist/opportunity/negotiation-summary.builder.d.ts.map +0 -1
- package/dist/opportunity/negotiation-summary.builder.js.map +0 -1
- package/dist/opportunity/opportunity.actor.d.ts.map +0 -1
- package/dist/opportunity/opportunity.actor.js.map +0 -1
- package/dist/opportunity/opportunity.claim-safety.d.ts.map +0 -1
- package/dist/opportunity/opportunity.claim-safety.js.map +0 -1
- package/dist/opportunity/opportunity.discover.d.ts.map +0 -1
- package/dist/opportunity/opportunity.discover.js.map +0 -1
- package/dist/opportunity/opportunity.enricher.d.ts.map +0 -1
- package/dist/opportunity/opportunity.enricher.js.map +0 -1
- package/dist/opportunity/opportunity.evaluator.d.ts.map +0 -1
- package/dist/opportunity/opportunity.evaluator.js.map +0 -1
- package/dist/opportunity/opportunity.evidence.d.ts.map +0 -1
- package/dist/opportunity/opportunity.evidence.js.map +0 -1
- package/dist/opportunity/opportunity.graph.d.ts.map +0 -1
- package/dist/opportunity/opportunity.graph.js.map +0 -1
- package/dist/opportunity/opportunity.introducer.d.ts.map +0 -1
- package/dist/opportunity/opportunity.introducer.js.map +0 -1
- package/dist/opportunity/opportunity.labels.d.ts.map +0 -1
- package/dist/opportunity/opportunity.labels.js.map +0 -1
- package/dist/opportunity/opportunity.pending-questions.d.ts.map +0 -1
- package/dist/opportunity/opportunity.pending-questions.js.map +0 -1
- package/dist/opportunity/opportunity.persist.d.ts.map +0 -1
- package/dist/opportunity/opportunity.persist.js.map +0 -1
- package/dist/opportunity/opportunity.presentation-cache.d.ts.map +0 -1
- package/dist/opportunity/opportunity.presentation-cache.js.map +0 -1
- package/dist/opportunity/opportunity.presentation.d.ts.map +0 -1
- package/dist/opportunity/opportunity.presentation.js.map +0 -1
- package/dist/opportunity/opportunity.presenter.d.ts.map +0 -1
- package/dist/opportunity/opportunity.presenter.js.map +0 -1
- package/dist/opportunity/opportunity.safe-presentation.d.ts.map +0 -1
- package/dist/opportunity/opportunity.safe-presentation.js.map +0 -1
- package/dist/opportunity/opportunity.state.d.ts.map +0 -1
- package/dist/opportunity/opportunity.state.js.map +0 -1
- package/dist/opportunity/opportunity.tools.d.ts.map +0 -1
- package/dist/opportunity/opportunity.tools.js.map +0 -1
- package/dist/opportunity/opportunity.utils.d.ts.map +0 -1
- package/dist/opportunity/opportunity.utils.js.map +0 -1
- package/dist/opportunity/outcome/outcome.env.d.ts.map +0 -1
- package/dist/opportunity/outcome/outcome.env.js.map +0 -1
- package/dist/opportunity/outcome/outcome.hypotheses.d.ts.map +0 -1
- package/dist/opportunity/outcome/outcome.hypotheses.js.map +0 -1
- package/dist/opportunity/outcome/outcome.shadow.d.ts.map +0 -1
- package/dist/opportunity/outcome/outcome.shadow.js.map +0 -1
- package/dist/opportunity/outcome/outcome.types.d.ts.map +0 -1
- package/dist/opportunity/outcome/outcome.types.js.map +0 -1
- package/dist/premise/premise.analyzer.d.ts.map +0 -1
- package/dist/premise/premise.analyzer.js.map +0 -1
- package/dist/premise/premise.decomposer.d.ts.map +0 -1
- package/dist/premise/premise.decomposer.js.map +0 -1
- package/dist/premise/premise.graph.d.ts.map +0 -1
- package/dist/premise/premise.graph.js.map +0 -1
- package/dist/premise/premise.indexer.d.ts.map +0 -1
- package/dist/premise/premise.indexer.js.map +0 -1
- package/dist/premise/premise.state.d.ts.map +0 -1
- package/dist/premise/premise.state.js.map +0 -1
- package/dist/premise/premise.tools.d.ts.map +0 -1
- package/dist/premise/premise.tools.js.map +0 -1
- package/dist/questioner/questioner.agent.d.ts.map +0 -1
- package/dist/questioner/questioner.agent.js.map +0 -1
- package/dist/questioner/questioner.ask.tool.d.ts.map +0 -1
- package/dist/questioner/questioner.ask.tool.js.map +0 -1
- package/dist/questioner/questioner.discovery.prompt.d.ts.map +0 -1
- package/dist/questioner/questioner.discovery.prompt.js.map +0 -1
- package/dist/questioner/questioner.env.d.ts.map +0 -1
- package/dist/questioner/questioner.env.js.map +0 -1
- package/dist/questioner/questioner.presets.d.ts.map +0 -1
- package/dist/questioner/questioner.presets.js.map +0 -1
- package/dist/questioner/questioner.qud.d.ts.map +0 -1
- package/dist/questioner/questioner.qud.js.map +0 -1
- package/dist/questioner/questioner.tools.d.ts.map +0 -1
- package/dist/questioner/questioner.tools.js.map +0 -1
- package/dist/questioner/questioner.types.d.ts.map +0 -1
- package/dist/questioner/questioner.types.js.map +0 -1
- package/dist/shared/agent/model-signal.d.ts.map +0 -1
- package/dist/shared/agent/model-signal.js.map +0 -1
- package/dist/shared/agent/model.config.d.ts.map +0 -1
- package/dist/shared/agent/model.config.js.map +0 -1
- package/dist/shared/agent/tests/llm-assert.d.ts +0 -11
- package/dist/shared/agent/tests/llm-assert.d.ts.map +0 -1
- package/dist/shared/agent/tests/llm-assert.js +0 -43
- package/dist/shared/agent/tests/llm-assert.js.map +0 -1
- package/dist/shared/agent/tool.factory.d.ts.map +0 -1
- package/dist/shared/agent/tool.factory.js.map +0 -1
- package/dist/shared/agent/tool.helpers.d.ts.map +0 -1
- package/dist/shared/agent/tool.helpers.js.map +0 -1
- package/dist/shared/agent/tool.registry.d.ts.map +0 -1
- package/dist/shared/agent/tool.registry.js.map +0 -1
- package/dist/shared/agent/tool.runtime.d.ts.map +0 -1
- package/dist/shared/agent/tool.runtime.js.map +0 -1
- package/dist/shared/agent/tool.scope.d.ts.map +0 -1
- package/dist/shared/agent/tool.scope.js.map +0 -1
- package/dist/shared/agent/utility.tools.d.ts.map +0 -1
- package/dist/shared/agent/utility.tools.js.map +0 -1
- package/dist/shared/assignment/network-assignment.policy.d.ts.map +0 -1
- package/dist/shared/assignment/network-assignment.policy.js.map +0 -1
- package/dist/shared/hyde/hyde.documents.d.ts.map +0 -1
- package/dist/shared/hyde/hyde.documents.js.map +0 -1
- package/dist/shared/hyde/hyde.env.d.ts.map +0 -1
- package/dist/shared/hyde/hyde.env.js.map +0 -1
- package/dist/shared/hyde/hyde.frame.d.ts.map +0 -1
- package/dist/shared/hyde/hyde.frame.js.map +0 -1
- package/dist/shared/hyde/hyde.generator.d.ts.map +0 -1
- package/dist/shared/hyde/hyde.generator.js.map +0 -1
- package/dist/shared/hyde/hyde.graph.d.ts.map +0 -1
- package/dist/shared/hyde/hyde.graph.js.map +0 -1
- package/dist/shared/hyde/hyde.state.d.ts.map +0 -1
- package/dist/shared/hyde/hyde.state.js.map +0 -1
- package/dist/shared/hyde/hyde.strategies.d.ts.map +0 -1
- package/dist/shared/hyde/hyde.strategies.js.map +0 -1
- package/dist/shared/hyde/hyde.validator.d.ts.map +0 -1
- package/dist/shared/hyde/hyde.validator.js.map +0 -1
- package/dist/shared/hyde/lens.inferrer.d.ts.map +0 -1
- package/dist/shared/hyde/lens.inferrer.js.map +0 -1
- package/dist/shared/interfaces/agent-dispatcher.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/agent-dispatcher.interface.js.map +0 -1
- package/dist/shared/interfaces/agent.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/agent.interface.js.map +0 -1
- package/dist/shared/interfaces/auth.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/auth.interface.js.map +0 -1
- package/dist/shared/interfaces/cache.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/cache.interface.js.map +0 -1
- package/dist/shared/interfaces/chat-message-writer.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/chat-message-writer.interface.js.map +0 -1
- package/dist/shared/interfaces/chat-session.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/chat-session.interface.js.map +0 -1
- package/dist/shared/interfaces/chat-summary.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/chat-summary.interface.js.map +0 -1
- package/dist/shared/interfaces/connect-link.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/connect-link.interface.js.map +0 -1
- package/dist/shared/interfaces/contact.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/contact.interface.js.map +0 -1
- package/dist/shared/interfaces/database.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/database.interface.js.map +0 -1
- package/dist/shared/interfaces/delivery-ledger.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/delivery-ledger.interface.js.map +0 -1
- package/dist/shared/interfaces/discovery-run.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/discovery-run.interface.js.map +0 -1
- package/dist/shared/interfaces/embedder.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/embedder.interface.js.map +0 -1
- package/dist/shared/interfaces/enrichment-run.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/enrichment-run.interface.js.map +0 -1
- package/dist/shared/interfaces/enrichment.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/enrichment.interface.js.map +0 -1
- package/dist/shared/interfaces/integration.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/integration.interface.js.map +0 -1
- package/dist/shared/interfaces/negotiation-events.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/negotiation-events.interface.js.map +0 -1
- package/dist/shared/interfaces/negotiation-summary.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/negotiation-summary.interface.js.map +0 -1
- package/dist/shared/interfaces/negotiator-memory.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/negotiator-memory.interface.js.map +0 -1
- package/dist/shared/interfaces/question-generator.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/question-generator.interface.js.map +0 -1
- package/dist/shared/interfaces/questioner.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/questioner.interface.js.map +0 -1
- package/dist/shared/interfaces/queue.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/queue.interface.js.map +0 -1
- package/dist/shared/interfaces/scraper.interface.d.ts.map +0 -1
- package/dist/shared/interfaces/scraper.interface.js.map +0 -1
- package/dist/shared/network/metadata.renderer.d.ts.map +0 -1
- package/dist/shared/network/metadata.renderer.js.map +0 -1
- package/dist/shared/observability/debug-meta.sanitizer.d.ts.map +0 -1
- package/dist/shared/observability/debug-meta.sanitizer.js.map +0 -1
- package/dist/shared/observability/log.d.ts.map +0 -1
- package/dist/shared/observability/log.js.map +0 -1
- package/dist/shared/observability/performance.d.ts.map +0 -1
- package/dist/shared/observability/performance.js.map +0 -1
- package/dist/shared/observability/protocol.logger.d.ts.map +0 -1
- package/dist/shared/observability/protocol.logger.js.map +0 -1
- package/dist/shared/observability/request-context.d.ts.map +0 -1
- package/dist/shared/observability/request-context.js.map +0 -1
- package/dist/shared/observability/trace.d.ts.map +0 -1
- package/dist/shared/observability/trace.js.map +0 -1
- package/dist/shared/schemas/chat-context.schema.d.ts.map +0 -1
- package/dist/shared/schemas/chat-context.schema.js.map +0 -1
- package/dist/shared/schemas/discovery-question.schema.d.ts.map +0 -1
- package/dist/shared/schemas/discovery-question.schema.js.map +0 -1
- package/dist/shared/schemas/identity.schema.d.ts.map +0 -1
- package/dist/shared/schemas/identity.schema.js.map +0 -1
- package/dist/shared/schemas/mcp-auth.schema.d.ts.map +0 -1
- package/dist/shared/schemas/mcp-auth.schema.js.map +0 -1
- package/dist/shared/schemas/negotiation-digest.schema.d.ts.map +0 -1
- package/dist/shared/schemas/negotiation-digest.schema.js.map +0 -1
- package/dist/shared/schemas/negotiation-state.schema.d.ts.map +0 -1
- package/dist/shared/schemas/negotiation-state.schema.js.map +0 -1
- package/dist/shared/schemas/network-assignment.schema.d.ts.map +0 -1
- package/dist/shared/schemas/network-assignment.schema.js.map +0 -1
- package/dist/shared/schemas/pending-question.schema.d.ts.map +0 -1
- package/dist/shared/schemas/pending-question.schema.js.map +0 -1
- package/dist/shared/schemas/question.schema.d.ts.map +0 -1
- package/dist/shared/schemas/question.schema.js.map +0 -1
- package/dist/shared/ui/lucide.icon-catalog.d.ts.map +0 -1
- package/dist/shared/ui/lucide.icon-catalog.js.map +0 -1
- package/dist/shared/utils/social-label.d.ts.map +0 -1
- package/dist/shared/utils/social-label.js.map +0 -1
- package/dist/shared/utils/telegram-handle.d.ts.map +0 -1
- package/dist/shared/utils/telegram-handle.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"negotiation.graph.js","sourceRoot":"/","sources":["negotiation/negotiation.graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,cAAc,EAAqB,MAAM,4CAA4C,CAAC;AAI/F,OAAO,EAAE,qBAAqB,EAAyG,MAAM,wBAAwB,CAAC;AACtK,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjQ,OAAO,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,iCAAiC,EAAsC,MAAM,sCAAsC,CAAC;AACnL,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAkD,MAAM,yBAAyB,CAAC;AACpI,OAAO,EAAE,cAAc,EAAE,8BAA8B,EAAE,2BAA2B,EAAqD,MAAM,2BAA2B,CAAC;AAE3K,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAI5E,OAAO,EAAE,yCAAyC,EAAE,oCAAoC,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AACnM,OAAO,EAAE,yBAAyB,EAAE,sBAAsB,EAA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S,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YACtG,IAAI,mBAAmB,EAAE,CAAC;gBACxB,IAAI,CAAC;oBACH,MAAM,mBAAmB,CAAC;wBACxB,SAAS;wBACT,QAAQ,EAAE,IAAI;wBACd,KAAK,EAAE,EAAE;wBACT,OAAO,EAAE;4BACP,cAAc,EAAE,KAAK;4BACrB,WAAW,EAAE,EAAE;4BACf,SAAS,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;4BAC3D,SAAS,EAAE,CAAC;yBACb;qBACF,CAAC,CAAC;gBACL,CAAC;gBAAC,MAAM,CAAC;oBACP,oCAAoC;gBACtC,CAAC;YACH,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAA0B,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;AACnE,CAAC","sourcesContent":["import { StateGraph } from \"@langchain/langgraph\";\n\nimport { invokeWithAbortSignal } from \"../shared/agent/model-signal.js\";\nimport { requestContext, type TraceEmitter } from \"../shared/observability/request-context.js\";\nimport type { NegotiationGraphDatabase, OpportunityStatus, NegotiationContinuationReceipt } from \"../shared/interfaces/database.interface.js\";\nimport type { NegotiationTimeoutQueue } from \"../shared/interfaces/negotiation-events.interface.js\";\nimport type { AgentDispatcher, NegotiationTurnPayload } from \"../shared/interfaces/agent-dispatcher.interface.js\";\nimport { NegotiationGraphState, type NegotiationTurn, type NegotiationOutcome, type UserNegotiationContext, type NegotiationGraphLike } from \"./negotiation.state.js\";\nimport { IndexNegotiator } from \"./negotiation.agent.js\";\nimport { ASK_USER_LOCK_SLACK_MS, allowedActionsFor, askUserAnswerWindowMs, configuredAskUserEnabled, configuredProtocolVersion, fallbackActionFor, isRejectLikeAction, isTerminalAction, readProtocolVersion, rejectActionFor } from \"./negotiation.protocol.js\";\nimport { assessConsultationEligibility, consultationPromptFor, negotiationConsultationPolicyMode, type NegotiationConsultationReason } from \"./negotiation.consultation-policy.js\";\nimport { NegotiationScreener, configuredScreenMode, type ScreenDecision, type ScreenDecisionRecord } from \"./negotiation.screen.js\";\nimport { assessDeadlock, configuredDeadlockShiftEnabled, configuredDeadlockThreshold, type DeadlockAssessment, type DeadlockShiftRecord } from \"./negotiation.deadlock.js\";\nimport type { NegotiationSeat, NegotiationProtocolVersion } from \"../shared/schemas/negotiation-state.schema.js\";\nimport { protocolLogger } from \"../shared/observability/protocol.logger.js\";\nimport type { QuestionerEnqueueFn } from \"../questioner/questioner.types.js\";\nimport type { ReflectEnqueueFn } from \"./negotiation.reflect.js\";\nimport type { NegotiatorMemoryEntry, NegotiatorMemoryRetrieveFn, NegotiatorMemoryScope } from \"./negotiation.memory.js\";\nimport { NEGOTIATION_QUESTION_GENERIC_COUNTERPARTY, NEGOTIATION_QUESTION_GENERIC_NETWORK, negotiationQuestionSettlementId, validateInflightAskUserFields } from './negotiation.question-safety.js';\nimport { attributedDialogueIsEmpty, buildSeededAttribution, combineAttributedDialogue, type AttributedPriorDialogue, type TaskAttribution } from './negotiation.attribution.js';\n\nconst logger = protocolLogger(\"NegotiationGraph\");\nconst initLog = protocolLogger(\"NegotiationGraph:Init\");\nconst screenNodeLog = protocolLogger(\"NegotiationGraph:Screen\");\nconst turnLog = protocolLogger(\"NegotiationGraph:Turn\");\nconst finalizeLog = protocolLogger(\"NegotiationGraph:Finalize\");\nconst negotiateCandidatesLog = protocolLogger(\"NegotiationGraph:negotiateCandidates\");\n\n/** Extracts the ordered NegotiationTurn list from A2A message data parts. */\nfunction turnsFromMessages(messages: Array<{ parts: unknown[] }>): NegotiationTurn[] {\n return messages\n .map((m) => {\n const dataPart = (m.parts as Array<{ kind?: string; data?: unknown }>).find((p) => p.kind === \"data\");\n return dataPart?.data as NegotiationTurn;\n })\n .filter(Boolean);\n}\n\n/**\n * Whether `userId`'s side has already spent its one `ask_user` client\n * consultation in this conversation (P3.2 rationing: max one per negotiation\n * per side, checked against the full message history so continuations count\n * prior sessions' consultations too).\n */\nfunction hasPriorAskUser(\n messages: Array<{ senderId: string; parts: unknown[] }>,\n userId: string,\n): boolean {\n const sender = `agent:${userId}`;\n return messages.some((m) => {\n if (m.senderId !== sender) return false;\n const dataPart = (m.parts as Array<{ kind?: string; data?: { action?: string } }>).find((p) => p.kind === \"data\");\n return dataPart?.data?.action === \"ask_user\";\n });\n}\n\ninterface IntentSnapshot {\n userId: string;\n intentId: string;\n title: string;\n description: string;\n}\n\n/** Capture immutable, internal-only intent provenance at task creation time. */\nfunction buildIntentSnapshots(\n sourceUser: UserNegotiationContext,\n candidateUser: UserNegotiationContext,\n): IntentSnapshot[] {\n const snapshots: IntentSnapshot[] = [];\n const seen = new Set<string>();\n\n for (const user of [sourceUser, candidateUser]) {\n if (typeof user.id !== 'string' || user.id.trim().length === 0) continue;\n for (const intent of Array.isArray(user.intents) ? user.intents : []) {\n if (typeof intent?.id !== 'string' || intent.id.trim().length === 0) continue;\n const key = `${user.id}\\u0000${intent.id}`;\n if (seen.has(key)) continue;\n seen.add(key);\n snapshots.push({\n userId: user.id,\n intentId: intent.id,\n title: typeof intent.title === 'string' ? intent.title : '',\n description: typeof intent.description === 'string' ? intent.description : '',\n });\n }\n }\n\n return snapshots;\n}\n\n/**\n * Factory for the bilateral negotiation LangGraph state machine.\n * @remarks Accepts an AgentDispatcher for per-turn agent resolution.\n */\nexport class NegotiationGraphFactory {\n constructor(\n private database: NegotiationGraphDatabase,\n private dispatcher: AgentDispatcher,\n private timeoutQueue?: NegotiationTimeoutQueue,\n private questionerEnqueue?: QuestionerEnqueueFn,\n private reflectEnqueue?: ReflectEnqueueFn,\n private memoryRetrieve?: NegotiatorMemoryRetrieveFn,\n ) {}\n\n createGraph() {\n const { database, dispatcher, timeoutQueue, questionerEnqueue, reflectEnqueue, memoryRetrieve } = this;\n const systemAgent = new IndexNegotiator();\n const screener = new NegotiationScreener();\n\n /**\n * P5.3 memory retrieval — never throws, never blocks a negotiation. The\n * injected fn already resolves [] when NEGOTIATOR_MEMORY_INJECT is off;\n * this wrapper adds the graph-side failure guard.\n */\n const retrieveMemory = async (\n userId: string,\n counterpartyUserId: string,\n queryText: string,\n scope: NegotiatorMemoryScope,\n ): Promise<NegotiatorMemoryEntry[]> => {\n if (!memoryRetrieve) return [];\n try {\n return await memoryRetrieve({ userId, counterpartyUserId, queryText, scope });\n } catch (err) {\n logger.warn(\"Negotiator memory retrieval failed; proceeding without memory\", {\n userId,\n scope,\n error: err instanceof Error ? err.message : String(err),\n });\n return [];\n }\n };\n\n /**\n * IND-569: resolve a prior negotiation task's attribution metadata for the\n * per-opportunity prior-dialogue labels. Never throws — any failure returns\n * null so the turns degrade to the unattributed block instead of leaking\n * into the current opportunity's context.\n */\n const resolveTaskAttribution = async (taskId: string): Promise<TaskAttribution | null> => {\n try {\n const task = await database.getTask(taskId);\n if (!task) return null;\n const md = (task.metadata ?? {}) as Record<string, unknown>;\n const opportunityId = typeof md.opportunityId === 'string' && md.opportunityId.length > 0 ? md.opportunityId : null;\n const snapshots = Array.isArray(md.intentSnapshots) ? (md.intentSnapshots as Array<Record<string, unknown>>) : [];\n const sourceIntentId = typeof md.sourceIntentId === 'string' ? md.sourceIntentId : null;\n const snap = snapshots.find((s) => s && s.intentId === sourceIntentId) ?? snapshots[0];\n const opportunityTitle = snap && typeof snap.title === 'string' && snap.title.trim().length > 0 ? (snap.title as string) : null;\n let outcome: string | null = null;\n try {\n const artifacts = await database.getArtifactsForTask(taskId);\n const outArtifact = artifacts.find((a) => a.name === 'negotiation-outcome');\n if (outArtifact) {\n const firstPart = Array.isArray(outArtifact.parts) ? (outArtifact.parts[0] as Record<string, unknown> | undefined) : undefined;\n const data = firstPart?.data as Record<string, unknown> | undefined;\n if (data && typeof data.hasOpportunity === 'boolean') {\n outcome = data.hasOpportunity ? 'accepted' : (data.reason === 'screened_out' ? 'not pursued' : 'declined');\n } else if (typeof outArtifact.metadata?.continuationOutcome === 'string') {\n outcome = outArtifact.metadata.continuationOutcome as string;\n }\n }\n } catch { /* outcome stays null; header degrades to \"outcome unknown\" */ }\n const concludedAt = task.updatedAt instanceof Date\n ? task.updatedAt.toISOString()\n : (task.updatedAt ? new Date(task.updatedAt as unknown as string).toISOString() : null);\n return { opportunityId, opportunityTitle, outcome, concludedAt };\n } catch {\n return null;\n }\n };\n\n /**\n * IND-569: build the attributed prior dialogue passed to the screener and\n * turn prompts. Combines the immutable seeded attribution (earlier + legacy\n * unattributed blocks, resolved once in init) with this session's own turns\n * (task-id-matched). Null when there is no seeded attribution.\n */\n const buildAttributedDialogue = (\n state: typeof NegotiationGraphState.State,\n ): AttributedPriorDialogue | null => {\n if (!state.isContinuation || !state.priorAttribution) return null;\n const currentSessionTurns = turnsFromMessages(\n state.messages.filter((m) => (m as { taskId?: string | null }).taskId === state.taskId),\n );\n const dialogue = combineAttributedDialogue(state.priorAttribution, currentSessionTurns);\n return attributedDialogueIsEmpty(dialogue) ? null : dialogue;\n };\n\n /** Similarity query text: seed reasoning + counterparty context. */\n const memoryQueryText = (\n state: typeof NegotiationGraphState.State,\n counterparty: UserNegotiationContext,\n ): string => [\n state.discoveryQuery ? `Search: ${state.discoveryQuery}` : \"\",\n state.seedAssessment?.reasoning ?? \"\",\n counterparty?.profile?.name ?? \"\",\n counterparty?.profile?.bio ?? \"\",\n (counterparty?.intents ?? []).slice(0, 5).map((i) => `${i.title}: ${i.description}`).join(\"\\n\"),\n ].filter(Boolean).join(\"\\n\");\n\n const initNode = async (state: typeof NegotiationGraphState.State) => {\n try {\n // Exact continuations reuse the prior conversation and preclaimed\n // successor; they must not create any mutable state before the fence.\n const agentIdA = `agent:${state.sourceUser.id}`;\n const agentIdB = `agent:${state.candidateUser.id}`;\n const execution = state.continuationExecution;\n const conversation = execution\n ? { id: execution.conversationId }\n : await database.getOrCreateDM(agentIdA, agentIdB, 'agent');\n\n // --- Lock gate: check for an active task on this conversation ---\n const priorMessages = await database.getMessagesForConversation(conversation.id);\n\n const activeStates = ['submitted', 'working', 'input_required', 'waiting_for_agent', 'claimed'];\n const isActiveAndFresh = (t: { state: string; updatedAt: Date }) => {\n if (!activeStates.includes(t.state)) return false;\n // State-aware freshness (IND-401): an `input_required` task is an\n // ask_user pause — it holds the conversation lock for its full answer\n // window (+ slack for the expiry worker), not the 5-min turn window.\n // Otherwise ambient rediscovery / chat negotiate_existing would start\n // a fresh negotiation right past the pause after 5 minutes.\n const freshnessMs = t.state === 'input_required'\n ? askUserAnswerWindowMs() + ASK_USER_LOCK_SLACK_MS\n : 5 * 60 * 1000;\n return (Date.now() - new Date(t.updatedAt).getTime()) < freshnessMs;\n };\n\n if (\n Boolean(state.resumeFromTaskId) !== Boolean(state.continuationSettlementId)\n || Boolean(state.resumeFromTaskId) !== Boolean(execution)\n ) return { error: 'invalid continuation correlation' };\n const exactContinuation = state.resumeFromTaskId && state.continuationSettlementId && execution\n ? { taskId: state.resumeFromTaskId, settlementId: state.continuationSettlementId, execution }\n : null;\n const priorTask = exactContinuation\n ? await database.getTask(exactContinuation.taskId)\n : state.opportunityId\n ? await database.getNegotiationTaskForOpportunity(state.opportunityId)\n : null;\n const claimedSuccessor = exactContinuation\n ? await database.getTask(exactContinuation.execution.successorTaskId)\n : null;\n if (exactContinuation) {\n const settlement = priorTask?.metadata?.questionSettlement as Record<string, unknown> | undefined;\n const storedExecution = claimedSuccessor?.metadata?.continuationExecution as Record<string, unknown> | undefined;\n if (\n !priorTask\n || priorTask.conversationId !== conversation.id\n || priorTask.state !== 'canceled'\n || priorTask.metadata?.opportunityId !== state.opportunityId\n || settlement?.settlementId !== exactContinuation.settlementId\n || settlement?.taskId !== exactContinuation.taskId\n || !claimedSuccessor\n || claimedSuccessor.conversationId !== conversation.id\n || storedExecution?.token !== exactContinuation.execution.token\n || storedExecution?.fence !== exactContinuation.execution.fence\n || storedExecution?.status !== 'claimed'\n ) return { error: 'invalid exact continuation task' };\n }\n const isLocked = !exactContinuation && !!priorTask && isActiveAndFresh(priorTask);\n\n if (isLocked) {\n initLog.info('Conversation locked by active task, returning busy', {\n conversationId: conversation.id,\n opportunityId: state.opportunityId,\n });\n return { error: 'busy' };\n }\n\n // --- Load prior messages and determine continuation ---\n const priorTurns: NegotiationTurn[] = turnsFromMessages(priorMessages);\n\n const isContinuation = priorTurns.length > 0;\n\n // Determine currentSpeaker from last prior message. An `ask_user` last\n // turn does NOT pass the floor: the sender paused to consult its own\n // client, so on resume the same side speaks again — now armed with the\n // client's answer (or its recorded absence). Flipping here would hand\n // the turn to the counterparty, who has nothing to respond to.\n let currentSpeaker: 'source' | 'candidate' = 'source';\n if (isContinuation && priorMessages.length > 0) {\n const lastMessage = priorMessages[priorMessages.length - 1];\n const lastAction = turnsFromMessages([lastMessage])[0]?.action;\n if (lastAction === 'ask_user') {\n currentSpeaker = lastMessage.senderId === agentIdA ? 'source' : 'candidate';\n } else {\n currentSpeaker = lastMessage.senderId === agentIdA ? 'candidate' : 'source';\n }\n }\n\n // Determine scenario-based maxTurns\n const scope = { action: 'manage:negotiations', scopeType: 'network', scopeId: state.indexContext.networkId };\n const [sourceHasAgent, candidateHasAgent] = await Promise.all([\n dispatcher.hasExternalAgent(state.sourceUser.id, scope),\n dispatcher.hasExternalAgent(state.candidateUser.id, scope),\n ]);\n\n const ambientMax = Number(process.env.NEGOTIATION_MAX_TURNS_AMBIENT) || 6;\n let maxTurns = state.maxTurns;\n if (maxTurns == null) {\n maxTurns = (sourceHasAgent && candidateHasAgent) ? 0 : ambientMax;\n }\n\n // --- Initiator seat resolution (v2: rigid per match, stamped at discovery) ---\n // 1. Continuations inherit from the prior task for the same opportunity —\n // never re-derive, so the seat cannot flip between sessions.\n // 2. Conversation-scoped tie-break: if another negotiation on this DM is\n // active and fresh (symmetric concurrent start under a different\n // opportunityId — the opportunity-scoped lock above cannot see it),\n // the first created task keeps the seat; this run inherits its stamp.\n // 3. Otherwise: explicit stamp from the caller, falling back to the\n // session's sourceUser (pre-stamp heuristic behavior, unchanged).\n const readInitiator = (metadata: Record<string, unknown> | null | undefined): string | null => {\n const v = metadata?.initiatorUserId;\n return typeof v === 'string' && v.length > 0 ? v : null;\n };\n let initiatorUserId = readInitiator(priorTask?.metadata) ?? state.initiatorUserId ?? state.sourceUser.id;\n // Conversation-scoped prior task: used only for the initiator tie-break\n // (and only when active+fresh).\n const convTask = !exactContinuation && !readInitiator(priorTask?.metadata)\n ? await database.getLatestNegotiationTaskForConversation?.(conversation.id).catch(() => null)\n : null;\n if (!readInitiator(priorTask?.metadata)) {\n if (convTask && convTask.id !== priorTask?.id && isActiveAndFresh(convTask)) {\n const convInitiator = readInitiator(convTask.metadata);\n if (convInitiator) {\n initLog.info('Conversation-scoped tie-break: inheriting initiator seat from concurrent task', {\n conversationId: conversation.id,\n winningTaskId: convTask.id,\n initiatorUserId: convInitiator,\n });\n initiatorUserId = convInitiator;\n }\n }\n }\n\n // --- Protocol version: pinned per negotiation, re-stamped per match ---\n // A prior task for this same negotiation (exact continuation resume or\n // a re-run of the same opportunity) pins the version, so one\n // negotiation never flips semantics mid-flight (absent field on a\n // genuine prior = pre-v2 task = v1). Everything else — including\n // continuations of older conversations between the same pair — stamps\n // fresh from NEGOTIATION_PROTOCOL_VERSION, so a version cutover\n // reaches existing pairs on their next new match instead of being\n // pinned to v1 forever by conversation history.\n const protocolVersion: NegotiationProtocolVersion = priorTask\n ? (readProtocolVersion(priorTask.metadata) ?? 'v1')\n : configuredProtocolVersion();\n\n const taskMetadata = {\n type: 'negotiation',\n sourceUserId: state.sourceUser.id,\n initiatorUserId,\n protocolVersion,\n candidateUserId: state.candidateUser.id,\n networkId: state.indexContext.networkId,\n sourceIntentId: state.sourceIntentId,\n candidateIntentId: state.candidateIntentId,\n participantBindings: [\n ...(state.sourceIntentId ? [{ userId: state.sourceUser.id, intentId: state.sourceIntentId, networkId: state.indexContext.networkId }] : []),\n ...(state.candidateIntentId ? [{ userId: state.candidateUser.id, intentId: state.candidateIntentId, networkId: state.indexContext.networkId }] : []),\n ],\n intentSnapshots: buildIntentSnapshots(state.sourceUser, state.candidateUser),\n ...(state.opportunityId && { opportunityId: state.opportunityId }),\n maxTurns,\n isContinuation,\n priorTurnCount: priorTurns.length,\n ...(exactContinuation ? {\n resumeFromTaskId: exactContinuation.taskId,\n continuationSettlementId: exactContinuation.settlementId,\n } : {}),\n };\n if (state.opportunityId && Boolean(state.opportunityStatus) !== Boolean(state.opportunityUpdatedAt)) {\n throw new Error('Negotiation attempt requires both opportunity status and updatedAt');\n }\n\n const task = exactContinuation\n ? claimedSuccessor\n : state.opportunityId && state.opportunityStatus && state.opportunityUpdatedAt\n ? await database.createNegotiationTaskForAttempt({\n conversationId: conversation.id,\n opportunityId: state.opportunityId,\n expectedStatus: state.opportunityStatus,\n expectedUpdatedAt: state.opportunityUpdatedAt,\n metadata: taskMetadata,\n })\n : await database.createTask(conversation.id, taskMetadata);\n\n if (!task) {\n throw new Error('Negotiation attempt is stale or already claimed');\n }\n\n // Attempt-bound discovery atomically promoted the exact persisted state\n // to `negotiating` while inserting the task. Legacy/direct invocations\n // with only an opportunity ID retain the prior best-effort status update.\n if (state.opportunityId && !state.opportunityUpdatedAt) {\n await database.updateOpportunityStatus(state.opportunityId, 'negotiating').catch((err) => {\n initLog.error('Failed to set opportunity status to negotiating', { opportunityId: state.opportunityId, error: err });\n });\n }\n\n // Load user answers collected by the questioner between sessions\n const userAnswers = (isContinuation && state.opportunityId)\n ? await database.getOpportunityUserAnswers(state.opportunityId).catch((err) => {\n initLog.error('Failed to load user answers', { opportunityId: state.opportunityId, error: err });\n return [];\n })\n : [];\n\n // Seed messages with prior turns (additive reducer appends new turns on top).\n // taskId is preserved so the turn/screen nodes can separate this\n // session's turns from seeded prior-task turns (IND-569).\n const seedMessages = isContinuation ? priorMessages.map((m) => ({\n id: m.id,\n senderId: m.senderId,\n role: 'agent' as const,\n parts: m.parts,\n createdAt: m.createdAt,\n taskId: (m as { taskId?: string | null }).taskId ?? null,\n })) : [];\n\n // IND-569: attribute seeded prior turns to their originating opportunity\n // once, up front. Earlier-opportunity and legacy unattributed blocks are\n // immutable for the session; the current block is composed per turn.\n const priorAttribution = isContinuation\n ? await buildSeededAttribution(\n priorMessages\n .map((m) => ({ taskId: (m as { taskId?: string | null }).taskId ?? null, turn: turnsFromMessages([m])[0] }))\n .filter((e): e is { taskId: string | null; turn: NegotiationTurn } => Boolean(e.turn)),\n state.opportunityId,\n resolveTaskAttribution,\n )\n : null;\n\n return {\n conversationId: conversation.id,\n taskId: task.id,\n currentSpeaker,\n turnCount: 0,\n maxTurns,\n isContinuation,\n initiatorUserId,\n protocolVersion,\n priorTurnCount: priorTurns.length,\n ...(priorAttribution && { priorAttribution }),\n ...(userAnswers.length > 0 && { userAnswers }),\n ...(exactContinuation?.execution.consultation\n ? { privateConsultation: exactContinuation.execution.consultation }\n : {}),\n ...(exactContinuation && (() => {\n const turnContext = priorTask?.metadata?.turnContext as Record<string, unknown> | undefined;\n const reason = turnContext?.consultationPolicyReason;\n return typeof reason === 'string' ? { consultationPolicyReason: reason as NegotiationConsultationReason } : {};\n })()),\n ...(seedMessages.length > 0 && { messages: seedMessages }),\n };\n } catch (err) {\n return { error: `Init failed: ${err instanceof Error ? err.message : String(err)}` };\n }\n };\n\n /**\n * Screen node (P2.1) — the outreach gate. Runs between init and the first\n * turn on FRESH negotiations only (routing skips it on continuations and\n * when NEGOTIATION_SCREEN_MODE=off). The reaching client's negotiator\n * decides whether the match is worth its client's name; in shadow mode the\n * decision is recorded (task metadata + trace event + log line) but never\n * blocks — the negotiation always proceeds to the first turn. In enforce\n * mode (P2.2) a `pass` routes straight to finalize: zero turns, zero\n * counterparty involvement, outcome `reason: \"screened_out\"`, opportunity\n * quietly `rejected` (init had already flipped it to `negotiating`).\n * A failed screen still fails OPEN in every mode.\n */\n const screenNode = async (state: typeof NegotiationGraphState.State) => {\n const traceEmitter = requestContext.getStore()?.traceEmitter;\n const emitWide = (event: Record<string, unknown>) =>\n (traceEmitter as ((e: Record<string, unknown>) => void) | undefined)?.(event);\n\n const mode = configuredScreenMode();\n const start = Date.now();\n // The client is the initiator seat's user — the side whose negotiator is\n // reaching out. Fresh runs stamp initiatorUserId in init; fall back to\n // sourceUser (what the stamp defaults to anyway).\n const initiatorId = state.initiatorUserId ?? state.sourceUser.id;\n const clientIsSource = initiatorId !== state.candidateUser.id;\n const clientUser = clientIsSource ? state.sourceUser : state.candidateUser;\n const counterpartyUser = clientIsSource ? state.candidateUser : state.sourceUser;\n\n // P5.3: the client's own negotiator memory informs the outreach gate.\n // Cached into state so the client's first turn reuses it.\n const clientSide: \"source\" | \"candidate\" = clientIsSource ? \"source\" : \"candidate\";\n const clientMemory = state.memoryBySide?.[clientSide]\n ?? (memoryRetrieve\n ? await retrieveMemory(clientUser.id, counterpartyUser.id, memoryQueryText(state, counterpartyUser), \"screen\")\n : []);\n\n let decision: ScreenDecision;\n let failedOpen = false;\n let screenError: string | undefined;\n // On continuations the seeded prior turns are the dialogue this pair\n // already had. Pass them so the gate evaluates the NEW signal\n // (discoveryQuery / seedAssessment) on its own merits with that context\n // available — mirroring the continuation policy in negotiation.agent.ts\n // (\"if materially different, evaluate on its own merits\").\n const priorDialogue = state.isContinuation ? turnsFromMessages(state.messages) : [];\n // IND-569: labeled per-opportunity attribution of that prior dialogue.\n const attributedPrior = buildAttributedDialogue(state);\n try {\n const counterpartyContext = (await database.getUserContext(counterpartyUser.id, null).catch(() => null))?.text ?? \"\";\n decision = await screener.invoke({\n clientUser,\n counterpartyUser,\n ...(counterpartyContext && { counterpartyContext }),\n ...(clientMemory.length > 0 && { memory: clientMemory }),\n // discoveryQuery belongs to the discovery session's source user; only\n // meaningful for the client when the client holds the source side.\n ...(clientIsSource && state.discoveryQuery && { discoveryQuery: state.discoveryQuery }),\n seedAssessment: state.seedAssessment,\n indexContext: state.indexContext,\n ...(priorDialogue.length > 0 && { isContinuation: true, priorDialogue }),\n ...(attributedPrior && { isContinuation: true, priorDialogueAttributed: attributedPrior }),\n });\n } catch (err) {\n // Fail open: a screen failure must never block a negotiation.\n failedOpen = true;\n screenError = err instanceof Error ? err.message : String(err);\n screenNodeLog.warn(\"Screen failed; proceeding open (reach_out)\", {\n taskId: state.taskId,\n opportunityId: state.opportunityId || undefined,\n error: screenError,\n });\n decision = {\n decision: \"reach_out\",\n reasoning: `screen_error: ${screenError}`,\n evidence: { counterpartyPremiseFit: \"\", intentAlignment: \"\" },\n };\n }\n\n const durationMs = Date.now() - start;\n const record: ScreenDecisionRecord = {\n ...decision,\n mode,\n ...(failedOpen && { failedOpen, error: screenError }),\n screenedAt: new Date().toISOString(),\n durationMs,\n };\n\n await database.setTaskScreenDecision?.(state.taskId, record as unknown as Record<string, unknown>, state.continuationExecution).catch((err) => {\n screenNodeLog.error(\"Failed to persist screen decision\", { taskId: state.taskId, error: err });\n });\n\n screenNodeLog.info(\"negotiation_screen\", {\n taskId: state.taskId,\n opportunityId: state.opportunityId || undefined,\n decision: decision.decision,\n mode,\n failedOpen,\n durationMs,\n });\n\n if (state.opportunityId) {\n emitWide({\n type: \"negotiation_screen\",\n opportunityId: state.opportunityId,\n negotiationConversationId: state.conversationId,\n decision: decision.decision,\n reasoning: decision.reasoning,\n mode,\n failedOpen,\n durationMs,\n });\n }\n\n // Routing happens on the conditional edge: shadow always proceeds to\n // the first turn; enforce routes a (non-failed-open) pass to finalize.\n return { screenDecision: record, memoryBySide: { [clientSide]: clientMemory } };\n };\n\n /**\n * P2.2 — true when the screen gate blocked this negotiation: enforce mode,\n * a genuine `pass` (never failed-open), before any turn was exchanged.\n * Shadow-mode passes and fail-open records never block.\n */\n const isScreenBlocked = (state: typeof NegotiationGraphState.State): boolean =>\n state.screenDecision?.mode === \"enforce\"\n && state.screenDecision.decision === \"pass\"\n && state.screenDecision.failedOpen !== true\n && state.turnCount === 0;\n\n const turnNode = async (state: typeof NegotiationGraphState.State) => {\n const traceEmitter = requestContext.getStore()?.traceEmitter;\n // Local helper to emit events whose shape is wider than the declared\n // `TraceEmitter` union. The chat agent already casts at its relay sink;\n // here we localize the cast at the callsite so the rest of the body stays typed.\n const emitWide = (event: Record<string, unknown>) =>\n (traceEmitter as ((e: Record<string, unknown>) => void) | undefined)?.(event);\n const agentName = \"Index negotiator\";\n const agentStart = Date.now();\n traceEmitter?.({ type: \"agent_start\", name: agentName });\n\n try {\n const history: NegotiationTurn[] = turnsFromMessages(state.messages);\n // IND-569: labeled per-opportunity attribution of prior dialogue on a\n // continuation. Null on fresh runs (history renders flat, unchanged).\n const attributedPrior = buildAttributedDialogue(state);\n\n const isSource = state.currentSpeaker === \"source\";\n const ownUser = isSource ? state.sourceUser : state.candidateUser;\n const otherUser = isSource ? state.candidateUser : state.sourceUser;\n const ownIntentId = isSource ? state.sourceIntentId : state.candidateIntentId;\n\n // Determine if this is the system agent's final allowed turn\n const maxTurns = state.maxTurns ?? 0;\n const isFinalTurn = maxTurns > 0 && (state.turnCount + 1) >= maxTurns;\n\n // Seat attribution keys on initiatorUserId (rigid v2 stamp), never on\n // parity or source/candidate position — under the conversation-scoped\n // tie-break this run's source may hold the counterparty seat.\n const version = state.protocolVersion ?? 'v1';\n const seat: NegotiationSeat = ownUser.id === (state.initiatorUserId ?? state.sourceUser.id)\n ? 'initiator'\n : 'counterparty';\n\n // Legacy ask_user availability (P3.2): flag on, full pause loop wired\n // (questioner + answer-window timer + an opportunity to resume\n // against), v2 non-final non-opening turn, and this side's one client\n // consultation not yet spent (rationing). Shadow is observational and\n // must preserve this legacy path byte-for-byte except for telemetry.\n const policyMode = negotiationConsultationPolicyMode();\n const askUserAvailable =\n version === 'v2'\n && !isFinalTurn\n && configuredAskUserEnabled()\n && !!questionerEnqueue\n && !!timeoutQueue?.enqueueAskUserExpiry\n && !!state.opportunityId\n && !!ownIntentId\n && !!state.indexContext.networkId\n && !(state.turnCount === 0 && !state.isContinuation)\n && !hasPriorAskUser(state.messages, ownUser.id);\n\n // ─── Deadlock detection → persuasion→bargaining stance (IND-428) ──────\n // Deterministic trailing-run inspection of the persisted history — no\n // LLM in the decision. Gated on the strict default-off flag AND v2,\n // checked alongside the protocol-version plumbing so v1 semantics stay\n // untouched. Fail-open: any detection error means \"no deadlock\" and\n // the legacy path proceeds byte-identically. The shift changes the\n // system agent's drafting stance only — allowedActions, the dispatch\n // payload, and all termination rules are untouched.\n let deadlock: DeadlockAssessment | null = null;\n if (version === 'v2' && configuredDeadlockShiftEnabled()) {\n try {\n deadlock = assessDeadlock(history, configuredDeadlockThreshold());\n } catch (err) {\n turnLog.warn('Deadlock detection failed; proceeding without mode shift', {\n taskId: state.taskId,\n error: err instanceof Error ? err.message : String(err),\n });\n deadlock = null;\n }\n }\n const bargainingMode = deadlock?.deadlocked === true;\n\n // P5.3: the speaker's own negotiator memory (cached per side across\n // turns). Injected into both the dispatch payload (the user's own\n // agent — scope-correct) and the system-agent prompt.\n const ownSide: \"source\" | \"candidate\" = isSource ? \"source\" : \"candidate\";\n const ownMemory = state.memoryBySide?.[ownSide]\n ?? (memoryRetrieve\n ? await retrieveMemory(ownUser.id, otherUser.id, memoryQueryText(state, otherUser), \"turn\")\n : []);\n\n const payload: NegotiationTurnPayload = {\n negotiationId: state.taskId,\n ownUser,\n otherUser,\n indexContext: state.indexContext,\n seedAssessment: state.seedAssessment,\n history,\n isFinalTurn,\n isDiscoverer: isSource,\n seat,\n protocolVersion: version,\n allowedActions: [...allowedActionsFor(version, seat, isFinalTurn, { askUser: askUserAvailable })],\n ...(state.discoveryQuery && isSource && { discoveryQuery: state.discoveryQuery }),\n ...(attributedPrior && { priorDialogue: attributedPrior }),\n ...(ownMemory.length > 0 && { negotiatorMemory: ownMemory }),\n ...(state.privateConsultation?.recipientUserId === ownUser.id\n ? { privateConsultation: state.privateConsultation }\n : {}),\n };\n\n const scope = { action: 'manage:negotiations', scopeType: 'network', scopeId: state.indexContext.networkId };\n\n const dispatchResult = await dispatcher.dispatch(ownUser.id, scope, payload, { timeoutMs: state.timeoutMs });\n\n let turn: NegotiationTurn;\n\n if (dispatchResult.handled) {\n // Personal agent responded. Under v2, coerce out-of-seat actions to\n // the conservative fallback — the polling/respond surfaces reject\n // these with a 400, but locally-dispatched turns land here directly.\n turn = dispatchResult.turn;\n if (version === 'v2' && !allowedActionsFor(version, seat, isFinalTurn, { askUser: askUserAvailable }).includes(turn.action)) {\n turnLog.warn('Personal agent returned out-of-seat action, coercing to conservative fallback', {\n action: turn.action, seat, isFinalTurn,\n });\n turn = { ...turn, action: fallbackActionFor(version, seat, isFinalTurn) };\n }\n } else if (dispatchResult.reason === 'waiting') {\n // Long timeout — graph suspends. Persist the full turn context so the\n // polling agent (and MCP consumers via get_negotiation) reconstruct\n // the same view the in-process system agent would see. The view is\n // stored in absolute source/candidate terms; perspective is projected\n // at pickup time using the claiming user's id.\n traceEmitter?.({ type: \"agent_end\", name: agentName, durationMs: Date.now() - agentStart, summary: \"waiting_for_agent\" });\n await database.setTaskTurnContext(state.taskId, {\n sourceUser: state.sourceUser,\n candidateUser: state.candidateUser,\n indexContext: state.indexContext,\n seedAssessment: state.seedAssessment,\n // Keep discoveryQuery speaker-scoped: include it only when the\n // parked turn belongs to the discoverer (source). Persisting it on\n // candidate-side turns would make the pickup prompt frame the\n // search as \"your user searched for X\" for the wrong user.\n ...(isSource && state.discoveryQuery && { discoveryQuery: state.discoveryQuery }),\n ...(state.privateConsultation && state.privateConsultation.recipientUserId === ownUser.id\n ? { privateConsultation: state.privateConsultation }\n : {}),\n }, state.continuationExecution);\n await database.updateTaskState(state.taskId, \"waiting_for_agent\", undefined, state.continuationExecution);\n return { status: 'waiting_for_agent' as const };\n } else {\n // No personal agent or timeout — run system agent\n turn = await systemAgent.invoke({\n ownUser,\n otherUser,\n indexContext: state.indexContext,\n seedAssessment: state.seedAssessment,\n history,\n isFinalTurn,\n isDiscoverer: isSource,\n seat,\n protocolVersion: version,\n ...(state.discoveryQuery && isSource && { discoveryQuery: state.discoveryQuery }),\n isContinuation: state.isContinuation,\n ...(attributedPrior && { priorDialogue: attributedPrior }),\n ...(state.userAnswers.length > 0 && { userAnswers: state.userAnswers }),\n ...(askUserAvailable && { canAskUser: true }),\n ...(bargainingMode && { bargaining: { consecutiveNonConvergent: deadlock!.consecutiveNonConvergent } }),\n ...(ownMemory.length > 0 && { memory: ownMemory }),\n ...(state.privateConsultation?.recipientUserId === ownUser.id\n ? { privateConsultation: state.privateConsultation }\n : {}),\n });\n }\n\n traceEmitter?.({ type: \"agent_end\", name: agentName, durationMs: Date.now() - agentStart, summary: `${turn.action}` });\n\n // First turn must open the negotiation (unless continuing a prior\n // conversation): v1 → \"propose\"; v2 initiator → \"outreach\". A v2 turn-0\n // speaker holding the counterparty seat (tie-break inheritance) is left\n // unforced — it is responding, not opening.\n if (state.turnCount === 0 && !state.isContinuation) {\n const openingAction = version === 'v2' ? 'outreach' : 'propose';\n if ((version !== 'v2' || seat === 'initiator') && turn.action !== openingAction) {\n turnLog.warn(`Agent returned unexpected action on turn 0, forcing to ${openingAction}`, { action: turn.action });\n turn.action = openingAction;\n }\n }\n\n // IND-508 deterministic admission is evaluated only after the opening\n // guard but before any turn is persisted. It consumes action/role enums\n // only; free-form reasoning, messages, profiles, and evaluator inputs\n // are intentionally unavailable to the policy.\n let consultationPolicyReason: NegotiationConsultationReason | undefined;\n const policyEligibility = policyMode === 'off' ? { eligible: false } : assessConsultationEligibility({\n protocolVersion: version,\n seat,\n isOpeningTurn: state.turnCount === 0 && !state.isContinuation,\n isFinalTurn,\n screenedOut: isScreenBlocked(state),\n action: turn.action,\n ownSuggestedRole: turn.assessment?.suggestedRoles?.ownUser,\n priorActions: history.map((prior) => prior.action),\n previouslyConsulted: hasPriorAskUser(state.messages, ownUser.id),\n hasExactResumeCoordinate: Boolean(\n configuredAskUserEnabled()\n && questionerEnqueue\n && timeoutQueue?.enqueueAskUserExpiry\n && state.taskId\n && state.opportunityId\n && ownIntentId\n && state.indexContext.networkId,\n ),\n lifecycleValid: Boolean(state.taskId && state.opportunityId && ownIntentId && state.indexContext.networkId),\n });\n const emitConsultationTelemetry = (stage: 'eligible' | 'asked', reason: NegotiationConsultationReason) => {\n turnLog.info('negotiation_consultation_policy', { stage, mode: policyMode, reason });\n emitWide({ type: 'negotiation_consultation_policy', stage, mode: policyMode, reason });\n };\n if (policyEligibility.eligible && policyEligibility.reason) {\n emitConsultationTelemetry('eligible', policyEligibility.reason);\n if (policyMode === 'on') {\n consultationPolicyReason = policyEligibility.reason;\n turn = {\n ...turn,\n action: 'ask_user',\n message: null,\n assessment: {\n reasoning: 'Client consultation required.',\n suggestedRoles: turn.assessment.suggestedRoles,\n },\n askUser: consultationPromptFor(consultationPolicyReason),\n };\n emitConsultationTelemetry('asked', consultationPolicyReason);\n }\n }\n\n // Safety net: off/shadow retain legacy behavior. In on, a spontaneous\n // ask_user is admissible only when the deterministic policy just\n // authorized it, so no unbounded pause can enter shared history.\n if (turn.action === 'ask_user' && (!askUserAvailable || (policyMode === 'on' && !consultationPolicyReason))) {\n turnLog.warn('ask_user emitted while unavailable, coercing to conservative fallback', {\n seat, isFinalTurn, taskId: state.taskId,\n });\n turn = { ...turn, action: fallbackActionFor(version, seat, isFinalTurn) };\n }\n\n // ─── Deadlock shift record (IND-428) ───────────────────────────────\n // Applied-stance analytics: recorded once per session, on the first\n // turn actually drafted in the bargaining stance (the system agent —\n // externally dispatched turns never receive the stance). Internal\n // metadata only: persisted to tasks.metadata.deadlockShift via the\n // optional hook; negotiation API surfaces project specific fields and\n // never return task metadata verbatim. Every step fails open.\n const bargainingApplied = bargainingMode && !dispatchResult.handled;\n let deadlockShiftRecord: DeadlockShiftRecord | null = null;\n if (bargainingApplied && !state.deadlockShift) {\n deadlockShiftRecord = {\n reason: 'consecutive_non_convergent',\n consecutiveNonConvergent: deadlock!.consecutiveNonConvergent,\n threshold: deadlock!.threshold,\n shiftedAtTurn: state.turnCount,\n seat,\n detectedAt: new Date().toISOString(),\n };\n await database.setTaskDeadlockShift?.(state.taskId, deadlockShiftRecord as unknown as Record<string, unknown>, state.continuationExecution).catch((err) => {\n turnLog.error('Failed to persist deadlock shift record', { taskId: state.taskId, error: err });\n });\n turnLog.info('negotiation_deadlock_shift', {\n taskId: state.taskId,\n opportunityId: state.opportunityId || undefined,\n seat,\n consecutiveNonConvergent: deadlockShiftRecord.consecutiveNonConvergent,\n threshold: deadlockShiftRecord.threshold,\n turnIndex: state.turnCount,\n });\n if (state.opportunityId) {\n emitWide({\n type: 'negotiation_deadlock_shift',\n opportunityId: state.opportunityId,\n negotiationConversationId: state.conversationId,\n turnIndex: state.turnCount,\n actor: isSource ? 'source' : 'candidate',\n consecutiveNonConvergent: deadlockShiftRecord.consecutiveNonConvergent,\n threshold: deadlockShiftRecord.threshold,\n });\n }\n }\n\n // ─── IND-564: `withdraw` requires a prior in-task outreach ────────────\n // `withdraw` semantically retracts an outreach the initiator made. In a\n // continuation whose first initiator move is `withdraw` (or any withdraw\n // before this task opened outreach), there is nothing to retract —\n // persisting it would drop a spurious \"connection withdrawn\" message\n // into the shared dm_pair thread as if an accepted connection were\n // pulled. Seeded prior-task turns (state.messages) do NOT count as an\n // in-task outreach. Map it to the quiet screen-out outcome instead: no\n // message persisted, turnCount unchanged, opportunity quietly rejected\n // in finalize. This is the backstop for whatever the screen gate (IND-\n // 563) does not catch (screen off/shadow, or a fail-open reach_out).\n //\n // Exact ask_user resumes (continuationExecution) are exempt: the\n // successor task is the SAME logical negotiation resumed after the\n // client answered, so a post-consultation `withdraw` is a legitimate\n // terminal decision, not an opening move.\n if (turn.action === 'withdraw' && !state.outreachOpened && !state.continuationExecution) {\n turnLog.info('negotiation_opening_withdraw_screened_out', {\n taskId: state.taskId,\n opportunityId: state.opportunityId || undefined,\n seat,\n turnCount: state.turnCount,\n isContinuation: state.isContinuation,\n });\n traceEmitter?.({ type: \"agent_end\", name: agentName, durationMs: Date.now() - agentStart, summary: \"screened_out: opening withdraw\" });\n return { lastTurn: turn, firstTurnScreenedOut: true };\n }\n\n const parts = [{ kind: \"data\" as const, data: turn }];\n const message = await database.createMessage({\n conversationId: state.conversationId,\n senderId: `agent:${ownUser.id}`,\n role: \"agent\",\n parts,\n taskId: state.taskId,\n ...(state.continuationExecution ? { continuationExecution: state.continuationExecution } : {}),\n });\n\n // ─── ask_user pause (P3.2) ────────────────────────────────────────────\n // The negotiator consults its OWN client: persist the turn (done above),\n // park the full turn context, arm the answer-window timer, enqueue the\n // question through the negotiation_inflight preset, then suspend the\n // task as input_required. The graph exits at this turn boundary exactly\n // like the waiting_for_agent suspend; the answer (or window expiry)\n // resumes via the run-existing continuation path.\n if (turn.action === 'ask_user') {\n const counterparty = isSource ? state.candidateUser : state.sourceUser;\n const safeAskUser = validateInflightAskUserFields({\n disclosureSubject: turn.askUser?.disclosureSubject,\n draftQuestion: turn.askUser?.draftQuestion,\n forbiddenIdentifiers: [\n counterparty.id,\n counterparty.profile.name ?? '',\n state.opportunityId,\n state.taskId,\n state.indexContext.networkId,\n isSource ? state.candidateIntentId ?? '' : state.sourceIntentId ?? '',\n ],\n forbiddenSourceText: [\n counterparty.profile.bio ?? '',\n counterparty.profile.location ?? '',\n ...counterparty.intents.flatMap((intent) => [intent.title, intent.description]),\n state.seedAssessment.reasoning,\n state.indexContext.prompt,\n state.discoveryQuery ?? '',\n ],\n });\n const settlementId = negotiationQuestionSettlementId(state.taskId);\n\n const askUserBinding = await database.captureNegotiationAskUserBinding({\n taskId: state.taskId,\n settlementId,\n recipientUserId: ownUser.id,\n recipientIntentId: ownIntentId!,\n opportunityId: state.opportunityId,\n networkId: state.indexContext.networkId,\n turnContext: {\n sourceUser: state.sourceUser,\n candidateUser: state.candidateUser,\n indexContext: state.indexContext,\n seedAssessment: state.seedAssessment,\n ...(isSource && state.discoveryQuery && { discoveryQuery: state.discoveryQuery }),\n ...(consultationPolicyReason && { consultationPolicyReason }),\n },\n ...(state.continuationExecution ? { continuationExecution: state.continuationExecution } : {}),\n });\n\n // Arm the timer BEFORE flipping state: it is the durable recovery\n // trigger even when generation enqueues no job or persists no row.\n const windowMs = askUserAnswerWindowMs();\n await timeoutQueue!.enqueueAskUserExpiry!(state.taskId, {\n settlementId,\n opportunityId: state.opportunityId,\n userId: ownUser.id,\n recipientIntentId: ownIntentId!,\n networkId: state.indexContext.networkId,\n intentFingerprint: askUserBinding.intentFingerprint,\n opportunityStatus: askUserBinding.opportunityStatus,\n opportunityUpdatedAt: askUserBinding.opportunityUpdatedAt,\n counterpartyUserId: askUserBinding.counterpartyUserId,\n counterpartyIntentId: askUserBinding.counterpartyIntentId,\n }, windowMs);\n\n // Persistence admission requires the exact task to be input_required.\n // Flip before enqueue; if the structured ask_user fields fail the\n // deterministic privacy gate, the timer alone closes the exact task.\n await database.updateTaskState(state.taskId, 'input_required', undefined, state.continuationExecution);\n if (safeAskUser) {\n const userContext = (await database.getUserContext(ownUser.id, null).catch(() => null))?.text ?? '';\n await questionerEnqueue!({\n mode: 'negotiation_inflight',\n purpose: 'inflight_consultation',\n userId: ownUser.id,\n sourceType: 'opportunity',\n sourceId: state.opportunityId,\n negotiation: {\n purpose: 'inflight_consultation',\n recipientUserId: ownUser.id,\n recipientIntentId: ownIntentId!,\n opportunityId: state.opportunityId,\n taskId: state.taskId,\n networkId: state.indexContext.networkId,\n },\n context: {\n negotiationId: state.taskId,\n counterpartyHint: NEGOTIATION_QUESTION_GENERIC_COUNTERPARTY,\n disclosureSubject: safeAskUser.disclosureSubject,\n ...(safeAskUser.draftQuestion && { draftQuestion: safeAskUser.draftQuestion }),\n indexContext: NEGOTIATION_QUESTION_GENERIC_NETWORK,\n ...(consultationPolicyReason && { consultationPolicyReason }),\n ...(userContext && { userContext }),\n },\n }).catch((error) => {\n turnLog.error('Failed to enqueue safe ask_user question; timeout recovery remains armed', {\n taskId: state.taskId,\n opportunityId: state.opportunityId,\n error,\n });\n });\n } else {\n turnLog.warn('Skipping unsafe or incomplete ask_user question generation', {\n taskId: state.taskId,\n opportunityId: state.opportunityId,\n });\n }\n\n turnLog.info('negotiation_ask_user_pause', {\n taskId: state.taskId,\n opportunityId: state.opportunityId,\n seat,\n askingUserId: ownUser.id,\n windowMs,\n });\n traceEmitter?.({ type: \"agent_end\", name: agentName, durationMs: Date.now() - agentStart, summary: \"ask_user\" });\n emitWide({\n type: 'negotiation_ask_user',\n opportunityId: state.opportunityId,\n negotiationConversationId: state.conversationId,\n turnIndex: state.turnCount,\n actor: isSource ? 'source' : 'candidate',\n questionGenerationSafe: Boolean(safeAskUser),\n windowMs,\n });\n\n return {\n messages: [{\n id: message.id,\n senderId: message.senderId,\n role: \"agent\" as const,\n parts: message.parts,\n createdAt: message.createdAt,\n taskId: state.taskId,\n }],\n turnCount: state.turnCount + 1,\n lastTurn: turn,\n status: 'input_required' as const,\n ...(deadlockShiftRecord && { deadlockShift: deadlockShiftRecord }),\n };\n }\n\n await database.updateTaskState(state.taskId, \"working\", undefined, state.continuationExecution);\n\n if (state.opportunityId) {\n emitWide({\n type: \"negotiation_turn\",\n opportunityId: state.opportunityId,\n negotiationConversationId: state.conversationId,\n turnIndex: state.turnCount,\n actor: isSource ? \"source\" : \"candidate\",\n action: turn.action,\n ...(turn.assessment?.reasoning && { reasoning: turn.assessment.reasoning }),\n ...(turn.message && { message: turn.message }),\n ...(turn.assessment?.suggestedRoles && { suggestedRoles: turn.assessment.suggestedRoles }),\n durationMs: Date.now() - agentStart,\n });\n }\n\n return {\n messages: [{\n id: message.id,\n senderId: message.senderId,\n role: \"agent\" as const,\n parts: message.parts,\n createdAt: message.createdAt,\n taskId: state.taskId,\n }],\n turnCount: state.turnCount + 1,\n currentSpeaker: (isSource ? \"candidate\" : \"source\") as \"source\" | \"candidate\",\n lastTurn: turn,\n memoryBySide: { [ownSide]: ownMemory },\n // Record the in-task outreach so a later `withdraw` is legal (IND-564).\n ...(turn.action === 'outreach' && { outreachOpened: true }),\n ...(deadlockShiftRecord && { deadlockShift: deadlockShiftRecord }),\n };\n } catch (err) {\n const errMsg = err instanceof Error ? err.message : String(err);\n turnLog.error(\"Agent invocation failed\", { error: errMsg, stack: err instanceof Error ? err.stack : undefined, turnCount: state.turnCount });\n traceEmitter?.({ type: \"agent_end\", name: agentName, durationMs: Date.now() - agentStart, summary: `error: ${errMsg}` });\n const errorSeat: NegotiationSeat = (state.currentSpeaker === 'source' ? state.sourceUser.id : state.candidateUser.id) === (state.initiatorUserId ?? state.sourceUser.id)\n ? 'initiator'\n : 'counterparty';\n return {\n lastTurn: {\n action: rejectActionFor(state.protocolVersion ?? 'v1', errorSeat),\n assessment: { reasoning: `Agent error: ${errMsg}`, suggestedRoles: { ownUser: \"peer\" as const, otherUser: \"peer\" as const } },\n },\n turnCount: state.turnCount + 1,\n error: `Turn failed: ${errMsg}`,\n };\n }\n };\n\n const evaluateNode = (state: typeof NegotiationGraphState.State): string => {\n if (state.status === 'waiting_for_agent') return \"finalize\";\n if (state.status === 'input_required') return \"finalize\";\n if (state.error) return \"finalize\";\n if (!state.lastTurn) return \"finalize\";\n // Terminal actions: accept (v1+v2), reject (v1), withdraw/decline (v2)\n if (isTerminalAction(state.lastTurn.action)) return \"finalize\";\n // question routes same as counter — next turn\n if ((state.maxTurns ?? 0) > 0 && state.turnCount >= state.maxTurns!) return \"finalize\";\n return \"turn\";\n };\n\n const finalizeNode = async (state: typeof NegotiationGraphState.State) => {\n const traceEmitter = requestContext.getStore()?.traceEmitter;\n const emitWide = (event: Record<string, unknown>) =>\n (traceEmitter as ((e: Record<string, unknown>) => void) | undefined)?.(event);\n\n const pauseReceipt = (outcome: 'waiting_for_agent' | 'input_required'): { continuationReceipt: NegotiationContinuationReceipt } | undefined =>\n state.continuationExecution\n ? {\n continuationReceipt: {\n priorTaskId: state.continuationExecution.taskId,\n settlementId: state.continuationExecution.settlementId,\n successorTaskId: state.continuationExecution.successorTaskId,\n fence: state.continuationExecution.fence,\n outcome,\n },\n }\n : undefined;\n\n if (state.status === 'waiting_for_agent') {\n if (state.opportunityId) {\n emitWide({\n type: \"negotiation_outcome\",\n opportunityId: state.opportunityId,\n outcome: \"waiting_for_agent\",\n turnCount: state.turnCount,\n isContinuation: state.isContinuation,\n });\n }\n return pauseReceipt('waiting_for_agent') ?? {};\n }\n\n // ask_user pause: no outcome, no completed state — the task stays\n // input_required until the client answers or the window expires.\n if (state.status === 'input_required') {\n if (state.opportunityId) {\n emitWide({\n type: \"negotiation_outcome\",\n opportunityId: state.opportunityId,\n outcome: \"input_required\",\n turnCount: state.turnCount,\n isContinuation: state.isContinuation,\n });\n }\n return pauseReceipt('input_required') ?? {};\n }\n\n // Init can fail closed before an attempt owns a task. Such a rejection is\n // not a completed negotiation and must not write through an empty task ID,\n // create an artifact, or advance the opportunity lifecycle.\n if (!state.taskId) {\n finalizeLog.info('Skipping outcome persistence because no negotiation task was claimed', {\n opportunityId: state.opportunityId || undefined,\n error: state.error || undefined,\n });\n return {};\n }\n\n const history: NegotiationTurn[] = turnsFromMessages(state.messages);\n\n const lastTurn = state.lastTurn;\n const hasOpportunity = lastTurn?.action === \"accept\";\n // P2.2: the client's own outreach gate declined before any turn — the\n // negotiation never happened from the counterparty's perspective.\n // IND-564: an opening-move `withdraw` blocked before any message was\n // persisted is the same quiet screen-out outcome (no in-task outreach to\n // retract), reached from the turn node rather than the screen node.\n const screenedOut = isScreenBlocked(state) || state.firstTurnScreenedOut === true;\n const atCap = !screenedOut && (state.maxTurns ?? 0) > 0 && state.turnCount >= state.maxTurns! && !isTerminalAction(lastTurn?.action);\n\n let agreedRoles: NegotiationOutcome[\"agreedRoles\"] = [];\n if (hasOpportunity && history.length >= 2) {\n const acceptTurn = history[history.length - 1];\n const precedingTurn = history[history.length - 2];\n const accepterIsSource = state.currentSpeaker === \"candidate\";\n const [sourceRole, candidateRole] = accepterIsSource\n ? [acceptTurn.assessment.suggestedRoles.ownUser, precedingTurn.assessment.suggestedRoles.ownUser]\n : [precedingTurn.assessment.suggestedRoles.ownUser, acceptTurn.assessment.suggestedRoles.ownUser];\n agreedRoles = [\n { userId: state.sourceUser.id, role: sourceRole },\n { userId: state.candidateUser.id, role: candidateRole },\n ];\n }\n\n const outcome: NegotiationOutcome = {\n hasOpportunity,\n agreedRoles,\n reasoning: screenedOut\n ? (state.screenDecision?.reasoning ?? lastTurn?.assessment?.reasoning ?? \"\")\n : (lastTurn?.assessment.reasoning ?? \"\"),\n turnCount: state.turnCount,\n ...(screenedOut\n ? { reason: \"screened_out\" as const }\n : atCap\n ? { reason: \"turn_cap\" as const }\n : {}),\n };\n\n try {\n await database.updateTaskState(state.taskId, \"completed\", undefined, state.continuationExecution);\n await database.createArtifact({\n taskId: state.taskId,\n name: \"negotiation-outcome\",\n parts: [{ kind: \"data\", data: outcome }],\n metadata: {\n hasOpportunity,\n turnCount: state.turnCount,\n ...(state.continuationExecution ? {\n continuationOutcome: hasOpportunity\n ? 'accepted'\n : (screenedOut || isRejectLikeAction(lastTurn?.action)) ? 'rejected' : 'stalled',\n } : {}),\n },\n ...(state.continuationExecution ? { continuationExecution: state.continuationExecution } : {}),\n });\n\n finalizeLog.info('Session complete', {\n conversationId: state.conversationId,\n taskId: state.taskId,\n isContinuation: state.isContinuation,\n turnsAdded: state.turnCount,\n priorTurnCount: state.priorTurnCount,\n outcome: hasOpportunity ? 'accepted' : screenedOut ? 'screened_out' : (atCap ? 'turn_cap' : (lastTurn?.action ?? 'unknown')),\n opportunityId: state.opportunityId || undefined,\n });\n\n if (state.opportunityId) {\n // screened_out → 'rejected': quiet terminal status (hidden from\n // default lists), never 'stalled' — with zero turns the generic\n // mapping would misfile the client's own gate decision.\n const nextStatus = lastTurn?.action === 'accept'\n ? 'pending'\n : (screenedOut || isRejectLikeAction(lastTurn?.action))\n ? 'rejected'\n : 'stalled';\n await database.updateOpportunityStatus(state.opportunityId, nextStatus, undefined, state.continuationExecution).catch((err) => {\n finalizeLog.error(\"Failed to update opportunity status\", { opportunityId: state.opportunityId, nextStatus, error: err });\n });\n }\n } catch (err) {\n finalizeLog.error(\"Failed to persist outcome\", { error: err });\n }\n\n if (state.opportunityId) {\n const emittedOutcome: \"accepted\" | \"rejected_stalled\" | \"turn_cap\" | \"timed_out\" | \"screened_out\" =\n hasOpportunity\n ? \"accepted\"\n : screenedOut\n ? \"screened_out\"\n : atCap\n ? \"turn_cap\"\n : state.error && /timeout/i.test(state.error)\n ? \"timed_out\"\n : \"rejected_stalled\";\n\n emitWide({\n type: \"negotiation_outcome\",\n opportunityId: state.opportunityId,\n outcome: emittedOutcome,\n turnCount: state.turnCount,\n isContinuation: state.isContinuation,\n turnsAdded: state.turnCount,\n priorTurnCount: state.priorTurnCount,\n ...(outcome.reasoning && { reasoning: outcome.reasoning }),\n ...(hasOpportunity && agreedRoles.length >= 2 && {\n agreedRoles: {\n ownUser: agreedRoles[0]?.role,\n otherUser: agreedRoles[1]?.role,\n },\n }),\n });\n }\n\n if (state.consultationPolicyReason) {\n // Stable, content-free terminal funnel telemetry. This executes only\n // after a fenced continuation has reached its terminal outcome.\n finalizeLog.info('negotiation_consultation_policy', {\n stage: 'terminal_outcome',\n reason: state.consultationPolicyReason,\n outcome: hasOpportunity ? 'accepted' : (screenedOut || isRejectLikeAction(lastTurn?.action)) ? 'rejected' : 'stalled',\n });\n emitWide({\n type: 'negotiation_consultation_policy',\n stage: 'terminal_outcome',\n reason: state.consultationPolicyReason,\n outcome: hasOpportunity ? 'accepted' : (screenedOut || isRejectLikeAction(lastTurn?.action)) ? 'rejected' : 'stalled',\n });\n }\n\n // Enqueue post-negotiation reflection (P5.2 memory write path) — fire\n // and forget: a reflection failure must never affect the outcome. Only\n // sessions that actually exchanged turns teach anything; init/turn\n // errors with turnCount 0 are skipped.\n if (reflectEnqueue && state.turnCount > 0 && !state.continuationExecution) {\n reflectEnqueue({\n negotiationId: state.taskId,\n conversationId: state.conversationId,\n ...(state.opportunityId && { opportunityId: state.opportunityId }),\n sourceUser: {\n id: state.sourceUser.id,\n ...(state.sourceUser.profile.name && { name: state.sourceUser.profile.name }),\n ...(state.sourceUser.profile.bio && { bio: state.sourceUser.profile.bio }),\n },\n candidateUser: {\n id: state.candidateUser.id,\n ...(state.candidateUser.profile.name && { name: state.candidateUser.profile.name }),\n ...(state.candidateUser.profile.bio && { bio: state.candidateUser.profile.bio }),\n },\n initiatorUserId: state.initiatorUserId ?? state.sourceUser.id,\n outcome: { hasOpportunity, reasoning: outcome.reasoning, turnCount: state.turnCount },\n }).catch((err) =>\n finalizeLog.error('Failed to enqueue negotiation reflection', {\n taskId: state.taskId,\n error: err,\n })\n );\n }\n\n // Enqueue question generation for stalled/capped negotiations (not accepted or explicitly rejected).\n // Require turnCount > 0 so early init/turn errors don't enqueue with empty context.\n if (!hasOpportunity && !isRejectLikeAction(lastTurn?.action) && state.turnCount > 0 && state.opportunityId && state.sourceIntentId && state.indexContext.networkId && questionerEnqueue && !state.continuationExecution) {\n const stallReason: 'turn_cap' | 'timeout' | 'stalled' = atCap\n ? 'turn_cap'\n : (state.error && /timeout/i.test(state.error))\n ? 'timeout'\n : 'stalled';\n\n const userContext = (await database.getUserContext(state.sourceUser.id, null))?.text ?? '';\n const sourceIntent = state.sourceUser.intents.find((intent) => intent.id === state.sourceIntentId);\n questionerEnqueue({\n mode: 'negotiation',\n purpose: 'stalled_followup',\n userId: state.sourceUser.id,\n sourceType: 'opportunity',\n sourceId: state.opportunityId,\n negotiation: {\n purpose: 'stalled_followup',\n recipientUserId: state.sourceUser.id,\n recipientIntentId: state.sourceIntentId,\n opportunityId: state.opportunityId,\n taskId: state.taskId,\n networkId: state.indexContext.networkId,\n },\n context: {\n negotiationId: state.taskId,\n counterpartyHint: NEGOTIATION_QUESTION_GENERIC_COUNTERPARTY,\n indexContext: NEGOTIATION_QUESTION_GENERIC_NETWORK,\n outcomeReason: stallReason,\n recipientIntent: sourceIntent\n ? `${sourceIntent.title}: ${sourceIntent.description}`\n : 'the signal attached to this match',\n userContext,\n },\n }).catch((err) =>\n finalizeLog.error('Failed to enqueue negotiation question generation', {\n opportunityId: state.opportunityId,\n error: err,\n })\n );\n }\n\n const terminalReceipt: { continuationReceipt: NegotiationContinuationReceipt } | undefined = state.continuationExecution\n ? {\n continuationReceipt: {\n priorTaskId: state.continuationExecution.taskId,\n settlementId: state.continuationExecution.settlementId,\n successorTaskId: state.continuationExecution.successorTaskId,\n fence: state.continuationExecution.fence,\n outcome: hasOpportunity\n ? 'accepted'\n : (screenedOut || isRejectLikeAction(lastTurn?.action)) ? 'rejected' : 'stalled',\n },\n }\n : undefined;\n\n return { outcome, status: 'completed' as const, ...terminalReceipt };\n };\n\n const workflow = new StateGraph(NegotiationGraphState)\n .addNode(\"init\", initNode)\n .addNode(\"screen\", screenNode)\n .addNode(\"turn\", turnNode)\n .addNode(\"finalize\", finalizeNode)\n .addConditionalEdges(\"turn\", evaluateNode, {\n turn: \"turn\",\n finalize: \"finalize\",\n })\n .addConditionalEdges(\"init\", (state: typeof NegotiationGraphState.State) => {\n if (state.error) return \"finalize\";\n // Screen gate (P2.1). Runs on fresh negotiations AND regular\n // continuations (IND-563): a new opportunity/intent reusing an existing\n // conversation must still pass the outreach gate before entering the\n // shared thread — a bad continuation match should be quietly screened\n // out, never dropped into the dm_pair. Exact ask_user resumes\n // (continuationExecution) are mid-flight and must never be re-screened.\n // `off` disables the node entirely.\n if (configuredScreenMode() !== \"off\" && !state.continuationExecution) return \"screen\";\n return \"turn\";\n }, { screen: \"screen\", turn: \"turn\", finalize: \"finalize\" })\n // P2.2: enforce-mode pass → finalize (screened_out); everything else → turn.\n .addConditionalEdges(\"screen\", (state: typeof NegotiationGraphState.State) =>\n isScreenBlocked(state) ? \"finalize\" : \"turn\",\n { turn: \"turn\", finalize: \"finalize\" })\n .addEdge(\"__start__\", \"init\")\n .addEdge(\"finalize\", \"__end__\");\n\n return workflow.compile();\n }\n}\n\nexport interface NegotiationCandidate {\n userId: string;\n /** Exact opportunity-bound source and candidate intent IDs. */\n sourceIntentId?: string;\n candidateIntentId?: string;\n reasoning: string;\n valencyRole: string;\n networkId?: string;\n candidateUser: UserNegotiationContext;\n /** The explicit search query that triggered discovery (if any). */\n discoveryQuery?: string;\n /**\n * ID of the opportunity this negotiation is for. When set, the negotiation\n * graph's finalize node updates the opportunity's status based on the outcome\n * (`accept` → 'pending', `reject` → 'rejected', otherwise → 'stalled').\n */\n opportunityId?: string;\n /** Exact persisted lifecycle state claimed by this negotiation attempt. */\n opportunityStatus?: OpportunityStatus;\n opportunityUpdatedAt?: Date;\n}\n\nexport interface NegotiationResult {\n userId: string;\n agreedRoles: NegotiationOutcome[\"agreedRoles\"];\n reasoning: string;\n turnCount: number;\n}\n\n/**\n * Per-candidate resolution hook — fires as each negotiation settles, before\n * Promise.all aggregates. Used by the orchestrator branch to progressively\n * stream `opportunity_draft_ready` events as each candidate resolves, rather\n * than emitting all at once after the full fan-out completes. Awaited so the\n * caller can run async work (DB update, event emit) before the next settle.\n *\n * `turns` and `outcome` are passed through from the underlying negotiation\n * graph so consumers can build per-candidate decision-question inputs without\n * re-walking trace events or DB artifacts. Both are present on every\n * resolution (accepted, rejected, stalled, error); error paths receive a\n * synthesized `outcome` with `hasOpportunity: false`.\n */\nexport type OnNegotiationResolved = (entry: {\n candidate: NegotiationCandidate;\n accepted: NegotiationResult | null;\n turns: NegotiationTurn[];\n outcome: NegotiationOutcome;\n continuationReceipt?: import('../shared/interfaces/database.interface.js').NegotiationContinuationReceipt;\n}) => Promise<void>;\n\n/**\n * Runs bilateral negotiation for each candidate in parallel.\n * @returns Only candidates that produced an opportunity\n */\nexport async function negotiateCandidates(\n negotiationGraph: NegotiationGraphLike,\n sourceUser: UserNegotiationContext,\n candidates: NegotiationCandidate[],\n indexContext: { networkId: string; prompt: string },\n opts?: {\n maxTurns?: number;\n traceEmitter?: TraceEmitter;\n indexContextOverrides?: Map<string, string>;\n timeoutMs?: number;\n onCandidateResolved?: OnNegotiationResolved;\n trigger?: \"orchestrator\" | \"ambient\";\n /**\n * Initiator seat for every candidate session in this fan-out (v2 stamp).\n * Passed through to the negotiation graph, which may still override it by\n * inheriting from a prior task on the same opportunity/conversation.\n */\n initiatorUserId?: string;\n /** Exact settled task to resume; only the durable run-existing path sets this. */\n resumeFromTaskId?: string;\n /** Deterministic settlement key paired with resumeFromTaskId. */\n continuationSettlementId?: string;\n /** Current durable lease/fence for this exact continuation successor. */\n continuationExecution?: import('../shared/interfaces/database.interface.js').NegotiationContinuationExecution;\n },\n): Promise<NegotiationResult[]> {\n const {\n maxTurns,\n traceEmitter,\n indexContextOverrides,\n timeoutMs,\n onCandidateResolved,\n trigger,\n initiatorUserId,\n resumeFromTaskId,\n continuationSettlementId,\n continuationExecution,\n } = opts ?? {};\n\n // Local helper to emit events whose shape is wider than the declared\n // `TraceEmitter` union (mirrors the cast used in chat.agent at the relay sink\n // and inside turn/finalize nodes above).\n const emitWide = (event: Record<string, unknown>) =>\n (traceEmitter as ((e: Record<string, unknown>) => void) | undefined)?.(event);\n\n const results = await Promise.all(\n candidates.map(async (candidate) => {\n const start = Date.now();\n if (candidate.opportunityId) {\n const candidateName = candidate.candidateUser?.profile?.name;\n emitWide({\n type: \"negotiation_session_start\",\n opportunityId: candidate.opportunityId,\n negotiationConversationId: \"\", // filled in on session_end\n sourceUserId: sourceUser.id,\n candidateUserId: candidate.userId,\n initiatorUserId: initiatorUserId ?? sourceUser.id,\n ...(candidateName && { candidateName }),\n trigger: trigger ?? \"ambient\",\n startedAt: start,\n });\n }\n traceEmitter?.({ type: \"agent_start\", name: \"Negotiating candidate\" });\n\n try {\n const candidateIndexContext = candidate.networkId\n ? { networkId: candidate.networkId, prompt: indexContextOverrides?.get(candidate.networkId) ?? '' }\n : indexContext;\n\n const result = await invokeWithAbortSignal(negotiationGraph, {\n sourceUser,\n candidateUser: candidate.candidateUser,\n ...(candidate.sourceIntentId && { sourceIntentId: candidate.sourceIntentId }),\n ...(candidate.candidateIntentId && { candidateIntentId: candidate.candidateIntentId }),\n indexContext: candidateIndexContext,\n seedAssessment: {\n reasoning: candidate.reasoning,\n valencyRole: candidate.valencyRole,\n },\n ...(candidate.discoveryQuery && { discoveryQuery: candidate.discoveryQuery }),\n ...(candidate.opportunityId && { opportunityId: candidate.opportunityId }),\n ...(candidate.opportunityStatus && { opportunityStatus: candidate.opportunityStatus }),\n ...(candidate.opportunityUpdatedAt && { opportunityUpdatedAt: candidate.opportunityUpdatedAt }),\n ...(initiatorUserId && { initiatorUserId }),\n ...(resumeFromTaskId && continuationSettlementId && continuationExecution ? {\n resumeFromTaskId,\n continuationSettlementId,\n continuationExecution,\n } : {}),\n ...(maxTurns !== undefined && { maxTurns }),\n ...(timeoutMs !== undefined && { timeoutMs }),\n });\n\n const durationMs = Date.now() - start;\n const outcome = result.outcome;\n const hasOpportunity = outcome?.hasOpportunity === true;\n const isContinuation = (result as { isContinuation?: boolean }).isContinuation ?? false;\n const priorTurnCount = (result as { priorTurnCount?: number }).priorTurnCount ?? 0;\n\n const turnFlow = (result.messages ?? [])\n .map((m) => {\n const dataPart = (m.parts as Array<{ kind?: string; data?: Record<string, unknown> }>)?.find((p) => p.kind === \"data\");\n if (!dataPart?.data) return null;\n const turn = dataPart.data as { action?: string };\n return turn.action ?? \"unknown\";\n })\n .filter(Boolean)\n .join(\" → \");\n\n const statusTag = hasOpportunity ? \"✓ opportunity\" : \"✗ rejected\";\n traceEmitter?.({ type: \"agent_end\", name: \"Negotiating candidate\", durationMs, summary: `${candidate.userId}: ${turnFlow} ${statusTag}` });\n\n if (candidate.opportunityId) {\n emitWide({\n type: \"negotiation_session_end\",\n opportunityId: candidate.opportunityId,\n negotiationConversationId: (result as { conversationId?: string }).conversationId ?? \"\",\n durationMs: Date.now() - start,\n isContinuation,\n turnsAdded: outcome?.turnCount ?? 0,\n priorTurnCount,\n });\n }\n\n const accepted: NegotiationResult | null = hasOpportunity && outcome\n ? {\n userId: candidate.userId,\n agreedRoles: outcome.agreedRoles,\n reasoning: outcome.reasoning,\n turnCount: outcome.turnCount,\n }\n : null;\n\n if (onCandidateResolved) {\n const turnHistory: NegotiationTurn[] = turnsFromMessages(result.messages ?? []);\n const resolvedOutcome: NegotiationOutcome = result.outcome ?? {\n hasOpportunity: false,\n agreedRoles: [],\n reasoning: \"no outcome returned by negotiation graph\",\n turnCount: turnHistory.length,\n };\n try {\n await onCandidateResolved({\n candidate,\n accepted,\n turns: turnHistory,\n outcome: resolvedOutcome,\n ...(result.continuationReceipt ? { continuationReceipt: result.continuationReceipt } : {}),\n });\n } catch (hookErr) {\n // Hook failures must not sink the candidate result — the aggregate\n // return is still useful, and the orchestrator branch logs its own\n // failures inline.\n negotiateCandidatesLog.error(\"onCandidateResolved hook threw\", {\n candidateUserId: candidate.userId,\n error: hookErr,\n });\n }\n }\n\n return accepted;\n } catch (err) {\n const durationMs = Date.now() - start;\n traceEmitter?.({ type: \"agent_end\", name: \"Negotiating candidate\", durationMs, summary: `${candidate.userId}: error` });\n if (candidate.opportunityId) {\n emitWide({\n type: \"negotiation_session_end\",\n opportunityId: candidate.opportunityId,\n negotiationConversationId: \"\",\n durationMs: Date.now() - start,\n });\n }\n negotiateCandidatesLog.error(\"Negotiation failed\", { candidateUserId: candidate.userId, error: err });\n if (onCandidateResolved) {\n try {\n await onCandidateResolved({\n candidate,\n accepted: null,\n turns: [],\n outcome: {\n hasOpportunity: false,\n agreedRoles: [],\n reasoning: err instanceof Error ? err.message : String(err),\n turnCount: 0,\n },\n });\n } catch {\n // ignore hook failure on error path\n }\n }\n return null;\n }\n }),\n );\n\n return results.filter((r): r is NegotiationResult => r !== null);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"negotiation.memory.d.ts","sourceRoot":"/","sources":["negotiation/negotiation.memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAgBpE;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,+EAA+E;AAC/E,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,MAAM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C;IAEpC,MAAM,KAAK,GAAa;QACtB,EAAE;QACF,2BAA2B;QAC3B,yIAAyI;KAC1I,CAAC;IACF,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,KAAK,CAAC,IAAI,CAAC,MAAM,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC1F,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,sJAAsJ,CAAC,CAAC;IAEnK,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["import type { DistilledMemoryKind } from \"./negotiation.reflect.js\";\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// NEGOTIATOR MEMORY INJECTION (P5.3 — read path)\n// ═══════════════════════════════════════════════════════════════════════════════\n//\n// Pure prompt-side counterpart of the P5.2 write path: retrieved\n// `negotiator_memories` rows shape how the negotiator screens, argues, and\n// chats. Retrieval itself lives in services/api (the protocol package has no\n// DB access) and is injected via `NegotiatorMemoryRetrieveFn` — the same\n// composition-root pattern as `questionerEnqueue`/`reflectEnqueue`.\n//\n// Contract: when the entry list is empty (memory empty, flag off, retrieval\n// failed) every renderer returns the empty string, so prompts are\n// byte-identical to the pre-P5.3 build.\n\n/**\n * A single memory entry as injected into prompts. A projection of the\n * `negotiator_memories` row: content + kind + confidence only — ids,\n * embeddings, and provenance never enter the prompt.\n */\nexport interface NegotiatorMemoryEntry {\n kind: DistilledMemoryKind;\n content: string;\n /** Anti-poisoning weight (0..1); rendered so the model can weigh hints. */\n confidence?: number;\n}\n\n/** Where a retrieval is happening — lets the read service tune top-k/scope. */\nexport type NegotiatorMemoryScope = \"screen\" | \"turn\";\n\n/** Query the graph hands to the injected retrieval function. */\nexport interface NegotiatorMemoryQuery {\n /** The user whose negotiator's own memory is being retrieved. */\n userId: string;\n /** The other side of this negotiation (dossier subject). */\n counterpartyUserId: string;\n /** Free-text similarity query (seed reasoning + counterparty context). */\n queryText: string;\n scope: NegotiatorMemoryScope;\n}\n\n/**\n * Injected retrieval seam (services/api implements it over the\n * `negotiator_memories` store). MUST resolve to `[]` on any failure or when\n * `NEGOTIATOR_MEMORY_INJECT` is off — memory must never break a negotiation.\n */\nexport type NegotiatorMemoryRetrieveFn = (\n query: NegotiatorMemoryQuery,\n) => Promise<NegotiatorMemoryEntry[]>;\n\nconst KIND_LABELS: Record<DistilledMemoryKind, string> = {\n playbook: \"playbook\",\n disclosure_rule: \"disclosure rule\",\n counterparty_dossier: \"counterparty note\",\n threshold: \"threshold\",\n};\n\nfunction confidenceSuffix(entry: NegotiatorMemoryEntry): string {\n return typeof entry.confidence === \"number\"\n ? ` (confidence ${Math.round(entry.confidence * 100) / 100})`\n : \"\";\n}\n\nexport interface RenderNegotiatorMemoryOptions {\n /**\n * When true (screen node), instructs the model to reflect memory influence\n * into `evidence.memoryHints` — without copying sensitive text verbatim.\n */\n memoryHintsInstruction?: boolean;\n}\n\n/**\n * Renders the private negotiator-memory section for counterparty-facing\n * prompts (the negotiation turn agent and the screen gate).\n *\n * Disclosure rules are HARD constraints — never soft hints; everything else\n * is advisory, weighted by confidence. The section leads with the leak\n * guard: memory text must never reach counterparty-visible fields.\n *\n * @returns Empty string when there are no entries (byte-identical prompts).\n */\nexport function renderNegotiatorMemorySection(\n entries: NegotiatorMemoryEntry[],\n opts?: RenderNegotiatorMemoryOptions,\n): string {\n if (entries.length === 0) return \"\";\n\n const disclosureRules = entries.filter((e) => e.kind === \"disclosure_rule\");\n const advisory = entries.filter((e) => e.kind !== \"disclosure_rule\");\n\n const lines: string[] = [\n \"\",\n \"\",\n \"PRIVATE NEGOTIATOR MEMORY — for your reasoning only. Never quote, paraphrase, or reveal any of it to the counterparty, and never mention that these notes exist.\",\n ];\n\n if (disclosureRules.length > 0) {\n lines.push(\"HARD DISCLOSURE CONSTRAINTS (absolute — these override every other goal, including reaching a deal):\");\n for (const rule of disclosureRules) {\n lines.push(`- ${rule.content}`);\n }\n }\n\n if (advisory.length > 0) {\n lines.push(\"Advisory notes from prior negotiations and client conversations (weigh by confidence; the live context wins on conflict):\");\n for (const entry of advisory) {\n lines.push(`- [${KIND_LABELS[entry.kind]}] ${entry.content}${confidenceSuffix(entry)}`);\n }\n }\n\n if (opts?.memoryHintsInstruction) {\n lines.push(\"Set evidence.memoryHints to a short note on how these memories informed your decision — describe the influence, never copy sensitive contents verbatim.\");\n }\n\n return lines.join(\"\\n\");\n}\n\n/**\n * Renders the memory section for the negotiator CHAT persona — the audience\n * is the client themself, so disclosure rules are their own standing\n * instructions (context, not secrets), and the client's live word always\n * outranks a stored note.\n *\n * @returns Empty string when there are no entries (byte-identical prompts).\n */\nexport function renderNegotiatorChatMemorySection(entries: NegotiatorMemoryEntry[]): string {\n if (entries.length === 0) return \"\";\n\n const lines: string[] = [\n \"\",\n \"## Your negotiator memory\",\n \"Notes you have accumulated from negotiations and prior conversations with your client (private to the two of you; weigh by confidence):\",\n ];\n for (const entry of entries) {\n lines.push(`- [${KIND_LABELS[entry.kind]}] ${entry.content}${confidenceSuffix(entry)}`);\n }\n lines.push(\"Use these to inform reports and recommendations. If the client contradicts one, trust the client — their current word always outranks a stored note.\");\n\n return lines.join(\"\\n\");\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"negotiation.protocol.d.ts","sourceRoot":"/","sources":["negotiation/negotiation.protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAwBpI,kGAAkG;AAClG,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAR5B,oDAAoD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQsC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AAC;AAED,wEAAwE;AACxE,MAAM,UAAU,oBAAoB,CAClC,MAAc,EACd,IAAqB,EACrB,OAAmC;IAEnC,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5D,OAAO,WAAW,MAAM,mCAAmC,IAAI,gCAAgC,OAAO,sBAAsB,OAAO,GAAG,CAAC;AACzI,CAAC","sourcesContent":["/**\n * Seat-scoped negotiation protocol rules (v2 client-advocate protocol).\n *\n * v2 fixes exactly one initiating seat per match (`metadata.initiatorUserId`,\n * stamped at discovery time — IND-396) and makes consent asymmetric:\n * **accept can only come from the counterparty seat**, schema-enforced.\n *\n * Vocabulary per seat (v2):\n * - initiator: `outreach | counter | question | withdraw` (no accept)\n * - counterparty: `accept | decline | counter | question`\n * - final turn: initiator `withdraw | counter`; counterparty `accept | decline`\n *\n * v1 tasks keep the legacy vocabulary (`propose | accept | reject | counter |\n * question`) — the version is inherited per conversation, never re-stamped, so\n * in-flight v1 negotiations are grandfathered untouched.\n *\n * Outcome mapping is version-independent: `accept` → opportunity `pending`,\n * `reject`/`withdraw`/`decline` → `rejected`, turn-cap → `stalled`.\n */\nimport { z } from \"zod\";\n\nimport { AskUserPayloadSchema } from \"../shared/schemas/negotiation-state.schema.js\";\nimport type { NegotiationAction, NegotiationSeat, NegotiationProtocolVersion } from \"../shared/schemas/negotiation-state.schema.js\";\n\n// ─── Shared assessment fragment ──────────────────────────────────────────────\n\nconst AssessmentSchema = z.object({\n reasoning: z.string(),\n suggestedRoles: z.object({\n ownUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n otherUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n }),\n});\n\nfunction turnSchema<T extends [NegotiationAction, ...NegotiationAction[]]>(actions: T) {\n return z.object({\n action: z.enum(actions),\n assessment: AssessmentSchema,\n message: z.string().nullable().optional(),\n /** Present when action is `ask_user` (v2, P3.2). */\n askUser: AskUserPayloadSchema.nullable().optional(),\n });\n}\n\n// ─── v2 seat-scoped turn schemas ─────────────────────────────────────────────\n\n/** Initiator seat, non-final turn: may reach out, push back, ask, or walk away — never accept. */\nexport const InitiatorTurnSchema = turnSchema([\"outreach\", \"counter\", \"question\", \"withdraw\"]);\n\n/** Counterparty seat, non-final turn: the only seat that can accept. */\nexport const CounterpartyTurnSchema = turnSchema([\"accept\", \"decline\", \"counter\", \"question\"]);\n\n/** Initiator seat, final allowed turn: commit to walking away or leave the door open. */\nexport const FinalInitiatorTurnSchema = turnSchema([\"withdraw\", \"counter\"]);\n\n/** Counterparty seat, final allowed turn: must decide. */\nexport const FinalCounterpartyTurnSchema = turnSchema([\"accept\", \"decline\"]);\n\n// ─── v2 ask_user variants (P3.2, flag-gated) ────────────────────────────────\n// Non-final turns only: the final-cap turn must decide, never pause. Selected\n// via the `opts.askUser` parameter on allowedActionsFor/turnSchemaFor — the\n// base schemas above stay byte-identical for every existing caller.\n\n/** Initiator seat, non-final turn, with the client-consult pause available. */\nexport const InitiatorAskUserTurnSchema = turnSchema([\"outreach\", \"counter\", \"question\", \"withdraw\", \"ask_user\"]);\n\n/** Counterparty seat, non-final turn, with the client-consult pause available. */\nexport const CounterpartyAskUserTurnSchema = turnSchema([\"accept\", \"decline\", \"counter\", \"question\", \"ask_user\"]);\n\n// ─── Action vocabulary per version + seat ────────────────────────────────────\n\nconst V1_ACTIONS: readonly NegotiationAction[] = [\"propose\", \"accept\", \"reject\", \"counter\", \"question\"];\nconst V1_FINAL_ACTIONS: readonly NegotiationAction[] = [\"accept\", \"reject\"];\nconst V2_INITIATOR_ACTIONS: readonly NegotiationAction[] = [\"outreach\", \"counter\", \"question\", \"withdraw\"];\nconst V2_COUNTERPARTY_ACTIONS: readonly NegotiationAction[] = [\"accept\", \"decline\", \"counter\", \"question\"];\nconst V2_FINAL_INITIATOR_ACTIONS: readonly NegotiationAction[] = [\"withdraw\", \"counter\"];\nconst V2_FINAL_COUNTERPARTY_ACTIONS: readonly NegotiationAction[] = [\"accept\", \"decline\"];\nconst V2_INITIATOR_ASK_USER_ACTIONS: readonly NegotiationAction[] = [...V2_INITIATOR_ACTIONS, \"ask_user\"];\nconst V2_COUNTERPARTY_ASK_USER_ACTIONS: readonly NegotiationAction[] = [...V2_COUNTERPARTY_ACTIONS, \"ask_user\"];\n\n/**\n * The set of actions a given seat may submit under a given protocol version.\n *\n * v1 ignores the seat entirely (legacy symmetric vocabulary) so pre-v2\n * negotiations behave exactly as before.\n */\nexport function allowedActionsFor(\n version: NegotiationProtocolVersion,\n seat: NegotiationSeat,\n isFinalTurn = false,\n opts?: AskUserOpts,\n): readonly NegotiationAction[] {\n if (version !== \"v2\") return isFinalTurn ? V1_FINAL_ACTIONS : V1_ACTIONS;\n const askUser = opts?.askUser === true && !isFinalTurn;\n if (seat === \"initiator\") {\n return isFinalTurn ? V2_FINAL_INITIATOR_ACTIONS : (askUser ? V2_INITIATOR_ASK_USER_ACTIONS : V2_INITIATOR_ACTIONS);\n }\n return isFinalTurn ? V2_FINAL_COUNTERPARTY_ACTIONS : (askUser ? V2_COUNTERPARTY_ASK_USER_ACTIONS : V2_COUNTERPARTY_ACTIONS);\n}\n\n/**\n * Zod turn schema for a system-agent turn, selected by version + seat +\n * final-turn flag. v1 returns the legacy schemas (seat-agnostic); v2 returns\n * the seat-scoped schemas above, making an initiator `accept` structurally\n * impossible rather than prompt-discouraged.\n *\n * The v1 legacy schemas are passed in by the caller (they live in\n * `negotiation.state.ts`) to keep this module free of a state-module import.\n */\nexport function turnSchemaFor(\n version: NegotiationProtocolVersion,\n seat: NegotiationSeat,\n isFinalTurn: boolean,\n v1Schemas: { system: z.ZodTypeAny; final: z.ZodTypeAny },\n opts?: AskUserOpts,\n): z.ZodTypeAny {\n if (version !== \"v2\") return isFinalTurn ? v1Schemas.final : v1Schemas.system;\n const askUser = opts?.askUser === true && !isFinalTurn;\n if (seat === \"initiator\") {\n return isFinalTurn ? FinalInitiatorTurnSchema : (askUser ? InitiatorAskUserTurnSchema : InitiatorTurnSchema);\n }\n return isFinalTurn ? FinalCounterpartyTurnSchema : (askUser ? CounterpartyAskUserTurnSchema : CounterpartyTurnSchema);\n}\n\n/**\n * Opt-in extension of the seat vocabulary with the `ask_user` client-consult\n * pause (P3.2). Never granted on final-cap turns (the final turn must decide)\n * and never under v1. Callers pass `{ askUser: true }` only when the full\n * pause loop is available on their surface: the ask-user feature flag is on,\n * a questioner enqueue and an answer-window timer are wired, the negotiation\n * has an opportunity to resume against, and the acting side has not already\n * consumed its one client question for this negotiation (rationing).\n */\nexport interface AskUserOpts {\n askUser?: boolean;\n}\n\n// ─── Action semantics (version-independent) ──────────────────────────────────\n\n/** Terminal actions end the negotiation immediately. */\nexport function isTerminalAction(action: string | undefined | null): boolean {\n return action === \"accept\" || action === \"reject\" || action === \"withdraw\" || action === \"decline\";\n}\n\n/** Reject-like actions map the opportunity to `rejected` (v1 reject, v2 withdraw/decline). */\nexport function isRejectLikeAction(action: string | undefined | null): boolean {\n return action === \"reject\" || action === \"withdraw\" || action === \"decline\";\n}\n\n/**\n * Conservative action when an agent produced schema-invalid output (after the\n * retry) or an internal error needs a seat-valid terminal placeholder.\n *\n * Non-final turns fall back to `counter` (keeps the dialogue open — the AC's\n * \"conservative counter\"). Final turns must decide: v1 → `reject`, v2\n * counterparty → `decline`, v2 initiator → `counter` is still legal on the\n * final turn so it stays `counter` (finalizes as turn-cap/stalled).\n */\nexport function fallbackActionFor(\n version: NegotiationProtocolVersion,\n seat: NegotiationSeat,\n isFinalTurn: boolean,\n): NegotiationAction {\n if (!isFinalTurn) return \"counter\";\n if (version !== \"v2\") return \"reject\";\n return seat === \"counterparty\" ? \"decline\" : \"counter\";\n}\n\n/** Seat-appropriate reject-like action for error paths. */\nexport function rejectActionFor(\n version: NegotiationProtocolVersion,\n seat: NegotiationSeat,\n): NegotiationAction {\n if (version !== \"v2\") return \"reject\";\n return seat === \"initiator\" ? \"withdraw\" : \"decline\";\n}\n\n// ─── Metadata readers ────────────────────────────────────────────────────────\n\n/**\n * Read the protocol version off task metadata. Returns null when the task\n * predates version stamping (treat as v1 at the call site when the task is a\n * genuine prior; fresh tasks stamp from {@link configuredProtocolVersion}).\n */\nexport function readProtocolVersion(\n metadata: { protocolVersion?: unknown } | null | undefined,\n): NegotiationProtocolVersion | null {\n const v = metadata?.protocolVersion;\n return v === \"v2\" ? \"v2\" : v === \"v1\" ? \"v1\" : null;\n}\n\n/**\n * Protocol version for negotiations without a prior task for the same\n * opportunity, from the `NEGOTIATION_PROTOCOL_VERSION` env switch. Defaults\n * to `v1` when unset — v2 is opt-in per environment, and rolling back is the\n * same single switch (only in-flight negotiations stay pinned to their\n * stamped version).\n */\nexport function configuredProtocolVersion(): NegotiationProtocolVersion {\n return process.env.NEGOTIATION_PROTOCOL_VERSION === \"v2\" ? \"v2\" : \"v1\";\n}\n\n/**\n * Whether the `ask_user` client-consult pause (P3.2) is enabled, from the\n * `NEGOTIATION_ASK_USER_ENABLED` env switch. Defaults to off — the deployment\n * is byte-for-byte unchanged until the flag is flipped, and rolling back is\n * the same single switch.\n */\nexport function configuredAskUserEnabled(): boolean {\n return process.env.NEGOTIATION_ASK_USER_ENABLED === \"true\";\n}\n\n/** Default answer window for a paused `ask_user` negotiation: 24 hours. */\nexport const DEFAULT_ASK_USER_WINDOW_MS = 24 * 60 * 60 * 1000;\n\n/**\n * Answer window for a paused `ask_user` negotiation, in ms. Overridable via\n * `NEGOTIATION_ASK_USER_WINDOW_MS` (dev/e2e use shorter windows to exercise\n * the expiry path); invalid or non-positive values fall back to 24 h.\n */\nexport function askUserAnswerWindowMs(): number {\n const raw = process.env.NEGOTIATION_ASK_USER_WINDOW_MS;\n if (raw) {\n const parsed = Number(raw);\n if (Number.isFinite(parsed) && parsed > 0) return parsed;\n }\n return DEFAULT_ASK_USER_WINDOW_MS;\n}\n\n/**\n * Slack added on top of the answer window when deciding whether a paused\n * (`input_required`) task still holds the conversation lock. Covers expiry\n * worker delay: the lock must outlive the timer slightly, so ambient\n * rediscovery cannot slip in between window expiry and the worker's resume.\n */\nexport const ASK_USER_LOCK_SLACK_MS = 60 * 60 * 1000;\n\n/**\n * Resolve the seat of `userId` on a negotiation task.\n *\n * Keys on `metadata.initiatorUserId` (the rigid v2 stamp), **never on turn\n * parity** — continuations can start with either side speaking first, so\n * parity misattributes seats across sessions. Pre-stamp tasks fall back to\n * `sourceUserId` (the discovery-session opener), which is what the stamp\n * defaults to anyway.\n */\nexport function resolveSeat(\n userId: string,\n metadata: { initiatorUserId?: unknown; sourceUserId?: unknown } | null | undefined,\n): NegotiationSeat {\n const initiator =\n typeof metadata?.initiatorUserId === \"string\" && metadata.initiatorUserId.length > 0\n ? metadata.initiatorUserId\n : typeof metadata?.sourceUserId === \"string\"\n ? metadata.sourceUserId\n : undefined;\n return initiator === userId ? \"initiator\" : \"counterparty\";\n}\n\n/** Human-readable seat-violation message shared by respond surfaces. */\nexport function seatViolationMessage(\n action: string,\n seat: NegotiationSeat,\n version: NegotiationProtocolVersion,\n): string {\n const allowed = allowedActionsFor(version, seat).join(\", \");\n return `Action \"${action}\" is not allowed for your seat (${seat}) under negotiation protocol ${version}. Allowed actions: ${allowed}.`;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"negotiation.question-safety.d.ts","sourceRoot":"/","sources":["negotiation/negotiation.question-safety.ts"],"names":[],"mappings":"AAEA,oGAAoG;AACpG,eAAO,MAAM,yCAAyC,0BAA0B,CAAC;AACjF,eAAO,MAAM,oCAAoC,yBAAyB,CAAC;AAC3E,eAAO,MAAM,4CAA4C,+EAA+E,CAAC;AASzI;;;;GAIG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IACR,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC,GACA,OAAO,CAoBT;AAED,2FAA2F;AAC3F,wBAAgB,6BAA6B,CAAC,K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6B,CAAC,aAAa,EAAE,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACvF,OAAO;QACL,iBAAiB;QACjB,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5C,CAAC;AACJ,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,+BAA+B,CAAC,MAAc;IAC5D,OAAO,sCAAsC,MAAM,EAAE,CAAC;AACxD,CAAC","sourcesContent":["import { hasUnsupportedOpportunityClaim } from '../opportunity/opportunity.claim-safety.js';\n\n/** Fixed prompt-safe labels; producers must not replace them with raw network/counterparty text. */\nexport const NEGOTIATION_QUESTION_GENERIC_COUNTERPARTY = 'the other participant';\nexport const NEGOTIATION_QUESTION_GENERIC_NETWORK = 'the selected network';\nexport const NEGOTIATION_QUESTION_GENERIC_UPTAKE_ACTIVITY = 'a potential collaboration that may require clarification before you decide';\n\nconst INTERNAL_ID_PATTERN = /\\b(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|(?:task|intent|network|opportunity|user|match)[_-]?id)\\b/i;\nconst PRIVATE_SOURCE_PATTERN = /\\b(?:private transcript|raw transcript|assessment(?:\\.reasoning)?|seed assessment|evaluator reasoning|match reason|matchReason|internal metadata|counterparty profile)\\b/i;\n\nfunction normalize(value: string): string {\n return value.toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();\n}\n\n/**\n * Deterministically reject question context copied from private negotiation inputs.\n * This guard never rewrites content: unsafe or ambiguous text yields no card while\n * the already-armed timeout retains the conservative continuation path.\n */\nexport function isSafeNegotiationQuestionText(\n value: string,\n options?: {\n forbiddenIdentifiers?: string[];\n forbiddenSourceText?: string[];\n },\n): boolean {\n const trimmed = value.trim();\n if (trimmed.length === 0 || trimmed.length > 600) return false;\n if (INTERNAL_ID_PATTERN.test(trimmed) || PRIVATE_SOURCE_PATTERN.test(trimmed)) return false;\n if (hasUnsupportedOpportunityClaim(trimmed)) return false;\n\n const normalized = normalize(trimmed);\n for (const identifier of options?.forbiddenIdentifiers ?? []) {\n const forbidden = normalize(identifier);\n if (forbidden.length >= 3 && new RegExp(`(?:^| )${forbidden.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}(?: |$)`).test(normalized)) {\n return false;\n }\n }\n for (const source of options?.forbiddenSourceText ?? []) {\n const forbidden = normalize(source);\n if (forbidden.length >= 24 && (normalized.includes(forbidden) || forbidden.includes(normalized))) {\n return false;\n }\n }\n return true;\n}\n\n/** Validate the only structured fields allowed to enter the inflight Questioner prompt. */\nexport function validateInflightAskUserFields(input: {\n disclosureSubject?: string | null;\n draftQuestion?: string | null;\n forbiddenIdentifiers?: string[];\n forbiddenSourceText?: string[];\n}): { disclosureSubject: string; draftQuestion?: string } | null {\n const disclosureSubject = input.disclosureSubject?.trim();\n if (!disclosureSubject || !isSafeNegotiationQuestionText(disclosureSubject, input)) return null;\n const draftQuestion = input.draftQuestion?.trim();\n if (draftQuestion && !isSafeNegotiationQuestionText(draftQuestion, input)) return null;\n return {\n disclosureSubject,\n ...(draftQuestion ? { draftQuestion } : {}),\n };\n}\n\n/** Stable, non-secret settlement/outbox key derived only from the exact paused task. */\nexport function negotiationQuestionSettlementId(taskId: string): string {\n return `negotiation-question-settlement-v1-${taskId}`;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"negotiation.reflect.d.ts","sourceRoot":"/","sources":["negotiation/negotiation.reflect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAMxE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,+EAK1B,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3E,wEAAwE;AACxE,eA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C;QAEH,MAAM,MAAM,GAAG,sBAAsB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACxD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,UAAU,CAAC,IAAI,CAAC,4CAA4C,EAAE;gBAC5D,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;aAC9D,CAAC,CAAC;YACH,MAAM,IAAI,KAAK,CAAC,iCAAiC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,SAAS,EAAE,CAAC,CAAC;QACnG,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC;IAC/D,CAAC;IAED;;;OAGG;IACO,KAAK,CAAC,SAAS,CACvB,KAA+C,EAC/C,YAAsD;QAEtD,OAAO,qBAAqB,CAAC,KAAK,EAAE,YAAY,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACzF,CAAC;CACF","sourcesContent":["import { z } from \"zod\";\n\nimport { createStructuredModel } from \"../shared/agent/model.config.js\";\nimport { invokeWithAbortSignal } from \"../shared/agent/model-signal.js\";\nimport { protocolLogger } from \"../shared/observability/protocol.logger.js\";\n\nconst reflectLog = protocolLogger(\"NegotiationReflector\");\n\n/**\n * Memory kinds a reflection pass may distill (P5.1 `negotiator_memories.kind`).\n * Plain text at the DB level (55P04 lesson) — adding kinds is code-only.\n */\nexport const NEGOTIATOR_MEMORY_KINDS = [\n \"playbook\",\n \"disclosure_rule\",\n \"counterparty_dossier\",\n \"threshold\",\n] as const;\n\nexport type DistilledMemoryKind = (typeof NEGOTIATOR_MEMORY_KINDS)[number];\n\n/** Hard ceiling on entries distilled per reflection pass (per side). */\nexport const MAX_DISTILLED_MEMORIES = 3;\n\n/**\n * One distilled memory entry as produced by the reflection LLM. The caller\n * owns persistence: it resolves `aboutCounterparty` to a `subjectUserId`,\n * computes the embedding, and attaches provenance `sourceRefs`.\n */\nexport const DistilledMemorySchema = z.object({\n kind: z.enum(NEGOTIATOR_MEMORY_KINDS),\n /** Self-contained operational statement, useful without the transcript. */\n content: z.string().min(1),\n /** Evidence strength, 0..1. Explicit client statements score high. */\n confidence: z.number().min(0).max(1),\n /**\n * True when the entry is about the counterparty (kind should be\n * `counterparty_dossier`); false for client-side rules and playbooks.\n */\n aboutCounterparty: z.boolean(),\n /** Turn indexes (0-based, into the provided transcript) evidencing this entry. */\n turnIndexes: z.array(z.number().int().min(0)).default([]),\n});\n\nexport type DistilledMemory = z.infer<typeof DistilledMemorySchema>;\n\nexport const ReflectionResultSchema = z.object({\n memories: z.array(DistilledMemorySchema).max(MAX_DISTILLED_MEMORIES),\n});\n\nexport type ReflectionResult = z.infer<typeof ReflectionResultSchema>;\n\n/** A transcript row projected into the reflecting client's perspective. */\nexport interface ReflectionTranscriptEntry {\n index: number;\n speaker: \"client\" | \"counterparty\";\n action: string;\n message?: string;\n reasoning?: string;\n}\n\nexport interface NegotiationReflectionInput {\n /** The user whose negotiator is reflecting (memories land on their agent). */\n clientUser: { id: string; name?: string; bio?: string };\n counterpartyUser: { id: string; name?: string; bio?: string };\n /** The client's seat in this negotiation. */\n seat: \"initiator\" | \"counterparty\";\n outcome: { hasOpportunity: boolean; reasoning: string; turnCount: number };\n transcript: ReflectionTranscriptEntry[];\n /** Network prompt for context (optional). */\n indexContext?: string;\n}\n\nexport interface ChatReflectionInput {\n clientUser: { id: string; name?: string };\n /** The negotiator DM messages, oldest first. */\n messages: Array<{ role: \"user\" | \"assistant\"; content: string }>;\n}\n\n/**\n * Payload the finalize node hands to the injected {@link ReflectEnqueueFn}.\n * Carries user display context so the reflect worker never re-loads profiles;\n * turn history is loaded from the conversation by the worker (payloads stay\n * small in Redis).\n */\nexport interface NegotiationReflectJobData {\n negotiationId: string;\n conversationId: string;\n opportunityId?: string;\n sourceUser: { id: string; name?: string; bio?: string };\n candidateUser: { id: string; name?: string; bio?: string };\n initiatorUserId: string;\n outcome: { hasOpportunity: boolean; reasoning: string; turnCount: number };\n}\n\n/**\n * Injected enqueue callback for post-negotiation reflection (P5.2). The\n * protocol package has no BullMQ access — services/api wires this at its\n * composition roots, exactly like `QuestionerEnqueueFn`. Called fire-and-\n * forget from the finalize node: a reflection failure must never affect the\n * negotiation outcome.\n */\nexport type ReflectEnqueueFn = (job: NegotiationReflectJobData) => Promise<void>;\n\nconst NEGOTIATION_SYSTEM_PROMPT = `You are the private post-negotiation reflection process for {clientName}'s negotiator agent. The negotiation is over; your job is to distill AT MOST ${MAX_DISTILLED_MEMORIES} durable operational memory entries that will make {clientName}'s negotiator better in FUTURE negotiations. These memories are private to {clientName}'s agent — the counterparty never sees them.\n\nMemory kinds:\n- \"playbook\": a tactic or pattern that worked or failed (e.g. \"Opening with the specific shared-interest angle got engagement; generic intros stalled\").\n- \"disclosure_rule\": what {clientName} is or is not willing to share/commit (only when the transcript actually evidences it).\n- \"counterparty_dossier\": a durable fact about the counterparty useful in future dealings with THEM specifically (set aboutCounterparty=true).\n- \"threshold\": a concrete boundary observed (e.g. minimum scope, timing constraints, deal-breakers).\n\nRules:\n- Record ONLY what future negotiations need. No summaries, no play-by-play, no identity facts about {clientName} (their profile already covers those).\n- Every entry MUST cite the transcript turn indexes that evidence it in turnIndexes.\n- Each content string must be self-contained and actionable without the transcript.\n- Set confidence by evidence strength: explicit statements ≈ 0.8-0.9, inferred patterns ≈ 0.4-0.6.\n- aboutCounterparty=true ONLY for counterparty_dossier entries.\n- Return an empty memories array when nothing durable was learned — most short or failed negotiations teach nothing. Do not force entries.`;\n\nconst CHAT_SYSTEM_PROMPT = `You are the private reflection process for {clientName}'s negotiator agent, reviewing a direct chat between {clientName} (the client) and their negotiator. Distill AT MOST ${MAX_DISTILLED_MEMORIES} durable operational memory entries capturing the client's STATED preferences, corrections, and instructions.\n\nMemory kinds:\n- \"playbook\": how the client wants negotiations approached (style, priorities).\n- \"disclosure_rule\": what the client said they will or won't share/commit.\n- \"threshold\": concrete boundaries the client stated (rates, scope, timing, deal-breakers).\n\nRules:\n- Only distill what the CLIENT stated or clearly confirmed — never invent preferences from the negotiator's own suggestions.\n- Do NOT produce counterparty_dossier entries; this is a client-side conversation. Always set aboutCounterparty=false.\n- Each content string must be self-contained and actionable.\n- turnIndexes cite 0-based indexes into the provided message list.\n- Set confidence by how explicit the client was (direct instruction ≈ 0.9, implied preference ≈ 0.5).\n- Return an empty memories array when the chat contains no durable guidance — casual Q&A usually doesn't.`;\n\nconst DEFAULT_REFLECT_TIMEOUT_MS = 20_000;\n\nexport interface NegotiationReflectorConfig {\n /** Hard ceiling on the reflection LLM round-trip, in ms (default 20000). */\n timeoutMs?: number;\n}\n\n/**\n * The memory distiller (P5.2). One structured LLM call per reflection pass,\n * producing ≤ {@link MAX_DISTILLED_MEMORIES} private memory entries for one\n * client's negotiator. Throws on LLM/validation failure — callers (the reflect\n * queue worker) own the swallow-and-log policy, since reflection must never\n * affect a negotiation outcome.\n */\nexport class NegotiationReflector {\n private readonly timeoutMs: number;\n\n constructor(config?: NegotiationReflectorConfig) {\n this.timeoutMs = config?.timeoutMs && Number.isFinite(config.timeoutMs) && config.timeoutMs > 0\n ? config.timeoutMs\n : DEFAULT_REFLECT_TIMEOUT_MS;\n }\n\n /**\n * Distill memories from a finished negotiation, from one side's perspective.\n * @throws When the LLM call times out or returns schema-invalid output.\n */\n async reflectNegotiation(input: NegotiationReflectionInput): Promise<DistilledMemory[]> {\n const clientName = input.clientUser.name ?? \"the client\";\n const counterpartyName = input.counterpartyUser.name ?? \"the counterparty\";\n\n const systemPrompt = NEGOTIATION_SYSTEM_PROMPT.replace(/{clientName}/g, clientName);\n\n const transcriptText = input.transcript.length > 0\n ? input.transcript.map((t) => {\n const who = t.speaker === \"client\" ? `${clientName}'s negotiator` : `${counterpartyName}'s negotiator`;\n const parts = [`[${t.index}] ${who} → ${t.action}`];\n if (t.message) parts.push(`message: ${t.message}`);\n if (t.reasoning) parts.push(`reasoning: ${t.reasoning}`);\n return parts.join(\"\\n \");\n }).join(\"\\n\")\n : \"(no turns)\";\n\n const userMessage = `CLIENT: ${clientName}${input.clientUser.bio ? ` — ${input.clientUser.bio}` : \"\"}\nSEAT: ${input.seat === \"initiator\" ? \"initiator (client's negotiator reached out)\" : \"counterparty (client's negotiator was reached)\"}\nCOUNTERPARTY: ${counterpartyName}${input.counterpartyUser.bio ? ` — ${input.counterpartyUser.bio}` : \"\"}\n${input.indexContext ? `NETWORK CONTEXT: ${input.indexContext}\\n` : \"\"}\nOUTCOME: ${input.outcome.hasOpportunity ? \"accepted\" : \"not accepted\"} after ${input.outcome.turnCount} turn(s) — ${input.outcome.reasoning}\n\nTRANSCRIPT:\n${transcriptText}\n\nDistill the durable memories (or return an empty array).`;\n\n return this.distill(systemPrompt, userMessage);\n }\n\n /**\n * Distill stated preferences/corrections from a client ↔ negotiator chat.\n * @throws When the LLM call times out or returns schema-invalid output.\n */\n async reflectChat(input: ChatReflectionInput): Promise<DistilledMemory[]> {\n const clientName = input.clientUser.name ?? \"the client\";\n const systemPrompt = CHAT_SYSTEM_PROMPT.replace(/{clientName}/g, clientName);\n\n const chatText = input.messages\n .map((m, i) => `[${i}] ${m.role === \"user\" ? clientName : \"negotiator\"}: ${m.content}`)\n .join(\"\\n\");\n\n const userMessage = `CHAT between ${clientName} and their negotiator (oldest first):\n${chatText}\n\nDistill the client's durable guidance (or return an empty array).`;\n\n return this.distill(systemPrompt, userMessage);\n }\n\n private async distill(systemPrompt: string, userMessage: string): Promise<DistilledMemory[]> {\n const model = createStructuredModel(\"negotiationReflector\", ReflectionResultSchema, { name: \"negotiation_reflector\" });\n\n const result = await this.callModel(model, [\n { role: \"system\", content: systemPrompt },\n { role: \"user\", content: userMessage },\n ]);\n\n const parsed = ReflectionResultSchema.safeParse(result);\n if (!parsed.success) {\n reflectLog.warn(\"Reflection output failed schema validation\", {\n issues: parsed.error.issues.map((i) => i.message).slice(0, 3),\n });\n throw new Error(`Reflection failed validation: ${parsed.error.issues[0]?.message ?? \"unknown\"}`);\n }\n return parsed.data.memories.slice(0, MAX_DISTILLED_MEMORIES);\n }\n\n /**\n * Raw structured-model round trip. Split out as a seam so tests can drive\n * the schema-validation path without a live provider.\n */\n protected async callModel(\n model: ReturnType<typeof createStructuredModel>,\n chatMessages: Array<{ role: string; content: string }>,\n ): Promise<unknown> {\n return invokeWithAbortSignal(model, chatMessages, AbortSignal.timeout(this.timeoutMs));\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"negotiation.screen.d.ts","sourceRoot":"/","sources":["negotiation/negotiation.screen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE5G,OAAO,EAAiC,KAAK,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACpG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAA4D,KAAK,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAItI;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB,uCAAwC,CAAC;AAE9E,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,IAAI,qBAAqB,CAI5D;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;IAG/B,8EAA8E;;;QAG5E,0EAA0E;;QAE1E,uEAAuE;;QAEvE,uHAAuH;;;;;;;;;;;;;;;;;;;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AC,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC;;gCAEf,KAAK,CAAC,cAAc,CAAC,SAAS,GAAG,oBAAoB;;qCAEhD,UAAU,GAAG,CAAC;QAE/C,MAAM,YAAY,GAAG;YACnB,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE;YACzC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE;SACvC,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,oBAAoB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,SAAS,CAAC,IAAI,CAAC,wCAAwC,EAAE;gBACvD,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;aAC9D,CAAC,CAAC;YACH,MAAM,IAAI,KAAK,CAAC,sCAAsC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,SAAS,EAAE,CAAC,CAAC;QACxG,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;;OAGG;IACO,KAAK,CAAC,SAAS,CACvB,KAA+C,EAC/C,YAAsD;QAEtD,OAAO,qBAAqB,CAAC,KAAK,EAAE,YAAY,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACzF,CAAC;CACF","sourcesContent":["import { z } from \"zod\";\n\nimport { createStructuredModel } from \"../shared/agent/model.config.js\";\nimport { invokeWithAbortSignal } from \"../shared/agent/model-signal.js\";\nimport type { UserNegotiationContext, SeedAssessment } from \"../shared/schemas/negotiation-state.schema.js\";\nimport { protocolLogger } from \"../shared/observability/protocol.logger.js\";\nimport { renderNegotiatorMemorySection, type NegotiatorMemoryEntry } from \"./negotiation.memory.js\";\nimport type { NegotiationTurn } from \"./negotiation.state.js\";\nimport { attributedDialogueIsEmpty, renderAttributedPriorDialogue, type AttributedPriorDialogue } from \"./negotiation.attribution.js\";\n\nconst screenLog = protocolLogger(\"NegotiationScreener\");\n\n/**\n * Screen-gate modes (P2.1 — client-advocate protocol).\n *\n * - `off` — the screen node is skipped entirely; no LLM call, no telemetry.\n * - `shadow` — the screen decision is made and recorded (task metadata +\n * trace event + log line) but NEVER blocks: every fresh negotiation still\n * proceeds to the first turn. Used to measure pass rates against observed\n * reject rates before enforcement.\n * - `enforce` — (P2.2) a `pass` decision blocks the negotiation before the\n * first turn: the graph routes straight to finalize with outcome\n * `reason: \"screened_out\"` — zero turns, zero counterparty involvement,\n * zero notifications; the opportunity is quietly `rejected`. A failed\n * screen still fails OPEN (never blocks), and `reach_out` proceeds normally.\n */\nexport const NEGOTIATION_SCREEN_MODES = [\"off\", \"shadow\", \"enforce\"] as const;\n\nexport type NegotiationScreenMode = (typeof NEGOTIATION_SCREEN_MODES)[number];\n\n/**\n * Resolve the screen mode from `NEGOTIATION_SCREEN_MODE`.\n *\n * Defaults to `off` when unset or unrecognized — the screen gate is an\n * explicit opt-in flip (same operational pattern as\n * `NEGOTIATION_PROTOCOL_VERSION` / `NEGOTIATOR_CHAT_ENABLED`): code ships\n * inert, the environment turns it on.\n */\nexport function configuredScreenMode(): NegotiationScreenMode {\n const raw = process.env.NEGOTIATION_SCREEN_MODE;\n if (raw === \"shadow\" || raw === \"enforce\" || raw === \"off\") return raw;\n return \"off\";\n}\n\n/**\n * Structured screen decision — the outreach gate's verdict on whether this\n * match is worth the client's name before any turn is exchanged.\n */\nexport const ScreenDecisionSchema = z.object({\n decision: z.enum([\"reach_out\", \"pass\"]),\n reasoning: z.string(),\n /** Suggested opening angle for the outreach turn (only when reaching out). */\n outreachAngle: z.string().nullable().optional(),\n evidence: z.object({\n /** How well the counterparty's context/premises fit the client's need. */\n counterpartyPremiseFit: z.string(),\n /** How the client's intents align with what the counterparty seeks. */\n intentAlignment: z.string(),\n /** Prior-negotiation memory signals (P5.3). Filled only when negotiator memory was injected into the screen prompt. */\n memoryHints: z.string().nullable().optional(),\n }),\n});\n\nexport type ScreenDecision = z.infer<typeof ScreenDecisionSchema>;\n\n/**\n * The record persisted to `tasks.metadata.screenDecision` and returned into\n * graph state. Extends the LLM decision with operational context so pass-rate\n * queries can group by mode and exclude failed-open rows.\n */\nexport interface ScreenDecisionRecord extends ScreenDecision {\n mode: NegotiationScreenMode;\n /** True when the screen LLM call failed and the gate defaulted open. */\n failedOpen?: boolean;\n /** Error message when `failedOpen` is set. */\n error?: string;\n screenedAt: string;\n durationMs: number;\n}\n\nexport interface NegotiationScreenerInput {\n /** The client — the user whose negotiator is deciding whether to reach out. */\n clientUser: UserNegotiationContext;\n /** The counterparty the client's negotiator would be reaching out to. */\n counterpartyUser: UserNegotiationContext;\n /** The counterparty's `user_contexts` paragraph (empty string when absent). */\n counterpartyContext?: string;\n /** The explicit search query that triggered discovery (if any). */\n discoveryQuery?: string;\n seedAssessment: Omit<SeedAssessment, \"actors\">;\n indexContext: { networkId: string; prompt?: string };\n /**\n * Retrieved negotiator memories for the client (P5.3 read path). Rendered\n * as a private prompt section with a memoryHints instruction. Absent/empty\n * → the prompt is byte-identical to before.\n */\n memory?: NegotiatorMemoryEntry[];\n /**\n * Whether this screen is for a continuation — a match against a counterparty\n * this client already has prior dialogue with (IND-563). When set with\n * `priorDialogue`, the gate evaluates the NEW signal on its own merits with\n * that dialogue as context. Absent → the prompt is byte-identical to before.\n */\n isContinuation?: boolean;\n /**\n * Prior negotiation turns with this counterparty (continuations only).\n * Rendered as read-only context so the gate can tell a materially-new signal\n * from a rehash of an already-settled one. Never treated as this task's own\n * outreach.\n */\n priorDialogue?: NegotiationTurn[];\n /**\n * Attributed form of the prior dialogue (IND-569). When present it supersedes\n * the flat `priorDialogue` list: earlier concluded opportunities and legacy\n * unattributed turns render as labeled, separated blocks so the gate can see\n * which prior turns belonged to OTHER opportunities. Absent → the flat\n * `priorDialogue` rendering is used (byte-identical to before).\n */\n priorDialogueAttributed?: AttributedPriorDialogue;\n}\n\nconst SYSTEM_PROMPT = `You are the outreach gate for {clientName}'s negotiator agent on a discovery network. Before any negotiation turn is exchanged, you decide whether this match is worth reaching out to on {clientName}'s behalf — their name and attention are spent with every outreach.\n\nNetwork context: {networkContext}\n\nDecide:\n- \"reach_out\" when the counterparty plausibly serves {clientName}'s stated needs and a concrete, honest opening case can be made. When reaching out, set outreachAngle to the strongest specific angle for the opening message.\n- \"pass\" when the match is generic, one-sided, or rests on vague overlap that would waste both parties' attention.\n\nRules:\n{queryRule}\n- Judge concrete intent alignment, not topical adjacency.\n- Fill evidence.counterpartyPremiseFit with what (if anything) in the counterparty's context actually fits, and evidence.intentAlignment with how the intents line up. Be specific; cite the strongest signal either way.\n- Do NOT reference internal system details like scores, pre-screens, or evaluator outputs in reasoning that could be shown to users.{negotiatorMemory}`;\n\nconst QUERY_RULE = `- {clientName} explicitly searched for \"{discoveryQuery}\". This query is the PRIMARY criterion: if the counterparty does not satisfy it, pass — background intents cannot rescue a query mismatch.`;\nconst NO_QUERY_RULE = `- No explicit search query: judge against {clientName}'s active intents.`;\n\nconst DEFAULT_SCREEN_TIMEOUT_MS = 15_000;\n\nexport interface NegotiationScreenerConfig {\n /** Hard ceiling on the screen LLM round-trip, in ms (default 15000). */\n timeoutMs?: number;\n}\n\n/**\n * The outreach gate (P2.1). One structured LLM call deciding\n * `reach_out | pass` for a fresh negotiation, from the reaching client's\n * perspective. Throws on LLM/validation failure — the screen graph node owns\n * the fail-open policy (a failed screen never blocks the negotiation).\n */\nexport class NegotiationScreener {\n private readonly timeoutMs: number;\n\n constructor(config?: NegotiationScreenerConfig) {\n this.timeoutMs = config?.timeoutMs && Number.isFinite(config.timeoutMs) && config.timeoutMs > 0\n ? config.timeoutMs\n : DEFAULT_SCREEN_TIMEOUT_MS;\n }\n\n /**\n * Produce a screen decision for a fresh match.\n * @throws When the LLM call times out or returns schema-invalid output.\n */\n async invoke(input: NegotiationScreenerInput): Promise<ScreenDecision> {\n const model = createStructuredModel(\"negotiationScreener\", ScreenDecisionSchema, { name: \"negotiation_screener\" });\n\n const clientName = input.clientUser.profile.name ?? \"your client\";\n const counterpartyName = input.counterpartyUser.profile.name ?? \"the counterparty\";\n const networkContext = input.indexContext.prompt || \"General discovery\";\n const queryRule = (input.discoveryQuery ? QUERY_RULE : NO_QUERY_RULE)\n .replace(/{clientName}/g, clientName)\n .replace(/{discoveryQuery}/g, input.discoveryQuery ?? \"\");\n\n const systemPrompt = SYSTEM_PROMPT\n .replace(/{clientName}/g, clientName)\n .replace(\"{networkContext}\", networkContext)\n .replace(\"{queryRule}\", queryRule)\n .replace(\"{negotiatorMemory}\", renderNegotiatorMemorySection(input.memory ?? [], { memoryHintsInstruction: true }));\n\n const formatIntents = (intents: UserNegotiationContext[\"intents\"]): string =>\n intents.length > 0 ? intents.map((i) => `- ${i.title}: ${i.description}`).join(\"\\n\") : \"- (none)\";\n\n const formatScreenTurn = (t: NegotiationTurn, i: number) => {\n const msgPart = t.message ? ` — ${t.message}` : \"\";\n return `Turn ${i + 1}: ${t.action} — ${t.assessment.reasoning}${msgPart}`;\n };\n\n // IND-569: prefer the attributed rendering (labeled per-opportunity blocks)\n // when the graph supplies it; otherwise fall back to the flat prior-turn list.\n const hasAttributed = input.isContinuation\n && input.priorDialogueAttributed != null\n && !attributedDialogueIsEmpty(input.priorDialogueAttributed);\n const flatPriorDialogue = input.isContinuation && input.priorDialogue && input.priorDialogue.length > 0\n ? input.priorDialogue\n : [];\n const priorDialogueBody = hasAttributed\n ? renderAttributedPriorDialogue(input.priorDialogueAttributed!, formatScreenTurn)\n : (flatPriorDialogue.length > 0 ? flatPriorDialogue.map(formatScreenTurn).join(\"\\n\") : \"\");\n const priorDialogueContext = priorDialogueBody\n ? `\\n\\n--- Prior dialogue with ${counterpartyName} (already spoken) ---\\n${priorDialogueBody}\\n\\nThis is a NEW signal against a counterparty ${clientName} has prior dialogue with. Some turns above may belong to OTHER, already-concluded opportunities (each block is labeled); they are background only. Judge the new signal on its own merits: if it is materially the same as what was already discussed, pass unless something concrete changed; if materially different, judge it fresh. Do NOT reach out again on generic overlap just because they spoke before.`\n : \"\";\n\n const userMessage = `YOUR CLIENT (${clientName}):\nBio: ${input.clientUser.profile.bio ?? \"N/A\"}\n${input.discoveryQuery ? `Search query: \"${input.discoveryQuery}\"\\nBackground intents (secondary to the query):` : \"Active intents:\"}\n${formatIntents(input.clientUser.intents)}\n\nCOUNTERPARTY (${counterpartyName}):\nBio: ${input.counterpartyUser.profile.bio ?? \"N/A\"}\n${input.counterpartyContext ? `Context: ${input.counterpartyContext}\\n` : \"\"}Active intents:\n${formatIntents(input.counterpartyUser.intents)}\n\nWhy this match was suggested: ${input.seedAssessment.reasoning}${priorDialogueContext}\n\nDecide whether reaching out serves ${clientName}.`;\n\n const chatMessages = [\n { role: \"system\", content: systemPrompt },\n { role: \"user\", content: userMessage },\n ];\n\n const result = await this.callModel(model, chatMessages);\n const parsed = ScreenDecisionSchema.safeParse(result);\n if (!parsed.success) {\n screenLog.warn(\"Screen output failed schema validation\", {\n issues: parsed.error.issues.map((i) => i.message).slice(0, 3),\n });\n throw new Error(`Screen decision failed validation: ${parsed.error.issues[0]?.message ?? \"unknown\"}`);\n }\n return parsed.data;\n }\n\n /**\n * Raw structured-model round trip. Split out as a seam so tests can drive\n * the schema-validation and fail-open paths without a live provider.\n */\n protected async callModel(\n model: ReturnType<typeof createStructuredModel>,\n chatMessages: Array<{ role: string; content: string }>,\n ): Promise<unknown> {\n return invokeWithAbortSignal(model, chatMessages, AbortSignal.timeout(this.timeoutMs));\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"negotiation.state.d.ts","sourceRoot":"/","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