toolception 0.6.2 → 0.6.3

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.
@@ -64,6 +64,31 @@ export declare class FastifyTransport {
64
64
  */
65
65
  private registerMcpDeleteEndpoint;
66
66
  stop(): Promise<void>;
67
+ /**
68
+ * Closes all active sessions and clears the session map so the server is
69
+ * free to accept a new connection. Required for SDK 1.26+, which throws
70
+ * "Already connected" when `connect()` is called while a transport is
71
+ * still attached. Handles unclean client disconnects followed by re-init.
72
+ *
73
+ * The map is cleared before closing so that `onclose` handlers fired by
74
+ * `transport.close()` do not attempt double-deletion.
75
+ *
76
+ * @param sessions - The client's active session map to drain
77
+ */
78
+ private drainExistingSessions;
79
+ /**
80
+ * Disconnects the server from its current transport so that `Protocol._transport`
81
+ * is cleared before a new connection is established.
82
+ *
83
+ * `drainExistingSessions` handles same-bundle reconnects (sessions in the map).
84
+ * This method handles the STATIC-mode cross-client case: a different client's
85
+ * bundle has an empty sessions map, but the shared server is still attached to
86
+ * the previous client's transport because `StreamableHTTPClientTransport.close()`
87
+ * does not send DELETE—it only aborts connections.
88
+ *
89
+ * @param server - The MCP server to disconnect from its current transport
90
+ */
91
+ private disconnectServer;
67
92
  /**
68
93
  * @param bundle - The client bundle to clean up
69
94
  */
@@ -1 +1 @@
1
- {"version":3,"file":"FastifyTransport.d.ts","sourceRoot":"","sources":["../../src/http/FastifyTransport.ts"],"names":[],"mappings":"AAAA,OAAgB,EACd,KAAK,eAAe,EAGrB,MAAM,SAAS,CAAC;AAIjB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAKnF,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,iBAAiB,CAAC;AAQzB,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO,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