agents-vue 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## v0.2.1
5
+
6
+ [compare changes](https://github.com/ymansurozer/agents-vue/compare/v0.2.0...v0.2.1)
7
+
8
+ ### 🩹 Fixes
9
+
10
+ - Serialize reconnect resume re-probes (parity with agents 0.17.2, #1837) ([#1837](https://github.com/ymansurozer/agents-vue/issues/1837))
11
+
12
+ ### ❤️ Contributors
13
+
14
+ - Ymansurozer <ymansurozer@gmail.com>
15
+
4
16
  ## v0.2.0
5
17
 
6
18
  [compare changes](https://github.com/ymansurozer/agents-vue/compare/v0.1.0...v0.2.0)
package/README.md CHANGED
@@ -165,6 +165,7 @@ const transport = new WebSocketChatTransport({
165
165
  | `cancelOnClientAbort` (local-only abort, default) | ✅ |
166
166
  | Pre-stream `cf_agent_stream_pending` (extended resume probe) | ✅ |
167
167
  | `connectionError` (terminal WebSocket close) | ✅ |
168
+ | Reconnect resume serialization (in-flight gate, `agents` 0.17.2 / #1837) | ✅ |
168
169
  | `useAgent` connection hook | 🚧 roadmap |
169
170
  | Initial-message HTTP cache | 🚧 roadmap |
170
171
  | `isServerStreaming` / `isStreaming` flags | 🚧 roadmap |
@@ -174,7 +175,7 @@ const transport = new WebSocketChatTransport({
174
175
  ```bash
175
176
  pnpm install
176
177
  pnpm exec playwright install chromium
177
- pnpm test # 79 tests in chromium (vitest-browser-vue)
178
+ pnpm test # 80 tests in chromium (vitest-browser-vue)
178
179
  pnpm typecheck
179
180
  pnpm lint
180
181
  pnpm build
package/dist/index.mjs CHANGED
@@ -615,6 +615,8 @@ function useAgentChat(options) {
615
615
  const fallbackAckedResumeRequestIds = /* @__PURE__ */ new Set();
616
616
  let streamState = { status: "idle" };
617
617
  let isResumingToolContinuation = false;
618
+ let resumeInFlight = false;
619
+ let resumeGeneration = 0;
618
620
  const isRecovering = ref(false);
619
621
  const connectionError = ref(null);
620
622
  const socket = new AgentClient({
@@ -826,8 +828,16 @@ function useAgentChat(options) {
826
828
  socket.addEventListener("open", (event) => {
827
829
  connectionError.value = null;
828
830
  options.onOpen?.(event);
829
- if (options.resume !== false) {
830
- void chat.resumeStream();
831
+ if (options.resume !== false && !resumeInFlight && !isResumingToolContinuation && !transport.isAwaitingResume()) {
832
+ resumeInFlight = true;
833
+ const myGeneration = resumeGeneration;
834
+ void chat.resumeStream().catch(() => {
835
+ }).finally(() => {
836
+ if (resumeGeneration !== myGeneration) {
837
+ return;
838
+ }
839
+ resumeInFlight = false;
840
+ });
831
841
  }
832
842
  });
833
843
  socket.addEventListener("close", (event) => {
@@ -843,6 +853,8 @@ function useAgentChat(options) {
843
853
  onScopeDispose(() => {
844
854
  fallbackAckedResumeRequestIds.clear();
845
855
  isRecovering.value = false;
856
+ resumeGeneration++;
857
+ resumeInFlight = false;
846
858
  socket.close();
847
859
  });
848
860
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-vue",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Vue 3 composable for Cloudflare Agents — a port of @cloudflare/ai-chat/react's useAgentChat.",
5
5
  "keywords": [
6
6
  "vue",