{"version":3,"file":"errors.cjs","names":["toolNames: string[]","toolName: string","errors: string[]","toolError: unknown","toolCall: ToolCall"],"sources":["../../src/agents/errors.ts"],"sourcesContent":["/* eslint-disable no-instanceof/no-instanceof */\nimport type { ToolCall } from \"@langchain/core/messages/tool\";\n\nexport class MultipleToolsBoundError extends Error {\n  constructor() {\n    super(\n      \"The provided LLM already has bound tools. \" +\n        \"Please provide an LLM without bound tools to createAgent. \" +\n        \"The agent will bind the tools provided in the 'tools' parameter.\"\n    );\n  }\n}\n\n/**\n * Raised when model returns multiple structured output tool calls when only one is expected.\n */\nexport class MultipleStructuredOutputsError extends Error {\n  public readonly toolNames: string[];\n\n  constructor(toolNames: string[]) {\n    super(\n      `The model has called multiple tools: ${toolNames.join(\n        \", \"\n      )} to return a structured output. ` +\n        \"This is not supported. Please provide a single structured output.\"\n    );\n    this.toolNames = toolNames;\n  }\n}\n\n/**\n * Raised when structured output tool call arguments fail to parse according to the schema.\n */\nexport class StructuredOutputParsingError extends Error {\n  public readonly toolName: string;\n\n  public readonly errors: string[];\n\n  constructor(toolName: string, errors: string[]) {\n    super(\n      `Failed to parse structured output for tool '${toolName}':${errors\n        .map((e) => `\\n  - ${e}`)\n        .join(\"\")}.`\n    );\n    this.toolName = toolName;\n    this.errors = errors;\n  }\n}\n\n/**\n * Raised when a tool call is throwing an error.\n */\nexport class ToolInvocationError extends Error {\n  public readonly toolCall: ToolCall;\n\n  public readonly toolError: Error;\n\n  constructor(toolError: unknown, toolCall: ToolCall) {\n    const error =\n      toolError instanceof Error ? toolError : new Error(String(toolError));\n    const toolArgs = JSON.stringify(toolCall.args);\n    super(\n      `Error invoking tool '${toolCall.name}' with kwargs ${toolArgs} with error: ${error.stack}\\n Please fix the error and try again.`\n    );\n\n    this.toolCall = toolCall;\n    this.toolError = error;\n  }\n}\n"],"mappings":";;AAGA,IAAa,0BAAb,cAA6C,MAAM;CACjD,cAAc;EACZ,MACE,uKAGD;CACF;AACF;;;;AAKD,IAAa,iCAAb,cAAoD,MAAM;CACxD,AAAgB;CAEhB,YAAYA,WAAqB;EAC/B,MACE,CAAC,qCAAqC,EAAE,UAAU,KAChD,KACD,CAAC,iGAAgC,CACmC,CACtE;EACD,KAAK,YAAY;CAClB;AACF;;;;AAKD,IAAa,+BAAb,cAAkD,MAAM;CACtD,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,UAAkBC,QAAkB;EAC9C,MACE,CAAC,4CAA4C,EAAE,SAAS,EAAE,EAAE,OACzD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACxB,KAAK,GAAG,CAAC,CAAC,CAAC,CACf;EACD,KAAK,WAAW;EAChB,KAAK,SAAS;CACf;AACF;;;;AAKD,IAAa,sBAAb,cAAyC,MAAM;CAC7C,AAAgB;CAEhB,AAAgB;CAEhB,YAAYC,WAAoBC,UAAoB;EAClD,MAAM,QACJ,qBAAqB,QAAQ,YAAY,IAAI,MAAM,OAAO,UAAU;EACtE,MAAM,WAAW,KAAK,UAAU,SAAS,KAAK;EAC9C,MACE,CAAC,qBAAqB,EAAE,SAAS,KAAK,cAAc,EAAE,SAAS,aAAa,EAAE,MAAM,MAAM,sCAAsC,CAAC,CAClI;EAED,KAAK,WAAW;EAChB,KAAK,YAAY;CAClB;AACF"}