@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
@@ -1,4 +1,5 @@
1
1
  import type { NetworkGraphDatabase } from "../ports/index.js";
2
+ import { NetworkGraphState } from "../domain/index.js";
2
3
  /**
3
4
  * Factory class to build and compile the Network (community) lifecycle graph.
4
5
  *
@@ -27,13 +28,20 @@ import type { NetworkGraphDatabase } from "../ports/index.js";
27
28
  *
28
29
  * IND-546: canonical home — previously network/network.graph.ts.
29
30
  */
31
+ /** The graph's channel state, as every node sees it. */
32
+ export type NetworkState = typeof NetworkGraphState.State;
33
+ /** Everything the network nodes reach for. */
34
+ export interface NetworkGraphDeps {
35
+ database: NetworkGraphDatabase;
36
+ }
30
37
  export declare class NetworkGraphFactory {
31
- private database;
38
+ /** Resolved dependency bag shared by every node. */
39
+ readonly deps: NetworkGraphDeps;
32
40
  constructor(database: NetworkGraphDatabase);
33
41
  createGraph(): import("@langchain/langgraph").CompiledStateGraph<{
34
42
  userId: string;
35
43
  networkId: string | undefined;
36
- operationMode: "delete" | "update" | "create" | "read";
44
+ operationMode: "update" | "create" | "delete" | "read";
37
45
  createInput: {
38
46
  title: string;
39
47
  prompt?: string;
@@ -92,7 +100,7 @@ export declare class NetworkGraphFactory {
92
100
  }, {
93
101
  userId?: string | undefined;
94
102
  networkId?: string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined;
95
- operationMode?: "delete" | "update" | "create" | "read" | import("@langchain/langgraph").OverwriteValue<"delete" | "update" | "create" | "read"> | undefined;
103
+ operationMode?: "update" | "create" | "delete" | "read" | import("@langchain/langgraph").OverwriteValue<"update" | "create" | "delete" | "read"> | undefined;
96
104
  createInput?: {
97
105
  title: string;
98
106
  prompt?: string;
@@ -204,7 +212,7 @@ export declare class NetworkGraphFactory {
204
212
  Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
205
213
  };
206
214
  networkId: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
207
- operationMode: import("@langchain/langgraph").BaseChannel<"delete" | "update" | "create" | "read", "delete" | "update" | "create" | "read" | import("@langchain/langgraph").OverwriteValue<"delete" | "update" | "create" | "read">, unknown>;
215
+ operationMode: import("@langchain/langgraph").BaseChannel<"update" | "create" | "delete" | "read", "update" | "create" | "delete" | "read" | import("@langchain/langgraph").OverwriteValue<"update" | "create" | "delete" | "read">, unknown>;
208
216
  createInput: import("@langchain/langgraph").BaseChannel<{
209
217
  title: string;
210
218
  prompt?: string;
@@ -365,7 +373,7 @@ export declare class NetworkGraphFactory {
365
373
  Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
366
374
  };
367
375
  networkId: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
368
- operationMode: import("@langchain/langgraph").BaseChannel<"delete" | "update" | "create" | "read", "delete" | "update" | "create" | "read" | import("@langchain/langgraph").OverwriteValue<"delete" | "update" | "create" | "read">, unknown>;
376
+ operationMode: import("@langchain/langgraph").BaseChannel<"update" | "create" | "delete" | "read", "update" | "create" | "delete" | "read" | import("@langchain/langgraph").OverwriteValue<"update" | "create" | "delete" | "read">, unknown>;
369
377
  createInput: import("@langchain/langgraph").BaseChannel<{
370
378
  title: string;
371
379
  prompt?: string;
@@ -637,3 +645,138 @@ export declare class NetworkGraphFactory {
637
645
  };
638
646
  }, unknown, unknown, []>;
639
647
  }
648
+ /**
649
+ * Read Node: List networks the user belongs to and owns.
650
+ */
651
+ export declare function readNode(state: NetworkState, deps: NetworkGraphDeps): Promise<{
652
+ readResult: {
653
+ memberOf: {
654
+ networkId: string;
655
+ title: string;
656
+ prompt: string | null;
657
+ autoAssign: boolean;
658
+ isPersonal: boolean;
659
+ joinedAt: Date;
660
+ }[];
661
+ owns: {
662
+ networkId: string;
663
+ title: string;
664
+ prompt: string | null;
665
+ memberCount: number;
666
+ intentCount: number;
667
+ joinPolicy: "anyone" | "invite_only";
668
+ }[];
669
+ stats: {
670
+ memberOfCount: number;
671
+ ownsCount: number;
672
+ scopeNote: string;
673
+ publicNetworksCount?: undefined;
674
+ };
675
+ publicNetworks?: undefined;
676
+ };
677
+ error?: undefined;
678
+ } | {
679
+ readResult: {
680
+ memberOf: {
681
+ networkId: string;
682
+ title: string;
683
+ prompt: string | null;
684
+ autoAssign: boolean;
685
+ isPersonal: boolean;
686
+ joinedAt: Date;
687
+ }[];
688
+ owns: {
689
+ networkId: string;
690
+ title: string;
691
+ prompt: string | null;
692
+ memberCount: number;
693
+ intentCount: number;
694
+ joinPolicy: "anyone" | "invite_only";
695
+ }[];
696
+ publicNetworks: {
697
+ networkId: string;
698
+ title: string;
699
+ prompt: string | null;
700
+ memberCount: number;
701
+ owner: {
702
+ id: string;
703
+ name: string;
704
+ avatar: string | null;
705
+ } | null;
706
+ }[];
707
+ stats: {
708
+ memberOfCount: number;
709
+ ownsCount: number;
710
+ publicNetworksCount: number;
711
+ scopeNote?: undefined;
712
+ };
713
+ };
714
+ error?: undefined;
715
+ } | {
716
+ error: string;
717
+ readResult?: undefined;
718
+ }>;
719
+ /**
720
+ * Create Node: Create a new network and add user as owner.
721
+ *
722
+ * Atomicity contract:
723
+ * 1. Create the network row.
724
+ * 2. Add the calling user as owner.
725
+ * 3. On step-2 failure: soft-delete the network (rollback).
726
+ * 4. Rollback failures are logged at error level but never override the
727
+ * primary failure message returned to the caller.
728
+ */
729
+ export declare function createNode(state: NetworkState, deps: NetworkGraphDeps): Promise<{
730
+ mutationResult: {
731
+ success: boolean;
732
+ error: string;
733
+ networkId?: undefined;
734
+ title?: undefined;
735
+ message?: undefined;
736
+ };
737
+ } | {
738
+ mutationResult: {
739
+ success: boolean;
740
+ networkId: string;
741
+ title: string;
742
+ message: string;
743
+ error?: undefined;
744
+ };
745
+ }>;
746
+ /**
747
+ * Update Node: Update network settings (owner only).
748
+ */
749
+ export declare function updateNode(state: NetworkState, deps: NetworkGraphDeps): Promise<{
750
+ mutationResult: {
751
+ success: boolean;
752
+ error: string;
753
+ networkId?: undefined;
754
+ message?: undefined;
755
+ };
756
+ } | {
757
+ mutationResult: {
758
+ success: boolean;
759
+ networkId: string;
760
+ message: string;
761
+ error?: undefined;
762
+ };
763
+ }>;
764
+ /**
765
+ * Delete Node: Soft-delete a network (owner only, sole member).
766
+ */
767
+ export declare function deleteNode(state: NetworkState, deps: NetworkGraphDeps): Promise<{
768
+ mutationResult: {
769
+ success: boolean;
770
+ error: string;
771
+ networkId?: undefined;
772
+ message?: undefined;
773
+ };
774
+ } | {
775
+ mutationResult: {
776
+ success: boolean;
777
+ networkId: string;
778
+ message: string;
779
+ error?: undefined;
780
+ };
781
+ }>;
782
+ export declare function routeByMode(state: NetworkState): string;