feat(контракт): артефакты договора arm-v1 и общий mock (R-02, R-03)

R-02: схемы ответов (17), примеры (12), описание OpenAPI (22 операции), каталог ошибок,
перечень проверок и SHA256 набора; проверки держат набор полей живых ответов, типы через
JSON-схемы, отсутствие дублей путей и совпадение отпечатка. Отказ 429 при создании
проверки теперь несёт retry_seconds полем.

R-03: общий mock повторяет правила сервера — две двери, ротация и сроки пропуска,
переиспользование живой проверки, аренда строки со сроком, автоматическое завершение,
владение проверкой на уровне человека, проверка владельца и состояния в шлюзе,
tool_choice, /chat/turn и поток событий. Выложен на https://infosmeta.ru:8444.

Проверки: 170 в наборе (173 с соседними), мутации схем, примеров, описания, отпечатка
и правил mock краснеют.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
anor
2026-11-18 19:29:24 +10:00
co-authored by Claude Code
parent 8f73f988b6
commit e089b22422
37 changed files with 2451 additions and 2 deletions
+84
View File
@@ -0,0 +1,84 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Выдача строки, ожидание или конец",
"oneOf": [
{
"type": "object",
"required": [
"item"
],
"properties": {
"item": {
"type": "object",
"required": [
"ord",
"text",
"target_path",
"target_sheet",
"target_row",
"lease"
],
"properties": {
"ord": {
"type": "integer"
},
"text": {
"type": "string"
},
"target_path": {
"type": [
"string",
"null"
]
},
"target_sheet": {
"type": [
"string",
"null"
]
},
"target_row": {
"type": [
"integer",
"null"
]
},
"lease": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"wait",
"retry_seconds"
],
"properties": {
"wait": {
"type": "boolean"
},
"retry_seconds": {
"type": "integer"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"done"
],
"properties": {
"done": {
"type": "boolean"
}
},
"additionalProperties": false
}
]
}
@@ -0,0 +1,18 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Код подключения программы",
"type": "object",
"required": [
"code",
"expires_in"
],
"properties": {
"code": {
"type": "string"
},
"expires_in": {
"type": "integer"
}
},
"additionalProperties": false
}
@@ -0,0 +1,42 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Подключённые устройства",
"type": "object",
"required": [
"items"
],
"properties": {
"items": {
"type": "array",
"items": {
"type": "object",
"required": [
"id",
"name",
"app_version",
"last_seen",
"tab_id"
],
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"app_version": {
"type": "string"
},
"last_seen": {
"type": "number"
},
"tab_id": {
"type": "string"
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
@@ -0,0 +1,33 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Продление пропуска",
"type": "object",
"required": [
"access",
"refresh",
"expires_in",
"tab_id",
"min_version"
],
"properties": {
"access": {
"type": "string"
},
"refresh": {
"type": "string"
},
"expires_in": {
"type": "integer"
},
"tab_id": {
"type": [
"string",
"null"
]
},
"min_version": {
"type": "string"
}
},
"additionalProperties": false
}
@@ -0,0 +1,37 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Обмен кода на пропуск",
"type": "object",
"required": [
"access",
"refresh",
"expires_in",
"tab_id",
"min_version",
"device_id"
],
"properties": {
"access": {
"type": "string"
},
"refresh": {
"type": "string"
},
"expires_in": {
"type": "integer"
},
"tab_id": {
"type": [
"string",
"null"
]
},
"min_version": {
"type": "string"
},
"device_id": {
"type": "integer"
}
},
"additionalProperties": false
}
+29
View File
@@ -0,0 +1,29 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Отказ: код, номер запроса и старые поля",
"type": "object",
"required": [
"code",
"request_id"
],
"properties": {
"detail": {
"description": "текст человеку (ручки проверки и сайт)"
},
"error": {
"description": "короткое слово причины (шлюз)"
},
"message": {
"description": "текст человеку (шлюз)"
},
"code": {
"type": "string",
"description": "машинный код из errors.md"
},
"request_id": {
"type": "string",
"description": "равен заголовку X-Request-Id"
}
},
"additionalProperties": true
}
@@ -0,0 +1,29 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Оценка расхода проверки",
"type": "object",
"required": [
"est_rub",
"provisional",
"suggested_budget_rub",
"rub_left"
],
"properties": {
"est_rub": {
"type": "number"
},
"provisional": {
"type": "boolean"
},
"suggested_budget_rub": {
"type": "number"
},
"rub_left": {
"type": [
"number",
"null"
]
}
},
"additionalProperties": false
}
+14
View File
@@ -0,0 +1,14 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Успешное действие без данных",
"type": "object",
"required": [
"ok"
],
"properties": {
"ok": {
"type": "boolean"
}
},
"additionalProperties": false
}
+32
View File
@@ -0,0 +1,32 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Остаток суточного предела",
"type": "object",
"required": [
"rub_limit",
"rub_left",
"rub_used",
"unlimited"
],
"properties": {
"rub_limit": {
"type": [
"number",
"null"
]
},
"rub_left": {
"type": [
"number",
"null"
]
},
"rub_used": {
"type": "number"
},
"unlimited": {
"type": "boolean"
}
},
"additionalProperties": false
}
+21
View File
@@ -0,0 +1,21 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Продление аренды строки",
"type": "object",
"required": [
"ok",
"status"
],
"properties": {
"ok": {
"type": "boolean"
},
"status": {
"type": "string"
},
"can_resume": {
"type": "boolean"
}
},
"additionalProperties": false
}
+139
View File
@@ -0,0 +1,139 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Проверка (строка базы как есть)",
"type": "object",
"required": [
"id",
"username",
"tab_id",
"title",
"status",
"stop_reason",
"created_at",
"started_at",
"finished_at",
"last_seen_at",
"total",
"n_fixed",
"n_partial",
"n_not_fixed",
"n_unknown",
"est_rub",
"est_provisional",
"budget_rub",
"price_rub",
"notified_at",
"notify_state",
"notify_tries",
"notify_next_at",
"error"
],
"properties": {
"id": {
"type": "integer"
},
"username": {
"type": "string"
},
"tab_id": {
"type": "string"
},
"title": {
"type": "string"
},
"status": {
"type": "string"
},
"stop_reason": {
"type": [
"string",
"null"
]
},
"created_at": {
"type": "number"
},
"started_at": {
"type": [
"number",
"null"
]
},
"finished_at": {
"type": [
"number",
"null"
]
},
"last_seen_at": {
"type": [
"number",
"null"
]
},
"total": {
"type": "integer"
},
"n_fixed": {
"type": "integer"
},
"n_partial": {
"type": "integer"
},
"n_not_fixed": {
"type": "integer"
},
"n_unknown": {
"type": "integer"
},
"est_rub": {
"type": [
"number",
"null"
]
},
"est_provisional": {
"type": "integer"
},
"budget_rub": {
"type": [
"number",
"null"
]
},
"price_rub": {
"type": [
"number",
"null"
]
},
"notified_at": {
"type": [
"number",
"null"
]
},
"notify_state": {
"type": [
"string",
"null"
]
},
"notify_tries": {
"type": "integer"
},
"notify_next_at": {
"type": [
"number",
"null"
]
},
"error": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
}
@@ -0,0 +1,22 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Созданная проверка",
"type": "object",
"required": [
"id",
"created",
"tab_id"
],
"properties": {
"id": {
"type": "integer"
},
"created": {
"type": "boolean"
},
"tab_id": {
"type": "string"
}
},
"additionalProperties": false
}
@@ -0,0 +1,21 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Проверка со строками",
"type": "object",
"required": [
"review",
"items"
],
"properties": {
"review": {
"$ref": "review.json"
},
"items": {
"type": "array",
"items": {
"$ref": "review_item.json"
}
}
},
"additionalProperties": false
}
@@ -0,0 +1,97 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Строка проверки (как есть)",
"type": "object",
"required": [
"id",
"review_id",
"ord",
"source_text",
"target_path",
"target_sheet",
"target_row",
"state",
"reason",
"verdict",
"evidence_json",
"started_at",
"finished_at",
"lease_token",
"lease_until"
],
"properties": {
"id": {
"type": "integer"
},
"review_id": {
"type": "integer"
},
"ord": {
"type": "integer"
},
"source_text": {
"type": "string"
},
"target_path": {
"type": [
"string",
"null"
]
},
"target_sheet": {
"type": [
"string",
"null"
]
},
"target_row": {
"type": [
"integer",
"null"
]
},
"state": {
"type": "string"
},
"reason": {
"type": [
"string",
"null"
]
},
"verdict": {
"type": [
"string",
"null"
]
},
"evidence_json": {
"type": "string"
},
"started_at": {
"type": [
"number",
"null"
]
},
"finished_at": {
"type": [
"number",
"null"
]
},
"lease_token": {
"type": [
"string",
"null"
]
},
"lease_until": {
"type": [
"number",
"null"
]
}
},
"additionalProperties": false
}
@@ -0,0 +1,100 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Список проверок",
"type": "object",
"required": [
"items"
],
"properties": {
"items": {
"type": "array",
"items": {
"type": "object",
"required": [
"id",
"title",
"status",
"stop_reason",
"created_at",
"finished_at",
"total",
"n_fixed",
"n_partial",
"n_not_fixed",
"n_unknown",
"est_rub",
"budget_rub",
"price_rub",
"notify_state"
],
"properties": {
"id": {
"type": "integer"
},
"title": {
"type": "string"
},
"status": {
"type": "string"
},
"stop_reason": {
"type": [
"string",
"null"
]
},
"created_at": {
"type": "number"
},
"finished_at": {
"type": [
"number",
"null"
]
},
"total": {
"type": "integer"
},
"n_fixed": {
"type": "integer"
},
"n_partial": {
"type": "integer"
},
"n_not_fixed": {
"type": "integer"
},
"n_unknown": {
"type": "integer"
},
"est_rub": {
"type": [
"number",
"null"
]
},
"budget_rub": {
"type": [
"number",
"null"
]
},
"price_rub": {
"type": [
"number",
"null"
]
},
"notify_state": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
@@ -0,0 +1,14 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Действие сайта выполнено",
"type": "object",
"required": [
"status"
],
"properties": {
"status": {
"type": "string"
}
},
"additionalProperties": false
}