@indexnetwork/protocol 6.6.3-rc.389.1 → 6.6.4-rc.390.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -0
- package/dist/negotiation/negotiation.graph.d.ts +8 -2
- package/dist/negotiation/negotiation.graph.d.ts.map +1 -1
- package/dist/negotiation/negotiation.graph.js +19 -4
- package/dist/negotiation/negotiation.graph.js.map +1 -1
- package/dist/negotiation/negotiation.state.d.ts +5 -3
- package/dist/negotiation/negotiation.state.d.ts.map +1 -1
- package/dist/negotiation/negotiation.state.js +5 -1
- package/dist/negotiation/negotiation.state.js.map +1 -1
- package/dist/opportunity/opportunity.graph.d.ts.map +1 -1
- package/dist/opportunity/opportunity.graph.js +1 -0
- package/dist/opportunity/opportunity.graph.js.map +1 -1
- package/dist/shared/interfaces/database.interface.d.ts +4 -3
- package/dist/shared/interfaces/database.interface.d.ts.map +1 -1
- package/dist/shared/interfaces/database.interface.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -45,6 +45,7 @@ See [STABILITY.md](./STABILITY.md) for the public-contract and tier definitions.
|
|
|
45
45
|
- Included protocol documentation files in the published package tarball so README links remain available to package consumers.
|
|
46
46
|
|
|
47
47
|
### Fixed
|
|
48
|
+
- Made negotiation startup claim the exact persisted pre-negotiation status and version, atomically promote the winning opportunity to `negotiating` with its task, and skip finalize persistence when init owns no task (IND-496).
|
|
48
49
|
- Made owned-intent opportunity persistence trigger-aware: recent/lifecycle dedup now reuses only rows linked to the same trigger intent, cross-trigger rows remain independently visible, enrichment cannot absorb another trigger's row, and final persistence reports typed same-trigger/active-negotiation conflicts (IND-495).
|
|
49
50
|
- Clamped intent-pinned `list_negotiations` results to the user's signal, added explicit signal/all scope metadata, and prevented stale cross-signal history from being presented as current negotiations (IND-483).
|
|
50
51
|
- Routed continuation-created and recovered opportunities through the normal negotiation boundary, threaded each persisted attempt version into atomic negotiation-task claiming, protected active/input-required tasks from duplicate negotiation, compensated pre-task failures and timeouts to truthful draft/latent states, and refreshed continuation cards from current lifecycle state (IND-470).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type TraceEmitter } from "../shared/observability/request-context.js";
|
|
2
|
-
import type { NegotiationGraphDatabase } from "../shared/interfaces/database.interface.js";
|
|
2
|
+
import type { NegotiationGraphDatabase, OpportunityStatus } from "../shared/interfaces/database.interface.js";
|
|
3
3
|
import type { NegotiationTimeoutQueue } from "../shared/interfaces/negotiation-events.interface.js";
|
|
4
4
|
import type { AgentDispatcher } from "../shared/interfaces/agent-dispatcher.interface.js";
|
|
5
5
|
import { type NegotiationTurn, type NegotiationOutcome, type UserNegotiationContext, type SeedAssessment, type NegotiationGraphLike } from "./negotiation.state.js";
|
|
@@ -37,6 +37,7 @@ export declare class NegotiationGraphFactory {
|
|
|
37
37
|
memoryBySide: Partial<Record<"source" | "candidate", NegotiatorMemoryEntry[]>>;
|
|
38
38
|
isContinuation: boolean;
|
|
39
39
|
opportunityId: string;
|
|
40
|
+
opportunityStatus: OpportunityStatus | undefined;
|
|
40
41
|
opportunityUpdatedAt: Date | undefined;
|
|
41
42
|
conversationId: string;
|
|
42
43
|
taskId: string;
|
|
@@ -93,6 +94,7 @@ export declare class NegotiationGraphFactory {
|
|
|
93
94
|
memoryBySide?: Partial<Record<"source" | "candidate", NegotiatorMemoryEntry[]>> | import("@langchain/langgraph").OverwriteValue<Partial<Record<"source" | "candidate", NegotiatorMemoryEntry[]>>> | undefined;
|
|
94
95
|
isContinuation?: boolean | import("@langchain/langgraph").OverwriteValue<boolean> | undefined;
|
|
95
96
|
opportunityId?: string | import("@langchain/langgraph").OverwriteValue<string> | undefined;
|
|
97
|
+
opportunityStatus?: OpportunityStatus | import("@langchain/langgraph").OverwriteValue<OpportunityStatus | undefined> | undefined;
|
|
96
98
|
opportunityUpdatedAt?: Date | import("@langchain/langgraph").OverwriteValue<Date | undefined> | undefined;
|
|
97
99
|
conversationId?: string | import("@langchain/langgraph").OverwriteValue<string> | undefined;
|
|
98
100
|
taskId?: string | import("@langchain/langgraph").OverwriteValue<string> | undefined;
|
|
@@ -175,6 +177,7 @@ export declare class NegotiationGraphFactory {
|
|
|
175
177
|
memoryBySide: import("@langchain/langgraph").BaseChannel<Partial<Record<"source" | "candidate", NegotiatorMemoryEntry[]>>, Partial<Record<"source" | "candidate", NegotiatorMemoryEntry[]>> | import("@langchain/langgraph").OverwriteValue<Partial<Record<"source" | "candidate", NegotiatorMemoryEntry[]>>>, unknown>;
|
|
176
178
|
isContinuation: import("@langchain/langgraph").BaseChannel<boolean, boolean | import("@langchain/langgraph").OverwriteValue<boolean>, unknown>;
|
|
177
179
|
opportunityId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
|
|
180
|
+
opportunityStatus: import("@langchain/langgraph").BaseChannel<OpportunityStatus | undefined, OpportunityStatus | import("@langchain/langgraph").OverwriteValue<OpportunityStatus | undefined> | undefined, unknown>;
|
|
178
181
|
opportunityUpdatedAt: import("@langchain/langgraph").BaseChannel<Date | undefined, Date | import("@langchain/langgraph").OverwriteValue<Date | undefined> | undefined, unknown>;
|
|
179
182
|
conversationId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
|
|
180
183
|
taskId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
|
|
@@ -280,6 +283,7 @@ export declare class NegotiationGraphFactory {
|
|
|
280
283
|
memoryBySide: import("@langchain/langgraph").BaseChannel<Partial<Record<"source" | "candidate", NegotiatorMemoryEntry[]>>, Partial<Record<"source" | "candidate", NegotiatorMemoryEntry[]>> | import("@langchain/langgraph").OverwriteValue<Partial<Record<"source" | "candidate", NegotiatorMemoryEntry[]>>>, unknown>;
|
|
281
284
|
isContinuation: import("@langchain/langgraph").BaseChannel<boolean, boolean | import("@langchain/langgraph").OverwriteValue<boolean>, unknown>;
|
|
282
285
|
opportunityId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
|
|
286
|
+
opportunityStatus: import("@langchain/langgraph").BaseChannel<OpportunityStatus | undefined, OpportunityStatus | import("@langchain/langgraph").OverwriteValue<OpportunityStatus | undefined> | undefined, unknown>;
|
|
283
287
|
opportunityUpdatedAt: import("@langchain/langgraph").BaseChannel<Date | undefined, Date | import("@langchain/langgraph").OverwriteValue<Date | undefined> | undefined, unknown>;
|
|
284
288
|
conversationId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
|
|
285
289
|
taskId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
|
|
@@ -414,6 +418,7 @@ export declare class NegotiationGraphFactory {
|
|
|
414
418
|
memoryBySide: import("@langchain/langgraph").BaseChannel<Partial<Record<"source" | "candidate", NegotiatorMemoryEntry[]>>, Partial<Record<"source" | "candidate", NegotiatorMemoryEntry[]>> | import("@langchain/langgraph").OverwriteValue<Partial<Record<"source" | "candidate", NegotiatorMemoryEntry[]>>>, unknown>;
|
|
415
419
|
isContinuation: import("@langchain/langgraph").BaseChannel<boolean, boolean | import("@langchain/langgraph").OverwriteValue<boolean>, unknown>;
|
|
416
420
|
opportunityId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
|
|
421
|
+
opportunityStatus: import("@langchain/langgraph").BaseChannel<OpportunityStatus | undefined, OpportunityStatus | import("@langchain/langgraph").OverwriteValue<OpportunityStatus | undefined> | undefined, unknown>;
|
|
417
422
|
opportunityUpdatedAt: import("@langchain/langgraph").BaseChannel<Date | undefined, Date | import("@langchain/langgraph").OverwriteValue<Date | undefined> | undefined, unknown>;
|
|
418
423
|
conversationId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
|
|
419
424
|
taskId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
|
|
@@ -530,7 +535,8 @@ export interface NegotiationCandidate {
|
|
|
530
535
|
* (`accept` → 'pending', `reject` → 'rejected', otherwise → 'stalled').
|
|
531
536
|
*/
|
|
532
537
|
opportunityId?: string;
|
|
533
|
-
/** Exact persisted lifecycle
|
|
538
|
+
/** Exact persisted lifecycle state claimed by this negotiation attempt. */
|
|
539
|
+
opportunityStatus?: OpportunityStatus;
|
|
534
540
|
opportunityUpdatedAt?: Date;
|
|
535
541
|
}
|
|
536
542
|
export interface NegotiationResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"negotiation.graph.d.ts","sourceRoot":"/","sources":["negotiation/negotiation.graph.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC/F,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"negotiation.graph.d.ts","sourceRoot":"/","sources":["negotiation/negotiation.graph.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC/F,OAAO,KAAK,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC9G,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sDAAsD,CAAC;AACpG,OAAO,KAAK,EAAE,eAAe,EAA0B,MAAM,oDAAoD,CAAC;AAClH,OAAO,EAAyB,KAAK,eAAe,EAAE,KAAK,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,KAAK,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG3L,OAAO,EAAkE,KAAK,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpI,OAAO,EAAwG,KAAK,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAC3K,OAAO,KAAK,EAAmB,0BAA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IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,EAAE,qBAAqB,CAAC;IAC5C,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IACrC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GACA,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAwJ9B"}
|
|
@@ -233,10 +233,14 @@ export class NegotiationGraphFactory {
|
|
|
233
233
|
isContinuation,
|
|
234
234
|
priorTurnCount: priorTurns.length,
|
|
235
235
|
};
|
|
236
|
-
|
|
236
|
+
if (state.opportunityId && Boolean(state.opportunityStatus) !== Boolean(state.opportunityUpdatedAt)) {
|
|
237
|
+
throw new Error('Negotiation attempt requires both opportunity status and updatedAt');
|
|
238
|
+
}
|
|
239
|
+
const task = state.opportunityId && state.opportunityStatus && state.opportunityUpdatedAt
|
|
237
240
|
? await database.createNegotiationTaskForAttempt({
|
|
238
241
|
conversationId: conversation.id,
|
|
239
242
|
opportunityId: state.opportunityId,
|
|
243
|
+
expectedStatus: state.opportunityStatus,
|
|
240
244
|
expectedUpdatedAt: state.opportunityUpdatedAt,
|
|
241
245
|
metadata: taskMetadata,
|
|
242
246
|
})
|
|
@@ -244,9 +248,9 @@ export class NegotiationGraphFactory {
|
|
|
244
248
|
if (!task) {
|
|
245
249
|
throw new Error('Negotiation attempt is stale or already claimed');
|
|
246
250
|
}
|
|
247
|
-
// Attempt-bound discovery
|
|
248
|
-
//
|
|
249
|
-
// only an opportunity ID retain the prior best-effort status update.
|
|
251
|
+
// Attempt-bound discovery atomically promoted the exact persisted state
|
|
252
|
+
// to `negotiating` while inserting the task. Legacy/direct invocations
|
|
253
|
+
// with only an opportunity ID retain the prior best-effort status update.
|
|
250
254
|
if (state.opportunityId && !state.opportunityUpdatedAt) {
|
|
251
255
|
await database.updateOpportunityStatus(state.opportunityId, 'negotiating').catch((err) => {
|
|
252
256
|
initLog.error('Failed to set opportunity status to negotiating', { opportunityId: state.opportunityId, error: err });
|
|
@@ -779,6 +783,16 @@ export class NegotiationGraphFactory {
|
|
|
779
783
|
}
|
|
780
784
|
return {};
|
|
781
785
|
}
|
|
786
|
+
// Init can fail closed before an attempt owns a task. Such a rejection is
|
|
787
|
+
// not a completed negotiation and must not write through an empty task ID,
|
|
788
|
+
// create an artifact, or advance the opportunity lifecycle.
|
|
789
|
+
if (!state.taskId) {
|
|
790
|
+
finalizeLog.info('Skipping outcome persistence because no negotiation task was claimed', {
|
|
791
|
+
opportunityId: state.opportunityId || undefined,
|
|
792
|
+
error: state.error || undefined,
|
|
793
|
+
});
|
|
794
|
+
return {};
|
|
795
|
+
}
|
|
782
796
|
const history = turnsFromMessages(state.messages);
|
|
783
797
|
const lastTurn = state.lastTurn;
|
|
784
798
|
const hasOpportunity = lastTurn?.action === "accept";
|
|
@@ -994,6 +1008,7 @@ export async function negotiateCandidates(negotiationGraph, sourceUser, candidat
|
|
|
994
1008
|
},
|
|
995
1009
|
...(candidate.discoveryQuery && { discoveryQuery: candidate.discoveryQuery }),
|
|
996
1010
|
...(candidate.opportunityId && { opportunityId: candidate.opportunityId }),
|
|
1011
|
+
...(candidate.opportunityStatus && { opportunityStatus: candidate.opportunityStatus }),
|
|
997
1012
|
...(candidate.opportunityUpdatedAt && { opportunityUpdatedAt: candidate.opportunityUpdatedAt }),
|
|
998
1013
|
...(initiatorUserId && { initiatorUserId }),
|
|
999
1014
|
...(maxTurns !== undefined && { maxTurns }),
|