@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
|
@@ -269,8 +269,8 @@ export function createIntentTools(defineTool, deps) {
|
|
|
269
269
|
"and durably stores an owner-scoped proposal containing the exact normalized description, optional network scope, and complete verifier output before returning a proposal widget. The intent itself is NOT yet persisted — the user must approve the proposal first.\n\n" +
|
|
270
270
|
"**Returns:** An intent_proposal code block that MUST be included verbatim in the response. The frontend renders it as an interactive " +
|
|
271
271
|
"card the user can approve or skip. On approval, the intent is persisted, indexed, and discovery begins.\n\n" +
|
|
272
|
-
"**Next steps after approval:** The intent is automatically linked to relevant indexes
|
|
273
|
-
"
|
|
272
|
+
"**Next steps after approval:** The intent is automatically linked to relevant indexes and becomes eligible for background matching. " +
|
|
273
|
+
"Background processing creates opportunities when matches are found; use list_opportunities only to review persisted results.\n\n" +
|
|
274
274
|
"**Specificity gate.** Before calling this tool, judge whether the description is concrete enough to be " +
|
|
275
275
|
"useful for matching. If the user says \"find a job\", \"meet people\", or \"learn something\", that's too " +
|
|
276
276
|
"vague — FIRST call read_user_contexts() + read_intents() to understand their context, THEN propose a " +
|
|
@@ -474,8 +474,8 @@ export function createIntentTools(defineTool, deps) {
|
|
|
474
474
|
});
|
|
475
475
|
const updateIntent = defineTool({
|
|
476
476
|
name: "update_intent",
|
|
477
|
-
description: "Updates an existing intent's description. After updating, the system re-processes
|
|
478
|
-
"re-evaluates its index assignments, and
|
|
477
|
+
description: "Updates an existing intent's description. After updating, the system re-processes it through inference and verification, " +
|
|
478
|
+
"re-evaluates its index assignments, and makes the approved signal eligible for background matching.\n\n" +
|
|
479
479
|
"**When to use:** When the user wants to refine or change what they're looking for — e.g. narrowing scope, adding specificity, " +
|
|
480
480
|
"or pivoting to a different need. Prefer updating over delete+create to preserve the intent's history and existing index links.\n\n" +
|
|
481
481
|
"**Returns:** Updated `intentId` and `description`, plus a confirmation message. The intent's embeddings and index relevancy scores are recalculated automatically.",
|
|
@@ -606,7 +606,7 @@ export function createIntentTools(defineTool, deps) {
|
|
|
606
606
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
607
607
|
const createIntentIndex = defineTool({
|
|
608
608
|
name: "create_intent_index",
|
|
609
|
-
description: "Manually links an intent to a network (community), making
|
|
609
|
+
description: "Manually links an intent to a network (community), making the approved signal eligible for background matching within that index. " +
|
|
610
610
|
"Normally intents are auto-assigned to relevant indexes on creation, but use this to explicitly add an intent to an additional index.\n\n" +
|
|
611
611
|
"**When to use:** When the user wants to share an existing intent with a specific community they belong to, " +
|
|
612
612
|
"or when auto-assignment missed a network the user considers relevant.\n\n" +
|
|
@@ -734,7 +734,7 @@ export function createIntentTools(defineTool, deps) {
|
|
|
734
734
|
const deleteIntentIndex = defineTool({
|
|
735
735
|
name: "delete_intent_index",
|
|
736
736
|
description: "Removes the link between an intent and a network. The intent itself is NOT deleted — it just stops being visible in that community " +
|
|
737
|
-
"and no longer
|
|
737
|
+
"and is no longer eligible for background matching within that index. The intent may still be linked to other indexes.\n\n" +
|
|
738
738
|
"**When to use:** When the user wants to withdraw an intent from a specific community without archiving it entirely. " +
|
|
739
739
|
"Use read_intent_indexes first to verify the link exists.\n\n" +
|
|
740
740
|
"**Returns:** Confirmation that the link was removed. To fully remove an intent, use delete_intent instead.",
|
|
@@ -787,8 +787,7 @@ export function createIntentTools(defineTool, deps) {
|
|
|
787
787
|
description: "Text-searches the authenticated user's own active signals by description. Case-insensitive substring " +
|
|
788
788
|
"match over the signal's payload and summary. Use when the user references a past signal they wrote " +
|
|
789
789
|
'("find my signal about React mentorship") or wants to audit what they\'ve posted.\n\n' +
|
|
790
|
-
"
|
|
791
|
-
"instead — that runs semantic matching across the user's networks.\n\n" +
|
|
790
|
+
"Approved signals are matched in the background. Use list_opportunities only to review persisted opportunities after background matching has produced them.\n\n" +
|
|
792
791
|
"**Returns:** `intents: [{ id, payload, summary, createdAt }]`, most recent first, up to `limit` (default 25).",
|
|
793
792
|
querySchema: z.object({
|
|
794
793
|
query: z.string().min(1).describe("Text to match against payload and summary (case-insensitive)."),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indexnetwork/protocol",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.2-rc.418.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -40,19 +40,20 @@
|
|
|
40
40
|
"eval:opportunity": "bun --env-file=../../.env.test ./eval/opportunity/opportunity.eval.ts",
|
|
41
41
|
"eval:clarification": "bun --env-file=../../.env.test ./eval/clarification/clarification.eval.ts",
|
|
42
42
|
"eval:canary": "bun --env-file=../../.env.test ./eval/canary/canary.eval.ts",
|
|
43
|
+
"eval:stance": "bun --env-file=../../.env.test ./eval/stance/stance.eval.ts",
|
|
43
44
|
"eval:view": "bun ./eval/viewer/viewer.eval.ts",
|
|
44
45
|
"eval:verify": "bun ./eval/verify.ts"
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {
|
|
47
|
-
"@langchain/core": "
|
|
48
|
-
"@langchain/langgraph": "
|
|
49
|
-
"@langchain/openai": "
|
|
50
|
-
"@modelcontextprotocol/server": "
|
|
51
|
-
"zod": "
|
|
48
|
+
"@langchain/core": "1.1.48",
|
|
49
|
+
"@langchain/langgraph": "1.3.2",
|
|
50
|
+
"@langchain/openai": "1.4.7",
|
|
51
|
+
"@modelcontextprotocol/server": "2.0.0",
|
|
52
|
+
"zod": "3.25.76"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
|
-
"@types/node": "
|
|
55
|
-
"dotenv": "
|
|
56
|
-
"typescript": "
|
|
55
|
+
"@types/node": "25.9.1",
|
|
56
|
+
"dotenv": "16.6.1",
|
|
57
|
+
"typescript": "5.9.3"
|
|
57
58
|
}
|
|
58
59
|
}
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Run discovery from an ad-hoc query (e.g. chat "find me a mentor", "who needs a React developer").
|
|
3
|
-
*
|
|
4
|
-
* Invokes the opportunity graph with the query as sourceText. The HyDE graph's
|
|
5
|
-
* LensInferrer automatically infers search lenses from the query, replacing the
|
|
6
|
-
* old hardcoded strategy selection. Returns formatted candidates (enriched with
|
|
7
|
-
* profile name/bio) for chat display.
|
|
8
|
-
*
|
|
9
|
-
* Used by the discover_opportunities chat tool.
|
|
10
|
-
*/
|
|
11
|
-
import type { ChatGraphCompositeDatabase, UserRecord } from "../../shared/interfaces/database.interface.js";
|
|
12
|
-
import type { Cache } from "../../shared/interfaces/cache.interface.js";
|
|
13
|
-
import type { QuestionerEnqueueFn } from "../../capabilities/questions.enqueue.facade.js";
|
|
14
|
-
import type { ToolScopeType } from "../../shared/agent/tool.scope.js";
|
|
15
|
-
import { OpportunityPresenter, type OpportunityPresentationResult, type HomeCardPresentationResult } from "./opportunity.presenter.js";
|
|
16
|
-
import type { ChatSummaryReader } from "../../shared/interfaces/chat-summary.interface.js";
|
|
17
|
-
import type { QuestionGeneratorReader } from "../../shared/interfaces/question-generator.interface.js";
|
|
18
|
-
import type { NegotiationSummaryReader } from "../../shared/interfaces/negotiation-summary.interface.js";
|
|
19
|
-
import type { Question, QuestionStrategy } from "../../shared/schemas/question.schema.js";
|
|
20
|
-
import type { DiscoverDebugStep } from '../domain/opportunity.discovery.contracts.js';
|
|
21
|
-
/** Compiled opportunity graph (from OpportunityGraphFactory.createGraph()). */
|
|
22
|
-
export type CompiledOpportunityGraph = ReturnType<import("./opportunity.graph.js").OpportunityGraphFactory["createGraph"]>;
|
|
23
|
-
export interface DiscoverInput {
|
|
24
|
-
/** Compiled opportunity graph (already has DB, embedder, cache, HyDE graph). */
|
|
25
|
-
opportunityGraph: CompiledOpportunityGraph;
|
|
26
|
-
/** Database for enriching candidates with profile (getProfile). */
|
|
27
|
-
database: ChatGraphCompositeDatabase;
|
|
28
|
-
userId: string;
|
|
29
|
-
query: string;
|
|
30
|
-
indexScope: string[];
|
|
31
|
-
limit?: number;
|
|
32
|
-
/** Optional intent to use as discovery source and for triggeredBy (e.g. from opportunity queue). */
|
|
33
|
-
triggerIntentId?: string;
|
|
34
|
-
/** When set, filter discovery candidates to this specific user only (direct connection). */
|
|
35
|
-
targetUserId?: string;
|
|
36
|
-
/** When set, discover on behalf of this user (introducer flow). The caller (userId) becomes the introducer. */
|
|
37
|
-
onBehalfOfUserId?: string;
|
|
38
|
-
/** When provided, each opportunity is enriched with personalized presentation (headline, personalizedSummary, suggestedAction). */
|
|
39
|
-
presenter?: OpportunityPresenter;
|
|
40
|
-
/**
|
|
41
|
-
* When true, use the full home card presentation format (with narratorRemark, action labels, mutualIntentsLabel).
|
|
42
|
-
* This enables rendering the same rich opportunity cards in chat as on the home page.
|
|
43
|
-
*/
|
|
44
|
-
useHomeCardFormat?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* When true, skip the LLM presenter and return minimal card data only (faster for chat).
|
|
47
|
-
* Sets homeCardPresentation and narratorChip from static labels and match reason.
|
|
48
|
-
*/
|
|
49
|
-
minimalForChat?: boolean;
|
|
50
|
-
/** When set (e.g. from chat), create opportunities as draft with context.conversationId = chatSessionId. */
|
|
51
|
-
chatSessionId?: string;
|
|
52
|
-
/** Redis cache for discovery pagination. When provided, remaining candidates are cached for continuation. */
|
|
53
|
-
cache?: Cache;
|
|
54
|
-
/**
|
|
55
|
-
* Which flow is invoking discovery. Drives the graph's trigger-aware branches
|
|
56
|
-
* in persist (initial status) and negotiate (park window + streaming). When
|
|
57
|
-
* omitted, the graph defaults to 'ambient'. Pass 'orchestrator' from the
|
|
58
|
-
* chat `discover_opportunities` tool so users see drafts stream in and the
|
|
59
|
-
* accepted-pair lookup surfaces existing connections.
|
|
60
|
-
*/
|
|
61
|
-
trigger?: 'ambient' | 'orchestrator';
|
|
62
|
-
/**
|
|
63
|
-
* MCP-only. When set, the opportunity graph's negotiate phase is capped at
|
|
64
|
-
* this many milliseconds; on timeout the caller gets whichever candidates
|
|
65
|
-
* finished, the rest stay in `negotiating` and finalize in the background.
|
|
66
|
-
* Chat, ambient queue, and all other callers omit this — existing behavior.
|
|
67
|
-
*/
|
|
68
|
-
negotiateTimeoutMs?: number;
|
|
69
|
-
/** Optional read-through chat-session digest reader. Required for chatContext enrichment. */
|
|
70
|
-
chatSummary?: ChatSummaryReader;
|
|
71
|
-
/**
|
|
72
|
-
* Optional negotiation summarizer. When provided, each post-negotiation digest
|
|
73
|
-
* replaces the raw negotiation in the decision-question generator's input,
|
|
74
|
-
* keeping that prompt small and predictable regardless of candidate count.
|
|
75
|
-
* When omitted, a deterministic fallback digest is built per negotiation.
|
|
76
|
-
*/
|
|
77
|
-
negotiationSummary?: NegotiationSummaryReader;
|
|
78
|
-
/** Optional decision-question generator. When omitted, no questions are produced. */
|
|
79
|
-
questionGenerator?: QuestionGeneratorReader;
|
|
80
|
-
/**
|
|
81
|
-
* Master switch for decision-question generation. When false, this code path
|
|
82
|
-
* is skipped entirely regardless of trigger. The composition root passes
|
|
83
|
-
* `isDiscoveryQuestionsEnabled()` (QUESTIONER_ENABLED + QUESTIONER_DISCOVERY_ENABLED).
|
|
84
|
-
*/
|
|
85
|
-
enableQuestions?: boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Optional async question enqueue callback. When provided, question generation
|
|
88
|
-
* is dispatched asynchronously to the QuestionerQueue instead of running inline
|
|
89
|
-
* via the `questionGenerator`. The callback receives an enqueue payload and
|
|
90
|
-
* returns a promise that resolves when the job is enqueued (not when generation
|
|
91
|
-
* completes).
|
|
92
|
-
*/
|
|
93
|
-
questionerEnqueue?: QuestionerEnqueueFn;
|
|
94
|
-
/** Focused request scope type for generated discovery questions. */
|
|
95
|
-
scopeType?: ToolScopeType;
|
|
96
|
-
/** Focused request scope id. When `scopeType === 'network'`, persisted as actor networkId. */
|
|
97
|
-
scopeId?: string;
|
|
98
|
-
}
|
|
99
|
-
/** One formatted opportunity for chat (candidate-facing). */
|
|
100
|
-
export interface FormattedDiscoveryCandidate {
|
|
101
|
-
opportunityId: string;
|
|
102
|
-
userId: string;
|
|
103
|
-
name?: string;
|
|
104
|
-
avatar?: string | null;
|
|
105
|
-
bio?: string;
|
|
106
|
-
matchReason: string;
|
|
107
|
-
score: number;
|
|
108
|
-
status?: string;
|
|
109
|
-
/** Present when DiscoverInput.presenter was provided (basic presentation). */
|
|
110
|
-
presentation?: OpportunityPresentationResult;
|
|
111
|
-
/** Present when DiscoverInput.useHomeCardFormat is true (full home card contract). */
|
|
112
|
-
homeCardPresentation?: HomeCardPresentationResult;
|
|
113
|
-
/** Viewer's role in this opportunity. */
|
|
114
|
-
viewerRole?: string;
|
|
115
|
-
/** Whether the viewer (as introducer) has approved the introduction. */
|
|
116
|
-
viewerApproved?: boolean;
|
|
117
|
-
/** Timestamp set once this viewer has already acted on the opportunity. */
|
|
118
|
-
viewerActedAt?: string | null;
|
|
119
|
-
/** Full user record for the candidate (needed for socials / Telegram fallback). */
|
|
120
|
-
candidateUser?: UserRecord | null;
|
|
121
|
-
/** Whether the counterpart is a ghost (not yet onboarded) user. */
|
|
122
|
-
isGhost?: boolean;
|
|
123
|
-
/** Narrator chip for home card display (name + remark, with optional avatar/userId for introducer). */
|
|
124
|
-
narratorChip?: {
|
|
125
|
-
name: string;
|
|
126
|
-
text: string;
|
|
127
|
-
avatar?: string | null;
|
|
128
|
-
userId?: string;
|
|
129
|
-
};
|
|
130
|
-
/** Second party in introducer arrow layout (candidate -> secondParty). Present when viewer is introducer. */
|
|
131
|
-
secondParty?: {
|
|
132
|
-
name: string;
|
|
133
|
-
avatar?: string | null;
|
|
134
|
-
userId?: string;
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
/** One step for debug visibility (subgraph/subtask). */
|
|
138
|
-
export type { DiscoverDebugStep } from '../domain/opportunity.discovery.contracts.js';
|
|
139
|
-
/** One existing connection (no new opportunity created; user already has one with this person). */
|
|
140
|
-
export interface ExistingConnection {
|
|
141
|
-
userId: string;
|
|
142
|
-
name: string;
|
|
143
|
-
status?: string;
|
|
144
|
-
opportunityId?: string;
|
|
145
|
-
}
|
|
146
|
-
export interface DiscoverResult {
|
|
147
|
-
found: boolean;
|
|
148
|
-
count: number;
|
|
149
|
-
message?: string;
|
|
150
|
-
opportunities?: FormattedDiscoveryCandidate[];
|
|
151
|
-
/** Existing connections eligible for card display (draft, latent, or pending). Others are mention-only. */
|
|
152
|
-
existingConnections?: ExistingConnection[];
|
|
153
|
-
/** All existing connections for mention text (e.g. "You already have a connection with: X (pending), Y (draft)."). */
|
|
154
|
-
existingConnectionsForMention?: ExistingConnection[];
|
|
155
|
-
/**
|
|
156
|
-
* Orchestrator-only: accepted opportunities the persist step found between the
|
|
157
|
-
* discoverer and a candidate counterparty (status='accepted'). Populated from
|
|
158
|
-
* OpportunityGraphState.dedupAlreadyAccepted. Used by the discover_opportunities
|
|
159
|
-
* tool to tell the LLM "this pair is already connected — open the existing
|
|
160
|
-
* chat rather than creating a new draft". Empty for the ambient trigger.
|
|
161
|
-
*/
|
|
162
|
-
alreadyAcceptedPairs?: Array<{
|
|
163
|
-
opportunityId: string;
|
|
164
|
-
counterpartyUserId: string;
|
|
165
|
-
}>;
|
|
166
|
-
/** When true, the chat agent should call create_intent(suggestedIntentDescription) and retry discovery. */
|
|
167
|
-
createIntentSuggested?: boolean;
|
|
168
|
-
/** Description to pass to create_intent when createIntentSuggested is true. */
|
|
169
|
-
suggestedIntentDescription?: string;
|
|
170
|
-
/** Internal steps for copy-debug (select_strategies, opportunity_graph, enrich, etc.). */
|
|
171
|
-
debugSteps?: DiscoverDebugStep[];
|
|
172
|
-
/** Pagination metadata -- present when there are more unevaluated candidates. */
|
|
173
|
-
pagination?: {
|
|
174
|
-
discoveryId: string;
|
|
175
|
-
evaluated: number;
|
|
176
|
-
remaining: number;
|
|
177
|
-
};
|
|
178
|
-
/** 0–3 decision questions produced by the orchestrator path. Omitted when none. */
|
|
179
|
-
questions?: Question[];
|
|
180
|
-
/** Debug metadata for `debugMeta.discoveryQuestions` plumbing. */
|
|
181
|
-
discoveryQuestionsDebug?: {
|
|
182
|
-
inputMode: "transcripts" | "insights";
|
|
183
|
-
finalCount: number;
|
|
184
|
-
strategies: QuestionStrategy[];
|
|
185
|
-
durationMs: number;
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Run discovery from an ad-hoc query (e.g. "find me a mentor", "who needs a React developer").
|
|
190
|
-
* The HyDE graph's LensInferrer automatically infers search lenses from the query.
|
|
191
|
-
* Invokes the opportunity graph and returns formatted candidates suitable for chat display.
|
|
192
|
-
*/
|
|
193
|
-
export declare function runDiscoverFromQuery(input: DiscoverInput): Promise<DiscoverResult>;
|
|
194
|
-
/**
|
|
195
|
-
* Continue a paginated discovery by evaluating the next batch of cached candidates.
|
|
196
|
-
* Loads candidates from Redis, invokes the opportunity graph in continue_discovery mode,
|
|
197
|
-
* then enriches and returns the results with updated pagination metadata.
|
|
198
|
-
*
|
|
199
|
-
* @param input - Continuation context (graph, database, cache, discoveryId, etc.).
|
|
200
|
-
* @returns Discovery result with enriched opportunities and pagination state.
|
|
201
|
-
*/
|
|
202
|
-
export declare function continueDiscovery(input: {
|
|
203
|
-
opportunityGraph: CompiledOpportunityGraph;
|
|
204
|
-
database: ChatGraphCompositeDatabase;
|
|
205
|
-
cache: Cache;
|
|
206
|
-
userId: string;
|
|
207
|
-
discoveryId: string;
|
|
208
|
-
/** If provided, validates the cached session's indexScope contains this network. */
|
|
209
|
-
expectedIndexId?: string;
|
|
210
|
-
limit?: number;
|
|
211
|
-
chatSessionId?: string;
|
|
212
|
-
minimalForChat?: boolean;
|
|
213
|
-
presenter?: OpportunityPresenter;
|
|
214
|
-
useHomeCardFormat?: boolean;
|
|
215
|
-
}): Promise<DiscoverResult>;
|