@mcp-use/inspector 2.0.0-canary.2 → 2.0.0-canary.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.
Files changed (22) hide show
  1. package/dist/cdn/inspector.js +71 -71
  2. package/dist/client/index.js +111 -107
  3. package/dist/web/assets/{browser-3da6ehP1.js → browser-C40hQ2nK.js} +18 -18
  4. package/dist/web/assets/{chunk-BFRKOEF2-DtKSesPm.js → chunk-4RBHI5AK-B1d1yrBp.js} +1 -1
  5. package/dist/web/assets/{chunk-LG5NSHEL-jBrp5-0B.js → chunk-LG5NSHEL-DeeoMxuI.js} +1 -1
  6. package/dist/web/assets/{chunk-HHVN27UL-Bl7cVwac.js → chunk-XHJKFHNX-B1n353yP.js} +2 -2
  7. package/dist/web/assets/{chunk_array-CZ9Igu7C.js → chunk_array-Bw1lTtex.js} +1 -1
  8. package/dist/web/assets/{client-C8v5dgcD.js → client-D3r-uzak.js} +1 -1
  9. package/dist/web/assets/{client-BIQLHM6B-D9kfmbc5.js → client-SMYSW3X7-Ch-GG44j.js} +3 -3
  10. package/dist/web/assets/{dist-CwVubZgG.js → dist-BZmXa__p.js} +1 -1
  11. package/dist/web/assets/{dist-BaO3qHVt.js → dist-JsQmV3pO.js} +1 -1
  12. package/dist/web/assets/{dist-8DnA4W8u.js → dist-t5Yo0YiG.js} +1 -1
  13. package/dist/web/assets/{function_calling-l_oTDrug.js → function_calling-kK7um7Ye.js} +1 -1
  14. package/dist/web/assets/{index-DG68X7Ml.js → index-XirTiuvy.js} +8 -8
  15. package/dist/web/assets/{llms-9ZdWocdy.js → llms-ByyTYk2T.js} +1 -1
  16. package/dist/web/assets/{messages-DyY5uvh8.js → messages-D4_mH1tk.js} +1 -1
  17. package/dist/web/assets/react-BXnk7NtJ.js +1 -0
  18. package/dist/web/assets/{stdio-CSZKOJVX-ub0qSr5n.js → stdio-DMAKKXMX-wCtySLeX.js} +1 -1
  19. package/dist/web/assets/{tools-BYpLdT-O.js → tools-kLe9X8V8.js} +1 -1
  20. package/dist/web/index.html +6 -6
  21. package/package.json +3 -3
  22. package/dist/web/assets/react-B4WpwZHt.js +0 -1
@@ -26842,7 +26842,7 @@ var zd = class {
26842
26842
  //#region src/client/telemetry/utils.ts
26843
26843
  function Kd() {
26844
26844
  try {
26845
- return "2.0.0-canary.2";
26845
+ return "2.0.0-canary.3";
26846
26846
  } catch {
26847
26847
  return "0.0.0";
26848
26848
  }
@@ -51035,7 +51035,7 @@ var uk, dk, Ame, jme, Mme, fk, pk, mk, hk, gk, Nme, _k, vk, yk, Pme, Fme, Ime, b
51035
51035
  }(), mve);
51036
51036
  }));
51037
51037
  //#endregion
51038
- //#region ../mcp-use/dist/chunk-FH66BO4Z.js
51038
+ //#region ../mcp-use/dist/chunk-VJC3VA6Z.js
51039
51039
  function pM() {
51040
51040
  return yM;
51041
51041
  }
@@ -51160,7 +51160,7 @@ function vM(e) {
51160
51160
  wM.getInstance().setSource(e);
51161
51161
  }
51162
51162
  var yM, bM, Tve, Eve, Dve, Ove, kve, Ave, jve, Mve, Nve, Pve, Fve, xM, SM, CM, wM, TM, Ive, EM = o((() => {
51163
- Pp(), Op(), jpe(), sw(), yM = "1.24.0-canary.2", U(pM, "getPackageVersion"), bM = class {
51163
+ Pp(), Op(), jpe(), sw(), yM = "1.24.0-canary.3", U(pM, "getPackageVersion"), bM = class {
51164
51164
  static {
51165
51165
  U(this, "BaseTelemetryEvent");
51166
51166
  }
@@ -51424,7 +51424,7 @@ var yM, bM, Tve, Eve, Dve, Ove, kve, Ave, jve, Mve, Nve, Pve, Fve, xM, SM, CM, w
51424
51424
  constructor() {
51425
51425
  this._runtimeEnvironment = wve(), this._storageCapability = Cve(this._runtimeEnvironment), this._source = this._getSourceFromLocalStorage() || this._runtimeEnvironment;
51426
51426
  let e = this._checkTelemetryDisabled(), t = this._runtimeEnvironment !== "unknown";
51427
- e ? (this._posthogBrowserClient = null, W.debug("Telemetry disabled via localStorage")) : t ? (W.info("Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false in localStorage to disable."), this._posthogLoading = this._initPostHogBrowser()) : (this._posthogBrowserClient = null, W.debug(`Telemetry disabled - unknown environment: ${this._runtimeEnvironment}`));
51427
+ e ? (this._posthogBrowserClient = null, W.debug("Telemetry disabled via localStorage")) : t ? (W.debug("Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false in localStorage to disable."), this._posthogLoading = this._initPostHogBrowser()) : (this._posthogBrowserClient = null, W.debug(`Telemetry disabled - unknown environment: ${this._runtimeEnvironment}`));
51428
51428
  }
51429
51429
  _getSourceFromLocalStorage() {
51430
51430
  try {
@@ -58057,7 +58057,7 @@ var Exe, Dxe, mN, hN, gN, _N, vN, yN, bN, xN, SN, CN, wN, TN, EN, DN, ON, kN, AN
58057
58057
  };
58058
58058
  }));
58059
58059
  //#endregion
58060
- //#region ../mcp-use/dist/chunk-HHVN27UL.js
58060
+ //#region ../mcp-use/dist/chunk-XHJKFHNX.js
58061
58061
  function HN(e, t) {
58062
58062
  return {
58063
58063
  onSampling: e?.onSampling ?? e?.samplingCallback ?? t?.onSampling ?? t?.samplingCallback,
@@ -58127,7 +58127,7 @@ var Fxe, WN, GN, KN, qN = o((() => {
58127
58127
  if (t?.code === 404 && e.sessionId && !this.reinitializing) {
58128
58128
  W.warn("[SSE] Session not found (404), re-initializing per MCP spec..."), this.reinitializing = !0;
58129
58129
  try {
58130
- e.sessionId = void 0, await this.reinitialize(e), W.info("[SSE] Re-initialization successful, retrying request"), await r(n);
58130
+ e.sessionId = void 0, await this.reinitialize(e), W.debug("[SSE] Re-initialization successful, retrying request"), await r(n);
58131
58131
  } finally {
58132
58132
  this.reinitializing = !1;
58133
58133
  }
@@ -58218,7 +58218,7 @@ var Fxe, WN, GN, KN, qN = o((() => {
58218
58218
  }
58219
58219
  W.debug(`Connecting to MCP implementation via HTTP: ${e}`);
58220
58220
  try {
58221
- W.info("🔄 Attempting streamable HTTP transport..."), await this.connectWithStreamableHttp(e), W.info("✅ Successfully connected via streamable HTTP");
58221
+ W.debug("🔄 Attempting streamable HTTP transport..."), await this.connectWithStreamableHttp(e), W.debug("✅ Successfully connected via streamable HTTP");
58222
58222
  } catch (t) {
58223
58223
  W.debug("Streamable HTTP connect failed", t);
58224
58224
  let { fallbackReason: n, is401Error: r, httpStatusCode: i } = this.classifyStreamableHttpFailure(t);
@@ -58228,7 +58228,7 @@ var Fxe, WN, GN, KN, qN = o((() => {
58228
58228
  throw e.code = 401, e;
58229
58229
  }
58230
58230
  if (this.disableSseFallback) throw W.info("SSE fallback disabled - failing connection"), await this.cleanupResources(), Error(`Streamable HTTP connection failed: ${n}`);
58231
- W.info("🔄 Falling back to SSE transport...");
58231
+ W.debug("🔄 Falling back to SSE transport...");
58232
58232
  try {
58233
58233
  await this.connectWithSse(e);
58234
58234
  } catch (e) {
@@ -58486,7 +58486,7 @@ var Fxe, WN, GN, KN, qN = o((() => {
58486
58486
  };
58487
58487
  }));
58488
58488
  //#endregion
58489
- //#region ../mcp-use/dist/chunk-BFRKOEF2.js
58489
+ //#region ../mcp-use/dist/chunk-4RBHI5AK.js
58490
58490
  function Ixe(e) {
58491
58491
  let t = Object.keys(e.mcpServers ?? {});
58492
58492
  wM.getInstance().trackMCPClientInit({
@@ -204442,7 +204442,7 @@ function LZt(e, t) {
204442
204442
  throw Error(`API key not found for provider '${e}'. Set ${r} environment variable or pass apiKey in llmConfig. Example: new MCPAgent({ llm: '${e}/model', llmConfig: { apiKey: 'your-key' } })`);
204443
204443
  }
204444
204444
  async function RZt(e, t) {
204445
- W.info(`Creating LLM from string: ${e}`);
204445
+ W.debug(`Creating LLM from string: ${e}`);
204446
204446
  let { provider: n, model: r } = p9(e), i = v9[n], a = LZt(n, t), o;
204447
204447
  try {
204448
204448
  W.debug(`Importing package ${i.package}...`), o = await import(i.package);
@@ -204459,7 +204459,7 @@ async function RZt(e, t) {
204459
204459
  t?.apiKey && (delete c.apiKey, c.apiKey = a), (n === "anthropic" || n === "google" || n === "openai" || n === "groq") && (c.model = r);
204460
204460
  try {
204461
204461
  let e = new s(c);
204462
- return W.info(`Successfully created ${n} LLM with model ${r}`), e;
204462
+ return W.debug(`Successfully created ${n} LLM with model ${r}`), e;
204463
204463
  } catch (e) {
204464
204464
  throw Error(`Failed to instantiate ${i.className} with model '${r}': ${e?.message || e}`);
204465
204465
  }
@@ -204544,7 +204544,7 @@ var WZt, h9, g9, GZt, KZt, qZt, JZt, YZt, XZt, ZZt, QZt, $Zt, eQt, _9, tQt, nQt,
204544
204544
  }
204545
204545
  static async createTools(e, t) {
204546
204546
  let n = new this(t);
204547
- (!e.activeSessions || Object.keys(e.activeSessions).length === 0) && (W.info("No active sessions found, creating new ones..."), await e.createAllSessions());
204547
+ (!e.activeSessions || Object.keys(e.activeSessions).length === 0) && (W.debug("No active sessions found, creating new ones..."), await e.createAllSessions());
204548
204548
  let r = e.getAllActiveSessions(), i = Object.values(r).map((e) => e.connector);
204549
204549
  return n.createToolsFromConnectors(i);
204550
204550
  }
@@ -204770,7 +204770,7 @@ var WZt, h9, g9, GZt, KZt, qZt, JZt, YZt, XZt, ZZt, QZt, $Zt, eQt, _9, tQt, nQt,
204770
204770
  let a = i.length;
204771
204771
  return n += ` Session created and connected. '${e}' is now the active server with ${a} tools available.`, n += `
204772
204772
 
204773
- ${i.map((e) => e.name).join("\n")}`, W.info(n), n;
204773
+ ${i.map((e) => e.name).join("\n")}`, W.debug(n), n;
204774
204774
  } catch (t) {
204775
204775
  return W.error(`Failed to add or connect to server '${e}': ${t.message}`), `Failed to add or connect to server '${e}': ${t.message}`;
204776
204776
  }
@@ -204860,12 +204860,12 @@ ${i.map((e) => e.name).join("\n")}`, W.info(n), n;
204860
204860
  this.client = e, this.adapter = t, this.overrideManagementTools = n;
204861
204861
  }
204862
204862
  setManagementTools(e) {
204863
- this.overrideManagementTools = e, W.info(`Overriding default management tools with a new set of ${e.length} tools.`);
204863
+ this.overrideManagementTools = e, W.debug(`Overriding default management tools with a new set of ${e.length} tools.`);
204864
204864
  }
204865
204865
  logState(e) {
204866
204866
  let t = this.client.getServerNames(), n = Object.keys(this.client.getAllActiveSessions());
204867
204867
  if (t.length === 0) {
204868
- W.info("Server Manager State: No servers configured.");
204868
+ W.debug("Server Manager State: No servers configured.");
204869
204869
  return;
204870
204870
  }
204871
204871
  let r = t.map((e) => ({
@@ -204875,7 +204875,7 @@ ${i.map((e) => e.name).join("\n")}`, W.info(n), n;
204875
204875
  "Tool Count": this.serverTools[e]?.length ?? 0,
204876
204876
  Active: this.activeServer === e ? "✅" : "❌"
204877
204877
  }));
204878
- W.info(`Server Manager State: [${e}]`), console.table(r);
204878
+ W.debug(`Server Manager State: [${e}]`), console.table(r);
204879
204879
  }
204880
204880
  initialize() {
204881
204881
  (this.client.getServerNames?.()).length === 0 && W.warn("No MCP servers defined in client configuration");
@@ -205041,7 +205041,7 @@ ${i.map((e) => e.name).join("\n")}`, W.info(n), n;
205041
205041
  "Content-Type": "application/json",
205042
205042
  "x-api-key": this.apiKey
205043
205043
  }, n = `${this.baseUrl}${rQt}`;
205044
- W.info(`\u{1F4DD} Creating chat session for agent ${this.agentId}`);
205044
+ W.debug(`\u{1F4DD} Creating chat session for agent ${this.agentId}`);
205045
205045
  try {
205046
205046
  let r = await fetch(n, {
205047
205047
  method: "POST",
@@ -205053,7 +205053,7 @@ ${i.map((e) => e.name).join("\n")}`, W.info(n), n;
205053
205053
  throw Error(t === 404 ? `Agent not found: Agent '${this.agentId}' does not exist or you don't have access to it. Please verify the agent ID and ensure it exists in your account.` : `Failed to create chat session: ${t} - ${e}`);
205054
205054
  }
205055
205055
  let i = (await r.json()).id;
205056
- return W.info(`\u2705 Chat session created: ${i}`), i;
205056
+ return W.debug(`\u2705 Chat session created: ${i}`), i;
205057
205057
  } catch (e) {
205058
205058
  throw e instanceof Error ? TypeError(`Failed to create chat session: ${e.message}`) : Error(`Failed to create chat session: ${String(e)}`);
205059
205059
  }
@@ -205062,17 +205062,17 @@ ${i.map((e) => e.name).join("\n")}`, W.info(n), n;
205062
205062
  let { query: a, maxSteps: o, externalHistory: s, outputSchema: c } = IZt(e, t, n, r, i);
205063
205063
  s !== void 0 && W.warn("External history is not yet supported for remote execution");
205064
205064
  try {
205065
- W.info(`\u{1F310} Executing query on remote agent ${this.agentId}`), this.chatId === null && (this.chatId = await this.createChatSession());
205065
+ W.debug(`\u{1F310} Executing query on remote agent ${this.agentId}`), this.chatId === null && (this.chatId = await this.createChatSession());
205066
205066
  let e = this.chatId, t = {
205067
205067
  query: a,
205068
205068
  max_steps: o ?? 10
205069
205069
  };
205070
- c && (t.output_schema = this.pydanticToJsonSchema(c), W.info("🔧 Using structured output with schema"));
205070
+ c && (t.output_schema = this.pydanticToJsonSchema(c), W.debug("🔧 Using structured output with schema"));
205071
205071
  let n = {
205072
205072
  "Content-Type": "application/json",
205073
205073
  "x-api-key": this.apiKey
205074
205074
  }, r = `${this.baseUrl}${iQt.replace("{chat_id}", e)}`;
205075
- W.info(`\u{1F680} Executing agent in chat ${e}`);
205075
+ W.debug(`\u{1F680} Executing agent in chat ${e}`);
205076
205076
  let i = await fetch(r, {
205077
205077
  method: "POST",
205078
205078
  headers: n,
@@ -205084,7 +205084,7 @@ ${i.map((e) => e.name).join("\n")}`, W.info(n), n;
205084
205084
  throw t === 401 ? (W.error(`\u274C Authentication failed: ${e}`), Error("Authentication failed: Invalid or missing API key. Please check your API key and ensure the MCP_USE_API_KEY environment variable is set correctly.")) : t === 403 ? (W.error(`\u274C Access forbidden: ${e}`), Error(`Access denied: You don't have permission to execute agent '${this.agentId}'. Check if the agent exists and you have the necessary permissions.`)) : t === 404 ? (W.error(`\u274C Agent not found: ${e}`), Error(`Agent not found: Agent '${this.agentId}' does not exist or you don't have access to it. Please verify the agent ID and ensure it exists in your account.`)) : t === 422 ? (W.error(`\u274C Validation error: ${e}`), Error(`Request validation failed: ${e}. Please check your query parameters and output schema format.`)) : t === 500 ? (W.error(`\u274C Server error: ${e}`), Error("Internal server error occurred during agent execution. Please try again later or contact support if the issue persists.")) : (W.error(`\u274C Remote execution failed with status ${t}: ${e}`), Error(`Remote agent execution failed: ${t} - ${e}`));
205085
205085
  }
205086
205086
  let s = await i.json();
205087
- if (W.info(`\u{1F527} Response: ${JSON.stringify(s)}`), W.info("✅ Remote execution completed successfully"), typeof s == "object" && s) {
205087
+ if (W.debug(`\u{1F527} Response: ${JSON.stringify(s)}`), W.debug("✅ Remote execution completed successfully"), typeof s == "object" && s) {
205088
205088
  if (s.status === "error" || s.error !== null) {
205089
205089
  let e = s.error ?? String(s);
205090
205090
  throw W.error(`\u274C Remote agent execution failed: ${e}`), Error(`Remote agent execution failed: ${e}`);
@@ -205105,7 +205105,7 @@ Raw error: ${s}`);
205105
205105
  return await this.run(e, t, n, r, i);
205106
205106
  }
205107
205107
  async close() {
205108
- W.info("🔌 Remote agent client closed");
205108
+ W.debug("🔌 Remote agent client closed");
205109
205109
  }
205110
205110
  }, v9 = {
205111
205111
  openai: {
@@ -205193,7 +205193,7 @@ Raw error: ${s}`);
205193
205193
  if (!e.llm) throw Error("llm is required for local execution. For remote execution, provide agentId instead.");
205194
205194
  if (typeof e.llm == "string") {
205195
205195
  if (this.isSimplifiedMode = !0, this.llmString = e.llm, this.llmConfig = e.llmConfig, this.mcpServersConfig = e.mcpServers, !this.mcpServersConfig || Object.keys(this.mcpServersConfig).length === 0) throw Error("Simplified mode requires 'mcpServers' configuration. Provide an object with server configurations, e.g., { filesystem: { command: 'npx', args: [...] } }");
205196
- this.llm = void 0, this.client = void 0, this.clientOwnedByAgent = !0, this.connectors = [], W.info(`\u{1F3AF} Simplified mode enabled: LLM will be created from '${this.llmString}'`);
205196
+ this.llm = void 0, this.client = void 0, this.clientOwnedByAgent = !0, this.connectors = [], W.debug(`\u{1F3AF} Simplified mode enabled: LLM will be created from '${this.llmString}'`);
205197
205197
  } else if (this.isSimplifiedMode = !1, this.llm = e.llm, this.client = e.client, this.connectors = e.connectors ?? [], this.clientOwnedByAgent = !1, !this.client && this.connectors.length === 0) throw Error("Explicit mode requires either 'client' or at least one 'connector'. Alternatively, use simplified mode with 'llm' as a string and 'mcpServers' config.");
205198
205198
  if (this.maxSteps = e.maxSteps ?? 5, this.autoInitialize = e.autoInitialize ?? !1, this.memoryEnabled = e.memoryEnabled ?? !0, this.systemPrompt = e.systemPrompt ?? null, this.systemPromptTemplateOverride = e.systemPromptTemplate ?? null, this.additionalInstructions = e.additionalInstructions ?? null, this.disallowedTools = e.disallowedTools ?? [], this.additionalTools = e.additionalTools ?? [], this.toolsUsedNames = e.toolsUsedNames ?? [], this.exposeResourcesAsTools = e.exposeResourcesAsTools ?? !0, this.exposePromptsAsTools = e.exposePromptsAsTools ?? !0, this.useServerManager = e.useServerManager ?? !1, this.verbose = e.verbose ?? !1, this.observe = e.observe ?? !0, this.isSimplifiedMode) this.adapter = e.adapter ?? new h9(this.disallowedTools), this.telemetry = CM.getInstance(), this.modelProvider = "unknown", this.modelName = "unknown";
205199
205199
  else {
@@ -205229,16 +205229,16 @@ Raw error: ${s}`);
205229
205229
  this._initialized = !0;
205230
205230
  return;
205231
205231
  }
205232
- if (W.info("🚀 Initializing MCP agent and connecting to services..."), this.isSimplifiedMode) {
205233
- if (W.info("🎯 Simplified mode: Creating client and LLM from configuration..."), this.mcpServersConfig) {
205234
- W.info(`Creating MCPClient with ${Object.keys(this.mcpServersConfig).length} server(s)...`);
205232
+ if (W.debug("🚀 Initializing MCP agent and connecting to services..."), this.isSimplifiedMode) {
205233
+ if (W.debug("🎯 Simplified mode: Creating client and LLM from configuration..."), this.mcpServersConfig) {
205234
+ W.debug(`Creating MCPClient with ${Object.keys(this.mcpServersConfig).length} server(s)...`);
205235
205235
  let { MCPClient: e } = await Promise.resolve().then(() => (rXt(), VYt));
205236
- this.client = new e({ mcpServers: this.mcpServersConfig }), W.info("✅ MCPClient created successfully");
205236
+ this.client = new e({ mcpServers: this.mcpServersConfig }), W.debug("✅ MCPClient created successfully");
205237
205237
  }
205238
205238
  if (this.llmString) {
205239
- W.info(`Creating LLM from string: ${this.llmString}...`);
205239
+ W.debug(`Creating LLM from string: ${this.llmString}...`);
205240
205240
  try {
205241
- this.llm = await RZt(this.llmString, this.llmConfig), W.info("✅ LLM created successfully");
205241
+ this.llm = await RZt(this.llmString, this.llmConfig), W.debug("✅ LLM created successfully");
205242
205242
  let [e, t] = mM(this.llm);
205243
205243
  this.modelProvider = e, this.modelName = t;
205244
205244
  } catch (e) {
@@ -205252,15 +205252,15 @@ Raw error: ${s}`);
205252
205252
  }
205253
205253
  this.callbacks = await this.observabilityManager.getCallbacks();
205254
205254
  let e = await this.observabilityManager.getHandlerNames();
205255
- if (e.length > 0 && W.info(`\u{1F4CA} Observability enabled with: ${e.join(", ")}`), this.useServerManager && this.serverManager) {
205255
+ if (e.length > 0 && W.debug(`\u{1F4CA} Observability enabled with: ${e.join(", ")}`), this.useServerManager && this.serverManager) {
205256
205256
  await this.serverManager.initialize();
205257
205257
  let e = this.serverManager.tools;
205258
- this._tools = e, this._tools.push(...this.additionalTools), W.info(`\u{1F527} Server manager mode active with ${e.length} management tools`), await this.createSystemMessageFromTools(this._tools);
205258
+ this._tools = e, this._tools.push(...this.additionalTools), W.debug(`\u{1F527} Server manager mode active with ${e.length} management tools`), await this.createSystemMessageFromTools(this._tools);
205259
205259
  } else {
205260
205260
  if (this.client) {
205261
- if (this.sessions = this.client.getAllActiveSessions(), W.info(`\u{1F50C} Found ${Object.keys(this.sessions).length} existing sessions`), Object.keys(this.sessions).filter((e) => e !== "code_mode").length === 0 && (W.info("🔄 No active sessions found, creating new ones..."), this.sessions = await this.client.createAllSessions(), W.info(`\u2705 Created ${Object.keys(this.sessions).length} new sessions`)), this.client.codeMode) {
205261
+ if (this.sessions = this.client.getAllActiveSessions(), W.debug(`\u{1F50C} Found ${Object.keys(this.sessions).length} existing sessions`), Object.keys(this.sessions).filter((e) => e !== "code_mode").length === 0 && (W.debug("🔄 No active sessions found, creating new ones..."), this.sessions = await this.client.createAllSessions(), W.debug(`\u2705 Created ${Object.keys(this.sessions).length} new sessions`)), this.client.codeMode) {
205262
205262
  let e = this.sessions.code_mode;
205263
- if (e) this._tools = await this.adapter.createToolsFromConnectors([e.connector]), W.info(`\u{1F6E0}\uFE0F Created ${this._tools.length} code mode tools`);
205263
+ if (e) this._tools = await this.adapter.createToolsFromConnectors([e.connector]), W.debug(`\u{1F6E0}\uFE0F Created ${this._tools.length} code mode tools`);
205264
205264
  else throw Error("Code mode enabled but code_mode session not found");
205265
205265
  } else {
205266
205266
  let e = Object.values(this.sessions).map((e) => e.connector), t = await this.adapter.createToolsFromConnectors(e), n = this.exposeResourcesAsTools ? await this.adapter.createResourcesFromConnectors(e) : [], r = this.exposePromptsAsTools ? await this.adapter.createPromptsFromConnectors(e) : [];
@@ -205268,24 +205268,24 @@ Raw error: ${s}`);
205268
205268
  ...t,
205269
205269
  ...n,
205270
205270
  ...r
205271
- ], W.info(`\u{1F6E0}\uFE0F Created ${this._tools.length} LangChain items from client: ${t.length} tools, ${n.length} resources, ${r.length} prompts`);
205271
+ ], W.debug(`\u{1F6E0}\uFE0F Created ${this._tools.length} LangChain items from client: ${t.length} tools, ${n.length} resources, ${r.length} prompts`);
205272
205272
  }
205273
205273
  this._tools.push(...this.additionalTools);
205274
205274
  } else {
205275
- W.info(`\u{1F517} Connecting to ${this.connectors.length} direct connectors...`);
205275
+ W.debug(`\u{1F517} Connecting to ${this.connectors.length} direct connectors...`);
205276
205276
  for (let e of this.connectors) e.isClientConnected || await e.connect();
205277
205277
  let e = await this.adapter.createToolsFromConnectors(this.connectors), t = await this.adapter.createResourcesFromConnectors(this.connectors), n = await this.adapter.createPromptsFromConnectors(this.connectors);
205278
205278
  this._tools = [
205279
205279
  ...e,
205280
205280
  ...t,
205281
205281
  ...n
205282
- ], this._tools.push(...this.additionalTools), W.info(`\u{1F6E0}\uFE0F Created ${this._tools.length} LangChain items from connectors: ${e.length} tools, ${t.length} resources, ${n.length} prompts`);
205282
+ ], this._tools.push(...this.additionalTools), W.debug(`\u{1F6E0}\uFE0F Created ${this._tools.length} LangChain items from connectors: ${e.length} tools, ${t.length} resources, ${n.length} prompts`);
205283
205283
  }
205284
- W.info(`\u{1F9F0} Found ${this._tools.length} tools across all connectors`), await this.createSystemMessageFromTools(this._tools);
205284
+ W.debug(`\u{1F9F0} Found ${this._tools.length} tools across all connectors`), await this.createSystemMessageFromTools(this._tools);
205285
205285
  }
205286
205286
  this._agentExecutor = this.createAgent(), this._initialized = !0;
205287
205287
  let t = this.getMCPServerInfo();
205288
- Object.keys(t).length > 0 && (this.setMetadata(t), W.debug(`MCP server info added to metadata: ${JSON.stringify(t)}`)), W.info("✨ Agent initialization complete");
205288
+ Object.keys(t).length > 0 && (this.setMetadata(t), W.debug(`MCP server info added to metadata: ${JSON.stringify(t)}`)), W.debug("✨ Agent initialization complete");
205289
205289
  }
205290
205290
  async createSystemMessageFromTools(e) {
205291
205291
  this.systemMessage = FZt(e, this.systemPromptTemplateOverride ?? tQt, nQt, this.useServerManager, this.disallowedTools, this.systemPrompt ?? void 0, this.additionalInstructions ?? void 0), this.memoryEnabled && (this.conversationHistory = [this.systemMessage, ...this.conversationHistory.filter((e) => !(e instanceof GK))]);
@@ -205293,7 +205293,7 @@ Raw error: ${s}`);
205293
205293
  createAgent() {
205294
205294
  if (!this.llm) throw Error("LLM is required to create agent");
205295
205295
  let e = this.systemMessage?.content ?? "You are a helpful assistant.", t = this._tools.map((e) => e.name);
205296
- W.info(`\u{1F9E0} Agent ready with tools: ${t.join(", ")}`);
205296
+ W.debug(`\u{1F9E0} Agent ready with tools: ${t.join(", ")}`);
205297
205297
  let n = [SJt({ runLimit: this.maxSteps })], r = VKt({
205298
205298
  model: this.llm,
205299
205299
  tools: this._tools,
@@ -205480,12 +205480,12 @@ Raw error: ${s}`);
205480
205480
  if ((c && !this._initialized || !this._initialized && this.autoInitialize) && (await this.initialize(), f = !0), !this._agentExecutor) throw Error("MCP agent failed to initialize");
205481
205481
  if (this.useServerManager && this.serverManager) {
205482
205482
  let e = this.serverManager.tools, t = new Set(e.map((e) => e.name)), n = new Set(this._tools.map((e) => e.name));
205483
- (t.size !== n.size || [...t].some((e) => !n.has(e))) && (W.info(`\u{1F504} Tools changed before execution, updating agent. New tools: ${[...t].join(", ")}`), this._tools = e, this._tools.push(...this.additionalTools), await this.createSystemMessageFromTools(this._tools), this._agentExecutor = this.createAgent());
205483
+ (t.size !== n.size || [...t].some((e) => !n.has(e))) && (W.debug(`\u{1F504} Tools changed before execution, updating agent. New tools: ${[...t].join(", ")}`), this._tools = e, this._tools.push(...this.additionalTools), await this.createSystemMessageFromTools(this._tools), this._agentExecutor = this.createAgent());
205484
205484
  }
205485
205485
  let e = l ?? this.conversationHistory, t = [];
205486
205486
  for (let n of e) (this._isHumanMessageLike(n) || this._isAIMessageLike(n) || this._isToolMessageLike(n)) && t.push(n);
205487
205487
  let n = o.length > 50 ? `${o.slice(0, 50).replace(/\n/g, " ")}...` : o.replace(/\n/g, " ");
205488
- W.info(`\u{1F4AC} Received query: '${n}'`), W.info("🏁 Starting agent execution");
205488
+ W.debug(`\u{1F4AC} Received query: '${n}'`), W.debug("🏁 Starting agent execution");
205489
205489
  let r = 0, i = [...t, new BK(o)];
205490
205490
  for (; r <= 3;) {
205491
205491
  let e = { messages: i }, t = !1, n = await this._agentExecutor.stream(e, {
@@ -205509,7 +205509,7 @@ Raw error: ${s}`);
205509
205509
  let t = e.name || "unknown", n = e.args || {};
205510
205510
  this.toolsUsedNames.push(t), g++;
205511
205511
  let r = JSON.stringify(n);
205512
- r.length > 100 && (r = `${r.slice(0, 97)}...`), W.info(`\u{1F527} Tool call: ${t} with input: ${r}`), yield {
205512
+ r.length > 100 && (r = `${r.slice(0, 97)}...`), W.debug(`\u{1F527} Tool call: ${t} with input: ${r}`), yield {
205513
205513
  action: {
205514
205514
  tool: t,
205515
205515
  toolInput: n,
@@ -205520,15 +205520,15 @@ Raw error: ${s}`);
205520
205520
  }
205521
205521
  if (this._isToolMessageLike(n)) {
205522
205522
  let e = n.content, i = String(e);
205523
- if (i.length > 100 && (i = `${i.slice(0, 97)}...`), i = i.replace(/\n/g, " "), W.info(`\u{1F4C4} Tool result: ${i}`), this.useServerManager && this.serverManager) {
205523
+ if (i.length > 100 && (i = `${i.slice(0, 97)}...`), i = i.replace(/\n/g, " "), W.debug(`\u{1F4C4} Tool result: ${i}`), this.useServerManager && this.serverManager) {
205524
205524
  let e = this.serverManager.tools, n = new Set(e.map((e) => e.name)), i = new Set(this._tools.map((e) => e.name));
205525
205525
  if (n.size !== i.size || [...n].some((e) => !i.has(e))) {
205526
- W.info(`\u{1F504} Tools changed during execution. New tools: ${[...n].join(", ")}`), this._tools = e, this._tools.push(...this.additionalTools), await this.createSystemMessageFromTools(this._tools), this._agentExecutor = this.createAgent(), t = !0, r++, W.info(`\u{1F503} Restarting execution with updated tools (restart ${r}/3)`);
205526
+ W.debug(`\u{1F504} Tools changed during execution. New tools: ${[...n].join(", ")}`), this._tools = e, this._tools.push(...this.additionalTools), await this.createSystemMessageFromTools(this._tools), this._agentExecutor = this.createAgent(), t = !0, r++, W.debug(`\u{1F503} Restarting execution with updated tools (restart ${r}/3)`);
205527
205527
  break;
205528
205528
  }
205529
205529
  }
205530
205530
  }
205531
- this._isAIMessageLike(n) && !this._messageHasToolCalls(n) && (h = this._normalizeOutput(this._getMessageContent(n)), W.info("✅ Agent finished with output"));
205531
+ this._isAIMessageLike(n) && !this._messageHasToolCalls(n) && (h = this._normalizeOutput(this._getMessageContent(n)), W.debug("✅ Agent finished with output"));
205532
205532
  }
205533
205533
  if (t) break;
205534
205534
  }
@@ -205545,15 +205545,15 @@ Raw error: ${s}`);
205545
205545
  for (let t of e) this.addToHistory(t);
205546
205546
  }
205547
205547
  if (u && h) try {
205548
- W.info("🔧 Attempting structured output...");
205548
+ W.debug("🔧 Attempting structured output...");
205549
205549
  let e = await this._attemptStructuredOutput(h, this.llm, u);
205550
- return this.memoryEnabled && this.addToHistory(new sq(`Structured result: ${JSON.stringify(e)}`)), W.info("✅ Structured output successful"), m = !0, e;
205550
+ return this.memoryEnabled && this.addToHistory(new sq(`Structured result: ${JSON.stringify(e)}`)), W.debug("✅ Structured output successful"), m = !0, e;
205551
205551
  } catch (e) {
205552
205552
  throw W.error(`\u274C Structured output failed: ${e}`), Error(`Failed to generate structured output: ${e instanceof Error ? e.message : String(e)}`);
205553
205553
  }
205554
- return W.info(`\u{1F389} Agent execution complete in ${((Date.now() - p) / 1e3).toFixed(2)} seconds`), m = !0, h || "No output generated";
205554
+ return W.debug(`\u{1F389} Agent execution complete in ${((Date.now() - p) / 1e3).toFixed(2)} seconds`), m = !0, h || "No output generated";
205555
205555
  } catch (e) {
205556
- throw W.error(`\u274C Error running query: ${e}`), f && c && (W.info("🧹 Cleaning up resources after error"), await this.close()), e;
205556
+ throw W.error(`\u274C Error running query: ${e}`), f && c && (W.debug("🧹 Cleaning up resources after error"), await this.close()), e;
205557
205557
  } finally {
205558
205558
  let e = Date.now() - p, t = 0;
205559
205559
  this.client ? t = Object.keys(this.client.getAllActiveSessions()).length : this.connectors && (t = this.connectors.length);
@@ -205581,7 +205581,7 @@ Raw error: ${s}`);
205581
205581
  executionTimeMs: e,
205582
205582
  errorType: m ? null : "execution_error",
205583
205583
  conversationHistoryLength: n
205584
- }), c && !this.client && f && (W.info("🧹 Closing agent after stream completion"), await this.close());
205584
+ }), c && !this.client && f && (W.debug("🧹 Closing agent after stream completion"), await this.close());
205585
205585
  }
205586
205586
  }
205587
205587
  async flush() {
@@ -205592,13 +205592,13 @@ Raw error: ${s}`);
205592
205592
  await this.remoteAgent.close();
205593
205593
  return;
205594
205594
  }
205595
- W.info("🔌 Closing MCPAgent resources…"), await this.observabilityManager.shutdown();
205595
+ W.debug("🔌 Closing MCPAgent resources…"), await this.observabilityManager.shutdown();
205596
205596
  try {
205597
- if (this._agentExecutor = null, this._tools = [], this.client) this.clientOwnedByAgent ? (W.info("🔄 Closing internally-created client (simplified mode) and cleaning up resources"), await this.client.close(), this.sessions = {}, this.client = void 0) : (W.info("🔄 Closing client and cleaning up resources"), await this.client.close(), this.sessions = {});
205598
- else for (let e of this.connectors) W.info("🔄 Disconnecting connector"), await e.disconnect();
205597
+ if (this._agentExecutor = null, this._tools = [], this.client) this.clientOwnedByAgent ? (W.debug("🔄 Closing internally-created client (simplified mode) and cleaning up resources"), await this.client.close(), this.sessions = {}, this.client = void 0) : (W.debug("🔄 Closing client and cleaning up resources"), await this.client.close(), this.sessions = {});
205598
+ else for (let e of this.connectors) W.debug("🔄 Disconnecting connector"), await e.disconnect();
205599
205599
  this.isSimplifiedMode && this.llm && (W.debug("🔄 Clearing LLM reference (simplified mode)"), this.llm = void 0), "connectorToolMap" in this.adapter && (this.adapter = new h9());
205600
205600
  } finally {
205601
- this._initialized = !1, W.info("👋 Agent closed successfully");
205601
+ this._initialized = !1, W.debug("👋 Agent closed successfully");
205602
205602
  }
205603
205603
  }
205604
205604
  async *prettyStreamEvents(e, t, n = !0, r, i) {
@@ -205615,11 +205615,11 @@ Raw error: ${s}`);
205615
205615
  if (!e) throw Error("MCP agent failed to initialize");
205616
205616
  this.maxSteps = c ?? this.maxSteps;
205617
205617
  let t = typeof s == "string" && s.length > 50 ? `${s.slice(0, 50).replace(/\n/g, " ")}...` : typeof s == "string" ? s.replace(/\n/g, " ") : String(s);
205618
- W.info(`\u{1F4AC} Received query for streamEvents: '${t}'`), this.memoryEnabled && (W.info(`\u{1F504} Adding user message to history: ${t}`), this.addToHistory(new BK({ content: s })));
205618
+ W.debug(`\u{1F4AC} Received query for streamEvents: '${t}'`), this.memoryEnabled && (W.debug(`\u{1F504} Adding user message to history: ${t}`), this.addToHistory(new BK({ content: s })));
205619
205619
  let n = u ?? this.conversationHistory, r = [];
205620
- for (let e of n) this._isHumanMessageLike(e) || this._isAIMessageLike(e) || this._isToolMessageLike(e) ? r.push(e) : W.info(`\u26A0\uFE0F Skipped message of type: ${e.constructor?.name || typeof e}`);
205620
+ for (let e of n) this._isHumanMessageLike(e) || this._isAIMessageLike(e) || this._isToolMessageLike(e) ? r.push(e) : W.debug(`\u26A0\uFE0F Skipped message of type: ${e.constructor?.name || typeof e}`);
205621
205621
  let i = [...r, new BK(s)];
205622
- W.info("callbacks", this.callbacks);
205622
+ W.debug("callbacks", this.callbacks);
205623
205623
  let a = e.streamEvents({ messages: i }, {
205624
205624
  streamMode: "messages",
205625
205625
  version: "v2",
@@ -205649,7 +205649,7 @@ Raw error: ${s}`);
205649
205649
  }
205650
205650
  }
205651
205651
  if (d && v) {
205652
- W.info("🔧 Attempting structured output conversion...");
205652
+ W.debug("🔧 Attempting structured output conversion...");
205653
205653
  try {
205654
205654
  let e = !1, t = null, n = null;
205655
205655
  this._attemptStructuredOutput(v, this.llm, d).then((n) => (e = !0, t = n, n)).catch((t) => {
@@ -205667,7 +205667,7 @@ Raw error: ${s}`);
205667
205667
  t && (yield {
205668
205668
  event: "on_structured_output",
205669
205669
  data: { output: t }
205670
- }, this.memoryEnabled && this.addToHistory(new sq(`Structured result: ${JSON.stringify(t)}`)), W.info("✅ Structured output successful"));
205670
+ }, this.memoryEnabled && this.addToHistory(new sq(`Structured result: ${JSON.stringify(t)}`)), W.debug("✅ Structured output successful"));
205671
205671
  } catch (e) {
205672
205672
  W.warn(`\u26A0\uFE0F Structured output failed: ${e}`), yield {
205673
205673
  event: "on_structured_output_error",
@@ -205675,9 +205675,9 @@ Raw error: ${s}`);
205675
205675
  };
205676
205676
  }
205677
205677
  } else this.memoryEnabled && v && this.addToHistory(new sq(v));
205678
- console.log("\n\n"), W.info(`\u{1F389} StreamEvents complete - ${g} events emitted`), h = !0;
205678
+ console.log("\n\n"), W.debug(`\u{1F389} StreamEvents complete - ${g} events emitted`), h = !0;
205679
205679
  } catch (e) {
205680
- throw W.error(`\u274C Error during streamEvents: ${e}`), p && l && (W.info("🧹 Cleaning up resources after initialization error in streamEvents"), await this.close()), e;
205680
+ throw W.error(`\u274C Error during streamEvents: ${e}`), p && l && (W.debug("🧹 Cleaning up resources after initialization error in streamEvents"), await this.close()), e;
205681
205681
  } finally {
205682
205682
  let e = Date.now() - m, t = 0;
205683
205683
  this.client ? t = Object.keys(this.client.getAllActiveSessions()).length : this.connectors && (t = this.connectors.length);
@@ -205702,22 +205702,22 @@ Raw error: ${s}`);
205702
205702
  executionTimeMs: e,
205703
205703
  errorType: h ? null : "streaming_error",
205704
205704
  conversationHistoryLength: n
205705
- }), l && !this.client && p && (W.info("🧹 Closing agent after streamEvents completion"), await this.close());
205705
+ }), l && !this.client && p && (W.debug("🧹 Closing agent after streamEvents completion"), await this.close());
205706
205706
  }
205707
205707
  }
205708
205708
  async _attemptStructuredOutput(e, t, n) {
205709
- W.info(`\u{1F504} Attempting structured output with schema: ${JSON.stringify(n, null, 2)}`), W.info(`\u{1F504} Raw result: ${JSON.stringify(e, null, 2)}`);
205709
+ W.debug(`\u{1F504} Attempting structured output with schema: ${JSON.stringify(n, null, 2)}`), W.debug(`\u{1F504} Raw result: ${JSON.stringify(e, null, 2)}`);
205710
205710
  let r = null, i = "";
205711
205711
  if (W.debug(`\u{1F504} Structured output requested, schema: ${JSON.stringify(cb(n), null, 2)}`), t && "withStructuredOutput" in t && typeof t.withStructuredOutput == "function") r = t.withStructuredOutput(n);
205712
205712
  else if (t) r = t;
205713
205713
  else throw Error("LLM is required for structured output");
205714
205714
  let { $schema: a, additionalProperties: o, ...s } = cb(n);
205715
- i = JSON.stringify(s, null, 2), W.info(`\u{1F504} Schema description: ${i}`);
205715
+ i = JSON.stringify(s, null, 2), W.debug(`\u{1F504} Schema description: ${i}`);
205716
205716
  let c = "";
205717
- typeof e == "string" ? c = e : e && typeof e == "object" && (c = JSON.stringify(e)), W.info("rawResult", e), c ||= JSON.stringify(e);
205717
+ typeof e == "string" ? c = e : e && typeof e == "object" && (c = JSON.stringify(e)), W.debug("rawResult", e), c ||= JSON.stringify(e);
205718
205718
  let l = "";
205719
205719
  for (let e = 1; e <= 3; e++) {
205720
- W.info(`\u{1F504} Structured output attempt ${e}/3`);
205720
+ W.debug(`\u{1F504} Structured output attempt ${e}/3`);
205721
205721
  let t = `
205722
205722
  Please format the following information according to the EXACT schema specified below.
205723
205723
  You must use the exact field names and types as shown in the schema.
@@ -205742,9 +205742,9 @@ Raw error: ${s}`);
205742
205742
  Please fix the issues mentioned above and ensure the output matches the schema exactly.
205743
205743
  `);
205744
205744
  try {
205745
- W.info(`\u{1F504} Structured output attempt ${e} - using streaming approach`);
205745
+ W.debug(`\u{1F504} Structured output attempt ${e} - using streaming approach`);
205746
205746
  let i = c.length > 300 ? `${c.slice(0, 300)}...` : c;
205747
- W.info(`\u{1F504} Content being formatted (${c.length} chars): ${i}`), W.info(`\u{1F504} Full format prompt (${t.length} chars):
205747
+ W.debug(`\u{1F504} Content being formatted (${c.length} chars): ${i}`), W.debug(`\u{1F504} Full format prompt (${t.length} chars):
205748
205748
  ${t}`);
205749
205749
  let a = await r.stream(t), o = null, s = 0;
205750
205750
  for await (let e of a) {
@@ -205761,9 +205761,9 @@ ${t}`);
205761
205761
  }
205762
205762
  s % 10 == 0 && W.debug(`\u{1F504} Structured output streaming: ${s} chunks`);
205763
205763
  }
205764
- if (W.info(`\u{1F504} Structured result attempt ${e}: ${JSON.stringify(o, null, 2)}`), !o) throw Error("No structured result received from stream");
205764
+ if (W.debug(`\u{1F504} Structured result attempt ${e}: ${JSON.stringify(o, null, 2)}`), !o) throw Error("No structured result received from stream");
205765
205765
  let l = this._validateStructuredResult(o, n);
205766
- return W.info(`\u2705 Structured output successful on attempt ${e}`), l;
205766
+ return W.debug(`\u2705 Structured output successful on attempt ${e}`), l;
205767
205767
  } catch (t) {
205768
205768
  if (l = t instanceof Error ? t.message : String(t), W.warn(`\u26A0\uFE0F Structured output attempt ${e} failed: ${l}`), e === 3) throw W.error("❌ All 3 structured output attempts failed"), Error(`Failed to generate valid structured output after 3 attempts. Last error: ${l}`);
205769
205769
  continue;