@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
|
@@ -268,40 +268,40 @@ export declare const NegotiationQuestionCandidateSchema: z.ZodEffects<z.ZodObjec
|
|
|
268
268
|
counterpartyFelicityAuthority: z.ZodOptional<z.ZodNumber>;
|
|
269
269
|
}, "strip", z.ZodTypeAny, {
|
|
270
270
|
networkId: string;
|
|
271
|
-
opportunityId: string;
|
|
272
271
|
purpose: "uptake" | "stalled_followup" | "inflight_consultation";
|
|
273
272
|
recipientUserId: string;
|
|
274
273
|
recipientIntentId: string;
|
|
274
|
+
opportunityId: string;
|
|
275
275
|
taskId?: string | undefined;
|
|
276
276
|
counterpartyUserId?: string | undefined;
|
|
277
277
|
counterpartyIntentId?: string | undefined;
|
|
278
278
|
counterpartyFelicityAuthority?: number | undefined;
|
|
279
279
|
}, {
|
|
280
280
|
networkId: string;
|
|
281
|
-
opportunityId: string;
|
|
282
281
|
purpose: "uptake" | "stalled_followup" | "inflight_consultation";
|
|
283
282
|
recipientUserId: string;
|
|
284
283
|
recipientIntentId: string;
|
|
284
|
+
opportunityId: string;
|
|
285
285
|
taskId?: string | undefined;
|
|
286
286
|
counterpartyUserId?: string | undefined;
|
|
287
287
|
counterpartyIntentId?: string | undefined;
|
|
288
288
|
counterpartyFelicityAuthority?: number | undefined;
|
|
289
289
|
}>, {
|
|
290
290
|
networkId: string;
|
|
291
|
-
opportunityId: string;
|
|
292
291
|
purpose: "uptake" | "stalled_followup" | "inflight_consultation";
|
|
293
292
|
recipientUserId: string;
|
|
294
293
|
recipientIntentId: string;
|
|
294
|
+
opportunityId: string;
|
|
295
295
|
taskId?: string | undefined;
|
|
296
296
|
counterpartyUserId?: string | undefined;
|
|
297
297
|
counterpartyIntentId?: string | undefined;
|
|
298
298
|
counterpartyFelicityAuthority?: number | undefined;
|
|
299
299
|
}, {
|
|
300
300
|
networkId: string;
|
|
301
|
-
opportunityId: string;
|
|
302
301
|
purpose: "uptake" | "stalled_followup" | "inflight_consultation";
|
|
303
302
|
recipientUserId: string;
|
|
304
303
|
recipientIntentId: string;
|
|
304
|
+
opportunityId: string;
|
|
305
305
|
taskId?: string | undefined;
|
|
306
306
|
counterpartyUserId?: string | undefined;
|
|
307
307
|
counterpartyIntentId?: string | undefined;
|
|
@@ -332,14 +332,14 @@ export declare const NegotiationQuestionProvenanceSchema: z.ZodEffects<z.ZodObje
|
|
|
332
332
|
questionOrdinal: z.ZodNumber;
|
|
333
333
|
}, "strip", z.ZodTypeAny, {
|
|
334
334
|
networkId: string;
|
|
335
|
-
opportunityId: string;
|
|
336
|
-
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
337
|
-
opportunityUpdatedAt: string;
|
|
338
335
|
purpose: "uptake" | "stalled_followup" | "inflight_consultation";
|
|
339
336
|
recipientUserId: string;
|
|
340
337
|
recipientIntentId: string;
|
|
338
|
+
opportunityId: string;
|
|
341
339
|
version: 1;
|
|
342
340
|
intentFingerprint: string;
|
|
341
|
+
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
342
|
+
opportunityUpdatedAt: string;
|
|
343
343
|
questionOrdinal: number;
|
|
344
344
|
taskId?: string | undefined;
|
|
345
345
|
counterpartyUserId?: string | undefined;
|
|
@@ -349,14 +349,14 @@ export declare const NegotiationQuestionProvenanceSchema: z.ZodEffects<z.ZodObje
|
|
|
349
349
|
taskUpdatedAt?: string | undefined;
|
|
350
350
|
}, {
|
|
351
351
|
networkId: string;
|
|
352
|
-
opportunityId: string;
|
|
353
|
-
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
354
|
-
opportunityUpdatedAt: string;
|
|
355
352
|
purpose: "uptake" | "stalled_followup" | "inflight_consultation";
|
|
356
353
|
recipientUserId: string;
|
|
357
354
|
recipientIntentId: string;
|
|
355
|
+
opportunityId: string;
|
|
358
356
|
version: 1;
|
|
359
357
|
intentFingerprint: string;
|
|
358
|
+
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
359
|
+
opportunityUpdatedAt: string;
|
|
360
360
|
questionOrdinal: number;
|
|
361
361
|
taskId?: string | undefined;
|
|
362
362
|
counterpartyUserId?: string | undefined;
|
|
@@ -366,14 +366,14 @@ export declare const NegotiationQuestionProvenanceSchema: z.ZodEffects<z.ZodObje
|
|
|
366
366
|
taskUpdatedAt?: string | undefined;
|
|
367
367
|
}>, {
|
|
368
368
|
networkId: string;
|
|
369
|
-
opportunityId: string;
|
|
370
|
-
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
371
|
-
opportunityUpdatedAt: string;
|
|
372
369
|
purpose: "uptake" | "stalled_followup" | "inflight_consultation";
|
|
373
370
|
recipientUserId: string;
|
|
374
371
|
recipientIntentId: string;
|
|
372
|
+
opportunityId: string;
|
|
375
373
|
version: 1;
|
|
376
374
|
intentFingerprint: string;
|
|
375
|
+
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
376
|
+
opportunityUpdatedAt: string;
|
|
377
377
|
questionOrdinal: number;
|
|
378
378
|
taskId?: string | undefined;
|
|
379
379
|
counterpartyUserId?: string | undefined;
|
|
@@ -383,14 +383,14 @@ export declare const NegotiationQuestionProvenanceSchema: z.ZodEffects<z.ZodObje
|
|
|
383
383
|
taskUpdatedAt?: string | undefined;
|
|
384
384
|
}, {
|
|
385
385
|
networkId: string;
|
|
386
|
-
opportunityId: string;
|
|
387
|
-
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
388
|
-
opportunityUpdatedAt: string;
|
|
389
386
|
purpose: "uptake" | "stalled_followup" | "inflight_consultation";
|
|
390
387
|
recipientUserId: string;
|
|
391
388
|
recipientIntentId: string;
|
|
389
|
+
opportunityId: string;
|
|
392
390
|
version: 1;
|
|
393
391
|
intentFingerprint: string;
|
|
392
|
+
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
393
|
+
opportunityUpdatedAt: string;
|
|
394
394
|
questionOrdinal: number;
|
|
395
395
|
taskId?: string | undefined;
|
|
396
396
|
counterpartyUserId?: string | undefined;
|
|
@@ -760,14 +760,14 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
760
760
|
questionOrdinal: z.ZodNumber;
|
|
761
761
|
}, "strip", z.ZodTypeAny, {
|
|
762
762
|
networkId: string;
|
|
763
|
-
opportunityId: string;
|
|
764
|
-
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
765
|
-
opportunityUpdatedAt: string;
|
|
766
763
|
purpose: "uptake" | "stalled_followup" | "inflight_consultation";
|
|
767
764
|
recipientUserId: string;
|
|
768
765
|
recipientIntentId: string;
|
|
766
|
+
opportunityId: string;
|
|
769
767
|
version: 1;
|
|
770
768
|
intentFingerprint: string;
|
|
769
|
+
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
770
|
+
opportunityUpdatedAt: string;
|
|
771
771
|
questionOrdinal: number;
|
|
772
772
|
taskId?: string | undefined;
|
|
773
773
|
counterpartyUserId?: string | undefined;
|
|
@@ -777,14 +777,14 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
777
777
|
taskUpdatedAt?: string | undefined;
|
|
778
778
|
}, {
|
|
779
779
|
networkId: string;
|
|
780
|
-
opportunityId: string;
|
|
781
|
-
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
782
|
-
opportunityUpdatedAt: string;
|
|
783
780
|
purpose: "uptake" | "stalled_followup" | "inflight_consultation";
|
|
784
781
|
recipientUserId: string;
|
|
785
782
|
recipientIntentId: string;
|
|
783
|
+
opportunityId: string;
|
|
786
784
|
version: 1;
|
|
787
785
|
intentFingerprint: string;
|
|
786
|
+
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
787
|
+
opportunityUpdatedAt: string;
|
|
788
788
|
questionOrdinal: number;
|
|
789
789
|
taskId?: string | undefined;
|
|
790
790
|
counterpartyUserId?: string | undefined;
|
|
@@ -794,14 +794,14 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
794
794
|
taskUpdatedAt?: string | undefined;
|
|
795
795
|
}>, {
|
|
796
796
|
networkId: string;
|
|
797
|
-
opportunityId: string;
|
|
798
|
-
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
799
|
-
opportunityUpdatedAt: string;
|
|
800
797
|
purpose: "uptake" | "stalled_followup" | "inflight_consultation";
|
|
801
798
|
recipientUserId: string;
|
|
802
799
|
recipientIntentId: string;
|
|
800
|
+
opportunityId: string;
|
|
803
801
|
version: 1;
|
|
804
802
|
intentFingerprint: string;
|
|
803
|
+
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
804
|
+
opportunityUpdatedAt: string;
|
|
805
805
|
questionOrdinal: number;
|
|
806
806
|
taskId?: string | undefined;
|
|
807
807
|
counterpartyUserId?: string | undefined;
|
|
@@ -811,14 +811,14 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
811
811
|
taskUpdatedAt?: string | undefined;
|
|
812
812
|
}, {
|
|
813
813
|
networkId: string;
|
|
814
|
-
opportunityId: string;
|
|
815
|
-
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
816
|
-
opportunityUpdatedAt: string;
|
|
817
814
|
purpose: "uptake" | "stalled_followup" | "inflight_consultation";
|
|
818
815
|
recipientUserId: string;
|
|
819
816
|
recipientIntentId: string;
|
|
817
|
+
opportunityId: string;
|
|
820
818
|
version: 1;
|
|
821
819
|
intentFingerprint: string;
|
|
820
|
+
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
821
|
+
opportunityUpdatedAt: string;
|
|
822
822
|
questionOrdinal: number;
|
|
823
823
|
taskId?: string | undefined;
|
|
824
824
|
counterpartyUserId?: string | undefined;
|
|
@@ -1152,14 +1152,14 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1152
1152
|
purpose?: "uptake" | "stalled_followup" | "inflight_consultation" | "recovery" | undefined;
|
|
1153
1153
|
negotiation?: {
|
|
1154
1154
|
networkId: string;
|
|
1155
|
-
opportunityId: string;
|
|
1156
|
-
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
1157
|
-
opportunityUpdatedAt: string;
|
|
1158
1155
|
purpose: "uptake" | "stalled_followup" | "inflight_consultation";
|
|
1159
1156
|
recipientUserId: string;
|
|
1160
1157
|
recipientIntentId: string;
|
|
1158
|
+
opportunityId: string;
|
|
1161
1159
|
version: 1;
|
|
1162
1160
|
intentFingerprint: string;
|
|
1161
|
+
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
1162
|
+
opportunityUpdatedAt: string;
|
|
1163
1163
|
questionOrdinal: number;
|
|
1164
1164
|
taskId?: string | undefined;
|
|
1165
1165
|
counterpartyUserId?: string | undefined;
|
|
@@ -1246,14 +1246,14 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1246
1246
|
purpose?: "uptake" | "stalled_followup" | "inflight_consultation" | "recovery" | undefined;
|
|
1247
1247
|
negotiation?: {
|
|
1248
1248
|
networkId: string;
|
|
1249
|
-
opportunityId: string;
|
|
1250
|
-
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
1251
|
-
opportunityUpdatedAt: string;
|
|
1252
1249
|
purpose: "uptake" | "stalled_followup" | "inflight_consultation";
|
|
1253
1250
|
recipientUserId: string;
|
|
1254
1251
|
recipientIntentId: string;
|
|
1252
|
+
opportunityId: string;
|
|
1255
1253
|
version: 1;
|
|
1256
1254
|
intentFingerprint: string;
|
|
1255
|
+
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
1256
|
+
opportunityUpdatedAt: string;
|
|
1257
1257
|
questionOrdinal: number;
|
|
1258
1258
|
taskId?: string | undefined;
|
|
1259
1259
|
counterpartyUserId?: string | undefined;
|
|
@@ -1340,14 +1340,14 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1340
1340
|
purpose?: "uptake" | "stalled_followup" | "inflight_consultation" | "recovery" | undefined;
|
|
1341
1341
|
negotiation?: {
|
|
1342
1342
|
networkId: string;
|
|
1343
|
-
opportunityId: string;
|
|
1344
|
-
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
1345
|
-
opportunityUpdatedAt: string;
|
|
1346
1343
|
purpose: "uptake" | "stalled_followup" | "inflight_consultation";
|
|
1347
1344
|
recipientUserId: string;
|
|
1348
1345
|
recipientIntentId: string;
|
|
1346
|
+
opportunityId: string;
|
|
1349
1347
|
version: 1;
|
|
1350
1348
|
intentFingerprint: string;
|
|
1349
|
+
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
1350
|
+
opportunityUpdatedAt: string;
|
|
1351
1351
|
questionOrdinal: number;
|
|
1352
1352
|
taskId?: string | undefined;
|
|
1353
1353
|
counterpartyUserId?: string | undefined;
|
|
@@ -1434,14 +1434,14 @@ export declare const QuestionDetectionSchema: z.ZodEffects<z.ZodObject<{
|
|
|
1434
1434
|
purpose?: "uptake" | "stalled_followup" | "inflight_consultation" | "recovery" | undefined;
|
|
1435
1435
|
negotiation?: {
|
|
1436
1436
|
networkId: string;
|
|
1437
|
-
opportunityId: string;
|
|
1438
|
-
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
1439
|
-
opportunityUpdatedAt: string;
|
|
1440
1437
|
purpose: "uptake" | "stalled_followup" | "inflight_consultation";
|
|
1441
1438
|
recipientUserId: string;
|
|
1442
1439
|
recipientIntentId: string;
|
|
1440
|
+
opportunityId: string;
|
|
1443
1441
|
version: 1;
|
|
1444
1442
|
intentFingerprint: string;
|
|
1443
|
+
opportunityStatus: "latent" | "draft" | "negotiating" | "pending" | "stalled" | "accepted" | "rejected" | "expired";
|
|
1444
|
+
opportunityUpdatedAt: string;
|
|
1445
1445
|
questionOrdinal: number;
|
|
1446
1446
|
taskId?: string | undefined;
|
|
1447
1447
|
counterpartyUserId?: string | undefined;
|
|
@@ -18,7 +18,6 @@ import { createIntentTools } from "../../intents/application/intent.tools.js";
|
|
|
18
18
|
import { createNetworkTools } from "../../networks/index.js";
|
|
19
19
|
import { createOpportunityTools } from "../../opportunities/index.js";
|
|
20
20
|
import { createUtilityTools } from "./utility.tools.js";
|
|
21
|
-
import { createIntegrationTools } from "../../integrations/index.js";
|
|
22
21
|
import { createContactTools } from "../../contacts/index.js";
|
|
23
22
|
// The composition root reaches the leaf directly (it is exempt from the barrel
|
|
24
23
|
// rule by design): importing agents/index.js here would pull in the
|
|
@@ -54,7 +53,6 @@ export async function createChatTools(deps, preResolvedContext) {
|
|
|
54
53
|
userId: deps.userId,
|
|
55
54
|
networkId: explicitScope.scopeType === 'network' ? explicitScope.scopeId : deps.networkId,
|
|
56
55
|
sessionId: deps.sessionId,
|
|
57
|
-
contactsEnabled: deps.contactsEnabled,
|
|
58
56
|
actionToolsEnabled: deps.actionToolsEnabled,
|
|
59
57
|
}));
|
|
60
58
|
if (!preResolvedContext && explicitScope.scopeType && explicitScope.scopeId) {
|
|
@@ -146,7 +144,6 @@ export async function createChatTools(deps, preResolvedContext) {
|
|
|
146
144
|
const systemDb = deps.systemDb ?? deps.createSystemDatabase(database, resolvedContext.userId, allowedNetworkIds, embedder);
|
|
147
145
|
// ─── Assemble dependencies ─────────────────────────────────────────────────
|
|
148
146
|
const cache = deps.cache;
|
|
149
|
-
const integration = deps.integration;
|
|
150
147
|
const toolDeps = {
|
|
151
148
|
database,
|
|
152
149
|
userDb,
|
|
@@ -154,10 +151,7 @@ export async function createChatTools(deps, preResolvedContext) {
|
|
|
154
151
|
scraper,
|
|
155
152
|
embedder,
|
|
156
153
|
cache,
|
|
157
|
-
integration,
|
|
158
154
|
contactService: deps.contactService,
|
|
159
|
-
contactsEnabled: deps.contactsEnabled,
|
|
160
|
-
integrationImporter: deps.integrationImporter,
|
|
161
155
|
enricher: deps.enricher,
|
|
162
156
|
negotiationDatabase: deps.negotiationDatabase,
|
|
163
157
|
negotiationTimeoutQueue: deps.negotiationTimeoutQueue,
|
|
@@ -204,7 +198,6 @@ export async function createChatTools(deps, preResolvedContext) {
|
|
|
204
198
|
const utilityTools = createUtilityTools(defineTool, toolDeps);
|
|
205
199
|
const contactTools = createContactTools(defineTool, toolDeps);
|
|
206
200
|
const agentTools = createAgentTools(defineTool, toolDeps);
|
|
207
|
-
const integrationTools = createIntegrationTools(defineTool, toolDeps);
|
|
208
201
|
const negotiationTools = deps.agentDispatcher
|
|
209
202
|
? createNegotiationTools(defineTool, toolDeps)
|
|
210
203
|
: [];
|
|
@@ -227,7 +220,6 @@ export async function createChatTools(deps, preResolvedContext) {
|
|
|
227
220
|
...networkTools,
|
|
228
221
|
...opportunityToolsForChat,
|
|
229
222
|
...utilityTools,
|
|
230
|
-
...integrationTools,
|
|
231
223
|
...contactTools,
|
|
232
224
|
...agentTools,
|
|
233
225
|
...negotiationTools,
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { Id } from '../interfaces/database.interface.js';
|
|
2
|
+
import type { OpportunityGraphDeps } from '../../opportunities/application/opportunity.graph.shared.js';
|
|
3
|
+
import type { OpportunityMutationOutcome } from '../../opportunities/application/opportunity.graph.modes.js';
|
|
1
4
|
import { z } from "zod";
|
|
2
5
|
import type { ModelConfig } from "./model.config.js";
|
|
3
6
|
import type { ToolScopeType } from "./tool.scope.js";
|
|
@@ -5,7 +8,6 @@ import type { UserIdentity } from "../schemas/identity.schema.js";
|
|
|
5
8
|
import type { ChatGraphCompositeDatabase, CreateOpportunityData, NetworkMembership, UserRecord, UserDatabase, SystemDatabase, NegotiationGraphDatabase } from "../interfaces/database.interface.js";
|
|
6
9
|
import type { Scraper } from "../interfaces/scraper.interface.js";
|
|
7
10
|
import type { Cache, HydeCache } from "../interfaces/cache.interface.js";
|
|
8
|
-
import type { IntegrationAdapter } from "../../integrations/ports/index.js";
|
|
9
11
|
import type { ContactServiceAdapter } from "../../contacts/ports/index.js";
|
|
10
12
|
import type { ProfileEnricher } from "../interfaces/enrichment.interface.js";
|
|
11
13
|
import type { IntentGraphQueue } from "../interfaces/queue.interface.js";
|
|
@@ -96,14 +98,6 @@ export interface ResolvedToolContext {
|
|
|
96
98
|
* which are owner-trusted and receive the full owner view.
|
|
97
99
|
*/
|
|
98
100
|
mcpCaller?: McpActivityCaller;
|
|
99
|
-
/**
|
|
100
|
-
* True when the CONTACTS_ENABLED feature flag is on. Carried from the
|
|
101
|
-
* composition root so prompt modules can gate contact-import guidance —
|
|
102
|
-
* when false/unset, the contacts prompt module is not injected, so the
|
|
103
|
-
* orchestrator never advertises Gmail import / add_contact (whose tools
|
|
104
|
-
* are also de-registered). Fail-closed: treat only `true` as enabled.
|
|
105
|
-
*/
|
|
106
|
-
contactsEnabled?: boolean;
|
|
107
101
|
/** True only when the gated reporter cleanup-action proposal tool is registered. */
|
|
108
102
|
actionToolsEnabled?: boolean;
|
|
109
103
|
}
|
|
@@ -139,19 +133,10 @@ interface ToolContextBindings {
|
|
|
139
133
|
cache: Cache;
|
|
140
134
|
/** Dedicated cache for HyDE graph (may be same instance as cache). */
|
|
141
135
|
hydeCache: HydeCache;
|
|
142
|
-
/** External integration platform adapter (OAuth, tool actions). */
|
|
143
|
-
integration: IntegrationAdapter;
|
|
144
136
|
/** Queue for enqueuing follow-up intent processing (HyDE generation/deletion). */
|
|
145
137
|
intentQueue: IntentGraphQueue;
|
|
146
138
|
/** Contact management operations. */
|
|
147
139
|
contactService: ContactServiceAdapter;
|
|
148
|
-
/**
|
|
149
|
-
* When false (or unset), the contact import / manual-add tools
|
|
150
|
-
* (import_contacts, add_contact, import_gmail_contacts) are not registered.
|
|
151
|
-
* Injected by the composition root from CONTACTS_ENABLED. Read/remove/search
|
|
152
|
-
* contact tools are always registered.
|
|
153
|
-
*/
|
|
154
|
-
contactsEnabled?: boolean;
|
|
155
140
|
/** True only when the gated reporter cleanup-action proposal tool is registered. */
|
|
156
141
|
actionToolsEnabled?: boolean;
|
|
157
142
|
/** Chat session reader for loading conversation history. */
|
|
@@ -221,15 +206,6 @@ interface ToolContextBindings {
|
|
|
221
206
|
enricher: ProfileEnricher;
|
|
222
207
|
/** Database adapter for negotiations/conversation operations. */
|
|
223
208
|
negotiationDatabase: NegotiationGraphDatabase;
|
|
224
|
-
/** Integration importer for bulk contact import from toolkits. */
|
|
225
|
-
integrationImporter: {
|
|
226
|
-
importContacts(userId: string, toolkit: string): Promise<{
|
|
227
|
-
imported: number;
|
|
228
|
-
skipped: number;
|
|
229
|
-
newContacts: number;
|
|
230
|
-
existingContacts: number;
|
|
231
|
-
}>;
|
|
232
|
-
};
|
|
233
209
|
/** Factory for user-scoped database access. */
|
|
234
210
|
createUserDatabase: (db: ChatGraphCompositeDatabase, userId: string) => UserDatabase;
|
|
235
211
|
/** Factory for system-scoped database access. */
|
|
@@ -316,8 +292,6 @@ export declare function resolveChatContext(params: {
|
|
|
316
292
|
networkId?: string;
|
|
317
293
|
/** Chat session ID for draft opportunities (stored as context.conversationId). */
|
|
318
294
|
sessionId?: string;
|
|
319
|
-
/** CONTACTS_ENABLED flag, forwarded onto the resolved context for prompt gating. */
|
|
320
|
-
contactsEnabled?: boolean;
|
|
321
295
|
/** Reporter action gate forwarded into the persona prompt/context. */
|
|
322
296
|
actionToolsEnabled?: boolean;
|
|
323
297
|
}): Promise<ResolvedToolContext>;
|
|
@@ -374,23 +348,7 @@ interface ToolDepsBindings {
|
|
|
374
348
|
scraper: Scraper;
|
|
375
349
|
embedder: import('../interfaces/embedder.interface.js').Embedder;
|
|
376
350
|
cache: Cache;
|
|
377
|
-
integration: IntegrationAdapter;
|
|
378
351
|
contactService: ContactServiceAdapter;
|
|
379
|
-
/**
|
|
380
|
-
* When false (or unset), the contact import / manual-add tools
|
|
381
|
-
* (import_contacts, add_contact, import_gmail_contacts) are not registered.
|
|
382
|
-
* Injected by the composition root from CONTACTS_ENABLED. Read/remove/search
|
|
383
|
-
* contact tools are always registered.
|
|
384
|
-
*/
|
|
385
|
-
contactsEnabled?: boolean;
|
|
386
|
-
integrationImporter: {
|
|
387
|
-
importContacts(userId: string, toolkit: string): Promise<{
|
|
388
|
-
imported: number;
|
|
389
|
-
skipped: number;
|
|
390
|
-
newContacts: number;
|
|
391
|
-
existingContacts: number;
|
|
392
|
-
}>;
|
|
393
|
-
};
|
|
394
352
|
enricher: ProfileEnricher;
|
|
395
353
|
/** Database adapter for negotiations/conversation operations. */
|
|
396
354
|
negotiationDatabase: NegotiationGraphDatabase;
|
|
@@ -493,6 +451,12 @@ interface ToolDepsBindings {
|
|
|
493
451
|
limit?: number;
|
|
494
452
|
scope?: 'tool' | 'principal';
|
|
495
453
|
}>;
|
|
454
|
+
/**
|
|
455
|
+
* The non-discovery opportunity operations (`update_opportunity` and its
|
|
456
|
+
* send variant). Defaults to the plain functions in
|
|
457
|
+
* `opportunity.graph.modes.ts`; injected by tests to observe the call.
|
|
458
|
+
*/
|
|
459
|
+
opportunityOperations?: OpportunityOperations;
|
|
496
460
|
graphs: {
|
|
497
461
|
profile: CompiledGraph;
|
|
498
462
|
intent: CompiledGraph;
|
|
@@ -584,4 +548,16 @@ export declare function extractUrls(text: string): string[];
|
|
|
584
548
|
* @returns A new value with sensitive fields replaced by `"[redacted]"`.
|
|
585
549
|
*/
|
|
586
550
|
export declare function redactSensitiveFields(value: unknown): unknown;
|
|
551
|
+
/** The subset of opportunity modes the tool layer invokes. */
|
|
552
|
+
export interface OpportunityOperations {
|
|
553
|
+
updateOpportunityStatus: (deps: Pick<OpportunityGraphDeps, 'database'>, request: {
|
|
554
|
+
userId: Id<'users'>;
|
|
555
|
+
opportunityId: string | undefined;
|
|
556
|
+
newStatus: string | undefined;
|
|
557
|
+
}) => Promise<OpportunityMutationOutcome>;
|
|
558
|
+
sendOpportunity: (deps: Pick<OpportunityGraphDeps, 'database' | 'queueNotification'>, request: {
|
|
559
|
+
userId: Id<'users'>;
|
|
560
|
+
opportunityId: string | undefined;
|
|
561
|
+
}) => Promise<OpportunityMutationOutcome>;
|
|
562
|
+
}
|
|
587
563
|
export {};
|
|
@@ -16,7 +16,7 @@ export class ChatContextAccessError extends Error {
|
|
|
16
16
|
* This preloads user identity, profile, network memberships, and scoped index role.
|
|
17
17
|
*/
|
|
18
18
|
export async function resolveChatContext(params) {
|
|
19
|
-
const { database, userId, networkId, sessionId,
|
|
19
|
+
const { database, userId, networkId, sessionId, actionToolsEnabled } = params;
|
|
20
20
|
const [user, rawProfile, userNetworks, globalContext] = await Promise.all([
|
|
21
21
|
database.getUser(userId),
|
|
22
22
|
database.getProfile(userId),
|
|
@@ -93,7 +93,6 @@ export async function resolveChatContext(params) {
|
|
|
93
93
|
scopedMembershipRole,
|
|
94
94
|
isOnboarding: !(user.onboarding?.completedAt),
|
|
95
95
|
hasName,
|
|
96
|
-
contactsEnabled,
|
|
97
96
|
actionToolsEnabled,
|
|
98
97
|
...(sessionId !== undefined ? { sessionId } : {}),
|
|
99
98
|
};
|
|
@@ -4,9 +4,10 @@ import type { OpportunityOwnerApprovalDeps } from '../../opportunities/ports/opp
|
|
|
4
4
|
export interface CreateToolRegistryOptions {
|
|
5
5
|
/**
|
|
6
6
|
* Tool-surface profile. The default `'rest'` profile (direct HTTP Tool API)
|
|
7
|
-
* exposes contact/Gmail tools and `
|
|
8
|
-
* profile omits those surfaces (IND-596/597). Retired
|
|
9
|
-
* compatibility aliases are absent from both profiles
|
|
7
|
+
* exposes contact/Gmail tools, `scrape_url`, and `complete_onboarding`. The
|
|
8
|
+
* restricted `'mcp'` profile omits those surfaces (IND-596/597). Retired
|
|
9
|
+
* profile/profile-run compatibility aliases are absent from both profiles
|
|
10
|
+
* (IND-373/598).
|
|
10
11
|
*/
|
|
11
12
|
surface?: ToolSurface;
|
|
12
13
|
}
|
|
@@ -4,7 +4,6 @@ import { createIntentTools } from '../../intents/application/intent.tools.js';
|
|
|
4
4
|
import { createNetworkTools } from '../../networks/index.js';
|
|
5
5
|
import { createOpportunityTools } from '../../opportunities/index.js';
|
|
6
6
|
import { createUtilityTools } from './utility.tools.js';
|
|
7
|
-
import { createIntegrationTools } from '../../integrations/index.js';
|
|
8
7
|
import { createContactTools } from '../../contacts/index.js';
|
|
9
8
|
import { createAgentTools } from '../../agents/index.js';
|
|
10
9
|
import { createNegotiationTools } from '../../negotiations/index.js';
|
|
@@ -53,7 +52,7 @@ export function createToolRegistry(deps, options = {}) {
|
|
|
53
52
|
// Create all tool domains -- each one calls defineTool() which populates the registry.
|
|
54
53
|
// The local defineTool is compatible with DefineTool (which returns any).
|
|
55
54
|
const dt = defineTool;
|
|
56
|
-
createEnrichmentTools(dt, deps);
|
|
55
|
+
createEnrichmentTools(dt, deps, { surface: isMcpSurface ? 'mcp' : 'rest' });
|
|
57
56
|
createIntentTools(dt, deps);
|
|
58
57
|
createNetworkTools(dt, deps);
|
|
59
58
|
createOpportunityTools(dt, deps);
|
|
@@ -62,10 +61,9 @@ export function createToolRegistry(deps, options = {}) {
|
|
|
62
61
|
// (IND-597). The retired report_agent_activity name retains no alias on
|
|
63
62
|
// either surface (IND-605).
|
|
64
63
|
createUtilityTools(dt, deps, { surface: isMcpSurface ? 'mcp' : 'rest' });
|
|
65
|
-
// Contact
|
|
64
|
+
// Contact tools are omitted from the MCP surface (IND-596). Their
|
|
66
65
|
// implementations remain available to the REST Tool API and chat agent.
|
|
67
66
|
if (!isMcpSurface) {
|
|
68
|
-
createIntegrationTools(dt, deps);
|
|
69
67
|
createContactTools(dt, deps);
|
|
70
68
|
}
|
|
71
69
|
createAgentTools(dt, deps);
|
|
@@ -93,23 +93,19 @@ export function createUtilityTools(defineTool, deps, options = {}) {
|
|
|
93
93
|
|
|
94
94
|
Contacts are people in a user's personal network, stored as members of their personal network with 'contact' permission.
|
|
95
95
|
|
|
96
|
-
- **
|
|
97
|
-
- **Ghost users**: When a contact email doesn't match an existing account, a ghost user is created. Ghost users are enriched with public profile data and participate in opportunity matching — they can be discovered even before joining the platform.
|
|
96
|
+
- **How contacts arise**: Accepting an opportunity puts both people in each other's personal network. There is no import or manual-add path.
|
|
98
97
|
- **Personal network scope**: Approved signals from personal-network contacts are matched in the background. Use list_opportunities only to review persisted results.
|
|
99
|
-
- **Contact data**: Each contact has userId, name, email,
|
|
98
|
+
- **Contact data**: Each contact has userId, name, email, and avatar.
|
|
100
99
|
|
|
101
100
|
### Contact Workflow
|
|
102
|
-
1.
|
|
103
|
-
2.
|
|
104
|
-
3.
|
|
105
|
-
4.
|
|
106
|
-
5. add_contact(email) → add individual contact
|
|
107
|
-
6. remove_contact(contactUserId) → remove from network`;
|
|
101
|
+
1. list_contacts → view all contacts with userId
|
|
102
|
+
2. create_intent or update_intent → create or refine an approved signal for background matching
|
|
103
|
+
3. list_opportunities → review persisted results when background processing finds matches
|
|
104
|
+
4. remove_contact(contactUserId) → remove from network`;
|
|
108
105
|
const managingContactsWorkflow = `### Managing Contacts
|
|
109
|
-
1.
|
|
110
|
-
2.
|
|
111
|
-
3.
|
|
112
|
-
4. list_opportunities → review persisted results
|
|
106
|
+
1. list_contacts() → view network
|
|
107
|
+
2. create_intent or update_intent → create or refine an approved signal for background matching
|
|
108
|
+
3. list_opportunities → review persisted results
|
|
113
109
|
|
|
114
110
|
`;
|
|
115
111
|
const sections = {
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capability-narrowed views of {@link Database}.
|
|
3
|
+
*
|
|
4
|
+
* Graphs depend on these rather than the whole port so a graph's data reach is
|
|
5
|
+
* visible in one line.
|
|
6
|
+
*/
|
|
7
|
+
import type { NegotiationGraphDatabase, NegotiationQueries } from './database.negotiation.js';
|
|
8
|
+
import type { Database } from './database.port.js';
|
|
9
|
+
/**
|
|
10
|
+
* Database interface narrowed for Profile Graph operations.
|
|
11
|
+
* Provides full profile lifecycle: read, write, and query mode.
|
|
12
|
+
*
|
|
13
|
+
* Access layer: Primarily UserDatabase (user's own profile)
|
|
14
|
+
*/
|
|
15
|
+
export type EnrichmentGraphDatabase = Pick<Database, 'getProfile' | 'getUser' | 'updateUser' | 'saveProfile' | 'getProfileByUserId' | 'softDeleteGhost' | 'findDuplicateUser' | 'mergeGhostUser' | 'getUserSocials' | 'setUserSocials' | 'getPremisesForUser' | 'getUserContext'> & {
|
|
16
|
+
/**
|
|
17
|
+
* Optional premise retraction support. When present, write-mode input that
|
|
18
|
+
* disavows existing premises ("remove X", "I have nothing to do with Y")
|
|
19
|
+
* retracts them during decomposition. Adapters without it (e.g. the scraped
|
|
20
|
+
* enrichment adapter) skip retraction — scraped content never disavows.
|
|
21
|
+
*/
|
|
22
|
+
updatePremise?: Database['updatePremise'];
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Database interface narrowed for Premise Graph operations.
|
|
26
|
+
* Provides premise lifecycle: create, read, update, and network assignment.
|
|
27
|
+
*
|
|
28
|
+
* Access layer: UserDatabase (user's own premises)
|
|
29
|
+
*/
|
|
30
|
+
export type PremiseGraphDatabase = Pick<Database, 'createPremise' | 'getPremise' | 'getPremisesForUser' | 'updatePremise' | 'assignPremiseToNetwork' | 'getPremiseNetworks' | 'getAssignmentNetworkMembershipsForUser' | 'getAssignmentNetworkIdsForUser' | 'getNetworkAssignmentContext' | 'getUserIndexIds' | 'getNetwork' | 'getNetworkMemberContext' | 'findSimilarActivePremise'>;
|
|
31
|
+
/**
|
|
32
|
+
* Composite database interface for Chat Graph.
|
|
33
|
+
* Includes direct ChatGraph operations plus all methods needed by
|
|
34
|
+
* internally composed subgraphs (ProfileGraph, OpportunityGraph, IntentGraph, NetworkGraph).
|
|
35
|
+
*
|
|
36
|
+
* Use this type when ChatGraph orchestrates subgraphs internally.
|
|
37
|
+
*
|
|
38
|
+
* Access layer: Both UserDatabase + SystemDatabase (orchestrates all operations)
|
|
39
|
+
*/
|
|
40
|
+
export type ChatGraphCompositeDatabase = Pick<Database, 'getProfile' | 'getActiveIntents' | 'getActiveIntentsAcrossIndexes' | 'getIntentsInIndexForMember' | 'getUser' | 'updateUser' | 'getUserSocials' | 'setUserSocials' | 'saveProfile' | 'softDeleteGhost' | 'createIntent' | 'updateIntent' | 'archiveIntent' | 'createOpportunity' | 'createOpportunityIfNetworkEligible' | 'createOpportunityAndExpireIdsIfNetworkEligible' | 'persistIntentScopedOpportunityIfNetworkEligible' | 'updateOpportunityStatusIfNetworkEligible' | 'getOpportunity' | 'getOpportunitiesByIds' | 'opportunityExistsBetweenActors' | 'findOpportunitiesByActors' | 'getOpportunitiesForUser' | 'updateOpportunityStatus' | 'compensateTasklessNegotiatingOpportunity' | 'updateOpportunityActorApproval' | 'stampOpportunityActorAction' | 'getOrCreateDM' | 'getHydeDocument' | 'getHydeDocumentsForSource' | 'saveHydeDocument' | 'getIntent' | 'getPublicIndexesNotJoined' | 'getUserIndexIds' | 'getAssignmentNetworkMembershipsForUser' | 'getAssignmentNetworkIdsForUser' | 'getNetworkMemberships' | 'getNetworkMembership' | 'getActiveNetworkMembershipPairs' | 'getNetwork' | 'getNetworkWithPermissions' | 'getIntentForIndexing' | 'getNetworkMemberContext' | 'getNetworkAssignmentContext' | 'isIntentAssignedToIndex' | 'assignIntentToNetwork' | 'assignIntentToNetworkIfMember' | 'unassignIntentFromIndex' | 'getNetworkIdsForIntent' | 'getIntentIndexScores' | 'getPersonalIndexesForContact' | 'getOwnedIndexes' | 'isIndexOwner' | 'isNetworkMember' | 'getNetworkMembersForOwner' | 'getNetworkMembersForMember' | 'getMembersFromUserIndexes' | 'getNetworkIntentsForOwner' | 'getNetworkIntentsForMember' | 'updateIndexSettings' | 'softDeleteNetwork' | 'deleteProfile' | 'getProfileByUserId' | 'createNetwork' | 'getNetworkMemberCount' | 'addMemberToNetwork' | 'removeMemberFromIndex' | 'findDuplicateUser' | 'mergeGhostUser' | 'getPremisesForUser' | 'getPremisesForUserInNetworks' | 'createPremise' | 'getPremise' | 'updatePremise' | 'assignPremiseToNetwork' | 'getPremiseNetworks' | 'searchPremisesBySimilarity' | 'searchPremisesBySimilarityBatch' | 'getUserContext' | 'getUserContexts' | 'searchIntentsByContextEmbedding' | 'searchUserContextsBySimilarity'> & Pick<NegotiationQueries, 'getNegotiationTaskForOpportunity'>;
|
|
41
|
+
/**
|
|
42
|
+
* Database interface for Opportunity Graph operations.
|
|
43
|
+
* Includes prep/scope (network membership, intents, index details), persist (create, dedupe),
|
|
44
|
+
* and CRUD operations (read, update status, send).
|
|
45
|
+
*
|
|
46
|
+
* Access layer: SystemDatabase (cross-user opportunity operations)
|
|
47
|
+
*/
|
|
48
|
+
export type OpportunityGraphDatabase = Pick<Database, 'getProfile' | 'createOpportunity' | 'createOpportunityIfNetworkEligible' | 'createOpportunityAndExpireIdsIfNetworkEligible' | 'persistIntentScopedOpportunityIfNetworkEligible' | 'updateOpportunityStatusIfNetworkEligible' | 'opportunityExistsBetweenActors' | 'findOpportunitiesByActors' | 'getUserIndexIds' | 'getNetworkMemberships' | 'getActiveNetworkMembershipPairs' | 'getActiveIntents' | 'getNetworkIdsForIntent' | 'getNetwork' | 'getNetworkMemberCount' | 'getIntentIndexScores' | 'getNetworkMemberContext' | 'getNetworkAssignmentContext' | 'getOpportunity' | 'getOpportunitiesForUser' | 'updateOpportunityStatus' | 'compensateTasklessNegotiatingOpportunity' | 'stampOpportunityActorAction' | 'updateOpportunityActorApproval' | 'isNetworkMember' | 'isIndexOwner' | 'getUser' | 'getOrCreateDM' | 'getIntent' | 'getPremise' | 'getPremisesForUser' | 'getPremisesForUserInNetworks' | 'searchPremisesBySimilarity' | 'searchPremisesBySimilarityBatch' | 'getUserContext' | 'getUserContexts' | 'searchIntentsByContextEmbedding' | 'searchUserContextsBySimilarity' | 'getHydeDocumentsForSource' | 'getRecentlyRejectedOpportunityCounterparties'> & Pick<NegotiationQueries, 'getNegotiationTaskForOpportunity'>;
|
|
49
|
+
export interface OutcomeOutbox {
|
|
50
|
+
event: unknown;
|
|
51
|
+
actorResolution: 'selected_intent' | 'unique_owned_scope';
|
|
52
|
+
result: {
|
|
53
|
+
inserted: boolean;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export type OpportunityControllerDatabase = Pick<Database, 'getOpportunity' | 'getOpportunitiesByIds' | 'findEnrichedReplacementOpportunities' | 'getOpportunitiesForUser' | 'getOpportunitiesForNetwork' | 'resolveOpportunityId' | 'updateOpportunityStatus' | 'createOpportunity' | 'createOpportunityAndExpireIds' | 'opportunityExistsBetweenActors' | 'findOpportunitiesByActors' | 'acceptSiblingOpportunities' | 'isIndexOwner' | 'isNetworkMember' | 'getUser' | 'getNetwork' | 'getNetworkMemberships' | 'getProfile' | 'getActiveIntents' | 'upsertContactMembership' | 'getOrCreateDM' | 'unhideConversation' | 'updateOpportunityActorApproval' | 'stampOpportunityActorAction'>;
|
|
57
|
+
/**
|
|
58
|
+
* Database interface narrowed for Intent Graph operations.
|
|
59
|
+
* Provides state population (getActiveIntents), action execution (create/update/archive),
|
|
60
|
+
* and read operations (query intents; getIntentsInIndexForMember for network-scoped reads).
|
|
61
|
+
*
|
|
62
|
+
* Access layer: UserDatabase (mutations on own intents) + SystemDatabase (network-scoped reads)
|
|
63
|
+
*/
|
|
64
|
+
export type IntentGraphDatabase = Pick<Database, 'getActiveIntents' | 'getActiveIntentsAcrossIndexes' | 'getIntentsInIndexForMember' | 'createIntent' | 'updateIntent' | 'archiveIntent' | 'isNetworkMember' | 'getNetworkIntentsForMember' | 'getUser' | 'getProfile' | 'getUserContext' | 'getPersonalIndexesForContact' | 'assignIntentToNetwork'>;
|
|
65
|
+
/**
|
|
66
|
+
* Database interface narrowed for Network Graph CRUD operations.
|
|
67
|
+
* Handles create, read, update, delete of indexes (communities).
|
|
68
|
+
*
|
|
69
|
+
* Access layer: UserDatabase (CRUD on own networks and memberships)
|
|
70
|
+
*/
|
|
71
|
+
export type NetworkGraphDatabase = Pick<Database, 'getNetworkMemberships' | 'getOwnedIndexes' | 'getPublicIndexesNotJoined' | 'isIndexOwner' | 'isNetworkMember' | 'getNetwork' | 'createNetwork' | 'addMemberToNetwork' | 'updateIndexSettings' | 'softDeleteNetwork' | 'getNetworkMemberCount'>;
|
|
72
|
+
/**
|
|
73
|
+
* Database interface narrowed for Intent Index Graph operations.
|
|
74
|
+
* Provides intent/index context and assignment for intent–index evaluation.
|
|
75
|
+
* (Migrated from the old NetworkGraphDatabase.)
|
|
76
|
+
*
|
|
77
|
+
* Access layer: UserDatabase (own intent assignment) + SystemDatabase (index context)
|
|
78
|
+
*/
|
|
79
|
+
export type IntentNetworkGraphDatabase = Pick<Database, 'getIntentForIndexing' | 'getNetworkMemberContext' | 'getNetworkAssignmentContext' | 'getNetwork' | 'isIntentAssignedToIndex' | 'assignIntentToNetworkIfMember' | 'unassignIntentFromIndex' | 'getIntent' | 'isNetworkMember' | 'isIndexOwner' | 'getNetworkIdsForIntent' | 'getNetworkIntentsForMember' | 'getIntentsInIndexForMember'>;
|
|
80
|
+
/**
|
|
81
|
+
* Database interface narrowed for Network Membership Graph operations.
|
|
82
|
+
* Handles CRUD for network memberships (add, list, remove members).
|
|
83
|
+
*
|
|
84
|
+
* Access layer: SystemDatabase (cross-user membership operations)
|
|
85
|
+
*/
|
|
86
|
+
export type NetworkMembershipGraphDatabase = Pick<Database, 'isNetworkMember' | 'isIndexOwner' | 'getNetworkWithPermissions' | 'addMemberToNetwork' | 'removeMemberFromIndex' | 'getNetworkMembersForMember'>;
|
|
87
|
+
/**
|
|
88
|
+
* Database interface narrowed for HyDE Graph operations.
|
|
89
|
+
* Provides HyDE document CRUD and intent lookup for refresh.
|
|
90
|
+
*
|
|
91
|
+
* Access layer: UserDatabase (own HyDE) + SystemDatabase (cross-user matching)
|
|
92
|
+
*/
|
|
93
|
+
export type HydeGraphDatabase = Pick<Database, 'getHydeDocument' | 'getHydeDocumentsForSource' | 'saveHydeDocument' | 'getIntent'>;
|
|
94
|
+
/**
|
|
95
|
+
* Database interface for Radar Graph (opportunity radar view).
|
|
96
|
+
* Load opportunities, enrich with profile/index, and support presenter context.
|
|
97
|
+
*
|
|
98
|
+
* Access layer: UserDatabase (own opportunities and profile)
|
|
99
|
+
*/
|
|
100
|
+
export type RadarGraphDatabase = Pick<Database, 'getOpportunitiesForUser' | 'getOpportunity' | 'getProfile' | 'getActiveIntents' | 'getNetwork' | 'getUser'> & Pick<NegotiationGraphDatabase, 'getNegotiationTaskForOpportunity' | 'getMessagesForConversation' | 'getArtifactsForTask'>;
|