@indexnetwork/protocol 6.12.1-rc.404.1 → 6.14.0-rc.406.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 +249 -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 +666 -0
- package/dist/negotiation/application/negotiation.graph.js +1394 -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 +79 -0
- package/dist/opportunity/application/opportunity.existing-negotiation.js +118 -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 +3707 -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 -1535
- package/dist/shared/schemas/question.schema.js +3 -420
- 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":"intent.graph.js","sourceRoot":"/","sources":["intent/intent.graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAiE,MAAM,mBAAmB,CAAC;AACpH,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAGvE,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAI5E,MAAM,MAAM,GAAG,cAAc,CAAC,oBAAoB,CAAC,CAAC;AAEpD;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CACzC,aAAkE,EAClE,eAAqC,EACrC,OAAiC;IAEjC,IAAI,aAAa,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC;IAC/C,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC;IAC/C,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE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mBAAmB,CAAC,MAAM,EAAE,cAAc,EAAE;YAC3C,KAAK,EAAE,OAAO;YACd,SAAS,EAAE,WAAW;YACtB,UAAU,EAAE,YAAY;YACxB,OAAO,EAAE,GAAG;SACb,CAAC;YAEF,gCAAgC;aAC/B,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;YAEtB,uEAAuE;aACtE,mBAAmB,CAAC,WAAW,EAAE,qBAAqB,EAAE;YACvD,YAAY,EAAE,cAAc;YAC5B,UAAU,EAAE,YAAY;YACxB,OAAO,EAAE,GAAG;SACb,CAAC;YAEF,kFAAkF;aACjF,mBAAmB,CAAC,cAAc,EAAE,CAAC,KAAoC,EAAE,EAAE;YAC5E,IAAI,KAAK,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;gBACtC,MAAM,CAAC,OAAO,CAAC,qEAAqE,CAAC,CAAC;gBACtF,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,OAAO,YAAY,CAAC;QACtB,CAAC,EAAE;YACD,UAAU,EAAE,YAAY;YACxB,OAAO,EAAE,GAAG;SACb,CAAC;YAEF,yCAAyC;aACxC,OAAO,CAAC,YAAY,EAAE,UAAU,CAAC;YAElC,6BAA6B;aAC5B,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAE5B,OAAO,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import { StateGraph, START, END } from \"@langchain/langgraph\";\nimport { IntentGraphState, VerifiedIntent, ExecutionResult, type IntentValidationFailure } from \"./intent.state.js\";\nimport { ExplicitIntentInferrer } from \"./intent.inferrer.js\";\nimport { SemanticVerifier } from \"./intent.verifier.js\";\nimport { DEFAULT_SPECIFICITY_WARNING } from \"./intent.specificity.js\";\nimport { IntentReconciler } from \"./intent.reconciler.js\";\nimport type { NormalizedIntentAction } from \"./intent.reconciler.js\";\nimport { IntentGraphDatabase } from \"../shared/interfaces/database.interface.js\";\nimport { getAbortSignalConfig } from \"../shared/agent/model-signal.js\";\nimport type { EmbeddingGenerator } from \"../shared/interfaces/embedder.interface.js\";\nimport type { IntentGraphQueue } from \"../shared/interfaces/queue.interface.js\";\nimport { protocolLogger } from \"../shared/observability/protocol.logger.js\";\nimport { timed } from \"../shared/observability/performance.js\";\nimport { requestContext } from \"../shared/observability/request-context.js\";\nimport type { DebugMetaAgent } from \"../chat/chat-streaming.types.js\";\nimport type { QuestionerEnqueueFn } from \"../questioner/questioner.types.js\";\n\nconst logger = protocolLogger(\"IntentGraphFactory\");\n\n/**\n * Enforce write-mode constraints on reconciler output before any action can\n * reach persistence. Update mode is deliberately fail-closed: only updates\n * whose id is one of the caller-provided targets survive.\n */\nexport function enforceIntentActionBoundary(\n operationMode: 'create' | 'update' | 'delete' | 'read' | 'propose',\n targetIntentIds: string[] | undefined,\n actions: NormalizedIntentAction[],\n): NormalizedIntentAction[] {\n if (operationMode !== 'update') return actions;\n const targets = new Set(targetIntentIds ?? []);\n return actions.filter((action) => action.type === 'update' && targets.has(action.id));\n}\n\n/**\n * Build the only action permitted for an explicit update. This path is\n * intentionally deterministic: semantic reconciliation may shape create\n * operations, but it may not redirect an update away from its supplied target.\n */\nexport function buildExplicitUpdateActions(\n targetIntentIds: string[] | undefined,\n activeIntentIds: string[],\n candidates: VerifiedIntent[],\n): { actions: NormalizedIntentAction[]; failure?: IntentValidationFailure } {\n if (targetIntentIds?.length !== 1 || !activeIntentIds.includes(targetIntentIds[0])) {\n return {\n actions: [],\n failure: {\n category: 'update_target_boundary',\n message: 'Explicit update requires exactly one active intent owned by the caller.',\n },\n };\n }\n if (candidates.length !== 1) {\n return {\n actions: [],\n failure: {\n category: 'reconciliation_boundary',\n message: 'Explicit update must resolve to exactly one verified intent.',\n },\n };\n }\n\n const candidate = candidates[0];\n return {\n actions: [{\n type: 'update',\n id: targetIntentIds[0],\n payload: candidate.description,\n score: candidate.score ?? null,\n reasoning: candidate.reasoning ?? 'Explicit user-confirmed update',\n intentMode: candidate.verification?.referential_anchor ? 'REFERENTIAL' : 'ATTRIBUTIVE',\n }],\n };\n}\n\nconst MAX_PERMISSIBLE_ENTROPY = 0.75;\nconst MIN_CLEAR_INTENT_SCORE = 40;\nconst GENERIC_JOB_PHRASE = /\\b(?:a|any|some)\\s+job\\b/i;\n\nconst inferRoleFromContextText = (text: string): string | null => {\n const normalized = text.toLowerCase();\n if (/\\b(engineer|developer)\\b/.test(normalized)) return \"software engineering\";\n if (/\\b(designer|ux|ui)\\b/.test(normalized)) return \"product design\";\n if (/\\b(marketing|marketer|growth)\\b/.test(normalized)) return \"marketing\";\n if (/\\b(product manager|product)\\b/.test(normalized)) return \"product management\";\n if (/\\b(data scientist|machine learning|ml|ai)\\b/.test(normalized)) return \"AI/ML\";\n if (/\\b(sales|account executive|business development)\\b/.test(normalized)) return \"sales\";\n return null;\n};\n\n/**\n * Derive a job-role qualifier from the user's global user_context paragraph\n * (the identity text that replaced the legacy profile projection). Role is\n * inferred from the free text; the old structured skills/interests extraction\n * is gone with the removed profile fields.\n */\nconst buildJobQualifierFromContext = (contextText: string): string | null => {\n const roleHint = inferRoleFromContextText(contextText ?? \"\");\n return roleHint ? `${roleHint} role` : null;\n};\n\nconst enrichVagueIntentWithContext = (description: string, userContext: string): string => {\n const trimmed = description?.trim();\n if (!trimmed) return description;\n\n const isGenericJobRequest =\n GENERIC_JOB_PHRASE.test(trimmed) ||\n /\\b(?:find|get|look(?:ing)?\\s+for|want)\\s+(?:to\\s+)?(?:find\\s+)?job\\b/i.test(trimmed);\n if (!isGenericJobRequest) return description;\n\n const qualifier = buildJobQualifierFromContext(userContext);\n if (!qualifier) return description;\n\n const enriched = trimmed\n .replace(/\\ba job\\b/i, `a ${qualifier}`)\n .replace(/\\bjob\\b/i, `${qualifier}`)\n .replace(/\\s{2,}/g, \" \")\n .trim();\n\n return enriched.length > 0 ? enriched : description;\n};\n\nconst isVague = (description: string, entropy: number, clarity: number): boolean => {\n if (GENERIC_JOB_PHRASE.test(description)) return true;\n if (entropy > MAX_PERMISSIBLE_ENTROPY) return true;\n if (clarity < MIN_CLEAR_INTENT_SCORE) return true;\n return false;\n};\n\nconst getSpecificityWarning = (verdict: { specificity_warning?: string | null }): string => {\n const warning = verdict.specificity_warning?.trim();\n return warning && warning.length > 0 ? warning : DEFAULT_SPECIFICITY_WARNING;\n};\n\nconst toSpeechActType = (classification?: string): \"COMMISSIVE\" | \"DIRECTIVE\" | null => {\n if (classification === \"COMMISSIVE\" || classification === \"DIRECTIVE\") return classification;\n return null;\n};\n\n/**\n * Factory class to build and compile the Intent Processing Graph.\n */\nexport class IntentGraphFactory {\n constructor(\n private database: IntentGraphDatabase,\n private embedder?: EmbeddingGenerator,\n private intentQueue?: IntentGraphQueue,\n private questionerEnqueue?: QuestionerEnqueueFn,\n private agents?: {\n inferrer?: Pick<ExplicitIntentInferrer, 'invoke'>;\n verifier?: Pick<SemanticVerifier, 'invoke'>;\n reconciler?: Pick<IntentReconciler, 'invoke'>;\n },\n ) { }\n\n public createGraph() {\n // Instantiate Agents (Nodes)\n const inferrer = this.agents?.inferrer ?? new ExplicitIntentInferrer();\n const verifier = this.agents?.verifier ?? new SemanticVerifier();\n const reconciler = this.agents?.reconciler ?? new IntentReconciler();\n\n // --- NODE DEFINITIONS ---\n\n /**\n * Node 0: Prep\n * Always fetches ALL of the user's active intents from the DB via getActiveIntents(userId).\n * This ensures reconciliation can detect duplicates and modifications globally,\n * regardless of network scope.\n */\n const prepNode = async (state: typeof IntentGraphState.State) => {\n return timed(\"IntentGraph.prep\", async () => {\n logger.verbose(\"Starting preparation phase\", {\n operationMode: state.operationMode,\n hasContent: !!state.inputContent,\n targetIntentIds: state.targetIntentIds,\n networkId: state.networkId,\n });\n\n // Gate: write operations require an existing profile\n if (state.operationMode !== 'read') {\n const profile = await this.database.getProfile(state.userId);\n if (!profile) {\n const msg = \"You need to create a profile before creating intents. Please set up your profile first.\";\n logger.error(\"Prep failed: no profile for user\", { userId: state.userId });\n return { error: msg };\n }\n }\n\n const activeIntents = await this.database.getActiveIntents(state.userId);\n const formattedActiveIntents = activeIntents\n .map(i => `ID: ${i.id}, Description: ${i.payload}, Summary: ${i.summary || 'N/A'}`)\n .join('\\n') || \"No active intents.\";\n\n logger.verbose(\"Fetched active intents\", {\n count: activeIntents.length,\n operationMode: state.operationMode\n });\n\n return {\n activeIntents: formattedActiveIntents,\n activeIntentIds: activeIntents.map((intent) => intent.id),\n trace: [{\n node: \"prep\",\n detail: `Fetched ${activeIntents.length} active intent(s)`,\n }],\n };\n });\n };\n\n /**\n * Node 1: Inference\n * Extracts intents from raw content.\n * Phase 4: Uses operation mode to control behavior and determine if node should execute.\n * Phase 5: Passes conversation context for anaphoric resolution.\n */\n const inferenceNode = async (state: typeof IntentGraphState.State) => {\n return timed(\"IntentGraph.inference\", async () => {\n logger.verbose(\"Starting inference\", {\n operationMode: state.operationMode,\n hasContent: !!state.inputContent,\n contentPreview: state.inputContent?.substring(0, 50),\n hasConversationContext: !!state.conversationContext,\n conversationMessagesCount: state.conversationContext?.length || 0\n });\n\n const agentTimingsAccum: DebugMetaAgent[] = [];\n\n // Phase 4: Control profile fallback based on operation mode\n // Only allow for create operations without explicit content\n const allowProfileFallback = state.operationMode === 'create' && !state.inputContent;\n\n // Cast operationMode: 'read' and 'propose' map to 'create' for the inferrer\n // (inference node is never called in read mode; propose behaves like create for inference)\n const inferrerMode = (state.operationMode === 'read' || state.operationMode === 'propose') ? 'create' : state.operationMode;\n const _traceEmitterInferrer = requestContext.getStore()?.traceEmitter;\n const inferrerStart = Date.now();\n _traceEmitterInferrer?.({ type: \"agent_start\", name: \"intent-inferrer\" });\n const result = await inferrer.invoke(\n state.inputContent || null,\n state.userProfile,\n {\n allowProfileFallback,\n operationMode: inferrerMode,\n conversationContext: state.conversationContext // Phase 5: Pass conversation history\n }\n );\n agentTimingsAccum.push({ name: 'intent.inferrer', durationMs: Date.now() - inferrerStart });\n _traceEmitterInferrer?.({ type: \"agent_end\", name: \"intent-inferrer\", durationMs: Date.now() - inferrerStart, summary: result.intents.length > 0 ? `Extracted ${result.intents.length} intent(s)` : \"intent-inferrer completed\" });\n\n logger.verbose(\"Inference complete\", {\n inferredCount: result.intents.length,\n operationMode: state.operationMode\n });\n\n const descriptions = result.intents.map(i => i.description).slice(0, 3);\n const truncated = result.intents.length > 3 ? `... +${result.intents.length - 3} more` : \"\";\n\n return {\n inferredIntents: result.intents,\n agentTimings: agentTimingsAccum,\n trace: [{\n node: \"inference\",\n detail: result.intents.length === 0\n ? \"No intents extracted\"\n : `Extracted ${result.intents.length}: ${descriptions.map(d => `\"${d.slice(0, 50)}${d.length > 50 ? '...' : ''}\"`).join(\", \")}${truncated}`,\n }],\n };\n });\n };\n\n /**\n * Node 2: Verification (Map-Reduce / Parallel)\n * Verifies each inferred intent in parallel.\n * Phase 4: Can be skipped for delete operations and updates with no new intents.\n */\n const verificationNode = async (state: typeof IntentGraphState.State) => {\n return timed(\"IntentGraph.verification\", async () => {\n const intents = state.inferredIntents;\n\n logger.verbose(\"Starting verification\", {\n operationMode: state.operationMode,\n intentCount: intents.length\n });\n\n if (intents.length === 0) {\n logger.verbose(\"No intents to verify\");\n return { verifiedIntents: [], agentTimings: [] };\n }\n\n logger.verbose('Verifying intents in parallel', { count: intents.length });\n\n const agentTimingsAccum: DebugMetaAgent[] = [];\n\n // Parallel Execution\n const verificationResults = await Promise.all(\n intents.map(async (intent): Promise<\n { intent: VerifiedIntent } | { failure: IntentValidationFailure }\n > => {\n try {\n let description = intent.description;\n const _traceEmitterVerifier = requestContext.getStore()?.traceEmitter;\n const verifierStart1 = Date.now();\n _traceEmitterVerifier?.({ type: \"agent_start\", name: \"intent-verifier\" });\n let verdict = await verifier.invoke(description, state.userProfile);\n agentTimingsAccum.push({ name: 'intent.verifier', durationMs: Date.now() - verifierStart1 });\n _traceEmitterVerifier?.({ type: \"agent_end\", name: \"intent-verifier\", durationMs: Date.now() - verifierStart1, summary: `Verified: ${verdict.classification}` });\n\n if (isVague(description, verdict.semantic_entropy, verdict.felicity_scores.clarity)) {\n // Role-hint enrichment for vague job intents reads the global\n // user_context paragraph instead of the structured profile fields.\n const roleHintContext = (await this.database.getUserContext(state.userId, null))?.text ?? '';\n const enrichedDescription = enrichVagueIntentWithContext(description, roleHintContext);\n if (enrichedDescription !== description) {\n logger.verbose(\"Enriched vague intent using profile context\", {\n before: description,\n after: enrichedDescription,\n });\n const _traceEmitterVerifier2 = requestContext.getStore()?.traceEmitter;\n const verifierStart2 = Date.now();\n _traceEmitterVerifier2?.({ type: \"agent_start\", name: \"intent-verifier\" });\n const enrichedVerdict = await verifier.invoke(enrichedDescription, state.userProfile);\n agentTimingsAccum.push({ name: 'intent.verifier', durationMs: Date.now() - verifierStart2 });\n _traceEmitterVerifier2?.({ type: \"agent_end\", name: \"intent-verifier\", durationMs: Date.now() - verifierStart2, summary: `Verified (enriched): ${enrichedVerdict.classification}` });\n const becameClear =\n enrichedVerdict.semantic_entropy < verdict.semantic_entropy ||\n enrichedVerdict.felicity_scores.clarity > verdict.felicity_scores.clarity;\n if (becameClear) {\n description = enrichedDescription;\n verdict = enrichedVerdict;\n }\n }\n }\n\n // Filter Logic: Must be a Commissive, Directive, or Declaration\n const VALID_TYPES = ['COMMISSIVE', 'DIRECTIVE', 'DECLARATION'];\n if (!VALID_TYPES.includes(verdict.classification)) {\n logger.warn('Dropping intent', { description, classification: verdict.classification });\n return {\n failure: {\n category: 'non_actionable',\n classification: verdict.classification,\n referentialBreadth: verdict.referential_breadth,\n message: `Description was classified as ${verdict.classification}, not an actionable goal.`,\n },\n };\n }\n\n if (isVague(description, verdict.semantic_entropy, verdict.felicity_scores.clarity)) {\n logger.warn('Dropping vague intent after verification', {\n description,\n entropy: verdict.semantic_entropy,\n clarity: verdict.felicity_scores.clarity,\n });\n return {\n failure: {\n category: 'vague_or_invalid',\n classification: verdict.classification,\n referentialBreadth: verdict.referential_breadth,\n message: 'Description failed clarity or semantic-entropy requirements.',\n },\n };\n }\n\n if (state.operationMode === 'create' && verdict.referential_breadth === 'broad') {\n logger.warn('Dropping broad attributive intent before persistence', {\n description,\n referentialBreadth: verdict.referential_breadth,\n missingSelectionalConstraints: verdict.missing_selectional_constraints,\n warning: getSpecificityWarning(verdict),\n });\n return {\n failure: {\n category: 'vague_or_invalid',\n classification: verdict.classification,\n referentialBreadth: verdict.referential_breadth,\n message: getSpecificityWarning(verdict),\n },\n };\n }\n\n // Calculate Score\n const score = Math.min(\n verdict.felicity_scores.authority,\n verdict.felicity_scores.sincerity,\n verdict.felicity_scores.clarity\n );\n\n // Return enriched intent\n return {\n intent: {\n ...intent,\n description,\n verification: verdict,\n score,\n },\n };\n } catch (e) {\n logger.error('Error verifying intent', { description: intent.description, error: e });\n return {\n failure: {\n category: 'verification_failure',\n message: e instanceof Error ? e.message : 'Intent verification failed unexpectedly.',\n },\n };\n }\n })\n );\n\n const verified = verificationResults.flatMap((result) => 'intent' in result ? [result.intent] : []);\n const validationFailures = verificationResults.flatMap((result) => 'failure' in result ? [result.failure] : []);\n logger.verbose(`Verification complete`, {\n passed: verified.length,\n total: intents.length,\n operationMode: state.operationMode\n });\n\n // Build trace entries with Felicity scores for each verified intent\n const traceEntries = verified.map(v => {\n const fs = v.verification?.felicity_scores;\n const entropy = v.verification?.semantic_entropy;\n const classification = v.verification?.classification;\n const referentialBreadth = v.verification?.referential_breadth;\n return {\n node: \"verification\",\n detail: `\"${v.description.slice(0, 40)}${v.description.length > 40 ? '...' : ''}\" → ${classification}${referentialBreadth ? ` (${referentialBreadth} referential breadth)` : ''}`,\n data: fs ? {\n clarity: fs.clarity,\n authority: fs.authority,\n sincerity: fs.sincerity,\n entropy: entropy != null ? Math.round(entropy * 100) / 100 : undefined,\n referentialBreadth,\n missingSelectionalConstraints: v.verification?.missing_selectional_constraints,\n specificityWarning: v.verification?.specificity_warning ?? undefined,\n classification,\n score: v.score,\n } : undefined,\n };\n });\n\n // Add summary trace if some intents were filtered out\n const dropped = intents.length - verified.length;\n if (dropped > 0) {\n traceEntries.unshift({\n node: \"verification\",\n detail: `Verified ${verified.length}/${intents.length} (${dropped} filtered as invalid)`,\n data: undefined,\n });\n } else if (verified.length > 0) {\n traceEntries.unshift({\n node: \"verification\",\n detail: `Verified ${verified.length} intent(s)`,\n data: undefined,\n });\n }\n\n return { verifiedIntents: verified, validationFailures, agentTimings: agentTimingsAccum, trace: traceEntries };\n });\n };\n\n /**\n * Node 3: Reconciliation\n * Decides on final actions (Create, Update, Expire).\n * Phase 4: Handles delete operations directly without LLM reconciliation.\n */\n const reconciliationNode = async (state: typeof IntentGraphState.State) => {\n return timed(\"IntentGraph.reconciliation\", async () => {\n logger.verbose(\"Starting reconciliation\", {\n operationMode: state.operationMode,\n verifiedIntentCount: state.verifiedIntents.length,\n targetIntentIds: state.targetIntentIds\n });\n\n const agentTimingsAccum: DebugMetaAgent[] = [];\n\n // Phase 4: Handle delete operations directly\n if (state.operationMode === 'delete') {\n if (!state.targetIntentIds || state.targetIntentIds.length === 0) {\n logger.warn(\"Delete mode with no target IDs\");\n return {\n actions: [],\n agentTimings: agentTimingsAccum,\n trace: [{ node: \"reconciler\", detail: \"Delete mode with no target IDs\" }],\n };\n }\n\n logger.verbose(\"Delete mode - generating expire actions\", {\n targetIds: state.targetIntentIds\n });\n\n const actions = state.targetIntentIds.map(id => ({\n type: 'expire' as const,\n id,\n reasoning: 'User requested deletion'\n }));\n\n return {\n actions,\n agentTimings: agentTimingsAccum,\n trace: [{\n node: \"reconciler\",\n detail: `Actions: expire=${actions.length}`,\n }],\n };\n }\n\n // Standard reconciliation for create/update operations\n const candidates = state.verifiedIntents;\n if (candidates.length === 0) {\n logger.verbose(\"No verified intents to reconcile\");\n return {\n actions: [],\n agentTimings: agentTimingsAccum,\n trace: [{ node: \"reconciler\", detail: \"No intents to reconcile\" }],\n };\n }\n\n if (state.operationMode === 'update') {\n const explicitUpdate = buildExplicitUpdateActions(\n state.targetIntentIds,\n state.activeIntentIds,\n candidates,\n );\n return {\n actions: explicitUpdate.actions,\n validationFailures: explicitUpdate.failure\n ? [...state.validationFailures, explicitUpdate.failure]\n : state.validationFailures,\n agentTimings: agentTimingsAccum,\n trace: [{\n node: 'reconciler',\n detail: explicitUpdate.failure\n ? `Explicit update rejected: ${explicitUpdate.failure.category}`\n : `Explicit update bound to target ${state.targetIntentIds?.[0]}`,\n }],\n };\n }\n\n // Format candidates for the Reconciler Prompt\n const formattedCandidates = candidates.map(c =>\n `- [${c.type.toUpperCase()}] \"${c.description}\" (Confidence: ${c.confidence}, Score: ${c.score})\\n` +\n ` Reasoning: ${c.reasoning}\\n` +\n ` Verification: ${c.verification?.classification} (Flags: ${c.verification?.flags.join(', ') || 'None'})`\n ).join('\\n');\n\n logger.verbose(\"Invoking reconciler agent\", {\n candidateCount: candidates.length,\n operationMode: state.operationMode\n });\n\n const _traceEmitterReconciler = requestContext.getStore()?.traceEmitter;\n const reconcilerStart = Date.now();\n _traceEmitterReconciler?.({ type: \"agent_start\", name: \"intent-reconciler\" });\n const result = await reconciler.invoke(formattedCandidates, state.activeIntents);\n agentTimingsAccum.push({ name: 'intent.reconciler', durationMs: Date.now() - reconcilerStart });\n _traceEmitterReconciler?.({ type: \"agent_end\", name: \"intent-reconciler\", durationMs: Date.now() - reconcilerStart, summary: `Reconciled ${result.actions.length} action(s)` });\n\n const actions = enforceIntentActionBoundary(\n state.operationMode,\n state.targetIntentIds,\n result.actions,\n );\n logger.verbose(\"Reconciliation complete\", {\n actionCount: actions.length,\n droppedActionCount: result.actions.length - actions.length,\n operationMode: state.operationMode\n });\n\n // Count actions by type after enforcing the operation boundary.\n const counts = { create: 0, update: 0, expire: 0 };\n for (const a of actions) {\n if (a.type in counts) counts[a.type as keyof typeof counts]++;\n }\n\n return {\n actions,\n agentTimings: agentTimingsAccum,\n trace: [{\n node: \"reconciler\",\n detail: `Actions: create=${counts.create}, update=${counts.update}, expire=${counts.expire}`,\n }],\n };\n });\n };\n\n /** Strip URLs and \"More details at [url]\" from intent payloads before persisting. */\n const sanitizePayload = (payload: string): string => {\n if (!payload || typeof payload !== \"string\") return payload;\n const out = payload\n .replace(/\\s*More details at\\s*:?\\s*https?:\\/\\/[^\\s\"'<>)\\]]+/gi, \"\")\n .replace(/\\s*See\\s+https?:\\/\\/[^\\s\"'<>)\\]]+\\s+for\\s+more[^.]*\\.?/gi, \"\")\n .replace(/https?:\\/\\/[^\\s\"'<>)\\]]+/g, \"\")\n .replace(/\\s{2,}/g, \" \")\n .trim();\n return out.replace(/[.,;]\\s*$/, \"\").trim() || payload;\n };\n\n /**\n * Generate a flat embedding for an intent payload, swallowing failures so\n * persistence can continue without an embedding. `intentId` is logging-only\n * (present for updates, absent for creates).\n */\n const generateIntentEmbedding = async (\n sanitizedPayload: string,\n intentId?: string,\n ): Promise<number[] | undefined> => {\n if (!this.embedder) return undefined;\n try {\n const embedding = await this.embedder.generate(sanitizedPayload, undefined, getAbortSignalConfig());\n const flatEmbedding = Array.isArray(embedding?.[0])\n ? (embedding as number[][])[0]\n : (embedding as number[]);\n logger.verbose(\"Generated embedding for intent\", {\n ...(intentId ? { intentId } : {}),\n dimensions: flatEmbedding?.length,\n });\n return flatEmbedding;\n } catch (embErr) {\n logger.error(\"Failed to generate embedding for intent (continuing without)\", {\n ...(intentId ? { intentId } : {}),\n error: embErr,\n });\n return undefined;\n }\n };\n\n /**\n * Node 4: Executor\n * Executes reconciler actions against the database.\n */\n const executorNode = async (state: typeof IntentGraphState.State) => {\n return timed(\"IntentGraph.executor\", async () => {\n const actions = enforceIntentActionBoundary(\n state.operationMode,\n state.targetIntentIds,\n state.actions ?? [],\n );\n if (actions.length === 0) {\n return { executionResults: [] };\n }\n\n logger.verbose('Executing actions', { count: actions.length });\n const results: ExecutionResult[] = [];\n const scopeEnvelope = state.scopeType && state.scopeId\n ? { scopeType: state.scopeType, scopeId: state.scopeId }\n : {};\n const verifiedIntentByPayload = new Map<string, VerifiedIntent>();\n for (const verifiedIntent of state.verifiedIntents) {\n verifiedIntentByPayload.set(verifiedIntent.description, verifiedIntent);\n verifiedIntentByPayload.set(sanitizePayload(verifiedIntent.description), verifiedIntent);\n }\n\n for (const action of actions) {\n const actionType = action.type.toLowerCase() as 'create' | 'update' | 'expire';\n try {\n if (actionType === 'create') {\n const createAction = action as {\n payload: string;\n score: number | null;\n semanticEntropy?: number | null;\n referentialAnchor?: string | null;\n intentMode?: 'REFERENTIAL' | 'ATTRIBUTIVE' | null;\n };\n const sanitizedPayload = sanitizePayload(createAction.payload);\n const matchedVerifiedIntent =\n verifiedIntentByPayload.get(createAction.payload) ||\n verifiedIntentByPayload.get(sanitizedPayload);\n\n // Generate embedding for the intent payload\n const flatEmbedding = await generateIntentEmbedding(sanitizedPayload);\n\n const created = await this.database.createIntent({\n userId: state.userId,\n payload: sanitizedPayload,\n confidence: createAction.score ? createAction.score / 100 : 1.0,\n inferenceType: 'explicit',\n sourceType: 'discovery_form',\n embedding: flatEmbedding,\n semanticEntropy:\n createAction.semanticEntropy ??\n matchedVerifiedIntent?.verification?.semantic_entropy ??\n null,\n referentialAnchor:\n createAction.referentialAnchor ??\n matchedVerifiedIntent?.verification?.referential_anchor ??\n null,\n felicityAuthority: matchedVerifiedIntent?.verification?.felicity_scores.authority ?? null,\n felicitySincerity: matchedVerifiedIntent?.verification?.felicity_scores.sincerity ?? null,\n felicityClarity: matchedVerifiedIntent?.verification?.felicity_scores.clarity ?? null,\n intentMode: createAction.intentMode ?? null,\n speechActType: toSpeechActType(matchedVerifiedIntent?.verification?.classification),\n });\n\n results.push({ actionType: 'create', success: true, intentId: created.id, payload: sanitizedPayload });\n logger.verbose('Created intent', { intentId: created.id });\n\n this.intentQueue?.addGenerateHydeJob({\n intentId: created.id,\n userId: state.userId,\n ...scopeEnvelope,\n }).catch((err) =>\n logger.error('Failed to enqueue intent HyDE job', { intentId: created.id, error: err })\n );\n\n if (this.questionerEnqueue) {\n const userContext = (await this.database.getUserContext(state.userId, null))?.text ?? '';\n this.questionerEnqueue({\n mode: 'intent',\n userId: state.userId,\n sourceType: 'intent',\n sourceId: created.id,\n ...scopeEnvelope,\n context: {\n intentId: created.id,\n payload: sanitizedPayload,\n userContext,\n },\n }).catch((err) =>\n logger.error('Failed to enqueue intent question generation', { intentId: created.id, error: err })\n );\n }\n\n } else if (actionType === 'update') {\n const updateAction = action as {\n id: string;\n payload: string;\n intentMode?: 'REFERENTIAL' | 'ATTRIBUTIVE' | null;\n };\n const sanitizedPayload = sanitizePayload(updateAction.payload);\n const matchedVerifiedIntent =\n verifiedIntentByPayload.get(updateAction.payload) ||\n verifiedIntentByPayload.get(sanitizedPayload);\n\n // Regenerate embedding for the updated payload\n const flatEmbedding = await generateIntentEmbedding(sanitizedPayload, updateAction.id);\n\n const updated = await this.database.updateIntent(updateAction.id, {\n payload: sanitizedPayload,\n embedding: flatEmbedding,\n semanticEntropy:\n matchedVerifiedIntent?.verification?.semantic_entropy ??\n null,\n referentialAnchor:\n matchedVerifiedIntent?.verification?.referential_anchor ??\n null,\n felicityAuthority: matchedVerifiedIntent?.verification?.felicity_scores.authority ?? null,\n felicitySincerity: matchedVerifiedIntent?.verification?.felicity_scores.sincerity ?? null,\n felicityClarity: matchedVerifiedIntent?.verification?.felicity_scores.clarity ?? null,\n intentMode: updateAction.intentMode ?? null,\n speechActType: toSpeechActType(matchedVerifiedIntent?.verification?.classification),\n ...(state.expectedIntentFingerprint !== undefined ? {\n expectedIntentFingerprint: state.expectedIntentFingerprint,\n expectedIntentUserId: state.userId,\n } : {}),\n });\n results.push({\n actionType: 'update',\n success: !!updated,\n intentId: updateAction.id,\n payload: sanitizedPayload,\n error: updated ? undefined : 'Intent not found'\n });\n logger.verbose('Updated intent', { intentId: updateAction.id });\n if (updated) {\n this.intentQueue?.addGenerateHydeJob({\n intentId: updateAction.id,\n userId: state.userId,\n ...scopeEnvelope,\n }).catch((err) =>\n logger.error('Failed to enqueue intent HyDE job', { intentId: updateAction.id, error: err })\n );\n }\n\n } else if (actionType === 'expire') {\n const expireAction = action as { id: string };\n const result = await this.database.archiveIntent(expireAction.id);\n results.push({\n actionType: 'expire',\n success: result.success,\n intentId: expireAction.id,\n error: result.error\n });\n logger.verbose('Archived intent', { intentId: expireAction.id });\n if (result.success) {\n this.intentQueue?.addDeleteHydeJob({ intentId: expireAction.id }).catch((err) =>\n logger.error('Failed to enqueue intent HyDE delete job', { intentId: expireAction.id, error: err })\n );\n }\n }\n } catch (error) {\n logger.error('Failed to execute action', { actionType: action.type, error });\n results.push({\n actionType,\n success: false,\n intentId: 'id' in action ? action.id : undefined,\n error: error instanceof Error ? error.message : 'Unknown error'\n });\n }\n }\n\n return { executionResults: results };\n });\n };\n\n // --- QUERY NODE (Read Mode) ---\n\n /**\n * Node: Query\n * Fast-path read node — fetches intents from DB based on scope.\n * Handles: global user intents, network-scoped (all or filtered by user).\n * No LLM calls; no inference/verification/reconciliation.\n */\n const queryNode = async (state: typeof IntentGraphState.State) => {\n return timed(\"IntentGraph.query\", async () => {\n logger.verbose(\"Starting query (read mode)\", {\n userId: state.userId,\n networkId: state.networkId,\n queryUserId: state.queryUserId,\n allUserIntents: state.allUserIntents,\n });\n\n try {\n // Scope-aware default: caller's intents across all reachable networks.\n // Triggered when the tool layer passed indexScope and did not pick a\n // specific networkId or queryUserId — i.e. \"my intents\" in a chat\n // where the agent's reach is more than one index.\n if (\n !state.queryUserId &&\n !state.networkId &&\n state.indexScope &&\n state.indexScope.length > 0\n ) {\n const intents = await this.database.getActiveIntentsAcrossIndexes(\n state.userId,\n state.indexScope,\n );\n if (intents.length === 0) {\n return {\n readResult: {\n count: 0,\n intents: [],\n message: \"You don't have any active intents yet. Share what you're looking for.\",\n },\n };\n }\n return {\n readResult: {\n count: intents.length,\n intents: intents.map((i) => ({\n id: i.id,\n description: i.payload,\n summary: i.summary,\n createdAt: i.createdAt,\n })),\n },\n };\n }\n\n // When allUserIntents is true, ignore network scope and return all\n const effectiveIndexId = state.allUserIntents ? undefined : state.networkId;\n\n if (effectiveIndexId) {\n // Verify membership\n const isMember = await this.database.isNetworkMember(effectiveIndexId, state.userId);\n if (!isMember) {\n return {\n readResult: {\n count: 0,\n intents: [],\n message: \"Index not found or you are not a member.\",\n },\n };\n }\n\n // Network-scoped read\n if (!state.queryUserId) {\n // All intents in the index (any member can see)\n const intents = await this.database.getNetworkIntentsForMember(\n effectiveIndexId,\n state.userId,\n { limit: 50, offset: 0 }\n );\n if (intents.length === 0) {\n return {\n readResult: {\n count: 0,\n intents: [],\n message: \"No intents in this network yet.\",\n networkId: effectiveIndexId,\n },\n };\n }\n return {\n readResult: {\n count: intents.length,\n networkId: effectiveIndexId,\n intents: intents.map((i) => ({\n id: i.id,\n description: i.payload,\n summary: i.summary,\n createdAt: i.createdAt,\n userId: i.userId,\n userName: i.userName,\n })),\n },\n };\n }\n\n // Specific user's intents in the index\n const effectiveUserId = state.queryUserId;\n const intents = await this.database.getIntentsInIndexForMember(\n effectiveUserId,\n effectiveIndexId\n );\n if (intents.length === 0) {\n return {\n readResult: {\n count: 0,\n intents: [],\n message:\n effectiveUserId === state.userId\n ? \"You don't have any intents in this network yet.\"\n : \"No intents for that user in this network.\",\n networkId: effectiveIndexId,\n },\n };\n }\n const user = await this.database.getUser(effectiveUserId);\n const userName = user?.name ?? null;\n return {\n readResult: {\n count: intents.length,\n networkId: effectiveIndexId,\n intents: intents.map((i) => ({\n id: i.id,\n description: i.payload,\n summary: i.summary,\n createdAt: i.createdAt,\n userId: effectiveUserId,\n userName,\n })),\n },\n };\n }\n\n // Global (no network scope): return user's own active intents\n const intents = await this.database.getActiveIntents(state.userId);\n if (intents.length === 0) {\n return {\n readResult: {\n count: 0,\n intents: [],\n message:\n \"You don't have any active intents yet. Share what you're looking for.\",\n },\n };\n }\n return {\n readResult: {\n count: intents.length,\n intents: intents.map((i) => ({\n id: i.id,\n description: i.payload,\n summary: i.summary,\n createdAt: i.createdAt,\n })),\n },\n };\n } catch (err) {\n logger.error(\"Query node failed\", { error: err });\n return {\n readResult: {\n count: 0,\n intents: [],\n message: \"Failed to fetch intents. Please try again.\",\n },\n };\n }\n });\n };\n\n // --- CONDITIONAL ROUTING FUNCTIONS ---\n\n /**\n * After prep: read mode → query; otherwise decide inference vs reconciler by operation mode.\n */\n const afterPrepRoute = (state: typeof IntentGraphState.State): string => {\n if (state.error) {\n logger.warn('Prep failed with error, short-circuiting to END', { error: state.error });\n return '__end__';\n }\n if (state.operationMode === 'read') {\n logger.verbose('Read mode - routing to query (fast path)');\n return 'query';\n }\n return shouldRunInference(state);\n };\n\n /**\n * Determines if inference should run based on operation mode.\n * Delete operations skip inference entirely and go straight to reconciliation.\n */\n const shouldRunInference = (state: typeof IntentGraphState.State): string => {\n if (state.operationMode === 'delete') {\n logger.verbose('Delete mode - skipping inference, routing to reconciliation');\n return 'reconciler';\n }\n\n logger.verbose('Running inference', {\n operationMode: state.operationMode\n });\n return 'inference';\n };\n\n /**\n * Determines if verification should run based on operation mode and inferred intents.\n * Skips verification for:\n * - Operations with no inferred intents\n * - Can be extended to skip for update operations with no new intents\n */\n const shouldRunVerification = (state: typeof IntentGraphState.State): string => {\n if (state.inferredIntents.length === 0) {\n if (state.operationMode === 'propose') {\n logger.verbose('Propose mode with no inferred intents - exiting early');\n return '__end__';\n }\n logger.verbose('No intents to verify - skipping verification, routing to reconciliation');\n return 'reconciler';\n }\n\n if (state.operationMode === 'update') {\n logger.verbose('Update mode with new intents - running verification');\n return 'verification';\n }\n\n if (state.operationMode === 'create') {\n logger.verbose('Create mode - running verification');\n return 'verification';\n }\n\n // Default to verification for safety\n logger.verbose('Default routing to verification');\n return 'verification';\n };\n\n // --- GRAPH ASSEMBLY WITH CONDITIONAL EDGES (PHASE 4) ---\n\n const workflow = new StateGraph(IntentGraphState)\n .addNode(\"prep\", prepNode)\n .addNode(\"query\", queryNode)\n .addNode(\"inference\", inferenceNode)\n .addNode(\"verification\", verificationNode)\n .addNode(\"reconciler\", reconciliationNode)\n .addNode(\"executor\", executorNode)\n\n // Flow paths:\n // - READ: prep → query → END (fast path, no LLM calls)\n // - CREATE: prep → inference → verification → reconciler → executor → END\n // - UPDATE: prep → inference → reconciliation → executor → END (skips verification if no new intents)\n // - DELETE: prep → reconciliation → executor → END (skips inference and verification)\n // - PROPOSE: prep → inference → verification → END (no reconciliation/execution, no DB writes)\n .addEdge(START, \"prep\")\n\n // After prep: read mode → query; else inference or reconciler\n .addConditionalEdges(\"prep\", afterPrepRoute, {\n query: \"query\",\n inference: \"inference\",\n reconciler: \"reconciler\",\n __end__: END,\n })\n\n // Query (read mode) always ends\n .addEdge(\"query\", END)\n\n // After inference: decide if we need verification (skip if no intents)\n .addConditionalEdges(\"inference\", shouldRunVerification, {\n verification: \"verification\",\n reconciler: \"reconciler\",\n __end__: END,\n })\n\n // After verification: propose mode exits early; others continue to reconciliation\n .addConditionalEdges(\"verification\", (state: typeof IntentGraphState.State) => {\n if (state.operationMode === 'propose') {\n logger.verbose('Propose mode - stopping after verification, skipping reconciliation');\n return '__end__';\n }\n return 'reconciler';\n }, {\n reconciler: \"reconciler\",\n __end__: END,\n })\n\n // Reconciliation always goes to executor\n .addEdge(\"reconciler\", \"executor\")\n\n // Executor is always the end\n .addEdge(\"executor\", END);\n\n return workflow.compile();\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intent.indexer.d.ts","sourceRoot":"/","sources":["intent/intent.indexer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;EAIpC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AA0D5E,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAA2C;;IAQxD;;;OAGG;IACH,OAAO,CAAC,QAAQ;IAQhB;;;;;;;;;OASG;IAEU,MAAM,CACjB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,EAC3B,UAAU,CAAC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AC;IACpF,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,MAAM;QAClB,OAAO,IAAI,CACT,KAAK,EAAE,IAMN,EAAE,EAAE;YACH,MAAM,KAAK,GAAG,IAAI,aAAa,EAAE,CAAC;YAClC,OAAO,MAAM,KAAK,CAAC,MAAM,CACvB,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,cAAc,CACpB,CAAC;QACJ,CAAC,EACD;YACE,IAAI,EAAE,gBAAgB;YACtB,WAAW,EACT,8HAA8H;YAChI,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;gBACf,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;gBAC7D,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;gBACnF,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;gBAChF,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;gBACzF,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2DAA2D,CAAC;aACvH,CAAC;SACH,CACF,CAAC;IACJ,CAAC;CACF;AAhGc;IADZ,KAAK,EAAE;;;;2CA4CP;AAOY;IADZ,KAAK,EAAE;;;;6CASP","sourcesContent":["import { HumanMessage, SystemMessage } from \"@langchain/core/messages\";\nimport { tool } from \"@langchain/core/tools\";\nimport { z } from \"zod\";\nimport { log } from \"../shared/observability/log.js\";\nimport { Timed } from \"../shared/observability/performance.js\";\nimport { createStructuredModel } from \"../shared/agent/model.config.js\";\nimport { invokeWithAbortSignal } from \"../shared/agent/model-signal.js\";\n\n// ──────────────────────────────────────────────────────────────\n// Response schema\n// ──────────────────────────────────────────────────────────────\n\nexport const IntentIndexerOutputSchema = z.object({\n indexScore: z.number().min(0).max(1).describe(\"Score for index appropriateness (0.0-1.0)\"),\n memberScore: z.number().min(0).max(1).describe(\"Score for member preference match (0.0-1.0)\"),\n reasoning: z.string().describe(\"Brief reasoning for the scores\"),\n});\n\n/**\n * Output structure for the Intent Indexer agent.\n */\nexport type IntentIndexerOutput = z.infer<typeof IntentIndexerOutputSchema>;\n\nconst logger = log.lib.from(\"IntentIndexer\");\nconst invokeLog = log.lib.from(\"IntentIndexer:invoke\");\n\n\n// ──────────────────────────────────────────────────────────────\n// 1. SYSTEM PROMPT\n// ──────────────────────────────────────────────────────────────\n\nconst systemPrompt = `\nYou are an expert Intent Evaluator for a social networking protocol.\n\nTASK:\nDetermine if a User Intent is appropriate for a specific Index (community) and matches a Member's sharing preferences.\n\nINPUTS:\n1. Intent: The content/action the user wants to perform.\n2. Network Prompt: The purpose/scope of the target community (Index).\n3. Member Prompt: The specific sharing preferences of the user in that community (optional).\n4. Source: Origin of the intent (file, link, etc.) (optional).\n5. Network Context: Rendered context about the network including type, dates, location, and events (optional).\n\nNETWORK TYPE AWARENESS:\n- When Network Context is provided, use it to inform your scoring.\n- For EVENT networks: consider temporal relevance. An intent about \"meeting at the venue\" is highly relevant to an upcoming event but irrelevant after it ends. Intents about topics aligned with the event's themes should score higher.\n- For COMMUNITY networks: score based on the network prompt and member preferences as usual.\n- If the network context includes dates and the intent is time-sensitive, factor temporal proximity into the score.\n\nSCORING RUBRIC:\n- 0.9-1.0: Highly appropriate, perfect match.\n- 0.7-0.8: Good match, relevant.\n- 0.5-0.6: Moderate, borderline.\n- 0.3-0.4: Low appropriateness, poor fit.\n- 0.0-0.2: Not appropriate.\n\nOUTPUT RULES:\n- Provide \\`indexScore\\` based on how well the Intent fits the Network Prompt.\n- Provide \\`memberScore\\` based on how well the Intent fits the Member Prompt (if provided). If Member Prompt is missing/empty, return 0.0 for memberScore.\n- Provide concise \\`reasoning\\`.\n`;\n\n// ──────────────────────────────────────────────────────────────\n// 2. RESPONSE SCHEMA (Zod)\n// ──────────────────────────────────────────────────────────────\n\nconst responseFormat = IntentIndexerOutputSchema;\n\n// ──────────────────────────────────────────────────────────────\n// 3. TYPE DEFINITIONS\n// ──────────────────────────────────────────────────────────────\n\ntype ResponseType = z.infer<typeof responseFormat>;\n\n// ──────────────────────────────────────────────────────────────\n// 4. CLASS DEFINITION\n// ──────────────────────────────────────────────────────────────\n\nexport class IntentIndexer {\n private model: ReturnType<typeof createStructuredModel>;\n\n constructor() {\n this.model = createStructuredModel(\"intentIndexer\", responseFormat, {\n name: \"intent_indexer\",\n });\n }\n\n /**\n * Converts the structured response into a string for logging or embedding.\n * Used when the output needs to be serialized (e.g. for traces).\n */\n private toString(output: ResponseType): string {\n return [\n `indexScore: ${output.indexScore}`,\n `memberScore: ${output.memberScore}`,\n `reasoning: ${output.reasoning}`,\n ].join(\"\\n\");\n }\n\n /**\n * Main entry point. Evaluates the appropriateness of an intent for a given index and member context.\n *\n * @param intent - The intent payload.\n * @param indexPrompt - The purpose of the index (community).\n * @param memberPrompt - The member's sharing preferences (optional).\n * @param sourceName - Optional source name for context (e.g. file, link).\n * @param networkContext - Optional rendered network context (type, dates, metadata).\n * @returns Structured output with indexScore, memberScore, and reasoning, or null on error.\n */\n @Timed()\n public async invoke(\n intent: string,\n indexPrompt: string | null,\n memberPrompt: string | null,\n sourceName?: string | null,\n networkContext?: string | null\n ): Promise<IntentIndexerOutput | null> {\n invokeLog.verbose(\"Evaluating intent\");\n\n const contextParts: string[] = [];\n if (sourceName) contextParts.push(`Source: ${sourceName}`);\n contextParts.push(indexPrompt ? `Index Purpose: ${indexPrompt}` : \"Index Purpose: (Not provided)\");\n contextParts.push(memberPrompt ? `Member Preferences: ${memberPrompt}` : \"Member Preferences: (Not provided)\");\n if (networkContext) contextParts.push(`Network Context:\\n${networkContext}`);\n\n const prompt = `\n # Context\n ${contextParts.join(\"\\n\")}\n\n # Intent\n ${intent}\n\n Evaluate the appropriateness of this intent.\n `;\n\n const messages = [\n new SystemMessage(systemPrompt),\n new HumanMessage(prompt),\n ];\n\n try {\n const result = await invokeWithAbortSignal(this.model, messages);\n const output = responseFormat.parse(result) as IntentIndexerOutput;\n\n invokeLog.verbose(\"Evaluation complete\", {\n indexScore: output.indexScore,\n memberScore: output.memberScore,\n });\n return output;\n } catch (error) {\n logger.error(\"Error during execution\", { error });\n return null;\n }\n }\n\n /**\n * Alias for invoke. Evaluates the appropriateness of an intent for a given index and member context.\n * Kept for compatibility with callers (e.g. Network Graph) that use evaluate().\n */\n @Timed()\n public async evaluate(\n intent: string,\n indexPrompt: string | null,\n memberPrompt: string | null,\n sourceName?: string | null,\n networkContext?: string | null\n ): Promise<IntentIndexerOutput | null> {\n return this.invoke(intent, indexPrompt, memberPrompt, sourceName, networkContext);\n }\n\n /**\n * Factory method to expose the agent as a LangChain tool.\n * Useful for composing agents into larger graphs.\n */\n public static asTool() {\n return tool(\n async (args: {\n intent: string;\n indexPrompt: string | null;\n memberPrompt: string | null;\n sourceName?: string | null;\n networkContext?: string | null;\n }) => {\n const agent = new IntentIndexer();\n return await agent.invoke(\n args.intent,\n args.indexPrompt,\n args.memberPrompt,\n args.sourceName,\n args.networkContext\n );\n },\n {\n name: \"intent_indexer\",\n description:\n \"Evaluates whether an intent is appropriate for a specific index (community or event) and matches member sharing preferences.\",\n schema: z.object({\n intent: z.string().describe(\"The intent payload to evaluate\"),\n indexPrompt: z.string().nullable().describe(\"The purpose of the index (community)\"),\n memberPrompt: z.string().nullable().describe(\"The member's sharing preferences\"),\n sourceName: z.string().nullable().optional().describe(\"Optional source name for context\"),\n networkContext: z.string().nullable().optional().describe(\"Optional rendered network context (type, dates, metadata)\"),\n }),\n }\n );\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intent.inferrer.d.ts","sourceRoot":"/","sources":["intent/intent.inferrer.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEpF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;OAGG;IACH,aAAa,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAE/C;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,WAAW,EAAE,CAAC;CACrC;AA2ED,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;EAKxB,CAAC;AAWH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAMlE,qBAAa,sBAAsB;IACjC,OAAO,CAAC,KAAK,CAA2C;;IAQxD;;;;;OAKG;IAEU,MAAM,CACjB,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,cAAc,EAAE,MAAM,EACtB,OAAO,GAAE,eAAoB;;;;;;;;IAwF/B;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAuBjC;;;OAGG;WACW,MAAM;;;;;;;;;;;;;;;;;;;;;;;CAgBrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intent.inferrer.js","sourceRoot":"/","sources":["intent/intent.inferrer.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAe,MAAM,0BAA0B,CAAC;AACpF,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EA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AAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBAC5F,OAAO,IAAI,KAAK,GAAG,CAAC,KAAK,IAAI,KAAK,OAAO,EAAE,CAAC;YAC9C,CAAC,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC;SACd,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,MAAM;QAClB,OAAO,IAAI,CACT,KAAK,EAAE,IAAwD,EAAE,EAAE;YACjE,MAAM,KAAK,GAAG,IAAI,sBAAsB,EAAE,CAAC;YAC3C,OAAO,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAC/D,CAAC,EACD;YACE,IAAI,EAAE,0BAA0B;YAChC,WAAW,EAAE,kEAAkE;YAC/E,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;gBACf,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;gBACrE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;aAChE,CAAC;SACH,CACF,CAAC;IACJ,CAAC;CACF;AA1Ic;IADZ,KAAK,EAAE;;;;oDA0FP","sourcesContent":["import { HumanMessage, SystemMessage, BaseMessage } from \"@langchain/core/messages\";\nimport { tool } from \"@langchain/core/tools\";\nimport { z } from \"zod\";\nimport { protocolLogger } from \"../shared/observability/protocol.logger.js\";\nimport { Timed } from \"../shared/observability/performance.js\";\nimport { createStructuredModel } from \"../shared/agent/model.config.js\";\nimport { invokeWithAbortSignal } from \"../shared/agent/model-signal.js\";\n\nconst logger = protocolLogger(\"ExplicitIntentInferrer\");\n\n// ──────────────────────────────────────────────────────────────\n// 0. INFERRER OPTIONS\n// ──────────────────────────────────────────────────────────────\n\n/**\n * Options to control inferrer behavior.\n * Used to implement safety controls for read/write separation.\n */\nexport interface InferrerOptions {\n /**\n * Whether to fallback to profile inference when content is empty.\n * Should be TRUE for create operations without explicit content.\n * Should be FALSE for query operations.\n * Default: true (for backward compatibility).\n */\n allowProfileFallback?: boolean;\n \n /**\n * The operation mode for context.\n * Helps inferrer understand the user's intent.\n */\n operationMode?: 'create' | 'update' | 'delete';\n \n /**\n * Conversation history for anaphoric resolution.\n * Used to resolve references like \"that intent\", \"this goal\", etc.\n * Optional - if not provided, inference uses only current content.\n */\n conversationContext?: BaseMessage[];\n}\n\n// ──────────────────────────────────────────────────────────────\n// 1. SYSTEM PROMPT\n// ──────────────────────────────────────────────────────────────\n\nconst systemPrompt = `\n You are an expert Intent Analyst. Your goal is to infer the user's current intentions based on their profile and new content.\n\n You have access to:\n 1. User Memory Profile (Identity, Narrative, Attributes) - The long-term context.\n 2. New Content - What they just said/did.\n 3. Conversation History (when available) - Recent messages for resolving references.\n 4. Operation Context - What type of operation is being performed.\n\n YOUR TASK:\n Analyze the \"New Content\" in the context of the \"Profile\", \"Conversation History\", and \"Operation Context\".\n Extract a list of **Inferred Intents**.\n\n INTENT TYPES:\n - 'goal': The user wants to start, continue, or achieve something. (e.g., \"I want to learn Rust\", \"Looking for a co-founder\")\n - 'tombstone': The user explicitly states they have COMPLETED, stopped, or abandoned a goal. (e.g., \"I finished the course\", \"I'm done with crypto\", \"Delete my running goal\")\n\n CRITICAL RULES:\n - Only analyze the \"New Content\" section if it exists.\n - If New Content says \"Return empty intents list\", you MUST return an empty intents array.\n - If New Content says \"No content to analyze\", return an empty intents array.\n - Be precise and self-contained in descriptions (e.g., \"Learn Rust programming\" instead of \"Learn it\").\n - Do NOT try to manage existing IDs or check for duplicates.\n - IGNORE purely phatic communication (e.g., \"Hello\", \"Hi\", \"Good morning\") - return empty intents.\n - For CREATE operations: Extract what the user wants to ADD.\n - For UPDATE operations: Extract what the user wants to CHANGE.\n - For queries/questions: You should not see these - return empty intents.\n\n CONTENT GROUNDING (CRITICAL):\n - When New Content is present, EVERY inferred intent MUST be directly related to the New Content.\n - The User Profile is ENRICHMENT CONTEXT ONLY — use it to add specificity or domain detail to content-derived intents.\n - Do NOT generate intents from the profile that are unrelated to the New Content.\n - If the New Content is a short phrase (e.g., \"artist\", \"photographer\"), treat it as the user's stated goal — infer what they want regarding that topic.\n - Example: New Content = \"artist\", Profile = \"Building a decentralized protocol\" → Intent: \"Find or connect with artists\" (NOT \"Secure partnerships for decentralized protocol\")\n - Example: New Content = \"looking for a photographer\", Profile = \"AI startup founder\" → Intent: \"Find a photographer\" (NOT \"Recruit AI engineers\")\n\n CONCEPT EXTRACTION (CRITICAL FOR MATCHING):\n - Intents must be SELF-CONTAINED and understandable to strangers with no prior context.\n - When a document describes a project, the project's NAME is irrelevant - only WHAT IT DOES and WHAT TECH IT USES matters.\n - STRIP OUT completely (do not include in any form):\n * ANY project/company/product names from the source document - these mean nothing to outsiders\n * URLs and links (https://..., http://...) - NEVER include URLs in intent descriptions\n * Phrases that reference URLs: \"More details at\", \"See ... for more\", \"Project details:\", \"mentioned in\", \"from the document\", \"as discussed\"\n * File names (\"Claude.md\", \"README\", \"the PDF\")\n - Describe the WORK and TECHNOLOGIES, never the project name.\n - Examples:\n * Source mentions \"FooBar Project\" using React/Node → Intent: \"Seeking React/Node.js developers for real-time web apps\" (NO \"FooBar\")\n * Source mentions \"Index Network\" with LangGraph → Intent: \"Seeking LangGraph/PostgreSQL developers for AI agent systems\" (NO \"Index Network\")\n * Source mentions \"Acme Corp\" doing ML → Intent: \"Seeking ML engineers for computer vision pipelines\" (NO \"Acme\")\n \n ANAPHORIC RESOLUTION (UPDATE operations):\n - When conversation history is provided, use it to resolve references like \"that intent\", \"this goal\", \"the project\", etc.\n - Look for previously mentioned intents in the conversation history.\n - If the user says \"make that intent X\", find what \"that intent\" refers to in the history and include ALL its details.\n - PRESERVE all existing details from the referenced intent and only MODIFY the specified parts.\n - Example: If history mentions \"text-based RPG game\" and user says \"make that intent have LLM narration\",\n the output should be \"Create a text-based RPG game with LLM-enhanced narration\" (preserving \"text-based\").\n \n WHEN TO FALLBACK TO PROFILE:\n - Only when explicitly instructed: \"(No content provided. Please infer intents from Profile Narrative and Aspirations)\"\n - This should ONLY happen for CREATE operations with no explicit user input\n - Never infer from profile for query operations\n - When content IS present: profile may inform HOW to describe the intent (e.g., adding domain context), but must NOT change WHAT the intent is about\n`;\n\n// ──────────────────────────────────────────────────────────────\n// 2. RESPONSE SCHEMA (Zod)\n// ──────────────────────────────────────────────────────────────\n\nconst InferredIntentSchema = z.object({\n type: z.enum(['goal', 'tombstone']).describe(\"The type of intent inferred\"),\n description: z.string().describe(\"Concise description of the intent\"),\n reasoning: z.string().describe(\"Why this intent was inferred\"),\n confidence: z.enum(['high', 'medium', 'low']).describe(\"Confidence level of the inference\")\n});\n\nconst responseFormat = z.object({\n intents: z.array(InferredIntentSchema).describe(\"List of inferred intents\")\n});\n\n// ──────────────────────────────────────────────────────────────\n// 3. TYPE DEFINITIONS\n// ──────────────────────────────────────────────────────────────\n\ntype ResponseType = z.infer<typeof responseFormat>;\nexport type InferredIntent = z.infer<typeof InferredIntentSchema>;\n\n// ──────────────────────────────────────────────────────────────\n// 4. CLASS DEFINITION\n// ──────────────────────────────────────────────────────────────\n\nexport class ExplicitIntentInferrer {\n private model: ReturnType<typeof createStructuredModel>;\n\n constructor() {\n this.model = createStructuredModel(\"intentInferrer\", responseFormat, {\n name: \"intent_inferrer\"\n });\n }\n\n /**\n * Main entry point. Invokes the agent with input and returns structured output.\n * @param content - The raw string content to analyze.\n * @param profileContext - The formatted profile context string.\n * @param options - Options controlling inference behavior (fallback, operation mode, conversation context).\n */\n @Timed()\n public async invoke(\n content: string | null,\n profileContext: string,\n options: InferrerOptions = {}\n ) {\n const {\n allowProfileFallback = true, // Default TRUE for backward compatibility\n operationMode = 'create',\n conversationContext = undefined\n } = options;\n \n logger.verbose(\"invoke: received input\", {\n contentPreview: content?.substring(0, 50),\n allowProfileFallback,\n operationMode,\n hasConversationContext: !!conversationContext,\n conversationMessageCount: conversationContext?.length || 0,\n });\n\n // CRITICAL: Don't fallback to profile when explicitly disabled\n // This prevents auto-generation of intents from profile during query operations\n if (!content && !allowProfileFallback) {\n logger.verbose(\"invoke: no content and fallback disabled, returning empty\");\n return { intents: [] };\n }\n\n // Build conversation history section for anaphoric resolution\n const formattedHistory = conversationContext && conversationContext.length > 0\n ? this.formatConversationHistory(conversationContext)\n : '';\n \n const conversationSection = formattedHistory\n ? `# Conversation History (for reference resolution)\\n${formattedHistory}\\n`\n : '';\n\n // Build content section based on fallback setting\n const contentSection = content\n ? `## New Content\\n\\n${content}`\n : allowProfileFallback\n ? '(No content provided. Please infer intents from Profile Narrative and Aspirations)'\n : '(No content to analyze. Return empty intents list.)';\n\n const prompt = `\n Context:\n # User Memory Profile\n ${profileContext}\n\n ${conversationSection}${contentSection}\n \n # Operation Context\n This analysis is for a ${operationMode} operation.\n ${operationMode === 'create' ? 'Extract NEW intents the user wants to add.' : ''}\n ${operationMode === 'update' ? 'Extract MODIFICATIONS to existing intents. Use conversation history to resolve references like \"that intent\".' : ''}\n ${operationMode === 'delete' ? 'This should not execute - delete operations skip inference.' : ''}\n `;\n \n logger.debug(\"invoke: prompt details\", {\n hasConversationHistory: !!conversationSection,\n conversationHistoryLength: formattedHistory.length,\n conversationHistoryPreview: formattedHistory.substring(0, 300),\n contentLength: content?.length ?? 0,\n promptLength: prompt.length,\n promptPreview: prompt.substring(0, 500),\n });\n\n const messages = [\n new SystemMessage(systemPrompt),\n new HumanMessage(prompt)\n ];\n\n try {\n const result = await invokeWithAbortSignal(this.model, messages);\n const output = responseFormat.parse(result);\n\n logger.verbose('invoke: found intents', {\n count: output.intents.length,\n operationMode,\n allowedFallback: allowProfileFallback,\n usedFallback: !content && allowProfileFallback,\n });\n return output;\n } catch (error: unknown) {\n const err = error instanceof Error ? error : new Error(String(error));\n logger.error(\"invoke: error during invocation\", {\n message: err.message,\n stack: err.stack,\n });\n return { intents: [] };\n }\n }\n\n /**\n * Formats conversation history for inclusion in the prompt.\n * Converts BaseMessage[] to readable string format.\n */\n private formatConversationHistory(messages: BaseMessage[]): string {\n const formatted = messages.map((msg, index) => {\n const role = msg._getType() === 'human' ? 'User' : 'Assistant';\n const content = typeof msg.content === 'string' ? msg.content : JSON.stringify(msg.content);\n // Truncate long messages for token efficiency\n const truncated = content.length > 200 ? content.substring(0, 200) + '...' : content;\n return `[${index + 1}] ${role}: ${truncated}`;\n }).join('\\n');\n \n logger.debug(\"formatConversationHistory: full conversation history\", {\n messageCount: messages.length,\n fullHistory: messages\n .map((msg, index) => {\n const role = msg._getType() === \"human\" ? \"User\" : \"Assistant\";\n const content = typeof msg.content === \"string\" ? msg.content : JSON.stringify(msg.content);\n return `[${index + 1}] ${role}: ${content}`;\n })\n .join(\"\\n\"),\n });\n\n return formatted;\n }\n\n /**\n * Factory method to expose the agent as a LangChain tool.\n * Useful for composing agents into larger graphs.\n */\n public static asTool() {\n return tool(\n async (args: { content: string | null; profileContext: string }) => {\n const agent = new ExplicitIntentInferrer();\n return await agent.invoke(args.content, args.profileContext);\n },\n {\n name: 'explicit_intent_inferrer',\n description: 'Extracts explicit intents from user content and profile context.',\n schema: z.object({\n content: z.string().nullable().describe('The new content to analyze'),\n profileContext: z.string().describe('The user profile context')\n })\n }\n );\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intent.reconciler.d.ts","sourceRoot":"/","sources":["intent/intent.reconciler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2ExB,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;EAS5B,CAAC;AAEH,QAAA,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;EAO5B,CAAC;AAEH,QAAA,MAAM,wBAAwB;;;;;;;;;;;;EAI5B,CAAC;AAcH,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AAE,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC;YAClF,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC;QACxC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,yBAAyB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;YACnD,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;QACzB,CAAC;IACH,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,MAAM;QAClB,OAAO,IAAI,CACT,KAAK,EAAE,IAAwD,EAAE,EAAE;YACjE,MAAM,KAAK,GAAG,IAAI,gBAAgB,EAAE,CAAC;YACrC,OAAO,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACtE,CAAC,EACD;YACE,IAAI,EAAE,mBAAmB;YACzB,WAAW,EAAE,6EAA6E;YAC1F,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;gBACf,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;gBAC5E,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;aACzE,CAAC;SACH,CACF,CAAC;IACJ,CAAC;CACF;AAxDc;IADZ,KAAK,EAAE;;;;8CAoCP","sourcesContent":["import { HumanMessage, SystemMessage } from \"@langchain/core/messages\";\nimport { tool } from \"@langchain/core/tools\";\nimport { z } from \"zod\";\nimport { protocolLogger } from \"../shared/observability/protocol.logger.js\";\nimport { Timed } from \"../shared/observability/performance.js\";\nimport { createStructuredModel } from \"../shared/agent/model.config.js\";\nimport { invokeWithAbortSignal } from \"../shared/agent/model-signal.js\";\n\nconst logger = protocolLogger(\"IntentReconciler\");\nconst invokeLog = protocolLogger(\"IntentReconciler:invoke\");\n\n\nconst CreateActionTypeSchema = z.union([z.literal(\"create\"), z.literal(\"CREATE\")]);\nconst UpdateActionTypeSchema = z.union([z.literal(\"update\"), z.literal(\"UPDATE\")]);\nconst ExpireActionTypeSchema = z.union([z.literal(\"expire\"), z.literal(\"EXPIRE\")]);\n\n// ──────────────────────────────────────────────────────────────\n// 1. SYSTEM PROMPT\n// ──────────────────────────────────────────────────────────────\n\n\nconst systemPrompt = `\nYou are an expert Intent Manager. Your goal is to reconcile NEWLY INFERRED intents with the user's ACTIVE intents.\n\nYou have access to:\n1. Inferred Intents: Goals or Tombstones extracted from recent user activity.\n2. Active Intents: What the user is currently working on.\n\nYOUR TASK:\nCompare the Inferred Intents against the Active Intents and decide on the necessary ACTIONS (Create, Update, Expire).\n\nMATCHING LOGIC:\n- You must determine if an Inferred Intent refers to the same underlying goal as an Active Intent.\n- You must detect if an Inferred Intent CONTRADICTS an Active Intent (Change of Mind).\n\nSEMANTIC GOVERNANCE RULES (Donnellan's Distinction):\n- **REFERENTIAL Intents** (Anchor != NULL): These point to specific entities (e.g., \"Google\").\n - Matching logic: Match if the Anchor is the SAME.\n - If Anchor is different (e.g. \"Join Google\" vs \"Join Meta\"), they are DIFFERENT intents.\n- **ATTRIBUTIVE Intents** (Anchor == NULL): These describe a class of things.\n - Matching logic: Match if the description is semantically similar content.\n - E.g. \"Join a startup\" and \"Work for a small tech company\" are the SAME.\n\nACTIONS:\n- CREATE: If an Inferred Goal does NOT match any Active Intent, CREATE it.\n- UPDATE: If an Inferred Goal matches an Active Intent but offers a better/different description, UPDATE it. When the match is an exact duplicate (same goal, no change needed), still output an UPDATE action with that Active Intent's id and the same payload—this allows the caller to link the intent to an index (e.g. add it to a community).\n CRITICAL UPDATE MERGE RULES:\n * When UPDATING an intent, you MUST PRESERVE all existing details from the Active Intent.\n * Only MODIFY or ADD the specific aspects mentioned in the Inferred Intent.\n * NEVER remove existing details unless explicitly contradicted.\n * Examples:\n - Active: \"Create a text-based RPG game\"\n - Inferred: \"Create an RPG game with LLM-enhanced narration\"\n - CORRECT UPDATE: \"Create a text-based RPG game with LLM-enhanced narration\" (preserved \"text-based\")\n - WRONG UPDATE: \"Create an RPG game with LLM-enhanced narration\" (lost \"text-based\")\n * Think of updates as REFINEMENTS or ADDITIONS, not REPLACEMENTS.\n * If the Inferred Intent is a complete restatement, it's fine to use it directly.\n * If the Inferred Intent adds/modifies specific aspects, merge it with existing details.\n\n COMPOUND INTENT SANITY CHECK (CRITICAL):\n * NEVER produce a compound intent — an intent with multiple distinct goals joined by \"and\", \"as well as\", commas, or similar.\n * If merging would create a compound (e.g., \"Find an artist for X, and collaborate on Y\"), the intents are NOT the same — CREATE the new one instead.\n * Valid UPDATE: adding detail to ONE goal (e.g., \"Find a developer\" → \"Find a senior React developer in Berlin\")\n * Invalid UPDATE (compound): joining TWO goals (e.g., \"Find an artist\" + \"Collaborate on art direction\" → \"Find an artist and collaborate on art direction\")\n * When in doubt, CREATE a new intent rather than risk a compound.\n- EXPIRE: If an Inferred Tombstone matches an Active Intent (semantically), EXPIRE it.\n- CONFLICT RESOLUTION: If a NEW Goal contradicts an Active Intent, EXPIRE the old and CREATE the new.\n- DEDUPLICATION: Use Donnellan's Distinction above to merge duplicates. For duplicates, output UPDATE (not an empty list) so the intent can be linked to an index.\n\nOutput a list of specific actions to apply.\nIMPORTANT: The type field MUST be exactly one of: \"create\", \"update\", \"expire\" (lowercase).\n`;\n\n// ──────────────────────────────────────────────────────────────\n// 2. RESPONSE SCHEMA (Zod)\n// ──────────────────────────────────────────────────────────────\n\nconst CreateIntentActionSchema = z.object({\n type: CreateActionTypeSchema,\n payload: z.string().describe(\"The new intent description\"),\n score: z.number().nullable().describe(\"The felicity score (0-100)\"),\n reasoning: z.string().nullable().describe(\"Reasoning for the creation (including felicity)\"),\n // Semantic Governance Fields\n intentMode: z.enum(['REFERENTIAL', 'ATTRIBUTIVE']).nullable().describe(\"Donnellan's Distinction\"),\n referentialAnchor: z.string().nullable().describe(\"Entity anchored to\"),\n semanticEntropy: z.number().nullable().describe(\"Constraint Density Score (0-1)\"),\n});\n\nconst UpdateIntentActionSchema = z.object({\n type: UpdateActionTypeSchema,\n id: z.string().describe(\"The ID of the intent to update\"),\n payload: z.string().describe(\"The updated intent description\"),\n score: z.number().nullable().describe(\"The felicity score (0-100)\"),\n reasoning: z.string().nullable().describe(\"Reasoning for the update\"),\n intentMode: z.enum(['REFERENTIAL', 'ATTRIBUTIVE']).nullable(),\n});\n\nconst ExpireIntentActionSchema = z.object({\n type: ExpireActionTypeSchema,\n id: z.string().describe(\"The ID of the intent to expire\"),\n reason: z.string().describe(\"Why it is expired\")\n});\n\nconst responseFormat = z.object({\n actions: z.array(z.union([\n CreateIntentActionSchema,\n UpdateIntentActionSchema,\n ExpireIntentActionSchema\n ])).describe(\"List of actions to apply\")\n});\n\n// ──────────────────────────────────────────────────────────────\n// 3. TYPE DEFINITIONS (match invoke() return shape: normalized lowercase action types)\n// ──────────────────────────────────────────────────────────────\n\nexport type NormalizedIntentAction =\n | Omit<z.infer<typeof CreateIntentActionSchema>, \"type\"> & { type: \"create\" }\n | Omit<z.infer<typeof UpdateIntentActionSchema>, \"type\"> & { type: \"update\" }\n | Omit<z.infer<typeof ExpireIntentActionSchema>, \"type\"> & { type: \"expire\" };\n\nexport type IntentReconcilerOutput = { actions: NormalizedIntentAction[] };\n\nconst normalizeActionType = (type: string): \"create\" | \"update\" | \"expire\" => {\n const normalized = type.toLowerCase();\n if (normalized === \"create\" || normalized === \"update\" || normalized === \"expire\") {\n return normalized;\n }\n logger.warn('normalizeActionType: unexpected action type, defaulting to \"create\"', { type });\n return \"create\";\n};\n\n// ──────────────────────────────────────────────────────────────\n// 4. CLASS DEFINITION\n// ──────────────────────────────────────────────────────────────\n\nexport class IntentReconciler {\n private model: ReturnType<typeof createStructuredModel>;\n\n constructor() {\n this.model = createStructuredModel(\"intentReconciler\", responseFormat, {\n name: \"intent_reconciler\"\n });\n }\n\n /**\n * Reconciles inferred intents with active intents.\n * @param inferredIntentsFormatted - Formatted string of inferred intents.\n * @param activeIntentsContext - Formatted string of active intents.\n */\n @Timed()\n public async invoke(inferredIntentsFormatted: string, activeIntentsContext: string) {\n invokeLog.verbose(`Reconciling intents...`);\n\n const prompt = `\n # Active Intents\n ${activeIntentsContext}\n\n # Inferred Intents (Candidates)\n ${inferredIntentsFormatted}\n\n Based on the Inferred Intents, determine the actions to modify the Active Intents state.\n IMPORTANT:\n - If you CREATE or UPDATE an intent, you MUST popuate the 'score' and 'reasoning' fields.\n - Extract the 'score', 'semanticEntropy', 'referentialAnchor' from the Inferred Intent's data.\n - Include the verification details in the 'reasoning'.\n `;\n\n const messages = [\n new SystemMessage(systemPrompt),\n new HumanMessage(prompt)\n ];\n\n try {\n const output = responseFormat.parse(await invokeWithAbortSignal(this.model, messages));\n const normalizedActions = output.actions.map((action: z.infer<typeof responseFormat>[\"actions\"][number]) => ({ \n ...action,\n type: normalizeActionType(action.type),\n })) as NormalizedIntentAction[];\n\n invokeLog.verbose('Decision computed', { actionCount: normalizedActions.length });\n return { actions: normalizedActions };\n } catch (error) {\n logger.error(\"Error during invocation\", { error });\n return { actions: [] };\n }\n }\n\n /**\n * Factory method to expose the agent as a LangChain tool.\n */\n public static asTool() {\n return tool(\n async (args: { inferredIntents: string; activeIntents: string }) => {\n const agent = new IntentReconciler();\n return await agent.invoke(args.inferredIntents, args.activeIntents);\n },\n {\n name: 'intent_reconciler',\n description: 'Reconciles inferred intents with active intents to determine state changes.',\n schema: z.object({\n inferredIntents: z.string().describe('Formatted string of inferred intents'),\n activeIntents: z.string().describe('Formatted string of active intents')\n })\n }\n );\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intent.specificity.d.ts","sourceRoot":"/","sources":["intent/intent.specificity.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,eAAO,MAAM,2BAA2B,4KAA4K,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intent.specificity.js","sourceRoot":"/","sources":["intent/intent.specificity.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,MAAM,CAAC,MAAM,2BAA2B,GAAG,yKAAyK,CAAC","sourcesContent":["/** Default user-facing warning for broad attributive intent proposals. */\nexport const DEFAULT_SPECIFICITY_WARNING = \"This signal is broad and may produce many weak matches. Add a more concrete role, outcome, location, timeframe, domain, or specific need to get better recommendations.\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intent.state.d.ts","sourceRoot":"/","sources":["intent/intent.state.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG;IAC5C,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GACvC,gBAAgB,GAChB,kBAAkB,GAClB,sBAAsB,GACtB,wBAAwB,GACxB,yBAAyB,CAAC;AAE9B,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,+BAA+B,CAAC;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;CACtD;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,UAAU,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC3C,mCAAmC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CA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C,CAAC;QACnD,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE;KAClB,CAAC;IAEF,sEAAsE;IACtE,YAAY,EAAE,UAAU,CAAmB;QACzC,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,GAAG,CAAC;QACvC,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE;KAClB,CAAC;IAEF,2BAA2B;IAE3B;;;;;OAKG;IACH,UAAU,EAAE,UAAU,CAAuB;QAC3C,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI;QAC9B,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS;KACzB,CAAC;IAEF;;;OAGG;IACH,WAAW,EAAE,UAAU,CAAqB;QAC1C,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,IAAI;QACrC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS;KACzB,CAAC;IAEF;;;OAGG;IACH,cAAc,EAAE,UAAU,CAAU;QAClC,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,IAAI;QACrC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK;KACrB,CAAC;IAEF;;OAEG;IACH,UAAU,EAAE,UAAU,CAYP;QACb,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI;QAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS;KACzB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { Annotation } from \"@langchain/langgraph\";\nimport { BaseMessage } from \"@langchain/core/messages\";\nimport { InferredIntent } from \"./intent.inferrer.js\";\nimport { SemanticVerifierOutput } from \"./intent.verifier.js\";\nimport { IntentReconcilerOutput } from \"./intent.reconciler.js\";\nimport type { DebugMetaAgent } from '../chat/chat-streaming.types.js';\nimport type { ToolScopeType } from '../shared/agent/tool.scope.js';\n\n/**\n * Extended InferredIntent that includes verification results.\n * We attach the verification output directly to the intent object\n * as it flows through the graph.\n */\nexport type VerifiedIntent = InferredIntent & {\n verification?: SemanticVerifierOutput;\n score?: number; // Calculated min(authority, sincerity, clarity)\n};\n\nexport type IntentValidationFailureCategory =\n | 'non_actionable'\n | 'vague_or_invalid'\n | 'verification_failure'\n | 'update_target_boundary'\n | 'reconciliation_boundary';\n\nexport interface IntentValidationFailure {\n category: IntentValidationFailureCategory;\n message: string;\n classification?: string;\n referentialBreadth?: 'narrow' | 'moderate' | 'broad';\n}\n\n/**\n * Result of executing a single reconciler action.\n */\nexport interface ExecutionResult {\n /** The action type that was executed */\n actionType: 'create' | 'update' | 'expire';\n /** Whether the action succeeded */\n success: boolean;\n /** The intent ID (created/updated/archived) */\n intentId?: string;\n /** Final payload (sanitized, for create/update) */\n payload?: string;\n /** Error message if failed */\n error?: string;\n}\n\n/**\n * The Graph State using LangGraph Annotations.\n * This acts as the central bus for data flowing through our graph.\n */\nexport const IntentGraphState = Annotation.Root({\n // --- Inputs (Required at start) ---\n\n /**\n * The unique identifier of the user whose intents are being processed.\n * Required for database operations.\n */\n userId: Annotation<string>,\n\n /**\n * The user's profile context (Identity, Narrative, etc.)\n */\n userProfile: Annotation<string>,\n\n /**\n * Explicit input content (e.g., user message).\n * Optional - graph might run on implicit only.\n */\n inputContent: Annotation<string | undefined>,\n\n /**\n * Conversation history for context-aware intent inference.\n * Used to resolve anaphoric references (\"that intent\", \"this goal\").\n * Limited to recent messages (typically last 10) for token efficiency.\n * Optional - if not provided, intent inference uses only inputContent.\n */\n conversationContext: Annotation<BaseMessage[] | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n\n /**\n * Operation mode controls graph flow and determines which nodes execute.\n * - 'create': Full pipeline (prep → inference → verification → reconciliation → execution)\n * - 'update': Skip verification if no new intents (prep → inference → reconciliation → execution)\n * - 'delete': Skip inference and verification (prep → reconciliation → execution)\n * - 'read': Fast path (prep → queryNode → END) — reads intents without LLM calls\n * - 'propose': Inference + verification only, stops before reconciliation (no DB writes)\n *\n * Defaults to 'create' for backward compatibility.\n */\n operationMode: Annotation<'create' | 'update' | 'delete' | 'read' | 'propose'>({\n reducer: (curr, next) => next ?? curr,\n default: () => 'create' as const,\n }),\n\n /**\n * For update/delete operations, specifies which intent IDs to target.\n * Optional - used when modifying or removing specific intents.\n */\n targetIntentIds: Annotation<string[] | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n\n /**\n * Optional material compare-and-set guard used only by recovery-answer\n * updates. The database rechecks it while holding the final intent row lock.\n */\n expectedIntentFingerprint: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n\n /**\n * Optional network scope (network ID). Used for linking created intents to a network\n * and for scoping read operations. Prep always fetches ALL user intents via\n * getActiveIntents(userId) regardless of network scope (for global dedup/reconciliation).\n */\n networkId: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n\n /** Focused request scope type for write-side assignment and follow-up queues. */\n scopeType: Annotation<ToolScopeType | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n\n /** Focused request scope id. When scopeType is `network`, this is the focused network id. */\n scopeId: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n\n // --- Populated by Graph (Prep Node) ---\n\n /**\n * The formatted string of currently active intents.\n * Always populated by prep via getActiveIntents(userId).\n */\n activeIntents: Annotation<string>({\n reducer: (curr, next) => next,\n default: () => \"\",\n }),\n\n /** IDs of active intents owned by the graph user, used to fail closed on explicit updates. */\n activeIntentIds: Annotation<string[]>({\n reducer: (curr, next) => next,\n default: () => [],\n }),\n\n // --- Intermediate State ---\n\n /**\n * List of raw intents extracted from text.\n */\n inferredIntents: Annotation<InferredIntent[]>({\n reducer: (curr, next) => next, // Overwrite with new inference\n default: () => [],\n }),\n\n /**\n * List of intents that have passed semantic verification.\n * Invalid intents are filtered out before reaching this state.\n */\n verifiedIntents: Annotation<VerifiedIntent[]>({\n reducer: (curr, next) => next,\n default: () => [],\n }),\n\n /** Structured reasons for candidates rejected before persistence. */\n validationFailures: Annotation<IntentValidationFailure[]>({\n reducer: (curr, next) => next,\n default: () => [],\n }),\n\n // --- Output ---\n\n /**\n * Final actions to be performed on the DB (Create, Update, Expire).\n */\n actions: Annotation<IntentReconcilerOutput['actions']>({\n reducer: (curr, next) => next,\n default: () => [],\n }),\n\n /**\n * Results of executing actions against the database.\n * Populated by executorNode after actions are persisted.\n */\n executionResults: Annotation<ExecutionResult[]>({\n reducer: (curr, next) => next,\n default: () => [],\n }),\n\n // --- Error State ---\n\n /**\n * If set, indicates a fatal error that should short-circuit the graph to END.\n * Populated by prep when a precondition fails (e.g. missing profile).\n */\n error: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n\n // --- Trace Output ---\n\n /**\n * Accumulated trace entries from each graph node.\n * Used for observability: surfaces internal processing steps (inference,\n * verification with Felicity scores, reconciliation) to the frontend.\n */\n trace: Annotation<Array<{ node: string; detail?: string; data?: Record<string, unknown> }>>({\n reducer: (curr, next) => [...curr, ...(next || [])],\n default: () => [],\n }),\n\n /** Timing records for each agent invocation within this graph run. */\n agentTimings: Annotation<DebugMetaAgent[]>({\n reducer: (acc, val) => [...acc, ...val],\n default: () => [],\n }),\n\n // --- Read Mode Fields ---\n\n /**\n * For read mode: the set of network IDs the caller's agent can reach.\n * When set and neither networkId nor queryUserId is provided, the graph\n * returns the caller's own intents across all networks in this set (scope-aware\n * default path). Derived by the tool layer from the scope envelope plus memberships.\n */\n indexScope: Annotation<string[] | undefined>({\n reducer: (_curr, next) => next,\n default: () => undefined,\n }),\n\n /**\n * For read mode: filter intents by a specific user when reading in a network.\n * When omitted and network-scoped, returns all intents in the network.\n */\n queryUserId: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n\n /**\n * For read mode: when true, return all of the current user's intents\n * ignoring network scope. Used before create_intent to detect duplicates.\n */\n allUserIntents: Annotation<boolean>({\n reducer: (curr, next) => next ?? curr,\n default: () => false,\n }),\n\n /**\n * Output of read mode: queried intents with count and optional metadata.\n */\n readResult: Annotation<{\n count: number;\n intents: Array<{\n id: string;\n description: string;\n summary: string | null;\n createdAt: Date;\n userId?: string;\n userName?: string | null;\n }>;\n message?: string;\n networkId?: string;\n } | undefined>({\n reducer: (curr, next) => next,\n default: () => undefined,\n }),\n});\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intent.tools.d.ts","sourceRoot":"/","sources":["intent/intent.tools.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAkB,MAAM,mBAAmB,CAAC;AAKlG,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAQ5E,KAAK,mBAAmB,GAAG,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;AAiC3D,8DAA8D;AAC9D,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,mBAAmB,GAAG,IAAI,GAAG,IAAI,CAExF;AAwDD,KAAK,uBAAuB,GAAG;IAC7B,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,kBAAkB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAC/C,KAAK,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;CAClF,CAAC;AAEF,mFAAmF;AACnF,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,uBAAuB,GAAG;IAC5E,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MA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M,IAAI,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;YAC3E,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YACvG,OAAO,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QACpC,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,CAAU,CAAC;AAClJ,CAAC","sourcesContent":["import { z } from \"zod\";\n\nimport { IntentClarifier } from \"./intent.clarifier.js\";\nimport type { ExecutionResult, IntentValidationFailure, VerifiedIntent } from \"./intent.state.js\";\nimport { DEFAULT_SPECIFICITY_WARNING } from \"./intent.specificity.js\";\nimport { protocolLogger } from \"../shared/observability/protocol.logger.js\";\nimport { traceGraph } from \"../shared/observability/trace.js\";\n\nimport type { DefineTool, ToolDeps } from \"../shared/agent/tool.helpers.js\";\nimport { success, error, UUID_REGEX } from \"../shared/agent/tool.helpers.js\";\nimport type { UserRecord } from \"../shared/interfaces/database.interface.js\";\nimport { invokeWithAbortSignal } from \"../shared/agent/model-signal.js\";\nimport { deriveAllowedNetworkIds, focusedIntentId, focusedNetworkId, focusedNetworkLabel, type ToolScopeEnvelope } from \"../shared/agent/tool.scope.js\";\n\nconst logger = protocolLogger(\"ChatTools:Intent\");\n\ntype IntentClarifierLike = Pick<IntentClarifier, \"invoke\">;\n\nlet intentClarifier: IntentClarifierLike | undefined;\n\nfunction getIntentClarifier(): IntentClarifierLike {\n intentClarifier ??= new IntentClarifier();\n return intentClarifier;\n}\n\nasync function buildTypedClarificationResult(params: {\n description: string;\n userProfile: string;\n activeIntentsContext?: string;\n debugSteps: Array<{ step: string; detail?: string; data?: Record<string, unknown> }>;\n}): Promise<string | null> {\n const clarification = await getIntentClarifier().invoke(\n params.description,\n params.userProfile,\n params.activeIntentsContext ?? \"\",\n );\n if (!clarification.needsClarification) return null;\n return JSON.stringify({\n success: false,\n needsClarification: true,\n underspecificationType: clarification.underspecificationType,\n suggestedDescription: clarification.suggestedDescription,\n clarificationMessage: clarification.clarificationMessage,\n missingFields: [clarification.underspecificationType],\n message: clarification.clarificationMessage,\n debugSteps: params.debugSteps,\n });\n}\n\n/** Replace the lazy clarifier in deterministic tool tests. */\nexport function setIntentClarifierForTesting(clarifier: IntentClarifierLike | null): void {\n intentClarifier = clarifier ?? undefined;\n}\n\n/**\n * Sanitize JSON string for use inside a markdown code fence (```). Escapes backticks\n * so embedded ``` cannot close the fence prematurely.\n */\nfunction sanitizeJsonForCodeFence(json: string): string {\n return json.replace(/`/g, \"\\\\u0060\");\n}\n\n/** When context is network-scoped, verifies the caller is still a member of that index. Returns error message or null. */\nasync function ensureScopedMembership(\n context: ToolScopeEnvelope & { indexName?: string; userId: string },\n systemDb: ToolDeps['systemDb']\n): Promise<string | null> {\n const scopedNetworkId = focusedNetworkId(context);\n if (!scopedNetworkId) return null;\n const isMember = await systemDb.isNetworkMember(scopedNetworkId, context.userId);\n if (!isMember) {\n return `This chat is scoped to ${focusedNetworkLabel(context)}. You are no longer a member of this community.`;\n }\n return null;\n}\n\nfunction buildApprovedProfileFallback(user: UserRecord | null | undefined): string {\n const bio = user?.intro?.trim();\n if (!user || !bio) return \"\";\n\n return JSON.stringify({\n userId: user.id,\n identity: {\n name: user.name ?? \"\",\n bio,\n location: user.location?.trim() ?? \"\",\n },\n narrative: { context: bio },\n attributes: { skills: [], interests: [] },\n });\n}\n\nfunction isBroadAttributiveIntent(intent: VerifiedIntent): boolean {\n return intent.verification?.referential_breadth === \"broad\";\n}\n\nconst NULL_LIKE_SPECIFICITY_WARNING_VALUES = new Set([\"null\", \"undefined\"]);\n\nfunction normalizeSpecificityWarning(value: string | null | undefined): string | null {\n const warning = value?.trim();\n if (!warning) return null;\n return NULL_LIKE_SPECIFICITY_WARNING_VALUES.has(warning.toLowerCase()) ? null : warning;\n}\n\nfunction specificityWarningFor(intent: VerifiedIntent): string {\n return normalizeSpecificityWarning(intent.verification?.specificity_warning) ?? DEFAULT_SPECIFICITY_WARNING;\n}\n\ntype IntentUpdateGraphResult = {\n executionResults?: ExecutionResult[];\n validationFailures?: IntentValidationFailure[];\n trace?: Array<{ node: string; detail?: string; data?: Record<string, unknown> }>;\n};\n\n/** Convert graph failures into an accurate, machine-readable update-tool error. */\nexport function describeIntentUpdateFailure(result: IntentUpdateGraphResult): {\n failureCategory: string;\n error: string;\n details?: string;\n} {\n const persistenceFailure = result.executionResults?.find((execution) => !execution.success);\n if (persistenceFailure) {\n return {\n failureCategory: 'persistence_failure',\n error: 'Intent update could not be persisted.',\n ...(persistenceFailure.error ? { details: persistenceFailure.error } : {}),\n };\n }\n\n const failure = result.validationFailures?.[0];\n if (failure) {\n const broadnessNote = failure.referentialBreadth === 'broad'\n ? ' Referential breadth was recorded as a warning; it was not the blocking reason.'\n : '';\n return {\n failureCategory: failure.category,\n error: `${failure.message}${broadnessNote}`,\n ...(failure.classification ? { details: `Speech act: ${failure.classification}.` } : {}),\n };\n }\n\n return {\n failureCategory: 'reconciliation_boundary',\n error: 'Intent update produced no executable action after target-boundary enforcement.',\n };\n}\n\nexport function createIntentTools(defineTool: DefineTool, deps: ToolDeps) {\n const { graphs, userDb } = deps;\n\n // ─────────────────────────────────────────────────────────────────────────────\n // INTENT CRUD\n // ─────────────────────────────────────────────────────────────────────────────\n\n const readIntents = defineTool({\n name: \"read_intents\",\n description:\n \"Retrieves intents (signals of interest/need, e.g. 'Looking for a React developer in Berlin'). \" +\n \"Intents are the core unit of discovery — they represent what users are seeking and drive semantic matching for opportunities.\\n\\n\" +\n \"**Usage modes:**\\n\" +\n \"- No parameters: returns the **caller's own** active intents. In an network-scoped chat the result is clamped to the reachable networks (the bound network plus the user's personal network). In an unscoped chat the result spans all of the user's active intents. There is no implicit default to the scoped network — to browse the bound community's intents, pass `networkId` explicitly.\\n\" +\n \"- With networkId: returns **all members'** intents in that index (community browse path). Add userId to filter to one member.\\n\" +\n \"- With userId in an network-scoped chat: reads that member's intents in the bound network. The target user must be a member of that index.\\n\" +\n \"- With userId in an unscoped chat: only works for the current user (cannot read another user's global intents without an network scope).\\n\\n\" +\n \"**Workflow:** To explore what members of a network are looking for, first call read_network_memberships(networkId) to list members, \" +\n \"then read_intents(networkId) to see all intents in that community. \" +\n \"Each intent includes: id, description (payload), summary, confidence (0-1), inferenceType (explicit/implicit), status, and linked indexes.\\n\\n\" +\n \"**Returns:** Paginated list of intents with count. Use the intent IDs in subsequent calls to update_intent, delete_intent, or create_intent_index.\",\n querySchema: z.object({\n networkId: z.string().optional().describe(\"Network UUID — filters intents to this network (community browse path: returns all members' intents). There is no implicit default in network-scoped chats; omit to get caller-owned intents across the reachable networks, or pass the scoped network UUID to browse community members. Get network IDs from read_networks.\"),\n userId: z.string().optional().describe(\"User ID — filters to this user's intents. In an network-scoped chat, this reads that member's intents in the bound network (no networkId required). In an unscoped chat, only the current user is allowed without networkId; cross-user reads require an network scope. Omit for caller-owned intents.\"),\n limit: z.number().int().min(1).max(100).optional().describe(\"Page size (1-100). Defaults to returning all results if omitted.\"),\n page: z.number().int().min(1).optional().describe(\"Page number (1-based). Only used when limit is also provided.\"),\n }),\n handler: async ({ context, query }) => {\n const scopeErr = await ensureScopedMembership(context, deps.systemDb);\n if (scopeErr) return error(scopeErr);\n\n // Distinguish \"explicit network browse\" from \"implicit scope-aware read\"\n const scopedNetworkId = focusedNetworkId(context);\n const scopedIntentId = focusedIntentId(context);\n const scopedIndexLabel = focusedNetworkLabel(context);\n const explicitNetworkId = query.networkId?.trim();\n const explicitUserId = query.userId?.trim();\n\n if (scopedIntentId && (explicitNetworkId || (explicitUserId && explicitUserId !== context.userId))) {\n return error(\"This chat is scoped to one selected intent. Only that intent is available here.\");\n }\n\n // Validate explicit networkId format\n if (explicitNetworkId && !UUID_REGEX.test(explicitNetworkId)) {\n return error(\"Invalid network ID format.\");\n }\n\n // Strict scope enforcement: in a scoped chat, the only allowed explicit\n // networkId is the envelope's scoped network. Cross-network browse must\n // happen in a separate unscoped chat or a chat scoped to that network.\n if (scopedNetworkId && explicitNetworkId && explicitNetworkId !== scopedNetworkId) {\n return error(\n `This chat is scoped to ${scopedIndexLabel}. You can only read intents from this community.`\n );\n }\n\n // Cross-user read in scoped chat: target user must be a member of the scoped network\n if (scopedNetworkId && explicitUserId && explicitUserId !== context.userId) {\n const isInScopedIndex = await deps.systemDb.isNetworkMember(scopedNetworkId, explicitUserId);\n if (!isInScopedIndex) {\n return error(\n `This chat is scoped to ${scopedIndexLabel}. You can only read intents from members of this community.`\n );\n }\n }\n\n // Cross-user global read is disallowed without an network scope\n if (!explicitNetworkId && !scopedNetworkId && explicitUserId && explicitUserId !== context.userId) {\n return error(\"Cannot read another user's global intents. Use networkId to scope to a shared network.\");\n }\n\n // Membership check for explicit cross-network reads in unscoped chats\n if (!scopedNetworkId && explicitNetworkId) {\n const callerIsMember = await deps.systemDb.isNetworkMember(explicitNetworkId, context.userId);\n if (!callerIsMember) {\n return error(\"You can only read intents from indexes you are a member of.\");\n }\n }\n\n // ── Choose the read mode ──\n // 1. Explicit networkId (browse all members in that index) — pass networkId, optionally + queryUserId.\n // 2. Explicit userId in a scoped chat — read that user's intents in the bound network.\n // 3. Explicit userId in an unscoped chat — only self (cross-user rejected above); global \"my intents\".\n // 4. Implicit (no explicit network/user) in scoped chat — pass indexScope, no networkId.\n // 5. Implicit in unscoped chat — global getActiveIntents (caller's own).\n const graphInput: Record<string, unknown> = {\n userId: context.userId,\n userProfile: \"\",\n operationMode: 'read' as const,\n };\n\n if (scopedIntentId) {\n const intent = await deps.systemDb.getIntent(scopedIntentId);\n if (!intent || intent.userId !== context.userId || intent.archivedAt) {\n return error(\"This selected intent is no longer available.\");\n }\n return success({\n count: 1,\n totalCount: 1,\n intents: [{\n id: intent.id,\n description: intent.payload,\n summary: intent.summary,\n createdAt: intent.createdAt,\n }],\n scopeRestriction: {\n isScoped: true,\n scopedToIntent: scopedIntentId,\n message: \"Results are restricted to the selected intent.\",\n },\n });\n }\n\n if (explicitNetworkId) {\n graphInput.networkId = explicitNetworkId;\n if (explicitUserId) graphInput.queryUserId = explicitUserId;\n } else if (explicitUserId && scopedNetworkId) {\n // Scoped chat + userId: implicit network is the chat's bound network.\n // Membership of the target user was verified above.\n graphInput.networkId = scopedNetworkId;\n graphInput.queryUserId = explicitUserId;\n } else if (explicitUserId) {\n // Unscoped chat + userId: only allowed for self (others rejected above).\n graphInput.queryUserId = explicitUserId;\n graphInput.allUserIntents = true;\n } else if (scopedNetworkId) {\n // Scoped chat, implicit read: caller-only across reachable networks.\n graphInput.indexScope = deriveAllowedNetworkIds({\n memberships: context.userNetworks,\n scopeType: 'network',\n scopeId: scopedNetworkId,\n });\n } else {\n // Unscoped, implicit read: caller's global intents.\n graphInput.allUserIntents = true;\n }\n\n const _readIntentGraphStart = Date.now();\n const result = await traceGraph(\"intent\", () => invokeWithAbortSignal(graphs.intent, graphInput));\n const _readIntentGraphMs = Date.now() - _readIntentGraphStart;\n\n if (result.readResult) {\n if (result.readResult.count === 0 && result.readResult.message && /not a member|Network not found/i.test(result.readResult.message)) {\n return error(result.readResult.message);\n }\n\n const shouldPaginate = query.limit !== undefined || query.page !== undefined;\n if (shouldPaginate && Array.isArray(result.readResult.intents)) {\n const limit = query.limit ?? 20;\n const page = query.page ?? 1;\n const offset = (page - 1) * limit;\n const pagedIntents = result.readResult.intents.slice(offset, offset + limit);\n return success({\n ...result.readResult,\n count: pagedIntents.length,\n totalCount: result.readResult.intents.length,\n limit,\n page,\n totalPages: Math.ceil(result.readResult.intents.length / limit),\n intents: pagedIntents,\n _graphTimings: [{ name: 'intent', durationMs: _readIntentGraphMs, agents: result.agentTimings ?? [] }],\n });\n }\n\n return success({ ...result.readResult, _graphTimings: [{ name: 'intent', durationMs: _readIntentGraphMs, agents: result.agentTimings ?? [] }] });\n }\n return error(\"Failed to fetch intents.\");\n },\n });\n\n const createIntent = defineTool({\n name: \"create_intent\",\n description:\n \"Creates a new intent (signal of interest/need) for the authenticated user. Intents drive the discovery engine — once created, \" +\n \"the system automatically evaluates them against indexes the user belongs to, links them to relevant communities, and begins \" +\n \"searching for matching opportunities (complementary intents from other users).\\n\\n\" +\n \"**What to pass:** A clear, concept-based description of what the user is looking for (e.g. 'Looking for an AI/ML co-founder in Berlin', \" +\n \"'Need a designer for a mobile app project'). If the user provided a URL, scrape it with scrape_url first and synthesize the content into a description.\\n\\n\" +\n \"**What happens:** The system runs inference (extracting structured intents), verification (checking specificity and speech-act type), \" +\n \"and returns a proposal widget. The proposal is NOT yet persisted — the user must approve it first.\\n\\n\" +\n \"**Returns:** An intent_proposal code block that MUST be included verbatim in the response. The frontend renders it as an interactive \" +\n \"card the user can approve or skip. On approval, the intent is persisted, indexed, and discovery begins.\\n\\n\" +\n \"**Next steps after approval:** The intent is automatically linked to relevant indexes. Call discover_opportunities(searchQuery) to explicitly trigger discovery, \" +\n \"or wait for background processing to find matches.\\n\\n\" +\n \"**Specificity gate.** Before calling this tool, judge whether the description is concrete enough to be \" +\n \"useful for matching. If the user says \\\"find a job\\\", \\\"meet people\\\", or \\\"learn something\\\", that's too \" +\n \"vague — FIRST call read_user_contexts() + read_intents() to understand their context, THEN propose a \" +\n \"refined version (\\\"Based on your background in X, did you mean 'Y'?\\\") and wait for confirmation before \" +\n \"calling create_intent. Specific asks (\\\"senior UX design role at a tech company in Berlin\\\") can go \" +\n \"directly to create_intent.\\n\\n\" +\n \"**URL handling.** If the user pastes a URL describing the intent (e.g. a job posting), call scrape_url \" +\n \"first with objective=\\\"Extract key details for an intent\\\", synthesize a conceptual description from the \" +\n \"content, then call create_intent with the synthesis. Exception: profile URLs (LinkedIn, GitHub, X) passed \" +\n \"to create_user_context are handled by that tool directly — do not scrape first.\",\n querySchema: z.object({\n description: z.string().describe(\"A clear, specific description of what the user is looking for. Should be concept-based, not a raw URL. If the user shared a URL, scrape it first with scrape_url and pass the synthesized content here. Vague descriptions will be rejected — include what kind, what for, and/or timeframe.\"),\n networkId: z.string().optional().describe(\"Network UUID to link the intent to upon creation. Defaults to the scoped network in network-scoped chats. Get network IDs from read_networks. If omitted, the system auto-assigns to relevant networks based on their prompts.\"),\n autoApprove: z.boolean().optional().describe(\"When true, automatically persists all verified intents without returning proposal cards for manual approval. MCP agents SHOULD set this to true since there is no UI for card-based approval. Web chat agents should omit or set to false to get interactive proposal cards.\"),\n }),\n handler: async ({ context, query }) => {\n const scopeErr = await ensureScopedMembership(context, deps.systemDb);\n if (scopeErr) return error(scopeErr);\n if (!query.description?.trim()) {\n return error(\"Description is required.\");\n }\n\n const scopedNetworkId = focusedNetworkId(context);\n const scopedIntentId = focusedIntentId(context);\n const scopedIndexLabel = focusedNetworkLabel(context);\n\n if (scopedIntentId) {\n return error(\"This chat is scoped to an existing selected intent. Update that intent instead of creating a different one here.\");\n }\n\n // Strict scope enforcement\n if (scopedNetworkId && query.networkId?.trim() && query.networkId.trim() !== scopedNetworkId) {\n return error(\n `This chat is scoped to ${scopedIndexLabel}. You can only create intents in this community.`\n );\n }\n\n const effectiveIndexId = scopedNetworkId || query.networkId?.trim() || undefined;\n const scopeEnvelope = scopedNetworkId\n ? { scopeType: 'network' as const, scopeId: scopedNetworkId }\n : {};\n\n // Fetch profile (the intent graph needs it for inference)\n const _profileGraphStart1 = Date.now();\n const profileResult = await traceGraph(\"profile\", () => invokeWithAbortSignal(graphs.profile, { userId: context.userId, operationMode: 'query' as const }));\n const _profileGraphMs1 = Date.now() - _profileGraphStart1;\n const latestUser = profileResult.profile ? undefined : typeof userDb.getUser === \"function\" ? await userDb.getUser() : context.user;\n const approvedProfileFallback = profileResult.profile ? \"\" : buildApprovedProfileFallback(latestUser);\n const userProfile = profileResult.profile ? JSON.stringify(profileResult.profile) : approvedProfileFallback;\n\n // Run inference + verification only (propose mode — no DB persistence)\n const _intentGraphStart1 = Date.now();\n const result = await traceGraph(\"intent\", () => invokeWithAbortSignal(graphs.intent, {\n userId: context.userId,\n userProfile,\n inputContent: query.description,\n operationMode: 'propose' as const,\n ...(effectiveIndexId ? { networkId: effectiveIndexId } : {}),\n ...scopeEnvelope,\n }));\n const _intentGraphMs1 = Date.now() - _intentGraphStart1;\n logger.debug(\"Intent graph propose response\", { result });\n\n const verified = result.verifiedIntents || [];\n\n // MCP contexts have no interactive UI for proposal cards — default to auto-approve\n const shouldAutoApprove = query.autoApprove ?? context.isMcp ?? false;\n \n // Extract trace from graph and convert to debugSteps\n const trace = Array.isArray(result.trace) ? result.trace : [];\n const debugSteps = trace.map((t: { node: string; detail?: string; data?: Record<string, unknown> }) => ({\n step: t.node,\n detail: t.detail,\n ...(t.data ? { data: t.data } : {}),\n }));\n \n if (verified.length === 0) {\n // Build a descriptive rejection reason from the trace so the ReACT agent\n // can retry with a better description or ask the user for clarification.\n // When inference produces 0 intents, propose mode exits before verification\n // runs — so we check inference trace first.\n const verificationTrace = debugSteps.find((s: { step: string; detail?: string }) => s.step === \"verification\");\n\n const typedClarification = await buildTypedClarificationResult({\n description: query.description,\n userProfile,\n activeIntentsContext: result.activeIntents,\n debugSteps,\n });\n if (typedClarification) return typedClarification;\n\n if (!verificationTrace) {\n const inferenceHint =\n debugSteps.find((s: { step: string; detail?: string }) => s.step === \"inference\")?.detail\n ?? \"no intents extracted\";\n return error(\n `No actionable intent was extracted (${inferenceHint}). ` +\n `Please retry with an explicit goal or ask the user what outcome they want.`,\n debugSteps,\n );\n }\n\n const rejectionHint =\n verificationTrace.detail ?? \"all candidate intents were filtered as invalid or too vague\";\n return error(\n `Intent verification failed (${rejectionHint}). ` +\n `The description may have been classified as a statement rather than a goal. ` +\n `Retry with an explicit goal or ask the user what outcome they want.`,\n debugSteps,\n );\n }\n\n // ── Auto-approve path (for MCP agents or explicit opt-in) ──\n if (shouldAutoApprove) {\n const broadIntents = (verified as VerifiedIntent[]).filter(isBroadAttributiveIntent);\n if (broadIntents.length > 0) {\n const typedClarification = await buildTypedClarificationResult({\n description: broadIntents[0].description,\n userProfile,\n activeIntentsContext: result.activeIntents,\n debugSteps,\n });\n if (typedClarification) return typedClarification;\n\n const first = broadIntents[0];\n const missing = first.verification?.missing_selectional_constraints ?? [];\n const missingHint = missing.length > 0\n ? ` Missing specifics: ${missing.map((m) => m.replace(/_/g, \" \")).join(\", \")}.`\n : \"\";\n return error(\n `${specificityWarningFor(first)}${missingHint} ` +\n `Please ask the user to clarify before creating this signal, or retry with a narrower description.`,\n debugSteps,\n );\n }\n\n const createdIntents: Array<{ description: string; confidence: number | null; speechActType: string | null }> = [];\n const createTimings: Array<{ name: string; durationMs: number; agents: unknown[] }> = [];\n\n for (const v of verified as VerifiedIntent[]) {\n const _createGraphStart = Date.now();\n const createResult = await traceGraph(\"intent\", () => invokeWithAbortSignal(graphs.intent, {\n userId: context.userId,\n userProfile,\n inputContent: v.description,\n operationMode: 'create' as const,\n ...(effectiveIndexId ? { networkId: effectiveIndexId } : {}),\n ...scopeEnvelope,\n }));\n const _createGraphMs = Date.now() - _createGraphStart;\n\n createTimings.push({ name: 'intent-create', durationMs: _createGraphMs, agents: createResult.agentTimings ?? [] });\n\n const succeeded = createResult.executionResults?.some((r: ExecutionResult) => r.success);\n if (succeeded) {\n createdIntents.push({\n description: v.description,\n confidence: v.score != null ? Math.round(v.score * 100) / 100 : null,\n speechActType: v.verification?.classification ?? null,\n });\n }\n }\n\n return success({\n created: createdIntents.length > 0,\n count: createdIntents.length,\n intents: createdIntents,\n message: createdIntents.length > 0\n ? `Created ${createdIntents.length} intent${createdIntents.length > 1 ? 's' : ''} successfully. The system will automatically index them and begin searching for matching opportunities.`\n : 'Intent creation failed — the intents could not be persisted.',\n debugSteps,\n _graphTimings: [\n { name: 'enrichment', durationMs: _profileGraphMs1, agents: profileResult.agentTimings ?? [] },\n { name: 'intent-propose', durationMs: _intentGraphMs1, agents: result.agentTimings ?? [] },\n ...createTimings,\n ],\n });\n }\n\n // ── Proposal path (for web chat with interactive cards) ──\n // Build intent_proposal code fences for each verified intent\n const proposalBlocks = verified.map((v: VerifiedIntent) => {\n const proposalId = crypto.randomUUID();\n const isBroad = isBroadAttributiveIntent(v);\n const data = {\n proposalId,\n description: v.description,\n ...(effectiveIndexId ? { networkId: effectiveIndexId } : {}),\n confidence: v.score != null ? Math.round(v.score * 100) / 100 : null,\n speechActType: v.verification?.classification ?? null,\n semanticEntropy: v.verification?.semantic_entropy ?? null,\n referentialBreadth: v.verification?.referential_breadth ?? null,\n missingSelectionalConstraints: v.verification?.missing_selectional_constraints ?? [],\n specificityWarning: isBroad ? specificityWarningFor(v) : normalizeSpecificityWarning(v.verification?.specificity_warning),\n };\n return (\n \"```intent_proposal\\n\" +\n sanitizeJsonForCodeFence(JSON.stringify(data)) +\n \"\\n```\"\n );\n });\n\n const blocksText = proposalBlocks.join(\"\\n\\n\");\n\n return success({\n proposed: true,\n count: verified.length,\n message: `IMPORTANT: Include the following \\`\\`\\`intent_proposal code blocks EXACTLY as-is in your response (they render as interactive cards for the user to approve or skip):\\n\\n${blocksText}`,\n debugSteps,\n _graphTimings: [\n { name: 'enrichment', durationMs: _profileGraphMs1, agents: profileResult.agentTimings ?? [] },\n { name: 'intent', durationMs: _intentGraphMs1, agents: result.agentTimings ?? [] },\n ],\n });\n },\n });\n\n const updateIntent = defineTool({\n name: \"update_intent\",\n description:\n \"Updates an existing intent's description. After updating, the system re-processes the intent through inference and verification, \" +\n \"re-evaluates its index assignments, and triggers fresh opportunity discovery with the new description.\\n\\n\" +\n \"**When to use:** When the user wants to refine or change what they're looking for — e.g. narrowing scope, adding specificity, \" +\n \"or pivoting to a different need. Prefer updating over delete+create to preserve the intent's history and existing index links.\\n\\n\" +\n \"**Returns:** Updated `intentId` and `description`, plus a confirmation message. The intent's embeddings and index relevancy scores are recalculated automatically.\",\n querySchema: z.object({\n intentId: z.string().describe(\"The UUID of the intent to update. Get this from read_intents results.\"),\n description: z.string().describe(\"The updated description of what the user is looking for. Same guidelines as create_intent — should be clear and specific.\"),\n }),\n handler: async ({ context, query }) => {\n const scopeErr = await ensureScopedMembership(context, deps.systemDb);\n if (scopeErr) return error(scopeErr);\n const intentId = query.intentId?.trim() ?? \"\";\n if (!UUID_REGEX.test(intentId)) {\n return error(\"Invalid intent ID format.\");\n }\n\n // Ownership guard: caller must own the intent\n const intent = await deps.systemDb.getIntent(intentId);\n if (!intent || intent.userId !== context.userId) {\n return error(\"Intent not found or you can only update your own intents.\");\n }\n if (intent.archivedAt) {\n return error(\"This intent is archived and cannot be updated. Create a new intent instead.\");\n }\n\n const scopedNetworkId = focusedNetworkId(context);\n const scopedIntentId = focusedIntentId(context);\n const scopedIndexLabel = focusedNetworkLabel(context);\n\n if (scopedIntentId && scopedIntentId !== intentId) {\n return error(\"This chat is scoped to one selected intent. You can only update that intent here.\");\n }\n\n // Strict scope enforcement: when chat is network-scoped, verify intent is linked to that index\n if (scopedNetworkId) {\n const db = deps.userDb;\n const intentNetworks = await db.getNetworkIdsForIntent(intentId);\n if (!intentNetworks.includes(scopedNetworkId)) {\n return error(\n `This chat is scoped to ${scopedIndexLabel}. You can only update intents linked to this community.`\n );\n }\n }\n\n const _profileGraphStart2 = Date.now();\n const profileResult = await traceGraph(\"profile\", () => invokeWithAbortSignal(graphs.profile, { userId: context.userId, operationMode: 'query' as const }));\n const _profileGraphMs2 = Date.now() - _profileGraphStart2;\n const latestUser = profileResult.profile ? undefined : typeof userDb.getUser === \"function\" ? await userDb.getUser() : context.user;\n const approvedProfileFallback = profileResult.profile ? \"\" : buildApprovedProfileFallback(latestUser);\n const userProfile = profileResult.profile ? JSON.stringify(profileResult.profile) : approvedProfileFallback;\n\n const _intentGraphStart2 = Date.now();\n const result = await traceGraph(\"intent\", () => invokeWithAbortSignal(graphs.intent, {\n userId: context.userId,\n userProfile,\n operationMode: 'update' as const,\n inputContent: query.description,\n targetIntentIds: [intentId],\n ...(scopedNetworkId && { networkId: scopedNetworkId, scopeType: 'network' as const, scopeId: scopedNetworkId }),\n }));\n const _intentGraphMs2 = Date.now() - _intentGraphStart2;\n\n if (!result.executionResults?.some((r: ExecutionResult) => r.success)) {\n return JSON.stringify({\n success: false,\n ...describeIntentUpdateFailure(result),\n });\n }\n return success({\n message: \"Intent updated.\",\n intentId,\n description: query.description,\n _graphTimings: [\n { name: 'enrichment', durationMs: _profileGraphMs2, agents: profileResult.agentTimings ?? [] },\n { name: 'intent', durationMs: _intentGraphMs2, agents: result.agentTimings ?? [] },\n ],\n });\n },\n });\n\n const deleteIntent = defineTool({\n name: \"delete_intent\",\n description:\n \"Archives (soft-deletes) an intent, removing it from active discovery. The intent is not permanently deleted — it is marked as archived \" +\n \"and no longer participates in opportunity matching or index evaluation.\\n\\n\" +\n \"**When to use:** When the user's need has been fulfilled, is no longer relevant, or was created by mistake. \" +\n \"If the user wants to change the description instead, use update_intent to preserve history.\\n\\n\" +\n \"**Returns:** Confirmation that the intent was archived. Previously created opportunities from this intent remain but won't generate new ones.\",\n querySchema: z.object({\n intentId: z.string().describe(\"The UUID of the intent to archive. Get this from read_intents results.\"),\n }),\n handler: async ({ context, query }) => {\n const scopeErr = await ensureScopedMembership(context, deps.systemDb);\n if (scopeErr) return error(scopeErr);\n const intentId = query.intentId?.trim() ?? \"\";\n if (!UUID_REGEX.test(intentId)) {\n return error(\"Invalid intent ID format.\");\n }\n\n // Ownership guard: caller must own the intent\n const intent = await deps.systemDb.getIntent(intentId);\n if (!intent || intent.userId !== context.userId) {\n return error(\"Intent not found or you can only delete your own intents.\");\n }\n\n const scopedNetworkId = focusedNetworkId(context);\n const scopedIntentId = focusedIntentId(context);\n const scopedIndexLabel = focusedNetworkLabel(context);\n\n if (scopedIntentId && scopedIntentId !== intentId) {\n return error(\"This chat is scoped to one selected intent. You can only delete that intent here.\");\n }\n\n // Strict scope enforcement: when chat is network-scoped, verify intent is linked to that index\n if (scopedNetworkId) {\n const db = deps.userDb;\n const intentNetworks = await db.getNetworkIdsForIntent(intentId);\n if (!intentNetworks.includes(scopedNetworkId)) {\n return error(\n `This chat is scoped to ${scopedIndexLabel}. You can only delete intents linked to this community.`\n );\n }\n }\n\n const _deleteIntentGraphStart = Date.now();\n const result = await traceGraph(\"intent\", () => invokeWithAbortSignal(graphs.intent, {\n userId: context.userId,\n userProfile: \"\",\n operationMode: 'delete' as const,\n targetIntentIds: [intentId],\n ...(scopedNetworkId && { networkId: scopedNetworkId, scopeType: 'network' as const, scopeId: scopedNetworkId }),\n }));\n const _deleteIntentGraphMs = Date.now() - _deleteIntentGraphStart;\n\n if (result.executionResults?.some((r: ExecutionResult) => !r.success)) {\n return error(\"Failed to delete intent.\");\n }\n return success({\n message: \"Intent archived successfully.\",\n _graphTimings: [{ name: 'intent', durationMs: _deleteIntentGraphMs, agents: result.agentTimings ?? [] }],\n });\n },\n });\n\n // ─────────────────────────────────────────────────────────────────────────────\n // INTENT–INDEX JUNCTION (link / list / unlink)\n // ─────────────────────────────────────────────────────────────────────────────\n\n const createIntentIndex = defineTool({\n name: \"create_intent_index\",\n description:\n \"Manually links an intent to a network (community), making it visible to other members and eligible for opportunity discovery within that index. \" +\n \"Normally intents are auto-assigned to relevant indexes on creation, but use this to explicitly add an intent to an additional index.\\n\\n\" +\n \"**When to use:** When the user wants to share an existing intent with a specific community they belong to, \" +\n \"or when auto-assignment missed a network the user considers relevant.\\n\\n\" +\n \"**Returns:** Confirmation that the link was created. The intent will now appear in that index's intent list and participate in discovery within that community.\",\n querySchema: z.object({\n intentId: z.string().describe(\"The UUID of the intent to link. Get this from read_intents results.\"),\n networkId: z.string().optional().describe(\"The UUID of the network to link the intent to. Get this from read_networks. Defaults to the scoped network in network-scoped chats.\"),\n }),\n handler: async ({ context, query }) => {\n const scopeErr = await ensureScopedMembership(context, deps.systemDb);\n if (scopeErr) return error(scopeErr);\n const scopedNetworkId = focusedNetworkId(context);\n const scopedIntentId = focusedIntentId(context);\n const scopedIndexLabel = focusedNetworkLabel(context);\n const intentId = query.intentId?.trim() ?? \"\";\n const networkId = query.networkId?.trim() || scopedNetworkId || \"\";\n if (scopedIntentId && intentId !== scopedIntentId) {\n return error(\"This chat is scoped to one selected intent. You can only link that intent here.\");\n }\n if (!UUID_REGEX.test(intentId) || !UUID_REGEX.test(networkId)) {\n return error(\"Invalid ID format. Both must be UUIDs.\");\n }\n\n // Strict scope enforcement: when chat is network-scoped, only allow linking to that index\n if (scopedNetworkId && networkId !== scopedNetworkId) {\n return error(\n `This chat is scoped to ${scopedIndexLabel}. You can only link intents to this community.`\n );\n }\n\n const _createIntentIndexGraphStart = Date.now();\n const result = await traceGraph(\"intent_network\", () => invokeWithAbortSignal(graphs.intentIndex, {\n userId: context.userId,\n networkId,\n intentId,\n operationMode: 'create' as const,\n skipEvaluation: true,\n }));\n const _createIntentIndexGraphMs = Date.now() - _createIntentIndexGraphStart;\n\n if (result.mutationResult) {\n if (result.mutationResult.success) {\n const alreadyExisted = result.mutationResult.message?.includes('already in this network') ?? false;\n return success({\n created: !alreadyExisted,\n message: result.mutationResult.message,\n _graphTimings: [{ name: 'intent_network', durationMs: _createIntentIndexGraphMs, agents: result.agentTimings ?? [] }],\n });\n }\n return error(result.mutationResult.error || \"Failed to link intent to network.\");\n }\n return error(\"Failed to link intent to network.\");\n },\n });\n\n const readIntentIndexes = defineTool({\n name: \"read_intent_indexes\",\n description:\n \"Reads the many-to-many links between intents and indexes. Use this to understand which intents are shared in which communities, \" +\n \"and which indexes a specific intent belongs to.\\n\\n\" +\n \"**Usage modes:**\\n\" +\n \"- With networkId: lists all intents linked to that index. Add userId to filter to one member's intents in that index.\\n\" +\n \"- With intentId + networkId: checks whether a specific intent is linked to a specific index.\\n\" +\n \"- intentId alone requires a networkId (the system won't reveal all networks an intent is in).\\n\\n\" +\n \"**When to use:** To audit which intents are active in a community, verify an intent's index assignment before unlinking, \" +\n \"or check if a newly created intent was auto-assigned to the expected index.\\n\\n\" +\n \"**Returns:** List of intent-network links with relevancy scores (0-1, how well the intent fits the network's purpose).\",\n querySchema: z.object({\n intentId: z.string().optional().describe(\"Intent UUID — check if this specific intent is linked to the specified index. Must be combined with networkId.\"),\n networkId: z.string().optional().describe(\"Network UUID — list all intents linked to this network. Get this from read_networks. Defaults to scoped network in network-scoped chats.\"),\n userId: z.string().optional().describe(\"Filter results to this user's intents within the specified index. Omit to see all members' intents.\"),\n }),\n handler: async ({ context, query }) => {\n const scopeErr = await ensureScopedMembership(context, deps.systemDb);\n if (scopeErr) return error(scopeErr);\n const scopedNetworkId = focusedNetworkId(context);\n const scopedIntentId = focusedIntentId(context);\n const scopedIndexLabel = focusedNetworkLabel(context);\n const intentId = query.intentId?.trim() || scopedIntentId || undefined;\n let networkId = query.networkId?.trim() || scopedNetworkId || undefined;\n const queryUserId = query.userId?.trim() || undefined;\n\n if (scopedIntentId && query.intentId?.trim() && query.intentId.trim() !== scopedIntentId) {\n return error(\"This chat is scoped to one selected intent. You can only read links for that intent here.\");\n }\n if (scopedIntentId && queryUserId && queryUserId !== context.userId) {\n return error(\"This chat is scoped to one selected intent. Other users' intent links are not available here.\");\n }\n\n if (intentId && !UUID_REGEX.test(intentId)) {\n return error(\"Invalid intent ID format.\");\n }\n if (networkId && !UUID_REGEX.test(networkId)) {\n return error(\"Invalid network ID format.\");\n }\n if (!intentId && !networkId) {\n return error(\"Provide networkId or intentId.\");\n }\n\n // Strict scope enforcement: when chat is network-scoped, only allow querying that index\n if (scopedNetworkId && networkId && networkId !== scopedNetworkId) {\n return error(\n `This chat is scoped to ${scopedIndexLabel}. You can only read intent links from this community.`\n );\n }\n\n // When only intentId is provided, enforce scope - don't reveal all linked indexes\n if (intentId && !networkId) {\n if (scopedNetworkId) {\n // When scoped, only check if intent is linked to the scoped network\n networkId = scopedNetworkId;\n } else {\n // When unscoped, still don't reveal all networks - require explicit networkId\n return error(\n \"Please provide a networkId to check if the intent is linked to a specific network. Listing all linked networks is not supported.\"\n );\n }\n }\n\n const _readIntentIndexGraphStart = Date.now();\n const result = await traceGraph(\"intent_network\", () => invokeWithAbortSignal(graphs.intentIndex, {\n userId: context.userId,\n networkId,\n intentId,\n operationMode: 'read' as const,\n queryUserId,\n }));\n const _readIntentIndexGraphMs = Date.now() - _readIntentIndexGraphStart;\n\n if (result.error) {\n return error(result.error);\n }\n if (result.readResult) {\n return success({ ...result.readResult, _graphTimings: [{ name: 'intent_network', durationMs: _readIntentIndexGraphMs, agents: result.agentTimings ?? [] }] });\n }\n return error(\"Failed to fetch intent-network links.\");\n },\n });\n\n const deleteIntentIndex = defineTool({\n name: \"delete_intent_index\",\n description:\n \"Removes the link between an intent and a network. The intent itself is NOT deleted — it just stops being visible in that community \" +\n \"and no longer participates in opportunity discovery within that index. The intent may still be linked to other indexes.\\n\\n\" +\n \"**When to use:** When the user wants to withdraw an intent from a specific community without archiving it entirely. \" +\n \"Use read_intent_indexes first to verify the link exists.\\n\\n\" +\n \"**Returns:** Confirmation that the link was removed. To fully remove an intent, use delete_intent instead.\",\n querySchema: z.object({\n intentId: z.string().describe(\"The UUID of the intent to unlink. Get this from read_intents or read_intent_indexes.\"),\n networkId: z.string().optional().describe(\"The UUID of the network to unlink from. Get this from read_networks. Defaults to the scoped network in network-scoped chats.\"),\n }),\n handler: async ({ context, query }) => {\n const scopeErr = await ensureScopedMembership(context, deps.systemDb);\n if (scopeErr) return error(scopeErr);\n const scopedNetworkId = focusedNetworkId(context);\n const scopedIntentId = focusedIntentId(context);\n const scopedIndexLabel = focusedNetworkLabel(context);\n const intentId = query.intentId?.trim() ?? \"\";\n const networkId = query.networkId?.trim() || scopedNetworkId || \"\";\n if (scopedIntentId && intentId !== scopedIntentId) {\n return error(\"This chat is scoped to one selected intent. You can only unlink that intent here.\");\n }\n if (!UUID_REGEX.test(intentId) || !UUID_REGEX.test(networkId)) {\n return error(\"Invalid ID format. Both must be UUIDs.\");\n }\n\n // Strict scope enforcement: when chat is network-scoped, only allow unlinking from that index\n if (scopedNetworkId && networkId !== scopedNetworkId) {\n return error(\n `This chat is scoped to ${scopedIndexLabel}. You can only unlink intents from this community.`\n );\n }\n\n const _deleteIntentIndexGraphStart = Date.now();\n const result = await traceGraph(\"intent_network\", () => invokeWithAbortSignal(graphs.intentIndex, {\n userId: context.userId,\n networkId,\n intentId,\n operationMode: 'delete' as const,\n }));\n const _deleteIntentIndexGraphMs = Date.now() - _deleteIntentIndexGraphStart;\n\n if (result.mutationResult) {\n if (result.mutationResult.success) {\n return success({\n deleted: true,\n message: result.mutationResult.message,\n _graphTimings: [{ name: 'intent_network', durationMs: _deleteIntentIndexGraphMs, agents: result.agentTimings ?? [] }],\n });\n }\n return error(result.mutationResult.error || \"Failed to unlink.\");\n }\n return error(\"Failed to unlink intent from network.\");\n },\n });\n\n const searchIntents = defineTool({\n name: \"search_intents\",\n description:\n \"Text-searches the authenticated user's own active signals by description. Case-insensitive substring \" +\n \"match over the signal's payload and summary. Use when the user references a past signal they wrote \" +\n '(\"find my signal about React mentorship\") or wants to audit what they\\'ve posted.\\n\\n' +\n \"For discovery of OTHER users' signals that match a query, use discover_opportunities(searchQuery=...) \" +\n \"instead — that runs semantic matching across the user's networks.\\n\\n\" +\n \"**Returns:** `intents: [{ id, payload, summary, createdAt }]`, most recent first, up to `limit` (default 25).\",\n querySchema: z.object({\n query: z.string().min(1).describe(\"Text to match against payload and summary (case-insensitive).\"),\n limit: z\n .number()\n .int()\n .positive()\n .max(100)\n .optional()\n .describe(\"Maximum intents to return (default 25, max 100).\"),\n }),\n handler: async ({ context, query }) => {\n const rows = await userDb.searchOwnIntents(query.query, query.limit ?? 25);\n logger.verbose(\"search_intents\", { userId: context.userId, query: query.query, matched: rows.length });\n return success({ intents: rows });\n },\n });\n\n return [readIntents, createIntent, updateIntent, deleteIntent, createIntentIndex, readIntentIndexes, deleteIntentIndex, searchIntents] as const;\n}\n"]}
|