{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "fak/shared-patch.v1.json",
  "title": "Shared Task Patch",
  "type": "object",
  "required": ["schema", "task_id", "base_rev", "actor", "scope", "durability", "ops", "message"],
  "properties": {
    "schema": {"type": "string", "const": "fak.shared-patch.v1"},
    "task_id": {"type": "string", "pattern": "^task_[A-Za-z0-9_.-]+$"},
    "base_rev": {"type": "string", "pattern": "^sha256:.+"},
    "actor": {"type": "object", "required": ["kind", "id"], "properties": {"kind": {"type": "string"}, "id": {"type": "string", "minLength": 1}}},
    "scope": {"type": "string", "enum": ["agent", "fleet", "tenant", "public"]},
    "durability": {"type": "string", "enum": ["turn", "session", "bounded", "durable"]},
    "ops": {"type": "array", "minItems": 1, "items": {"type": "object", "required": ["op", "path"], "properties": {"op": {"type": "string", "enum": ["append", "replace", "remove"]}, "path": {"type": "string", "pattern": "^/"}, "value": {}}}},
    "message": {"type": "string"}
  }
}
