@aintela/chat 0.4.34 → 0.4.36
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/components.js +5618 -5519
- package/dist/components.js.map +1 -1
- package/dist/hooks.js +1 -1
- package/dist/{httpArtifactService-_66bhjGo.js → httpArtifactService-GdGsaFKS.js} +7 -4
- package/dist/httpArtifactService-GdGsaFKS.js.map +1 -0
- package/dist/{httpSessionService-B3CxFtl1.js → httpSessionService-CUujaUo6.js} +130 -113
- package/dist/httpSessionService-CUujaUo6.js.map +1 -0
- package/dist/index.js +4 -4
- package/dist/models.js +1 -1
- package/dist/{serializer-BB8Cz7YD.js → serializer-DX-yGa_k.js} +547 -524
- package/dist/serializer-DX-yGa_k.js.map +1 -0
- package/dist/services.js +2 -2
- package/dist/src/components/AiChat/AiChatContext.d.ts +2 -0
- package/dist/src/components/AiChat/AiChatTypes.d.ts +11 -0
- package/dist/src/components/AiChat/ChatPane/messageAgentSummarized.test.d.ts +1 -0
- package/dist/src/components/AiChat/ChatPane/parts/ThoughtRun.d.ts +14 -0
- package/dist/src/components/AiChat/ChatPane/reasoningHeadlines.d.ts +13 -0
- package/dist/src/components/AiChat/ChatPane/reasoningHeadlines.test.d.ts +1 -0
- package/dist/src/models/ServerEvent.d.ts +3 -0
- package/dist/src/models/enums.d.ts +2 -1
- package/dist/src/models/semanticKernelModel/models.d.ts +10 -1
- package/dist/{useChatSessions-BzgPYfyj.js → useChatSessions-BXYvvd4S.js} +2 -2
- package/dist/{useChatSessions-BzgPYfyj.js.map → useChatSessions-BXYvvd4S.js.map} +1 -1
- package/package.json +1 -1
- package/dist/httpArtifactService-_66bhjGo.js.map +0 -1
- package/dist/httpSessionService-B3CxFtl1.js.map +0 -1
- package/dist/serializer-BB8Cz7YD.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer-DX-yGa_k.js","sources":["../src/models/enums.ts","../src/models/InteractionPart.ts","../src/models/semanticKernelModel/models.ts","../src/models/ServerEvent.ts","../src/models/semanticKernelModel/serializer.ts"],"sourcesContent":["import type { ConnectionState } from \"./connectionState\";\nimport type { Theme } from \"@mui/material/styles\";\nimport PsychologyIcon from '@mui/icons-material/Psychology';\nimport FlashOnIcon from '@mui/icons-material/FlashOn';\nimport RocketLaunchIcon from '@mui/icons-material/RocketLaunch';\nimport GeneratingTokensOutlined from '@mui/icons-material/GeneratingTokensOutlined';\nimport AutoFixHighIcon from '@mui/icons-material/AutoFixHigh';\nimport SortByAlphaOutlined from \"@mui/icons-material/SortByAlphaOutlined\";\nimport AllInclusiveIcon from '@mui/icons-material/AllInclusive';\n\nexport type ChatEventType = 'ChatEvent' | 'ChatResponse' | 'ChatRequest';\nexport const ChatEventType = {\n ChatEvent: 'ChatEvent',\n ChatResponse: 'ChatResponse',\n ChatRequest: 'ChatRequest',\n} as const;\n\nexport type RunMode = 'interactive' | 'autonomous';\nexport const RunMode = {\n Interactive: 'interactive',\n Autonomous: 'autonomous'\n} as const;\n\nexport type ChatAction = 'SendMessage' | 'Suspend' | 'Ping' | 'Close' | 'Other' | 'AnswerHumanTool';\nexport const ChatAction = {\n SendMessage: 'SendMessage',\n Other: 'Other',\n Suspend: 'Suspend',\n Close: 'Close',\n Ping: 'Ping',\n AnswerHumanTool: 'AnswerHumanTool'\n} as const;\n\n\nexport type EventType = 'partial_function_call' | 'tool_event' | 'function_call' | 'not_defined' | 'function_response' | 'function_client_output' | 'user_answer' | 'video' | 'thought' | 'thought_highlight' | 'inline_data' | 'file_data' | 'code_execution_result' | 'executable_code' | 'text' | 'other' | 'waiting' | 'suspended' | 'server_error';\nexport const EventType = {\n FunctionCall: 'function_call',\n PartialFunctionCall: 'partial_function_call',\n FunctionResponse: 'function_response',\n // Persisted, client-only sibling carrying a tool's ToolClientOutput payload, keyed by call id.\n // Folded into its call part on replay (never rendered on its own); the live turn delivers the\n // same payload inline on the StreamingFinalFunctionResultContent result event.\n FunctionClientOutput: 'function_client_output',\n // A user turn's rich UI representation (from UserUiContent). Carries functionDetails {name,args,\n // isUi,status:'Done'} so it routes through the uiTool dispatcher/registry exactly like an\n // agent-emitted UI tool — but authored by the user and rendered on the user side of the turn.\n UserAnswer: 'user_answer',\n Video: 'video',\n Thought: 'thought',\n // A highlight of the reasoning (StreamingThoughtHighlightContent): feeds the thought run's trail, never renders alone.\n ThoughtHighlight: 'thought_highlight',\n InlineData: 'inline_data',\n FileData: 'file_data',\n CodeExecutionResult: 'code_execution_result',\n ExecutableCode: 'executable_code',\n Other: 'other',\n Text: 'text',\n ToolEvent: 'tool_event',\n ServerError: 'server_error',\n NotDefined: 'not_defined',\n Waiting: 'waiting',\n Suspended: 'suspended'\n} as const;\n\nexport const GetEventTypeFromDotNetName = (name: string): EventType => {\n switch (name.toLocaleLowerCase()) {\n case 'functioncall':\n return EventType.FunctionCall;\n case 'functionresponse':\n return EventType.FunctionResponse;\n // Streaming \"final\" call/result carry their own $type on the wire — map them like their collapsed\n // KernelContent forms so the top-level event classifies as call/response, not NotDefined.\n case 'streamingfinalfunctioncallcontent':\n return EventType.FunctionCall;\n case 'streamingfinalfunctionresultcontent':\n return EventType.FunctionResponse;\n case 'text':\n return EventType.Text;\n case 'streamingtextcontent':\n return EventType.Text;\n case 'partialfunctioncall':\n return EventType.PartialFunctionCall;\n case 'streamingfunctioncallupdatecontent':\n return EventType.PartialFunctionCall;\n case 'streamingreasoningcontent':\n return EventType.Thought;\n case 'streamingthoughthighlightcontent':\n case 'partialthoughthighlight':\n return EventType.ThoughtHighlight;\n case 'functionclientoutputcontent':\n return EventType.FunctionClientOutput;\n case 'streamingclientoutputcontent':\n return EventType.FunctionClientOutput;\n case 'partialText':\n return EventType.Text;\n case 'unknown':\n return EventType.Other;\n default:\n return EventType.NotDefined;\n }\n}\n\nexport const EventTypeDescriptions = {\n [EventType.FunctionCall]: 'Executing function call',\n [EventType.FunctionResponse]: 'Getting response',\n [EventType.Video]: 'Video',\n [EventType.Thought]: 'Thought',\n [EventType.InlineData]: 'InlineData',\n [EventType.FileData]: 'FileData',\n [EventType.CodeExecutionResult]: 'Coding...',\n [EventType.ExecutableCode]: 'Coding...',\n [EventType.Other]: 'Other',\n [EventType.Text]: 'Text',\n [EventType.NotDefined]: 'NotDefined'\n};\n\nexport type ResponseType = 'Regular' | 'Artifact';\nexport const ResponseType = {\n Regular: 'Regular',\n Artifact: 'Artifact',\n} as const;\n\nexport type AuthorType = 'User' | 'Agent' | \"System\";\nexport const AuthorType = {\n User: 'User',\n Agent: 'Agent',\n System: 'System'\n} as const;\n\nexport type ArtifactType = 'Dashboard' | 'Chart' | 'Code';\nexport const ArtifactType = {\n Dashboard: 'Dashboard',\n Chart: 'Chart',\n Code: 'Code',\n} as const;\n\n// Agent selection types\nexport type AgentType = 'BI_Envision_Agent' | 'BI_Master_Customer_Agent' | 'BI_Dedicated_Customer_Agent' | 'Unknown';\nexport const AgentType = {\n BI_Envision_Agent: 'BI_Envision_Agent',\n BI_Master_Customer_Agent: 'BI_Master_Customer_Agent',\n BI_Dedicated_Customer_Agent: 'BI_Dedicated_Customer_Agent',\n Unknown: 'Unknown',\n} as const;\n\n// Agent mode\nexport type AgentMode = 'Interactive' | 'Newsletter'\nexport const AgentMode = {\n Interactive: 'Interactive',\n Newsletter: 'Newsletter'\n} as const;\n\nexport const AgentConfig = {\n [AgentType.BI_Envision_Agent]: {\n name: 'Envision',\n description: 'Analisa dados de vendas globais\\ncom insights consolidados de todos os clientes\\ne métricas agregadas do mercado'\n },\n [AgentType.BI_Master_Customer_Agent]: {\n name: 'Clientes Master',\n description: 'Visão consolidada de todos os clientes\\ncom análises comparativas e benchmarks\\nentre diferentes organizações'\n },\n [AgentType.BI_Dedicated_Customer_Agent]: {\n name: 'Cliente Único',\n description: 'Foco em um cliente específico\\ncom análises detalhadas e personalizadas\\npara sua organização'\n },\n [AgentType.Unknown]: {\n name: 'Não definido',\n description: 'Não definido'\n }\n} as const;\n\nexport type SkillLevel = 'FAST' | 'BALANCED' | 'PRO' | 'LIVE'\nexport const SkillLevel = {\n 'FAST': 'FAST',\n 'BALANCED': 'BALANCED',\n 'PRO': 'PRO',\n 'LIVE': 'LIVE',\n} as const;\n\n// Model selection types\nexport type ModelType = 'claude-opus-4-6' | 'claude-sonnet-4-6' | 'gemini_3_1_flash_lite_preview' | 'gemini_3_5_flash' | 'gemini-3.1-pro-preview' | 'gpt-5.1' | 'glm-5' | 'glm-4.7' | 'glm-4.7-flash' | 'kimi-k2.6' | 'kimi-k2-turbo-preview' | 'gpt-5.2' | 'gpt-5.4' | 'gpt-5.4-mini' | 'deepseek-v4-pro' | 'deepseek-v4-flash' | 'wen3.6-plus' | 'qwen3.7-max' | 'uiToolShowcase';\nexport const ModelType = {\n 'gemini_3_5_flash': 'gemini-3.5-flash',\n 'gemini_3_1_pro_preview': 'gemini-3.1-pro-preview',\n 'gemini_3_1_flash_lite_preview': 'gemini-3.1-flash-lite-preview',\n 'Gemini_live_2_5_flash_preview': 'gemini-live-2.5-flash-lite',\n 'Claude_Sonnet_4_6': 'claude-sonnet-4-6',\n 'Claude_Opus_4_6': 'claude-opus-4-6',\n 'Gpt_5_1': 'gpt-5.1',\n 'Gpt_5_2': 'gpt-5.2',\n 'Gpt_5_5': 'gpt-5.5-2026-04-23',\n 'Gpt_5_4_mini': 'gpt-5.4-mini',\n 'Glm-5_2': 'Glm-5.2',\n 'Glm_4.7': 'Glm-4.7',\n 'Glm_4.7_flash': 'Glm-4.7-Flash',\n 'Kimi_K26': 'kimi-k2.6',\n 'Kimi_Turbo': 'kimi-k2-turbo-preview',\n 'DeepSeek_v4_Pro': 'deepseek-v4-pro',\n 'DeepSeek_v4-Flash': 'deepseek-v4-flash',\n 'Qwen3_6-plus': 'qwen3.6-plus',\n 'Qwen3_7-max': 'qwen3.7-max',\n 'CorporateTravelDashboard': \"CorporateTravelDashboard\",\n 'ShowGuideDemo': \"ShowGuideDemo\",\n 'uiToolShowcase': 'uiToolShowcase',\n 'AUTO': 'AUTO'\n} as const;\n\nexport const ModelConfig = {\n [ModelType.Claude_Opus_4_6]: {\n name: 'Claude Opus 4.6',\n description: 'Modelo mais avançado da anthropic, no entanto, não tão rápido como o Sonnet',\n icon: AllInclusiveIcon,\n contextWindow: '1M tokens',\n speed: 'Moderate',\n quality: 'Highest'\n },\n [ModelType.Claude_Sonnet_4_6]: {\n name: 'Claude Sonnet 4.6',\n description: 'Ótima relação velocidade/qualidade',\n icon: AllInclusiveIcon,\n contextWindow: '1M tokens',\n speed: 'Fast',\n quality: 'High'\n },\n [ModelType.gemini_3_1_pro_preview]: {\n name: 'Gemini 3.1 Pro',\n description: 'Modelo mais avançado\\nMelhor qualidade para tarefas complexas\\nContexto: 2M tokens',\n icon: PsychologyIcon,\n contextWindow: '2M tokens',\n speed: 'Moderate',\n quality: 'Highest'\n },\n [ModelType.gemini_3_5_flash]: {\n name: 'Gemini 3.5 Flash',\n description: 'Equilibrio ideal entre velocidade e qualidade\\nÓtimo para a maioria das tarefas\\nContexto: 1M tokens',\n icon: FlashOnIcon,\n contextWindow: '1M tokens',\n speed: 'Fast',\n quality: 'High'\n },\n [ModelType.gemini_3_1_flash_lite_preview]: {\n name: 'Gemini 3 Lite Flash',\n description: 'NOVO: Equilibrio ideal entre velocidade e qualidade\\nÓtimo para a maioria das tarefas\\nContexto: 1M tokens',\n icon: FlashOnIcon,\n contextWindow: '1M tokens',\n speed: 'Fast',\n quality: 'High'\n },\n\n [ModelType.Gpt_5_1]: {\n name: 'Chat GPT 5.1',\n description: 'Chat GPT 5.1',\n icon: RocketLaunchIcon,\n contextWindow: '200k tokens',\n speed: 'Good',\n quality: 'High'\n },\n [ModelType.Gpt_5_2]: {\n name: 'Chat GPT 5.2',\n description: 'Chat GPT 5.2',\n icon: RocketLaunchIcon,\n contextWindow: '200k tokens',\n speed: 'Good',\n quality: 'Highest'\n },\n [ModelType.Gpt_5_5]: {\n name: 'Chat GPT 5.5',\n description: 'A melhor inteligência em escala para fluxos de trabalho de agentes, codificação e profissionais.',\n icon: RocketLaunchIcon,\n contextWindow: '200k tokens',\n speed: 'Good',\n quality: 'Highest'\n },\n [ModelType.Gpt_5_4_mini]: {\n name: 'Chat GPT 5.4 Mini',\n description: 'Modelo compacto mais robusto da OpenAi até momento para codificação, uso de computadores e subagentes.',\n icon: RocketLaunchIcon,\n contextWindow: '200k tokens',\n speed: 'Fast',\n quality: 'Highest'\n },\n [ModelType[\"Glm-5_2\"]]: {\n name: 'Z.ai Glm-5',\n description: 'Modelo open weights bem competente da Z.Ai. Apesar de gerar respostas mais longas o modelo é muito capaz.',\n icon: SortByAlphaOutlined,\n contextWindow: '200k tokens',\n speed: 'Good',\n quality: 'Highest'\n },\n [ModelType[\"Glm_4.7\"]]: {\n name: 'Z.ai Glm-4.7',\n description: '',\n icon: SortByAlphaOutlined,\n contextWindow: '200k tokens',\n speed: 'Fast',\n quality: 'High'\n },\n [ModelType[\"Glm_4.7_flash\"]]: {\n name: 'Z.ai Glm-4.7',\n description: '',\n icon: SortByAlphaOutlined,\n contextWindow: '200k tokens',\n speed: 'Good',\n quality: 'High'\n },\n [ModelType.DeepSeek_v4_Pro]: {\n name: 'DeepSeek Reasoner',\n description: 'Modelo da DeepSeek com modo de raciocínio profundo (thinking mode).\\nIdeal para tarefas complexas que se beneficiam de cadeia de pensamento extensa.',\n icon: PsychologyIcon,\n contextWindow: '128k tokens',\n speed: 'Moderate',\n quality: 'Highest'\n },\n [ModelType[\"DeepSeek_v4-Flash\"]]: {\n name: 'DeepSeek Chat',\n description: 'Modelo de chat rápido da DeepSeek, sem modo de raciocínio.\\nÓtimo equilíbrio entre velocidade e qualidade para uso geral.',\n icon: FlashOnIcon,\n contextWindow: '128k tokens',\n speed: 'Fast',\n quality: 'High'\n },\n [ModelType.Kimi_K26]: {\n name: 'Kimi K2.6 Pro',\n description: 'Modelo híbrido da Moonshot com modo de raciocínio (thinking) ativado por padrão.\\nMelhor capacidade da família K2 para tarefas complexas.',\n icon: PsychologyIcon,\n contextWindow: '256k tokens',\n speed: 'Moderate',\n quality: 'Highest'\n },\n [ModelType.Kimi_Turbo]: {\n name: 'Kimi K2 Turbo',\n description: 'Variante rápida (não-thinking) da Moonshot.\\nÓtima relação velocidade/qualidade para uso geral.',\n icon: FlashOnIcon,\n contextWindow: '256k tokens',\n speed: 'Fast',\n quality: 'High'\n },\n [ModelType[\"Qwen3_6-plus\"]]: {\n name: 'Qwen 3.6 Plus - Alibaba',\n description: 'Multimodal nativo, context window - 1 milhão de tokens, codificação agentiva',\n icon: FlashOnIcon,\n contextWindow: '1 milhão',\n speed: 'Moderate',\n quality: 'Highest'\n },\n [ModelType[\"Qwen3_7-max\"]]: {\n name: 'Qwen 3.7 Max - Alibaba',\n description: 'Multimodal nativo, context window - 1 milhão de tokens, codificação agentiva',\n icon: FlashOnIcon,\n contextWindow: '1 milhão',\n speed: 'Moderate',\n quality: 'Highest'\n },\n [ModelType.uiToolShowcase]: {\n name: 'UiToolShowcase - Testing',\n description: 'Cria um stream de testes.',\n icon: GeneratingTokensOutlined,\n contextWindow: '256k tokens',\n speed: 'Fast',\n quality: 'High'\n }\n\n} as const;\n\nexport type ModelVendor = 'Google' | 'Anthropic' | 'OpenAI' | 'ZhiPu' | 'Moonshot' | 'DeepSeek' | 'Unknown';\n\nexport function getModelVendor(modelId: string | undefined): ModelVendor {\n if (!modelId) return 'Unknown';\n const id = modelId.toLowerCase();\n if (id.startsWith('gemini') || id.startsWith('live')) return 'Google';\n if (id.startsWith('claude')) return 'Anthropic';\n if (id.startsWith('gpt')) return 'OpenAI';\n if (id.startsWith('glm')) return 'ZhiPu';\n if (id.startsWith('kimi')) return 'Moonshot';\n if (id.startsWith('deepseek')) return 'DeepSeek';\n if (id === 'auto') return 'Unknown';\n return 'Unknown';\n}\n\nexport const getConnectionStateColor = (connectionState: ConnectionState, theme: Theme) => {\n switch (connectionState) {\n case 'Connected':\n return theme.palette.primary.light;\n case 'Paused':\n return theme.palette.warning.light;\n case 'Disconnected':\n return theme.palette.text.secondary;\n case 'Connecting':\n return theme.palette.success.dark;\n case 'Unknown':\n return theme.palette.text.secondary;\n default:\n return theme.palette.text.secondary;\n }\n};","import { getRandomUUID } from '@lib/utils/envUtils';\nimport type { FunctionDetails, CodeExecutionResultDetails, ExecutableCodeDetails, ThoughtDetails, ErrorDetails, TextDetails, ToolEventDetails } from \"./ServerEvent\";\nimport { EventType } from \"./enums\";\n\nexport interface InteractionPart {\n id: string;\n eventType: EventType;\n author: string,\n functionDetails?: FunctionDetails;\n codeExecutionResultDetails?: CodeExecutionResultDetails;\n executableCodeDetails?: ExecutableCodeDetails;\n thoughtDetails?: ThoughtDetails;\n toolDetails?: ToolEventDetails,\n textDetails?: TextDetails;\n errorDetails?: ErrorDetails;\n visible?: boolean;\n created: Date;\n ended?: Date;\n text?: string;\n hasTask?: boolean;\n rawDetails?: any;\n\n //Chuck event properties\n textLastChunk?: string;\n thoughtLastChunk?: string;\n partial: boolean;\n\n //Helper properties\n isStillWriting: boolean;\n mustPush: boolean;\n textAppendable: boolean;\n waitingDetails?: {\n stopPoint?: Date;\n addTimer: boolean;\n isTimerRunning: boolean;\n status: string;\n startingPoint: Date\n loadDots?: boolean\n }\n}\n\n\nexport class InteractionPartUtils {\n static replaceFirstTwoTabsPerLine(value?: any): string {\n const regex = /^\\s{15}/gm;\n return typeof (value) === \"string\" ? value.replaceAll(regex, (match) => match.substring(15)) : value ?? \"\";\n }\n\n static jsonToString(json: any): string {\n if (json == null) return \"\";\n if (typeof json !== \"object\") return String(json);\n\n const charCollapsed = Array.isArray(json)\n ? (InteractionPartUtils.isCharArray(json) ? json.join(\"\") : null)\n : InteractionPartUtils.tryCollapseCharIndexedObject(json);\n if (charCollapsed != null) return charCollapsed;\n\n if (Array.isArray(json)) {\n try { return JSON.stringify(json, null, 2); }\n catch { return String(json); }\n }\n\n const objectProps = Object.keys(json);\n const textReponseLines: string[] = [];\n objectProps.forEach((prop: string) => {\n let value = json[prop];\n if (typeof value === 'object') {\n value = JSON.stringify(json[prop], null, 2);\n }\n const startChart = value?.toString().indexOf(\"\\n\") > -1 ? \"\\n\" : \"\";\n textReponseLines.push(`${prop}:${startChart}${value}`);\n });\n return textReponseLines.join(\"\\n\");\n }\n\n static functionDetailsToString(obj: any | undefined): string {\n if (obj == null) return \"\";\n if (typeof obj == \"string\") {\n obj = obj.replaceAll(\"\\\"{\", \"{\").replaceAll(\"}\\\"\", \"}\").replaceAll(\"'{\", \"{\").replaceAll(\"}'\", \"}\")\n obj = obj.replaceAll(\"\\\\\\\"\", \"\\\"\");\n try {\n obj = JSON.parse(obj)\n }\n catch {\n return obj;\n }\n if (typeof obj !== \"object\" || obj == null) return String(obj);\n }\n if (Array.isArray(obj)) {\n try { return JSON.stringify(obj, null, 2); }\n catch { return String(obj); }\n }\n\n const objectProps = Object.keys(obj);\n const textReponseLines: string[] = [];\n objectProps.forEach((prop: string) => {\n let value = obj?.[prop];\n if (typeof value === 'object') {\n value = JSON.stringify(value, null, 2);\n }\n const startChar = value?.toString().indexOf(\"\\n\") > -1 ? \"\\n\" : \"\";\n textReponseLines.push(`${prop}:${startChar}${value}`);\n });\n return textReponseLines.join(\"\\n\");\n }\n\n /**\n * Reads the server-generated SlotId from a UI render tool's result. The\n * result reaches the client as a plain object on the live path, but as a\n * JSON string — sometimes double-encoded (a JSON string of a JSON string) —\n * on the persisted / session-replay path. Unwrap up to two string layers\n * before reading the field. Returns undefined when absent or unparseable.\n */\n static uiSlotId(part?: InteractionPart): string | undefined {\n let r: unknown = part?.functionDetails?.response;\n for (let i = 0; i < 2 && typeof r === \"string\"; i++) {\n try { r = JSON.parse(r); } catch { return undefined; }\n }\n if (!r || typeof r !== \"object\") return undefined;\n const o = r as Record<string, unknown>;\n const v = o.SlotId ?? o.slotId;\n return typeof v === \"string\" ? v : undefined;\n }\n\n static fromError(errorMsg: string) {\n const errorPart: InteractionPart = {\n errorDetails: { errorMessage: errorMsg },\n eventType: EventType.ServerError,\n id: '',\n author: 'main',\n created: new Date(),\n partial: false,\n isStillWriting: false,\n mustPush: false,\n textAppendable: false\n }\n return errorPart;\n }\n\n static fromText(text: string, author?: string, id?: string): InteractionPart {\n const textPart: InteractionPart = {\n text: text,\n eventType: EventType.Text,\n id: id ?? getRandomUUID(),\n created: new Date(),\n author: author ?? \"main\",\n partial: false,\n isStillWriting: false,\n mustPush: false,\n textAppendable: false\n }\n return textPart;\n }\n\n /**\n * Builds the user-authored UI part for a `sendMessage(text, { ui })` turn. Mirrors the\n * shape `ServerEvent` produces from a persisted `UserUiContent` on reload, so the live\n * and replayed parts are identical: an `EventType.UserAnswer` carrying functionDetails\n * {name, args, isUi, status:'Done'} that routes through the uiTool dispatcher/registry.\n */\n static fromUserUi(name: string, args?: string, id?: string): InteractionPart {\n return {\n id: id ?? getRandomUUID(),\n eventType: EventType.UserAnswer,\n author: 'user',\n created: new Date(),\n partial: false,\n isStillWriting: false,\n mustPush: false,\n textAppendable: false,\n functionDetails: {\n id: '',\n name: name,\n args: args,\n status: 'Done',\n isUi: true,\n },\n };\n }\n\n static createWaiting(addTimer: boolean = false, isTimerRunning: boolean = true, status: string, startingPoint: Date, stopPoint?: Date): InteractionPart {\n if (!status)\n status = \"Waiting\";\n const partData = InteractionPartUtils.fromText(\"...\", undefined, \"waitingpart\");\n partData.eventType = EventType.Waiting;\n partData.waitingDetails = {\n startingPoint: startingPoint,\n addTimer: addTimer,\n isTimerRunning: isTimerRunning,\n status: status,\n stopPoint: stopPoint\n }\n return partData;\n }\n\n static createSuspended(): InteractionPart {\n const partData = InteractionPartUtils.fromText(\"SUSPEND\")\n partData.eventType = EventType.Suspended;\n return partData;\n }\n\n static getPartTextContent(part: InteractionPart): string {\n return part.text ?? \"\";\n }\n\n static FlatParts(parts: InteractionPart[]): InteractionPart | undefined {\n if (parts.length === 0)\n return undefined;\n\n const textParts = parts.filter((p) => p.eventType == EventType.Text);\n const onlyPart = textParts.length > 0 ? textParts[0] : parts[0];\n const unique_event_types: EventType[] = [... new Set(parts.map((p) => p.eventType))];\n\n if (unique_event_types.length == 1) {\n onlyPart.eventType = unique_event_types[0]\n }\n else {\n if (textParts.length > 0) {\n onlyPart.eventType = EventType.Text\n }\n }\n\n onlyPart.mustPush = !(onlyPart.eventType == EventType.Text || onlyPart.eventType == EventType.Thought || onlyPart.eventType == EventType.NotDefined || onlyPart.eventType == EventType.PartialFunctionCall);\n onlyPart.textAppendable = onlyPart.eventType == EventType.Text || onlyPart.eventType == EventType.Thought || onlyPart.eventType == EventType.PartialFunctionCall;\n\n for (const part of parts) {\n if (!onlyPart.codeExecutionResultDetails && part.codeExecutionResultDetails)\n onlyPart.codeExecutionResultDetails = part.codeExecutionResultDetails;\n if (!onlyPart.errorDetails && part.errorDetails)\n onlyPart.errorDetails = part.errorDetails;\n if (!onlyPart.executableCodeDetails && part.executableCodeDetails)\n onlyPart.executableCodeDetails = part.executableCodeDetails;\n if (!onlyPart.functionDetails && part.functionDetails)\n onlyPart.functionDetails = part.functionDetails;\n // A streaming FINAL call/result event carries two reps of the same call: the collapsed\n // FunctionCall/Result (content.items) buries isUi/askUserComponent/clientOutput in `__`-args\n // — and a NO-ARG tool's don't survive decode — while the StreamingFinal* sibling\n // (streamingParts) carries them TOP-LEVEL. Fold those signals in from whichever sibling has\n // them, so collapsing to one part can't drop them (else a parked no-arg ask-user tool like\n // update_profile loses askUserComponent and its drawer never surfaces).\n if (onlyPart.functionDetails && part.functionDetails && part !== onlyPart) {\n const od = onlyPart.functionDetails, pd = part.functionDetails;\n if (!od.askUserComponent && pd.askUserComponent) od.askUserComponent = pd.askUserComponent;\n if (!od.isUi && pd.isUi) od.isUi = true;\n if (!od.clientOutput && pd.clientOutput) od.clientOutput = pd.clientOutput;\n od.isAskUser = od.isAskUser || pd.isAskUser || !!od.askUserComponent;\n }\n if (!onlyPart.rawDetails && part.rawDetails)\n onlyPart.rawDetails = part.rawDetails;\n if (!onlyPart.thoughtDetails && part.thoughtDetails)\n onlyPart.thoughtDetails = part.thoughtDetails;\n if (!onlyPart.errorDetails && part.errorDetails)\n onlyPart.errorDetails = part.errorDetails;\n }\n\n return onlyPart;\n }\n\n static isCharArray(value: any): value is string[] {\n return Array.isArray(value)\n && value.length > 0\n && value.every((item: any) => typeof item === \"string\" && item.length === 1);\n }\n\n /**\n * Detects objects like `{0: \"a\", 1: \"b\", 2: \"c\", ...}` — a string that was\n * spread/indexed into an object (e.g. `{...someString}` or the server\n * serializing a string as a char-indexed dict). Returns the reassembled\n * string, or `null` if the value doesn't match this pattern.\n */\n static tryCollapseCharIndexedObject(value: any): string | null {\n if (value == null || typeof value !== \"object\" || Array.isArray(value)) return null;\n const keys = Object.keys(value);\n if (keys.length === 0) return null;\n\n for (let i = 0; i < keys.length; i++) {\n if (keys[i] !== String(i)) return null;\n const v = value[keys[i]];\n if (typeof v !== \"string\" || v.length !== 1) return null;\n }\n\n return keys.map(k => value[k]).join(\"\");\n }\n\n static isCodeExecution(part: InteractionPart): boolean {\n return part.eventType === EventType.CodeExecutionResult ||\n part.eventType === EventType.ExecutableCode;\n }\n}","import './init'; // MUST be first - loads reflect-metadata\nimport { jsonObject, jsonMember, jsonArrayMember, AnyT } from 'typedjson';\nimport { type Artifact } from '../../models/Artifact'\n\n// // Enums\nexport type PartType = 'ToolEventContent' | 'StreamingToolEventContent' | 'TextContent' | 'StreamingFinalFunctionCallContent' | 'StreamingFinalFunctionResultContent' | 'StreamingClientOutputContent' | 'StreamingReasoningContent' | 'StreamingThoughtHighlightContent' | 'ImageContent' | 'FunctionCallContent' | 'FunctionResultContent' | 'FunctionClientOutputContent' | 'UserUiContent' | 'ChatMessageContent' | 'StreamingTextContent' | 'StreamingFunctionCallUpdateContent' | 'Unknown';\nexport const PartType = {\n // KernelContent derived types\n TextContent: \"TextContent\",\n ToolEventContent: \"ToolEventContent\",\n StreamingToolEventContent: \"StreamingToolEventContent\",\n StreamingReasoningContent: \"StreamingReasoningContent\",\n StreamingThoughtHighlightContent: \"StreamingThoughtHighlightContent\",\n ImageContent: \"ImageContent\",\n FunctionCallContent: \"FunctionCallContent\",\n FunctionResultContent: \"FunctionResultContent\",\n FunctionClientOutputContent: \"FunctionClientOutputContent\",\n UserUiContent: \"UserUiContent\",\n ChatMessageContent: \"ChatMessageContent\",\n // StreamingKernelContent derived types\n StreamingTextContent: \"StreamingTextContent\",\n StreamingFunctionCallUpdateContent: \"StreamingFunctionCallUpdateContent\",\n StreamingFinalFunctionCallContent: \"StreamingFinalFunctionCallContent\",\n StreamingFinalFunctionResultContent: \"StreamingFinalFunctionResultContent\",\n StreamingClientOutputContent: \"StreamingClientOutputContent\"\n\n} as const;\n\n@jsonObject({ name: 'AuthorRole' })\nexport class AuthorRole {\n\n @jsonMember(String)\n label?: string;\n}\n\nexport enum Commands {\n OpenStream = 'OpenStream',\n CloseStream = 'CloseStream',\n Ignore = 'Ignore',\n}\n\n// Supporting Classes\n@jsonObject({ name: 'EventTypeInformation' })\nexport class EventTypeInformation {\n @jsonMember(String)\n type?: string;\n\n @jsonMember(String)\n fullName?: string;\n}\n\n@jsonObject({ name: 'LlmArtifact' })\nexport class LlmArtifact {\n @jsonMember(String)\n id!: string;\n\n @jsonMember(String)\n name?: string;\n\n @jsonMember(String)\n mimeType?: string;\n\n @jsonMember(String)\n description?: string;\n\n toArtifact(): Artifact {\n return {\n created: new Date(),\n updatedAt: new Date(),\n name: this.name ?? 'Not Defined',\n description: this.description,\n mimeType: this.mimeType,\n id: this.id\n }\n }\n}\n\n@jsonObject({ name: 'KernelContent' })\nexport abstract class KernelContent {\n @jsonMember(String)\n mimeType?: string;\n\n // InnerContent is ignored (JsonIgnore in C#)\n // Not decorated with @jsonMember\n innerContent?: any;\n\n @jsonMember(String)\n modelId?: string;\n\n // Decorated so subtypes deserialize it (mirrors StreamingKernelContent.metadata). A tool's\n // client-only payload rides here when the runtime collapses StreamingFinalFunctionResultContent →\n // the sealed FunctionResultContent (see ToKernelContent); the decoder reads `metadata.clientOutput`.\n @jsonMember(AnyT)\n metadata?: Record<string, any> | null;\n}\n\n\n// StreamingKernelContent Base Class (Abstract)\n@jsonObject({ name: 'StreamingKernelContent' })\nexport abstract class StreamingKernelContent {\n @jsonMember(Number)\n choiceIndex: number = 0;\n\n // InnerContent is ignored (JsonIgnore in C#)\n // Not decorated with @jsonMember\n innerContent?: any;\n\n @jsonMember(String)\n modelId?: string;\n\n @jsonMember(Object)\n metadata?: Record<string, any>;\n}\n\n\n// TextContent\n@jsonObject({ name: 'TextContent' })\nexport class TextContent extends KernelContent {\n\n @jsonMember(String)\n text?: string;\n\n // Encoding is ignored (JsonIgnore in C#)\n // Not decorated with @jsonMember\n encoding?: string;\n\n constructor() {\n super();\n this.encoding = 'UTF8';\n }\n\n toString(): string {\n return this.text ?? '';\n }\n}\n\n@jsonObject({ name: 'StreamingToolEventContent' })\nexport class StreamingToolEventContent extends StreamingKernelContent {\n\n @jsonMember(String)\n eventName?: string;\n\n @jsonMember(String)\n eventData?: string;\n\n @jsonMember(String)\n sessionId?: string;\n\n constructor() {\n super();\n }\n}\n\n// TextContent\n@jsonObject({ name: 'ToolEventContent' })\nexport class ToolEventContent extends KernelContent {\n\n @jsonMember(String)\n eventName?: string;\n\n @jsonMember(String)\n eventData?: string;\n\n @jsonMember(String)\n sessionId?: string;\n\n constructor() {\n super();\n }\n}\n\n// ImageContent (referenced but not fully defined in original)\n@jsonObject({ name: 'ImageContent' })\nexport class ImageContent extends KernelContent {\n @jsonMember(String)\n url?: string;\n\n @jsonMember(String)\n dataUri?: string;\n}\n\n// FunctionCallContent\n@jsonObject({ name: 'FunctionCallContent' })\nexport class FunctionCallContent extends KernelContent {\n @jsonMember(String)\n id?: string;\n\n @jsonMember(String)\n pluginName?: string;\n\n @jsonMember(String)\n functionName!: string;\n\n @jsonMember(AnyT)\n arguments?: any;\n\n // Exception is not serializable - omit jsonMember decorator\n exception?: Error;\n}\n\n// The client-render hints for a tool call/result — one value object carried by the streaming final\n// types (server: ToolCallPresentation). Live wire is camelCase (these member names); on the reload\n// path it rides raw inside FunctionCall/Result `metadata[\"aia:presentation\"]` with PascalCase keys,\n// which ServerEvent reads case-insensitively.\n// ⚠️ EVERY field the server sends must be declared here. TypedJSON copies only declared members, so an\n// undeclared one is silently DROPPED on the live wire — it survives only on the reload path, where\n// ServerEvent reads the raw metadata object instead. That asymmetry is invisible until a flag that matters\n// only live stops arriving, which is exactly how `parked` shipped broken.\n@jsonObject({ name: 'ToolCallPresentation' })\nexport class ToolCallPresentation {\n @jsonMember(Boolean)\n isUi?: boolean;\n\n @jsonMember(String)\n askUserComponent?: string;\n\n @jsonMember(String)\n argsDescription?: string;\n\n // Runtime override on a RESULT: the UI tool called CancelUiRender() and must not be drawn.\n @jsonMember(Boolean)\n cancelUi?: boolean;\n\n // The PARK signal on a StreamingClientOutputContent: the tool is now waiting on a human, which is what\n // licenses the ask-user drawer to open.\n @jsonMember(Boolean)\n parked?: boolean;\n}\n\n// The metadata key the presentation rides under on a collapsed (persisted) FunctionCall/Result.\nexport const PresentationMetadataKey = 'aia:presentation';\n\n// MUST extend StreamingKernelContent (NOT FunctionCallContent): on the server this is a\n// StreamingKernelContent (StreamingFunctionCallUpdateContent), and it arrives in `streamingParts`\n// (StreamingKernelContent[]). TypedJSON only resolves a polymorphic $type to a subtype of the\n// declared element type — extending FunctionCallContent made it unresolvable there, so it fell\n// back to base StreamingKernelContent. Wire fields mirror StreamingFunctionCallUpdateContent\n// (callId / name / arguments) plus the presentation object.\n@jsonObject({ name: 'StreamingFinalFunctionCallContent' })\nexport class StreamingFinalFunctionCallContent extends StreamingKernelContent {\n @jsonMember(String, { name: \"callId\" })\n id?: string;\n\n @jsonMember(String, { name: \"name\" })\n functionName?: string;\n\n @jsonMember(String)\n arguments?: string;\n\n // Client-render hints (isUi / askUserComponent / argsDescription) as one object.\n @jsonMember(ToolCallPresentation)\n presentation?: ToolCallPresentation;\n}\n\n// FunctionResultContent\n@jsonObject({ name: 'FunctionResultContent' })\nexport class FunctionResultContent extends KernelContent {\n @jsonMember(String, { name: \"callId\" })\n id?: string;\n\n @jsonMember(String)\n pluginName?: string;\n\n @jsonMember(String)\n functionName?: string;\n\n @jsonMember(AnyT)\n result?: any;\n}\n\n// See StreamingFinalFunctionCallContent: must extend StreamingKernelContent so it resolves\n// inside `streamingParts`. Wire fields per the server-side StreamingFinalFunctionResultContent\n// (callId / pluginName / functionName / result / presentation / clientOutput).\n@jsonObject({ name: 'StreamingFinalFunctionResultContent' })\nexport class StreamingFinalFunctionResultContent extends StreamingKernelContent {\n @jsonMember(String, { name: \"callId\" })\n id?: string;\n\n @jsonMember(String)\n pluginName?: string;\n\n @jsonMember(String)\n functionName?: string;\n\n @jsonMember(AnyT)\n result?: any;\n\n // Client-render hints (isUi / askUserComponent) as one object.\n @jsonMember(ToolCallPresentation)\n presentation?: ToolCallPresentation;\n\n // Client-only payload the tool wrote via CallContext.SetClientData (a live object, camelCase +\n // string enums — shaped server-side, delivered in-line, NOT a JSON string), correlated to this\n // result by callId. Rides this result event live — never the model-facing `result`; the durable\n // replay form is FunctionClientOutputContent. Kept separate from `presentation` (a data payload,\n // not a render hint).\n @jsonMember(AnyT)\n clientOutput?: any;\n}\n\n// Persisted, client-only sibling carrying a tool's ToolClientOutput payload on the Tool message\n// (server-side FunctionClientOutputContent : IClientOnlyContent — stripped from the model request,\n// kept for replay). Correlated to its result by callId; folded into the call part on session reload.\n@jsonObject({ name: 'FunctionClientOutputContent' })\nexport class FunctionClientOutputContent extends KernelContent {\n @jsonMember(String, { name: \"callId\" })\n id?: string;\n\n // A live object (camelCase + string enums), delivered in-line by the server — NOT a JSON string.\n @jsonMember(AnyT)\n data?: any;\n}\n\n// Non-terminal, client-only payload pushed WHILE an ask-user tool is parked (server-side\n// StreamingClientOutputContent, from RegisterHumanInput(callId, initialClientOutput) — issue #60). Unlike\n// the result-event clientOutput, it carries no result and does NOT close the call: it is folded onto the\n// parked call part by callId so the ask-user component renders pre-filled, leaving the call Executing until\n// the real answer arrives. The LLM never sees it.\n@jsonObject({ name: 'StreamingClientOutputContent' })\nexport class StreamingClientOutputContent extends StreamingKernelContent {\n @jsonMember(String, { name: \"callId\" })\n id?: string;\n\n // A live object (camelCase + string enums), delivered in-line by the server — NOT a JSON string.\n // NULL/absent is legitimate: a tool that parks with no prefill still sends this content, because the\n // event's other job is to announce the PARK.\n @jsonMember(AnyT)\n clientOutput?: any;\n\n // Carries `parked` — the signal that this call is now waiting on a human, and therefore the only thing\n // that licenses the ask-user drawer. MUST be declared: TypedJSON drops undeclared members, so without\n // this the server's flag reached the socket and was thrown away one layer above it.\n @jsonMember(ToolCallPresentation)\n presentation?: ToolCallPresentation;\n}\n\n// Persisted, client-only sibling carrying a host UI representation for a USER turn\n// (server-side UserUiContent : IClientOnlyContent — stripped from the model request, kept for\n// replay). `name` selects a client-registered uiTool renderer; `args` is its serialized props\n// (JSON string). The live turn injects the same {name,args} as a UserAnswer part client-side;\n// this is the durable form that re-hydrates the component on session reload.\n@jsonObject({ name: 'UserUiContent' })\nexport class UserUiContent extends KernelContent {\n @jsonMember(String)\n name?: string;\n\n @jsonMember(String)\n args?: string;\n}\n\n// ChatMessageContent - defined before LlmEvent to avoid forward reference\n@jsonObject({ name: 'ChatMessageContent' })\nexport class ChatMessageContent extends KernelContent {\n @jsonMember(AuthorRole)\n role?: AuthorRole;\n\n @jsonArrayMember(() => KernelContent)\n items?: KernelContent[];\n}\n\n// StreamingFunctionCallUpdateContent\n@jsonObject({ name: 'StreamingFunctionCallUpdateContent' })\nexport class StreamingFunctionCallUpdateContent extends StreamingKernelContent {\n @jsonMember(String)\n callId?: string;\n\n @jsonMember(String)\n name?: string;\n\n @jsonMember(String)\n arguments?: string;\n\n @jsonMember(Number)\n functionCallIndex: number = 0;\n}\n\n// StreamingTextContent\n@jsonObject({ name: 'StreamingTextContent' })\nexport class StreamingTextContent extends StreamingKernelContent {\n @jsonMember(String)\n text?: string;\n\n // Encoding is not explicitly serialized in C#\n // Not decorated with @jsonMember\n encoding?: string;\n}\n\n@jsonObject({ name: 'StreamingReasoningContent' })\nexport class StreamingReasoningContent extends StreamingKernelContent {\n @jsonMember(String)\n text?: string;\n\n // Encoding is not explicitly serialized in C#\n // Not decorated with @jsonMember\n encoding?: string;\n}\n\n/**\n * A highlight of the model's reasoning — one short line saying what a reasoning paragraph does — produced by the\n * agents server while the reasoning streams. It belongs to the reasoning, so it is a streaming part of its own (the\n * SDK's StreamingThoughtHighlightContent), never a tool event.\n */\n@jsonObject({ name: 'StreamingThoughtHighlightContent' })\nexport class StreamingThoughtHighlightContent extends StreamingKernelContent {\n @jsonMember(String)\n headline?: string;\n}\n\n// InstructionSummary - defined before SessionInformation\n@jsonObject({ name: 'InstructionSummary' })\nexport class InstructionSummary {\n @jsonMember(String)\n instructionCategory: string = \"\"\n\n @jsonMember(String)\n description: string = \"\"\n\n @jsonMember(String)\n interactionId: string = \"\"\n}\n\n// SessionInformation - defined before LlmEvent to avoid forward reference\n@jsonObject({ name: 'SessionInformation' })\nexport class SessionInformation {\n @jsonMember(Number)\n size: number = 0\n\n @jsonMember(Number)\n originalSize: number = 0\n\n @jsonMember(Number)\n ratio: number = 0\n\n @jsonMember(Number)\n previousRatio: number = 0\n\n @jsonMember(Number)\n threshold: number = 0\n\n @jsonMember(Number)\n maxSize: number = 0\n\n @jsonMember(String)\n id?: string\n\n @jsonArrayMember(InstructionSummary)\n instructionSummaries?: InstructionSummary[] = []\n\n // ── Present only on a COMPRESSION event ──────────────────────────────────\n // The server sends SessionCompressionInformation (a subclass) as this same\n // `session_information` field when a compression step runs in-band, so these\n // arrive filled and are absent on every ordinary turn. Declared here rather\n // than as a second model because the wire has one field, and a subclass\n // TypedJSON never sees would silently drop the numbers.\n //\n // ⚠️ In-band means the LEGACY trim and the planner's own events. The\n // summarizing compactor runs DETACHED (out of band, on the run bus), so its\n // pass produces no event here at all — which is why the panel infers a\n // compaction from a drop in `size` instead of waiting for these. They are the\n // richer signal when they do arrive, not the only one.\n @jsonMember(Number)\n interactionsCompressed?: number\n\n @jsonMember(Number)\n interactionsRemoved?: number\n\n @jsonMember(Number)\n compressionRatio?: number\n\n @jsonMember(Number)\n newOverallCount?: number\n}\n\n// Main Event Class\n@jsonObject({ name: 'LlmEvent' })\nexport class LlmEvent {\n\n @jsonMember(Number)\n timestamp!: number;\n\n @jsonMember(String)\n mimeType!: string;\n\n @jsonMember(Boolean)\n partial!: boolean;\n\n @jsonMember(Boolean)\n turnComplete!: boolean;\n\n @jsonMember(Boolean)\n visible!: boolean;\n\n @jsonMember(String)\n serverError?: string;\n\n @jsonMember(String)\n interactionId!: string;\n\n @jsonMember(SessionInformation)\n sessionInformation?: SessionInformation;\n\n @jsonMember(EventTypeInformation)\n eventType?: EventTypeInformation;\n\n @jsonArrayMember(LlmArtifact)\n artifactsGenerated: LlmArtifact[] = [];\n\n @jsonMember(String)\n author?: string;\n\n @jsonMember(AuthorRole)\n role?: AuthorRole;\n\n @jsonMember(String)\n command?: Commands;\n\n @jsonMember(ChatMessageContent)\n content?: ChatMessageContent;\n\n @jsonArrayMember(() => StreamingKernelContent)\n streamingParts?: StreamingKernelContent[];\n\n subAgentId?: string;\n subAgentName?: string;\n text?: string;\n}\n\n@jsonObject({ name: 'PartialLlmEvent' })\nexport class PartialLlmEvent {\n\n @jsonMember(Number, { name: \"ts\" })\n timeStamp?: number;\n\n @jsonMember(String, { name: \"pt\" })\n partialText?: string;\n\n @jsonMember(String, { name: \"pr\" })\n partialReasoning?: string;\n\n @jsonMember(String, { name: \"fn\" })\n functionName?: string;\n\n @jsonArrayMember(() => StreamingKernelContent)\n streamingParts?: StreamingKernelContent[];\n\n @jsonMember(String, { name: \"fid\" })\n functionCallId?: string;\n\n @jsonMember(String, { name: \"tp\" })\n type?: string;\n\n @jsonMember(String, { name: \"itid\" })\n iteractionId?: string;\n\n @jsonMember(EventTypeInformation)\n partialEventType?: EventTypeInformation;\n\n @jsonMember(String, { name: \"said\" })\n subAgentId?: string;\n}\n\n\n@jsonObject({ name: 'StreamingResponse' })\nexport class StreamingResponse {\n\n @jsonMember(String)\n type!: string;\n\n @jsonMember(LlmEvent)\n event?: LlmEvent;\n\n @jsonMember(String)\n sessionId?: string;\n\n /**\n * Optional. Server piggybacks a freshly minted JWT on the next few Pong frames\n * after a WS upgrade where it auto-refreshed the token (inbound was expired or\n * near expiry). The client mirrors this into the stored user record so the\n * global fetch interceptor stops sending the stale token.\n */\n @jsonMember(String)\n accessToken?: string;\n\n @jsonMember(PartialLlmEvent, { name: \"pe\" })\n partialEvent?: PartialLlmEvent;\n\n @jsonMember(String)\n subAgentId?: string;\n\n @jsonMember(String)\n subAgentName?: string;\n\n /**\n * Server-assigned monotonic sequence number for events emitted by an InteractionRun.\n * Tracked client-side as `lastSeq` so reconnects can resume mid-stream via\n * `?lastSeq=N` on the WebSocket URL. Absent on control messages (Pong / Suspended)\n * and on RewindLost notices that carry the new starting seq directly.\n */\n @jsonMember(Number)\n seq?: number;\n}\n\n@jsonObject({ name: 'Payload' })\nexport class Payload {\n\n @jsonArrayMember(LlmEvent)\n events!: LlmEvent[];\n}\n\nexport interface InteractionStatistics {\n eventCount: number,\n unknonwCount: number,\n unparsedCount: number,\n totalTransfered: number,\n buffer: string[],\n startTime: Date,\n elapsed: number,\n tokensPerSecond: number,\n sessionInformation?: SessionInformation\n /**\n * Every compaction observed on this connection, oldest first — what the\n * session-usage panel draws as markers. See `detectCompaction`.\n */\n sessionCompactions?: SessionCompaction[]\n}\n\n/**\n * One observed compaction: when it happened, and how much smaller the session\n * got. `ratio` is where on the usage bar it happened (the fill BEFORE it), which\n * is what makes a marker's position meaningful.\n */\nexport interface SessionCompaction {\n at: number\n ratio: number\n sizeBefore: number\n sizeAfter: number\n /** From an in-band compression event; absent for a detached pass. */\n interactionsCompressed?: number\n}\n\n","import { EventType, SkillLevel, GetEventTypeFromDotNetName } from './enums';\nimport { InteractionPartUtils, type InteractionPart } from './InteractionPart';\nimport { type EndMessageData } from './EndMessageData';\nimport { ANALYTICS_AGENT_NAME } from '@lib/utils/environmentUtils';\nimport { FunctionCallContent, FunctionClientOutputContent, FunctionResultContent, KernelContent, LlmArtifact, LlmEvent, PartType, PresentationMetadataKey, SessionInformation, StreamingClientOutputContent, StreamingFinalFunctionCallContent, StreamingFinalFunctionResultContent, StreamingFunctionCallUpdateContent, StreamingKernelContent, StreamingReasoningContent, StreamingThoughtHighlightContent, StreamingTextContent, StreamingToolEventContent, TextContent, ToolEventContent, UserUiContent } from './semanticKernelModel/models';\nimport { getRandomUUID } from '@lib/utils';\n\n/**\n * The client-render hints for a tool call/result, read from whichever shape arrived:\n * • a LIVE streaming part carries them top-level as `presentation` (camelCase), or\n * • a persisted/collapsed FunctionCall/Result carries them in `metadata[\"aia:presentation\"]`\n * (PascalCase, from the session-load serializer).\n * Fields are read case-insensitively so one mapping covers both. Replaces the old scattered\n * top-level flags + `__`-args smuggling.\n */\nfunction readPresentation(serverCall: any): { isUi: boolean; askUserComponent?: string; argsDescription?: string; cancelUi?: boolean; parked?: boolean } {\n const raw = serverCall?.presentation\n ?? (serverCall?.metadata as Record<string, unknown> | undefined)?.[PresentationMetadataKey];\n if (!raw || typeof raw !== 'object') return { isUi: false };\n const o = raw as Record<string, unknown>;\n const pick = (camel: string, pascal: string) => o[camel] ?? o[pascal];\n return {\n isUi: pick('isUi', 'IsUi') === true,\n askUserComponent: (pick('askUserComponent', 'AskUserComponent') as string | undefined) || undefined,\n argsDescription: (pick('argsDescription', 'ArgsDescription') as string | undefined) || undefined,\n // Runtime override on a RESULT: the UI tool chose not to render (CallContext.CancelUiRender).\n cancelUi: pick('cancelUi', 'CancelUi') === true || undefined,\n // Live signal on the PARK event: the tool is now waiting on a human, so the drawer may open.\n parked: pick('parked', 'Parked') === true || undefined,\n };\n}\n\nexport interface FunctionDetails {\n id: string;\n args?: any;\n text?: string;\n name: string;\n start?: Date,\n end?: Date,\n response?: any;\n status: 'Composing' | 'Executing' | 'Done';\n silent?: boolean\n /** True when this targets a [KernelUiFunction] render tool — classified as `uiTool`. */\n isUi?: boolean\n /**\n * True when this targets a [KernelUIComponent] ask-user tool — classified as `askUser` and drawn\n * in the docked ask-user drawer (AskUserSheet). Derived from {@link askUserComponent}'s presence;\n * mirrors how {@link isUi} works, replacing the legacy hard-coded ask_user/askauth name matching.\n */\n isAskUser?: boolean\n /**\n * The ask-user component to draw (the server's [KernelUIComponent] value): e.g. `\"AskUserPart\"`,\n * `\"AskAuthPart\"`, `\"AskCreateAccount\"`. Resolved against the ui-tool registry's askUser entries.\n */\n askUserComponent?: string\n /** Server-provided human one-liner describing the call args, for the tool-call chip. */\n argsDescription?: string\n /**\n * Runtime override stamped on a RESULT when a UI tool called `CallContext.CancelUiRender()`: the\n * call targets a [KernelUIComponent]/[KernelUiFunction] but the tool chose NOT to draw it (e.g. a\n * precondition already held). Sticky in the interaction merge; suppresses the ask-user drawer /\n * UI-render classification so a stale/empty prompt never lingers.\n */\n cancelUi?: boolean\n /**\n * True once the tool has actually PARKED — it called `CallContext.Ask`/`RegisterHumanInput` and is waiting\n * on a human. Arrives on the park event (`StreamingClientOutputContent`, prefill or not) and is sticky in\n * the interaction merge.\n *\n * This is what licenses the ask-user drawer. {@link askUserComponent} cannot: it rides the CALL, which is\n * streamed before the tool body runs, so it says \"this call targets a form\" and not \"this call is asking\".\n * Keying the drawer off the call meant it opened for the whole body of every UI tool — so a guard that\n * short-circuits (`ask_for_credit_card` finding a card already on file) FLASHED the drawer for as long as\n * its ProfileApi round trip took. Requiring this flag inverts the default: nothing opens until the server\n * says it is waiting.\n *\n * Live-only by design, and not persisted: it describes a moment, and a replayed session has nothing\n * waiting. The drawer is only ever computed from the live turn (`currentMessage`, reset to null on session\n * load), so there is no replay path that needs it.\n */\n parked?: boolean\n /**\n * Client-only payload the tool produced via its ToolClientOutput sink, correlated to this call\n * by id. A (possibly JSON) string off the wire — render data the LLM never saw. Arrives WITH the\n * result on the live path (StreamingFinalFunctionResultContent.clientOutput) and is folded from\n * the persisted FunctionClientOutputContent sibling on replay. Prefer this over `args` in a\n * uiTool renderer; it is only present once the call has RESPONDED.\n */\n clientOutput?: any\n}\n\nexport interface ThoughtDetails {\n text: string;\n /** The Portuguese headlines the agents server derived from this thought (reasoning-trace localization), as\n * persisted on the message (`ChatResponseMessage.ReasoningHeadlines`). Live, they arrive as tool events instead. */\n headlines?: string[];\n}\n\nexport interface ToolEventDetails {\n eventName: string;\n eventData: string;\n subAgentId?: string;\n /** Id of the session that generated the event (server-stamped). Lets consumers\n * persist event-derived state to the right session even for stale/trailing events. */\n sessionId?: string;\n}\n\nexport interface TextDetails {\n hasCodeBlock?: boolean\n version: number;\n}\n\nexport interface ErrorDetails {\n errorMessage: string;\n /**\n * The server's stack trace, when the failure came from the SDK's `Server Error` event.\n *\n * Kept apart from `errorMessage` so a renderer can show the sentence and hide the trace behind a\n * disclosure: pasting the whole thing into the transcript is how the message that matters gets lost.\n */\n stackTrace?: string;\n}\n\nexport interface ExecutableCodeDetails {\n code: string;\n language: string;\n}\n\nexport interface CodeExecutionResultDetails {\n outcome: string;\n output?: string;\n}\n\ninterface CodeExecutionResult {\n outcome: string | null\n output: string | null\n}\n\ninterface ExecutableCode {\n code: string | null\n language: string | null\n}\n\nexport class ServerEvent {\n uniqueId!: string;\n mimeType!: string;\n created!: Date;\n author: 'tool' | 'main' | 'system';\n eventType!: EventType;\n allEventTypes: EventType[] = [];\n interactionId: string;\n artifactsDelta: string[] = [];\n llmArtifacts?: LlmArtifact[] = [];\n partial!: boolean;\n turn_complete?: boolean;\n isFinalResponse?: boolean;\n interrupted?: boolean;\n model_session_id!: string;\n functionDetails?: FunctionDetails\n executableCodeDetails?: ExecutableCodeDetails;\n codeExecutionResultDetails?: CodeExecutionResultDetails;\n thoughtDefails?: ThoughtDetails;\n rawDetails?: any;\n rendered?: boolean;\n serverError?: string;\n server_session_id?: string | null;\n asyncFinalResponse?: boolean;\n agentServerBaseUrl?: string;\n parts: InteractionPart[] = [];\n endMessageData?: EndMessageData;\n command?: string;\n session_information?: SessionInformation;\n subAgentId?: string;\n subAgentName?: string;\n visible: boolean = true;\n\n constructor(interactionId: string) {\n this.interactionId = interactionId;\n this.author = \"main\";\n }\n\n public static createErrorEvent(errorMessage: string, interactionId: string) {\n const serverErrorEvent = new ServerEvent(interactionId)\n serverErrorEvent.turn_complete = true;\n serverErrorEvent.partial = false;\n serverErrorEvent.parts = []\n const errorPart: InteractionPart = {\n eventType: EventType.ServerError,\n errorDetails: {\n errorMessage: errorMessage\n },\n id: '',\n author: 'main',\n created: new Date(),\n partial: false,\n isStillWriting: false,\n mustPush: false,\n textAppendable: false\n }\n serverErrorEvent.parts.push(errorPart);\n return serverErrorEvent;\n }\n\n static parseFlatPropertiesTypedEvent(event: LlmEvent) {\n const serverMessage: ServerEvent = new ServerEvent(event.interactionId);\n\n serverMessage.serverError = event.serverError;\n\n if (!event.interactionId) {\n\n throw new Error(\"Interaction ID is required\");\n }\n\n\n serverMessage.model_session_id = \"\";\n serverMessage.server_session_id = null;\n serverMessage.asyncFinalResponse = event.turnComplete;\n serverMessage.command = event.command?.toString();\n if (event.sessionInformation)\n serverMessage.session_information = event.sessionInformation as SessionInformation\n\n // The agent occasionally emits terminal events (notably the\n // `turnComplete: true` packet) without an `author` field. The\n // previous strict throw here got swallowed by the WS handler's\n // try/catch (WebSocketConnectionV2.handleEvent), which meant\n // `serverMessage.turn_complete` never propagated and the store\n // was stuck at `turnOpen: true` forever. Treat missing-author\n // events as `main` (same as the switch default below) so the\n // turn-complete signal reaches `setTurnOpen(false)`.\n if (!event.author || event.author == \"\") {\n console.warn('[ServerEvent] event with no author; defaulting to \"main\"', {\n interactionId: event.interactionId,\n turnComplete: event.turnComplete,\n });\n }\n\n switch (event?.author) {\n case ANALYTICS_AGENT_NAME:\n serverMessage.author = \"tool\";\n break;\n case \"system\":\n serverMessage.author = \"system\";\n break;\n default:\n serverMessage.author = \"main\";\n }\n serverMessage.mimeType = event.mimeType;\n serverMessage.created = new Date(event.timestamp);\n serverMessage.eventType = EventType.NotDefined;\n\n serverMessage.partial = event.partial?.toString()?.toLowerCase() === \"true\"\n\n serverMessage.turn_complete = event.turnComplete;\n serverMessage.visible = event.visible;\n serverMessage.isFinalResponse = event.turnComplete ?? false;\n\n serverMessage.artifactsDelta = []\n if (event.artifactsGenerated && event.artifactsGenerated.length > 0) {\n serverMessage.created = new Date(event.timestamp);\n serverMessage.llmArtifacts = event.artifactsGenerated;\n }\n\n serverMessage.subAgentId = event.subAgentId;\n serverMessage.subAgentName = event.subAgentName;\n\n return serverMessage;\n }\n\n static getPartType(part: KernelContent | StreamingKernelContent): PartType {\n if (part instanceof TextContent) {\n return \"TextContent\"\n }\n else if (part instanceof FunctionCallContent) {\n return \"FunctionCallContent\"\n }\n else if (part instanceof FunctionResultContent) {\n return \"FunctionResultContent\"\n }\n else if (part instanceof StreamingFunctionCallUpdateContent) {\n return \"StreamingFunctionCallUpdateContent\"\n }\n else if (part instanceof StreamingFinalFunctionCallContent) {\n return \"StreamingFinalFunctionCallContent\"\n }\n else if (part instanceof StreamingFinalFunctionResultContent) {\n return \"StreamingFinalFunctionResultContent\"\n }\n else if (part instanceof FunctionClientOutputContent) {\n return \"FunctionClientOutputContent\"\n }\n else if (part instanceof StreamingClientOutputContent) {\n return \"StreamingClientOutputContent\"\n }\n else if (part instanceof UserUiContent) {\n return \"UserUiContent\"\n }\n else if (part instanceof StreamingTextContent) {\n return \"StreamingTextContent\"\n }\n else if (part instanceof StreamingReasoningContent) {\n return \"StreamingReasoningContent\"\n }\n else if (part instanceof StreamingThoughtHighlightContent) {\n return \"StreamingThoughtHighlightContent\"\n }\n else if (part instanceof ToolEventContent) {\n return \"ToolEventContent\"\n }\n else if (part instanceof StreamingToolEventContent) {\n return \"StreamingToolEventContent\"\n }\n else {\n return \"Unknown\";\n }\n }\n\n static parseFromTypedEvent(event: LlmEvent) {\n const serverMessage = ServerEvent.parseFlatPropertiesTypedEvent(event);\n\n if (serverMessage.serverError) {\n serverMessage.parts.push(InteractionPartUtils.fromError(serverMessage.serverError));\n return serverMessage;\n }\n\n //For turncomplete msgs for instance\n if (!event.content && !event.streamingParts)\n return serverMessage;\n\n serverMessage.parts = [];\n\n const mergedParts: KernelContent[] | StreamingKernelContent[] = [...event.content?.items ?? [], ...event.streamingParts ?? []];\n\n serverMessage.eventType = GetEventTypeFromDotNetName(event.eventType?.type ?? '');\n\n let index = 0;\n for (const serverPart of mergedParts) {\n let part: InteractionPart = {\n id: \"\",\n author: serverMessage.author,\n eventType: serverMessage.eventType,\n created: new Date(),\n visible: serverMessage.visible,\n partial: serverMessage.partial,\n isStillWriting: false,\n mustPush: false,\n textAppendable: false\n }\n index++;\n\n const partType: PartType = ServerEvent.getPartType(serverPart);\n\n\n type functionType = FunctionCallContent & FunctionResultContent & StreamingFinalFunctionCallContent & StreamingFinalFunctionResultContent;\n\n if (partType == PartType.FunctionCallContent || partType == PartType.FunctionResultContent || partType == PartType.StreamingFinalFunctionCallContent || partType == PartType.StreamingFinalFunctionResultContent) {\n var serverCall = serverPart as functionType;\n\n if (serverCall.id == \"Server Error\") {\n // The SDK sends `arguments: { error, stackTrace }`. Read the two fields out instead of\n // stringifying the bag: `errorMessage` is what a renderer puts in front of a person, and\n // a JSON blob with an escaped multi-line trace in it is not a sentence anybody can read.\n // Falls back to the stringified bag if the shape is ever something else, so an unexpected\n // payload still surfaces rather than vanishing.\n const args = (serverCall.arguments ?? {}) as { error?: unknown; stackTrace?: unknown };\n const message = typeof args.error === 'string' && args.error.trim().length > 0\n ? args.error\n : JSON.stringify(serverCall.arguments);\n\n part.eventType = EventType.ServerError\n part.errorDetails = {\n errorMessage: message,\n stackTrace: typeof args.stackTrace === 'string' ? args.stackTrace : undefined,\n }\n part.functionDetails = undefined;\n }\n else {\n part.eventType = partType == PartType.FunctionCallContent || partType == PartType.StreamingFinalFunctionCallContent ? EventType.FunctionCall : EventType.FunctionResponse;\n let result: any = undefined;\n try {\n if (serverCall?.result) {\n if (typeof serverCall.result === \"object\") {\n result = serverCall.result;\n } else if (typeof serverCall.result === \"string\") {\n const parsed = JSON.parse(serverCall.result);\n result = (typeof parsed === \"object\" && parsed !== null)\n ? parsed\n : serverCall.result;\n } else {\n result = serverCall.result;\n }\n }\n }\n catch (error) {\n console.warn(\"Parse function error\", error)\n result = serverCall?.result;\n }\n part.thoughtDetails = {\n text: ''\n }\n // Client-render hints ride as ONE presentation object (no more `__`-args smuggling):\n // a live streaming part carries it top-level as `presentation` (camelCase); a\n // persisted/collapsed FunctionCall/Result carries it in metadata[\"aia:presentation\"]\n // (PascalCase). readPresentation reads either, case-insensitively.\n const presentation = readPresentation(serverCall);\n part.functionDetails = {\n id: serverCall?.id ?? '',\n args: serverCall?.arguments,\n // The SETTLED call arrives as FunctionCallContent on the persisted/replay path and as\n // StreamingFinalFunctionCallContent on the live one — both open the call, so both stamp\n // `start`. Keying on the persisted type alone left every LIVE call `Executing` with no\n // start, and a renderer gating its elapsed timer on `status === 'Executing' && start`\n // showed \"running\" with no stopwatch (AIA issue 1022). Same for `end` on the result.\n start: partType == PartType.FunctionCallContent || partType == PartType.StreamingFinalFunctionCallContent\n ? serverMessage.created : undefined,\n end: partType == PartType.FunctionResultContent || partType == PartType.StreamingFinalFunctionResultContent\n ? serverMessage.created : undefined,\n text: JSON.stringify(serverCall?.arguments) ?? '',\n name: (serverCall?.functionName ?? \"\"),\n status: part.eventType == EventType.FunctionCall ? 'Executing' : 'Done',\n response: result,\n isUi: presentation.isUi,\n argsDescription: presentation.argsDescription,\n // Client-only payload riding the RESULT event: live top-level `clientOutput`, or\n // metadata.clientOutput on the collapsed/persisted result. Calls leave it undefined.\n // The persisted-replay form also folds in via FunctionClientOutputContent.\n clientOutput: serverCall?.clientOutput\n ?? (serverCall?.metadata as Record<string, unknown> | undefined)?.clientOutput,\n askUserComponent: presentation.askUserComponent,\n // Runtime \"don't render\" override on a RESULT (CallContext.CancelUiRender).\n cancelUi: presentation.cancelUi,\n }\n // isAskUser mirrors isUi: derived from the component's presence, so classification\n // and the drawer key off a single flag (see classifyPart / AskUserSheet).\n part.functionDetails.isAskUser = !!part.functionDetails.askUserComponent;\n\n event.text = serverCall?.arguments;\n }\n }\n else if (partType == PartType.StreamingTextContent) {\n part.eventType = EventType.Text;\n part.text = (serverPart as StreamingTextContent)?.text?.replaceAll(\"\\\\n\", \"\\n\");;\n part.textLastChunk = (serverPart as StreamingTextContent).text;\n event.text = part.text;\n }\n else if (partType == PartType.TextContent) {\n part.eventType = EventType.Text;\n part.text = (serverPart as TextContent)?.text?.replaceAll(\"\\\\n\", \"\\n\");;\n part.textLastChunk = (serverPart as TextContent).text;\n event.text = part.text;\n }\n else if (partType == PartType.StreamingReasoningContent) {\n part.eventType = EventType.Thought;\n part.thoughtDetails = {\n text: (serverPart as StreamingReasoningContent)?.text?.replaceAll(\"\\\\n\", \"\\n\") ?? \"\"\n }\n part.text = (serverPart as StreamingReasoningContent)?.text?.replaceAll(\"\\\\n\", \"\\n\")\n part.textLastChunk = (serverPart as StreamingReasoningContent).text;\n event.text = part.text;\n }\n else if (partType == PartType.StreamingThoughtHighlightContent) {\n // A highlight of the reasoning: carried as the thought's headline, never as text of its own, so it\n // can neither merge into the reasoning text nor render as a part (MessageAgent folds it into the\n // thought run's trail).\n const headline = (serverPart as StreamingThoughtHighlightContent)?.headline ?? \"\";\n part.eventType = EventType.ThoughtHighlight;\n part.thoughtDetails = { text: \"\", headlines: headline ? [headline] : [] };\n }\n else if (partType == PartType.StreamingFunctionCallUpdateContent) {\n const partialFunctionCall = (serverPart as StreamingFunctionCallUpdateContent);\n part.eventType = EventType.PartialFunctionCall;\n part.text = partialFunctionCall.arguments;\n part.thoughtDetails = {\n text: ''\n }\n part.functionDetails = {\n id: partialFunctionCall.callId ?? '',\n text: part.text,\n status: 'Composing',\n name: partialFunctionCall?.name ?? 'Unknown',\n }\n event.text = part.text;\n }\n else if (partType == PartType.ToolEventContent || partType == PartType.StreamingToolEventContent) {\n part.eventType = EventType.ToolEvent;\n const toolEvent = (serverPart as ToolEventContent);\n part.toolDetails = {\n eventName: toolEvent.eventName ?? \"\",\n eventData: toolEvent.eventData ?? \"\",\n sessionId: toolEvent.sessionId ?? undefined,\n }\n }\n else if (partType == PartType.FunctionClientOutputContent) {\n // Persisted, client-only sibling of a function result (replay path). Carries the\n // tool's ToolClientOutput payload keyed by callId; it is folded into the matching\n // call part (functionDetails.clientOutput) by the session decoder and never renders\n // on its own. The live path delivers the same payload on the result event instead.\n const clientOutput = (serverPart as FunctionClientOutputContent);\n part.eventType = EventType.FunctionClientOutput;\n part.functionDetails = {\n id: clientOutput.id ?? '',\n name: '',\n status: 'Done',\n clientOutput: clientOutput.data,\n }\n }\n else if (partType == PartType.StreamingClientOutputContent) {\n // Non-terminal prefill pushed while an ask-user tool is PARKED (issue #60). Same call-id\n // fold as the persisted sibling above, but it must NOT close the call — no status here, so\n // interactionService folds clientOutput onto the parked call and leaves it Executing.\n const clientOutput = (serverPart as StreamingClientOutputContent);\n part.eventType = EventType.FunctionClientOutput;\n part.functionDetails = {\n id: clientOutput.id ?? '',\n name: '',\n // The parked call stays Executing; interactionService folds only clientOutput onto it and\n // leaves the existing status untouched, so this is just to satisfy the type.\n status: 'Executing',\n clientOutput: clientOutput.clientOutput,\n // The park signal itself (the reason this event fires even with no prefill).\n parked: readPresentation(clientOutput).parked,\n }\n }\n else if (partType == PartType.UserUiContent) {\n // Client-only UI representation for this user turn (replay path). Routes through the\n // uiTool dispatcher via functionDetails (name → registry key, args → props), but is\n // authored by the user: rendered on the user side (MessageUser) and excluded from the\n // agent side (MessageAgent). The live turn injects this same shape client-side; this\n // branch re-hydrates it on session reload.\n const userUi = (serverPart as UserUiContent);\n part.eventType = EventType.UserAnswer;\n part.author = 'user';\n part.functionDetails = {\n id: '',\n name: userUi.name ?? '',\n args: userUi.args,\n status: 'Done',\n isUi: true,\n }\n }\n else {\n part.eventType = EventType.NotDefined;\n console.warn(`Got a unmapped event_type:${serverMessage.eventType}, data:`, partType, serverPart)\n continue;\n }\n\n serverMessage.parts.push(part);\n }\n\n return serverMessage;\n }\n\n static createFromThought(interactionId: string, thinkingText: string): ServerEvent {\n const thinkingEvent: ServerEvent = {\n author: \"main\",\n visible: true,\n eventType: EventType.Thought,\n uniqueId: new Date().getTime().toString(),\n interactionId: interactionId,\n allEventTypes: [EventType.Thought],\n artifactsDelta: [''],\n model_session_id: \"\",\n created: new Date(),\n turn_complete: false,\n partial: true,\n asyncFinalResponse: false,\n mimeType: \"text/plain\",\n parts: [\n {\n thoughtDetails: {\n text: thinkingText,\n },\n // ThoughtPart renders `part.text` (via getPartTextContent), so a\n // thought built here with only `thoughtDetails` rendered as an\n // EMPTY reasoning block. The live decoder sets both for a\n // StreamingReasoningContent — match it, or this factory produces\n // a part the UI cannot show. Only the demo's fake gateway builds\n // thoughts this way, which is why it went unnoticed.\n text: thinkingText,\n id: getRandomUUID(),\n created: new Date(),\n eventType: EventType.Thought,\n author: \"main\",\n isStillWriting: false,\n textAppendable: true,\n partial: true,\n mustPush: true\n }\n ]\n }\n return thinkingEvent\n }\n\n static createFromFunctionName(functionName: string, interactionId: string, callData?: any): ServerEvent {\n const callEvent = ServerEvent.createFromText(\"\",interactionId);\n callEvent.parts[0].text = undefined;\n callEvent.parts[0].thoughtDetails = undefined;\n callEvent.parts[0].textAppendable = false;\n callEvent.parts[0].mustPush = true;\n \n callEvent.parts[0].functionDetails = {\n name: functionName,\n id:'callId',\n status: 'Executing',\n start: new Date(),\n end:undefined,\n text:'dfsdfdf',\n args:callData\n }\n return callEvent;\n }\n\n static createFromText(message: string, interactionId: string, thinkingData?: string): ServerEvent {\n\n const textEvent: ServerEvent = {\n author: \"main\",\n visible: true,\n eventType: EventType.Text,\n uniqueId: new Date().getTime().toString(),\n interactionId: interactionId,\n allEventTypes: [EventType.Text],\n artifactsDelta: [''],\n model_session_id: \"\",\n created: new Date(),\n turn_complete: false,\n partial: true,\n asyncFinalResponse: false,\n mimeType: \"text/plain\",\n parts: [\n {\n // Optional reasoning trace shown next to the message. Parts\n // with `eventType: Text` AND a populated `thoughtDetails`\n // render the text in the body and the trace in the\n // thinking strip.\n thoughtDetails: thinkingData ? {\n text: thinkingData\n } : undefined,\n id: getRandomUUID(),\n created: new Date(),\n // Part eventType MUST match the outer event's eventType.\n // Was previously `Thought` here, which made the merger\n // classify a streamed Text part as a Thought (rendered\n // in the trace strip instead of the message body) —\n // the chat would show the message during streaming and\n // then \"disappear\" once the part was reclassified.\n eventType: EventType.Text,\n author: \"main\",\n isStillWriting: false,\n textAppendable: true,\n partial: true,\n mustPush: true,\n text: message\n }\n ]\n }\n return textEvent;\n }\n\n} ","import './init'; // MUST be first - loads reflect-metadata\n\nimport { TypedJSON, type IndexedObject, JsonObjectMetadata } from 'typedjson';\nimport {\n LlmEvent,\n KernelContent,\n TextContent,\n ImageContent,\n FunctionCallContent,\n FunctionResultContent,\n ChatMessageContent,\n StreamingKernelContent,\n StreamingTextContent,\n StreamingFunctionCallUpdateContent,\n StreamingResponse,\n Payload,\n InstructionSummary,\n StreamingReasoningContent,\n StreamingThoughtHighlightContent,\n ToolEventContent,\n StreamingToolEventContent,\n StreamingFinalFunctionCallContent,\n StreamingFinalFunctionResultContent,\n StreamingClientOutputContent,\n FunctionClientOutputContent,\n UserUiContent\n} from './models';\n\n// All known content types for polymorphic deserialization\nconst KNOWN_CONTENT_TYPES = [\n // KernelContent derived types\n TextContent,\n ImageContent,\n FunctionCallContent,\n ToolEventContent,\n FunctionResultContent,\n FunctionClientOutputContent,\n UserUiContent,\n ChatMessageContent,\n // StreamingKernelContent derived types\n StreamingTextContent,\n StreamingFunctionCallUpdateContent,\n StreamingReasoningContent,\n StreamingThoughtHighlightContent,\n StreamingToolEventContent,\n StreamingFinalFunctionCallContent,\n StreamingFinalFunctionResultContent,\n StreamingClientOutputContent,\n InstructionSummary\n];\n\n/**\n * Helper function to get constructor name (replaces typedjson internal nameof)\n */\nfunction getConstructorName(constructor: Function): string {\n return constructor.name;\n}\n\n/**\n * Custom type emitter for .NET compatibility\n * Emits \"$type\" property for polymorphic types to match .NET serialization\n */\nexport function dotNetTypeEmitter(\n targetObject: IndexedObject,\n sourceObject: IndexedObject,\n expectedSourceType: Function,\n sourceTypeMetadata?: JsonObjectMetadata,\n) {\n // Add \"$type\" property for polymorphic deserialization (matches .NET's JsonPolymorphic)\n if (sourceObject.constructor !== expectedSourceType) {\n targetObject[\"$type\"] = sourceTypeMetadata?.name ?? getConstructorName(sourceObject.constructor);\n }\n}\n\nexport function dotnetTypeResolver(\n sourceObject: IndexedObject,\n knownTypes: Map<string, Function>,\n): Function | undefined {\n if (sourceObject[\"$type\"] != null) {\n return knownTypes.get(sourceObject[\"$type\"]);\n }\n}\n\n/**\n * Creates a configured TypedJSON serializer for Event objects\n * Includes all known types for polymorphic serialization\n */\nexport function createEventSerializer(): TypedJSON<LlmEvent> {\n const serializer = new TypedJSON(LlmEvent);\n\n serializer.config({\n knownTypes: KNOWN_CONTENT_TYPES,\n typeHintEmitter: dotNetTypeEmitter,\n typeResolver: dotnetTypeResolver\n });\n\n return serializer;\n}\n\nexport function createPayloadSerializer(): TypedJSON<Payload> {\n const serializer = new TypedJSON<Payload>(Payload);\n\n serializer.config({\n knownTypes: KNOWN_CONTENT_TYPES,\n typeHintEmitter: dotNetTypeEmitter,\n typeResolver: dotnetTypeResolver\n });\n\n return serializer;\n}\n\nexport function createStreamingResponseSerializer(): TypedJSON<StreamingResponse> {\n const serializer = new TypedJSON<StreamingResponse>(StreamingResponse);\n\n serializer.config({\n knownTypes: KNOWN_CONTENT_TYPES,\n typeHintEmitter: dotNetTypeEmitter,\n typeResolver: dotnetTypeResolver\n });\n\n return serializer;\n}\n\n/**\n * Sanitizes JSON string by fixing control characters that may come from .NET serialization\n * This handles cases where newlines, tabs, and other control characters are not properly escaped\n */\nexport function sanitizeJsonString(jsonStr: string): string {\n try {\n // First, try to parse as-is (in case it's already valid)\n JSON.parse(jsonStr);\n return jsonStr;\n } catch (e) {\n // If parsing fails, we need to escape unescaped control characters within string values\n // We'll do this by processing character by character, tracking when we're inside a string\n\n let result = '';\n let inString = false;\n\n for (let i = 0; i < jsonStr.length; i++) {\n const char = jsonStr[i];\n const code = char.charCodeAt(0);\n\n // Handle backslash - check if it's starting an escape sequence\n if (char === '\\\\' && inString && i + 1 < jsonStr.length) {\n const nextChar = jsonStr[i + 1];\n // Valid escape sequences in JSON: \\\" \\\\ \\/ \\b \\f \\n \\r \\t \\uXXXX\n if (nextChar === '\"' || nextChar === '\\\\' || nextChar === '/' ||\n nextChar === 'b' || nextChar === 'f' || nextChar === 'n' ||\n nextChar === 'r' || nextChar === 't') {\n // Valid single-char escape - copy both characters\n result += char + nextChar;\n i++; // Skip the next character\n continue;\n } else if (nextChar === 'u' && i + 5 < jsonStr.length) {\n // Unicode escape sequence \\uXXXX - copy all 6 characters\n result += jsonStr.substring(i, i + 6);\n i += 5; // Skip the next 5 characters (u and 4 hex digits)\n continue;\n } else {\n // Invalid escape sequence - just add the backslash\n result += char;\n continue;\n }\n }\n\n // Track string boundaries (but not if it's escaped)\n if (char === '\"') {\n // Check if this quote is escaped by looking back\n let numBackslashes = 0;\n for (let j = i - 1; j >= 0 && jsonStr[j] === '\\\\'; j--) {\n numBackslashes++;\n }\n // If there's an even number of backslashes (including 0), the quote is not escaped\n if (numBackslashes % 2 === 0) {\n inString = !inString;\n }\n result += char;\n continue;\n }\n\n // If we're inside a string and encounter an unescaped control character, escape it\n if (inString && code < 32) {\n switch (char) {\n case '\\n':\n result += '\\\\n';\n break;\n case '\\r':\n result += '\\\\r';\n break;\n case '\\t':\n result += '\\\\t';\n break;\n case '\\f':\n result += '\\\\f';\n break;\n case '\\b':\n result += '\\\\b';\n break;\n default:\n // For other control characters, use unicode escape\n const hex = code.toString(16).padStart(4, '0');\n result += `\\\\u${hex}`;\n break;\n }\n } else {\n result += char;\n }\n }\n\n return result;\n }\n}\n\n/**\n * Deserializes a JSON string into a Payload, with automatic sanitization of control characters\n */\nexport function deserializePayload(json: string): StreamingResponse | undefined {\n const sanitized = sanitizeJsonString(json);\n const serializer = createStreamingResponseSerializer();\n return serializer.parse(sanitized);\n}\n\n/**\n * Deserializes a JSON string into an Event object, with automatic sanitization of control characters\n */\nexport function deserializeEvent(json: string): LlmEvent | undefined {\n const sanitized = sanitizeJsonString(json);\n const serializer = createEventSerializer();\n return serializer.parse(sanitized);\n}\n\n/**\n * Serializes an Event object into a JSON string\n */\nexport function serializeEvent(event: LlmEvent): string {\n const serializer = createEventSerializer();\n return serializer.stringify(event);\n}\n\n/**\n * Creates a configured TypedJSON serializer for KernelContent objects\n */\nexport function createKernelContentSerializer(): TypedJSON<KernelContent> {\n const serializer = new TypedJSON(KernelContent);\n\n serializer.config({\n knownTypes: KNOWN_CONTENT_TYPES,\n typeHintEmitter: dotNetTypeEmitter,\n typeResolver: dotnetTypeResolver\n });\n\n return serializer;\n}\n\n/**\n * Creates a configured TypedJSON serializer for StreamingKernelContent objects\n */\nexport function createStreamingKernelContentSerializer(): TypedJSON<StreamingKernelContent> {\n const serializer = new TypedJSON(StreamingKernelContent);\n\n serializer.config({\n knownTypes: [\n StreamingTextContent,\n StreamingFunctionCallUpdateContent\n ],\n typeHintEmitter: dotNetTypeEmitter\n });\n\n return serializer;\n}\n"],"names":["ChatEventType","RunMode","ChatAction","EventType","GetEventTypeFromDotNetName","__name","name","EventTypeDescriptions","ResponseType","AuthorType","ArtifactType","AgentType","AgentMode","AgentConfig","SkillLevel","ModelType","ModelConfig","AllInclusiveIcon","PsychologyIcon","FlashOnIcon","RocketLaunchIcon","SortByAlphaOutlined","GeneratingTokensOutlined","getModelVendor","modelId","id","getConnectionStateColor","connectionState","theme","_InteractionPartUtils","value","regex","match","json","charCollapsed","objectProps","textReponseLines","prop","startChart","obj","startChar","part","r","_a","i","o","v","errorMsg","text","author","getRandomUUID","args","addTimer","isTimerRunning","status","startingPoint","stopPoint","partData","parts","textParts","onlyPart","unique_event_types","od","pd","item","keys","k","InteractionPartUtils","PartType","AuthorRole","__publicField","__decorateClass","jsonMember","jsonObject","EventTypeInformation","LlmArtifact","KernelContent","AnyT","StreamingKernelContent","TextContent","StreamingToolEventContent","ToolEventContent","ImageContent","FunctionCallContent","ToolCallPresentation","PresentationMetadataKey","StreamingFinalFunctionCallContent","FunctionResultContent","StreamingFinalFunctionResultContent","FunctionClientOutputContent","StreamingClientOutputContent","UserUiContent","ChatMessageContent","jsonArrayMember","StreamingFunctionCallUpdateContent","StreamingTextContent","StreamingReasoningContent","StreamingThoughtHighlightContent","InstructionSummary","SessionInformation","LlmEvent","PartialLlmEvent","StreamingResponse","Payload","readPresentation","serverCall","raw","pick","camel","pascal","_ServerEvent","interactionId","errorMessage","serverErrorEvent","errorPart","event","serverMessage","ANALYTICS_AGENT_NAME","_c","_b","mergedParts","serverPart","partType","message","result","parsed","error","presentation","_d","_e","_f","_g","headline","partialFunctionCall","toolEvent","clientOutput","userUi","thinkingText","functionName","callData","callEvent","thinkingData","ServerEvent","KNOWN_CONTENT_TYPES","getConstructorName","constructor","dotNetTypeEmitter","targetObject","sourceObject","expectedSourceType","sourceTypeMetadata","dotnetTypeResolver","knownTypes","createEventSerializer","serializer","TypedJSON","createStreamingResponseSerializer","sanitizeJsonString","jsonStr","inString","char","code","nextChar","numBackslashes","j","hex","deserializePayload","sanitized","deserializeEvent","serializeEvent"],"mappings":";;;;;;;;;;;;AAWO,MAAMA,KAAgB;AAAA,EAC3B,WAAW;AAAA,EACX,cAAc;AAAA,EACd,aAAa;AACf,GAGaC,KAAU;AAAA,EACrB,aAAa;AAAA,EACb,YAAY;AACd,GAGaC,KAAa;AAAA,EACxB,aAAa;AAAA,EACb,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AAAA,EACP,MAAM;AAAA,EACN,iBAAiB;AACnB,GAIaC,IAAY;AAAA,EACvB,cAAc;AAAA,EACd,qBAAqB;AAAA,EACrB,kBAAkB;AAAA;AAAA;AAAA;AAAA,EAIlB,sBAAsB;AAAA;AAAA;AAAA;AAAA,EAItB,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,SAAS;AAAA;AAAA,EAET,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,qB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AAU;AACV;AAAA,UACJ,KAAK;AACD,YAAAA,KAAU;AACV;AAAA,UACJ,KAAK;AACD,YAAAA,KAAU;AACV;AAAA,UACJ;AAEI,kBAAMyC,IAAMJ,EAAK,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG;AAC7C,YAAArC,KAAU,MAAMyC,CAAG;AACnB;AAAA,QAAA;AAAA;AAGR,QAAAzC,KAAUoC;AAAA,IAElB;AAEA,WAAOpC;AAAA,EACX;AACJ;AArFgBvH,EAAAwJ,IAAA;AA0FT,SAASS,GAAmBrI,GAA6C;AAC5E,QAAMsI,IAAYV,GAAmB5H,CAAI;AAEzC,SADmB2H,GAAA,EACD,MAAMW,CAAS;AACrC;AAJgBlK,EAAAiK,IAAA;AAST,SAASE,GAAiBvI,GAAoC;AACjE,QAAMsI,IAAYV,GAAmB5H,CAAI;AAEzC,SADmBwH,GAAA,EACD,MAAMc,CAAS;AACrC;AAJgBlK,EAAAmK,IAAA;AAST,SAASC,GAAetD,GAAyB;AAEpD,SADmBsC,GAAA,EACD,UAAUtC,CAAK;AACrC;AAHgB9G,EAAAoK,IAAA;"}
|
package/dist/services.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as t, a as s, E as r, H as o, I as c, L as n, W as i } from "./httpArtifactService-
|
|
1
|
+
import { A as t, a as s, E as r, H as o, I as c, L as n, W as i } from "./httpArtifactService-GdGsaFKS.js";
|
|
2
2
|
import { A as v } from "./artifactHtmlHandler-CMQJf1cX.js";
|
|
3
|
-
import { H, d as f, r as p } from "./httpSessionService-
|
|
3
|
+
import { H, d as f, r as p } from "./httpSessionService-CUujaUo6.js";
|
|
4
4
|
export {
|
|
5
5
|
t as AgentGatewayService,
|
|
6
6
|
s as AgentGatewayWSAsync,
|
|
@@ -25,6 +25,8 @@ export interface AiChatContextState {
|
|
|
25
25
|
showStatistics: boolean;
|
|
26
26
|
showStickyHeader: boolean;
|
|
27
27
|
showToolCalls: boolean;
|
|
28
|
+
summarizedReasoning: boolean;
|
|
29
|
+
showReasoningTrace: boolean;
|
|
28
30
|
showModelSelector: boolean;
|
|
29
31
|
showSessionInfo: boolean;
|
|
30
32
|
showConnectionState: boolean;
|
|
@@ -152,6 +152,17 @@ export interface AiChatBaseProps extends AiChatStyleProps {
|
|
|
152
152
|
showPromptHistory?: boolean;
|
|
153
153
|
showStatistics?: boolean;
|
|
154
154
|
showToolCalls?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Summarized reasoning (reasoning-trace localization): the thought block shows only the Portuguese
|
|
157
|
+
* headlines the agents server derives from the model's reasoning, never the raw trace. The raw trace comes
|
|
158
|
+
* back under `showToolCalls` (the host's diagnostic toggle). Default off: the trace renders as before.
|
|
159
|
+
*/
|
|
160
|
+
summarizedReasoning?: boolean;
|
|
161
|
+
/**
|
|
162
|
+
* In summarized reasoning, also show the RAW reasoning trace after the highlights (the host's diagnostic
|
|
163
|
+
* toggle). Independent of `showToolCalls`, which governs tool calls and is on by default in obtapp.
|
|
164
|
+
*/
|
|
165
|
+
showReasoningTrace?: boolean;
|
|
155
166
|
showStickyHeader?: boolean;
|
|
156
167
|
showModelSelector?: boolean;
|
|
157
168
|
showSessionInfo?: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -6,6 +6,20 @@ export interface ThoughtRunProps {
|
|
|
6
6
|
/** Whether this run is the thought the turn is CURRENTLY writing (open + labelled "Pensando…"). */
|
|
7
7
|
isLive: boolean;
|
|
8
8
|
friendlyMode?: boolean;
|
|
9
|
+
/** The headlines the server derived from this thought's reasoning (reasoning-trace localization), in order.
|
|
10
|
+
* The last one is the live label in place of "Pensando..."; the whole trail stays under the header once the
|
|
11
|
+
* thought settles, because a thought on a fast model lives half a second and a live-only label would never be
|
|
12
|
+
* read. */
|
|
13
|
+
headlines?: string[];
|
|
14
|
+
/** Summarized reasoning (the host's `summarizedReasoning`): the collapsible block holds the headline trail, and
|
|
15
|
+
* in diagnostic mode (`showTrace`) the raw trace after it. Open while live, collapsed once settled. A settled
|
|
16
|
+
* thought with no headline and no diagnostics renders nothing at all. */
|
|
17
|
+
summarized?: boolean;
|
|
18
|
+
/** Diagnostics (`showReasoningTrace`): in summarized mode, shows the raw trace after the highlights. */
|
|
19
|
+
showTrace?: boolean;
|
|
20
|
+
/** Summarized mode: whether this is the message's LAST thought. Only that one stays open; an earlier one folds
|
|
21
|
+
* the moment a new thought begins, its highlights one click away. */
|
|
22
|
+
isLastThought?: boolean;
|
|
9
23
|
/** One `<MessagePart>` per part — each still its own memoized component. */
|
|
10
24
|
children: React.ReactNode;
|
|
11
25
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InteractionPart } from '../../../models/InteractionPart';
|
|
2
|
+
/**
|
|
3
|
+
* The tool event an agents server before the StreamingThoughtHighlightContent part emitted for each highlight. Still
|
|
4
|
+
* read so a session recorded by such a server, or a server not yet upgraded, keeps its trail.
|
|
5
|
+
*/
|
|
6
|
+
export declare const REASONING_HEADLINE_EVENT = "reasoningHeadline";
|
|
7
|
+
/**
|
|
8
|
+
* The reasoning headlines of each thought, in order of the thoughts. A thought is the run of Thought, ThoughtHighlight
|
|
9
|
+
* (and legacy ToolEvent) parts between two parts of any other kind (text, a function call…); its trail is the
|
|
10
|
+
* highlights inside it, each once. Pure, so it is testable without a DOM.
|
|
11
|
+
*/
|
|
12
|
+
export declare function reasoningHeadlineTrails(parts: InteractionPart[]): string[][];
|
|
13
|
+
export declare function headlineText(raw: string): string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -62,6 +62,9 @@ export interface FunctionDetails {
|
|
|
62
62
|
}
|
|
63
63
|
export interface ThoughtDetails {
|
|
64
64
|
text: string;
|
|
65
|
+
/** The Portuguese headlines the agents server derived from this thought (reasoning-trace localization), as
|
|
66
|
+
* persisted on the message (`ChatResponseMessage.ReasoningHeadlines`). Live, they arrive as tool events instead. */
|
|
67
|
+
headlines?: string[];
|
|
65
68
|
}
|
|
66
69
|
export interface ToolEventDetails {
|
|
67
70
|
eventName: string;
|
|
@@ -20,7 +20,7 @@ export declare const ChatAction: {
|
|
|
20
20
|
readonly Ping: "Ping";
|
|
21
21
|
readonly AnswerHumanTool: "AnswerHumanTool";
|
|
22
22
|
};
|
|
23
|
-
export type EventType = 'partial_function_call' | 'tool_event' | 'function_call' | 'not_defined' | 'function_response' | 'function_client_output' | 'user_answer' | 'video' | 'thought' | 'inline_data' | 'file_data' | 'code_execution_result' | 'executable_code' | 'text' | 'other' | 'waiting' | 'suspended' | 'server_error';
|
|
23
|
+
export type EventType = 'partial_function_call' | 'tool_event' | 'function_call' | 'not_defined' | 'function_response' | 'function_client_output' | 'user_answer' | 'video' | 'thought' | 'thought_highlight' | 'inline_data' | 'file_data' | 'code_execution_result' | 'executable_code' | 'text' | 'other' | 'waiting' | 'suspended' | 'server_error';
|
|
24
24
|
export declare const EventType: {
|
|
25
25
|
readonly FunctionCall: "function_call";
|
|
26
26
|
readonly PartialFunctionCall: "partial_function_call";
|
|
@@ -29,6 +29,7 @@ export declare const EventType: {
|
|
|
29
29
|
readonly UserAnswer: "user_answer";
|
|
30
30
|
readonly Video: "video";
|
|
31
31
|
readonly Thought: "thought";
|
|
32
|
+
readonly ThoughtHighlight: "thought_highlight";
|
|
32
33
|
readonly InlineData: "inline_data";
|
|
33
34
|
readonly FileData: "file_data";
|
|
34
35
|
readonly CodeExecutionResult: "code_execution_result";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Artifact } from '../../models/Artifact';
|
|
2
|
-
export type PartType = 'ToolEventContent' | 'StreamingToolEventContent' | 'TextContent' | 'StreamingFinalFunctionCallContent' | 'StreamingFinalFunctionResultContent' | 'StreamingClientOutputContent' | 'StreamingReasoningContent' | 'ImageContent' | 'FunctionCallContent' | 'FunctionResultContent' | 'FunctionClientOutputContent' | 'UserUiContent' | 'ChatMessageContent' | 'StreamingTextContent' | 'StreamingFunctionCallUpdateContent' | 'Unknown';
|
|
2
|
+
export type PartType = 'ToolEventContent' | 'StreamingToolEventContent' | 'TextContent' | 'StreamingFinalFunctionCallContent' | 'StreamingFinalFunctionResultContent' | 'StreamingClientOutputContent' | 'StreamingReasoningContent' | 'StreamingThoughtHighlightContent' | 'ImageContent' | 'FunctionCallContent' | 'FunctionResultContent' | 'FunctionClientOutputContent' | 'UserUiContent' | 'ChatMessageContent' | 'StreamingTextContent' | 'StreamingFunctionCallUpdateContent' | 'Unknown';
|
|
3
3
|
export declare const PartType: {
|
|
4
4
|
readonly TextContent: "TextContent";
|
|
5
5
|
readonly ToolEventContent: "ToolEventContent";
|
|
6
6
|
readonly StreamingToolEventContent: "StreamingToolEventContent";
|
|
7
7
|
readonly StreamingReasoningContent: "StreamingReasoningContent";
|
|
8
|
+
readonly StreamingThoughtHighlightContent: "StreamingThoughtHighlightContent";
|
|
8
9
|
readonly ImageContent: "ImageContent";
|
|
9
10
|
readonly FunctionCallContent: "FunctionCallContent";
|
|
10
11
|
readonly FunctionResultContent: "FunctionResultContent";
|
|
@@ -136,6 +137,14 @@ export declare class StreamingReasoningContent extends StreamingKernelContent {
|
|
|
136
137
|
text?: string;
|
|
137
138
|
encoding?: string;
|
|
138
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* A highlight of the model's reasoning — one short line saying what a reasoning paragraph does — produced by the
|
|
142
|
+
* agents server while the reasoning streams. It belongs to the reasoning, so it is a streaming part of its own (the
|
|
143
|
+
* SDK's StreamingThoughtHighlightContent), never a tool event.
|
|
144
|
+
*/
|
|
145
|
+
export declare class StreamingThoughtHighlightContent extends StreamingKernelContent {
|
|
146
|
+
headline?: string;
|
|
147
|
+
}
|
|
139
148
|
export declare class InstructionSummary {
|
|
140
149
|
instructionCategory: string;
|
|
141
150
|
description: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var L = Object.defineProperty;
|
|
2
2
|
var d = (e, t) => L(e, "name", { value: t, configurable: !0 });
|
|
3
3
|
import { useMemo as h, useState as v, useCallback as g, useEffect as C } from "react";
|
|
4
|
-
import { H } from "./httpSessionService-
|
|
4
|
+
import { H } from "./httpSessionService-CUujaUo6.js";
|
|
5
5
|
const w = 6e4, y = 60 * w, l = 24 * y;
|
|
6
6
|
function k(e) {
|
|
7
7
|
if (!e) return;
|
|
@@ -104,4 +104,4 @@ d(Y, "useChatSessions");
|
|
|
104
104
|
export {
|
|
105
105
|
Y as u
|
|
106
106
|
};
|
|
107
|
-
//# sourceMappingURL=useChatSessions-
|
|
107
|
+
//# sourceMappingURL=useChatSessions-BXYvvd4S.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChatSessions-BzgPYfyj.js","sources":["../src/hooks/useChatSessions.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState } from 'react';\nimport type { ChatSession } from '@lib/models/ChatSession';\nimport type { ISessionService } from '@lib/services/servers/sessionService/ISessionService';\nimport { HttpSessionService } from '../services';\n\n/**\n * One row in a session-picker UI. `raw` is the original ChatSession the\n * server returned; everything else is a derived label the hook computed\n * (and the host's `decorate` callback may have overridden).\n */\nexport interface ChatSessionListItem {\n id: string;\n title: string;\n snippet?: string;\n /** Compact relative-time label (\"now\", \"5m\", \"2h\", \"Mar 14\"). */\n timeLabel?: string;\n /** Optional per-row tag — host-supplied via the `decorate` callback. */\n kind?: string;\n updatedAt?: Date;\n raw: ChatSession;\n}\n\n/**\n * Sessions bucketed by recency. The order of `label` reflects display\n * order top-down (\"Today\" first, \"Older\" last).\n */\nexport interface ChatSessionGroup {\n label: string;\n items: ChatSessionListItem[];\n}\n\nexport interface UseChatSessionsOptions {\n sessionService?: ISessionService;\n /**\n * If provided, the live (current) session is merged into the list —\n * replacing an existing entry by id, or prepended if not yet on the\n * server. Lets a \"New chat\" row appear instantly without waiting for\n * the server roundtrip.\n */\n liveSession?: ChatSession | null;\n\n accessToken: string,\n serverBaseUrl: string,\n /**\n * Per-row override hook. Whatever fields you return are merged on top\n * of the hook's computed item — typical use is adding a `kind` tag for\n * application-specific session types (`'chat' | 'composer' | ...`) the\n * library doesn't know about.\n */\n decorate?: (session: ChatSession) => Partial<ChatSessionListItem>;\n}\n\nexport interface UseChatSessionsResult {\n /** Flat list (live session merged in, server order preserved). */\n sessions: ChatSession[];\n /** Same data bucketed by recency. */\n groups: ChatSessionGroup[];\n isLoading: boolean;\n error: Error | null;\n refresh: () => Promise<void>;\n /** Optimistic rename — patches local state immediately, rolls back on failure. */\n rename: (id: string, title: string) => Promise<void>;\n /** Optimistic remove — drops from local state immediately, rolls back on failure. */\n remove: (id: string) => Promise<void>;\n}\n\nconst MINUTE_MS = 60_000;\nconst HOUR_MS = 60 * MINUTE_MS;\nconst DAY_MS = 24 * HOUR_MS;\n\nfunction toDate(value: Date | string | undefined | null): Date | undefined {\n if (!value) return undefined;\n if (value instanceof Date) return value;\n const d = new Date(value);\n return Number.isNaN(d.getTime()) ? undefined : d;\n}\n\nfunction formatTimeLabel(date: Date | undefined): string {\n if (!date) return '';\n const diff = Date.now() - date.getTime();\n if (diff < MINUTE_MS) return 'now';\n if (diff < HOUR_MS) return `${Math.floor(diff / MINUTE_MS)}m`;\n if (diff < DAY_MS) return `${Math.floor(diff / HOUR_MS)}h`;\n if (diff < 7 * DAY_MS) return `${Math.floor(diff / DAY_MS)}d`;\n return date.toLocaleDateString(undefined, { month: 'short', day: 'numeric' });\n}\n\nfunction startOfToday(): Date {\n const d = new Date();\n d.setHours(0, 0, 0, 0);\n return d;\n}\n\nfunction groupByTime(items: ChatSessionListItem[]): ChatSessionGroup[] {\n const today = startOfToday();\n const yesterday = new Date(today.getTime() - DAY_MS);\n const weekAgo = new Date(today.getTime() - 7 * DAY_MS);\n const monthAgo = new Date(today.getTime() - 30 * DAY_MS);\n\n // Insertion-ordered map preserves the bucket display order.\n const buckets: Array<[string, ChatSessionListItem[]]> = [\n ['Today', []],\n ['Yesterday', []],\n ['This Week', []],\n ['This Month', []],\n ['Older', []],\n ];\n\n for (const item of items) {\n const u = item.updatedAt;\n if (!u) { buckets[4][1].push(item); continue; }\n if (u >= today) buckets[0][1].push(item);\n else if (u >= yesterday) buckets[1][1].push(item);\n else if (u >= weekAgo) buckets[2][1].push(item);\n else if (u >= monthAgo) buckets[3][1].push(item);\n else buckets[4][1].push(item);\n }\n\n return buckets\n .filter(([, list]) => list.length > 0)\n .map(([label, list]) => ({ label, items: list }));\n}\n\nfunction buildItem(\n session: ChatSession,\n decorate?: (s: ChatSession) => Partial<ChatSessionListItem>,\n): ChatSessionListItem {\n const updatedAt = toDate(session.updatedAt) ?? toDate(session.created);\n const base: ChatSessionListItem = {\n id: session.id ?? session.browserScopeId ?? '',\n title: session.overview || session.userDescription || '(untitled chat)',\n snippet: session.lastQuestion ?? undefined,\n timeLabel: formatTimeLabel(updatedAt),\n kind: session.agentType as string | undefined,\n updatedAt,\n raw: session,\n };\n return { ...base, ...(decorate?.(session) ?? {}) };\n}\n\n/**\n * Fetch + organise the user's chat sessions for a picker UI. Backend-agnostic\n * — the host injects an `ISessionService` so the same hook drives an HTTP\n * client, an in-memory fake, or whatever else.\n *\n * Replaces the duplicated `useEffect(async () => sessionService.getAllSessions())`\n * + grouping logic that lived in DataExplorerViewV2 and MobileSessionsList,\n * and consolidates the optimistic rename/delete pattern.\n */\nexport function useChatSessions(opts: UseChatSessionsOptions): UseChatSessionsResult {\n\n const defaultSessionService = useMemo(() => {\n return new HttpSessionService(opts.serverBaseUrl, opts.accessToken);\n }, [opts.accessToken, opts.serverBaseUrl]);\n\n const { sessionService, liveSession, decorate } = {\n sessionService: defaultSessionService,\n liveSession: opts.liveSession,\n decorate: opts.decorate\n };\n const [sessions, setSessions] = useState<ChatSession[]>([]);\n const [isLoading, setIsLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n\n const refresh = useCallback(async () => {\n setIsLoading(true);\n setError(null);\n try {\n const list = await sessionService.getAllSessions();\n setSessions(list);\n } catch (err) {\n setError(err instanceof Error ? err : new Error(String(err)));\n } finally {\n setIsLoading(false);\n }\n }, [sessionService]);\n\n useEffect(() => { void refresh(); }, [refresh]);\n\n const merged = useMemo(() => {\n if (!liveSession?.id) return sessions;\n const idx = sessions.findIndex(s => s.id === liveSession.id);\n if (idx === -1) return [liveSession, ...sessions];\n const copy = sessions.slice();\n copy[idx] = liveSession;\n return copy;\n }, [sessions, liveSession]);\n\n const items = useMemo(\n () => merged.map(s => buildItem(s, decorate)),\n [merged, decorate],\n );\n\n const groups = useMemo(() => groupByTime(items), [items]);\n\n const rename = useCallback(async (id: string, title: string) => {\n setSessions(current =>\n current.map(s => (s.id === id ? { ...s, overview: title } : s)),\n );\n try {\n await sessionService.patchSession(id, { overview: title });\n } catch (err) {\n console.error('[useChatSessions] rename failed; refreshing to roll back:', err);\n void refresh();\n }\n }, [sessionService, refresh]);\n\n const remove = useCallback(async (id: string) => {\n setSessions(current => current.filter(s => s.id !== id));\n try {\n await sessionService.removeSession(id);\n } catch (err) {\n console.error('[useChatSessions] remove failed; refreshing to roll back:', err);\n void refresh();\n }\n }, [sessionService, refresh]);\n\n return { sessions: merged, groups, isLoading, error, refresh, rename, remove };\n}\n"],"names":["MINUTE_MS","HOUR_MS","DAY_MS","toDate","value","d","__name","formatTimeLabel","date","diff","startOfToday","groupByTime","items","today","yesterday","weekAgo","monthAgo","buckets","item","u","list","label","buildItem","session","decorate","updatedAt","useChatSessions","opts","defaultSessionService","useMemo","HttpSessionService","sessionService","liveSession","sessions","setSessions","useState","isLoading","setIsLoading","error","setError","refresh","useCallback","err","useEffect","merged","idx","s","copy","groups","rename","id","title","current","remove"],"mappings":";;;;AAkEA,MAAMA,IAAY,KACZC,IAAU,KAAKD,GACfE,IAAS,KAAKD;AAEpB,SAASE,EAAOC,GAA2D;AACvE,MAAI,CAACA,EAAO;AACZ,MAAIA,aAAiB,KAAM,QAAOA;AAClC,QAAMC,IAAI,IAAI,KAAKD,CAAK;AACxB,SAAO,OAAO,MAAMC,EAAE,QAAA,CAAS,IAAI,SAAYA;AACnD;AALSC,EAAAH,GAAA;AAOT,SAASI,EA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UAAUC,GAAO;AAAA,IAC7D,SAAST,GAAK;AACV,cAAQ,MAAM,6DAA6DA,CAAG,GACzEF,EAAA;AAAA,IACT;AAAA,EACJ,GAAG,CAACT,GAAgBS,CAAO,CAAC,GAEtBa,IAASZ,EAAY,OAAOS,MAAe;AAC7C,IAAAhB,EAAY,OAAWkB,EAAQ,OAAO,OAAKN,EAAE,OAAOI,CAAE,CAAC;AACvD,QAAI;AACA,YAAMnB,EAAe,cAAcmB,CAAE;AAAA,IACzC,SAASR,GAAK;AACV,cAAQ,MAAM,6DAA6DA,CAAG,GACzEF,EAAA;AAAA,IACT;AAAA,EACJ,GAAG,CAACT,GAAgBS,CAAO,CAAC;AAE5B,SAAO,EAAE,UAAUI,GAAQ,QAAAI,GAAQ,WAAAZ,GAAW,OAAAE,GAAO,SAAAE,GAAS,QAAAS,GAAQ,QAAAI,EAAA;AAC1E;AAtEgB/C,EAAAoB,GAAA;"}
|
|
1
|
+
{"version":3,"file":"useChatSessions-BXYvvd4S.js","sources":["../src/hooks/useChatSessions.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState } from 'react';\nimport type { ChatSession } from '@lib/models/ChatSession';\nimport type { ISessionService } from '@lib/services/servers/sessionService/ISessionService';\nimport { HttpSessionService } from '../services';\n\n/**\n * One row in a session-picker UI. `raw` is the original ChatSession the\n * server returned; everything else is a derived label the hook computed\n * (and the host's `decorate` callback may have overridden).\n */\nexport interface ChatSessionListItem {\n id: string;\n title: string;\n snippet?: string;\n /** Compact relative-time label (\"now\", \"5m\", \"2h\", \"Mar 14\"). */\n timeLabel?: string;\n /** Optional per-row tag — host-supplied via the `decorate` callback. */\n kind?: string;\n updatedAt?: Date;\n raw: ChatSession;\n}\n\n/**\n * Sessions bucketed by recency. The order of `label` reflects display\n * order top-down (\"Today\" first, \"Older\" last).\n */\nexport interface ChatSessionGroup {\n label: string;\n items: ChatSessionListItem[];\n}\n\nexport interface UseChatSessionsOptions {\n sessionService?: ISessionService;\n /**\n * If provided, the live (current) session is merged into the list —\n * replacing an existing entry by id, or prepended if not yet on the\n * server. Lets a \"New chat\" row appear instantly without waiting for\n * the server roundtrip.\n */\n liveSession?: ChatSession | null;\n\n accessToken: string,\n serverBaseUrl: string,\n /**\n * Per-row override hook. Whatever fields you return are merged on top\n * of the hook's computed item — typical use is adding a `kind` tag for\n * application-specific session types (`'chat' | 'composer' | ...`) the\n * library doesn't know about.\n */\n decorate?: (session: ChatSession) => Partial<ChatSessionListItem>;\n}\n\nexport interface UseChatSessionsResult {\n /** Flat list (live session merged in, server order preserved). */\n sessions: ChatSession[];\n /** Same data bucketed by recency. */\n groups: ChatSessionGroup[];\n isLoading: boolean;\n error: Error | null;\n refresh: () => Promise<void>;\n /** Optimistic rename — patches local state immediately, rolls back on failure. */\n rename: (id: string, title: string) => Promise<void>;\n /** Optimistic remove — drops from local state immediately, rolls back on failure. */\n remove: (id: string) => Promise<void>;\n}\n\nconst MINUTE_MS = 60_000;\nconst HOUR_MS = 60 * MINUTE_MS;\nconst DAY_MS = 24 * HOUR_MS;\n\nfunction toDate(value: Date | string | undefined | null): Date | undefined {\n if (!value) return undefined;\n if (value instanceof Date) return value;\n const d = new Date(value);\n return Number.isNaN(d.getTime()) ? undefined : d;\n}\n\nfunction formatTimeLabel(date: Date | undefined): string {\n if (!date) return '';\n const diff = Date.now() - date.getTime();\n if (diff < MINUTE_MS) return 'now';\n if (diff < HOUR_MS) return `${Math.floor(diff / MINUTE_MS)}m`;\n if (diff < DAY_MS) return `${Math.floor(diff / HOUR_MS)}h`;\n if (diff < 7 * DAY_MS) return `${Math.floor(diff / DAY_MS)}d`;\n return date.toLocaleDateString(undefined, { month: 'short', day: 'numeric' });\n}\n\nfunction startOfToday(): Date {\n const d = new Date();\n d.setHours(0, 0, 0, 0);\n return d;\n}\n\nfunction groupByTime(items: ChatSessionListItem[]): ChatSessionGroup[] {\n const today = startOfToday();\n const yesterday = new Date(today.getTime() - DAY_MS);\n const weekAgo = new Date(today.getTime() - 7 * DAY_MS);\n const monthAgo = new Date(today.getTime() - 30 * DAY_MS);\n\n // Insertion-ordered map preserves the bucket display order.\n const buckets: Array<[string, ChatSessionListItem[]]> = [\n ['Today', []],\n ['Yesterday', []],\n ['This Week', []],\n ['This Month', []],\n ['Older', []],\n ];\n\n for (const item of items) {\n const u = item.updatedAt;\n if (!u) { buckets[4][1].push(item); continue; }\n if (u >= today) buckets[0][1].push(item);\n else if (u >= yesterday) buckets[1][1].push(item);\n else if (u >= weekAgo) buckets[2][1].push(item);\n else if (u >= monthAgo) buckets[3][1].push(item);\n else buckets[4][1].push(item);\n }\n\n return buckets\n .filter(([, list]) => list.length > 0)\n .map(([label, list]) => ({ label, items: list }));\n}\n\nfunction buildItem(\n session: ChatSession,\n decorate?: (s: ChatSession) => Partial<ChatSessionListItem>,\n): ChatSessionListItem {\n const updatedAt = toDate(session.updatedAt) ?? toDate(session.created);\n const base: ChatSessionListItem = {\n id: session.id ?? session.browserScopeId ?? '',\n title: session.overview || session.userDescription || '(untitled chat)',\n snippet: session.lastQuestion ?? undefined,\n timeLabel: formatTimeLabel(updatedAt),\n kind: session.agentType as string | undefined,\n updatedAt,\n raw: session,\n };\n return { ...base, ...(decorate?.(session) ?? {}) };\n}\n\n/**\n * Fetch + organise the user's chat sessions for a picker UI. Backend-agnostic\n * — the host injects an `ISessionService` so the same hook drives an HTTP\n * client, an in-memory fake, or whatever else.\n *\n * Replaces the duplicated `useEffect(async () => sessionService.getAllSessions())`\n * + grouping logic that lived in DataExplorerViewV2 and MobileSessionsList,\n * and consolidates the optimistic rename/delete pattern.\n */\nexport function useChatSessions(opts: UseChatSessionsOptions): UseChatSessionsResult {\n\n const defaultSessionService = useMemo(() => {\n return new HttpSessionService(opts.serverBaseUrl, opts.accessToken);\n }, [opts.accessToken, opts.serverBaseUrl]);\n\n const { sessionService, liveSession, decorate } = {\n sessionService: defaultSessionService,\n liveSession: opts.liveSession,\n decorate: opts.decorate\n };\n const [sessions, setSessions] = useState<ChatSession[]>([]);\n const [isLoading, setIsLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n\n const refresh = useCallback(async () => {\n setIsLoading(true);\n setError(null);\n try {\n const list = await sessionService.getAllSessions();\n setSessions(list);\n } catch (err) {\n setError(err instanceof Error ? err : new Error(String(err)));\n } finally {\n setIsLoading(false);\n }\n }, [sessionService]);\n\n useEffect(() => { void refresh(); }, [refresh]);\n\n const merged = useMemo(() => {\n if (!liveSession?.id) return sessions;\n const idx = sessions.findIndex(s => s.id === liveSession.id);\n if (idx === -1) return [liveSession, ...sessions];\n const copy = sessions.slice();\n copy[idx] = liveSession;\n return copy;\n }, [sessions, liveSession]);\n\n const items = useMemo(\n () => merged.map(s => buildItem(s, decorate)),\n [merged, decorate],\n );\n\n const groups = useMemo(() => groupByTime(items), [items]);\n\n const rename = useCallback(async (id: string, title: string) => {\n setSessions(current =>\n current.map(s => (s.id === id ? { ...s, overview: title } : s)),\n );\n try {\n await sessionService.patchSession(id, { overview: title });\n } catch (err) {\n console.error('[useChatSessions] rename failed; refreshing to roll back:', err);\n void refresh();\n }\n }, [sessionService, refresh]);\n\n const remove = useCallback(async (id: string) => {\n setSessions(current => current.filter(s => s.id !== id));\n try {\n await sessionService.removeSession(id);\n } catch (err) {\n console.error('[useChatSessions] remove failed; refreshing to roll back:', err);\n void refresh();\n }\n }, [sessionService, refresh]);\n\n return { sessions: merged, groups, isLoading, error, refresh, rename, remove };\n}\n"],"names":["MINUTE_MS","HOUR_MS","DAY_MS","toDate","value","d","__name","formatTimeLabel","date","diff","startOfToday","groupByTime","items","today","yesterday","weekAgo","monthAgo","buckets","item","u","list","label","buildItem","session","decorate","updatedAt","useChatSessions","opts","defaultSessionService","useMemo","HttpSessionService","sessionService","liveSession","sessions","setSessions","useState","isLoading","setIsLoading","error","setError","refresh","useCallback","err","useEffect","merged","idx","s","copy","groups","rename","id","title","current","remove"],"mappings":";;;;AAkEA,MAAMA,IAAY,KACZC,IAAU,KAAKD,GACfE,IAAS,KAAKD;AA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