{
  "components": {
    "parameters": {},
    "schemas": {
      "ProblemDetails": {
        "description": "Ошибка в формате Problem Details (RFC 9457)",
        "properties": {
          "code": {
            "description": "Стабильный машиночитаемый код ошибки",
            "type": "string"
          },
          "detail": {
            "description": "Пояснение для человека",
            "type": "string"
          },
          "errors": {
            "description": "Ошибки валидации по полям",
            "items": {
              "properties": {
                "name": {
                  "description": "Имя поля",
                  "type": "string"
                },
                "pointer": {
                  "description": "JSON Pointer на поле",
                  "type": "string"
                },
                "reason": {
                  "description": "Причина",
                  "type": "string"
                },
                "rule": {
                  "description": "Нарушенное правило",
                  "type": "string"
                }
              },
              "required": [
                "reason"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "instance": {
            "description": "Путь запроса, в котором возникла ошибка",
            "type": "string"
          },
          "request_id": {
            "description": "Идентификатор запроса для обращения в поддержку",
            "type": "string"
          },
          "status": {
            "description": "HTTP-статус",
            "type": "integer"
          },
          "title": {
            "description": "Краткое описание",
            "type": "string"
          },
          "trace_id": {
            "description": "Идентификатор трассы",
            "type": "string"
          },
          "type": {
            "description": "URI типа ошибки, ведёт на описание в документации",
            "format": "uri",
            "type": "string"
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "code"
        ],
        "type": "object"
      },
      "SystemAgentAuthor": {
        "properties": {
          "id": {
            "description": "Сотрудник, внёсший изменение",
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "description": "staff — сотрудник платформы; system — перенос из поставки платформы",
            "enum": [
              "staff",
              "system"
            ],
            "type": "string"
          },
          "name": {
            "description": "Имя сотрудника на момент изменения",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "kind",
          "id",
          "name"
        ],
        "type": "object"
      },
      "SystemAgentBase": {
        "properties": {
          "files": {
            "$ref": "#/components/schemas/SystemAgentBaseFiles"
          },
          "updatedAt": {
            "description": "Время, ISO 8601",
            "type": "string"
          },
          "updatedBy": {
            "$ref": "#/components/schemas/SystemAgentAuthor"
          },
          "version": {
            "description": "Номер версии",
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "version",
          "files",
          "updatedAt",
          "updatedBy"
        ],
        "type": "object"
      },
      "SystemAgentBaseFiles": {
        "properties": {
          "AGENTS.md": {
            "description": "Общие правила работы агентов: инструменты, ответы, память",
            "type": "string"
          },
          "STYLE.md": {
            "description": "Общий стиль общения, дополняет характер каждого пресета",
            "type": "string"
          }
        },
        "required": [
          "AGENTS.md",
          "STYLE.md"
        ],
        "type": "object"
      },
      "SystemAgentBasePatch": {
        "additionalProperties": false,
        "properties": {
          "files": {
            "additionalProperties": false,
            "properties": {
              "AGENTS.md": {
                "description": "Содержимое файла в Markdown",
                "type": "string"
              },
              "STYLE.md": {
                "description": "Содержимое файла в Markdown",
                "type": "string"
              }
            },
            "type": "object"
          }
        },
        "required": [
          "files"
        ],
        "type": "object"
      },
      "SystemAgentBaseVersion": {
        "properties": {
          "author": {
            "$ref": "#/components/schemas/SystemAgentAuthor"
          },
          "createdAt": {
            "description": "Время, ISO 8601",
            "type": "string"
          },
          "files": {
            "$ref": "#/components/schemas/SystemAgentBaseFiles"
          },
          "origin": {
            "description": "seeded — перенос из поставки; edited — правка; restored — откат к прежней версии",
            "enum": [
              "seeded",
              "edited",
              "restored"
            ],
            "type": "string"
          },
          "restoredFrom": {
            "description": "Версия, к которой выполнен откат",
            "type": [
              "integer",
              "null"
            ]
          },
          "version": {
            "description": "Номер версии",
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "version",
          "files",
          "author",
          "origin",
          "restoredFrom",
          "createdAt"
        ],
        "type": "object"
      },
      "SystemAgentCatalog": {
        "properties": {
          "base": {
            "properties": {
              "updatedAt": {
                "description": "Время, ISO 8601",
                "type": "string"
              },
              "updatedBy": {
                "$ref": "#/components/schemas/SystemAgentAuthor"
              },
              "version": {
                "description": "Номер версии",
                "minimum": 1,
                "type": "integer"
              }
            },
            "required": [
              "version",
              "updatedAt",
              "updatedBy"
            ],
            "type": "object"
          },
          "presets": {
            "items": {
              "properties": {
                "description": {
                  "type": "string"
                },
                "id": {
                  "description": "Пресет",
                  "enum": [
                    "paralegal",
                    "civilist",
                    "litigator",
                    "investigator",
                    "compliance",
                    "legal-engineer",
                    "custom"
                  ],
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "updatedAt": {
                  "description": "Время, ISO 8601",
                  "type": "string"
                },
                "updatedBy": {
                  "$ref": "#/components/schemas/SystemAgentAuthor"
                },
                "version": {
                  "description": "Номер версии",
                  "minimum": 1,
                  "type": "integer"
                }
              },
              "required": [
                "id",
                "label",
                "description",
                "version",
                "updatedAt",
                "updatedBy"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "skills": {
            "items": {
              "properties": {
                "slug": {
                  "description": "Навык",
                  "pattern": "^[a-z][a-z0-9-]{0,63}$",
                  "type": "string"
                },
                "updatedAt": {
                  "description": "Время, ISO 8601",
                  "type": "string"
                },
                "updatedBy": {
                  "$ref": "#/components/schemas/SystemAgentAuthor"
                },
                "usedBy": {
                  "items": {
                    "description": "Пресет",
                    "enum": [
                      "paralegal",
                      "civilist",
                      "litigator",
                      "investigator",
                      "compliance",
                      "legal-engineer",
                      "custom"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                },
                "version": {
                  "description": "Номер версии",
                  "minimum": 1,
                  "type": "integer"
                }
              },
              "required": [
                "slug",
                "version",
                "usedBy",
                "updatedAt",
                "updatedBy"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "base",
          "presets",
          "skills"
        ],
        "type": "object"
      },
      "SystemAgentModels": {
        "properties": {
          "auxCompressionModel": {
            "description": "Модель сжатия контекста; null — модель для поручений",
            "type": [
              "string",
              "null"
            ]
          },
          "auxProvider": {
            "description": "Провайдер вспомогательных моделей",
            "type": "string"
          },
          "auxVisionModel": {
            "description": "Модель для изображений; null — основная модель",
            "type": [
              "string",
              "null"
            ]
          },
          "delegationModel": {
            "description": "Модель для поручений",
            "type": "string"
          },
          "model": {
            "description": "Основная модель",
            "type": "string"
          }
        },
        "required": [
          "model",
          "delegationModel",
          "auxProvider",
          "auxCompressionModel",
          "auxVisionModel"
        ],
        "type": "object"
      },
      "SystemAgentPreset": {
        "properties": {
          "description": {
            "description": "Описание для выбора роли",
            "type": "string"
          },
          "files": {
            "$ref": "#/components/schemas/SystemAgentPresetFiles"
          },
          "icon": {
            "description": "Иконка",
            "type": "string"
          },
          "id": {
            "description": "Пресет",
            "enum": [
              "paralegal",
              "civilist",
              "litigator",
              "investigator",
              "compliance",
              "legal-engineer",
              "custom"
            ],
            "type": "string"
          },
          "label": {
            "description": "Название",
            "type": "string"
          },
          "language": {
            "description": "Язык общения по умолчанию",
            "type": "string"
          },
          "models": {
            "$ref": "#/components/schemas/SystemAgentModels"
          },
          "skills": {
            "description": "Навыки пресета",
            "items": {
              "description": "Навык",
              "pattern": "^[a-z][a-z0-9-]{0,63}$",
              "type": "string"
            },
            "type": "array"
          },
          "updatedAt": {
            "description": "Время, ISO 8601",
            "type": "string"
          },
          "updatedBy": {
            "$ref": "#/components/schemas/SystemAgentAuthor"
          },
          "version": {
            "description": "Номер версии",
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "id",
          "version",
          "label",
          "description",
          "icon",
          "language",
          "models",
          "skills",
          "files",
          "updatedAt",
          "updatedBy"
        ],
        "type": "object"
      },
      "SystemAgentPresetFiles": {
        "properties": {
          "SOUL.md": {
            "description": "Роль и характер пресета",
            "type": "string"
          }
        },
        "required": [
          "SOUL.md"
        ],
        "type": "object"
      },
      "SystemAgentPresetPatch": {
        "additionalProperties": false,
        "properties": {
          "description": {
            "type": "string"
          },
          "files": {
            "additionalProperties": false,
            "properties": {
              "SOUL.md": {
                "description": "Содержимое файла в Markdown",
                "type": "string"
              }
            },
            "type": "object"
          },
          "icon": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "models": {
            "additionalProperties": false,
            "properties": {
              "auxCompressionModel": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "auxProvider": {
                "type": "string"
              },
              "auxVisionModel": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "delegationModel": {
                "type": "string"
              },
              "model": {
                "type": "string"
              }
            },
            "type": "object"
          },
          "skills": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "SystemAgentPresetVersion": {
        "properties": {
          "author": {
            "$ref": "#/components/schemas/SystemAgentAuthor"
          },
          "createdAt": {
            "description": "Время, ISO 8601",
            "type": "string"
          },
          "description": {
            "description": "Описание для выбора роли",
            "type": "string"
          },
          "files": {
            "$ref": "#/components/schemas/SystemAgentPresetFiles"
          },
          "icon": {
            "description": "Иконка",
            "type": "string"
          },
          "id": {
            "description": "Пресет",
            "enum": [
              "paralegal",
              "civilist",
              "litigator",
              "investigator",
              "compliance",
              "legal-engineer",
              "custom"
            ],
            "type": "string"
          },
          "label": {
            "description": "Название",
            "type": "string"
          },
          "language": {
            "description": "Язык общения по умолчанию",
            "type": "string"
          },
          "models": {
            "$ref": "#/components/schemas/SystemAgentModels"
          },
          "origin": {
            "description": "seeded — перенос из поставки; edited — правка; restored — откат к прежней версии",
            "enum": [
              "seeded",
              "edited",
              "restored"
            ],
            "type": "string"
          },
          "restoredFrom": {
            "description": "Версия, к которой выполнен откат",
            "type": [
              "integer",
              "null"
            ]
          },
          "skills": {
            "description": "Навыки пресета",
            "items": {
              "description": "Навык",
              "pattern": "^[a-z][a-z0-9-]{0,63}$",
              "type": "string"
            },
            "type": "array"
          },
          "version": {
            "description": "Номер версии",
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "id",
          "version",
          "label",
          "description",
          "icon",
          "language",
          "models",
          "skills",
          "files",
          "author",
          "origin",
          "restoredFrom",
          "createdAt"
        ],
        "type": "object"
      },
      "SystemAgentSkill": {
        "properties": {
          "content": {
            "description": "SKILL.md навыка",
            "type": "string"
          },
          "slug": {
            "description": "Навык",
            "pattern": "^[a-z][a-z0-9-]{0,63}$",
            "type": "string"
          },
          "updatedAt": {
            "description": "Время, ISO 8601",
            "type": "string"
          },
          "updatedBy": {
            "$ref": "#/components/schemas/SystemAgentAuthor"
          },
          "usedBy": {
            "description": "Пресеты с этим навыком",
            "items": {
              "description": "Пресет",
              "enum": [
                "paralegal",
                "civilist",
                "litigator",
                "investigator",
                "compliance",
                "legal-engineer",
                "custom"
              ],
              "type": "string"
            },
            "type": "array"
          },
          "version": {
            "description": "Номер версии",
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "slug",
          "version",
          "content",
          "usedBy",
          "updatedAt",
          "updatedBy"
        ],
        "type": "object"
      },
      "SystemAgentSkillContent": {
        "additionalProperties": false,
        "properties": {
          "content": {
            "description": "Содержимое файла в Markdown",
            "type": "string"
          }
        },
        "required": [
          "content"
        ],
        "type": "object"
      },
      "SystemAgentSkillVersion": {
        "properties": {
          "author": {
            "$ref": "#/components/schemas/SystemAgentAuthor"
          },
          "content": {
            "description": "Содержимое файла в Markdown",
            "type": "string"
          },
          "createdAt": {
            "description": "Время, ISO 8601",
            "type": "string"
          },
          "origin": {
            "description": "seeded — перенос из поставки; edited — правка; restored — откат к прежней версии",
            "enum": [
              "seeded",
              "edited",
              "restored"
            ],
            "type": "string"
          },
          "restoredFrom": {
            "description": "Версия, к которой выполнен откат",
            "type": [
              "integer",
              "null"
            ]
          },
          "slug": {
            "description": "Навык",
            "pattern": "^[a-z][a-z0-9-]{0,63}$",
            "type": "string"
          },
          "version": {
            "description": "Номер версии",
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "slug",
          "version",
          "content",
          "author",
          "origin",
          "restoredFrom",
          "createdAt"
        ],
        "type": "object"
      },
      "SystemAgentVersionPage": {
        "properties": {
          "nextBefore": {
            "description": "Значение before для следующей страницы",
            "type": [
              "integer",
              "null"
            ]
          },
          "versions": {
            "items": {
              "$ref": "#/components/schemas/SystemAgentVersionSummary"
            },
            "type": "array"
          }
        },
        "required": [
          "versions",
          "nextBefore"
        ],
        "type": "object"
      },
      "SystemAgentVersionSummary": {
        "properties": {
          "author": {
            "$ref": "#/components/schemas/SystemAgentAuthor"
          },
          "changed": {
            "description": "Изменённые поля относительно предыдущей версии, например files.SOUL.md",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "createdAt": {
            "description": "Время, ISO 8601",
            "type": "string"
          },
          "origin": {
            "description": "seeded — перенос из поставки; edited — правка; restored — откат к прежней версии",
            "enum": [
              "seeded",
              "edited",
              "restored"
            ],
            "type": "string"
          },
          "restoredFrom": {
            "description": "Версия, к которой выполнен откат",
            "type": [
              "integer",
              "null"
            ]
          },
          "version": {
            "description": "Номер версии",
            "minimum": 1,
            "type": "integer"
          }
        },
        "required": [
          "version",
          "author",
          "origin",
          "restoredFrom",
          "createdAt",
          "changed"
        ],
        "type": "object"
      }
    },
    "securitySchemes": {
      "dpop": {
        "bearerFormat": "JWT",
        "description": "Access token, привязанный к ключу клиента по RFC 9449: заголовок `Authorization: DPoP <token>` и заголовок `DPoP` с доказательством для каждого запроса. Сервер выдаёт `DPoP-Nonce`, который клиент включает в доказательство.",
        "scheme": "dpop",
        "type": "http"
      },
      "mutualTLS": {
        "description": "Access token, привязанный к клиентскому сертификату по RFC 8705: заголовок `Authorization: Bearer <token>` поверх mTLS-соединения тем же сертификатом.",
        "type": "mutualTLS"
      }
    }
  },
  "info": {
    "description": "Системные агенты платформы: пресеты, общие файлы и навыки. Доступно сотрудникам платформы.",
    "title": "LegalStack Agents API",
    "version": "1.0.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/v1/agents/system/base": {
      "get": {
        "operationId": "get_api_v1_agents_system_base",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemAgentBase"
                }
              }
            },
            "description": "Общие файлы",
            "headers": {
              "ETag": {
                "description": "Версия для заголовка If-Match",
                "required": true,
                "schema": {
                  "description": "Версия для заголовка If-Match",
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Требуется вход сотрудника платформы"
          },
          "403": {
            "description": "Нет права в панели управления"
          }
        },
        "security": [
          {
            "dpop": []
          }
        ],
        "summary": "Общие файлы системных агентов",
        "tags": [
          "system-agents"
        ]
      },
      "patch": {
        "description": "Сохраняет новую версию и применяет её к агентам всех команд.",
        "operationId": "patch_api_v1_agents_system_base",
        "parameters": [
          {
            "description": "ETag текущей версии из заголовка ответа, например \"3\"",
            "in": "header",
            "name": "if-match",
            "required": false,
            "schema": {
              "description": "ETag текущей версии из заголовка ответа, например \"3\"",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SystemAgentBasePatch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemAgentBase"
                }
              }
            },
            "description": "Общие файлы после изменения",
            "headers": {
              "ETag": {
                "description": "Версия для заголовка If-Match",
                "required": true,
                "schema": {
                  "description": "Версия для заголовка If-Match",
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Некорректный запрос: не прошла валидация параметров или тела"
          },
          "401": {
            "description": "Требуется вход сотрудника платформы"
          },
          "403": {
            "description": "Нет права в панели управления"
          },
          "404": {
            "description": "Не найдено"
          },
          "412": {
            "description": "Версию уже изменили: обновите данные и повторите"
          },
          "422": {
            "description": "Содержимое не прошло проверку"
          },
          "428": {
            "description": "Не передан заголовок If-Match"
          }
        },
        "security": [
          {
            "dpop": []
          }
        ],
        "summary": "Изменить общие файлы",
        "tags": [
          "system-agents"
        ]
      }
    },
    "/api/v1/agents/system/base/versions": {
      "get": {
        "operationId": "get_api_v1_agents_system_base_versions",
        "parameters": [
          {
            "description": "Сколько версий вернуть",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "description": "Сколько версий вернуть",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Вернуть версии с номером меньше указанного",
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "description": "Вернуть версии с номером меньше указанного",
              "minimum": 2,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemAgentVersionPage"
                }
              }
            },
            "description": "Версии"
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Некорректный запрос: не прошла валидация параметров или тела"
          },
          "401": {
            "description": "Требуется вход сотрудника платформы"
          },
          "403": {
            "description": "Нет права в панели управления"
          }
        },
        "security": [
          {
            "dpop": []
          }
        ],
        "summary": "История общих файлов",
        "tags": [
          "system-agents"
        ]
      }
    },
    "/api/v1/agents/system/base/versions/{version}": {
      "get": {
        "operationId": "get_api_v1_agents_system_base_versions_version",
        "parameters": [
          {
            "description": "Номер версии",
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "description": "Номер версии",
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemAgentBaseVersion"
                }
              }
            },
            "description": "Версия"
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Некорректный запрос: не прошла валидация параметров или тела"
          },
          "401": {
            "description": "Требуется вход сотрудника платформы"
          },
          "403": {
            "description": "Нет права в панели управления"
          },
          "404": {
            "description": "Не найдено"
          }
        },
        "security": [
          {
            "dpop": []
          }
        ],
        "summary": "Версия общих файлов",
        "tags": [
          "system-agents"
        ]
      }
    },
    "/api/v1/agents/system/base/versions/{version}/restore": {
      "post": {
        "description": "Создаёт новую версию с содержимым указанной; история не переписывается.",
        "operationId": "post_api_v1_agents_system_base_versions_version_restore",
        "parameters": [
          {
            "description": "Номер версии",
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "description": "Номер версии",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "ETag текущей версии из заголовка ответа, например \"3\"",
            "in": "header",
            "name": "if-match",
            "required": false,
            "schema": {
              "description": "ETag текущей версии из заголовка ответа, например \"3\"",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemAgentBase"
                }
              }
            },
            "description": "Общие файлы после отката",
            "headers": {
              "ETag": {
                "description": "Версия для заголовка If-Match",
                "required": true,
                "schema": {
                  "description": "Версия для заголовка If-Match",
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Некорректный запрос: не прошла валидация параметров или тела"
          },
          "401": {
            "description": "Требуется вход сотрудника платформы"
          },
          "403": {
            "description": "Нет права в панели управления"
          },
          "404": {
            "description": "Не найдено"
          },
          "412": {
            "description": "Версию уже изменили: обновите данные и повторите"
          },
          "422": {
            "description": "Содержимое не прошло проверку"
          },
          "428": {
            "description": "Не передан заголовок If-Match"
          }
        },
        "security": [
          {
            "dpop": []
          }
        ],
        "summary": "Вернуть версию общих файлов",
        "tags": [
          "system-agents"
        ]
      }
    },
    "/api/v1/agents/system/catalog": {
      "get": {
        "description": "Общие файлы, пресеты и навыки с номерами текущих версий.",
        "operationId": "get_api_v1_agents_system_catalog",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemAgentCatalog"
                }
              }
            },
            "description": "Каталог"
          },
          "401": {
            "description": "Требуется вход сотрудника платформы"
          },
          "403": {
            "description": "Нет права в панели управления"
          }
        },
        "security": [
          {
            "dpop": []
          }
        ],
        "summary": "Каталог системных агентов",
        "tags": [
          "system-agents"
        ]
      }
    },
    "/api/v1/agents/system/presets/{presetId}": {
      "get": {
        "operationId": "get_api_v1_agents_system_presets_presetId",
        "parameters": [
          {
            "description": "Пресет",
            "in": "path",
            "name": "presetId",
            "required": true,
            "schema": {
              "description": "Пресет",
              "enum": [
                "paralegal",
                "civilist",
                "litigator",
                "investigator",
                "compliance",
                "legal-engineer",
                "custom"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemAgentPreset"
                }
              }
            },
            "description": "Пресет",
            "headers": {
              "ETag": {
                "description": "Версия для заголовка If-Match",
                "required": true,
                "schema": {
                  "description": "Версия для заголовка If-Match",
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Некорректный запрос: не прошла валидация параметров или тела"
          },
          "401": {
            "description": "Требуется вход сотрудника платформы"
          },
          "403": {
            "description": "Нет права в панели управления"
          },
          "404": {
            "description": "Не найдено"
          }
        },
        "security": [
          {
            "dpop": []
          }
        ],
        "summary": "Пресет",
        "tags": [
          "system-agents"
        ]
      },
      "patch": {
        "description": "Сохраняет новую версию и применяет её к агентам команд с этим пресетом.",
        "operationId": "patch_api_v1_agents_system_presets_presetId",
        "parameters": [
          {
            "description": "Пресет",
            "in": "path",
            "name": "presetId",
            "required": true,
            "schema": {
              "description": "Пресет",
              "enum": [
                "paralegal",
                "civilist",
                "litigator",
                "investigator",
                "compliance",
                "legal-engineer",
                "custom"
              ],
              "type": "string"
            }
          },
          {
            "description": "ETag текущей версии из заголовка ответа, например \"3\"",
            "in": "header",
            "name": "if-match",
            "required": false,
            "schema": {
              "description": "ETag текущей версии из заголовка ответа, например \"3\"",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SystemAgentPresetPatch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemAgentPreset"
                }
              }
            },
            "description": "Пресет после изменения",
            "headers": {
              "ETag": {
                "description": "Версия для заголовка If-Match",
                "required": true,
                "schema": {
                  "description": "Версия для заголовка If-Match",
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Некорректный запрос: не прошла валидация параметров или тела"
          },
          "401": {
            "description": "Требуется вход сотрудника платформы"
          },
          "403": {
            "description": "Нет права в панели управления"
          },
          "404": {
            "description": "Не найдено"
          },
          "412": {
            "description": "Версию уже изменили: обновите данные и повторите"
          },
          "422": {
            "description": "Содержимое не прошло проверку"
          },
          "428": {
            "description": "Не передан заголовок If-Match"
          }
        },
        "security": [
          {
            "dpop": []
          }
        ],
        "summary": "Изменить пресет",
        "tags": [
          "system-agents"
        ]
      }
    },
    "/api/v1/agents/system/presets/{presetId}/versions": {
      "get": {
        "operationId": "get_api_v1_agents_system_presets_presetId_versions",
        "parameters": [
          {
            "description": "Пресет",
            "in": "path",
            "name": "presetId",
            "required": true,
            "schema": {
              "description": "Пресет",
              "enum": [
                "paralegal",
                "civilist",
                "litigator",
                "investigator",
                "compliance",
                "legal-engineer",
                "custom"
              ],
              "type": "string"
            }
          },
          {
            "description": "Сколько версий вернуть",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "description": "Сколько версий вернуть",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Вернуть версии с номером меньше указанного",
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "description": "Вернуть версии с номером меньше указанного",
              "minimum": 2,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemAgentVersionPage"
                }
              }
            },
            "description": "Версии"
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Некорректный запрос: не прошла валидация параметров или тела"
          },
          "401": {
            "description": "Требуется вход сотрудника платформы"
          },
          "403": {
            "description": "Нет права в панели управления"
          },
          "404": {
            "description": "Не найдено"
          }
        },
        "security": [
          {
            "dpop": []
          }
        ],
        "summary": "История пресета",
        "tags": [
          "system-agents"
        ]
      }
    },
    "/api/v1/agents/system/presets/{presetId}/versions/{version}": {
      "get": {
        "operationId": "get_api_v1_agents_system_presets_presetId_versions_version",
        "parameters": [
          {
            "description": "Пресет",
            "in": "path",
            "name": "presetId",
            "required": true,
            "schema": {
              "description": "Пресет",
              "enum": [
                "paralegal",
                "civilist",
                "litigator",
                "investigator",
                "compliance",
                "legal-engineer",
                "custom"
              ],
              "type": "string"
            }
          },
          {
            "description": "Номер версии",
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "description": "Номер версии",
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemAgentPresetVersion"
                }
              }
            },
            "description": "Версия"
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Некорректный запрос: не прошла валидация параметров или тела"
          },
          "401": {
            "description": "Требуется вход сотрудника платформы"
          },
          "403": {
            "description": "Нет права в панели управления"
          },
          "404": {
            "description": "Не найдено"
          }
        },
        "security": [
          {
            "dpop": []
          }
        ],
        "summary": "Версия пресета",
        "tags": [
          "system-agents"
        ]
      }
    },
    "/api/v1/agents/system/presets/{presetId}/versions/{version}/restore": {
      "post": {
        "description": "Создаёт новую версию с содержимым указанной; история не переписывается.",
        "operationId": "post_api_v1_agents_system_presets_presetId_versions_version_restore",
        "parameters": [
          {
            "description": "Пресет",
            "in": "path",
            "name": "presetId",
            "required": true,
            "schema": {
              "description": "Пресет",
              "enum": [
                "paralegal",
                "civilist",
                "litigator",
                "investigator",
                "compliance",
                "legal-engineer",
                "custom"
              ],
              "type": "string"
            }
          },
          {
            "description": "Номер версии",
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "description": "Номер версии",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "ETag текущей версии из заголовка ответа, например \"3\"",
            "in": "header",
            "name": "if-match",
            "required": false,
            "schema": {
              "description": "ETag текущей версии из заголовка ответа, например \"3\"",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemAgentPreset"
                }
              }
            },
            "description": "Пресет после отката",
            "headers": {
              "ETag": {
                "description": "Версия для заголовка If-Match",
                "required": true,
                "schema": {
                  "description": "Версия для заголовка If-Match",
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Некорректный запрос: не прошла валидация параметров или тела"
          },
          "401": {
            "description": "Требуется вход сотрудника платформы"
          },
          "403": {
            "description": "Нет права в панели управления"
          },
          "404": {
            "description": "Не найдено"
          },
          "412": {
            "description": "Версию уже изменили: обновите данные и повторите"
          },
          "422": {
            "description": "Содержимое не прошло проверку"
          },
          "428": {
            "description": "Не передан заголовок If-Match"
          }
        },
        "security": [
          {
            "dpop": []
          }
        ],
        "summary": "Вернуть версию пресета",
        "tags": [
          "system-agents"
        ]
      }
    },
    "/api/v1/agents/system/skills/{slug}": {
      "get": {
        "operationId": "get_api_v1_agents_system_skills_slug",
        "parameters": [
          {
            "description": "Навык",
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "description": "Навык",
              "pattern": "^[a-z][a-z0-9-]{0,63}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemAgentSkill"
                }
              }
            },
            "description": "Навык",
            "headers": {
              "ETag": {
                "description": "Версия для заголовка If-Match",
                "required": true,
                "schema": {
                  "description": "Версия для заголовка If-Match",
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Некорректный запрос: не прошла валидация параметров или тела"
          },
          "401": {
            "description": "Требуется вход сотрудника платформы"
          },
          "403": {
            "description": "Нет права в панели управления"
          },
          "404": {
            "description": "Не найдено"
          }
        },
        "security": [
          {
            "dpop": []
          }
        ],
        "summary": "Навык",
        "tags": [
          "system-agents"
        ]
      },
      "put": {
        "description": "Сохраняет новую версию SKILL.md и применяет её к агентам команд, у которых есть этот навык.",
        "operationId": "put_api_v1_agents_system_skills_slug",
        "parameters": [
          {
            "description": "Навык",
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "description": "Навык",
              "pattern": "^[a-z][a-z0-9-]{0,63}$",
              "type": "string"
            }
          },
          {
            "description": "ETag текущей версии из заголовка ответа, например \"3\"",
            "in": "header",
            "name": "if-match",
            "required": false,
            "schema": {
              "description": "ETag текущей версии из заголовка ответа, например \"3\"",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SystemAgentSkillContent"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemAgentSkill"
                }
              }
            },
            "description": "Навык после изменения",
            "headers": {
              "ETag": {
                "description": "Версия для заголовка If-Match",
                "required": true,
                "schema": {
                  "description": "Версия для заголовка If-Match",
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Некорректный запрос: не прошла валидация параметров или тела"
          },
          "401": {
            "description": "Требуется вход сотрудника платформы"
          },
          "403": {
            "description": "Нет права в панели управления"
          },
          "404": {
            "description": "Не найдено"
          },
          "412": {
            "description": "Версию уже изменили: обновите данные и повторите"
          },
          "422": {
            "description": "Содержимое не прошло проверку"
          },
          "428": {
            "description": "Не передан заголовок If-Match"
          }
        },
        "security": [
          {
            "dpop": []
          }
        ],
        "summary": "Изменить навык",
        "tags": [
          "system-agents"
        ]
      }
    },
    "/api/v1/agents/system/skills/{slug}/versions": {
      "get": {
        "operationId": "get_api_v1_agents_system_skills_slug_versions",
        "parameters": [
          {
            "description": "Навык",
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "description": "Навык",
              "pattern": "^[a-z][a-z0-9-]{0,63}$",
              "type": "string"
            }
          },
          {
            "description": "Сколько версий вернуть",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "description": "Сколько версий вернуть",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Вернуть версии с номером меньше указанного",
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "description": "Вернуть версии с номером меньше указанного",
              "minimum": 2,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemAgentVersionPage"
                }
              }
            },
            "description": "Версии"
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Некорректный запрос: не прошла валидация параметров или тела"
          },
          "401": {
            "description": "Требуется вход сотрудника платформы"
          },
          "403": {
            "description": "Нет права в панели управления"
          },
          "404": {
            "description": "Не найдено"
          }
        },
        "security": [
          {
            "dpop": []
          }
        ],
        "summary": "История навыка",
        "tags": [
          "system-agents"
        ]
      }
    },
    "/api/v1/agents/system/skills/{slug}/versions/{version}": {
      "get": {
        "operationId": "get_api_v1_agents_system_skills_slug_versions_version",
        "parameters": [
          {
            "description": "Навык",
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "description": "Навык",
              "pattern": "^[a-z][a-z0-9-]{0,63}$",
              "type": "string"
            }
          },
          {
            "description": "Номер версии",
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "description": "Номер версии",
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemAgentSkillVersion"
                }
              }
            },
            "description": "Версия"
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Некорректный запрос: не прошла валидация параметров или тела"
          },
          "401": {
            "description": "Требуется вход сотрудника платформы"
          },
          "403": {
            "description": "Нет права в панели управления"
          },
          "404": {
            "description": "Не найдено"
          }
        },
        "security": [
          {
            "dpop": []
          }
        ],
        "summary": "Версия навыка",
        "tags": [
          "system-agents"
        ]
      }
    },
    "/api/v1/agents/system/skills/{slug}/versions/{version}/restore": {
      "post": {
        "description": "Создаёт новую версию с содержимым указанной; история не переписывается.",
        "operationId": "post_api_v1_agents_system_skills_slug_versions_version_restore",
        "parameters": [
          {
            "description": "Навык",
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "description": "Навык",
              "pattern": "^[a-z][a-z0-9-]{0,63}$",
              "type": "string"
            }
          },
          {
            "description": "Номер версии",
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "description": "Номер версии",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "ETag текущей версии из заголовка ответа, например \"3\"",
            "in": "header",
            "name": "if-match",
            "required": false,
            "schema": {
              "description": "ETag текущей версии из заголовка ответа, например \"3\"",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemAgentSkill"
                }
              }
            },
            "description": "Навык после отката",
            "headers": {
              "ETag": {
                "description": "Версия для заголовка If-Match",
                "required": true,
                "schema": {
                  "description": "Версия для заголовка If-Match",
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Некорректный запрос: не прошла валидация параметров или тела"
          },
          "401": {
            "description": "Требуется вход сотрудника платформы"
          },
          "403": {
            "description": "Нет права в панели управления"
          },
          "404": {
            "description": "Не найдено"
          },
          "412": {
            "description": "Версию уже изменили: обновите данные и повторите"
          },
          "422": {
            "description": "Содержимое не прошло проверку"
          },
          "428": {
            "description": "Не передан заголовок If-Match"
          }
        },
        "security": [
          {
            "dpop": []
          }
        ],
        "summary": "Вернуть версию навыка",
        "tags": [
          "system-agents"
        ]
      }
    }
  },
  "servers": [
    {
      "description": "Публичный API LegalStack",
      "url": "https://api.legalstack.ru"
    }
  ],
  "tags": [
    {
      "description": "Системные агенты: пресеты, общие файлы и навыки агентов платформы, история версий и откат.",
      "name": "system-agents",
      "x-displayName": "Системные агенты"
    }
  ],
  "webhooks": {}
}
