langgraph-ui-components 0.0.27 → 0.0.28
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/README.md +103 -4
- package/dist/_virtual/index.cjs.js +1 -1
- package/dist/_virtual/index.cjs2.js +1 -1
- package/dist/_virtual/index.cjs3.js +1 -1
- package/dist/_virtual/index.es.js +5 -2
- package/dist/_virtual/index.es2.js +4 -2
- package/dist/_virtual/index.es2.js.map +1 -1
- package/dist/_virtual/index.es3.js +4 -4
- package/dist/components/ChatBody.cjs.js +2 -2
- package/dist/components/ChatBody.cjs.js.map +1 -1
- package/dist/components/ChatBody.d.ts.map +1 -1
- package/dist/components/ChatBody.es.js +191 -164
- package/dist/components/ChatBody.es.js.map +1 -1
- package/dist/components/TodoList.cjs.js +2 -0
- package/dist/components/TodoList.cjs.js.map +1 -0
- package/dist/components/TodoList.d.ts +5 -0
- package/dist/components/TodoList.d.ts.map +1 -0
- package/dist/components/TodoList.es.js +65 -0
- package/dist/components/TodoList.es.js.map +1 -0
- package/dist/components/messages/AgentMessage.cjs.js +2 -2
- package/dist/components/messages/AgentMessage.cjs.js.map +1 -1
- package/dist/components/messages/AgentMessage.d.ts +3 -1
- package/dist/components/messages/AgentMessage.d.ts.map +1 -1
- package/dist/components/messages/AgentMessage.es.js +107 -104
- package/dist/components/messages/AgentMessage.es.js.map +1 -1
- package/dist/components/messages/CustomComponentRender.cjs.js.map +1 -1
- package/dist/components/messages/CustomComponentRender.es.js.map +1 -1
- package/dist/components/ui/syntax-highlighter.cjs.js +1 -1
- package/dist/components/ui/syntax-highlighter.cjs.js.map +1 -1
- package/dist/components/ui/syntax-highlighter.es.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/node_modules/.pnpm/react-syntax-highlighter@16.1.0_react@19.2.3/node_modules/react-syntax-highlighter/dist/cjs/styles/prism/index.cjs.js +1 -1
- package/dist/node_modules/.pnpm/react-syntax-highlighter@16.1.0_react@19.2.3/node_modules/react-syntax-highlighter/dist/cjs/styles/prism/index.es.js +1 -1
- package/dist/node_modules/.pnpm/react-syntax-highlighter@16.1.0_react@19.2.3/node_modules/react-syntax-highlighter/dist/esm/async-languages/create-language-async-loader.cjs.js +1 -1
- package/dist/node_modules/.pnpm/react-syntax-highlighter@16.1.0_react@19.2.3/node_modules/react-syntax-highlighter/dist/esm/async-languages/create-language-async-loader.cjs.js.map +1 -1
- package/dist/node_modules/.pnpm/react-syntax-highlighter@16.1.0_react@19.2.3/node_modules/react-syntax-highlighter/dist/esm/async-languages/create-language-async-loader.es.js +1 -1
- package/dist/node_modules/.pnpm/react-syntax-highlighter@16.1.0_react@19.2.3/node_modules/react-syntax-highlighter/dist/esm/async-syntax-highlighter.cjs.js +1 -1
- package/dist/node_modules/.pnpm/react-syntax-highlighter@16.1.0_react@19.2.3/node_modules/react-syntax-highlighter/dist/esm/async-syntax-highlighter.cjs.js.map +1 -1
- package/dist/node_modules/.pnpm/react-syntax-highlighter@16.1.0_react@19.2.3/node_modules/react-syntax-highlighter/dist/esm/async-syntax-highlighter.es.js +1 -1
- package/dist/pages/Chat/Chat.cjs.js +1 -1
- package/dist/pages/Chat/Chat.cjs.js.map +1 -1
- package/dist/pages/Chat/Chat.d.ts.map +1 -1
- package/dist/pages/Chat/Chat.es.js +41 -34
- package/dist/pages/Chat/Chat.es.js.map +1 -1
- package/dist/pages/Sidebar/sidebar.cjs.js +1 -1
- package/dist/pages/Sidebar/sidebar.cjs.js.map +1 -1
- package/dist/pages/Sidebar/sidebar.d.ts.map +1 -1
- package/dist/pages/Sidebar/sidebar.es.js +75 -70
- package/dist/pages/Sidebar/sidebar.es.js.map +1 -1
- package/dist/providers/Stream.cjs.js +1 -1
- package/dist/providers/Stream.cjs.js.map +1 -1
- package/dist/providers/Stream.d.ts +40 -8
- package/dist/providers/Stream.d.ts.map +1 -1
- package/dist/providers/Stream.es.js +136 -123
- package/dist/providers/Stream.es.js.map +1 -1
- package/package.json +17 -1
- package/src/App.tsx +4 -4
- package/src/components/ChatBody.tsx +158 -67
- package/src/components/TodoList.tsx +72 -0
- package/src/components/messages/AgentMessage.tsx +7 -1
- package/src/components/messages/CustomComponentRender.tsx +1 -1
- package/src/index.ts +1 -1
- package/src/pages/Chat/Chat.tsx +13 -3
- package/src/pages/Sidebar/sidebar.tsx +12 -3
- package/src/providers/Stream.tsx +76 -32
- package/dist/_virtual/index.cjs10.js +0 -2
- package/dist/_virtual/index.cjs10.js.map +0 -1
- package/dist/_virtual/index.cjs11.js +0 -2
- package/dist/_virtual/index.cjs11.js.map +0 -1
- package/dist/_virtual/index.cjs12.js +0 -2
- package/dist/_virtual/index.cjs12.js.map +0 -1
- package/dist/_virtual/index.cjs4.js +0 -2
- package/dist/_virtual/index.cjs4.js.map +0 -1
- package/dist/_virtual/index.cjs5.js +0 -2
- package/dist/_virtual/index.cjs5.js.map +0 -1
- package/dist/_virtual/index.cjs6.js +0 -2
- package/dist/_virtual/index.cjs6.js.map +0 -1
- package/dist/_virtual/index.cjs7.js +0 -2
- package/dist/_virtual/index.cjs7.js.map +0 -1
- package/dist/_virtual/index.cjs8.js +0 -2
- package/dist/_virtual/index.cjs8.js.map +0 -1
- package/dist/_virtual/index.cjs9.js +0 -2
- package/dist/_virtual/index.cjs9.js.map +0 -1
- package/dist/_virtual/index.es10.js +0 -8
- package/dist/_virtual/index.es10.js.map +0 -1
- package/dist/_virtual/index.es11.js +0 -5
- package/dist/_virtual/index.es11.js.map +0 -1
- package/dist/_virtual/index.es12.js +0 -8
- package/dist/_virtual/index.es12.js.map +0 -1
- package/dist/_virtual/index.es4.js +0 -6
- package/dist/_virtual/index.es4.js.map +0 -1
- package/dist/_virtual/index.es5.js +0 -5
- package/dist/_virtual/index.es5.js.map +0 -1
- package/dist/_virtual/index.es6.js +0 -5
- package/dist/_virtual/index.es6.js.map +0 -1
- package/dist/_virtual/index.es7.js +0 -5
- package/dist/_virtual/index.es7.js.map +0 -1
- package/dist/_virtual/index.es8.js +0 -5
- package/dist/_virtual/index.es8.js.map +0 -1
- package/dist/_virtual/index.es9.js +0 -5
- package/dist/_virtual/index.es9.js.map +0 -1
- package/dist/_virtual/lower-bound.cjs.js +0 -2
- package/dist/_virtual/lower-bound.cjs.js.map +0 -1
- package/dist/_virtual/lower-bound.es.js +0 -5
- package/dist/_virtual/lower-bound.es.js.map +0 -1
- package/dist/_virtual/priority-queue.cjs.js +0 -2
- package/dist/_virtual/priority-queue.cjs.js.map +0 -1
- package/dist/_virtual/priority-queue.es.js +0 -5
- package/dist/_virtual/priority-queue.es.js.map +0 -1
- package/dist/_virtual/re.cjs.js +0 -2
- package/dist/_virtual/re.cjs.js.map +0 -1
- package/dist/_virtual/re.es.js +0 -5
- package/dist/_virtual/re.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/_virtual/_rolldown/runtime.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/_virtual/_rolldown/runtime.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/_virtual/_rolldown/runtime.es.js +0 -12
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/_virtual/_rolldown/runtime.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/errors/index.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/errors/index.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/errors/index.es.js +0 -66
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/errors/index.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/anthropic.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/anthropic.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/anthropic.es.js +0 -283
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/anthropic.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/bedrock_converse.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/bedrock_converse.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/bedrock_converse.es.js +0 -219
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/bedrock_converse.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/data.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/data.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/data.es.js +0 -42
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/data.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/deepseek.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/deepseek.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/deepseek.es.js +0 -31
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/deepseek.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/google.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/google.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/google.es.js +0 -77
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/google.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/google_genai.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/google_genai.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/google_genai.es.js +0 -78
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/google_genai.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/google_vertexai.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/google_vertexai.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/google_vertexai.es.js +0 -75
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/google_vertexai.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/groq.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/groq.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/groq.es.js +0 -51
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/groq.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/index.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/index.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/index.es.js +0 -23
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/index.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/ollama.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/ollama.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/ollama.es.js +0 -31
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/ollama.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/openai.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/openai.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/openai.es.js +0 -241
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/openai.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/utils.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/utils.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/utils.es.js +0 -37
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/utils.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/xai.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/xai.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/xai.es.js +0 -42
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/block_translators/xai.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/content/data.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/content/data.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/content/data.es.js +0 -16
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/messages/content/data.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/tracers/console.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/tracers/console.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/tracers/console.es.js +0 -9
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/tracers/console.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/fast-json-patch/index.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/fast-json-patch/index.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/fast-json-patch/index.es.js +0 -3
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/fast-json-patch/index.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/fast-json-patch/src/core.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/fast-json-patch/src/core.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/fast-json-patch/src/core.es.js +0 -230
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/fast-json-patch/src/core.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/fast-json-patch/src/helpers.cjs.js +0 -3
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/fast-json-patch/src/helpers.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/fast-json-patch/src/helpers.es.js +0 -87
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/fast-json-patch/src/helpers.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/json.cjs.js +0 -3
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/json.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/json.es.js +0 -133
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/json.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/namespace.cjs.js +0 -2
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/namespace.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/namespace.es.js +0 -29
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/namespace.es.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/sax-js/sax.cjs.js +0 -10
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/sax-js/sax.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/sax-js/sax.es.js +0 -795
- package/dist/node_modules/.pnpm/@langchain_core@1.1.33_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/sax-js/sax.es.js.map +0 -1
- package/dist/node_modules/.pnpm/ansi-styles@5.2.0/node_modules/ansi-styles/index.cjs.js +0 -2
- package/dist/node_modules/.pnpm/ansi-styles@5.2.0/node_modules/ansi-styles/index.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/ansi-styles@5.2.0/node_modules/ansi-styles/index.es.js +0 -111
- package/dist/node_modules/.pnpm/ansi-styles@5.2.0/node_modules/ansi-styles/index.es.js.map +0 -1
- package/dist/node_modules/.pnpm/camelcase@6.3.0/node_modules/camelcase/index.cjs.js +0 -2
- package/dist/node_modules/.pnpm/camelcase@6.3.0/node_modules/camelcase/index.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/camelcase@6.3.0/node_modules/camelcase/index.es.js +0 -30
- package/dist/node_modules/.pnpm/camelcase@6.3.0/node_modules/camelcase/index.es.js.map +0 -1
- package/dist/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.cjs.js +0 -2
- package/dist/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.es.js +0 -112
- package/dist/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.es.js.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/_uuid.cjs.js +0 -2
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/_uuid.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/_uuid.es.js +0 -3
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/_uuid.es.js.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/fast-safe-stringify/index.cjs.js +0 -2
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/fast-safe-stringify/index.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/fast-safe-stringify/index.es.js +0 -6
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/fast-safe-stringify/index.es.js.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/fs.browser.cjs.js +0 -2
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/fs.browser.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/fs.browser.es.js +0 -14
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/fs.browser.es.js.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/p-queue.cjs.js +0 -2
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/p-queue.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/p-queue.es.js +0 -3
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/p-queue.es.js.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/prompt_cache/index.cjs.js +0 -2
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/prompt_cache/index.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/prompt_cache/index.es.js +0 -200
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/prompt_cache/index.es.js.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/xxhash/xxhash.cjs.js +0 -2
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/xxhash/xxhash.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/xxhash/xxhash.es.js +0 -22
- package/dist/node_modules/.pnpm/langsmith@0.5.10_openai@6.16.0_zod@4.3.5_/node_modules/langsmith/dist/utils/xxhash/xxhash.es.js.map +0 -1
- package/dist/node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.cjs.js +0 -2
- package/dist/node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.es.js +0 -18
- package/dist/node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.es.js.map +0 -1
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.cjs.js +0 -2
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.es.js +0 -198
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.es.js.map +0 -1
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.cjs.js +0 -2
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.es.js +0 -20
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.es.js.map +0 -1
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.cjs.js +0 -2
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.es.js +0 -41
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.es.js.map +0 -1
- package/dist/node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.cjs.js +0 -2
- package/dist/node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.es.js +0 -45
- package/dist/node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/comparator.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/comparator.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/comparator.es.js +0 -57
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/comparator.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/range.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/range.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/range.es.js +0 -149
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/range.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/semver.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/semver.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/semver.es.js +0 -170
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/classes/semver.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.es.js +0 -15
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/clean.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/cmp.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/cmp.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/cmp.es.js +0 -40
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/cmp.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.es.js +0 -34
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/coerce.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-build.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-build.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-build.es.js +0 -15
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-build.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-loose.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-loose.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-loose.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare-loose.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/compare.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.es.js +0 -25
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/diff.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/eq.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/eq.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/eq.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/eq.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gt.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gt.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gt.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gt.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gte.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gte.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gte.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/gte.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/inc.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/inc.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/inc.es.js +0 -22
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/inc.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lt.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lt.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lt.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lt.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lte.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lte.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lte.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/lte.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/major.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/major.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/major.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/major.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/minor.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/minor.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/minor.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/minor.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/neq.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/neq.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/neq.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/neq.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.es.js +0 -22
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/parse.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/patch.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/patch.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/patch.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/patch.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.es.js +0 -15
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/prerelease.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rcompare.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rcompare.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rcompare.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rcompare.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rsort.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rsort.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rsort.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/rsort.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/satisfies.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/satisfies.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/satisfies.es.js +0 -19
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/satisfies.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/sort.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/sort.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/sort.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/sort.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.es.js +0 -15
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/functions/valid.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/index.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/index.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/index.es.js +0 -98
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/index.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.es.js +0 -29
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/constants.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.es.js +0 -9
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/identifiers.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/identifiers.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/identifiers.es.js +0 -19
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/identifiers.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/lrucache.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/lrucache.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/lrucache.es.js +0 -33
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/lrucache.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/parse-options.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/parse-options.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/parse-options.es.js +0 -11
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/parse-options.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/re.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/re.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/re.es.js +0 -33
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/re.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/gtr.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/gtr.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/gtr.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/gtr.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/intersects.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/intersects.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/intersects.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/intersects.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/ltr.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/ltr.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/ltr.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/ltr.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/max-satisfying.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/max-satisfying.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/max-satisfying.es.js +0 -23
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/max-satisfying.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-satisfying.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-satisfying.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-satisfying.es.js +0 -23
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-satisfying.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-version.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-version.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-version.es.js +0 -43
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/min-version.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/outside.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/outside.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/outside.es.js +0 -45
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/outside.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/simplify.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/simplify.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/simplify.es.js +0 -25
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/simplify.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/subset.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/subset.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/subset.es.js +0 -95
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/subset.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/to-comparators.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/to-comparators.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/to-comparators.es.js +0 -12
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/to-comparators.es.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/valid.cjs.js +0 -2
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/valid.cjs.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/valid.es.js +0 -18
- package/dist/node_modules/.pnpm/semver@7.7.3/node_modules/semver/ranges/valid.es.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stream.es.js","sources":["../../src/providers/Stream.tsx"],"sourcesContent":["/* @refresh reset */\nimport { useChatRuntime } from \"@/providers/ChatRuntime\";\nimport { logger } from \"@/utils/logger\";\nimport { type AIMessage, type Message } from \"@langchain/langgraph-sdk\";\n\n// Derive the tool-call types from AIMessage since the SDK doesn't re-export them\ntype ToolCall = NonNullable<AIMessage[\"tool_calls\"]>[number];\ntype InvalidToolCall = NonNullable<AIMessage[\"invalid_tool_calls\"]>[number];\nimport { useStream, type UseStream } from \"@langchain/langgraph-sdk/react\";\nimport {\n isRemoveUIMessage,\n isUIMessage,\n type RemoveUIMessage,\n type UIMessage,\n uiMessageReducer,\n} from \"@langchain/langgraph-sdk/react-ui\";\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { toast } from \"sonner\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { useThread } from \"./Thread\";\n\nexport type StateType = {\n messages: Message[];\n ui?: UIMessage[];\n suggestions?: string[];\n};\n\nconst useTypedStream = useStream<\n StateType,\n {\n UpdateType: {\n messages?: Message[] | Message | string;\n ui?: (UIMessage | RemoveUIMessage)[] | UIMessage | RemoveUIMessage;\n };\n CustomEventType: UIMessage | RemoveUIMessage;\n }\n>;\n\ntype StreamContextType = UseStream<StateType, {\n UpdateType: {\n\n messages?: Message[] | Message | string;\n ui?: (UIMessage | RemoveUIMessage)[] | UIMessage | RemoveUIMessage;\n };\n CustomEventType: UIMessage | RemoveUIMessage;\n}> & {\n sendMessage: (\n message: Message | string,\n options?: {\n /** If true, message is meant for agent only (not user-visible) */\n type?: Message[\"type\"];\n /** Name field required for function/tool messages */\n name?: string;\n /** If true, message is hidden from user UI */\n hidden?: boolean;\n /** Tool calls associated with this message */\n tool_calls?: ToolCall[];\n /** Invalid tool calls associated with this message */\n invalid_tool_calls?: InvalidToolCall[];\n /** If provided, use this ID for the message instead of generating one */\n tool_call_id?: string;\n /** Additional kwargs to attach to the message */\n additional_kwargs?: Record<string, unknown>;\n /** UI components to display alongside the message */\n ui?: UIMessage[];\n /** Custom ID for the message (will also be used for UI components) */\n id?: string;\n /** Custom context to override/merge with identity */\n context?: Record<string, unknown>;\n }\n ) => Promise<void>;\n submitMessage: (\n message: Message,\n options?: {\n streamMode?: (\"values\" | \"updates\" | \"messages\" | \"custom\" | \"debug\")[];\n streamSubgraphs?: boolean;\n streamResumable?: boolean;\n contextValues?: Record<string, unknown>;\n }\n ) => Promise<void>;\n regenerateMessage: (messageId: string) => Promise<void>;\n fetchCatalog: () => Promise<unknown>;\n};\n\nconst StreamContext = createContext<StreamContextType | undefined>(undefined);\n\nasync function checkGraphStatus(apiUrl: string, authToken: string | null | undefined) {\n try {\n const res = await fetch(`${apiUrl}/info`, {\n headers: authToken ? { Authorization: `Bearer ${authToken}` } : undefined,\n });\n return res.ok;\n } catch {\n logger.error(\"Failed to initialize LangGraph Agent\");\n }\n}\n\nasync function fetchCatalog(apiUrl: string, authToken: string | null | undefined) {\n try {\n const res = await fetch(`${apiUrl}/agents/catalog`, {\n headers: authToken ? { Authorization: `Bearer ${authToken}` } : undefined,\n });\n if (res.ok) {\n const data = await res.json();\n return data;\n }\n return null;\n }\n catch {\n logger.error(\"Failed to fetch LangGraph Catalog\");\n return null;\n }\n}\n\nasync function sleep(ms = 6000) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nconst StreamSession = ({ children }: { children: ReactNode }) => {\n const { apiUrl, assistantId, identity } = useChatRuntime();\n const { mode, threadId, setThreadId, getThreads, setThreads, configuration } = useThread();\n\n // Store local-only AI messages that shouldn't trigger backend calls\n const [localMessages, setLocalMessages] = useState<Message[]>([]);\n // Store local-only UI components\n const [localUI, setLocalUI] = useState<UIMessage[]>([]);\n // Track if catalog has been fetched to prevent duplicate calls\n const [catalogFetched, setCatalogFetched] = useState(false);\n const [catalogCache, setCatalogCache] = useState<unknown>(null);\n\n const streamValue = useTypedStream({\n apiUrl,\n assistantId,\n threadId: mode === \"multi\" ? threadId : null,\n defaultHeaders: identity?.authToken\n ? { Authorization: `Bearer ${identity?.authToken}` }\n : undefined,\n fetchStateHistory: true,\n onUpdateEvent: (data, options) => {\n // Scan update data (potentially nested by node name) for AI messages\n // with reasoning_content or tool_status in additional_kwargs.\n // Merge these into existing messages so they're available during streaming.\n const enrichedMessages: Message[] = [];\n\n const scan = (obj: unknown) => {\n if (!obj || typeof obj !== \"object\") return;\n const o = obj as Record<string, unknown>;\n if (Array.isArray(o.messages)) {\n for (const m of o.messages as Message[]) {\n const ak = (m as Record<string, unknown>).additional_kwargs as Record<string, unknown> | undefined;\n if (m?.type === \"ai\" && m.id && ak) {\n const hasReasoning = typeof ak.reasoning_content === \"string\" && ak.reasoning_content.length > 0;\n const hasToolStatus = Array.isArray(ak.tool_status) && (ak.tool_status as unknown[]).length > 0;\n if (hasReasoning || hasToolStatus) {\n enrichedMessages.push(m);\n }\n }\n }\n }\n for (const val of Object.values(o)) {\n if (val && typeof val === \"object\" && !Array.isArray(val)) {\n scan(val);\n }\n }\n };\n\n scan(data);\n\n if (enrichedMessages.length > 0) {\n options.mutate((prev) => {\n const prevMessages = (prev.messages ?? []) as Message[];\n const enrichedById = new Map<string, Message>();\n for (const m of enrichedMessages) {\n if (m.id) enrichedById.set(m.id, m);\n }\n\n let changed = false;\n const updatedMessages = prevMessages.map((m) => {\n if (!m.id || !enrichedById.has(m.id)) return m;\n const enriched = enrichedById.get(m.id)!;\n enrichedById.delete(m.id);\n changed = true;\n const enrichedKwargs = (enriched as Record<string, unknown>).additional_kwargs as Record<string, unknown> | undefined;\n return {\n ...m,\n additional_kwargs: {\n ...(m.additional_kwargs ?? {}),\n ...(enrichedKwargs ?? {}),\n },\n };\n });\n\n if (!changed) return prev;\n\n return { ...prev, messages: updatedMessages };\n });\n }\n },\n onCustomEvent: (event, options) => {\n if (isUIMessage(event) || isRemoveUIMessage(event)) {\n options.mutate((prev) => {\n logger.debug(\"UI Event received in StreamProvider:\", event);\n const ui = uiMessageReducer(prev.ui ?? [], event);\n return { ...prev, ui };\n });\n }\n },\n\n onThreadId: (id) => {\n if (!id) return;\n if (mode === \"single\") {\n // lock once\n if (!threadId) setThreadId(id);\n } else {\n // switch freely\n setThreadId(id);\n // Refetch threads list when thread ID changes.\n // Wait for some seconds before fetching so we're able to get the new thread that was created.\n sleep().then(() => getThreads().then(setThreads).catch((err) => logger.error(\"Failed to refresh threads:\", err)));\n }\n },\n });\n\n /**\n * Send a message to the agent programmatically\n * Useful for triggering agent actions without user-visible messages\n * e.g., \"login completed\", \"card clicked: {id}\"\n */\n const sendMessage = useCallback(\n async (\n message: Message | string,\n options?: {\n type?: Message[\"type\"];\n name?: string;\n hidden?: boolean;\n tool_calls?: ToolCall[];\n invalid_tool_calls?: InvalidToolCall[];\n tool_call_id?: string;\n additional_kwargs?: Record<string, unknown>;\n ui?: UIMessage[];\n id?: string; // Allow passing custom ID\n context?: Record<string, unknown>; // Allow passing custom context to override identity\n }\n ) => {\n // Use provided ID or generate new one\n const messageId = options?.id || uuidv4();\n\n const messageObj: Message =\n typeof message === \"string\"\n ? ({\n id: messageId, // Use the determined ID\n type: options?.type ?? \"human\",\n content: message,\n ...(options?.name && { name: options.name }),\n ...(options?.tool_calls && { tool_calls: options.tool_calls }),\n ...(options?.invalid_tool_calls && { invalid_tool_calls: options.invalid_tool_calls }),\n ...(options?.tool_call_id && { tool_call_id: options.tool_call_id }),\n ...((options?.additional_kwargs || options?.hidden) && {\n additional_kwargs: {\n ...(options?.hidden && { hidden: true }),\n ...(options?.additional_kwargs ?? {}),\n }\n }),\n } as Message)\n : {\n ...message,\n id: messageId, // Override with determined ID\n // Allow overriding message fields with options\n ...(options?.tool_calls && { tool_calls: options.tool_calls }),\n ...(options?.additional_kwargs && {\n additional_kwargs: {\n ...message.additional_kwargs,\n ...options.additional_kwargs,\n }\n }),\n };\n\n // console.log(\"Sending message via sendMessage:\", messageObj); → converted to debug log\n logger.debug(\"Sending message via sendMessage:\", messageObj);\n\n // If message type is \"ai\", just append to local state without submitting to agent\n // This is useful for injecting initial messages or system messages that don't need agent processing\n if (options?.type === \"ai\") {\n setLocalMessages((prev) => [...prev, messageObj]);\n logger.debug(\"Appended AI message to localMessages:\", options?.ui);\n // Also store any UI components, linking them to the message id\n if (options.ui && options.ui.length > 0) {\n const uiWithMessageId = options.ui.map((ui, index) => ({\n ...ui,\n id: messageId, // Link to the message ID so CustomComponentRender can find it\n // Ensure each UI component has a unique identifier for React keys\n _key: (ui as UIMessage & { _key?: string })._key || `${messageId}-ui-${index}`,\n })) as UIMessage[];\n setLocalUI((prev) => [...prev, ...uiWithMessageId]);\n }\n return;\n }\n\n // For non-AI messages, submit to the agent\n const currentMessages = streamValue.messages || [];\n // Merge identity with custom context, custom context takes precedence\n const mergedContext = options?.context\n ? { ...identity, ...options.context, ...configuration }\n : identity || {};\n\n await streamValue.submit(\n { messages: [...currentMessages, messageObj] },\n {\n context: mergedContext,\n streamMode: [\"values\", \"messages-tuple\", \"updates\", \"custom\"],\n }\n );\n },\n [streamValue, identity, configuration, setLocalMessages, setLocalUI]\n );\n\n // Combine stream messages with local AI messages, deduplicating by ID\n const combinedMessages = useMemo(() => {\n const allMessages = [...localMessages, ...(streamValue.messages || [])];\n // Deduplicate by message ID, keeping the first occurrence\n const seen = new Set<string>();\n return allMessages.filter(msg => {\n if (!msg.id) return true; // Keep messages without IDs\n if (seen.has(msg.id)) return false;\n seen.add(msg.id);\n return true;\n });\n }, [localMessages, streamValue.messages]);\n\n // Combine local UI with stream UI, deduplicating by unique key\n const combinedUI = useMemo(() => {\n logger.debug(\"Combining local UI with stream UI:\", localUI, streamValue.values?.ui);\n const allUI = [...localUI, ...(streamValue.values?.ui || [])];\n // Deduplicate by _key or id+name combination\n const seen = new Set<string>();\n return allUI.filter(ui => {\n const key = (ui as UIMessage & { _key?: string })._key || `${ui.id}-${ui.name}`;\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n }, [localUI, streamValue.values?.ui]);\n\n const submitMessage = useCallback(\n async (\n message: Message,\n options?: {\n streamMode?: (\"values\" | \"updates\" | \"messages\" | \"custom\" | \"debug\")[];\n streamSubgraphs?: boolean;\n streamResumable?: boolean;\n contextValues?: Record<string, unknown>;\n }\n ) => {\n // Get ALL current messages (including local AI messages)\n const allCurrentMessages = combinedMessages || [];\n\n await streamValue.submit(\n { messages: [...allCurrentMessages, message] },\n {\n context: { ...identity, ...options?.contextValues },\n streamMode: options?.streamMode || [\"values\", \"messages-tuple\", \"updates\", \"custom\"],\n streamSubgraphs: options?.streamSubgraphs ?? true,\n streamResumable: options?.streamResumable ?? true,\n optimisticValues: (prev) => ({\n ...prev,\n messages: [...allCurrentMessages, message],\n }),\n }\n );\n },\n [streamValue, identity, combinedMessages]\n );\n\n /**\n * Regenerate an AI response by finding the last human message before the specified AI message\n * and resubmitting from that point\n */\n const regenerateMessage = useCallback(\n async (messageId: string) => {\n const allMessages = combinedMessages || [];\n const messageIndex = allMessages.findIndex((msg) => msg.id === messageId);\n\n if (messageIndex === -1) {\n logger.error(\"Message not found for regeneration:\", messageId);\n return;\n }\n\n // Find the last human message before this AI message\n let lastHumanIndex = messageIndex - 1;\n while (lastHumanIndex >= 0 && allMessages[lastHumanIndex].type !== \"human\") {\n lastHumanIndex--;\n }\n\n if (lastHumanIndex === -1) {\n logger.error(\"No human message found before AI message:\", messageId);\n return;\n }\n\n // Get all messages up to and including the last human message\n const messagesToKeep = allMessages.slice(0, lastHumanIndex + 1);\n\n // Remove the last human message from the list since we'll resubmit it\n const messagesBeforeHuman = messagesToKeep.slice(0, -1);\n const humanMessage = messagesToKeep[messagesToKeep.length - 1];\n\n // Clear local messages that came after the human message\n setLocalMessages((prev) =>\n prev.filter((msg) => {\n const msgIndex = allMessages.findIndex((m) => m.id === msg.id);\n return msgIndex < lastHumanIndex;\n })\n );\n\n // Clear local UI that came after the human message \n setLocalUI((prev) =>\n prev.filter((ui) => {\n const msgIndex = allMessages.findIndex((m) => m.id === ui.id);\n return msgIndex < lastHumanIndex;\n })\n );\n\n // Resubmit from the human message\n await streamValue.submit(\n { messages: [...messagesBeforeHuman, humanMessage] },\n {\n streamMode: [\"values\"],\n streamSubgraphs: true,\n streamResumable: true,\n }\n );\n },\n [combinedMessages, streamValue, identity, configuration, setLocalMessages, setLocalUI]\n );\n\n useEffect(() => {\n checkGraphStatus(apiUrl, identity?.authToken).then((ok) => {\n if (!ok) {\n toast.error(\"Failed to connect to LangGraph server\", {\n description: `Unable to reach ${apiUrl}`,\n duration: 10000,\n });\n }\n });\n }, [apiUrl, identity?.authToken]);\n\n const fetchCatalogMemoized = useCallback(async () => {\n // Return cached data if already fetched\n if (catalogFetched && catalogCache !== null) {\n return catalogCache;\n }\n\n // Fetch catalog only once\n if (!catalogFetched) {\n setCatalogFetched(true);\n const data = await fetchCatalog(apiUrl, identity?.authToken);\n setCatalogCache(data);\n return data;\n }\n\n return catalogCache;\n }, [apiUrl, identity?.authToken, catalogFetched, catalogCache]);\n\n const value = useMemo(\n () => ({\n ...streamValue,\n messages: combinedMessages, // Override with combined messages\n values: {\n ...streamValue.values,\n ui: combinedUI, // Override with combined UI\n },\n sendMessage,\n submitMessage,\n regenerateMessage,\n fetchCatalog: fetchCatalogMemoized,\n }),\n [streamValue, combinedMessages, combinedUI, sendMessage, submitMessage, regenerateMessage, fetchCatalogMemoized]\n );\n\n return (\n <StreamContext.Provider value={value}>{children}</StreamContext.Provider>\n );\n};\n\n/**\n * Provides streaming message functionality for real-time AI responses.\n * Manages message state, handles streaming updates, and provides submit/sendMessage functions.\n * \n * @example\n * ```tsx\n * <StreamProvider>\n * <ChatInterface />\n * </StreamProvider>\n * ```\n */\nexport function StreamProvider({ children }: { children: ReactNode }) {\n return <StreamSession>{children}</StreamSession>;\n}\n\n/**\n * Hook to access the streaming context.\n * Provides access to messages, loading state, and functions to submit messages.\n * \n * @throws {Error} If used outside of StreamProvider\n * \n * @example\n * ```tsx\n * const { messages, isLoading, submit, sendMessage } = useStreamContext();\n * ```\n */\nexport function useStreamContext(): StreamContextType {\n const ctx = useContext(StreamContext);\n if (!ctx) {\n throw new Error(\"useStreamContext must be used within StreamProvider\");\n }\n return ctx;\n}"],"names":["useTypedStream","useStream","StreamContext","createContext","checkGraphStatus","apiUrl","authToken","logger","fetchCatalog","res","sleep","ms","resolve","StreamSession","children","assistantId","identity","useChatRuntime","mode","threadId","setThreadId","getThreads","setThreads","configuration","useThread","localMessages","setLocalMessages","useState","localUI","setLocalUI","catalogFetched","setCatalogFetched","catalogCache","setCatalogCache","streamValue","data","options","enrichedMessages","scan","obj","o","m","ak","hasReasoning","hasToolStatus","val","prev","prevMessages","enrichedById","changed","updatedMessages","enriched","enrichedKwargs","event","isUIMessage","isRemoveUIMessage","ui","uiMessageReducer","id","err","sendMessage","useCallback","message","messageId","uuidv4","messageObj","uiWithMessageId","index","currentMessages","mergedContext","combinedMessages","useMemo","allMessages","seen","msg","combinedUI","allUI","key","submitMessage","allCurrentMessages","regenerateMessage","messageIndex","lastHumanIndex","messagesToKeep","messagesBeforeHuman","humanMessage","useEffect","ok","toast","fetchCatalogMemoized","value","jsx","StreamProvider","useStreamContext","ctx","useContext"],"mappings":";;;;;;;;;;AAmCA,MAAMA,KAAiBC,GAyDjBC,IAAgBC,EAA6C,MAAS;AAE5E,eAAeC,GAAiBC,GAAgBC,GAAsC;AACpF,MAAI;AAIF,YAHY,MAAM,MAAM,GAAGD,CAAM,SAAS;AAAA,MACxC,SAASC,IAAY,EAAE,eAAe,UAAUA,CAAS,OAAO;AAAA,IAAA,CACjE,GACU;AAAA,EACb,QAAQ;AACN,IAAAC,EAAO,MAAM,sCAAsC;AAAA,EACrD;AACF;AAEA,eAAeC,GAAaH,GAAgBC,GAAsC;AAChF,MAAI;AACF,UAAMG,IAAM,MAAM,MAAM,GAAGJ,CAAM,mBAAmB;AAAA,MAClD,SAASC,IAAY,EAAE,eAAe,UAAUA,CAAS,OAAO;AAAA,IAAA,CACjE;AACD,WAAIG,EAAI,KACO,MAAMA,EAAI,KAAA,IAGlB;AAAA,EACT,QACM;AACJ,WAAAF,EAAO,MAAM,mCAAmC,GACzC;AAAA,EACT;AACF;AAEA,eAAeG,GAAMC,IAAK,KAAM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,GAAU,SAAS;AAC3D,aAAAiB,EAAgBE,CAAI,GACbA;AAAA,IACT;AAEA,WAAOH;AAAA,EACT,GAAG,CAAC3B,GAAQW,GAAU,WAAWc,GAAgBE,CAAY,CAAC,GAExD0D,IAAQnB;AAAA,IACZ,OAAO;AAAA,MACL,GAAGrC;AAAA,MACH,UAAUoC;AAAA;AAAA,MACV,QAAQ;AAAA,QACN,GAAGpC,EAAY;AAAA,QACf,IAAIyC;AAAA;AAAA,MAAA;AAAA,MAEN,aAAAf;AAAA,MACA,eAAAkB;AAAA,MACA,mBAAAE;AAAA,MACA,cAAcS;AAAA,IAAA;AAAA,IAEhB,CAACvD,GAAaoC,GAAkBK,GAAYf,GAAakB,GAAeE,GAAmBS,CAAoB;AAAA,EAAA;AAGjH,SACE,gBAAAE,EAACzF,EAAc,UAAd,EAAuB,OAAAwF,GAAe,UAAA5E,EAAA,CAAS;AAEpD;AAaO,SAAS8E,GAAe,EAAE,UAAA9E,KAAqC;AACpE,SAAO,gBAAA6E,EAAC9E,MAAe,UAAAC,GAAS;AAClC;AAaO,SAAS+E,KAAsC;AACpD,QAAMC,IAAMC,EAAW7F,CAAa;AACpC,MAAI,CAAC4F;AACH,UAAM,IAAI,MAAM,qDAAqD;AAEvE,SAAOA;AACT;"}
|
|
1
|
+
{"version":3,"file":"Stream.es.js","sources":["../../src/providers/Stream.tsx"],"sourcesContent":["/* @refresh reset */\nimport { useChatRuntime } from \"@/providers/ChatRuntime\";\nimport { logger } from \"@/utils/logger\";\nimport { type AIMessage, type Message } from \"@langchain/langgraph-sdk\";\n\n// Derive the tool-call types from AIMessage since the SDK doesn't re-export them\ntype ToolCall = NonNullable<AIMessage[\"tool_calls\"]>[number];\ntype InvalidToolCall = NonNullable<AIMessage[\"invalid_tool_calls\"]>[number];\nimport { useStream } from \"@langchain/langgraph-sdk/react\";\nimport {\n isRemoveUIMessage,\n isUIMessage,\n type RemoveUIMessage,\n type UIMessage,\n uiMessageReducer,\n} from \"@langchain/langgraph-sdk/react-ui\";\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { toast } from \"sonner\";\nimport { v4 as uuidv4 } from \"uuid\";\nimport { useThread } from \"./Thread\";\n\nexport type TodoItem = {\n id: string;\n content: string;\n status: \"pending\" | \"in_progress\" | \"completed\";\n updatedAt?: string | number | Date;\n run_id?: string;\n runId?: string;\n messageId?: string;\n checkpoint?: string;\n};\n\nexport type StateType = {\n messages: Message[];\n ui?: UIMessage[];\n suggestions?: string[];\n todos?: TodoItem[];\n};\n\nconst useTypedStream = useStream<\n StateType,\n {\n UpdateType: {\n messages?: Message[] | Message | string;\n ui?: (UIMessage | RemoveUIMessage)[] | UIMessage | RemoveUIMessage;\n };\n CustomEventType: UIMessage | RemoveUIMessage;\n }\n>;\n\ntype StreamContextType = ReturnType<typeof useTypedStream> & {\n sendMessage: (\n message: Message | string,\n options?: {\n /** If true, message is meant for agent only (not user-visible) */\n type?: Message[\"type\"];\n /** Name field required for function/tool messages */\n name?: string;\n /** If true, message is hidden from user UI */\n hidden?: boolean;\n /** Tool calls associated with this message */\n tool_calls?: ToolCall[];\n /** Invalid tool calls associated with this message */\n invalid_tool_calls?: InvalidToolCall[];\n /** If provided, use this ID for the message instead of generating one */\n tool_call_id?: string;\n /** Additional kwargs to attach to the message */\n additional_kwargs?: Record<string, unknown>;\n /** UI components to display alongside the message */\n ui?: UIMessage[];\n /** Custom ID for the message (will also be used for UI components) */\n id?: string;\n /** Custom context to override/merge with identity */\n context?: Record<string, unknown>;\n }\n ) => Promise<void>;\n submitMessage: (\n message: Message,\n options?: {\n streamMode?: (\"values\" | \"updates\" | \"messages\" | \"custom\" | \"debug\")[];\n streamSubgraphs?: boolean;\n streamResumable?: boolean;\n contextValues?: Record<string, unknown>;\n }\n ) => Promise<void>;\n regenerateMessage: (messageId: string) => Promise<void>;\n fetchCatalog: () => Promise<unknown>;\n};\n\nconst StreamContext = createContext<StreamContextType | undefined>(undefined);\n\nasync function checkGraphStatus(apiUrl: string, authToken: string | null | undefined) {\n try {\n const res = await fetch(`${apiUrl}/info`, {\n headers: authToken ? { Authorization: `Bearer ${authToken}` } : undefined,\n });\n return res.ok;\n } catch {\n logger.error(\"Failed to initialize LangGraph Agent\");\n }\n}\n\nasync function fetchCatalog(apiUrl: string, authToken: string | null | undefined) {\n try {\n const res = await fetch(`${apiUrl}/agents/catalog`, {\n headers: authToken ? { Authorization: `Bearer ${authToken}` } : undefined,\n });\n if (res.ok) {\n const data = await res.json();\n return data;\n }\n return null;\n }\n catch {\n logger.error(\"Failed to fetch LangGraph Catalog\");\n return null;\n }\n}\n\nasync function sleep(ms = 6000) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nconst StreamSession = ({ children }: { children: ReactNode }) => {\n const { apiUrl, assistantId, identity } = useChatRuntime();\n const { mode, threadId, setThreadId, getThreads, setThreads, configuration } = useThread();\n\n // Store local-only AI messages that shouldn't trigger backend calls\n const [localMessages, setLocalMessages] = useState<Message[]>([]);\n // Store local-only UI components\n const [localUI, setLocalUI] = useState<UIMessage[]>([]);\n // Track if catalog has been fetched to prevent duplicate calls\n const [catalogFetched, setCatalogFetched] = useState(false);\n const [catalogCache, setCatalogCache] = useState<unknown>(null);\n\n const streamValue = useTypedStream({\n apiUrl,\n assistantId,\n threadId: mode === \"multi\" ? threadId : null,\n defaultHeaders: identity?.authToken\n ? { Authorization: `Bearer ${identity?.authToken}` }\n : undefined,\n fetchStateHistory: true,\n onUpdateEvent: (data, options) => {\n // Scan update data (potentially nested by node name) for AI messages\n // with reasoning_content or tool_status in additional_kwargs.\n // Merge these into existing messages so they're available during streaming.\n const enrichedMessages: Message[] = [];\n\n const scan = (obj: unknown) => {\n if (!obj || typeof obj !== \"object\") return;\n const o = obj as Record<string, unknown>;\n if (Array.isArray(o.messages)) {\n for (const m of o.messages as Message[]) {\n const ak = (m as Record<string, unknown>).additional_kwargs as Record<string, unknown> | undefined;\n if (m?.type === \"ai\" && m.id && ak) {\n const hasReasoning = typeof ak.reasoning_content === \"string\" && ak.reasoning_content.length > 0;\n const hasToolStatus = Array.isArray(ak.tool_status) && (ak.tool_status as unknown[]).length > 0;\n if (hasReasoning || hasToolStatus) {\n enrichedMessages.push(m);\n }\n }\n }\n }\n for (const val of Object.values(o)) {\n if (val && typeof val === \"object\" && !Array.isArray(val)) {\n scan(val);\n }\n }\n };\n\n scan(data);\n\n // Scan update data for todos. We track whether the field was present at all\n // (foundTodos !== undefined) vs absent (foundTodos === undefined), so we can\n // distinguish \"event has todos: []\" (preserve previous) from \"event has no\n // todos field\" (don't touch). A non-empty array updates the stored todos.\n // To explicitly clear todos, the backend should send a dedicated signal\n // (e.g. a custom event) rather than relying on an empty array.\n let foundTodos: unknown[] | undefined;\n const scanTodos = (obj: unknown) => {\n if (!obj || typeof obj !== \"object\") return;\n const o = obj as Record<string, unknown>;\n if (\"todos\" in o && Array.isArray(o.todos)) {\n // Prefer non-empty arrays; keep existing foundTodos if we already found one.\n if (o.todos.length > 0 || foundTodos === undefined) {\n foundTodos = o.todos;\n }\n }\n for (const val of Object.values(o)) {\n if (val && typeof val === \"object\" && !Array.isArray(val)) {\n scanTodos(val);\n }\n }\n };\n scanTodos(data);\n\n if (enrichedMessages.length > 0 || foundTodos !== undefined) {\n options.mutate((prev) => {\n let result = prev;\n\n if (enrichedMessages.length > 0) {\n const prevMessages = (result.messages ?? []) as Message[];\n const enrichedById = new Map<string, Message>();\n for (const m of enrichedMessages) {\n if (m.id) enrichedById.set(m.id, m);\n }\n\n let changed = false;\n const updatedMessages = prevMessages.map((m) => {\n if (!m.id || !enrichedById.has(m.id)) return m;\n const enriched = enrichedById.get(m.id)!;\n enrichedById.delete(m.id);\n changed = true;\n const enrichedKwargs = (enriched as Record<string, unknown>).additional_kwargs as Record<string, unknown> | undefined;\n return {\n ...m,\n additional_kwargs: {\n ...(m.additional_kwargs ?? {}),\n ...(enrichedKwargs ?? {}),\n },\n };\n });\n\n if (changed) {\n result = { ...result, messages: updatedMessages };\n }\n }\n\n if (foundTodos !== undefined) {\n // If the event delivered a non-empty array, update; if empty, preserve\n // the previous value so subgraph events that don't own todos don't wipe them.\n if (foundTodos.length > 0) {\n result = { ...result, todos: foundTodos as TodoItem[] };\n }\n // foundTodos.length === 0: field was present but empty — keep prev.todos\n }\n\n return result === prev ? prev : result;\n });\n }\n },\n onCustomEvent: (event, options) => {\n if (isUIMessage(event) || isRemoveUIMessage(event)) {\n options.mutate((prev) => {\n logger.debug(\"UI Event received in StreamProvider:\", event);\n const ui = uiMessageReducer(prev.ui ?? [], event);\n return { ...prev, ui };\n });\n }\n },\n\n onThreadId: (id) => {\n if (!id) return;\n if (mode === \"single\") {\n // lock once\n if (!threadId) setThreadId(id);\n } else {\n // switch freely\n setThreadId(id);\n // Refetch threads list when thread ID changes.\n // Wait for some seconds before fetching so we're able to get the new thread that was created.\n sleep().then(() => getThreads().then(setThreads).catch((err) => logger.error(\"Failed to refresh threads:\", err)));\n }\n },\n });\n\n /**\n * Send a message to the agent programmatically\n * Useful for triggering agent actions without user-visible messages\n * e.g., \"login completed\", \"card clicked: {id}\"\n */\n const sendMessage = useCallback(\n async (\n message: Message | string,\n options?: {\n type?: Message[\"type\"];\n name?: string;\n hidden?: boolean;\n tool_calls?: ToolCall[];\n invalid_tool_calls?: InvalidToolCall[];\n tool_call_id?: string;\n additional_kwargs?: Record<string, unknown>;\n ui?: UIMessage[];\n id?: string; // Allow passing custom ID\n context?: Record<string, unknown>; // Allow passing custom context to override identity\n }\n ) => {\n // Use provided ID or generate new one\n const messageId = options?.id || uuidv4();\n\n const messageObj: Message =\n typeof message === \"string\"\n ? ({\n id: messageId, // Use the determined ID\n type: options?.type ?? \"human\",\n content: message,\n ...(options?.name && { name: options.name }),\n ...(options?.tool_calls && { tool_calls: options.tool_calls }),\n ...(options?.invalid_tool_calls && { invalid_tool_calls: options.invalid_tool_calls }),\n ...(options?.tool_call_id && { tool_call_id: options.tool_call_id }),\n ...((options?.additional_kwargs || options?.hidden) && {\n additional_kwargs: {\n ...(options?.hidden && { hidden: true }),\n ...(options?.additional_kwargs ?? {}),\n }\n }),\n } as Message)\n : {\n ...message,\n id: messageId, // Override with determined ID\n // Allow overriding message fields with options\n ...(options?.tool_calls && { tool_calls: options.tool_calls }),\n ...(options?.additional_kwargs && {\n additional_kwargs: {\n ...message.additional_kwargs,\n ...options.additional_kwargs,\n }\n }),\n };\n\n // console.log(\"Sending message via sendMessage:\", messageObj); → converted to debug log\n logger.debug(\"Sending message via sendMessage:\", messageObj);\n\n // If message type is \"ai\", just append to local state without submitting to agent\n // This is useful for injecting initial messages or system messages that don't need agent processing\n if (options?.type === \"ai\") {\n setLocalMessages((prev) => [...prev, messageObj]);\n logger.debug(\"Appended AI message to localMessages:\", options?.ui);\n // Also store any UI components, linking them to the message id\n if (options.ui && options.ui.length > 0) {\n const uiWithMessageId = options.ui.map((ui, index) => ({\n ...ui,\n id: messageId, // Link to the message ID so CustomComponentRender can find it\n // Ensure each UI component has a unique identifier for React keys\n _key: (ui as UIMessage & { _key?: string })._key || `${messageId}-ui-${index}`,\n })) as UIMessage[];\n setLocalUI((prev) => [...prev, ...uiWithMessageId]);\n }\n return;\n }\n\n // For non-AI messages, submit to the agent\n const currentMessages = streamValue.messages || [];\n // Merge identity with custom context, custom context takes precedence\n const mergedContext = options?.context\n ? { ...identity, ...options.context, ...configuration }\n : identity || {};\n\n await streamValue.submit(\n { messages: [...currentMessages, messageObj] },\n {\n context: mergedContext,\n streamMode: [\"values\", \"messages-tuple\", \"updates\", \"custom\"],\n }\n );\n },\n [streamValue, identity, configuration, setLocalMessages, setLocalUI]\n );\n\n // Combine stream messages with local AI messages, deduplicating by ID\n const combinedMessages = useMemo(() => {\n const allMessages = [...localMessages, ...(streamValue.messages || [])];\n // Deduplicate by message ID, keeping the first occurrence\n const seen = new Set<string>();\n return allMessages.filter(msg => {\n if (!msg.id) return true; // Keep messages without IDs\n if (seen.has(msg.id)) return false;\n seen.add(msg.id);\n return true;\n });\n }, [localMessages, streamValue.messages]);\n\n // Combine local UI with stream UI, deduplicating by unique key\n const combinedUI = useMemo(() => {\n logger.debug(\"Combining local UI with stream UI:\", localUI, streamValue.values?.ui);\n const allUI = [...localUI, ...(streamValue.values?.ui || [])];\n // Deduplicate by _key or id+name combination\n const seen = new Set<string>();\n return allUI.filter(ui => {\n const key = (ui as UIMessage & { _key?: string })._key || `${ui.id}-${ui.name}`;\n if (seen.has(key)) return false;\n seen.add(key);\n return true;\n });\n }, [localUI, streamValue.values?.ui]);\n\n const submitMessage = useCallback(\n async (\n message: Message,\n options?: {\n streamMode?: (\"values\" | \"updates\" | \"messages\" | \"custom\" | \"debug\")[];\n streamSubgraphs?: boolean;\n streamResumable?: boolean;\n contextValues?: Record<string, unknown>;\n }\n ) => {\n // Get ALL current messages (including local AI messages)\n const allCurrentMessages = combinedMessages || [];\n\n await streamValue.submit(\n { messages: [...allCurrentMessages, message] },\n {\n context: { ...identity, ...options?.contextValues },\n streamMode: options?.streamMode || [\"values\", \"messages-tuple\", \"updates\", \"custom\"],\n streamSubgraphs: options?.streamSubgraphs ?? true,\n streamResumable: options?.streamResumable ?? true,\n optimisticValues: (prev) => ({\n ...prev,\n messages: [...allCurrentMessages, message],\n }),\n }\n );\n },\n [streamValue, identity, combinedMessages]\n );\n\n /**\n * Regenerate an AI response by finding the last human message before the specified AI message\n * and resubmitting from that point\n */\n const regenerateMessage = useCallback(\n async (messageId: string) => {\n const allMessages = combinedMessages || [];\n const messageIndex = allMessages.findIndex((msg) => msg.id === messageId);\n\n if (messageIndex === -1) {\n logger.error(\"Message not found for regeneration:\", messageId);\n return;\n }\n\n // Find the last human message before this AI message\n let lastHumanIndex = messageIndex - 1;\n while (lastHumanIndex >= 0 && allMessages[lastHumanIndex].type !== \"human\") {\n lastHumanIndex--;\n }\n\n if (lastHumanIndex === -1) {\n logger.error(\"No human message found before AI message:\", messageId);\n return;\n }\n\n // Get all messages up to and including the last human message\n const messagesToKeep = allMessages.slice(0, lastHumanIndex + 1);\n\n // Remove the last human message from the list since we'll resubmit it\n const messagesBeforeHuman = messagesToKeep.slice(0, -1);\n const humanMessage = messagesToKeep[messagesToKeep.length - 1];\n\n // Clear local messages that came after the human message\n setLocalMessages((prev) =>\n prev.filter((msg) => {\n const msgIndex = allMessages.findIndex((m) => m.id === msg.id);\n return msgIndex < lastHumanIndex;\n })\n );\n\n // Clear local UI that came after the human message \n setLocalUI((prev) =>\n prev.filter((ui) => {\n const msgIndex = allMessages.findIndex((m) => m.id === ui.id);\n return msgIndex < lastHumanIndex;\n })\n );\n\n // Resubmit from the human message\n await streamValue.submit(\n { messages: [...messagesBeforeHuman, humanMessage] },\n {\n streamMode: [\"values\"],\n streamSubgraphs: true,\n streamResumable: true,\n }\n );\n },\n [combinedMessages, streamValue, identity, configuration, setLocalMessages, setLocalUI]\n );\n\n useEffect(() => {\n checkGraphStatus(apiUrl, identity?.authToken).then((ok) => {\n if (!ok) {\n toast.error(\"Failed to connect to LangGraph server\", {\n description: `Unable to reach ${apiUrl}`,\n duration: 10000,\n });\n }\n });\n }, [apiUrl, identity?.authToken]);\n\n const fetchCatalogMemoized = useCallback(async () => {\n // Return cached data if already fetched\n if (catalogFetched && catalogCache !== null) {\n return catalogCache;\n }\n\n // Fetch catalog only once\n if (!catalogFetched) {\n setCatalogFetched(true);\n const data = await fetchCatalog(apiUrl, identity?.authToken);\n setCatalogCache(data);\n return data;\n }\n\n return catalogCache;\n }, [apiUrl, identity?.authToken, catalogFetched, catalogCache]);\n\n const value = useMemo(\n () => ({\n ...streamValue,\n messages: combinedMessages, // Override with combined messages\n values: {\n ...streamValue.values,\n ui: combinedUI, // Override with combined UI\n },\n sendMessage,\n submitMessage,\n regenerateMessage,\n fetchCatalog: fetchCatalogMemoized,\n }),\n [streamValue, combinedMessages, combinedUI, sendMessage, submitMessage, regenerateMessage, fetchCatalogMemoized]\n );\n\n return (\n <StreamContext.Provider value={value}>{children}</StreamContext.Provider>\n );\n};\n\n/**\n * Provides streaming message functionality for real-time AI responses.\n * Manages message state, handles streaming updates, and provides submit/sendMessage functions.\n * \n * @example\n * ```tsx\n * <StreamProvider>\n * <ChatInterface />\n * </StreamProvider>\n * ```\n */\nexport function StreamProvider({ children }: { children: ReactNode }) {\n return <StreamSession>{children}</StreamSession>;\n}\n\n/**\n * Hook to access the streaming context.\n * Provides access to messages, loading state, and functions to submit messages.\n * \n * @throws {Error} If used outside of StreamProvider\n * \n * @example\n * ```tsx\n * const { messages, isLoading, submit, sendMessage } = useStreamContext();\n * ```\n */\nexport function useStreamContext(): StreamContextType {\n const ctx = useContext(StreamContext);\n if (!ctx) {\n throw new Error(\"useStreamContext must be used within StreamProvider\");\n }\n return ctx;\n}"],"names":["useTypedStream","useStream","StreamContext","createContext","checkGraphStatus","apiUrl","authToken","logger","fetchCatalog","res","sleep","ms","resolve","StreamSession","children","assistantId","identity","useChatRuntime","mode","threadId","setThreadId","getThreads","setThreads","configuration","useThread","localMessages","setLocalMessages","useState","localUI","setLocalUI","catalogFetched","setCatalogFetched","catalogCache","setCatalogCache","streamValue","data","options","enrichedMessages","scan","obj","o","m","ak","hasReasoning","hasToolStatus","val","foundTodos","scanTodos","prev","result","prevMessages","enrichedById","changed","updatedMessages","enriched","enrichedKwargs","event","isUIMessage","isRemoveUIMessage","ui","uiMessageReducer","id","err","sendMessage","useCallback","message","messageId","uuidv4","messageObj","uiWithMessageId","index","currentMessages","mergedContext","combinedMessages","useMemo","allMessages","seen","msg","combinedUI","allUI","key","submitMessage","allCurrentMessages","regenerateMessage","messageIndex","lastHumanIndex","messagesToKeep","messagesBeforeHuman","humanMessage","useEffect","ok","toast","fetchCatalogMemoized","value","jsx","StreamProvider","useStreamContext","ctx","useContext"],"mappings":";;;;;;;;;;AA+CA,MAAMA,KAAiBC,GAkDjBC,IAAgBC,EAA6C,MAAS;AAE5E,eAAeC,GAAiBC,GAAgBC,GAAsC;AACpF,MAAI;AAIF,YAHY,MAAM,MAAM,GAAGD,CAAM,SAAS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AGxC;AAAA,MACH,UAAUuC;AAAA;AAAA,MACV,QAAQ;AAAA,QACN,GAAGvC,EAAY;AAAA,QACf,IAAI4C;AAAA;AAAA,MAAA;AAAA,MAEN,aAAAf;AAAA,MACA,eAAAkB;AAAA,MACA,mBAAAE;AAAA,MACA,cAAcS;AAAA,IAAA;AAAA,IAEhB,CAAC1D,GAAauC,GAAkBK,GAAYf,GAAakB,GAAeE,GAAmBS,CAAoB;AAAA,EAAA;AAGjH,SACE,gBAAAE,EAAC5F,EAAc,UAAd,EAAuB,OAAA2F,GAAe,UAAA/E,EAAA,CAAS;AAEpD;AAaO,SAASiF,GAAe,EAAE,UAAAjF,KAAqC;AACpE,SAAO,gBAAAgF,EAACjF,MAAe,UAAAC,GAAS;AAClC;AAaO,SAASkF,KAAsC;AACpD,QAAMC,IAAMC,EAAWhG,CAAa;AACpC,MAAI,CAAC+F;AACH,UAAM,IAAI,MAAM,qDAAqD;AAEvE,SAAOA;AACT;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langgraph-ui-components",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.28",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs.js",
|
|
7
7
|
"module": "./dist/index.es.js",
|
|
@@ -121,6 +121,22 @@
|
|
|
121
121
|
"vite": "^7.2.4",
|
|
122
122
|
"vite-plugin-dts": "^4.5.4"
|
|
123
123
|
},
|
|
124
|
+
"keywords": [
|
|
125
|
+
"langgraph",
|
|
126
|
+
"langgraph-ui",
|
|
127
|
+
"react",
|
|
128
|
+
"chat-ui",
|
|
129
|
+
"ai-components",
|
|
130
|
+
"chatbot",
|
|
131
|
+
"sidebar",
|
|
132
|
+
"streaming",
|
|
133
|
+
"langchain",
|
|
134
|
+
"assistant",
|
|
135
|
+
"chatgpt-ui",
|
|
136
|
+
"human-in-the-loop",
|
|
137
|
+
"hitl",
|
|
138
|
+
"generative-ui"
|
|
139
|
+
],
|
|
124
140
|
"sideEffects": [
|
|
125
141
|
"**/*.css"
|
|
126
142
|
],
|
package/src/App.tsx
CHANGED
|
@@ -27,8 +27,8 @@ function ChatWrapper({ children }: { children?: React.ReactNode }) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
return (<>
|
|
30
|
-
|
|
31
|
-
<Chat textToSpeechVoice={textToSpeechVoice} />
|
|
30
|
+
<Sidebar supportChatHistory={true} textToSpeechVoice={textToSpeechVoice} />
|
|
31
|
+
{/* <Chat textToSpeechVoice={textToSpeechVoice} /> */}
|
|
32
32
|
{children}
|
|
33
33
|
</>
|
|
34
34
|
)
|
|
@@ -40,12 +40,12 @@ function App() {
|
|
|
40
40
|
user_id: "68f3b3ba4ce23e5b582b7780",
|
|
41
41
|
org_id: "1",
|
|
42
42
|
quote_id: "695b5cfcc4d07dc56f093d92",
|
|
43
|
-
authToken: "
|
|
43
|
+
authToken: "xQpz7LPUqh5nArwn8Boam6JpJX2BOXf4NDcJ9kEEuWc",
|
|
44
44
|
});
|
|
45
45
|
return (
|
|
46
46
|
<React.Suspense fallback={<div>Loading (layout)...</div>}>
|
|
47
47
|
<ChatRuntimeProvider
|
|
48
|
-
apiUrl={"https://
|
|
48
|
+
apiUrl={"https://agents.3ya.io"}
|
|
49
49
|
assistantId={"chat_agent"}
|
|
50
50
|
// apiUrl={"https://agents.3ya.io"}
|
|
51
51
|
// assistantId={"v3ya_external_agent"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { parsePartialJson } from "@langchain/core/output_parsers";
|
|
2
1
|
import { useStreamContext } from "@/providers/Stream";
|
|
3
2
|
import { useCustomComponents } from "@/providers/CustomComponentProvider";
|
|
4
3
|
import type { chatBodyProps } from "@/types/ChatProps";
|
|
5
4
|
import { logger } from "@/utils/logger";
|
|
6
5
|
import { isAiWithToolCalls, isToolMessage } from "@/utils/utils";
|
|
7
|
-
import type {
|
|
6
|
+
import type { Message } from "@langchain/langgraph-sdk";
|
|
7
|
+
import type { TodoItem } from "@/providers/Stream";
|
|
8
8
|
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
9
9
|
import AgentMessage from "./messages/AgentMessage";
|
|
10
10
|
import CustomComponentRender from "./messages/CustomComponentRender";
|
|
@@ -26,9 +26,67 @@ export default function ChatBody({ setIsFirstMessage, enableToolCallIndicator =
|
|
|
26
26
|
// Memoize messages with stable reference
|
|
27
27
|
const memoMessages = useMemo(() => messages ?? [], [messages]);
|
|
28
28
|
|
|
29
|
+
const uiMessageIds = useMemo(() => {
|
|
30
|
+
const ids = new Set<string>();
|
|
31
|
+
const uiMessages = stream.values?.ui;
|
|
32
|
+
if (!Array.isArray(uiMessages)) return ids;
|
|
33
|
+
|
|
34
|
+
for (const ui of uiMessages) {
|
|
35
|
+
const uiObj = ui as unknown as Record<string, unknown>;
|
|
36
|
+
const metadata =
|
|
37
|
+
uiObj.metadata && typeof uiObj.metadata === "object"
|
|
38
|
+
? (uiObj.metadata as Record<string, unknown>)
|
|
39
|
+
: undefined;
|
|
40
|
+
|
|
41
|
+
const candidates = [
|
|
42
|
+
typeof uiObj.id === "string" ? uiObj.id : undefined,
|
|
43
|
+
typeof metadata?.id === "string" ? metadata.id : undefined,
|
|
44
|
+
typeof metadata?.message_id === "string" ? metadata.message_id : undefined,
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
for (const candidate of candidates) {
|
|
48
|
+
if (candidate) ids.add(candidate);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return ids;
|
|
53
|
+
}, [stream.values?.ui]);
|
|
54
|
+
|
|
29
55
|
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
30
56
|
const prevMessageCountRef = useRef(0);
|
|
31
57
|
const shouldAutoScrollRef = useRef(true);
|
|
58
|
+
const frozenTodosByGroupRef = useRef<Map<string, TodoItem[]>>(new Map());
|
|
59
|
+
|
|
60
|
+
const normalizeTodos = useCallback((todos: unknown): TodoItem[] => {
|
|
61
|
+
if (!Array.isArray(todos)) return [];
|
|
62
|
+
|
|
63
|
+
return todos
|
|
64
|
+
.map((todo, index) => {
|
|
65
|
+
if (!todo || typeof todo !== "object") return null;
|
|
66
|
+
const t = todo as Record<string, unknown>;
|
|
67
|
+
const status = t.status;
|
|
68
|
+
if (
|
|
69
|
+
typeof t.content !== "string" ||
|
|
70
|
+
(status !== "pending" && status !== "in_progress" && status !== "completed")
|
|
71
|
+
) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
id: t.id && typeof t.id === "string" ? t.id : `todo-${index}`,
|
|
77
|
+
content: t.content,
|
|
78
|
+
status,
|
|
79
|
+
updatedAt: t.updatedAt instanceof Date || typeof t.updatedAt === "string" || typeof t.updatedAt === "number"
|
|
80
|
+
? (t.updatedAt as string | number | Date)
|
|
81
|
+
: undefined,
|
|
82
|
+
run_id: typeof t.run_id === "string" ? t.run_id : undefined,
|
|
83
|
+
runId: typeof t.runId === "string" ? t.runId : undefined,
|
|
84
|
+
messageId: typeof t.messageId === "string" ? t.messageId : undefined,
|
|
85
|
+
checkpoint: typeof t.checkpoint === "string" ? t.checkpoint : undefined,
|
|
86
|
+
} as TodoItem;
|
|
87
|
+
})
|
|
88
|
+
.filter((todo): todo is TodoItem => todo !== null);
|
|
89
|
+
}, []);
|
|
32
90
|
|
|
33
91
|
// Handler for message feedback
|
|
34
92
|
const handleFeedback = useCallback((messageId: string, feedback: MessageFeedback) => {
|
|
@@ -62,7 +120,11 @@ export default function ChatBody({ setIsFirstMessage, enableToolCallIndicator =
|
|
|
62
120
|
|
|
63
121
|
// Handler for HITL interrupt responses
|
|
64
122
|
const handleInterruptRespond = useCallback((response: any) => {
|
|
65
|
-
stream.submit(null, {
|
|
123
|
+
stream.submit(null, {
|
|
124
|
+
command: { resume: response },
|
|
125
|
+
streamMode: ["values", "messages-tuple", "updates", "custom"],
|
|
126
|
+
streamSubgraphs: true,
|
|
127
|
+
});
|
|
66
128
|
}, [stream]);
|
|
67
129
|
|
|
68
130
|
// Build interrupt actions for custom renderers
|
|
@@ -102,34 +164,6 @@ export default function ChatBody({ setIsFirstMessage, enableToolCallIndicator =
|
|
|
102
164
|
};
|
|
103
165
|
}, [stream.interrupt, handleInterruptRespond]);
|
|
104
166
|
|
|
105
|
-
const getToolCallsFromContent = useCallback((content: Message["content"]): AIMessage["tool_calls"] => {
|
|
106
|
-
if (!Array.isArray(content)) return [];
|
|
107
|
-
const toolCallContents = content.filter(
|
|
108
|
-
(c) => typeof c === "object" && c !== null && (c as any).type === "tool_use" && (c as any).id,
|
|
109
|
-
) as Array<Record<string, any>>;
|
|
110
|
-
|
|
111
|
-
return toolCallContents.map((tc) => {
|
|
112
|
-
let args: Record<string, any> = {};
|
|
113
|
-
if (tc?.input) {
|
|
114
|
-
if (typeof tc.input === "string") {
|
|
115
|
-
try {
|
|
116
|
-
args = parsePartialJson(tc.input) ?? {};
|
|
117
|
-
} catch {
|
|
118
|
-
args = {};
|
|
119
|
-
}
|
|
120
|
-
} else if (typeof tc.input === "object") {
|
|
121
|
-
args = tc.input as Record<string, any>;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return {
|
|
125
|
-
name: tc.name ?? "",
|
|
126
|
-
id: tc.id ?? "",
|
|
127
|
-
args,
|
|
128
|
-
type: "tool_call",
|
|
129
|
-
};
|
|
130
|
-
});
|
|
131
|
-
}, []);
|
|
132
|
-
|
|
133
167
|
// Get the parent scroll container
|
|
134
168
|
const getScrollContainer = useCallback(() => {
|
|
135
169
|
if (containerRef.current) {
|
|
@@ -163,6 +197,8 @@ export default function ChatBody({ setIsFirstMessage, enableToolCallIndicator =
|
|
|
163
197
|
|
|
164
198
|
// Use message id or fallback to index for key
|
|
165
199
|
const msgKey = msg.id ?? `msg-${index}`;
|
|
200
|
+
const hasCustomComponentForMessage = (message: Message) =>
|
|
201
|
+
typeof message.id === "string" && uiMessageIds.has(message.id);
|
|
166
202
|
|
|
167
203
|
if (msg.type === "human") {
|
|
168
204
|
return <HumanMessage key={msgKey} message={msg} fontSize={chatBodyProps?.fontSize} />;
|
|
@@ -182,8 +218,12 @@ export default function ChatBody({ setIsFirstMessage, enableToolCallIndicator =
|
|
|
182
218
|
}
|
|
183
219
|
|
|
184
220
|
if (prevIndex >= 0 && messagesArray[prevIndex].type === "ai") {
|
|
185
|
-
//
|
|
186
|
-
|
|
221
|
+
// Only render separately if THIS message owns custom UI (needs its own group).
|
|
222
|
+
// Otherwise it was already consumed by the previous group's forward scan.
|
|
223
|
+
const currentHasCustomUi = hasCustomComponentForMessage(msg);
|
|
224
|
+
if (!currentHasCustomUi) {
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
187
227
|
}
|
|
188
228
|
}
|
|
189
229
|
|
|
@@ -197,6 +237,11 @@ export default function ChatBody({ setIsFirstMessage, enableToolCallIndicator =
|
|
|
197
237
|
groupedTimelineMessages.push(nextMsg);
|
|
198
238
|
nextIndex++;
|
|
199
239
|
} else if (nextMsg.type === "ai") {
|
|
240
|
+
if (hasCustomComponentForMessage(nextMsg)) {
|
|
241
|
+
// Sub-agent/custom UI messages should be rendered in their own section
|
|
242
|
+
// to avoid parent-bubble flicker and reparenting during streaming.
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
200
245
|
groupedTimelineMessages.push(nextMsg);
|
|
201
246
|
nextIndex++;
|
|
202
247
|
} else {
|
|
@@ -206,23 +251,42 @@ export default function ChatBody({ setIsFirstMessage, enableToolCallIndicator =
|
|
|
206
251
|
}
|
|
207
252
|
|
|
208
253
|
const groupedAiMessages = groupedTimelineMessages.filter((m) => m.type === "ai");
|
|
209
|
-
const toolMessages = groupedTimelineMessages.filter((m) => isToolMessage(m));
|
|
210
254
|
|
|
211
|
-
// Merge content from all AI messages, preserving
|
|
255
|
+
// Merge content from all AI messages, preserving reasoning blocks.
|
|
256
|
+
// Deduplicate identical text content (subgraph messages can duplicate parent messages).
|
|
212
257
|
const hasArrayContent = groupedAiMessages.some((m) => Array.isArray(m.content));
|
|
258
|
+
const seenTexts = new Set<string>();
|
|
213
259
|
const mergedContent: Message["content"] = hasArrayContent
|
|
214
260
|
? groupedAiMessages.flatMap((m) => {
|
|
215
|
-
if (Array.isArray(m.content))
|
|
216
|
-
|
|
261
|
+
if (Array.isArray(m.content)) {
|
|
262
|
+
return (m.content as any[]).filter((block: any) => {
|
|
263
|
+
if (block.type === "text" && typeof block.text === "string") {
|
|
264
|
+
if (seenTexts.has(block.text)) return false;
|
|
265
|
+
seenTexts.add(block.text);
|
|
266
|
+
}
|
|
267
|
+
return true;
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
if (typeof m.content === "string" && m.content.length > 0) {
|
|
271
|
+
if (seenTexts.has(m.content)) return [];
|
|
272
|
+
seenTexts.add(m.content);
|
|
217
273
|
return [{ type: "text", text: m.content }];
|
|
274
|
+
}
|
|
218
275
|
return [];
|
|
219
276
|
})
|
|
220
|
-
:
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
277
|
+
: (() => {
|
|
278
|
+
const unique: string[] = [];
|
|
279
|
+
for (const m of groupedAiMessages) {
|
|
280
|
+
const text = typeof m.content === "string" ? m.content : "";
|
|
281
|
+
if (text && !seenTexts.has(text)) {
|
|
282
|
+
seenTexts.add(text);
|
|
283
|
+
unique.push(text);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return unique.join("\n\n");
|
|
287
|
+
})();
|
|
224
288
|
|
|
225
|
-
// Extract plain-text portion for legacy checks
|
|
289
|
+
// Extract plain-text portion for legacy checks
|
|
226
290
|
const combinedContent = hasArrayContent
|
|
227
291
|
? (mergedContent as any[])
|
|
228
292
|
.map((c: any) => (c.type === "text" ? (c.text as string) : ""))
|
|
@@ -230,13 +294,6 @@ export default function ChatBody({ setIsFirstMessage, enableToolCallIndicator =
|
|
|
230
294
|
.join(" ")
|
|
231
295
|
: (mergedContent as string);
|
|
232
296
|
|
|
233
|
-
const toolCallsFromContent = groupedAiMessages
|
|
234
|
-
.flatMap((m) => {
|
|
235
|
-
const calls = getToolCallsFromContent(m.content);
|
|
236
|
-
return calls || [];
|
|
237
|
-
})
|
|
238
|
-
.filter((tc): tc is NonNullable<typeof tc> => tc != null && tc !== undefined);
|
|
239
|
-
|
|
240
297
|
// Create a combined message object preserving full content (including thinking blocks)
|
|
241
298
|
const combinedMessage = {
|
|
242
299
|
...msg,
|
|
@@ -259,26 +316,64 @@ export default function ChatBody({ setIsFirstMessage, enableToolCallIndicator =
|
|
|
259
316
|
const ak = (m as Record<string, unknown>).additional_kwargs as Record<string, unknown> | undefined;
|
|
260
317
|
return typeof ak?.reasoning_content === "string" && (ak.reasoning_content as string).length > 0;
|
|
261
318
|
});
|
|
319
|
+
|
|
262
320
|
const hasKwargsToolStatus = groupedAiMessages.some((m) => {
|
|
263
321
|
const ak = (m as Record<string, unknown>).additional_kwargs as Record<string, unknown> | undefined;
|
|
264
322
|
return Array.isArray(ak?.tool_status) && (ak.tool_status as unknown[]).length > 0;
|
|
265
323
|
});
|
|
266
|
-
|
|
267
|
-
const hasToolCalls =
|
|
324
|
+
const hasToolMessages = groupedTimelineMessages.some((m) => isToolMessage(m));
|
|
325
|
+
const hasToolCalls = enableToolCallIndicator && (
|
|
268
326
|
groupedAiMessages.some((m) => isAiWithToolCalls(m)) ||
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
327
|
+
hasKwargsToolStatus ||
|
|
328
|
+
hasToolMessages
|
|
329
|
+
);
|
|
273
330
|
const hasAnyDisplayableContent =
|
|
274
331
|
!!combinedContent ||
|
|
275
332
|
hasThinkingContent ||
|
|
276
333
|
hasKwargsReasoning ||
|
|
277
|
-
|
|
334
|
+
hasToolCalls;
|
|
278
335
|
|
|
279
336
|
const isLastMessageGroup = nextIndex >= messagesArray.length;
|
|
280
337
|
const isStreamingThisMessage = isLoading && isLastMessageGroup;
|
|
281
338
|
|
|
339
|
+
const groupKey = groupedAiMessages
|
|
340
|
+
.map((m) => m.id)
|
|
341
|
+
.filter((id): id is string => typeof id === "string" && id.length > 0)
|
|
342
|
+
.join("|") || msgKey;
|
|
343
|
+
|
|
344
|
+
const todosForGroup = (() => {
|
|
345
|
+
const frozen = frozenTodosByGroupRef.current.get(groupKey);
|
|
346
|
+
if (!isStreamingThisMessage && frozen && frozen.length > 0) {
|
|
347
|
+
return frozen;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if (isStreamingThisMessage) {
|
|
351
|
+
const live = normalizeTodos(stream.values?.todos);
|
|
352
|
+
if (live.length > 0) {
|
|
353
|
+
frozenTodosByGroupRef.current.set(groupKey, live);
|
|
354
|
+
return live;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
for (let i = groupedAiMessages.length - 1; i >= 0; i--) {
|
|
359
|
+
const aiMeta = stream.getMessagesMetadata(groupedAiMessages[i]);
|
|
360
|
+
const aiValues = aiMeta?.firstSeenState?.values as { todos?: unknown } | undefined;
|
|
361
|
+
const snapshot = normalizeTodos(aiValues?.todos);
|
|
362
|
+
if (snapshot.length > 0) {
|
|
363
|
+
if (!frozen || frozen.length === 0) {
|
|
364
|
+
frozenTodosByGroupRef.current.set(groupKey, snapshot);
|
|
365
|
+
}
|
|
366
|
+
return frozen ?? snapshot;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
if (frozen && frozen.length > 0) {
|
|
371
|
+
return frozen;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return [];
|
|
375
|
+
})();
|
|
376
|
+
|
|
282
377
|
// Show Thinking animation whenever streaming with no displayable content yet (plain chat or tool-call)
|
|
283
378
|
const showThinkingIndicator = isStreamingThisMessage && !hasAnyDisplayableContent;
|
|
284
379
|
|
|
@@ -293,7 +388,6 @@ export default function ChatBody({ setIsFirstMessage, enableToolCallIndicator =
|
|
|
293
388
|
<AgentMessage
|
|
294
389
|
agentName={chatBodyProps?.agentName}
|
|
295
390
|
fontSize={chatBodyProps?.fontSize}
|
|
296
|
-
// agentAvatarUrl={chatBodyProps?.agentAvatarUrl}
|
|
297
391
|
message={combinedMessage}
|
|
298
392
|
groupedMessages={groupedTimelineMessages}
|
|
299
393
|
showToolActivity={enableToolCallIndicator}
|
|
@@ -304,6 +398,7 @@ export default function ChatBody({ setIsFirstMessage, enableToolCallIndicator =
|
|
|
304
398
|
branch={meta?.branch}
|
|
305
399
|
branchOptions={meta?.branchOptions}
|
|
306
400
|
onBranchSelect={handleBranchSelect}
|
|
401
|
+
todos={todosForGroup}
|
|
307
402
|
/>
|
|
308
403
|
)}
|
|
309
404
|
{/* 3. Custom component (from all messages in the group) */}
|
|
@@ -312,7 +407,7 @@ export default function ChatBody({ setIsFirstMessage, enableToolCallIndicator =
|
|
|
312
407
|
))}
|
|
313
408
|
</React.Fragment>
|
|
314
409
|
);
|
|
315
|
-
}, [isLoading, stream, enableToolCallIndicator, handleRegenerate, messageFeedback, handleFeedback, handleBranchSelect]);
|
|
410
|
+
}, [isLoading, stream, normalizeTodos, enableToolCallIndicator, handleRegenerate, messageFeedback, handleFeedback, handleBranchSelect, uiMessageIds]);
|
|
316
411
|
|
|
317
412
|
// Memoize the rendered messages array
|
|
318
413
|
const renderedMessages = useMemo(() => {
|
|
@@ -409,6 +504,11 @@ export default function ChatBody({ setIsFirstMessage, enableToolCallIndicator =
|
|
|
409
504
|
<>
|
|
410
505
|
{renderedMessages}
|
|
411
506
|
{/* Show HITL interrupt card when agent is paused for approval */}
|
|
507
|
+
{/* Show thinking indicator when loading and last message is human (no AI response yet) */}
|
|
508
|
+
{isLoading && memoMessages.length > 0 &&
|
|
509
|
+
memoMessages[memoMessages.length - 1].type === "human" && (
|
|
510
|
+
<Thinking />
|
|
511
|
+
)}
|
|
412
512
|
{!isLoading && stream.interrupt && interruptActions && (() => {
|
|
413
513
|
const payload = stream.interrupt.value as any;
|
|
414
514
|
const toolName = payload?.actionRequests?.[0]?.name;
|
|
@@ -416,15 +516,6 @@ export default function ChatBody({ setIsFirstMessage, enableToolCallIndicator =
|
|
|
416
516
|
if (!InterruptComponent) return null;
|
|
417
517
|
return <InterruptComponent interrupt={payload} actions={interruptActions} />;
|
|
418
518
|
})()}
|
|
419
|
-
{/* Show thinking indicator when loading and no AI response has started yet */}
|
|
420
|
-
{isLoading && memoMessages.length > 0 && (() => {
|
|
421
|
-
const lastMsg = memoMessages[memoMessages.length - 1];
|
|
422
|
-
// Show if last message is human or if last AI has no content (only tool calls)
|
|
423
|
-
return lastMsg.type === "human" ||
|
|
424
|
-
(lastMsg.type === "ai" && !lastMsg.content && isAiWithToolCalls(lastMsg));
|
|
425
|
-
})() && (
|
|
426
|
-
<Thinking />
|
|
427
|
-
)}
|
|
428
519
|
</>
|
|
429
520
|
)}
|
|
430
521
|
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { TodoItem } from "@/providers/Stream";
|
|
2
|
+
import { CheckCircle2, Circle, Loader2, Sparkles } from "lucide-react";
|
|
3
|
+
|
|
4
|
+
const statusConfig = {
|
|
5
|
+
completed: {
|
|
6
|
+
icon: CheckCircle2,
|
|
7
|
+
iconClass: "text-emerald-400",
|
|
8
|
+
textClass: "text-zinc-400 line-through",
|
|
9
|
+
},
|
|
10
|
+
in_progress: {
|
|
11
|
+
icon: Loader2,
|
|
12
|
+
iconClass: "text-blue-400 animate-spin",
|
|
13
|
+
textClass: "text-zinc-100",
|
|
14
|
+
},
|
|
15
|
+
pending: {
|
|
16
|
+
icon: Circle,
|
|
17
|
+
iconClass: "text-zinc-500",
|
|
18
|
+
textClass: "text-zinc-400",
|
|
19
|
+
},
|
|
20
|
+
} as const;
|
|
21
|
+
|
|
22
|
+
export default function TodoList({ todos }: { todos: TodoItem[] }) {
|
|
23
|
+
if (!todos.length) return null;
|
|
24
|
+
|
|
25
|
+
const completed = todos.filter((t) => t.status === "completed").length;
|
|
26
|
+
const inProgress = todos.find((t) => t.status === "in_progress");
|
|
27
|
+
const percentage = Math.round((completed / todos.length) * 100);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div className="mb-3 w-full max-w-full rounded-2xl border border-zinc-700/60 bg-zinc-950/35 px-4 py-3.5 shadow-[0_10px_30px_rgba(0,0,0,0.25)] backdrop-blur-sm">
|
|
31
|
+
<div className="mb-3 flex items-start justify-between gap-3">
|
|
32
|
+
<div className="min-w-0">
|
|
33
|
+
<div className="flex items-center gap-2 text-zinc-200">
|
|
34
|
+
<Sparkles className="h-3.5 w-3.5 text-cyan-300/90" />
|
|
35
|
+
<span className="text-xs font-semibold uppercase tracking-[0.14em] text-zinc-300">Agent Plan</span>
|
|
36
|
+
</div>
|
|
37
|
+
<p className="mt-1 truncate text-xs text-zinc-400">
|
|
38
|
+
{inProgress ? `Now: ${inProgress.content}` : "Wrapping up remaining steps"}
|
|
39
|
+
</p>
|
|
40
|
+
</div>
|
|
41
|
+
<div className="rounded-lg border border-zinc-700/80 bg-zinc-900/70 px-2.5 py-1 text-[11px] font-medium text-zinc-300">
|
|
42
|
+
{completed}/{todos.length} done
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div className="mb-3 h-1.5 overflow-hidden rounded-full bg-zinc-800/80">
|
|
47
|
+
<div
|
|
48
|
+
className="h-full rounded-full bg-linear-to-r from-cyan-400 to-emerald-400 transition-all duration-500"
|
|
49
|
+
style={{ width: `${percentage}%` }}
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<ul className="space-y-1.5">
|
|
54
|
+
{todos.map((todo) => {
|
|
55
|
+
const config = statusConfig[todo.status];
|
|
56
|
+
const Icon = config.icon;
|
|
57
|
+
return (
|
|
58
|
+
<li
|
|
59
|
+
key={todo.id}
|
|
60
|
+
className="group flex items-center gap-2 rounded-lg border border-zinc-800/80 bg-zinc-900/45 px-2.5 py-2 transition-colors duration-200 hover:border-zinc-700/80"
|
|
61
|
+
>
|
|
62
|
+
<Icon className={`h-3.5 w-3.5 flex-shrink-0 ${config.iconClass}`} />
|
|
63
|
+
<span className={`line-clamp-1 text-xs ${config.textClass}`}>
|
|
64
|
+
{todo.content}
|
|
65
|
+
</span>
|
|
66
|
+
</li>
|
|
67
|
+
);
|
|
68
|
+
})}
|
|
69
|
+
</ul>
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
}
|