@indexnetwork/protocol 14.3.2-rc.477.1 → 17.0.0-rc.479.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +141 -0
- package/IMPLEMENTATION.md +50 -52
- package/STABILITY.md +3 -3
- package/dist/chat/chat.agent.js +2 -3
- package/dist/chat/chat.graph.d.ts +41 -1
- package/dist/chat/chat.graph.js +108 -127
- package/dist/chat/negotiator.persona.d.ts +1 -1
- package/dist/chat/negotiator.persona.js +1 -4
- package/dist/chat/negotiator.prompt.js +1 -2
- package/dist/chat/onboarding.persona.js +0 -1
- package/dist/chat/reporter.persona.js +0 -1
- package/dist/chat/signal.persona.js +0 -1
- package/dist/contacts/application/contact.tools.d.ts +6 -9
- package/dist/contacts/application/contact.tools.js +11 -92
- package/dist/contacts/application/index.d.ts +2 -14
- package/dist/contacts/application/index.js +2 -13
- package/dist/contacts/domain/contact.types.d.ts +0 -23
- package/dist/contacts/domain/index.d.ts +2 -6
- package/dist/contacts/index.d.ts +1 -1
- package/dist/contacts/index.js +1 -1
- package/dist/contacts/ports/contact.repository.port.d.ts +5 -12
- package/dist/contacts/ports/contact.repository.port.js +4 -6
- package/dist/contacts/ports/contact.tools.port.d.ts +1 -3
- package/dist/contacts/ports/contact.tools.port.js +1 -2
- package/dist/contacts/ports/index.d.ts +1 -1
- package/dist/contacts/ports/index.js +1 -1
- package/dist/discovery/hyde.frame.d.ts +4 -4
- package/dist/discovery/hyde.graph.d.ts +71 -12
- package/dist/discovery/hyde.graph.js +337 -335
- package/dist/discovery/lens.inferrer.d.ts +6 -6
- package/dist/enrichment/enrichment.graph.d.ts +127 -9
- package/dist/enrichment/enrichment.graph.js +633 -655
- package/dist/enrichment/enrichment.state.d.ts +1 -1
- package/dist/enrichment/enrichment.tools.context-read.d.ts +10 -0
- package/dist/enrichment/enrichment.tools.context-read.js +353 -0
- package/dist/enrichment/enrichment.tools.context-write.d.ts +9 -0
- package/dist/enrichment/enrichment.tools.context-write.js +417 -0
- package/dist/enrichment/enrichment.tools.d.ts +11 -1
- package/dist/enrichment/enrichment.tools.helpers.d.ts +139 -0
- package/dist/enrichment/enrichment.tools.helpers.js +234 -0
- package/dist/enrichment/enrichment.tools.js +16 -975
- package/dist/index.d.ts +27 -50
- package/dist/index.js +17 -28
- package/dist/intents/application/intent.graph.d.ts +71 -67
- package/dist/intents/application/intent.graph.execute.d.ts +59 -0
- package/dist/intents/application/intent.graph.execute.js +301 -0
- package/dist/intents/application/intent.graph.infer.d.ts +44 -0
- package/dist/intents/application/intent.graph.infer.js +97 -0
- package/dist/intents/application/intent.graph.js +96 -888
- package/dist/intents/application/intent.graph.reconcile.d.ts +71 -0
- package/dist/intents/application/intent.graph.reconcile.js +274 -0
- package/dist/intents/application/intent.graph.shared.d.ts +70 -0
- package/dist/intents/application/intent.graph.shared.js +153 -0
- package/dist/intents/domain/intent.state.d.ts +1 -1
- package/dist/maintenance/maintenance.graph.d.ts +66 -3
- package/dist/maintenance/maintenance.graph.js +155 -156
- package/dist/mcp/mcp.authorization-policy.d.ts +24 -28
- package/dist/mcp/mcp.authorization-policy.js +14 -34
- package/dist/mcp/mcp.server.d.ts +3 -3
- package/dist/mcp/mcp.server.js +14 -20
- package/dist/negotiations/application/negotiation.candidates.d.ts +83 -0
- package/dist/negotiations/application/negotiation.candidates.js +162 -0
- package/dist/negotiations/application/negotiation.graph.d.ts +91 -157
- package/dist/negotiations/application/negotiation.graph.finalize.d.ts +5 -0
- package/dist/negotiations/application/negotiation.graph.finalize.js +280 -0
- package/dist/negotiations/application/negotiation.graph.init.d.ts +54 -0
- package/dist/negotiations/application/negotiation.graph.init.js +227 -0
- package/dist/negotiations/application/negotiation.graph.js +69 -1388
- package/dist/negotiations/application/negotiation.graph.screen.d.ts +23 -0
- package/dist/negotiations/application/negotiation.graph.screen.js +108 -0
- package/dist/negotiations/application/negotiation.graph.shared.d.ts +75 -0
- package/dist/negotiations/application/negotiation.graph.shared.js +125 -0
- package/dist/negotiations/application/negotiation.graph.turn.d.ts +105 -0
- package/dist/negotiations/application/negotiation.graph.turn.js +484 -0
- package/dist/negotiations/domain/negotiation.state.d.ts +1 -1
- package/dist/negotiations/domain/negotiation.state.js +0 -1
- package/dist/networks/application/indexer.graph.d.ts +165 -7
- package/dist/networks/application/indexer.graph.js +339 -388
- package/dist/networks/application/indexer.state.d.ts +1 -1
- package/dist/networks/application/membership.graph.d.ts +83 -5
- package/dist/networks/application/membership.graph.js +177 -207
- package/dist/networks/application/network.graph.d.ts +148 -5
- package/dist/networks/application/network.graph.js +249 -278
- package/dist/networks/domain/membership.state.d.ts +1 -1
- package/dist/networks/domain/network.state.d.ts +1 -1
- package/dist/opportunities/application/delivery-card.cache.d.ts +1 -1
- package/dist/opportunities/application/delivery-card.cache.js +2 -2
- package/dist/opportunities/application/index.d.ts +2 -2
- package/dist/opportunities/application/index.js +2 -2
- package/dist/opportunities/application/opportunity.evaluator.js +1 -1
- package/dist/opportunities/application/opportunity.graph.d.ts +686 -473
- package/dist/opportunities/application/opportunity.graph.discovery-strategies.d.ts +109 -0
- package/dist/opportunities/application/opportunity.graph.discovery-strategies.js +451 -0
- package/dist/opportunities/application/opportunity.graph.discovery.d.ts +69 -0
- package/dist/opportunities/application/opportunity.graph.discovery.js +397 -0
- package/dist/opportunities/application/opportunity.graph.evaluation.d.ts +82 -0
- package/dist/opportunities/application/opportunity.graph.evaluation.js +608 -0
- package/dist/opportunities/application/opportunity.graph.js +120 -3690
- package/dist/opportunities/application/opportunity.graph.modes.d.ts +538 -0
- package/dist/opportunities/application/opportunity.graph.modes.js +538 -0
- package/dist/opportunities/application/opportunity.graph.negotiate.d.ts +109 -0
- package/dist/opportunities/application/opportunity.graph.negotiate.js +392 -0
- package/dist/opportunities/application/opportunity.graph.persist-node.d.ts +93 -0
- package/dist/opportunities/application/opportunity.graph.persist-node.js +765 -0
- package/dist/opportunities/application/opportunity.graph.prep.d.ts +150 -0
- package/dist/opportunities/application/opportunity.graph.prep.js +381 -0
- package/dist/opportunities/application/opportunity.graph.shared.d.ts +173 -0
- package/dist/opportunities/application/opportunity.graph.shared.js +199 -0
- package/dist/opportunities/application/opportunity.presentation.d.ts +399 -0
- package/dist/opportunities/application/{opportunity.presenter.js → opportunity.presentation.js} +735 -9
- package/dist/opportunities/application/opportunity.tools.cards.d.ts +152 -0
- package/dist/opportunities/application/opportunity.tools.cards.js +235 -0
- package/dist/opportunities/application/opportunity.tools.d.ts +8 -114
- package/dist/opportunities/application/opportunity.tools.js +28 -711
- package/dist/opportunities/application/opportunity.tools.list.d.ts +10 -0
- package/dist/opportunities/application/opportunity.tools.list.js +493 -0
- package/dist/opportunities/domain/index.d.ts +3 -3
- package/dist/opportunities/domain/index.js +3 -3
- package/dist/opportunities/domain/opportunity.state.d.ts +19 -19
- package/dist/opportunities/index.d.ts +6 -6
- package/dist/opportunities/index.js +4 -4
- package/dist/opportunities/ports/opportunity.tools.port.d.ts +1 -1
- package/dist/opportunities/radar/radar.graph.d.ts +57 -13
- package/dist/opportunities/radar/radar.graph.js +470 -471
- package/dist/premises/premise.graph.d.ts +88 -20
- package/dist/premises/premise.graph.js +207 -218
- package/dist/questions/domain/question.schema.d.ts +40 -40
- package/dist/shared/agent/tool.factory.js +0 -8
- package/dist/shared/agent/tool.helpers.d.ts +21 -45
- package/dist/shared/agent/tool.helpers.js +1 -2
- package/dist/shared/agent/tool.registry.d.ts +4 -3
- package/dist/shared/agent/tool.registry.js +2 -4
- package/dist/shared/agent/tool.runtime.js +0 -2
- package/dist/shared/agent/utility.tools.js +9 -13
- package/dist/shared/interfaces/database.capabilities.d.ts +100 -0
- package/dist/shared/interfaces/database.capabilities.js +7 -0
- package/dist/shared/interfaces/database.entities.d.ts +533 -0
- package/dist/shared/interfaces/database.entities.js +10 -0
- package/dist/shared/interfaces/database.identity-queries.d.ts +294 -0
- package/dist/shared/interfaces/database.identity-queries.js +4 -0
- package/dist/shared/interfaces/database.interface.d.ts +15 -2277
- package/dist/shared/interfaces/database.interface.js +8 -0
- package/dist/shared/interfaces/database.member-queries.d.ts +221 -0
- package/dist/shared/interfaces/database.member-queries.js +4 -0
- package/dist/shared/interfaces/database.negotiation.d.ts +305 -0
- package/dist/shared/interfaces/database.negotiation.js +26 -0
- package/dist/shared/interfaces/database.network-queries.d.ts +277 -0
- package/dist/shared/interfaces/database.network-queries.js +4 -0
- package/dist/shared/interfaces/database.opportunity-queries.d.ts +285 -0
- package/dist/shared/interfaces/database.opportunity-queries.js +4 -0
- package/dist/shared/interfaces/database.port.d.ts +322 -0
- package/dist/shared/interfaces/database.port.js +29 -0
- package/dist/shared/schemas/discovery-question.schema.d.ts +14 -14
- package/dist/shared/schemas/negotiation-digest.schema.d.ts +2 -2
- package/package.json +2 -15
- package/dist/contacts/application/contact.inviter.d.ts +0 -49
- package/dist/contacts/application/contact.inviter.js +0 -64
- package/dist/integrations/application/index.d.ts +0 -14
- package/dist/integrations/application/index.js +0 -14
- package/dist/integrations/application/integration.tools.d.ts +0 -27
- package/dist/integrations/application/integration.tools.js +0 -98
- package/dist/integrations/domain/index.d.ts +0 -16
- package/dist/integrations/domain/index.js +0 -1
- package/dist/integrations/domain/integration.types.d.ts +0 -51
- package/dist/integrations/domain/integration.types.js +0 -9
- package/dist/integrations/index.d.ts +0 -10
- package/dist/integrations/index.js +0 -8
- package/dist/integrations/ports/index.d.ts +0 -25
- package/dist/integrations/ports/index.js +0 -23
- package/dist/integrations/ports/integration.adapter.port.d.ts +0 -62
- package/dist/integrations/ports/integration.adapter.port.js +0 -15
- package/dist/integrations/ports/integration.importer.port.d.ts +0 -31
- package/dist/integrations/ports/integration.importer.port.js +0 -15
- package/dist/integrations/ports/integration.tools.port.d.ts +0 -25
- package/dist/integrations/ports/integration.tools.port.js +0 -18
- package/dist/opportunities/application/opportunity.card-presentation.d.ts +0 -44
- package/dist/opportunities/application/opportunity.card-presentation.js +0 -93
- package/dist/opportunities/application/opportunity.presenter.d.ts +0 -156
- package/dist/opportunities/domain/opportunity.presentation-cache.d.ts +0 -5
- package/dist/opportunities/domain/opportunity.presentation-cache.js +0 -11
- package/dist/opportunities/domain/opportunity.presentation.d.ts +0 -76
- package/dist/opportunities/domain/opportunity.presentation.js +0 -516
- package/dist/opportunities/domain/opportunity.safe-presentation.d.ts +0 -104
- package/dist/opportunities/domain/opportunity.safe-presentation.js +0 -102
package/CHANGELOG.md
CHANGED
|
@@ -20,6 +20,146 @@ went 6.7.1 → 8.0.2 with no 7.x in between because the whole 7.x line shipped a
|
|
|
20
20
|
prereleases between the two promotions. To track every change, read `rc`; to
|
|
21
21
|
pin a supported release, use `latest`.
|
|
22
22
|
|
|
23
|
+
## 17.0.0 - 2026-08-17
|
|
24
|
+
|
|
25
|
+
### Removed
|
|
26
|
+
|
|
27
|
+
- **BREAKING**: Remove the `integrations` capability entirely
|
|
28
|
+
(`src/integrations/`) and its public exports: `IntegrationAdapter`,
|
|
29
|
+
`IntegrationConnection`, `IntegrationSession`, `IntegrationSessionOptions`,
|
|
30
|
+
`ToolActionResponse`. Hosts that typed a Composio adapter against these
|
|
31
|
+
should declare the shape locally — `services/api` already carries a
|
|
32
|
+
structurally identical copy in `adapters/integration.adapter.ts`.
|
|
33
|
+
- **BREAKING**: Remove `generateInviteMessage` (and `InviteInput` /
|
|
34
|
+
`InviteOutput`). It generated outreach copy for ghost-user counterparts and
|
|
35
|
+
required `recipient.isGhost`; with ghost users retired it can never fire.
|
|
36
|
+
- **BREAKING**: Remove the `import_gmail_contacts`, `import_contacts` and
|
|
37
|
+
`add_contact` tools. These were the only paths that minted ghost users.
|
|
38
|
+
Contacts are now established solely by accepting an opportunity, which writes
|
|
39
|
+
the mutual `contact` memberships. `list_contacts`, `remove_contact` and
|
|
40
|
+
`search_contacts` are unchanged.
|
|
41
|
+
- **BREAKING**: Remove `contactsEnabled` from `ToolDeps`, the tool-registry
|
|
42
|
+
composition deps, and `resolveChatContext`. The `CONTACTS_ENABLED` flag gated
|
|
43
|
+
only the removed write paths and no longer exists.
|
|
44
|
+
- **BREAKING**: Remove `integration` and `integrationImporter` from `ToolDeps`.
|
|
45
|
+
Nothing in the protocol consumed them once the integration tools were removed.
|
|
46
|
+
- Remove `createGhostUser` from the database interface. No protocol code path
|
|
47
|
+
creates users any more.
|
|
48
|
+
|
|
49
|
+
### Changed
|
|
50
|
+
|
|
51
|
+
- `ContactServiceAdapter` narrows to `listContacts` / `removeContact` /
|
|
52
|
+
`searchContacts`; `importContacts` and `addContact` are gone, along with the
|
|
53
|
+
`ContactInput`, `ContactResult` and `ContactImportResult` domain types.
|
|
54
|
+
- Orchestrator, negotiator, signal and onboarding prompt surfaces no longer
|
|
55
|
+
advertise contact import or Gmail import.
|
|
56
|
+
|
|
57
|
+
## 16.1.0 - 2026-08-17
|
|
58
|
+
|
|
59
|
+
### Removed
|
|
60
|
+
|
|
61
|
+
- Remove the eval harnesses (`eval/`) and the 13 `eval:*` package scripts. No
|
|
62
|
+
public API change: `src/` never imported `eval/`, so the package build,
|
|
63
|
+
architecture gates and source tests are unaffected. The final state is
|
|
64
|
+
preserved in the `archive/eval-2026-08-16` tag; restore with
|
|
65
|
+
`git checkout archive/eval-2026-08-16 -- packages/protocol/eval`.
|
|
66
|
+
|
|
67
|
+
## 16.0.0 - 2026-08-17
|
|
68
|
+
|
|
69
|
+
### Removed
|
|
70
|
+
|
|
71
|
+
- **Breaking:** MCP no longer gates on web/CLI onboarding. Incomplete
|
|
72
|
+
onboarding does not restrict the MCP inventory, `onboarding_human` and
|
|
73
|
+
`onboarding_required` are gone, and `complete_onboarding` is omitted from
|
|
74
|
+
the MCP registry. `read_user_contexts` no longer returns
|
|
75
|
+
`onboardingComplete` on MCP. Web onboarding chat and the REST Tool API
|
|
76
|
+
keep the existing completion flow.
|
|
77
|
+
|
|
78
|
+
## 15.0.0 - 2026-08-17
|
|
79
|
+
|
|
80
|
+
Public-surface prune. `src/index.ts` goes from 443 exported symbols across 164
|
|
81
|
+
export statements to 312 across 143. No implementation changed: every removed
|
|
82
|
+
symbol still exists and still works inside the package — it is simply no longer
|
|
83
|
+
re-exported from the barrel.
|
|
84
|
+
|
|
85
|
+
A symbol was kept whenever a retained export could not be *used* without it —
|
|
86
|
+
parameter and member types of exported functions, interfaces, and unions stay
|
|
87
|
+
public even with no direct importer, because an exported symbol whose members
|
|
88
|
+
cannot be named is not usable.
|
|
89
|
+
|
|
90
|
+
The removal set was derived by parsing every barrel export and resolving it
|
|
91
|
+
against every consumer reference in `services/`, `apps/`, `packages/*`,
|
|
92
|
+
`docs/`, `.claude/`, and the protocol's own `eval/` and `skills/` trees —
|
|
93
|
+
covering static named imports, `import type` queries, `import('...').Sym` type
|
|
94
|
+
positions, `await import()` destructuring, namespace aliases, and `mock.module`
|
|
95
|
+
shapes. A symbol was removed only when nothing outside the package imported it
|
|
96
|
+
from the package root.
|
|
97
|
+
|
|
98
|
+
### Removed from the public API (BREAKING)
|
|
99
|
+
|
|
100
|
+
131 symbols. None were deleted; all remain internal. The largest groups:
|
|
101
|
+
|
|
102
|
+
- **Capability tool factories** — `createChatTools`, `createAgentTools`,
|
|
103
|
+
`createIntentTools`, `createNetworkTools`, `createOpportunityTools`,
|
|
104
|
+
`createNegotiationTools`, `createQuestionerTools`,
|
|
105
|
+
`createAskUserQuestionTools`, `createContactTools`, `createIntegrationTools`,
|
|
106
|
+
`createPremiseTools`, and their `*ToolDeps` types. These are composed
|
|
107
|
+
internally by `createMcpServer` / `createToolRegistry`, which remain public.
|
|
108
|
+
`createEnrichmentTools` and `EnrichmentToolDeps` stay exported — the API
|
|
109
|
+
service calls them directly from its enrichment-run worker.
|
|
110
|
+
- **MCP authorization policy** — 27 symbols from `mcp/mcp.authorization-policy.ts`
|
|
111
|
+
(`MCP_AGENT_ADMIN_TOOLS`, `McpCapabilityPolicy`, `McpToolAccessRuleSchema`,
|
|
112
|
+
`defineMcpToolAccessRules`, the `Mcp*` policy types, …). Four stay public
|
|
113
|
+
because a host cannot type its own `createMcpServer` call without them:
|
|
114
|
+
`CANONICAL_MCP_CAPABILITY_POLICY_OPTIONS`, `McpCapabilityPolicyOptions` (the
|
|
115
|
+
fourth parameter), `McpAuthorizationObserver`, and
|
|
116
|
+
`McpAuthorizationDenialEvent` (the observer callback's only argument).
|
|
117
|
+
- **Activity projection** — 15 symbols from `shared/agent/activity-projection.ts`
|
|
118
|
+
(`projectActivitySummary`, `ActivitySummaryResponseSchema`,
|
|
119
|
+
`QUESTION_MODE_TO_DOMAIN`, `READ_ACTIVITY_SUMMARY_TOOL_NAME`, …).
|
|
120
|
+
- **Persona helpers** — the `filter*Tools` / `narrow*Tools` helpers, the
|
|
121
|
+
`*_TOOL_NAMES` constants, and the `SIGNAL_NEW_SIGNAL_KICKOFF` /
|
|
122
|
+
`ONBOARDING_PROFILE_KICKOFF` constants. The persona IDs, the prompt
|
|
123
|
+
constants, and `REPORTER_BRIEFING_KICKOFF` stay — `apps/web` imports the
|
|
124
|
+
latter.
|
|
125
|
+
- **Discovery env accessors** — `discoveryAllowedTypes`, `discoveryMinSimilarity`,
|
|
126
|
+
`discoveryProfileSource`, `discoveryIntentMatchingEnabled`,
|
|
127
|
+
`discoveryProfileMatchingEnabled`, the `validate*` helpers, and the
|
|
128
|
+
`DISCOVERY_*_DEFAULT` constants. `discoveryEvaluatorMinScore` stays: its one
|
|
129
|
+
importer is `services/api/src/cli/discovery-env-matrix.main.ts`. That CLI is
|
|
130
|
+
slated for removal with the eval harnesses, and this accessor should be
|
|
131
|
+
pruned in the same change. These back live Railway configuration and are
|
|
132
|
+
unchanged in behaviour; only the re-export is gone.
|
|
133
|
+
- **Signal-intake types** — `IntakePack`, `IntakePackInput`, `SynthesisInput`,
|
|
134
|
+
`SynthesisResult`, `FollowUpPlan`, `answerLabel`, `normalizeIntakePack`, …
|
|
135
|
+
|
|
136
|
+
Two of the removed symbols (`createAgentTools` and
|
|
137
|
+
`CANONICAL_MCP_TOOL_ACCESS_RULES`) are referenced by `services/api` tests
|
|
138
|
+
through deep source paths rather than the package root, so those tests are
|
|
139
|
+
unaffected by the barrel change.
|
|
140
|
+
|
|
141
|
+
### Changed
|
|
142
|
+
|
|
143
|
+
- `IMPLEMENTATION.md` §1 no longer documents a `modelConfig` override on
|
|
144
|
+
`ToolDeps` — that field does not exist there. `modelConfig` lives on the
|
|
145
|
+
internal `ToolContext` / `ProtocolDeps` composition, which is not exported, so
|
|
146
|
+
the section now documents the environment variables as the supported
|
|
147
|
+
configuration path and states plainly that programmatic override is outside
|
|
148
|
+
the public contract.
|
|
149
|
+
- `IMPLEMENTATION.md` §3 now documents `createMcpServer` and
|
|
150
|
+
`createToolRegistry` + `invokeToolRuntime` as the supported tool entry points,
|
|
151
|
+
replacing the `createChatTools` walkthrough.
|
|
152
|
+
- `STABILITY.md` — the **Capability tools** tier now covers
|
|
153
|
+
`createEnrichmentTools` only; the **Public API** row names `createToolRegistry`
|
|
154
|
+
and corrects `ToolContext` to the actually-exported `ResolvedToolContext`.
|
|
155
|
+
|
|
156
|
+
### Migration
|
|
157
|
+
|
|
158
|
+
Hosts composing tools by capability should call `createMcpServer` (full MCP
|
|
159
|
+
server, policy applied) or `createToolRegistry` (raw handler map, invoked via
|
|
160
|
+
`invokeToolRuntime`). Both take the same dependency object the individual
|
|
161
|
+
factories did.
|
|
162
|
+
|
|
23
163
|
## 14.3.2 - 2026-08-16
|
|
24
164
|
|
|
25
165
|
No source change. The public contract in `src/index.ts` is untouched; only
|
|
@@ -419,6 +559,7 @@ No public API change: all 441 exported symbols are byte-identical to 13.2.0, and
|
|
|
419
559
|
## [Unreleased]
|
|
420
560
|
|
|
421
561
|
### Changed
|
|
562
|
+
- Behaviour-neutral internal refactor (16.1.1): split the six largest modules and hoist every graph node to a top-level function. The opportunity graph is now the discovery pipeline only — its eight non-pipeline modes (read, update, delete, send, negotiate_existing, approve_introduction, and the two introduction stages) are plain functions on `OpportunityGraphFactory` instead of `operationMode` conditional-edge routing. `database.interface.ts` becomes a barrel over entity, query-group, and capability-view modules; every `Pick<Database, ...>` resolves as before. The opportunity presentation cluster is one module. `opportunity.graph.ts` 4167 → 250 lines, `database.interface.ts` 2925 → 17, `negotiation.graph.ts` 1619 → 111, `opportunity.tools.ts` 1200 → 354, `enrichment.tools.ts` 1198 → 178, `intent.graph.ts` 1091 → 174. No public export, feature flag, or environment variable changed.
|
|
422
563
|
- Move the opportunity-presentation review checklist into `src/opportunity/AGENTS.md` and repoint the `opportunity.safe-presentation.ts` and `discriminator.adjustments.ts` comments at it. Comment-only; no runtime change.
|
|
423
564
|
|
|
424
565
|
### Removed
|
package/IMPLEMENTATION.md
CHANGED
|
@@ -10,7 +10,7 @@ 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, `
|
|
13
|
+
- **Stable** — interfaces, graph factories, agents, `createMcpServer`, the
|
|
14
14
|
tool/runtime helpers, and shared schemas. 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.
|
|
@@ -35,27 +35,15 @@ npm install @indexnetwork/protocol
|
|
|
35
35
|
|
|
36
36
|
The package reads `OPENROUTER_API_KEY` (required), `CHAT_MODEL`, and `CHAT_REASONING_EFFORT` from environment variables. No startup call is needed.
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
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.
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
import { createChatTools } from "@indexnetwork/protocol";
|
|
42
|
-
|
|
43
|
-
const tools = await createChatTools({
|
|
44
|
-
// ... other deps ...
|
|
45
|
-
modelConfig: {
|
|
46
|
-
chatModel: "google/gemini-2.5-flash", // optional — has a default
|
|
47
|
-
chatReasoningEffort: "low", // optional: minimal | low | medium | high | xhigh
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
`apiKey` and `baseURL` can also be overridden this way. All other protocol agents (evaluators, generators, etc.) rely on `OPENROUTER_API_KEY` set in the environment regardless of `modelConfig`.
|
|
40
|
+
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.
|
|
53
41
|
|
|
54
42
|
### 2. Implement the adapters
|
|
55
43
|
|
|
56
44
|
The package defines interfaces — your application provides the concrete implementations.
|
|
57
45
|
|
|
58
|
-
**Required** (always needed by
|
|
46
|
+
**Required** (always needed by the tool registry):
|
|
59
47
|
|
|
60
48
|
| Interface | Responsibility |
|
|
61
49
|
|---|---|
|
|
@@ -90,50 +78,60 @@ All interfaces are exported from the package root — import them with `import t
|
|
|
90
78
|
|
|
91
79
|
### 3. Create tools
|
|
92
80
|
|
|
93
|
-
|
|
81
|
+
Two entry points are supported, both taking a single dependency object built
|
|
82
|
+
from the adapters above.
|
|
83
|
+
|
|
84
|
+
`createMcpServer` is the complete integration: it composes every capability's
|
|
85
|
+
tools internally, applies the authorization policy, and returns a ready MCP
|
|
86
|
+
server.
|
|
94
87
|
|
|
95
88
|
```typescript
|
|
96
|
-
import {
|
|
89
|
+
import { createMcpServer, CANONICAL_MCP_CAPABILITY_POLICY_OPTIONS } from "@indexnetwork/protocol";
|
|
97
90
|
|
|
98
|
-
const
|
|
99
|
-
|
|
91
|
+
const server = createMcpServer(
|
|
92
|
+
deps, // ToolDeps + the opportunity owner-approval port
|
|
93
|
+
authResolver, // McpAuthResolver
|
|
94
|
+
scopedDepsFactory, // ScopedDepsFactory — builds per-user scoped userDb/systemDb
|
|
95
|
+
CANONICAL_MCP_CAPABILITY_POLICY_OPTIONS,
|
|
96
|
+
authorizationObserver, // optional McpAuthorizationObserver
|
|
97
|
+
);
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`createToolRegistry` is the lower-level surface for hosts running their own
|
|
101
|
+
runtime. It returns a `Map` of tool name to `RawToolDefinition` — raw async
|
|
102
|
+
handlers taking `{ context, query }` — which you invoke through
|
|
103
|
+
`invokeToolRuntime`:
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import { createToolRegistry, invokeToolRuntime, resolveChatContext } from "@indexnetwork/protocol";
|
|
100
107
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
intentQueue, // IntentGraphQueue
|
|
109
|
-
contactService, // ContactServiceAdapter
|
|
110
|
-
chatSession, // ChatSessionReader
|
|
111
|
-
enricher, // ProfileEnricher
|
|
112
|
-
negotiationDatabase, // NegotiationGraphDatabase
|
|
113
|
-
integrationImporter, // bulk contact import
|
|
114
|
-
createUserDatabase, // (db, userId) => UserDatabase
|
|
115
|
-
createSystemDatabase, // (db, userId, indexScope, embedder?) => SystemDatabase
|
|
116
|
-
|
|
117
|
-
// ── Optional scoping ──
|
|
118
|
-
networkId: "optional-network-uuid", // scope tools to a specific index/network
|
|
119
|
-
sessionId: "chat-session-id", // enables draft opportunities with conversation context
|
|
120
|
-
|
|
121
|
-
// ── Optional capabilities (enable when the host supports them) ──
|
|
122
|
-
agentDatabase, // AgentDatabase — agent registry
|
|
123
|
-
agentDispatcher, // AgentDispatcher — routes negotiation turns to personal agents
|
|
124
|
-
deliveryLedger, // DeliveryLedger — OpenClaw delivery commits
|
|
125
|
-
enrichmentRuns, // EnrichmentRunStore (+ enrichmentRunQueue) — async MCP enrichment runs
|
|
126
|
-
mintConnectLink, // short connect links for opportunity accepts
|
|
127
|
-
modelConfig, // override chat model / reasoning effort (see above)
|
|
108
|
+
const registry = createToolRegistry(deps, { surface: "mcp" }); // omit `surface` for the full REST set
|
|
109
|
+
|
|
110
|
+
const context = await resolveChatContext({
|
|
111
|
+
database, // the ChatGraphCompositeDatabase reads listed above
|
|
112
|
+
userId: "user-uuid",
|
|
113
|
+
networkId, // optional — scopes tools to one network
|
|
114
|
+
sessionId, // optional — enables draft opportunities
|
|
128
115
|
});
|
|
129
116
|
|
|
130
|
-
|
|
117
|
+
const tool = registry.get("search_intents")!;
|
|
118
|
+
const result = await invokeToolRuntime({
|
|
119
|
+
toolName: tool.name,
|
|
120
|
+
tool,
|
|
121
|
+
context,
|
|
122
|
+
query: { /* validated against tool.schema */ },
|
|
123
|
+
});
|
|
131
124
|
```
|
|
132
125
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
126
|
+
The dependency object carries the required adapters listed above; optional
|
|
127
|
+
capabilities default to a degraded-but-functional mode when omitted (for
|
|
128
|
+
example, without `agentDispatcher` the negotiation tools are not registered).
|
|
129
|
+
|
|
130
|
+
The per-capability tool factories behind these entry points
|
|
131
|
+
(`createChatTools`, `createIntentTools`, `createNegotiationTools`, …) are
|
|
132
|
+
package-internal as of 15.0.0 and are not part of the supported surface.
|
|
133
|
+
`createEnrichmentTools` remains exported for hosts that run enrichment on its
|
|
134
|
+
own worker, separately from the chat runtime.
|
|
137
135
|
|
|
138
136
|
## Graphs
|
|
139
137
|
|
package/STABILITY.md
CHANGED
|
@@ -30,13 +30,13 @@ Covered by SemVer below. Breaking changes require a **major** bump.
|
|
|
30
30
|
|
|
31
31
|
| Barrel section | What it is |
|
|
32
32
|
|---|---|
|
|
33
|
-
| **Public API** | `
|
|
33
|
+
| **Public API** | `createToolRegistry`, model config helpers, tool/runtime helpers (`ResolvedToolContext`, `ToolDeps`, `invokeToolRuntime`, …), `requestContext`. |
|
|
34
34
|
| **Interfaces** | Every `*.interface.ts` port you implement to inject infrastructure (databases, embedder, cache, scraper, queues, integration, agent dispatcher, …). |
|
|
35
35
|
| **Shared schemas** | Zod schemas + inferred types that cross the boundary (questions, identity, network-assignment, chat-context, …). |
|
|
36
36
|
| **Graph factories** | `*GraphFactory` classes (`ChatGraphFactory`, `OpportunityGraphFactory`, `NegotiationGraphFactory`, …). |
|
|
37
37
|
| **Agents** | Structured LLM agents (`UserContextGenerator`, `IndexNegotiator`, `OpportunityEvaluator`, …). |
|
|
38
|
-
| **MCP** | `createMcpServer`
|
|
39
|
-
| **Capability tools** |
|
|
38
|
+
| **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. |
|
|
39
|
+
| **Capability tools** | `createEnrichmentTools` only. The other per-capability tool factories became package-internal in 15.0.0 — compose them through `createMcpServer` or `createToolRegistry`. |
|
|
40
40
|
|
|
41
41
|
### Experimental
|
|
42
42
|
|
package/dist/chat/chat.agent.js
CHANGED
|
@@ -204,7 +204,6 @@ export class ChatAgent {
|
|
|
204
204
|
userId: context.userId,
|
|
205
205
|
networkId: scopedNetworkId,
|
|
206
206
|
sessionId: context.sessionId,
|
|
207
|
-
contactsEnabled: context.contactsEnabled,
|
|
208
207
|
actionToolsEnabled: context.actionToolsEnabled,
|
|
209
208
|
});
|
|
210
209
|
if (explicitScope.scopeType && explicitScope.scopeId) {
|
|
@@ -327,8 +326,8 @@ export class ChatAgent {
|
|
|
327
326
|
}
|
|
328
327
|
try {
|
|
329
328
|
logger.verbose("Executing tool", { name: tc.name, args: tc.args });
|
|
330
|
-
|
|
331
|
-
|
|
329
|
+
const result = await tool.invoke(tc.args);
|
|
330
|
+
const resultStr = typeof result === "string" ? result : JSON.stringify(result);
|
|
332
331
|
logger.debug("Tool response", { name: tc.name, result: resultStr });
|
|
333
332
|
logger.verbose("Tool completed", {
|
|
334
333
|
name: tc.name,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { BaseCheckpointSaver } from "@langchain/langgraph";
|
|
1
|
+
import { BaseCheckpointSaver, type LangGraphRunnableConfig } from "@langchain/langgraph";
|
|
2
2
|
import { BaseMessage } from "@langchain/core/messages";
|
|
3
|
+
import { ChatGraphState } from "./chat.state.js";
|
|
3
4
|
import type { ChatPersonaConfig } from "./chat.persona.js";
|
|
4
5
|
import type { ChatGraphCompositeDatabase } from "../shared/interfaces/database.interface.js";
|
|
5
6
|
import type { Embedder } from "../shared/interfaces/embedder.interface.js";
|
|
@@ -21,6 +22,16 @@ import type { ProtocolDeps } from "../shared/agent/tool.helpers.js";
|
|
|
21
22
|
* with a flexible, LLM-driven approach that can handle multi-step
|
|
22
23
|
* reasoning and self-correction.
|
|
23
24
|
*/
|
|
25
|
+
/** The graph's channel state, as the agent loop sees it. */
|
|
26
|
+
export type ChatState = typeof ChatGraphState.State;
|
|
27
|
+
/** Everything the agent loop node reaches for. */
|
|
28
|
+
export interface ChatGraphNodeDeps {
|
|
29
|
+
database: ChatGraphCompositeDatabase;
|
|
30
|
+
embedder: Embedder;
|
|
31
|
+
scraper: Scraper;
|
|
32
|
+
protocolDeps: ProtocolDeps;
|
|
33
|
+
persona: ChatPersonaConfig;
|
|
34
|
+
}
|
|
24
35
|
export declare class ChatGraphFactory {
|
|
25
36
|
private database;
|
|
26
37
|
private embedder;
|
|
@@ -382,3 +393,32 @@ export declare class ChatGraphFactory {
|
|
|
382
393
|
*/
|
|
383
394
|
private buildGraph;
|
|
384
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* The main agent loop node.
|
|
398
|
+
* Runs a ReAct-style agent that calls tools until it decides to respond.
|
|
399
|
+
*
|
|
400
|
+
* Uses `agent.streamRun()` + `config.writer` so that text tokens and
|
|
401
|
+
* tool-activity events are pushed into the graph's custom stream in
|
|
402
|
+
* real-time rather than batched at the end.
|
|
403
|
+
*/
|
|
404
|
+
export declare function agentLoopNode(state: ChatState, config: LangGraphRunnableConfig, deps: ChatGraphNodeDeps): Promise<{
|
|
405
|
+
messages: BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>[];
|
|
406
|
+
responseText: string;
|
|
407
|
+
iterationCount: number;
|
|
408
|
+
shouldContinue: boolean;
|
|
409
|
+
debugMeta: {
|
|
410
|
+
graph: string;
|
|
411
|
+
iterations: number;
|
|
412
|
+
tools: import("./chat-streaming.types.js").DebugMetaToolCall[];
|
|
413
|
+
llm: import("./chat-streaming.types.js").DebugMetaLlm;
|
|
414
|
+
orchestratorNegotiations?: import("./chat-streaming.types.js").DebugMetaOrchestratorNegotiations;
|
|
415
|
+
};
|
|
416
|
+
error?: undefined;
|
|
417
|
+
} | {
|
|
418
|
+
error: string;
|
|
419
|
+
responseText: string;
|
|
420
|
+
shouldContinue: boolean;
|
|
421
|
+
messages?: undefined;
|
|
422
|
+
iterationCount?: undefined;
|
|
423
|
+
debugMeta?: undefined;
|
|
424
|
+
}>;
|