@langgraph-js/sdk 1.10.1 → 1.10.2

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/TestKit.d.ts CHANGED
@@ -66,11 +66,12 @@ export declare class TestLangGraphChat {
66
66
  checkAllTask(messages: readonly RenderMessage[], options?: {
67
67
  skipLengthCheck?: boolean;
68
68
  }): void;
69
+ private readited;
69
70
  /**
70
71
  * @zh 准备测试环境,初始化客户端连接
71
72
  * @en Prepare test environment, initialize client connection
72
73
  */
73
- ready(): Promise<import("./LangGraphClient.js").LangGraphClient>;
74
+ ready(): Promise<import("./LangGraphClient.js").LangGraphClient> | undefined;
74
75
  /**
75
76
  * @zh 模拟人类输入消息并等待测试任务完成,这是测试的核心方法
76
77
  * @en Simulate human input and wait for test tasks to complete, this is the core test method
package/dist/TestKit.js CHANGED
@@ -26,6 +26,7 @@ export class TestLangGraphChat {
26
26
  this.lastLength = 0;
27
27
  /** 待处理的测试任务列表 */
28
28
  this.processFunc = [];
29
+ this.readited = false;
29
30
  this.debug = (_a = options.debug) !== null && _a !== void 0 ? _a : false;
30
31
  options.tools && this.addTools(options.tools);
31
32
  const renderMessages = this.store.data.renderMessages;
@@ -92,6 +93,10 @@ export class TestLangGraphChat {
92
93
  * @en Prepare test environment, initialize client connection
93
94
  */
94
95
  ready() {
96
+ if (this.readited) {
97
+ return;
98
+ }
99
+ this.readited = true;
95
100
  return this.store.mutations.initClient();
96
101
  }
97
102
  /**
@@ -121,7 +126,9 @@ export class TestLangGraphChat {
121
126
  content: text,
122
127
  },
123
128
  ])
124
- .then(() => {
129
+ .then(async () => {
130
+ // messages 有 10 ms 的 debounce,我们需要稍等一下
131
+ await new Promise((resolve) => setTimeout(resolve, 20));
125
132
  this.checkAllTask(this.getMessages(), {
126
133
  skipLengthCheck: true,
127
134
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langgraph-js/sdk",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "description": "The UI SDK for LangGraph - seamlessly integrate your AI agents with frontend interfaces",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/TestKit.ts CHANGED
@@ -117,11 +117,16 @@ export class TestLangGraphChat {
117
117
  }
118
118
  }
119
119
 
120
+ private readited = false
120
121
  /**
121
122
  * @zh 准备测试环境,初始化客户端连接
122
123
  * @en Prepare test environment, initialize client connection
123
124
  */
124
125
  ready() {
126
+ if (this.readited) {
127
+ return
128
+ }
129
+ this.readited = true
125
130
  return this.store.mutations.initClient();
126
131
  }
127
132
 
@@ -152,7 +157,9 @@ export class TestLangGraphChat {
152
157
  content: text,
153
158
  },
154
159
  ])
155
- .then(() => {
160
+ .then(async () => {
161
+ // messages 有 10 ms 的 debounce,我们需要稍等一下
162
+ await new Promise((resolve) => setTimeout(resolve, 20));
156
163
  this.checkAllTask(this.getMessages(), {
157
164
  skipLengthCheck: true,
158
165
  });