@indexnetwork/protocol 0.4.0 → 0.5.1-rc.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +8 -3
  2. package/dist/agent/agent.tools.d.ts +3 -0
  3. package/dist/agent/agent.tools.d.ts.map +1 -0
  4. package/dist/agent/agent.tools.js +330 -0
  5. package/dist/agent/agent.tools.js.map +1 -0
  6. package/dist/chat/chat.agent.d.ts.map +1 -1
  7. package/dist/chat/chat.agent.js +7 -6
  8. package/dist/chat/chat.agent.js.map +1 -1
  9. package/dist/index.d.ts +6 -2
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +3 -2
  12. package/dist/index.js.map +1 -1
  13. package/dist/mcp/mcp.server.d.ts +1 -10
  14. package/dist/mcp/mcp.server.d.ts.map +1 -1
  15. package/dist/mcp/mcp.server.js +59 -8
  16. package/dist/mcp/mcp.server.js.map +1 -1
  17. package/dist/negotiation/negotiation.agent.d.ts +30 -0
  18. package/dist/negotiation/negotiation.agent.d.ts.map +1 -0
  19. package/dist/negotiation/negotiation.agent.js +92 -0
  20. package/dist/negotiation/negotiation.agent.js.map +1 -0
  21. package/dist/negotiation/negotiation.graph.d.ts +138 -166
  22. package/dist/negotiation/negotiation.graph.d.ts.map +1 -1
  23. package/dist/negotiation/negotiation.graph.js +85 -80
  24. package/dist/negotiation/negotiation.graph.js.map +1 -1
  25. package/dist/negotiation/negotiation.state.d.ts +128 -34
  26. package/dist/negotiation/negotiation.state.d.ts.map +1 -1
  27. package/dist/negotiation/negotiation.state.js +45 -14
  28. package/dist/negotiation/negotiation.state.js.map +1 -1
  29. package/dist/negotiation/negotiation.tools.d.ts.map +1 -1
  30. package/dist/negotiation/negotiation.tools.js +183 -172
  31. package/dist/negotiation/negotiation.tools.js.map +1 -1
  32. package/dist/opportunity/opportunity.evaluator.d.ts.map +1 -1
  33. package/dist/opportunity/opportunity.evaluator.js +35 -10
  34. package/dist/opportunity/opportunity.evaluator.js.map +1 -1
  35. package/dist/opportunity/opportunity.graph.d.ts +30 -0
  36. package/dist/opportunity/opportunity.graph.d.ts.map +1 -1
  37. package/dist/opportunity/opportunity.graph.js +45 -8
  38. package/dist/opportunity/opportunity.graph.js.map +1 -1
  39. package/dist/opportunity/opportunity.tools.d.ts.map +1 -1
  40. package/dist/opportunity/opportunity.tools.js +12 -4
  41. package/dist/opportunity/opportunity.tools.js.map +1 -1
  42. package/dist/profile/profile.graph.d.ts +12 -12
  43. package/dist/profile/profile.graph.d.ts.map +1 -1
  44. package/dist/profile/profile.graph.js +22 -15
  45. package/dist/profile/profile.graph.js.map +1 -1
  46. package/dist/profile/profile.tools.d.ts.map +1 -1
  47. package/dist/profile/profile.tools.js +12 -1
  48. package/dist/profile/profile.tools.js.map +1 -1
  49. package/dist/shared/agent/model.config.d.ts +1 -4
  50. package/dist/shared/agent/model.config.d.ts.map +1 -1
  51. package/dist/shared/agent/model.config.js +1 -2
  52. package/dist/shared/agent/model.config.js.map +1 -1
  53. package/dist/shared/agent/tool.factory.d.ts.map +1 -1
  54. package/dist/shared/agent/tool.factory.js +12 -6
  55. package/dist/shared/agent/tool.factory.js.map +1 -1
  56. package/dist/shared/agent/tool.helpers.d.ts +17 -9
  57. package/dist/shared/agent/tool.helpers.d.ts.map +1 -1
  58. package/dist/shared/agent/tool.helpers.js.map +1 -1
  59. package/dist/shared/agent/tool.registry.d.ts.map +1 -1
  60. package/dist/shared/agent/tool.registry.js +2 -0
  61. package/dist/shared/agent/tool.registry.js.map +1 -1
  62. package/dist/shared/interfaces/agent-dispatcher.interface.d.ts +68 -0
  63. package/dist/shared/interfaces/agent-dispatcher.interface.d.ts.map +1 -0
  64. package/dist/shared/interfaces/agent-dispatcher.interface.js +9 -0
  65. package/dist/shared/interfaces/agent-dispatcher.interface.js.map +1 -0
  66. package/dist/shared/interfaces/agent.interface.d.ts +176 -0
  67. package/dist/shared/interfaces/agent.interface.d.ts.map +1 -0
  68. package/dist/shared/interfaces/agent.interface.js +15 -0
  69. package/dist/shared/interfaces/agent.interface.js.map +1 -0
  70. package/dist/shared/interfaces/auth.interface.d.ts +10 -3
  71. package/dist/shared/interfaces/auth.interface.d.ts.map +1 -1
  72. package/dist/shared/interfaces/database.interface.d.ts +1 -1
  73. package/dist/shared/interfaces/database.interface.d.ts.map +1 -1
  74. package/dist/shared/interfaces/negotiation-events.interface.d.ts +2 -34
  75. package/dist/shared/interfaces/negotiation-events.interface.d.ts.map +1 -1
  76. package/dist/shared/interfaces/negotiation-events.interface.js +2 -2
  77. package/package.json +4 -2
  78. package/dist/negotiation/negotiation.proposer.d.ts +0 -26
  79. package/dist/negotiation/negotiation.proposer.d.ts.map +0 -1
  80. package/dist/negotiation/negotiation.proposer.js +0 -67
  81. package/dist/negotiation/negotiation.proposer.js.map +0 -1
  82. package/dist/negotiation/negotiation.responder.d.ts +0 -26
  83. package/dist/negotiation/negotiation.responder.d.ts.map +0 -1
  84. package/dist/negotiation/negotiation.responder.js +0 -71
  85. package/dist/negotiation/negotiation.responder.js.map +0 -1
@@ -1,31 +1,17 @@
1
1
  import { type TraceEmitter } from "../shared/observability/request-context.js";
2
2
  import type { NegotiationDatabase } from "../shared/interfaces/database.interface.js";
3
- import type { WebhookLookup, NegotiationEventEmitter, NegotiationTimeoutQueue } from "../shared/interfaces/negotiation-events.interface.js";
4
- import { type NegotiationTurn, type NegotiationOutcome, type UserNegotiationContext, type SeedAssessment, type NegotiationGraphLike } from "./negotiation.state.js";
5
- interface NegotiationAgentLike {
6
- invoke(input: {
7
- ownUser: UserNegotiationContext;
8
- otherUser: UserNegotiationContext;
9
- indexContext: {
10
- networkId: string;
11
- prompt: string;
12
- };
13
- seedAssessment: SeedAssessment;
14
- history: NegotiationTurn[];
15
- }): Promise<NegotiationTurn>;
16
- }
3
+ import type { NegotiationTimeoutQueue } from "../shared/interfaces/negotiation-events.interface.js";
4
+ import type { AgentDispatcher } from "../shared/interfaces/agent-dispatcher.interface.js";
5
+ import { type NegotiationOutcome, type UserNegotiationContext, type SeedAssessment, type NegotiationGraphLike } from "./negotiation.state.js";
17
6
  /**
18
7
  * Factory for the bilateral negotiation LangGraph state machine.
19
- * @remarks Accepts dependencies via constructor for testability.
8
+ * @remarks Accepts an AgentDispatcher for per-turn agent resolution.
20
9
  */
21
10
  export declare class NegotiationGraphFactory {
22
11
  private database;
23
- private proposer;
24
- private responder;
25
- private webhookLookup?;
26
- private eventEmitter?;
12
+ private dispatcher;
27
13
  private timeoutQueue?;
28
- constructor(database: NegotiationDatabase, proposer: NegotiationAgentLike, responder: NegotiationAgentLike, webhookLookup?: WebhookLookup | undefined, eventEmitter?: NegotiationEventEmitter | undefined, timeoutQueue?: NegotiationTimeoutQueue | undefined);
14
+ constructor(database: NegotiationDatabase, dispatcher: AgentDispatcher, timeoutQueue?: NegotiationTimeoutQueue | undefined);
29
15
  createGraph(): import("@langchain/langgraph").CompiledStateGraph<{
30
16
  sourceUser: UserNegotiationContext;
31
17
  candidateUser: UserNegotiationContext;
@@ -34,35 +20,36 @@ export declare class NegotiationGraphFactory {
34
20
  prompt: string;
35
21
  };
36
22
  seedAssessment: SeedAssessment;
23
+ discoveryQuery: string | undefined;
24
+ opportunityId: string;
37
25
  conversationId: string;
38
26
  taskId: string;
39
27
  messages: import("./negotiation.state.js").NegotiationMessage[];
40
28
  turnCount: number;
41
- maxTurns: number;
29
+ maxTurns: number | undefined;
30
+ timeoutMs: number;
42
31
  currentSpeaker: "source" | "candidate";
43
32
  lastTurn: {
44
- action: "propose" | "accept" | "reject" | "counter";
33
+ action: "propose" | "accept" | "reject" | "counter" | "question";
45
34
  assessment: {
46
35
  reasoning: string;
47
- fitScore: number;
48
36
  suggestedRoles: {
49
37
  ownUser: "agent" | "patient" | "peer";
50
38
  otherUser: "agent" | "patient" | "peer";
51
39
  };
52
40
  };
41
+ message?: string | null | undefined;
53
42
  } | null;
54
- status: "active" | "waiting_for_external" | "completed";
55
- yieldForExternal: boolean;
43
+ status: "active" | "waiting_for_agent" | "completed";
56
44
  outcome: {
57
45
  reasoning: string;
58
46
  hasOpportunity: boolean;
59
- finalScore: number;
60
47
  agreedRoles: {
61
48
  userId: string;
62
49
  role: "agent" | "patient" | "peer";
63
50
  }[];
64
51
  turnCount: number;
65
- reason?: string | undefined;
52
+ reason?: "timeout" | "turn_cap" | undefined;
66
53
  } | null;
67
54
  error: string | null;
68
55
  }, {
@@ -76,55 +63,55 @@ export declare class NegotiationGraphFactory {
76
63
  prompt: string;
77
64
  }> | undefined;
78
65
  seedAssessment?: SeedAssessment | import("@langchain/langgraph").OverwriteValue<SeedAssessment> | undefined;
66
+ discoveryQuery?: string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined;
67
+ opportunityId?: string | import("@langchain/langgraph").OverwriteValue<string> | undefined;
79
68
  conversationId?: string | import("@langchain/langgraph").OverwriteValue<string> | undefined;
80
69
  taskId?: string | import("@langchain/langgraph").OverwriteValue<string> | undefined;
81
70
  messages?: import("./negotiation.state.js").NegotiationMessage[] | import("@langchain/langgraph").OverwriteValue<import("./negotiation.state.js").NegotiationMessage[]> | undefined;
82
71
  turnCount?: number | import("@langchain/langgraph").OverwriteValue<number> | undefined;
83
- maxTurns?: number | import("@langchain/langgraph").OverwriteValue<number> | undefined;
72
+ maxTurns?: number | import("@langchain/langgraph").OverwriteValue<number | undefined> | undefined;
73
+ timeoutMs?: number | import("@langchain/langgraph").OverwriteValue<number> | undefined;
84
74
  currentSpeaker?: "source" | "candidate" | import("@langchain/langgraph").OverwriteValue<"source" | "candidate"> | undefined;
85
75
  lastTurn?: {
86
- action: "propose" | "accept" | "reject" | "counter";
76
+ action: "propose" | "accept" | "reject" | "counter" | "question";
87
77
  assessment: {
88
78
  reasoning: string;
89
- fitScore: number;
90
79
  suggestedRoles: {
91
80
  ownUser: "agent" | "patient" | "peer";
92
81
  otherUser: "agent" | "patient" | "peer";
93
82
  };
94
83
  };
84
+ message?: string | null | undefined;
95
85
  } | import("@langchain/langgraph").OverwriteValue<{
96
- action: "propose" | "accept" | "reject" | "counter";
86
+ action: "propose" | "accept" | "reject" | "counter" | "question";
97
87
  assessment: {
98
88
  reasoning: string;
99
- fitScore: number;
100
89
  suggestedRoles: {
101
90
  ownUser: "agent" | "patient" | "peer";
102
91
  otherUser: "agent" | "patient" | "peer";
103
92
  };
104
93
  };
94
+ message?: string | null | undefined;
105
95
  } | null> | null | undefined;
106
- status?: "active" | "waiting_for_external" | "completed" | import("@langchain/langgraph").OverwriteValue<"active" | "waiting_for_external" | "completed"> | undefined;
107
- yieldForExternal?: boolean | import("@langchain/langgraph").OverwriteValue<boolean> | undefined;
96
+ status?: "active" | "waiting_for_agent" | "completed" | import("@langchain/langgraph").OverwriteValue<"active" | "waiting_for_agent" | "completed"> | undefined;
108
97
  outcome?: {
109
98
  reasoning: string;
110
99
  hasOpportunity: boolean;
111
- finalScore: number;
112
100
  agreedRoles: {
113
101
  userId: string;
114
102
  role: "agent" | "patient" | "peer";
115
103
  }[];
116
104
  turnCount: number;
117
- reason?: string | undefined;
105
+ reason?: "timeout" | "turn_cap" | undefined;
118
106
  } | import("@langchain/langgraph").OverwriteValue<{
119
107
  reasoning: string;
120
108
  hasOpportunity: boolean;
121
- finalScore: number;
122
109
  agreedRoles: {
123
110
  userId: string;
124
111
  role: "agent" | "patient" | "peer";
125
112
  }[];
126
113
  turnCount: number;
127
- reason?: string | undefined;
114
+ reason?: "timeout" | "turn_cap" | undefined;
128
115
  } | null> | null | undefined;
129
116
  error?: string | import("@langchain/langgraph").OverwriteValue<string | null> | null | undefined;
130
117
  }, "__start__" | "init" | "turn" | "finalize", {
@@ -141,75 +128,74 @@ export declare class NegotiationGraphFactory {
141
128
  prompt: string;
142
129
  }>, unknown>;
143
130
  seedAssessment: import("@langchain/langgraph").BaseChannel<SeedAssessment, SeedAssessment | import("@langchain/langgraph").OverwriteValue<SeedAssessment>, unknown>;
131
+ discoveryQuery: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
132
+ opportunityId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
144
133
  conversationId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
145
134
  taskId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
146
135
  messages: import("@langchain/langgraph").BaseChannel<import("./negotiation.state.js").NegotiationMessage[], import("./negotiation.state.js").NegotiationMessage[] | import("@langchain/langgraph").OverwriteValue<import("./negotiation.state.js").NegotiationMessage[]>, unknown>;
147
136
  turnCount: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
148
- maxTurns: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
137
+ maxTurns: import("@langchain/langgraph").BaseChannel<number | undefined, number | import("@langchain/langgraph").OverwriteValue<number | undefined> | undefined, unknown>;
138
+ timeoutMs: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
149
139
  currentSpeaker: import("@langchain/langgraph").BaseChannel<"source" | "candidate", "source" | "candidate" | import("@langchain/langgraph").OverwriteValue<"source" | "candidate">, unknown>;
150
140
  lastTurn: import("@langchain/langgraph").BaseChannel<{
151
- action: "propose" | "accept" | "reject" | "counter";
141
+ action: "propose" | "accept" | "reject" | "counter" | "question";
152
142
  assessment: {
153
143
  reasoning: string;
154
- fitScore: number;
155
144
  suggestedRoles: {
156
145
  ownUser: "agent" | "patient" | "peer";
157
146
  otherUser: "agent" | "patient" | "peer";
158
147
  };
159
148
  };
149
+ message?: string | null | undefined;
160
150
  } | null, {
161
- action: "propose" | "accept" | "reject" | "counter";
151
+ action: "propose" | "accept" | "reject" | "counter" | "question";
162
152
  assessment: {
163
153
  reasoning: string;
164
- fitScore: number;
165
154
  suggestedRoles: {
166
155
  ownUser: "agent" | "patient" | "peer";
167
156
  otherUser: "agent" | "patient" | "peer";
168
157
  };
169
158
  };
159
+ message?: string | null | undefined;
170
160
  } | import("@langchain/langgraph").OverwriteValue<{
171
- action: "propose" | "accept" | "reject" | "counter";
161
+ action: "propose" | "accept" | "reject" | "counter" | "question";
172
162
  assessment: {
173
163
  reasoning: string;
174
- fitScore: number;
175
164
  suggestedRoles: {
176
165
  ownUser: "agent" | "patient" | "peer";
177
166
  otherUser: "agent" | "patient" | "peer";
178
167
  };
179
168
  };
169
+ message?: string | null | undefined;
180
170
  } | null> | null, unknown>;
181
- status: import("@langchain/langgraph").BaseChannel<"active" | "waiting_for_external" | "completed", "active" | "waiting_for_external" | "completed" | import("@langchain/langgraph").OverwriteValue<"active" | "waiting_for_external" | "completed">, unknown>;
182
- yieldForExternal: import("@langchain/langgraph").BaseChannel<boolean, boolean | import("@langchain/langgraph").OverwriteValue<boolean>, unknown>;
171
+ status: import("@langchain/langgraph").BaseChannel<"active" | "waiting_for_agent" | "completed", "active" | "waiting_for_agent" | "completed" | import("@langchain/langgraph").OverwriteValue<"active" | "waiting_for_agent" | "completed">, unknown>;
183
172
  outcome: import("@langchain/langgraph").BaseChannel<{
184
173
  reasoning: string;
185
174
  hasOpportunity: boolean;
186
- finalScore: number;
187
175
  agreedRoles: {
188
176
  userId: string;
189
177
  role: "agent" | "patient" | "peer";
190
178
  }[];
191
179
  turnCount: number;
192
- reason?: string | undefined;
180
+ reason?: "timeout" | "turn_cap" | undefined;
193
181
  } | null, {
194
182
  reasoning: string;
195
183
  hasOpportunity: boolean;
196
- finalScore: number;
197
184
  agreedRoles: {
198
185
  userId: string;
199
186
  role: "agent" | "patient" | "peer";
200
187
  }[];
201
188
  turnCount: number;
202
- reason?: string | undefined;
189
+ reason?: "timeout" | "turn_cap" | undefined;
203
190
  } | import("@langchain/langgraph").OverwriteValue<{
204
191
  reasoning: string;
205
192
  hasOpportunity: boolean;
206
- finalScore: number;
207
193
  agreedRoles: {
208
194
  userId: string;
209
195
  role: "agent" | "patient" | "peer";
210
196
  }[];
211
197
  turnCount: number;
212
- reason?: string | undefined;
198
+ reason?: "timeout" | "turn_cap" | undefined;
213
199
  } | null> | null, unknown>;
214
200
  error: import("@langchain/langgraph").BaseChannel<string | null, string | import("@langchain/langgraph").OverwriteValue<string | null> | null, unknown>;
215
201
  }, {
@@ -226,75 +212,74 @@ export declare class NegotiationGraphFactory {
226
212
  prompt: string;
227
213
  }>, unknown>;
228
214
  seedAssessment: import("@langchain/langgraph").BaseChannel<SeedAssessment, SeedAssessment | import("@langchain/langgraph").OverwriteValue<SeedAssessment>, unknown>;
215
+ discoveryQuery: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
216
+ opportunityId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
229
217
  conversationId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
230
218
  taskId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
231
219
  messages: import("@langchain/langgraph").BaseChannel<import("./negotiation.state.js").NegotiationMessage[], import("./negotiation.state.js").NegotiationMessage[] | import("@langchain/langgraph").OverwriteValue<import("./negotiation.state.js").NegotiationMessage[]>, unknown>;
232
220
  turnCount: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
233
- maxTurns: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
221
+ maxTurns: import("@langchain/langgraph").BaseChannel<number | undefined, number | import("@langchain/langgraph").OverwriteValue<number | undefined> | undefined, unknown>;
222
+ timeoutMs: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
234
223
  currentSpeaker: import("@langchain/langgraph").BaseChannel<"source" | "candidate", "source" | "candidate" | import("@langchain/langgraph").OverwriteValue<"source" | "candidate">, unknown>;
235
224
  lastTurn: import("@langchain/langgraph").BaseChannel<{
236
- action: "propose" | "accept" | "reject" | "counter";
225
+ action: "propose" | "accept" | "reject" | "counter" | "question";
237
226
  assessment: {
238
227
  reasoning: string;
239
- fitScore: number;
240
228
  suggestedRoles: {
241
229
  ownUser: "agent" | "patient" | "peer";
242
230
  otherUser: "agent" | "patient" | "peer";
243
231
  };
244
232
  };
233
+ message?: string | null | undefined;
245
234
  } | null, {
246
- action: "propose" | "accept" | "reject" | "counter";
235
+ action: "propose" | "accept" | "reject" | "counter" | "question";
247
236
  assessment: {
248
237
  reasoning: string;
249
- fitScore: number;
250
238
  suggestedRoles: {
251
239
  ownUser: "agent" | "patient" | "peer";
252
240
  otherUser: "agent" | "patient" | "peer";
253
241
  };
254
242
  };
243
+ message?: string | null | undefined;
255
244
  } | import("@langchain/langgraph").OverwriteValue<{
256
- action: "propose" | "accept" | "reject" | "counter";
245
+ action: "propose" | "accept" | "reject" | "counter" | "question";
257
246
  assessment: {
258
247
  reasoning: string;
259
- fitScore: number;
260
248
  suggestedRoles: {
261
249
  ownUser: "agent" | "patient" | "peer";
262
250
  otherUser: "agent" | "patient" | "peer";
263
251
  };
264
252
  };
253
+ message?: string | null | undefined;
265
254
  } | null> | null, unknown>;
266
- status: import("@langchain/langgraph").BaseChannel<"active" | "waiting_for_external" | "completed", "active" | "waiting_for_external" | "completed" | import("@langchain/langgraph").OverwriteValue<"active" | "waiting_for_external" | "completed">, unknown>;
267
- yieldForExternal: import("@langchain/langgraph").BaseChannel<boolean, boolean | import("@langchain/langgraph").OverwriteValue<boolean>, unknown>;
255
+ status: import("@langchain/langgraph").BaseChannel<"active" | "waiting_for_agent" | "completed", "active" | "waiting_for_agent" | "completed" | import("@langchain/langgraph").OverwriteValue<"active" | "waiting_for_agent" | "completed">, unknown>;
268
256
  outcome: import("@langchain/langgraph").BaseChannel<{
269
257
  reasoning: string;
270
258
  hasOpportunity: boolean;
271
- finalScore: number;
272
259
  agreedRoles: {
273
260
  userId: string;
274
261
  role: "agent" | "patient" | "peer";
275
262
  }[];
276
263
  turnCount: number;
277
- reason?: string | undefined;
264
+ reason?: "timeout" | "turn_cap" | undefined;
278
265
  } | null, {
279
266
  reasoning: string;
280
267
  hasOpportunity: boolean;
281
- finalScore: number;
282
268
  agreedRoles: {
283
269
  userId: string;
284
270
  role: "agent" | "patient" | "peer";
285
271
  }[];
286
272
  turnCount: number;
287
- reason?: string | undefined;
273
+ reason?: "timeout" | "turn_cap" | undefined;
288
274
  } | import("@langchain/langgraph").OverwriteValue<{
289
275
  reasoning: string;
290
276
  hasOpportunity: boolean;
291
- finalScore: number;
292
277
  agreedRoles: {
293
278
  userId: string;
294
279
  role: "agent" | "patient" | "peer";
295
280
  }[];
296
281
  turnCount: number;
297
- reason?: string | undefined;
282
+ reason?: "timeout" | "turn_cap" | undefined;
298
283
  } | null> | null, unknown>;
299
284
  error: import("@langchain/langgraph").BaseChannel<string | null, string | import("@langchain/langgraph").OverwriteValue<string | null> | null, unknown>;
300
285
  }, import("@langchain/langgraph").StateDefinition, {
@@ -303,6 +288,7 @@ export declare class NegotiationGraphFactory {
303
288
  taskId: string;
304
289
  currentSpeaker: "source";
305
290
  turnCount: number;
291
+ maxTurns: number;
306
292
  error?: undefined;
307
293
  } | {
308
294
  error: string;
@@ -310,6 +296,7 @@ export declare class NegotiationGraphFactory {
310
296
  taskId?: undefined;
311
297
  currentSpeaker?: undefined;
312
298
  turnCount?: undefined;
299
+ maxTurns?: undefined;
313
300
  };
314
301
  turn: import("@langchain/langgraph").UpdateType<{
315
302
  sourceUser: import("@langchain/langgraph").BaseChannel<UserNegotiationContext, UserNegotiationContext | import("@langchain/langgraph").OverwriteValue<UserNegotiationContext>, unknown>;
@@ -325,75 +312,74 @@ export declare class NegotiationGraphFactory {
325
312
  prompt: string;
326
313
  }>, unknown>;
327
314
  seedAssessment: import("@langchain/langgraph").BaseChannel<SeedAssessment, SeedAssessment | import("@langchain/langgraph").OverwriteValue<SeedAssessment>, unknown>;
315
+ discoveryQuery: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
316
+ opportunityId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
328
317
  conversationId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
329
318
  taskId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
330
319
  messages: import("@langchain/langgraph").BaseChannel<import("./negotiation.state.js").NegotiationMessage[], import("./negotiation.state.js").NegotiationMessage[] | import("@langchain/langgraph").OverwriteValue<import("./negotiation.state.js").NegotiationMessage[]>, unknown>;
331
320
  turnCount: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
332
- maxTurns: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
321
+ maxTurns: import("@langchain/langgraph").BaseChannel<number | undefined, number | import("@langchain/langgraph").OverwriteValue<number | undefined> | undefined, unknown>;
322
+ timeoutMs: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
333
323
  currentSpeaker: import("@langchain/langgraph").BaseChannel<"source" | "candidate", "source" | "candidate" | import("@langchain/langgraph").OverwriteValue<"source" | "candidate">, unknown>;
334
324
  lastTurn: import("@langchain/langgraph").BaseChannel<{
335
- action: "propose" | "accept" | "reject" | "counter";
325
+ action: "propose" | "accept" | "reject" | "counter" | "question";
336
326
  assessment: {
337
327
  reasoning: string;
338
- fitScore: number;
339
328
  suggestedRoles: {
340
329
  ownUser: "agent" | "patient" | "peer";
341
330
  otherUser: "agent" | "patient" | "peer";
342
331
  };
343
332
  };
333
+ message?: string | null | undefined;
344
334
  } | null, {
345
- action: "propose" | "accept" | "reject" | "counter";
335
+ action: "propose" | "accept" | "reject" | "counter" | "question";
346
336
  assessment: {
347
337
  reasoning: string;
348
- fitScore: number;
349
338
  suggestedRoles: {
350
339
  ownUser: "agent" | "patient" | "peer";
351
340
  otherUser: "agent" | "patient" | "peer";
352
341
  };
353
342
  };
343
+ message?: string | null | undefined;
354
344
  } | import("@langchain/langgraph").OverwriteValue<{
355
- action: "propose" | "accept" | "reject" | "counter";
345
+ action: "propose" | "accept" | "reject" | "counter" | "question";
356
346
  assessment: {
357
347
  reasoning: string;
358
- fitScore: number;
359
348
  suggestedRoles: {
360
349
  ownUser: "agent" | "patient" | "peer";
361
350
  otherUser: "agent" | "patient" | "peer";
362
351
  };
363
352
  };
353
+ message?: string | null | undefined;
364
354
  } | null> | null, unknown>;
365
- status: import("@langchain/langgraph").BaseChannel<"active" | "waiting_for_external" | "completed", "active" | "waiting_for_external" | "completed" | import("@langchain/langgraph").OverwriteValue<"active" | "waiting_for_external" | "completed">, unknown>;
366
- yieldForExternal: import("@langchain/langgraph").BaseChannel<boolean, boolean | import("@langchain/langgraph").OverwriteValue<boolean>, unknown>;
355
+ status: import("@langchain/langgraph").BaseChannel<"active" | "waiting_for_agent" | "completed", "active" | "waiting_for_agent" | "completed" | import("@langchain/langgraph").OverwriteValue<"active" | "waiting_for_agent" | "completed">, unknown>;
367
356
  outcome: import("@langchain/langgraph").BaseChannel<{
368
357
  reasoning: string;
369
358
  hasOpportunity: boolean;
370
- finalScore: number;
371
359
  agreedRoles: {
372
360
  userId: string;
373
361
  role: "agent" | "patient" | "peer";
374
362
  }[];
375
363
  turnCount: number;
376
- reason?: string | undefined;
364
+ reason?: "timeout" | "turn_cap" | undefined;
377
365
  } | null, {
378
366
  reasoning: string;
379
367
  hasOpportunity: boolean;
380
- finalScore: number;
381
368
  agreedRoles: {
382
369
  userId: string;
383
370
  role: "agent" | "patient" | "peer";
384
371
  }[];
385
372
  turnCount: number;
386
- reason?: string | undefined;
373
+ reason?: "timeout" | "turn_cap" | undefined;
387
374
  } | import("@langchain/langgraph").OverwriteValue<{
388
375
  reasoning: string;
389
376
  hasOpportunity: boolean;
390
- finalScore: number;
391
377
  agreedRoles: {
392
378
  userId: string;
393
379
  role: "agent" | "patient" | "peer";
394
380
  }[];
395
381
  turnCount: number;
396
- reason?: string | undefined;
382
+ reason?: "timeout" | "turn_cap" | undefined;
397
383
  } | null> | null, unknown>;
398
384
  error: import("@langchain/langgraph").BaseChannel<string | null, string | import("@langchain/langgraph").OverwriteValue<string | null> | null, unknown>;
399
385
  }>;
@@ -404,13 +390,12 @@ export declare class NegotiationGraphFactory {
404
390
  outcome: {
405
391
  reasoning: string;
406
392
  hasOpportunity: boolean;
407
- finalScore: number;
408
393
  agreedRoles: {
409
394
  userId: string;
410
395
  role: "agent" | "patient" | "peer";
411
396
  }[];
412
397
  turnCount: number;
413
- reason?: string | undefined;
398
+ reason?: "timeout" | "turn_cap" | undefined;
414
399
  };
415
400
  status: "completed";
416
401
  };
@@ -418,26 +403,21 @@ export declare class NegotiationGraphFactory {
418
403
  }
419
404
  export interface NegotiationCandidate {
420
405
  userId: string;
421
- score: number;
422
406
  reasoning: string;
423
407
  valencyRole: string;
424
408
  networkId?: string;
425
409
  candidateUser: UserNegotiationContext;
410
+ /** The explicit search query that triggered discovery (if any). */
411
+ discoveryQuery?: string;
426
412
  }
427
413
  export interface NegotiationResult {
428
414
  userId: string;
429
- negotiationScore: number;
430
415
  agreedRoles: NegotiationOutcome["agreedRoles"];
431
416
  reasoning: string;
432
417
  turnCount: number;
433
418
  }
434
419
  /**
435
420
  * Runs bilateral negotiation for each candidate in parallel.
436
- * @param negotiationGraph - Compiled negotiation graph
437
- * @param sourceUser - Source user context
438
- * @param candidates - Evaluated candidates to negotiate with
439
- * @param indexContext - Index context for the negotiation
440
- * @param opts - Optional maxTurns and traceEmitter
441
421
  * @returns Only candidates that produced an opportunity
442
422
  */
443
423
  export declare function negotiateCandidates(negotiationGraph: NegotiationGraphLike, sourceUser: UserNegotiationContext, candidates: NegotiationCandidate[], indexContext: {
@@ -447,20 +427,14 @@ export declare function negotiateCandidates(negotiationGraph: NegotiationGraphLi
447
427
  maxTurns?: number;
448
428
  traceEmitter?: TraceEmitter;
449
429
  indexContextOverrides?: Map<string, string>;
450
- yieldForExternal?: boolean;
430
+ timeoutMs?: number;
451
431
  }): Promise<NegotiationResult[]>;
452
432
  /**
453
433
  * Creates a negotiation graph with the provided dependencies.
454
- * @param deps.database - Conversation database adapter
455
- * @param deps.proposer - Agent that proposes negotiation terms
456
- * @param deps.responder - Agent that responds to negotiation proposals
457
434
  */
458
435
  export declare function createDefaultNegotiationGraph(deps: {
459
436
  database: NegotiationDatabase;
460
- proposer: NegotiationAgentLike;
461
- responder: NegotiationAgentLike;
462
- webhookLookup?: WebhookLookup;
463
- eventEmitter?: NegotiationEventEmitter;
437
+ dispatcher: AgentDispatcher;
464
438
  timeoutQueue?: NegotiationTimeoutQueue;
465
439
  }): import("@langchain/langgraph").CompiledStateGraph<{
466
440
  sourceUser: UserNegotiationContext;
@@ -470,35 +444,36 @@ export declare function createDefaultNegotiationGraph(deps: {
470
444
  prompt: string;
471
445
  };
472
446
  seedAssessment: SeedAssessment;
447
+ discoveryQuery: string | undefined;
448
+ opportunityId: string;
473
449
  conversationId: string;
474
450
  taskId: string;
475
451
  messages: import("./negotiation.state.js").NegotiationMessage[];
476
452
  turnCount: number;
477
- maxTurns: number;
453
+ maxTurns: number | undefined;
454
+ timeoutMs: number;
478
455
  currentSpeaker: "source" | "candidate";
479
456
  lastTurn: {
480
- action: "propose" | "accept" | "reject" | "counter";
457
+ action: "propose" | "accept" | "reject" | "counter" | "question";
481
458
  assessment: {
482
459
  reasoning: string;
483
- fitScore: number;
484
460
  suggestedRoles: {
485
461
  ownUser: "agent" | "patient" | "peer";
486
462
  otherUser: "agent" | "patient" | "peer";
487
463
  };
488
464
  };
465
+ message?: string | null | undefined;
489
466
  } | null;
490
- status: "active" | "waiting_for_external" | "completed";
491
- yieldForExternal: boolean;
467
+ status: "active" | "waiting_for_agent" | "completed";
492
468
  outcome: {
493
469
  reasoning: string;
494
470
  hasOpportunity: boolean;
495
- finalScore: number;
496
471
  agreedRoles: {
497
472
  userId: string;
498
473
  role: "agent" | "patient" | "peer";
499
474
  }[];
500
475
  turnCount: number;
501
- reason?: string | undefined;
476
+ reason?: "timeout" | "turn_cap" | undefined;
502
477
  } | null;
503
478
  error: string | null;
504
479
  }, {
@@ -512,55 +487,55 @@ export declare function createDefaultNegotiationGraph(deps: {
512
487
  prompt: string;
513
488
  }> | undefined;
514
489
  seedAssessment?: SeedAssessment | import("@langchain/langgraph").OverwriteValue<SeedAssessment> | undefined;
490
+ discoveryQuery?: string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined;
491
+ opportunityId?: string | import("@langchain/langgraph").OverwriteValue<string> | undefined;
515
492
  conversationId?: string | import("@langchain/langgraph").OverwriteValue<string> | undefined;
516
493
  taskId?: string | import("@langchain/langgraph").OverwriteValue<string> | undefined;
517
494
  messages?: import("./negotiation.state.js").NegotiationMessage[] | import("@langchain/langgraph").OverwriteValue<import("./negotiation.state.js").NegotiationMessage[]> | undefined;
518
495
  turnCount?: number | import("@langchain/langgraph").OverwriteValue<number> | undefined;
519
- maxTurns?: number | import("@langchain/langgraph").OverwriteValue<number> | undefined;
496
+ maxTurns?: number | import("@langchain/langgraph").OverwriteValue<number | undefined> | undefined;
497
+ timeoutMs?: number | import("@langchain/langgraph").OverwriteValue<number> | undefined;
520
498
  currentSpeaker?: "source" | "candidate" | import("@langchain/langgraph").OverwriteValue<"source" | "candidate"> | undefined;
521
499
  lastTurn?: {
522
- action: "propose" | "accept" | "reject" | "counter";
500
+ action: "propose" | "accept" | "reject" | "counter" | "question";
523
501
  assessment: {
524
502
  reasoning: string;
525
- fitScore: number;
526
503
  suggestedRoles: {
527
504
  ownUser: "agent" | "patient" | "peer";
528
505
  otherUser: "agent" | "patient" | "peer";
529
506
  };
530
507
  };
508
+ message?: string | null | undefined;
531
509
  } | import("@langchain/langgraph").OverwriteValue<{
532
- action: "propose" | "accept" | "reject" | "counter";
510
+ action: "propose" | "accept" | "reject" | "counter" | "question";
533
511
  assessment: {
534
512
  reasoning: string;
535
- fitScore: number;
536
513
  suggestedRoles: {
537
514
  ownUser: "agent" | "patient" | "peer";
538
515
  otherUser: "agent" | "patient" | "peer";
539
516
  };
540
517
  };
518
+ message?: string | null | undefined;
541
519
  } | null> | null | undefined;
542
- status?: "active" | "waiting_for_external" | "completed" | import("@langchain/langgraph").OverwriteValue<"active" | "waiting_for_external" | "completed"> | undefined;
543
- yieldForExternal?: boolean | import("@langchain/langgraph").OverwriteValue<boolean> | undefined;
520
+ status?: "active" | "waiting_for_agent" | "completed" | import("@langchain/langgraph").OverwriteValue<"active" | "waiting_for_agent" | "completed"> | undefined;
544
521
  outcome?: {
545
522
  reasoning: string;
546
523
  hasOpportunity: boolean;
547
- finalScore: number;
548
524
  agreedRoles: {
549
525
  userId: string;
550
526
  role: "agent" | "patient" | "peer";
551
527
  }[];
552
528
  turnCount: number;
553
- reason?: string | undefined;
529
+ reason?: "timeout" | "turn_cap" | undefined;
554
530
  } | import("@langchain/langgraph").OverwriteValue<{
555
531
  reasoning: string;
556
532
  hasOpportunity: boolean;
557
- finalScore: number;
558
533
  agreedRoles: {
559
534
  userId: string;
560
535
  role: "agent" | "patient" | "peer";
561
536
  }[];
562
537
  turnCount: number;
563
- reason?: string | undefined;
538
+ reason?: "timeout" | "turn_cap" | undefined;
564
539
  } | null> | null | undefined;
565
540
  error?: string | import("@langchain/langgraph").OverwriteValue<string | null> | null | undefined;
566
541
  }, "__start__" | "init" | "turn" | "finalize", {
@@ -577,75 +552,74 @@ export declare function createDefaultNegotiationGraph(deps: {
577
552
  prompt: string;
578
553
  }>, unknown>;
579
554
  seedAssessment: import("@langchain/langgraph").BaseChannel<SeedAssessment, SeedAssessment | import("@langchain/langgraph").OverwriteValue<SeedAssessment>, unknown>;
555
+ discoveryQuery: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
556
+ opportunityId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
580
557
  conversationId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
581
558
  taskId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
582
559
  messages: import("@langchain/langgraph").BaseChannel<import("./negotiation.state.js").NegotiationMessage[], import("./negotiation.state.js").NegotiationMessage[] | import("@langchain/langgraph").OverwriteValue<import("./negotiation.state.js").NegotiationMessage[]>, unknown>;
583
560
  turnCount: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
584
- maxTurns: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
561
+ maxTurns: import("@langchain/langgraph").BaseChannel<number | undefined, number | import("@langchain/langgraph").OverwriteValue<number | undefined> | undefined, unknown>;
562
+ timeoutMs: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
585
563
  currentSpeaker: import("@langchain/langgraph").BaseChannel<"source" | "candidate", "source" | "candidate" | import("@langchain/langgraph").OverwriteValue<"source" | "candidate">, unknown>;
586
564
  lastTurn: import("@langchain/langgraph").BaseChannel<{
587
- action: "propose" | "accept" | "reject" | "counter";
565
+ action: "propose" | "accept" | "reject" | "counter" | "question";
588
566
  assessment: {
589
567
  reasoning: string;
590
- fitScore: number;
591
568
  suggestedRoles: {
592
569
  ownUser: "agent" | "patient" | "peer";
593
570
  otherUser: "agent" | "patient" | "peer";
594
571
  };
595
572
  };
573
+ message?: string | null | undefined;
596
574
  } | null, {
597
- action: "propose" | "accept" | "reject" | "counter";
575
+ action: "propose" | "accept" | "reject" | "counter" | "question";
598
576
  assessment: {
599
577
  reasoning: string;
600
- fitScore: number;
601
578
  suggestedRoles: {
602
579
  ownUser: "agent" | "patient" | "peer";
603
580
  otherUser: "agent" | "patient" | "peer";
604
581
  };
605
582
  };
583
+ message?: string | null | undefined;
606
584
  } | import("@langchain/langgraph").OverwriteValue<{
607
- action: "propose" | "accept" | "reject" | "counter";
585
+ action: "propose" | "accept" | "reject" | "counter" | "question";
608
586
  assessment: {
609
587
  reasoning: string;
610
- fitScore: number;
611
588
  suggestedRoles: {
612
589
  ownUser: "agent" | "patient" | "peer";
613
590
  otherUser: "agent" | "patient" | "peer";
614
591
  };
615
592
  };
593
+ message?: string | null | undefined;
616
594
  } | null> | null, unknown>;
617
- status: import("@langchain/langgraph").BaseChannel<"active" | "waiting_for_external" | "completed", "active" | "waiting_for_external" | "completed" | import("@langchain/langgraph").OverwriteValue<"active" | "waiting_for_external" | "completed">, unknown>;
618
- yieldForExternal: import("@langchain/langgraph").BaseChannel<boolean, boolean | import("@langchain/langgraph").OverwriteValue<boolean>, unknown>;
595
+ status: import("@langchain/langgraph").BaseChannel<"active" | "waiting_for_agent" | "completed", "active" | "waiting_for_agent" | "completed" | import("@langchain/langgraph").OverwriteValue<"active" | "waiting_for_agent" | "completed">, unknown>;
619
596
  outcome: import("@langchain/langgraph").BaseChannel<{
620
597
  reasoning: string;
621
598
  hasOpportunity: boolean;
622
- finalScore: number;
623
599
  agreedRoles: {
624
600
  userId: string;
625
601
  role: "agent" | "patient" | "peer";
626
602
  }[];
627
603
  turnCount: number;
628
- reason?: string | undefined;
604
+ reason?: "timeout" | "turn_cap" | undefined;
629
605
  } | null, {
630
606
  reasoning: string;
631
607
  hasOpportunity: boolean;
632
- finalScore: number;
633
608
  agreedRoles: {
634
609
  userId: string;
635
610
  role: "agent" | "patient" | "peer";
636
611
  }[];
637
612
  turnCount: number;
638
- reason?: string | undefined;
613
+ reason?: "timeout" | "turn_cap" | undefined;
639
614
  } | import("@langchain/langgraph").OverwriteValue<{
640
615
  reasoning: string;
641
616
  hasOpportunity: boolean;
642
- finalScore: number;
643
617
  agreedRoles: {
644
618
  userId: string;
645
619
  role: "agent" | "patient" | "peer";
646
620
  }[];
647
621
  turnCount: number;
648
- reason?: string | undefined;
622
+ reason?: "timeout" | "turn_cap" | undefined;
649
623
  } | null> | null, unknown>;
650
624
  error: import("@langchain/langgraph").BaseChannel<string | null, string | import("@langchain/langgraph").OverwriteValue<string | null> | null, unknown>;
651
625
  }, {
@@ -662,75 +636,74 @@ export declare function createDefaultNegotiationGraph(deps: {
662
636
  prompt: string;
663
637
  }>, unknown>;
664
638
  seedAssessment: import("@langchain/langgraph").BaseChannel<SeedAssessment, SeedAssessment | import("@langchain/langgraph").OverwriteValue<SeedAssessment>, unknown>;
639
+ discoveryQuery: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
640
+ opportunityId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
665
641
  conversationId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
666
642
  taskId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
667
643
  messages: import("@langchain/langgraph").BaseChannel<import("./negotiation.state.js").NegotiationMessage[], import("./negotiation.state.js").NegotiationMessage[] | import("@langchain/langgraph").OverwriteValue<import("./negotiation.state.js").NegotiationMessage[]>, unknown>;
668
644
  turnCount: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
669
- maxTurns: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
645
+ maxTurns: import("@langchain/langgraph").BaseChannel<number | undefined, number | import("@langchain/langgraph").OverwriteValue<number | undefined> | undefined, unknown>;
646
+ timeoutMs: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
670
647
  currentSpeaker: import("@langchain/langgraph").BaseChannel<"source" | "candidate", "source" | "candidate" | import("@langchain/langgraph").OverwriteValue<"source" | "candidate">, unknown>;
671
648
  lastTurn: import("@langchain/langgraph").BaseChannel<{
672
- action: "propose" | "accept" | "reject" | "counter";
649
+ action: "propose" | "accept" | "reject" | "counter" | "question";
673
650
  assessment: {
674
651
  reasoning: string;
675
- fitScore: number;
676
652
  suggestedRoles: {
677
653
  ownUser: "agent" | "patient" | "peer";
678
654
  otherUser: "agent" | "patient" | "peer";
679
655
  };
680
656
  };
657
+ message?: string | null | undefined;
681
658
  } | null, {
682
- action: "propose" | "accept" | "reject" | "counter";
659
+ action: "propose" | "accept" | "reject" | "counter" | "question";
683
660
  assessment: {
684
661
  reasoning: string;
685
- fitScore: number;
686
662
  suggestedRoles: {
687
663
  ownUser: "agent" | "patient" | "peer";
688
664
  otherUser: "agent" | "patient" | "peer";
689
665
  };
690
666
  };
667
+ message?: string | null | undefined;
691
668
  } | import("@langchain/langgraph").OverwriteValue<{
692
- action: "propose" | "accept" | "reject" | "counter";
669
+ action: "propose" | "accept" | "reject" | "counter" | "question";
693
670
  assessment: {
694
671
  reasoning: string;
695
- fitScore: number;
696
672
  suggestedRoles: {
697
673
  ownUser: "agent" | "patient" | "peer";
698
674
  otherUser: "agent" | "patient" | "peer";
699
675
  };
700
676
  };
677
+ message?: string | null | undefined;
701
678
  } | null> | null, unknown>;
702
- status: import("@langchain/langgraph").BaseChannel<"active" | "waiting_for_external" | "completed", "active" | "waiting_for_external" | "completed" | import("@langchain/langgraph").OverwriteValue<"active" | "waiting_for_external" | "completed">, unknown>;
703
- yieldForExternal: import("@langchain/langgraph").BaseChannel<boolean, boolean | import("@langchain/langgraph").OverwriteValue<boolean>, unknown>;
679
+ status: import("@langchain/langgraph").BaseChannel<"active" | "waiting_for_agent" | "completed", "active" | "waiting_for_agent" | "completed" | import("@langchain/langgraph").OverwriteValue<"active" | "waiting_for_agent" | "completed">, unknown>;
704
680
  outcome: import("@langchain/langgraph").BaseChannel<{
705
681
  reasoning: string;
706
682
  hasOpportunity: boolean;
707
- finalScore: number;
708
683
  agreedRoles: {
709
684
  userId: string;
710
685
  role: "agent" | "patient" | "peer";
711
686
  }[];
712
687
  turnCount: number;
713
- reason?: string | undefined;
688
+ reason?: "timeout" | "turn_cap" | undefined;
714
689
  } | null, {
715
690
  reasoning: string;
716
691
  hasOpportunity: boolean;
717
- finalScore: number;
718
692
  agreedRoles: {
719
693
  userId: string;
720
694
  role: "agent" | "patient" | "peer";
721
695
  }[];
722
696
  turnCount: number;
723
- reason?: string | undefined;
697
+ reason?: "timeout" | "turn_cap" | undefined;
724
698
  } | import("@langchain/langgraph").OverwriteValue<{
725
699
  reasoning: string;
726
700
  hasOpportunity: boolean;
727
- finalScore: number;
728
701
  agreedRoles: {
729
702
  userId: string;
730
703
  role: "agent" | "patient" | "peer";
731
704
  }[];
732
705
  turnCount: number;
733
- reason?: string | undefined;
706
+ reason?: "timeout" | "turn_cap" | undefined;
734
707
  } | null> | null, unknown>;
735
708
  error: import("@langchain/langgraph").BaseChannel<string | null, string | import("@langchain/langgraph").OverwriteValue<string | null> | null, unknown>;
736
709
  }, import("@langchain/langgraph").StateDefinition, {
@@ -739,6 +712,7 @@ export declare function createDefaultNegotiationGraph(deps: {
739
712
  taskId: string;
740
713
  currentSpeaker: "source";
741
714
  turnCount: number;
715
+ maxTurns: number;
742
716
  error?: undefined;
743
717
  } | {
744
718
  error: string;
@@ -746,6 +720,7 @@ export declare function createDefaultNegotiationGraph(deps: {
746
720
  taskId?: undefined;
747
721
  currentSpeaker?: undefined;
748
722
  turnCount?: undefined;
723
+ maxTurns?: undefined;
749
724
  };
750
725
  turn: import("@langchain/langgraph").UpdateType<{
751
726
  sourceUser: import("@langchain/langgraph").BaseChannel<UserNegotiationContext, UserNegotiationContext | import("@langchain/langgraph").OverwriteValue<UserNegotiationContext>, unknown>;
@@ -761,75 +736,74 @@ export declare function createDefaultNegotiationGraph(deps: {
761
736
  prompt: string;
762
737
  }>, unknown>;
763
738
  seedAssessment: import("@langchain/langgraph").BaseChannel<SeedAssessment, SeedAssessment | import("@langchain/langgraph").OverwriteValue<SeedAssessment>, unknown>;
739
+ discoveryQuery: import("@langchain/langgraph").BaseChannel<string | undefined, string | import("@langchain/langgraph").OverwriteValue<string | undefined> | undefined, unknown>;
740
+ opportunityId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
764
741
  conversationId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
765
742
  taskId: import("@langchain/langgraph").BaseChannel<string, string | import("@langchain/langgraph").OverwriteValue<string>, unknown>;
766
743
  messages: import("@langchain/langgraph").BaseChannel<import("./negotiation.state.js").NegotiationMessage[], import("./negotiation.state.js").NegotiationMessage[] | import("@langchain/langgraph").OverwriteValue<import("./negotiation.state.js").NegotiationMessage[]>, unknown>;
767
744
  turnCount: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
768
- maxTurns: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
745
+ maxTurns: import("@langchain/langgraph").BaseChannel<number | undefined, number | import("@langchain/langgraph").OverwriteValue<number | undefined> | undefined, unknown>;
746
+ timeoutMs: import("@langchain/langgraph").BaseChannel<number, number | import("@langchain/langgraph").OverwriteValue<number>, unknown>;
769
747
  currentSpeaker: import("@langchain/langgraph").BaseChannel<"source" | "candidate", "source" | "candidate" | import("@langchain/langgraph").OverwriteValue<"source" | "candidate">, unknown>;
770
748
  lastTurn: import("@langchain/langgraph").BaseChannel<{
771
- action: "propose" | "accept" | "reject" | "counter";
749
+ action: "propose" | "accept" | "reject" | "counter" | "question";
772
750
  assessment: {
773
751
  reasoning: string;
774
- fitScore: number;
775
752
  suggestedRoles: {
776
753
  ownUser: "agent" | "patient" | "peer";
777
754
  otherUser: "agent" | "patient" | "peer";
778
755
  };
779
756
  };
757
+ message?: string | null | undefined;
780
758
  } | null, {
781
- action: "propose" | "accept" | "reject" | "counter";
759
+ action: "propose" | "accept" | "reject" | "counter" | "question";
782
760
  assessment: {
783
761
  reasoning: string;
784
- fitScore: number;
785
762
  suggestedRoles: {
786
763
  ownUser: "agent" | "patient" | "peer";
787
764
  otherUser: "agent" | "patient" | "peer";
788
765
  };
789
766
  };
767
+ message?: string | null | undefined;
790
768
  } | import("@langchain/langgraph").OverwriteValue<{
791
- action: "propose" | "accept" | "reject" | "counter";
769
+ action: "propose" | "accept" | "reject" | "counter" | "question";
792
770
  assessment: {
793
771
  reasoning: string;
794
- fitScore: number;
795
772
  suggestedRoles: {
796
773
  ownUser: "agent" | "patient" | "peer";
797
774
  otherUser: "agent" | "patient" | "peer";
798
775
  };
799
776
  };
777
+ message?: string | null | undefined;
800
778
  } | null> | null, unknown>;
801
- status: import("@langchain/langgraph").BaseChannel<"active" | "waiting_for_external" | "completed", "active" | "waiting_for_external" | "completed" | import("@langchain/langgraph").OverwriteValue<"active" | "waiting_for_external" | "completed">, unknown>;
802
- yieldForExternal: import("@langchain/langgraph").BaseChannel<boolean, boolean | import("@langchain/langgraph").OverwriteValue<boolean>, unknown>;
779
+ status: import("@langchain/langgraph").BaseChannel<"active" | "waiting_for_agent" | "completed", "active" | "waiting_for_agent" | "completed" | import("@langchain/langgraph").OverwriteValue<"active" | "waiting_for_agent" | "completed">, unknown>;
803
780
  outcome: import("@langchain/langgraph").BaseChannel<{
804
781
  reasoning: string;
805
782
  hasOpportunity: boolean;
806
- finalScore: number;
807
783
  agreedRoles: {
808
784
  userId: string;
809
785
  role: "agent" | "patient" | "peer";
810
786
  }[];
811
787
  turnCount: number;
812
- reason?: string | undefined;
788
+ reason?: "timeout" | "turn_cap" | undefined;
813
789
  } | null, {
814
790
  reasoning: string;
815
791
  hasOpportunity: boolean;
816
- finalScore: number;
817
792
  agreedRoles: {
818
793
  userId: string;
819
794
  role: "agent" | "patient" | "peer";
820
795
  }[];
821
796
  turnCount: number;
822
- reason?: string | undefined;
797
+ reason?: "timeout" | "turn_cap" | undefined;
823
798
  } | import("@langchain/langgraph").OverwriteValue<{
824
799
  reasoning: string;
825
800
  hasOpportunity: boolean;
826
- finalScore: number;
827
801
  agreedRoles: {
828
802
  userId: string;
829
803
  role: "agent" | "patient" | "peer";
830
804
  }[];
831
805
  turnCount: number;
832
- reason?: string | undefined;
806
+ reason?: "timeout" | "turn_cap" | undefined;
833
807
  } | null> | null, unknown>;
834
808
  error: import("@langchain/langgraph").BaseChannel<string | null, string | import("@langchain/langgraph").OverwriteValue<string | null> | null, unknown>;
835
809
  }>;
@@ -840,16 +814,14 @@ export declare function createDefaultNegotiationGraph(deps: {
840
814
  outcome: {
841
815
  reasoning: string;
842
816
  hasOpportunity: boolean;
843
- finalScore: number;
844
817
  agreedRoles: {
845
818
  userId: string;
846
819
  role: "agent" | "patient" | "peer";
847
820
  }[];
848
821
  turnCount: number;
849
- reason?: string | undefined;
822
+ reason?: "timeout" | "turn_cap" | undefined;
850
823
  };
851
824
  status: "completed";
852
825
  };
853
826
  }, unknown, unknown>;
854
- export {};
855
827
  //# sourceMappingURL=negotiation.graph.d.ts.map