@indexnetwork/protocol 6.8.0-rc.395.1 → 6.10.0-rc.397.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/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/negotiation/negotiation.agent.d.ts +3 -1
- package/dist/negotiation/negotiation.agent.d.ts.map +1 -1
- package/dist/negotiation/negotiation.agent.js +4 -1
- package/dist/negotiation/negotiation.agent.js.map +1 -1
- package/dist/negotiation/negotiation.consultation-policy.d.ts +40 -0
- package/dist/negotiation/negotiation.consultation-policy.d.ts.map +1 -0
- package/dist/negotiation/negotiation.consultation-policy.js +69 -0
- package/dist/negotiation/negotiation.consultation-policy.js.map +1 -0
- package/dist/negotiation/negotiation.graph.d.ts +86 -28
- package/dist/negotiation/negotiation.graph.d.ts.map +1 -1
- package/dist/negotiation/negotiation.graph.js +311 -81
- package/dist/negotiation/negotiation.graph.js.map +1 -1
- package/dist/negotiation/negotiation.question-safety.d.ts +26 -0
- package/dist/negotiation/negotiation.question-safety.d.ts.map +1 -0
- package/dist/negotiation/negotiation.question-safety.js +56 -0
- package/dist/negotiation/negotiation.question-safety.js.map +1 -0
- package/dist/negotiation/negotiation.state.d.ts +25 -2
- package/dist/negotiation/negotiation.state.d.ts.map +1 -1
- package/dist/negotiation/negotiation.state.js +35 -0
- package/dist/negotiation/negotiation.state.js.map +1 -1
- package/dist/opportunity/opportunity.graph.d.ts +12 -1
- package/dist/opportunity/opportunity.graph.d.ts.map +1 -1
- package/dist/opportunity/opportunity.graph.js +43 -5
- package/dist/opportunity/opportunity.graph.js.map +1 -1
- package/dist/opportunity/opportunity.state.d.ts +5 -2
- package/dist/opportunity/opportunity.state.d.ts.map +1 -1
- package/dist/opportunity/opportunity.state.js +5 -0
- package/dist/opportunity/opportunity.state.js.map +1 -1
- package/dist/questioner/questioner.agent.d.ts +1 -1
- package/dist/questioner/questioner.agent.d.ts.map +1 -1
- package/dist/questioner/questioner.agent.js +5 -0
- package/dist/questioner/questioner.agent.js.map +1 -1
- package/dist/questioner/questioner.presets.d.ts.map +1 -1
- package/dist/questioner/questioner.presets.js +9 -13
- package/dist/questioner/questioner.presets.js.map +1 -1
- package/dist/questioner/questioner.types.d.ts +47 -10
- package/dist/questioner/questioner.types.d.ts.map +1 -1
- package/dist/questioner/questioner.types.js +61 -1
- package/dist/questioner/questioner.types.js.map +1 -1
- package/dist/shared/agent/tool.factory.d.ts.map +1 -1
- package/dist/shared/agent/tool.factory.js +1 -0
- package/dist/shared/agent/tool.factory.js.map +1 -1
- package/dist/shared/interfaces/agent-dispatcher.interface.d.ts +3 -0
- package/dist/shared/interfaces/agent-dispatcher.interface.d.ts.map +1 -1
- package/dist/shared/interfaces/agent-dispatcher.interface.js.map +1 -1
- package/dist/shared/interfaces/database.interface.d.ts +81 -6
- package/dist/shared/interfaces/database.interface.d.ts.map +1 -1
- package/dist/shared/interfaces/database.interface.js.map +1 -1
- package/dist/shared/interfaces/negotiation-events.interface.d.ts +14 -2
- package/dist/shared/interfaces/negotiation-events.interface.d.ts.map +1 -1
- package/dist/shared/interfaces/negotiation-events.interface.js.map +1 -1
- package/dist/shared/schemas/question.schema.d.ts +347 -28
- package/dist/shared/schemas/question.schema.d.ts.map +1 -1
- package/dist/shared/schemas/question.schema.js +132 -2
- package/dist/shared/schemas/question.schema.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { hasUnsupportedOpportunityClaim } from '../opportunity/opportunity.claim-safety.js';
|
|
2
|
+
/** Fixed prompt-safe labels; producers must not replace them with raw network/counterparty text. */
|
|
3
|
+
export const NEGOTIATION_QUESTION_GENERIC_COUNTERPARTY = 'the other participant';
|
|
4
|
+
export const NEGOTIATION_QUESTION_GENERIC_NETWORK = 'the selected network';
|
|
5
|
+
export const NEGOTIATION_QUESTION_GENERIC_UPTAKE_ACTIVITY = 'a potential collaboration that may require clarification before you decide';
|
|
6
|
+
const INTERNAL_ID_PATTERN = /\b(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|(?:task|intent|network|opportunity|user|match)[_-]?id)\b/i;
|
|
7
|
+
const PRIVATE_SOURCE_PATTERN = /\b(?:private transcript|raw transcript|assessment(?:\.reasoning)?|seed assessment|evaluator reasoning|match reason|matchReason|internal metadata|counterparty profile)\b/i;
|
|
8
|
+
function normalize(value) {
|
|
9
|
+
return value.toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Deterministically reject question context copied from private negotiation inputs.
|
|
13
|
+
* This guard never rewrites content: unsafe or ambiguous text yields no card while
|
|
14
|
+
* the already-armed timeout retains the conservative continuation path.
|
|
15
|
+
*/
|
|
16
|
+
export function isSafeNegotiationQuestionText(value, options) {
|
|
17
|
+
const trimmed = value.trim();
|
|
18
|
+
if (trimmed.length === 0 || trimmed.length > 600)
|
|
19
|
+
return false;
|
|
20
|
+
if (INTERNAL_ID_PATTERN.test(trimmed) || PRIVATE_SOURCE_PATTERN.test(trimmed))
|
|
21
|
+
return false;
|
|
22
|
+
if (hasUnsupportedOpportunityClaim(trimmed))
|
|
23
|
+
return false;
|
|
24
|
+
const normalized = normalize(trimmed);
|
|
25
|
+
for (const identifier of options?.forbiddenIdentifiers ?? []) {
|
|
26
|
+
const forbidden = normalize(identifier);
|
|
27
|
+
if (forbidden.length >= 3 && new RegExp(`(?:^| )${forbidden.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?: |$)`).test(normalized)) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
for (const source of options?.forbiddenSourceText ?? []) {
|
|
32
|
+
const forbidden = normalize(source);
|
|
33
|
+
if (forbidden.length >= 24 && (normalized.includes(forbidden) || forbidden.includes(normalized))) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
/** Validate the only structured fields allowed to enter the inflight Questioner prompt. */
|
|
40
|
+
export function validateInflightAskUserFields(input) {
|
|
41
|
+
const disclosureSubject = input.disclosureSubject?.trim();
|
|
42
|
+
if (!disclosureSubject || !isSafeNegotiationQuestionText(disclosureSubject, input))
|
|
43
|
+
return null;
|
|
44
|
+
const draftQuestion = input.draftQuestion?.trim();
|
|
45
|
+
if (draftQuestion && !isSafeNegotiationQuestionText(draftQuestion, input))
|
|
46
|
+
return null;
|
|
47
|
+
return {
|
|
48
|
+
disclosureSubject,
|
|
49
|
+
...(draftQuestion ? { draftQuestion } : {}),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** Stable, non-secret settlement/outbox key derived only from the exact paused task. */
|
|
53
|
+
export function negotiationQuestionSettlementId(taskId) {
|
|
54
|
+
return `negotiation-question-settlement-v1-${taskId}`;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=negotiation.question-safety.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negotiation.question-safety.js","sourceRoot":"/","sources":["negotiation/negotiation.question-safety.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AAE5F,oGAAoG;AACpG,MAAM,CAAC,MAAM,yCAAyC,GAAG,uBAAuB,CAAC;AACjF,MAAM,CAAC,MAAM,oCAAoC,GAAG,sBAAsB,CAAC;AAC3E,MAAM,CAAC,MAAM,4CAA4C,GAAG,4EAA4E,CAAC;AAEzI,MAAM,mBAAmB,GAAG,wIAAwI,CAAC;AACrK,MAAM,sBAAsB,GAAG,2KAA2K,CAAC;AAE3M,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC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AAU,6BAA6B,CAAC,KAK7C;IACC,MAAM,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC;IAC1D,IAAI,CAAC,iBAAiB,IAAI,CAAC,6BAA6B,CAAC,iBAAiB,EAAE,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAChG,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC;IAClD,IAAI,aAAa,IAAI,CAAC,6BAA6B,CAAC,aAAa,EAAE,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACvF,OAAO;QACL,iBAAiB;QACjB,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5C,CAAC;AACJ,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,+BAA+B,CAAC,MAAc;IAC5D,OAAO,sCAAsC,MAAM,EAAE,CAAC;AACxD,CAAC","sourcesContent":["import { hasUnsupportedOpportunityClaim } from '../opportunity/opportunity.claim-safety.js';\n\n/** Fixed prompt-safe labels; producers must not replace them with raw network/counterparty text. */\nexport const NEGOTIATION_QUESTION_GENERIC_COUNTERPARTY = 'the other participant';\nexport const NEGOTIATION_QUESTION_GENERIC_NETWORK = 'the selected network';\nexport const NEGOTIATION_QUESTION_GENERIC_UPTAKE_ACTIVITY = 'a potential collaboration that may require clarification before you decide';\n\nconst INTERNAL_ID_PATTERN = /\\b(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|(?:task|intent|network|opportunity|user|match)[_-]?id)\\b/i;\nconst PRIVATE_SOURCE_PATTERN = /\\b(?:private transcript|raw transcript|assessment(?:\\.reasoning)?|seed assessment|evaluator reasoning|match reason|matchReason|internal metadata|counterparty profile)\\b/i;\n\nfunction normalize(value: string): string {\n return value.toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();\n}\n\n/**\n * Deterministically reject question context copied from private negotiation inputs.\n * This guard never rewrites content: unsafe or ambiguous text yields no card while\n * the already-armed timeout retains the conservative continuation path.\n */\nexport function isSafeNegotiationQuestionText(\n value: string,\n options?: {\n forbiddenIdentifiers?: string[];\n forbiddenSourceText?: string[];\n },\n): boolean {\n const trimmed = value.trim();\n if (trimmed.length === 0 || trimmed.length > 600) return false;\n if (INTERNAL_ID_PATTERN.test(trimmed) || PRIVATE_SOURCE_PATTERN.test(trimmed)) return false;\n if (hasUnsupportedOpportunityClaim(trimmed)) return false;\n\n const normalized = normalize(trimmed);\n for (const identifier of options?.forbiddenIdentifiers ?? []) {\n const forbidden = normalize(identifier);\n if (forbidden.length >= 3 && new RegExp(`(?:^| )${forbidden.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}(?: |$)`).test(normalized)) {\n return false;\n }\n }\n for (const source of options?.forbiddenSourceText ?? []) {\n const forbidden = normalize(source);\n if (forbidden.length >= 24 && (normalized.includes(forbidden) || forbidden.includes(normalized))) {\n return false;\n }\n }\n return true;\n}\n\n/** Validate the only structured fields allowed to enter the inflight Questioner prompt. */\nexport function validateInflightAskUserFields(input: {\n disclosureSubject?: string | null;\n draftQuestion?: string | null;\n forbiddenIdentifiers?: string[];\n forbiddenSourceText?: string[];\n}): { disclosureSubject: string; draftQuestion?: string } | null {\n const disclosureSubject = input.disclosureSubject?.trim();\n if (!disclosureSubject || !isSafeNegotiationQuestionText(disclosureSubject, input)) return null;\n const draftQuestion = input.draftQuestion?.trim();\n if (draftQuestion && !isSafeNegotiationQuestionText(draftQuestion, input)) return null;\n return {\n disclosureSubject,\n ...(draftQuestion ? { draftQuestion } : {}),\n };\n}\n\n/** Stable, non-secret settlement/outbox key derived only from the exact paused task. */\nexport function negotiationQuestionSettlementId(taskId: string): string {\n return `negotiation-question-settlement-v1-${taskId}`;\n}\n"]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import type { NegotiationUserAnswer, OpportunityStatus } from "../shared/interfaces/database.interface.js";
|
|
2
|
+
import type { NegotiationContinuationExecution, NegotiationContinuationReceipt, NegotiationPrivateConsultation, NegotiationUserAnswer, OpportunityStatus } from "../shared/interfaces/database.interface.js";
|
|
3
3
|
import type { ScreenDecisionRecord } from "./negotiation.screen.js";
|
|
4
4
|
import type { DeadlockShiftRecord } from "./negotiation.deadlock.js";
|
|
5
5
|
import type { NegotiatorMemoryEntry } from "./negotiation.memory.js";
|
|
6
6
|
import { type NegotiationProtocolVersion } from "../shared/schemas/negotiation-state.schema.js";
|
|
7
|
+
import type { NegotiationConsultationReason } from "./negotiation.consultation-policy.js";
|
|
7
8
|
/**
|
|
8
9
|
* Zod schema for a single negotiation turn (DataPart payload in A2A message).
|
|
9
10
|
* Accepts the full v1+v2 action union — which subset is valid for a given turn
|
|
@@ -245,6 +246,9 @@ export interface NegotiationGraphLike {
|
|
|
245
246
|
invoke(input: {
|
|
246
247
|
sourceUser: UserNegotiationContext;
|
|
247
248
|
candidateUser: UserNegotiationContext;
|
|
249
|
+
/** Exact opportunity-actor intent bindings; never inferred from intent array order. */
|
|
250
|
+
sourceIntentId?: string;
|
|
251
|
+
candidateIntentId?: string;
|
|
248
252
|
indexContext: {
|
|
249
253
|
networkId: string;
|
|
250
254
|
prompt: string;
|
|
@@ -264,12 +268,20 @@ export interface NegotiationGraphLike {
|
|
|
264
268
|
* opportunity → conversation-scoped tie-break → fall back to sourceUser.id.
|
|
265
269
|
*/
|
|
266
270
|
initiatorUserId?: string;
|
|
271
|
+
/** Exact settled task for a durable ask_user continuation. */
|
|
272
|
+
resumeFromTaskId?: string;
|
|
273
|
+
/** Deterministic durable settlement/outbox identifier. */
|
|
274
|
+
continuationSettlementId?: string;
|
|
275
|
+
/** Current durable lease/fence for the exact successor execution. */
|
|
276
|
+
continuationExecution?: NegotiationContinuationExecution;
|
|
267
277
|
}): Promise<{
|
|
268
278
|
outcome: NegotiationOutcome | null;
|
|
269
279
|
messages?: NegotiationMessage[];
|
|
270
280
|
conversationId?: string;
|
|
271
281
|
isContinuation?: boolean;
|
|
272
282
|
priorTurnCount?: number;
|
|
283
|
+
error?: string | null;
|
|
284
|
+
continuationReceipt?: NegotiationContinuationReceipt;
|
|
273
285
|
}>;
|
|
274
286
|
}
|
|
275
287
|
/** A2A message record shape (matches messages table). */
|
|
@@ -284,6 +296,8 @@ export interface NegotiationMessage {
|
|
|
284
296
|
export declare const NegotiationGraphState: import("@langchain/langgraph").AnnotationRoot<{
|
|
285
297
|
sourceUser: import("@langchain/langgraph").BaseChannel<UserNegotiationContext, UserNegotiationContext | import("@langchain/langgraph").OverwriteValue<UserNegotiationContext>, unknown>;
|
|
286
298
|
candidateUser: import("@langchain/langgraph").BaseChannel<UserNegotiationContext, UserNegotiationContext | import("@langchain/langgraph").OverwriteValue<UserNegotiationContext>, unknown>;
|
|
299
|
+
sourceIntentId: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
|
|
300
|
+
candidateIntentId: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
|
|
287
301
|
indexContext: import("@langchain/langgraph").BaseChannel<{
|
|
288
302
|
networkId: string;
|
|
289
303
|
prompt: string;
|
|
@@ -338,6 +352,15 @@ export declare const NegotiationGraphState: import("@langchain/langgraph").Annot
|
|
|
338
352
|
/** Exact persisted lifecycle state claimed by this negotiation attempt. */
|
|
339
353
|
opportunityStatus: import("@langchain/langgraph").BaseChannel<OpportunityStatus | undefined, OpportunityStatus | import("@langchain/langgraph").OverwriteValue<OpportunityStatus | undefined> | undefined, unknown>;
|
|
340
354
|
opportunityUpdatedAt: import("@langchain/langgraph").BaseChannel<Date | undefined, Date | import("@langchain/langgraph").OverwriteValue<Date | undefined> | undefined, unknown>;
|
|
355
|
+
/** Exact prior task selected by a durable continuation; bypasses latest-task lookup. */
|
|
356
|
+
resumeFromTaskId: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
|
|
357
|
+
/** Deterministic settlement key used to idempotently reuse a successor task. */
|
|
358
|
+
continuationSettlementId: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
|
|
359
|
+
continuationExecution: import("@langchain/langgraph").BaseChannel<NegotiationContinuationExecution | undefined, NegotiationContinuationExecution | import("@langchain/langgraph").OverwriteValue<NegotiationContinuationExecution | undefined> | undefined, unknown>;
|
|
360
|
+
continuationReceipt: import("@langchain/langgraph").BaseChannel<NegotiationContinuationReceipt | undefined, NegotiationContinuationReceipt | import("@langchain/langgraph").OverwriteValue<NegotiationContinuationReceipt | undefined> | undefined, unknown>;
|
|
361
|
+
privateConsultation: import("@langchain/langgraph").BaseChannel<NegotiationPrivateConsultation | undefined, NegotiationPrivateConsultation | import("@langchain/langgraph").OverwriteValue<NegotiationPrivateConsultation | undefined> | undefined, unknown>;
|
|
362
|
+
/** Server-only IND-508 category recovered from the exact prior task binding. */
|
|
363
|
+
consultationPolicyReason: import("@langchain/langgraph").BaseChannel<NegotiationConsultationReason | undefined, NegotiationConsultationReason | import("@langchain/langgraph").OverwriteValue<NegotiationConsultationReason | undefined> | undefined, unknown>;
|
|
341
364
|
conversationId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
|
|
342
365
|
taskId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
|
|
343
366
|
messages: import("@langchain/langgraph").BaseChannel<NegotiationMessage[], NegotiationMessage[] | import("@langchain/langgraph").OverwriteValue<NegotiationMessage[]>, unknown>;
|
|
@@ -403,7 +426,7 @@ export declare const NegotiationGraphState: import("@langchain/langgraph").Annot
|
|
|
403
426
|
* negotiator's own client (answer or 24 h window expiry resumes it)
|
|
404
427
|
* - `completed` — negotiation finalized (accept/reject/turn-cap/timeout)
|
|
405
428
|
*/
|
|
406
|
-
status: import("@langchain/langgraph").BaseChannel<"
|
|
429
|
+
status: import("@langchain/langgraph").BaseChannel<"waiting_for_agent" | "input_required" | "completed" | "active", "waiting_for_agent" | "input_required" | "completed" | "active" | import("@langchain/langgraph").OverwriteValue<"waiting_for_agent" | "input_required" | "completed" | "active">, unknown>;
|
|
407
430
|
/** Number of turns present in the conversation before this session started. */
|
|
408
431
|
priorTurnCount: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
|
|
409
432
|
/** User answers collected by the questioner between negotiation sessions. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"negotiation.state.d.ts","sourceRoot":"/","sources":["negotiation/negotiation.state.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"negotiation.state.d.ts","sourceRoot":"/","sources":["negotiation/negotiation.state.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,gCAAgC,EAAE,8BAA8B,EAAE,8BAA8B,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC7M,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAA6C,KAAK,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAC3I,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AAE1F;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;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;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,4DAA4D;AAC5D,eAAO,MAAM,qBAAqB;;;;;;mBAiBM,MAAM;gBAAU,MAAM;;mBAAtB,MAAM;gBAAU,MAAM;;mBAAtB,MAAM;gBAAU,MAAM;;;IAS5D;;;;OAIG;;IAMH,mEAAmE;;IAKnE;;;;;OAKG;;IAMH;;;;OAIG;;IAMH;;;;;;OAMG;;IAMH;;;;;;OAMG;;IAMH,8EAA8E;;;IAS9E,2EAA2E;;;IAS3E,wFAAwF;;IAKxF,gFAAgF;;;;;IAoBhF,gFAAgF;;;;;;;IAyBhF;;;;;;OAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAeH;;;;;;;OAOG;;IAMH,+EAA+E;;IAM/E,6EAA6E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc7E,CAAC"}
|
|
@@ -64,6 +64,14 @@ export const NegotiationGraphState = Annotation.Root({
|
|
|
64
64
|
reducer: (curr, next) => next ?? curr,
|
|
65
65
|
default: () => ({ id: "", intents: [], profile: {} }),
|
|
66
66
|
}),
|
|
67
|
+
sourceIntentId: Annotation({
|
|
68
|
+
reducer: (curr, next) => next ?? curr,
|
|
69
|
+
default: () => undefined,
|
|
70
|
+
}),
|
|
71
|
+
candidateIntentId: Annotation({
|
|
72
|
+
reducer: (curr, next) => next ?? curr,
|
|
73
|
+
default: () => undefined,
|
|
74
|
+
}),
|
|
67
75
|
indexContext: Annotation({
|
|
68
76
|
reducer: (curr, next) => next ?? curr,
|
|
69
77
|
default: () => ({ networkId: "", prompt: "" }),
|
|
@@ -145,6 +153,33 @@ export const NegotiationGraphState = Annotation.Root({
|
|
|
145
153
|
reducer: (curr, next) => next ?? curr,
|
|
146
154
|
default: () => undefined,
|
|
147
155
|
}),
|
|
156
|
+
/** Exact prior task selected by a durable continuation; bypasses latest-task lookup. */
|
|
157
|
+
resumeFromTaskId: Annotation({
|
|
158
|
+
reducer: (curr, next) => next ?? curr,
|
|
159
|
+
default: () => undefined,
|
|
160
|
+
}),
|
|
161
|
+
/** Deterministic settlement key used to idempotently reuse a successor task. */
|
|
162
|
+
continuationSettlementId: Annotation({
|
|
163
|
+
reducer: (curr, next) => next ?? curr,
|
|
164
|
+
default: () => undefined,
|
|
165
|
+
}),
|
|
166
|
+
continuationExecution: Annotation({
|
|
167
|
+
reducer: (curr, next) => next ?? curr,
|
|
168
|
+
default: () => undefined,
|
|
169
|
+
}),
|
|
170
|
+
continuationReceipt: Annotation({
|
|
171
|
+
reducer: (curr, next) => next ?? curr,
|
|
172
|
+
default: () => undefined,
|
|
173
|
+
}),
|
|
174
|
+
privateConsultation: Annotation({
|
|
175
|
+
reducer: (curr, next) => next ?? curr,
|
|
176
|
+
default: () => undefined,
|
|
177
|
+
}),
|
|
178
|
+
/** Server-only IND-508 category recovered from the exact prior task binding. */
|
|
179
|
+
consultationPolicyReason: Annotation({
|
|
180
|
+
reducer: (curr, next) => next ?? curr,
|
|
181
|
+
default: () => undefined,
|
|
182
|
+
}),
|
|
148
183
|
conversationId: Annotation({
|
|
149
184
|
reducer: (curr, next) => next ?? curr,
|
|
150
185
|
default: () => "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"negotiation.state.js","sourceRoot":"/","sources":["negotiation/negotiation.state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAmC,MAAM,+CAA+C,CAAC;AAE3I;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,MAAM,EAAE,CAA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C;CACH,CAAC,CAAC","sourcesContent":["import { Annotation } from \"@langchain/langgraph\";\nimport { z } from \"zod\";\nimport type { NegotiationUserAnswer, OpportunityStatus } from \"../shared/interfaces/database.interface.js\";\nimport type { ScreenDecisionRecord } from \"./negotiation.screen.js\";\nimport type { DeadlockShiftRecord } from \"./negotiation.deadlock.js\";\nimport type { NegotiatorMemoryEntry } from \"./negotiation.memory.js\";\nimport { AskUserPayloadSchema, NEGOTIATION_ACTIONS, type NegotiationProtocolVersion } from \"../shared/schemas/negotiation-state.schema.js\";\n\n/**\n * Zod schema for a single negotiation turn (DataPart payload in A2A message).\n * Accepts the full v1+v2 action union — which subset is valid for a given turn\n * is enforced by the seat-scoped schemas in `negotiation.protocol.ts`.\n */\nexport const NegotiationTurnSchema = z.object({\n action: z.enum(NEGOTIATION_ACTIONS),\n assessment: z.object({\n reasoning: z.string(),\n suggestedRoles: z.object({\n ownUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n otherUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n }),\n }),\n message: z.string().nullable().optional(),\n /** Present when action is `ask_user` (v2, P3.2). */\n askUser: AskUserPayloadSchema.nullable().optional(),\n});\n\n/** Restricted v1 turn schema for the system agent (no question action). */\nexport const SystemNegotiationTurnSchema = z.object({\n action: z.enum([\"propose\", \"accept\", \"reject\", \"counter\"]),\n assessment: z.object({\n reasoning: z.string(),\n suggestedRoles: z.object({\n ownUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n otherUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n }),\n }),\n message: z.string().nullable().optional(),\n});\n\n/** v1 turn schema for system agent's final allowed turn (must decide). */\nexport const FinalNegotiationTurnSchema = z.object({\n action: z.enum([\"accept\", \"reject\"]),\n assessment: z.object({\n reasoning: z.string(),\n suggestedRoles: z.object({\n ownUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n otherUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n }),\n }),\n message: z.string().nullable().optional(),\n});\n\nexport type NegotiationTurn = z.infer<typeof NegotiationTurnSchema>;\n\n/** Zod schema for the negotiation outcome (Artifact payload on COMPLETED task). */\nexport const NegotiationOutcomeSchema = z.object({\n hasOpportunity: z.boolean(),\n agreedRoles: z.array(z.object({\n userId: z.string(),\n role: z.enum([\"agent\", \"patient\", \"peer\"]),\n })),\n reasoning: z.string(),\n turnCount: z.number(),\n reason: z.enum([\"turn_cap\", \"timeout\", \"screened_out\"]).optional(),\n});\n\nexport type NegotiationOutcome = z.infer<typeof NegotiationOutcomeSchema>;\n\n/** Context each agent receives about its user. */\nexport interface UserNegotiationContext {\n id: string;\n intents: Array<{ id: string; title: string; description: string; confidence: number }>;\n profile: { name?: string; bio?: string; location?: string; interests?: string[]; skills?: string[] };\n}\n\n/** Seed assessment from the evaluator pre-filter. */\nexport interface SeedAssessment {\n reasoning: string;\n valencyRole: string;\n actors?: Array<{ userId: string; role: string }>;\n}\n\n/** Typed interface for a negotiation graph's invoke signature. */\nexport interface NegotiationGraphLike {\n invoke(input: {\n sourceUser: UserNegotiationContext;\n candidateUser: UserNegotiationContext;\n indexContext: { networkId: string; prompt: string };\n seedAssessment: Omit<SeedAssessment, \"actors\">;\n discoveryQuery?: string;\n opportunityId?: string;\n /** Exact persisted lifecycle state claimed by this negotiation attempt. */\n opportunityStatus?: OpportunityStatus;\n opportunityUpdatedAt?: Date;\n maxTurns?: number;\n timeoutMs?: number;\n /**\n * The user who holds the initiating seat for this match (v2 client-advocate\n * protocol). Stamped into task metadata by the init node. When omitted, the\n * init node resolves it: inherit from the prior task for the same\n * opportunity → conversation-scoped tie-break → fall back to sourceUser.id.\n */\n initiatorUserId?: string;\n }): Promise<{\n outcome: NegotiationOutcome | null;\n messages?: NegotiationMessage[];\n conversationId?: string;\n isContinuation?: boolean;\n priorTurnCount?: number;\n }>;\n}\n\n/** A2A message record shape (matches messages table). */\nexport interface NegotiationMessage {\n id: string;\n senderId: string;\n role: \"agent\";\n parts: unknown[];\n createdAt: Date;\n}\n\n/** LangGraph state annotation for the negotiation graph. */\nexport const NegotiationGraphState = Annotation.Root({\n sourceUser: Annotation<UserNegotiationContext>({\n reducer: (curr, next) => next ?? curr,\n default: () => ({ id: \"\", intents: [], profile: {} }),\n }),\n candidateUser: Annotation<UserNegotiationContext>({\n reducer: (curr, next) => next ?? curr,\n default: () => ({ id: \"\", intents: [], profile: {} }),\n }),\n indexContext: Annotation<{ networkId: string; prompt: string }>({\n reducer: (curr, next) => next ?? curr,\n default: () => ({ networkId: \"\", prompt: \"\" }),\n }),\n seedAssessment: Annotation<SeedAssessment>({\n reducer: (curr, next) => next ?? curr,\n default: () => ({ reasoning: \"\", valencyRole: \"\" }),\n }),\n\n /**\n * Explicit initiator seat for this match (purely additive metadata — no seat\n * rules attach to it yet). Resolution when unset happens in the init node;\n * the resolved value is written back to state and into task metadata.\n */\n initiatorUserId: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n\n /** The explicit search query that triggered discovery (if any). */\n discoveryQuery: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n /**\n * Negotiation protocol version for this session's task. Resolved by the\n * init node: inherited from the prior task on the conversation when one\n * exists (never re-stamped — a v1 conversation stays v1 mid-flight), else\n * stamped from `NEGOTIATION_PROTOCOL_VERSION` for genuinely fresh runs.\n */\n protocolVersion: Annotation<NegotiationProtocolVersion>({\n reducer: (curr, next) => next ?? curr,\n default: () => \"v1\" as const,\n }),\n\n /**\n * Screen-gate decision for this fresh run (P2.1 shadow mode). Written by the\n * screen node; null when the gate is off, on continuations, or before the\n * node runs. Mirrors `tasks.metadata.screenDecision`.\n */\n screenDecision: Annotation<ScreenDecisionRecord | null>({\n reducer: (curr, next) => next ?? curr,\n default: () => null,\n }),\n\n /**\n * First applied deadlock→bargaining shift in this session (IND-428).\n * Written by the turn node when the system agent first drafts in the\n * bargaining stance; used to record the shift exactly once per session.\n * Internal analytics only — mirrored to `tasks.metadata.deadlockShift`,\n * never into any turn payload or public projection.\n */\n deadlockShift: Annotation<DeadlockShiftRecord | null>({\n reducer: (curr, next) => next ?? curr,\n default: () => null,\n }),\n\n /**\n * Per-side negotiator-memory cache (P5.3 read path). Populated lazily the\n * first time each side's memory is retrieved (screen node for the client,\n * turn node for the speaker) so a multi-turn session pays for retrieval at\n * most once per side. `undefined` per side = not yet retrieved; `[]` =\n * retrieved and empty (flag off / no rows / retrieval failed).\n */\n memoryBySide: Annotation<Partial<Record<\"source\" | \"candidate\", NegotiatorMemoryEntry[]>>>({\n reducer: (curr, next) => ({ ...curr, ...next }),\n default: () => ({}),\n }),\n\n /** Whether this run is continuing a prior conversation with the same pair. */\n isContinuation: Annotation<boolean>({\n reducer: (curr, next) => next ?? curr,\n default: () => false,\n }),\n opportunityId: Annotation<string>({\n reducer: (curr, next) => next ?? curr,\n default: () => \"\",\n }),\n /** Exact persisted lifecycle state claimed by this negotiation attempt. */\n opportunityStatus: Annotation<OpportunityStatus | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n opportunityUpdatedAt: Annotation<Date | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n conversationId: Annotation<string>({\n reducer: (curr, next) => next ?? curr,\n default: () => \"\",\n }),\n taskId: Annotation<string>({\n reducer: (curr, next) => next ?? curr,\n default: () => \"\",\n }),\n messages: Annotation<NegotiationMessage[]>({\n reducer: (curr, next) => [...curr, ...(next || [])],\n default: () => [],\n }),\n turnCount: Annotation<number>({\n reducer: (curr, next) => next ?? curr,\n default: () => 0,\n }),\n maxTurns: Annotation<number | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n /**\n * Park-window budget in milliseconds. Ambient callers pass `AMBIENT_PARK_WINDOW_MS`\n * (5 minutes); orchestrator callers pass a shorter window. This annotation default\n * is a safety net for any caller that omits the field — keep it aligned with\n * `AMBIENT_PARK_WINDOW_MS` in packages/protocol/src/negotiation/negotiation.tools.ts.\n * Inlined rather than imported to avoid a state↔tools cycle.\n */\n timeoutMs: Annotation<number>({\n reducer: (curr, next) => next ?? curr,\n default: () => 5 * 60 * 1000,\n }),\n\n currentSpeaker: Annotation<\"source\" | \"candidate\">({\n reducer: (curr, next) => next ?? curr,\n default: () => \"source\" as const,\n }),\n lastTurn: Annotation<NegotiationTurn | null>({\n reducer: (curr, next) => next ?? curr,\n default: () => null,\n }),\n\n /**\n * Graph status.\n * - `active` — agents are exchanging turns (default)\n * - `waiting_for_agent` — graph suspended; awaiting external agent response or timeout\n * - `input_required` — graph suspended on an `ask_user` pause; awaiting the\n * negotiator's own client (answer or 24 h window expiry resumes it)\n * - `completed` — negotiation finalized (accept/reject/turn-cap/timeout)\n */\n status: Annotation<'active' | 'waiting_for_agent' | 'input_required' | 'completed'>({\n reducer: (curr, next) => next ?? curr,\n default: () => 'active' as const,\n }),\n\n /** Number of turns present in the conversation before this session started. */\n priorTurnCount: Annotation<number>({\n reducer: (curr, next) => next ?? curr,\n default: () => 0,\n }),\n\n /** User answers collected by the questioner between negotiation sessions. */\n userAnswers: Annotation<NegotiationUserAnswer[]>({\n reducer: (curr, next) => next ?? curr,\n default: () => [],\n }),\n\n outcome: Annotation<NegotiationOutcome | null>({\n reducer: (curr, next) => next ?? curr,\n default: () => null,\n }),\n error: Annotation<string | null>({\n reducer: (curr, next) => next ?? curr,\n default: () => null,\n }),\n});\n"]}
|
|
1
|
+
{"version":3,"file":"negotiation.state.js","sourceRoot":"/","sources":["negotiation/negotiation.state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAmC,MAAM,+CAA+C,CAAC;AAG3I;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC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,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,IAAI;QACrC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI;KACpB,CAAC;CACH,CAAC,CAAC","sourcesContent":["import { Annotation } from \"@langchain/langgraph\";\nimport { z } from \"zod\";\nimport type { NegotiationContinuationExecution, NegotiationContinuationReceipt, NegotiationPrivateConsultation, NegotiationUserAnswer, OpportunityStatus } from \"../shared/interfaces/database.interface.js\";\nimport type { ScreenDecisionRecord } from \"./negotiation.screen.js\";\nimport type { DeadlockShiftRecord } from \"./negotiation.deadlock.js\";\nimport type { NegotiatorMemoryEntry } from \"./negotiation.memory.js\";\nimport { AskUserPayloadSchema, NEGOTIATION_ACTIONS, type NegotiationProtocolVersion } from \"../shared/schemas/negotiation-state.schema.js\";\nimport type { NegotiationConsultationReason } from \"./negotiation.consultation-policy.js\";\n\n/**\n * Zod schema for a single negotiation turn (DataPart payload in A2A message).\n * Accepts the full v1+v2 action union — which subset is valid for a given turn\n * is enforced by the seat-scoped schemas in `negotiation.protocol.ts`.\n */\nexport const NegotiationTurnSchema = z.object({\n action: z.enum(NEGOTIATION_ACTIONS),\n assessment: z.object({\n reasoning: z.string(),\n suggestedRoles: z.object({\n ownUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n otherUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n }),\n }),\n message: z.string().nullable().optional(),\n /** Present when action is `ask_user` (v2, P3.2). */\n askUser: AskUserPayloadSchema.nullable().optional(),\n});\n\n/** Restricted v1 turn schema for the system agent (no question action). */\nexport const SystemNegotiationTurnSchema = z.object({\n action: z.enum([\"propose\", \"accept\", \"reject\", \"counter\"]),\n assessment: z.object({\n reasoning: z.string(),\n suggestedRoles: z.object({\n ownUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n otherUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n }),\n }),\n message: z.string().nullable().optional(),\n});\n\n/** v1 turn schema for system agent's final allowed turn (must decide). */\nexport const FinalNegotiationTurnSchema = z.object({\n action: z.enum([\"accept\", \"reject\"]),\n assessment: z.object({\n reasoning: z.string(),\n suggestedRoles: z.object({\n ownUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n otherUser: z.enum([\"agent\", \"patient\", \"peer\"]),\n }),\n }),\n message: z.string().nullable().optional(),\n});\n\nexport type NegotiationTurn = z.infer<typeof NegotiationTurnSchema>;\n\n/** Zod schema for the negotiation outcome (Artifact payload on COMPLETED task). */\nexport const NegotiationOutcomeSchema = z.object({\n hasOpportunity: z.boolean(),\n agreedRoles: z.array(z.object({\n userId: z.string(),\n role: z.enum([\"agent\", \"patient\", \"peer\"]),\n })),\n reasoning: z.string(),\n turnCount: z.number(),\n reason: z.enum([\"turn_cap\", \"timeout\", \"screened_out\"]).optional(),\n});\n\nexport type NegotiationOutcome = z.infer<typeof NegotiationOutcomeSchema>;\n\n/** Context each agent receives about its user. */\nexport interface UserNegotiationContext {\n id: string;\n intents: Array<{ id: string; title: string; description: string; confidence: number }>;\n profile: { name?: string; bio?: string; location?: string; interests?: string[]; skills?: string[] };\n}\n\n/** Seed assessment from the evaluator pre-filter. */\nexport interface SeedAssessment {\n reasoning: string;\n valencyRole: string;\n actors?: Array<{ userId: string; role: string }>;\n}\n\n/** Typed interface for a negotiation graph's invoke signature. */\nexport interface NegotiationGraphLike {\n invoke(input: {\n sourceUser: UserNegotiationContext;\n candidateUser: UserNegotiationContext;\n /** Exact opportunity-actor intent bindings; never inferred from intent array order. */\n sourceIntentId?: string;\n candidateIntentId?: string;\n indexContext: { networkId: string; prompt: string };\n seedAssessment: Omit<SeedAssessment, \"actors\">;\n discoveryQuery?: string;\n opportunityId?: string;\n /** Exact persisted lifecycle state claimed by this negotiation attempt. */\n opportunityStatus?: OpportunityStatus;\n opportunityUpdatedAt?: Date;\n maxTurns?: number;\n timeoutMs?: number;\n /**\n * The user who holds the initiating seat for this match (v2 client-advocate\n * protocol). Stamped into task metadata by the init node. When omitted, the\n * init node resolves it: inherit from the prior task for the same\n * opportunity → conversation-scoped tie-break → fall back to sourceUser.id.\n */\n initiatorUserId?: string;\n /** Exact settled task for a durable ask_user continuation. */\n resumeFromTaskId?: string;\n /** Deterministic durable settlement/outbox identifier. */\n continuationSettlementId?: string;\n /** Current durable lease/fence for the exact successor execution. */\n continuationExecution?: NegotiationContinuationExecution;\n }): Promise<{\n outcome: NegotiationOutcome | null;\n messages?: NegotiationMessage[];\n conversationId?: string;\n isContinuation?: boolean;\n priorTurnCount?: number;\n error?: string | null;\n continuationReceipt?: NegotiationContinuationReceipt;\n }>;\n}\n\n/** A2A message record shape (matches messages table). */\nexport interface NegotiationMessage {\n id: string;\n senderId: string;\n role: \"agent\";\n parts: unknown[];\n createdAt: Date;\n}\n\n/** LangGraph state annotation for the negotiation graph. */\nexport const NegotiationGraphState = Annotation.Root({\n sourceUser: Annotation<UserNegotiationContext>({\n reducer: (curr, next) => next ?? curr,\n default: () => ({ id: \"\", intents: [], profile: {} }),\n }),\n candidateUser: Annotation<UserNegotiationContext>({\n reducer: (curr, next) => next ?? curr,\n default: () => ({ id: \"\", intents: [], profile: {} }),\n }),\n sourceIntentId: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n candidateIntentId: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n indexContext: Annotation<{ networkId: string; prompt: string }>({\n reducer: (curr, next) => next ?? curr,\n default: () => ({ networkId: \"\", prompt: \"\" }),\n }),\n seedAssessment: Annotation<SeedAssessment>({\n reducer: (curr, next) => next ?? curr,\n default: () => ({ reasoning: \"\", valencyRole: \"\" }),\n }),\n\n /**\n * Explicit initiator seat for this match (purely additive metadata — no seat\n * rules attach to it yet). Resolution when unset happens in the init node;\n * the resolved value is written back to state and into task metadata.\n */\n initiatorUserId: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n\n /** The explicit search query that triggered discovery (if any). */\n discoveryQuery: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n /**\n * Negotiation protocol version for this session's task. Resolved by the\n * init node: inherited from the prior task on the conversation when one\n * exists (never re-stamped — a v1 conversation stays v1 mid-flight), else\n * stamped from `NEGOTIATION_PROTOCOL_VERSION` for genuinely fresh runs.\n */\n protocolVersion: Annotation<NegotiationProtocolVersion>({\n reducer: (curr, next) => next ?? curr,\n default: () => \"v1\" as const,\n }),\n\n /**\n * Screen-gate decision for this fresh run (P2.1 shadow mode). Written by the\n * screen node; null when the gate is off, on continuations, or before the\n * node runs. Mirrors `tasks.metadata.screenDecision`.\n */\n screenDecision: Annotation<ScreenDecisionRecord | null>({\n reducer: (curr, next) => next ?? curr,\n default: () => null,\n }),\n\n /**\n * First applied deadlock→bargaining shift in this session (IND-428).\n * Written by the turn node when the system agent first drafts in the\n * bargaining stance; used to record the shift exactly once per session.\n * Internal analytics only — mirrored to `tasks.metadata.deadlockShift`,\n * never into any turn payload or public projection.\n */\n deadlockShift: Annotation<DeadlockShiftRecord | null>({\n reducer: (curr, next) => next ?? curr,\n default: () => null,\n }),\n\n /**\n * Per-side negotiator-memory cache (P5.3 read path). Populated lazily the\n * first time each side's memory is retrieved (screen node for the client,\n * turn node for the speaker) so a multi-turn session pays for retrieval at\n * most once per side. `undefined` per side = not yet retrieved; `[]` =\n * retrieved and empty (flag off / no rows / retrieval failed).\n */\n memoryBySide: Annotation<Partial<Record<\"source\" | \"candidate\", NegotiatorMemoryEntry[]>>>({\n reducer: (curr, next) => ({ ...curr, ...next }),\n default: () => ({}),\n }),\n\n /** Whether this run is continuing a prior conversation with the same pair. */\n isContinuation: Annotation<boolean>({\n reducer: (curr, next) => next ?? curr,\n default: () => false,\n }),\n opportunityId: Annotation<string>({\n reducer: (curr, next) => next ?? curr,\n default: () => \"\",\n }),\n /** Exact persisted lifecycle state claimed by this negotiation attempt. */\n opportunityStatus: Annotation<OpportunityStatus | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n opportunityUpdatedAt: Annotation<Date | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n /** Exact prior task selected by a durable continuation; bypasses latest-task lookup. */\n resumeFromTaskId: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n /** Deterministic settlement key used to idempotently reuse a successor task. */\n continuationSettlementId: Annotation<string | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n\n continuationExecution: Annotation<NegotiationContinuationExecution | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n\n continuationReceipt: Annotation<NegotiationContinuationReceipt | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n\n privateConsultation: Annotation<NegotiationPrivateConsultation | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n /** Server-only IND-508 category recovered from the exact prior task binding. */\n consultationPolicyReason: Annotation<NegotiationConsultationReason | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n conversationId: Annotation<string>({\n reducer: (curr, next) => next ?? curr,\n default: () => \"\",\n }),\n taskId: Annotation<string>({\n reducer: (curr, next) => next ?? curr,\n default: () => \"\",\n }),\n messages: Annotation<NegotiationMessage[]>({\n reducer: (curr, next) => [...curr, ...(next || [])],\n default: () => [],\n }),\n turnCount: Annotation<number>({\n reducer: (curr, next) => next ?? curr,\n default: () => 0,\n }),\n maxTurns: Annotation<number | undefined>({\n reducer: (curr, next) => next ?? curr,\n default: () => undefined,\n }),\n /**\n * Park-window budget in milliseconds. Ambient callers pass `AMBIENT_PARK_WINDOW_MS`\n * (5 minutes); orchestrator callers pass a shorter window. This annotation default\n * is a safety net for any caller that omits the field — keep it aligned with\n * `AMBIENT_PARK_WINDOW_MS` in packages/protocol/src/negotiation/negotiation.tools.ts.\n * Inlined rather than imported to avoid a state↔tools cycle.\n */\n timeoutMs: Annotation<number>({\n reducer: (curr, next) => next ?? curr,\n default: () => 5 * 60 * 1000,\n }),\n\n currentSpeaker: Annotation<\"source\" | \"candidate\">({\n reducer: (curr, next) => next ?? curr,\n default: () => \"source\" as const,\n }),\n lastTurn: Annotation<NegotiationTurn | null>({\n reducer: (curr, next) => next ?? curr,\n default: () => null,\n }),\n\n /**\n * Graph status.\n * - `active` — agents are exchanging turns (default)\n * - `waiting_for_agent` — graph suspended; awaiting external agent response or timeout\n * - `input_required` — graph suspended on an `ask_user` pause; awaiting the\n * negotiator's own client (answer or 24 h window expiry resumes it)\n * - `completed` — negotiation finalized (accept/reject/turn-cap/timeout)\n */\n status: Annotation<'active' | 'waiting_for_agent' | 'input_required' | 'completed'>({\n reducer: (curr, next) => next ?? curr,\n default: () => 'active' as const,\n }),\n\n /** Number of turns present in the conversation before this session started. */\n priorTurnCount: Annotation<number>({\n reducer: (curr, next) => next ?? curr,\n default: () => 0,\n }),\n\n /** User answers collected by the questioner between negotiation sessions. */\n userAnswers: Annotation<NegotiationUserAnswer[]>({\n reducer: (curr, next) => next ?? curr,\n default: () => [],\n }),\n\n outcome: Annotation<NegotiationOutcome | null>({\n reducer: (curr, next) => next ?? curr,\n default: () => null,\n }),\n error: Annotation<string | null>({\n reducer: (curr, next) => next ?? curr,\n default: () => null,\n }),\n});\n"]}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* Constructor injects Database, Embedder, and compiled HyDE graph.
|
|
13
13
|
*/
|
|
14
|
-
import type { Id } from '../shared/interfaces/database.interface.js';
|
|
14
|
+
import type { Id, NegotiationContinuationReceipt } from '../shared/interfaces/database.interface.js';
|
|
15
15
|
import type { DebugMetaAgent } from '../chat/chat-streaming.types.js';
|
|
16
16
|
import { type IndexedIntent, type SourceProfileData, type TargetNetwork, type CandidateMatch, type EvaluatedCandidate, type EvaluatedOpportunity, type EvaluatedOpportunityActor } from './opportunity.state.js';
|
|
17
17
|
import { type CandidateProfile, type EvaluatorEntity, type EvaluatorInput } from './opportunity.evaluator.js';
|
|
@@ -190,6 +190,7 @@ export declare class OpportunityGraphFactory {
|
|
|
190
190
|
existingTriggerIntentId?: string;
|
|
191
191
|
}[];
|
|
192
192
|
persistenceOutcome: import("./opportunity.state.js").OpportunityPersistenceOutcome | undefined;
|
|
193
|
+
negotiationContinuationReceipt: NegotiationContinuationReceipt | undefined;
|
|
193
194
|
error: string | undefined;
|
|
194
195
|
readResult: {
|
|
195
196
|
count: number;
|
|
@@ -323,6 +324,7 @@ export declare class OpportunityGraphFactory {
|
|
|
323
324
|
existingTriggerIntentId?: string;
|
|
324
325
|
}[]> | undefined;
|
|
325
326
|
persistenceOutcome?: import("./opportunity.state.js").OpportunityPersistenceOutcome | import("@langchain/langgraph").OverwriteValue<import("./opportunity.state.js").OpportunityPersistenceOutcome | undefined> | undefined;
|
|
327
|
+
negotiationContinuationReceipt?: NegotiationContinuationReceipt | import("@langchain/langgraph").OverwriteValue<NegotiationContinuationReceipt | undefined> | undefined;
|
|
326
328
|
error?: string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined;
|
|
327
329
|
readResult?: {
|
|
328
330
|
count: number;
|
|
@@ -523,6 +525,7 @@ export declare class OpportunityGraphFactory {
|
|
|
523
525
|
existingTriggerIntentId?: string;
|
|
524
526
|
}[]>, unknown>;
|
|
525
527
|
persistenceOutcome: import("@langchain/langgraph").BaseChannel<import("./opportunity.state.js").OpportunityPersistenceOutcome | undefined, import("./opportunity.state.js").OpportunityPersistenceOutcome | import("@langchain/langgraph").OverwriteValue<import("./opportunity.state.js").OpportunityPersistenceOutcome | undefined> | undefined, unknown>;
|
|
528
|
+
negotiationContinuationReceipt: import("@langchain/langgraph").BaseChannel<NegotiationContinuationReceipt | undefined, NegotiationContinuationReceipt | import("@langchain/langgraph").OverwriteValue<NegotiationContinuationReceipt | undefined> | undefined, unknown>;
|
|
526
529
|
error: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
|
|
527
530
|
readResult: import("@langchain/langgraph").BaseChannel<{
|
|
528
531
|
count: number;
|
|
@@ -770,6 +773,7 @@ export declare class OpportunityGraphFactory {
|
|
|
770
773
|
existingTriggerIntentId?: string;
|
|
771
774
|
}[]>, unknown>;
|
|
772
775
|
persistenceOutcome: import("@langchain/langgraph").BaseChannel<import("./opportunity.state.js").OpportunityPersistenceOutcome | undefined, import("./opportunity.state.js").OpportunityPersistenceOutcome | import("@langchain/langgraph").OverwriteValue<import("./opportunity.state.js").OpportunityPersistenceOutcome | undefined> | undefined, unknown>;
|
|
776
|
+
negotiationContinuationReceipt: import("@langchain/langgraph").BaseChannel<NegotiationContinuationReceipt | undefined, NegotiationContinuationReceipt | import("@langchain/langgraph").OverwriteValue<NegotiationContinuationReceipt | undefined> | undefined, unknown>;
|
|
773
777
|
error: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
|
|
774
778
|
readResult: import("@langchain/langgraph").BaseChannel<{
|
|
775
779
|
count: number;
|
|
@@ -1181,6 +1185,7 @@ export declare class OpportunityGraphFactory {
|
|
|
1181
1185
|
};
|
|
1182
1186
|
options: {
|
|
1183
1187
|
initialStatus: OpportunityStatus;
|
|
1188
|
+
negotiationContinuation?: import("../shared/interfaces/database.interface.js").NegotiationContinuationExecution;
|
|
1184
1189
|
minScore?: number;
|
|
1185
1190
|
limit?: number;
|
|
1186
1191
|
lenses?: import("../shared/hyde/lens.inferrer.js").Lens[];
|
|
@@ -1205,6 +1210,7 @@ export declare class OpportunityGraphFactory {
|
|
|
1205
1210
|
};
|
|
1206
1211
|
options: {
|
|
1207
1212
|
initialStatus: OpportunityStatus;
|
|
1213
|
+
negotiationContinuation?: import("../shared/interfaces/database.interface.js").NegotiationContinuationExecution;
|
|
1208
1214
|
minScore?: number;
|
|
1209
1215
|
limit?: number;
|
|
1210
1216
|
lenses?: import("../shared/hyde/lens.inferrer.js").Lens[];
|
|
@@ -1362,9 +1368,14 @@ export declare class OpportunityGraphFactory {
|
|
|
1362
1368
|
};
|
|
1363
1369
|
};
|
|
1364
1370
|
negotiate_existing: {
|
|
1371
|
+
negotiationContinuationReceipt?: undefined;
|
|
1372
|
+
error?: undefined;
|
|
1373
|
+
} | {
|
|
1374
|
+
negotiationContinuationReceipt: NegotiationContinuationReceipt;
|
|
1365
1375
|
error?: undefined;
|
|
1366
1376
|
} | {
|
|
1367
1377
|
error: string;
|
|
1378
|
+
negotiationContinuationReceipt?: undefined;
|
|
1368
1379
|
};
|
|
1369
1380
|
approve_introduction: {
|
|
1370
1381
|
mutationResult: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opportunity.graph.d.ts","sourceRoot":"/","sources":["opportunity/opportunity.graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"opportunity.graph.d.ts","sourceRoot":"/","sources":["opportunity/opportunity.graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,EAAE,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAC;AACrG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAyB,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,KAAK,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,KAAK,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAExO,OAAO,EAAwB,KAAK,gBAAgB,EAAuC,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACzK,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAS3F,yDAAyD;AACzD,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,CAAC,EAAE,CACP,oB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,EAAE,CAAC;;;sBAzF1B,MAAM;yBAAW,MAAM;uBAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAqUvD,MAAM;yBAAW,MAAM;uBAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCA2pCtE,EAAE,CAAC,OAAO,CAAC;2BACjB,EAAE,CAAC,UAAU,CAAC;wCACD,EAAE,CAAC,eAAe,CAAC;iCAC1B,iBAAiB;yBACzB,+BAA+B,GAAG,yBAAyB,GAAG,uBAAuB;0CACpE,MAAM;;;+BAoBiB,MAAM;oCAAsB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAw8C9F"}
|
|
@@ -1920,8 +1920,10 @@ export class OpportunityGraphFactory {
|
|
|
1920
1920
|
filteredBeforeInvocation.push(opp.id);
|
|
1921
1921
|
return null;
|
|
1922
1922
|
}
|
|
1923
|
-
const
|
|
1924
|
-
|
|
1923
|
+
const opportunityActors = opp.actors;
|
|
1924
|
+
const sourceActor = opportunityActors.find(a => a.userId === discoveryUserId && a.role !== 'introducer');
|
|
1925
|
+
const candidateActor = opportunityActors.find(a => a.userId !== discoveryUserId && a.role !== 'introducer');
|
|
1926
|
+
if (!sourceActor || !candidateActor) {
|
|
1925
1927
|
negotiateLog.verbose('Skipping opportunity: no candidateActor found', {
|
|
1926
1928
|
opportunityId: opp.id,
|
|
1927
1929
|
discoveryUserId,
|
|
@@ -1930,7 +1932,7 @@ export class OpportunityGraphFactory {
|
|
|
1930
1932
|
filteredBeforeInvocation.push(opp.id);
|
|
1931
1933
|
return null;
|
|
1932
1934
|
}
|
|
1933
|
-
return { opp, candidateActor };
|
|
1935
|
+
return { opp, sourceActor, candidateActor };
|
|
1934
1936
|
})
|
|
1935
1937
|
.filter((e) => e !== null);
|
|
1936
1938
|
await Promise.all(filteredBeforeInvocation.map(compensateTasklessNegotiatingOpportunity));
|
|
@@ -1938,8 +1940,9 @@ export class OpportunityGraphFactory {
|
|
|
1938
1940
|
inputOpportunities: state.opportunities.length,
|
|
1939
1941
|
outputCandidates: candidateEntries.length,
|
|
1940
1942
|
});
|
|
1941
|
-
const candidates = await Promise.all(candidateEntries.map(async ({ opp, candidateActor }) => {
|
|
1943
|
+
const candidates = await Promise.all(candidateEntries.map(async ({ opp, sourceActor, candidateActor }) => {
|
|
1942
1944
|
const userId = candidateActor.userId;
|
|
1945
|
+
const sourceIntentId = resolveOpportunityActorIntent(sourceActor);
|
|
1943
1946
|
const candidateIntentId = resolveOpportunityActorIntent(candidateActor);
|
|
1944
1947
|
const [profile, user, activeIntents, intent] = await Promise.all([
|
|
1945
1948
|
this.database.getProfile(userId).catch(() => null),
|
|
@@ -1953,6 +1956,8 @@ export class OpportunityGraphFactory {
|
|
|
1953
1956
|
const candidateIntents = buildPrioritizedNegotiationIntents(activeIntents, candidateIntentId, ownedFallbackIntent);
|
|
1954
1957
|
return {
|
|
1955
1958
|
userId,
|
|
1959
|
+
...(sourceIntentId ? { sourceIntentId } : {}),
|
|
1960
|
+
...(candidateIntentId ? { candidateIntentId } : {}),
|
|
1956
1961
|
opportunityId: opp.id,
|
|
1957
1962
|
opportunityStatus: opp.status,
|
|
1958
1963
|
opportunityUpdatedAt: opp.updatedAt,
|
|
@@ -3651,6 +3656,23 @@ export class OpportunityGraphFactory {
|
|
|
3651
3656
|
}
|
|
3652
3657
|
const actors = opp.actors;
|
|
3653
3658
|
const nonIntroducerActors = actors.filter(a => a.role !== 'introducer');
|
|
3659
|
+
const continuation = state.options.negotiationContinuation;
|
|
3660
|
+
if (continuation) {
|
|
3661
|
+
const recipientActor = nonIntroducerActors.find((actor) => actor.userId === state.userId);
|
|
3662
|
+
const counterpartyActor = nonIntroducerActors.find((actor) => actor.userId === continuation.counterpartyUserId);
|
|
3663
|
+
if (!recipientActor
|
|
3664
|
+
|| resolveOpportunityActorIntent(recipientActor) !== continuation.recipientIntentId
|
|
3665
|
+
|| recipientActor.networkId !== continuation.networkId
|
|
3666
|
+
|| !counterpartyActor
|
|
3667
|
+
|| resolveOpportunityActorIntent(counterpartyActor) !== continuation.counterpartyIntentId
|
|
3668
|
+
|| counterpartyActor.networkId !== continuation.networkId) {
|
|
3669
|
+
negotiateExistingLog.warn('Exact continuation actor binding is stale', {
|
|
3670
|
+
opportunityId: state.opportunityId,
|
|
3671
|
+
taskId: continuation.taskId,
|
|
3672
|
+
});
|
|
3673
|
+
return {};
|
|
3674
|
+
}
|
|
3675
|
+
}
|
|
3654
3676
|
// Find the sourceActor: non-introducer with role patient or party, fallback to first non-introducer
|
|
3655
3677
|
const sourceActor = nonIntroducerActors.find(a => a.role === 'patient' || a.role === 'party')
|
|
3656
3678
|
?? nonIntroducerActors[0];
|
|
@@ -3697,7 +3719,11 @@ export class OpportunityGraphFactory {
|
|
|
3697
3719
|
const candidateIntentsForNeg = buildPrioritizedNegotiationIntents(candidateIntents, candidateIntentId, candidateFallbackIntent?.userId === candidateActor.userId ? candidateFallbackIntent : null);
|
|
3698
3720
|
const candidate = {
|
|
3699
3721
|
userId: candidateActor.userId,
|
|
3722
|
+
...(sourceIntentId ? { sourceIntentId } : {}),
|
|
3723
|
+
...(candidateIntentId ? { candidateIntentId } : {}),
|
|
3700
3724
|
opportunityId: opp.id,
|
|
3725
|
+
opportunityStatus: opp.status,
|
|
3726
|
+
opportunityUpdatedAt: opp.updatedAt,
|
|
3701
3727
|
reasoning: opp.interpretation?.reasoning ?? '',
|
|
3702
3728
|
valencyRole: candidateActor.role ?? 'peer',
|
|
3703
3729
|
networkId: candidateActor.networkId,
|
|
@@ -3725,14 +3751,24 @@ export class OpportunityGraphFactory {
|
|
|
3725
3751
|
// from the prior task's metadata inside the negotiation init node
|
|
3726
3752
|
// (continuations never re-derive the seat). The role heuristic above
|
|
3727
3753
|
// remains only as the fallback for pre-stamp tasks.
|
|
3754
|
+
let continuationReceipt;
|
|
3728
3755
|
const acceptedResults = await negotiateCandidates(this.negotiationGraph, sourceUser, [candidate], { networkId: '', prompt: '' }, {
|
|
3729
3756
|
maxTurns: Number(process.env.NEGOTIATION_MAX_TURNS_AMBIENT) || 6,
|
|
3730
3757
|
indexContextOverrides: indexContextMap,
|
|
3731
3758
|
timeoutMs: AMBIENT_PARK_WINDOW_MS,
|
|
3732
3759
|
trigger: 'ambient',
|
|
3760
|
+
...(continuation ? {
|
|
3761
|
+
resumeFromTaskId: continuation.taskId,
|
|
3762
|
+
continuationSettlementId: continuation.settlementId,
|
|
3763
|
+
continuationExecution: continuation,
|
|
3764
|
+
onCandidateResolved: async ({ continuationReceipt: receipt }) => {
|
|
3765
|
+
if (receipt?.successorTaskId === continuation.successorTaskId)
|
|
3766
|
+
continuationReceipt = receipt;
|
|
3767
|
+
},
|
|
3768
|
+
} : {}),
|
|
3733
3769
|
});
|
|
3734
3770
|
// Send notifications to non-introducer actors if negotiation was accepted
|
|
3735
|
-
if (acceptedResults.length > 0 && this.queueNotification) {
|
|
3771
|
+
if (acceptedResults.length > 0 && this.queueNotification && !continuation) {
|
|
3736
3772
|
for (const actor of nonIntroducerActors) {
|
|
3737
3773
|
await this.queueNotification(opp.id, actor.userId, 'high').catch((err) => {
|
|
3738
3774
|
negotiateExistingLog.warn('Failed to queue notification', { actorId: actor.userId, error: err });
|
|
@@ -3742,7 +3778,9 @@ export class OpportunityGraphFactory {
|
|
|
3742
3778
|
negotiateExistingLog.info('Negotiation complete', {
|
|
3743
3779
|
opportunityId: opp.id,
|
|
3744
3780
|
accepted: acceptedResults.length > 0,
|
|
3781
|
+
continuationFence: continuation?.fence,
|
|
3745
3782
|
});
|
|
3783
|
+
return continuationReceipt ? { negotiationContinuationReceipt: continuationReceipt } : {};
|
|
3746
3784
|
}
|
|
3747
3785
|
catch (err) {
|
|
3748
3786
|
negotiateExistingLog.error('Failed', { opportunityId: state.opportunityId, error: err });
|