@indexnetwork/protocol 14.3.2-rc.477.1 → 16.1.1-rc.478.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 (140) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/IMPLEMENTATION.md +50 -52
  3. package/STABILITY.md +3 -3
  4. package/dist/chat/chat.agent.js +2 -2
  5. package/dist/chat/chat.graph.d.ts +41 -1
  6. package/dist/chat/chat.graph.js +108 -127
  7. package/dist/discovery/hyde.frame.d.ts +4 -4
  8. package/dist/discovery/hyde.graph.d.ts +71 -12
  9. package/dist/discovery/hyde.graph.js +337 -335
  10. package/dist/discovery/lens.inferrer.d.ts +6 -6
  11. package/dist/enrichment/enrichment.graph.d.ts +127 -9
  12. package/dist/enrichment/enrichment.graph.js +633 -655
  13. package/dist/enrichment/enrichment.state.d.ts +1 -1
  14. package/dist/enrichment/enrichment.tools.context-read.d.ts +10 -0
  15. package/dist/enrichment/enrichment.tools.context-read.js +353 -0
  16. package/dist/enrichment/enrichment.tools.context-write.d.ts +9 -0
  17. package/dist/enrichment/enrichment.tools.context-write.js +417 -0
  18. package/dist/enrichment/enrichment.tools.d.ts +11 -1
  19. package/dist/enrichment/enrichment.tools.helpers.d.ts +139 -0
  20. package/dist/enrichment/enrichment.tools.helpers.js +234 -0
  21. package/dist/enrichment/enrichment.tools.js +16 -975
  22. package/dist/index.d.ts +27 -48
  23. package/dist/index.js +17 -27
  24. package/dist/intents/application/intent.graph.d.ts +71 -67
  25. package/dist/intents/application/intent.graph.execute.d.ts +59 -0
  26. package/dist/intents/application/intent.graph.execute.js +301 -0
  27. package/dist/intents/application/intent.graph.infer.d.ts +44 -0
  28. package/dist/intents/application/intent.graph.infer.js +97 -0
  29. package/dist/intents/application/intent.graph.js +96 -888
  30. package/dist/intents/application/intent.graph.reconcile.d.ts +71 -0
  31. package/dist/intents/application/intent.graph.reconcile.js +274 -0
  32. package/dist/intents/application/intent.graph.shared.d.ts +70 -0
  33. package/dist/intents/application/intent.graph.shared.js +153 -0
  34. package/dist/intents/domain/intent.state.d.ts +1 -1
  35. package/dist/maintenance/maintenance.graph.d.ts +66 -3
  36. package/dist/maintenance/maintenance.graph.js +155 -156
  37. package/dist/mcp/mcp.authorization-policy.d.ts +24 -28
  38. package/dist/mcp/mcp.authorization-policy.js +14 -34
  39. package/dist/mcp/mcp.server.d.ts +3 -3
  40. package/dist/mcp/mcp.server.js +12 -16
  41. package/dist/negotiations/application/negotiation.candidates.d.ts +83 -0
  42. package/dist/negotiations/application/negotiation.candidates.js +162 -0
  43. package/dist/negotiations/application/negotiation.graph.d.ts +91 -157
  44. package/dist/negotiations/application/negotiation.graph.finalize.d.ts +5 -0
  45. package/dist/negotiations/application/negotiation.graph.finalize.js +280 -0
  46. package/dist/negotiations/application/negotiation.graph.init.d.ts +54 -0
  47. package/dist/negotiations/application/negotiation.graph.init.js +227 -0
  48. package/dist/negotiations/application/negotiation.graph.js +69 -1388
  49. package/dist/negotiations/application/negotiation.graph.screen.d.ts +23 -0
  50. package/dist/negotiations/application/negotiation.graph.screen.js +108 -0
  51. package/dist/negotiations/application/negotiation.graph.shared.d.ts +75 -0
  52. package/dist/negotiations/application/negotiation.graph.shared.js +125 -0
  53. package/dist/negotiations/application/negotiation.graph.turn.d.ts +105 -0
  54. package/dist/negotiations/application/negotiation.graph.turn.js +484 -0
  55. package/dist/negotiations/domain/negotiation.state.d.ts +1 -1
  56. package/dist/negotiations/domain/negotiation.state.js +0 -1
  57. package/dist/networks/application/indexer.graph.d.ts +165 -7
  58. package/dist/networks/application/indexer.graph.js +339 -388
  59. package/dist/networks/application/indexer.state.d.ts +1 -1
  60. package/dist/networks/application/membership.graph.d.ts +83 -5
  61. package/dist/networks/application/membership.graph.js +177 -207
  62. package/dist/networks/application/network.graph.d.ts +148 -5
  63. package/dist/networks/application/network.graph.js +249 -278
  64. package/dist/networks/domain/membership.state.d.ts +1 -1
  65. package/dist/networks/domain/network.state.d.ts +1 -1
  66. package/dist/opportunities/application/delivery-card.cache.d.ts +1 -1
  67. package/dist/opportunities/application/delivery-card.cache.js +2 -2
  68. package/dist/opportunities/application/index.d.ts +2 -2
  69. package/dist/opportunities/application/index.js +2 -2
  70. package/dist/opportunities/application/opportunity.evaluator.js +1 -1
  71. package/dist/opportunities/application/opportunity.graph.d.ts +686 -473
  72. package/dist/opportunities/application/opportunity.graph.discovery-strategies.d.ts +109 -0
  73. package/dist/opportunities/application/opportunity.graph.discovery-strategies.js +451 -0
  74. package/dist/opportunities/application/opportunity.graph.discovery.d.ts +69 -0
  75. package/dist/opportunities/application/opportunity.graph.discovery.js +397 -0
  76. package/dist/opportunities/application/opportunity.graph.evaluation.d.ts +82 -0
  77. package/dist/opportunities/application/opportunity.graph.evaluation.js +608 -0
  78. package/dist/opportunities/application/opportunity.graph.js +120 -3690
  79. package/dist/opportunities/application/opportunity.graph.modes.d.ts +538 -0
  80. package/dist/opportunities/application/opportunity.graph.modes.js +538 -0
  81. package/dist/opportunities/application/opportunity.graph.negotiate.d.ts +109 -0
  82. package/dist/opportunities/application/opportunity.graph.negotiate.js +392 -0
  83. package/dist/opportunities/application/opportunity.graph.persist-node.d.ts +93 -0
  84. package/dist/opportunities/application/opportunity.graph.persist-node.js +765 -0
  85. package/dist/opportunities/application/opportunity.graph.prep.d.ts +150 -0
  86. package/dist/opportunities/application/opportunity.graph.prep.js +381 -0
  87. package/dist/opportunities/application/opportunity.graph.shared.d.ts +173 -0
  88. package/dist/opportunities/application/opportunity.graph.shared.js +199 -0
  89. package/dist/opportunities/application/opportunity.presentation.d.ts +399 -0
  90. package/dist/opportunities/application/{opportunity.presenter.js → opportunity.presentation.js} +735 -9
  91. package/dist/opportunities/application/opportunity.tools.cards.d.ts +152 -0
  92. package/dist/opportunities/application/opportunity.tools.cards.js +235 -0
  93. package/dist/opportunities/application/opportunity.tools.d.ts +8 -114
  94. package/dist/opportunities/application/opportunity.tools.js +28 -711
  95. package/dist/opportunities/application/opportunity.tools.list.d.ts +10 -0
  96. package/dist/opportunities/application/opportunity.tools.list.js +493 -0
  97. package/dist/opportunities/domain/index.d.ts +3 -3
  98. package/dist/opportunities/domain/index.js +3 -3
  99. package/dist/opportunities/domain/opportunity.state.d.ts +19 -19
  100. package/dist/opportunities/index.d.ts +6 -6
  101. package/dist/opportunities/index.js +4 -4
  102. package/dist/opportunities/ports/opportunity.tools.port.d.ts +1 -1
  103. package/dist/opportunities/radar/radar.graph.d.ts +57 -13
  104. package/dist/opportunities/radar/radar.graph.js +470 -471
  105. package/dist/premises/premise.graph.d.ts +88 -20
  106. package/dist/premises/premise.graph.js +207 -218
  107. package/dist/questions/domain/question.schema.d.ts +40 -40
  108. package/dist/shared/agent/tool.helpers.d.ts +21 -0
  109. package/dist/shared/agent/tool.registry.d.ts +4 -3
  110. package/dist/shared/agent/tool.registry.js +1 -1
  111. package/dist/shared/interfaces/database.capabilities.d.ts +100 -0
  112. package/dist/shared/interfaces/database.capabilities.js +7 -0
  113. package/dist/shared/interfaces/database.entities.d.ts +533 -0
  114. package/dist/shared/interfaces/database.entities.js +10 -0
  115. package/dist/shared/interfaces/database.identity-queries.d.ts +294 -0
  116. package/dist/shared/interfaces/database.identity-queries.js +4 -0
  117. package/dist/shared/interfaces/database.interface.d.ts +15 -2277
  118. package/dist/shared/interfaces/database.interface.js +8 -0
  119. package/dist/shared/interfaces/database.member-queries.d.ts +228 -0
  120. package/dist/shared/interfaces/database.member-queries.js +4 -0
  121. package/dist/shared/interfaces/database.negotiation.d.ts +305 -0
  122. package/dist/shared/interfaces/database.negotiation.js +26 -0
  123. package/dist/shared/interfaces/database.network-queries.d.ts +277 -0
  124. package/dist/shared/interfaces/database.network-queries.js +4 -0
  125. package/dist/shared/interfaces/database.opportunity-queries.d.ts +285 -0
  126. package/dist/shared/interfaces/database.opportunity-queries.js +4 -0
  127. package/dist/shared/interfaces/database.port.d.ts +322 -0
  128. package/dist/shared/interfaces/database.port.js +29 -0
  129. package/dist/shared/schemas/discovery-question.schema.d.ts +14 -14
  130. package/dist/shared/schemas/negotiation-digest.schema.d.ts +2 -2
  131. package/package.json +2 -15
  132. package/dist/opportunities/application/opportunity.card-presentation.d.ts +0 -44
  133. package/dist/opportunities/application/opportunity.card-presentation.js +0 -93
  134. package/dist/opportunities/application/opportunity.presenter.d.ts +0 -156
  135. package/dist/opportunities/domain/opportunity.presentation-cache.d.ts +0 -5
  136. package/dist/opportunities/domain/opportunity.presentation-cache.js +0 -11
  137. package/dist/opportunities/domain/opportunity.presentation.d.ts +0 -76
  138. package/dist/opportunities/domain/opportunity.presentation.js +0 -516
  139. package/dist/opportunities/domain/opportunity.safe-presentation.d.ts +0 -104
  140. 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;
@@ -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";
@@ -493,6 +496,12 @@ interface ToolDepsBindings {
493
496
  limit?: number;
494
497
  scope?: 'tool' | 'principal';
495
498
  }>;
499
+ /**
500
+ * The non-discovery opportunity operations (`update_opportunity` and its
501
+ * send variant). Defaults to the plain functions in
502
+ * `opportunity.graph.modes.ts`; injected by tests to observe the call.
503
+ */
504
+ opportunityOperations?: OpportunityOperations;
496
505
  graphs: {
497
506
  profile: CompiledGraph;
498
507
  intent: CompiledGraph;
@@ -584,4 +593,16 @@ export declare function extractUrls(text: string): string[];
584
593
  * @returns A new value with sensitive fields replaced by `"[redacted]"`.
585
594
  */
586
595
  export declare function redactSensitiveFields(value: unknown): unknown;
596
+ /** The subset of opportunity modes the tool layer invokes. */
597
+ export interface OpportunityOperations {
598
+ updateOpportunityStatus: (deps: Pick<OpportunityGraphDeps, 'database'>, request: {
599
+ userId: Id<'users'>;
600
+ opportunityId: string | undefined;
601
+ newStatus: string | undefined;
602
+ }) => Promise<OpportunityMutationOutcome>;
603
+ sendOpportunity: (deps: Pick<OpportunityGraphDeps, 'database' | 'queueNotification'>, request: {
604
+ userId: Id<'users'>;
605
+ opportunityId: string | undefined;
606
+ }) => Promise<OpportunityMutationOutcome>;
607
+ }
587
608
  export {};
@@ -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 `scrape_url`. The restricted `'mcp'`
8
- * profile omits those surfaces (IND-596/597). Retired profile/profile-run
9
- * compatibility aliases are absent from both profiles (IND-373/598).
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
  }
@@ -53,7 +53,7 @@ export function createToolRegistry(deps, options = {}) {
53
53
  // Create all tool domains -- each one calls defineTool() which populates the registry.
54
54
  // The local defineTool is compatible with DefineTool (which returns any).
55
55
  const dt = defineTool;
56
- createEnrichmentTools(dt, deps);
56
+ createEnrichmentTools(dt, deps, { surface: isMcpSurface ? 'mcp' : 'rest' });
57
57
  createIntentTools(dt, deps);
58
58
  createNetworkTools(dt, deps);
59
59
  createOpportunityTools(dt, deps);
@@ -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'>;
@@ -0,0 +1,7 @@
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
+ export {};