@indexnetwork/protocol 6.15.0-rc.407.1 → 8.0.1-rc.417.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.
Files changed (110) hide show
  1. package/CHANGELOG.md +302 -0
  2. package/IMPLEMENTATION.md +7 -4
  3. package/dist/capabilities/opportunities.facade.d.ts +4 -0
  4. package/dist/capabilities/opportunities.facade.js +4 -0
  5. package/dist/chat/chat-streaming.types.d.ts +4 -5
  6. package/dist/chat/chat.agent.d.ts +0 -19
  7. package/dist/chat/chat.agent.js +1 -70
  8. package/dist/chat/chat.persona.d.ts +0 -6
  9. package/dist/chat/chat.persona.js +0 -1
  10. package/dist/chat/chat.prompt.js +10 -10
  11. package/dist/chat/chat.prompt.modules.js +0 -104
  12. package/dist/chat/chat.tools.js +11 -7
  13. package/dist/chat/negotiator.persona.js +0 -1
  14. package/dist/chat/onboarding.persona.js +0 -1
  15. package/dist/chat/reporter.persona.d.ts +1 -1
  16. package/dist/chat/reporter.persona.js +1 -2
  17. package/dist/chat/reporter.prompt.js +5 -5
  18. package/dist/chat/signal.persona.js +0 -1
  19. package/dist/communities/application/network.tools.js +48 -27
  20. package/dist/contacts/application/contact.tools.js +9 -9
  21. package/dist/index.d.ts +9 -2
  22. package/dist/index.js +5 -0
  23. package/dist/maintenance/maintenance.graph.js +7 -0
  24. package/dist/mcp/mcp.authorization-policy.d.ts +250 -0
  25. package/dist/mcp/mcp.authorization-policy.js +522 -0
  26. package/dist/mcp/mcp.server.d.ts +6 -29
  27. package/dist/mcp/mcp.server.js +202 -228
  28. package/dist/negotiation/application/negotiation.agent.js +29 -5
  29. package/dist/negotiation/application/negotiation.graph.d.ts +2 -5
  30. package/dist/negotiation/application/negotiation.graph.js +53 -23
  31. package/dist/negotiation/domain/index.d.ts +3 -0
  32. package/dist/negotiation/domain/index.js +3 -0
  33. package/dist/negotiation/domain/negotiation.deadlock.d.ts +7 -1
  34. package/dist/negotiation/domain/negotiation.deadlock.js +48 -1
  35. package/dist/negotiation/domain/negotiation.stance.contracts.d.ts +85 -0
  36. package/dist/negotiation/domain/negotiation.stance.contracts.js +140 -0
  37. package/dist/negotiation/domain/negotiation.state.d.ts +2 -3
  38. package/dist/negotiation/domain/negotiation.state.js +2 -3
  39. package/dist/negotiation/public/index.d.ts +2 -0
  40. package/dist/negotiation/public/index.js +2 -0
  41. package/dist/opportunity/application/index.d.ts +0 -3
  42. package/dist/opportunity/application/index.js +0 -3
  43. package/dist/opportunity/application/opportunity.graph.d.ts +0 -43
  44. package/dist/opportunity/application/opportunity.graph.js +7 -113
  45. package/dist/opportunity/application/opportunity.introducer-feature.d.ts +2 -0
  46. package/dist/opportunity/application/opportunity.introducer-feature.js +4 -0
  47. package/dist/opportunity/application/opportunity.owner-approval.d.ts +118 -0
  48. package/dist/opportunity/application/opportunity.owner-approval.js +34 -0
  49. package/dist/opportunity/application/opportunity.owner-provenance.d.ts +6 -0
  50. package/dist/opportunity/application/opportunity.owner-provenance.js +28 -0
  51. package/dist/opportunity/application/opportunity.tools.d.ts +3 -3
  52. package/dist/opportunity/application/opportunity.tools.js +77 -870
  53. package/dist/opportunity/discriminator/discriminator.shadow.js +17 -10
  54. package/dist/opportunity/discriminator/discriminator.types.d.ts +2 -0
  55. package/dist/opportunity/domain/index.d.ts +0 -2
  56. package/dist/opportunity/domain/index.js +0 -2
  57. package/dist/opportunity/domain/opportunity.state.d.ts +2 -70
  58. package/dist/opportunity/domain/opportunity.state.js +2 -55
  59. package/dist/opportunity/opportunity.owner-approval.d.ts +5 -0
  60. package/dist/opportunity/opportunity.owner-approval.js +5 -0
  61. package/dist/opportunity/ports/opportunity.tools.port.d.ts +12 -1
  62. package/dist/opportunity/public/index.d.ts +3 -3
  63. package/dist/opportunity/public/index.js +2 -1
  64. package/dist/participant-agents/application/agent.tools.d.ts +1 -1
  65. package/dist/participant-agents/application/agent.tools.js +44 -6
  66. package/dist/participant-agents/application/index.d.ts +5 -3
  67. package/dist/participant-agents/application/index.js +5 -3
  68. package/dist/questions/application/question.tools.js +31 -2
  69. package/dist/runtime/foreground/composition/tool.factory.d.ts +2 -1
  70. package/dist/runtime/foreground/composition/tool.factory.js +9 -2
  71. package/dist/runtime/foreground/composition/tool.registry.d.ts +16 -2
  72. package/dist/runtime/foreground/composition/tool.registry.js +41 -38
  73. package/dist/shared/agent/activity-projection.d.ts +271 -0
  74. package/dist/shared/agent/activity-projection.js +248 -0
  75. package/dist/shared/agent/canonical-guidance.d.ts +30 -0
  76. package/dist/shared/agent/canonical-guidance.js +249 -0
  77. package/dist/shared/agent/tool.helpers.d.ts +9 -17
  78. package/dist/shared/agent/tool.runtime.js +1 -3
  79. package/dist/shared/agent/utility.tools.d.ts +11 -1
  80. package/dist/shared/agent/utility.tools.js +126 -90
  81. package/dist/shared/interfaces/auth.interface.d.ts +2 -8
  82. package/dist/shared/interfaces/chat-session.interface.js +5 -0
  83. package/dist/shared/interfaces/database.interface.d.ts +12 -5
  84. package/dist/shared/observability/request-context.d.ts +4 -40
  85. package/dist/shared/schemas/mcp-auth.schema.d.ts +87 -15
  86. package/dist/shared/schemas/mcp-auth.schema.js +49 -1
  87. package/dist/signals/application/intent.tools.js +7 -8
  88. package/package.json +10 -9
  89. package/dist/opportunity/application/opportunity.discover.d.ts +0 -215
  90. package/dist/opportunity/application/opportunity.discover.js +0 -793
  91. package/dist/opportunity/application/opportunity.discovery-continuation-finalization.d.ts +0 -34
  92. package/dist/opportunity/application/opportunity.discovery-continuation-finalization.js +0 -74
  93. package/dist/opportunity/application/opportunity.discovery-mcp-lifecycle-finalization.d.ts +0 -44
  94. package/dist/opportunity/application/opportunity.discovery-mcp-lifecycle-finalization.js +0 -92
  95. package/dist/opportunity/domain/opportunity.discovery-run-coalescing.d.ts +0 -33
  96. package/dist/opportunity/domain/opportunity.discovery-run-coalescing.js +0 -33
  97. package/dist/opportunity/domain/opportunity.discovery.contracts.d.ts +0 -45
  98. package/dist/opportunity/domain/opportunity.discovery.contracts.js +0 -1
  99. package/dist/opportunity/opportunity.discover.d.ts +0 -5
  100. package/dist/opportunity/opportunity.discover.js +0 -5
  101. package/dist/opportunity/opportunity.discovery-continuation-finalization.d.ts +0 -5
  102. package/dist/opportunity/opportunity.discovery-continuation-finalization.js +0 -5
  103. package/dist/opportunity/opportunity.discovery-mcp-lifecycle-finalization.d.ts +0 -5
  104. package/dist/opportunity/opportunity.discovery-mcp-lifecycle-finalization.js +0 -5
  105. package/dist/opportunity/opportunity.discovery-run-coalescing.d.ts +0 -5
  106. package/dist/opportunity/opportunity.discovery-run-coalescing.js +0 -5
  107. package/dist/opportunity/opportunity.discovery.contracts.d.ts +0 -5
  108. package/dist/opportunity/opportunity.discovery.contracts.js +0 -5
  109. package/dist/shared/interfaces/discovery-run.interface.d.ts +0 -70
  110. package/dist/shared/interfaces/discovery-run.interface.js +0 -1
@@ -1,34 +0,0 @@
1
- import type { Cache } from '../../shared/interfaces/cache.interface.js';
2
- import type { ChatGraphCompositeDatabase, Opportunity } from '../../shared/interfaces/database.interface.js';
3
- import type { CandidateMatch } from '../domain/opportunity.state.js';
4
- import type { DiscoverDebugStep, DiscoveryResultContract } from '../domain/opportunity.discovery.contracts.js';
5
- export interface DiscoveryContinuationCacheSession {
6
- candidates: CandidateMatch[];
7
- }
8
- export interface DiscoveryContinuationGraphResult {
9
- trace?: Array<{
10
- node: string;
11
- detail?: string;
12
- data?: Record<string, unknown>;
13
- }>;
14
- error?: string;
15
- remainingCandidates?: CandidateMatch[];
16
- opportunities?: Opportunity[];
17
- }
18
- interface DiscoveryContinuationFinalizationInput<TOpportunity> {
19
- result: DiscoveryContinuationGraphResult;
20
- cache: Pick<Cache, 'set' | 'delete'>;
21
- cacheKey: string;
22
- cached: DiscoveryContinuationCacheSession;
23
- userId: string;
24
- discoveryId: string;
25
- database: Pick<ChatGraphCompositeDatabase, 'getOpportunitiesByIds'>;
26
- enrich: (opportunities: Opportunity[], debugSteps: DiscoverDebugStep[]) => Promise<TOpportunity[]>;
27
- }
28
- /**
29
- * Finalizes a successful continuation graph result without owning session
30
- * lookup, scope admission, or graph invocation. Cache failures are advisory;
31
- * lifecycle refresh and presentation use the graph result regardless.
32
- */
33
- export declare function finalizeDiscoveryContinuation<TOpportunity>(args: DiscoveryContinuationFinalizationInput<TOpportunity>): Promise<DiscoveryResultContract<TOpportunity>>;
34
- export {};
@@ -1,74 +0,0 @@
1
- import { protocolLogger } from '../../shared/observability/protocol.logger.js';
2
- const logger = protocolLogger('OpportunityDiscover');
3
- /**
4
- * Finalizes a successful continuation graph result without owning session
5
- * lookup, scope admission, or graph invocation. Cache failures are advisory;
6
- * lifecycle refresh and presentation use the graph result regardless.
7
- */
8
- export async function finalizeDiscoveryContinuation(args) {
9
- const debugSteps = [];
10
- for (const trace of args.result.trace || []) {
11
- debugSteps.push({
12
- step: trace.node,
13
- detail: trace.detail,
14
- ...(trace.data ? { data: trace.data } : {}),
15
- });
16
- }
17
- if (args.result.error) {
18
- logger.warn('continueDiscovery graph returned error', { error: args.result.error });
19
- return {
20
- found: false,
21
- count: 0,
22
- message: 'Discovery continuation failed. Please start a new search.',
23
- debugSteps,
24
- };
25
- }
26
- const remaining = args.result.remainingCandidates || [];
27
- let pagination;
28
- try {
29
- if (remaining.length > 0) {
30
- await args.cache.set(args.cacheKey, {
31
- ...args.cached,
32
- candidates: remaining,
33
- }, { ttl: 1800 });
34
- pagination = {
35
- discoveryId: args.discoveryId,
36
- evaluated: args.cached.candidates.length - remaining.length,
37
- remaining: remaining.length,
38
- };
39
- }
40
- else {
41
- await args.cache.delete(args.cacheKey);
42
- }
43
- }
44
- catch (cacheErr) {
45
- logger.warn('Failed to update discovery pagination cache', {
46
- userId: args.userId,
47
- discoveryId: args.discoveryId,
48
- error: cacheErr instanceof Error ? cacheErr.message : String(cacheErr),
49
- });
50
- }
51
- const opportunities = Array.isArray(args.result.opportunities) ? args.result.opportunities : [];
52
- const refreshed = opportunities.length > 0
53
- ? await args.database.getOpportunitiesByIds(opportunities.map((opportunity) => opportunity.id))
54
- : [];
55
- const refreshedById = new Map(refreshed.map((opportunity) => [opportunity.id, opportunity]));
56
- const currentOpportunities = opportunities.map((opportunity) => refreshedById.get(opportunity.id) ?? opportunity);
57
- if (currentOpportunities.length === 0) {
58
- return {
59
- found: false,
60
- count: 0,
61
- message: 'No more matching opportunities found in the remaining candidates.',
62
- debugSteps,
63
- pagination,
64
- };
65
- }
66
- const enriched = await args.enrich(currentOpportunities, debugSteps);
67
- return {
68
- found: true,
69
- count: enriched.length,
70
- opportunities: enriched,
71
- debugSteps,
72
- pagination,
73
- };
74
- }
@@ -1,44 +0,0 @@
1
- import type { OpportunityStatus } from '../../shared/interfaces/database.interface.js';
2
- import type { OpportunityCardLike } from './opportunity.card-presentation.js';
3
- import type { ExistingConnection, FormattedDiscoveryCandidate } from './opportunity.discover.js';
4
- type DiscoveryPagination = {
5
- discoveryId: string;
6
- evaluated: number;
7
- remaining: number;
8
- };
9
- export interface DiscoveryMcpLifecycleFinalizationInput<TCard extends OpportunityCardLike> {
10
- isMcp: boolean;
11
- candidates: FormattedDiscoveryCandidate[];
12
- existingConnections?: ExistingConnection[];
13
- existingConnectionsForMention?: ExistingConnection[];
14
- alreadyAcceptedPairs?: Array<{
15
- opportunityId: string;
16
- counterpartyUserId: string;
17
- }>;
18
- pagination?: DiscoveryPagination;
19
- isIntroducerFlow: boolean;
20
- displayLimit: number;
21
- readOpportunitiesByIds: (ids: string[]) => Promise<Array<{
22
- id: string;
23
- status: OpportunityStatus;
24
- }>>;
25
- warn: (message: string, data: Record<string, unknown>) => void;
26
- /** The caller supplies the only allowed safe-presentation path for card text. */
27
- projectSafeCard: (candidate: FormattedDiscoveryCandidate) => TCard;
28
- }
29
- export interface DiscoveryMcpLifecycleFinalization<TCard extends OpportunityCardLike> {
30
- displayedCards: TCard[];
31
- /** Source candidates retain viewer approval data for facade-owned link minting. */
32
- displayedCandidates: FormattedDiscoveryCandidate[];
33
- negotiatingCount: number;
34
- /** Adds lifecycle-aware completion copy after facade-owned link decoration. */
35
- composeMessage: (baseMessage: string) => string;
36
- }
37
- /**
38
- * Reconciles a discovery graph result with authoritative opportunity lifecycle
39
- * rows before the MCP tool presents cards. Graph output is intentionally not
40
- * trusted for new-card lifecycle after its negotiate phase. The tools facade
41
- * continues to own link writes and the outer tool response.
42
- */
43
- export declare function finalizeMcpDiscoveryLifecycle<TCard extends OpportunityCardLike>(input: DiscoveryMcpLifecycleFinalizationInput<TCard>): Promise<DiscoveryMcpLifecycleFinalization<TCard>>;
44
- export {};
@@ -1,92 +0,0 @@
1
- function existingConnectionsNarrative(connections) {
2
- if (connections.length === 0)
3
- return '';
4
- return ('\n\nYou already have a connection with: ' +
5
- connections.map((connection) => connection.name + (connection.status ? ` (${connection.status})` : '')).join(', ') +
6
- '. View on your home page.');
7
- }
8
- function alreadyAcceptedNarrative(alreadyAcceptedPairs) {
9
- if (alreadyAcceptedPairs.length === 0)
10
- return '';
11
- return `\n\nYou already have ${alreadyAcceptedPairs.length} accepted opportunity(ies) with some of these candidates — open the existing chat with them rather than creating a new draft.`;
12
- }
13
- /**
14
- * Reconciles a discovery graph result with authoritative opportunity lifecycle
15
- * rows before the MCP tool presents cards. Graph output is intentionally not
16
- * trusted for new-card lifecycle after its negotiate phase. The tools facade
17
- * continues to own link writes and the outer tool response.
18
- */
19
- export async function finalizeMcpDiscoveryLifecycle(input) {
20
- const existingConnectionIds = new Set((input.existingConnections ?? [])
21
- .map((connection) => connection.opportunityId)
22
- .filter((id) => typeof id === 'string'));
23
- let negotiatingCount = 0;
24
- let visibleCandidates = input.candidates;
25
- if (input.isMcp && input.candidates.length > 0) {
26
- const newCardIds = input.candidates
27
- .filter((candidate) => !existingConnectionIds.has(candidate.opportunityId))
28
- .map((candidate) => candidate.opportunityId);
29
- const refreshed = newCardIds.length > 0
30
- ? await input.readOpportunitiesByIds(newCardIds)
31
- : [];
32
- const statusById = new Map(refreshed.map((opportunity) => [opportunity.id, opportunity.status]));
33
- const draftCandidates = [];
34
- for (const candidate of input.candidates) {
35
- if (existingConnectionIds.has(candidate.opportunityId)) {
36
- // Re-surfaced connections preserve their discover-time lifecycle.
37
- draftCandidates.push(candidate);
38
- continue;
39
- }
40
- const refreshedStatus = statusById.get(candidate.opportunityId);
41
- if (refreshedStatus === 'draft') {
42
- draftCandidates.push({ ...candidate, status: refreshedStatus });
43
- continue;
44
- }
45
- if (refreshedStatus === 'negotiating') {
46
- negotiatingCount += 1;
47
- continue;
48
- }
49
- if (refreshedStatus === 'rejected' || refreshedStatus === 'stalled') {
50
- continue;
51
- }
52
- // Pending, latent, and missing rows are not expected after the graph's
53
- // negotiate phase. Preserve the established fail-closed display policy:
54
- // do not surface a card, but make the deferred state observable.
55
- input.warn('unexpected refreshed status — counting as negotiating', {
56
- opportunityId: candidate.opportunityId,
57
- refreshedStatus,
58
- });
59
- negotiatingCount += 1;
60
- }
61
- visibleCandidates = draftCandidates;
62
- }
63
- // Projection is supplied by the tools facade so this policy cannot choose a
64
- // raw-reasoning path; callers must use getSafePresentationOrSkip-compatible copy.
65
- const projectedCards = visibleCandidates.map(input.projectSafeCard);
66
- const displayedCards = projectedCards.slice(0, input.displayLimit);
67
- const displayedCandidates = visibleCandidates.slice(0, input.displayLimit);
68
- const extraFromCap = projectedCards.length - displayedCards.length;
69
- const existingNarrative = existingConnectionsNarrative(input.existingConnectionsForMention ?? input.existingConnections ?? []);
70
- const acceptedNarrative = alreadyAcceptedNarrative(input.alreadyAcceptedPairs ?? []);
71
- const totalRemaining = (input.pagination?.remaining ?? 0) + extraFromCap;
72
- const completionNarrative = totalRemaining > 0 && input.pagination?.discoveryId
73
- ? `\n\nThere are ${totalRemaining} more candidates. Ask if the user wants to see more — they can say "show me more" and you should call discover_opportunities with continueFrom="${input.pagination.discoveryId}".`
74
- : input.isIntroducerFlow
75
- ? '\n\nThese are all the introduction candidates I found for this person.'
76
- : '\n\nThese are all the connections I found. If the user wants to attract more connections, suggest they create a signal — e.g. "Would you like to create a signal so others looking for someone like you can find you?" If they agree, call create_intent with a description based on what they were searching for.';
77
- return {
78
- displayedCards,
79
- displayedCandidates,
80
- negotiatingCount,
81
- composeMessage(baseMessage) {
82
- const message = baseMessage + existingNarrative + acceptedNarrative + completionNarrative;
83
- if (!input.isMcp || negotiatingCount === 0)
84
- return message;
85
- if (displayedCards.length > 0) {
86
- return message + `\n\n${negotiatingCount} more opportunit${negotiatingCount === 1 ? 'y is' : 'ies are'} still being evaluated — check back via \`list_opportunities\` shortly.`;
87
- }
88
- // Preserve existing/accepted facts but omit card-only completion copy.
89
- return `Found candidates, but they're still being evaluated. Try \`list_opportunities\` in a minute — ${negotiatingCount} pending.` + existingNarrative + acceptedNarrative;
90
- },
91
- };
92
- }
@@ -1,33 +0,0 @@
1
- type DiscoveryRunScope = {
2
- scopeType?: string;
3
- scopeId?: string;
4
- };
5
- type DiscoveryCoalescingRequest = {
6
- continueFrom?: string;
7
- searchQuery?: string;
8
- networkId?: string;
9
- intentId?: string;
10
- targetUserId?: string;
11
- introTargetUserId?: string;
12
- partyUserIds?: string[];
13
- entities?: Array<{
14
- userId: string;
15
- networkId: string;
16
- }>;
17
- hint?: string;
18
- };
19
- type ActiveDiscoveryRunForCoalescing = {
20
- id: string;
21
- status: string;
22
- input: DiscoveryCoalescingRequest;
23
- context: DiscoveryRunScope;
24
- };
25
- /**
26
- * Finds an active MCP discovery run that describes the same user request and
27
- * resolved scope boundary. The identity is deliberately normalized so harmless
28
- * formatting differences share one expensive graph execution, while distinct
29
- * hints, opaque continuation tokens, entity networks, and scopes remain
30
- * independent runs.
31
- */
32
- export declare function findCoalescedDiscoveryRun(input: DiscoveryCoalescingRequest, context: DiscoveryRunScope, activeRuns: readonly ActiveDiscoveryRunForCoalescing[]): ActiveDiscoveryRunForCoalescing | undefined;
33
- export {};
@@ -1,33 +0,0 @@
1
- /**
2
- * Finds an active MCP discovery run that describes the same user request and
3
- * resolved scope boundary. The identity is deliberately normalized so harmless
4
- * formatting differences share one expensive graph execution, while distinct
5
- * hints, opaque continuation tokens, entity networks, and scopes remain
6
- * independent runs.
7
- */
8
- export function findCoalescedDiscoveryRun(input, context, activeRuns) {
9
- const signature = discoveryRunSignature(input, context);
10
- return activeRuns.find((run) => discoveryRunSignature(run.input, run.context) === signature);
11
- }
12
- function discoveryRunSignature(input, scope) {
13
- const text = (value) => (value ?? "").trim().toLowerCase();
14
- const id = (value) => (value ?? "").trim();
15
- const entities = [...(input.entities ?? [])]
16
- .map((entity) => JSON.stringify([id(entity.networkId), id(entity.userId)]))
17
- .sort();
18
- return JSON.stringify({
19
- searchQuery: text(input.searchQuery),
20
- networkId: id(input.networkId),
21
- intentId: id(input.intentId),
22
- targetUserId: id(input.targetUserId),
23
- introTargetUserId: id(input.introTargetUserId),
24
- continueFrom: id(input.continueFrom),
25
- hint: text(input.hint),
26
- partyUserIds: [...(input.partyUserIds ?? [])].map((value) => value.trim()).sort(),
27
- entities,
28
- scope: {
29
- scopeType: id(scope.scopeType),
30
- scopeId: id(scope.scopeId),
31
- },
32
- });
33
- }
@@ -1,45 +0,0 @@
1
- import type { Question, QuestionStrategy } from "../../shared/schemas/question.schema.js";
2
- /** One step for discovery debug visibility (subgraph/subtask). */
3
- export interface DiscoverDebugStep {
4
- step: string;
5
- detail?: string;
6
- data?: Record<string, unknown>;
7
- }
8
- /** Neutral discovery result envelope shared with continuation finalization. */
9
- export interface DiscoveryResultContract<TOpportunity> {
10
- found: boolean;
11
- count: number;
12
- message?: string;
13
- opportunities?: TOpportunity[];
14
- existingConnections?: Array<{
15
- userId: string;
16
- name: string;
17
- status?: string;
18
- opportunityId?: string;
19
- }>;
20
- existingConnectionsForMention?: Array<{
21
- userId: string;
22
- name: string;
23
- status?: string;
24
- opportunityId?: string;
25
- }>;
26
- alreadyAcceptedPairs?: Array<{
27
- opportunityId: string;
28
- counterpartyUserId: string;
29
- }>;
30
- createIntentSuggested?: boolean;
31
- suggestedIntentDescription?: string;
32
- debugSteps?: DiscoverDebugStep[];
33
- pagination?: {
34
- discoveryId: string;
35
- evaluated: number;
36
- remaining: number;
37
- };
38
- questions?: Question[];
39
- discoveryQuestionsDebug?: {
40
- inputMode: "transcripts" | "insights";
41
- finalCount: number;
42
- strategies: QuestionStrategy[];
43
- durationMs: number;
44
- };
45
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Thin backward-compat shim — IND-551.
3
- * Canonical location: opportunity/application/opportunity.discover.ts
4
- */
5
- export * from "./application/opportunity.discover.js";
@@ -1,5 +0,0 @@
1
- /**
2
- * Thin backward-compat shim — IND-551.
3
- * Canonical location: opportunity/application/opportunity.discover.ts
4
- */
5
- export * from "./application/opportunity.discover.js";
@@ -1,5 +0,0 @@
1
- /**
2
- * Thin backward-compat shim — IND-551.
3
- * Canonical location: opportunity/application/opportunity.discovery-continuation-finalization.ts
4
- */
5
- export * from "./application/opportunity.discovery-continuation-finalization.js";
@@ -1,5 +0,0 @@
1
- /**
2
- * Thin backward-compat shim — IND-551.
3
- * Canonical location: opportunity/application/opportunity.discovery-continuation-finalization.ts
4
- */
5
- export * from "./application/opportunity.discovery-continuation-finalization.js";
@@ -1,5 +0,0 @@
1
- /**
2
- * Thin backward-compat shim — IND-551.
3
- * Canonical location: opportunity/application/opportunity.discovery-mcp-lifecycle-finalization.ts
4
- */
5
- export * from "./application/opportunity.discovery-mcp-lifecycle-finalization.js";
@@ -1,5 +0,0 @@
1
- /**
2
- * Thin backward-compat shim — IND-551.
3
- * Canonical location: opportunity/application/opportunity.discovery-mcp-lifecycle-finalization.ts
4
- */
5
- export * from "./application/opportunity.discovery-mcp-lifecycle-finalization.js";
@@ -1,5 +0,0 @@
1
- /**
2
- * Thin backward-compat shim — IND-551.
3
- * Canonical location: opportunity/domain/opportunity.discovery-run-coalescing.ts
4
- */
5
- export * from "./domain/opportunity.discovery-run-coalescing.js";
@@ -1,5 +0,0 @@
1
- /**
2
- * Thin backward-compat shim — IND-551.
3
- * Canonical location: opportunity/domain/opportunity.discovery-run-coalescing.ts
4
- */
5
- export * from "./domain/opportunity.discovery-run-coalescing.js";
@@ -1,5 +0,0 @@
1
- /**
2
- * Thin backward-compat shim — IND-551.
3
- * Canonical location: opportunity/domain/opportunity.discovery.contracts.ts
4
- */
5
- export * from "./domain/opportunity.discovery.contracts.js";
@@ -1,5 +0,0 @@
1
- /**
2
- * Thin backward-compat shim — IND-551.
3
- * Canonical location: opportunity/domain/opportunity.discovery.contracts.ts
4
- */
5
- export * from "./domain/opportunity.discovery.contracts.js";
@@ -1,70 +0,0 @@
1
- import type { ToolRequestContext } from "./tool-request-context.interface.js";
2
- export type DiscoveryRunStatus = "queued" | "running" | "succeeded" | "failed" | "cancelled";
3
- export interface DiscoveryRunInput {
4
- continueFrom?: string;
5
- searchQuery?: string;
6
- networkId?: string;
7
- intentId?: string;
8
- targetUserId?: string;
9
- introTargetUserId?: string;
10
- partyUserIds?: string[];
11
- entities?: Array<{
12
- userId: string;
13
- profile?: {
14
- name?: string;
15
- bio?: string;
16
- location?: string;
17
- interests?: string[];
18
- skills?: string[];
19
- context?: string;
20
- };
21
- intents?: Array<{
22
- intentId: string;
23
- payload: string;
24
- summary?: string;
25
- }>;
26
- networkId: string;
27
- }>;
28
- hint?: string;
29
- }
30
- export interface DiscoveryRunRecord {
31
- id: string;
32
- userId: string;
33
- agentId?: string | null;
34
- status: DiscoveryRunStatus;
35
- input: DiscoveryRunInput;
36
- context: Pick<ToolRequestContext, "userId" | "userName" | "userEmail" | "scopeType" | "scopeId" | "indexName" | "sessionId" | "agentId" | "clientSurface">;
37
- progress?: Record<string, unknown> | null;
38
- result?: unknown;
39
- error?: string | null;
40
- cancelRequestedAt?: Date | null;
41
- createdAt: Date;
42
- startedAt?: Date | null;
43
- completedAt?: Date | null;
44
- expiresAt?: Date | null;
45
- }
46
- export interface CreateDiscoveryRunInput {
47
- userId: string;
48
- agentId?: string | null;
49
- input: DiscoveryRunInput;
50
- context: DiscoveryRunRecord["context"];
51
- expiresAt?: Date;
52
- }
53
- export interface DiscoveryRunStore {
54
- create(input: CreateDiscoveryRunInput): Promise<DiscoveryRunRecord>;
55
- get(runId: string, userId: string): Promise<DiscoveryRunRecord | null>;
56
- markRunning(runId: string): Promise<DiscoveryRunRecord | null>;
57
- updateProgress(runId: string, progress: Record<string, unknown>): Promise<void>;
58
- markSucceeded(runId: string, result: unknown): Promise<void>;
59
- markFailed(runId: string, error: string): Promise<void>;
60
- requestCancel(runId: string, userId: string): Promise<DiscoveryRunRecord | null>;
61
- markCancelled(runId: string, reason?: string): Promise<void>;
62
- isCancelRequested(runId: string): Promise<boolean>;
63
- listActive(userId: string, limit?: number): Promise<DiscoveryRunRecord[]>;
64
- }
65
- export interface DiscoveryRunQueue {
66
- enqueue(runId: string): Promise<{
67
- jobId?: string | number;
68
- } | void>;
69
- cancel(runId: string): Promise<boolean>;
70
- }
@@ -1 +0,0 @@
1
- export {};