{"version":3,"file":"max-iterations-error.mjs","names":[],"sources":["../../../../../../../ai/src/errors/max-iterations-error.ts"],"sourcesContent":["import type { AIErrorOptions } from \"./ai-error\";\nimport type { ErrorCategory } from \"./error-category.type\";\nimport { SupervisorFailedError } from \"./supervisor-failed-error\";\n\nexport type MaxIterationsErrorOptions = AIErrorOptions & {\n  maxIterations: number;\n};\n\n/**\n * Hard-cap guard: the supervisor ran `maxIterations` loop turns\n * without reaching a terminal decision (`END`, `satisfied: true`, or\n * cancellation). Terminates the run immediately with a typed error on\n * `result.error` — partial per-iteration snapshots are still\n * available on `result.report.snapshots`.\n *\n * @example\n * const { error, report } = await supervisor.execute(input);\n * if (error?.code === \"SUPERVISOR_MAX_ITERATIONS\") {\n *   logger.warn(\"supervisor did not converge\", {\n *     iterations: report.iterations,\n *   });\n * }\n */\nexport class MaxIterationsError extends SupervisorFailedError {\n  public static readonly defaultCategory: ErrorCategory = \"max-iterations\";\n\n  public readonly maxIterations: number;\n\n  public constructor(message: string, options: MaxIterationsErrorOptions) {\n    super(message, options, \"SUPERVISOR_MAX_ITERATIONS\");\n    this.name = \"MaxIterationsError\";\n    this.maxIterations = options.maxIterations;\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,IAAa,qBAAb,cAAwC,sBAAsB;;yBACJ;;CAIxD,AAAO,YAAY,SAAiB,SAAoC;EACtE,MAAM,SAAS,SAAS,2BAA2B;EACnD,KAAK,OAAO;EACZ,KAAK,gBAAgB,QAAQ;CAC/B;AACF"}