@indexnetwork/protocol 10.1.3-rc.453.1 → 11.0.1-rc.455.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/dist/capabilities/contacts.facade.d.ts +1 -1
  3. package/dist/capabilities/integrations.facade.d.ts +1 -1
  4. package/dist/capabilities/opportunities.facade.d.ts +2 -1
  5. package/dist/capabilities/opportunities.facade.js +1 -1
  6. package/dist/capabilities/participant-agents.facade.d.ts +2 -2
  7. package/dist/capabilities/participant-agents.facade.js +1 -1
  8. package/dist/capabilities/questions.facade.d.ts +2 -2
  9. package/dist/capabilities/questions.facade.js +1 -1
  10. package/dist/chat/chat-streaming.types.d.ts +1 -1
  11. package/dist/chat/chat.agent.d.ts +1 -1
  12. package/dist/contacts/domain/contact.types.d.ts +0 -2
  13. package/dist/contacts/domain/contact.types.js +0 -2
  14. package/dist/contacts/domain/index.d.ts +0 -2
  15. package/dist/contacts/index.d.ts +1 -2
  16. package/dist/contacts/index.js +1 -2
  17. package/dist/contacts/ports/contact.tools.port.d.ts +3 -5
  18. package/dist/contacts/ports/contact.tools.port.js +3 -5
  19. package/dist/contacts/ports/index.d.ts +0 -2
  20. package/dist/contacts/ports/index.js +0 -2
  21. package/dist/enrichment/enrichment.graph.d.ts +4 -4
  22. package/dist/enrichment/enrichment.state.d.ts +1 -1
  23. package/dist/index.d.ts +8 -8
  24. package/dist/index.js +3 -3
  25. package/dist/integrations/domain/index.d.ts +0 -2
  26. package/dist/integrations/domain/integration.types.d.ts +0 -2
  27. package/dist/integrations/domain/integration.types.js +0 -2
  28. package/dist/integrations/index.d.ts +1 -2
  29. package/dist/integrations/index.js +1 -2
  30. package/dist/integrations/ports/index.d.ts +0 -2
  31. package/dist/integrations/ports/index.js +0 -2
  32. package/dist/integrations/ports/integration.tools.port.d.ts +3 -5
  33. package/dist/integrations/ports/integration.tools.port.js +3 -5
  34. package/dist/mcp/elicitation.builder.d.ts +1 -1
  35. package/dist/mcp/elicitation.dispatcher.d.ts +1 -1
  36. package/dist/opportunity/application/opportunity.graph.d.ts +14 -8
  37. package/dist/opportunity/application/opportunity.graph.js +26 -14
  38. package/dist/opportunity/discovery.env.d.ts +6 -0
  39. package/dist/opportunity/discovery.env.js +30 -0
  40. package/dist/opportunity/discriminator/discriminator.adjustments.d.ts +1 -1
  41. package/dist/opportunity/discriminator/discriminator.push.d.ts +1 -1
  42. package/dist/opportunity/discriminator/discriminator.question.d.ts +1 -1
  43. package/dist/opportunity/domain/opportunity.state.d.ts +1 -3
  44. package/dist/opportunity/public/index.d.ts +2 -1
  45. package/dist/opportunity/public/index.js +1 -1
  46. package/dist/participant-agents/domain/index.d.ts +0 -1
  47. package/dist/participant-agents/index.d.ts +2 -6
  48. package/dist/participant-agents/index.js +2 -6
  49. package/dist/participant-agents/ports/agent.tools.port.d.ts +3 -5
  50. package/dist/participant-agents/ports/agent.tools.port.js +3 -5
  51. package/dist/participant-agents/ports/index.d.ts +1 -2
  52. package/dist/participant-agents/ports/index.js +1 -2
  53. package/dist/questions/domain/index.d.ts +0 -1
  54. package/dist/questions/domain/index.js +0 -1
  55. package/dist/questions/domain/question.schema.d.ts +1 -3
  56. package/dist/questions/domain/question.schema.js +1 -3
  57. package/dist/questions/index.d.ts +1 -6
  58. package/dist/questions/index.js +1 -6
  59. package/dist/questions/ports/question.generator.port.d.ts +1 -2
  60. package/dist/questions/ports/question.persistence.port.d.ts +1 -2
  61. package/dist/questions/public/index.d.ts +1 -1
  62. package/dist/shared/agent/tool.helpers.d.ts +6 -6
  63. package/dist/shared/interfaces/database.interface.d.ts +2 -0
  64. package/dist/shared/schemas/pending-question.schema.d.ts +1 -1
  65. package/dist/signals/application/intent.clarifier.js +1 -1
  66. package/dist/signals/application/intent.graph.d.ts +1 -1
  67. package/dist/signals/application/intent.verifier.d.ts +6 -6
  68. package/package.json +1 -1
  69. package/dist/shared/interfaces/agent.interface.d.ts +0 -17
  70. package/dist/shared/interfaces/agent.interface.js +0 -15
  71. package/dist/shared/interfaces/contact.interface.d.ts +0 -9
  72. package/dist/shared/interfaces/contact.interface.js +0 -8
  73. package/dist/shared/interfaces/integration.interface.d.ts +0 -9
  74. package/dist/shared/interfaces/integration.interface.js +0 -8
  75. package/dist/shared/interfaces/question-generator.interface.d.ts +0 -5
  76. package/dist/shared/interfaces/question-generator.interface.js +0 -1
  77. package/dist/shared/interfaces/questioner.interface.d.ts +0 -5
  78. package/dist/shared/interfaces/questioner.interface.js +0 -1
  79. package/dist/shared/schemas/question.schema.d.ts +0 -5
  80. package/dist/shared/schemas/question.schema.js +0 -5
@@ -31,7 +31,7 @@ import { renderNetworkContext } from '../../shared/network/metadata.renderer.js'
31
31
  import { requestContext } from "../../shared/observability/request-context.js";
32
32
  import { getAbortSignalConfig } from "../../shared/agent/model-signal.js";
33
33
  import { mergeOpportunityEvidence, withCandidateEvidence, withMatchedStrategies } from '../domain/opportunity.evidence.js';
34
- import { discoveryIntentMatchingEnabled, discoveryProfileMatchingEnabled, discoveryProfileSource } from '../discovery.env.js';
34
+ import { DISCOVERY_EVALUATOR_MIN_SCORE_DEFAULT, discoveryEvaluatorMinScore, discoveryIntentMatchingEnabled, discoveryMinSimilarity, discoveryProfileMatchingEnabled, discoveryProfileSource, validateDiscoveryEvaluatorMinScore, validateDiscoveryMinSimilarity } from '../discovery.env.js';
35
35
  import { normalizeOpportunityActorIntent, resolveOpportunityActorIntent } from '../domain/opportunity.actor.js';
36
36
  import { approveOpportunityIntroduction, deleteOpportunityLifecycle, sendOpportunityLifecycle, updateOpportunityLifecycle } from './opportunity.lifecycle.js';
37
37
  import { stampEligibleNewbornOpportunities } from './opportunity.newborn-stamping.js';
@@ -208,7 +208,9 @@ export class OpportunityGraphFactory {
208
208
  */
209
209
  queueNegotiateExisting,
210
210
  /** Host-side P4b stamper. Omitted by manual/introducer/enrichment roots. */
211
- stampNewbornOpportunities) {
211
+ stampNewbornOpportunities,
212
+ /** Eval/test-only overrides; production composition resolves from environment. */
213
+ thresholdOverrides) {
212
214
  this.database = database;
213
215
  this.embedder = embedder;
214
216
  this.hydeGenerator = hydeGenerator;
@@ -218,8 +220,15 @@ export class OpportunityGraphFactory {
218
220
  this.agentDispatcher = agentDispatcher;
219
221
  this.queueNegotiateExisting = queueNegotiateExisting;
220
222
  this.stampNewbornOpportunities = stampNewbornOpportunities;
223
+ this.thresholdOverrides = thresholdOverrides;
221
224
  }
222
225
  createGraph() {
226
+ const retrievalMinSimilarity = this.thresholdOverrides?.retrievalMinSimilarity === undefined
227
+ ? discoveryMinSimilarity()
228
+ : validateDiscoveryMinSimilarity(this.thresholdOverrides.retrievalMinSimilarity);
229
+ const evaluatorMinScore = this.thresholdOverrides?.evaluatorMinScore === undefined
230
+ ? discoveryEvaluatorMinScore()
231
+ : validateDiscoveryEvaluatorMinScore(this.thresholdOverrides.evaluatorMinScore);
223
232
  const evaluatorAgent = this.optionalEvaluator ?? new OpportunityEvaluator();
224
233
  // ═══════════════════════════════════════════════════════════════
225
234
  // NODE DEFINITIONS
@@ -743,8 +752,6 @@ export class OpportunityGraphFactory {
743
752
  // (The options.limit controls final output, not search pool)
744
753
  const limitPerStrategy = 30;
745
754
  const perIndexLimit = 80;
746
- // Similarity threshold for recall (0.30 = 30% similarity)
747
- const minScore = 0.3;
748
755
  // Discovery match-type gating (DISCOVERY_ALLOWED_TYPES / DISCOVERY_PROFILE_SOURCE).
749
756
  // Result filtering below is defense-in-depth: corpusGating already scopes the
750
757
  // embedder's corpus searches, but adapters may still return other types.
@@ -903,7 +910,7 @@ export class OpportunityGraphFactory {
903
910
  excludeUserId: discoveryUserId,
904
911
  limitPerStrategy,
905
912
  limit: perIndexLimit,
906
- minScore,
913
+ minScore: retrievalMinSimilarity,
907
914
  corpusGating,
908
915
  });
909
916
  if (intentResultsEnabled)
@@ -1011,6 +1018,7 @@ export class OpportunityGraphFactory {
1011
1018
  networkIds: targetNetworkIds,
1012
1019
  excludeUserId: discoveryUserId,
1013
1020
  limitPerSource: PREMISE_MATCH_LIMIT_PER_SOURCE,
1021
+ minScore: retrievalMinSimilarity,
1014
1022
  })
1015
1023
  : (await Promise.all(sourcePremises.map(async (sp) => {
1016
1024
  const results = await self.database.searchPremisesBySimilarity({
@@ -1018,6 +1026,7 @@ export class OpportunityGraphFactory {
1018
1026
  networkIds: targetNetworkIds,
1019
1027
  excludeUserId: discoveryUserId,
1020
1028
  limit: PREMISE_MATCH_LIMIT_PER_SOURCE,
1029
+ minScore: retrievalMinSimilarity,
1021
1030
  });
1022
1031
  return results.map((r) => ({ ...r, sourcePremiseId: sp.premiseId }));
1023
1032
  }))).flat();
@@ -1090,7 +1099,7 @@ export class OpportunityGraphFactory {
1090
1099
  excludeUserId: discoveryUserId,
1091
1100
  limitPerStrategy: limitPerStrategy,
1092
1101
  limit: 20,
1093
- minScore,
1102
+ minScore: retrievalMinSimilarity,
1094
1103
  corpusGating,
1095
1104
  });
1096
1105
  for (const r of results.filter(r => r.type === 'intent')) {
@@ -1114,7 +1123,7 @@ export class OpportunityGraphFactory {
1114
1123
  networkIds: [ctx.networkId],
1115
1124
  excludeUserId: discoveryUserId,
1116
1125
  limit: 20,
1117
- minScore: minScore,
1126
+ minScore: retrievalMinSimilarity,
1118
1127
  });
1119
1128
  for (const r of results) {
1120
1129
  contextCandidates.push(withCandidateEvidence({
@@ -1169,7 +1178,7 @@ export class OpportunityGraphFactory {
1169
1178
  networkIds: [ctx.networkId],
1170
1179
  excludeUserId: discoveryUserId,
1171
1180
  limit: 20,
1172
- minScore,
1181
+ minScore: retrievalMinSimilarity,
1173
1182
  });
1174
1183
  for (const r of results) {
1175
1184
  contextCandidates.push(withCandidateEvidence({
@@ -1302,7 +1311,7 @@ export class OpportunityGraphFactory {
1302
1311
  excludeUserId: discoveryUserId,
1303
1312
  limitPerStrategy,
1304
1313
  limit: perIndexLimit,
1305
- minScore,
1314
+ minScore: retrievalMinSimilarity,
1306
1315
  corpusGating,
1307
1316
  });
1308
1317
  if (intentResultsEnabled)
@@ -1692,8 +1701,9 @@ export class OpportunityGraphFactory {
1692
1701
  return evidenceByEntityKey.get(keys[0]);
1693
1702
  return undefined;
1694
1703
  }
1695
- // Lower default threshold to 50 for better recall
1696
- const minScore = state.options.minScore ?? 50;
1704
+ const minScore = state.targetUserId
1705
+ ? DISCOVERY_EVALUATOR_MIN_SCORE_DEFAULT
1706
+ : evaluatorMinScore;
1697
1707
  const evaluatorSignalConfig = getAbortSignalConfig();
1698
1708
  const evaluator = typeof evaluatorAgent.invokeEntityBundle === 'function'
1699
1709
  ? evaluatorAgent
@@ -1883,15 +1893,17 @@ export class OpportunityGraphFactory {
1883
1893
  });
1884
1894
  // Build detailed trace entries for each evaluated candidate
1885
1895
  // Threshold filter trace: how many candidates in this batch were above/below similarity threshold
1886
- const aboveThreshold = batchToEvaluate.filter(c => c.similarity >= 0.40).length;
1896
+ const aboveThreshold = batchToEvaluate.filter((candidate) => candidate.similarity >= retrievalMinSimilarity).length;
1887
1897
  const belowThreshold = batchToEvaluate.length - aboveThreshold;
1888
1898
  traceEntries.push({
1889
1899
  node: "threshold_filter",
1890
- detail: `${aboveThreshold} above 0.40, ${belowThreshold} below (batch of ${batchToEvaluate.length})`,
1900
+ detail: `${aboveThreshold} above ${retrievalMinSimilarity}, ${belowThreshold} below (batch of ${batchToEvaluate.length})`,
1891
1901
  data: {
1892
1902
  aboveThreshold,
1893
1903
  belowThreshold,
1894
- minScore: 0.40,
1904
+ minScore: retrievalMinSimilarity,
1905
+ retrievalMinSimilarity,
1906
+ evaluatorMinScore: minScore,
1895
1907
  batchSize: batchToEvaluate.length,
1896
1908
  },
1897
1909
  });
@@ -1,3 +1,9 @@
1
+ export declare const DISCOVERY_MIN_SIMILARITY_DEFAULT = 0.3;
2
+ export declare const DISCOVERY_EVALUATOR_MIN_SCORE_DEFAULT = 50;
3
+ export declare function validateDiscoveryMinSimilarity(value: number): number;
4
+ export declare function validateDiscoveryEvaluatorMinScore(value: number): number;
5
+ export declare function discoveryMinSimilarity(): number;
6
+ export declare function discoveryEvaluatorMinScore(): number;
1
7
  /** Data types allowed to participate in opportunity matching. */
2
8
  export type DiscoveryMatchType = 'intent' | 'profile';
3
9
  /** Test hook: clear warn-once state so each test observes warnings. */
@@ -21,6 +21,36 @@
21
21
  */
22
22
  import { protocolLogger } from '../shared/observability/protocol.logger.js';
23
23
  const envLog = protocolLogger('Discovery:env');
24
+ export const DISCOVERY_MIN_SIMILARITY_DEFAULT = 0.30;
25
+ export const DISCOVERY_EVALUATOR_MIN_SCORE_DEFAULT = 50;
26
+ const DECIMAL_VALUE = /^[+]?(?:\d+(?:\.\d*)?|\.\d+)$/;
27
+ function validateThreshold(name, value, max) {
28
+ if (!Number.isFinite(value) || value < 0 || value > max) {
29
+ throw new Error(`${name} must be a finite decimal between 0 and ${max} (inclusive)`);
30
+ }
31
+ return value;
32
+ }
33
+ function readThreshold(raw, name, fallback, max) {
34
+ if (raw === undefined || raw.trim() === '')
35
+ return fallback;
36
+ const normalized = raw.trim();
37
+ if (!DECIMAL_VALUE.test(normalized)) {
38
+ throw new Error(`${name} must be a finite decimal between 0 and ${max} (inclusive)`);
39
+ }
40
+ return validateThreshold(name, Number(normalized), max);
41
+ }
42
+ export function validateDiscoveryMinSimilarity(value) {
43
+ return validateThreshold('DISCOVERY_MIN_SIMILARITY', value, 1);
44
+ }
45
+ export function validateDiscoveryEvaluatorMinScore(value) {
46
+ return validateThreshold('DISCOVERY_EVALUATOR_MIN_SCORE', value, 100);
47
+ }
48
+ export function discoveryMinSimilarity() {
49
+ return readThreshold(process.env.DISCOVERY_MIN_SIMILARITY, 'DISCOVERY_MIN_SIMILARITY', DISCOVERY_MIN_SIMILARITY_DEFAULT, 1);
50
+ }
51
+ export function discoveryEvaluatorMinScore() {
52
+ return readThreshold(process.env.DISCOVERY_EVALUATOR_MIN_SCORE, 'DISCOVERY_EVALUATOR_MIN_SCORE', DISCOVERY_EVALUATOR_MIN_SCORE_DEFAULT, 100);
53
+ }
24
54
  const VALID_TOKENS = new Set(['intent', 'profile']);
25
55
  const BOTH = new Set(['intent', 'profile']);
26
56
  /** Tokens/values already warned about (warn-once per process). */
@@ -1,4 +1,4 @@
1
- import type { QuestionPoolDiscriminator } from "../../shared/schemas/question.schema.js";
1
+ import type { QuestionPoolDiscriminator } from "../../questions/domain/question.schema.js";
2
2
  /** Recipient and intent provenance that scopes one pool preference. */
3
3
  export interface PoolAdjustmentProvenance {
4
4
  recipientUserId: string;
@@ -1,4 +1,4 @@
1
- import type { QuestionPoolSnapshot } from "../../shared/schemas/question.schema.js";
1
+ import type { QuestionPoolSnapshot } from "../../questions/domain/question.schema.js";
2
2
  /** Maximum raw intent-title characters included in a proactive DM line. */
3
3
  export declare const POOL_QUESTION_PUSH_TITLE_MAX_CHARS = 80;
4
4
  /** Stable identity for one pool refresh cycle. Chained alternates retain it. */
@@ -8,7 +8,7 @@
8
8
  * produced (and evidence-verified) at mining time, so synthesis is pure,
9
9
  * auditable, and cheap to re-run for interview-mode chaining.
10
10
  */
11
- import type { Question, QuestionPoolDiscriminator, QuestionPoolSnapshot } from "../../shared/schemas/question.schema.js";
11
+ import type { Question, QuestionPoolDiscriminator, QuestionPoolSnapshot } from "../../questions/domain/question.schema.js";
12
12
  import type { ScoredDiscriminator } from "./discriminator.types.js";
13
13
  /** Fixed option appended to every pool question — the no-preference escape. */
14
14
  export declare const BOTH_MATTER_LABEL = "Both matter";
@@ -118,8 +118,6 @@ export interface OpportunityGraphOptions {
118
118
  negotiationContinuation?: NegotiationContinuationExecution;
119
119
  /** Initial status for created opportunities (default: 'pending') */
120
120
  initialStatus?: OpportunityStatus;
121
- /** Minimum score threshold (default: 50) */
122
- minScore?: number;
123
121
  /** Maximum opportunities to return (default: 20) */
124
122
  limit?: number;
125
123
  /** Pre-inferred lenses (if not provided, lens inference runs automatically in HyDE graph) */
@@ -178,7 +176,7 @@ export declare const OpportunityGraphState: import("@langchain/langgraph").Annot
178
176
  *
179
177
  * Defaults to 'create' for backward compatibility.
180
178
  */
181
- operationMode: import("@langchain/langgraph").BaseChannel<"delete" | "send" | "update" | "create" | "create_introduction" | "continue_discovery" | "read" | "negotiate_existing" | "approve_introduction", "delete" | "send" | "update" | "create" | "create_introduction" | "continue_discovery" | "read" | "negotiate_existing" | "approve_introduction" | import("@langchain/langgraph").OverwriteValue<"delete" | "send" | "update" | "create" | "create_introduction" | "continue_discovery" | "read" | "negotiate_existing" | "approve_introduction">, unknown>;
179
+ operationMode: import("@langchain/langgraph").BaseChannel<"delete" | "send" | "update" | "create" | "read" | "create_introduction" | "continue_discovery" | "negotiate_existing" | "approve_introduction", "delete" | "send" | "update" | "create" | "read" | "create_introduction" | "continue_discovery" | "negotiate_existing" | "approve_introduction" | import("@langchain/langgraph").OverwriteValue<"delete" | "send" | "update" | "create" | "read" | "create_introduction" | "continue_discovery" | "negotiate_existing" | "approve_introduction">, unknown>;
182
180
  /** Introduction mode: pre-gathered entities (profiles + intents per party). */
183
181
  introductionEntities: import("@langchain/langgraph").BaseChannel<EvaluatorEntity[], EvaluatorEntity[] | import("@langchain/langgraph").OverwriteValue<EvaluatorEntity[]>, unknown>;
184
182
  /** Introduction mode: optional hint from the introducer. */
@@ -24,7 +24,7 @@ export { buildDiscoverySummary, toDiscoveryNegotiation, } from "../domain/negoti
24
24
  export type { NegotiationResolution } from "../domain/negotiation-summary.builder.js";
25
25
  export type { PoolCandidate, DiscriminatorMiningInput, MinedDiscriminator, ScoredDiscriminator, DiscriminatorShadowResult, } from "../discriminator/discriminator.types.js";
26
26
  export { poolQuestionsMiningMode, poolQuestionsMode, poolQuestionsPushMode, poolQuestionsStampNewborn, POOL_DISCRIMINATOR_MIN_POOL_SIZE, POOL_DISCRIMINATOR_MAX_CANDIDATES, POOL_DISCRIMINATOR_MAX_PUBLIC_CONTEXT_CHARS, POOL_QUESTION_MIN_VOI, POOL_QUESTION_MAX_PENDING_PER_INTENT, poolQuestionsRanking, POOL_RERUN_DEBOUNCE_MS, poolQuestionsVisitTrigger, POOL_VISIT_MINING_DEBOUNCE_MS, } from "../discriminator/discriminator.env.js";
27
- export { discoveryAllowedTypes, discoveryIntentMatchingEnabled, discoveryProfileMatchingEnabled, discoveryProfileSource, resetDiscoveryEnvWarningsForTests, } from "../discovery.env.js";
27
+ export { DISCOVERY_EVALUATOR_MIN_SCORE_DEFAULT, DISCOVERY_MIN_SIMILARITY_DEFAULT, discoveryAllowedTypes, discoveryEvaluatorMinScore, discoveryIntentMatchingEnabled, discoveryMinSimilarity, discoveryProfileMatchingEnabled, discoveryProfileSource, resetDiscoveryEnvWarningsForTests, validateDiscoveryEvaluatorMinScore, validateDiscoveryMinSimilarity, } from "../discovery.env.js";
28
28
  export type { DiscoveryMatchType, DiscoveryProfileSource, } from "../discovery.env.js";
29
29
  export { buildPoolAdjustment, planPoolAdjustments, mergePoolAdjustment, } from "../discriminator/discriminator.adjustments.js";
30
30
  export type { PoolAdjustment, PoolAdjustmentSignal, } from "../discriminator/discriminator.adjustments.js";
@@ -38,6 +38,7 @@ export { computeRadarHealth } from "../radar/radar.health.js";
38
38
  export type { RadarHealthInput } from "../radar/radar.health.js";
39
39
  export { isIntroducerDiscoveryEnabled } from "../application/opportunity.introducer-feature.js";
40
40
  export { OpportunityGraphFactory } from "../application/opportunity.graph.js";
41
+ export type { OpportunityGraphThresholdOverrides } from "../application/opportunity.graph.js";
41
42
  export type { StampNewbornOpportunitiesFn, StampNewbornOpportunitiesInput, } from "../application/opportunity.newborn-stamping.js";
42
43
  export { OpportunityEvaluator } from "../application/opportunity.evaluator.js";
43
44
  export type { EvaluatorInput } from "../application/opportunity.evaluator.js";
@@ -22,7 +22,7 @@ export { OPPORTUNITY_PRESENTATION_CACHE_VERSION, buildRadarCardPresentationCache
22
22
  export { buildDiscoverySummary, toDiscoveryNegotiation, } from "../domain/negotiation-summary.builder.js";
23
23
  export { poolQuestionsMiningMode, poolQuestionsMode, poolQuestionsPushMode, poolQuestionsStampNewborn, POOL_DISCRIMINATOR_MIN_POOL_SIZE, POOL_DISCRIMINATOR_MAX_CANDIDATES, POOL_DISCRIMINATOR_MAX_PUBLIC_CONTEXT_CHARS, POOL_QUESTION_MIN_VOI, POOL_QUESTION_MAX_PENDING_PER_INTENT, poolQuestionsRanking, POOL_RERUN_DEBOUNCE_MS, poolQuestionsVisitTrigger, POOL_VISIT_MINING_DEBOUNCE_MS, } from "../discriminator/discriminator.env.js";
24
24
  // discovery env accessors
25
- export { discoveryAllowedTypes, discoveryIntentMatchingEnabled, discoveryProfileMatchingEnabled, discoveryProfileSource, resetDiscoveryEnvWarningsForTests, } from "../discovery.env.js";
25
+ export { DISCOVERY_EVALUATOR_MIN_SCORE_DEFAULT, DISCOVERY_MIN_SIMILARITY_DEFAULT, discoveryAllowedTypes, discoveryEvaluatorMinScore, discoveryIntentMatchingEnabled, discoveryMinSimilarity, discoveryProfileMatchingEnabled, discoveryProfileSource, resetDiscoveryEnvWarningsForTests, validateDiscoveryEvaluatorMinScore, validateDiscoveryMinSimilarity, } from "../discovery.env.js";
26
26
  export { buildPoolAdjustment, planPoolAdjustments, mergePoolAdjustment, } from "../discriminator/discriminator.adjustments.js";
27
27
  export { synthesizePoolQuestion, selectQuestionDiscriminators, toQuestionDiscriminator, BOTH_MATTER_LABEL, } from "../discriminator/discriminator.question.js";
28
28
  export { poolQuestionCycleKey, buildPoolQuestionPushMessage, } from "../discriminator/discriminator.push.js";
@@ -14,7 +14,6 @@
14
14
  * - createAgentTools: application layer — lives in participant-agents/application.
15
15
  *
16
16
  * IND-548: canonical domain layer for the participant-agents capability.
17
- * Legacy path (shared/interfaces/agent.interface.ts) is a thin compatibility shim.
18
17
  */
19
18
  export type { AgentRecord, AgentTransportRecord, AgentPermissionRecord, AgentWithRelations, CreateAgentInput, CreateTransportInput, GrantPermissionInput, } from "./agent.types.js";
20
19
  export { SYSTEM_AGENT_IDS } from "./agent.types.js";
@@ -8,13 +8,9 @@
8
8
  * that must go through the participant-agents public surface.
9
9
  *
10
10
  * IND-548: canonical home for agent registration, permission-aware behaviour,
11
- * and dispatch contracts previously spread across agent/,
12
- * shared/interfaces/agent.interface.ts, and
13
- * shared/interfaces/agent-dispatcher.interface.ts.
11
+ * and dispatch contracts.
14
12
  *
15
- * Compatibility paths:
16
- * - shared/interfaces/agent.interface.ts — re-exports from participant-agents/domain
17
- * and participant-agents/ports
13
+ * Compatibility path:
18
14
  * - shared/interfaces/agent-dispatcher.interface.ts — re-exports from
19
15
  * participant-agents/ports
20
16
  */
@@ -8,13 +8,9 @@
8
8
  * that must go through the participant-agents public surface.
9
9
  *
10
10
  * IND-548: canonical home for agent registration, permission-aware behaviour,
11
- * and dispatch contracts previously spread across agent/,
12
- * shared/interfaces/agent.interface.ts, and
13
- * shared/interfaces/agent-dispatcher.interface.ts.
11
+ * and dispatch contracts.
14
12
  *
15
- * Compatibility paths:
16
- * - shared/interfaces/agent.interface.ts — re-exports from participant-agents/domain
17
- * and participant-agents/ports
13
+ * Compatibility path:
18
14
  * - shared/interfaces/agent-dispatcher.interface.ts — re-exports from
19
15
  * participant-agents/ports
20
16
  */
@@ -5,11 +5,9 @@
5
5
  * optional AgentDatabase so agent registration tools are compiled only
6
6
  * when the database adapter is wired at the composition root.
7
7
  *
8
- * NOTE: This type is intentionally defined inline (not derived via Pick from
9
- * ToolRegistryCompositionDeps in shared/agent/tool.helpers.ts) to avoid a
10
- * module cycle. ToolRegistryCompositionDeps imports AgentDatabase from
11
- * shared/interfaces/agent.interface.ts, which after IND-548 forwards to
12
- * participant-agents/ports — creating a cycle back here.
8
+ * NOTE: This type is intentionally defined inline rather than derived from
9
+ * ToolRegistryCompositionDeps, keeping the capability port independent from
10
+ * the all-capability composition contract.
13
11
  *
14
12
  * Structural equivalence with ToolRegistryCompositionDeps.agentDatabase is
15
13
  * preserved: both have type `AgentDatabase | undefined`.
@@ -5,11 +5,9 @@
5
5
  * optional AgentDatabase so agent registration tools are compiled only
6
6
  * when the database adapter is wired at the composition root.
7
7
  *
8
- * NOTE: This type is intentionally defined inline (not derived via Pick from
9
- * ToolRegistryCompositionDeps in shared/agent/tool.helpers.ts) to avoid a
10
- * module cycle. ToolRegistryCompositionDeps imports AgentDatabase from
11
- * shared/interfaces/agent.interface.ts, which after IND-548 forwards to
12
- * participant-agents/ports — creating a cycle back here.
8
+ * NOTE: This type is intentionally defined inline rather than derived from
9
+ * ToolRegistryCompositionDeps, keeping the capability port independent from
10
+ * the all-capability composition contract.
13
11
  *
14
12
  * Structural equivalence with ToolRegistryCompositionDeps.agentDatabase is
15
13
  * preserved: both have type `AgentDatabase | undefined`.
@@ -19,8 +19,7 @@
19
19
  * - AgentToolDeps — host capabilities for registration/permission tools.
20
20
  *
21
21
  * IND-548: canonical ports surface for the participant-agents capability.
22
- * Legacy paths:
23
- * - shared/interfaces/agent.interface.ts → re-exports AgentDatabase from here
22
+ * Compatibility path:
24
23
  * - shared/interfaces/agent-dispatcher.interface.ts → re-exports from here
25
24
  */
26
25
  export type { AgentDatabase } from "./agent.repository.port.js";
@@ -19,8 +19,7 @@
19
19
  * - AgentToolDeps — host capabilities for registration/permission tools.
20
20
  *
21
21
  * IND-548: canonical ports surface for the participant-agents capability.
22
- * Legacy paths:
23
- * - shared/interfaces/agent.interface.ts → re-exports AgentDatabase from here
22
+ * Compatibility path:
24
23
  * - shared/interfaces/agent-dispatcher.interface.ts → re-exports from here
25
24
  */
26
25
  export {};
@@ -20,6 +20,5 @@
20
20
  * - Persistence/generator ports: questions/ports.
21
21
  *
22
22
  * IND-547: canonical home for question domain types.
23
- * Legacy path (shared/schemas/question.schema.ts) is a thin compatibility shim.
24
23
  */
25
24
  export * from "./question.schema.js";
@@ -20,6 +20,5 @@
20
20
  * - Persistence/generator ports: questions/ports.
21
21
  *
22
22
  * IND-547: canonical home for question domain types.
23
- * Legacy path (shared/schemas/question.schema.ts) is a thin compatibility shim.
24
23
  */
25
24
  export * from "./question.schema.js";
@@ -5,9 +5,7 @@
5
5
  * elicitation dispatch, plus internal generator, persistence, and delivery
6
6
  * envelopes used across the questions capability.
7
7
  *
8
- * IND-547: extracted from shared/schemas/question.schema.ts into the
9
- * questions domain layer. Legacy path (shared/schemas/question.schema.ts)
10
- * is a thin compatibility shim pointing here.
8
+ * IND-547: canonical question schema in the questions domain layer.
11
9
  */
12
10
  import { z } from "zod";
13
11
  export declare const QuestionOptionSchema: z.ZodObject<{
@@ -5,9 +5,7 @@
5
5
  * elicitation dispatch, plus internal generator, persistence, and delivery
6
6
  * envelopes used across the questions capability.
7
7
  *
8
- * IND-547: extracted from shared/schemas/question.schema.ts into the
9
- * questions domain layer. Legacy path (shared/schemas/question.schema.ts)
10
- * is a thin compatibility shim pointing here.
8
+ * IND-547: canonical question schema in the questions domain layer.
11
9
  */
12
10
  import { z } from "zod";
13
11
  export const QuestionOptionSchema = z.object({
@@ -7,14 +7,9 @@
7
7
  * go through the questions public surface.
8
8
  *
9
9
  * IND-547: canonical home for question generation, eligibility, validation,
10
- * provenance, settlement policy, and continuation behaviour previously spread
11
- * across questioner/, shared/schemas/question.schema.ts, and
12
- * shared/interfaces/questioner.interface.ts.
10
+ * provenance, settlement policy, and continuation behaviour.
13
11
  *
14
12
  * Compatibility paths:
15
13
  * - capabilities/questions.facade.ts — re-exports from questions/public/index.js
16
- * - shared/schemas/question.schema.ts — re-exports from questions/domain
17
- * - shared/interfaces/questioner.interface.ts — re-exports from questions/ports
18
- * - shared/interfaces/question-generator.interface.ts — re-exports from questions/ports
19
14
  */
20
15
  export * from "./public/index.js";
@@ -7,14 +7,9 @@
7
7
  * go through the questions public surface.
8
8
  *
9
9
  * IND-547: canonical home for question generation, eligibility, validation,
10
- * provenance, settlement policy, and continuation behaviour previously spread
11
- * across questioner/, shared/schemas/question.schema.ts, and
12
- * shared/interfaces/questioner.interface.ts.
10
+ * provenance, settlement policy, and continuation behaviour.
13
11
  *
14
12
  * Compatibility paths:
15
13
  * - capabilities/questions.facade.ts — re-exports from questions/public/index.js
16
- * - shared/schemas/question.schema.ts — re-exports from questions/domain
17
- * - shared/interfaces/questioner.interface.ts — re-exports from questions/ports
18
- * - shared/interfaces/question-generator.interface.ts — re-exports from questions/ports
19
14
  */
20
15
  export * from "./public/index.js";
@@ -11,8 +11,7 @@
11
11
  * `ProtocolDeps`/`ToolContext`. The protocol module never constructs its own
12
12
  * LLM-bound generator — callers inject one (or `undefined` to opt out).
13
13
  *
14
- * IND-547: canonical home previously shared/interfaces/question-generator.interface.ts.
15
- * Legacy path is a thin compatibility shim pointing here.
14
+ * IND-547: canonical question generator port.
16
15
  */
17
16
  import type { DiscoveryQuestionInput } from "../../shared/schemas/discovery-question.schema.js";
18
17
  import type { QuestionGenerationResult } from "../domain/question.schema.js";
@@ -5,8 +5,7 @@
5
5
  * QuestionerAgent. Implementations live in the backend and are injected into
6
6
  * ProtocolDeps.
7
7
  *
8
- * IND-547: canonical home previously shared/interfaces/questioner.interface.ts.
9
- * Legacy path is a thin compatibility shim pointing here.
8
+ * IND-547: canonical question persistence port.
10
9
  */
11
10
  import type { Question, QuestionMode, QuestionPurpose, QuestionStrategy, QuestionDetection, QuestionActor, QuestionAnswer, UnderspecificationType } from "../domain/question.schema.js";
12
11
  /** Shape accepted by `persist()` — everything needed to insert a question row. */
@@ -44,4 +44,4 @@ export { isQuestionerEnabled, isDiscoveryQuestionsEnabled, isUptakeGuardEnabled,
44
44
  export { isValidQuestionerInputContract, } from "../application/index.js";
45
45
  export type { QuestionerInput, QuestionerEnqueuePayload, QuestionerEnqueueFn, PoolDiscoveryContext, RecoveryQuestionerInput, UptakeQuestionerInput, PostStallQuestionerInput, InflightQuestionerInput, } from "../application/index.js";
46
46
  export { createQuestionerTools, createAskUserQuestionTools } from "../application/index.js";
47
- export type { QuestionerToolDeps, AskUserQuestionToolDeps } from "../ports/index.js";
47
+ export type { AskUserQuestionToolDeps, ChatQuestionAnswerOutcome, ChatQuestionsHost, PersistableQuestion, PersistedQuestion, QuestionFilters, QuestionGeneratorReader, QuestionerDatabase, QuestionerToolDeps, } from "../ports/index.js";
@@ -5,25 +5,25 @@ import type { UserIdentity } from "../schemas/identity.schema.js";
5
5
  import type { ChatGraphCompositeDatabase, CreateOpportunityData, NetworkMembership, UserRecord, UserDatabase, SystemDatabase, NegotiationGraphDatabase } from "../interfaces/database.interface.js";
6
6
  import type { Scraper } from "../interfaces/scraper.interface.js";
7
7
  import type { Cache, HydeCache } from "../interfaces/cache.interface.js";
8
- import type { IntegrationAdapter } from "../interfaces/integration.interface.js";
9
- import type { ContactServiceAdapter } from "../interfaces/contact.interface.js";
8
+ import type { IntegrationAdapter } from "../../integrations/ports/index.js";
9
+ import type { ContactServiceAdapter } from "../../contacts/ports/index.js";
10
10
  import type { ProfileEnricher } from "../interfaces/enrichment.interface.js";
11
11
  import type { IntentGraphQueue } from "../interfaces/queue.interface.js";
12
12
  import type { ChatSessionReader } from "../interfaces/chat-session.interface.js";
13
13
  import type { ChatSummaryReader } from "../interfaces/chat-summary.interface.js";
14
14
  import type { ChatMessageWriter } from "../interfaces/chat-message-writer.interface.js";
15
- import type { QuestionGeneratorReader } from "../interfaces/question-generator.interface.js";
15
+ import type { QuestionGeneratorReader } from "../../questions/ports/question.generator.port.js";
16
16
  import type { NegotiationSummaryReader } from "../interfaces/negotiation-summary.interface.js";
17
17
  import type { Embedder } from "../interfaces/embedder.interface.js";
18
- import type { AgentDatabase } from "../interfaces/agent.interface.js";
18
+ import type { AgentDatabase } from "../../participant-agents/ports/index.js";
19
19
  import type { NegotiationTimeoutQueue } from "../interfaces/negotiation-events.interface.js";
20
20
  import type { AgentDispatcher } from "../interfaces/agent-dispatcher.interface.js";
21
21
  import type { DeliveryLedger } from "../interfaces/delivery-ledger.interface.js";
22
- import type { ChatQuestionsHost, QuestionerDatabase } from "../interfaces/questioner.interface.js";
22
+ import type { ChatQuestionsHost, QuestionerDatabase } from "../../questions/ports/index.js";
23
23
  import type { NegotiatorMemoryToolsHost } from "../interfaces/negotiator-memory.interface.js";
24
24
  import type { QuestionerEnqueueFn } from "../../questions/application/question.input.js";
25
25
  import type { PendingQuestionSummary } from "../schemas/pending-question.schema.js";
26
- import type { QuestionMode, QuestionPurpose } from "../schemas/question.schema.js";
26
+ import type { QuestionMode, QuestionPurpose } from "../../questions/domain/question.schema.js";
27
27
  import type { EnrichmentRunQueue, EnrichmentRunStore } from "../interfaces/enrichment-run.interface.js";
28
28
  import type { McpActivityCaller } from "./activity-projection.js";
29
29
  export type IdentityContext = UserIdentity | null;
@@ -1460,6 +1460,7 @@ export interface Database {
1460
1460
  networkIds: string[];
1461
1461
  excludeUserId: string;
1462
1462
  limit: number;
1463
+ minScore?: number;
1463
1464
  }): Promise<Array<{
1464
1465
  premiseId: string;
1465
1466
  userId: string;
@@ -1500,6 +1501,7 @@ export interface Database {
1500
1501
  networkIds: string[];
1501
1502
  excludeUserId: string;
1502
1503
  limitPerSource: number;
1504
+ minScore?: number;
1503
1505
  }): Promise<Array<{
1504
1506
  sourcePremiseId: string;
1505
1507
  premiseId: string;
@@ -3,7 +3,7 @@
3
3
  * in tool results. Omits internal fields (actors, answer, status) that
4
4
  * are not needed by the chat agent or MCP client.
5
5
  */
6
- import type { QuestionMode, QuestionPurpose } from "./question.schema.js";
6
+ import type { QuestionMode, QuestionPurpose } from "../../questions/domain/question.schema.js";
7
7
  export interface PendingQuestionSummary {
8
8
  id: string;
9
9
  title: string;
@@ -13,7 +13,7 @@ import { createStructuredModel } from "../../shared/agent/model.config.js";
13
13
  import { invokeWithAbortSignal } from "../../shared/agent/model-signal.js";
14
14
  import { protocolLogger } from "../../shared/observability/protocol.logger.js";
15
15
  import { Timed } from "../../shared/observability/performance.js";
16
- import { UnderspecificationTypeSchema } from "../../shared/schemas/question.schema.js";
16
+ import { UnderspecificationTypeSchema } from "../../questions/domain/question.schema.js";
17
17
  const logger = protocolLogger("IntentClarifier");
18
18
  const clarificationSchema = z.discriminatedUnion("needsClarification", [
19
19
  z.object({
@@ -150,7 +150,7 @@ export declare class IntentGraphFactory {
150
150
  message?: string;
151
151
  networkId?: string;
152
152
  } | undefined> | undefined;
153
- }, "query" | "__start__" | "inference" | "verification" | "prep" | "reconciler" | "executor", {
153
+ }, "query" | "__start__" | "prep" | "inference" | "verification" | "reconciler" | "executor", {
154
154
  userId: {
155
155
  (annotation: import("@langchain/langgraph").SingleReducer<string, string>): import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
156
156
  (): import("@langchain/langgraph").LastValue<string>;
@@ -9,13 +9,13 @@ declare const responseFormat: z.ZodObject<{
9
9
  authority: z.ZodNumber;
10
10
  sincerity: z.ZodNumber;
11
11
  }, "strip", z.ZodTypeAny, {
12
- sincerity: number;
13
12
  clarity: number;
14
13
  authority: number;
15
- }, {
16
14
  sincerity: number;
15
+ }, {
17
16
  clarity: number;
18
17
  authority: number;
18
+ sincerity: number;
19
19
  }>;
20
20
  semantic_entropy: z.ZodNumber;
21
21
  referential_anchor: z.ZodNullable<z.ZodString>;
@@ -27,9 +27,9 @@ declare const responseFormat: z.ZodObject<{
27
27
  reasoning: string;
28
28
  classification: "COMMISSIVE" | "DIRECTIVE" | "ASSERTIVE" | "EXPRESSIVE" | "DECLARATION" | "UNKNOWN";
29
29
  felicity_scores: {
30
- sincerity: number;
31
30
  clarity: number;
32
31
  authority: number;
32
+ sincerity: number;
33
33
  };
34
34
  semantic_entropy: number;
35
35
  referential_anchor: string | null;
@@ -41,9 +41,9 @@ declare const responseFormat: z.ZodObject<{
41
41
  reasoning: string;
42
42
  classification: "COMMISSIVE" | "DIRECTIVE" | "ASSERTIVE" | "EXPRESSIVE" | "DECLARATION" | "UNKNOWN";
43
43
  felicity_scores: {
44
- sincerity: number;
45
44
  clarity: number;
46
45
  authority: number;
46
+ sincerity: number;
47
47
  };
48
48
  semantic_entropy: number;
49
49
  referential_anchor: string | null;
@@ -67,9 +67,9 @@ export declare class SemanticVerifier {
67
67
  reasoning: string;
68
68
  classification: "COMMISSIVE" | "DIRECTIVE" | "ASSERTIVE" | "EXPRESSIVE" | "DECLARATION" | "UNKNOWN";
69
69
  felicity_scores: {
70
- sincerity: number;
71
70
  clarity: number;
72
71
  authority: number;
72
+ sincerity: number;
73
73
  };
74
74
  semantic_entropy: number;
75
75
  referential_anchor: string | null;
@@ -100,9 +100,9 @@ export declare class SemanticVerifier {
100
100
  reasoning: string;
101
101
  classification: "COMMISSIVE" | "DIRECTIVE" | "ASSERTIVE" | "EXPRESSIVE" | "DECLARATION" | "UNKNOWN";
102
102
  felicity_scores: {
103
- sincerity: number;
104
103
  clarity: number;
105
104
  authority: number;
105
+ sincerity: number;
106
106
  };
107
107
  semantic_entropy: number;
108
108
  referential_anchor: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexnetwork/protocol",
3
- "version": "10.1.3-rc.453.1",
3
+ "version": "11.0.1-rc.455.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",