@indexnetwork/protocol 14.3.2-rc.477.1 → 17.0.0-rc.479.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 +141 -0
- package/IMPLEMENTATION.md +50 -52
- package/STABILITY.md +3 -3
- package/dist/chat/chat.agent.js +2 -3
- package/dist/chat/chat.graph.d.ts +41 -1
- package/dist/chat/chat.graph.js +108 -127
- package/dist/chat/negotiator.persona.d.ts +1 -1
- package/dist/chat/negotiator.persona.js +1 -4
- package/dist/chat/negotiator.prompt.js +1 -2
- package/dist/chat/onboarding.persona.js +0 -1
- package/dist/chat/reporter.persona.js +0 -1
- package/dist/chat/signal.persona.js +0 -1
- package/dist/contacts/application/contact.tools.d.ts +6 -9
- package/dist/contacts/application/contact.tools.js +11 -92
- package/dist/contacts/application/index.d.ts +2 -14
- package/dist/contacts/application/index.js +2 -13
- package/dist/contacts/domain/contact.types.d.ts +0 -23
- package/dist/contacts/domain/index.d.ts +2 -6
- package/dist/contacts/index.d.ts +1 -1
- package/dist/contacts/index.js +1 -1
- package/dist/contacts/ports/contact.repository.port.d.ts +5 -12
- package/dist/contacts/ports/contact.repository.port.js +4 -6
- package/dist/contacts/ports/contact.tools.port.d.ts +1 -3
- package/dist/contacts/ports/contact.tools.port.js +1 -2
- package/dist/contacts/ports/index.d.ts +1 -1
- package/dist/contacts/ports/index.js +1 -1
- package/dist/discovery/hyde.frame.d.ts +4 -4
- package/dist/discovery/hyde.graph.d.ts +71 -12
- package/dist/discovery/hyde.graph.js +337 -335
- package/dist/discovery/lens.inferrer.d.ts +6 -6
- package/dist/enrichment/enrichment.graph.d.ts +127 -9
- package/dist/enrichment/enrichment.graph.js +633 -655
- package/dist/enrichment/enrichment.state.d.ts +1 -1
- package/dist/enrichment/enrichment.tools.context-read.d.ts +10 -0
- package/dist/enrichment/enrichment.tools.context-read.js +353 -0
- package/dist/enrichment/enrichment.tools.context-write.d.ts +9 -0
- package/dist/enrichment/enrichment.tools.context-write.js +417 -0
- package/dist/enrichment/enrichment.tools.d.ts +11 -1
- package/dist/enrichment/enrichment.tools.helpers.d.ts +139 -0
- package/dist/enrichment/enrichment.tools.helpers.js +234 -0
- package/dist/enrichment/enrichment.tools.js +16 -975
- package/dist/index.d.ts +27 -50
- package/dist/index.js +17 -28
- package/dist/intents/application/intent.graph.d.ts +71 -67
- package/dist/intents/application/intent.graph.execute.d.ts +59 -0
- package/dist/intents/application/intent.graph.execute.js +301 -0
- package/dist/intents/application/intent.graph.infer.d.ts +44 -0
- package/dist/intents/application/intent.graph.infer.js +97 -0
- package/dist/intents/application/intent.graph.js +96 -888
- package/dist/intents/application/intent.graph.reconcile.d.ts +71 -0
- package/dist/intents/application/intent.graph.reconcile.js +274 -0
- package/dist/intents/application/intent.graph.shared.d.ts +70 -0
- package/dist/intents/application/intent.graph.shared.js +153 -0
- package/dist/intents/domain/intent.state.d.ts +1 -1
- package/dist/maintenance/maintenance.graph.d.ts +66 -3
- package/dist/maintenance/maintenance.graph.js +155 -156
- package/dist/mcp/mcp.authorization-policy.d.ts +24 -28
- package/dist/mcp/mcp.authorization-policy.js +14 -34
- package/dist/mcp/mcp.server.d.ts +3 -3
- package/dist/mcp/mcp.server.js +14 -20
- package/dist/negotiations/application/negotiation.candidates.d.ts +83 -0
- package/dist/negotiations/application/negotiation.candidates.js +162 -0
- package/dist/negotiations/application/negotiation.graph.d.ts +91 -157
- package/dist/negotiations/application/negotiation.graph.finalize.d.ts +5 -0
- package/dist/negotiations/application/negotiation.graph.finalize.js +280 -0
- package/dist/negotiations/application/negotiation.graph.init.d.ts +54 -0
- package/dist/negotiations/application/negotiation.graph.init.js +227 -0
- package/dist/negotiations/application/negotiation.graph.js +69 -1388
- package/dist/negotiations/application/negotiation.graph.screen.d.ts +23 -0
- package/dist/negotiations/application/negotiation.graph.screen.js +108 -0
- package/dist/negotiations/application/negotiation.graph.shared.d.ts +75 -0
- package/dist/negotiations/application/negotiation.graph.shared.js +125 -0
- package/dist/negotiations/application/negotiation.graph.turn.d.ts +105 -0
- package/dist/negotiations/application/negotiation.graph.turn.js +484 -0
- package/dist/negotiations/domain/negotiation.state.d.ts +1 -1
- package/dist/negotiations/domain/negotiation.state.js +0 -1
- package/dist/networks/application/indexer.graph.d.ts +165 -7
- package/dist/networks/application/indexer.graph.js +339 -388
- package/dist/networks/application/indexer.state.d.ts +1 -1
- package/dist/networks/application/membership.graph.d.ts +83 -5
- package/dist/networks/application/membership.graph.js +177 -207
- package/dist/networks/application/network.graph.d.ts +148 -5
- package/dist/networks/application/network.graph.js +249 -278
- package/dist/networks/domain/membership.state.d.ts +1 -1
- package/dist/networks/domain/network.state.d.ts +1 -1
- package/dist/opportunities/application/delivery-card.cache.d.ts +1 -1
- package/dist/opportunities/application/delivery-card.cache.js +2 -2
- package/dist/opportunities/application/index.d.ts +2 -2
- package/dist/opportunities/application/index.js +2 -2
- package/dist/opportunities/application/opportunity.evaluator.js +1 -1
- package/dist/opportunities/application/opportunity.graph.d.ts +686 -473
- package/dist/opportunities/application/opportunity.graph.discovery-strategies.d.ts +109 -0
- package/dist/opportunities/application/opportunity.graph.discovery-strategies.js +451 -0
- package/dist/opportunities/application/opportunity.graph.discovery.d.ts +69 -0
- package/dist/opportunities/application/opportunity.graph.discovery.js +397 -0
- package/dist/opportunities/application/opportunity.graph.evaluation.d.ts +82 -0
- package/dist/opportunities/application/opportunity.graph.evaluation.js +608 -0
- package/dist/opportunities/application/opportunity.graph.js +120 -3690
- package/dist/opportunities/application/opportunity.graph.modes.d.ts +538 -0
- package/dist/opportunities/application/opportunity.graph.modes.js +538 -0
- package/dist/opportunities/application/opportunity.graph.negotiate.d.ts +109 -0
- package/dist/opportunities/application/opportunity.graph.negotiate.js +392 -0
- package/dist/opportunities/application/opportunity.graph.persist-node.d.ts +93 -0
- package/dist/opportunities/application/opportunity.graph.persist-node.js +765 -0
- package/dist/opportunities/application/opportunity.graph.prep.d.ts +150 -0
- package/dist/opportunities/application/opportunity.graph.prep.js +381 -0
- package/dist/opportunities/application/opportunity.graph.shared.d.ts +173 -0
- package/dist/opportunities/application/opportunity.graph.shared.js +199 -0
- package/dist/opportunities/application/opportunity.presentation.d.ts +399 -0
- package/dist/opportunities/application/{opportunity.presenter.js → opportunity.presentation.js} +735 -9
- package/dist/opportunities/application/opportunity.tools.cards.d.ts +152 -0
- package/dist/opportunities/application/opportunity.tools.cards.js +235 -0
- package/dist/opportunities/application/opportunity.tools.d.ts +8 -114
- package/dist/opportunities/application/opportunity.tools.js +28 -711
- package/dist/opportunities/application/opportunity.tools.list.d.ts +10 -0
- package/dist/opportunities/application/opportunity.tools.list.js +493 -0
- package/dist/opportunities/domain/index.d.ts +3 -3
- package/dist/opportunities/domain/index.js +3 -3
- package/dist/opportunities/domain/opportunity.state.d.ts +19 -19
- package/dist/opportunities/index.d.ts +6 -6
- package/dist/opportunities/index.js +4 -4
- package/dist/opportunities/ports/opportunity.tools.port.d.ts +1 -1
- package/dist/opportunities/radar/radar.graph.d.ts +57 -13
- package/dist/opportunities/radar/radar.graph.js +470 -471
- package/dist/premises/premise.graph.d.ts +88 -20
- package/dist/premises/premise.graph.js +207 -218
- package/dist/questions/domain/question.schema.d.ts +40 -40
- package/dist/shared/agent/tool.factory.js +0 -8
- package/dist/shared/agent/tool.helpers.d.ts +21 -45
- package/dist/shared/agent/tool.helpers.js +1 -2
- package/dist/shared/agent/tool.registry.d.ts +4 -3
- package/dist/shared/agent/tool.registry.js +2 -4
- package/dist/shared/agent/tool.runtime.js +0 -2
- package/dist/shared/agent/utility.tools.js +9 -13
- package/dist/shared/interfaces/database.capabilities.d.ts +100 -0
- package/dist/shared/interfaces/database.capabilities.js +7 -0
- package/dist/shared/interfaces/database.entities.d.ts +533 -0
- package/dist/shared/interfaces/database.entities.js +10 -0
- package/dist/shared/interfaces/database.identity-queries.d.ts +294 -0
- package/dist/shared/interfaces/database.identity-queries.js +4 -0
- package/dist/shared/interfaces/database.interface.d.ts +15 -2277
- package/dist/shared/interfaces/database.interface.js +8 -0
- package/dist/shared/interfaces/database.member-queries.d.ts +221 -0
- package/dist/shared/interfaces/database.member-queries.js +4 -0
- package/dist/shared/interfaces/database.negotiation.d.ts +305 -0
- package/dist/shared/interfaces/database.negotiation.js +26 -0
- package/dist/shared/interfaces/database.network-queries.d.ts +277 -0
- package/dist/shared/interfaces/database.network-queries.js +4 -0
- package/dist/shared/interfaces/database.opportunity-queries.d.ts +285 -0
- package/dist/shared/interfaces/database.opportunity-queries.js +4 -0
- package/dist/shared/interfaces/database.port.d.ts +322 -0
- package/dist/shared/interfaces/database.port.js +29 -0
- package/dist/shared/schemas/discovery-question.schema.d.ts +14 -14
- package/dist/shared/schemas/negotiation-digest.schema.d.ts +2 -2
- package/package.json +2 -15
- package/dist/contacts/application/contact.inviter.d.ts +0 -49
- package/dist/contacts/application/contact.inviter.js +0 -64
- package/dist/integrations/application/index.d.ts +0 -14
- package/dist/integrations/application/index.js +0 -14
- package/dist/integrations/application/integration.tools.d.ts +0 -27
- package/dist/integrations/application/integration.tools.js +0 -98
- package/dist/integrations/domain/index.d.ts +0 -16
- package/dist/integrations/domain/index.js +0 -1
- package/dist/integrations/domain/integration.types.d.ts +0 -51
- package/dist/integrations/domain/integration.types.js +0 -9
- package/dist/integrations/index.d.ts +0 -10
- package/dist/integrations/index.js +0 -8
- package/dist/integrations/ports/index.d.ts +0 -25
- package/dist/integrations/ports/index.js +0 -23
- package/dist/integrations/ports/integration.adapter.port.d.ts +0 -62
- package/dist/integrations/ports/integration.adapter.port.js +0 -15
- package/dist/integrations/ports/integration.importer.port.d.ts +0 -31
- package/dist/integrations/ports/integration.importer.port.js +0 -15
- package/dist/integrations/ports/integration.tools.port.d.ts +0 -25
- package/dist/integrations/ports/integration.tools.port.js +0 -18
- package/dist/opportunities/application/opportunity.card-presentation.d.ts +0 -44
- package/dist/opportunities/application/opportunity.card-presentation.js +0 -93
- package/dist/opportunities/application/opportunity.presenter.d.ts +0 -156
- package/dist/opportunities/domain/opportunity.presentation-cache.d.ts +0 -5
- package/dist/opportunities/domain/opportunity.presentation-cache.js +0 -11
- package/dist/opportunities/domain/opportunity.presentation.d.ts +0 -76
- package/dist/opportunities/domain/opportunity.presentation.js +0 -516
- package/dist/opportunities/domain/opportunity.safe-presentation.d.ts +0 -104
- package/dist/opportunities/domain/opportunity.safe-presentation.js +0 -102
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The opportunity operations that are not discovery.
|
|
3
|
+
*
|
|
4
|
+
* These used to be graph nodes reached through an `operationMode` conditional
|
|
5
|
+
* edge at START — nine one-node paths sharing a state machine they never used.
|
|
6
|
+
* They are plain async functions now; callers invoke the one they mean. Only
|
|
7
|
+
* the discovery pipeline still needs a graph.
|
|
8
|
+
*
|
|
9
|
+
* Each returns the same shape the corresponding node returned, so callers read
|
|
10
|
+
* `readResult` / `mutationResult` exactly as before.
|
|
11
|
+
*/
|
|
12
|
+
import type { Id, NegotiationContinuationReceipt } from '../../shared/interfaces/database.interface.js';
|
|
13
|
+
import type { DebugMetaAgent } from '../../agents/index.js';
|
|
14
|
+
import type { EvaluatedOpportunity, EvaluatedOpportunityActor } from '../domain/opportunity.state.js';
|
|
15
|
+
import type { EvaluatorEntity } from './opportunity.evaluator.js';
|
|
16
|
+
import type { OpportunityMutationResult } from './opportunity.lifecycle.js';
|
|
17
|
+
import { type OpportunityGraphDeps, type OpportunityState } from './opportunity.graph.shared.js';
|
|
18
|
+
/** Identifies the caller and the opportunity every mutation mode acts on. */
|
|
19
|
+
export interface OpportunityMutationRequest {
|
|
20
|
+
userId: Id<'users'>;
|
|
21
|
+
opportunityId: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
/** Shape the update/delete/send/approve modes return. */
|
|
24
|
+
export interface OpportunityMutationOutcome {
|
|
25
|
+
mutationResult: OpportunityMutationResult;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Read mode: list opportunities for the user, optionally filtered by networkId.
|
|
29
|
+
* Fast path — no LLM calls.
|
|
30
|
+
*/
|
|
31
|
+
export declare function readOpportunities(deps: Pick<OpportunityGraphDeps, 'database'>, request: {
|
|
32
|
+
userId: Id<'users'>;
|
|
33
|
+
networkId?: Id<'networks'>;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
readResult: {
|
|
36
|
+
count: number;
|
|
37
|
+
message: string;
|
|
38
|
+
opportunities: {
|
|
39
|
+
id: string;
|
|
40
|
+
indexName: string;
|
|
41
|
+
connectedWith: string[];
|
|
42
|
+
suggestedBy: string | null;
|
|
43
|
+
reasoning: string;
|
|
44
|
+
status: import("../../shared/interfaces/database.entities.js").OpportunityStatus;
|
|
45
|
+
category: string;
|
|
46
|
+
confidence: number | null;
|
|
47
|
+
source: string | null;
|
|
48
|
+
}[];
|
|
49
|
+
};
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Update mode: change opportunity status (accept, reject, etc.).
|
|
53
|
+
* For 'accepted', enforces the self-accept guard: the caller's actor entry
|
|
54
|
+
* must not already have `actedAt` set — i.e. the caller has not yet been
|
|
55
|
+
* the one to advance this opportunity's state. Stamps `actedAt` on accept
|
|
56
|
+
* atomically with the status change via `stampOpportunityActorAction`.
|
|
57
|
+
*/
|
|
58
|
+
export declare function updateOpportunityStatus(deps: Pick<OpportunityGraphDeps, 'database'>, request: OpportunityMutationRequest & {
|
|
59
|
+
newStatus: string | undefined;
|
|
60
|
+
}): Promise<OpportunityMutationOutcome>;
|
|
61
|
+
/** Delete mode: expire/archive an opportunity. */
|
|
62
|
+
export declare function deleteOpportunity(deps: Pick<OpportunityGraphDeps, 'database'>, request: OpportunityMutationRequest): Promise<OpportunityMutationOutcome>;
|
|
63
|
+
/** Send mode: promote a latent or draft opportunity to pending + queue notification. */
|
|
64
|
+
export declare function sendOpportunity(deps: Pick<OpportunityGraphDeps, 'database' | 'queueNotification'>, request: OpportunityMutationRequest): Promise<OpportunityMutationOutcome>;
|
|
65
|
+
/**
|
|
66
|
+
* Approve-introduction mode.
|
|
67
|
+
* Called by the introducer to approve a latent introducer-pattern opportunity.
|
|
68
|
+
* Sets approved=true on the introducer actor (status stays latent), then
|
|
69
|
+
* enqueues a negotiate_existing job so the parties negotiate normally.
|
|
70
|
+
*/
|
|
71
|
+
export declare function approveIntroduction(deps: Pick<OpportunityGraphDeps, 'database' | 'queueNegotiateExisting'>, request: OpportunityMutationRequest): Promise<OpportunityMutationOutcome>;
|
|
72
|
+
/**
|
|
73
|
+
* Negotiate-existing mode: load an existing opportunity by ID and run bilateral negotiation.
|
|
74
|
+
* Used after introducer approval to trigger the normal negotiation flow for a latent opportunity.
|
|
75
|
+
*/
|
|
76
|
+
export declare function negotiateExisting(deps: Pick<OpportunityGraphDeps, 'database' | 'negotiationGraph' | 'queueNotification'>, request: OpportunityMutationRequest & {
|
|
77
|
+
continuation?: OpportunityState['options']['negotiationContinuation'];
|
|
78
|
+
}): Promise<{
|
|
79
|
+
negotiationContinuationReceipt?: NegotiationContinuationReceipt;
|
|
80
|
+
error?: string;
|
|
81
|
+
}>;
|
|
82
|
+
/** What the caller supplies to create an introduction. */
|
|
83
|
+
export interface IntroductionRequest {
|
|
84
|
+
userId: Id<'users'>;
|
|
85
|
+
networkId?: Id<'networks'>;
|
|
86
|
+
/** Pre-gathered entities (profiles + intents per party). */
|
|
87
|
+
introductionEntities: EvaluatorEntity[];
|
|
88
|
+
/** Optional hint from the introducer. */
|
|
89
|
+
introductionHint?: string;
|
|
90
|
+
/** When set (e.g. chat scope), networkId must match this. */
|
|
91
|
+
requiredNetworkId?: Id<'networks'>;
|
|
92
|
+
options?: Partial<OpportunityState['options']>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Introduction mode: validate → evaluate → persist.
|
|
96
|
+
*
|
|
97
|
+
* Validation gates on scope and membership; evaluation asks the evaluator to
|
|
98
|
+
* justify the pairing (falling back to the introducer's own word); persistence
|
|
99
|
+
* reuses the discovery pipeline's persist stage.
|
|
100
|
+
*/
|
|
101
|
+
export declare function createIntroduction(deps: OpportunityGraphDeps, request: IntroductionRequest): Promise<{
|
|
102
|
+
error?: string;
|
|
103
|
+
trace?: Array<{
|
|
104
|
+
node: string;
|
|
105
|
+
detail?: string;
|
|
106
|
+
data?: Record<string, unknown>;
|
|
107
|
+
}>;
|
|
108
|
+
opportunities: never[];
|
|
109
|
+
evaluatedOpportunities: never[];
|
|
110
|
+
agentTimings: never[];
|
|
111
|
+
} | {
|
|
112
|
+
opportunities: never[];
|
|
113
|
+
persistenceOutcome: {
|
|
114
|
+
evaluatedCount: number;
|
|
115
|
+
createdCount: number;
|
|
116
|
+
reactivatedCount: number;
|
|
117
|
+
sameTriggerDuplicateSuppressions: number;
|
|
118
|
+
pairActiveNegotiationSuppressions: number;
|
|
119
|
+
crossTriggerAllowedCount: number;
|
|
120
|
+
finalAtomicConflictCount: number;
|
|
121
|
+
};
|
|
122
|
+
existingBetweenActors?: undefined;
|
|
123
|
+
trace?: undefined;
|
|
124
|
+
error?: undefined;
|
|
125
|
+
evaluatedOpportunities: never[];
|
|
126
|
+
agentTimings: never[];
|
|
127
|
+
introductionContext?: undefined;
|
|
128
|
+
options?: undefined;
|
|
129
|
+
} | {
|
|
130
|
+
opportunities: import("../../shared/interfaces/database.entities.js").Opportunity[];
|
|
131
|
+
existingBetweenActors: {
|
|
132
|
+
candidateUserId: Id<"users">;
|
|
133
|
+
networkId: Id<"networks">;
|
|
134
|
+
existingOpportunityId?: Id<"opportunities">;
|
|
135
|
+
existingStatus?: import("../../shared/interfaces/database.entities.js").OpportunityStatus;
|
|
136
|
+
reason?: "same_trigger_recent_duplicate" | "pair_active_negotiation" | "final_atomic_conflict";
|
|
137
|
+
existingTriggerIntentId?: string;
|
|
138
|
+
}[];
|
|
139
|
+
persistenceOutcome: {
|
|
140
|
+
evaluatedCount: number;
|
|
141
|
+
createdCount: number;
|
|
142
|
+
reactivatedCount: number;
|
|
143
|
+
sameTriggerDuplicateSuppressions: number;
|
|
144
|
+
pairActiveNegotiationSuppressions: number;
|
|
145
|
+
crossTriggerAllowedCount: number;
|
|
146
|
+
finalAtomicConflictCount: number;
|
|
147
|
+
};
|
|
148
|
+
trace: {
|
|
149
|
+
node: string;
|
|
150
|
+
detail: string;
|
|
151
|
+
data: {
|
|
152
|
+
created: number;
|
|
153
|
+
reactivated: number;
|
|
154
|
+
existingSkipped: number;
|
|
155
|
+
totalOutput: number;
|
|
156
|
+
persistenceOutcome: {
|
|
157
|
+
evaluatedCount: number;
|
|
158
|
+
createdCount: number;
|
|
159
|
+
reactivatedCount: number;
|
|
160
|
+
sameTriggerDuplicateSuppressions: number;
|
|
161
|
+
pairActiveNegotiationSuppressions: number;
|
|
162
|
+
crossTriggerAllowedCount: number;
|
|
163
|
+
finalAtomicConflictCount: number;
|
|
164
|
+
};
|
|
165
|
+
durationMs: number;
|
|
166
|
+
};
|
|
167
|
+
}[];
|
|
168
|
+
error?: undefined;
|
|
169
|
+
evaluatedOpportunities: never[];
|
|
170
|
+
agentTimings: never[];
|
|
171
|
+
introductionContext?: undefined;
|
|
172
|
+
options?: undefined;
|
|
173
|
+
} | {
|
|
174
|
+
opportunities: never[];
|
|
175
|
+
existingBetweenActors: never[];
|
|
176
|
+
error: string;
|
|
177
|
+
trace: {
|
|
178
|
+
node: string;
|
|
179
|
+
detail: string;
|
|
180
|
+
data: {
|
|
181
|
+
error: string;
|
|
182
|
+
};
|
|
183
|
+
}[];
|
|
184
|
+
persistenceOutcome?: undefined;
|
|
185
|
+
evaluatedOpportunities: never[];
|
|
186
|
+
agentTimings: never[];
|
|
187
|
+
introductionContext?: undefined;
|
|
188
|
+
options?: undefined;
|
|
189
|
+
} | {
|
|
190
|
+
opportunities: never[];
|
|
191
|
+
persistenceOutcome: {
|
|
192
|
+
evaluatedCount: number;
|
|
193
|
+
createdCount: number;
|
|
194
|
+
reactivatedCount: number;
|
|
195
|
+
sameTriggerDuplicateSuppressions: number;
|
|
196
|
+
pairActiveNegotiationSuppressions: number;
|
|
197
|
+
crossTriggerAllowedCount: number;
|
|
198
|
+
finalAtomicConflictCount: number;
|
|
199
|
+
};
|
|
200
|
+
existingBetweenActors?: undefined;
|
|
201
|
+
trace?: undefined;
|
|
202
|
+
error: string;
|
|
203
|
+
evaluatedOpportunities: never[];
|
|
204
|
+
agentTimings: never[];
|
|
205
|
+
introductionContext?: undefined;
|
|
206
|
+
options?: undefined;
|
|
207
|
+
} | {
|
|
208
|
+
opportunities: import("../../shared/interfaces/database.entities.js").Opportunity[];
|
|
209
|
+
existingBetweenActors: {
|
|
210
|
+
candidateUserId: Id<"users">;
|
|
211
|
+
networkId: Id<"networks">;
|
|
212
|
+
existingOpportunityId?: Id<"opportunities">;
|
|
213
|
+
existingStatus?: import("../../shared/interfaces/database.entities.js").OpportunityStatus;
|
|
214
|
+
reason?: "same_trigger_recent_duplicate" | "pair_active_negotiation" | "final_atomic_conflict";
|
|
215
|
+
existingTriggerIntentId?: string;
|
|
216
|
+
}[];
|
|
217
|
+
persistenceOutcome: {
|
|
218
|
+
evaluatedCount: number;
|
|
219
|
+
createdCount: number;
|
|
220
|
+
reactivatedCount: number;
|
|
221
|
+
sameTriggerDuplicateSuppressions: number;
|
|
222
|
+
pairActiveNegotiationSuppressions: number;
|
|
223
|
+
crossTriggerAllowedCount: number;
|
|
224
|
+
finalAtomicConflictCount: number;
|
|
225
|
+
};
|
|
226
|
+
trace: {
|
|
227
|
+
node: string;
|
|
228
|
+
detail: string;
|
|
229
|
+
data: {
|
|
230
|
+
created: number;
|
|
231
|
+
reactivated: number;
|
|
232
|
+
existingSkipped: number;
|
|
233
|
+
totalOutput: number;
|
|
234
|
+
persistenceOutcome: {
|
|
235
|
+
evaluatedCount: number;
|
|
236
|
+
createdCount: number;
|
|
237
|
+
reactivatedCount: number;
|
|
238
|
+
sameTriggerDuplicateSuppressions: number;
|
|
239
|
+
pairActiveNegotiationSuppressions: number;
|
|
240
|
+
crossTriggerAllowedCount: number;
|
|
241
|
+
finalAtomicConflictCount: number;
|
|
242
|
+
};
|
|
243
|
+
durationMs: number;
|
|
244
|
+
};
|
|
245
|
+
}[];
|
|
246
|
+
error: string;
|
|
247
|
+
evaluatedOpportunities: never[];
|
|
248
|
+
agentTimings: never[];
|
|
249
|
+
introductionContext?: undefined;
|
|
250
|
+
options?: undefined;
|
|
251
|
+
} | {
|
|
252
|
+
opportunities: never[];
|
|
253
|
+
persistenceOutcome: {
|
|
254
|
+
evaluatedCount: number;
|
|
255
|
+
createdCount: number;
|
|
256
|
+
reactivatedCount: number;
|
|
257
|
+
sameTriggerDuplicateSuppressions: number;
|
|
258
|
+
pairActiveNegotiationSuppressions: number;
|
|
259
|
+
crossTriggerAllowedCount: number;
|
|
260
|
+
finalAtomicConflictCount: number;
|
|
261
|
+
};
|
|
262
|
+
existingBetweenActors?: undefined;
|
|
263
|
+
trace: {
|
|
264
|
+
node: string;
|
|
265
|
+
detail: string;
|
|
266
|
+
data: {
|
|
267
|
+
error: string;
|
|
268
|
+
};
|
|
269
|
+
}[];
|
|
270
|
+
error?: undefined;
|
|
271
|
+
evaluatedOpportunities: {
|
|
272
|
+
actors: EvaluatedOpportunityActor[];
|
|
273
|
+
score: number;
|
|
274
|
+
reasoning: string;
|
|
275
|
+
}[];
|
|
276
|
+
introductionContext: {
|
|
277
|
+
createdByName: string | undefined;
|
|
278
|
+
};
|
|
279
|
+
options: {
|
|
280
|
+
initialStatus: import("../../shared/interfaces/database.entities.js").OpportunityStatus;
|
|
281
|
+
negotiationContinuation?: import("../../shared/interfaces/database.negotiation.js").NegotiationContinuationExecution;
|
|
282
|
+
limit?: number;
|
|
283
|
+
lenses?: import("../../discovery/lens.inferrer.js").Lens[];
|
|
284
|
+
hydeDescription?: string;
|
|
285
|
+
existingOpportunities?: string;
|
|
286
|
+
conversationId?: string;
|
|
287
|
+
negotiateTimeoutMs?: number;
|
|
288
|
+
};
|
|
289
|
+
agentTimings: DebugMetaAgent[];
|
|
290
|
+
} | {
|
|
291
|
+
opportunities: never[];
|
|
292
|
+
persistenceOutcome?: undefined;
|
|
293
|
+
existingBetweenActors?: undefined;
|
|
294
|
+
trace: {
|
|
295
|
+
node: string;
|
|
296
|
+
detail: string;
|
|
297
|
+
data: {
|
|
298
|
+
error: string;
|
|
299
|
+
};
|
|
300
|
+
}[];
|
|
301
|
+
error?: undefined;
|
|
302
|
+
evaluatedOpportunities: {
|
|
303
|
+
actors: EvaluatedOpportunityActor[];
|
|
304
|
+
score: number;
|
|
305
|
+
reasoning: string;
|
|
306
|
+
}[];
|
|
307
|
+
introductionContext: {
|
|
308
|
+
createdByName: string | undefined;
|
|
309
|
+
};
|
|
310
|
+
options: {
|
|
311
|
+
initialStatus: import("../../shared/interfaces/database.entities.js").OpportunityStatus;
|
|
312
|
+
negotiationContinuation?: import("../../shared/interfaces/database.negotiation.js").NegotiationContinuationExecution;
|
|
313
|
+
limit?: number;
|
|
314
|
+
lenses?: import("../../discovery/lens.inferrer.js").Lens[];
|
|
315
|
+
hydeDescription?: string;
|
|
316
|
+
existingOpportunities?: string;
|
|
317
|
+
conversationId?: string;
|
|
318
|
+
negotiateTimeoutMs?: number;
|
|
319
|
+
};
|
|
320
|
+
agentTimings: DebugMetaAgent[];
|
|
321
|
+
} | {
|
|
322
|
+
opportunities: import("../../shared/interfaces/database.entities.js").Opportunity[];
|
|
323
|
+
existingBetweenActors: {
|
|
324
|
+
candidateUserId: Id<"users">;
|
|
325
|
+
networkId: Id<"networks">;
|
|
326
|
+
existingOpportunityId?: Id<"opportunities">;
|
|
327
|
+
existingStatus?: import("../../shared/interfaces/database.entities.js").OpportunityStatus;
|
|
328
|
+
reason?: "same_trigger_recent_duplicate" | "pair_active_negotiation" | "final_atomic_conflict";
|
|
329
|
+
existingTriggerIntentId?: string;
|
|
330
|
+
}[];
|
|
331
|
+
persistenceOutcome: {
|
|
332
|
+
evaluatedCount: number;
|
|
333
|
+
createdCount: number;
|
|
334
|
+
reactivatedCount: number;
|
|
335
|
+
sameTriggerDuplicateSuppressions: number;
|
|
336
|
+
pairActiveNegotiationSuppressions: number;
|
|
337
|
+
crossTriggerAllowedCount: number;
|
|
338
|
+
finalAtomicConflictCount: number;
|
|
339
|
+
};
|
|
340
|
+
trace: {
|
|
341
|
+
node: string;
|
|
342
|
+
detail: string;
|
|
343
|
+
data: {
|
|
344
|
+
created: number;
|
|
345
|
+
reactivated: number;
|
|
346
|
+
existingSkipped: number;
|
|
347
|
+
totalOutput: number;
|
|
348
|
+
persistenceOutcome: {
|
|
349
|
+
evaluatedCount: number;
|
|
350
|
+
createdCount: number;
|
|
351
|
+
reactivatedCount: number;
|
|
352
|
+
sameTriggerDuplicateSuppressions: number;
|
|
353
|
+
pairActiveNegotiationSuppressions: number;
|
|
354
|
+
crossTriggerAllowedCount: number;
|
|
355
|
+
finalAtomicConflictCount: number;
|
|
356
|
+
};
|
|
357
|
+
durationMs: number;
|
|
358
|
+
};
|
|
359
|
+
}[];
|
|
360
|
+
error?: undefined;
|
|
361
|
+
evaluatedOpportunities: {
|
|
362
|
+
actors: EvaluatedOpportunityActor[];
|
|
363
|
+
score: number;
|
|
364
|
+
reasoning: string;
|
|
365
|
+
}[];
|
|
366
|
+
introductionContext: {
|
|
367
|
+
createdByName: string | undefined;
|
|
368
|
+
};
|
|
369
|
+
options: {
|
|
370
|
+
initialStatus: import("../../shared/interfaces/database.entities.js").OpportunityStatus;
|
|
371
|
+
negotiationContinuation?: import("../../shared/interfaces/database.negotiation.js").NegotiationContinuationExecution;
|
|
372
|
+
limit?: number;
|
|
373
|
+
lenses?: import("../../discovery/lens.inferrer.js").Lens[];
|
|
374
|
+
hydeDescription?: string;
|
|
375
|
+
existingOpportunities?: string;
|
|
376
|
+
conversationId?: string;
|
|
377
|
+
negotiateTimeoutMs?: number;
|
|
378
|
+
};
|
|
379
|
+
agentTimings: DebugMetaAgent[];
|
|
380
|
+
} | {
|
|
381
|
+
opportunities: never[];
|
|
382
|
+
existingBetweenActors: never[];
|
|
383
|
+
error: string;
|
|
384
|
+
trace: {
|
|
385
|
+
node: string;
|
|
386
|
+
detail: string;
|
|
387
|
+
data: {
|
|
388
|
+
error: string;
|
|
389
|
+
};
|
|
390
|
+
}[];
|
|
391
|
+
persistenceOutcome?: undefined;
|
|
392
|
+
evaluatedOpportunities: {
|
|
393
|
+
actors: EvaluatedOpportunityActor[];
|
|
394
|
+
score: number;
|
|
395
|
+
reasoning: string;
|
|
396
|
+
}[];
|
|
397
|
+
introductionContext: {
|
|
398
|
+
createdByName: string | undefined;
|
|
399
|
+
};
|
|
400
|
+
options: {
|
|
401
|
+
initialStatus: import("../../shared/interfaces/database.entities.js").OpportunityStatus;
|
|
402
|
+
negotiationContinuation?: import("../../shared/interfaces/database.negotiation.js").NegotiationContinuationExecution;
|
|
403
|
+
limit?: number;
|
|
404
|
+
lenses?: import("../../discovery/lens.inferrer.js").Lens[];
|
|
405
|
+
hydeDescription?: string;
|
|
406
|
+
existingOpportunities?: string;
|
|
407
|
+
conversationId?: string;
|
|
408
|
+
negotiateTimeoutMs?: number;
|
|
409
|
+
};
|
|
410
|
+
agentTimings: DebugMetaAgent[];
|
|
411
|
+
} | {
|
|
412
|
+
opportunities: never[];
|
|
413
|
+
persistenceOutcome: {
|
|
414
|
+
evaluatedCount: number;
|
|
415
|
+
createdCount: number;
|
|
416
|
+
reactivatedCount: number;
|
|
417
|
+
sameTriggerDuplicateSuppressions: number;
|
|
418
|
+
pairActiveNegotiationSuppressions: number;
|
|
419
|
+
crossTriggerAllowedCount: number;
|
|
420
|
+
finalAtomicConflictCount: number;
|
|
421
|
+
};
|
|
422
|
+
existingBetweenActors?: undefined;
|
|
423
|
+
trace?: undefined;
|
|
424
|
+
error?: undefined;
|
|
425
|
+
evaluatedOpportunities: EvaluatedOpportunity[];
|
|
426
|
+
introductionContext: {
|
|
427
|
+
createdByName: string | undefined;
|
|
428
|
+
};
|
|
429
|
+
options: {
|
|
430
|
+
initialStatus: import("../../shared/interfaces/database.entities.js").OpportunityStatus;
|
|
431
|
+
negotiationContinuation?: import("../../shared/interfaces/database.negotiation.js").NegotiationContinuationExecution;
|
|
432
|
+
limit?: number;
|
|
433
|
+
lenses?: import("../../discovery/lens.inferrer.js").Lens[];
|
|
434
|
+
hydeDescription?: string;
|
|
435
|
+
existingOpportunities?: string;
|
|
436
|
+
conversationId?: string;
|
|
437
|
+
negotiateTimeoutMs?: number;
|
|
438
|
+
};
|
|
439
|
+
agentTimings: DebugMetaAgent[];
|
|
440
|
+
} | {
|
|
441
|
+
opportunities: never[];
|
|
442
|
+
persistenceOutcome?: undefined;
|
|
443
|
+
existingBetweenActors?: undefined;
|
|
444
|
+
trace?: undefined;
|
|
445
|
+
error?: undefined;
|
|
446
|
+
evaluatedOpportunities: EvaluatedOpportunity[];
|
|
447
|
+
introductionContext: {
|
|
448
|
+
createdByName: string | undefined;
|
|
449
|
+
};
|
|
450
|
+
options: {
|
|
451
|
+
initialStatus: import("../../shared/interfaces/database.entities.js").OpportunityStatus;
|
|
452
|
+
negotiationContinuation?: import("../../shared/interfaces/database.negotiation.js").NegotiationContinuationExecution;
|
|
453
|
+
limit?: number;
|
|
454
|
+
lenses?: import("../../discovery/lens.inferrer.js").Lens[];
|
|
455
|
+
hydeDescription?: string;
|
|
456
|
+
existingOpportunities?: string;
|
|
457
|
+
conversationId?: string;
|
|
458
|
+
negotiateTimeoutMs?: number;
|
|
459
|
+
};
|
|
460
|
+
agentTimings: DebugMetaAgent[];
|
|
461
|
+
}>;
|
|
462
|
+
/**
|
|
463
|
+
* Introduction validation: network scope, membership for introducer and all
|
|
464
|
+
* party users, and no existing opportunity between the parties.
|
|
465
|
+
*/
|
|
466
|
+
export declare function validateIntroduction(deps: Pick<OpportunityGraphDeps, 'database'>, state: Pick<OpportunityState, 'userId' | 'networkId' | 'introductionEntities' | 'requiredNetworkId'>): Promise<{
|
|
467
|
+
error?: string;
|
|
468
|
+
trace?: Array<{
|
|
469
|
+
node: string;
|
|
470
|
+
detail?: string;
|
|
471
|
+
data?: Record<string, unknown>;
|
|
472
|
+
}>;
|
|
473
|
+
}>;
|
|
474
|
+
/**
|
|
475
|
+
* Introduction evaluation: runs the entity-bundle evaluator and sets
|
|
476
|
+
* evaluatedOpportunities (one) + introductionContext.
|
|
477
|
+
*/
|
|
478
|
+
export declare function evaluateIntroduction(deps: Pick<OpportunityGraphDeps, 'database' | 'evaluatorAgent'>, state: Pick<OpportunityState, 'userId' | 'networkId' | 'introductionEntities' | 'introductionHint' | 'options' | 'error'>): Promise<{
|
|
479
|
+
evaluatedOpportunities: never[];
|
|
480
|
+
agentTimings: never[];
|
|
481
|
+
error?: undefined;
|
|
482
|
+
introductionContext?: undefined;
|
|
483
|
+
options?: undefined;
|
|
484
|
+
trace?: undefined;
|
|
485
|
+
} | {
|
|
486
|
+
evaluatedOpportunities: never[];
|
|
487
|
+
error: string;
|
|
488
|
+
agentTimings: never[];
|
|
489
|
+
introductionContext?: undefined;
|
|
490
|
+
options?: undefined;
|
|
491
|
+
trace?: undefined;
|
|
492
|
+
} | {
|
|
493
|
+
evaluatedOpportunities: {
|
|
494
|
+
actors: EvaluatedOpportunityActor[];
|
|
495
|
+
score: number;
|
|
496
|
+
reasoning: string;
|
|
497
|
+
}[];
|
|
498
|
+
introductionContext: {
|
|
499
|
+
createdByName: string | undefined;
|
|
500
|
+
};
|
|
501
|
+
options: {
|
|
502
|
+
initialStatus: import("../../shared/interfaces/database.entities.js").OpportunityStatus;
|
|
503
|
+
negotiationContinuation?: import("../../shared/interfaces/database.negotiation.js").NegotiationContinuationExecution;
|
|
504
|
+
limit?: number;
|
|
505
|
+
lenses?: import("../../discovery/lens.inferrer.js").Lens[];
|
|
506
|
+
hydeDescription?: string;
|
|
507
|
+
existingOpportunities?: string;
|
|
508
|
+
conversationId?: string;
|
|
509
|
+
negotiateTimeoutMs?: number;
|
|
510
|
+
};
|
|
511
|
+
agentTimings: DebugMetaAgent[];
|
|
512
|
+
trace: {
|
|
513
|
+
node: string;
|
|
514
|
+
detail: string;
|
|
515
|
+
data: {
|
|
516
|
+
error: string;
|
|
517
|
+
};
|
|
518
|
+
}[];
|
|
519
|
+
error?: undefined;
|
|
520
|
+
} | {
|
|
521
|
+
evaluatedOpportunities: EvaluatedOpportunity[];
|
|
522
|
+
introductionContext: {
|
|
523
|
+
createdByName: string | undefined;
|
|
524
|
+
};
|
|
525
|
+
options: {
|
|
526
|
+
initialStatus: import("../../shared/interfaces/database.entities.js").OpportunityStatus;
|
|
527
|
+
negotiationContinuation?: import("../../shared/interfaces/database.negotiation.js").NegotiationContinuationExecution;
|
|
528
|
+
limit?: number;
|
|
529
|
+
lenses?: import("../../discovery/lens.inferrer.js").Lens[];
|
|
530
|
+
hydeDescription?: string;
|
|
531
|
+
existingOpportunities?: string;
|
|
532
|
+
conversationId?: string;
|
|
533
|
+
negotiateTimeoutMs?: number;
|
|
534
|
+
};
|
|
535
|
+
agentTimings: DebugMetaAgent[];
|
|
536
|
+
error?: undefined;
|
|
537
|
+
trace?: undefined;
|
|
538
|
+
}>;
|