@indexnetwork/protocol 22.0.0-rc.499.1 → 64.0.0-rc.604.2

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 (561) hide show
  1. package/CHANGELOG.md +1841 -0
  2. package/IMPLEMENTATION.md +140 -181
  3. package/README.md +16 -20
  4. package/STABILITY.md +16 -11
  5. package/dist/{intents/intent.module.d.ts → capabilities/intents.d.ts} +182 -192
  6. package/dist/capabilities/intents.js +88 -0
  7. package/dist/capabilities/negotiations.d.ts +17 -0
  8. package/dist/capabilities/negotiations.js +16 -0
  9. package/dist/{networks/network.module.d.ts → capabilities/networks.d.ts} +33 -169
  10. package/dist/{networks/network.module.js → capabilities/networks.js} +6 -17
  11. package/dist/index.d.ts +57 -134
  12. package/dist/index.js +41 -105
  13. package/dist/internal/agents/agent.repository.port.d.ts +59 -0
  14. package/dist/internal/agents/agent.repository.port.js +7 -0
  15. package/dist/internal/agents/agent.types.d.ts +35 -0
  16. package/dist/{agents → internal/agents}/agent.types.js +1 -6
  17. package/dist/{intents → internal/intents}/graph/intent.graph.d.ts +142 -151
  18. package/dist/{intents → internal/intents}/graph/intent.graph.execute.d.ts +5 -1
  19. package/dist/{intents → internal/intents}/graph/intent.graph.execute.js +165 -46
  20. package/dist/internal/intents/graph/intent.graph.infer.d.ts +78 -0
  21. package/dist/internal/intents/graph/intent.graph.infer.js +122 -0
  22. package/dist/internal/intents/graph/intent.graph.js +108 -0
  23. package/dist/{intents → internal/intents}/graph/intent.graph.reconcile.d.ts +18 -9
  24. package/dist/internal/intents/graph/intent.graph.reconcile.js +173 -0
  25. package/dist/internal/intents/graph/intent.graph.shared.d.ts +55 -0
  26. package/dist/{intents → internal/intents}/graph/intent.graph.shared.js +25 -70
  27. package/dist/{intents → internal/intents}/graph/intent.graph.state.d.ts +96 -32
  28. package/dist/{intents → internal/intents}/graph/intent.graph.state.js +42 -31
  29. package/dist/internal/intents/intent.admission.d.ts +16 -0
  30. package/dist/internal/intents/intent.admission.js +30 -0
  31. package/dist/{intents → internal/intents}/intent.inferrer.d.ts +1 -40
  32. package/dist/{intents → internal/intents}/intent.inferrer.js +13 -49
  33. package/dist/internal/intents/intent.preparer.d.ts +52 -0
  34. package/dist/internal/intents/intent.preparer.js +87 -0
  35. package/dist/{intents → internal/intents}/intent.verifier.d.ts +3 -36
  36. package/dist/{intents → internal/intents}/intent.verifier.js +0 -17
  37. package/dist/{networks → internal/networks}/indexer.graph.d.ts +15 -200
  38. package/dist/{networks → internal/networks}/indexer.graph.js +19 -128
  39. package/dist/{networks → internal/networks}/indexer.state.d.ts +8 -63
  40. package/dist/internal/networks/indexer.state.js +70 -0
  41. package/dist/{networks → internal/networks}/membership.graph.d.ts +6 -6
  42. package/dist/{networks → internal/networks}/membership.graph.js +3 -3
  43. package/dist/{networks → internal/networks}/membership.state.d.ts +2 -2
  44. package/dist/{networks → internal/networks}/membership.state.js +2 -2
  45. package/dist/{networks → internal/networks}/network.graph.d.ts +9 -22
  46. package/dist/{networks → internal/networks}/network.graph.js +13 -27
  47. package/dist/{networks → internal/networks}/network.recommender.d.ts +2 -2
  48. package/dist/{networks → internal/networks}/network.recommender.js +2 -2
  49. package/dist/{networks → internal/networks}/network.state.d.ts +4 -7
  50. package/dist/{networks → internal/networks}/network.state.js +4 -4
  51. package/dist/internal/opportunities/negotiation-context.loader.d.ts +26 -0
  52. package/dist/internal/opportunities/negotiation-context.loader.js +36 -0
  53. package/dist/{opportunities → internal/opportunities}/opportunity.actor.d.ts +1 -1
  54. package/dist/{opportunities → internal/opportunities}/opportunity.actor.js +7 -1
  55. package/dist/internal/opportunities/opportunity.counterparties.d.ts +17 -0
  56. package/dist/internal/opportunities/opportunity.counterparties.js +19 -0
  57. package/dist/internal/opportunities/opportunity.events.d.ts +38 -0
  58. package/dist/internal/opportunities/opportunity.events.js +94 -0
  59. package/dist/{opportunities → internal/opportunities}/opportunity.feed-selection.d.ts +3 -9
  60. package/dist/internal/opportunities/opportunity.feed-selection.js +40 -0
  61. package/dist/internal/opportunities/opportunity.graph.modes.d.ts +39 -0
  62. package/dist/internal/opportunities/opportunity.graph.modes.js +138 -0
  63. package/dist/{opportunities → internal/opportunities}/opportunity.labels.d.ts +2 -3
  64. package/dist/internal/opportunities/opportunity.labels.js +9 -0
  65. package/dist/{opportunities → internal/opportunities}/opportunity.presentation.d.ts +17 -86
  66. package/dist/{opportunities → internal/opportunities}/opportunity.presentation.js +54 -447
  67. package/dist/{opportunities → internal/opportunities}/opportunity.update-admission.d.ts +2 -2
  68. package/dist/internal/opportunities/opportunity.utils.d.ts +105 -0
  69. package/dist/internal/opportunities/opportunity.utils.js +165 -0
  70. package/dist/{opportunities → internal/opportunities}/radar/radar.graph.d.ts +17 -17
  71. package/dist/{opportunities → internal/opportunities}/radar/radar.graph.js +41 -161
  72. package/dist/{opportunities → internal/opportunities}/radar/radar.state.d.ts +4 -11
  73. package/dist/{shared → internal/shared}/agent/model-signal.d.ts +1 -1
  74. package/dist/{shared → internal/shared}/agent/model-signal.js +1 -1
  75. package/dist/{shared → internal/shared}/agent/model.config.d.ts +28 -86
  76. package/dist/{shared → internal/shared}/agent/model.config.js +58 -69
  77. package/dist/internal/shared/agent/model.resolver.d.ts +33 -0
  78. package/dist/{shared → internal/shared}/agent/model.resolver.js +18 -33
  79. package/dist/internal/shared/agent/scope.d.ts +20 -0
  80. package/dist/internal/shared/agent/scope.js +24 -0
  81. package/dist/internal/shared/assignment/network-assignment.policy.d.ts +23 -0
  82. package/dist/internal/shared/assignment/network-assignment.policy.js +28 -0
  83. package/dist/{shared → internal/shared}/observability/log.d.ts +3 -6
  84. package/dist/{shared → internal/shared}/observability/log.js +9 -18
  85. package/dist/{shared → internal/shared}/observability/protocol.logger.d.ts +1 -1
  86. package/dist/{shared → internal/shared}/observability/protocol.logger.js +1 -1
  87. package/dist/internal/shared/observability/request-context.d.ts +29 -0
  88. package/dist/internal/shared/observability/request-context.js +17 -0
  89. package/dist/{shared → internal/shared}/utils/social-label.d.ts +2 -2
  90. package/dist/{shared → internal/shared}/utils/social-label.js +1 -1
  91. package/dist/platform/database/capabilities.d.ts +59 -0
  92. package/dist/{shared/interfaces/database.entities.d.ts → platform/database/entities.d.ts} +81 -121
  93. package/dist/{shared/interfaces/database.identity-queries.d.ts → platform/database/identity-queries.d.ts} +55 -20
  94. package/dist/platform/database/member-queries.d.ts +55 -0
  95. package/dist/platform/database/member-queries.js +4 -0
  96. package/dist/platform/database/negotiation.d.ts +38 -0
  97. package/dist/{shared/interfaces/database.network-queries.d.ts → platform/database/network-queries.d.ts} +66 -67
  98. package/dist/platform/database/network-queries.js +4 -0
  99. package/dist/{shared/interfaces/database.opportunity-queries.d.ts → platform/database/opportunity-queries.d.ts} +25 -109
  100. package/dist/{shared/interfaces/database.port.d.ts → platform/database/port.d.ts} +52 -117
  101. package/dist/{shared/interfaces/database.port.js → platform/database/port.js} +3 -5
  102. package/dist/platform/database.d.ts +23 -0
  103. package/dist/{shared/interfaces/database.interface.js → platform/database.js} +1 -1
  104. package/dist/{shared/interfaces/cache.interface.d.ts → platform/discovery/cache.d.ts} +2 -4
  105. package/dist/{shared/interfaces/cache.interface.js → platform/discovery/cache.js} +1 -1
  106. package/dist/platform/discovery/embedder.d.ts +31 -0
  107. package/dist/platform/runtime/errors.d.ts +6 -0
  108. package/dist/platform/runtime/errors.js +9 -0
  109. package/dist/platform/runtime/follow-up.d.ts +36 -0
  110. package/dist/platform/runtime/follow-up.js +4 -0
  111. package/dist/platform/runtime/observability.d.ts +34 -0
  112. package/dist/protocol/core.d.ts +11 -0
  113. package/dist/protocol/discovery.rules.d.ts +21 -0
  114. package/dist/protocol/discovery.rules.js +29 -0
  115. package/dist/protocol/negotiation.constants.d.ts +3 -0
  116. package/dist/protocol/negotiation.constants.js +3 -0
  117. package/dist/protocol/negotiation.rules.d.ts +73 -0
  118. package/dist/protocol/negotiation.rules.js +68 -0
  119. package/dist/protocol/protocol.prompt.d.ts +13 -0
  120. package/dist/protocol/protocol.prompt.js +190 -0
  121. package/dist/{shared → protocol}/schemas/discovery-question.schema.d.ts +13 -13
  122. package/dist/{shared → protocol}/schemas/discovery-question.schema.js +2 -2
  123. package/dist/{shared → protocol}/schemas/identity.schema.d.ts +4 -4
  124. package/dist/{shared → protocol}/schemas/identity.schema.js +4 -4
  125. package/dist/{shared → protocol}/schemas/network-assignment.schema.d.ts +11 -20
  126. package/dist/{shared → protocol}/schemas/network-assignment.schema.js +2 -9
  127. package/dist/protocol/schemas/underspecification.schema.d.ts +9 -0
  128. package/dist/protocol/schemas/underspecification.schema.js +12 -0
  129. package/package.json +7 -15
  130. package/dist/agents/agent.dispatcher.port.d.ts +0 -25
  131. package/dist/agents/agent.module.d.ts +0 -19
  132. package/dist/agents/agent.module.js +0 -11
  133. package/dist/agents/agent.repository.port.d.ts +0 -118
  134. package/dist/agents/agent.repository.port.js +0 -10
  135. package/dist/agents/agent.tools.d.ts +0 -16
  136. package/dist/agents/agent.tools.js +0 -351
  137. package/dist/agents/agent.tools.port.d.ts +0 -22
  138. package/dist/agents/agent.tools.port.js +0 -18
  139. package/dist/agents/agent.types.d.ts +0 -76
  140. package/dist/chat/chat-streaming.types.d.ts +0 -618
  141. package/dist/chat/chat-streaming.types.js +0 -297
  142. package/dist/chat/chat.agent.d.ts +0 -292
  143. package/dist/chat/chat.agent.js +0 -1010
  144. package/dist/chat/chat.graph.d.ts +0 -424
  145. package/dist/chat/chat.graph.js +0 -257
  146. package/dist/chat/chat.interrupt.classifier.d.ts +0 -25
  147. package/dist/chat/chat.interrupt.classifier.js +0 -64
  148. package/dist/chat/chat.persona.d.ts +0 -39
  149. package/dist/chat/chat.prompt.d.ts +0 -4
  150. package/dist/chat/chat.prompt.js +0 -12
  151. package/dist/chat/chat.prompt.modules.d.ts +0 -30
  152. package/dist/chat/chat.prompt.modules.js +0 -40
  153. package/dist/chat/chat.question-dedup.d.ts +0 -14
  154. package/dist/chat/chat.question-dedup.js +0 -17
  155. package/dist/chat/chat.state.d.ts +0 -135
  156. package/dist/chat/chat.state.js +0 -120
  157. package/dist/chat/chat.streamer.d.ts +0 -64
  158. package/dist/chat/chat.streamer.js +0 -217
  159. package/dist/chat/chat.suggester.d.ts +0 -23
  160. package/dist/chat/chat.suggester.js +0 -95
  161. package/dist/chat/chat.summarizer.d.ts +0 -20
  162. package/dist/chat/chat.summarizer.js +0 -97
  163. package/dist/chat/chat.title.generator.d.ts +0 -19
  164. package/dist/chat/chat.title.generator.js +0 -66
  165. package/dist/chat/chat.tools.d.ts +0 -5
  166. package/dist/chat/chat.tools.js +0 -62
  167. package/dist/chat/chat.utils.d.ts +0 -41
  168. package/dist/chat/chat.utils.js +0 -88
  169. package/dist/chat/negotiator.persona.d.ts +0 -74
  170. package/dist/chat/negotiator.persona.js +0 -154
  171. package/dist/chat/negotiator.prompt.d.ts +0 -45
  172. package/dist/chat/negotiator.prompt.js +0 -160
  173. package/dist/chat/negotiator.tools.d.ts +0 -42
  174. package/dist/chat/negotiator.tools.js +0 -134
  175. package/dist/chat/onboarding.persona.d.ts +0 -28
  176. package/dist/chat/onboarding.persona.js +0 -86
  177. package/dist/chat/onboarding.prompt.d.ts +0 -6
  178. package/dist/chat/onboarding.prompt.js +0 -63
  179. package/dist/chat/signal.persona.d.ts +0 -47
  180. package/dist/chat/signal.persona.js +0 -319
  181. package/dist/chat/signal.prompt.d.ts +0 -39
  182. package/dist/chat/signal.prompt.js +0 -136
  183. package/dist/contacts/contact.module.d.ts +0 -8
  184. package/dist/contacts/contact.module.js +0 -6
  185. package/dist/contacts/contact.repository.port.d.ts +0 -21
  186. package/dist/contacts/contact.repository.port.js +0 -12
  187. package/dist/contacts/contact.tools.d.ts +0 -17
  188. package/dist/contacts/contact.tools.js +0 -108
  189. package/dist/contacts/contact.tools.port.d.ts +0 -20
  190. package/dist/contacts/contact.tools.port.js +0 -16
  191. package/dist/contacts/contact.types.d.ts +0 -24
  192. package/dist/contacts/contact.types.js +0 -8
  193. package/dist/contexts/context.generator.d.ts +0 -95
  194. package/dist/contexts/context.generator.js +0 -127
  195. package/dist/contexts/context.module.d.ts +0 -13
  196. package/dist/contexts/context.module.js +0 -12
  197. package/dist/contexts/context.tools.port.d.ts +0 -9
  198. package/dist/discovery/hyde.documents.d.ts +0 -9
  199. package/dist/discovery/hyde.documents.js +0 -49
  200. package/dist/discovery/hyde.env.d.ts +0 -8
  201. package/dist/discovery/hyde.env.js +0 -9
  202. package/dist/discovery/hyde.frame.d.ts +0 -150
  203. package/dist/discovery/hyde.frame.js +0 -107
  204. package/dist/discovery/hyde.generator.d.ts +0 -38
  205. package/dist/discovery/hyde.generator.js +0 -103
  206. package/dist/discovery/hyde.graph.d.ts +0 -209
  207. package/dist/discovery/hyde.graph.js +0 -482
  208. package/dist/discovery/hyde.state.d.ts +0 -70
  209. package/dist/discovery/hyde.state.js +0 -85
  210. package/dist/discovery/hyde.strategies.d.ts +0 -17
  211. package/dist/discovery/hyde.strategies.js +0 -34
  212. package/dist/discovery/hyde.validator.d.ts +0 -78
  213. package/dist/discovery/hyde.validator.js +0 -48
  214. package/dist/discovery/index.d.ts +0 -26
  215. package/dist/discovery/index.js +0 -19
  216. package/dist/discovery/lens.inferrer.d.ts +0 -214
  217. package/dist/discovery/lens.inferrer.js +0 -152
  218. package/dist/enrichment/enrichment.generator.d.ts +0 -68
  219. package/dist/enrichment/enrichment.generator.js +0 -95
  220. package/dist/enrichment/enrichment.graph.d.ts +0 -544
  221. package/dist/enrichment/enrichment.graph.js +0 -695
  222. package/dist/enrichment/enrichment.state.d.ts +0 -141
  223. package/dist/enrichment/enrichment.state.js +0 -115
  224. package/dist/enrichment/enrichment.tools.context-read.d.ts +0 -10
  225. package/dist/enrichment/enrichment.tools.context-read.js +0 -353
  226. package/dist/enrichment/enrichment.tools.context-write.d.ts +0 -9
  227. package/dist/enrichment/enrichment.tools.context-write.js +0 -417
  228. package/dist/enrichment/enrichment.tools.d.ts +0 -13
  229. package/dist/enrichment/enrichment.tools.helpers.d.ts +0 -139
  230. package/dist/enrichment/enrichment.tools.helpers.js +0 -234
  231. package/dist/enrichment/enrichment.tools.js +0 -153
  232. package/dist/intents/graph/intent.graph.infer.d.ts +0 -44
  233. package/dist/intents/graph/intent.graph.infer.js +0 -97
  234. package/dist/intents/graph/intent.graph.js +0 -134
  235. package/dist/intents/graph/intent.graph.reconcile.js +0 -274
  236. package/dist/intents/graph/intent.graph.shared.d.ts +0 -68
  237. package/dist/intents/intake/intake.orchestrator.d.ts +0 -203
  238. package/dist/intents/intake/intake.orchestrator.js +0 -255
  239. package/dist/intents/intake/intake.pack.generator.d.ts +0 -57
  240. package/dist/intents/intake/intake.pack.generator.js +0 -90
  241. package/dist/intents/intent.clarifier.d.ts +0 -51
  242. package/dist/intents/intent.clarifier.js +0 -201
  243. package/dist/intents/intent.indexer.d.ts +0 -82
  244. package/dist/intents/intent.indexer.js +0 -170
  245. package/dist/intents/intent.module.js +0 -103
  246. package/dist/intents/intent.proposal.d.ts +0 -37
  247. package/dist/intents/intent.proposal.js +0 -14
  248. package/dist/intents/intent.reconciler.d.ts +0 -105
  249. package/dist/intents/intent.reconciler.js +0 -186
  250. package/dist/intents/intent.tools.d.ts +0 -27
  251. package/dist/intents/intent.tools.js +0 -808
  252. package/dist/maintenance/maintenance.graph.d.ts +0 -239
  253. package/dist/maintenance/maintenance.graph.js +0 -199
  254. package/dist/maintenance/maintenance.state.d.ts +0 -35
  255. package/dist/maintenance/maintenance.state.js +0 -55
  256. package/dist/mcp/elicitation.builder.d.ts +0 -53
  257. package/dist/mcp/elicitation.builder.js +0 -74
  258. package/dist/mcp/elicitation.dispatcher.d.ts +0 -36
  259. package/dist/mcp/elicitation.dispatcher.js +0 -86
  260. package/dist/mcp/mcp.authorization-policy.d.ts +0 -252
  261. package/dist/mcp/mcp.authorization-policy.js +0 -535
  262. package/dist/mcp/mcp.server.d.ts +0 -90
  263. package/dist/mcp/mcp.server.js +0 -631
  264. package/dist/negotiations/insight.generator.d.ts +0 -31
  265. package/dist/negotiations/insight.generator.js +0 -105
  266. package/dist/negotiations/negotiation.agent.d.ts +0 -130
  267. package/dist/negotiations/negotiation.agent.js +0 -396
  268. package/dist/negotiations/negotiation.answer-consumption.d.ts +0 -223
  269. package/dist/negotiations/negotiation.answer-consumption.js +0 -275
  270. package/dist/negotiations/negotiation.attribution.d.ts +0 -91
  271. package/dist/negotiations/negotiation.attribution.js +0 -109
  272. package/dist/negotiations/negotiation.candidates.d.ts +0 -83
  273. package/dist/negotiations/negotiation.candidates.js +0 -162
  274. package/dist/negotiations/negotiation.client-dm.d.ts +0 -50
  275. package/dist/negotiations/negotiation.client-dm.js +0 -66
  276. package/dist/negotiations/negotiation.consultation-policy.d.ts +0 -95
  277. package/dist/negotiations/negotiation.consultation-policy.js +0 -159
  278. package/dist/negotiations/negotiation.deadlock.contracts.d.ts +0 -10
  279. package/dist/negotiations/negotiation.deadlock.d.ts +0 -87
  280. package/dist/negotiations/negotiation.deadlock.js +0 -150
  281. package/dist/negotiations/negotiation.detail-reader.d.ts +0 -94
  282. package/dist/negotiations/negotiation.detail-reader.js +0 -91
  283. package/dist/negotiations/negotiation.expected-speaker.d.ts +0 -33
  284. package/dist/negotiations/negotiation.expected-speaker.js +0 -59
  285. package/dist/negotiations/negotiation.graph.d.ts +0 -694
  286. package/dist/negotiations/negotiation.graph.finalize.d.ts +0 -5
  287. package/dist/negotiations/negotiation.graph.finalize.js +0 -403
  288. package/dist/negotiations/negotiation.graph.init.d.ts +0 -54
  289. package/dist/negotiations/negotiation.graph.init.js +0 -256
  290. package/dist/negotiations/negotiation.graph.js +0 -94
  291. package/dist/negotiations/negotiation.graph.screen.d.ts +0 -23
  292. package/dist/negotiations/negotiation.graph.screen.js +0 -108
  293. package/dist/negotiations/negotiation.graph.shared.d.ts +0 -111
  294. package/dist/negotiations/negotiation.graph.shared.js +0 -168
  295. package/dist/negotiations/negotiation.graph.turn.d.ts +0 -134
  296. package/dist/negotiations/negotiation.graph.turn.js +0 -662
  297. package/dist/negotiations/negotiation.hermes-contract.d.ts +0 -31
  298. package/dist/negotiations/negotiation.hermes-contract.js +0 -72
  299. package/dist/negotiations/negotiation.intent-snapshot-provenance.d.ts +0 -21
  300. package/dist/negotiations/negotiation.intent-snapshot-provenance.js +0 -28
  301. package/dist/negotiations/negotiation.lifecycle-narration.d.ts +0 -18
  302. package/dist/negotiations/negotiation.lifecycle-narration.js +0 -87
  303. package/dist/negotiations/negotiation.memory.d.ts +0 -65
  304. package/dist/negotiations/negotiation.memory.js +0 -83
  305. package/dist/negotiations/negotiation.module.d.ts +0 -36
  306. package/dist/negotiations/negotiation.module.js +0 -23
  307. package/dist/negotiations/negotiation.protocol.d.ts +0 -1018
  308. package/dist/negotiations/negotiation.protocol.js +0 -224
  309. package/dist/negotiations/negotiation.question-safety.d.ts +0 -52
  310. package/dist/negotiations/negotiation.question-safety.js +0 -119
  311. package/dist/negotiations/negotiation.reflect.d.ts +0 -194
  312. package/dist/negotiations/negotiation.reflect.js +0 -145
  313. package/dist/negotiations/negotiation.scope.d.ts +0 -41
  314. package/dist/negotiations/negotiation.scope.js +0 -39
  315. package/dist/negotiations/negotiation.screen.contracts.d.ts +0 -88
  316. package/dist/negotiations/negotiation.screen.contracts.js +0 -58
  317. package/dist/negotiations/negotiation.screen.d.ts +0 -78
  318. package/dist/negotiations/negotiation.screen.js +0 -112
  319. package/dist/negotiations/negotiation.stall-gap.d.ts +0 -83
  320. package/dist/negotiations/negotiation.stall-gap.js +0 -152
  321. package/dist/negotiations/negotiation.stance.contracts.d.ts +0 -123
  322. package/dist/negotiations/negotiation.stance.contracts.js +0 -317
  323. package/dist/negotiations/negotiation.state.d.ts +0 -597
  324. package/dist/negotiations/negotiation.state.js +0 -286
  325. package/dist/negotiations/negotiation.summarizer.d.ts +0 -25
  326. package/dist/negotiations/negotiation.summarizer.js +0 -101
  327. package/dist/negotiations/negotiation.task-lock-policy.d.ts +0 -10
  328. package/dist/negotiations/negotiation.task-lock-policy.js +0 -22
  329. package/dist/negotiations/negotiation.tools.d.ts +0 -18
  330. package/dist/negotiations/negotiation.tools.js +0 -842
  331. package/dist/negotiations/negotiation.tools.port.d.ts +0 -17
  332. package/dist/negotiations/negotiation.turn-cap.d.ts +0 -9
  333. package/dist/negotiations/negotiation.turn-cap.js +0 -12
  334. package/dist/networks/indexer.state.js +0 -112
  335. package/dist/networks/network.tools.d.ts +0 -36
  336. package/dist/networks/network.tools.js +0 -594
  337. package/dist/opportunities/delivery-card.cache.d.ts +0 -25
  338. package/dist/opportunities/delivery-card.cache.js +0 -43
  339. package/dist/opportunities/discovery.env.d.ts +0 -20
  340. package/dist/opportunities/discovery.env.js +0 -109
  341. package/dist/opportunities/discriminator/discriminator.adjustments.d.ts +0 -90
  342. package/dist/opportunities/discriminator/discriminator.adjustments.js +0 -141
  343. package/dist/opportunities/discriminator/discriminator.assigner.d.ts +0 -78
  344. package/dist/opportunities/discriminator/discriminator.assigner.js +0 -153
  345. package/dist/opportunities/discriminator/discriminator.env.d.ts +0 -103
  346. package/dist/opportunities/discriminator/discriminator.env.js +0 -103
  347. package/dist/opportunities/discriminator/discriminator.miner.d.ts +0 -114
  348. package/dist/opportunities/discriminator/discriminator.miner.js +0 -228
  349. package/dist/opportunities/discriminator/discriminator.push.d.ts +0 -13
  350. package/dist/opportunities/discriminator/discriminator.push.js +0 -19
  351. package/dist/opportunities/discriminator/discriminator.question.d.ts +0 -58
  352. package/dist/opportunities/discriminator/discriminator.question.js +0 -155
  353. package/dist/opportunities/discriminator/discriminator.scorer.d.ts +0 -32
  354. package/dist/opportunities/discriminator/discriminator.scorer.js +0 -105
  355. package/dist/opportunities/discriminator/discriminator.shadow.d.ts +0 -32
  356. package/dist/opportunities/discriminator/discriminator.shadow.js +0 -90
  357. package/dist/opportunities/discriminator/discriminator.types.d.ts +0 -93
  358. package/dist/opportunities/discriminator/discriminator.types.js +0 -18
  359. package/dist/opportunities/negotiation-context.loader.d.ts +0 -59
  360. package/dist/opportunities/negotiation-context.loader.js +0 -90
  361. package/dist/opportunities/negotiation-evidence/negotiation-evidence.env.d.ts +0 -43
  362. package/dist/opportunities/negotiation-evidence/negotiation-evidence.env.js +0 -44
  363. package/dist/opportunities/negotiation-evidence/negotiation-evidence.extractor.d.ts +0 -24
  364. package/dist/opportunities/negotiation-evidence/negotiation-evidence.extractor.js +0 -188
  365. package/dist/opportunities/negotiation-evidence/negotiation-evidence.miner.d.ts +0 -26
  366. package/dist/opportunities/negotiation-evidence/negotiation-evidence.miner.js +0 -112
  367. package/dist/opportunities/negotiation-evidence/negotiation-evidence.shadow.d.ts +0 -19
  368. package/dist/opportunities/negotiation-evidence/negotiation-evidence.shadow.js +0 -61
  369. package/dist/opportunities/negotiation-evidence/negotiation-evidence.types.d.ts +0 -191
  370. package/dist/opportunities/negotiation-evidence/negotiation-evidence.types.js +0 -18
  371. package/dist/opportunities/negotiation-evidence/negotiation-evidence.verifier.d.ts +0 -34
  372. package/dist/opportunities/negotiation-evidence/negotiation-evidence.verifier.js +0 -91
  373. package/dist/opportunities/negotiation-summary.builder.d.ts +0 -37
  374. package/dist/opportunities/negotiation-summary.builder.js +0 -66
  375. package/dist/opportunities/opportunity.discovery-negotiation-summary.d.ts +0 -14
  376. package/dist/opportunities/opportunity.discovery-negotiation-summary.js +0 -46
  377. package/dist/opportunities/opportunity.enricher.d.ts +0 -71
  378. package/dist/opportunities/opportunity.enricher.js +0 -280
  379. package/dist/opportunities/opportunity.evaluator.d.ts +0 -289
  380. package/dist/opportunities/opportunity.evaluator.js +0 -516
  381. package/dist/opportunities/opportunity.evidence.d.ts +0 -22
  382. package/dist/opportunities/opportunity.evidence.js +0 -87
  383. package/dist/opportunities/opportunity.existing-negotiation.d.ts +0 -79
  384. package/dist/opportunities/opportunity.existing-negotiation.js +0 -118
  385. package/dist/opportunities/opportunity.feed-selection.js +0 -96
  386. package/dist/opportunities/opportunity.graph.d.ts +0 -1611
  387. package/dist/opportunities/opportunity.graph.discovery-strategies.d.ts +0 -109
  388. package/dist/opportunities/opportunity.graph.discovery-strategies.js +0 -451
  389. package/dist/opportunities/opportunity.graph.discovery.d.ts +0 -69
  390. package/dist/opportunities/opportunity.graph.discovery.js +0 -397
  391. package/dist/opportunities/opportunity.graph.evaluation.d.ts +0 -82
  392. package/dist/opportunities/opportunity.graph.evaluation.js +0 -608
  393. package/dist/opportunities/opportunity.graph.js +0 -193
  394. package/dist/opportunities/opportunity.graph.modes.d.ts +0 -538
  395. package/dist/opportunities/opportunity.graph.modes.js +0 -538
  396. package/dist/opportunities/opportunity.graph.negotiate.d.ts +0 -109
  397. package/dist/opportunities/opportunity.graph.negotiate.js +0 -392
  398. package/dist/opportunities/opportunity.graph.persist-node.d.ts +0 -93
  399. package/dist/opportunities/opportunity.graph.persist-node.js +0 -765
  400. package/dist/opportunities/opportunity.graph.prep.d.ts +0 -150
  401. package/dist/opportunities/opportunity.graph.prep.js +0 -381
  402. package/dist/opportunities/opportunity.graph.shared.d.ts +0 -173
  403. package/dist/opportunities/opportunity.graph.shared.js +0 -199
  404. package/dist/opportunities/opportunity.introducer-feature.d.ts +0 -2
  405. package/dist/opportunities/opportunity.introducer-feature.js +0 -4
  406. package/dist/opportunities/opportunity.introducer.d.ts +0 -77
  407. package/dist/opportunities/opportunity.introducer.js +0 -99
  408. package/dist/opportunities/opportunity.labels.js +0 -10
  409. package/dist/opportunities/opportunity.lifecycle.d.ts +0 -63
  410. package/dist/opportunities/opportunity.lifecycle.js +0 -181
  411. package/dist/opportunities/opportunity.module.d.ts +0 -54
  412. package/dist/opportunities/opportunity.module.js +0 -39
  413. package/dist/opportunities/opportunity.newborn-stamping.d.ts +0 -41
  414. package/dist/opportunities/opportunity.newborn-stamping.js +0 -81
  415. package/dist/opportunities/opportunity.owner-approval.d.ts +0 -118
  416. package/dist/opportunities/opportunity.owner-approval.js +0 -34
  417. package/dist/opportunities/opportunity.owner-provenance.d.ts +0 -6
  418. package/dist/opportunities/opportunity.owner-provenance.js +0 -28
  419. package/dist/opportunities/opportunity.persist.d.ts +0 -58
  420. package/dist/opportunities/opportunity.persist.js +0 -145
  421. package/dist/opportunities/opportunity.persistence-admission.d.ts +0 -39
  422. package/dist/opportunities/opportunity.persistence-admission.js +0 -59
  423. package/dist/opportunities/opportunity.state.d.ts +0 -451
  424. package/dist/opportunities/opportunity.state.js +0 -256
  425. package/dist/opportunities/opportunity.tools.cards.d.ts +0 -138
  426. package/dist/opportunities/opportunity.tools.cards.js +0 -212
  427. package/dist/opportunities/opportunity.tools.d.ts +0 -12
  428. package/dist/opportunities/opportunity.tools.js +0 -236
  429. package/dist/opportunities/opportunity.tools.list.d.ts +0 -10
  430. package/dist/opportunities/opportunity.tools.list.js +0 -489
  431. package/dist/opportunities/opportunity.tools.port.d.ts +0 -16
  432. package/dist/opportunities/opportunity.utils.d.ts +0 -217
  433. package/dist/opportunities/opportunity.utils.js +0 -395
  434. package/dist/opportunities/outcome/outcome.env.d.ts +0 -60
  435. package/dist/opportunities/outcome/outcome.env.js +0 -63
  436. package/dist/opportunities/outcome/outcome.hypotheses.d.ts +0 -29
  437. package/dist/opportunities/outcome/outcome.hypotheses.js +0 -117
  438. package/dist/opportunities/outcome/outcome.shadow.d.ts +0 -56
  439. package/dist/opportunities/outcome/outcome.shadow.js +0 -87
  440. package/dist/opportunities/outcome/outcome.types.d.ts +0 -110
  441. package/dist/opportunities/outcome/outcome.types.js +0 -26
  442. package/dist/opportunities/radar/radar.health.d.ts +0 -31
  443. package/dist/opportunities/radar/radar.health.js +0 -75
  444. package/dist/premises/premise.analyzer.d.ts +0 -35
  445. package/dist/premises/premise.analyzer.js +0 -115
  446. package/dist/premises/premise.decomposer.d.ts +0 -69
  447. package/dist/premises/premise.decomposer.js +0 -213
  448. package/dist/premises/premise.graph.d.ts +0 -345
  449. package/dist/premises/premise.graph.js +0 -278
  450. package/dist/premises/premise.indexer.d.ts +0 -35
  451. package/dist/premises/premise.indexer.js +0 -86
  452. package/dist/premises/premise.state.d.ts +0 -67
  453. package/dist/premises/premise.state.js +0 -94
  454. package/dist/premises/premise.tools.d.ts +0 -3
  455. package/dist/premises/premise.tools.js +0 -248
  456. package/dist/questions/question.env.d.ts +0 -27
  457. package/dist/questions/question.env.js +0 -27
  458. package/dist/questions/question.input.d.ts +0 -107
  459. package/dist/questions/question.module.d.ts +0 -30
  460. package/dist/questions/question.module.js +0 -28
  461. package/dist/questions/question.schema.d.ts +0 -1529
  462. package/dist/questions/question.schema.js +0 -420
  463. package/dist/shared/agent/activity-projection.d.ts +0 -271
  464. package/dist/shared/agent/activity-projection.js +0 -254
  465. package/dist/shared/agent/canonical-guidance.d.ts +0 -30
  466. package/dist/shared/agent/canonical-guidance.js +0 -246
  467. package/dist/shared/agent/model.resolver.d.ts +0 -48
  468. package/dist/shared/agent/tool.factory.d.ts +0 -17
  469. package/dist/shared/agent/tool.factory.js +0 -221
  470. package/dist/shared/agent/tool.helpers.d.ts +0 -482
  471. package/dist/shared/agent/tool.helpers.js +0 -232
  472. package/dist/shared/agent/tool.registry.d.ts +0 -25
  473. package/dist/shared/agent/tool.registry.js +0 -76
  474. package/dist/shared/agent/tool.runtime.d.ts +0 -28
  475. package/dist/shared/agent/tool.runtime.js +0 -194
  476. package/dist/shared/agent/tool.scope.d.ts +0 -44
  477. package/dist/shared/agent/tool.scope.js +0 -50
  478. package/dist/shared/agent/utility.tools.d.ts +0 -15
  479. package/dist/shared/agent/utility.tools.js +0 -322
  480. package/dist/shared/assignment/network-assignment.policy.d.ts +0 -61
  481. package/dist/shared/assignment/network-assignment.policy.js +0 -105
  482. package/dist/shared/interfaces/agent-dispatcher.interface.d.ts +0 -100
  483. package/dist/shared/interfaces/agent-dispatcher.interface.js +0 -12
  484. package/dist/shared/interfaces/auth.interface.d.ts +0 -37
  485. package/dist/shared/interfaces/auth.interface.js +0 -1
  486. package/dist/shared/interfaces/chat-message-writer.interface.d.ts +0 -18
  487. package/dist/shared/interfaces/chat-message-writer.interface.js +0 -1
  488. package/dist/shared/interfaces/chat-session.interface.d.ts +0 -23
  489. package/dist/shared/interfaces/chat-session.interface.js +0 -18
  490. package/dist/shared/interfaces/chat-summary.interface.d.ts +0 -16
  491. package/dist/shared/interfaces/chat-summary.interface.js +0 -1
  492. package/dist/shared/interfaces/database.capabilities.d.ts +0 -100
  493. package/dist/shared/interfaces/database.interface.d.ts +0 -16
  494. package/dist/shared/interfaces/database.member-queries.d.ts +0 -219
  495. package/dist/shared/interfaces/database.member-queries.js +0 -4
  496. package/dist/shared/interfaces/database.negotiation.d.ts +0 -329
  497. package/dist/shared/interfaces/database.negotiation.js +0 -26
  498. package/dist/shared/interfaces/database.network-queries.js +0 -4
  499. package/dist/shared/interfaces/database.opportunity-queries.js +0 -4
  500. package/dist/shared/interfaces/delivery-ledger.interface.d.ts +0 -40
  501. package/dist/shared/interfaces/delivery-ledger.interface.js +0 -5
  502. package/dist/shared/interfaces/embedder.interface.d.ts +0 -92
  503. package/dist/shared/interfaces/embedder.interface.js +0 -4
  504. package/dist/shared/interfaces/enrichment-run.interface.d.ts +0 -62
  505. package/dist/shared/interfaces/enrichment-run.interface.js +0 -1
  506. package/dist/shared/interfaces/enrichment.interface.js +0 -1
  507. package/dist/shared/interfaces/negotiation-events.interface.d.ts +0 -77
  508. package/dist/shared/interfaces/negotiation-events.interface.js +0 -6
  509. package/dist/shared/interfaces/negotiation-summary.interface.d.ts +0 -25
  510. package/dist/shared/interfaces/negotiation-summary.interface.js +0 -1
  511. package/dist/shared/interfaces/negotiator-memory.interface.d.ts +0 -58
  512. package/dist/shared/interfaces/negotiator-memory.interface.js +0 -11
  513. package/dist/shared/interfaces/queue.interface.d.ts +0 -23
  514. package/dist/shared/interfaces/queue.interface.js +0 -4
  515. package/dist/shared/interfaces/scraper.interface.js +0 -1
  516. package/dist/shared/interfaces/tool-request-context.interface.d.ts +0 -11
  517. package/dist/shared/interfaces/tool-request-context.interface.js +0 -1
  518. package/dist/shared/observability/request-context.d.ts +0 -27
  519. package/dist/shared/observability/request-context.js +0 -6
  520. package/dist/shared/schemas/mcp-auth.schema.d.ts +0 -87
  521. package/dist/shared/schemas/mcp-auth.schema.js +0 -56
  522. package/dist/shared/schemas/negotiation-digest.schema.d.ts +0 -58
  523. package/dist/shared/schemas/negotiation-digest.schema.js +0 -38
  524. package/dist/shared/schemas/negotiation-state.schema.d.ts +0 -343
  525. package/dist/shared/schemas/negotiation-state.schema.js +0 -81
  526. package/dist/shared/schemas/question-block.fixture.d.ts +0 -12
  527. package/dist/shared/schemas/question-block.fixture.js +0 -39
  528. package/dist/shared/schemas/question-block.schema.d.ts +0 -111
  529. package/dist/shared/schemas/question-block.schema.js +0 -124
  530. package/dist/shared/schemas/structured-question.schema.d.ts +0 -66
  531. package/dist/shared/schemas/structured-question.schema.js +0 -31
  532. package/dist/shared/schemas/underspecification.schema.d.ts +0 -13
  533. package/dist/shared/schemas/underspecification.schema.js +0 -16
  534. /package/dist/{opportunities → internal/opportunities}/opportunity.update-admission.js +0 -0
  535. /package/dist/{opportunities → internal/opportunities}/radar/radar.state.js +0 -0
  536. /package/dist/{shared → internal/shared}/network/metadata.renderer.d.ts +0 -0
  537. /package/dist/{shared → internal/shared}/network/metadata.renderer.js +0 -0
  538. /package/dist/{shared → internal/shared}/observability/debug-meta.sanitizer.d.ts +0 -0
  539. /package/dist/{shared → internal/shared}/observability/debug-meta.sanitizer.js +0 -0
  540. /package/dist/{shared → internal/shared}/observability/performance.d.ts +0 -0
  541. /package/dist/{shared → internal/shared}/observability/performance.js +0 -0
  542. /package/dist/{shared → internal/shared}/observability/trace.d.ts +0 -0
  543. /package/dist/{shared → internal/shared}/observability/trace.js +0 -0
  544. /package/dist/{shared → internal/shared}/utils/claim-safety.d.ts +0 -0
  545. /package/dist/{shared → internal/shared}/utils/claim-safety.js +0 -0
  546. /package/dist/{shared → internal/shared}/utils/telegram-handle.d.ts +0 -0
  547. /package/dist/{shared → internal/shared}/utils/telegram-handle.js +0 -0
  548. /package/dist/{shared/interfaces/database.capabilities.js → platform/database/capabilities.js} +0 -0
  549. /package/dist/{shared/interfaces/database.entities.js → platform/database/entities.js} +0 -0
  550. /package/dist/{shared/interfaces/database.identity-queries.js → platform/database/identity-queries.js} +0 -0
  551. /package/dist/{agents/agent.dispatcher.port.js → platform/database/negotiation.js} +0 -0
  552. /package/dist/{chat/chat.persona.js → platform/database/opportunity-queries.js} +0 -0
  553. /package/dist/{contexts/context.tools.port.js → platform/discovery/embedder.js} +0 -0
  554. /package/dist/{shared/interfaces/scraper.interface.d.ts → platform/discovery/scraper.d.ts} +0 -0
  555. /package/dist/{negotiations/negotiation.deadlock.contracts.js → platform/discovery/scraper.js} +0 -0
  556. /package/dist/{shared/interfaces/enrichment.interface.d.ts → platform/enrichment/ports.d.ts} +0 -0
  557. /package/dist/{negotiations/negotiation.tools.port.js → platform/enrichment/ports.js} +0 -0
  558. /package/dist/{opportunities/opportunity.tools.port.js → platform/runtime/observability.js} +0 -0
  559. /package/dist/{questions/question.input.js → protocol/core.js} +0 -0
  560. /package/dist/{shared → protocol}/schemas/chat-context.schema.d.ts +0 -0
  561. /package/dist/{shared → protocol}/schemas/chat-context.schema.js +0 -0
package/IMPLEMENTATION.md CHANGED
@@ -10,20 +10,68 @@ supported entry point is the package root (`import { ... } from "@indexnetwork/p
10
10
  deep imports are not part of the contract. Every symbol is re-exported explicitly from
11
11
  `src/index.ts` and tagged with a stability tier:
12
12
 
13
- - **Stable** — interfaces, graph factories, agents, `createMcpServer`, the
14
- tool/runtime helpers, and shared schemas. Breaking changes require a major bump.
13
+ - **Stable** — interfaces, graph factories, agents, and shared schemas.
14
+ Breaking changes require a major bump.
15
15
  - **Experimental** (`@experimental`) — advanced graph-state types and internal
16
16
  helpers; may change in a minor release.
17
17
 
18
18
  See [STABILITY.md](./STABILITY.md) for the full policy and the deprecation path,
19
19
  and [CHANGELOG.md](./CHANGELOG.md) for release history.
20
20
 
21
- Internal source is domain-first: `signals`, `communities`, `questions`,
22
- `participant-agents`, `contacts`, and `integrations`; opportunity and negotiation
23
- place state/contracts in `domain/` and workflows/tools in `application/`. The
24
- `intents` capability is instead organized by function behind a single exported
25
- class, `Intents`: files sit flat and named for what they do, with `graph/` and
26
- `intake/` the two multi-file stages that keep a directory.
21
+ Private source under `src/internal/` is domain-first: `agents`, `networks`,
22
+ `opportunities`, with `shared` for cross-cutting model and scope
23
+ helpers. The `intents` capability is
24
+ organized by function behind a single exported class, `Intents`: files sit flat
25
+ and named for what they do, with `graph/` the one multi-file stage
26
+ that keep a directory.
27
+
28
+ `Negotiations` is the autonomous participation capability. It observes current
29
+ state and returns protocol guidance, available actions, and block reasons. Its
30
+ execute path passes a pure protocol decision function into the host's transaction:
31
+ the host locks current membership, intent, and negotiation state, evaluates the
32
+ function, and atomically applies the turn and opportunity transition.
33
+ `openCounterparties` likewise receives the protocol's opening decision callback.
34
+ The protocol enforces 12 total turns, leaving exhausted matches undecided, and
35
+ A2A agreement only advances to pending owner review. `NegotiationContextDatabase`
36
+ continues to provide scoped turn logs for opportunity presentation.
37
+
38
+ Personal-agent reasoning and H2A communication live in the independent
39
+ `@indexnetwork/agent` package. The API imports both libraries and supplies
40
+ persistence, principal context, models, and events. The scenario TUI uses the same
41
+ protocol capability with memory storage. Neither library imports the other.
42
+
43
+ ## Boundary model
44
+
45
+ The package is migrating incrementally to a protocol kernel. `protocol/`
46
+ contains portable, framework-free contracts and shared protocol instructions; `platform/` contains host-facing
47
+ ports and supported runtime hooks; and `capabilities/` exposes small named
48
+ behavior surfaces. Graphs, internal model prompts, retrieval, and agent helpers remain
49
+ private implementation. These are source boundaries only: import supported
50
+ symbols from `@indexnetwork/protocol`, not source subpaths. See
51
+ [docs/protocol-kernel.md](./docs/protocol-kernel.md) for migration status.
52
+
53
+ ## Shared protocol instructions
54
+
55
+ [`src/protocol/protocol.prompt.ts`](./src/protocol/protocol.prompt.ts) owns shared
56
+ protocol instruction text in named constants. The module depends only
57
+ on the negotiation limits, with no models, hosts, environment variables, or
58
+ transport implementations.
59
+
60
+ | Prompt or content | Consumer |
61
+ |---|---|
62
+ | `NEGOTIATION_GUIDANCE` | `protocol/negotiation.rules.ts`: `observeNegotiation` returns it to negotiation hosts; also the canonical `negotiations` topic |
63
+ | `CANONICAL_GUIDANCE_SUMMARY`, `CANONICAL_GUIDANCE_TOPICS`, `CANONICAL_GUIDANCE_TOPICS_CONTENT` | The host's `GET /api/docs`: summary, topic metadata, and canonical sections |
64
+
65
+ The host picks the topic and shapes the response.
66
+ `negotiation.rules.ts` keeps validation and transitions. Guidance and enforcement
67
+ share limits from
68
+ [`src/protocol/negotiation.constants.ts`](./src/protocol/negotiation.constants.ts).
69
+ Internal model prompts and personal-agent prompt composition stay with their
70
+ existing owners.
71
+
72
+ These paths describe internal ownership, not new public APIs. The package root
73
+ continues to export `NEGOTIATION_GUIDANCE`, `NEGOTIATION_MAX_TURNS`, and
74
+ `NEGOTIATION_MESSAGE_LIMIT` directly from their owning modules.
27
75
 
28
76
 
29
77
  ## Install
@@ -38,118 +86,55 @@ npm install @indexnetwork/protocol
38
86
 
39
87
  The package reads `OPENROUTER_API_KEY` (required), `CHAT_MODEL`, and `CHAT_REASONING_EFFORT` from environment variables. No startup call is needed.
40
88
 
41
- Environment variables are the supported way to configure models. `CHAT_MODEL` and `CHAT_REASONING_EFFORT` (`minimal | low | medium | high | xhigh`) drive the built-in chat runtime (`ChatGraphFactory` / `ChatAgent`); every other protocol agent — evaluators, generators, miners — reads `OPENROUTER_API_KEY` from the environment.
89
+ Environment variables are the supported way to configure models. `CHAT_MODEL` and `CHAT_REASONING_EFFORT` (`minimal | low | medium | high | xhigh`) drive the default model; every protocol agent reads `OPENROUTER_API_KEY` from the environment.
42
90
 
43
- There is a per-instance `modelConfig` (chat model, reasoning effort, `apiKey`, `baseURL`) that `ChatAgent` reads off the resolved tool context, but it lives on the internal composition types (`ToolContext` / `ProtocolDeps`), not on `ToolDeps`, and those types are not exported. **Programmatic model override is therefore not part of the public contract in 15.0.0** — use the environment variables. If you need a typed override path, open an issue rather than reaching through a deep import.
91
+ Programmatic model override is not part of the public contract — use the environment variables. If you need a typed override path, open an issue rather than reaching through a deep import.
44
92
 
45
93
  ### 2. Implement the adapters
46
94
 
47
95
  The package defines interfaces — your application provides the concrete implementations.
48
96
 
49
- **Required** (always needed by the tool registry):
97
+ **Required** (always needed by the graphs):
50
98
 
51
99
  | Interface | Responsibility |
52
100
  |---|---|
53
- | `ChatGraphCompositeDatabase` | Core data access (users, intents, indexes/networks, opportunities) |
101
+ | `CompositeDatabase` | Core data access (users, intents, networks, opportunities) |
54
102
  | `UserDatabase` / `SystemDatabase` | Context-bound databases built by `createUserDatabase` / `createSystemDatabase` |
55
103
  | `Embedder` | Vector embeddings for semantic search |
56
104
  | `Scraper` | Web content extraction |
57
- | `Cache` / `HydeCache` | Result caching (HyDE may share the general cache) |
58
- | `IntegrationAdapter` | OAuth and external tool actions |
59
- | `IntentGraphQueue` | Background intent processing queue |
60
- | `ContactServiceAdapter` | Contact management |
61
- | `ChatSessionReader` | Load conversation history |
105
+ | `Cache` / `OpportunityCache` | Presentation/result caching |
106
+ | `IntentFollowUp` | Lifecycle follow-up (`scoreIntent`, `onIntentSaved`, `onIntentArchived`, `onIntentResumed`) |
62
107
  | `ProfileEnricher` | Enrich profiles from external sources |
63
- | `NegotiationGraphDatabase` | Negotiation state persistence |
108
+ | `NegotiationDatabase` | Current negotiation state and atomic commit with the supplied protocol decision function |
109
+ | `NegotiationContextDatabase` | Read-only negotiation turn log, for opportunity presentation (folded into `CompositeDatabase`) |
64
110
 
65
111
  **Optional** (enable specific capabilities; omit to run without that feature):
66
112
 
67
113
  | Interface | Responsibility |
68
114
  |---|---|
69
- | `AgentDatabase` | Agent registry CRUD (agents, transports, permissions) |
70
- | `AgentDispatcher` | Resolves and invokes personal agents during negotiation turns — required to register the negotiation tools |
71
- | `McpAuthResolver` | Resolves `{ userId, agentId }` from an incoming MCP HTTP request (MCP server only) |
72
- | `DeliveryLedger` | Commits OpenClaw opportunity-delivery rows |
73
- | `EnrichmentRunStore` / `EnrichmentRunQueue` | Persist and execute async MCP enrichment runs |
74
- | `MintConnectLink` | Mints short connect links for opportunity accepts |
75
- | `ChatSummaryReader` | Read-through chat-session digest |
76
- | `ChatMessageWriter` | Writes user messages into the most-recent chat session (MCP elicitation) |
77
- | `QuestionGeneratorReader` / `QuestionerDatabase` | Decision-question generation and persistence |
78
- | `NegotiationSummaryReader` | Negotiation-digest summarization (falls back to deterministic digests) |
115
+ | `AgentDatabase` | Agent registry CRUD (agents, permissions) |
79
116
 
80
117
  All interfaces are exported from the package root — import them with `import type { ... } from "@indexnetwork/protocol"`.
81
118
 
82
- ### 3. Create tools
83
-
84
- Two entry points are supported, both taking a single dependency object built
85
- from the adapters above.
86
-
87
- `createMcpServer` is the complete integration: it composes every capability's
88
- tools internally, applies the authorization policy, and returns a ready MCP
89
- server.
90
-
91
- ```typescript
92
- import { createMcpServer, CANONICAL_MCP_CAPABILITY_POLICY_OPTIONS } from "@indexnetwork/protocol";
93
-
94
- const server = createMcpServer(
95
- deps, // ToolDeps + the opportunity owner-approval port
96
- authResolver, // McpAuthResolver
97
- scopedDepsFactory, // ScopedDepsFactory — builds per-user scoped userDb/systemDb
98
- CANONICAL_MCP_CAPABILITY_POLICY_OPTIONS,
99
- authorizationObserver, // optional McpAuthorizationObserver
100
- );
101
- ```
102
-
103
- `createToolRegistry` is the lower-level surface for hosts running their own
104
- runtime. It returns a `Map` of tool name to `RawToolDefinition` — raw async
105
- handlers taking `{ context, query }` — which you invoke through
106
- `invokeToolRuntime`:
107
-
108
- ```typescript
109
- import { createToolRegistry, invokeToolRuntime, resolveChatContext } from "@indexnetwork/protocol";
110
-
111
- const registry = createToolRegistry(deps, { surface: "mcp" }); // omit `surface` for the full REST set
112
-
113
- const context = await resolveChatContext({
114
- database, // the ChatGraphCompositeDatabase reads listed above
115
- userId: "user-uuid",
116
- networkId, // optional — scopes tools to one network
117
- sessionId, // optional — enables draft opportunities
118
- });
119
-
120
- const tool = registry.get("search_intents")!;
121
- const result = await invokeToolRuntime({
122
- toolName: tool.name,
123
- tool,
124
- context,
125
- query: { /* validated against tool.schema */ },
126
- });
127
- ```
119
+ ### 3. Compile the graphs
128
120
 
129
- The dependency object carries the required adapters listed above; optional
130
- capabilities default to a degraded-but-functional mode when omitted (for
131
- example, without `agentDispatcher` the negotiation tools are not registered).
121
+ Intent/network graph factories take the adapters above and return compiled LangGraphs.
122
+ Opportunity read and lifecycle operations are plain async functions. The database ports
123
+ `updateOpportunityStatus(id, status, acceptedBy?)` and
124
+ `stampOpportunityActorAction(id, actorUserId, status, acceptedBy?)` do not capture
125
+ outcome feedback or accept an outbox. Negotiation outcomes remain part of the
126
+ negotiation state and presentation contracts.
132
127
 
133
- The per-capability tool factories behind these entry points
134
- (`createChatTools`, `createIntentTools`, `createNegotiationTools`, …) are
135
- package-internal as of 15.0.0 and are not part of the supported surface.
136
- `createEnrichmentTools` remains exported for hosts that run enrichment on its
137
- own worker, separately from the chat runtime.
128
+ Optional capabilities default to a
129
+ degraded-but-functional mode when omitted.
138
130
 
139
131
  ## Graphs
140
132
 
141
- For direct graph invocation (bypassing the tool layer), a `*GraphFactory` class is exported for each workflow:
133
+ A `*GraphFactory` class is exported for each workflow:
142
134
 
143
135
  ```typescript
144
136
  import {
145
- ChatGraphFactory,
146
- OpportunityGraphFactory,
147
- EnrichmentGraphFactory,
148
- PremiseGraphFactory,
149
- NegotiationGraphFactory,
150
- HydeGraphFactory,
151
137
  RadarGraphFactory,
152
- MaintenanceGraphFactory,
153
138
  } from "@indexnetwork/protocol";
154
139
  ```
155
140
 
@@ -162,24 +147,32 @@ The intent and community graphs are the exceptions: they are reached through the
162
147
 
163
148
  | Factory | Workflow |
164
149
  |---|---|
165
- | `ChatGraphFactory` | ReAct chat loop — LLM calls tools, responds to the user |
166
- | `OpportunityGraphFactory` | Background matching: search, evaluate (valency), rank, persist |
167
- | `EnrichmentGraphFactory` | Enrich users (scrape + embed) and decompose into premises |
168
- | `PremiseGraphFactory` | Decompose and index a user's premises |
169
- | `NegotiationGraphFactory` | Multi-turn bilateral negotiation flows |
170
- | `HydeGraphFactory` | Generate hypothetical documents and embed them (cache-aware) |
171
150
  | `RadarGraphFactory` | Build the radar view: flat presenter-card list, optionally intent-scoped |
172
- | `MaintenanceGraphFactory` | Periodic maintenance (feed health, opportunity expiration) |
173
151
 
174
- ### Persisted chat personas
152
+ ## On-demand discovery
175
153
 
176
- `ChatGraphFactory.withPersona()` keeps the runtime neutral while selecting an exported persona configuration. `SIGNAL_PERSONA` and `ONBOARDING_PERSONA` each own an exact positive tool allowlist; shared tools added later remain unavailable until reviewed. `ONBOARDING_PERSONA` reuses Signal's proposal-only, live-membership-narrowed `create_intent` contract and otherwise exposes only privacy consent, approved self-context preview/confirmation, guided questions, and validated completion. Hosts must persist the exported persona ID on session creation and treat it as authoritative on follow-ups.
154
+ Discovery is not a protocol workflow and does not run when a signal is written.
155
+ The host exposes it as a search: the owner's agent sends a query, the host
156
+ embeds it and retrieves candidate signals from the communities that signal is
157
+ shared in, and the agent picks which counterparties are worth an opportunity.
158
+ Nothing is generated ahead of the query and nothing is cached.
159
+
160
+ Protocol owns only what the picks are committed with. The host assigns
161
+ `pairKeyOf(...)` and calls `openCounterparties(pairs, decideNegotiationOpening)`,
162
+ which writes the opportunity and its negotiation; opening rules run inside the
163
+ existing host transaction. Network/broadcast scope remains a protocol rule
164
+ exposed through `resolveDiscoveryNetworkScope`, with context permissions handled
165
+ by `renderDiscoveryNetworkContext`.
166
+
167
+ `IntentFollowUp` therefore has no matching work to schedule: `onIntentSaved`,
168
+ `onIntentArchived`, and `onIntentResumed` exist for hosts that want them and may
169
+ do nothing. `scoreIntent` remains independent metadata work.
177
170
 
178
171
  ## Intents
179
172
 
180
173
  Signals are the protocol's base unit, and the whole capability ships as one
181
- class. `Intents` covers the lifecycle graph, semantic verification, network
182
- indexing, the guided intake interview, and the agent-facing intent tools.
174
+ class. `Intents` covers the lifecycle graph, semantic verification, and payload
175
+ clarification.
183
176
 
184
177
  ```typescript
185
178
  import { Intents } from "@indexnetwork/protocol";
@@ -187,8 +180,7 @@ import { Intents } from "@indexnetwork/protocol";
187
180
  const intents = new Intents({
188
181
  database, // IntentGraphDatabase — required only by createGraph()
189
182
  embedder, // EmbeddingGenerator
190
- queue, // IntentGraphQueue
191
- questionerEnqueue, // QuestionerEnqueueFn
183
+ followUp, // IntentFollowUp
192
184
  });
193
185
  ```
194
186
 
@@ -198,108 +190,75 @@ first use, so an unused method costs nothing.
198
190
 
199
191
  | Method | Purpose |
200
192
  |---|---|
201
- | `createGraph()` | Compile the lifecycle graph — prep, infer, verify, reconcile, execute. Requires `database` |
193
+ | `createGraph()` | Prepare and create exactly one new signal; explicitly read, update, archive, or transition existing signals. Requires `database` |
202
194
  | `verifyIntent(content, profileContext)` | Felicity conditions, speech-act classification, semantic entropy, specificity |
203
- | `indexIntent(intent, indexPrompt, memberPrompt, sourceName?, networkContext?)` | Score one signal against one network; `null` when the model call fails |
204
- | `generateIntakePack(input)` | The participant's intake brief and round-1 question |
205
- | `generateIntakeFollowUps(input)` | Plan and write the next follow-up questions |
206
- | `synthesizeIntake(input)` | Turn answered rounds into a description and card summary |
207
- | `Intents.createTools(defineTool, deps)` | Register the agent-facing intent tools |
208
- | `Intents.normalizeDescription(description)` | Normalize a description to its persisted form |
209
- | `Intents.FALLBACK_INTAKE_QUESTION` | The static round-1 question used when generation is unavailable |
195
+ | `prepare({ payload, answers? })` | Fold recovery answers into the draft, then return `ready` with metadata or `needs_revision` with admission feedback and a dynamic recovery form; model failures throw for retry |
196
+ | `scoreIntent(content, profileContext?)` | Measure saved text without admission filters; a negative verdict still returns metadata |
197
+ | `Intents.normalizeDescription(description)` | Normalize an explicit update description; creation preserves text verbatim |
198
+
199
+ Creation with `inputContent` prepares the description once and persists that exact
200
+ text in a new record, even if a similar signal exists. Guided hosts call `prepare`
201
+ until it returns `ready`, then issue their own authenticated preparation receipt
202
+ bound to the owner and admitted draft. After authenticating the receipt, pass
203
+ `preparation: { metadata }` to `createGraph().invoke()` alongside the final
204
+ `inputContent`. If the user edited the text, pass `metadata: null`: permission to
205
+ create survives revisions, but the draft's scores do not describe the edited text.
206
+ Never accept this graph input directly from an untrusted client.
207
+
208
+ No inference, admission, or reconciliation runs on prepared creation. The graph
209
+ persists first and invokes `IntentFollowUp.scoreIntent` for revised text. Hosts
210
+ must run scoring as best-effort background work, apply only metadata while the
211
+ owner and payload still match, and leave the saved record usable on negative
212
+ verdicts or failures. Authentication, nonempty text, length limits, and network
213
+ membership remain the host's responsibility.
210
214
 
211
215
  ## Networks
212
216
 
213
217
  Communities ship the same way: one class covering the community lifecycle graph,
214
- the membership graph, signal↔community assignment, and the agent-facing
215
- community tools.
218
+ the membership graph, and signal↔community assignment.
216
219
 
217
220
  ```typescript
218
221
  import { Networks } from "@indexnetwork/protocol";
219
222
 
220
223
  const networks = new Networks({
221
- database, // community, roster, and assignment persistence
222
- indexer: intents, // an `Intents` instance — scores a signal against a community
224
+ database, // community, roster, and assignment persistence
223
225
  });
224
226
  ```
225
227
 
226
- Both dependencies are optional; each method names what it requires, so a host
227
- that only registers tools can construct `new Networks()` with nothing.
228
+ The dependency is optional; each method names what it requires, so
229
+ construction never fails.
228
230
 
229
231
  | Method | Purpose |
230
232
  |---|---|
231
233
  | `createGraph()` | Compile the community lifecycle graph — create, read, update, delete. Requires `database` |
232
234
  | `createMembershipGraph()` | Compile the roster graph — add, list, remove members. Requires `database` |
233
- | `createAssignmentGraph()` | Compile signal↔community assignment, direct or model-evaluated. Requires `database` and `indexer` |
234
- | `Networks.createTools(defineTool, deps)` | Register the agent-facing community tools |
235
+ | `createAssignmentGraph()` | Compile signal↔community assignment — link and unlink. Requires `database` |
235
236
 
236
- Assignment takes an `Intents` instance as its evaluator — the `indexer`
237
- dependency is narrowed to the single `indexIntent` method it calls.
237
+ Assignment applies no scoring policy: a link exists because the signal's owner
238
+ asked for it, so the row is written at score 1 with `mode: manual_override`.
238
239
 
239
- ## MCP server
240
+ ## The REST API and the CLI
240
241
 
241
- The package exports a factory that registers every chat tool over the Model Context Protocol and attaches a canonical `instructions` block (`MCP_INSTRUCTIONS`) that every connecting runtime follows. The factory takes three arguments:
242
+ External agents use `@indexnetwork/cli` against the host's REST API. Every
243
+ capability is a named resource — `/api/intents`, `/api/networks`,
244
+ `/api/opportunities`, `/api/negotiations`, `/api/conversations`, `/api/scrape`,
245
+ `/api/docs` — and the user's single event stream is `GET /api/events`. Ownership
246
+ and network membership checks live in the host's controllers and services.
242
247
 
243
- ```typescript
244
- import { createMcpServer, type McpAuthResolver } from "@indexnetwork/protocol";
245
-
246
- const authResolver: McpAuthResolver = {
247
- async resolveIdentity(req) {
248
- // Look up the API key in `x-api-key` and return { userId, agentId? }.
249
- // `agentId` should come from Better Auth token metadata so downstream
250
- // tool handlers can attribute every call to a concrete agent identity.
251
- return resolveFromApiKey(req);
252
- },
253
- };
254
-
255
- const server = createMcpServer(
256
- deps,
257
- authResolver,
258
- {
259
- // Per-request factory for scoped user/system databases.
260
- create: (userId, indexScope) => createScopedDeps(userId, indexScope),
261
- },
262
- );
248
+ ```bash
249
+ index --api-url https://protocol.index.network docs --json
250
+ index --api-url https://protocol.index.network docs workflows --json
251
+ index --api-url https://protocol.index.network intent list --json
263
252
  ```
264
253
 
265
- On every tool call the server:
266
-
267
- 1. Extracts the HTTP request from the MCP `ServerContext`.
268
- 2. Calls `authResolver.resolveIdentity(req)` to get `{ userId, agentId }`.
269
- 3. Gates access through the canonical capability policy (`mcp/mcp.authorization-policy.ts`), decided per resolved principal BEFORE any context read or scoped-deps creation:
270
- - **Enrollment-capable unregistered API keys** may see and call only `register_agent` — single-purpose across the entire registry.
271
- - **Plain unregistered API keys** fail closed on every tool.
272
- - **Registered active agents** retain their canonical permission- and network-scope-authorized domain tools, `read_docs`, and (for designated delivery agents) `confirm_opportunity_delivery`; within the agent-administration family (`MCP_AGENT_ADMIN_TOOLS`) they may see and call only `read_own_agent`, which returns the caller's own sanitized record and accepts no target.
273
- - **Session humans** administer their owned agents (`register_agent`, `list_agents`, `update_agent`, `delete_agent`, `grant_agent_permission`, `revoke_agent_permission`) but are never offered the agent-only `read_own_agent`.
274
- - Contact/Gmail-import tools, `scrape_url`, and the deprecated `*_user_profile`/`*_profile_run` aliases are not registered on the MCP surface at all (IND-596/597/598).
275
- 4. Builds per-request scoped databases via `scopedDepsFactory` and invokes the tool handler through the shared runtime.
276
-
277
- ### Runtime controls
278
-
279
- MCP tools are bounded by `ToolInvocationRuntime`:
280
-
281
- | Class | Default | Class override |
282
- |---|---:|---|
283
- | `fast` | 10 s | `MCP_TOOL_TIMEOUT_FAST_MS` |
284
- | `bounded_slow` | 45 s | `MCP_TOOL_TIMEOUT_BOUNDED_SLOW_MS` |
285
- | `async_candidate` | 50 s | `MCP_TOOL_TIMEOUT_ASYNC_CANDIDATE_MS` |
286
-
287
- Per-tool timeout overrides use `MCP_TOOL_TIMEOUT_<TOOL_NAME>_MS`. Tool outputs are capped by `MCP_TOOL_MAX_OUTPUT_BYTES` (default `1000000`) or `MCP_TOOL_MAX_OUTPUT_<TOOL_NAME>_BYTES`; inbound MCP request bodies are capped by the backend with `MCP_MAX_REQUEST_BYTES` (default `1000000`). Runtime failures return JSON text envelopes with stable `code` values: `TOOL_TIMEOUT`, `TOOL_CANCELLED`, or `TOOL_OUTPUT_TOO_LARGE`.
288
-
289
-
290
- ### `MCP_INSTRUCTIONS`
291
-
292
- The instructions string is the single canonical behavioral contract for every runtime that connects to Index Network — voice, entity model, discovery-first rule, output rules, and the **Negotiation turn mode** block that tells a silent subagent how to handle a live negotiation turn when its session key is prefixed `index:negotiation:`. Plugin skills and bootstrap scripts do **not** redefine this guidance; they defer to whatever ships in `MCP_INSTRUCTIONS`.
293
-
294
- ### Negotiation-facing tools
295
-
296
- Personal agents participate in bilateral negotiation via a small set of MCP tools:
297
-
298
- | Tool | Purpose |
299
- |---|---|
300
- | `get_negotiation` | Fetch the full turn history and assessment seed for a negotiation |
301
- | `list_negotiations` | List current and concluded agent negotiations with lifecycle-explicit opportunity and owner-action narration |
302
- | `respond_to_negotiation` | Submit a turn (propose / counter / accept / reject / question) |
254
+ `GET /api/docs` serves canonical protocol guidance, including the resource
255
+ routes and negotiation rules. Integrations read that guidance before writing.
256
+ `GET /api/negotiations` lists the seat's negotiations across every opportunity;
257
+ one negotiation is observed and turned through its opportunity, at
258
+ `GET /api/opportunities/:id/negotiation` and
259
+ `POST /api/opportunities/:id/negotiation/turns`, because exactly one is written
260
+ with each opportunity. Personal-agent conversations require an intent scope and
261
+ the current question ID when answering a pending question.
303
262
 
304
263
  ## Publishing
305
264
 
package/README.md CHANGED
@@ -24,7 +24,6 @@ flowchart LR
24
24
  Participant --> Context[Context]
25
25
  Participant --> Signal[Signal]
26
26
 
27
- Premises[Premises] --> Context
28
27
  Context --> Scope[Effective scope]
29
28
  Signal --> Scope
30
29
  Community[Community membership and norms] --> Scope
@@ -54,7 +53,7 @@ The graph is intentionally consent-centered: agents can construct context, disco
54
53
  3. **Semantic discovery** — matching is based on role fit, constraints, complementarity, and contextual relevance rather than exact keyword overlap.
55
54
  4. **Explainable surfacing** — every surfaced opportunity SHOULD include a legible reason: why these participants, why now, and what the next action might be.
56
55
  5. **Consent at relationship boundaries** — agents MAY discover and negotiate, but MUST NOT create or accept a relationship without explicit participant approval.
57
- 6. **Agent interoperability** — first-party agents, personal agents, community agents, and external MCP clients SHOULD be able to participate under the same behavioral contract.
56
+ 6. **Agent interoperability** — first-party agents, personal agents, community agents, and external CLI clients SHOULD be able to participate under the same behavioral contract.
58
57
 
59
58
  ## Non-goals
60
59
 
@@ -74,8 +73,7 @@ The protocol does not attempt to be:
74
73
  | **Participant** | A human principal represented in the network. A participant may act directly or through one or more agents. |
75
74
  | **Agent** | A software actor authorized to act for a participant or community within a declared scope. |
76
75
  | **Signal** | A participant's actionable expression of intent: what they seek, offer, need, are building, are exploring, or can support. |
77
- | **Premise** | An atomic contextual claim about a participant, used to ground what signals are plausible or relevant. |
78
- | **Context** | A synthesized representation of premises, history, constraints, and community-specific relevance. |
76
+ | **Context** | A synthesized representation of a participant's identity, history, constraints, and community-specific relevance. |
79
77
  | **Community** | A bounded discovery scope with membership, purpose, norms, and relevance criteria. |
80
78
  | **Membership** | The relationship between a participant and a community. Agents receive community authority through separate scoped permissions. |
81
79
  | **Candidate** | A possible counterpart or opportunity component identified during discovery but not yet surfaced. |
@@ -91,7 +89,6 @@ Some implementation APIs may expose historical names such as `intent`, `index`,
91
89
  erDiagram
92
90
  PARTICIPANT ||--o{ AGENT : authorizes
93
91
  PARTICIPANT ||--o{ SIGNAL : expresses
94
- PARTICIPANT ||--o{ PREMISE : asserts
95
92
  PARTICIPANT ||--o{ CONTEXT : represented_by
96
93
  PARTICIPANT ||--o{ MEMBERSHIP : holds
97
94
  AGENT ||--o{ AGENT_PERMISSION : receives
@@ -180,7 +177,7 @@ A broader credential MUST NOT expand a narrower request. A narrower agent permis
180
177
 
181
178
  The protocol separates internal state from participant-facing language.
182
179
 
183
- Internal records MAY contain IDs, embeddings, scores, graph state, and tool names. Participant-facing responses MUST NOT expose these implementation details unless an identifier is directly actionable by the participant, such as a conversation identifier needed to open an accepted connection.
180
+ Internal records MAY contain IDs, embeddings, scores, and graph state. Participant-facing responses MUST NOT expose these implementation details unless an identifier is directly actionable by the participant, such as a conversation identifier needed to open an accepted connection.
184
181
 
185
182
  ## Core objects
186
183
 
@@ -202,13 +199,13 @@ Signals have the following conceptual lifecycle:
202
199
 
203
200
  A signal MUST NOT be treated as active if it is outside the participant's authority, obviously insincere, unsafe to act on, or too vague to evaluate.
204
201
 
205
- ### Premise and context
202
+ ### Context
206
203
 
207
- A premise is a small claim about a participant: background, role, current work, capability, location, affiliation, constraint, or declared preference. Premises ground discovery by determining whether a signal is plausible and which communities or counterparts are relevant.
204
+ Context describes a participant: background, role, current work, capability, location, affiliation, constraints, and declared preferences. It grounds discovery by determining whether a signal is plausible and which communities or counterparts are relevant.
208
205
 
209
- Context is derived from premises. Context MAY be global to a participant or specific to a community. Community-specific context SHOULD emphasize facts relevant to that community's purpose and suppress irrelevant detail.
206
+ Context MAY be global to a participant or specific to a community. Community-specific context SHOULD emphasize facts relevant to that community's purpose and suppress irrelevant detail.
210
207
 
211
- Premise and context updates SHOULD cause downstream discovery representations to refresh. Stale context SHOULD NOT be used when fresher participant-approved context exists.
208
+ Context updates SHOULD cause downstream discovery representations to refresh. Stale context SHOULD NOT be used when fresher participant-approved context exists.
212
209
 
213
210
  ### Community
214
211
 
@@ -316,7 +313,7 @@ sequenceDiagram
316
313
 
317
314
  ### 1. Context construction
318
315
 
319
- The protocol collects participant-provided or participant-authorized material and turns it into premises and context. Context construction MUST preserve provenance and SHOULD prefer participant-approved information over inferred information.
316
+ The protocol collects participant-provided or participant-authorized material and turns it into context. Context construction MUST preserve provenance and SHOULD prefer participant-approved information over inferred information.
320
317
 
321
318
  ### 2. Signal admission
322
319
 
@@ -328,7 +325,7 @@ The protocol determines the effective communities in which the signal can operat
328
325
 
329
326
  ### 4. Candidate generation
330
327
 
331
- The protocol generates candidates by comparing signals and context inside the effective scope. Candidate generation MAY use multiple strategies, including signal-to-signal, context-to-signal, premise-to-premise, semantic retrieval, and directed target construction.
328
+ The protocol generates candidates by comparing signals and context inside the effective scope. Candidate generation MAY use multiple strategies, including signal-to-signal, context-to-signal, semantic retrieval, and directed target construction.
332
329
 
333
330
  Candidate generation is not surfacing. Candidate data MUST remain internal until evaluation and visibility checks pass.
334
331
 
@@ -352,7 +349,7 @@ A conforming agent MUST:
352
349
 
353
350
  - act only within its authenticated participant and community scope,
354
351
  - preserve participant consent at send, accept, and connection boundaries,
355
- - avoid exposing internal IDs, raw tool results, embeddings, scores, or database field names,
352
+ - avoid exposing internal IDs, raw graph results, embeddings, scores, or database field names,
356
353
  - distinguish known facts from inferred context,
357
354
  - ask for clarification when required information is missing,
358
355
  - use the protocol vocabulary in participant-facing output,
@@ -389,21 +386,20 @@ The following invariants define the protocol's trust boundary:
389
386
 
390
387
  ## Interoperability
391
388
 
392
- The reference implementation exposes the protocol to agents through a Model Context Protocol (MCP) server and typed package APIs. MCP is the preferred interoperability surface for external agents because it provides tool discovery, runtime instructions, identity resolution, and bounded tool invocation.
389
+ The reference implementation exposes the protocol through a REST API and typed package APIs. External agents use the Index CLI against those resources, reading canonical guidance from `GET /api/docs`. The API resolves identity and enforces ownership, network scope, and protocol rules.
393
390
 
394
391
  ```mermaid
395
392
  flowchart LR
396
- ExternalAgent[External agent] -->|MCP tools| McpServer[Index Network MCP server]
393
+ ExternalAgent[External agent] --> CLI[Index CLI]
394
+ CLI --> HTTP[Index REST API]
397
395
  FirstPartyAgent[First-party agent] -->|typed runtime| Runtime[Protocol runtime]
398
- PersonalAgent[Personal agent] -->|MCP tools or REST polling| McpServer
399
396
 
400
- McpServer --> Identity[Identity resolution]
397
+ HTTP --> Identity[Identity resolution]
401
398
  Identity --> AgentGate[Agent registration and scope]
402
399
  AgentGate --> ScopedDeps[Scoped protocol dependencies]
403
400
  ScopedDeps --> Runtime
404
401
 
405
- Runtime --> Tools[Protocol tools]
406
- Tools --> Graphs[Discovery, context, signal, negotiation graphs]
402
+ Runtime --> Graphs[Discovery, context, signal graphs]
407
403
  Graphs --> Results[Bounded results]
408
404
  Results --> Runtime
409
405
  Runtime --> ParticipantOutput[Participant-facing output rules]
@@ -422,6 +418,6 @@ Implementations MAY expose additional transports, but they SHOULD preserve the s
422
418
 
423
419
  The canonical TypeScript implementation is `@indexnetwork/protocol`.
424
420
 
425
- - [IMPLEMENTATION.md](./IMPLEMENTATION.md) — package installation, adapters, graph factories, MCP server usage, and publishing.
421
+ - [IMPLEMENTATION.md](./IMPLEMENTATION.md) — package installation, adapters, graph factories, REST API and CLI usage, and publishing.
426
422
  - [STABILITY.md](./STABILITY.md) — public API contract and SemVer policy.
427
423
  - [CHANGELOG.md](./CHANGELOG.md) — release history.
package/STABILITY.md CHANGED
@@ -10,8 +10,7 @@ change. It is the reference behind the tier annotations in `src/index.ts`.
10
10
  - The supported entry points are the package root:
11
11
  `import { ... } from "@indexnetwork/protocol"` — and the **browser-safe
12
12
  subpaths** listed in `package.json` `exports` (as of 21.1.0:
13
- `@indexnetwork/protocol/question-block` and
14
- `@indexnetwork/protocol/question-block/fixture`). A browser-safe subpath
13
+ package root. There are no supported browser subpaths.
15
14
  exposes one shared-schema module whose only runtime dependency is `zod`, for
16
15
  consumers (the web client) that cannot load the node-only package root. The
17
16
  schema module's symbols are also re-exported from the root (the fixture is
@@ -30,6 +29,9 @@ change. It is the reference behind the tier annotations in `src/index.ts`.
30
29
  as a class rather than a re-export list — `intents` does, via `Intents` in
31
30
  `intents/intent.module.ts` — which makes the whole capability one exported
32
31
  symbol and its internal layout free to change without a contract change.
32
+ - `protocol/`, `platform/`, `capabilities/`, and `internal/` are source-level
33
+ boundaries, not consumer subpaths. The sole supported Node import remains the
34
+ package root.
33
35
 
34
36
  ## Stability tiers
35
37
 
@@ -41,14 +43,17 @@ Covered by SemVer below. Breaking changes require a **major** bump.
41
43
 
42
44
  | Barrel section | What it is |
43
45
  |---|---|
44
- | **Public API** | `createToolRegistry`, model config helpers, tool/runtime helpers (`ResolvedToolContext`, `ToolDeps`, `invokeToolRuntime`, …), `requestContext`. |
45
- | **Interfaces** | Every `*.interface.ts` port you implement to inject infrastructure (databases, embedder, cache, scraper, queues, integration, agent dispatcher, …). |
46
- | **Shared schemas** | Zod schemas + inferred types that cross the boundary (questions, identity, network-assignment, chat-context, …). |
47
- | **Graph factories** | `*GraphFactory` classes (`ChatGraphFactory`, `OpportunityGraphFactory`, `NegotiationGraphFactory`, …). |
48
- | **Intents** | `Intents` — the whole signal capability as one class (lifecycle graph, verification, network indexing, guided intake, tools) plus `IntentsDeps` and the intake/indexer types. Replaced the six separate intent exports in 18.0.0. |
49
- | **Agents** | Structured LLM agents (`UserContextGenerator`, `IndexNegotiator`, `OpportunityEvaluator`, …). |
50
- | **MCP** | `createMcpServer` plus the types needed to call it: `ScopedDepsFactory`, `McpCapabilityPolicyOptions`, `CANONICAL_MCP_CAPABILITY_POLICY_OPTIONS`, `McpAuthorizationObserver`, `McpAuthorizationDenialEvent`. The rest of `mcp.authorization-policy.ts` is package-internal as of 15.0.0. |
51
- | **Capability tools** | `createEnrichmentTools` only. The other per-capability tool factories became package-internal in 15.0.0 — compose them through `createMcpServer` or `createToolRegistry`. |
46
+ | **Public API** | Model config helpers, request scope helpers (`deriveAllowedNetworkIds`, `deriveDiscoveryNetworkIds`), `requestContext`. |
47
+ | **Interfaces** | Every port you implement to inject infrastructure (databases, embedder, cache, scraper, integration, …). |
48
+ | **Shared schemas** | Zod schemas + inferred types that cross the boundary (underspecification, identity, network-assignment, chat-context, …). |
49
+ | **Graph factories** | `*GraphFactory` classes (for example, `RadarGraphFactory`). |
50
+ | **Intents** | `Intents` — the whole signal capability as one class (lifecycle graph, verification, preparation) plus `IntentsDeps` and the `Prepare*` / `RecoveryField*` types. Replaced the six separate intent exports in 18.0.0. |
51
+ | **Agents** | Structured LLM agents (`OpportunityEvaluator`, …). |
52
+
53
+ `Negotiations`, `NegotiationDatabase`, the opening and turn decision functions,
54
+ the observation function, and `negotiationTurnSchema` are stable. Hosts must
55
+ evaluate supplied decision callbacks against locked current state and commit
56
+ their effects atomically. `openCounterparties` takes the protocol opening callback.
52
57
 
53
58
  ### Experimental
54
59
 
@@ -57,7 +62,7 @@ a major bump. Use at your own risk and pin a version if you depend on them.
57
62
 
58
63
  | Area | What it is |
59
64
  |---|---|
60
- | **States** | Advanced graph-state shapes (`UserNegotiationContext`, `NegotiationTurn`, `NegotiationGraphLike`, …) exposed for advanced graph consumers. |
65
+ | **States** | Advanced graph-state shapes exposed for advanced graph consumers. |
61
66
  | **Internal helpers** | Low-level support utilities re-exported for the backend's own use (selection/eval/evidence helpers) that are not part of the recommended integration surface. |
62
67
 
63
68
  > Most symbols in the barrel are consumed by the Index Network backend itself; a