{
  "openapi": "3.1.0",
  "info": {
    "title": "抖店本地受控网关 — gateway模式",
    "version": "0.1.0",
    "description": "Generated from the enabled gateway-http.mjs route guards. This is a partial implementation contract, not F01–F20 platform acceptance. The default server mode remains static_only and does not expose these business endpoints. IDs must be strings. Unknown, repeated, case-aliased query/JSON fields are rejected; JSON body limit 1 MiB. The sole binary upload route has explicit MIME-dependent byte limits. Direct loopback clients only; Origin headers are rejected."
  },
  "servers": [
    {
      "url": "http://127.0.0.1:9130",
      "description": "Loopback only; set DOUDIAN_MODE=gateway and DOUDIAN_API_TOKEN explicitly."
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "x-mode": "gateway",
  "x-default-server-mode": "static_only",
  "x-live-verified": false,
  "x-desktop-dependency": {
    "required": true,
    "transport": "existing_client_cdp",
    "runtime_bridge_restored": false,
    "official_login_challenges_restored": false,
    "merchant_context_restored": false,
    "arbitrary_eval_or_proxy_exposed": false,
    "protocol_commerce": {
      "desktop_required": false,
      "explicit_identity_allowlist_required": true,
      "im_recovered": false,
      "live_verified": false
    }
  },
  "x-source": {
    "file": "lib/gateway-http.mjs",
    "sha256": "1eb62efabe2223286c947cd46a33824bac67421e08eff1ebc415b40a66b93a42",
    "note": "Hash proves the reviewed route-source version, not semantic completeness or platform acceptance."
  },
  "x-contract-rules": {
    "unknown_query_parameters": "reject",
    "unknown_json_fields": "reject",
    "duplicate_or_case_aliased_parameters": "reject",
    "large_ids": "strings_only",
    "automatic_send_default": false,
    "query_object_validation": "x-query-schema additionalProperties=false; OpenAPI standard parameter lists alone cannot encode unknown-query rejection"
  },
  "paths": {
    "/health": {
      "get": {
        "operationId": "get_health",
        "summary": "Local liveness only; not platform or SDK readiness",
        "tags": [
          "health"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "ok",
                    "mode",
                    "live_verified",
                    "runtime_dependencies_ready"
                  ],
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "mode": {
                      "const": "gateway"
                    },
                    "live_verified": {
                      "const": false
                    },
                    "runtime_dependencies_ready": {
                      "const": false
                    }
                  }
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "security": []
      }
    },
    "/capabilities": {
      "get": {
        "operationId": "get_capabilities",
        "summary": "Enabled local capabilities and explicit unresolved dependencies",
        "tags": [
          "capabilities"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        }
      }
    },
    "/sessions": {
      "get": {
        "operationId": "get_sessions",
        "summary": "List local attached aliases; no login performed",
        "tags": [
          "sessions"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        }
      }
    },
    "/sessions/discover": {
      "post": {
        "operationId": "post_sessions_discover",
        "summary": "Discover allowed pages in an existing loopback CDP endpoint",
        "tags": [
          "sessions"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "cdp_endpoint": {
                    "type": "string",
                    "pattern": "^http://127\\.0\\.0\\.1:[0-9]+/?$",
                    "description": "Existing loopback CDP endpoint. Does not start the desktop client, enable debugging or perform official login."
                  }
                },
                "required": [
                  "cdp_endpoint"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576
      }
    },
    "/sessions/attach": {
      "post": {
        "operationId": "post_sessions_attach",
        "summary": "Attach one existing official page; not password/QR login",
        "tags": [
          "sessions"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "session_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
                  },
                  "cdp_endpoint": {
                    "type": "string",
                    "pattern": "^http://127\\.0\\.0\\.1:[0-9]+/?$",
                    "description": "Existing loopback CDP endpoint. Does not start the desktop client, enable debugging or perform official login."
                  },
                  "target_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512,
                    "pattern": "^[^\\u0000-\\u001f]+$"
                  }
                },
                "required": [
                  "session_id",
                  "cdp_endpoint",
                  "target_id"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576
      }
    },
    "/sessions/protocol/attach": {
      "post": {
        "operationId": "post_sessions_protocol_attach",
        "summary": "Bind a configured independent protocol identity after successful currentuser identity verification",
        "tags": [
          "sessions"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "session_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
                  },
                  "identity_id": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$",
                    "description": "Process-startup allowlisted identity label, not a file path or cookie jar."
                  }
                },
                "required": [
                  "session_id",
                  "identity_id"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576,
        "description": "Requires DOUDIAN_TRANSPORT=protocol_commerce and a process-startup identity_id→absolute identity.json map. HTTP callers cannot choose private file paths or supply cookie material. Authentication/risk/halted failures do not fall back to the desktop or a different identity. No SMS or login is initiated here."
      }
    },
    "/sessions/official/attach": {
      "post": {
        "operationId": "post_sessions_official_attach",
        "summary": "Bind the process-startup official WC through a private stdio provider; no PID, URL or code accepted",
        "tags": [
          "sessions"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "session_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
                  }
                },
                "required": [
                  "session_id"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576,
        "description": "Requires official_runtime and exact DOUDIAN_OFFICIAL_TARGET_JSON at startup. A private stdio provider rechecks the original process/WC identity and executes only fixed builders. The native partition is unknown/null, never forged; UID/shop/biz plus a boot context_key bind this kind only. There is no HTTP debugging/eval service, injected install copy, PID discovery or caller-selected runtime code."
      }
    },
    "/sessions/detach": {
      "post": {
        "operationId": "post_sessions_detach",
        "summary": "Local detach, not platform logout",
        "tags": [
          "sessions"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "session_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
                  }
                },
                "required": [
                  "session_id"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576
      }
    },
    "/commerce/read": {
      "post": {
        "operationId": "post_commerce_read",
        "summary": "Read one fixed source-backed commerce contract through an independent private session",
        "tags": [
          "commerce"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "session_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "GET",
                      "POST"
                    ],
                    "description": "Local source-backed contract method, not an arbitrary upstream HTTP method."
                  },
                  "path": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000,
                    "pattern": "^/[^?#]*$",
                    "description": "Exact local commerce catalogue path, possibly with validated identifier segments. Absolute URLs, queries, arbitrary paths and unknown contracts are rejected."
                  },
                  "input": {
                    "type": "object",
                    "description": "Only the matched fixed contract fields are accepted. Cannot contain caller URLs, headers, credentials or executable code."
                  }
                },
                "required": [
                  "session_id",
                  "method",
                  "path"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576,
        "description": "This is a finite local catalogue RPC, not a URL proxy: method/path resolve through commerceRoutes, and the matched builder alone chooses HTTPS host, upstream path, method, query and body. Unknown fields and non-read contracts are rejected before dispatch. Identity is checked through currentuser before and after each result; this is not proof of IM login or complete upstream schemas."
      }
    },
    "/sessions/status": {
      "get": {
        "operationId": "get_sessions_status",
        "summary": "Identity binding status; HTTP authentication and platform acceptance remain separate",
        "tags": [
          "sessions"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "session_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          },
          "required": [
            "session_id"
          ]
        },
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          }
        ]
      }
    },
    "/sessions/health": {
      "get": {
        "operationId": "get_sessions_health",
        "summary": "Fixed original-account HTTP auth, SDK-ready and fresh native LOCAL WS-state snapshot; cached at most once per 30 seconds; never refreshes or relogs in",
        "tags": [
          "sessions"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "session_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          },
          "required": [
            "session_id"
          ]
        },
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          }
        ]
      }
    },
    "/conversations/cache": {
      "get": {
        "operationId": "get_conversations_cache",
        "summary": "Bounded current Store conversation page; explicit cache snapshot, not authoritative server total",
        "tags": [
          "conversations"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "session_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            },
            "cursor": {
              "type": "string",
              "minLength": 1,
              "maxLength": 8192,
              "description": "URL-encoded strict JSON serialization of returned next_cursor {scope,snapshot,version,offset}; bound to account/context/cache snapshot. Never a platform history cursor. Do not alter fields."
            },
            "page_size": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "description": "Canonical decimal integer in [1, 25]. Bounded in-memory cache only."
            },
            "include_content": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "Default false; content stays inert data and is never executed."
            }
          },
          "required": [
            "session_id"
          ]
        },
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 8192,
              "description": "URL-encoded strict JSON serialization of returned next_cursor {scope,snapshot,version,offset}; bound to account/context/cache snapshot. Never a platform history cursor. Do not alter fields."
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "description": "Canonical decimal integer in [1, 25]. Bounded in-memory cache only."
            }
          },
          {
            "name": "include_content",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "Default false; content stays inert data and is never executed."
            }
          }
        ]
      }
    },
    "/conversations/history/cache": {
      "get": {
        "operationId": "get_conversations_history_cache",
        "summary": "Bounded cached-history page with typed message projection; no pull or mark-read",
        "tags": [
          "conversations"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "session_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            },
            "conversation_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512,
              "pattern": "^[^\\u0000-\\u001f]+$"
            },
            "cursor": {
              "type": "string",
              "minLength": 1,
              "maxLength": 8192,
              "description": "URL-encoded strict JSON serialization of returned next_cursor {scope,snapshot,version,offset}; bound to account/context/cache snapshot. Never a platform history cursor. Do not alter fields."
            },
            "page_size": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "description": "Canonical decimal integer in [1, 25]. Bounded in-memory cache only."
            },
            "include_content": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "Default false; content stays inert data and is never executed."
            }
          },
          "required": [
            "session_id",
            "conversation_id"
          ]
        },
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          },
          {
            "name": "conversation_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512,
              "pattern": "^[^\\u0000-\\u001f]+$"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 8192,
              "description": "URL-encoded strict JSON serialization of returned next_cursor {scope,snapshot,version,offset}; bound to account/context/cache snapshot. Never a platform history cursor. Do not alter fields."
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "description": "Canonical decimal integer in [1, 25]. Bounded in-memory cache only."
            }
          },
          {
            "name": "include_content",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "Default false; content stays inert data and is never executed."
            }
          }
        ]
      }
    },
    "/messages/observe": {
      "post": {
        "operationId": "post_messages_observe",
        "summary": "Finite passive SDK window; observed changes are not automatically fresh buyer messages or permission to reply",
        "tags": [
          "messages"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "session_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
                  },
                  "conversation_ids": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 16,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512,
                      "pattern": "^[^\\u0000-\\u001f]+$"
                    }
                  },
                  "duration_ms": {
                    "type": "integer",
                    "minimum": 100,
                    "maximum": 5000
                  },
                  "max_events": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 8
                  }
                },
                "required": [
                  "session_id",
                  "conversation_ids"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576
      }
    },
    "/account/profile": {
      "get": {
        "operationId": "get_account_profile",
        "summary": "Read bound Store identity; permissions remain unknown",
        "tags": [
          "account"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "session_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          },
          "required": [
            "session_id"
          ]
        },
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          }
        ]
      }
    },
    "/shop/profile": {
      "get": {
        "operationId": "get_shop_profile",
        "summary": "Read shop identity from the selected binding",
        "tags": [
          "shop"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "session_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          },
          "required": [
            "session_id"
          ]
        },
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          }
        ]
      }
    },
    "/messages/status": {
      "get": {
        "operationId": "get_messages_status",
        "summary": "Read SDK status within the selected bound context",
        "tags": [
          "messages"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "session_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          },
          "required": [
            "session_id"
          ]
        },
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          }
        ]
      }
    },
    "/conversations": {
      "get": {
        "operationId": "get_conversations",
        "summary": "Read current Store conversations; not proven authoritative or complete",
        "tags": [
          "conversations"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "session_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          },
          "required": [
            "session_id"
          ]
        },
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          }
        ]
      }
    },
    "/conversations/history": {
      "get": {
        "operationId": "get_conversations_history",
        "summary": "Read local history or explicitly pull; never implicitly mark read",
        "tags": [
          "conversations"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "session_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            },
            "conversation_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512,
              "pattern": "^[^\\u0000-\\u001f]+$"
            },
            "pull": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "count is accepted only when pull=true."
            },
            "count": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "description": "Canonical decimal integer in [1, 100]. Requires pull=true; SDK pull count, not a recovered global history cursor."
            }
          },
          "required": [
            "session_id",
            "conversation_id"
          ]
        },
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          },
          {
            "name": "conversation_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512,
              "pattern": "^[^\\u0000-\\u001f]+$"
            }
          },
          {
            "name": "pull",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ],
              "description": "count is accepted only when pull=true."
            }
          },
          {
            "name": "count",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "description": "Canonical decimal integer in [1, 100]. Requires pull=true; SDK pull count, not a recovered global history cursor."
            }
          }
        ]
      }
    },
    "/messages/connect": {
      "post": {
        "operationId": "post_messages_connect",
        "summary": "Connect/subscribe without sending; SDK callbacks are not proven fresh push",
        "tags": [
          "messages"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "session_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
                  }
                },
                "required": [
                  "session_id"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576
      }
    },
    "/messages/events": {
      "get": {
        "operationId": "get_messages_events",
        "summary": "Account-partitioned event replay or SSE stream",
        "tags": [
          "messages"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string"
                },
                "example": "id: 1\nevent: message\ndata: {\"session_id\":\"test-session\",\"seq\":1}\n\n"
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "session_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            },
            "after_seq": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "description": "Canonical decimal integer in [0, 9007199254740991]. Per-account local event sequence. Must agree with Last-Event-ID if both supplied."
            },
            "limit": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "description": "Canonical decimal integer in [1, 1000]. JSON replay only; forbidden when stream=true."
            },
            "stream": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          "required": [
            "session_id"
          ]
        },
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          },
          {
            "name": "after_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "description": "Canonical decimal integer in [0, 9007199254740991]. Per-account local event sequence. Must agree with Last-Event-ID if both supplied."
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "description": "Canonical decimal integer in [1, 1000]. JSON replay only; forbidden when stream=true."
            }
          },
          {
            "name": "stream",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            }
          },
          {
            "name": "Last-Event-ID",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(0|[1-9][0-9]*)$",
              "description": "Canonical decimal integer in [0, 9007199254740991]."
            }
          }
        ],
        "description": "stream=true enables SSE. Replay and live events share account-specific monotonic sequence numbers. Sequence gaps, backpressure, or invalidated identity produce sync_required and close; reconnect requires explicit same-account cursor. Callbacks from the current SDK adapter are source=sdk_callback/fresh=false, not proven new messages."
      }
    },
    "/messages/text": {
      "post": {
        "operationId": "post_messages_text",
        "summary": "Explicit gated text send using the persistent ledger; 200 is not delivery",
        "tags": [
          "messages"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "session_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
                  },
                  "conversation_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512,
                    "pattern": "^[^\\u0000-\\u001f]+$"
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 10000,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit text; not executable instructions or a platform tool request."
                  },
                  "biz_unique": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Persistent idempotency key within session_id. Same key with different target/content returns 409; uncertain never implicitly resends."
                  }
                },
                "required": [
                  "session_id",
                  "conversation_id",
                  "text",
                  "biz_unique"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576,
        "description": "Write gate and approved target scope are required for text sending. Keep acknowledged/rejected/uncertain distinct. Wrapper fulfilled, null or serverId alone is not a proven ACK; current real adapter has verified_ack=false. Reconciliation never resends."
      }
    },
    "/messages/send": {
      "post": {
        "operationId": "post_messages_send",
        "summary": "Unified typed text/image/plain-link/product/video send through one account-scoped durable ledger",
        "tags": [
          "messages"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "session_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
                  },
                  "conversation_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512,
                    "pattern": "^[^\\u0000-\\u001f]+$"
                  },
                  "biz_unique": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Persistent idempotency key within session_id. Same key with different target/content returns 409; uncertain never implicitly resends."
                  },
                  "message": {
                    "oneOf": [
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "type",
                          "text"
                        ],
                        "properties": {
                          "type": {
                            "const": "text"
                          },
                          "text": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 10000
                          }
                        }
                      },
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "type",
                          "url"
                        ],
                        "properties": {
                          "type": {
                            "const": "link"
                          },
                          "url": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 2048,
                            "format": "uri",
                            "description": "Credential-free HTTP(S), sent as plain URL text; no rich-preview card schema is claimed."
                          }
                        }
                      },
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "type",
                          "product_id"
                        ],
                        "properties": {
                          "type": {
                            "const": "product"
                          },
                          "product_id": {
                            "type": "string",
                            "pattern": "^[1-9][0-9]{0,29}$",
                            "description": "Must be in this bound account's explicitly verified product scope."
                          }
                        }
                      },
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "type",
                          "media_id"
                        ],
                        "properties": {
                          "type": {
                            "const": "image"
                          },
                          "media_id": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 512,
                            "description": "Trusted ready upload resource reference bound to this account and receiver. Not a URI, path, caller ownership declaration or upload token."
                          }
                        }
                      },
                      {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "type",
                          "media_id"
                        ],
                        "properties": {
                          "type": {
                            "const": "video"
                          },
                          "media_id": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 512,
                            "description": "Trusted ready upload resource reference bound to this account and receiver. Not a URI, path, caller ownership declaration or upload token."
                          }
                        }
                      }
                    ],
                    "description": "Discriminated typed send payload. Extra SDK ext, sender/receiver/account overrides and opaque custom-card JSON are rejected."
                  }
                },
                "required": [
                  "session_id",
                  "conversation_id",
                  "biz_unique",
                  "message"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576,
        "description": "All five types share session+biz_unique deduplication. The digest covers message type, normalized content/resource and account; cross-type reuse conflicts. Account/owned-conversation preflight and final dispatch guards are required. Images/videos require a trusted upload resolver bound to both account and receiver, not caller URIs. Product cards require an explicit same-shop product scope and a no-wrapper-retry transport capability. Plain URL text is not a rich-link card. Missing transports/upload/ACK evidence remain typed unavailable/uncertain; no implicit upload, replay, new-conversation creation or ACK fabrication."
      }
    },
    "/media/upload": {
      "post": {
        "operationId": "post_media_upload",
        "summary": "Upload bounded raw image or MP4 bytes through a trusted account/receiver-bound adapter; never sends a message",
        "tags": [
          "media"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "session_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            },
            "conversation_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512,
              "pattern": "^[^\\u0000-\\u001f]+$"
            },
            "type": {
              "type": "string",
              "enum": [
                "image",
                "video"
              ],
              "description": "Binary upload kind. Never a filename, path, URL or caller metadata envelope."
            }
          },
          "required": [
            "session_id",
            "conversation_id",
            "type"
          ]
        },
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          },
          {
            "name": "conversation_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512,
              "pattern": "^[^\\u0000-\\u001f]+$"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "image",
                "video"
              ],
              "description": "Binary upload kind. Never a filename, path, URL or caller metadata envelope."
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "image/png": {
              "schema": {
                "type": "string",
                "format": "binary"
              },
              "x-max-body-bytes": 15728640
            },
            "image/jpeg": {
              "schema": {
                "type": "string",
                "format": "binary"
              },
              "x-max-body-bytes": 15728640
            },
            "image/jpg": {
              "schema": {
                "type": "string",
                "format": "binary"
              },
              "x-max-body-bytes": 15728640
            },
            "image/gif": {
              "schema": {
                "type": "string",
                "format": "binary"
              },
              "x-max-body-bytes": 15728640
            },
            "video/mp4": {
              "schema": {
                "type": "string",
                "format": "binary"
              },
              "x-max-body-bytes": 16777216
            }
          }
        },
        "x-max-body-bytes": 16777216,
        "description": "Write gate, approved existing conversation and exact official process/WC account context are required. Body is raw bytes only; no JSON, URL/path, STS, caller dimensions or ownership claims. Image limit 15 MiB, MP4 gateway limit 16 MiB (not a platform maximum). Trusted uploader sniffs content and produces a private signed receipt; only opaque media_id/type/ready/message_sent=false is returned. No implicit fallback, token refresh, automatic retry or message send. Missing trusted upload hook is typed unavailable. A timeout is not permission to retry automatically."
      }
    },
    "/messages/ledger": {
      "get": {
        "operationId": "get_messages_ledger",
        "summary": "Read one account-scoped idempotency record",
        "tags": [
          "messages"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "session_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            },
            "biz_unique": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Persistent idempotency key within session_id. Same key with different target/content returns 409; uncertain never implicitly resends."
            }
          },
          "required": [
            "session_id",
            "biz_unique"
          ]
        },
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          },
          {
            "name": "biz_unique",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Persistent idempotency key within session_id. Same key with different target/content returns 409; uncertain never implicitly resends."
            }
          }
        ]
      }
    },
    "/messages/reconcile": {
      "post": {
        "operationId": "post_messages_reconcile",
        "summary": "Explicitly reconcile uncertain sends only through a proven ACK correlator",
        "tags": [
          "messages"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "session_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
                  },
                  "biz_unique": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Persistent idempotency key within session_id. Same key with different target/content returns 409; uncertain never implicitly resends."
                  }
                },
                "required": [
                  "session_id",
                  "biz_unique"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576,
        "description": "Write gate and approved target scope are required for text sending. Keep acknowledged/rejected/uncertain distinct. Wrapper fulfilled, null or serverId alone is not a proven ACK; current real adapter has verified_ack=false. Reconciliation never resends."
      }
    },
    "/ai/status": {
      "get": {
        "operationId": "get_ai_status",
        "summary": "Provider configuration and account queue state, without provider requests",
        "tags": [
          "ai"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "session_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          },
          "required": [
            "session_id"
          ]
        },
        "parameters": [
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          }
        ]
      }
    },
    "/ai/drafts": {
      "post": {
        "operationId": "post_ai_drafts",
        "summary": "Generate a draft with same-session history; never sends",
        "tags": [
          "ai"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "session_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
                  },
                  "conversation_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512,
                    "pattern": "^[^\\u0000-\\u001f]+$"
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 20000,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit text; not executable instructions or a platform tool request."
                  }
                },
                "required": [
                  "session_id",
                  "conversation_id",
                  "text"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576
      }
    },
    "/ai/reception/config": {
      "post": {
        "operationId": "post_ai_reception_config",
        "summary": "Explicit account reception scope; disabled by default and after restart",
        "tags": [
          "ai"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "session_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "auto_send": {
                    "type": "boolean",
                    "description": "Defaults off. Requires enabled=true, explicit conversations, process write gate and approved send scope."
                  },
                  "conversations": {
                    "type": "array",
                    "maxItems": 100,
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                },
                "required": [
                  "session_id",
                  "enabled",
                  "auto_send",
                  "conversations"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576
      }
    },
    "/ai/takeover": {
      "post": {
        "operationId": "post_ai_takeover",
        "summary": "Cancel and suppress automated tasks for one conversation",
        "tags": [
          "ai"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "session_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
                  },
                  "conversation_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512,
                    "pattern": "^[^\\u0000-\\u001f]+$"
                  }
                },
                "required": [
                  "session_id",
                  "conversation_id"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576
      }
    },
    "/ai/release": {
      "post": {
        "operationId": "post_ai_release",
        "summary": "Release local human takeover for one conversation",
        "tags": [
          "ai"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "session_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
                  },
                  "conversation_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512,
                    "pattern": "^[^\\u0000-\\u001f]+$"
                  }
                },
                "required": [
                  "session_id",
                  "conversation_id"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576
      }
    },
    "/collections/products": {
      "post": {
        "operationId": "post_collections_products",
        "summary": "Create bounded product task only when a source-backed collector is injected",
        "tags": [
          "collections"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "202": {
            "description": "Task accepted locally; inspect state/completeness. Does not claim platform validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "session_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
                  },
                  "query": {
                    "type": "object",
                    "description": "Original collection scope. Its permitted fields depend on the injected source-backed collector. The default gateway has no commerce collector; the supplied product adapter accepts only recovered query fields, not arbitrary lifecycle states."
                  },
                  "ids": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 10000,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    }
                  },
                  "start_page": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "max_pages": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "max_items": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000000
                  },
                  "rate_ms": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 60000
                  },
                  "request_timeout_ms": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 300000
                  },
                  "timeout_ms": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 86400000
                  }
                },
                "required": [
                  "session_id",
                  "query"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576,
        "x-requires-injected-collector": true,
        "description": "Default desktop CLI gateway has no commerce collector: returns COLLECTION_TRANSPORT_UNAVAILABLE. Explicit protocol_commerce config injects the independent fixed-route reader and product collector. It only covers online/passed-audit products and specified product details; merchant order extraction, all product states and production platform validation remain unresolved. Order collection fails before any platform request. completed is scoped to the recorded query, never an unrestricted all-shop guarantee."
      }
    },
    "/collections/orders": {
      "post": {
        "operationId": "post_collections_orders",
        "summary": "Create order task only with an independently proven order extractor; default adapter has none",
        "tags": [
          "collections"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "202": {
            "description": "Task accepted locally; inspect state/completeness. Does not claim platform validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "session_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
                  },
                  "query": {
                    "type": "object",
                    "description": "Original collection scope. Its permitted fields depend on the injected source-backed collector. The default gateway has no commerce collector; the supplied product adapter accepts only recovered query fields, not arbitrary lifecycle states."
                  },
                  "ids": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 10000,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 512
                    }
                  },
                  "start_page": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000
                  },
                  "max_pages": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "max_items": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000000
                  },
                  "rate_ms": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 60000
                  },
                  "request_timeout_ms": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 300000
                  },
                  "timeout_ms": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 86400000
                  }
                },
                "required": [
                  "session_id",
                  "query"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576,
        "x-requires-injected-collector": true,
        "description": "Default desktop CLI gateway has no commerce collector: returns COLLECTION_TRANSPORT_UNAVAILABLE. Explicit protocol_commerce config injects the independent fixed-route reader and product collector. It only covers online/passed-audit products and specified product details; merchant order extraction, all product states and production platform validation remain unresolved. Order collection fails before any platform request. completed is scoped to the recorded query, never an unrestricted all-shop guarantee."
      }
    },
    "/collections/{id}": {
      "get": {
        "operationId": "get_collections_id",
        "summary": "Read selected account task state",
        "tags": [
          "collections"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "session_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          },
          "required": [
            "session_id"
          ]
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Account-owned collection UUID; another account receives 404."
          },
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          }
        ],
        "x-requires-injected-collector": true,
        "description": "Default desktop CLI gateway has no commerce collector: returns COLLECTION_TRANSPORT_UNAVAILABLE. Explicit protocol_commerce config injects the independent fixed-route reader and product collector. It only covers online/passed-audit products and specified product details; merchant order extraction, all product states and production platform validation remain unresolved. Order collection fails before any platform request. completed is scoped to the recorded query, never an unrestricted all-shop guarantee."
      },
      "delete": {
        "operationId": "delete_collections_id",
        "summary": "Cancel only the selected account task; never deletes its archive",
        "tags": [
          "collections"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "session_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          },
          "required": [
            "session_id"
          ]
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Account-owned collection UUID; another account receives 404."
          },
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          }
        ],
        "x-requires-injected-collector": true,
        "description": "Default desktop CLI gateway has no commerce collector: returns COLLECTION_TRANSPORT_UNAVAILABLE. Explicit protocol_commerce config injects the independent fixed-route reader and product collector. It only covers online/passed-audit products and specified product details; merchant order extraction, all product states and production platform validation remain unresolved. Order collection fails before any platform request. completed is scoped to the recorded query, never an unrestricted all-shop guarantee."
      }
    },
    "/collections/{id}/download": {
      "get": {
        "operationId": "get_collections_id_download",
        "summary": "Download committed JSONL and metadata; no local file path",
        "tags": [
          "collections"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "200": {
            "description": "Local result. HTTP success alone never proves platform acceptance or message ACK.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "session_id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          },
          "required": [
            "session_id"
          ]
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Account-owned collection UUID; another account receives 404."
          },
          {
            "name": "session_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128,
              "pattern": "^[^\\u0000-\\u001f]+$",
              "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
            }
          }
        ],
        "x-requires-injected-collector": true,
        "description": "Default desktop CLI gateway has no commerce collector: returns COLLECTION_TRANSPORT_UNAVAILABLE. Explicit protocol_commerce config injects the independent fixed-route reader and product collector. It only covers online/passed-audit products and specified product details; merchant order extraction, all product states and production platform validation remain unresolved. Order collection fails before any platform request. completed is scoped to the recorded query, never an unrestricted all-shop guarantee."
      }
    },
    "/collections/{id}/resume": {
      "post": {
        "operationId": "post_collections_id_resume",
        "summary": "Explicit same-scope and same-identity cursor-validated resume",
        "tags": [
          "collections"
        ],
        "x-mode": "gateway",
        "x-live-verified": false,
        "x-reject-unknown-query": true,
        "x-reject-case-aliases-and-duplicates": true,
        "responses": {
          "202": {
            "description": "Task accepted locally; inspect state/completeness. Does not claim platform validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuntimeResult"
                }
              }
            }
          },
          "default": {
            "description": "Uniform local error; no upstream credential material. Runtime may return 400/401/403/404/409/413/415/429/500/501/502/503/504.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "session_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128,
                    "pattern": "^[^\\u0000-\\u001f]+$",
                    "description": "Explicit local account alias. No implicit default account; old aliases cannot be silently rebound to another identity."
                  },
                  "query": {
                    "type": "object",
                    "description": "Original collection scope. Its permitted fields depend on the injected source-backed collector. The default gateway has no commerce collector; the supplied product adapter accepts only recovered query fields, not arbitrary lifecycle states."
                  },
                  "proof": {
                    "description": "Explicit cursor-validity proof consumed by the injected validator. Never interpreted as an arbitrary platform command; generic transport has no implicit resume capability."
                  },
                  "max_pages": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000
                  },
                  "max_items": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 10000000
                  }
                },
                "required": [
                  "session_id",
                  "query",
                  "proof"
                ]
              }
            }
          }
        },
        "x-query-schema": {
          "type": "object",
          "additionalProperties": false,
          "properties": {}
        },
        "x-max-body-bytes": 1048576,
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Account-owned collection UUID; another account receives 404."
          }
        ],
        "x-requires-injected-collector": true,
        "description": "Default desktop CLI gateway has no commerce collector: returns COLLECTION_TRANSPORT_UNAVAILABLE. Explicit protocol_commerce config injects the independent fixed-route reader and product collector. It only covers online/passed-audit products and specified product details; merchant order extraction, all product states and production platform validation remain unresolved. Order collection fails before any platform request. completed is scoped to the recorded query, never an unrestricted all-shop guarantee."
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "DOUDIAN_API_TOKEN: at least 24 whitespace-free characters. Never put credentials in a query string."
      }
    },
    "schemas": {
      "RuntimeResult": {
        "type": "object",
        "additionalProperties": true,
        "description": "Operation-specific runtime envelope. Preserve original identity, delivery, raw, uncertain and provenance fields; schemas not recovered from upstream are deliberately not invented."
      },
      "Problem": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "ok",
          "problem"
        ],
        "properties": {
          "ok": {
            "const": false
          },
          "problem": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              },
              "message": {
                "type": "string",
                "minLength": 1,
                "maxLength": 2000
              }
            }
          }
        }
      }
    }
  }
}
