@indexnetwork/protocol 8.4.0-rc.425.1 → 8.6.0-rc.427.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/IMPLEMENTATION.md +2 -2
- package/dist/capabilities/opportunities.facade.d.ts +5 -5
- package/dist/capabilities/opportunities.facade.js +4 -4
- package/dist/index.d.ts +6 -6
- package/dist/index.js +4 -4
- package/dist/maintenance/maintenance.graph.d.ts +9 -9
- package/dist/maintenance/maintenance.graph.js +20 -20
- package/dist/maintenance/maintenance.state.d.ts +5 -5
- package/dist/maintenance/maintenance.state.js +3 -3
- package/dist/opportunity/application/delivery-card.cache.js +1 -1
- package/dist/opportunity/application/index.d.ts +2 -3
- package/dist/opportunity/application/index.js +3 -4
- package/dist/opportunity/application/negotiation-context.loader.d.ts +1 -1
- package/dist/opportunity/application/negotiation-context.loader.js +1 -1
- package/dist/opportunity/application/opportunity.enricher.js +2 -2
- package/dist/opportunity/application/opportunity.presenter.d.ts +15 -15
- package/dist/opportunity/application/opportunity.presenter.js +17 -17
- package/dist/opportunity/application/opportunity.tools.d.ts +1 -1
- package/dist/opportunity/application/opportunity.tools.js +3 -3
- package/dist/opportunity/discriminator/discriminator.adjustments.js +1 -1
- package/dist/opportunity/discriminator/discriminator.env.d.ts +1 -1
- package/dist/opportunity/discriminator/discriminator.env.js +1 -1
- package/dist/opportunity/domain/index.d.ts +3 -3
- package/dist/opportunity/domain/index.js +3 -3
- package/dist/opportunity/domain/opportunity.presentation-cache.d.ts +1 -2
- package/dist/opportunity/domain/opportunity.presentation-cache.js +2 -5
- package/dist/opportunity/domain/opportunity.presentation.d.ts +1 -1
- package/dist/opportunity/domain/opportunity.presentation.js +1 -1
- package/dist/opportunity/domain/opportunity.safe-presentation.d.ts +2 -2
- package/dist/opportunity/domain/opportunity.safe-presentation.js +1 -1
- package/dist/opportunity/domain/opportunity.utils.d.ts +5 -5
- package/dist/opportunity/domain/opportunity.utils.js +8 -8
- package/dist/opportunity/index.d.ts +1 -1
- package/dist/opportunity/index.js +1 -1
- package/dist/opportunity/opportunity.presenter.d.ts +3 -3
- package/dist/opportunity/opportunity.presenter.js +2 -2
- package/dist/opportunity/public/index.d.ts +5 -5
- package/dist/opportunity/public/index.js +6 -6
- package/dist/opportunity/{feed/feed.graph.d.ts → radar/radar.graph.d.ts} +42 -73
- package/dist/opportunity/{feed/feed.graph.js → radar/radar.graph.js} +60 -222
- package/dist/opportunity/{feed/feed.health.d.ts → radar/radar.health.d.ts} +7 -7
- package/dist/opportunity/{feed/feed.health.js → radar/radar.health.js} +8 -8
- package/dist/opportunity/{feed/feed.state.d.ts → radar/radar.state.d.ts} +21 -47
- package/dist/opportunity/{feed/feed.state.js → radar/radar.state.js} +15 -24
- package/dist/shared/agent/tool.helpers.d.ts +1 -1
- package/dist/shared/interfaces/database.interface.d.ts +3 -3
- package/package.json +1 -1
- package/dist/opportunity/feed/feed.categorizer.d.ts +0 -27
- package/dist/opportunity/feed/feed.categorizer.js +0 -168
- package/dist/shared/ui/lucide.icon-catalog.d.ts +0 -21
- package/dist/shared/ui/lucide.icon-catalog.js +0 -100
package/IMPLEMENTATION.md
CHANGED
|
@@ -169,7 +169,7 @@ import {
|
|
|
169
169
|
NetworkGraphFactory,
|
|
170
170
|
NetworkMembershipGraphFactory,
|
|
171
171
|
IntentNetworkGraphFactory,
|
|
172
|
-
|
|
172
|
+
RadarGraphFactory,
|
|
173
173
|
MaintenanceGraphFactory,
|
|
174
174
|
} from "@indexnetwork/protocol";
|
|
175
175
|
```
|
|
@@ -189,7 +189,7 @@ Each factory takes its typed dependencies in the constructor and exposes a
|
|
|
189
189
|
| `NetworkGraphFactory` | Manage network/network CRUD |
|
|
190
190
|
| `NetworkMembershipGraphFactory` | Manage network/network member join/leave |
|
|
191
191
|
| `IntentNetworkGraphFactory` | Evaluate and assign/unassign intents to indexes |
|
|
192
|
-
| `
|
|
192
|
+
| `RadarGraphFactory` | Build the radar view: flat presenter-card list, optionally intent-scoped |
|
|
193
193
|
| `MaintenanceGraphFactory` | Periodic maintenance (feed health, opportunity expiration) |
|
|
194
194
|
|
|
195
195
|
### Persisted chat personas
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* IND-551: canonical paths updated to opportunity/domain and
|
|
8
8
|
* opportunity/application; shims remain at old flat paths for compatibility.
|
|
9
9
|
*/
|
|
10
|
-
export {
|
|
10
|
+
export { RadarGraphFactory } from "../opportunity/radar/radar.graph.js";
|
|
11
11
|
export { OpportunityGraphFactory } from "../opportunity/application/opportunity.graph.js";
|
|
12
12
|
export type { StampNewbornOpportunitiesFn, StampNewbornOpportunitiesInput } from "../opportunity/application/opportunity.newborn-stamping.js";
|
|
13
13
|
export { hasUnsupportedOpportunityClaim, stripUnsupportedOpportunityClaims } from "../opportunity/domain/opportunity.claim-safety.js";
|
|
@@ -37,10 +37,10 @@ export type { RawEvidenceTurn, RawEvidenceOutcome, RawEvidenceOwnerAnswer, RawEv
|
|
|
37
37
|
export { isOutcomeQuestionsActivated, OUTCOME_MIN_INDEPENDENT_EXAMPLES, OUTCOME_MAX_CANDIDATES, OUTCOME_MAX_PUBLIC_CONTEXT_CHARS } from "../opportunity/outcome/outcome.env.js";
|
|
38
38
|
export { runOutcomeShadow } from "../opportunity/outcome/outcome.shadow.js";
|
|
39
39
|
export type { OutcomeLabel, OutcomeExample, OutcomeShadowResult } from "../opportunity/outcome/outcome.types.js";
|
|
40
|
-
export { canUserSeeOpportunity, isActionableForViewer, validateOpportunityActors, classifyOpportunity, selectByComposition,
|
|
40
|
+
export { canUserSeeOpportunity, isActionableForViewer, validateOpportunityActors, classifyOpportunity, selectByComposition, RADAR_SOFT_TARGETS } from "../opportunity/domain/opportunity.utils.js";
|
|
41
41
|
export { getPrimaryActionLabel } from "../opportunity/domain/opportunity.labels.js";
|
|
42
|
-
export {
|
|
43
|
-
export type {
|
|
42
|
+
export { computeRadarHealth } from "../opportunity/radar/radar.health.js";
|
|
43
|
+
export type { RadarHealthInput } from "../opportunity/radar/radar.health.js";
|
|
44
44
|
export { isIntroducerDiscoveryEnabled } from "../opportunity/application/opportunity.introducer-feature.js";
|
|
45
45
|
export { selectContactsForDiscovery, shouldRunIntroducerDiscovery, runIntroducerDiscovery, MAX_CONTACTS_PER_CYCLE, MAX_CANDIDATES_PER_CONTACT, INTRODUCER_DISCOVERY_SOURCE } from "../opportunity/application/opportunity.introducer.js";
|
|
46
46
|
export type { IntroducerDiscoveryDatabase, IntroducerDiscoveryQueue, ContactWithIntents } from "../opportunity/application/opportunity.introducer.js";
|
|
@@ -52,5 +52,5 @@ export { presentOpportunity, stripUuids, truncateAtBoundary } from "../opportuni
|
|
|
52
52
|
export type { UserInfo } from "../opportunity/domain/opportunity.presentation.js";
|
|
53
53
|
export { stripUnsupportedOpportunityClaims as stripUnsupportedOpportunityClaimsText } from "../opportunity/domain/opportunity.claim-safety.js";
|
|
54
54
|
export { safeFallbackSummary } from "../opportunity/domain/opportunity.safe-presentation.js";
|
|
55
|
-
export { buildApiChatCardPresentationCacheKey, buildDeliveryCardPresentationCacheKey,
|
|
55
|
+
export { buildApiChatCardPresentationCacheKey, buildDeliveryCardPresentationCacheKey, buildRadarCardPresentationCacheKey } from "../opportunity/domain/opportunity.presentation-cache.js";
|
|
56
56
|
export { getOrCreateDeliveryCardBatch } from "../opportunity/application/delivery-card.cache.js";
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* opportunity/application; shims remain at old flat paths for compatibility.
|
|
9
9
|
*/
|
|
10
10
|
// ── Core graphs ───────────────────────────────────────────────────────────────
|
|
11
|
-
export {
|
|
11
|
+
export { RadarGraphFactory } from "../opportunity/radar/radar.graph.js";
|
|
12
12
|
export { OpportunityGraphFactory } from "../opportunity/application/opportunity.graph.js";
|
|
13
13
|
// ── Presentation safety ───────────────────────────────────────────────────────
|
|
14
14
|
export { hasUnsupportedOpportunityClaim, stripUnsupportedOpportunityClaims } from "../opportunity/domain/opportunity.claim-safety.js";
|
|
@@ -37,9 +37,9 @@ export { runNegotiationEvidenceShadow } from "../opportunity/negotiation-evidenc
|
|
|
37
37
|
export { isOutcomeQuestionsActivated, OUTCOME_MIN_INDEPENDENT_EXAMPLES, OUTCOME_MAX_CANDIDATES, OUTCOME_MAX_PUBLIC_CONTEXT_CHARS } from "../opportunity/outcome/outcome.env.js";
|
|
38
38
|
export { runOutcomeShadow } from "../opportunity/outcome/outcome.shadow.js";
|
|
39
39
|
// ── Domain predicates and feed algorithms ─────────────────────────────────────
|
|
40
|
-
export { canUserSeeOpportunity, isActionableForViewer, validateOpportunityActors, classifyOpportunity, selectByComposition,
|
|
40
|
+
export { canUserSeeOpportunity, isActionableForViewer, validateOpportunityActors, classifyOpportunity, selectByComposition, RADAR_SOFT_TARGETS } from "../opportunity/domain/opportunity.utils.js";
|
|
41
41
|
export { getPrimaryActionLabel } from "../opportunity/domain/opportunity.labels.js";
|
|
42
|
-
export {
|
|
42
|
+
export { computeRadarHealth } from "../opportunity/radar/radar.health.js";
|
|
43
43
|
// ── Introducer / ambient discovery ───────────────────────────────────────────
|
|
44
44
|
export { isIntroducerDiscoveryEnabled } from "../opportunity/application/opportunity.introducer-feature.js";
|
|
45
45
|
export { selectContactsForDiscovery, shouldRunIntroducerDiscovery, runIntroducerDiscovery, MAX_CONTACTS_PER_CYCLE, MAX_CANDIDATES_PER_CONTACT, INTRODUCER_DISCOVERY_SOURCE } from "../opportunity/application/opportunity.introducer.js";
|
|
@@ -52,5 +52,5 @@ export { bindOwnerApprovalProvenance } from "../opportunity/application/opportun
|
|
|
52
52
|
export { presentOpportunity, stripUuids, truncateAtBoundary } from "../opportunity/domain/opportunity.presentation.js";
|
|
53
53
|
export { stripUnsupportedOpportunityClaims as stripUnsupportedOpportunityClaimsText } from "../opportunity/domain/opportunity.claim-safety.js";
|
|
54
54
|
export { safeFallbackSummary } from "../opportunity/domain/opportunity.safe-presentation.js";
|
|
55
|
-
export { buildApiChatCardPresentationCacheKey, buildDeliveryCardPresentationCacheKey,
|
|
55
|
+
export { buildApiChatCardPresentationCacheKey, buildDeliveryCardPresentationCacheKey, buildRadarCardPresentationCacheKey } from "../opportunity/domain/opportunity.presentation-cache.js";
|
|
56
56
|
export { getOrCreateDeliveryCardBatch } from "../opportunity/application/delivery-card.cache.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type { NegotiationSummaryReader } from "./shared/interfaces/negotiation-s
|
|
|
16
16
|
export type { DiscoveryNegotiationDigest } from "./shared/schemas/negotiation-digest.schema.js";
|
|
17
17
|
export { NegotiationSummarizer } from "./capabilities/negotiation.facade.js";
|
|
18
18
|
export type { ContactServiceAdapter } from "./shared/interfaces/contact.interface.js";
|
|
19
|
-
export type { ChatGraphCompositeDatabase, UserDatabase, AgentActivitySummary, SystemDatabase, OpportunityGraphDatabase, OpportunityControllerDatabase, OutcomeOutbox,
|
|
19
|
+
export type { ChatGraphCompositeDatabase, UserDatabase, AgentActivitySummary, SystemDatabase, OpportunityGraphDatabase, OpportunityControllerDatabase, OutcomeOutbox, RadarGraphDatabase, IntentGraphDatabase, HydeGraphDatabase, EnrichmentGraphDatabase, PremiseGraphDatabase, NegotiationGraphDatabase, NegotiationOpportunityLifecycle, NegotiationContinuationExecution, NegotiationContinuationReceipt, Opportunity, OpportunityActor, OpportunityStatus, AssignmentNetworkMembership, IntentNetworkFinalAssignmentResult, CreateOpportunityData, } from "./shared/interfaces/database.interface.js";
|
|
20
20
|
export type { Embedder, VectorStoreOption, VectorSearchResult, HydeCandidate, HydeSearchOptions, LensEmbedding } from "./shared/interfaces/embedder.interface.js";
|
|
21
21
|
export type { IntegrationAdapter, IntegrationConnection, IntegrationSession, IntegrationSessionOptions, ToolActionResponse } from "./shared/interfaces/integration.interface.js";
|
|
22
22
|
export type { IntentGraphQueue } from "./shared/interfaces/queue.interface.js";
|
|
@@ -40,7 +40,7 @@ export { NEGOTIATOR_PERSONA_ID, createNegotiatorPersona } from "./capabilities/p
|
|
|
40
40
|
export { SIGNAL_PERSONA_ID, SIGNAL_PERSONA, SIGNAL_NEW_SIGNAL_KICKOFF, SIGNAL_TOOL_NAMES, createSignalTools, filterSignalTools, narrowSignalTools, } from "./capabilities/participant-agents.facade.js";
|
|
41
41
|
export { REPORTER_PERSONA_ID, REPORTER_PERSONA, REPORTER_BRIEFING_KICKOFF, REPORTER_TOOL_NAMES, createReporterTools, filterReporterTools, narrowReporterTools, } from "./capabilities/participant-agents.facade.js";
|
|
42
42
|
export { ONBOARDING_PERSONA_ID, ONBOARDING_PERSONA, ONBOARDING_PROFILE_KICKOFF, ONBOARDING_TOOL_NAMES, createOnboardingTools, filterOnboardingTools, narrowOnboardingTools, } from "./capabilities/participant-agents.facade.js";
|
|
43
|
-
export {
|
|
43
|
+
export { RadarGraphFactory } from "./capabilities/opportunities.facade.js";
|
|
44
44
|
export { HydeGraphFactory } from "./capabilities/participant-context.facade.js";
|
|
45
45
|
export { NetworkGraphFactory } from "./capabilities/communities.facade.js";
|
|
46
46
|
export { NetworkMembershipGraphFactory } from "./capabilities/communities.facade.js";
|
|
@@ -109,10 +109,10 @@ export { OpportunityEvaluator } from "./capabilities/opportunities.facade.js";
|
|
|
109
109
|
export type { EvaluatorInput } from "./capabilities/opportunities.facade.js";
|
|
110
110
|
export { OpportunityPresenter, gatherPresenterContext } from "./capabilities/opportunities.facade.js";
|
|
111
111
|
export type { PresenterDatabase } from "./capabilities/opportunities.facade.js";
|
|
112
|
-
export { canUserSeeOpportunity, isActionableForViewer, validateOpportunityActors, classifyOpportunity, selectByComposition,
|
|
112
|
+
export { canUserSeeOpportunity, isActionableForViewer, validateOpportunityActors, classifyOpportunity, selectByComposition, RADAR_SOFT_TARGETS } from "./capabilities/opportunities.facade.js";
|
|
113
113
|
export { getPrimaryActionLabel } from "./capabilities/opportunities.facade.js";
|
|
114
|
-
export {
|
|
115
|
-
export type {
|
|
114
|
+
export { computeRadarHealth } from "./capabilities/opportunities.facade.js";
|
|
115
|
+
export type { RadarHealthInput } from "./capabilities/opportunities.facade.js";
|
|
116
116
|
export { isIntroducerDiscoveryEnabled } from "./capabilities/opportunities.facade.js";
|
|
117
117
|
export { selectContactsForDiscovery, shouldRunIntroducerDiscovery, runIntroducerDiscovery, MAX_CONTACTS_PER_CYCLE, MAX_CANDIDATES_PER_CONTACT, INTRODUCER_DISCOVERY_SOURCE } from "./capabilities/opportunities.facade.js";
|
|
118
118
|
export type { IntroducerDiscoveryDatabase, IntroducerDiscoveryQueue, ContactWithIntents } from "./capabilities/opportunities.facade.js";
|
|
@@ -122,7 +122,7 @@ export type { UserInfo } from "./capabilities/opportunities.facade.js";
|
|
|
122
122
|
export { stripUuids, truncateAtBoundary } from "./capabilities/opportunities.facade.js";
|
|
123
123
|
export { stripUnsupportedOpportunityClaims } from "./capabilities/opportunities.facade.js";
|
|
124
124
|
export { safeFallbackSummary } from "./capabilities/opportunities.facade.js";
|
|
125
|
-
export { buildApiChatCardPresentationCacheKey, buildDeliveryCardPresentationCacheKey,
|
|
125
|
+
export { buildApiChatCardPresentationCacheKey, buildDeliveryCardPresentationCacheKey, buildRadarCardPresentationCacheKey } from "./capabilities/opportunities.facade.js";
|
|
126
126
|
export { getOrCreateDeliveryCardBatch } from "./capabilities/opportunities.facade.js";
|
|
127
127
|
export { createToolRegistry } from "./shared/agent/tool.registry.js";
|
|
128
128
|
export { createIntentTools } from "./capabilities/signals.facade.js";
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ export { NEGOTIATOR_PERSONA_ID, createNegotiatorPersona } from "./capabilities/p
|
|
|
35
35
|
export { SIGNAL_PERSONA_ID, SIGNAL_PERSONA, SIGNAL_NEW_SIGNAL_KICKOFF, SIGNAL_TOOL_NAMES, createSignalTools, filterSignalTools, narrowSignalTools, } from "./capabilities/participant-agents.facade.js";
|
|
36
36
|
export { REPORTER_PERSONA_ID, REPORTER_PERSONA, REPORTER_BRIEFING_KICKOFF, REPORTER_TOOL_NAMES, createReporterTools, filterReporterTools, narrowReporterTools, } from "./capabilities/participant-agents.facade.js";
|
|
37
37
|
export { ONBOARDING_PERSONA_ID, ONBOARDING_PERSONA, ONBOARDING_PROFILE_KICKOFF, ONBOARDING_TOOL_NAMES, createOnboardingTools, filterOnboardingTools, narrowOnboardingTools, } from "./capabilities/participant-agents.facade.js";
|
|
38
|
-
export {
|
|
38
|
+
export { RadarGraphFactory } from "./capabilities/opportunities.facade.js";
|
|
39
39
|
export { HydeGraphFactory } from "./capabilities/participant-context.facade.js";
|
|
40
40
|
export { NetworkGraphFactory } from "./capabilities/communities.facade.js";
|
|
41
41
|
export { NetworkMembershipGraphFactory } from "./capabilities/communities.facade.js";
|
|
@@ -90,9 +90,9 @@ export { runOutcomeShadow } from "./capabilities/opportunities.facade.js";
|
|
|
90
90
|
export { OpportunityEvaluator } from "./capabilities/opportunities.facade.js";
|
|
91
91
|
export { OpportunityPresenter, gatherPresenterContext } from "./capabilities/opportunities.facade.js";
|
|
92
92
|
// ─── Support utilities ────────────────────────────────────────────────────────
|
|
93
|
-
export { canUserSeeOpportunity, isActionableForViewer, validateOpportunityActors, classifyOpportunity, selectByComposition,
|
|
93
|
+
export { canUserSeeOpportunity, isActionableForViewer, validateOpportunityActors, classifyOpportunity, selectByComposition, RADAR_SOFT_TARGETS } from "./capabilities/opportunities.facade.js";
|
|
94
94
|
export { getPrimaryActionLabel } from "./capabilities/opportunities.facade.js";
|
|
95
|
-
export {
|
|
95
|
+
export { computeRadarHealth } from "./capabilities/opportunities.facade.js";
|
|
96
96
|
export { isIntroducerDiscoveryEnabled } from "./capabilities/opportunities.facade.js";
|
|
97
97
|
export { selectContactsForDiscovery, shouldRunIntroducerDiscovery, runIntroducerDiscovery, MAX_CONTACTS_PER_CYCLE, MAX_CANDIDATES_PER_CONTACT, INTRODUCER_DISCOVERY_SOURCE } from "./capabilities/opportunities.facade.js";
|
|
98
98
|
export { persistOpportunities } from "./capabilities/opportunities.facade.js";
|
|
@@ -100,7 +100,7 @@ export { presentOpportunity } from "./capabilities/opportunities.facade.js";
|
|
|
100
100
|
export { stripUuids, truncateAtBoundary } from "./capabilities/opportunities.facade.js";
|
|
101
101
|
export { stripUnsupportedOpportunityClaims } from "./capabilities/opportunities.facade.js";
|
|
102
102
|
export { safeFallbackSummary } from "./capabilities/opportunities.facade.js";
|
|
103
|
-
export { buildApiChatCardPresentationCacheKey, buildDeliveryCardPresentationCacheKey,
|
|
103
|
+
export { buildApiChatCardPresentationCacheKey, buildDeliveryCardPresentationCacheKey, buildRadarCardPresentationCacheKey } from "./capabilities/opportunities.facade.js";
|
|
104
104
|
export { getOrCreateDeliveryCardBatch } from "./capabilities/opportunities.facade.js";
|
|
105
105
|
// ─── Tools ────────────────────────────────────────────────────────────────────
|
|
106
106
|
export { createToolRegistry } from "./shared/agent/tool.registry.js";
|
|
@@ -62,7 +62,7 @@ export declare class MaintenanceGraphFactory {
|
|
|
62
62
|
currentOpportunities: import("../index.js").Opportunity[];
|
|
63
63
|
expiredCount: number;
|
|
64
64
|
lastRediscoveryAt: number | null;
|
|
65
|
-
healthResult: import("../opportunity/
|
|
65
|
+
healthResult: import("../opportunity/radar/radar.health.js").RadarHealthResult | null;
|
|
66
66
|
rediscoveryJobsEnqueued: number;
|
|
67
67
|
connectorFlowCount: number;
|
|
68
68
|
introducerDiscoveryJobsEnqueued: number;
|
|
@@ -79,12 +79,12 @@ export declare class MaintenanceGraphFactory {
|
|
|
79
79
|
currentOpportunities?: import("../index.js").Opportunity[] | import("@langchain/langgraph").OverwriteValue<import("../index.js").Opportunity[]> | undefined;
|
|
80
80
|
expiredCount?: number | import("@langchain/langgraph").OverwriteValue<number> | undefined;
|
|
81
81
|
lastRediscoveryAt?: number | import("@langchain/langgraph").OverwriteValue<number | null> | null | undefined;
|
|
82
|
-
healthResult?: import("../opportunity/
|
|
82
|
+
healthResult?: import("../opportunity/radar/radar.health.js").RadarHealthResult | import("@langchain/langgraph").OverwriteValue<import("../opportunity/radar/radar.health.js").RadarHealthResult | null> | null | undefined;
|
|
83
83
|
rediscoveryJobsEnqueued?: number | import("@langchain/langgraph").OverwriteValue<number> | undefined;
|
|
84
84
|
connectorFlowCount?: number | import("@langchain/langgraph").OverwriteValue<number> | undefined;
|
|
85
85
|
introducerDiscoveryJobsEnqueued?: number | import("@langchain/langgraph").OverwriteValue<number> | undefined;
|
|
86
86
|
error?: string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined;
|
|
87
|
-
}, "__start__" | "
|
|
87
|
+
}, "__start__" | "loadCurrentRadar" | "scoreRadarHealth" | "rediscover" | "introducerDiscovery" | "logMaintenance", {
|
|
88
88
|
userId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
|
|
89
89
|
activeIntents: import("@langchain/langgraph").BaseChannel<{
|
|
90
90
|
id: string;
|
|
@@ -99,7 +99,7 @@ export declare class MaintenanceGraphFactory {
|
|
|
99
99
|
currentOpportunities: import("@langchain/langgraph").BaseChannel<import("../index.js").Opportunity[], import("../index.js").Opportunity[] | import("@langchain/langgraph").OverwriteValue<import("../index.js").Opportunity[]>, unknown>;
|
|
100
100
|
expiredCount: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
101
101
|
lastRediscoveryAt: import("@langchain/langgraph").BaseChannel<number | null, number | import("@langchain/langgraph").OverwriteValue<number | null> | null, unknown>;
|
|
102
|
-
healthResult: import("@langchain/langgraph").BaseChannel<import("../opportunity/
|
|
102
|
+
healthResult: import("@langchain/langgraph").BaseChannel<import("../opportunity/radar/radar.health.js").RadarHealthResult | null, import("../opportunity/radar/radar.health.js").RadarHealthResult | import("@langchain/langgraph").OverwriteValue<import("../opportunity/radar/radar.health.js").RadarHealthResult | null> | null, unknown>;
|
|
103
103
|
rediscoveryJobsEnqueued: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
104
104
|
connectorFlowCount: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
105
105
|
introducerDiscoveryJobsEnqueued: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
@@ -119,13 +119,13 @@ export declare class MaintenanceGraphFactory {
|
|
|
119
119
|
currentOpportunities: import("@langchain/langgraph").BaseChannel<import("../index.js").Opportunity[], import("../index.js").Opportunity[] | import("@langchain/langgraph").OverwriteValue<import("../index.js").Opportunity[]>, unknown>;
|
|
120
120
|
expiredCount: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
121
121
|
lastRediscoveryAt: import("@langchain/langgraph").BaseChannel<number | null, number | import("@langchain/langgraph").OverwriteValue<number | null> | null, unknown>;
|
|
122
|
-
healthResult: import("@langchain/langgraph").BaseChannel<import("../opportunity/
|
|
122
|
+
healthResult: import("@langchain/langgraph").BaseChannel<import("../opportunity/radar/radar.health.js").RadarHealthResult | null, import("../opportunity/radar/radar.health.js").RadarHealthResult | import("@langchain/langgraph").OverwriteValue<import("../opportunity/radar/radar.health.js").RadarHealthResult | null> | null, unknown>;
|
|
123
123
|
rediscoveryJobsEnqueued: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
124
124
|
connectorFlowCount: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
125
125
|
introducerDiscoveryJobsEnqueued: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
126
126
|
error: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
|
|
127
127
|
}, import("@langchain/langgraph").StateDefinition, {
|
|
128
|
-
|
|
128
|
+
loadCurrentRadar: import("@langchain/langgraph").UpdateType<{
|
|
129
129
|
userId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
|
|
130
130
|
activeIntents: import("@langchain/langgraph").BaseChannel<{
|
|
131
131
|
id: string;
|
|
@@ -140,18 +140,18 @@ export declare class MaintenanceGraphFactory {
|
|
|
140
140
|
currentOpportunities: import("@langchain/langgraph").BaseChannel<import("../index.js").Opportunity[], import("../index.js").Opportunity[] | import("@langchain/langgraph").OverwriteValue<import("../index.js").Opportunity[]>, unknown>;
|
|
141
141
|
expiredCount: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
142
142
|
lastRediscoveryAt: import("@langchain/langgraph").BaseChannel<number | null, number | import("@langchain/langgraph").OverwriteValue<number | null> | null, unknown>;
|
|
143
|
-
healthResult: import("@langchain/langgraph").BaseChannel<import("../opportunity/
|
|
143
|
+
healthResult: import("@langchain/langgraph").BaseChannel<import("../opportunity/radar/radar.health.js").RadarHealthResult | null, import("../opportunity/radar/radar.health.js").RadarHealthResult | import("@langchain/langgraph").OverwriteValue<import("../opportunity/radar/radar.health.js").RadarHealthResult | null> | null, unknown>;
|
|
144
144
|
rediscoveryJobsEnqueued: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
145
145
|
connectorFlowCount: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
146
146
|
introducerDiscoveryJobsEnqueued: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
147
147
|
error: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
|
|
148
148
|
}>;
|
|
149
|
-
|
|
149
|
+
scoreRadarHealth: {
|
|
150
150
|
healthResult?: undefined;
|
|
151
151
|
connectorFlowCount?: undefined;
|
|
152
152
|
error?: undefined;
|
|
153
153
|
} | {
|
|
154
|
-
healthResult: import("../opportunity/
|
|
154
|
+
healthResult: import("../opportunity/radar/radar.health.js").RadarHealthResult;
|
|
155
155
|
connectorFlowCount: number;
|
|
156
156
|
error?: undefined;
|
|
157
157
|
} | {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Maintenance Graph: evaluate
|
|
2
|
+
* Maintenance Graph: evaluate radar health and trigger rediscovery when unhealthy.
|
|
3
3
|
* Also runs introducer discovery when connector-flow slots are underfilled.
|
|
4
4
|
*
|
|
5
|
-
* Write path — separate from the read-only
|
|
6
|
-
* Flow:
|
|
5
|
+
* Write path — separate from the read-only RadarGraph.
|
|
6
|
+
* Flow: loadCurrentRadar → scoreRadarHealth → [shouldRediscover] → rediscover → introducerDiscovery → logMaintenance → END
|
|
7
7
|
* └─ [skip rediscovery] ─────────────→ introducerDiscovery → logMaintenance → END
|
|
8
8
|
*/
|
|
9
9
|
import { StateGraph, START, END } from '@langchain/langgraph';
|
|
10
10
|
import { MaintenanceGraphState } from './maintenance.state.js';
|
|
11
|
-
import {
|
|
12
|
-
import { canUserSeeOpportunity, classifyOpportunity, isActionableForViewer,
|
|
11
|
+
import { computeRadarHealth } from '../opportunity/radar/radar.health.js';
|
|
12
|
+
import { canUserSeeOpportunity, classifyOpportunity, isActionableForViewer, RADAR_SOFT_TARGETS } from '../opportunity/opportunity.utils.js';
|
|
13
13
|
import { shouldRunIntroducerDiscovery, runIntroducerDiscovery } from '../opportunity/opportunity.introducer.js';
|
|
14
14
|
import { isIntroducerDiscoveryEnabled } from '../opportunity/application/opportunity.introducer-feature.js';
|
|
15
15
|
import { protocolLogger } from '../shared/observability/protocol.logger.js';
|
|
@@ -27,7 +27,7 @@ export class MaintenanceGraphFactory {
|
|
|
27
27
|
}
|
|
28
28
|
/** Compile and return the maintenance graph. */
|
|
29
29
|
createGraph() {
|
|
30
|
-
const
|
|
30
|
+
const loadCurrentRadarNode = async (state) => {
|
|
31
31
|
if (!state.userId) {
|
|
32
32
|
return { error: 'userId is required' };
|
|
33
33
|
}
|
|
@@ -58,11 +58,11 @@ export class MaintenanceGraphFactory {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
catch (e) {
|
|
61
|
-
logger.error('MaintenanceGraph
|
|
62
|
-
return { error: 'Failed to load current
|
|
61
|
+
logger.error('MaintenanceGraph loadCurrentRadar failed', { error: e });
|
|
62
|
+
return { error: 'Failed to load current radar' };
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
|
-
const
|
|
65
|
+
const scoreRadarHealthNode = async (state) => {
|
|
66
66
|
if (state.error)
|
|
67
67
|
return {};
|
|
68
68
|
try {
|
|
@@ -76,7 +76,7 @@ export class MaintenanceGraphFactory {
|
|
|
76
76
|
else if (category === 'connector-flow')
|
|
77
77
|
connectorFlowCount++;
|
|
78
78
|
}
|
|
79
|
-
const healthResult =
|
|
79
|
+
const healthResult = computeRadarHealth({
|
|
80
80
|
connectionCount,
|
|
81
81
|
connectorFlowCount,
|
|
82
82
|
expiredCount: state.expiredCount,
|
|
@@ -84,7 +84,7 @@ export class MaintenanceGraphFactory {
|
|
|
84
84
|
lastRediscoveryAt: state.lastRediscoveryAt,
|
|
85
85
|
freshnessWindowMs: FRESHNESS_WINDOW_MS,
|
|
86
86
|
});
|
|
87
|
-
logger.verbose('
|
|
87
|
+
logger.verbose('Radar health scored', {
|
|
88
88
|
userId: state.userId,
|
|
89
89
|
score: healthResult.score,
|
|
90
90
|
shouldMaintain: healthResult.shouldMaintain,
|
|
@@ -93,8 +93,8 @@ export class MaintenanceGraphFactory {
|
|
|
93
93
|
return { healthResult, connectorFlowCount };
|
|
94
94
|
}
|
|
95
95
|
catch (e) {
|
|
96
|
-
logger.error('MaintenanceGraph
|
|
97
|
-
return { error: 'Failed to score
|
|
96
|
+
logger.error('MaintenanceGraph scoreRadarHealth failed', { error: e });
|
|
97
|
+
return { error: 'Failed to score radar health' };
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
100
|
const shouldRediscover = (state) => {
|
|
@@ -140,7 +140,7 @@ export class MaintenanceGraphFactory {
|
|
|
140
140
|
return {};
|
|
141
141
|
}
|
|
142
142
|
try {
|
|
143
|
-
const connectorFlowTarget =
|
|
143
|
+
const connectorFlowTarget = RADAR_SOFT_TARGETS.connectorFlow;
|
|
144
144
|
if (!shouldRunIntroducerDiscovery(state.connectorFlowCount, connectorFlowTarget)) {
|
|
145
145
|
logger.verbose('Introducer discovery skipped — connector-flow target met', {
|
|
146
146
|
userId: state.userId,
|
|
@@ -178,17 +178,17 @@ export class MaintenanceGraphFactory {
|
|
|
178
178
|
return {};
|
|
179
179
|
};
|
|
180
180
|
const graph = new StateGraph(MaintenanceGraphState)
|
|
181
|
-
.addNode('
|
|
182
|
-
.addNode('
|
|
181
|
+
.addNode('loadCurrentRadar', loadCurrentRadarNode)
|
|
182
|
+
.addNode('scoreRadarHealth', scoreRadarHealthNode)
|
|
183
183
|
.addNode('rediscover', rediscoverNode)
|
|
184
184
|
.addNode('introducerDiscovery', introducerDiscoveryNode)
|
|
185
185
|
.addNode('logMaintenance', logMaintenanceNode)
|
|
186
|
-
.addEdge(START, '
|
|
187
|
-
.addConditionalEdges('
|
|
188
|
-
|
|
186
|
+
.addEdge(START, 'loadCurrentRadar')
|
|
187
|
+
.addConditionalEdges('loadCurrentRadar', (state) => (state.error ? 'end' : 'scoreRadarHealth'), {
|
|
188
|
+
scoreRadarHealth: 'scoreRadarHealth',
|
|
189
189
|
end: END,
|
|
190
190
|
})
|
|
191
|
-
.addConditionalEdges('
|
|
191
|
+
.addConditionalEdges('scoreRadarHealth', shouldRediscover, {
|
|
192
192
|
rediscover: 'rediscover',
|
|
193
193
|
introducerDiscovery: 'introducerDiscovery',
|
|
194
194
|
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Opportunity } from '../shared/interfaces/database.interface.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RadarHealthResult } from '../opportunity/radar/radar.health.js';
|
|
3
3
|
/**
|
|
4
4
|
* Maintenance Graph State (Annotation-based).
|
|
5
|
-
* Flow:
|
|
5
|
+
* Flow: loadCurrentRadar → scoreRadarHealth → [conditional: rediscover | END] → logMaintenance → END
|
|
6
6
|
*/
|
|
7
7
|
export declare const MaintenanceGraphState: import("@langchain/langgraph").AnnotationRoot<{
|
|
8
8
|
userId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
|
|
@@ -23,11 +23,11 @@ export declare const MaintenanceGraphState: import("@langchain/langgraph").Annot
|
|
|
23
23
|
expiredCount: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
24
24
|
/** Unix ms timestamp of last rediscovery for this user. */
|
|
25
25
|
lastRediscoveryAt: import("@langchain/langgraph").BaseChannel<number | null, number | import("@langchain/langgraph").OverwriteValue<number | null> | null, unknown>;
|
|
26
|
-
/**
|
|
27
|
-
healthResult: import("@langchain/langgraph").BaseChannel<
|
|
26
|
+
/** Radar health score result. */
|
|
27
|
+
healthResult: import("@langchain/langgraph").BaseChannel<RadarHealthResult | null, RadarHealthResult | import("@langchain/langgraph").OverwriteValue<RadarHealthResult | null> | null, unknown>;
|
|
28
28
|
/** Number of rediscovery jobs enqueued. */
|
|
29
29
|
rediscoveryJobsEnqueued: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
30
|
-
/** Current connector-flow opportunity count (from
|
|
30
|
+
/** Current connector-flow opportunity count (from scoreRadarHealth). */
|
|
31
31
|
connectorFlowCount: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
32
32
|
/** Number of introducer discovery jobs enqueued. */
|
|
33
33
|
introducerDiscoveryJobsEnqueued: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Annotation } from '@langchain/langgraph';
|
|
2
2
|
/**
|
|
3
3
|
* Maintenance Graph State (Annotation-based).
|
|
4
|
-
* Flow:
|
|
4
|
+
* Flow: loadCurrentRadar → scoreRadarHealth → [conditional: rediscover | END] → logMaintenance → END
|
|
5
5
|
*/
|
|
6
6
|
export const MaintenanceGraphState = Annotation.Root({
|
|
7
7
|
userId: Annotation({
|
|
@@ -28,7 +28,7 @@ export const MaintenanceGraphState = Annotation.Root({
|
|
|
28
28
|
reducer: (curr, next) => next ?? curr,
|
|
29
29
|
default: () => null,
|
|
30
30
|
}),
|
|
31
|
-
/**
|
|
31
|
+
/** Radar health score result. */
|
|
32
32
|
healthResult: Annotation({
|
|
33
33
|
reducer: (curr, next) => next ?? curr,
|
|
34
34
|
default: () => null,
|
|
@@ -38,7 +38,7 @@ export const MaintenanceGraphState = Annotation.Root({
|
|
|
38
38
|
reducer: (curr, next) => next ?? curr,
|
|
39
39
|
default: () => 0,
|
|
40
40
|
}),
|
|
41
|
-
/** Current connector-flow opportunity count (from
|
|
41
|
+
/** Current connector-flow opportunity count (from scoreRadarHealth). */
|
|
42
42
|
connectorFlowCount: Annotation({
|
|
43
43
|
reducer: (curr, next) => next ?? curr,
|
|
44
44
|
default: () => 0,
|
|
@@ -23,7 +23,7 @@ export async function getOrCreateDeliveryCardBatch(cache, presenter, presenterDb
|
|
|
23
23
|
await Promise.all(misses.map(async ({ opp, index }) => {
|
|
24
24
|
const presenterInput = await gatherPresenterContext(presenterDb, opp, viewerId);
|
|
25
25
|
presenterInput.opportunityStatus = opp.status;
|
|
26
|
-
const presented = await presenter.
|
|
26
|
+
const presented = await presenter.presentCard(presenterInput);
|
|
27
27
|
const card = {
|
|
28
28
|
opportunityId: opp.id,
|
|
29
29
|
headline: presented.headline,
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* - discriminator/ — miner, assigner, shadow orchestrator
|
|
28
28
|
* - negotiation-evidence/ — miner, shadow orchestrator
|
|
29
29
|
* - outcome/ — shadow orchestrator
|
|
30
|
-
* -
|
|
30
|
+
* - radar/ — radar graph
|
|
31
31
|
*
|
|
32
32
|
* IND-551: canonical application layer for the opportunities capability.
|
|
33
33
|
*/
|
|
@@ -56,5 +56,4 @@ export { runPoolDiscriminatorShadow } from "../discriminator/discriminator.shado
|
|
|
56
56
|
export { NegotiationEvidenceMiner } from "../negotiation-evidence/negotiation-evidence.miner.js";
|
|
57
57
|
export { runNegotiationEvidenceShadow } from "../negotiation-evidence/negotiation-evidence.shadow.js";
|
|
58
58
|
export { runOutcomeShadow } from "../outcome/outcome.shadow.js";
|
|
59
|
-
export {
|
|
60
|
-
export { HomeCategorizerAgent } from "../feed/feed.categorizer.js";
|
|
59
|
+
export { RadarGraphFactory } from "../radar/radar.graph.js";
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* - discriminator/ — miner, assigner, shadow orchestrator
|
|
28
28
|
* - negotiation-evidence/ — miner, shadow orchestrator
|
|
29
29
|
* - outcome/ — shadow orchestrator
|
|
30
|
-
* -
|
|
30
|
+
* - radar/ — radar graph
|
|
31
31
|
*
|
|
32
32
|
* IND-551: canonical application layer for the opportunities capability.
|
|
33
33
|
*/
|
|
@@ -60,6 +60,5 @@ export { NegotiationEvidenceMiner } from "../negotiation-evidence/negotiation-ev
|
|
|
60
60
|
export { runNegotiationEvidenceShadow } from "../negotiation-evidence/negotiation-evidence.shadow.js";
|
|
61
61
|
// outcome application
|
|
62
62
|
export { runOutcomeShadow } from "../outcome/outcome.shadow.js";
|
|
63
|
-
//
|
|
64
|
-
export {
|
|
65
|
-
export { HomeCategorizerAgent } from "../feed/feed.categorizer.js";
|
|
63
|
+
// radar application
|
|
64
|
+
export { RadarGraphFactory } from "../radar/radar.graph.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Negotiation context loader: given an opportunity, fetches the attached
|
|
3
|
-
* negotiation task's transcript and outcome so the
|
|
3
|
+
* negotiation task's transcript and outcome so the card presenter can
|
|
4
4
|
* explain *why* the opportunity surfaced.
|
|
5
5
|
*
|
|
6
6
|
* For `draft`, `latent`, and `expired` opportunities, no negotiation has
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Negotiation context loader: given an opportunity, fetches the attached
|
|
3
|
-
* negotiation task's transcript and outcome so the
|
|
3
|
+
* negotiation task's transcript and outcome so the card presenter can
|
|
4
4
|
* explain *why* the opportunity surfaced.
|
|
5
5
|
*
|
|
6
6
|
* For `draft`, `latent`, and `expired` opportunities, no negotiation has
|
|
@@ -49,9 +49,9 @@ function cosineSimilarity(a, b) {
|
|
|
49
49
|
* Priority: accepted > pending > rejected > stalled > draft (only when incoming is draft) > latent.
|
|
50
50
|
* The incoming status is included so we do not wrongly downgrade when the new opportunity has a higher-priority status.
|
|
51
51
|
* When incoming is 'draft' (e.g. from in-chat discovery), we preserve draft so the opportunity stays chat-only and
|
|
52
|
-
* does not appear on the
|
|
52
|
+
* does not appear on the radar view (radar excludes draft).
|
|
53
53
|
* When incoming is NOT draft (e.g. 'latent' from the background broker), existing draft status does NOT contaminate
|
|
54
|
-
* the result — the broker-created opportunity retains its own status and can appear on the
|
|
54
|
+
* the result — the broker-created opportunity retains its own status and can appear on the radar view.
|
|
55
55
|
*/
|
|
56
56
|
function resolveEnrichedStatus(relatedStatuses, incomingStatus) {
|
|
57
57
|
const statuses = incomingStatus ? [...relatedStatuses, incomingStatus] : relatedStatuses;
|
|
@@ -37,8 +37,8 @@ export type OpportunityPresentationResult = z.infer<typeof PresentationSchema> &
|
|
|
37
37
|
/** Diagnostic category; never changes production fallback policy. */
|
|
38
38
|
fallbackReason?: "timeout" | "error" | "sanitization";
|
|
39
39
|
};
|
|
40
|
-
/** Input for
|
|
41
|
-
export interface
|
|
40
|
+
/** Input for card presenter call; extends PresenterInput with optional mutual intent count. */
|
|
41
|
+
export interface CardPresenterInput extends PresenterInput {
|
|
42
42
|
/** Number of overlapping intents (for generating mutualIntentsLabel). */
|
|
43
43
|
mutualIntentCount?: number;
|
|
44
44
|
/**
|
|
@@ -49,8 +49,8 @@ export interface HomeCardPresenterInput extends PresenterInput {
|
|
|
49
49
|
*/
|
|
50
50
|
negotiationContext?: NegotiationContext;
|
|
51
51
|
}
|
|
52
|
-
/** LLM-generated fields for
|
|
53
|
-
export declare const
|
|
52
|
+
/** LLM-generated fields for card presentation (buttons are hardcoded by callers, not LLM-generated). */
|
|
53
|
+
export declare const CardLLMSchema: z.ZodObject<{
|
|
54
54
|
headline: z.ZodString;
|
|
55
55
|
personalizedSummary: z.ZodString;
|
|
56
56
|
digestSummary: z.ZodString;
|
|
@@ -75,8 +75,8 @@ export declare const HomeCardLLMSchema: z.ZodObject<{
|
|
|
75
75
|
digestSummary: string;
|
|
76
76
|
narratorRemark: string;
|
|
77
77
|
}>;
|
|
78
|
-
/** LLM-generated result from
|
|
79
|
-
export type
|
|
78
|
+
/** LLM-generated result from presentCard (callers append button labels from opportunity.constants). */
|
|
79
|
+
export type CardLLMResult = z.infer<typeof CardLLMSchema> & {
|
|
80
80
|
/**
|
|
81
81
|
* True when the LLM call failed and this is fallback-shaped copy built from
|
|
82
82
|
* raw match reasoning. Callers with strict quality requirements (digests,
|
|
@@ -85,8 +85,8 @@ export type HomeCardLLMResult = z.infer<typeof HomeCardLLMSchema> & {
|
|
|
85
85
|
*/
|
|
86
86
|
isFallback?: boolean;
|
|
87
87
|
};
|
|
88
|
-
/** Full
|
|
89
|
-
export type
|
|
88
|
+
/** Full card display contract including hardcoded button labels (assembled by callers). */
|
|
89
|
+
export type CardPresentationResult = CardLLMResult & {
|
|
90
90
|
primaryActionLabel: string;
|
|
91
91
|
secondaryActionLabel: string;
|
|
92
92
|
};
|
|
@@ -118,14 +118,14 @@ export declare class OpportunityPresenter {
|
|
|
118
118
|
signal?: AbortSignal;
|
|
119
119
|
}): Promise<OpportunityPresentationResult>;
|
|
120
120
|
/**
|
|
121
|
-
* Generate LLM-powered
|
|
121
|
+
* Generate LLM-powered card content (headline, body, narrator remark, mutual-intent label).
|
|
122
122
|
* Callers append button labels from opportunity.constants.
|
|
123
123
|
*
|
|
124
124
|
* When `negotiationContext.status === 'negotiating'`, returns a templated
|
|
125
125
|
* chip synchronously without invoking the LLM — the card just reflects
|
|
126
126
|
* "negotiation in progress" at that point.
|
|
127
127
|
*/
|
|
128
|
-
|
|
128
|
+
presentCard(input: CardPresenterInput): Promise<CardLLMResult>;
|
|
129
129
|
/**
|
|
130
130
|
* Process multiple opportunities in parallel with bounded concurrency.
|
|
131
131
|
*/
|
|
@@ -133,12 +133,12 @@ export declare class OpportunityPresenter {
|
|
|
133
133
|
concurrency?: number;
|
|
134
134
|
}): Promise<OpportunityPresentationResult[]>;
|
|
135
135
|
/**
|
|
136
|
-
* Process multiple opportunities as
|
|
137
|
-
* Returns full
|
|
136
|
+
* Process multiple opportunities as cards in parallel with bounded concurrency.
|
|
137
|
+
* Returns full card display contracts (headline, body, narrator remark, action labels, mutual-intent label).
|
|
138
138
|
*/
|
|
139
|
-
|
|
139
|
+
presentCardBatch(inputs: CardPresenterInput[], options?: {
|
|
140
140
|
concurrency?: number;
|
|
141
|
-
}): Promise<
|
|
141
|
+
}): Promise<CardLLMResult[]>;
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* Build the LLM-facing signal summary while excluding pool adjustments. Pool
|
|
@@ -150,7 +150,7 @@ export declare function summarizeSignalsForPresenter(signals: Opportunity['inter
|
|
|
150
150
|
* Gather all context needed for the presenter from the database.
|
|
151
151
|
* Fetches viewer profile, viewer intents, other party profile(s), and index in parallel.
|
|
152
152
|
*
|
|
153
|
-
* @param displayCounterpartUserId - When set (e.g. for
|
|
153
|
+
* @param displayCounterpartUserId - When set (e.g. for a radar card), only this counterpart is included in otherPartyContext so the presenter writes about the person on the card. Omitted for introducer view (card shows both parties).
|
|
154
154
|
*/
|
|
155
155
|
export declare function gatherPresenterContext(database: PresenterDatabase, opportunity: Opportunity, viewerId: string, displayCounterpartUserId?: string): Promise<PresenterInput>;
|
|
156
156
|
export {};
|