agents 0.10.0 → 0.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/mcp/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { MessageType } from "../types.js";
2
- import { o as getAgentByName, s as getCurrentAgent, t as Agent } from "../src-B8NZxxsO.js";
2
+ import { o as getAgentByName, s as getCurrentAgent, t as Agent } from "../src-f7-4oW_C.js";
3
3
  import { a as RPCServerTransport, i as RPCClientTransport, o as RPC_DO_PREFIX } from "../client-QBjFV5de.js";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
5
5
  import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
@@ -488,9 +488,8 @@ const createAutoHandler = (basePath, namespace, options = {}) => {
488
488
  };
489
489
  function corsHeaders(_request, corsOptions = {}) {
490
490
  const origin = corsOptions.origin || "*";
491
- const headers = corsOptions.headers || "Content-Type, Accept, Authorization, mcp-session-id, mcp-protocol-version";
492
491
  return {
493
- "Access-Control-Allow-Headers": headers,
492
+ "Access-Control-Allow-Headers": corsOptions.headers || "Content-Type, Accept, Authorization, mcp-session-id, mcp-protocol-version",
494
493
  "Access-Control-Allow-Methods": corsOptions.methods || "GET, POST, DELETE, OPTIONS",
495
494
  "Access-Control-Allow-Origin": origin,
496
495
  "Access-Control-Expose-Headers": corsOptions.exposeHeaders || "mcp-session-id",
@@ -1541,15 +1540,7 @@ var McpAgent = class McpAgent extends Agent {
1541
1540
  * @returns The response message(s) or undefined
1542
1541
  */
1543
1542
  async handleMcpMessage(message) {
1544
- if (!this._transport) {
1545
- this.props = await this.ctx.storage.get("props");
1546
- await this.init();
1547
- const server = await this.server;
1548
- this._transport = this.initTransport();
1549
- if (!this._transport) throw new Error("Failed to initialize transport");
1550
- await server.connect(this._transport);
1551
- await this.reinitializeServer();
1552
- }
1543
+ await this.__unsafe_ensureInitialized();
1553
1544
  if (!(this._transport instanceof RPCServerTransport)) throw new Error("Expected RPC transport");
1554
1545
  if (!Array.isArray(message)) {
1555
1546
  const parseResult = JSONRPCMessageSchema.safeParse(message);