{"version":3,"file":"supervisor-failed-error.mjs","names":[],"sources":["../../../../../../../ai/src/errors/supervisor-failed-error.ts"],"sourcesContent":["import { AIError, type AIErrorOptions } from \"./ai-error\";\nimport type { AIErrorCode } from \"./error-code.type\";\n\n/**\n * Base class for every supervisor-specific failure surfaced from\n * `supervisor.execute()` / `supervisor.resume()` / authoring-time\n * `ai.supervisor()` validation.\n *\n * **Role.** Anchor for the `SUPERVISOR_*` code family. Subclasses\n * carry precise codes (`SUPERVISOR_MAX_ITERATIONS`,\n * `SUPERVISOR_INVALID_ROUTE`, …); this base catches everything a\n * supervisor run can produce that isn't already an agent / tool /\n * provider / workflow error bubbling up from a child execution.\n *\n * Child-execution errors (agent, tool, provider, workflow) flow\n * through the supervisor unchanged — they are captured on the\n * relevant branch snapshot and, if fatal, wrapped as the `cause` of a\n * `SupervisorFailedError` only when the supervisor itself has no\n * narrower subclass to throw.\n *\n * @example\n * try {\n *   ai.supervisor({\n *     route: () => \"triage\",\n *     router: routerAgent,\n *     intents: { triage },\n *   });\n * } catch (error) {\n *   if (error instanceof SupervisorFailedError) {\n *     console.error(error.code, error.message);\n *   }\n * }\n */\nexport class SupervisorFailedError extends AIError {\n  public constructor(\n    message: string,\n    options?: AIErrorOptions,\n    code: AIErrorCode = \"SUPERVISOR_FAILED\",\n  ) {\n    super(code, message, options);\n    this.name = \"SupervisorFailedError\";\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAa,wBAAb,cAA2C,QAAQ;CACjD,AAAO,YACL,SACA,SACA,OAAoB,qBACpB;EACA,MAAM,MAAM,SAAS,OAAO;EAC5B,KAAK,OAAO;CACd;AACF"}