@indexnetwork/protocol 0.3.3 → 0.4.0-rc.13.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/README.md +8 -3
- package/dist/agent/agent.tools.d.ts +3 -0
- package/dist/agent/agent.tools.d.ts.map +1 -0
- package/dist/agent/agent.tools.js +330 -0
- package/dist/agent/agent.tools.js.map +1 -0
- package/dist/contact/contact.tools.d.ts.map +1 -1
- package/dist/contact/contact.tools.js +37 -22
- package/dist/contact/contact.tools.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/integration/integration.tools.d.ts.map +1 -1
- package/dist/integration/integration.tools.js +10 -8
- package/dist/integration/integration.tools.js.map +1 -1
- package/dist/intent/intent.tools.d.ts.map +1 -1
- package/dist/intent/intent.tools.js +112 -23
- package/dist/intent/intent.tools.js.map +1 -1
- package/dist/mcp/mcp.server.d.ts +1 -1
- package/dist/mcp/mcp.server.d.ts.map +1 -1
- package/dist/mcp/mcp.server.js +8 -4
- package/dist/mcp/mcp.server.js.map +1 -1
- package/dist/negotiation/negotiation.graph.d.ts +37 -1
- package/dist/negotiation/negotiation.graph.d.ts.map +1 -1
- package/dist/negotiation/negotiation.graph.js +48 -6
- package/dist/negotiation/negotiation.graph.js.map +1 -1
- package/dist/negotiation/negotiation.state.d.ts +12 -0
- package/dist/negotiation/negotiation.state.d.ts.map +1 -1
- package/dist/negotiation/negotiation.state.js +16 -0
- package/dist/negotiation/negotiation.state.js.map +1 -1
- package/dist/negotiation/negotiation.tools.d.ts +7 -0
- package/dist/negotiation/negotiation.tools.d.ts.map +1 -0
- package/dist/negotiation/negotiation.tools.js +547 -0
- package/dist/negotiation/negotiation.tools.js.map +1 -0
- package/dist/network/network.tools.d.ts.map +1 -1
- package/dist/network/network.tools.js +65 -21
- package/dist/network/network.tools.js.map +1 -1
- package/dist/opportunity/opportunity.graph.d.ts +31 -0
- package/dist/opportunity/opportunity.graph.d.ts.map +1 -1
- package/dist/opportunity/opportunity.graph.js +49 -4
- package/dist/opportunity/opportunity.graph.js.map +1 -1
- package/dist/opportunity/opportunity.tools.d.ts.map +1 -1
- package/dist/opportunity/opportunity.tools.js +62 -30
- package/dist/opportunity/opportunity.tools.js.map +1 -1
- package/dist/profile/profile.graph.d.ts +12 -12
- package/dist/profile/profile.graph.d.ts.map +1 -1
- package/dist/profile/profile.graph.js +22 -15
- package/dist/profile/profile.graph.js.map +1 -1
- package/dist/profile/profile.tools.d.ts.map +1 -1
- package/dist/profile/profile.tools.js +62 -19
- package/dist/profile/profile.tools.js.map +1 -1
- package/dist/shared/agent/tool.factory.d.ts.map +1 -1
- package/dist/shared/agent/tool.factory.js +17 -1
- package/dist/shared/agent/tool.factory.js.map +1 -1
- package/dist/shared/agent/tool.helpers.d.ts +33 -0
- package/dist/shared/agent/tool.helpers.d.ts.map +1 -1
- package/dist/shared/agent/tool.helpers.js.map +1 -1
- package/dist/shared/agent/tool.registry.d.ts.map +1 -1
- package/dist/shared/agent/tool.registry.js +6 -0
- package/dist/shared/agent/tool.registry.js.map +1 -1
- package/dist/shared/agent/utility.tools.d.ts.map +1 -1
- package/dist/shared/agent/utility.tools.js +215 -46
- package/dist/shared/agent/utility.tools.js.map +1 -1
- package/dist/shared/interfaces/agent.interface.d.ts +176 -0
- package/dist/shared/interfaces/agent.interface.d.ts.map +1 -0
- package/dist/shared/interfaces/agent.interface.js +15 -0
- package/dist/shared/interfaces/agent.interface.js.map +1 -0
- package/dist/shared/interfaces/auth.interface.d.ts +10 -3
- package/dist/shared/interfaces/auth.interface.d.ts.map +1 -1
- package/dist/shared/interfaces/database.interface.d.ts +52 -0
- package/dist/shared/interfaces/database.interface.d.ts.map +1 -1
- package/dist/shared/interfaces/negotiation-events.interface.d.ts +58 -0
- package/dist/shared/interfaces/negotiation-events.interface.d.ts.map +1 -0
- package/dist/shared/interfaces/negotiation-events.interface.js +7 -0
- package/dist/shared/interfaces/negotiation-events.interface.js.map +1 -0
- package/dist/shared/interfaces/webhook.interface.d.ts +25 -0
- package/dist/shared/interfaces/webhook.interface.d.ts.map +1 -0
- package/dist/shared/interfaces/webhook.interface.js +2 -0
- package/dist/shared/interfaces/webhook.interface.js.map +1 -0
- package/dist/webhook/webhook.tools.d.ts +7 -0
- package/dist/webhook/webhook.tools.d.ts.map +1 -0
- package/dist/webhook/webhook.tools.js +127 -0
- package/dist/webhook/webhook.tools.js.map +1 -0
- package/package.json +4 -2
|
@@ -4,10 +4,18 @@ export function createUtilityTools(defineTool, deps) {
|
|
|
4
4
|
const { scraper } = deps;
|
|
5
5
|
const scrapeUrl = defineTool({
|
|
6
6
|
name: "scrape_url",
|
|
7
|
-
description: "Extracts text content from a URL
|
|
7
|
+
description: "Extracts text content from a web URL — articles, LinkedIn/GitHub profiles, documentation, project pages, etc. " +
|
|
8
|
+
"Returns the page's text content (up to 10,000 characters) for use in subsequent tool calls.\n\n" +
|
|
9
|
+
"**When to use:**\n" +
|
|
10
|
+
"- Before create_intent: when the user shares a URL and wants to create an intent from it. Scrape first, then synthesize into a description.\n" +
|
|
11
|
+
"- Before create_user_profile or update_user_profile: when the user shares a profile URL to update their profile from.\n" +
|
|
12
|
+
"- When the user asks about content at a URL.\n\n" +
|
|
13
|
+
"**URL format:** Bare domains work fine (e.g. 'github.com/user/repo') — protocol (https://) is added automatically.\n\n" +
|
|
14
|
+
"**Returns:** `{ url, contentLength, content }`. Content is truncated at 10,000 chars. " +
|
|
15
|
+
"Returns an error if the URL is unreachable, requires login, or has no extractable text.",
|
|
8
16
|
querySchema: z.object({
|
|
9
|
-
url: z.string().describe("The URL to
|
|
10
|
-
objective: z.string().optional().describe("
|
|
17
|
+
url: z.string().describe("The URL to extract content from. Protocol is optional — 'github.com/user/repo', 'linkedin.com/in/name', and 'https://example.com' all work."),
|
|
18
|
+
objective: z.string().optional().describe("Why you're scraping — guides content extraction for better results. Examples: 'User wants to create an intent from this project page', 'User wants to update their profile from this LinkedIn page', 'Extract key information about this company'. Omit for generic text extraction."),
|
|
11
19
|
}),
|
|
12
20
|
handler: async ({ context: _context, query }) => {
|
|
13
21
|
const normalizedUrl = normalizeUrl(query.url);
|
|
@@ -32,64 +40,225 @@ export function createUtilityTools(defineTool, deps) {
|
|
|
32
40
|
});
|
|
33
41
|
const readDocs = defineTool({
|
|
34
42
|
name: "read_docs",
|
|
35
|
-
description: "Returns the
|
|
43
|
+
description: "Returns comprehensive documentation about the Index Network protocol — entity model, workflows, tool usage guidance, and domain concepts. " +
|
|
44
|
+
"This is the primary way for an external agent to bootstrap understanding of the system.\n\n" +
|
|
45
|
+
"**When to use:** Call this FIRST when starting a new session. MCP agents MUST call read_docs(topic='mcp_agent_guide') at the start of every conversation to learn proper output formatting and workflow rules.\n" +
|
|
46
|
+
"Also call when you need to understand:\n" +
|
|
47
|
+
"- What entities exist and how they relate (intents, indexes, opportunities, profiles, contacts)\n" +
|
|
48
|
+
"- The discovery workflow (how intents become opportunities)\n" +
|
|
49
|
+
"- Which tools to call in what order for common tasks\n" +
|
|
50
|
+
"- Authentication and API patterns\n\n" +
|
|
51
|
+
"**Returns:** Markdown documentation. Pass `topic` to get a specific section, or omit for the full reference.\n\n" +
|
|
52
|
+
"**Available topics:** 'entities', 'intents', 'opportunities', 'indexes', 'profiles', 'contacts', 'discovery', 'workflows', 'authentication', 'mcp_agent_guide'",
|
|
36
53
|
querySchema: z.object({
|
|
37
|
-
topic: z.string().optional().describe("
|
|
54
|
+
topic: z.string().optional().describe("Narrow to a specific topic: 'entities', 'intents', 'opportunities', 'indexes', 'profiles', 'contacts', 'discovery', 'workflows', or 'authentication'. Omit to get the full documentation."),
|
|
38
55
|
}),
|
|
39
56
|
handler: async ({ context: _context, query }) => {
|
|
40
57
|
const topic = query.topic?.trim().toLowerCase();
|
|
41
58
|
const sections = {
|
|
42
|
-
entities: `## Entity Model
|
|
43
|
-
|
|
44
|
-
- **Users**: People on the platform. Authenticated via session (Better Auth).
|
|
45
|
-
- **Profiles**: A user's identity — bio, skills, interests, location, social links. Generated from account data or social URLs. Has a vector embedding for semantic matching.
|
|
46
|
-
- **Indexes
|
|
47
|
-
- **Index Members**: Junction between Users and Indexes. Tracks permissions, join date, auto-assign setting, and optional member prompt.
|
|
48
|
-
- **Intents**:
|
|
49
|
-
- **IntentNetworks**:
|
|
50
|
-
- **Opportunities**: Discovered connections between users based on
|
|
51
|
-
- **
|
|
59
|
+
entities: `## Entity Model & Relationships
|
|
60
|
+
|
|
61
|
+
- **Users**: People on the platform. Authenticated via API key (X-API-Key header) for MCP/external agents, or session-based (Better Auth) for the web app.
|
|
62
|
+
- **Profiles**: A user's identity — name, bio, skills, interests, location, social links. Generated from account data or social URLs via enrichment. Has a vector embedding for semantic matching. One profile per user.
|
|
63
|
+
- **Indexes** (also called "networks"): Communities or groups where members share intents and discover opportunities. Each has a title, optional prompt (purpose description), join policy (anyone or invite_only), and an owner. The user's **personal index** (isPersonal=true) stores their contacts.
|
|
64
|
+
- **Index Members**: Junction between Users and Indexes. Tracks permissions (owner, member, contact), join date, auto-assign setting, and optional member prompt.
|
|
65
|
+
- **Intents**: Signals of interest/need — what a user is looking for (e.g. "Looking for a React developer in Berlin"). Each has a description (payload), summary, confidence score (0-1), inferenceType (explicit/implicit), source tracking, and vector embedding.
|
|
66
|
+
- **IntentNetworks**: Many-to-many junction between Intents and Indexes. An intent can be in multiple indexes. Has a relevancyScore (0-1) indicating how well the intent fits the index's purpose.
|
|
67
|
+
- **Opportunities**: Discovered connections between users based on complementary intents within shared indexes. Have actors with roles (introducer, party), status lifecycle, match reasoning, confidence score, and presentation data.
|
|
68
|
+
- **Contacts**: People in a user's personal network, stored as index members with 'contact' permission on the personal index. Can be real users or ghost users (placeholder accounts enriched from public data).
|
|
69
|
+
- **Ghost Users**: Placeholder accounts created for contacts who aren't on the platform yet. Enriched with public profile data (LinkedIn, GitHub) and participate in opportunity matching.
|
|
70
|
+
|
|
71
|
+
### Key Relationships
|
|
72
|
+
- Users → Profiles (1:1)
|
|
73
|
+
- Users → Indexes (many:many via Index Members)
|
|
74
|
+
- Users → Intents (1:many, user owns intents)
|
|
75
|
+
- Intents → Indexes (many:many via IntentNetworks with relevancyScore)
|
|
76
|
+
- Opportunities → Users (many:many via actors with roles)
|
|
77
|
+
- Opportunities → Indexes (scoped to shared index context)
|
|
78
|
+
- Contacts → Personal Index (stored as members with 'contact' permission)`,
|
|
52
79
|
intents: `## Intent Lifecycle
|
|
53
80
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
81
|
+
Intents are the core unit of discovery — they represent what users are seeking and drive semantic matching.
|
|
82
|
+
|
|
83
|
+
1. **Creation** (create_intent): User describes what they're looking for. The system runs inference (extracting structured intents from free text) and verification (checking specificity, speech-act type). Returns a proposal for user approval.
|
|
84
|
+
2. **Confidence & Classification**: Each intent gets a confidence score (0-1), inferenceType (explicit = user stated directly, implicit = system inferred), and speech act classification (commissive, directive, assertive).
|
|
85
|
+
3. **Index Assignment**: After creation, the intent is automatically evaluated against all indexes the user belongs to. The index's prompt is used as criteria. Matching indexes get linked via IntentNetworks with a relevancyScore (0-1).
|
|
86
|
+
4. **Discovery Trigger**: Creating an intent triggers background opportunity detection — the system searches for other users in shared indexes whose intents complement this one.
|
|
87
|
+
5. **Source Tracking**: Intents track their origin via sourceType (file, integration, link, discovery_form, enrichment) and sourceId.
|
|
88
|
+
6. **Update** (update_intent): Re-processes through inference/verification, recalculates embeddings and index assignments.
|
|
89
|
+
7. **Archive** (delete_intent): Soft-deletes the intent. It stops participating in discovery but is not permanently removed.
|
|
90
|
+
|
|
91
|
+
### Intent Best Practices
|
|
92
|
+
- Be specific: "Looking for a senior React developer for a 3-month contract in Berlin" > "Need a developer"
|
|
93
|
+
- One intent per need: don't combine multiple requests into one intent
|
|
94
|
+
- Update rather than delete+create to preserve history`,
|
|
60
95
|
opportunities: `## Opportunity Lifecycle
|
|
61
96
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
- **
|
|
97
|
+
Opportunities represent discovered connections between users — potential matches worth pursuing.
|
|
98
|
+
|
|
99
|
+
1. **Detection** (create_opportunities): The opportunity graph finds users whose intents semantically complement each other within shared indexes. Uses HyDE embeddings for retrieval and an LLM evaluator for scoring.
|
|
100
|
+
2. **Roles**: Each opportunity assigns roles to actors:
|
|
101
|
+
- **introducer**: The person who triggered the introduction (may be the system or another user)
|
|
102
|
+
- **party**: The people being connected (typically 2)
|
|
103
|
+
3. **Status Flow**: draft → pending → accepted/rejected/expired
|
|
104
|
+
- **draft**: Created but not sent. Only the creator/introducer sees it.
|
|
105
|
+
- **pending**: Sent to the other party. They're notified and can respond.
|
|
106
|
+
- **accepted**: Both parties agreed to connect.
|
|
107
|
+
- **rejected**: One party declined.
|
|
108
|
+
- **expired**: Timed out without response.
|
|
109
|
+
4. **Creation Modes**:
|
|
110
|
+
- **Discovery**: Automatic — system finds matches based on intent overlap (create_opportunities with searchQuery)
|
|
111
|
+
- **Introduction**: Manual — a user introduces two specific people (create_opportunities with partyUserIds + entities)
|
|
112
|
+
- **Direct**: One-to-one — connect with a specific person (create_opportunities with targetUserId)
|
|
113
|
+
5. **Presentation**: Each opportunity includes personalized match reasoning, confidence score, and suggested next action.
|
|
114
|
+
|
|
115
|
+
### Opportunity Workflow
|
|
116
|
+
1. create_opportunities(searchQuery="AI engineers") → returns draft opportunity cards
|
|
117
|
+
2. update_opportunity(opportunityId, status="pending") → sends to other party
|
|
118
|
+
3. Other party sees opportunity → calls update_opportunity(status="accepted" or "rejected")`,
|
|
70
119
|
indexes: `## Index Mechanics
|
|
71
120
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
- **
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
121
|
+
Indexes (also called "networks") are communities where members share what they're looking for and the system discovers connections between them.
|
|
122
|
+
|
|
123
|
+
- **Purpose prompt**: Each index has an optional prompt describing its purpose (e.g. "AI/ML co-founders in Berlin"). This prompt is used by the intent indexer to evaluate whether an intent belongs in this community. Indexes without prompts accept all intents (relevancyScore defaults to 1.0).
|
|
124
|
+
- **Join policy**: "anyone" (open — any user can self-join) or "invite_only" (only the owner can add members).
|
|
125
|
+
- **Personal index**: Each user has exactly one personal index (isPersonal=true) created on registration. It stores their contacts. Cannot be deleted, renamed, or listed publicly.
|
|
126
|
+
- **Membership**: Members can see all intents in the index. The **auto-assign** setting on a membership means new intents by that user are automatically evaluated against the index.
|
|
127
|
+
- **Owner permissions**: Index owners can update settings (title, prompt, joinPolicy), add/remove members, and delete the index (if sole member).
|
|
128
|
+
- **Discovery scope**: Opportunities are discovered within index boundaries — the system matches intents of members who share at least one index.
|
|
129
|
+
|
|
130
|
+
### Index Workflow
|
|
131
|
+
1. create_network(title, prompt) → creates new community, you become owner
|
|
132
|
+
2. create_network_membership(networkId, userId) → invite members
|
|
133
|
+
3. Members create intents → auto-assigned to the index based on prompt
|
|
134
|
+
4. create_opportunities(networkId) → discover matches within this community`,
|
|
78
135
|
profiles: `## Profile System
|
|
79
136
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
137
|
+
Profiles are the user's identity on the platform, used for semantic matching in opportunity discovery.
|
|
138
|
+
|
|
139
|
+
- **Structure**: name, bio, location, skills[], interests[], social links (LinkedIn, GitHub, Twitter, websites)
|
|
140
|
+
- **Generation**: Auto-generated from account data (name, email, social links) via web enrichment. Can also be created from explicit user input (bioOrDescription).
|
|
141
|
+
- **Enrichment**: The system scrapes public profiles (LinkedIn, GitHub, Twitter) to build a rich identity with skills, interests, and narrative context.
|
|
142
|
+
- **Embeddings**: Profiles have vector embeddings for semantic matching. HyDE (Hypothetical Document Embedding) generates synthetic documents:
|
|
143
|
+
- Mirror: self-description of the person
|
|
144
|
+
- Reciprocal: what this person would look for in others
|
|
145
|
+
- Neighborhood: related community context
|
|
146
|
+
- **Onboarding flow**: create_user_profile() → preview → create_user_profile(confirm=true) → complete_onboarding()
|
|
147
|
+
- **Updates**: Use update_user_profile for targeted changes, create_user_profile for full regeneration.
|
|
148
|
+
|
|
149
|
+
### Profile Best Practices
|
|
150
|
+
- Richer profiles produce better opportunity matches
|
|
151
|
+
- Social links enable enrichment — encourage users to add LinkedIn/GitHub
|
|
152
|
+
- Profiles are recalculated when updated, which may surface new matches`,
|
|
153
|
+
contacts: `## Contact Management
|
|
154
|
+
|
|
155
|
+
Contacts are people in a user's personal network, stored as members of their personal index with 'contact' permission.
|
|
156
|
+
|
|
157
|
+
- **Adding contacts**: Via import_contacts (bulk), add_contact (single email), or import_gmail_contacts (Google integration).
|
|
158
|
+
- **Ghost users**: When a contact email doesn't match an existing account, a ghost user is created. Ghost users are enriched with public profile data and participate in opportunity matching — they can be discovered even before joining the platform.
|
|
159
|
+
- **Personal index scope**: Pass the personal index networkId to create_opportunities to scope discovery to just the user's contacts.
|
|
160
|
+
- **Contact data**: Each contact has userId, name, email, avatar, and isGhost flag.
|
|
161
|
+
|
|
162
|
+
### Contact Workflow
|
|
163
|
+
1. import_contacts or import_gmail_contacts → bulk add to network
|
|
164
|
+
2. list_contacts → view all contacts with userId
|
|
165
|
+
3. create_opportunities(networkId=personalIndexId) → find matches among contacts
|
|
166
|
+
4. add_contact(email) → add individual contact
|
|
167
|
+
5. remove_contact(contactUserId) → remove from network`,
|
|
85
168
|
discovery: `## Discovery Mechanics
|
|
86
169
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
170
|
+
Discovery is the process of finding meaningful connections between users based on their intents and profiles.
|
|
171
|
+
|
|
172
|
+
### How Discovery Works
|
|
173
|
+
1. **Trigger**: Runs automatically when an intent is created, or explicitly when create_opportunities is called.
|
|
174
|
+
2. **Pipeline**: Preparation (gather user context) → Scope (determine which indexes to search) → Candidate retrieval (semantic matching via HyDE embeddings) → Evaluation (LLM scores relevance and complementarity) → Ranking → Persist as opportunities.
|
|
175
|
+
3. **Semantic matching**: Uses HyDE (Hypothetical Document Embeddings) to find candidate intents that complement the source. This goes beyond keyword matching — it understands conceptual relationships.
|
|
176
|
+
4. **Evaluation**: An LLM evaluator agent scores each candidate match on relevance, complementarity, and actionability. Low-scoring matches are filtered out.
|
|
177
|
+
5. **Results**: Persisted as draft opportunities with roles, reasoning, and confidence scores.
|
|
178
|
+
6. **Background processing**: After intent creation, a queue job continues looking for matches asynchronously.
|
|
179
|
+
7. **Pagination**: Large result sets are paginated. Use continueFrom with the discoveryId to evaluate more candidates.
|
|
180
|
+
|
|
181
|
+
### Discovery Best Practices
|
|
182
|
+
- More specific intents produce more relevant matches
|
|
183
|
+
- Richer profiles improve matching quality
|
|
184
|
+
- Scope to a specific index (networkId) for more targeted results
|
|
185
|
+
- After discovery returns no results, suggest creating an intent to attract future matches`,
|
|
186
|
+
workflows: `## Common Tool Workflows
|
|
187
|
+
|
|
188
|
+
### New User Setup
|
|
189
|
+
1. create_user_profile(linkedinUrl/githubUrl) → generate profile from social data
|
|
190
|
+
2. complete_onboarding() → unlock full access
|
|
191
|
+
3. read_networks() → see available communities
|
|
192
|
+
4. create_network_membership(networkId) → join a community
|
|
193
|
+
5. create_intent(description) → post what you're looking for
|
|
194
|
+
6. create_opportunities(searchQuery) → find matches
|
|
195
|
+
|
|
196
|
+
### Finding Connections
|
|
197
|
+
1. read_networks() → list user's communities (get networkId)
|
|
198
|
+
2. create_opportunities(searchQuery, networkId) → discover matches
|
|
199
|
+
3. Review opportunity cards → update_opportunity(opportunityId, status="pending") to send
|
|
200
|
+
|
|
201
|
+
### Making an Introduction
|
|
202
|
+
1. read_network_memberships(networkId) → find members in shared community
|
|
203
|
+
2. read_user_profiles(userId) → get profiles of both parties
|
|
204
|
+
3. read_intents(networkId, userId) → get intents of both parties
|
|
205
|
+
4. create_opportunities(partyUserIds=[id1,id2], entities=[...], hint="reason") → create introduction
|
|
206
|
+
|
|
207
|
+
### Managing Contacts
|
|
208
|
+
1. import_gmail_contacts() or import_contacts([...]) → add contacts
|
|
209
|
+
2. list_contacts() → view network
|
|
210
|
+
3. create_opportunities(networkId=personalIndexId) → find matches among contacts
|
|
211
|
+
|
|
212
|
+
### Creating a Community
|
|
213
|
+
1. create_network(title, prompt) → create index
|
|
214
|
+
2. create_network_membership(networkId, userId) → invite members
|
|
215
|
+
3. Members create intents → auto-indexed
|
|
216
|
+
4. create_opportunities(networkId) → discover connections within community`,
|
|
217
|
+
authentication: `## Authentication & API Access
|
|
218
|
+
|
|
219
|
+
### For External AI Agents (MCP)
|
|
220
|
+
- Authenticate via **X-API-Key** header with a valid API key
|
|
221
|
+
- The API key is tied to a specific user account
|
|
222
|
+
- All operations execute in the context of the authenticated user
|
|
223
|
+
- Base URL: protocol.index.network/mcp
|
|
224
|
+
|
|
225
|
+
### Key Constraints
|
|
226
|
+
- Users can only read their own intents globally, or intents in indexes they belong to
|
|
227
|
+
- Users can only read profiles of people in shared indexes
|
|
228
|
+
- Index-scoped operations are restricted to that index
|
|
229
|
+
- Personal indexes cannot be deleted or renamed
|
|
230
|
+
- Only index owners can update settings, add/remove members (for invite_only indexes)
|
|
231
|
+
|
|
232
|
+
### Rate Limits & Best Practices
|
|
233
|
+
- Avoid unnecessary read_intents/read_networks calls — cache results within a conversation
|
|
234
|
+
- Use pagination (limit/page) for large result sets
|
|
235
|
+
- Call read_docs once at the start to understand the domain`,
|
|
236
|
+
mcp_agent_guide: `## MCP Agent Integration Guide
|
|
237
|
+
|
|
238
|
+
**IMPORTANT: Read this section if you are an AI agent accessing Index Network via MCP tools.**
|
|
239
|
+
|
|
240
|
+
### Output Formatting
|
|
241
|
+
- Tool results often contain structured JSON data (proposals, opportunities, cards). **Do NOT dump raw JSON to the user.** Parse the JSON and present information in natural language with clear formatting.
|
|
242
|
+
- Some tool results contain interactive card markup (code blocks with \`intent_proposal\`, \`opportunity_card\` language tags). These are designed for the Index Network web UI. **As an MCP agent, ignore card markup.** Instead, extract the meaningful data from the JSON and present it conversationally.
|
|
243
|
+
- When presenting opportunities or intents, use bullet points or short paragraphs — not raw JSON objects.
|
|
244
|
+
|
|
245
|
+
### Intent Creation Workflow
|
|
246
|
+
- **Always pass \`autoApprove: true\` when calling \`create_intent\`.** This persists intents directly without returning proposal cards that require manual UI approval.
|
|
247
|
+
- The tool will return a list of created intents with their descriptions and confidence scores. Present these in natural language.
|
|
248
|
+
- Do not tell the user to "click on cards" or "approve above" — there is no UI. Intents are created immediately with autoApprove.
|
|
249
|
+
- After creating intents, proactively suggest or run discovery to find matches.
|
|
250
|
+
|
|
251
|
+
### Discovery Workflow
|
|
252
|
+
- After creating intents, proactively suggest running discovery: \`create_opportunities(searchQuery=...)\`
|
|
253
|
+
- Present discovered opportunities in natural language with the counterpart's name, match reasoning, and suggested next steps.
|
|
254
|
+
- Do not reference "cards", "panels", or any web UI elements.
|
|
255
|
+
|
|
256
|
+
### General MCP Agent Rules
|
|
257
|
+
- You are operating via API tools, not a web interface. Never reference clicking, scrolling, cards, panels, or any visual UI elements.
|
|
258
|
+
- Be proactive: if a logical next step exists (e.g., running discovery after creating intents), suggest or execute it.
|
|
259
|
+
- Use \`list_opportunities\` to check existing matches, \`list_negotiations\` for ongoing negotiations.
|
|
260
|
+
- Use \`read_networks\` to understand which communities the user belongs to before scoping operations.
|
|
261
|
+
- When errors occur, provide clear technical context rather than vague "backend issue" messages.`,
|
|
93
262
|
};
|
|
94
263
|
if (topic) {
|
|
95
264
|
const matched = Object.entries(sections).find(([key]) => key.includes(topic) || topic.includes(key));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utility.tools.js","sourceRoot":"","sources":["../../../src/shared/agent/utility.tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,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FAuBqE;gBAEpF,OAAO,EAAE;;;;;;;;;;;;;;;4EAe2D;gBAEpE,QAAQ,EAAE;;;;;;;;;;;;;;;;;wEAiBsD;gBAEhE,QAAQ,EAAE;;;;;;;;;;;;;;uDAcqC;gBAE/C,SAAS,EAAE;;;;;;;;;;;;;;;;;2FAiBwE;gBAEnF,SAAS,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2EA8BwD;gBAEnE,cAAc,EAAE;;;;;;;;;;;;;;;;;;4DAkBoC;gBAEpD,eAAe,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;iGAyBwE;aAC1F,CAAC;YAEF,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;gBACrG,IAAI,OAAO,EAAE,CAAC;oBACZ,OAAO,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;gBAC7D,CAAC;gBACD,iCAAiC;YACnC,CAAC;YAED,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACrD,OAAO,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QACvC,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAU,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database adapter interface for agent registry operations.
|
|
3
|
+
* Implemented by the host application and injected via ProtocolDeps.
|
|
4
|
+
*/
|
|
5
|
+
export interface AgentRecord {
|
|
6
|
+
id: string;
|
|
7
|
+
ownerId: string;
|
|
8
|
+
name: string;
|
|
9
|
+
description: string | null;
|
|
10
|
+
type: 'personal' | 'system';
|
|
11
|
+
status: 'active' | 'inactive';
|
|
12
|
+
metadata: Record<string, unknown>;
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
updatedAt: Date;
|
|
15
|
+
}
|
|
16
|
+
export interface AgentTransportRecord {
|
|
17
|
+
id: string;
|
|
18
|
+
agentId: string;
|
|
19
|
+
channel: 'webhook' | 'mcp';
|
|
20
|
+
config: Record<string, unknown>;
|
|
21
|
+
priority: number;
|
|
22
|
+
active: boolean;
|
|
23
|
+
failureCount: number;
|
|
24
|
+
}
|
|
25
|
+
export interface AgentPermissionRecord {
|
|
26
|
+
id: string;
|
|
27
|
+
agentId: string;
|
|
28
|
+
userId: string;
|
|
29
|
+
scope: 'global' | 'node' | 'network';
|
|
30
|
+
scopeId: string | null;
|
|
31
|
+
actions: string[];
|
|
32
|
+
createdAt: Date;
|
|
33
|
+
}
|
|
34
|
+
export interface AgentWithRelations extends AgentRecord {
|
|
35
|
+
transports: AgentTransportRecord[];
|
|
36
|
+
permissions: AgentPermissionRecord[];
|
|
37
|
+
}
|
|
38
|
+
export interface CreateAgentInput {
|
|
39
|
+
ownerId: string;
|
|
40
|
+
name: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
type?: 'personal' | 'system';
|
|
43
|
+
metadata?: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
export interface CreateTransportInput {
|
|
46
|
+
agentId: string;
|
|
47
|
+
channel: 'webhook' | 'mcp';
|
|
48
|
+
config?: Record<string, unknown>;
|
|
49
|
+
priority?: number;
|
|
50
|
+
}
|
|
51
|
+
export interface GrantPermissionInput {
|
|
52
|
+
agentId: string;
|
|
53
|
+
userId: string;
|
|
54
|
+
scope?: 'global' | 'node' | 'network';
|
|
55
|
+
scopeId?: string;
|
|
56
|
+
actions: string[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Database adapter interface for agent registry operations.
|
|
60
|
+
*
|
|
61
|
+
* Handles CRUD for agents, their transports, and permission grants.
|
|
62
|
+
* Implemented by the host application (backend) and injected into the
|
|
63
|
+
* protocol layer via constructor injection at the composition root.
|
|
64
|
+
*/
|
|
65
|
+
export interface AgentDatabase {
|
|
66
|
+
/**
|
|
67
|
+
* Creates a new agent record.
|
|
68
|
+
* @param input - Agent creation parameters.
|
|
69
|
+
* @returns The persisted agent record.
|
|
70
|
+
*/
|
|
71
|
+
createAgent(input: CreateAgentInput): Promise<AgentRecord>;
|
|
72
|
+
/**
|
|
73
|
+
* Retrieves an agent by its ID.
|
|
74
|
+
* @param agentId - The agent UUID.
|
|
75
|
+
* @returns The agent record, or null if not found.
|
|
76
|
+
*/
|
|
77
|
+
getAgent(agentId: string): Promise<AgentRecord | null>;
|
|
78
|
+
/**
|
|
79
|
+
* Retrieves an agent along with its transports and permissions.
|
|
80
|
+
* @param agentId - The agent UUID.
|
|
81
|
+
* @returns The agent with relations, or null if not found.
|
|
82
|
+
*/
|
|
83
|
+
getAgentWithRelations(agentId: string): Promise<AgentWithRelations | null>;
|
|
84
|
+
/**
|
|
85
|
+
* Updates mutable fields on an agent.
|
|
86
|
+
* @param agentId - The agent UUID.
|
|
87
|
+
* @param updates - Partial set of fields to update.
|
|
88
|
+
* @returns The updated agent record, or null if not found.
|
|
89
|
+
*/
|
|
90
|
+
updateAgent(agentId: string, updates: Partial<Pick<AgentRecord, 'name' | 'description' | 'status' | 'metadata'>>): Promise<AgentRecord | null>;
|
|
91
|
+
/**
|
|
92
|
+
* Deletes an agent and its associated transports and permissions.
|
|
93
|
+
* @param agentId - The agent UUID.
|
|
94
|
+
*/
|
|
95
|
+
deleteAgent(agentId: string): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Lists all agents owned by a user, including their relations.
|
|
98
|
+
* @param userId - The owner's user ID.
|
|
99
|
+
* @returns Array of agents with transports and permissions.
|
|
100
|
+
*/
|
|
101
|
+
listAgentsForUser(userId: string): Promise<AgentWithRelations[]>;
|
|
102
|
+
/**
|
|
103
|
+
* Creates a transport channel for an agent.
|
|
104
|
+
* @param input - Transport creation parameters.
|
|
105
|
+
* @returns The persisted transport record.
|
|
106
|
+
*/
|
|
107
|
+
createTransport(input: CreateTransportInput): Promise<AgentTransportRecord>;
|
|
108
|
+
/**
|
|
109
|
+
* Deletes a transport channel.
|
|
110
|
+
* @param transportId - The transport UUID.
|
|
111
|
+
*/
|
|
112
|
+
deleteTransport(transportId: string): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Increments the failure counter for a transport channel.
|
|
115
|
+
* @param transportId - The transport UUID.
|
|
116
|
+
*/
|
|
117
|
+
recordTransportFailure(transportId: string): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Resets the failure counter for a transport channel after a successful delivery.
|
|
120
|
+
* @param transportId - The transport UUID.
|
|
121
|
+
*/
|
|
122
|
+
recordTransportSuccess(transportId: string): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Grants a permission to an agent for a given user and scope.
|
|
125
|
+
* @param input - Permission grant parameters.
|
|
126
|
+
* @returns The persisted permission record.
|
|
127
|
+
*/
|
|
128
|
+
grantPermission(input: GrantPermissionInput): Promise<AgentPermissionRecord>;
|
|
129
|
+
/**
|
|
130
|
+
* Revokes a permission by its ID.
|
|
131
|
+
* @param permissionId - The permission UUID.
|
|
132
|
+
*/
|
|
133
|
+
revokePermission(permissionId: string): Promise<void>;
|
|
134
|
+
/**
|
|
135
|
+
* Checks whether an agent holds a specific permission for a user.
|
|
136
|
+
* @param agentId - The agent UUID.
|
|
137
|
+
* @param userId - The user whose permission is being checked.
|
|
138
|
+
* @param action - The action string to verify (e.g. `"read"`, `"write"`).
|
|
139
|
+
* @param scope - Optional scope restriction; defaults to global if omitted.
|
|
140
|
+
* @returns True if the permission exists, false otherwise.
|
|
141
|
+
*/
|
|
142
|
+
hasPermission(agentId: string, userId: string, action: string, scope?: {
|
|
143
|
+
type: 'global' | 'node' | 'network';
|
|
144
|
+
id?: string;
|
|
145
|
+
}): Promise<boolean>;
|
|
146
|
+
/**
|
|
147
|
+
* Returns all agents authorized for a user and action, optionally within a scope.
|
|
148
|
+
* @param userId - The user to check authorization for.
|
|
149
|
+
* @param action - The action string (e.g. `"read"`, `"write"`).
|
|
150
|
+
* @param scope - Optional scope restriction.
|
|
151
|
+
* @returns Array of authorized agents with their relations.
|
|
152
|
+
*/
|
|
153
|
+
findAuthorizedAgents(userId: string, action: string, scope?: {
|
|
154
|
+
type: 'global' | 'node' | 'network';
|
|
155
|
+
id?: string;
|
|
156
|
+
}): Promise<AgentWithRelations[]>;
|
|
157
|
+
/**
|
|
158
|
+
* Returns the well-known IDs for built-in system agents.
|
|
159
|
+
* @returns Object mapping system agent roles to their fixed UUIDs.
|
|
160
|
+
*/
|
|
161
|
+
getSystemAgentIds(): {
|
|
162
|
+
chatOrchestrator: string;
|
|
163
|
+
negotiator: string;
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Fixed UUIDs for built-in system agents.
|
|
168
|
+
*
|
|
169
|
+
* These are seeded into the database on first run and must never change,
|
|
170
|
+
* as they are referenced by foreign keys and hard-coded in protocol logic.
|
|
171
|
+
*/
|
|
172
|
+
export declare const SYSTEM_AGENT_IDS: {
|
|
173
|
+
readonly chatOrchestrator: "00000000-0000-0000-0000-000000000001";
|
|
174
|
+
readonly negotiator: "00000000-0000-0000-0000-000000000002";
|
|
175
|
+
};
|
|
176
|
+
//# sourceMappingURL=agent.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.interface.d.ts","sourceRoot":"","sources":["../../../src/shared/interfaces/agent.interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;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ACH,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpD;;;OAGG;IACH,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3D;;;OAGG;IACH,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3D;;;;OAIG;IACH,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAE7E;;;OAGG;IACH,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtD;;;;;;;OAOG;IACH,aAAa,CACX,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,GAC3D,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpB;;;;;;OAMG;IACH,oBAAoB,CAClB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,GAC3D,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IAEjC;;;OAGG;IACH,iBAAiB,IAAI;QAAE,gBAAgB,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;CACvE;AAED;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Database adapter interface for agent registry operations.
|
|
3
|
+
* Implemented by the host application and injected via ProtocolDeps.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Fixed UUIDs for built-in system agents.
|
|
7
|
+
*
|
|
8
|
+
* These are seeded into the database on first run and must never change,
|
|
9
|
+
* as they are referenced by foreign keys and hard-coded in protocol logic.
|
|
10
|
+
*/
|
|
11
|
+
export const SYSTEM_AGENT_IDS = {
|
|
12
|
+
chatOrchestrator: '00000000-0000-0000-0000-000000000001',
|
|
13
|
+
negotiator: '00000000-0000-0000-0000-000000000002',
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=agent.interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.interface.js","sourceRoot":"","sources":["../../../src/shared/interfaces/agent.interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4LH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,gBAAgB,EAAE,sCAAsC;IACxD,UAAU,EAAE,sCAAsC;CAC1C,CAAC"}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Resolves the authenticated
|
|
2
|
+
* Resolves the authenticated MCP identity from an incoming request.
|
|
3
3
|
* Injected into the MCP server factory so the protocol layer
|
|
4
4
|
* stays independent of any specific auth implementation.
|
|
5
5
|
*/
|
|
6
6
|
export interface McpAuthResolver {
|
|
7
7
|
/**
|
|
8
|
-
* Extracts and validates the authenticated
|
|
8
|
+
* Extracts and validates the authenticated identity from the request.
|
|
9
9
|
* @param request - The incoming HTTP request
|
|
10
|
-
* @returns The authenticated user's UUID
|
|
10
|
+
* @returns The authenticated user's UUID and optional agent UUID
|
|
11
11
|
* @throws Error if authentication fails (no token, invalid token, etc.)
|
|
12
12
|
*/
|
|
13
|
+
resolveIdentity(request: Request): Promise<{
|
|
14
|
+
userId: string;
|
|
15
|
+
agentId?: string;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use resolveIdentity instead.
|
|
19
|
+
*/
|
|
13
20
|
resolveUserId(request: Request): Promise<string>;
|
|
14
21
|
}
|
|
15
22
|
//# sourceMappingURL=auth.interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.interface.d.ts","sourceRoot":"","sources":["../../../src/shared/interfaces/auth.interface.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAClD"}
|
|
1
|
+
{"version":3,"file":"auth.interface.d.ts","sourceRoot":"","sources":["../../../src/shared/interfaces/auth.interface.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAEjF;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAClD"}
|
|
@@ -1441,6 +1441,58 @@ export interface NegotiationDatabase {
|
|
|
1441
1441
|
}): Promise<{
|
|
1442
1442
|
id: string;
|
|
1443
1443
|
}>;
|
|
1444
|
+
/**
|
|
1445
|
+
* Lists negotiation tasks where the given user is source or candidate.
|
|
1446
|
+
* @param userId - The user ID to filter by (matches sourceUserId or candidateUserId in task metadata)
|
|
1447
|
+
* @param options - Optional status filter
|
|
1448
|
+
* @returns Array of task records with metadata
|
|
1449
|
+
*/
|
|
1450
|
+
getTasksForUser(userId: string, options?: {
|
|
1451
|
+
state?: string;
|
|
1452
|
+
}): Promise<Array<{
|
|
1453
|
+
id: string;
|
|
1454
|
+
conversationId: string;
|
|
1455
|
+
state: string;
|
|
1456
|
+
metadata: Record<string, unknown> | null;
|
|
1457
|
+
createdAt: Date;
|
|
1458
|
+
updatedAt: Date;
|
|
1459
|
+
}>>;
|
|
1460
|
+
/**
|
|
1461
|
+
* Gets a specific task by ID.
|
|
1462
|
+
* @param taskId - The task ID to look up
|
|
1463
|
+
* @returns The task record or null if not found
|
|
1464
|
+
*/
|
|
1465
|
+
getTask(taskId: string): Promise<{
|
|
1466
|
+
id: string;
|
|
1467
|
+
conversationId: string;
|
|
1468
|
+
state: string;
|
|
1469
|
+
metadata: Record<string, unknown> | null;
|
|
1470
|
+
createdAt: Date;
|
|
1471
|
+
updatedAt: Date;
|
|
1472
|
+
} | null>;
|
|
1473
|
+
/**
|
|
1474
|
+
* Gets all messages for a conversation, ordered by creation time.
|
|
1475
|
+
* @param conversationId - The conversation to fetch messages for
|
|
1476
|
+
* @returns Array of message records
|
|
1477
|
+
*/
|
|
1478
|
+
getMessagesForConversation(conversationId: string): Promise<Array<{
|
|
1479
|
+
id: string;
|
|
1480
|
+
senderId: string;
|
|
1481
|
+
role: 'user' | 'agent';
|
|
1482
|
+
parts: unknown[];
|
|
1483
|
+
createdAt: Date;
|
|
1484
|
+
}>>;
|
|
1485
|
+
/**
|
|
1486
|
+
* Gets artifacts for a task (e.g. negotiation outcome).
|
|
1487
|
+
* @param taskId - The task to fetch artifacts for
|
|
1488
|
+
* @returns Array of artifact records
|
|
1489
|
+
*/
|
|
1490
|
+
getArtifactsForTask(taskId: string): Promise<Array<{
|
|
1491
|
+
id: string;
|
|
1492
|
+
name: string | null;
|
|
1493
|
+
parts: unknown[];
|
|
1494
|
+
metadata: Record<string, unknown> | null;
|
|
1495
|
+
}>>;
|
|
1444
1496
|
}
|
|
1445
1497
|
/**
|
|
1446
1498
|
* Database interface for opportunity controller (API).
|