@indexnetwork/protocol 4.5.0-rc.330.1 → 4.5.0-rc.332.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-streaming.types.d.ts +2 -0
- package/dist/chat/chat-streaming.types.d.ts.map +1 -1
- package/dist/chat/chat-streaming.types.js.map +1 -1
- package/dist/chat/negotiator.persona.d.ts +1 -1
- package/dist/chat/negotiator.persona.d.ts.map +1 -1
- package/dist/chat/negotiator.persona.js +4 -1
- package/dist/chat/negotiator.persona.js.map +1 -1
- package/dist/chat/negotiator.prompt.d.ts.map +1 -1
- package/dist/chat/negotiator.prompt.js +20 -2
- package/dist/chat/negotiator.prompt.js.map +1 -1
- package/dist/negotiation/negotiation.graph.d.ts +18 -0
- package/dist/negotiation/negotiation.graph.d.ts.map +1 -1
- package/dist/negotiation/negotiation.graph.js +40 -12
- package/dist/negotiation/negotiation.graph.js.map +1 -1
- package/dist/negotiation/negotiation.state.d.ts +13 -0
- package/dist/negotiation/negotiation.state.d.ts.map +1 -1
- package/dist/negotiation/negotiation.state.js +9 -0
- package/dist/negotiation/negotiation.state.js.map +1 -1
- package/dist/opportunity/opportunity.graph.d.ts.map +1 -1
- package/dist/opportunity/opportunity.graph.js +9 -0
- package/dist/opportunity/opportunity.graph.js.map +1 -1
- package/dist/questioner/questioner.tools.d.ts +4 -3
- package/dist/questioner/questioner.tools.d.ts.map +1 -1
- package/dist/questioner/questioner.tools.js +77 -3
- package/dist/questioner/questioner.tools.js.map +1 -1
- package/dist/shared/agent/tool.helpers.d.ts +21 -0
- package/dist/shared/agent/tool.helpers.d.ts.map +1 -1
- package/dist/shared/agent/tool.helpers.js.map +1 -1
- package/dist/shared/interfaces/database.interface.d.ts +17 -0
- package/dist/shared/interfaces/database.interface.d.ts.map +1 -1
- package/dist/shared/interfaces/database.interface.js.map +1 -1
- package/package.json +1 -1
|
@@ -399,6 +399,8 @@ export interface NegotiationSessionStartEvent extends ChatStreamEventBase {
|
|
|
399
399
|
negotiationConversationId: string;
|
|
400
400
|
sourceUserId: string;
|
|
401
401
|
candidateUserId: string;
|
|
402
|
+
/** The user holding the initiating seat for this match (v2 stamp). */
|
|
403
|
+
initiatorUserId?: string;
|
|
402
404
|
candidateName?: string;
|
|
403
405
|
trigger: "orchestrator" | "ambient";
|
|
404
406
|
startedAt: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-streaming.types.d.ts","sourceRoot":"/","sources":["chat/chat-streaming.types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGvF,MAAM,MAAM,mBAAmB,GAC3B,QAAQ,GACR,SAAS,GACT,UAAU,GACV,gBAAgB,GAChB,iBAAiB,GACjB,OAAO,GACP,MAAM,GACN,OAAO,GAEP,YAAY,GACZ,UAAU,GACV,gBAAgB,GAEhB,eAAe,GAEf,iBAAiB,GACjB,WAAW,GACX,SAAS,GAET,mBAAmB,GACnB,gBAAgB,GAEhB,YAAY,GACZ,aAAa,GACb,WAAW,GACX,aAAa,GACb,WAAW,GACX,aAAa,GACb,WAAW,GACX,wBAAwB,GAExB,2BAA2B,GAC3B,yBAAyB,GACzB,kBAAkB,GAClB,qBAAqB,GAErB,uBAAuB,GACvB,qBAAqB,GACrB,0BAA0B,GAC1B,wBAAwB,GACxB,oBAAoB,GAEpB,eAAe,GAEf,gBAAgB,CAAC;AAErB;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+BAA+B;IAC/B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,mBAAmB;IACtD,IAAI,EAAE,QAAQ,CAAC;IACf,oCAAoC;IACpC,OAAO,EAAE,M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iB,CACtB,qBAAqB,EACrB,SAAS,EACT,OAAO,CACR,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC5C,SAAiB,EACjB,OAA4C;IAE5C,OAAO,iBAAiB,CAA2B,uBAAuB,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AACtG,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,SAAiB,EACjB,OAA0C;IAE1C,OAAO,iBAAiB,CAAyB,qBAAqB,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAClG,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,SAAiB,EACjB,OAA+C;IAE/C,OAAO,iBAAiB,CAA8B,0BAA0B,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAC5G,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,SAAiB,EACjB,OAA6C;IAE7C,OAAO,iBAAiB,CAA4B,wBAAwB,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AACxG,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,SAAiB,EACjB,OAAkC;IAElC,OAAO,iBAAiB,CAAyB,oBAAoB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AAC7F,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,SAAiB,EACjB,OAA6C;IAE7C,OAAO,iBAAiB,CAAoB,eAAe,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AACnF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CACrC,SAAiB,EACjB,QAA2B,EAC3B,SAAiB;IAEjB,OAAO,iBAAiB,CAAoB,gBAAgB,EAAE,SAAS,EAAE;QACvE,QAAQ;QACR,SAAS;KACV,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * SSE Event types for Chat Graph streaming.\n *\n * These types define the structure of events sent during streaming chat responses.\n * Events are sent as Server-Sent Events (SSE) with JSON payloads.\n */\n\nimport type { Question, QuestionStrategy } from \"../shared/schemas/question.schema.js\";\n\n// Event type discriminator\nexport type ChatStreamEventType =\n | \"status\"\n | \"routing\"\n | \"thinking\"\n | \"subgraph_start\"\n | \"subgraph_result\"\n | \"token\"\n | \"done\"\n | \"error\"\n // Agent Loop Architecture events\n | \"tool_start\"\n | \"tool_end\"\n | \"agent_thinking\"\n // Streaming narration events\n | \"tool_activity\"\n // Agent loop trace events\n | \"iteration_start\"\n | \"llm_start\"\n | \"llm_end\"\n // Internal response tracking events\n | \"response_complete\"\n | \"response_reset\"\n // Debug meta (per-turn graph/tool usage for copy debug)\n | \"debug_meta\"\n | \"graph_start\"\n | \"graph_end\"\n | \"phase_start\"\n | \"phase_end\"\n | \"agent_start\"\n | \"agent_end\"\n | \"hallucination_detected\"\n // Orchestrator-inline negotiation trace events\n | \"negotiation_session_start\"\n | \"negotiation_session_end\"\n | \"negotiation_turn\"\n | \"negotiation_outcome\"\n // Discovery decision-question events\n | \"chat_summarizer_start\"\n | \"chat_summarizer_end\"\n | \"question_generator_start\"\n | \"question_generator_end\"\n | \"decision_questions\"\n // Blocking mid-turn user question (ask_user_question tool)\n | \"user_question\"\n // Steer-or-queue interrupt event\n | \"steer_or_queue\";\n\n/**\n * Base interface for all chat stream events.\n */\nexport interface ChatStreamEventBase {\n /** Event type discriminator */\n type: ChatStreamEventType;\n /** Session ID for the chat session */\n sessionId: string;\n /** ISO 8601 timestamp */\n timestamp: string;\n}\n\n/**\n * Status event - sent to indicate processing state changes.\n */\nexport interface StatusEvent extends ChatStreamEventBase {\n type: \"status\";\n /** Human-readable status message */\n message: string;\n}\n\n/**\n * Routing event - sent when the router determines which subgraph to use.\n */\nexport interface RoutingEvent extends ChatStreamEventBase {\n type: \"routing\";\n /** Target subgraph name */\n target: string;\n /** Optional reasoning for the routing decision */\n reasoning?: string;\n}\n\n/**\n * Thinking event - sent to stream the model's reasoning and decision-making process.\n */\nexport interface ThinkingEvent extends ChatStreamEventBase {\n type: \"thinking\";\n /** The thinking/reasoning content */\n content: string;\n /** Optional step identifier (e.g., 'router', 'inference', 'verification') */\n step?: string;\n}\n\n/**\n * Subgraph start event - sent when a subgraph begins processing.\n */\nexport interface SubgraphStartEvent extends ChatStreamEventBase {\n type: \"subgraph_start\";\n /** Name of the subgraph being executed */\n subgraph: string;\n}\n\n/**\n * Subgraph result event - sent when a subgraph completes with results.\n */\nexport interface SubgraphResultEvent extends ChatStreamEventBase {\n type: \"subgraph_result\";\n /** Name of the subgraph that completed */\n subgraph: string;\n /** Result data from the subgraph */\n data: Record<string, unknown>;\n}\n\n/**\n * Token event - sent for each token during streaming response.\n */\nexport interface TokenEvent extends ChatStreamEventBase {\n type: \"token\";\n /** Token content (partial text) */\n content: string;\n}\n\n/**\n * Chat suggestion for follow-up actions.\n * Matches frontend Suggestion type (label, type, followupText/prefill).\n */\nexport interface ChatSuggestion {\n label: string;\n type: \"direct\" | \"prompt\";\n /** For 'direct' type: text to auto-submit as next message */\n followupText?: string;\n /** For 'prompt' type: text to prefill the input */\n prefill?: string;\n}\n\n/**\n * Rich opportunity card data for chat messages.\n * Matches the home page card format for consistent rendering.\n */\nexport interface OpportunityCardPayload {\n opportunityId: string;\n userId: string;\n name?: string;\n avatar?: string | null;\n /** Main body text (personalizedSummary from presenter). */\n mainText: string;\n /** Call-to-action line (suggestedAction from presenter). */\n cta?: string;\n /** Short headline hook. */\n headline?: string;\n /** Label for primary action button (e.g. \"Start Chat\"). */\n primaryActionLabel?: string;\n /** Label for secondary action button (e.g. \"Skip\"). */\n secondaryActionLabel?: string;\n /** Subtitle under the other party name (e.g. \"1 mutual intent\"). */\n mutualIntentsLabel?: string;\n /** Narrator chip for human-introduced opportunities. */\n narratorChip?: {\n name: string;\n text: string;\n avatar?: string | null;\n userId?: string;\n };\n /** Viewer's role in this opportunity. */\n viewerRole?: string;\n /** Match confidence score (0-1). */\n score?: number;\n /** Opportunity status. */\n status?: string;\n /** Second party in introducer arrow layout (name -> name). Present when viewerRole is 'introducer'. */\n secondParty?: {\n name: string;\n avatar?: string | null;\n userId?: string;\n };\n}\n\n/**\n * Done event - sent when the response is complete.\n */\nexport interface DoneEvent extends ChatStreamEventBase {\n type: \"done\";\n /** Complete response text */\n response: string;\n /** Server-generated assistant message ID (for trace event persistence) */\n messageId?: string;\n /** Optional routing decision metadata */\n routingDecision?: Record<string, unknown>;\n /** Optional subgraph results metadata */\n subgraphResults?: Record<string, unknown>;\n /** Optional session title (auto-generated or existing) */\n title?: string;\n /** Optional context-aware follow-up suggestions */\n suggestions?: ChatSuggestion[];\n /** Optional rich opportunity cards returned by tools */\n opportunityCards?: OpportunityCardPayload[];\n /** Decision questions to render (orchestrator flow only). */\n decisionQuestions?: Question[];\n}\n\n/**\n * Error event - sent when an error occurs.\n */\nexport interface ErrorEvent extends ChatStreamEventBase {\n type: \"error\";\n /** Human-readable error message */\n message: string;\n /** Optional error code for programmatic handling */\n code?: string;\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// AGENT LOOP ARCHITECTURE EVENTS\n// ════════════════════════════════════════════════════════════════════════════\n\n/**\n * Tool start event - sent when a tool begins executing.\n */\nexport interface ToolStartEvent extends ChatStreamEventBase {\n type: \"tool_start\";\n /** Name of the tool being executed */\n toolName: string;\n /** Arguments passed to the tool */\n toolArgs: Record<string, unknown>;\n}\n\n/**\n * Tool end event - sent when a tool finishes executing.\n */\nexport interface ToolEndEvent extends ChatStreamEventBase {\n type: \"tool_end\";\n /** Name of the tool that completed */\n toolName: string;\n /** Whether the tool execution succeeded */\n success: boolean;\n /** Brief summary of the result */\n resultSummary?: string;\n}\n\n/**\n * Agent thinking event - sent between agent iterations.\n */\nexport interface AgentThinkingEvent extends ChatStreamEventBase {\n type: \"agent_thinking\";\n /** Current iteration number */\n iteration: number;\n /** Tools used in this iteration */\n toolsUsed: string[];\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// AGENT LOOP TRACE EVENTS\n// ════════════════════════════════════════════════════════════════════════════\n\n/**\n * Iteration start event - emitted when a new agent loop iteration begins.\n */\nexport interface IterationStartEvent extends ChatStreamEventBase {\n type: \"iteration_start\";\n iteration: number;\n}\n\n/**\n * LLM start event - emitted when the LLM begins generating a response.\n */\nexport interface LlmStartEvent extends ChatStreamEventBase {\n type: \"llm_start\";\n iteration: number;\n}\n\n/**\n * LLM end event - emitted when the LLM finishes generating (may include tool calls).\n */\nexport interface LlmEndEvent extends ChatStreamEventBase {\n type: \"llm_end\";\n iteration: number;\n hasToolCalls: boolean;\n toolNames?: string[];\n}\n\n/**\n * Tool activity event - inline narration of tool execution.\n * Sent as the agent streams its response, replacing the old ThinkingDropdown.\n */\nexport interface ToolActivityEvent extends ChatStreamEventBase {\n type: \"tool_activity\";\n /** Internal tool name */\n toolName: string;\n /** User-friendly description (e.g. \"Looking up your profile...\") */\n description: string;\n /** Whether the tool is starting or has finished */\n phase: \"start\" | \"end\";\n /** Whether the tool succeeded (present when phase === 'end') */\n success?: boolean;\n /** Brief result summary (present when phase === 'end') */\n summary?: string;\n /** Internal steps executed by this tool (present when phase === 'end') */\n steps?: DebugMetaStep[];\n}\n\n/**\n * Internal event carrying the agent's authoritative final response text.\n * Emitted by the streamer after the graph completes. Not forwarded to the frontend SSE stream.\n */\nexport interface ResponseCompleteEvent extends ChatStreamEventBase {\n type: \"response_complete\";\n /** The agent's final response text (from the last iteration only) */\n response: string;\n}\n\n/**\n * Response reset event — tells the frontend to discard all previously streamed tokens.\n * Emitted when the agent detects hallucinated code blocks and forces a correction iteration.\n */\nexport interface ResponseResetEvent extends ChatStreamEventBase {\n type: \"response_reset\";\n /** Human-readable reason for the reset */\n reason: string;\n}\n\n/**\n * Hallucination detected event — tells the frontend that the agent caught a\n * hallucinated code block and is auto-invoking the correct tool.\n */\nexport interface HallucinationDetectedEvent extends ChatStreamEventBase {\n type: \"hallucination_detected\";\n /** The type of block that was hallucinated (e.g. \"intent_proposal\", \"opportunity\") */\n blockType: string;\n /** The tool being auto-invoked to recover */\n tool: string;\n}\n\n/**\n * One internal step reported by a tool for debug visibility (e.g. subgraph, subtask).\n */\nexport interface DebugMetaStep {\n step: string;\n detail?: string;\n /** Structured data for rich display (e.g., Felicity scores, classification, candidate info). */\n data?: Record<string, unknown>;\n}\n\n/**\n * One agent invocation recorded inside a graph run.\n */\nexport interface DebugMetaAgent {\n /** Name of the agent (e.g. \"opportunity.evaluator\"). */\n name: string;\n /** Wall-clock milliseconds for this agent invocation. */\n durationMs: number;\n}\n\n/**\n * One graph invocation recorded by a tool that calls a LangGraph graph.\n */\nexport interface DebugMetaGraph {\n /** Name of the graph (e.g. \"opportunity\"). */\n name: string;\n /** Wall-clock milliseconds for the full graph run. */\n durationMs: number;\n /** Agent invocations recorded inside this graph run. */\n agents: DebugMetaAgent[];\n}\n\n/**\n * One tool call entry in debug meta (sanitized args, result summary, optional steps).\n */\nexport interface DebugMetaToolCall {\n name: string;\n args: Record<string, unknown>;\n resultSummary: string;\n success: boolean;\n /** Wall-clock milliseconds for the full tool execution. */\n durationMs: number;\n /** Internal steps (subgraphs, subtasks) when the tool reports debugSteps in its result. */\n steps?: DebugMetaStep[];\n /** LangGraph graphs invoked by this tool, with their agent timings. */\n graphs?: DebugMetaGraph[];\n}\n\n/**\n * LLM call statistics accumulated during a single agent turn.\n */\nexport interface DebugMetaLlm {\n /** Total number of LLM calls made in this turn. */\n calls: number;\n /** Cumulative wall-clock time spent waiting for the LLM across all calls. */\n totalDurationMs: number;\n /** Entries recorded each time a response_reset event was emitted. */\n resets: Array<{ reason: string; at: number }>;\n /** Entries recorded each time a hallucination_detected event was emitted. */\n hallucinations: Array<{ blockType: string; tool: string; at: number }>;\n}\n\n/**\n * Negotiation sessions initiated by the orchestrator during this turn.\n */\nexport interface DebugMetaOrchestratorNegotiations {\n /** Opportunity IDs for which a negotiation_session_start was emitted. */\n opportunityIds: string[];\n}\n\n/**\n * Decision-question generation debug data (orchestrator path only).\n */\nexport interface DebugMetaDiscoveryQuestions {\n inputMode: \"transcripts\" | \"insights\";\n finalCount: number;\n strategies: QuestionStrategy[];\n durationMs: number;\n}\n\n/**\n * Debug meta event - per-turn graph and tool usage for copy debug.\n */\nexport interface DebugMetaEvent extends ChatStreamEventBase {\n type: \"debug_meta\";\n graph: string;\n iterations: number;\n tools: DebugMetaToolCall[];\n llm: DebugMetaLlm;\n orchestratorNegotiations?: DebugMetaOrchestratorNegotiations;\n /** Decision-question generation debug data (orchestrator path only). */\n discoveryQuestions?: DebugMetaDiscoveryQuestions;\n}\n\n/** Graph start event — emitted when a LangGraph sub-graph begins inside a tool. */\nexport interface GraphStartEvent extends ChatStreamEventBase {\n type: \"graph_start\";\n graphName: string;\n}\n\n/** Graph end event — emitted when a LangGraph sub-graph completes. */\nexport interface GraphEndEvent extends ChatStreamEventBase {\n type: \"graph_end\";\n graphName: string;\n durationMs: number;\n}\n\n/**\n * Phase start event — emitted when a logical groupings of inline work begins\n * inside a tool. Phases share container semantics with graphs (they can host\n * agents) but render differently in the trace UI so users can tell them\n * apart from LangGraph state machines.\n */\nexport interface PhaseStartEvent extends ChatStreamEventBase {\n type: \"phase_start\";\n phaseName: string;\n}\n\n/** Phase end event — emitted when a logical phase completes. */\nexport interface PhaseEndEvent extends ChatStreamEventBase {\n type: \"phase_end\";\n phaseName: string;\n durationMs: number;\n}\n\n/** Agent start event — emitted when an LLM agent begins inside a graph node. */\nexport interface AgentStartEvent extends ChatStreamEventBase {\n type: \"agent_start\";\n agentName: string;\n}\n\n/** Agent end event — emitted when an LLM agent completes. */\nexport interface AgentEndEvent extends ChatStreamEventBase {\n type: \"agent_end\";\n agentName: string;\n durationMs: number;\n /** Structured outcome summary, e.g. \"5 of 12 passed\" or \"3 intents extracted\". */\n summary: string;\n}\n\n/** Orchestrator per-candidate negotiation wrapper — emitted from `negotiateCandidates`. */\nexport interface NegotiationSessionStartEvent extends ChatStreamEventBase {\n type: \"negotiation_session_start\";\n opportunityId: string;\n negotiationConversationId: string;\n sourceUserId: string;\n candidateUserId: string;\n candidateName?: string;\n trigger: \"orchestrator\" | \"ambient\";\n startedAt: number;\n}\n\nexport interface NegotiationSessionEndEvent extends ChatStreamEventBase {\n type: \"negotiation_session_end\";\n opportunityId: string;\n negotiationConversationId: string;\n durationMs: number;\n}\n\n/** One turn inside a bilateral negotiation. Emitted by the negotiation graph's turn node. */\nexport interface NegotiationTurnEvent extends ChatStreamEventBase {\n type: \"negotiation_turn\";\n opportunityId: string;\n negotiationConversationId: string;\n turnIndex: number;\n actor: \"source\" | \"candidate\";\n action: \"propose\" | \"accept\" | \"reject\" | \"counter\" | \"question\";\n reasoning?: string;\n message?: string;\n suggestedRoles?: { ownUser?: string; otherUser?: string };\n durationMs: number;\n}\n\nexport interface NegotiationOutcomeEvent extends ChatStreamEventBase {\n type: \"negotiation_outcome\";\n opportunityId: string;\n outcome:\n | \"accepted\"\n | \"rejected_stalled\"\n | \"waiting_for_agent\"\n | \"timed_out\"\n | \"turn_cap\";\n turnCount: number;\n reasoning?: string;\n agreedRoles?: { ownUser?: string; otherUser?: string };\n}\n\nexport interface ChatSummarizerStartEvent extends ChatStreamEventBase {\n type: \"chat_summarizer_start\";\n payload: { sessionId: string };\n}\n\nexport interface ChatSummarizerEndEvent extends ChatStreamEventBase {\n type: \"chat_summarizer_end\";\n payload: {\n durationMs: number;\n };\n}\n\nexport interface QuestionGeneratorStartEvent extends ChatStreamEventBase {\n type: \"question_generator_start\";\n payload: {\n inputMode: \"transcripts\" | \"insights\";\n negotiationCount: number;\n hasChatContext: boolean;\n truncated?: { originalCount: number; keptCount: number };\n };\n}\n\nexport interface QuestionGeneratorEndEvent extends ChatStreamEventBase {\n type: \"question_generator_end\";\n payload: {\n finalCount: number;\n strategies: QuestionStrategy[];\n durationMs: number;\n inputMode: \"transcripts\" | \"insights\";\n };\n}\n\nexport interface DecisionQuestionsEvent extends ChatStreamEventBase {\n type: \"decision_questions\";\n questions: Question[];\n}\n\n/**\n * One persisted question streamed by the ask_user_question tool.\n * Carries the DB id so the frontend can answer/dismiss it through the\n * questions REST endpoints while the turn is still blocked.\n */\nexport interface UserQuestionPayload {\n id: string;\n title: string;\n prompt: string;\n options: Array<{ label: string; description: string }>;\n multiSelect: boolean;\n}\n\n/**\n * User question event — emitted when the orchestrator's ask_user_question\n * tool persisted chat-mode questions and is now blocking the turn awaiting\n * the user's inline answer.\n */\nexport interface UserQuestionEvent extends ChatStreamEventBase {\n type: \"user_question\";\n questions: UserQuestionPayload[];\n}\n\n/**\n * Steer-or-queue event — injected into the active SSE stream by the /chat/interrupt\n * endpoint after the classifier runs. The frontend holds the mid-stream message as\n * \"pending\" until this event arrives, then acts on the decision.\n */\nexport interface SteerOrQueueEvent extends ChatStreamEventBase {\n type: \"steer_or_queue\";\n /** Classifier decision: interrupt and restart, or buffer until current run completes. */\n decision: \"steer\" | \"queue\";\n /** Echoed from the interrupt request so the frontend can update the correct pending message. */\n messageId: string;\n}\n\n/**\n * Union type of all chat stream events.\n */\nexport type ChatStreamEvent =\n | StatusEvent\n | RoutingEvent\n | ThinkingEvent\n | SubgraphStartEvent\n | SubgraphResultEvent\n | TokenEvent\n | DoneEvent\n | ErrorEvent\n // Agent Loop Architecture events\n | ToolStartEvent\n | ToolEndEvent\n | AgentThinkingEvent\n // Streaming narration events\n | ToolActivityEvent\n // Agent loop trace events\n | IterationStartEvent\n | LlmStartEvent\n | LlmEndEvent\n // Internal response tracking events\n | ResponseCompleteEvent\n | ResponseResetEvent\n | HallucinationDetectedEvent\n // Debug meta\n | DebugMetaEvent\n // Trace hierarchy events\n | GraphStartEvent\n | GraphEndEvent\n | PhaseStartEvent\n | PhaseEndEvent\n | AgentStartEvent\n | AgentEndEvent\n | NegotiationSessionStartEvent\n | NegotiationSessionEndEvent\n | NegotiationTurnEvent\n | NegotiationOutcomeEvent\n | ChatSummarizerStartEvent\n | ChatSummarizerEndEvent\n | QuestionGeneratorStartEvent\n | QuestionGeneratorEndEvent\n | DecisionQuestionsEvent\n | UserQuestionEvent\n | SteerOrQueueEvent;\n\n/**\n * Formats a chat stream event as an SSE message. If JSON.stringify throws (e.g. circular ref,\n * non-serializable value), returns a minimal error event so the stream stays valid.\n *\n * @param event - The event to format\n * @returns SSE-formatted string with \"data: \" prefix and double newline\n */\nexport function formatSSEEvent(event: ChatStreamEvent): string {\n try {\n return `data: ${JSON.stringify(event)}\\n\\n`;\n } catch (serializeError) {\n const fallback: ErrorEvent = {\n type: \"error\",\n sessionId:\n typeof (event as ChatStreamEventBase).sessionId === \"string\"\n ? (event as ChatStreamEventBase).sessionId\n : \"unknown\",\n timestamp: new Date().toISOString(),\n message: \"Response could not be serialized. Please try again.\",\n code: \"SERIALIZATION_ERROR\",\n };\n return `data: ${JSON.stringify(fallback)}\\n\\n`;\n }\n}\n\n/**\n * Creates a chat stream event with common fields populated.\n *\n * @param type - Event type\n * @param sessionId - Session ID\n * @param data - Event-specific data (excluding type, sessionId, timestamp)\n * @returns Complete event object\n *\n * @example\n * ```ts\n * const statusEvent = createStreamEvent<StatusEvent>('status', 'session-123', {\n * message: 'Processing your request...'\n * });\n * ```\n */\nexport function createStreamEvent<T extends ChatStreamEvent>(\n type: T[\"type\"],\n sessionId: string,\n data: Omit<T, \"type\" | \"sessionId\" | \"timestamp\">,\n): T {\n return {\n ...data,\n type,\n sessionId,\n timestamp: new Date().toISOString(),\n } as T;\n}\n\n/**\n * Type guard to check if an event is a specific type.\n */\nexport function isEventType<T extends ChatStreamEvent>(\n event: ChatStreamEvent,\n type: T[\"type\"],\n): event is T {\n return event.type === type;\n}\n\n/**\n * Creates a formatted status event.\n */\nexport function createStatusEvent(\n sessionId: string,\n message: string,\n): StatusEvent {\n return createStreamEvent<StatusEvent>(\"status\", sessionId, { message });\n}\n\n/**\n * Creates a formatted routing event.\n */\nexport function createRoutingEvent(\n sessionId: string,\n target: string,\n reasoning?: string,\n): RoutingEvent {\n return createStreamEvent<RoutingEvent>(\"routing\", sessionId, {\n target,\n reasoning,\n });\n}\n\n/**\n * Creates a formatted subgraph start event.\n */\nexport function createSubgraphStartEvent(\n sessionId: string,\n subgraph: string,\n): SubgraphStartEvent {\n return createStreamEvent<SubgraphStartEvent>(\"subgraph_start\", sessionId, {\n subgraph,\n });\n}\n\n/**\n * Creates a formatted subgraph result event.\n */\nexport function createSubgraphResultEvent(\n sessionId: string,\n subgraph: string,\n data: Record<string, unknown>,\n): SubgraphResultEvent {\n return createStreamEvent<SubgraphResultEvent>(\"subgraph_result\", sessionId, {\n subgraph,\n data,\n });\n}\n\n/**\n * Creates a formatted token event.\n */\nexport function createTokenEvent(\n sessionId: string,\n content: string,\n): TokenEvent {\n return createStreamEvent<TokenEvent>(\"token\", sessionId, { content });\n}\n\n/**\n * Options for the done event (optional metadata).\n */\nexport interface CreateDoneEventOptions {\n messageId?: string;\n routingDecision?: Record<string, unknown>;\n subgraphResults?: Record<string, unknown>;\n title?: string;\n suggestions?: ChatSuggestion[];\n opportunityCards?: OpportunityCardPayload[];\n decisionQuestions?: Question[];\n}\n\n/**\n * Creates a formatted done event.\n */\nexport function createDoneEvent(\n sessionId: string,\n response: string,\n options?: CreateDoneEventOptions,\n): DoneEvent {\n return createStreamEvent<DoneEvent>(\"done\", sessionId, {\n ...options,\n response,\n });\n}\n\n/**\n * Creates a formatted error event.\n */\nexport function createErrorEvent(\n sessionId: string,\n message: string,\n code?: string,\n): ErrorEvent {\n return createStreamEvent<ErrorEvent>(\"error\", sessionId, { message, code });\n}\n\n/**\n * Creates a formatted thinking event.\n */\nexport function createThinkingEvent(\n sessionId: string,\n content: string,\n step?: string,\n): ThinkingEvent {\n return createStreamEvent<ThinkingEvent>(\"thinking\", sessionId, {\n content,\n step,\n });\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// AGENT LOOP EVENT CREATORS\n// ════════════════════════════════════════════════════════════════════════════\n\n/**\n * Creates a formatted tool start event.\n */\nexport function createToolStartEvent(\n sessionId: string,\n toolName: string,\n toolArgs: Record<string, unknown>,\n): ToolStartEvent {\n return createStreamEvent<ToolStartEvent>(\"tool_start\", sessionId, {\n toolName,\n toolArgs,\n });\n}\n\n/**\n * Creates a formatted tool end event.\n */\nexport function createToolEndEvent(\n sessionId: string,\n toolName: string,\n success: boolean,\n resultSummary?: string,\n): ToolEndEvent {\n return createStreamEvent<ToolEndEvent>(\"tool_end\", sessionId, {\n toolName,\n success,\n resultSummary,\n });\n}\n\n/**\n * Creates a formatted agent thinking event.\n */\nexport function createAgentThinkingEvent(\n sessionId: string,\n iteration: number,\n toolsUsed: string[],\n): AgentThinkingEvent {\n return createStreamEvent<AgentThinkingEvent>(\"agent_thinking\", sessionId, {\n iteration,\n toolsUsed,\n });\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// AGENT LOOP TRACE EVENT CREATORS\n// ════════════════════════════════════════════════════════════════════════════\n\n/**\n * Creates a formatted iteration start event.\n */\nexport function createIterationStartEvent(\n sessionId: string,\n iteration: number,\n): IterationStartEvent {\n return createStreamEvent<IterationStartEvent>(\"iteration_start\", sessionId, {\n iteration,\n });\n}\n\n/**\n * Creates a formatted LLM start event.\n */\nexport function createLlmStartEvent(\n sessionId: string,\n iteration: number,\n): LlmStartEvent {\n return createStreamEvent<LlmStartEvent>(\"llm_start\", sessionId, {\n iteration,\n });\n}\n\n/**\n * Creates a formatted LLM end event.\n */\nexport function createLlmEndEvent(\n sessionId: string,\n iteration: number,\n hasToolCalls: boolean,\n toolNames?: string[],\n): LlmEndEvent {\n return createStreamEvent<LlmEndEvent>(\"llm_end\", sessionId, {\n iteration,\n hasToolCalls,\n toolNames,\n });\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// STREAMING NARRATION EVENT CREATORS\n// ════════════════════════════════════════════════════════════════════════════\n\n/**\n * Creates a formatted tool activity event (inline narration).\n */\nexport function createToolActivityEvent(\n sessionId: string,\n toolName: string,\n description: string,\n phase: \"start\" | \"end\",\n success?: boolean,\n summary?: string,\n steps?: DebugMetaStep[],\n): ToolActivityEvent {\n return createStreamEvent<ToolActivityEvent>(\"tool_activity\", sessionId, {\n toolName,\n description,\n phase,\n success,\n summary,\n steps,\n });\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// INTERNAL RESPONSE TRACKING EVENT CREATORS\n// ════════════════════════════════════════════════════════════════════════════\n\n/**\n * Creates a formatted response complete event.\n */\nexport function createResponseCompleteEvent(\n sessionId: string,\n response: string,\n): ResponseCompleteEvent {\n return createStreamEvent<ResponseCompleteEvent>(\"response_complete\", sessionId, { response });\n}\n\n/**\n * Creates a formatted response reset event.\n * Tells the frontend to discard all previously streamed tokens.\n */\nexport function createResponseResetEvent(\n sessionId: string,\n reason: string,\n): ResponseResetEvent {\n return createStreamEvent<ResponseResetEvent>(\"response_reset\", sessionId, { reason });\n}\n\n/**\n * Creates a hallucination detected event for the trace panel.\n */\nexport function createHallucinationDetectedEvent(\n sessionId: string,\n blockType: string,\n tool: string,\n): HallucinationDetectedEvent {\n return createStreamEvent<HallucinationDetectedEvent>(\"hallucination_detected\", sessionId, { blockType, tool });\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// DEBUG META EVENT CREATORS\n// ════════════════════════════════════════════════════════════════════════════\n\n/**\n * Creates a formatted debug meta event (per-turn graph and tool usage).\n */\nexport function createDebugMetaEvent(\n sessionId: string,\n graph: string,\n iterations: number,\n tools: DebugMetaToolCall[],\n llm: DebugMetaLlm,\n orchestratorNegotiations?: DebugMetaOrchestratorNegotiations,\n discoveryQuestions?: DebugMetaDiscoveryQuestions,\n): DebugMetaEvent {\n return createStreamEvent<DebugMetaEvent>(\"debug_meta\", sessionId, {\n graph,\n iterations,\n tools,\n llm,\n ...(orchestratorNegotiations !== undefined && { orchestratorNegotiations }),\n ...(discoveryQuestions !== undefined && { discoveryQuestions }),\n });\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// TRACE HIERARCHY EVENT CREATORS\n// ════════════════════════════════════════════════════════════════════════════\n\n/**\n * Creates a graph start event emitted when a LangGraph sub-graph begins inside a tool.\n */\nexport function createGraphStartEvent(sessionId: string, graphName: string): GraphStartEvent {\n return createStreamEvent<GraphStartEvent>(\"graph_start\", sessionId, { graphName });\n}\n\n/**\n * Creates a graph end event emitted when a LangGraph sub-graph completes.\n */\nexport function createGraphEndEvent(sessionId: string, graphName: string, durationMs: number): GraphEndEvent {\n return createStreamEvent<GraphEndEvent>(\"graph_end\", sessionId, { graphName, durationMs });\n}\n\nexport function createPhaseStartEvent(sessionId: string, phaseName: string): PhaseStartEvent {\n return createStreamEvent<PhaseStartEvent>(\"phase_start\", sessionId, { phaseName });\n}\n\nexport function createPhaseEndEvent(sessionId: string, phaseName: string, durationMs: number): PhaseEndEvent {\n return createStreamEvent<PhaseEndEvent>(\"phase_end\", sessionId, { phaseName, durationMs });\n}\n\n/**\n * Creates an agent start event emitted when an LLM agent begins inside a graph node.\n */\nexport function createAgentStartEvent(sessionId: string, agentName: string): AgentStartEvent {\n return createStreamEvent<AgentStartEvent>(\"agent_start\", sessionId, { agentName });\n}\n\n/**\n * Creates an agent end event emitted when an LLM agent completes.\n */\nexport function createAgentEndEvent(\n sessionId: string,\n agentName: string,\n durationMs: number,\n summary: string,\n): AgentEndEvent {\n return createStreamEvent<AgentEndEvent>(\"agent_end\", sessionId, { agentName, durationMs, summary });\n}\n\nexport function createNegotiationSessionStartEvent(\n sessionId: string,\n payload: Omit<NegotiationSessionStartEvent, \"type\" | \"sessionId\" | \"timestamp\">,\n): NegotiationSessionStartEvent {\n return createStreamEvent<NegotiationSessionStartEvent>(\n \"negotiation_session_start\",\n sessionId,\n payload,\n );\n}\n\nexport function createNegotiationSessionEndEvent(\n sessionId: string,\n payload: Omit<NegotiationSessionEndEvent, \"type\" | \"sessionId\" | \"timestamp\">,\n): NegotiationSessionEndEvent {\n return createStreamEvent<NegotiationSessionEndEvent>(\n \"negotiation_session_end\",\n sessionId,\n payload,\n );\n}\n\nexport function createNegotiationTurnEvent(\n sessionId: string,\n payload: Omit<NegotiationTurnEvent, \"type\" | \"sessionId\" | \"timestamp\">,\n): NegotiationTurnEvent {\n return createStreamEvent<NegotiationTurnEvent>(\"negotiation_turn\", sessionId, payload);\n}\n\nexport function createNegotiationOutcomeEvent(\n sessionId: string,\n payload: Omit<NegotiationOutcomeEvent, \"type\" | \"sessionId\" | \"timestamp\">,\n): NegotiationOutcomeEvent {\n return createStreamEvent<NegotiationOutcomeEvent>(\n \"negotiation_outcome\",\n sessionId,\n payload,\n );\n}\n\nexport function createChatSummarizerStartEvent(\n sessionId: string,\n payload: ChatSummarizerStartEvent[\"payload\"],\n): ChatSummarizerStartEvent {\n return createStreamEvent<ChatSummarizerStartEvent>(\"chat_summarizer_start\", sessionId, { payload });\n}\n\nexport function createChatSummarizerEndEvent(\n sessionId: string,\n payload: ChatSummarizerEndEvent[\"payload\"],\n): ChatSummarizerEndEvent {\n return createStreamEvent<ChatSummarizerEndEvent>(\"chat_summarizer_end\", sessionId, { payload });\n}\n\nexport function createQuestionGeneratorStartEvent(\n sessionId: string,\n payload: QuestionGeneratorStartEvent[\"payload\"],\n): QuestionGeneratorStartEvent {\n return createStreamEvent<QuestionGeneratorStartEvent>(\"question_generator_start\", sessionId, { payload });\n}\n\nexport function createQuestionGeneratorEndEvent(\n sessionId: string,\n payload: QuestionGeneratorEndEvent[\"payload\"],\n): QuestionGeneratorEndEvent {\n return createStreamEvent<QuestionGeneratorEndEvent>(\"question_generator_end\", sessionId, { payload });\n}\n\nexport function createDecisionQuestionsEvent(\n sessionId: string,\n payload: { questions: Question[] },\n): DecisionQuestionsEvent {\n return createStreamEvent<DecisionQuestionsEvent>(\"decision_questions\", sessionId, payload);\n}\n\nexport function createUserQuestionEvent(\n sessionId: string,\n payload: { questions: UserQuestionPayload[] },\n): UserQuestionEvent {\n return createStreamEvent<UserQuestionEvent>(\"user_question\", sessionId, payload);\n}\n\n/**\n * Creates a steer-or-queue event injected into the active stream by the interrupt endpoint.\n */\nexport function createSteerOrQueueEvent(\n sessionId: string,\n decision: \"steer\" | \"queue\",\n messageId: string,\n): SteerOrQueueEvent {\n return createStreamEvent<SteerOrQueueEvent>(\"steer_or_queue\", sessionId, {\n decision,\n messageId,\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AAC;AACnF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CACrC,SAAiB,EACjB,QAA2B,EAC3B,SAAiB;IAEjB,OAAO,iBAAiB,CAAoB,gBAAgB,EAAE,SAAS,EAAE;QACvE,QAAQ;QACR,SAAS;KACV,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * SSE Event types for Chat Graph streaming.\n *\n * These types define the structure of events sent during streaming chat responses.\n * Events are sent as Server-Sent Events (SSE) with JSON payloads.\n */\n\nimport type { Question, QuestionStrategy } from \"../shared/schemas/question.schema.js\";\n\n// Event type discriminator\nexport type ChatStreamEventType =\n | \"status\"\n | \"routing\"\n | \"thinking\"\n | \"subgraph_start\"\n | \"subgraph_result\"\n | \"token\"\n | \"done\"\n | \"error\"\n // Agent Loop Architecture events\n | \"tool_start\"\n | \"tool_end\"\n | \"agent_thinking\"\n // Streaming narration events\n | \"tool_activity\"\n // Agent loop trace events\n | \"iteration_start\"\n | \"llm_start\"\n | \"llm_end\"\n // Internal response tracking events\n | \"response_complete\"\n | \"response_reset\"\n // Debug meta (per-turn graph/tool usage for copy debug)\n | \"debug_meta\"\n | \"graph_start\"\n | \"graph_end\"\n | \"phase_start\"\n | \"phase_end\"\n | \"agent_start\"\n | \"agent_end\"\n | \"hallucination_detected\"\n // Orchestrator-inline negotiation trace events\n | \"negotiation_session_start\"\n | \"negotiation_session_end\"\n | \"negotiation_turn\"\n | \"negotiation_outcome\"\n // Discovery decision-question events\n | \"chat_summarizer_start\"\n | \"chat_summarizer_end\"\n | \"question_generator_start\"\n | \"question_generator_end\"\n | \"decision_questions\"\n // Blocking mid-turn user question (ask_user_question tool)\n | \"user_question\"\n // Steer-or-queue interrupt event\n | \"steer_or_queue\";\n\n/**\n * Base interface for all chat stream events.\n */\nexport interface ChatStreamEventBase {\n /** Event type discriminator */\n type: ChatStreamEventType;\n /** Session ID for the chat session */\n sessionId: string;\n /** ISO 8601 timestamp */\n timestamp: string;\n}\n\n/**\n * Status event - sent to indicate processing state changes.\n */\nexport interface StatusEvent extends ChatStreamEventBase {\n type: \"status\";\n /** Human-readable status message */\n message: string;\n}\n\n/**\n * Routing event - sent when the router determines which subgraph to use.\n */\nexport interface RoutingEvent extends ChatStreamEventBase {\n type: \"routing\";\n /** Target subgraph name */\n target: string;\n /** Optional reasoning for the routing decision */\n reasoning?: string;\n}\n\n/**\n * Thinking event - sent to stream the model's reasoning and decision-making process.\n */\nexport interface ThinkingEvent extends ChatStreamEventBase {\n type: \"thinking\";\n /** The thinking/reasoning content */\n content: string;\n /** Optional step identifier (e.g., 'router', 'inference', 'verification') */\n step?: string;\n}\n\n/**\n * Subgraph start event - sent when a subgraph begins processing.\n */\nexport interface SubgraphStartEvent extends ChatStreamEventBase {\n type: \"subgraph_start\";\n /** Name of the subgraph being executed */\n subgraph: string;\n}\n\n/**\n * Subgraph result event - sent when a subgraph completes with results.\n */\nexport interface SubgraphResultEvent extends ChatStreamEventBase {\n type: \"subgraph_result\";\n /** Name of the subgraph that completed */\n subgraph: string;\n /** Result data from the subgraph */\n data: Record<string, unknown>;\n}\n\n/**\n * Token event - sent for each token during streaming response.\n */\nexport interface TokenEvent extends ChatStreamEventBase {\n type: \"token\";\n /** Token content (partial text) */\n content: string;\n}\n\n/**\n * Chat suggestion for follow-up actions.\n * Matches frontend Suggestion type (label, type, followupText/prefill).\n */\nexport interface ChatSuggestion {\n label: string;\n type: \"direct\" | \"prompt\";\n /** For 'direct' type: text to auto-submit as next message */\n followupText?: string;\n /** For 'prompt' type: text to prefill the input */\n prefill?: string;\n}\n\n/**\n * Rich opportunity card data for chat messages.\n * Matches the home page card format for consistent rendering.\n */\nexport interface OpportunityCardPayload {\n opportunityId: string;\n userId: string;\n name?: string;\n avatar?: string | null;\n /** Main body text (personalizedSummary from presenter). */\n mainText: string;\n /** Call-to-action line (suggestedAction from presenter). */\n cta?: string;\n /** Short headline hook. */\n headline?: string;\n /** Label for primary action button (e.g. \"Start Chat\"). */\n primaryActionLabel?: string;\n /** Label for secondary action button (e.g. \"Skip\"). */\n secondaryActionLabel?: string;\n /** Subtitle under the other party name (e.g. \"1 mutual intent\"). */\n mutualIntentsLabel?: string;\n /** Narrator chip for human-introduced opportunities. */\n narratorChip?: {\n name: string;\n text: string;\n avatar?: string | null;\n userId?: string;\n };\n /** Viewer's role in this opportunity. */\n viewerRole?: string;\n /** Match confidence score (0-1). */\n score?: number;\n /** Opportunity status. */\n status?: string;\n /** Second party in introducer arrow layout (name -> name). Present when viewerRole is 'introducer'. */\n secondParty?: {\n name: string;\n avatar?: string | null;\n userId?: string;\n };\n}\n\n/**\n * Done event - sent when the response is complete.\n */\nexport interface DoneEvent extends ChatStreamEventBase {\n type: \"done\";\n /** Complete response text */\n response: string;\n /** Server-generated assistant message ID (for trace event persistence) */\n messageId?: string;\n /** Optional routing decision metadata */\n routingDecision?: Record<string, unknown>;\n /** Optional subgraph results metadata */\n subgraphResults?: Record<string, unknown>;\n /** Optional session title (auto-generated or existing) */\n title?: string;\n /** Optional context-aware follow-up suggestions */\n suggestions?: ChatSuggestion[];\n /** Optional rich opportunity cards returned by tools */\n opportunityCards?: OpportunityCardPayload[];\n /** Decision questions to render (orchestrator flow only). */\n decisionQuestions?: Question[];\n}\n\n/**\n * Error event - sent when an error occurs.\n */\nexport interface ErrorEvent extends ChatStreamEventBase {\n type: \"error\";\n /** Human-readable error message */\n message: string;\n /** Optional error code for programmatic handling */\n code?: string;\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// AGENT LOOP ARCHITECTURE EVENTS\n// ════════════════════════════════════════════════════════════════════════════\n\n/**\n * Tool start event - sent when a tool begins executing.\n */\nexport interface ToolStartEvent extends ChatStreamEventBase {\n type: \"tool_start\";\n /** Name of the tool being executed */\n toolName: string;\n /** Arguments passed to the tool */\n toolArgs: Record<string, unknown>;\n}\n\n/**\n * Tool end event - sent when a tool finishes executing.\n */\nexport interface ToolEndEvent extends ChatStreamEventBase {\n type: \"tool_end\";\n /** Name of the tool that completed */\n toolName: string;\n /** Whether the tool execution succeeded */\n success: boolean;\n /** Brief summary of the result */\n resultSummary?: string;\n}\n\n/**\n * Agent thinking event - sent between agent iterations.\n */\nexport interface AgentThinkingEvent extends ChatStreamEventBase {\n type: \"agent_thinking\";\n /** Current iteration number */\n iteration: number;\n /** Tools used in this iteration */\n toolsUsed: string[];\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// AGENT LOOP TRACE EVENTS\n// ════════════════════════════════════════════════════════════════════════════\n\n/**\n * Iteration start event - emitted when a new agent loop iteration begins.\n */\nexport interface IterationStartEvent extends ChatStreamEventBase {\n type: \"iteration_start\";\n iteration: number;\n}\n\n/**\n * LLM start event - emitted when the LLM begins generating a response.\n */\nexport interface LlmStartEvent extends ChatStreamEventBase {\n type: \"llm_start\";\n iteration: number;\n}\n\n/**\n * LLM end event - emitted when the LLM finishes generating (may include tool calls).\n */\nexport interface LlmEndEvent extends ChatStreamEventBase {\n type: \"llm_end\";\n iteration: number;\n hasToolCalls: boolean;\n toolNames?: string[];\n}\n\n/**\n * Tool activity event - inline narration of tool execution.\n * Sent as the agent streams its response, replacing the old ThinkingDropdown.\n */\nexport interface ToolActivityEvent extends ChatStreamEventBase {\n type: \"tool_activity\";\n /** Internal tool name */\n toolName: string;\n /** User-friendly description (e.g. \"Looking up your profile...\") */\n description: string;\n /** Whether the tool is starting or has finished */\n phase: \"start\" | \"end\";\n /** Whether the tool succeeded (present when phase === 'end') */\n success?: boolean;\n /** Brief result summary (present when phase === 'end') */\n summary?: string;\n /** Internal steps executed by this tool (present when phase === 'end') */\n steps?: DebugMetaStep[];\n}\n\n/**\n * Internal event carrying the agent's authoritative final response text.\n * Emitted by the streamer after the graph completes. Not forwarded to the frontend SSE stream.\n */\nexport interface ResponseCompleteEvent extends ChatStreamEventBase {\n type: \"response_complete\";\n /** The agent's final response text (from the last iteration only) */\n response: string;\n}\n\n/**\n * Response reset event — tells the frontend to discard all previously streamed tokens.\n * Emitted when the agent detects hallucinated code blocks and forces a correction iteration.\n */\nexport interface ResponseResetEvent extends ChatStreamEventBase {\n type: \"response_reset\";\n /** Human-readable reason for the reset */\n reason: string;\n}\n\n/**\n * Hallucination detected event — tells the frontend that the agent caught a\n * hallucinated code block and is auto-invoking the correct tool.\n */\nexport interface HallucinationDetectedEvent extends ChatStreamEventBase {\n type: \"hallucination_detected\";\n /** The type of block that was hallucinated (e.g. \"intent_proposal\", \"opportunity\") */\n blockType: string;\n /** The tool being auto-invoked to recover */\n tool: string;\n}\n\n/**\n * One internal step reported by a tool for debug visibility (e.g. subgraph, subtask).\n */\nexport interface DebugMetaStep {\n step: string;\n detail?: string;\n /** Structured data for rich display (e.g., Felicity scores, classification, candidate info). */\n data?: Record<string, unknown>;\n}\n\n/**\n * One agent invocation recorded inside a graph run.\n */\nexport interface DebugMetaAgent {\n /** Name of the agent (e.g. \"opportunity.evaluator\"). */\n name: string;\n /** Wall-clock milliseconds for this agent invocation. */\n durationMs: number;\n}\n\n/**\n * One graph invocation recorded by a tool that calls a LangGraph graph.\n */\nexport interface DebugMetaGraph {\n /** Name of the graph (e.g. \"opportunity\"). */\n name: string;\n /** Wall-clock milliseconds for the full graph run. */\n durationMs: number;\n /** Agent invocations recorded inside this graph run. */\n agents: DebugMetaAgent[];\n}\n\n/**\n * One tool call entry in debug meta (sanitized args, result summary, optional steps).\n */\nexport interface DebugMetaToolCall {\n name: string;\n args: Record<string, unknown>;\n resultSummary: string;\n success: boolean;\n /** Wall-clock milliseconds for the full tool execution. */\n durationMs: number;\n /** Internal steps (subgraphs, subtasks) when the tool reports debugSteps in its result. */\n steps?: DebugMetaStep[];\n /** LangGraph graphs invoked by this tool, with their agent timings. */\n graphs?: DebugMetaGraph[];\n}\n\n/**\n * LLM call statistics accumulated during a single agent turn.\n */\nexport interface DebugMetaLlm {\n /** Total number of LLM calls made in this turn. */\n calls: number;\n /** Cumulative wall-clock time spent waiting for the LLM across all calls. */\n totalDurationMs: number;\n /** Entries recorded each time a response_reset event was emitted. */\n resets: Array<{ reason: string; at: number }>;\n /** Entries recorded each time a hallucination_detected event was emitted. */\n hallucinations: Array<{ blockType: string; tool: string; at: number }>;\n}\n\n/**\n * Negotiation sessions initiated by the orchestrator during this turn.\n */\nexport interface DebugMetaOrchestratorNegotiations {\n /** Opportunity IDs for which a negotiation_session_start was emitted. */\n opportunityIds: string[];\n}\n\n/**\n * Decision-question generation debug data (orchestrator path only).\n */\nexport interface DebugMetaDiscoveryQuestions {\n inputMode: \"transcripts\" | \"insights\";\n finalCount: number;\n strategies: QuestionStrategy[];\n durationMs: number;\n}\n\n/**\n * Debug meta event - per-turn graph and tool usage for copy debug.\n */\nexport interface DebugMetaEvent extends ChatStreamEventBase {\n type: \"debug_meta\";\n graph: string;\n iterations: number;\n tools: DebugMetaToolCall[];\n llm: DebugMetaLlm;\n orchestratorNegotiations?: DebugMetaOrchestratorNegotiations;\n /** Decision-question generation debug data (orchestrator path only). */\n discoveryQuestions?: DebugMetaDiscoveryQuestions;\n}\n\n/** Graph start event — emitted when a LangGraph sub-graph begins inside a tool. */\nexport interface GraphStartEvent extends ChatStreamEventBase {\n type: \"graph_start\";\n graphName: string;\n}\n\n/** Graph end event — emitted when a LangGraph sub-graph completes. */\nexport interface GraphEndEvent extends ChatStreamEventBase {\n type: \"graph_end\";\n graphName: string;\n durationMs: number;\n}\n\n/**\n * Phase start event — emitted when a logical groupings of inline work begins\n * inside a tool. Phases share container semantics with graphs (they can host\n * agents) but render differently in the trace UI so users can tell them\n * apart from LangGraph state machines.\n */\nexport interface PhaseStartEvent extends ChatStreamEventBase {\n type: \"phase_start\";\n phaseName: string;\n}\n\n/** Phase end event — emitted when a logical phase completes. */\nexport interface PhaseEndEvent extends ChatStreamEventBase {\n type: \"phase_end\";\n phaseName: string;\n durationMs: number;\n}\n\n/** Agent start event — emitted when an LLM agent begins inside a graph node. */\nexport interface AgentStartEvent extends ChatStreamEventBase {\n type: \"agent_start\";\n agentName: string;\n}\n\n/** Agent end event — emitted when an LLM agent completes. */\nexport interface AgentEndEvent extends ChatStreamEventBase {\n type: \"agent_end\";\n agentName: string;\n durationMs: number;\n /** Structured outcome summary, e.g. \"5 of 12 passed\" or \"3 intents extracted\". */\n summary: string;\n}\n\n/** Orchestrator per-candidate negotiation wrapper — emitted from `negotiateCandidates`. */\nexport interface NegotiationSessionStartEvent extends ChatStreamEventBase {\n type: \"negotiation_session_start\";\n opportunityId: string;\n negotiationConversationId: string;\n sourceUserId: string;\n candidateUserId: string;\n /** The user holding the initiating seat for this match (v2 stamp). */\n initiatorUserId?: string;\n candidateName?: string;\n trigger: \"orchestrator\" | \"ambient\";\n startedAt: number;\n}\n\nexport interface NegotiationSessionEndEvent extends ChatStreamEventBase {\n type: \"negotiation_session_end\";\n opportunityId: string;\n negotiationConversationId: string;\n durationMs: number;\n}\n\n/** One turn inside a bilateral negotiation. Emitted by the negotiation graph's turn node. */\nexport interface NegotiationTurnEvent extends ChatStreamEventBase {\n type: \"negotiation_turn\";\n opportunityId: string;\n negotiationConversationId: string;\n turnIndex: number;\n actor: \"source\" | \"candidate\";\n action: \"propose\" | \"accept\" | \"reject\" | \"counter\" | \"question\";\n reasoning?: string;\n message?: string;\n suggestedRoles?: { ownUser?: string; otherUser?: string };\n durationMs: number;\n}\n\nexport interface NegotiationOutcomeEvent extends ChatStreamEventBase {\n type: \"negotiation_outcome\";\n opportunityId: string;\n outcome:\n | \"accepted\"\n | \"rejected_stalled\"\n | \"waiting_for_agent\"\n | \"timed_out\"\n | \"turn_cap\";\n turnCount: number;\n reasoning?: string;\n agreedRoles?: { ownUser?: string; otherUser?: string };\n}\n\nexport interface ChatSummarizerStartEvent extends ChatStreamEventBase {\n type: \"chat_summarizer_start\";\n payload: { sessionId: string };\n}\n\nexport interface ChatSummarizerEndEvent extends ChatStreamEventBase {\n type: \"chat_summarizer_end\";\n payload: {\n durationMs: number;\n };\n}\n\nexport interface QuestionGeneratorStartEvent extends ChatStreamEventBase {\n type: \"question_generator_start\";\n payload: {\n inputMode: \"transcripts\" | \"insights\";\n negotiationCount: number;\n hasChatContext: boolean;\n truncated?: { originalCount: number; keptCount: number };\n };\n}\n\nexport interface QuestionGeneratorEndEvent extends ChatStreamEventBase {\n type: \"question_generator_end\";\n payload: {\n finalCount: number;\n strategies: QuestionStrategy[];\n durationMs: number;\n inputMode: \"transcripts\" | \"insights\";\n };\n}\n\nexport interface DecisionQuestionsEvent extends ChatStreamEventBase {\n type: \"decision_questions\";\n questions: Question[];\n}\n\n/**\n * One persisted question streamed by the ask_user_question tool.\n * Carries the DB id so the frontend can answer/dismiss it through the\n * questions REST endpoints while the turn is still blocked.\n */\nexport interface UserQuestionPayload {\n id: string;\n title: string;\n prompt: string;\n options: Array<{ label: string; description: string }>;\n multiSelect: boolean;\n}\n\n/**\n * User question event — emitted when the orchestrator's ask_user_question\n * tool persisted chat-mode questions and is now blocking the turn awaiting\n * the user's inline answer.\n */\nexport interface UserQuestionEvent extends ChatStreamEventBase {\n type: \"user_question\";\n questions: UserQuestionPayload[];\n}\n\n/**\n * Steer-or-queue event — injected into the active SSE stream by the /chat/interrupt\n * endpoint after the classifier runs. The frontend holds the mid-stream message as\n * \"pending\" until this event arrives, then acts on the decision.\n */\nexport interface SteerOrQueueEvent extends ChatStreamEventBase {\n type: \"steer_or_queue\";\n /** Classifier decision: interrupt and restart, or buffer until current run completes. */\n decision: \"steer\" | \"queue\";\n /** Echoed from the interrupt request so the frontend can update the correct pending message. */\n messageId: string;\n}\n\n/**\n * Union type of all chat stream events.\n */\nexport type ChatStreamEvent =\n | StatusEvent\n | RoutingEvent\n | ThinkingEvent\n | SubgraphStartEvent\n | SubgraphResultEvent\n | TokenEvent\n | DoneEvent\n | ErrorEvent\n // Agent Loop Architecture events\n | ToolStartEvent\n | ToolEndEvent\n | AgentThinkingEvent\n // Streaming narration events\n | ToolActivityEvent\n // Agent loop trace events\n | IterationStartEvent\n | LlmStartEvent\n | LlmEndEvent\n // Internal response tracking events\n | ResponseCompleteEvent\n | ResponseResetEvent\n | HallucinationDetectedEvent\n // Debug meta\n | DebugMetaEvent\n // Trace hierarchy events\n | GraphStartEvent\n | GraphEndEvent\n | PhaseStartEvent\n | PhaseEndEvent\n | AgentStartEvent\n | AgentEndEvent\n | NegotiationSessionStartEvent\n | NegotiationSessionEndEvent\n | NegotiationTurnEvent\n | NegotiationOutcomeEvent\n | ChatSummarizerStartEvent\n | ChatSummarizerEndEvent\n | QuestionGeneratorStartEvent\n | QuestionGeneratorEndEvent\n | DecisionQuestionsEvent\n | UserQuestionEvent\n | SteerOrQueueEvent;\n\n/**\n * Formats a chat stream event as an SSE message. If JSON.stringify throws (e.g. circular ref,\n * non-serializable value), returns a minimal error event so the stream stays valid.\n *\n * @param event - The event to format\n * @returns SSE-formatted string with \"data: \" prefix and double newline\n */\nexport function formatSSEEvent(event: ChatStreamEvent): string {\n try {\n return `data: ${JSON.stringify(event)}\\n\\n`;\n } catch (serializeError) {\n const fallback: ErrorEvent = {\n type: \"error\",\n sessionId:\n typeof (event as ChatStreamEventBase).sessionId === \"string\"\n ? (event as ChatStreamEventBase).sessionId\n : \"unknown\",\n timestamp: new Date().toISOString(),\n message: \"Response could not be serialized. Please try again.\",\n code: \"SERIALIZATION_ERROR\",\n };\n return `data: ${JSON.stringify(fallback)}\\n\\n`;\n }\n}\n\n/**\n * Creates a chat stream event with common fields populated.\n *\n * @param type - Event type\n * @param sessionId - Session ID\n * @param data - Event-specific data (excluding type, sessionId, timestamp)\n * @returns Complete event object\n *\n * @example\n * ```ts\n * const statusEvent = createStreamEvent<StatusEvent>('status', 'session-123', {\n * message: 'Processing your request...'\n * });\n * ```\n */\nexport function createStreamEvent<T extends ChatStreamEvent>(\n type: T[\"type\"],\n sessionId: string,\n data: Omit<T, \"type\" | \"sessionId\" | \"timestamp\">,\n): T {\n return {\n ...data,\n type,\n sessionId,\n timestamp: new Date().toISOString(),\n } as T;\n}\n\n/**\n * Type guard to check if an event is a specific type.\n */\nexport function isEventType<T extends ChatStreamEvent>(\n event: ChatStreamEvent,\n type: T[\"type\"],\n): event is T {\n return event.type === type;\n}\n\n/**\n * Creates a formatted status event.\n */\nexport function createStatusEvent(\n sessionId: string,\n message: string,\n): StatusEvent {\n return createStreamEvent<StatusEvent>(\"status\", sessionId, { message });\n}\n\n/**\n * Creates a formatted routing event.\n */\nexport function createRoutingEvent(\n sessionId: string,\n target: string,\n reasoning?: string,\n): RoutingEvent {\n return createStreamEvent<RoutingEvent>(\"routing\", sessionId, {\n target,\n reasoning,\n });\n}\n\n/**\n * Creates a formatted subgraph start event.\n */\nexport function createSubgraphStartEvent(\n sessionId: string,\n subgraph: string,\n): SubgraphStartEvent {\n return createStreamEvent<SubgraphStartEvent>(\"subgraph_start\", sessionId, {\n subgraph,\n });\n}\n\n/**\n * Creates a formatted subgraph result event.\n */\nexport function createSubgraphResultEvent(\n sessionId: string,\n subgraph: string,\n data: Record<string, unknown>,\n): SubgraphResultEvent {\n return createStreamEvent<SubgraphResultEvent>(\"subgraph_result\", sessionId, {\n subgraph,\n data,\n });\n}\n\n/**\n * Creates a formatted token event.\n */\nexport function createTokenEvent(\n sessionId: string,\n content: string,\n): TokenEvent {\n return createStreamEvent<TokenEvent>(\"token\", sessionId, { content });\n}\n\n/**\n * Options for the done event (optional metadata).\n */\nexport interface CreateDoneEventOptions {\n messageId?: string;\n routingDecision?: Record<string, unknown>;\n subgraphResults?: Record<string, unknown>;\n title?: string;\n suggestions?: ChatSuggestion[];\n opportunityCards?: OpportunityCardPayload[];\n decisionQuestions?: Question[];\n}\n\n/**\n * Creates a formatted done event.\n */\nexport function createDoneEvent(\n sessionId: string,\n response: string,\n options?: CreateDoneEventOptions,\n): DoneEvent {\n return createStreamEvent<DoneEvent>(\"done\", sessionId, {\n ...options,\n response,\n });\n}\n\n/**\n * Creates a formatted error event.\n */\nexport function createErrorEvent(\n sessionId: string,\n message: string,\n code?: string,\n): ErrorEvent {\n return createStreamEvent<ErrorEvent>(\"error\", sessionId, { message, code });\n}\n\n/**\n * Creates a formatted thinking event.\n */\nexport function createThinkingEvent(\n sessionId: string,\n content: string,\n step?: string,\n): ThinkingEvent {\n return createStreamEvent<ThinkingEvent>(\"thinking\", sessionId, {\n content,\n step,\n });\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// AGENT LOOP EVENT CREATORS\n// ════════════════════════════════════════════════════════════════════════════\n\n/**\n * Creates a formatted tool start event.\n */\nexport function createToolStartEvent(\n sessionId: string,\n toolName: string,\n toolArgs: Record<string, unknown>,\n): ToolStartEvent {\n return createStreamEvent<ToolStartEvent>(\"tool_start\", sessionId, {\n toolName,\n toolArgs,\n });\n}\n\n/**\n * Creates a formatted tool end event.\n */\nexport function createToolEndEvent(\n sessionId: string,\n toolName: string,\n success: boolean,\n resultSummary?: string,\n): ToolEndEvent {\n return createStreamEvent<ToolEndEvent>(\"tool_end\", sessionId, {\n toolName,\n success,\n resultSummary,\n });\n}\n\n/**\n * Creates a formatted agent thinking event.\n */\nexport function createAgentThinkingEvent(\n sessionId: string,\n iteration: number,\n toolsUsed: string[],\n): AgentThinkingEvent {\n return createStreamEvent<AgentThinkingEvent>(\"agent_thinking\", sessionId, {\n iteration,\n toolsUsed,\n });\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// AGENT LOOP TRACE EVENT CREATORS\n// ════════════════════════════════════════════════════════════════════════════\n\n/**\n * Creates a formatted iteration start event.\n */\nexport function createIterationStartEvent(\n sessionId: string,\n iteration: number,\n): IterationStartEvent {\n return createStreamEvent<IterationStartEvent>(\"iteration_start\", sessionId, {\n iteration,\n });\n}\n\n/**\n * Creates a formatted LLM start event.\n */\nexport function createLlmStartEvent(\n sessionId: string,\n iteration: number,\n): LlmStartEvent {\n return createStreamEvent<LlmStartEvent>(\"llm_start\", sessionId, {\n iteration,\n });\n}\n\n/**\n * Creates a formatted LLM end event.\n */\nexport function createLlmEndEvent(\n sessionId: string,\n iteration: number,\n hasToolCalls: boolean,\n toolNames?: string[],\n): LlmEndEvent {\n return createStreamEvent<LlmEndEvent>(\"llm_end\", sessionId, {\n iteration,\n hasToolCalls,\n toolNames,\n });\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// STREAMING NARRATION EVENT CREATORS\n// ════════════════════════════════════════════════════════════════════════════\n\n/**\n * Creates a formatted tool activity event (inline narration).\n */\nexport function createToolActivityEvent(\n sessionId: string,\n toolName: string,\n description: string,\n phase: \"start\" | \"end\",\n success?: boolean,\n summary?: string,\n steps?: DebugMetaStep[],\n): ToolActivityEvent {\n return createStreamEvent<ToolActivityEvent>(\"tool_activity\", sessionId, {\n toolName,\n description,\n phase,\n success,\n summary,\n steps,\n });\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// INTERNAL RESPONSE TRACKING EVENT CREATORS\n// ════════════════════════════════════════════════════════════════════════════\n\n/**\n * Creates a formatted response complete event.\n */\nexport function createResponseCompleteEvent(\n sessionId: string,\n response: string,\n): ResponseCompleteEvent {\n return createStreamEvent<ResponseCompleteEvent>(\"response_complete\", sessionId, { response });\n}\n\n/**\n * Creates a formatted response reset event.\n * Tells the frontend to discard all previously streamed tokens.\n */\nexport function createResponseResetEvent(\n sessionId: string,\n reason: string,\n): ResponseResetEvent {\n return createStreamEvent<ResponseResetEvent>(\"response_reset\", sessionId, { reason });\n}\n\n/**\n * Creates a hallucination detected event for the trace panel.\n */\nexport function createHallucinationDetectedEvent(\n sessionId: string,\n blockType: string,\n tool: string,\n): HallucinationDetectedEvent {\n return createStreamEvent<HallucinationDetectedEvent>(\"hallucination_detected\", sessionId, { blockType, tool });\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// DEBUG META EVENT CREATORS\n// ════════════════════════════════════════════════════════════════════════════\n\n/**\n * Creates a formatted debug meta event (per-turn graph and tool usage).\n */\nexport function createDebugMetaEvent(\n sessionId: string,\n graph: string,\n iterations: number,\n tools: DebugMetaToolCall[],\n llm: DebugMetaLlm,\n orchestratorNegotiations?: DebugMetaOrchestratorNegotiations,\n discoveryQuestions?: DebugMetaDiscoveryQuestions,\n): DebugMetaEvent {\n return createStreamEvent<DebugMetaEvent>(\"debug_meta\", sessionId, {\n graph,\n iterations,\n tools,\n llm,\n ...(orchestratorNegotiations !== undefined && { orchestratorNegotiations }),\n ...(discoveryQuestions !== undefined && { discoveryQuestions }),\n });\n}\n\n// ════════════════════════════════════════════════════════════════════════════\n// TRACE HIERARCHY EVENT CREATORS\n// ════════════════════════════════════════════════════════════════════════════\n\n/**\n * Creates a graph start event emitted when a LangGraph sub-graph begins inside a tool.\n */\nexport function createGraphStartEvent(sessionId: string, graphName: string): GraphStartEvent {\n return createStreamEvent<GraphStartEvent>(\"graph_start\", sessionId, { graphName });\n}\n\n/**\n * Creates a graph end event emitted when a LangGraph sub-graph completes.\n */\nexport function createGraphEndEvent(sessionId: string, graphName: string, durationMs: number): GraphEndEvent {\n return createStreamEvent<GraphEndEvent>(\"graph_end\", sessionId, { graphName, durationMs });\n}\n\nexport function createPhaseStartEvent(sessionId: string, phaseName: string): PhaseStartEvent {\n return createStreamEvent<PhaseStartEvent>(\"phase_start\", sessionId, { phaseName });\n}\n\nexport function createPhaseEndEvent(sessionId: string, phaseName: string, durationMs: number): PhaseEndEvent {\n return createStreamEvent<PhaseEndEvent>(\"phase_end\", sessionId, { phaseName, durationMs });\n}\n\n/**\n * Creates an agent start event emitted when an LLM agent begins inside a graph node.\n */\nexport function createAgentStartEvent(sessionId: string, agentName: string): AgentStartEvent {\n return createStreamEvent<AgentStartEvent>(\"agent_start\", sessionId, { agentName });\n}\n\n/**\n * Creates an agent end event emitted when an LLM agent completes.\n */\nexport function createAgentEndEvent(\n sessionId: string,\n agentName: string,\n durationMs: number,\n summary: string,\n): AgentEndEvent {\n return createStreamEvent<AgentEndEvent>(\"agent_end\", sessionId, { agentName, durationMs, summary });\n}\n\nexport function createNegotiationSessionStartEvent(\n sessionId: string,\n payload: Omit<NegotiationSessionStartEvent, \"type\" | \"sessionId\" | \"timestamp\">,\n): NegotiationSessionStartEvent {\n return createStreamEvent<NegotiationSessionStartEvent>(\n \"negotiation_session_start\",\n sessionId,\n payload,\n );\n}\n\nexport function createNegotiationSessionEndEvent(\n sessionId: string,\n payload: Omit<NegotiationSessionEndEvent, \"type\" | \"sessionId\" | \"timestamp\">,\n): NegotiationSessionEndEvent {\n return createStreamEvent<NegotiationSessionEndEvent>(\n \"negotiation_session_end\",\n sessionId,\n payload,\n );\n}\n\nexport function createNegotiationTurnEvent(\n sessionId: string,\n payload: Omit<NegotiationTurnEvent, \"type\" | \"sessionId\" | \"timestamp\">,\n): NegotiationTurnEvent {\n return createStreamEvent<NegotiationTurnEvent>(\"negotiation_turn\", sessionId, payload);\n}\n\nexport function createNegotiationOutcomeEvent(\n sessionId: string,\n payload: Omit<NegotiationOutcomeEvent, \"type\" | \"sessionId\" | \"timestamp\">,\n): NegotiationOutcomeEvent {\n return createStreamEvent<NegotiationOutcomeEvent>(\n \"negotiation_outcome\",\n sessionId,\n payload,\n );\n}\n\nexport function createChatSummarizerStartEvent(\n sessionId: string,\n payload: ChatSummarizerStartEvent[\"payload\"],\n): ChatSummarizerStartEvent {\n return createStreamEvent<ChatSummarizerStartEvent>(\"chat_summarizer_start\", sessionId, { payload });\n}\n\nexport function createChatSummarizerEndEvent(\n sessionId: string,\n payload: ChatSummarizerEndEvent[\"payload\"],\n): ChatSummarizerEndEvent {\n return createStreamEvent<ChatSummarizerEndEvent>(\"chat_summarizer_end\", sessionId, { payload });\n}\n\nexport function createQuestionGeneratorStartEvent(\n sessionId: string,\n payload: QuestionGeneratorStartEvent[\"payload\"],\n): QuestionGeneratorStartEvent {\n return createStreamEvent<QuestionGeneratorStartEvent>(\"question_generator_start\", sessionId, { payload });\n}\n\nexport function createQuestionGeneratorEndEvent(\n sessionId: string,\n payload: QuestionGeneratorEndEvent[\"payload\"],\n): QuestionGeneratorEndEvent {\n return createStreamEvent<QuestionGeneratorEndEvent>(\"question_generator_end\", sessionId, { payload });\n}\n\nexport function createDecisionQuestionsEvent(\n sessionId: string,\n payload: { questions: Question[] },\n): DecisionQuestionsEvent {\n return createStreamEvent<DecisionQuestionsEvent>(\"decision_questions\", sessionId, payload);\n}\n\nexport function createUserQuestionEvent(\n sessionId: string,\n payload: { questions: UserQuestionPayload[] },\n): UserQuestionEvent {\n return createStreamEvent<UserQuestionEvent>(\"user_question\", sessionId, payload);\n}\n\n/**\n * Creates a steer-or-queue event injected into the active stream by the interrupt endpoint.\n */\nexport function createSteerOrQueueEvent(\n sessionId: string,\n decision: \"steer\" | \"queue\",\n messageId: string,\n): SteerOrQueueEvent {\n return createStreamEvent<SteerOrQueueEvent>(\"steer_or_queue\", sessionId, {\n decision,\n messageId,\n });\n}\n"]}
|
|
@@ -25,7 +25,7 @@ export declare const NEGOTIATOR_PERSONA_ID = "negotiator";
|
|
|
25
25
|
* - agent management (`register/update/delete_agent`, permission grants),
|
|
26
26
|
* - `confirm_opportunity_delivery` (OpenClaw ledger write, never chat).
|
|
27
27
|
*/
|
|
28
|
-
export declare const NEGOTIATOR_TOOL_NAMES: readonly ["list_negotiations", "get_negotiation", "respond_to_negotiation", "list_opportunities", "update_opportunity", "read_pending_questions", "read_intents", "create_intent", "update_intent", "delete_intent", "search_intents", "read_intent_indexes", "create_intent_index", "delete_intent_index", "read_user_contexts", "create_user_context", "update_user_context", "confirm_user_context", "preview_user_context", "read_premises", "create_premise", "update_premise", "retract_premise", "read_networks", "read_network_memberships", "create_network_membership", "delete_network_membership", "list_contacts", "search_contacts", "add_contact", "remove_contact", "import_contacts", "import_gmail_contacts", "scrape_url"];
|
|
28
|
+
export declare const NEGOTIATOR_TOOL_NAMES: readonly ["list_negotiations", "get_negotiation", "respond_to_negotiation", "list_opportunities", "update_opportunity", "read_pending_questions", "answer_pending_question", "read_intents", "create_intent", "update_intent", "delete_intent", "search_intents", "read_intent_indexes", "create_intent_index", "delete_intent_index", "read_user_contexts", "create_user_context", "update_user_context", "confirm_user_context", "preview_user_context", "read_premises", "create_premise", "update_premise", "retract_premise", "read_networks", "read_network_memberships", "create_network_membership", "delete_network_membership", "list_contacts", "search_contacts", "add_contact", "remove_contact", "import_contacts", "import_gmail_contacts", "scrape_url"];
|
|
29
29
|
/**
|
|
30
30
|
* Filters a full chat-tool registry down to the negotiator allowlist.
|
|
31
31
|
* Exported separately so the scoping rule is unit-testable without
|
|
@@ -1 +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;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,qBAAqB
|
|
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;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,qBAAqB,0uBAiDxB,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;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,uBAAuB,GAAG,iBAAiB,CAUxF"}
|
|
@@ -42,8 +42,11 @@ export const NEGOTIATOR_TOOL_NAMES = [
|
|
|
42
42
|
"update_opportunity",
|
|
43
43
|
// Pending questions — the system's open questions for the client. Added for
|
|
44
44
|
// intent-pinned sessions (P4.2/IND-403); the tool clamps itself to the
|
|
45
|
-
// focused intent scope when one is set.
|
|
45
|
+
// focused intent scope when one is set. answer_pending_question (P4.3/IND-404)
|
|
46
|
+
// records the client's explicit answers through the same pipeline the
|
|
47
|
+
// question cards use.
|
|
46
48
|
"read_pending_questions",
|
|
49
|
+
"answer_pending_question",
|
|
47
50
|
// Signals — the input surface of signal-based discovery (P4.5)
|
|
48
51
|
"read_intents",
|
|
49
52
|
"create_intent",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"negotiator.persona.js","sourceRoot":"/","sources":["chat/negotiator.persona.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA8D,MAAM,iCAAiC,CAAC;AAE9H,OAAO,EAAE,4BAA4B,EAAgC,MAAM,wBAAwB,CAAC;AAEpG,kFAAkF;AAClF,4BAA4B;AAC5B,kFAAkF;AAClF,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,0EAA0E;AAC1E,iEAAiE;AACjE,kDAAkD;AAElD;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAElD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,gDAAgD;IAChD,mBAAmB;IACnB,iBAAiB;IACjB,wBAAwB;IACxB,oBAAoB;IACpB,oBAAoB;IACpB,4EAA4E;IAC5E,uEAAuE;IACvE,
|
|
1
|
+
{"version":3,"file":"negotiator.persona.js","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E,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACpE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,IAAiB,EACjB,kBAAwC;IAExC,MAAM,KAAK,GAAG,MAAM,eAAe,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;IAC9D,OAAO,qBAAqB,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAA6B;IACnE,OAAO;QACL,EAAE,EAAE,qBAAqB;QACzB,kBAAkB,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,4BAA4B,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC;QACtF,WAAW,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,EAAE,CAAC,qBAAqB,CAAC,IAAI,EAAE,kBAAkB,CAAC;QAC1F,aAAa,EAAE;YACb,oBAAoB,EAAE,KAAK;YAC3B,qBAAqB,EAAE,IAAI;SAC5B;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 * P4.5 (IND-413) expanded this from the read-mostly P4.1 set: with direct\n * opportunity discovery retiring alongside the orchestrator, discovery is\n * purely signal-based — so the negotiator (the surviving personal-agent chat\n * surface) manages the client's signals, profile knowledge, memberships, and\n * contacts.\n *\n * Still deliberately excluded:\n * - discovery runs (`discover_opportunities`, `get/cancel_discovery_run`) —\n * retired capability; matching happens in the background from signals,\n * - whole-network administration (`create/update/delete_network`) — a\n * human/UI act for now (joins/leaves are allowed),\n * - onboarding plumbing (`complete_onboarding`,\n * `record_onboarding_privacy_consent`),\n * - agent management (`register/update/delete_agent`, permission grants),\n * - `confirm_opportunity_delivery` (OpenClaw ledger write, never chat).\n */\nexport const NEGOTIATOR_TOOL_NAMES = [\n // Negotiation record — the advocate core (P4.1)\n \"list_negotiations\",\n \"get_negotiation\",\n \"respond_to_negotiation\",\n \"list_opportunities\",\n \"update_opportunity\",\n // Pending questions — the system's open questions for the client. Added for\n // intent-pinned sessions (P4.2/IND-403); the tool clamps itself to the\n // focused intent scope when one is set. answer_pending_question (P4.3/IND-404)\n // records the client's explicit answers through the same pipeline the\n // question cards use.\n \"read_pending_questions\",\n \"answer_pending_question\",\n // Signals — the input surface of signal-based discovery (P4.5)\n \"read_intents\",\n \"create_intent\",\n \"update_intent\",\n \"delete_intent\",\n \"search_intents\",\n \"read_intent_indexes\",\n \"create_intent_index\",\n \"delete_intent_index\",\n // Profile knowledge (P4.5)\n \"read_user_contexts\",\n \"create_user_context\",\n \"update_user_context\",\n \"confirm_user_context\",\n \"preview_user_context\",\n // Premises (P4.5; read was already in P4.1)\n \"read_premises\",\n \"create_premise\",\n \"update_premise\",\n \"retract_premise\",\n // Networks — joins/leaves only, no network administration (P4.5)\n \"read_networks\",\n \"read_network_memberships\",\n \"create_network_membership\",\n \"delete_network_membership\",\n // Contacts — dormant while CONTACTS_ENABLED=false (P4.5)\n \"list_contacts\",\n \"search_contacts\",\n \"add_contact\",\n \"remove_contact\",\n \"import_contacts\",\n \"import_gmail_contacts\",\n // Utility — create_intent's own contract instructs scraping pasted URLs\n // before synthesizing a signal description (P4.5)\n \"scrape_url\",\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 (P4.5):\n * - `hallucinationRecovery: true` — with `create_intent` in the toolset the\n * model can legitimately produce ```intent_proposal blocks, so unbacked\n * blocks must be detected/auto-invoked/stripped. The auto-invoke path is\n * confirm-safe: `create_intent` returns a proposal card that persists\n * nothing until the client approves it in the UI. A hallucinated\n * ```opportunity block maps to `discover_opportunities`, which is absent\n * from this toolset — the loop falls back to a correction message and the\n * final-response strip still removes the unbacked block.\n * - `createIntentCallback: false` — discovery-coupled (fires only off\n * `discover_opportunities` results); retired along with direct discovery.\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: true,\n },\n };\n}\n"]}
|
|
@@ -1 +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;AAE3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAkBjE,+EAA+E;AAC/E,MAAM,WAAW,uBAAuB;IACtC,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;
|
|
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;AAE3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAkBjE,+EAA+E;AAC/E,MAAM,WAAW,uBAAuB;IACtC,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAkCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,mBAAmB,EACxB,IAAI,EAAE,uBAAuB,EAC7B,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,MAAM,CAgFR"}
|
|
@@ -9,11 +9,26 @@ function buildPinnedSignalSection(intentId, label) {
|
|
|
9
9
|
return `
|
|
10
10
|
## Pinned signal
|
|
11
11
|
This conversation was opened from one of the client's signals (intent id: ${intentId}${labelLine}). Treat it as the working focus of this chat:
|
|
12
|
-
- Open questions listed by read_pending_questions here are this signal's open questions — surface them early and work through them conversationally
|
|
12
|
+
- Open questions listed by read_pending_questions here are this signal's open questions — surface them early and work through them conversationally. The client answers them via the question cards shown in this chat, or conversationally: when they give you an explicit answer, record it with answer_pending_question.
|
|
13
13
|
- list_opportunities and read_pending_questions are automatically restricted to this signal in this session; use them to report matches, negotiations, and follow-ups that grew out of it.
|
|
14
14
|
- When the client restates or sharpens what they want here, propose an update to this signal (update_intent) or a new premise — on their confirmation — so background matching reflects it.
|
|
15
15
|
- This is a focus, not a wall: you may still read the client's profile, premises, and other signals when the conversation needs the fuller picture, and general questions about their negotiations remain fair game.`;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Renders the question-inbox section for the unscoped DM (P4.3/IND-404).
|
|
19
|
+
* The DM is the client's primary surface for the system's open questions:
|
|
20
|
+
* signal refinements, negotiation follow-ups, profile gaps. Cards render in
|
|
21
|
+
* the chat; conversational answers are recorded via answer_pending_question.
|
|
22
|
+
*/
|
|
23
|
+
function buildQuestionInboxSection() {
|
|
24
|
+
return `
|
|
25
|
+
## Client question inbox
|
|
26
|
+
The system collects open questions for your client (signal refinements, negotiation follow-ups, profile gaps), and this chat is the primary place they get handled. Question cards also render directly in this chat.
|
|
27
|
+
- Early in a conversation — or whenever the client asks what needs their attention — call read_pending_questions and surface what is open, briefly and in plain language.
|
|
28
|
+
- When the client asks why something is being asked, explain the question's context from the record it came from (the negotiation, opportunity, or signal behind it) — look it up, don't guess.
|
|
29
|
+
- When the client answers a question conversationally, record it with answer_pending_question — pass exactly what they said (their chosen options and/or their own words), never an answer you inferred. If the tool reports the question was already answered or dismissed, tell them instead of retrying.
|
|
30
|
+
- Never pressure the client to answer; the questions keep for later and remain available in the app's Questions page.`;
|
|
31
|
+
}
|
|
17
32
|
/**
|
|
18
33
|
* Builds the system prompt for the negotiator chat persona.
|
|
19
34
|
*
|
|
@@ -36,9 +51,11 @@ export function buildNegotiatorSystemContent(ctx, opts, _iterCtx) {
|
|
|
36
51
|
? `\n${opts.agentDescription.trim()}\n`
|
|
37
52
|
: "";
|
|
38
53
|
const pinnedIntentId = focusedIntentId(ctx);
|
|
54
|
+
// Pinned sessions clamp the question tools to the signal and carry their own
|
|
55
|
+
// question guidance; the unscoped DM gets the full inbox instead.
|
|
39
56
|
const pinnedSignalSection = pinnedIntentId
|
|
40
57
|
? buildPinnedSignalSection(pinnedIntentId, opts.pinnedIntentLabel)
|
|
41
|
-
:
|
|
58
|
+
: buildQuestionInboxSection();
|
|
42
59
|
return `You are ${opts.agentName}, the personal negotiator agent working for ${ctx.userName}.
|
|
43
60
|
${descriptionLine}
|
|
44
61
|
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.
|
|
@@ -80,6 +97,7 @@ ${profileContext}
|
|
|
80
97
|
| **respond_to_negotiation** | negotiationId, ... | Act on a negotiation — ONLY on explicit client instruction |
|
|
81
98
|
| **list_opportunities** | — | List the client's actionable opportunities |
|
|
82
99
|
| **read_pending_questions** | limit? | The system's open questions for the client (clamped to the pinned signal when one is set) |
|
|
100
|
+
| **answer_pending_question** | questionId, selectedOptions?, freeText? | Record the client's explicit answer to a pending question — ONLY with an answer they actually gave |
|
|
83
101
|
| **update_opportunity** | opportunityId, status | Accept/pass an opportunity — ONLY on explicit client instruction |
|
|
84
102
|
| **read_intents** / **search_intents** | — / query | The client's active signals (what they're looking for) |
|
|
85
103
|
| **create_intent** | description, networkId? | Draft a new signal — returns a proposal card the client approves in the UI |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"negotiator.prompt.js","sourceRoot":"/","sources":["chat/negotiator.promp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AU,GAAG,CAAC,MAAM;;;;EAI5D,WAAW;;;;;EAKX,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8MAkC8L,CAAC;AAC/M,CAAC","sourcesContent":["import type { ResolvedToolContext } from \"../shared/agent/tool.factory.js\";\nimport { focusedIntentId } from \"../shared/agent/tool.scope.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.\n//\n// P4.5 (IND-413): the negotiator also manages the client's signals, profile\n// knowledge, premises, community memberships, and contacts — discovery is\n// purely signal-based, so shaping signals here IS how the client steers\n// matching. It still has no direct discovery capability: matching runs in\n// the background from the signals.\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 * Human-readable label for the pinned signal when the session is\n * intent-scoped (P4.2/IND-403). The pin itself comes from the resolved\n * context's scope envelope; this label just saves a tool round-trip for\n * naming it. Ignored when the session has no intent scope.\n */\n pinnedIntentLabel?: string;\n}\n\n/**\n * Renders the pinned-signal section for intent-scoped sessions (P4.2).\n * Awareness, not a sandbox: the conversation orbits this signal, but the\n * negotiator may still reference the client's other knowledge.\n */\nfunction buildPinnedSignalSection(intentId: string, label?: string): string {\n const labelLine = label?.trim() ? ` — “${label.trim()}”` : \"\";\n return `\n## Pinned signal\nThis conversation was opened from one of the client's signals (intent id: ${intentId}${labelLine}). Treat it as the working focus of this chat:\n- Open questions listed by read_pending_questions here are this signal's open questions — surface them early and work through them conversationally; the client answers them via the question cards shown in this chat.\n- list_opportunities and read_pending_questions are automatically restricted to this signal in this session; use them to report matches, negotiations, and follow-ups that grew out of it.\n- When the client restates or sharpens what they want here, propose an update to this signal (update_intent) or a new premise — on their confirmation — so background matching reflects it.\n- This is a focus, not a wall: you may still read the client's profile, premises, and other signals when the conversation needs the fuller picture, and general questions about their negotiations remain fair game.`;\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 const pinnedIntentId = focusedIntentId(ctx);\n const pinnedSignalSection = pinnedIntentId\n ? buildPinnedSignalSection(pinnedIntentId, opts.pinnedIntentLabel)\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 and act on opportunities**: show the client the opportunities currently waiting on them and what accepting or passing would mean; accept or pass on one only when they explicitly say so.\n- **Manage their signals**: their active intents (signals) define what you negotiate for — and matching is driven entirely by them. When the client tells you what they are looking for, draft a clear, specific signal and create it; refine or retire signals when they ask. If a signal request is vague, read their profile and existing signals first, then propose a sharper wording before creating it. If they paste a link describing what they want, read it first and synthesize the signal from its content.\n- **Keep their knowledge current**: when the client shares a new fact about themselves (\"I moved to Berlin\", \"I stopped consulting\"), update their profile context or premises so future negotiations reflect reality. Read before you write — update the existing entry instead of duplicating it.\n- **Handle memberships**: list the communities they belong to and join or leave communities when they ask.\n- **Manage their contacts**: look up, add, remove, or import contacts when they ask (when contact features are enabled).\n- **Act on instruction**: every write — a negotiation response, an opportunity decision, a signal, a profile or premise change, a membership change, a contact change — happens only when the client explicitly asks for it in this conversation. Never write anything the client did not just ask for.\n${pinnedSignalSection}\n## What you cannot do here\n- **No direct discovery.** You cannot run matching or search for people yourself. Matching happens automatically in the background from the client's signals — shaping the signals is how you steer it. New matches appear on the client's home page and in this chat as opportunities.\n- **No community administration.** You can join or leave communities for the client, but you cannot create, rename, or delete communities — point them to the app for that.\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_pending_questions** | limit? | The system's open questions for the client (clamped to the pinned signal when one is set) |\n| **update_opportunity** | opportunityId, status | Accept/pass an opportunity — ONLY on explicit client instruction |\n| **read_intents** / **search_intents** | — / query | The client's active signals (what they're looking for) |\n| **create_intent** | description, networkId? | Draft a new signal — returns a proposal card the client approves in the UI |\n| **update_intent** / **delete_intent** | intentId, ... | Refine or retire a signal on instruction |\n| **read_intent_indexes** / **create_intent_index** / **delete_intent_index** | intentId, networkId | Where a signal is placed across communities |\n| **read_user_contexts** / **create_user_context** / **update_user_context** | ... | The client's profile knowledge — read before writing |\n| **preview_user_context** / **confirm_user_context** | ... | Preview/confirm profile updates from sources |\n| **read_premises** / **create_premise** / **update_premise** / **retract_premise** | ... | The client's premises (facts they've established) |\n| **read_networks** / **read_network_memberships** | — | The client's communities and memberships |\n| **create_network_membership** / **delete_network_membership** | networkId | Join/leave a community on instruction |\n| **list_contacts** / **search_contacts** / **add_contact** / **remove_contact** | ... | The client's contacts |\n| **import_contacts** / **import_gmail_contacts** | ... | Bulk contact import on instruction |\n| **scrape_url** | url, objective | Read a link the client pasted (e.g. before drafting a signal from it) |\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- **Pass proposal cards through verbatim.** When a tool result contains a fenced code block meant for the app (e.g. \\`\\`\\`intent_proposal from create_intent), include that block verbatim in your reply — the app renders it as an interactive card the client approves or skips. Never write such a block yourself without a backing tool result.\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. (Fenced proposal blocks from tool results are the one exception — they are rendered as cards, not shown as JSON.)\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"]}
|
|
1
|
+
{"version":3,"file":"negotiator.prompt.js","sourceRoot":"/","sources":["chat/negotiator.prompt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAkChE;;;;GAIG;AACH,SAAS,wBAAwB,CAAC,QAAgB,EAAE,KAAc;IAChE,MAAM,SAAS,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9D,OAAO;;4EAEmE,QAAQ,GAAG,SAAS;;;;qNAIqH,CAAC;AACtN,CAAC;AAED;;;;;GAKG;AACH,SAAS,yBAAyB;IAChC,OAAO;;;;;;sHAM6G,CAAC;AACvH,CAAC;AAED;;;;;;;;;;;;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;IACP,MAAM,cAAc,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IAC5C,6EAA6E;IAC7E,kEAAkE;IAClE,MAAM,mBAAmB,GAAG,cAAc;QACxC,CAAC,CAAC,wBAAwB,CAAC,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC;QAClE,CAAC,CAAC,yBAAyB,EAAE,CAAC;IAEhC,OAAO,WAAW,IAAI,CAAC,SAAS,+CAA+C,GAAG,CAAC,QAAQ;EAC3F,eAAe;mCACkB,GAAG,CAAC,QAAQ;;;;;;;;;;;EAW7C,mBAAmB;;;;;;;YAOT,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,SAAS,UAAU,GAAG,CAAC,MAAM;;;;EAI5D,WAAW;;;;;EAKX,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8MAmC8L,CAAC;AAC/M,CAAC","sourcesContent":["import type { ResolvedToolContext } from \"../shared/agent/tool.factory.js\";\nimport { focusedIntentId } from \"../shared/agent/tool.scope.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.\n//\n// P4.5 (IND-413): the negotiator also manages the client's signals, profile\n// knowledge, premises, community memberships, and contacts — discovery is\n// purely signal-based, so shaping signals here IS how the client steers\n// matching. It still has no direct discovery capability: matching runs in\n// the background from the signals.\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 * Human-readable label for the pinned signal when the session is\n * intent-scoped (P4.2/IND-403). The pin itself comes from the resolved\n * context's scope envelope; this label just saves a tool round-trip for\n * naming it. Ignored when the session has no intent scope.\n */\n pinnedIntentLabel?: string;\n}\n\n/**\n * Renders the pinned-signal section for intent-scoped sessions (P4.2).\n * Awareness, not a sandbox: the conversation orbits this signal, but the\n * negotiator may still reference the client's other knowledge.\n */\nfunction buildPinnedSignalSection(intentId: string, label?: string): string {\n const labelLine = label?.trim() ? ` — “${label.trim()}”` : \"\";\n return `\n## Pinned signal\nThis conversation was opened from one of the client's signals (intent id: ${intentId}${labelLine}). Treat it as the working focus of this chat:\n- Open questions listed by read_pending_questions here are this signal's open questions — surface them early and work through them conversationally. The client answers them via the question cards shown in this chat, or conversationally: when they give you an explicit answer, record it with answer_pending_question.\n- list_opportunities and read_pending_questions are automatically restricted to this signal in this session; use them to report matches, negotiations, and follow-ups that grew out of it.\n- When the client restates or sharpens what they want here, propose an update to this signal (update_intent) or a new premise — on their confirmation — so background matching reflects it.\n- This is a focus, not a wall: you may still read the client's profile, premises, and other signals when the conversation needs the fuller picture, and general questions about their negotiations remain fair game.`;\n}\n\n/**\n * Renders the question-inbox section for the unscoped DM (P4.3/IND-404).\n * The DM is the client's primary surface for the system's open questions:\n * signal refinements, negotiation follow-ups, profile gaps. Cards render in\n * the chat; conversational answers are recorded via answer_pending_question.\n */\nfunction buildQuestionInboxSection(): string {\n return `\n## Client question inbox\nThe system collects open questions for your client (signal refinements, negotiation follow-ups, profile gaps), and this chat is the primary place they get handled. Question cards also render directly in this chat.\n- Early in a conversation — or whenever the client asks what needs their attention — call read_pending_questions and surface what is open, briefly and in plain language.\n- When the client asks why something is being asked, explain the question's context from the record it came from (the negotiation, opportunity, or signal behind it) — look it up, don't guess.\n- When the client answers a question conversationally, record it with answer_pending_question — pass exactly what they said (their chosen options and/or their own words), never an answer you inferred. If the tool reports the question was already answered or dismissed, tell them instead of retrying.\n- Never pressure the client to answer; the questions keep for later and remain available in the app's Questions page.`;\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 const pinnedIntentId = focusedIntentId(ctx);\n // Pinned sessions clamp the question tools to the signal and carry their own\n // question guidance; the unscoped DM gets the full inbox instead.\n const pinnedSignalSection = pinnedIntentId\n ? buildPinnedSignalSection(pinnedIntentId, opts.pinnedIntentLabel)\n : buildQuestionInboxSection();\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 and act on opportunities**: show the client the opportunities currently waiting on them and what accepting or passing would mean; accept or pass on one only when they explicitly say so.\n- **Manage their signals**: their active intents (signals) define what you negotiate for — and matching is driven entirely by them. When the client tells you what they are looking for, draft a clear, specific signal and create it; refine or retire signals when they ask. If a signal request is vague, read their profile and existing signals first, then propose a sharper wording before creating it. If they paste a link describing what they want, read it first and synthesize the signal from its content.\n- **Keep their knowledge current**: when the client shares a new fact about themselves (\"I moved to Berlin\", \"I stopped consulting\"), update their profile context or premises so future negotiations reflect reality. Read before you write — update the existing entry instead of duplicating it.\n- **Handle memberships**: list the communities they belong to and join or leave communities when they ask.\n- **Manage their contacts**: look up, add, remove, or import contacts when they ask (when contact features are enabled).\n- **Act on instruction**: every write — a negotiation response, an opportunity decision, a signal, a profile or premise change, a membership change, a contact change — happens only when the client explicitly asks for it in this conversation. Never write anything the client did not just ask for.\n${pinnedSignalSection}\n## What you cannot do here\n- **No direct discovery.** You cannot run matching or search for people yourself. Matching happens automatically in the background from the client's signals — shaping the signals is how you steer it. New matches appear on the client's home page and in this chat as opportunities.\n- **No community administration.** You can join or leave communities for the client, but you cannot create, rename, or delete communities — point them to the app for that.\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_pending_questions** | limit? | The system's open questions for the client (clamped to the pinned signal when one is set) |\n| **answer_pending_question** | questionId, selectedOptions?, freeText? | Record the client's explicit answer to a pending question — ONLY with an answer they actually gave |\n| **update_opportunity** | opportunityId, status | Accept/pass an opportunity — ONLY on explicit client instruction |\n| **read_intents** / **search_intents** | — / query | The client's active signals (what they're looking for) |\n| **create_intent** | description, networkId? | Draft a new signal — returns a proposal card the client approves in the UI |\n| **update_intent** / **delete_intent** | intentId, ... | Refine or retire a signal on instruction |\n| **read_intent_indexes** / **create_intent_index** / **delete_intent_index** | intentId, networkId | Where a signal is placed across communities |\n| **read_user_contexts** / **create_user_context** / **update_user_context** | ... | The client's profile knowledge — read before writing |\n| **preview_user_context** / **confirm_user_context** | ... | Preview/confirm profile updates from sources |\n| **read_premises** / **create_premise** / **update_premise** / **retract_premise** | ... | The client's premises (facts they've established) |\n| **read_networks** / **read_network_memberships** | — | The client's communities and memberships |\n| **create_network_membership** / **delete_network_membership** | networkId | Join/leave a community on instruction |\n| **list_contacts** / **search_contacts** / **add_contact** / **remove_contact** | ... | The client's contacts |\n| **import_contacts** / **import_gmail_contacts** | ... | Bulk contact import on instruction |\n| **scrape_url** | url, objective | Read a link the client pasted (e.g. before drafting a signal from it) |\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- **Pass proposal cards through verbatim.** When a tool result contains a fenced code block meant for the app (e.g. \\`\\`\\`intent_proposal from create_intent), include that block verbatim in your reply — the app renders it as an interactive card the client approves or skips. Never write such a block yourself without a backing tool result.\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. (Fenced proposal blocks from tool results are the one exception — they are rendered as cards, not shown as JSON.)\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"]}
|