@vegintech/langchain-react-agent 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -2,8 +2,9 @@ import * as react from "react";
2
2
  import React$1, { ReactNode } from "react";
3
3
  import { ThoughtChainItemProps } from "@ant-design/x";
4
4
  import { Components } from "streamdown";
5
+ import * as _langchain_langgraph_sdk_react0 from "@langchain/langgraph-sdk/react";
5
6
  import { BaseNode, InsertPosition, NodeRender, SenderProps, SkillType, SlotConfigType } from "@ant-design/x/es/sender/interface.ts";
6
- import { Message, Thread } from "@langchain/langgraph-sdk";
7
+ import { Message } from "@langchain/langgraph-sdk";
7
8
 
8
9
  //#region src/types.d.ts
9
10
  /** ToolCard 组件 Props */
@@ -246,7 +247,19 @@ interface AgentChatRef {
246
247
  clearInput: () => void;
247
248
  /** 聚焦输入框 */
248
249
  focusInput: () => void;
249
- createThread: () => Promise<Thread>;
250
+ /**
251
+ * LangGraph Stream 实例
252
+ * 提供对底层流式连接的完整访问,包括:
253
+ * - messages: 当前消息列表
254
+ * - values: Agent 状态值
255
+ * - isLoading: 是否正在加载
256
+ * - submit: 提交消息
257
+ * - stop: 停止流
258
+ * - interrupt: 中断事件
259
+ * - client: LangGraph 客户端(可通过 client.threads.create() 创建新线程)
260
+ * 等完整功能
261
+ */
262
+ stream: ReturnType<typeof _langchain_langgraph_sdk_react0.useStream> | null;
250
263
  }
251
264
  /** Streamdown 安全过滤配置 */
252
265
  interface StreamdownSecurityConfig {
package/dist/index.mjs CHANGED
@@ -1377,9 +1377,9 @@ const AgentChat = forwardRef(({ apiUrl, assistantId, headers, threadId, onThread
1377
1377
  useImperativeHandle(ref, () => ({
1378
1378
  input: chatInputRef.current,
1379
1379
  setSkill: (skill) => chatInputRef.current?.setSkill?.(skill),
1380
- createThread: () => stream.client.threads.create(),
1381
1380
  clearInput: () => chatInputRef.current?.clear?.(),
1382
- focusInput: () => chatInputRef.current?.focus?.()
1381
+ focusInput: () => chatInputRef.current?.focus?.(),
1382
+ stream
1383
1383
  }));
1384
1384
  useEffect(() => {
1385
1385
  if (stream.values && onAgentStateChange) onAgentStateChange(stream.values);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vegintech/langchain-react-agent",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "LangChain Agent UI component library for React",
5
5
  "license": "MIT",
6
6
  "files": [