@indexnetwork/protocol 13.2.0-rc.466.1 → 14.0.0-rc.468.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 +49 -0
- package/dist/capabilities/participant-agents.facade.d.ts +1 -2
- package/dist/capabilities/participant-agents.facade.js +1 -2
- package/dist/chat/chat-streaming.types.d.ts +16 -40
- package/dist/chat/chat-streaming.types.js +1 -8
- package/dist/chat/chat.agent.d.ts +5 -25
- package/dist/chat/chat.agent.js +12 -46
- package/dist/chat/chat.graph.d.ts +4 -6
- package/dist/chat/chat.graph.js +2 -3
- package/dist/chat/chat.persona.d.ts +7 -21
- package/dist/chat/chat.persona.js +1 -24
- package/dist/chat/chat.prompt.d.ts +0 -13
- package/dist/chat/chat.prompt.js +6 -428
- package/dist/chat/chat.prompt.modules.d.ts +2 -32
- package/dist/chat/chat.prompt.modules.js +1 -235
- package/dist/chat/chat.streamer.js +2 -8
- package/dist/communities/public/index.d.ts +2 -2
- package/dist/communities/public/index.js +2 -2
- package/dist/contacts/public/index.d.ts +1 -1
- package/dist/contacts/public/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +0 -1
- package/dist/integrations/public/index.d.ts +1 -1
- package/dist/integrations/public/index.js +1 -1
- package/dist/mcp/mcp.server.d.ts +1 -1
- package/dist/mcp/mcp.server.js +1 -1
- package/dist/negotiation/public/index.d.ts +1 -1
- package/dist/negotiation/public/index.js +1 -1
- package/dist/participant-agents/public/index.d.ts +2 -2
- package/dist/participant-agents/public/index.js +2 -2
- package/dist/participant-context/application/index.js +1 -1
- package/dist/participant-context/domain/index.d.ts +1 -1
- package/dist/participant-context/domain/index.js +1 -1
- package/dist/participant-context/public/index.d.ts +2 -2
- package/dist/participant-context/public/index.js +2 -2
- package/dist/questions/public/index.d.ts +1 -1
- package/dist/questions/public/index.js +1 -1
- package/dist/shared/agent/tool.factory.d.ts +15 -4
- package/dist/shared/agent/tool.factory.js +233 -4
- package/dist/shared/agent/tool.registry.d.ts +21 -9
- package/dist/shared/agent/tool.registry.js +80 -12
- package/dist/signals/application/index.d.ts +1 -1
- package/dist/signals/application/index.js +1 -1
- package/dist/signals/public/index.d.ts +2 -2
- package/dist/signals/public/index.js +2 -2
- package/package.json +1 -1
- package/dist/communities/index.d.ts +0 -14
- package/dist/communities/index.js +0 -14
- package/dist/contacts/index.d.ts +0 -18
- package/dist/contacts/index.js +0 -18
- package/dist/integrations/index.d.ts +0 -22
- package/dist/integrations/index.js +0 -22
- package/dist/negotiation/index.d.ts +0 -25
- package/dist/negotiation/index.js +0 -25
- package/dist/opportunity/index.d.ts +0 -29
- package/dist/opportunity/index.js +0 -29
- package/dist/participant-agents/index.d.ts +0 -17
- package/dist/participant-agents/index.js +0 -17
- package/dist/platform/index.d.ts +0 -19
- package/dist/platform/index.js +0 -23
- package/dist/public/index.d.ts +0 -17
- package/dist/public/index.js +0 -17
- package/dist/questions/index.d.ts +0 -15
- package/dist/questions/index.js +0 -15
- package/dist/runtime/background/index.d.ts +0 -14
- package/dist/runtime/background/index.js +0 -14
- package/dist/runtime/foreground/composition/tool.factory.d.ts +0 -17
- package/dist/runtime/foreground/composition/tool.factory.js +0 -235
- package/dist/runtime/foreground/composition/tool.registry.d.ts +0 -24
- package/dist/runtime/foreground/composition/tool.registry.js +0 -80
- package/dist/runtime/foreground/index.d.ts +0 -13
- package/dist/runtime/foreground/index.js +0 -13
- package/dist/runtime/foreground/signals/intent.tools.d.ts +0 -13
- package/dist/runtime/foreground/signals/intent.tools.js +0 -13
- package/dist/signals/index.d.ts +0 -13
- package/dist/signals/index.js +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -20,6 +20,45 @@ went 6.7.1 → 8.0.2 with no 7.x in between because the whole 7.x line shipped a
|
|
|
20
20
|
prereleases between the two promotions. To track every change, read `rc`; to
|
|
21
21
|
pin a supported release, use `latest`.
|
|
22
22
|
|
|
23
|
+
## 13.2.1 - 2026-08-16
|
|
24
|
+
|
|
25
|
+
No public API change: all 441 exported symbols are byte-identical to 13.2.0, and
|
|
26
|
+
`src/index.ts` is untouched. This is internal structure only.
|
|
27
|
+
|
|
28
|
+
### Removed
|
|
29
|
+
|
|
30
|
+
- Removed the IND-543 outer shells — `src/public/`, `src/platform/`,
|
|
31
|
+
`src/runtime/foreground/`, and `src/runtime/background/`. All four were
|
|
32
|
+
declaration-only placeholders with zero inbound imports; `runtime/background`
|
|
33
|
+
and `public` consisted of nothing but a header comment. The only thing
|
|
34
|
+
referencing them was a spec asserting that they existed.
|
|
35
|
+
- Removed eight unused capability barrels (`signals/index.ts`,
|
|
36
|
+
`communities/index.ts`, `contacts/index.ts`, `questions/index.ts`,
|
|
37
|
+
`opportunity/index.ts`, `negotiation/index.ts`, `integrations/index.ts`,
|
|
38
|
+
`participant-agents/index.ts`). Each was `export * from "./public/index.js"`
|
|
39
|
+
with no importers — every real consumer already went to `public/` directly.
|
|
40
|
+
- Removed `src/shared/ui/`, which contained no source, only a `tests/tsconfig.json`.
|
|
41
|
+
- Removed the `ambient-background`, `neutral-platform`, and
|
|
42
|
+
`public-compatibility` capability classifications, which existed solely to
|
|
43
|
+
describe the deleted shells.
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- Resolved the tool-composition shim inversion. `tool.registry.ts` and
|
|
48
|
+
`tool.factory.ts` were implemented in `runtime/foreground/composition/` and
|
|
49
|
+
re-exported from `shared/agent/` through modules marked `@deprecated` — but
|
|
50
|
+
all 25 importers used the deprecated path. The implementations now live at
|
|
51
|
+
`shared/agent/tool.registry.ts` and `shared/agent/tool.factory.ts`, and the
|
|
52
|
+
indirection is gone. `mcp.server.ts` was the one direct consumer of the old
|
|
53
|
+
location and now resolves to the same single home.
|
|
54
|
+
- `signals/application/intent.tools.ts` is imported directly by the tool
|
|
55
|
+
factory; the `runtime/foreground/signals/intent.tools.ts` pass-through
|
|
56
|
+
re-export that sat between them is removed.
|
|
57
|
+
- Replaced `architecture/tests/runtime-shells.spec.ts` with
|
|
58
|
+
`architecture/tests/package-entry.spec.ts`, which asserts the invariants that
|
|
59
|
+
outlived the shells: `src/index.ts` is the sole `package.json` export, and the
|
|
60
|
+
tool composition root has exactly one implementation.
|
|
61
|
+
|
|
23
62
|
## 13.2.0 - 2026-08-16
|
|
24
63
|
|
|
25
64
|
### Added
|
|
@@ -93,6 +132,16 @@ pin a supported release, use `latest`.
|
|
|
93
132
|
|
|
94
133
|
## [Unreleased]
|
|
95
134
|
|
|
135
|
+
### Removed
|
|
136
|
+
|
|
137
|
+
- **Breaking (14.0.0):** remove the `orchestrator` chat persona. `ORCHESTRATOR_PERSONA_ID` and `ORCHESTRATOR_PERSONA` are gone from the public API, and the orchestrator system prompt (`buildSystemContent`) and its conditional prompt-module registry are deleted. `ChatPersonaLoopBehaviors.hallucinationRecovery` is retained — it is opted into by the onboarding, signal and negotiator personas, not just the removed one.
|
|
138
|
+
- Remove the never-emitted `question_generator_start` / `question_generator_end` stream events and the `DebugMetaDiscoveryQuestions` debug payload, which had no producer.
|
|
139
|
+
|
|
140
|
+
### Changed
|
|
141
|
+
|
|
142
|
+
- **Breaking:** `ChatGraphFactory` and `ChatAgent.create()` now require a `ChatPersonaConfig`. There is no default persona; callers name the persona they drive.
|
|
143
|
+
- `DebugMetaOrchestratorNegotiations` keeps its name and wire key deliberately. It is read back out of persisted message debug metadata, so renaming it would drop the negotiation pointer for every historical message. It is populated for every persona whose tools can start a negotiation, not only the persona it is named after.
|
|
144
|
+
|
|
96
145
|
### Changed
|
|
97
146
|
|
|
98
147
|
- The eval ops sign-in callback accepts only the `api_key` field (protocol
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* 2. **Runtime personas, chat graph, and tool-composition seams** — sourced
|
|
12
12
|
* from chat/ (runtime foreground; not owned by participant-agents module):
|
|
13
|
-
* - `ChatGraphFactory`,
|
|
13
|
+
* - `ChatGraphFactory`, persona ids and factories, etc.
|
|
14
14
|
* - `ChatTitleGenerator`, `ChatInterruptClassifier`, `ChatSummarizer`, etc.
|
|
15
15
|
*
|
|
16
16
|
* Runtime personas, chat/MCP transport, authentication, and all-capability
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
export { createAgentTools, SYSTEM_AGENT_IDS } from "../participant-agents/public/index.js";
|
|
23
23
|
export type { AgentToolDeps } from "../participant-agents/public/index.js";
|
|
24
24
|
export { ChatGraphFactory } from "../chat/chat.graph.js";
|
|
25
|
-
export { ORCHESTRATOR_PERSONA_ID } from "../chat/chat.persona.js";
|
|
26
25
|
export type { ChatPersonaConfig } from "../chat/chat.persona.js";
|
|
27
26
|
export { NEGOTIATOR_PERSONA_ID, createNegotiatorPersona } from "../chat/negotiator.persona.js";
|
|
28
27
|
export { SIGNAL_PERSONA_ID, SIGNAL_PERSONA, SIGNAL_NEW_SIGNAL_KICKOFF, SIGNAL_TOOL_NAMES, createSignalTools, filterSignalTools, narrowSignalTools } from "../chat/signal.persona.js";
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* 2. **Runtime personas, chat graph, and tool-composition seams** — sourced
|
|
12
12
|
* from chat/ (runtime foreground; not owned by participant-agents module):
|
|
13
|
-
* - `ChatGraphFactory`,
|
|
13
|
+
* - `ChatGraphFactory`, persona ids and factories, etc.
|
|
14
14
|
* - `ChatTitleGenerator`, `ChatInterruptClassifier`, `ChatSummarizer`, etc.
|
|
15
15
|
*
|
|
16
16
|
* Runtime personas, chat/MCP transport, authentication, and all-capability
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
export { createAgentTools, SYSTEM_AGENT_IDS } from "../participant-agents/public/index.js";
|
|
24
24
|
// ── Runtime chat graph ────────────────────────────────────────────────────────
|
|
25
25
|
export { ChatGraphFactory } from "../chat/chat.graph.js";
|
|
26
|
-
export { ORCHESTRATOR_PERSONA_ID } from "../chat/chat.persona.js";
|
|
27
26
|
export { NEGOTIATOR_PERSONA_ID, createNegotiatorPersona } from "../chat/negotiator.persona.js";
|
|
28
27
|
export { SIGNAL_PERSONA_ID, SIGNAL_PERSONA, SIGNAL_NEW_SIGNAL_KICKOFF, SIGNAL_TOOL_NAMES, createSignalTools, filterSignalTools, narrowSignalTools } from "../chat/signal.persona.js";
|
|
29
28
|
export { REPORTER_PERSONA_ID, REPORTER_PERSONA, REPORTER_BRIEFING_KICKOFF, REPORTER_TOOL_NAMES, createReporterTools, filterReporterTools, narrowReporterTools } from "../chat/reporter.persona.js";
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* These types define the structure of events sent during streaming chat responses.
|
|
5
5
|
* Events are sent as Server-Sent Events (SSE) with JSON payloads.
|
|
6
6
|
*/
|
|
7
|
-
import type { Question
|
|
8
|
-
export type ChatStreamEventType = "status" | "routing" | "thinking" | "subgraph_start" | "subgraph_result" | "token" | "done" | "error" | "tool_start" | "tool_end" | "agent_thinking" | "tool_activity" | "iteration_start" | "llm_start" | "llm_end" | "response_complete" | "response_reset" | "debug_meta" | "graph_start" | "graph_end" | "phase_start" | "phase_end" | "agent_start" | "agent_end" | "hallucination_detected" | "negotiation_session_start" | "negotiation_session_end" | "negotiation_turn" | "negotiation_outcome" | "chat_summarizer_start" | "chat_summarizer_end" | "
|
|
7
|
+
import type { Question } from "../questions/domain/question.schema.js";
|
|
8
|
+
export type ChatStreamEventType = "status" | "routing" | "thinking" | "subgraph_start" | "subgraph_result" | "token" | "done" | "error" | "tool_start" | "tool_end" | "agent_thinking" | "tool_activity" | "iteration_start" | "llm_start" | "llm_end" | "response_complete" | "response_reset" | "debug_meta" | "graph_start" | "graph_end" | "phase_start" | "phase_end" | "agent_start" | "agent_end" | "hallucination_detected" | "negotiation_session_start" | "negotiation_session_end" | "negotiation_turn" | "negotiation_outcome" | "chat_summarizer_start" | "chat_summarizer_end" | "decision_questions" | "user_question" | "steer_or_queue";
|
|
9
9
|
/**
|
|
10
10
|
* Base interface for all chat stream events.
|
|
11
11
|
*/
|
|
@@ -143,7 +143,7 @@ export interface DoneEvent extends ChatStreamEventBase {
|
|
|
143
143
|
suggestions?: ChatSuggestion[];
|
|
144
144
|
/** Optional rich opportunity cards returned by tools */
|
|
145
145
|
opportunityCards?: OpportunityCardPayload[];
|
|
146
|
-
/** Decision questions to render
|
|
146
|
+
/** Decision questions to render, harvested from any tool result carrying `questions`. */
|
|
147
147
|
decisionQuestions?: Question[];
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
@@ -326,19 +326,20 @@ export interface DebugMetaLlm {
|
|
|
326
326
|
/**
|
|
327
327
|
* Negotiation sessions recorded during this turn.
|
|
328
328
|
*/
|
|
329
|
+
/**
|
|
330
|
+
* Negotiations started during a chat turn, keyed by opportunity.
|
|
331
|
+
*
|
|
332
|
+
* Named for the retired orchestrator persona; the key is deliberately
|
|
333
|
+
* unchanged because it is read back out of persisted message debug metadata
|
|
334
|
+
* (see debug.controller's negotiation hydration). Renaming it would drop the
|
|
335
|
+
* pointer for every historical message and silently fall back to the
|
|
336
|
+
* time-window heuristic. Populated for every persona whose tools can start a
|
|
337
|
+
* negotiation, not just the persona it is named after.
|
|
338
|
+
*/
|
|
329
339
|
export interface DebugMetaOrchestratorNegotiations {
|
|
330
340
|
/** Opportunity IDs for which a negotiation_session_start was emitted. */
|
|
331
341
|
opportunityIds: string[];
|
|
332
342
|
}
|
|
333
|
-
/**
|
|
334
|
-
* Decision-question generation debug data.
|
|
335
|
-
*/
|
|
336
|
-
export interface DebugMetaDiscoveryQuestions {
|
|
337
|
-
inputMode: "transcripts" | "insights";
|
|
338
|
-
finalCount: number;
|
|
339
|
-
strategies: QuestionStrategy[];
|
|
340
|
-
durationMs: number;
|
|
341
|
-
}
|
|
342
343
|
/**
|
|
343
344
|
* Debug meta event - per-turn graph and tool usage for copy debug.
|
|
344
345
|
*/
|
|
@@ -349,8 +350,6 @@ export interface DebugMetaEvent extends ChatStreamEventBase {
|
|
|
349
350
|
tools: DebugMetaToolCall[];
|
|
350
351
|
llm: DebugMetaLlm;
|
|
351
352
|
orchestratorNegotiations?: DebugMetaOrchestratorNegotiations;
|
|
352
|
-
/** Decision-question generation debug data. */
|
|
353
|
-
discoveryQuestions?: DebugMetaDiscoveryQuestions;
|
|
354
353
|
}
|
|
355
354
|
/** Graph start event — emitted when a LangGraph sub-graph begins inside a tool. */
|
|
356
355
|
export interface GraphStartEvent extends ChatStreamEventBase {
|
|
@@ -449,27 +448,6 @@ export interface ChatSummarizerEndEvent extends ChatStreamEventBase {
|
|
|
449
448
|
durationMs: number;
|
|
450
449
|
};
|
|
451
450
|
}
|
|
452
|
-
export interface QuestionGeneratorStartEvent extends ChatStreamEventBase {
|
|
453
|
-
type: "question_generator_start";
|
|
454
|
-
payload: {
|
|
455
|
-
inputMode: "transcripts" | "insights";
|
|
456
|
-
negotiationCount: number;
|
|
457
|
-
hasChatContext: boolean;
|
|
458
|
-
truncated?: {
|
|
459
|
-
originalCount: number;
|
|
460
|
-
keptCount: number;
|
|
461
|
-
};
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
|
-
export interface QuestionGeneratorEndEvent extends ChatStreamEventBase {
|
|
465
|
-
type: "question_generator_end";
|
|
466
|
-
payload: {
|
|
467
|
-
finalCount: number;
|
|
468
|
-
strategies: QuestionStrategy[];
|
|
469
|
-
durationMs: number;
|
|
470
|
-
inputMode: "transcripts" | "insights";
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
451
|
export interface DecisionQuestionsEvent extends ChatStreamEventBase {
|
|
474
452
|
type: "decision_questions";
|
|
475
453
|
questions: Question[];
|
|
@@ -484,7 +462,7 @@ export interface UserQuestionPayload {
|
|
|
484
462
|
id: string;
|
|
485
463
|
}
|
|
486
464
|
/**
|
|
487
|
-
* User question event — emitted when
|
|
465
|
+
* User question event — emitted when a persona's ask_user_question
|
|
488
466
|
* tool persisted chat-mode questions and is now blocking the turn awaiting
|
|
489
467
|
* the user's inline answer.
|
|
490
468
|
*/
|
|
@@ -507,7 +485,7 @@ export interface SteerOrQueueEvent extends ChatStreamEventBase {
|
|
|
507
485
|
/**
|
|
508
486
|
* Union type of all chat stream events.
|
|
509
487
|
*/
|
|
510
|
-
export type ChatStreamEvent = StatusEvent | RoutingEvent | ThinkingEvent | SubgraphStartEvent | SubgraphResultEvent | TokenEvent | DoneEvent | ErrorEvent | ToolStartEvent | ToolEndEvent | AgentThinkingEvent | ToolActivityEvent | IterationStartEvent | LlmStartEvent | LlmEndEvent | ResponseCompleteEvent | ResponseResetEvent | HallucinationDetectedEvent | DebugMetaEvent | GraphStartEvent | GraphEndEvent | PhaseStartEvent | PhaseEndEvent | AgentStartEvent | AgentEndEvent | NegotiationSessionStartEvent | NegotiationSessionEndEvent | NegotiationTurnEvent | NegotiationOutcomeEvent | ChatSummarizerStartEvent | ChatSummarizerEndEvent |
|
|
488
|
+
export type ChatStreamEvent = StatusEvent | RoutingEvent | ThinkingEvent | SubgraphStartEvent | SubgraphResultEvent | TokenEvent | DoneEvent | ErrorEvent | ToolStartEvent | ToolEndEvent | AgentThinkingEvent | ToolActivityEvent | IterationStartEvent | LlmStartEvent | LlmEndEvent | ResponseCompleteEvent | ResponseResetEvent | HallucinationDetectedEvent | DebugMetaEvent | GraphStartEvent | GraphEndEvent | PhaseStartEvent | PhaseEndEvent | AgentStartEvent | AgentEndEvent | NegotiationSessionStartEvent | NegotiationSessionEndEvent | NegotiationTurnEvent | NegotiationOutcomeEvent | ChatSummarizerStartEvent | ChatSummarizerEndEvent | DecisionQuestionsEvent | UserQuestionEvent | SteerOrQueueEvent;
|
|
511
489
|
/**
|
|
512
490
|
* Formats a chat stream event as an SSE message. If JSON.stringify throws (e.g. circular ref,
|
|
513
491
|
* non-serializable value), returns a minimal error event so the stream stays valid.
|
|
@@ -624,7 +602,7 @@ export declare function createHallucinationDetectedEvent(sessionId: string, bloc
|
|
|
624
602
|
/**
|
|
625
603
|
* Creates a formatted debug meta event (per-turn graph and tool usage).
|
|
626
604
|
*/
|
|
627
|
-
export declare function createDebugMetaEvent(sessionId: string, graph: string, iterations: number, tools: DebugMetaToolCall[], llm: DebugMetaLlm, orchestratorNegotiations?: DebugMetaOrchestratorNegotiations
|
|
605
|
+
export declare function createDebugMetaEvent(sessionId: string, graph: string, iterations: number, tools: DebugMetaToolCall[], llm: DebugMetaLlm, orchestratorNegotiations?: DebugMetaOrchestratorNegotiations): DebugMetaEvent;
|
|
628
606
|
/**
|
|
629
607
|
* Creates a graph start event emitted when a LangGraph sub-graph begins inside a tool.
|
|
630
608
|
*/
|
|
@@ -649,8 +627,6 @@ export declare function createNegotiationTurnEvent(sessionId: string, payload: O
|
|
|
649
627
|
export declare function createNegotiationOutcomeEvent(sessionId: string, payload: Omit<NegotiationOutcomeEvent, "type" | "sessionId" | "timestamp">): NegotiationOutcomeEvent;
|
|
650
628
|
export declare function createChatSummarizerStartEvent(sessionId: string, payload: ChatSummarizerStartEvent["payload"]): ChatSummarizerStartEvent;
|
|
651
629
|
export declare function createChatSummarizerEndEvent(sessionId: string, payload: ChatSummarizerEndEvent["payload"]): ChatSummarizerEndEvent;
|
|
652
|
-
export declare function createQuestionGeneratorStartEvent(sessionId: string, payload: QuestionGeneratorStartEvent["payload"]): QuestionGeneratorStartEvent;
|
|
653
|
-
export declare function createQuestionGeneratorEndEvent(sessionId: string, payload: QuestionGeneratorEndEvent["payload"]): QuestionGeneratorEndEvent;
|
|
654
630
|
export declare function createDecisionQuestionsEvent(sessionId: string, payload: {
|
|
655
631
|
questions: Question[];
|
|
656
632
|
}): DecisionQuestionsEvent;
|
|
@@ -223,14 +223,13 @@ export function createHallucinationDetectedEvent(sessionId, blockType, tool) {
|
|
|
223
223
|
/**
|
|
224
224
|
* Creates a formatted debug meta event (per-turn graph and tool usage).
|
|
225
225
|
*/
|
|
226
|
-
export function createDebugMetaEvent(sessionId, graph, iterations, tools, llm, orchestratorNegotiations
|
|
226
|
+
export function createDebugMetaEvent(sessionId, graph, iterations, tools, llm, orchestratorNegotiations) {
|
|
227
227
|
return createStreamEvent("debug_meta", sessionId, {
|
|
228
228
|
graph,
|
|
229
229
|
iterations,
|
|
230
230
|
tools,
|
|
231
231
|
llm,
|
|
232
232
|
...(orchestratorNegotiations !== undefined && { orchestratorNegotiations }),
|
|
233
|
-
...(discoveryQuestions !== undefined && { discoveryQuestions }),
|
|
234
233
|
});
|
|
235
234
|
}
|
|
236
235
|
// ════════════════════════════════════════════════════════════════════════════
|
|
@@ -284,12 +283,6 @@ export function createChatSummarizerStartEvent(sessionId, payload) {
|
|
|
284
283
|
export function createChatSummarizerEndEvent(sessionId, payload) {
|
|
285
284
|
return createStreamEvent("chat_summarizer_end", sessionId, { payload });
|
|
286
285
|
}
|
|
287
|
-
export function createQuestionGeneratorStartEvent(sessionId, payload) {
|
|
288
|
-
return createStreamEvent("question_generator_start", sessionId, { payload });
|
|
289
|
-
}
|
|
290
|
-
export function createQuestionGeneratorEndEvent(sessionId, payload) {
|
|
291
|
-
return createStreamEvent("question_generator_end", sessionId, { payload });
|
|
292
|
-
}
|
|
293
286
|
export function createDecisionQuestionsEvent(sessionId, payload) {
|
|
294
287
|
return createStreamEvent("decision_questions", sessionId, payload);
|
|
295
288
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BaseMessage } from "@langchain/core/messages";
|
|
2
2
|
import type { ToolContext } from "../shared/agent/tool.factory.js";
|
|
3
|
-
import {
|
|
4
|
-
import type { DebugMetaToolCall, DebugMetaLlm, DebugMetaOrchestratorNegotiations
|
|
5
|
-
import type { Question
|
|
3
|
+
import type { ChatPersonaConfig } from "./chat.persona.js";
|
|
4
|
+
import type { DebugMetaToolCall, DebugMetaLlm, DebugMetaOrchestratorNegotiations } from "./chat-streaming.types.js";
|
|
5
|
+
import type { Question } from "../questions/domain/question.schema.js";
|
|
6
6
|
export { ITERATION_NUDGE } from "./chat.prompt.js";
|
|
7
7
|
/**
|
|
8
8
|
* Writer callback for streaming custom data out of the graph node.
|
|
@@ -138,25 +138,6 @@ export type AgentStreamEvent = {
|
|
|
138
138
|
payload: {
|
|
139
139
|
durationMs: number;
|
|
140
140
|
};
|
|
141
|
-
} | {
|
|
142
|
-
type: "question_generator_start";
|
|
143
|
-
payload: {
|
|
144
|
-
inputMode: "transcripts" | "insights";
|
|
145
|
-
negotiationCount: number;
|
|
146
|
-
hasChatContext: boolean;
|
|
147
|
-
truncated?: {
|
|
148
|
-
originalCount: number;
|
|
149
|
-
keptCount: number;
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
} | {
|
|
153
|
-
type: "question_generator_end";
|
|
154
|
-
payload: {
|
|
155
|
-
finalCount: number;
|
|
156
|
-
strategies: QuestionStrategy[];
|
|
157
|
-
durationMs: number;
|
|
158
|
-
inputMode: "transcripts" | "insights";
|
|
159
|
-
};
|
|
160
141
|
};
|
|
161
142
|
/**
|
|
162
143
|
* Soft limit: After this many iterations, inject a nudge message.
|
|
@@ -226,9 +207,9 @@ export declare class ChatAgent {
|
|
|
226
207
|
*
|
|
227
208
|
* @param context - Tool context (database, userId, scope, deps)
|
|
228
209
|
* @param persona - Persona config (prompt builder, toolset, loop behaviors).
|
|
229
|
-
*
|
|
210
|
+
* Required — there is no default persona.
|
|
230
211
|
*/
|
|
231
|
-
static create(context: ToolContext, persona
|
|
212
|
+
static create(context: ToolContext, persona: ChatPersonaConfig): Promise<ChatAgent>;
|
|
232
213
|
/**
|
|
233
214
|
* Run a single iteration of the agent loop.
|
|
234
215
|
*
|
|
@@ -317,7 +298,6 @@ export declare class ChatAgent {
|
|
|
317
298
|
tools: DebugMetaToolCall[];
|
|
318
299
|
llm: DebugMetaLlm;
|
|
319
300
|
orchestratorNegotiations?: DebugMetaOrchestratorNegotiations;
|
|
320
|
-
discoveryQuestions?: DebugMetaDiscoveryQuestions;
|
|
321
301
|
};
|
|
322
302
|
}>;
|
|
323
303
|
}
|
package/dist/chat/chat.agent.js
CHANGED
|
@@ -11,7 +11,6 @@ import { AIMessage, SystemMessage, ToolMessage } from "@langchain/core/messages"
|
|
|
11
11
|
import { resolveChatContext } from "../shared/agent/tool.helpers.js";
|
|
12
12
|
import { scopeFromNetworkId } from "../shared/agent/tool.scope.js";
|
|
13
13
|
import { ITERATION_NUDGE } from "./chat.prompt.js";
|
|
14
|
-
import { ORCHESTRATOR_PERSONA } from "./chat.persona.js";
|
|
15
14
|
import { extractRecentToolCalls } from "./chat.prompt.modules.js";
|
|
16
15
|
import { protocolLogger } from "../shared/observability/protocol.logger.js";
|
|
17
16
|
import { createModel } from "../shared/agent/model.config.js";
|
|
@@ -192,9 +191,9 @@ export class ChatAgent {
|
|
|
192
191
|
*
|
|
193
192
|
* @param context - Tool context (database, userId, scope, deps)
|
|
194
193
|
* @param persona - Persona config (prompt builder, toolset, loop behaviors).
|
|
195
|
-
*
|
|
194
|
+
* Required — there is no default persona.
|
|
196
195
|
*/
|
|
197
|
-
static async create(context, persona
|
|
196
|
+
static async create(context, persona) {
|
|
198
197
|
const { networkId: legacyNetworkId } = context;
|
|
199
198
|
const explicitScope = context.scopeType && context.scopeId
|
|
200
199
|
? { scopeType: context.scopeType, scopeId: context.scopeId }
|
|
@@ -442,7 +441,6 @@ export class ChatAgent {
|
|
|
442
441
|
let debugSteps;
|
|
443
442
|
let graphTimings;
|
|
444
443
|
let decisionQuestions;
|
|
445
|
-
let discoveryQuestionsDebug;
|
|
446
444
|
try {
|
|
447
445
|
const parsed = JSON.parse(normalized);
|
|
448
446
|
const payload = parsed.success && parsed.data != null ? parsed.data : parsed;
|
|
@@ -472,31 +470,9 @@ export class ChatAgent {
|
|
|
472
470
|
catch { /* keep original if can't clean */ }
|
|
473
471
|
}
|
|
474
472
|
const rawQuestions = payload.questions ?? parsed.questions;
|
|
475
|
-
const rawQuestionDebug = payload._discoveryQuestionsDebug
|
|
476
|
-
?? parsed._discoveryQuestionsDebug;
|
|
477
473
|
if (Array.isArray(rawQuestions)) {
|
|
478
474
|
decisionQuestions = rawQuestions;
|
|
479
475
|
}
|
|
480
|
-
if (rawQuestionDebug && typeof rawQuestionDebug === "object") {
|
|
481
|
-
discoveryQuestionsDebug = rawQuestionDebug;
|
|
482
|
-
}
|
|
483
|
-
// `_discoveryQuestionsDebug` is internal trace data — strip from the LLM-facing
|
|
484
|
-
// tool result. `questions` is intentionally kept visible so the agent can
|
|
485
|
-
// follow the prompt addendum and reference the decision prompts in its reply.
|
|
486
|
-
if (discoveryQuestionsDebug !== undefined) {
|
|
487
|
-
try {
|
|
488
|
-
const cleaned = JSON.parse(normalized);
|
|
489
|
-
const stripFrom = (obj) => {
|
|
490
|
-
delete obj._discoveryQuestionsDebug;
|
|
491
|
-
};
|
|
492
|
-
stripFrom(cleaned);
|
|
493
|
-
if (cleaned.data && typeof cleaned.data === "object") {
|
|
494
|
-
stripFrom(cleaned.data);
|
|
495
|
-
}
|
|
496
|
-
normalized = JSON.stringify(cleaned);
|
|
497
|
-
}
|
|
498
|
-
catch { /* keep original */ }
|
|
499
|
-
}
|
|
500
476
|
}
|
|
501
477
|
catch {
|
|
502
478
|
/* not JSON, keep default */
|
|
@@ -507,7 +483,6 @@ export class ChatAgent {
|
|
|
507
483
|
debugSteps,
|
|
508
484
|
graphTimings,
|
|
509
485
|
...(decisionQuestions !== undefined ? { decisionQuestions } : {}),
|
|
510
|
-
...(discoveryQuestionsDebug !== undefined ? { discoveryQuestionsDebug } : {}),
|
|
511
486
|
};
|
|
512
487
|
}
|
|
513
488
|
/**
|
|
@@ -566,9 +541,8 @@ export class ChatAgent {
|
|
|
566
541
|
*/
|
|
567
542
|
async streamRun(initialMessages, writer, signal) {
|
|
568
543
|
const llm = { calls: 0, totalDurationMs: 0, resets: [], hallucinations: [] };
|
|
569
|
-
const
|
|
544
|
+
const negotiationIds = new Set();
|
|
570
545
|
let lastLlmStart = 0;
|
|
571
|
-
let latestDiscoveryQuestionsDebug;
|
|
572
546
|
const emit = (event) => {
|
|
573
547
|
if (event.type === "llm_start") {
|
|
574
548
|
llm.calls += 1;
|
|
@@ -587,7 +561,7 @@ export class ChatAgent {
|
|
|
587
561
|
llm.hallucinations.push({ blockType: event.blockType, tool: event.tool, at: Date.now() });
|
|
588
562
|
}
|
|
589
563
|
else if (event.type === "negotiation_session_start") {
|
|
590
|
-
|
|
564
|
+
negotiationIds.add(event.opportunityId);
|
|
591
565
|
}
|
|
592
566
|
try {
|
|
593
567
|
writer?.(event);
|
|
@@ -743,8 +717,6 @@ export class ChatAgent {
|
|
|
743
717
|
const toolDurationMs = Date.now() - toolStart;
|
|
744
718
|
let resultStr = typeof result === "string" ? result : JSON.stringify(result);
|
|
745
719
|
const normalized = await this.normalizeToolResult(tc.name, resultStr, tc.args);
|
|
746
|
-
if (normalized.discoveryQuestionsDebug)
|
|
747
|
-
latestDiscoveryQuestionsDebug = normalized.discoveryQuestionsDebug;
|
|
748
720
|
resultStr = normalized.resultStr;
|
|
749
721
|
result = resultStr;
|
|
750
722
|
if (normalized.decisionQuestions && normalized.decisionQuestions.length > 0) {
|
|
@@ -835,8 +807,8 @@ export class ChatAgent {
|
|
|
835
807
|
// directly instead of calling the corresponding tool. These blocks
|
|
836
808
|
// lack valid proposalIds / data and won't work in the frontend.
|
|
837
809
|
// Auto-invoke the correct tool directly instead of re-asking the LLM.
|
|
838
|
-
// Persona-gated: only personas with hallucinationRecovery enabled
|
|
839
|
-
//
|
|
810
|
+
// Persona-gated: only personas with hallucinationRecovery enabled run
|
|
811
|
+
// detection/auto-invoke — other personas never trigger this branch.
|
|
840
812
|
const hallucinatedBlock = this.persona.loopBehaviors.hallucinationRecovery
|
|
841
813
|
? this.detectHallucinatedBlock(iterationText, toolsDebug, iterCtx.currentMessage)
|
|
842
814
|
: null;
|
|
@@ -887,9 +859,6 @@ export class ChatAgent {
|
|
|
887
859
|
// Mirror the main tool loop's handling: forward decision questions
|
|
888
860
|
// and capture debug metadata even when the discovery tool was invoked
|
|
889
861
|
// via the hallucination-recovery path.
|
|
890
|
-
if (normalized.discoveryQuestionsDebug) {
|
|
891
|
-
latestDiscoveryQuestionsDebug = normalized.discoveryQuestionsDebug;
|
|
892
|
-
}
|
|
893
862
|
if (normalized.decisionQuestions && normalized.decisionQuestions.length > 0) {
|
|
894
863
|
const { fresh: freshHallucination, newIds: newIdsHallucination } = deduplicateQuestions(normalized.decisionQuestions, surfacedQuestionIds);
|
|
895
864
|
if (freshHallucination.length > 0) {
|
|
@@ -1044,10 +1013,9 @@ export class ChatAgent {
|
|
|
1044
1013
|
iterations: iterationCount,
|
|
1045
1014
|
tools: toolsDebug,
|
|
1046
1015
|
llm,
|
|
1047
|
-
...(
|
|
1048
|
-
orchestratorNegotiations: { opportunityIds: [...
|
|
1016
|
+
...(negotiationIds.size > 0 && {
|
|
1017
|
+
orchestratorNegotiations: { opportunityIds: [...negotiationIds] },
|
|
1049
1018
|
}),
|
|
1050
|
-
...(latestDiscoveryQuestionsDebug && { discoveryQuestions: latestDiscoveryQuestionsDebug }),
|
|
1051
1019
|
},
|
|
1052
1020
|
};
|
|
1053
1021
|
}
|
|
@@ -1062,10 +1030,9 @@ export class ChatAgent {
|
|
|
1062
1030
|
iterations: iterationCount,
|
|
1063
1031
|
tools: toolsDebug,
|
|
1064
1032
|
llm,
|
|
1065
|
-
...(
|
|
1066
|
-
orchestratorNegotiations: { opportunityIds: [...
|
|
1033
|
+
...(negotiationIds.size > 0 && {
|
|
1034
|
+
orchestratorNegotiations: { opportunityIds: [...negotiationIds] },
|
|
1067
1035
|
}),
|
|
1068
|
-
...(latestDiscoveryQuestionsDebug && { discoveryQuestions: latestDiscoveryQuestionsDebug }),
|
|
1069
1036
|
},
|
|
1070
1037
|
};
|
|
1071
1038
|
}
|
|
@@ -1100,10 +1067,9 @@ export class ChatAgent {
|
|
|
1100
1067
|
iterations: iterationCount,
|
|
1101
1068
|
tools: toolsDebug,
|
|
1102
1069
|
llm,
|
|
1103
|
-
...(
|
|
1104
|
-
orchestratorNegotiations: { opportunityIds: [...
|
|
1070
|
+
...(negotiationIds.size > 0 && {
|
|
1071
|
+
orchestratorNegotiations: { opportunityIds: [...negotiationIds] },
|
|
1105
1072
|
}),
|
|
1106
|
-
...(latestDiscoveryQuestionsDebug && { discoveryQuestions: latestDiscoveryQuestionsDebug }),
|
|
1107
1073
|
},
|
|
1108
1074
|
};
|
|
1109
1075
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseCheckpointSaver } from "@langchain/langgraph";
|
|
2
2
|
import { BaseMessage } from "@langchain/core/messages";
|
|
3
|
-
import {
|
|
3
|
+
import type { ChatPersonaConfig } from "./chat.persona.js";
|
|
4
4
|
import type { ChatGraphCompositeDatabase } from "../shared/interfaces/database.interface.js";
|
|
5
5
|
import type { Embedder } from "../shared/interfaces/embedder.interface.js";
|
|
6
6
|
import type { Scraper } from "../shared/interfaces/scraper.interface.js";
|
|
@@ -27,12 +27,12 @@ export declare class ChatGraphFactory {
|
|
|
27
27
|
private scraper;
|
|
28
28
|
private chatSession;
|
|
29
29
|
private protocolDeps;
|
|
30
|
-
/** Persona driving this graph's agent loop.
|
|
30
|
+
/** Persona driving this graph's agent loop. Required — there is no default. */
|
|
31
31
|
private persona;
|
|
32
32
|
private streamingService;
|
|
33
33
|
constructor(database: ChatGraphCompositeDatabase, embedder: Embedder, scraper: Scraper, chatSession: ChatSessionReader, protocolDeps: ProtocolDeps,
|
|
34
|
-
/** Persona driving this graph's agent loop.
|
|
35
|
-
persona
|
|
34
|
+
/** Persona driving this graph's agent loop. Required — there is no default. */
|
|
35
|
+
persona: ChatPersonaConfig);
|
|
36
36
|
/**
|
|
37
37
|
* Returns a sibling factory sharing all dependencies but driven by a
|
|
38
38
|
* different persona. Used to derive per-session persona factories (e.g. the
|
|
@@ -181,7 +181,6 @@ export declare class ChatGraphFactory {
|
|
|
181
181
|
tools: import("./chat-streaming.types.js").DebugMetaToolCall[];
|
|
182
182
|
llm: import("./chat-streaming.types.js").DebugMetaLlm;
|
|
183
183
|
orchestratorNegotiations?: import("./chat-streaming.types.js").DebugMetaOrchestratorNegotiations;
|
|
184
|
-
discoveryQuestions?: import("./chat-streaming.types.js").DebugMetaDiscoveryQuestions;
|
|
185
184
|
};
|
|
186
185
|
error?: undefined;
|
|
187
186
|
} | {
|
|
@@ -332,7 +331,6 @@ export declare class ChatGraphFactory {
|
|
|
332
331
|
tools: import("./chat-streaming.types.js").DebugMetaToolCall[];
|
|
333
332
|
llm: import("./chat-streaming.types.js").DebugMetaLlm;
|
|
334
333
|
orchestratorNegotiations?: import("./chat-streaming.types.js").DebugMetaOrchestratorNegotiations;
|
|
335
|
-
discoveryQuestions?: import("./chat-streaming.types.js").DebugMetaDiscoveryQuestions;
|
|
336
334
|
};
|
|
337
335
|
error?: undefined;
|
|
338
336
|
} | {
|
package/dist/chat/chat.graph.js
CHANGED
|
@@ -2,7 +2,6 @@ import { StateGraph, START, END } from "@langchain/langgraph";
|
|
|
2
2
|
import { HumanMessage } from "@langchain/core/messages";
|
|
3
3
|
import { ChatGraphState } from "./chat.state.js";
|
|
4
4
|
import { ChatAgent } from "./chat.agent.js";
|
|
5
|
-
import { ORCHESTRATOR_PERSONA } from "./chat.persona.js";
|
|
6
5
|
import { protocolLogger } from "../shared/observability/protocol.logger.js";
|
|
7
6
|
import { truncateToTokenLimit, MAX_CONTEXT_TOKENS } from "./chat.utils.js";
|
|
8
7
|
import { ChatStreamer } from "./chat.streamer.js";
|
|
@@ -40,8 +39,8 @@ const RETRY_DELAY_MS = 800;
|
|
|
40
39
|
*/
|
|
41
40
|
export class ChatGraphFactory {
|
|
42
41
|
constructor(database, embedder, scraper, chatSession, protocolDeps,
|
|
43
|
-
/** Persona driving this graph's agent loop.
|
|
44
|
-
persona
|
|
42
|
+
/** Persona driving this graph's agent loop. Required — there is no default. */
|
|
43
|
+
persona) {
|
|
45
44
|
this.database = database;
|
|
46
45
|
this.embedder = embedder;
|
|
47
46
|
this.scraper = scraper;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ChatTools, ToolContext, ResolvedToolContext } from "../shared/agent/tool.factory.js";
|
|
2
2
|
import type { IterationContext } from "./chat.prompt.modules.js";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Behaviors that live in the agent loop itself (not in the prompt or toolset).
|
|
5
|
+
* Each persona opts in explicitly.
|
|
6
6
|
*/
|
|
7
7
|
export interface ChatPersonaLoopBehaviors {
|
|
8
8
|
/**
|
|
9
9
|
* Detect hallucinated ```opportunity / ```intent_proposal code blocks in model
|
|
10
10
|
* text, auto-invoke the corresponding tool, and strip unbacked blocks from the
|
|
11
11
|
* final response. Only meaningful for personas whose toolset can legitimately
|
|
12
|
-
* produce those blocks
|
|
12
|
+
* produce those blocks — enabled for onboarding, signal and negotiator, off
|
|
13
|
+
* for reporter.
|
|
13
14
|
*/
|
|
14
15
|
hallucinationRecovery: boolean;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* Persona configuration injected into `ChatAgent.create()`.
|
|
18
19
|
*
|
|
19
|
-
* A persona bundles the three
|
|
20
|
+
* A persona bundles the three persona-coupled seams of the chat runtime:
|
|
20
21
|
* system-prompt construction, toolset creation, and loop behaviors.
|
|
21
22
|
*/
|
|
22
23
|
export interface ChatPersonaConfig {
|
|
@@ -34,21 +35,6 @@ export interface ChatPersonaConfig {
|
|
|
34
35
|
* deterministic safety redirects derived entirely from iteration context.
|
|
35
36
|
*/
|
|
36
37
|
resolveDeterministicResponse?: (ctx: ResolvedToolContext, iterCtx: IterationContext) => string | null;
|
|
37
|
-
/**
|
|
38
|
+
/** Loop behaviors this persona opts into. */
|
|
38
39
|
loopBehaviors: ChatPersonaLoopBehaviors;
|
|
39
40
|
}
|
|
40
|
-
/** Persona id for the default orchestrator ("You are Index…"). */
|
|
41
|
-
export declare const ORCHESTRATOR_PERSONA_ID = "orchestrator";
|
|
42
|
-
/**
|
|
43
|
-
* The orchestrator persona — exactly the pre-personafication wiring:
|
|
44
|
-
* `buildSystemContent` from chat.prompt, `createChatTools` from tool.factory,
|
|
45
|
-
* and all loop behaviors enabled.
|
|
46
|
-
*
|
|
47
|
-
* Both functions delegate lazily (arrow wrappers) instead of capturing the
|
|
48
|
-
* imported symbols at module-load time. This preserves ESM live-binding
|
|
49
|
-
* semantics: the pre-refactor code read `createChatTools` through its import
|
|
50
|
-
* binding at call time, which is what lets test suites swap the module via
|
|
51
|
-
* `mock.module` — a snapshot in this object literal would pin whichever
|
|
52
|
-
* version was loaded first.
|
|
53
|
-
*/
|
|
54
|
-
export declare const ORCHESTRATOR_PERSONA: ChatPersonaConfig;
|
|
@@ -1,24 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { buildSystemContent } from "./chat.prompt.js";
|
|
3
|
-
/** Persona id for the default orchestrator ("You are Index…"). */
|
|
4
|
-
export const ORCHESTRATOR_PERSONA_ID = "orchestrator";
|
|
5
|
-
/**
|
|
6
|
-
* The orchestrator persona — exactly the pre-personafication wiring:
|
|
7
|
-
* `buildSystemContent` from chat.prompt, `createChatTools` from tool.factory,
|
|
8
|
-
* and all loop behaviors enabled.
|
|
9
|
-
*
|
|
10
|
-
* Both functions delegate lazily (arrow wrappers) instead of capturing the
|
|
11
|
-
* imported symbols at module-load time. This preserves ESM live-binding
|
|
12
|
-
* semantics: the pre-refactor code read `createChatTools` through its import
|
|
13
|
-
* binding at call time, which is what lets test suites swap the module via
|
|
14
|
-
* `mock.module` — a snapshot in this object literal would pin whichever
|
|
15
|
-
* version was loaded first.
|
|
16
|
-
*/
|
|
17
|
-
export const ORCHESTRATOR_PERSONA = {
|
|
18
|
-
id: ORCHESTRATOR_PERSONA_ID,
|
|
19
|
-
buildSystemContent: (ctx, iterCtx) => buildSystemContent(ctx, iterCtx),
|
|
20
|
-
createTools: (deps, preResolvedContext) => createChatTools(deps, preResolvedContext),
|
|
21
|
-
loopBehaviors: {
|
|
22
|
-
hallucinationRecovery: true,
|
|
23
|
-
},
|
|
24
|
-
};
|
|
1
|
+
export {};
|
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import type { ResolvedToolContext } from "../shared/agent/tool.factory.js";
|
|
2
|
-
import type { IterationContext } from "./chat.prompt.modules.js";
|
|
3
1
|
/**
|
|
4
2
|
* Nudge message injected after SOFT_ITERATION_LIMIT iterations.
|
|
5
3
|
*/
|
|
6
4
|
export declare const ITERATION_NUDGE = "[System Note: You've made several tool calls. Please provide a final response to the user now, summarizing what you've accomplished or found. If you need more information from the user, ask for it in your response.]";
|
|
7
|
-
/**
|
|
8
|
-
* Builds the full system prompt for the chat agent.
|
|
9
|
-
* Composes core, onboarding, scoping, and dynamic modules into a single
|
|
10
|
-
* prompt string. Without iterCtx only core sections are included; modules
|
|
11
|
-
* are omitted, producing a leaner first-iteration prompt.
|
|
12
|
-
*
|
|
13
|
-
* @param ctx - Resolved tool context for the current session
|
|
14
|
-
* @param iterCtx - Optional iteration context for dynamic module resolution
|
|
15
|
-
* @returns The complete system prompt string
|
|
16
|
-
*/
|
|
17
|
-
export declare function buildSystemContent(ctx: ResolvedToolContext, iterCtx?: IterationContext): string;
|