@indexnetwork/protocol 4.5.0-rc.327.1 → 4.5.0-rc.328.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/chat.graph.d.ts +10 -0
- package/dist/chat/chat.graph.d.ts.map +1 -1
- package/dist/chat/chat.graph.js +12 -0
- package/dist/chat/chat.graph.js.map +1 -1
- package/dist/chat/negotiator.persona.d.ts +49 -0
- package/dist/chat/negotiator.persona.d.ts.map +1 -0
- package/dist/chat/negotiator.persona.js +78 -0
- package/dist/chat/negotiator.persona.js.map +1 -0
- package/dist/chat/negotiator.prompt.d.ts +24 -0
- package/dist/chat/negotiator.prompt.d.ts.map +1 -0
- package/dist/chat/negotiator.prompt.js +71 -0
- package/dist/chat/negotiator.prompt.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -33,6 +33,16 @@ export declare class ChatGraphFactory {
|
|
|
33
33
|
constructor(database: ChatGraphCompositeDatabase, embedder: Embedder, scraper: Scraper, chatSession: ChatSessionReader, protocolDeps: ProtocolDeps,
|
|
34
34
|
/** Persona driving this graph's agent loop. Defaults to the orchestrator. */
|
|
35
35
|
persona?: ChatPersonaConfig);
|
|
36
|
+
/**
|
|
37
|
+
* Returns a sibling factory sharing all dependencies but driven by a
|
|
38
|
+
* different persona. Used to derive per-session persona factories (e.g. the
|
|
39
|
+
* negotiator, whose identity comes from the user's personal agent row) from
|
|
40
|
+
* the composition-root orchestrator factory without re-wiring deps.
|
|
41
|
+
*
|
|
42
|
+
* @param persona - The persona config for the derived factory
|
|
43
|
+
* @returns A new ChatGraphFactory with identical deps and the given persona
|
|
44
|
+
*/
|
|
45
|
+
withPersona(persona: ChatPersonaConfig): ChatGraphFactory;
|
|
36
46
|
/**
|
|
37
47
|
* Creates and compiles the Chat Graph without persistence.
|
|
38
48
|
* @returns Compiled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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAQ9D;;;;;;;OAOG;IACU,kBAAkB,CAC7B,SAAS,EAAE,MAAM,EACjB,WAAW,GAAE,MAAW,GACvB,OAAO,CAAC,WAAW,EAAE,CAAC;IAqCzB;;;OAGG;IACW,2BAA2B,CACvC,KAAK,EAAE;QACL,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,eAAe,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,WAAW,GAAG,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACzE,yFAAyF;QACzF,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,EACD,YAAY,CAAC,EAAE,mBAAmB,EAClC,MAAM,CAAC,EAAE,WAAW;IAKtB;;;OAGG;IACW,gBAAgB,CAC5B,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,WAAW,EAAE,CAAA;KAAE,EAClD,SAAS,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,mBAAmB,EAClC,MAAM,CAAC,EAAE,WAAW;IAKtB;;;OAGG;IACH,OAAO,CAAC,UAAU;CAgJnB"}
|
package/dist/chat/chat.graph.js
CHANGED
|
@@ -50,6 +50,18 @@ export class ChatGraphFactory {
|
|
|
50
50
|
this.persona = persona;
|
|
51
51
|
this.streamingService = new ChatStreamer((sessionId, maxMessages) => this.loadSessionContext(sessionId, maxMessages), (checkpointer) => this.createStreamingGraph(checkpointer));
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Returns a sibling factory sharing all dependencies but driven by a
|
|
55
|
+
* different persona. Used to derive per-session persona factories (e.g. the
|
|
56
|
+
* negotiator, whose identity comes from the user's personal agent row) from
|
|
57
|
+
* the composition-root orchestrator factory without re-wiring deps.
|
|
58
|
+
*
|
|
59
|
+
* @param persona - The persona config for the derived factory
|
|
60
|
+
* @returns A new ChatGraphFactory with identical deps and the given persona
|
|
61
|
+
*/
|
|
62
|
+
withPersona(persona) {
|
|
63
|
+
return new ChatGraphFactory(this.database, this.embedder, this.scraper, this.chatSession, this.protocolDeps, persona);
|
|
64
|
+
}
|
|
53
65
|
/**
|
|
54
66
|
* Creates and compiles the Chat Graph without persistence.
|
|
55
67
|
* @returns Compiled StateGraph ready for invocation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.graph.js","sourceRoot":"/","sources":["chat/chat.graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAqD,MAAM,sBAAsB,CAAC;AACjH,OAAO,EAAe,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAA0B,MAAM,mBAAmB,CAAC;AAIjF,OAAO,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAC;AAG5E,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,wCAAwC,CAAC;AAE/D,MAAM,MAAM,GAAG,cAAc,CAAC,kBAAkB,CAAC,CAAC;AAElD,SAAS,gBAAgB,CAAC,GAAY;IACpC,MAAM,MAAM,GACT,GAA2B,CAAC,MAAM,IAAK,GAA+B,CAAC,UAAU,CAAC;IACrF,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,GAAG,IAAI,MAAM,IAAI,GAAG;QAAE,OAAO,IAAI,CAAC;IAC9E,MAA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;wBAClG,cAAc,EAAE,KAAK;qBACtB,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,4EAA4E;QAC5E,iBAAiB;QACjB,4EAA4E;QAE5E,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,cAAc,CAAC;aAC5C,OAAO,CAAC,YAAY,EAAE,aAAa,CAAC;aACpC,OAAO,CAAC,KAAK,EAAE,YAAY,CAAC;aAC5B,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;QAE9B,MAAM,CAAC,OAAO,CAAC,oDAAoD,CAAC,CAAC;QACrE,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF","sourcesContent":["import { StateGraph, START, END, BaseCheckpointSaver, type LangGraphRunnableConfig } from \"@langchain/langgraph\";\nimport { BaseMessage, HumanMessage } from \"@langchain/core/messages\";\nimport { ChatGraphState } from \"./chat.state.js\";\nimport { ChatAgent } from \"./chat.agent.js\";\nimport { ORCHESTRATOR_PERSONA, type ChatPersonaConfig } from \"./chat.persona.js\";\nimport type { ChatGraphCompositeDatabase } from \"../shared/interfaces/database.interface.js\";\nimport type { Embedder } from \"../shared/interfaces/embedder.interface.js\";\nimport type { Scraper } from \"../shared/interfaces/scraper.interface.js\";\nimport { protocolLogger } from \"../shared/observability/protocol.logger.js\";\nimport type { ChatSessionReader } from \"../shared/interfaces/chat-session.interface.js\";\nimport type { ProtocolDeps } from \"../shared/agent/tool.helpers.js\";\nimport { truncateToTokenLimit, MAX_CONTEXT_TOKENS } from \"./chat.utils.js\";\nimport { ChatStreamer } from \"./chat.streamer.js\";\nimport { timed } from \"../shared/observability/performance.js\";\n\nconst logger = protocolLogger(\"ChatGraphFactory\");\n\nfunction isRetriableError(err: unknown): boolean {\n const status =\n (err as { status?: number }).status ?? (err as { statusCode?: number }).statusCode;\n if (typeof status === \"number\" && status >= 500 && status <= 599) return true;\n const msg = err instanceof Error ? err.message : String(err);\n const lower = msg.toLowerCase();\n return (\n lower.includes(\"internal server error\") ||\n /\\b500\\b|status[: ]*500/i.test(msg) ||\n lower.includes(\"econnreset\") ||\n lower.includes(\"etimedout\")\n );\n}\n\nconst RETRY_DELAY_MS = 800;\n\n// ══════════════════════════════════════════════════════════════════════════════\n// CHAT GRAPH FACTORY (Agent Loop Architecture)\n// ══════════════════════════════════════════════════════════════════════════════\n\n/**\n * Factory class to build and compile the Chat Graph.\n * \n * Architecture: ReAct-Style Agent Loop\n * \n * The graph contains a single node that runs an agent loop:\n * 1. Agent receives messages (conversation + tool results)\n * 2. Agent decides: call tools OR respond to user\n * 3. If tools called → execute → add results → loop back\n * 4. If response → exit loop → stream to user\n * \n * This replaces the previous 17-node conditional routing architecture\n * with a flexible, LLM-driven approach that can handle multi-step\n * reasoning and self-correction.\n */\nexport class ChatGraphFactory {\n private streamingService: ChatStreamer;\n\n constructor(\n private database: ChatGraphCompositeDatabase,\n private embedder: Embedder,\n private scraper: Scraper,\n private chatSession: ChatSessionReader,\n private protocolDeps: ProtocolDeps,\n /** Persona driving this graph's agent loop. Defaults to the orchestrator. */\n private persona: ChatPersonaConfig = ORCHESTRATOR_PERSONA,\n ) {\n this.streamingService = new ChatStreamer(\n (sessionId, maxMessages) => this.loadSessionContext(sessionId, maxMessages),\n (checkpointer) => this.createStreamingGraph(checkpointer)\n );\n }\n\n /**\n * Creates and compiles the Chat Graph without persistence.\n * @returns Compiled StateGraph ready for invocation\n */\n public createGraph() {\n return this.buildGraph().compile();\n }\n\n /**\n * Creates a streaming-enabled graph with optional checkpointer for persistence.\n * @param checkpointer - Optional checkpointer (e.g., MemorySaver or PostgresSaver)\n * @returns Compiled StateGraph ready for streaming\n */\n public createStreamingGraph(checkpointer?: BaseCheckpointSaver) {\n const graph = this.buildGraph();\n if (checkpointer) {\n return graph.compile({ checkpointer });\n }\n return graph.compile();\n }\n\n /**\n * Load previous messages from a session and convert to LangChain messages.\n * Handles token truncation to fit within context window limits.\n *\n * @param sessionId - The session ID to load context from\n * @param maxMessages - Maximum number of messages to load (default: 20)\n * @returns Array of LangChain BaseMessage objects\n */\n public async loadSessionContext(\n sessionId: string,\n maxMessages: number = 20\n ): Promise<BaseMessage[]> {\n logger.verbose(\"Loading session context\", {\n sessionId,\n maxMessages,\n });\n\n try {\n const messages = await this.chatSession.getSessionMessages(sessionId, maxMessages);\n\n if (messages.length === 0) {\n logger.verbose(\"No previous messages found\", { sessionId });\n return [];\n }\n\n // Convert database messages to LangChain format.\n // All roles map to HumanMessage to avoid circular dependency.\n const langchainMessages = messages.map((msg) => new HumanMessage(msg.content));\n\n // Truncate to fit within token limits\n const truncatedMessages = truncateToTokenLimit(langchainMessages, MAX_CONTEXT_TOKENS);\n\n logger.verbose(\"Context loaded\", {\n sessionId,\n originalCount: messages.length,\n truncatedCount: truncatedMessages.length,\n });\n return truncatedMessages;\n } catch (error) {\n logger.error(\"Failed to load context\", {\n sessionId,\n error: error instanceof Error ? error.message : String(error),\n });\n // Return empty array on error - don't fail the entire request\n return [];\n }\n }\n\n /**\n * Streams chat events with full session context.\n * Delegates to ChatGraphStreamingService.\n */\n public async *streamChatEventsWithContext(\n input: {\n userId: string;\n message: string;\n sessionId: string;\n maxContextMessages?: number;\n networkId?: string;\n prefillMessages?: Array<{ role: \"assistant\" | \"user\"; content: string }>;\n /** Per-run identifier used to form a composite LangGraph thread_id (sessionId:runId). */\n runId?: string;\n },\n checkpointer?: BaseCheckpointSaver,\n signal?: AbortSignal,\n ) {\n yield* this.streamingService.streamChatEventsWithContext(input, checkpointer, signal);\n }\n\n /**\n * Streams chat events from the graph execution.\n * Delegates to ChatGraphStreamingService.\n */\n public async *streamChatEvents(\n input: { userId: string; messages: BaseMessage[] },\n sessionId: string,\n checkpointer?: BaseCheckpointSaver,\n signal?: AbortSignal,\n ) {\n yield* this.streamingService.streamChatEvents(input, sessionId, checkpointer, signal);\n }\n\n /**\n * Internal method to build the graph structure.\n * @returns Uncompiled StateGraph\n */\n private buildGraph() {\n const database = this.database;\n const embedder = this.embedder;\n const scraper = this.scraper;\n const protocolDeps = this.protocolDeps;\n const persona = this.persona;\n\n // ─────────────────────────────────────────────────────────────────────────\n // AGENT LOOP NODE\n // ─────────────────────────────────────────────────────────────────────────\n\n /**\n * The main agent loop node.\n * Runs a ReAct-style agent that calls tools until it decides to respond.\n *\n * Uses `agent.streamRun()` + `config.writer` so that text tokens and\n * tool-activity events are pushed into the graph's custom stream in\n * real-time rather than batched at the end.\n */\n const agentLoopNode = async (\n state: typeof ChatGraphState.State,\n config: LangGraphRunnableConfig\n ) => {\n return timed(\"ChatGraph.agentLoop\", async () => {\n logger.verbose(\"Agent loop starting\", {\n userId: state.userId,\n messageCount: state.messages.length,\n currentIteration: state.iterationCount\n });\n\n const runLoop = async () => {\n const legacyNetworkId = state.networkId;\n const scopeType = state.scopeType ?? (legacyNetworkId ? 'network' as const : undefined);\n const scopeId = state.scopeId ?? legacyNetworkId;\n const agent = await ChatAgent.create({\n ...protocolDeps,\n userId: state.userId,\n database,\n embedder,\n scraper,\n ...(legacyNetworkId ? { networkId: legacyNetworkId } : {}),\n ...(scopeType && scopeId ? { scopeType, scopeId } : {}),\n sessionId: state.sessionId,\n } as import(\"../shared/agent/tool.helpers.js\").ToolContext, persona);\n // Direct streaming writer - emit events immediately instead of buffering\n const directWriter = (data: unknown) => {\n try {\n config.writer?.(data);\n } catch {\n /* swallow if writer is gone */\n }\n };\n // Get signal from configurable (passed by streamer via graph.stream() config)\n const signal = config.configurable?.signal as AbortSignal | undefined;\n const result = await agent.streamRun(state.messages, directWriter, signal);\n return result;\n };\n\n try {\n const result = await runLoop();\n logger.debug(\"Agent streamRun result\", {\n responseText: result.responseText,\n iterationCount: result.iterationCount,\n messageCount: result.messages.length,\n });\n logger.verbose(\"Agent loop complete\", {\n userId: state.userId,\n iterations: result.iterationCount,\n responseLength: result.responseText.length\n });\n return {\n messages: result.messages,\n responseText: result.responseText,\n iterationCount: result.iterationCount,\n shouldContinue: false,\n debugMeta: result.debugMeta,\n };\n } catch (error) {\n if (isRetriableError(error)) {\n const signal = config.configurable?.signal as AbortSignal | undefined;\n if (signal?.aborted) {\n return {\n error: \"Request aborted\",\n responseText: \"\",\n shouldContinue: false,\n };\n }\n logger.warn(\"Agent loop failed with retriable error, retrying once\", {\n userId: state.userId,\n error: error instanceof Error ? error.message : String(error)\n });\n await new Promise((r) => setTimeout(r, RETRY_DELAY_MS));\n try {\n const result = await runLoop();\n logger.verbose(\"Agent loop complete after retry\", {\n userId: state.userId,\n iterations: result.iterationCount,\n });\n return {\n messages: result.messages,\n responseText: result.responseText,\n iterationCount: result.iterationCount,\n shouldContinue: false,\n debugMeta: result.debugMeta,\n };\n } catch (retryError) {\n logger.error(\"Agent loop failed on retry\", {\n userId: state.userId,\n error: retryError instanceof Error ? retryError.message : String(retryError)\n });\n return {\n error: retryError instanceof Error ? retryError.message : \"Agent loop failed\",\n responseText: \"I apologize, but I encountered an issue processing your request. Please try again.\",\n shouldContinue: false\n };\n }\n }\n\n logger.error(\"Agent loop failed\", {\n userId: state.userId,\n error: error instanceof Error ? error.message : String(error)\n });\n\n return {\n error: error instanceof Error ? error.message : \"Agent loop failed\",\n responseText: \"I apologize, but I encountered an issue processing your request. Please try again.\",\n shouldContinue: false\n };\n }\n });\n };\n\n // ─────────────────────────────────────────────────────────────────────────\n // GRAPH ASSEMBLY\n // ─────────────────────────────────────────────────────────────────────────\n\n const workflow = new StateGraph(ChatGraphState)\n .addNode(\"agent_loop\", agentLoopNode)\n .addEdge(START, \"agent_loop\")\n .addEdge(\"agent_loop\", END);\n\n logger.verbose(\"Graph built successfully (agent loop architecture)\");\n return workflow;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chat.graph.js","sourceRoot":"/","sources":["chat/chat.graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAqD,MAAM,sBAAsB,CAAC;AACjH,OAAO,EAAe,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,cAAc,EA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AAC,CAAC;QACrE,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF","sourcesContent":["import { StateGraph, START, END, BaseCheckpointSaver, type LangGraphRunnableConfig } from \"@langchain/langgraph\";\nimport { BaseMessage, HumanMessage } from \"@langchain/core/messages\";\nimport { ChatGraphState } from \"./chat.state.js\";\nimport { ChatAgent } from \"./chat.agent.js\";\nimport { ORCHESTRATOR_PERSONA, type ChatPersonaConfig } from \"./chat.persona.js\";\nimport type { ChatGraphCompositeDatabase } from \"../shared/interfaces/database.interface.js\";\nimport type { Embedder } from \"../shared/interfaces/embedder.interface.js\";\nimport type { Scraper } from \"../shared/interfaces/scraper.interface.js\";\nimport { protocolLogger } from \"../shared/observability/protocol.logger.js\";\nimport type { ChatSessionReader } from \"../shared/interfaces/chat-session.interface.js\";\nimport type { ProtocolDeps } from \"../shared/agent/tool.helpers.js\";\nimport { truncateToTokenLimit, MAX_CONTEXT_TOKENS } from \"./chat.utils.js\";\nimport { ChatStreamer } from \"./chat.streamer.js\";\nimport { timed } from \"../shared/observability/performance.js\";\n\nconst logger = protocolLogger(\"ChatGraphFactory\");\n\nfunction isRetriableError(err: unknown): boolean {\n const status =\n (err as { status?: number }).status ?? (err as { statusCode?: number }).statusCode;\n if (typeof status === \"number\" && status >= 500 && status <= 599) return true;\n const msg = err instanceof Error ? err.message : String(err);\n const lower = msg.toLowerCase();\n return (\n lower.includes(\"internal server error\") ||\n /\\b500\\b|status[: ]*500/i.test(msg) ||\n lower.includes(\"econnreset\") ||\n lower.includes(\"etimedout\")\n );\n}\n\nconst RETRY_DELAY_MS = 800;\n\n// ══════════════════════════════════════════════════════════════════════════════\n// CHAT GRAPH FACTORY (Agent Loop Architecture)\n// ══════════════════════════════════════════════════════════════════════════════\n\n/**\n * Factory class to build and compile the Chat Graph.\n * \n * Architecture: ReAct-Style Agent Loop\n * \n * The graph contains a single node that runs an agent loop:\n * 1. Agent receives messages (conversation + tool results)\n * 2. Agent decides: call tools OR respond to user\n * 3. If tools called → execute → add results → loop back\n * 4. If response → exit loop → stream to user\n * \n * This replaces the previous 17-node conditional routing architecture\n * with a flexible, LLM-driven approach that can handle multi-step\n * reasoning and self-correction.\n */\nexport class ChatGraphFactory {\n private streamingService: ChatStreamer;\n\n constructor(\n private database: ChatGraphCompositeDatabase,\n private embedder: Embedder,\n private scraper: Scraper,\n private chatSession: ChatSessionReader,\n private protocolDeps: ProtocolDeps,\n /** Persona driving this graph's agent loop. Defaults to the orchestrator. */\n private persona: ChatPersonaConfig = ORCHESTRATOR_PERSONA,\n ) {\n this.streamingService = new ChatStreamer(\n (sessionId, maxMessages) => this.loadSessionContext(sessionId, maxMessages),\n (checkpointer) => this.createStreamingGraph(checkpointer)\n );\n }\n\n /**\n * Returns a sibling factory sharing all dependencies but driven by a\n * different persona. Used to derive per-session persona factories (e.g. the\n * negotiator, whose identity comes from the user's personal agent row) from\n * the composition-root orchestrator factory without re-wiring deps.\n *\n * @param persona - The persona config for the derived factory\n * @returns A new ChatGraphFactory with identical deps and the given persona\n */\n public withPersona(persona: ChatPersonaConfig): ChatGraphFactory {\n return new ChatGraphFactory(\n this.database,\n this.embedder,\n this.scraper,\n this.chatSession,\n this.protocolDeps,\n persona,\n );\n }\n\n /**\n * Creates and compiles the Chat Graph without persistence.\n * @returns Compiled StateGraph ready for invocation\n */\n public createGraph() {\n return this.buildGraph().compile();\n }\n\n /**\n * Creates a streaming-enabled graph with optional checkpointer for persistence.\n * @param checkpointer - Optional checkpointer (e.g., MemorySaver or PostgresSaver)\n * @returns Compiled StateGraph ready for streaming\n */\n public createStreamingGraph(checkpointer?: BaseCheckpointSaver) {\n const graph = this.buildGraph();\n if (checkpointer) {\n return graph.compile({ checkpointer });\n }\n return graph.compile();\n }\n\n /**\n * Load previous messages from a session and convert to LangChain messages.\n * Handles token truncation to fit within context window limits.\n *\n * @param sessionId - The session ID to load context from\n * @param maxMessages - Maximum number of messages to load (default: 20)\n * @returns Array of LangChain BaseMessage objects\n */\n public async loadSessionContext(\n sessionId: string,\n maxMessages: number = 20\n ): Promise<BaseMessage[]> {\n logger.verbose(\"Loading session context\", {\n sessionId,\n maxMessages,\n });\n\n try {\n const messages = await this.chatSession.getSessionMessages(sessionId, maxMessages);\n\n if (messages.length === 0) {\n logger.verbose(\"No previous messages found\", { sessionId });\n return [];\n }\n\n // Convert database messages to LangChain format.\n // All roles map to HumanMessage to avoid circular dependency.\n const langchainMessages = messages.map((msg) => new HumanMessage(msg.content));\n\n // Truncate to fit within token limits\n const truncatedMessages = truncateToTokenLimit(langchainMessages, MAX_CONTEXT_TOKENS);\n\n logger.verbose(\"Context loaded\", {\n sessionId,\n originalCount: messages.length,\n truncatedCount: truncatedMessages.length,\n });\n return truncatedMessages;\n } catch (error) {\n logger.error(\"Failed to load context\", {\n sessionId,\n error: error instanceof Error ? error.message : String(error),\n });\n // Return empty array on error - don't fail the entire request\n return [];\n }\n }\n\n /**\n * Streams chat events with full session context.\n * Delegates to ChatGraphStreamingService.\n */\n public async *streamChatEventsWithContext(\n input: {\n userId: string;\n message: string;\n sessionId: string;\n maxContextMessages?: number;\n networkId?: string;\n prefillMessages?: Array<{ role: \"assistant\" | \"user\"; content: string }>;\n /** Per-run identifier used to form a composite LangGraph thread_id (sessionId:runId). */\n runId?: string;\n },\n checkpointer?: BaseCheckpointSaver,\n signal?: AbortSignal,\n ) {\n yield* this.streamingService.streamChatEventsWithContext(input, checkpointer, signal);\n }\n\n /**\n * Streams chat events from the graph execution.\n * Delegates to ChatGraphStreamingService.\n */\n public async *streamChatEvents(\n input: { userId: string; messages: BaseMessage[] },\n sessionId: string,\n checkpointer?: BaseCheckpointSaver,\n signal?: AbortSignal,\n ) {\n yield* this.streamingService.streamChatEvents(input, sessionId, checkpointer, signal);\n }\n\n /**\n * Internal method to build the graph structure.\n * @returns Uncompiled StateGraph\n */\n private buildGraph() {\n const database = this.database;\n const embedder = this.embedder;\n const scraper = this.scraper;\n const protocolDeps = this.protocolDeps;\n const persona = this.persona;\n\n // ─────────────────────────────────────────────────────────────────────────\n // AGENT LOOP NODE\n // ─────────────────────────────────────────────────────────────────────────\n\n /**\n * The main agent loop node.\n * Runs a ReAct-style agent that calls tools until it decides to respond.\n *\n * Uses `agent.streamRun()` + `config.writer` so that text tokens and\n * tool-activity events are pushed into the graph's custom stream in\n * real-time rather than batched at the end.\n */\n const agentLoopNode = async (\n state: typeof ChatGraphState.State,\n config: LangGraphRunnableConfig\n ) => {\n return timed(\"ChatGraph.agentLoop\", async () => {\n logger.verbose(\"Agent loop starting\", {\n userId: state.userId,\n messageCount: state.messages.length,\n currentIteration: state.iterationCount\n });\n\n const runLoop = async () => {\n const legacyNetworkId = state.networkId;\n const scopeType = state.scopeType ?? (legacyNetworkId ? 'network' as const : undefined);\n const scopeId = state.scopeId ?? legacyNetworkId;\n const agent = await ChatAgent.create({\n ...protocolDeps,\n userId: state.userId,\n database,\n embedder,\n scraper,\n ...(legacyNetworkId ? { networkId: legacyNetworkId } : {}),\n ...(scopeType && scopeId ? { scopeType, scopeId } : {}),\n sessionId: state.sessionId,\n } as import(\"../shared/agent/tool.helpers.js\").ToolContext, persona);\n // Direct streaming writer - emit events immediately instead of buffering\n const directWriter = (data: unknown) => {\n try {\n config.writer?.(data);\n } catch {\n /* swallow if writer is gone */\n }\n };\n // Get signal from configurable (passed by streamer via graph.stream() config)\n const signal = config.configurable?.signal as AbortSignal | undefined;\n const result = await agent.streamRun(state.messages, directWriter, signal);\n return result;\n };\n\n try {\n const result = await runLoop();\n logger.debug(\"Agent streamRun result\", {\n responseText: result.responseText,\n iterationCount: result.iterationCount,\n messageCount: result.messages.length,\n });\n logger.verbose(\"Agent loop complete\", {\n userId: state.userId,\n iterations: result.iterationCount,\n responseLength: result.responseText.length\n });\n return {\n messages: result.messages,\n responseText: result.responseText,\n iterationCount: result.iterationCount,\n shouldContinue: false,\n debugMeta: result.debugMeta,\n };\n } catch (error) {\n if (isRetriableError(error)) {\n const signal = config.configurable?.signal as AbortSignal | undefined;\n if (signal?.aborted) {\n return {\n error: \"Request aborted\",\n responseText: \"\",\n shouldContinue: false,\n };\n }\n logger.warn(\"Agent loop failed with retriable error, retrying once\", {\n userId: state.userId,\n error: error instanceof Error ? error.message : String(error)\n });\n await new Promise((r) => setTimeout(r, RETRY_DELAY_MS));\n try {\n const result = await runLoop();\n logger.verbose(\"Agent loop complete after retry\", {\n userId: state.userId,\n iterations: result.iterationCount,\n });\n return {\n messages: result.messages,\n responseText: result.responseText,\n iterationCount: result.iterationCount,\n shouldContinue: false,\n debugMeta: result.debugMeta,\n };\n } catch (retryError) {\n logger.error(\"Agent loop failed on retry\", {\n userId: state.userId,\n error: retryError instanceof Error ? retryError.message : String(retryError)\n });\n return {\n error: retryError instanceof Error ? retryError.message : \"Agent loop failed\",\n responseText: \"I apologize, but I encountered an issue processing your request. Please try again.\",\n shouldContinue: false\n };\n }\n }\n\n logger.error(\"Agent loop failed\", {\n userId: state.userId,\n error: error instanceof Error ? error.message : String(error)\n });\n\n return {\n error: error instanceof Error ? error.message : \"Agent loop failed\",\n responseText: \"I apologize, but I encountered an issue processing your request. Please try again.\",\n shouldContinue: false\n };\n }\n });\n };\n\n // ─────────────────────────────────────────────────────────────────────────\n // GRAPH ASSEMBLY\n // ─────────────────────────────────────────────────────────────────────────\n\n const workflow = new StateGraph(ChatGraphState)\n .addNode(\"agent_loop\", agentLoopNode)\n .addEdge(START, \"agent_loop\")\n .addEdge(\"agent_loop\", END);\n\n logger.verbose(\"Graph built successfully (agent loop architecture)\");\n return workflow;\n }\n}\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ChatTools, type ToolContext, type ResolvedToolContext } from "../shared/agent/tool.factory.js";
|
|
2
|
+
import type { ChatPersonaConfig } from "./chat.persona.js";
|
|
3
|
+
import { type NegotiatorPromptOptions } from "./negotiator.prompt.js";
|
|
4
|
+
/**
|
|
5
|
+
* Persona id for the user's personal negotiator. Matches the
|
|
6
|
+
* `conversations.persona` column value for negotiator DM sessions.
|
|
7
|
+
*/
|
|
8
|
+
export declare const NEGOTIATOR_PERSONA_ID = "negotiator";
|
|
9
|
+
/**
|
|
10
|
+
* Client-scoped tool allowlist for the negotiator persona.
|
|
11
|
+
*
|
|
12
|
+
* Deliberately excludes every network-facing capability: no discovery
|
|
13
|
+
* (`discover_opportunities`), no network/membership management, no profile or
|
|
14
|
+
* intent writes, no contact import. This agent works for one client; as the
|
|
15
|
+
* orchestrator sunsets, network-facing capabilities migrate here deliberately
|
|
16
|
+
* (out of scope for P4.1).
|
|
17
|
+
*/
|
|
18
|
+
export declare const NEGOTIATOR_TOOL_NAMES: readonly ["list_negotiations", "get_negotiation", "respond_to_negotiation", "list_opportunities", "read_intents", "read_premises"];
|
|
19
|
+
/**
|
|
20
|
+
* Filters a full chat-tool registry down to the negotiator allowlist.
|
|
21
|
+
* Exported separately so the scoping rule is unit-testable without
|
|
22
|
+
* constructing the full tool factory dependency graph.
|
|
23
|
+
*/
|
|
24
|
+
export declare function filterNegotiatorTools<T extends {
|
|
25
|
+
name: string;
|
|
26
|
+
}>(tools: T[]): T[];
|
|
27
|
+
/**
|
|
28
|
+
* Creates the negotiator persona's client-scoped toolset.
|
|
29
|
+
*
|
|
30
|
+
* Reuses the standard chat tool factory (so context resolution, scope
|
|
31
|
+
* derivation, logging, and error handling stay identical) and filters the
|
|
32
|
+
* registry to the allowlist. The negotiation tools are already context-bound
|
|
33
|
+
* to `context.userId`, so every tool in this set can only read or act on the
|
|
34
|
+
* calling client's own data.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createNegotiatorTools(deps: ToolContext, preResolvedContext?: ResolvedToolContext): Promise<ChatTools>;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a negotiator `ChatPersonaConfig` bound to the client's personal
|
|
39
|
+
* negotiator agent row identity.
|
|
40
|
+
*
|
|
41
|
+
* Loop behaviors are all OFF: no create-intent callback and no
|
|
42
|
+
* hallucinated-block auto-invoke/strip — the negotiator's toolset cannot
|
|
43
|
+
* legitimately produce opportunity/intent-proposal blocks, and it must never
|
|
44
|
+
* inherit the orchestrator's discovery auto-invocation.
|
|
45
|
+
*
|
|
46
|
+
* @param opts - Identity from the user's `type='personal'` agent row
|
|
47
|
+
*/
|
|
48
|
+
export declare function createNegotiatorPersona(opts: NegotiatorPromptOptions): ChatPersonaConfig;
|
|
49
|
+
//# sourceMappingURL=negotiator.persona.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negotiator.persona.d.ts","sourceRoot":"/","sources":["chat/negotiator.persona.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,KAAK,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC9H,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAgC,KAAK,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAYpG;;;GAGG;AACH,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAElD;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,oIAOxB,CAAC;AAIX;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEjF;AAED;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,WAAW,EACjB,kBAAkB,CAAC,EAAE,mBAAmB,GACvC,OAAO,CAAC,SAAS,CAAC,CAGpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,uBAAuB,GAAG,iBAAiB,CAUxF"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { createChatTools } from "../shared/agent/tool.factory.js";
|
|
2
|
+
import { buildNegotiatorSystemContent } from "./negotiator.prompt.js";
|
|
3
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
4
|
+
// NEGOTIATOR PERSONA (P4.1)
|
|
5
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
6
|
+
//
|
|
7
|
+
// A pure persona addition on the P4.0 persona-neutral chat runtime: advocate
|
|
8
|
+
// prompt, client-scoped toolset, and all orchestrator loop behaviors OFF.
|
|
9
|
+
// Unlike the orchestrator (a static singleton), the negotiator persona is
|
|
10
|
+
// created per session because its identity comes from the user's
|
|
11
|
+
// `type='personal'` agent row (name/description).
|
|
12
|
+
/**
|
|
13
|
+
* Persona id for the user's personal negotiator. Matches the
|
|
14
|
+
* `conversations.persona` column value for negotiator DM sessions.
|
|
15
|
+
*/
|
|
16
|
+
export const NEGOTIATOR_PERSONA_ID = "negotiator";
|
|
17
|
+
/**
|
|
18
|
+
* Client-scoped tool allowlist for the negotiator persona.
|
|
19
|
+
*
|
|
20
|
+
* Deliberately excludes every network-facing capability: no discovery
|
|
21
|
+
* (`discover_opportunities`), no network/membership management, no profile or
|
|
22
|
+
* intent writes, no contact import. This agent works for one client; as the
|
|
23
|
+
* orchestrator sunsets, network-facing capabilities migrate here deliberately
|
|
24
|
+
* (out of scope for P4.1).
|
|
25
|
+
*/
|
|
26
|
+
export const NEGOTIATOR_TOOL_NAMES = [
|
|
27
|
+
"list_negotiations",
|
|
28
|
+
"get_negotiation",
|
|
29
|
+
"respond_to_negotiation",
|
|
30
|
+
"list_opportunities",
|
|
31
|
+
"read_intents",
|
|
32
|
+
"read_premises",
|
|
33
|
+
];
|
|
34
|
+
const NEGOTIATOR_TOOL_ALLOWLIST = new Set(NEGOTIATOR_TOOL_NAMES);
|
|
35
|
+
/**
|
|
36
|
+
* Filters a full chat-tool registry down to the negotiator allowlist.
|
|
37
|
+
* Exported separately so the scoping rule is unit-testable without
|
|
38
|
+
* constructing the full tool factory dependency graph.
|
|
39
|
+
*/
|
|
40
|
+
export function filterNegotiatorTools(tools) {
|
|
41
|
+
return tools.filter((t) => NEGOTIATOR_TOOL_ALLOWLIST.has(t.name));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Creates the negotiator persona's client-scoped toolset.
|
|
45
|
+
*
|
|
46
|
+
* Reuses the standard chat tool factory (so context resolution, scope
|
|
47
|
+
* derivation, logging, and error handling stay identical) and filters the
|
|
48
|
+
* registry to the allowlist. The negotiation tools are already context-bound
|
|
49
|
+
* to `context.userId`, so every tool in this set can only read or act on the
|
|
50
|
+
* calling client's own data.
|
|
51
|
+
*/
|
|
52
|
+
export async function createNegotiatorTools(deps, preResolvedContext) {
|
|
53
|
+
const tools = await createChatTools(deps, preResolvedContext);
|
|
54
|
+
return filterNegotiatorTools(tools);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Creates a negotiator `ChatPersonaConfig` bound to the client's personal
|
|
58
|
+
* negotiator agent row identity.
|
|
59
|
+
*
|
|
60
|
+
* Loop behaviors are all OFF: no create-intent callback and no
|
|
61
|
+
* hallucinated-block auto-invoke/strip — the negotiator's toolset cannot
|
|
62
|
+
* legitimately produce opportunity/intent-proposal blocks, and it must never
|
|
63
|
+
* inherit the orchestrator's discovery auto-invocation.
|
|
64
|
+
*
|
|
65
|
+
* @param opts - Identity from the user's `type='personal'` agent row
|
|
66
|
+
*/
|
|
67
|
+
export function createNegotiatorPersona(opts) {
|
|
68
|
+
return {
|
|
69
|
+
id: NEGOTIATOR_PERSONA_ID,
|
|
70
|
+
buildSystemContent: (ctx, iterCtx) => buildNegotiatorSystemContent(ctx, opts, iterCtx),
|
|
71
|
+
createTools: (deps, preResolvedContext) => createNegotiatorTools(deps, preResolvedContext),
|
|
72
|
+
loopBehaviors: {
|
|
73
|
+
createIntentCallback: false,
|
|
74
|
+
hallucinationRecovery: false,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=negotiator.persona.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negotiator.persona.js","sourceRoot":"/","sources":["chat/negotiator.persona.ts"],"names":[],"mappings":"AAAA,OAAO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AC;QAC1F,aAAa,EAAE;YACb,oBAAoB,EAAE,KAAK;YAC3B,qBAAqB,EAAE,KAAK;SAC7B;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { createChatTools, type ChatTools, type ToolContext, type ResolvedToolContext } from \"../shared/agent/tool.factory.js\";\nimport type { ChatPersonaConfig } from \"./chat.persona.js\";\nimport { buildNegotiatorSystemContent, type NegotiatorPromptOptions } from \"./negotiator.prompt.js\";\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// NEGOTIATOR PERSONA (P4.1)\n// ═══════════════════════════════════════════════════════════════════════════════\n//\n// A pure persona addition on the P4.0 persona-neutral chat runtime: advocate\n// prompt, client-scoped toolset, and all orchestrator loop behaviors OFF.\n// Unlike the orchestrator (a static singleton), the negotiator persona is\n// created per session because its identity comes from the user's\n// `type='personal'` agent row (name/description).\n\n/**\n * Persona id for the user's personal negotiator. Matches the\n * `conversations.persona` column value for negotiator DM sessions.\n */\nexport const NEGOTIATOR_PERSONA_ID = \"negotiator\";\n\n/**\n * Client-scoped tool allowlist for the negotiator persona.\n *\n * Deliberately excludes every network-facing capability: no discovery\n * (`discover_opportunities`), no network/membership management, no profile or\n * intent writes, no contact import. This agent works for one client; as the\n * orchestrator sunsets, network-facing capabilities migrate here deliberately\n * (out of scope for P4.1).\n */\nexport const NEGOTIATOR_TOOL_NAMES = [\n \"list_negotiations\",\n \"get_negotiation\",\n \"respond_to_negotiation\",\n \"list_opportunities\",\n \"read_intents\",\n \"read_premises\",\n] as const;\n\nconst NEGOTIATOR_TOOL_ALLOWLIST: ReadonlySet<string> = new Set(NEGOTIATOR_TOOL_NAMES);\n\n/**\n * Filters a full chat-tool registry down to the negotiator allowlist.\n * Exported separately so the scoping rule is unit-testable without\n * constructing the full tool factory dependency graph.\n */\nexport function filterNegotiatorTools<T extends { name: string }>(tools: T[]): T[] {\n return tools.filter((t) => NEGOTIATOR_TOOL_ALLOWLIST.has(t.name));\n}\n\n/**\n * Creates the negotiator persona's client-scoped toolset.\n *\n * Reuses the standard chat tool factory (so context resolution, scope\n * derivation, logging, and error handling stay identical) and filters the\n * registry to the allowlist. The negotiation tools are already context-bound\n * to `context.userId`, so every tool in this set can only read or act on the\n * calling client's own data.\n */\nexport async function createNegotiatorTools(\n deps: ToolContext,\n preResolvedContext?: ResolvedToolContext,\n): Promise<ChatTools> {\n const tools = await createChatTools(deps, preResolvedContext);\n return filterNegotiatorTools(tools);\n}\n\n/**\n * Creates a negotiator `ChatPersonaConfig` bound to the client's personal\n * negotiator agent row identity.\n *\n * Loop behaviors are all OFF: no create-intent callback and no\n * hallucinated-block auto-invoke/strip — the negotiator's toolset cannot\n * legitimately produce opportunity/intent-proposal blocks, and it must never\n * inherit the orchestrator's discovery auto-invocation.\n *\n * @param opts - Identity from the user's `type='personal'` agent row\n */\nexport function createNegotiatorPersona(opts: NegotiatorPromptOptions): ChatPersonaConfig {\n return {\n id: NEGOTIATOR_PERSONA_ID,\n buildSystemContent: (ctx, iterCtx) => buildNegotiatorSystemContent(ctx, opts, iterCtx),\n createTools: (deps, preResolvedContext) => createNegotiatorTools(deps, preResolvedContext),\n loopBehaviors: {\n createIntentCallback: false,\n hallucinationRecovery: false,\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ResolvedToolContext } from "../shared/agent/tool.factory.js";
|
|
2
|
+
import type { IterationContext } from "./chat.prompt.modules.js";
|
|
3
|
+
/** Identity options resolved from the user's personal negotiator agent row. */
|
|
4
|
+
export interface NegotiatorPromptOptions {
|
|
5
|
+
/** The negotiator agent's display name (e.g. "Ada's Negotiator"). */
|
|
6
|
+
agentName: string;
|
|
7
|
+
/** The negotiator agent's description, when set on the agent row. */
|
|
8
|
+
agentDescription?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Builds the system prompt for the negotiator chat persona.
|
|
12
|
+
*
|
|
13
|
+
* Grounded in the client's preloaded user/profile context; everything else
|
|
14
|
+
* (negotiations, opportunities, signals, premises) must be fetched through
|
|
15
|
+
* the client-scoped toolset each turn.
|
|
16
|
+
*
|
|
17
|
+
* @param ctx - Resolved tool context for the current session
|
|
18
|
+
* @param opts - Identity from the client's personal negotiator agent row
|
|
19
|
+
* @param _iterCtx - Iteration context (unused — the negotiator prompt has no
|
|
20
|
+
* dynamic modules; the nudge is injected by the agent loop)
|
|
21
|
+
* @returns The complete system prompt string
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildNegotiatorSystemContent(ctx: ResolvedToolContext, opts: NegotiatorPromptOptions, _iterCtx?: IterationContext): string;
|
|
24
|
+
//# sourceMappingURL=negotiator.prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negotiator.prompt.d.ts","sourceRoot":"/","sources":["chat/negotiator.prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAajE,+EAA+E;AAC/E,MAAM,WAAW,uBAAuB;IACtC,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,mBAAmB,EACxB,IAAI,EAAE,uBAAuB,EAC7B,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,MAAM,CAyDR"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the system prompt for the negotiator chat persona.
|
|
3
|
+
*
|
|
4
|
+
* Grounded in the client's preloaded user/profile context; everything else
|
|
5
|
+
* (negotiations, opportunities, signals, premises) must be fetched through
|
|
6
|
+
* the client-scoped toolset each turn.
|
|
7
|
+
*
|
|
8
|
+
* @param ctx - Resolved tool context for the current session
|
|
9
|
+
* @param opts - Identity from the client's personal negotiator agent row
|
|
10
|
+
* @param _iterCtx - Iteration context (unused — the negotiator prompt has no
|
|
11
|
+
* dynamic modules; the nudge is injected by the agent loop)
|
|
12
|
+
* @returns The complete system prompt string
|
|
13
|
+
*/
|
|
14
|
+
export function buildNegotiatorSystemContent(ctx, opts, _iterCtx) {
|
|
15
|
+
const userContext = JSON.stringify(ctx.user, null, 2);
|
|
16
|
+
const profileContext = ctx.userProfile
|
|
17
|
+
? JSON.stringify(ctx.userProfile, null, 2)
|
|
18
|
+
: "null";
|
|
19
|
+
const descriptionLine = opts.agentDescription?.trim()
|
|
20
|
+
? `\n${opts.agentDescription.trim()}\n`
|
|
21
|
+
: "";
|
|
22
|
+
return `You are ${opts.agentName}, the personal negotiator agent working for ${ctx.userName}.
|
|
23
|
+
${descriptionLine}
|
|
24
|
+
You work for exactly one client: ${ctx.userName}. You represent them in negotiations with other members' agents across the network, and this chat is your direct line to them. Your job here is to keep your client informed about what you have been doing on their behalf, explain your reasoning honestly, and act only on their explicit instructions.
|
|
25
|
+
|
|
26
|
+
## What you do in this chat
|
|
27
|
+
- **Report on negotiations**: when the client asks what is happening, look up their negotiations and summarize status, counterparties, and where things stand.
|
|
28
|
+
- **Explain decisions**: when the client asks why something was pursued, declined, or stalled ("why did you pass on X?"), find the relevant negotiation and answer from the actual record — the messages, outcomes, and reasoning stored there. Never reconstruct a rationale from memory.
|
|
29
|
+
- **Review opportunities**: show the client the opportunities currently waiting on them and what accepting or passing would mean.
|
|
30
|
+
- **Stay grounded in their signals**: their active intents and premises define what you negotiate for. Read them before making claims about what the client is looking for.
|
|
31
|
+
- **Act on instruction**: respond to a negotiation (accept, decline, or reply) only when the client explicitly tells you to in this conversation. Never take a negotiation action the client did not just ask for.
|
|
32
|
+
|
|
33
|
+
## What you cannot do here
|
|
34
|
+
- **No network-wide discovery.** You cannot look for new people, run matching, or create new connections from this chat. New matches are discovered by the system in the background and appear on the client's home page.
|
|
35
|
+
- **No profile, community, or membership management.** If the client asks for those, tell them plainly that it is outside your remit as their negotiator and they can do it from the main chat or the app.
|
|
36
|
+
- You cannot push updates after this conversation ends. You only report when asked.
|
|
37
|
+
|
|
38
|
+
## Session
|
|
39
|
+
- Client: ${ctx.userName} (${ctx.userEmail}), id: ${ctx.userId}
|
|
40
|
+
|
|
41
|
+
### Client (preloaded context)
|
|
42
|
+
\`\`\`json
|
|
43
|
+
${userContext}
|
|
44
|
+
\`\`\`
|
|
45
|
+
|
|
46
|
+
### Client Context (preloaded context)
|
|
47
|
+
\`\`\`json
|
|
48
|
+
${profileContext}
|
|
49
|
+
\`\`\`
|
|
50
|
+
|
|
51
|
+
## Tools Reference
|
|
52
|
+
|
|
53
|
+
| Tool | Params | What it does |
|
|
54
|
+
|------|--------|-------------|
|
|
55
|
+
| **list_negotiations** | status?, limit? | List the client's negotiations |
|
|
56
|
+
| **get_negotiation** | negotiationId | Full negotiation record: messages, outcome, reasoning |
|
|
57
|
+
| **respond_to_negotiation** | negotiationId, ... | Act on a negotiation — ONLY on explicit client instruction |
|
|
58
|
+
| **list_opportunities** | — | List the client's actionable opportunities |
|
|
59
|
+
| **read_intents** | — | The client's active signals (what they're looking for) |
|
|
60
|
+
| **read_premises** | — | The client's premises (facts they've established) |
|
|
61
|
+
|
|
62
|
+
## Grounding rules
|
|
63
|
+
- **Never fabricate.** Every claim about a negotiation, opportunity, signal, or premise must come from a tool result in this conversation. If you have not looked it up this turn, look it up before answering. Only the client's identity and profile above are preloaded.
|
|
64
|
+
- **Check tool results before confirming.** Never claim an action succeeded without a successful tool result for it.
|
|
65
|
+
- **Be honest about your own actions.** If the record shows you made a judgment call the client disagrees with, explain the reasoning from the record — do not get defensive, and do not invent justifications the record does not support.
|
|
66
|
+
- **Never expose IDs, UUIDs, tool names, or raw JSON** to the client. Translate everything into natural language; refer to people and opportunities by name.
|
|
67
|
+
- **Respond in the language of the client's latest message.**
|
|
68
|
+
- **Voice**: first person, loyal but candid, calm and concise. No hype, no networking clichés, no exaggeration. You are their agent, not a salesperson.
|
|
69
|
+
- When calling tools, first write a short natural sentence plus a \`>\` blockquote describing what you are checking (e.g. "> Checking the record with Alice"), then leave an empty line after the blockquote.`;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=negotiator.prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negotiator.prompt.js","sourceRoot":"/","sources":["chat/negotiator.prompt.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,4BAA4B,CAC1C,GAAwB,EACxB,IAA6B,EAC7B,QAA2B;IAE3B,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACtD,MAAM,cAAc,GAAG,GAAG,CAAC,WAAW;QACpC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1C,CAAC,CAAC,MAAM,CAAC;IACX,MAAM,eAAe,GAAG,IAAI,CAAC,gBAAgB,EAAE,IAAI,EAAE;QACnD,CAAC,CAAC,KAAK,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI;QACvC,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,WAAW,IAAI,CAAC,SAAS,+CAA+C,GAAG,CAAC,QAAQ;EAC3F,eAAe;mCACkB,GAAG,CAAC,QAAQ;;;;;;;;;;;;;;;YAenC,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,SAAS,UAAU,GAAG,CAAC,MAAM;;;;EAI5D,WAAW;;;;;EAKX,cAAc;;;;;;;;;;;;;;;;;;;;;8MAqB8L,CAAC;AAC/M,CAAC","sourcesContent":["import type { ResolvedToolContext } from \"../shared/agent/tool.factory.js\";\nimport type { IterationContext } from \"./chat.prompt.modules.js\";\n\n// ═══════════════════════════════════════════════════════════════════════════════\n// NEGOTIATOR PERSONA SYSTEM PROMPT (P4.1)\n// ═══════════════════════════════════════════════════════════════════════════════\n//\n// The direct chat line between a user and their personal negotiator agent\n// (the `type='personal'` agent row). Unlike the orchestrator prompt, this\n// persona works for exactly one client: it reports on the client's\n// negotiations and opportunities, explains decisions from the negotiation\n// record, and acts only on explicit client instruction. It has no\n// network-wide discovery capabilities.\n\n/** Identity options resolved from the user's personal negotiator agent row. */\nexport interface NegotiatorPromptOptions {\n /** The negotiator agent's display name (e.g. \"Ada's Negotiator\"). */\n agentName: string;\n /** The negotiator agent's description, when set on the agent row. */\n agentDescription?: string;\n}\n\n/**\n * Builds the system prompt for the negotiator chat persona.\n *\n * Grounded in the client's preloaded user/profile context; everything else\n * (negotiations, opportunities, signals, premises) must be fetched through\n * the client-scoped toolset each turn.\n *\n * @param ctx - Resolved tool context for the current session\n * @param opts - Identity from the client's personal negotiator agent row\n * @param _iterCtx - Iteration context (unused — the negotiator prompt has no\n * dynamic modules; the nudge is injected by the agent loop)\n * @returns The complete system prompt string\n */\nexport function buildNegotiatorSystemContent(\n ctx: ResolvedToolContext,\n opts: NegotiatorPromptOptions,\n _iterCtx?: IterationContext,\n): string {\n const userContext = JSON.stringify(ctx.user, null, 2);\n const profileContext = ctx.userProfile\n ? JSON.stringify(ctx.userProfile, null, 2)\n : \"null\";\n const descriptionLine = opts.agentDescription?.trim()\n ? `\\n${opts.agentDescription.trim()}\\n`\n : \"\";\n\n return `You are ${opts.agentName}, the personal negotiator agent working for ${ctx.userName}.\n${descriptionLine}\nYou work for exactly one client: ${ctx.userName}. You represent them in negotiations with other members' agents across the network, and this chat is your direct line to them. Your job here is to keep your client informed about what you have been doing on their behalf, explain your reasoning honestly, and act only on their explicit instructions.\n\n## What you do in this chat\n- **Report on negotiations**: when the client asks what is happening, look up their negotiations and summarize status, counterparties, and where things stand.\n- **Explain decisions**: when the client asks why something was pursued, declined, or stalled (\"why did you pass on X?\"), find the relevant negotiation and answer from the actual record — the messages, outcomes, and reasoning stored there. Never reconstruct a rationale from memory.\n- **Review opportunities**: show the client the opportunities currently waiting on them and what accepting or passing would mean.\n- **Stay grounded in their signals**: their active intents and premises define what you negotiate for. Read them before making claims about what the client is looking for.\n- **Act on instruction**: respond to a negotiation (accept, decline, or reply) only when the client explicitly tells you to in this conversation. Never take a negotiation action the client did not just ask for.\n\n## What you cannot do here\n- **No network-wide discovery.** You cannot look for new people, run matching, or create new connections from this chat. New matches are discovered by the system in the background and appear on the client's home page.\n- **No profile, community, or membership management.** If the client asks for those, tell them plainly that it is outside your remit as their negotiator and they can do it from the main chat or the app.\n- You cannot push updates after this conversation ends. You only report when asked.\n\n## Session\n- Client: ${ctx.userName} (${ctx.userEmail}), id: ${ctx.userId}\n\n### Client (preloaded context)\n\\`\\`\\`json\n${userContext}\n\\`\\`\\`\n\n### Client Context (preloaded context)\n\\`\\`\\`json\n${profileContext}\n\\`\\`\\`\n\n## Tools Reference\n\n| Tool | Params | What it does |\n|------|--------|-------------|\n| **list_negotiations** | status?, limit? | List the client's negotiations |\n| **get_negotiation** | negotiationId | Full negotiation record: messages, outcome, reasoning |\n| **respond_to_negotiation** | negotiationId, ... | Act on a negotiation — ONLY on explicit client instruction |\n| **list_opportunities** | — | List the client's actionable opportunities |\n| **read_intents** | — | The client's active signals (what they're looking for) |\n| **read_premises** | — | The client's premises (facts they've established) |\n\n## Grounding rules\n- **Never fabricate.** Every claim about a negotiation, opportunity, signal, or premise must come from a tool result in this conversation. If you have not looked it up this turn, look it up before answering. Only the client's identity and profile above are preloaded.\n- **Check tool results before confirming.** Never claim an action succeeded without a successful tool result for it.\n- **Be honest about your own actions.** If the record shows you made a judgment call the client disagrees with, explain the reasoning from the record — do not get defensive, and do not invent justifications the record does not support.\n- **Never expose IDs, UUIDs, tool names, or raw JSON** to the client. Translate everything into natural language; refer to people and opportunities by name.\n- **Respond in the language of the client's latest message.**\n- **Voice**: first person, loyal but candid, calm and concise. No hype, no networking clichés, no exaggeration. You are their agent, not a salesperson.\n- When calling tools, first write a short natural sentence plus a \\`>\\` blockquote describing what you are checking (e.g. \"> Checking the record with Alice\"), then leave an empty line after the blockquote.`;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -52,6 +52,8 @@ export { buildCandidateEvidence, withCandidateEvidence, mergeOpportunityEvidence
|
|
|
52
52
|
export type { EvidenceCandidateInput } from "./opportunity/opportunity.evidence.js";
|
|
53
53
|
export { ChatGraphFactory } from "./chat/chat.graph.js";
|
|
54
54
|
export { ORCHESTRATOR_PERSONA, ORCHESTRATOR_PERSONA_ID, type ChatPersonaConfig, type ChatPersonaLoopBehaviors, } from "./chat/chat.persona.js";
|
|
55
|
+
export { NEGOTIATOR_PERSONA_ID, NEGOTIATOR_TOOL_NAMES, createNegotiatorPersona, createNegotiatorTools, filterNegotiatorTools, } from "./chat/negotiator.persona.js";
|
|
56
|
+
export { buildNegotiatorSystemContent, type NegotiatorPromptOptions } from "./chat/negotiator.prompt.js";
|
|
55
57
|
export { HomeGraphFactory } from "./opportunity/feed/feed.graph.js";
|
|
56
58
|
export { HydeGraphFactory } from "./shared/hyde/hyde.graph.js";
|
|
57
59
|
export { NetworkGraphFactory } from "./network/network.graph.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,YAAY,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAChE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACjF,YAAY,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,EAAE,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACjJ,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACz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MAAM,qCAAqC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,8 @@ export { buildCandidateEvidence, withCandidateEvidence, mergeOpportunityEvidence
|
|
|
33
33
|
// ─── Graph factories ──────────────────────────────────────────────────────────
|
|
34
34
|
export { ChatGraphFactory } from "./chat/chat.graph.js";
|
|
35
35
|
export { ORCHESTRATOR_PERSONA, ORCHESTRATOR_PERSONA_ID, } from "./chat/chat.persona.js";
|
|
36
|
+
export { NEGOTIATOR_PERSONA_ID, NEGOTIATOR_TOOL_NAMES, createNegotiatorPersona, createNegotiatorTools, filterNegotiatorTools, } from "./chat/negotiator.persona.js";
|
|
37
|
+
export { buildNegotiatorSystemContent } from "./chat/negotiator.prompt.js";
|
|
36
38
|
export { HomeGraphFactory } from "./opportunity/feed/feed.graph.js";
|
|
37
39
|
export { HydeGraphFactory } from "./shared/hyde/hyde.graph.js";
|
|
38
40
|
export { NetworkGraphFactory } from "./network/network.graph.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,6CAA6C;AAC7C,EAAE;AACF,4DAA4D;AAC5D,gFAAgF;AAChF,+EAA+E;AAC/E,qDAAqD;AACrD,EAAE;AACF,yDAAyD;AACzD,2EAA2E;AAC3E,mEAAmE;AACnE,+EAA+E;AAC/E,iFAAiF;AACjF,gFAAgF;AAEhF,iFAAiF;AAEjF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAI9D,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,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AC;AACpH,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAE1N,OAAO,EAAE,4BAA4B,EAAE,uBAAuB,EAAwD,MAAM,sCAAsC,CAAC;AAEnK,iFAAiF;AAEjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,iFAAiF;AAEjF,OAAO,EAAE,eAAe,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEpI,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AASvE,iFAAiF;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC","sourcesContent":["// =============================================================================\n// @indexnetwork/protocol — public API barrel\n//\n// This file is the ONLY supported entry point. Deep imports\n// (\"@indexnetwork/protocol/src/...\") are not part of the contract and may break\n// in any release. Every symbol is re-exported explicitly (no wildcards) so the\n// surface is reviewable and changes are intentional.\n//\n// Stability tiers are defined in STABILITY.md. In short:\n// • Stable — Interfaces, Graph factories, Agents, createChatTools,\n// the tool/runtime helpers, and shared schemas.\n// • Experimental — Sections marked @experimental below (advanced graph state\n// types and internal helpers); may change in a minor release.\n// =============================================================================\n\n// ─── Public API (recommended for external consumers) ──────────────────────────\n\nexport { createChatTools } from \"./shared/agent/tool.factory.js\";\nexport { getModelName } from \"./shared/agent/model.config.js\";\nexport type { ChatTools } from \"./shared/agent/tool.factory.js\";\nexport type { ModelConfig, ModelSettings } from \"./shared/agent/model.config.js\";\nexport type { ToolContext, ResolvedToolContext, ToolDeps, ProtocolDeps, RawToolDefinition, CompiledGraph } from \"./shared/agent/tool.helpers.js\";\nexport { ChatContextAccessError, resolveChatContext } from \"./shared/agent/tool.helpers.js\";\nexport {\n deriveAllowedNetworkIds,\n deriveDiscoveryNetworkIds,\n focusedNetworkId,\n focusedNetworkLabel,\n hasNetworkScope,\n scopeFromNetworkId,\n} from \"./shared/agent/tool.scope.js\";\nexport type { ToolScopeEnvelope, ToolScopeType, ScopeMembership, DeriveNetworkScopeInput } from \"./shared/agent/tool.scope.js\";\nexport { requestContext } from \"./shared/observability/request-context.js\";\nexport { setLoggerFactory } from \"./shared/observability/log.js\";\nexport type { LoggerWithSource as ProtocolLoggerWithSource } from \"./shared/observability/log.js\";\nexport { setTimingWrapper } from \"./shared/observability/performance.js\";\nexport { ToolRuntimeError, getToolTimeoutPolicy, invokeToolRuntime, toolRuntimeErrorToResult } from \"./shared/agent/tool.runtime.js\";\nexport type { ToolRuntimeErrorCode, ToolTimeoutClass, ToolTimeoutPolicy } from \"./shared/agent/tool.runtime.js\";\n\n// ─── Interfaces (implement these to wire up your infrastructure) ───────────────\n\nexport type { McpAuthResolver } from \"./shared/interfaces/auth.interface.js\";\nexport type { Cache, CacheOptions, HydeCache, OpportunityCache } from \"./shared/interfaces/cache.interface.js\";\nexport type { ChatSessionReader, ChatSessionDetail, ChatSessionSummary } from \"./shared/interfaces/chat-session.interface.js\";\nexport type { ChatSummaryReader } from \"./shared/interfaces/chat-summary.interface.js\";\nexport type { ChatMessageWriter } from \"./shared/interfaces/chat-message-writer.interface.js\";\nexport type { QuestionGeneratorReader } from \"./shared/interfaces/question-generator.interface.js\";\nexport type { QuestionerDatabase, PersistableQuestion, PersistedQuestion, QuestionFilters, ChatQuestionsHost, ChatQuestionAnswerOutcome } from \"./shared/interfaces/questioner.interface.js\";\nexport type { NegotiationSummaryReader } from \"./shared/interfaces/negotiation-summary.interface.js\";\nexport type { DiscoveryNegotiationDigest } from \"./shared/schemas/negotiation-digest.schema.js\";\nexport { NegotiationSummarizer, buildFallbackDigest } from \"./negotiation/negotiation.summarizer.js\";\nexport type { ContactServiceAdapter, ContactEntry, ContactImportResult, ContactInput, ContactResult, ContactSearchResult } from \"./shared/interfaces/contact.interface.js\";\nexport type {\n ChatGraphCompositeDatabase, UserDatabase, SystemDatabase, Database,\n OpportunityGraphDatabase, OpportunityControllerDatabase, HomeGraphDatabase,\n IntentGraphDatabase, IntentNetworkGraphDatabase, NetworkGraphDatabase, NetworkMembershipGraphDatabase,\n HydeGraphDatabase, EnrichmentGraphDatabase, PremiseGraphDatabase, NegotiationGraphDatabase,\n NegotiationQueries, NegotiationUserAnswer,\n Opportunity, OpportunityActor, OpportunityContext, OpportunityDetection, OpportunityInterpretation,\n OpportunityQueryOptions, OpportunitySignal, OpportunityStatus,\n ActiveIntent, CreatedIntent, CreateIntentData, UpdateIntentData, IntentRecord, SimilarIntent, SimilarIntentSearchOptions,\n IndexedIntentDetails, IndexMemberDetails, AssignmentNetworkMembership, NetworkAssignmentContext, NetworkMembership, OwnedIndex,\n CreateHydeDocumentData, HydeDocument, HydeSourceType, CreateOpportunityData,\n PremiseAnalysis, PremiseAssertion, PremiseProvenance, PremiseRecord, PremiseValidity,\n OnboardingPrivacyState, OnboardingProfileSeed, OnboardingState, PrivacyConsentDecision, PrivacyConsentSource,\n UpdateIndexSettingsData, UserRecord, UserSocial, ArchiveResult, Id,\n} from \"./shared/interfaces/database.interface.js\";\nexport type {\n Embedder, EmbeddingGenerator, EmbeddingGenerateOptions,\n VectorStore, VectorStoreOption, VectorSearchResult,\n HydeCandidate, HydeSearchOptions, LensEmbedding,\n} from \"./shared/interfaces/embedder.interface.js\";\nexport type { ProfileEnricher, EnrichmentRequest, EnrichmentResult } from \"./shared/interfaces/enrichment.interface.js\";\nexport type { IntegrationAdapter, IntegrationConnection, IntegrationSession, IntegrationSessionOptions, ToolActionResponse } from \"./shared/interfaces/integration.interface.js\";\nexport type { IntentGraphQueue } from \"./shared/interfaces/queue.interface.js\";\nexport type { Scraper, ExtractUrlContentOptions } from \"./shared/interfaces/scraper.interface.js\";\nexport type { Storage } from \"./shared/interfaces/storage.interface.js\";\nexport type { DeliveryLedger, DeliveredOpportunityRow } from \"./shared/interfaces/delivery-ledger.interface.js\";\nexport type { MintConnectLink, ConnectLinkKind } from \"./shared/interfaces/connect-link.interface.js\";\nexport type {\n DiscoveryRunStore, DiscoveryRunQueue, DiscoveryRunInput, CreateDiscoveryRunInput,\n DiscoveryRunRecord, DiscoveryRunStatus,\n} from \"./shared/interfaces/discovery-run.interface.js\";\nexport type {\n EnrichmentRunStore, EnrichmentRunQueue, EnrichmentRunInput, CreateEnrichmentRunInput,\n UpdateUserEnrichmentRunInput, PreviewUserEnrichmentRunInput,\n EnrichmentRunRecord, EnrichmentRunStatus, EnrichmentRunOperation,\n} from \"./shared/interfaces/enrichment-run.interface.js\";\nexport type { NegotiationTimeoutQueue } from \"./shared/interfaces/negotiation-events.interface.js\";\nexport type { AgentDispatcher, AgentDispatchResult, NegotiationTurnPayload } from \"./shared/interfaces/agent-dispatcher.interface.js\";\nexport type { AgentRecord, AgentTransportRecord, AgentPermissionRecord, AgentWithRelations, CreateAgentInput, CreateTransportInput, GrantPermissionInput, AgentDatabase } from './shared/interfaces/agent.interface.js';\nexport { SYSTEM_AGENT_IDS } from './shared/interfaces/agent.interface.js';\n\n// ─── Shared schemas ───────────────────────────────────────────────────────────\n\nexport { ChatContextDigestSchema, type ChatContextDigest } from \"./shared/schemas/chat-context.schema.js\";\nexport { QuestionOptionSchema, QuestionSchema, QuestionStrategySchema, QuestionWithStrategySchema, QuestionGeneratorResponseSchema, QuestionModeSchema, QuestionDetectionSchema, QuestionActorSchema, QuestionAnswerSchema, type Question, type QuestionOption, type QuestionStrategy, type QuestionWithStrategy, type QuestionGeneratorResponse, type QuestionGenerationResult, type QuestionMode, type QuestionDetection, type QuestionActor, type QuestionAnswer } from \"./shared/schemas/question.schema.js\";\nexport type { PendingQuestionSummary } from \"./shared/schemas/pending-question.schema.js\";\nexport type { McpAuthInput } from \"./shared/schemas/mcp-auth.schema.js\";\nexport { UserIdentitySchema, type UserIdentity } from \"./shared/schemas/identity.schema.js\";\nexport type { DiscoverySourceProfile, DiscoverySummary, DiscoveryNegotiation, DiscoveryTurn, DiscoveryOutcome, DiscoveryQuestionInput, NegotiationRole } from \"./shared/schemas/discovery-question.schema.js\";\nexport { NetworkAssignmentResourceTypeSchema, NetworkAssignmentModeSchema, NetworkAssignmentScopeSchema, NetworkAssignmentPromptPresenceSchema, NetworkAssignmentPolicySchema, NetworkAssignmentRawScoresSchema, NetworkAssignmentMetadataSchema, OpportunityEvidenceKindSchema, OpportunityEvidenceSchema } from \"./shared/schemas/network-assignment.schema.js\";\nexport type { NetworkAssignmentResourceType, NetworkAssignmentMode, NetworkAssignmentScope, NetworkAssignmentPromptPresence, NetworkAssignmentPolicy, NetworkAssignmentRawScores, NetworkAssignmentMetadata, OpportunityEvidenceKind, OpportunityEvidence } from \"./shared/schemas/network-assignment.schema.js\";\nexport { DEFAULT_NETWORK_ASSIGNMENT_THRESHOLD, classifyPromptPresence, resolveAssignmentNetworkScope, buildNetworkAssignmentDecision, combineAssignmentScores } from \"./shared/assignment/network-assignment.policy.js\";\nexport type { PromptPresenceInput, ResolveAssignmentNetworkScopeArgs, AssignmentScopeMembership, BuildNetworkAssignmentDecisionArgs, NetworkAssignmentDecision } from \"./shared/assignment/network-assignment.policy.js\";\nexport { buildCandidateEvidence, withCandidateEvidence, mergeOpportunityEvidence, withMatchedStrategies, renderOpportunityEvidenceForPrompt } from \"./opportunity/opportunity.evidence.js\";\nexport type { EvidenceCandidateInput } from \"./opportunity/opportunity.evidence.js\";\n\n// ─── Graph factories ──────────────────────────────────────────────────────────\n\nexport { ChatGraphFactory } from \"./chat/chat.graph.js\";\nexport {\n ORCHESTRATOR_PERSONA,\n ORCHESTRATOR_PERSONA_ID,\n type ChatPersonaConfig,\n type ChatPersonaLoopBehaviors,\n} from \"./chat/chat.persona.js\";\nexport { HomeGraphFactory } from \"./opportunity/feed/feed.graph.js\";\nexport { HydeGraphFactory } from \"./shared/hyde/hyde.graph.js\";\nexport { NetworkGraphFactory } from \"./network/network.graph.js\";\nexport { NetworkMembershipGraphFactory } from \"./network/membership/membership.graph.js\";\nexport { IntentGraphFactory } from \"./intent/intent.graph.js\";\nexport { IntentNetworkGraphFactory } from \"./network/indexer/indexer.graph.js\";\nexport { MaintenanceGraphFactory } from \"./maintenance/maintenance.graph.js\";\nexport type { MaintenanceGraphDatabase, MaintenanceGraphCache, MaintenanceGraphQueue } from \"./maintenance/maintenance.graph.js\";\nexport { NegotiationGraphFactory, createDefaultNegotiationGraph, negotiateCandidates } from \"./negotiation/negotiation.graph.js\";\nexport { OpportunityGraphFactory } from \"./opportunity/opportunity.graph.js\";\nexport { EnrichmentGraphFactory } from \"./enrichment/enrichment.graph.js\";\nexport { PremiseGraphFactory } from \"./premise/premise.graph.js\";\n\n// ─── Agents ───────────────────────────────────────────────────────────────────\n\nexport { UserContextGenerator } from \"./context/context.generator.js\";\nexport type { UserContextInput, IncrementalContextInput, UserContextResult, GlobalContextInput, GlobalIncrementalContextInput } from \"./context/context.generator.js\";\nexport { ChatTitleGenerator } from \"./chat/chat.title.generator.js\";\nexport { ChatInterruptClassifier } from \"./chat/chat.interrupt.classifier.js\";\nexport type { ClassifyInterruptInput } from \"./chat/chat.interrupt.classifier.js\";\nexport { ChatSummarizer } from \"./chat/chat.summarizer.js\";\nexport type { ChatSummarizerInput, ChatSummarizerMessage } from \"./chat/chat.summarizer.js\";\nexport { HydeGenerator } from \"./shared/hyde/hyde.generator.js\";\nexport { SuggestionGenerator } from \"./chat/chat.suggester.js\";\nexport type { SuggestionGeneratorInput } from \"./chat/chat.suggester.js\";\nexport { generateInviteMessage } from \"./contact/contact.inviter.js\";\nexport type { InviteInput, InviteOutput } from \"./contact/contact.inviter.js\";\nexport { IntentIndexer } from \"./intent/intent.indexer.js\";\nexport type { IntentIndexerOutput } from \"./intent/intent.indexer.js\";\nexport { PremiseAnalyzer } from \"./premise/premise.analyzer.js\";\nexport type { PremiseAnalyzerOutput } from \"./premise/premise.analyzer.js\";\nexport { PremiseDecomposer } from \"./premise/premise.decomposer.js\";\nexport type { PremiseDecomposerOutput, DecomposedPremise } from \"./premise/premise.decomposer.js\";\nexport { PremiseIndexer } from \"./premise/premise.indexer.js\";\nexport type { PremiseIndexerOutput } from \"./premise/premise.indexer.js\";\nexport { LensInferrer } from \"./shared/hyde/lens.inferrer.js\";\nexport { NegotiationInsightsGenerator } from \"./negotiation/insight.generator.js\";\nexport type { NegotiationDigest } from \"./negotiation/insight.generator.js\";\nexport { IndexNegotiator } from \"./negotiation/negotiation.agent.js\";\nexport type { NegotiationAgentInput } from \"./negotiation/negotiation.agent.js\";\nexport { QuestionerAgent } from \"./questioner/questioner.agent.js\";\nexport type { QuestionerAgentConfig } from \"./questioner/questioner.agent.js\";\nexport type { QuestionerInput, QuestionerContext, QuestionerEnqueuePayload, QuestionerEnqueueFn, DiscoveryContext, IntentContext, ProfileContext, NegotiationContext, ChatContext } from \"./questioner/questioner.types.js\";\nexport { getPreset } from \"./questioner/questioner.presets.js\";\nexport { isQuestionerEnabled, isDiscoveryQuestionsEnabled, discoveryQuestionsInputMode, discoveryQuestionsTimeoutMs, chatQuestionWaitTimeoutMs } from \"./questioner/questioner.env.js\";\nexport type { QuestionerPreset } from \"./questioner/questioner.presets.js\";\nexport { OpportunityEvaluator } from \"./opportunity/opportunity.evaluator.js\";\nexport type { EvaluatorInput, OpportunityEvaluatorOptionsConstructor } from \"./opportunity/opportunity.evaluator.js\";\nexport { OpportunityPresenter, gatherPresenterContext } from \"./opportunity/opportunity.presenter.js\";\nexport { createOpportunityTools } from \"./opportunity/opportunity.tools.js\";\nexport { createEnrichmentTools } from \"./enrichment/enrichment.tools.js\";\nexport type { PresenterDatabase } from \"./opportunity/opportunity.presenter.js\";\nexport { QuestionGenerator } from \"./opportunity/question.generator.js\";\n\n// ─── Support utilities ────────────────────────────────────────────────────────\n\nexport { renderNetworkContext } from './shared/network/metadata.renderer.js';\nexport { canUserSeeOpportunity, isActionableForViewer, validateOpportunityActors, classifyOpportunity, selectByComposition, selectDigestCandidates, DIGEST_REDELIVERY_COOLDOWN_DAYS, FEED_SOFT_TARGETS } from \"./opportunity/opportunity.utils.js\";\nexport type { DigestDeliveredRow } from \"./opportunity/opportunity.utils.js\";\nexport { getPrimaryActionLabel } from \"./opportunity/opportunity.labels.js\";\nexport { computeFeedHealth } from \"./opportunity/feed/feed.health.js\";\nexport type { FeedHealthInput, FeedHealthResult } from \"./opportunity/feed/feed.health.js\";\nexport { selectContactsForDiscovery, shouldRunIntroducerDiscovery, runIntroducerDiscovery, MAX_CONTACTS_PER_CYCLE, MAX_CANDIDATES_PER_CONTACT, INTRODUCER_DISCOVERY_SOURCE } from \"./opportunity/opportunity.introducer.js\";\nexport type { IntroducerDiscoveryDatabase, IntroducerDiscoveryQueue, ContactWithIntents } from \"./opportunity/opportunity.introducer.js\";\nexport { persistOpportunities } from \"./opportunity/opportunity.persist.js\";\nexport { presentOpportunity } from \"./opportunity/opportunity.presentation.js\";\nexport type { UserInfo } from \"./opportunity/opportunity.presentation.js\";\nexport { stripUuids, stripIntroducerMentions, truncateAtBoundary } from \"./opportunity/opportunity.presentation.js\";\nexport { safeFallbackSummary, getSafePresentationOrSkip, SAFE_FALLBACK_MAX_CHARS, DEFAULT_FALLBACK_HEADLINE, DEFAULT_FALLBACK_ACTION, DEFAULT_EMPTY_FALLBACK_TEXT } from \"./opportunity/opportunity.safe-presentation.js\";\nexport type { SafeFallbackOptions, SafePresentation, SafePresentationOptions, SafePresentationSource } from \"./opportunity/opportunity.safe-presentation.js\";\nexport { getOrCreateDeliveryCardBatch, DELIVERY_CARD_CACHE_TTL, type CachedDeliveryCard, type OpportunityWithContext } from \"./opportunity/delivery-card.cache.js\";\n\n// ─── Tools ────────────────────────────────────────────────────────────────────\n\nexport { createToolRegistry } from \"./shared/agent/tool.registry.js\";\nexport { createAgentTools } from './agent/agent.tools.js';\nexport { AMBIENT_PARK_WINDOW_MS } from './negotiation/negotiation.tools.js';\nexport { normalizeTelegramHandle } from './shared/utils/telegram-handle.js';\n\n// ─── MCP ──────────────────────────────────────────────────────────────────────\n\nexport { createMcpServer, computeAgentAllowedNetworkIds, buildMcpOnboardingMessage, ONBOARDING_ALLOWED } from \"./mcp/mcp.server.js\";\nexport type { ScopedDepsFactory } from \"./mcp/mcp.server.js\";\nexport { buildElicitationCreate, flattenChoice } from \"./mcp/elicitation.builder.js\";\nexport { dispatchElicitations } from \"./mcp/elicitation.dispatcher.js\";\nexport type { ElicitResultLike, ElicitInputFn, DispatchElicitationsParams } from \"./mcp/elicitation.dispatcher.js\";\n\n// ─── States (for advanced graph consumers) ────────────────────────────────────\n// @experimental — internal graph-state shapes; may change in a minor release.\n\nexport type { UserNegotiationContext, NegotiationTurn, NegotiationOutcome, SeedAssessment } from \"./shared/schemas/negotiation-state.schema.js\";\nexport type { NegotiationGraphLike } from \"./negotiation/negotiation.state.js\";\n\n// ─── Streamers ────────────────────────────────────────────────────────────────\n\nexport { ChatStreamer } from \"./chat/chat.streamer.js\";\nexport { ResponseStreamer } from \"./shared/agent/response.streamer.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,6CAA6C;AAC7C,EAAE;AACF,4DAA4D;AAC5D,gFAAgF;AAChF,+EAA+E;AAC/E,qDAAqD;AACrD,EAAE;AACF,yDAAyD;AACzD,2EAA2E;AAC3E,mEAAmE;AACnE,+EAA+E;AAC/E,iFAAiF;AACjF,gFAAgF;AAEhF,iFAAiF;AAEjF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;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,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,yCAAyC,CAAC;AAE5N,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAE/E,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AACpH,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAE1N,OAAO,EAAE,4BAA4B,EAAE,uBAAuB,EAAwD,MAAM,sCAAsC,CAAC;AAEnK,iFAAiF;AAEjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,iFAAiF;AAEjF,OAAO,EAAE,eAAe,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEpI,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AASvE,iFAAiF;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC","sourcesContent":["// =============================================================================\n// @indexnetwork/protocol — public API barrel\n//\n// This file is the ONLY supported entry point. Deep imports\n// (\"@indexnetwork/protocol/src/...\") are not part of the contract and may break\n// in any release. Every symbol is re-exported explicitly (no wildcards) so the\n// surface is reviewable and changes are intentional.\n//\n// Stability tiers are defined in STABILITY.md. In short:\n// • Stable — Interfaces, Graph factories, Agents, createChatTools,\n// the tool/runtime helpers, and shared schemas.\n// • Experimental — Sections marked @experimental below (advanced graph state\n// types and internal helpers); may change in a minor release.\n// =============================================================================\n\n// ─── Public API (recommended for external consumers) ──────────────────────────\n\nexport { createChatTools } from \"./shared/agent/tool.factory.js\";\nexport { getModelName } from \"./shared/agent/model.config.js\";\nexport type { ChatTools } from \"./shared/agent/tool.factory.js\";\nexport type { ModelConfig, ModelSettings } from \"./shared/agent/model.config.js\";\nexport type { ToolContext, ResolvedToolContext, ToolDeps, ProtocolDeps, RawToolDefinition, CompiledGraph } from \"./shared/agent/tool.helpers.js\";\nexport { ChatContextAccessError, resolveChatContext } from \"./shared/agent/tool.helpers.js\";\nexport {\n deriveAllowedNetworkIds,\n deriveDiscoveryNetworkIds,\n focusedNetworkId,\n focusedNetworkLabel,\n hasNetworkScope,\n scopeFromNetworkId,\n} from \"./shared/agent/tool.scope.js\";\nexport type { ToolScopeEnvelope, ToolScopeType, ScopeMembership, DeriveNetworkScopeInput } from \"./shared/agent/tool.scope.js\";\nexport { requestContext } from \"./shared/observability/request-context.js\";\nexport { setLoggerFactory } from \"./shared/observability/log.js\";\nexport type { LoggerWithSource as ProtocolLoggerWithSource } from \"./shared/observability/log.js\";\nexport { setTimingWrapper } from \"./shared/observability/performance.js\";\nexport { ToolRuntimeError, getToolTimeoutPolicy, invokeToolRuntime, toolRuntimeErrorToResult } from \"./shared/agent/tool.runtime.js\";\nexport type { ToolRuntimeErrorCode, ToolTimeoutClass, ToolTimeoutPolicy } from \"./shared/agent/tool.runtime.js\";\n\n// ─── Interfaces (implement these to wire up your infrastructure) ───────────────\n\nexport type { McpAuthResolver } from \"./shared/interfaces/auth.interface.js\";\nexport type { Cache, CacheOptions, HydeCache, OpportunityCache } from \"./shared/interfaces/cache.interface.js\";\nexport type { ChatSessionReader, ChatSessionDetail, ChatSessionSummary } from \"./shared/interfaces/chat-session.interface.js\";\nexport type { ChatSummaryReader } from \"./shared/interfaces/chat-summary.interface.js\";\nexport type { ChatMessageWriter } from \"./shared/interfaces/chat-message-writer.interface.js\";\nexport type { QuestionGeneratorReader } from \"./shared/interfaces/question-generator.interface.js\";\nexport type { QuestionerDatabase, PersistableQuestion, PersistedQuestion, QuestionFilters, ChatQuestionsHost, ChatQuestionAnswerOutcome } from \"./shared/interfaces/questioner.interface.js\";\nexport type { NegotiationSummaryReader } from \"./shared/interfaces/negotiation-summary.interface.js\";\nexport type { DiscoveryNegotiationDigest } from \"./shared/schemas/negotiation-digest.schema.js\";\nexport { NegotiationSummarizer, buildFallbackDigest } from \"./negotiation/negotiation.summarizer.js\";\nexport type { ContactServiceAdapter, ContactEntry, ContactImportResult, ContactInput, ContactResult, ContactSearchResult } from \"./shared/interfaces/contact.interface.js\";\nexport type {\n ChatGraphCompositeDatabase, UserDatabase, SystemDatabase, Database,\n OpportunityGraphDatabase, OpportunityControllerDatabase, HomeGraphDatabase,\n IntentGraphDatabase, IntentNetworkGraphDatabase, NetworkGraphDatabase, NetworkMembershipGraphDatabase,\n HydeGraphDatabase, EnrichmentGraphDatabase, PremiseGraphDatabase, NegotiationGraphDatabase,\n NegotiationQueries, NegotiationUserAnswer,\n Opportunity, OpportunityActor, OpportunityContext, OpportunityDetection, OpportunityInterpretation,\n OpportunityQueryOptions, OpportunitySignal, OpportunityStatus,\n ActiveIntent, CreatedIntent, CreateIntentData, UpdateIntentData, IntentRecord, SimilarIntent, SimilarIntentSearchOptions,\n IndexedIntentDetails, IndexMemberDetails, AssignmentNetworkMembership, NetworkAssignmentContext, NetworkMembership, OwnedIndex,\n CreateHydeDocumentData, HydeDocument, HydeSourceType, CreateOpportunityData,\n PremiseAnalysis, PremiseAssertion, PremiseProvenance, PremiseRecord, PremiseValidity,\n OnboardingPrivacyState, OnboardingProfileSeed, OnboardingState, PrivacyConsentDecision, PrivacyConsentSource,\n UpdateIndexSettingsData, UserRecord, UserSocial, ArchiveResult, Id,\n} from \"./shared/interfaces/database.interface.js\";\nexport type {\n Embedder, EmbeddingGenerator, EmbeddingGenerateOptions,\n VectorStore, VectorStoreOption, VectorSearchResult,\n HydeCandidate, HydeSearchOptions, LensEmbedding,\n} from \"./shared/interfaces/embedder.interface.js\";\nexport type { ProfileEnricher, EnrichmentRequest, EnrichmentResult } from \"./shared/interfaces/enrichment.interface.js\";\nexport type { IntegrationAdapter, IntegrationConnection, IntegrationSession, IntegrationSessionOptions, ToolActionResponse } from \"./shared/interfaces/integration.interface.js\";\nexport type { IntentGraphQueue } from \"./shared/interfaces/queue.interface.js\";\nexport type { Scraper, ExtractUrlContentOptions } from \"./shared/interfaces/scraper.interface.js\";\nexport type { Storage } from \"./shared/interfaces/storage.interface.js\";\nexport type { DeliveryLedger, DeliveredOpportunityRow } from \"./shared/interfaces/delivery-ledger.interface.js\";\nexport type { MintConnectLink, ConnectLinkKind } from \"./shared/interfaces/connect-link.interface.js\";\nexport type {\n DiscoveryRunStore, DiscoveryRunQueue, DiscoveryRunInput, CreateDiscoveryRunInput,\n DiscoveryRunRecord, DiscoveryRunStatus,\n} from \"./shared/interfaces/discovery-run.interface.js\";\nexport type {\n EnrichmentRunStore, EnrichmentRunQueue, EnrichmentRunInput, CreateEnrichmentRunInput,\n UpdateUserEnrichmentRunInput, PreviewUserEnrichmentRunInput,\n EnrichmentRunRecord, EnrichmentRunStatus, EnrichmentRunOperation,\n} from \"./shared/interfaces/enrichment-run.interface.js\";\nexport type { NegotiationTimeoutQueue } from \"./shared/interfaces/negotiation-events.interface.js\";\nexport type { AgentDispatcher, AgentDispatchResult, NegotiationTurnPayload } from \"./shared/interfaces/agent-dispatcher.interface.js\";\nexport type { AgentRecord, AgentTransportRecord, AgentPermissionRecord, AgentWithRelations, CreateAgentInput, CreateTransportInput, GrantPermissionInput, AgentDatabase } from './shared/interfaces/agent.interface.js';\nexport { SYSTEM_AGENT_IDS } from './shared/interfaces/agent.interface.js';\n\n// ─── Shared schemas ───────────────────────────────────────────────────────────\n\nexport { ChatContextDigestSchema, type ChatContextDigest } from \"./shared/schemas/chat-context.schema.js\";\nexport { QuestionOptionSchema, QuestionSchema, QuestionStrategySchema, QuestionWithStrategySchema, QuestionGeneratorResponseSchema, QuestionModeSchema, QuestionDetectionSchema, QuestionActorSchema, QuestionAnswerSchema, type Question, type QuestionOption, type QuestionStrategy, type QuestionWithStrategy, type QuestionGeneratorResponse, type QuestionGenerationResult, type QuestionMode, type QuestionDetection, type QuestionActor, type QuestionAnswer } from \"./shared/schemas/question.schema.js\";\nexport type { PendingQuestionSummary } from \"./shared/schemas/pending-question.schema.js\";\nexport type { McpAuthInput } from \"./shared/schemas/mcp-auth.schema.js\";\nexport { UserIdentitySchema, type UserIdentity } from \"./shared/schemas/identity.schema.js\";\nexport type { DiscoverySourceProfile, DiscoverySummary, DiscoveryNegotiation, DiscoveryTurn, DiscoveryOutcome, DiscoveryQuestionInput, NegotiationRole } from \"./shared/schemas/discovery-question.schema.js\";\nexport { NetworkAssignmentResourceTypeSchema, NetworkAssignmentModeSchema, NetworkAssignmentScopeSchema, NetworkAssignmentPromptPresenceSchema, NetworkAssignmentPolicySchema, NetworkAssignmentRawScoresSchema, NetworkAssignmentMetadataSchema, OpportunityEvidenceKindSchema, OpportunityEvidenceSchema } from \"./shared/schemas/network-assignment.schema.js\";\nexport type { NetworkAssignmentResourceType, NetworkAssignmentMode, NetworkAssignmentScope, NetworkAssignmentPromptPresence, NetworkAssignmentPolicy, NetworkAssignmentRawScores, NetworkAssignmentMetadata, OpportunityEvidenceKind, OpportunityEvidence } from \"./shared/schemas/network-assignment.schema.js\";\nexport { DEFAULT_NETWORK_ASSIGNMENT_THRESHOLD, classifyPromptPresence, resolveAssignmentNetworkScope, buildNetworkAssignmentDecision, combineAssignmentScores } from \"./shared/assignment/network-assignment.policy.js\";\nexport type { PromptPresenceInput, ResolveAssignmentNetworkScopeArgs, AssignmentScopeMembership, BuildNetworkAssignmentDecisionArgs, NetworkAssignmentDecision } from \"./shared/assignment/network-assignment.policy.js\";\nexport { buildCandidateEvidence, withCandidateEvidence, mergeOpportunityEvidence, withMatchedStrategies, renderOpportunityEvidenceForPrompt } from \"./opportunity/opportunity.evidence.js\";\nexport type { EvidenceCandidateInput } from \"./opportunity/opportunity.evidence.js\";\n\n// ─── Graph factories ──────────────────────────────────────────────────────────\n\nexport { ChatGraphFactory } from \"./chat/chat.graph.js\";\nexport {\n ORCHESTRATOR_PERSONA,\n ORCHESTRATOR_PERSONA_ID,\n type ChatPersonaConfig,\n type ChatPersonaLoopBehaviors,\n} from \"./chat/chat.persona.js\";\nexport {\n NEGOTIATOR_PERSONA_ID,\n NEGOTIATOR_TOOL_NAMES,\n createNegotiatorPersona,\n createNegotiatorTools,\n filterNegotiatorTools,\n} from \"./chat/negotiator.persona.js\";\nexport { buildNegotiatorSystemContent, type NegotiatorPromptOptions } from \"./chat/negotiator.prompt.js\";\nexport { HomeGraphFactory } from \"./opportunity/feed/feed.graph.js\";\nexport { HydeGraphFactory } from \"./shared/hyde/hyde.graph.js\";\nexport { NetworkGraphFactory } from \"./network/network.graph.js\";\nexport { NetworkMembershipGraphFactory } from \"./network/membership/membership.graph.js\";\nexport { IntentGraphFactory } from \"./intent/intent.graph.js\";\nexport { IntentNetworkGraphFactory } from \"./network/indexer/indexer.graph.js\";\nexport { MaintenanceGraphFactory } from \"./maintenance/maintenance.graph.js\";\nexport type { MaintenanceGraphDatabase, MaintenanceGraphCache, MaintenanceGraphQueue } from \"./maintenance/maintenance.graph.js\";\nexport { NegotiationGraphFactory, createDefaultNegotiationGraph, negotiateCandidates } from \"./negotiation/negotiation.graph.js\";\nexport { OpportunityGraphFactory } from \"./opportunity/opportunity.graph.js\";\nexport { EnrichmentGraphFactory } from \"./enrichment/enrichment.graph.js\";\nexport { PremiseGraphFactory } from \"./premise/premise.graph.js\";\n\n// ─── Agents ───────────────────────────────────────────────────────────────────\n\nexport { UserContextGenerator } from \"./context/context.generator.js\";\nexport type { UserContextInput, IncrementalContextInput, UserContextResult, GlobalContextInput, GlobalIncrementalContextInput } from \"./context/context.generator.js\";\nexport { ChatTitleGenerator } from \"./chat/chat.title.generator.js\";\nexport { ChatInterruptClassifier } from \"./chat/chat.interrupt.classifier.js\";\nexport type { ClassifyInterruptInput } from \"./chat/chat.interrupt.classifier.js\";\nexport { ChatSummarizer } from \"./chat/chat.summarizer.js\";\nexport type { ChatSummarizerInput, ChatSummarizerMessage } from \"./chat/chat.summarizer.js\";\nexport { HydeGenerator } from \"./shared/hyde/hyde.generator.js\";\nexport { SuggestionGenerator } from \"./chat/chat.suggester.js\";\nexport type { SuggestionGeneratorInput } from \"./chat/chat.suggester.js\";\nexport { generateInviteMessage } from \"./contact/contact.inviter.js\";\nexport type { InviteInput, InviteOutput } from \"./contact/contact.inviter.js\";\nexport { IntentIndexer } from \"./intent/intent.indexer.js\";\nexport type { IntentIndexerOutput } from \"./intent/intent.indexer.js\";\nexport { PremiseAnalyzer } from \"./premise/premise.analyzer.js\";\nexport type { PremiseAnalyzerOutput } from \"./premise/premise.analyzer.js\";\nexport { PremiseDecomposer } from \"./premise/premise.decomposer.js\";\nexport type { PremiseDecomposerOutput, DecomposedPremise } from \"./premise/premise.decomposer.js\";\nexport { PremiseIndexer } from \"./premise/premise.indexer.js\";\nexport type { PremiseIndexerOutput } from \"./premise/premise.indexer.js\";\nexport { LensInferrer } from \"./shared/hyde/lens.inferrer.js\";\nexport { NegotiationInsightsGenerator } from \"./negotiation/insight.generator.js\";\nexport type { NegotiationDigest } from \"./negotiation/insight.generator.js\";\nexport { IndexNegotiator } from \"./negotiation/negotiation.agent.js\";\nexport type { NegotiationAgentInput } from \"./negotiation/negotiation.agent.js\";\nexport { QuestionerAgent } from \"./questioner/questioner.agent.js\";\nexport type { QuestionerAgentConfig } from \"./questioner/questioner.agent.js\";\nexport type { QuestionerInput, QuestionerContext, QuestionerEnqueuePayload, QuestionerEnqueueFn, DiscoveryContext, IntentContext, ProfileContext, NegotiationContext, ChatContext } from \"./questioner/questioner.types.js\";\nexport { getPreset } from \"./questioner/questioner.presets.js\";\nexport { isQuestionerEnabled, isDiscoveryQuestionsEnabled, discoveryQuestionsInputMode, discoveryQuestionsTimeoutMs, chatQuestionWaitTimeoutMs } from \"./questioner/questioner.env.js\";\nexport type { QuestionerPreset } from \"./questioner/questioner.presets.js\";\nexport { OpportunityEvaluator } from \"./opportunity/opportunity.evaluator.js\";\nexport type { EvaluatorInput, OpportunityEvaluatorOptionsConstructor } from \"./opportunity/opportunity.evaluator.js\";\nexport { OpportunityPresenter, gatherPresenterContext } from \"./opportunity/opportunity.presenter.js\";\nexport { createOpportunityTools } from \"./opportunity/opportunity.tools.js\";\nexport { createEnrichmentTools } from \"./enrichment/enrichment.tools.js\";\nexport type { PresenterDatabase } from \"./opportunity/opportunity.presenter.js\";\nexport { QuestionGenerator } from \"./opportunity/question.generator.js\";\n\n// ─── Support utilities ────────────────────────────────────────────────────────\n\nexport { renderNetworkContext } from './shared/network/metadata.renderer.js';\nexport { canUserSeeOpportunity, isActionableForViewer, validateOpportunityActors, classifyOpportunity, selectByComposition, selectDigestCandidates, DIGEST_REDELIVERY_COOLDOWN_DAYS, FEED_SOFT_TARGETS } from \"./opportunity/opportunity.utils.js\";\nexport type { DigestDeliveredRow } from \"./opportunity/opportunity.utils.js\";\nexport { getPrimaryActionLabel } from \"./opportunity/opportunity.labels.js\";\nexport { computeFeedHealth } from \"./opportunity/feed/feed.health.js\";\nexport type { FeedHealthInput, FeedHealthResult } from \"./opportunity/feed/feed.health.js\";\nexport { selectContactsForDiscovery, shouldRunIntroducerDiscovery, runIntroducerDiscovery, MAX_CONTACTS_PER_CYCLE, MAX_CANDIDATES_PER_CONTACT, INTRODUCER_DISCOVERY_SOURCE } from \"./opportunity/opportunity.introducer.js\";\nexport type { IntroducerDiscoveryDatabase, IntroducerDiscoveryQueue, ContactWithIntents } from \"./opportunity/opportunity.introducer.js\";\nexport { persistOpportunities } from \"./opportunity/opportunity.persist.js\";\nexport { presentOpportunity } from \"./opportunity/opportunity.presentation.js\";\nexport type { UserInfo } from \"./opportunity/opportunity.presentation.js\";\nexport { stripUuids, stripIntroducerMentions, truncateAtBoundary } from \"./opportunity/opportunity.presentation.js\";\nexport { safeFallbackSummary, getSafePresentationOrSkip, SAFE_FALLBACK_MAX_CHARS, DEFAULT_FALLBACK_HEADLINE, DEFAULT_FALLBACK_ACTION, DEFAULT_EMPTY_FALLBACK_TEXT } from \"./opportunity/opportunity.safe-presentation.js\";\nexport type { SafeFallbackOptions, SafePresentation, SafePresentationOptions, SafePresentationSource } from \"./opportunity/opportunity.safe-presentation.js\";\nexport { getOrCreateDeliveryCardBatch, DELIVERY_CARD_CACHE_TTL, type CachedDeliveryCard, type OpportunityWithContext } from \"./opportunity/delivery-card.cache.js\";\n\n// ─── Tools ────────────────────────────────────────────────────────────────────\n\nexport { createToolRegistry } from \"./shared/agent/tool.registry.js\";\nexport { createAgentTools } from './agent/agent.tools.js';\nexport { AMBIENT_PARK_WINDOW_MS } from './negotiation/negotiation.tools.js';\nexport { normalizeTelegramHandle } from './shared/utils/telegram-handle.js';\n\n// ─── MCP ──────────────────────────────────────────────────────────────────────\n\nexport { createMcpServer, computeAgentAllowedNetworkIds, buildMcpOnboardingMessage, ONBOARDING_ALLOWED } from \"./mcp/mcp.server.js\";\nexport type { ScopedDepsFactory } from \"./mcp/mcp.server.js\";\nexport { buildElicitationCreate, flattenChoice } from \"./mcp/elicitation.builder.js\";\nexport { dispatchElicitations } from \"./mcp/elicitation.dispatcher.js\";\nexport type { ElicitResultLike, ElicitInputFn, DispatchElicitationsParams } from \"./mcp/elicitation.dispatcher.js\";\n\n// ─── States (for advanced graph consumers) ────────────────────────────────────\n// @experimental — internal graph-state shapes; may change in a minor release.\n\nexport type { UserNegotiationContext, NegotiationTurn, NegotiationOutcome, SeedAssessment } from \"./shared/schemas/negotiation-state.schema.js\";\nexport type { NegotiationGraphLike } from \"./negotiation/negotiation.state.js\";\n\n// ─── Streamers ────────────────────────────────────────────────────────────────\n\nexport { ChatStreamer } from \"./chat/chat.streamer.js\";\nexport { ResponseStreamer } from \"./shared/agent/response.streamer.js\";\n"]}
|