{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/multi-agent-ecosystem/multi-agent-pipeline/pipeline/schemas/shared-routine-import-request.schema.json",
  "title": "Shared routine import request",
  "description": "The body of POST /v1/routines/shared/{id}/import. Step 1 is {} or {as} (the local name, when the shared one is taken); step 2 sends the confirmToken step 1 returned with the sha256 and the digest it showed, and nothing else.",
  "type": "object",
  "additionalProperties": false,
  "required": ["contractVersion"],
  "properties": {
    "contractVersion": {
      "type": "string",
      "pattern": "^1\\.[0-9]+\\.[0-9]+$",
      "x-sensitivity": "none"
    },
    "as": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9-]{0,39}$",
      "not": {
        "const": "shared"
      },
      "x-sensitivity": "none",
      "description": "The local name. One path segment, and never the reserved name shared."
    },
    "confirmToken": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{16,128}$",
      "x-sensitivity": "none",
      "description": "The confirmToken the preview returned. Single use, bound to the route and the shared id."
    },
    "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$",
      "x-sensitivity": "none",
      "description": "The sha256 the preview showed. The import is refused unless the body still hashes to it."
    },
    "digest": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$",
      "x-sensitivity": "none",
      "description": "The payload digest the preview showed. The import is refused unless the name, both descriptions, the argument hint and the body still hash to it."
    }
  }
}
