@indexnetwork/protocol 6.15.0-rc.407.1 → 8.0.2-rc.418.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 +309 -0
- package/IMPLEMENTATION.md +7 -4
- package/dist/capabilities/opportunities.facade.d.ts +4 -0
- package/dist/capabilities/opportunities.facade.js +4 -0
- package/dist/chat/chat-streaming.types.d.ts +4 -5
- package/dist/chat/chat.agent.d.ts +0 -19
- package/dist/chat/chat.agent.js +1 -70
- package/dist/chat/chat.persona.d.ts +0 -6
- package/dist/chat/chat.persona.js +0 -1
- package/dist/chat/chat.prompt.js +10 -10
- package/dist/chat/chat.prompt.modules.js +0 -104
- package/dist/chat/chat.tools.js +11 -7
- package/dist/chat/negotiator.persona.js +0 -1
- package/dist/chat/onboarding.persona.js +0 -1
- package/dist/chat/reporter.persona.d.ts +1 -1
- package/dist/chat/reporter.persona.js +1 -2
- package/dist/chat/reporter.prompt.js +5 -5
- package/dist/chat/signal.persona.js +0 -1
- package/dist/communities/application/network.tools.js +48 -27
- package/dist/contacts/application/contact.tools.js +9 -9
- package/dist/index.d.ts +9 -2
- package/dist/index.js +5 -0
- package/dist/maintenance/maintenance.graph.js +7 -0
- package/dist/mcp/mcp.authorization-policy.d.ts +250 -0
- package/dist/mcp/mcp.authorization-policy.js +522 -0
- package/dist/mcp/mcp.server.d.ts +6 -29
- package/dist/mcp/mcp.server.js +202 -228
- package/dist/negotiation/application/negotiation.agent.js +29 -5
- package/dist/negotiation/application/negotiation.graph.d.ts +2 -5
- package/dist/negotiation/application/negotiation.graph.js +53 -23
- package/dist/negotiation/domain/index.d.ts +3 -0
- package/dist/negotiation/domain/index.js +3 -0
- package/dist/negotiation/domain/negotiation.deadlock.d.ts +7 -1
- package/dist/negotiation/domain/negotiation.deadlock.js +48 -1
- package/dist/negotiation/domain/negotiation.stance.contracts.d.ts +85 -0
- package/dist/negotiation/domain/negotiation.stance.contracts.js +140 -0
- package/dist/negotiation/domain/negotiation.state.d.ts +2 -3
- package/dist/negotiation/domain/negotiation.state.js +2 -3
- package/dist/negotiation/public/index.d.ts +2 -0
- package/dist/negotiation/public/index.js +2 -0
- package/dist/opportunity/application/index.d.ts +0 -3
- package/dist/opportunity/application/index.js +0 -3
- package/dist/opportunity/application/opportunity.graph.d.ts +0 -43
- package/dist/opportunity/application/opportunity.graph.js +7 -113
- package/dist/opportunity/application/opportunity.introducer-feature.d.ts +2 -0
- package/dist/opportunity/application/opportunity.introducer-feature.js +4 -0
- package/dist/opportunity/application/opportunity.owner-approval.d.ts +118 -0
- package/dist/opportunity/application/opportunity.owner-approval.js +34 -0
- package/dist/opportunity/application/opportunity.owner-provenance.d.ts +6 -0
- package/dist/opportunity/application/opportunity.owner-provenance.js +28 -0
- package/dist/opportunity/application/opportunity.tools.d.ts +3 -3
- package/dist/opportunity/application/opportunity.tools.js +77 -870
- package/dist/opportunity/discriminator/discriminator.shadow.js +17 -10
- package/dist/opportunity/discriminator/discriminator.types.d.ts +2 -0
- package/dist/opportunity/domain/index.d.ts +0 -2
- package/dist/opportunity/domain/index.js +0 -2
- package/dist/opportunity/domain/opportunity.state.d.ts +2 -70
- package/dist/opportunity/domain/opportunity.state.js +2 -55
- package/dist/opportunity/opportunity.owner-approval.d.ts +5 -0
- package/dist/opportunity/opportunity.owner-approval.js +5 -0
- package/dist/opportunity/ports/opportunity.tools.port.d.ts +12 -1
- package/dist/opportunity/public/index.d.ts +3 -3
- package/dist/opportunity/public/index.js +2 -1
- package/dist/participant-agents/application/agent.tools.d.ts +1 -1
- package/dist/participant-agents/application/agent.tools.js +44 -6
- package/dist/participant-agents/application/index.d.ts +5 -3
- package/dist/participant-agents/application/index.js +5 -3
- package/dist/questions/application/question.tools.js +31 -2
- package/dist/runtime/foreground/composition/tool.factory.d.ts +2 -1
- package/dist/runtime/foreground/composition/tool.factory.js +9 -2
- package/dist/runtime/foreground/composition/tool.registry.d.ts +16 -2
- package/dist/runtime/foreground/composition/tool.registry.js +41 -38
- package/dist/shared/agent/activity-projection.d.ts +271 -0
- package/dist/shared/agent/activity-projection.js +248 -0
- package/dist/shared/agent/canonical-guidance.d.ts +30 -0
- package/dist/shared/agent/canonical-guidance.js +249 -0
- package/dist/shared/agent/tool.helpers.d.ts +9 -17
- package/dist/shared/agent/tool.runtime.js +1 -3
- package/dist/shared/agent/utility.tools.d.ts +11 -1
- package/dist/shared/agent/utility.tools.js +126 -90
- package/dist/shared/interfaces/auth.interface.d.ts +2 -8
- package/dist/shared/interfaces/chat-session.interface.js +5 -0
- package/dist/shared/interfaces/database.interface.d.ts +12 -5
- package/dist/shared/observability/request-context.d.ts +4 -40
- package/dist/shared/schemas/mcp-auth.schema.d.ts +87 -15
- package/dist/shared/schemas/mcp-auth.schema.js +49 -1
- package/dist/signals/application/intent.tools.js +7 -8
- package/package.json +10 -9
- package/dist/opportunity/application/opportunity.discover.d.ts +0 -215
- package/dist/opportunity/application/opportunity.discover.js +0 -793
- package/dist/opportunity/application/opportunity.discovery-continuation-finalization.d.ts +0 -34
- package/dist/opportunity/application/opportunity.discovery-continuation-finalization.js +0 -74
- package/dist/opportunity/application/opportunity.discovery-mcp-lifecycle-finalization.d.ts +0 -44
- package/dist/opportunity/application/opportunity.discovery-mcp-lifecycle-finalization.js +0 -92
- package/dist/opportunity/domain/opportunity.discovery-run-coalescing.d.ts +0 -33
- package/dist/opportunity/domain/opportunity.discovery-run-coalescing.js +0 -33
- package/dist/opportunity/domain/opportunity.discovery.contracts.d.ts +0 -45
- package/dist/opportunity/domain/opportunity.discovery.contracts.js +0 -1
- package/dist/opportunity/opportunity.discover.d.ts +0 -5
- package/dist/opportunity/opportunity.discover.js +0 -5
- package/dist/opportunity/opportunity.discovery-continuation-finalization.d.ts +0 -5
- package/dist/opportunity/opportunity.discovery-continuation-finalization.js +0 -5
- package/dist/opportunity/opportunity.discovery-mcp-lifecycle-finalization.d.ts +0 -5
- package/dist/opportunity/opportunity.discovery-mcp-lifecycle-finalization.js +0 -5
- package/dist/opportunity/opportunity.discovery-run-coalescing.d.ts +0 -5
- package/dist/opportunity/opportunity.discovery-run-coalescing.js +0 -5
- package/dist/opportunity/opportunity.discovery.contracts.d.ts +0 -5
- package/dist/opportunity/opportunity.discovery.contracts.js +0 -5
- package/dist/shared/interfaces/discovery-run.interface.d.ts +0 -70
- package/dist/shared/interfaces/discovery-run.interface.js +0 -1
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical guidance for Index Network protocol operations.
|
|
3
|
+
*
|
|
4
|
+
* This is the single normative source for:
|
|
5
|
+
* - Entity model and identity/context definitions
|
|
6
|
+
* - Premise, signal, community, network, and opportunity concepts
|
|
7
|
+
* - Negotiation semantics (owner approval vs A2A acceptance)
|
|
8
|
+
* - H2A and A2A collaboration (H2H is never exposed)
|
|
9
|
+
* - Retired vocabulary (no contact/Gmail/scrape/profile/ghost-user guidance)
|
|
10
|
+
*
|
|
11
|
+
* Wired into:
|
|
12
|
+
* - MCP_INSTRUCTIONS (packages/protocol/src/mcp/mcp.server.ts)
|
|
13
|
+
* - read_docs tool (packages/protocol/src/shared/agent/utility.tools.ts)
|
|
14
|
+
*
|
|
15
|
+
* IND-602, IND-603
|
|
16
|
+
*/
|
|
17
|
+
export const CANONICAL_GUIDANCE_TOPICS = [
|
|
18
|
+
"identity-context",
|
|
19
|
+
"premises",
|
|
20
|
+
"signals",
|
|
21
|
+
"communities-networks",
|
|
22
|
+
"opportunities",
|
|
23
|
+
"negotiations",
|
|
24
|
+
"workflows",
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* Summary of canonical entity model and protocol semantics.
|
|
28
|
+
* Used in MCP_INSTRUCTIONS and as read_docs summary across all surfaces.
|
|
29
|
+
* Never mentions retired contact/Gmail/scrape/profile/ghost-user guidance.
|
|
30
|
+
* Optimized to ~1900 chars to leave room for MCP_INSTRUCTIONS context budget.
|
|
31
|
+
*/
|
|
32
|
+
export const CANONICAL_GUIDANCE_SUMMARY = `# Index Network Protocol
|
|
33
|
+
|
|
34
|
+
Index Network is a private, intent-driven discovery protocol. Users express signals (intents), agents find matches within shared networks, and decisions proceed through clear gates.
|
|
35
|
+
|
|
36
|
+
## Core Concepts
|
|
37
|
+
|
|
38
|
+
**Identity & Context** — User profile (name, bio, skills, interests, location) and current scope (networks, intents, stage).
|
|
39
|
+
|
|
40
|
+
**Premises** — Foundational facts: background, experience, stage, timeline, constraints.
|
|
41
|
+
|
|
42
|
+
**Signals** — What users seek (intents, opportunities). Drive semantic matching.
|
|
43
|
+
|
|
44
|
+
**Communities & Networks** — Private groups where members share signals and discover connections via shared membership.
|
|
45
|
+
|
|
46
|
+
**Opportunities** — Discovered matches between users. Lifecycle: draft → pending → accepted/rejected/expired.
|
|
47
|
+
|
|
48
|
+
**Negotiations** — Agents coordinate, users approve. **A2A acceptance is not owner approval.** These are separate gates.
|
|
49
|
+
|
|
50
|
+
**Workflows** — H2A (users express signals → agents discover) and A2A (agents coordinate) over MCP. Further escalation via native surfaces (human-to-human threads do not cross MCP).
|
|
51
|
+
|
|
52
|
+
## Canonical Topics
|
|
53
|
+
|
|
54
|
+
Refer to these for detailed entity facts and lifecycle:
|
|
55
|
+
|
|
56
|
+
- **identity-context** — Profile structure, context scoping
|
|
57
|
+
- **premises** — Background, stage, constraints
|
|
58
|
+
- **signals** — Intent inference, classification
|
|
59
|
+
- **communities-networks** — Membership, auto-assign
|
|
60
|
+
- **opportunities** — Discovery, roles, reasoning
|
|
61
|
+
- **negotiations** — Owner approval vs A2A, acceptance gates
|
|
62
|
+
- **workflows** — H2A and A2A tool sequences`;
|
|
63
|
+
/**
|
|
64
|
+
* Detailed canonical topic content for read_docs.
|
|
65
|
+
* Indexed by topic name; each contains current entity, capability, and lifecycle facts.
|
|
66
|
+
*/
|
|
67
|
+
export const CANONICAL_GUIDANCE_TOPICS_CONTENT = {
|
|
68
|
+
"identity-context": `## Identity & Context
|
|
69
|
+
|
|
70
|
+
**Identity** is the user's profile on the platform: name, bio, skills, interests, location, social links. It's used for semantic matching and is enriched from social URLs (LinkedIn, GitHub) or explicit user input.
|
|
71
|
+
|
|
72
|
+
**Context** is the user's current scope: which networks they belong to, what intents they've expressed, their stage (onboarding vs established), their preferences (e.g. geographic scope). Context shapes what discovery surfaces and what tools are available.
|
|
73
|
+
|
|
74
|
+
### Profile Structure
|
|
75
|
+
- Name, bio, location
|
|
76
|
+
- Skills and interests (arrays)
|
|
77
|
+
- Social links (LinkedIn, GitHub, Twitter, personal websites)
|
|
78
|
+
- Embeddings for semantic matching (generated via HyDE — hypothetical document embedding)
|
|
79
|
+
|
|
80
|
+
### Context Scoping
|
|
81
|
+
- Users can belong to multiple networks
|
|
82
|
+
- Each network has a scope (open to all members or invite-only)
|
|
83
|
+
- Discovery is scoped to shared networks
|
|
84
|
+
|
|
85
|
+
### Key Distinction
|
|
86
|
+
Identity is static and represents who the user is. Context is dynamic and represents where they are in their journey and what they're focused on at this moment.`,
|
|
87
|
+
premises: `## Premises
|
|
88
|
+
|
|
89
|
+
**Premise** is the foundational context that shapes what matches will be relevant: a user's background, experience level, location, timeline, stage of life, constraints, and what they can actually commit to.
|
|
90
|
+
|
|
91
|
+
### Premise Examples
|
|
92
|
+
- "I'm a junior developer with 2 years of Python experience"
|
|
93
|
+
- "I'm based in Berlin and can't relocate"
|
|
94
|
+
- "I'm looking to start a company but can only contribute part-time until March"
|
|
95
|
+
- "I've exited twice and have capital to invest"
|
|
96
|
+
|
|
97
|
+
### Why Premises Matter
|
|
98
|
+
Premises filter and prioritize candidates. Two opportunities with identical signal overlap will rank differently based on whose premises align. A senior engineer may look for "growing engineers" (premise: mentor/investor) vs "equal partners" (premise: cofounder).
|
|
99
|
+
|
|
100
|
+
### Expressing Premises
|
|
101
|
+
- In profile: bio section and skills/interests summarize professional premise
|
|
102
|
+
- In intents: the description should include stage, timeline, and constraints
|
|
103
|
+
- In context: shared network membership indicates domain interest
|
|
104
|
+
|
|
105
|
+
### Premise Inference
|
|
106
|
+
The system learns premises from:
|
|
107
|
+
- Explicit user input (bio, intent descriptions)
|
|
108
|
+
- Social enrichment (LinkedIn career history, GitHub project scale)
|
|
109
|
+
- Behavioral signals (intents created, networks joined)`,
|
|
110
|
+
signals: `## Signals
|
|
111
|
+
|
|
112
|
+
**Signal** is what a user is actively looking for — an intent, a need, a role they want to fill. Signals are the atoms of discovery.
|
|
113
|
+
|
|
114
|
+
### Signal Properties
|
|
115
|
+
- Description (free text: "Looking for a React developer for a 3-month contract in Berlin")
|
|
116
|
+
- Summary (structured extract: role, domain, stage, geography, duration)
|
|
117
|
+
- Confidence (0-1, how well the inference captured the user's intent)
|
|
118
|
+
- Inference type (explicit = user stated directly; implicit = system inferred)
|
|
119
|
+
- Embedding (semantic vector for matching)
|
|
120
|
+
|
|
121
|
+
### Signal vs Premise
|
|
122
|
+
- **Premise** is the user's foundational context ("I'm a senior engineer in Berlin")
|
|
123
|
+
- **Signal** is what they're seeking right now ("I'm looking for co-founders to start an AI company")
|
|
124
|
+
|
|
125
|
+
### Signal Lifecycle
|
|
126
|
+
1. User creates intent (explicit signal) or system infers from behavior (implicit)
|
|
127
|
+
2. Signal is embedded (converted to semantic vector)
|
|
128
|
+
3. Signal is assigned to networks (via auto-assign rules)
|
|
129
|
+
4. Signal participates in discovery (matched against other signals)
|
|
130
|
+
|
|
131
|
+
### Signal Best Practices
|
|
132
|
+
- Be specific: "Senior React developer, 3-month contract, Berlin" > "Need a developer"
|
|
133
|
+
- One signal per need: don't combine multiple requests
|
|
134
|
+
- Update signals when context changes (location, timeline, role requirements)`,
|
|
135
|
+
"communities-networks": `## Communities & Networks
|
|
136
|
+
|
|
137
|
+
**Network** (also called "community") is a private group where members share signals and discover connections. Each network has:
|
|
138
|
+
- Title and optional purpose prompt (describing what the network is for)
|
|
139
|
+
- Membership list (with permissions and auto-assign settings)
|
|
140
|
+
- Join policy (open to anyone or invite-only)
|
|
141
|
+
- Scope for discovery (opportunities are found within shared networks)
|
|
142
|
+
|
|
143
|
+
### Network Properties
|
|
144
|
+
- Purpose prompt: Used to evaluate whether new signals belong in this network (signals with high relevance are auto-assigned)
|
|
145
|
+
- Join policy: "anyone" (self-join) or "invite_only" (owner invites)
|
|
146
|
+
- Owner: Can update settings, add/remove members, delete network
|
|
147
|
+
- Auto-assign: Members can opt in/out of automatic signal assignment
|
|
148
|
+
|
|
149
|
+
### Network Scope for Discovery
|
|
150
|
+
- Opportunities are discovered only between members of shared networks
|
|
151
|
+
- If two users share network A but not B, discovery in A will find them
|
|
152
|
+
- Scoping discovery to a specific network (networkId parameter) narrows results to that community
|
|
153
|
+
|
|
154
|
+
### Community Membership
|
|
155
|
+
- Members see all signals in the network
|
|
156
|
+
- Members can create signals (intents) that are auto-evaluated for relevance to the network
|
|
157
|
+
- Members can discover within the network
|
|
158
|
+
- Permissions track member type (owner, member, contact)
|
|
159
|
+
|
|
160
|
+
### Key Constraint
|
|
161
|
+
Discovery is networked — it only finds matches within shared networks. This privacy boundary is fundamental.`,
|
|
162
|
+
opportunities: `## Opportunities
|
|
163
|
+
|
|
164
|
+
**Opportunity** is a discovered connection between two or more users based on complementary signals and shared network membership. Each opportunity has:
|
|
165
|
+
- Parties (the people being connected)
|
|
166
|
+
- Roles (introducer, party)
|
|
167
|
+
- Status (draft → pending → accepted/rejected/expired)
|
|
168
|
+
- Match reasoning (why they're a good fit)
|
|
169
|
+
- Confidence score (0-1 from evaluation)
|
|
170
|
+
|
|
171
|
+
### Opportunity Lifecycle
|
|
172
|
+
1. **Draft**: Created locally, only visible to creator. Offer to send.
|
|
173
|
+
2. **Pending**: Sent to recipient. They're notified and waiting.
|
|
174
|
+
3. **Accepted**: Recipient accepted. Both parties see the match.
|
|
175
|
+
4. **Rejected**: Recipient declined.
|
|
176
|
+
5. **Expired**: Timed out without response.
|
|
177
|
+
|
|
178
|
+
### Background Matching
|
|
179
|
+
Approved signals are evaluated in the background. Use list_opportunities only to review persisted cards; it does not start matching.
|
|
180
|
+
|
|
181
|
+
### Opportunity Evaluation
|
|
182
|
+
- Candidate retrieval: Uses HyDE embeddings to find semantically related signals
|
|
183
|
+
- LLM evaluation: Scores relevance, complementarity, and actionability
|
|
184
|
+
- Reasoning: Each opportunity includes match reasoning for the user
|
|
185
|
+
|
|
186
|
+
### Opportunity Acceptance
|
|
187
|
+
Accepting an opportunity expresses interest in the connection. Owner acceptance (explicit user confirmation) is required for any escalation.`,
|
|
188
|
+
negotiations: `## Negotiations
|
|
189
|
+
|
|
190
|
+
**Negotiation** is how agents and users coordinate to reach decisions about matches. Two distinct gates govern acceptance:
|
|
191
|
+
|
|
192
|
+
### Agent-to-Agent (A2A) Acceptance
|
|
193
|
+
When two agent services coordinate on behalf of their users, they may reach agreement that a match is worth pursuing. Agents veto, accept, or defer based on their user's context. This is A2A acceptance.
|
|
194
|
+
|
|
195
|
+
### Owner Approval (Human Confirmation)
|
|
196
|
+
When a human user explicitly confirms in conversation "Yes, I want to pursue this connection", that is owner approval. Owner approval is a separate, human-driven gate.
|
|
197
|
+
|
|
198
|
+
### Critical Rule
|
|
199
|
+
**A2A acceptance is not owner approval.** Agents can accept while humans have not yet approved. The system tracks these separately:
|
|
200
|
+
- A2A acceptance: Agents vetted the match and recommend it
|
|
201
|
+
- Owner approval: The human explicitly confirmed
|
|
202
|
+
|
|
203
|
+
These gates are independent. Do not conflate them.
|
|
204
|
+
|
|
205
|
+
### Negotiation Workflow
|
|
206
|
+
1. Discovery creates draft opportunity
|
|
207
|
+
2. A2A coordination (agents evaluate viability)
|
|
208
|
+
3. A2A acceptance (agents agree to propose)
|
|
209
|
+
4. Opportunity sent to recipient (pending)
|
|
210
|
+
5. Owner review (human reads match reasoning)
|
|
211
|
+
6. Owner approval (human confirms)
|
|
212
|
+
7. Escalation (via native surfaces, not MCP)
|
|
213
|
+
|
|
214
|
+
### Rules
|
|
215
|
+
- Track A2A and owner approval separately
|
|
216
|
+
- Never accept without explicit user approval
|
|
217
|
+
- Always surface reasoning to owner
|
|
218
|
+
- Human-to-human messaging is not MCP`,
|
|
219
|
+
workflows: `## Common Tool Workflows
|
|
220
|
+
|
|
221
|
+
### H2A: Human→Agent Discovery
|
|
222
|
+
User expresses signals (intents). Agent discovers matches and presents reasoning.
|
|
223
|
+
|
|
224
|
+
1. User creates intents (signals)
|
|
225
|
+
2. Background matching evaluates approved signals
|
|
226
|
+
3. Agent uses list_opportunities to surface persisted matches
|
|
227
|
+
4. User reviews and approves (owner approval)
|
|
228
|
+
5. Escalation via native surfaces
|
|
229
|
+
|
|
230
|
+
### A2A: Agent→Agent Coordination
|
|
231
|
+
Two agents coordinate on behalf of users to identify, vet, and propose matches.
|
|
232
|
+
|
|
233
|
+
1. Approved signals for User A are evaluated in the background
|
|
234
|
+
2. Agent B vets match from User B side (A2A negotiation)
|
|
235
|
+
3. Agents reach agreement (A2A acceptance)
|
|
236
|
+
4. Both agents present to users with shared reasoning
|
|
237
|
+
5. Both users approve (owner approval required)
|
|
238
|
+
6. Escalation via native surfaces
|
|
239
|
+
|
|
240
|
+
### MCP Scope
|
|
241
|
+
The MCP protocol carries H2A and A2A workflows only. Escalation to direct messaging (web, Telegram, native surfaces) is outside MCP.
|
|
242
|
+
|
|
243
|
+
### Best Practices
|
|
244
|
+
- Call read_docs to understand the domain
|
|
245
|
+
- Create or refine approved signals in relevant shared networks; list_opportunities reviews persisted results
|
|
246
|
+
- Present matches and reasoning to users
|
|
247
|
+
- Get explicit owner approval before any commitment
|
|
248
|
+
- Escalation to direct messaging is not MCP`,
|
|
249
|
+
};
|
|
@@ -25,8 +25,8 @@ import type { NegotiatorMemoryToolsHost } from "../interfaces/negotiator-memory.
|
|
|
25
25
|
import type { QuestionerEnqueueFn } from "../../questioner/questioner.types.js";
|
|
26
26
|
import type { PendingQuestionSummary } from "../schemas/pending-question.schema.js";
|
|
27
27
|
import type { QuestionMode, QuestionPurpose } from "../schemas/question.schema.js";
|
|
28
|
-
import type { DiscoveryRunQueue, DiscoveryRunStore } from "../interfaces/discovery-run.interface.js";
|
|
29
28
|
import type { EnrichmentRunQueue, EnrichmentRunStore } from "../interfaces/enrichment-run.interface.js";
|
|
29
|
+
import type { McpActivityCaller } from "./activity-projection.js";
|
|
30
30
|
export type IdentityContext = UserIdentity | null;
|
|
31
31
|
export interface ToolErrorReport {
|
|
32
32
|
operation: string;
|
|
@@ -92,6 +92,14 @@ export interface ResolvedToolContext {
|
|
|
92
92
|
isMcp?: boolean;
|
|
93
93
|
/** Agent ID when the request originates from an API key linked to an agent. */
|
|
94
94
|
agentId?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Typed resolved MCP caller context, set only by the MCP server after the
|
|
97
|
+
* capability subject is resolved. Tools with permission-projected output
|
|
98
|
+
* (currently `read_activity_summary`) pass it into the centralized
|
|
99
|
+
* projection in `activity-projection.ts`. Absent on REST/chat surfaces,
|
|
100
|
+
* which are owner-trusted and receive the full owner view.
|
|
101
|
+
*/
|
|
102
|
+
mcpCaller?: McpActivityCaller;
|
|
95
103
|
/**
|
|
96
104
|
* Receiver's rendering surface declared by the MCP client via the
|
|
97
105
|
* `x-index-surface` request header. `'telegram'` means the MCP response is
|
|
@@ -256,10 +264,6 @@ interface ToolContextBindings {
|
|
|
256
264
|
stampNewbornOpportunities?: StampNewbornOpportunitiesFn;
|
|
257
265
|
/** Delivery ledger for committing opportunity delivery rows (optional — absent in chat context). */
|
|
258
266
|
deliveryLedger?: DeliveryLedger;
|
|
259
|
-
/** Persistence for async MCP discovery runs (optional — absent in non-MCP/test contexts). */
|
|
260
|
-
discoveryRuns?: DiscoveryRunStore;
|
|
261
|
-
/** Queue for async MCP discovery run execution (optional — absent in non-MCP/test contexts). */
|
|
262
|
-
discoveryRunQueue?: DiscoveryRunQueue;
|
|
263
267
|
/** Persistence for async MCP profile runs (optional — absent in non-MCP/test contexts). */
|
|
264
268
|
enrichmentRuns?: EnrichmentRunStore;
|
|
265
269
|
/** Queue for async MCP profile run execution (optional — absent in non-MCP/test contexts). */
|
|
@@ -415,14 +419,6 @@ interface ToolDepsBindings {
|
|
|
415
419
|
chatSession?: ChatSessionReader;
|
|
416
420
|
/** Read-through chat-session digest. Optional; consumers fall back to undefined `chatContext`. */
|
|
417
421
|
chatSummary?: ChatSummaryReader;
|
|
418
|
-
/**
|
|
419
|
-
* Test seam for opportunity discovery helpers. Production compositions leave
|
|
420
|
-
* this unset so tools call the real discovery module directly.
|
|
421
|
-
*/
|
|
422
|
-
opportunityDiscovery?: {
|
|
423
|
-
runDiscoverFromQuery?: (input: unknown) => Promise<unknown>;
|
|
424
|
-
continueDiscovery?: (input: unknown) => Promise<unknown>;
|
|
425
|
-
};
|
|
426
422
|
/**
|
|
427
423
|
* Test seam for opportunity card presentation helpers. Production
|
|
428
424
|
* compositions leave this unset so tools construct the real presenter.
|
|
@@ -495,10 +491,6 @@ interface ToolDepsBindings {
|
|
|
495
491
|
stampNewbornOpportunities?: StampNewbornOpportunitiesFn;
|
|
496
492
|
/** Delivery ledger for committing opportunity delivery rows (optional — absent in chat context). */
|
|
497
493
|
deliveryLedger?: DeliveryLedger;
|
|
498
|
-
/** Persistence for async MCP discovery runs (optional — absent in non-MCP/test contexts). */
|
|
499
|
-
discoveryRuns?: DiscoveryRunStore;
|
|
500
|
-
/** Queue for async MCP discovery run execution (optional — absent in non-MCP/test contexts). */
|
|
501
|
-
discoveryRunQueue?: DiscoveryRunQueue;
|
|
502
494
|
/** Persistence for async MCP profile runs (optional — absent in non-MCP/test contexts). */
|
|
503
495
|
enrichmentRuns?: EnrichmentRunStore;
|
|
504
496
|
/** Queue for async MCP profile run execution (optional — absent in non-MCP/test contexts). */
|
|
@@ -22,11 +22,10 @@ const FAST_TOOLS = new Set([
|
|
|
22
22
|
"delete_network_membership",
|
|
23
23
|
"confirm_opportunity_delivery",
|
|
24
24
|
"read_docs",
|
|
25
|
-
"get_discovery_run",
|
|
26
|
-
"cancel_discovery_run",
|
|
27
25
|
"get_profile_run",
|
|
28
26
|
"cancel_profile_run",
|
|
29
27
|
"remove_contact",
|
|
28
|
+
"read_own_agent",
|
|
30
29
|
"register_agent",
|
|
31
30
|
"list_agents",
|
|
32
31
|
"update_agent",
|
|
@@ -49,7 +48,6 @@ const ASYNC_CANDIDATE_TOOLS = new Set([
|
|
|
49
48
|
"update_user_profile",
|
|
50
49
|
"create_intent",
|
|
51
50
|
"update_intent",
|
|
52
|
-
"discover_opportunities",
|
|
53
51
|
"scrape_url",
|
|
54
52
|
"import_gmail_contacts",
|
|
55
53
|
"import_contacts",
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { DefineTool, ToolRegistryCompositionDeps } from "./tool.helpers.js";
|
|
2
2
|
/** Host capabilities consumed by URL and profile utility tools. */
|
|
3
3
|
type UtilityToolDeps = Pick<ToolRegistryCompositionDeps, "scraper" | "userDb">;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Tool-surface profile. The restricted `'mcp'` surface omits `scrape_url`
|
|
6
|
+
* (IND-597) and sanitizes `read_docs` guidance so it never advertises the
|
|
7
|
+
* contact/Gmail workflows removed from MCP (IND-596). The default `'rest'`
|
|
8
|
+
* surface (direct HTTP Tool API + chat) retains full behavior.
|
|
9
|
+
*/
|
|
10
|
+
export type ToolSurface = "mcp" | "rest";
|
|
11
|
+
export interface CreateUtilityToolsOptions {
|
|
12
|
+
surface?: ToolSurface;
|
|
13
|
+
}
|
|
14
|
+
export declare function createUtilityTools(defineTool: DefineTool, deps: UtilityToolDeps, options?: CreateUtilityToolsOptions): any[];
|
|
5
15
|
export {};
|