@indexnetwork/protocol 66.0.0-rc.619.1 → 66.0.0-rc.623.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/dist/capabilities/intents.d.ts +24 -0
- package/dist/internal/intents/graph/intent.graph.d.ts +24 -0
- package/dist/internal/intents/graph/intent.graph.execute.js +4 -1
- package/dist/internal/intents/graph/intent.graph.state.d.ts +12 -0
- package/dist/internal/intents/graph/intent.graph.state.js +4 -0
- package/dist/internal/opportunities/opportunity.cards.d.ts +2 -0
- package/dist/internal/opportunities/opportunity.cards.js +13 -8
- package/dist/platform/database/entities.d.ts +10 -6
- package/dist/platform/database/identity-queries.d.ts +0 -1
- package/dist/protocol/protocol.prompt.js +4 -0
- package/package.json +1 -1
|
@@ -73,6 +73,8 @@ export declare class Intents {
|
|
|
73
73
|
archive: boolean;
|
|
74
74
|
status: "active" | "paused" | undefined;
|
|
75
75
|
expectedIntentFingerprint: string | undefined;
|
|
76
|
+
sourceType: string | null | undefined;
|
|
77
|
+
sourceId: string | null | undefined;
|
|
76
78
|
networkId: string | undefined;
|
|
77
79
|
networkIds: string[] | undefined;
|
|
78
80
|
scopeType: import("../index.js").ScopeType | undefined;
|
|
@@ -123,6 +125,8 @@ export declare class Intents {
|
|
|
123
125
|
archive?: boolean | import("@langchain/langgraph").OverwriteValue<boolean> | undefined;
|
|
124
126
|
status?: "active" | "paused" | import("@langchain/langgraph").OverwriteValue<"active" | "paused" | undefined> | undefined;
|
|
125
127
|
expectedIntentFingerprint?: string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined;
|
|
128
|
+
sourceType?: string | null | undefined;
|
|
129
|
+
sourceId?: string | null | undefined;
|
|
126
130
|
networkId?: string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined;
|
|
127
131
|
networkIds?: string[] | import("@langchain/langgraph").OverwriteValue<string[] | undefined> | undefined;
|
|
128
132
|
scopeType?: import("../index.js").ScopeType | import("@langchain/langgraph").OverwriteValue<import("../index.js").ScopeType | undefined> | undefined;
|
|
@@ -214,6 +218,16 @@ export declare class Intents {
|
|
|
214
218
|
archive: import("@langchain/langgraph").BaseChannel<boolean, boolean | import("@langchain/langgraph").OverwriteValue<boolean>, unknown>;
|
|
215
219
|
status: import("@langchain/langgraph").BaseChannel<"active" | "paused" | undefined, "active" | "paused" | import("@langchain/langgraph").OverwriteValue<"active" | "paused" | undefined> | undefined, unknown>;
|
|
216
220
|
expectedIntentFingerprint: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
|
|
221
|
+
sourceType: {
|
|
222
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | null | undefined, string | null | undefined>): import("@langchain/langgraph").BaseChannel<string | null | undefined, string | import("@langchain/langgraph").OverwriteValue<string | null | undefined> | null | undefined, unknown>;
|
|
223
|
+
(): import("@langchain/langgraph").LastValue<string | null | undefined>;
|
|
224
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
225
|
+
};
|
|
226
|
+
sourceId: {
|
|
227
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | null | undefined, string | null | undefined>): import("@langchain/langgraph").BaseChannel<string | null | undefined, string | import("@langchain/langgraph").OverwriteValue<string | null | undefined> | null | undefined, unknown>;
|
|
228
|
+
(): import("@langchain/langgraph").LastValue<string | null | undefined>;
|
|
229
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
230
|
+
};
|
|
217
231
|
networkId: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
|
|
218
232
|
networkIds: import("@langchain/langgraph").BaseChannel<string[] | undefined, string[] | import("@langchain/langgraph").OverwriteValue<string[] | undefined> | undefined, unknown>;
|
|
219
233
|
scopeType: import("@langchain/langgraph").BaseChannel<import("../index.js").ScopeType | undefined, import("../index.js").ScopeType | import("@langchain/langgraph").OverwriteValue<import("../index.js").ScopeType | undefined> | undefined, unknown>;
|
|
@@ -326,6 +340,16 @@ export declare class Intents {
|
|
|
326
340
|
archive: import("@langchain/langgraph").BaseChannel<boolean, boolean | import("@langchain/langgraph").OverwriteValue<boolean>, unknown>;
|
|
327
341
|
status: import("@langchain/langgraph").BaseChannel<"active" | "paused" | undefined, "active" | "paused" | import("@langchain/langgraph").OverwriteValue<"active" | "paused" | undefined> | undefined, unknown>;
|
|
328
342
|
expectedIntentFingerprint: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
|
|
343
|
+
sourceType: {
|
|
344
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | null | undefined, string | null | undefined>): import("@langchain/langgraph").BaseChannel<string | null | undefined, string | import("@langchain/langgraph").OverwriteValue<string | null | undefined> | null | undefined, unknown>;
|
|
345
|
+
(): import("@langchain/langgraph").LastValue<string | null | undefined>;
|
|
346
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
347
|
+
};
|
|
348
|
+
sourceId: {
|
|
349
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | null | undefined, string | null | undefined>): import("@langchain/langgraph").BaseChannel<string | null | undefined, string | import("@langchain/langgraph").OverwriteValue<string | null | undefined> | null | undefined, unknown>;
|
|
350
|
+
(): import("@langchain/langgraph").LastValue<string | null | undefined>;
|
|
351
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
352
|
+
};
|
|
329
353
|
networkId: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
|
|
330
354
|
networkIds: import("@langchain/langgraph").BaseChannel<string[] | undefined, string[] | import("@langchain/langgraph").OverwriteValue<string[] | undefined> | undefined, unknown>;
|
|
331
355
|
scopeType: import("@langchain/langgraph").BaseChannel<import("../index.js").ScopeType | undefined, import("../index.js").ScopeType | import("@langchain/langgraph").OverwriteValue<import("../index.js").ScopeType | undefined> | undefined, unknown>;
|
|
@@ -31,6 +31,8 @@ export declare class IntentGraphFactory {
|
|
|
31
31
|
archive: boolean;
|
|
32
32
|
status: "active" | "paused" | undefined;
|
|
33
33
|
expectedIntentFingerprint: string | undefined;
|
|
34
|
+
sourceType: string | null | undefined;
|
|
35
|
+
sourceId: string | null | undefined;
|
|
34
36
|
networkId: string | undefined;
|
|
35
37
|
networkIds: string[] | undefined;
|
|
36
38
|
scopeType: import("../../../index.js").ScopeType | undefined;
|
|
@@ -81,6 +83,8 @@ export declare class IntentGraphFactory {
|
|
|
81
83
|
archive?: boolean | import("@langchain/langgraph").OverwriteValue<boolean> | undefined;
|
|
82
84
|
status?: "active" | "paused" | import("@langchain/langgraph").OverwriteValue<"active" | "paused" | undefined> | undefined;
|
|
83
85
|
expectedIntentFingerprint?: string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined;
|
|
86
|
+
sourceType?: string | null | undefined;
|
|
87
|
+
sourceId?: string | null | undefined;
|
|
84
88
|
networkId?: string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined;
|
|
85
89
|
networkIds?: string[] | import("@langchain/langgraph").OverwriteValue<string[] | undefined> | undefined;
|
|
86
90
|
scopeType?: import("../../../index.js").ScopeType | import("@langchain/langgraph").OverwriteValue<import("../../../index.js").ScopeType | undefined> | undefined;
|
|
@@ -172,6 +176,16 @@ export declare class IntentGraphFactory {
|
|
|
172
176
|
archive: import("@langchain/langgraph").BaseChannel<boolean, boolean | import("@langchain/langgraph").OverwriteValue<boolean>, unknown>;
|
|
173
177
|
status: import("@langchain/langgraph").BaseChannel<"active" | "paused" | undefined, "active" | "paused" | import("@langchain/langgraph").OverwriteValue<"active" | "paused" | undefined> | undefined, unknown>;
|
|
174
178
|
expectedIntentFingerprint: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
|
|
179
|
+
sourceType: {
|
|
180
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | null | undefined, string | null | undefined>): import("@langchain/langgraph").BaseChannel<string | null | undefined, string | import("@langchain/langgraph").OverwriteValue<string | null | undefined> | null | undefined, unknown>;
|
|
181
|
+
(): import("@langchain/langgraph").LastValue<string | null | undefined>;
|
|
182
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
183
|
+
};
|
|
184
|
+
sourceId: {
|
|
185
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | null | undefined, string | null | undefined>): import("@langchain/langgraph").BaseChannel<string | null | undefined, string | import("@langchain/langgraph").OverwriteValue<string | null | undefined> | null | undefined, unknown>;
|
|
186
|
+
(): import("@langchain/langgraph").LastValue<string | null | undefined>;
|
|
187
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
188
|
+
};
|
|
175
189
|
networkId: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
|
|
176
190
|
networkIds: import("@langchain/langgraph").BaseChannel<string[] | undefined, string[] | import("@langchain/langgraph").OverwriteValue<string[] | undefined> | undefined, unknown>;
|
|
177
191
|
scopeType: import("@langchain/langgraph").BaseChannel<import("../../../index.js").ScopeType | undefined, import("../../../index.js").ScopeType | import("@langchain/langgraph").OverwriteValue<import("../../../index.js").ScopeType | undefined> | undefined, unknown>;
|
|
@@ -284,6 +298,16 @@ export declare class IntentGraphFactory {
|
|
|
284
298
|
archive: import("@langchain/langgraph").BaseChannel<boolean, boolean | import("@langchain/langgraph").OverwriteValue<boolean>, unknown>;
|
|
285
299
|
status: import("@langchain/langgraph").BaseChannel<"active" | "paused" | undefined, "active" | "paused" | import("@langchain/langgraph").OverwriteValue<"active" | "paused" | undefined> | undefined, unknown>;
|
|
286
300
|
expectedIntentFingerprint: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
|
|
301
|
+
sourceType: {
|
|
302
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | null | undefined, string | null | undefined>): import("@langchain/langgraph").BaseChannel<string | null | undefined, string | import("@langchain/langgraph").OverwriteValue<string | null | undefined> | null | undefined, unknown>;
|
|
303
|
+
(): import("@langchain/langgraph").LastValue<string | null | undefined>;
|
|
304
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
305
|
+
};
|
|
306
|
+
sourceId: {
|
|
307
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | null | undefined, string | null | undefined>): import("@langchain/langgraph").BaseChannel<string | null | undefined, string | import("@langchain/langgraph").OverwriteValue<string | null | undefined> | null | undefined, unknown>;
|
|
308
|
+
(): import("@langchain/langgraph").LastValue<string | null | undefined>;
|
|
309
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
310
|
+
};
|
|
287
311
|
networkId: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
|
|
288
312
|
networkIds: import("@langchain/langgraph").BaseChannel<string[] | undefined, string[] | import("@langchain/langgraph").OverwriteValue<string[] | undefined> | undefined, unknown>;
|
|
289
313
|
scopeType: import("@langchain/langgraph").BaseChannel<import("../../../index.js").ScopeType | undefined, import("../../../index.js").ScopeType | import("@langchain/langgraph").OverwriteValue<import("../../../index.js").ScopeType | undefined> | undefined, unknown>;
|
|
@@ -39,7 +39,8 @@ export async function executorNode(state, deps) {
|
|
|
39
39
|
payload,
|
|
40
40
|
confidence: 1.0,
|
|
41
41
|
inferenceType: 'explicit',
|
|
42
|
-
sourceType:
|
|
42
|
+
sourceType: state.sourceType ?? null,
|
|
43
|
+
sourceId: state.sourceId ?? null,
|
|
43
44
|
embedding: flatEmbedding,
|
|
44
45
|
semanticEntropy: metadata?.semanticEntropy ?? null,
|
|
45
46
|
referentialAnchor: metadata?.referentialAnchor ?? null,
|
|
@@ -88,6 +89,8 @@ export async function executorNode(state, deps) {
|
|
|
88
89
|
felicityClarity: matchedVerifiedIntent?.verification?.felicity_scores.clarity ?? null,
|
|
89
90
|
intentMode: updateAction.intentMode ?? null,
|
|
90
91
|
speechActType: toSpeechActType(matchedVerifiedIntent?.verification?.classification),
|
|
92
|
+
...(state.sourceType !== undefined ? { sourceType: state.sourceType } : {}),
|
|
93
|
+
...(state.sourceId !== undefined ? { sourceId: state.sourceId } : {}),
|
|
91
94
|
...(state.expectedIntentFingerprint !== undefined ? {
|
|
92
95
|
expectedIntentFingerprint: state.expectedIntentFingerprint,
|
|
93
96
|
expectedIntentUserId: state.userId,
|
|
@@ -154,6 +154,18 @@ export declare const IntentGraphState: import("@langchain/langgraph").Annotation
|
|
|
154
154
|
* updates. The database rechecks it while holding the final intent row lock.
|
|
155
155
|
*/
|
|
156
156
|
expectedIntentFingerprint: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
|
|
157
|
+
/** Client-owned label written on create or update. Undefined leaves it; null clears it. */
|
|
158
|
+
sourceType: {
|
|
159
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | null | undefined, string | null | undefined>): import("@langchain/langgraph").BaseChannel<string | null | undefined, string | import("@langchain/langgraph").OverwriteValue<string | null | undefined> | null | undefined, unknown>;
|
|
160
|
+
(): import("@langchain/langgraph").LastValue<string | null | undefined>;
|
|
161
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
162
|
+
};
|
|
163
|
+
/** Client-owned reference written on create or update. Undefined leaves it; null clears it. */
|
|
164
|
+
sourceId: {
|
|
165
|
+
(annotation: import("@langchain/langgraph").SingleReducer<string | null | undefined, string | null | undefined>): import("@langchain/langgraph").BaseChannel<string | null | undefined, string | import("@langchain/langgraph").OverwriteValue<string | null | undefined> | null | undefined, unknown>;
|
|
166
|
+
(): import("@langchain/langgraph").LastValue<string | null | undefined>;
|
|
167
|
+
Root: <S extends import("@langchain/langgraph").StateDefinition>(sd: S) => import("@langchain/langgraph").AnnotationRoot<S>;
|
|
168
|
+
};
|
|
157
169
|
/**
|
|
158
170
|
* Optional network scope (network ID) for read operations. Prep always
|
|
159
171
|
* fetches ALL user intents via getActiveIntents(userId) regardless of network
|
|
@@ -64,6 +64,10 @@ export const IntentGraphState = Annotation.Root({
|
|
|
64
64
|
reducer: (curr, next) => next ?? curr,
|
|
65
65
|
default: () => undefined,
|
|
66
66
|
}),
|
|
67
|
+
/** Client-owned label written on create or update. Undefined leaves it; null clears it. */
|
|
68
|
+
sourceType: (Annotation),
|
|
69
|
+
/** Client-owned reference written on create or update. Undefined leaves it; null clears it. */
|
|
70
|
+
sourceId: (Annotation),
|
|
67
71
|
/**
|
|
68
72
|
* Optional network scope (network ID) for read operations. Prep always
|
|
69
73
|
* fetches ALL user intents via getActiveIntents(userId) regardless of network
|
|
@@ -29,6 +29,8 @@ export interface OpportunityCard {
|
|
|
29
29
|
};
|
|
30
30
|
/** Viewer's role in this opportunity (e.g. 'party', 'agent', 'patient', 'peer'). */
|
|
31
31
|
viewerRole?: string;
|
|
32
|
+
/** This viewer already committed. Status can still be pending until the other person accepts. */
|
|
33
|
+
viewerCommitted?: boolean;
|
|
32
34
|
/**
|
|
33
35
|
* True for a skeleton card: identity fields are real but mainText/cta are
|
|
34
36
|
* empty because the presenter was skipped. Never cached.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { protocolLogger } from '../shared/observability/protocol.logger.js';
|
|
7
7
|
import { buildOpportunityCardCacheKey, gatherPresenterContext } from './opportunity.presentation.js';
|
|
8
8
|
import { loadNegotiationContext } from './negotiation-context.loader.js';
|
|
9
|
-
import { canUserSeeOpportunity
|
|
9
|
+
import { canUserSeeOpportunity } from './opportunity.utils.js';
|
|
10
10
|
import { getPrimaryActionLabel, SECONDARY_ACTION_LABEL } from './opportunity.labels.js';
|
|
11
11
|
const logger = protocolLogger('OpportunityCards');
|
|
12
12
|
const PRESENTATION_CONCURRENCY = 50;
|
|
@@ -30,6 +30,12 @@ function pickDisplayCounterpartActor(opportunity, viewerId) {
|
|
|
30
30
|
function counterpartUserIds(opportunity, viewerId) {
|
|
31
31
|
return new Set(opportunity.actors.map((a) => a.userId).filter((id) => id && id !== viewerId));
|
|
32
32
|
}
|
|
33
|
+
function viewerHasCommitted(opportunity, viewerId) {
|
|
34
|
+
return (opportunity.committedActorIds ?? []).includes(viewerId);
|
|
35
|
+
}
|
|
36
|
+
function stampViewerCommitted(card, viewerCommitted) {
|
|
37
|
+
return { ...card, viewerCommitted };
|
|
38
|
+
}
|
|
33
39
|
/**
|
|
34
40
|
* Present one opportunity as a card for the viewer.
|
|
35
41
|
*
|
|
@@ -46,13 +52,14 @@ export async function presentOpportunityCard(deps, opportunity, viewerId, option
|
|
|
46
52
|
const counterpart = pickDisplayCounterpartActor(opportunity, viewerId);
|
|
47
53
|
if (!counterpart)
|
|
48
54
|
return null;
|
|
55
|
+
const viewerCommitted = viewerHasCommitted(opportunity, viewerId);
|
|
49
56
|
const cacheable = opportunity.status !== 'negotiating';
|
|
50
57
|
const cacheKey = buildOpportunityCardCacheKey(opportunity.id, viewerId, options.intentId);
|
|
51
58
|
if (cacheable && !options.skeleton && !options.noCache) {
|
|
52
59
|
try {
|
|
53
60
|
const hit = await deps.cache.get(cacheKey);
|
|
54
61
|
if (hit)
|
|
55
|
-
return { ...hit, status: opportunity.status };
|
|
62
|
+
return stampViewerCommitted({ ...hit, status: opportunity.status }, viewerCommitted);
|
|
56
63
|
}
|
|
57
64
|
catch (error) {
|
|
58
65
|
logger.warn('card cache read failed, presenting', { opportunityId: opportunity.id, error });
|
|
@@ -78,7 +85,7 @@ export async function presentOpportunityCard(deps, opportunity, viewerId, option
|
|
|
78
85
|
viewerRole,
|
|
79
86
|
};
|
|
80
87
|
if (options.skeleton) {
|
|
81
|
-
return { ...identity, mainText: '', cta: '', mutualIntentsLabel: 'Shared interests', presentationPending: true };
|
|
88
|
+
return stampViewerCommitted({ ...identity, mainText: '', cta: '', mutualIntentsLabel: 'Shared interests', presentationPending: true }, viewerCommitted);
|
|
82
89
|
}
|
|
83
90
|
const [context, negotiationContext] = await Promise.all([
|
|
84
91
|
gatherPresenterContext(database, opportunity, viewerId, counterpart.userId, options.intentId),
|
|
@@ -89,14 +96,14 @@ export async function presentOpportunityCard(deps, opportunity, viewerId, option
|
|
|
89
96
|
opportunityStatus: opportunity.status,
|
|
90
97
|
...(negotiationContext ? { negotiationContext } : {}),
|
|
91
98
|
});
|
|
92
|
-
const card = {
|
|
99
|
+
const card = stampViewerCommitted({
|
|
93
100
|
...identity,
|
|
94
101
|
mainText: presentation.personalizedSummary,
|
|
95
102
|
cta: presentation.suggestedAction,
|
|
96
103
|
headline: presentation.headline,
|
|
97
104
|
mutualIntentsLabel: presentation.mutualIntentsLabel,
|
|
98
105
|
narratorChip: { name: 'Index', text: presentation.narratorRemark },
|
|
99
|
-
};
|
|
106
|
+
}, viewerCommitted);
|
|
100
107
|
if (cacheable) {
|
|
101
108
|
await deps.cache.set(cacheKey, card).catch((error) => {
|
|
102
109
|
logger.warn('card cache write failed', { opportunityId: opportunity.id, error });
|
|
@@ -124,8 +131,6 @@ export async function listOpportunityCards(deps, input) {
|
|
|
124
131
|
const requested = new Set(input.statuses);
|
|
125
132
|
const visible = raw
|
|
126
133
|
.filter((opp) => requested.has(opp.status) && canUserSeeOpportunity(opp.actors, opp.status, viewerId))
|
|
127
|
-
.filter((opp) => opp.status !== 'pending'
|
|
128
|
-
|| isActionableForViewer(opp.actors, opp.status, viewerId, opp.committedActorIds ?? []))
|
|
129
134
|
.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
|
|
130
135
|
const seen = new Set();
|
|
131
136
|
const opportunities = visible.filter((opp) => {
|
|
@@ -146,7 +151,7 @@ export async function listOpportunityCards(deps, input) {
|
|
|
146
151
|
cacheableOpps.forEach((opp, i) => {
|
|
147
152
|
const hit = hits[i];
|
|
148
153
|
if (hit)
|
|
149
|
-
cached.set(opp.id, { ...hit, status: opp.status });
|
|
154
|
+
cached.set(opp.id, stampViewerCommitted({ ...hit, status: opp.status }, viewerHasCommitted(opp, viewerId)));
|
|
150
155
|
});
|
|
151
156
|
}
|
|
152
157
|
catch (error) {
|
|
@@ -155,10 +155,10 @@ export interface CreateIntentData {
|
|
|
155
155
|
isIncognito?: boolean;
|
|
156
156
|
/** Network IDs to associate with (optional, uses dynamic scoping if empty) */
|
|
157
157
|
networkIds?: string[];
|
|
158
|
-
/**
|
|
159
|
-
sourceType?:
|
|
160
|
-
/**
|
|
161
|
-
sourceId?: string;
|
|
158
|
+
/** Client-owned label, stored and returned unchanged */
|
|
159
|
+
sourceType?: string | null;
|
|
160
|
+
/** Client-owned reference, stored and returned unchanged */
|
|
161
|
+
sourceId?: string | null;
|
|
162
162
|
/** Confidence score from inference (0-1, required) */
|
|
163
163
|
confidence: number;
|
|
164
164
|
/** How the intent was inferred */
|
|
@@ -191,6 +191,10 @@ export interface UpdateIntentData {
|
|
|
191
191
|
embedding?: number[];
|
|
192
192
|
/** Updated incognito status */
|
|
193
193
|
isIncognito?: boolean;
|
|
194
|
+
/** Client-owned label; null clears it */
|
|
195
|
+
sourceType?: string | null;
|
|
196
|
+
/** Client-owned reference; null clears it */
|
|
197
|
+
sourceId?: string | null;
|
|
194
198
|
/** Updated network associations (replaces existing) */
|
|
195
199
|
networkIds?: string[];
|
|
196
200
|
/** Semantic entropy from verifier (0 specific -> 1 vague) */
|
|
@@ -244,9 +248,9 @@ export interface IntentRecord extends CreatedIntent {
|
|
|
244
248
|
archivedAt: Date | null;
|
|
245
249
|
/** Embedding vector (may be null) */
|
|
246
250
|
embedding?: number[] | null;
|
|
247
|
-
/**
|
|
251
|
+
/** Client-owned label */
|
|
248
252
|
sourceType?: string | null;
|
|
249
|
-
/**
|
|
253
|
+
/** Client-owned reference */
|
|
250
254
|
sourceId?: string | null;
|
|
251
255
|
/** Lifecycle admission state; null is a legacy active row. */
|
|
252
256
|
status?: 'active' | 'paused' | null;
|
|
@@ -84,6 +84,10 @@ Identity is account/presentation metadata. Context is dynamic, scoped runtime st
|
|
|
84
84
|
- Confidence (0-1, how well the inference captured the user's intent)
|
|
85
85
|
- Inference type (explicit = user stated directly; implicit = system inferred)
|
|
86
86
|
- Embedding (semantic vector for matching)
|
|
87
|
+
- Source type and source ID (optional client-owned strings, set on create or update, stored and returned unchanged)
|
|
88
|
+
|
|
89
|
+
### Source Fields
|
|
90
|
+
Clients may set \`sourceType\` and \`sourceId\` to map their own records to a published signal. An agent that inferred an ambient intent can pass its local id as \`sourceId\` when the owner approves publishing it, then match the signal back by that value. Index does not interpret either field. Omit a field to leave it unchanged; null clears it.
|
|
87
91
|
|
|
88
92
|
### Signal Lifecycle
|
|
89
93
|
1. User creates intent (explicit signal) or system infers from behavior (implicit)
|