{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://lobework.com/contracts/extension-manifest.schema.json",
  "title": "LobeWork Extension Manifest",
  "type": "object",
  "additionalProperties": true,
  "required": [
    "manifestVersion",
    "id",
    "name",
    "version",
    "publisher",
    "requiredPlan",
    "permissions",
    "contributions"
  ],
  "properties": {
    "manifestVersion": {
      "const": 1
    },
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9]+(?:[.-][a-z0-9]+)+$",
      "maxLength": 120
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?$"
    },
    "summary": {
      "type": "string",
      "maxLength": 220
    },
    "description": {
      "type": "string",
      "maxLength": 1600
    },
    "category": {
      "enum": [
        "AI",
        "Automation",
        "Business",
        "Creative",
        "Development",
        "Integrations",
        "Productivity",
        "Research",
        "Utilities"
      ]
    },
    "source": {
      "enum": [
        "official",
        "third-party",
        "local"
      ]
    },
    "availability": {
      "enum": [
        "available",
        "coming_soon",
        "unlisted"
      ]
    },
    "publisher": {
      "type": "object",
      "required": [
        "id",
        "name"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "website": {
          "type": "string"
        },
        "supportUrl": {
          "type": "string"
        },
        "verified": {
          "type": "boolean"
        }
      }
    },
    "requiredPlan": {
      "enum": [
        "none",
        "starter",
        "standard",
        "pro",
        "studio",
        "special",
        "unlimited"
      ]
    },
    "requiredEntitlements": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "uniqueItems": true
    },
    "permissions": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "enum": [
          "project.read",
          "project.write",
          "files.read",
          "files.write",
          "models.invoke",
          "network.fetch",
          "connectedApps.register",
          "skills.register",
          "commands.register",
          "automations.register",
          "notifications.send"
        ]
      }
    },
    "contributions": {
      "type": "object",
      "properties": {
        "skills": {
          "$ref": "#/$defs/contributions"
        },
        "providers": {
          "$ref": "#/$defs/contributions"
        },
        "automations": {
          "$ref": "#/$defs/contributions"
        },
        "commands": {
          "$ref": "#/$defs/contributions"
        },
        "connectedApps": {
          "$ref": "#/$defs/contributions"
        },
        "workspaceModules": {
          "$ref": "#/$defs/contributions"
        }
      }
    },
    "package": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string"
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-fA-F0-9]{64}$"
        },
        "signature": {
          "type": "string"
        }
      }
    }
  },
  "$defs": {
    "contributions": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "name"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "target": {
            "type": "string"
          },
          "definition": {
            "type": "object",
            "properties": {
              "definitionId": {
                "type": "string",
                "pattern": "^[a-z0-9]+(?:[.-][a-z0-9]+)+$",
                "maxLength": 120
              },
              "kind": {
                "type": "string",
                "maxLength": 80
              },
              "defaultModel": {
                "type": "string",
                "maxLength": 160
              },
              "defaultBaseUrl": {
                "type": "string",
                "maxLength": 2000
              },
              "credentialMode": {
                "enum": [
                  "required",
                  "optional",
                  "none"
                ]
              },
              "transport": {
                "type": "string",
                "maxLength": 80
              },
              "requiredPlan": {
                "enum": [
                  "none",
                  "starter",
                  "standard",
                  "pro",
                  "studio",
                  "special",
                  "unlimited"
                ]
              },
              "requiredEntitlements": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "uniqueItems": true
              },
              "capabilities": {
                "type": "object",
                "properties": {
                  "chat": {
                    "type": "boolean"
                  },
                  "embeddings": {
                    "type": "boolean"
                  },
                  "vision": {
                    "type": "boolean"
                  },
                  "imageGeneration": {
                    "type": "boolean"
                  },
                  "toolCalls": {
                    "type": "boolean"
                  },
                  "streaming": {
                    "type": "boolean"
                  },
                  "local": {
                    "type": "boolean"
                  },
                  "modelDiscovery": {
                    "type": "boolean"
                  }
                }
              },
              "discovery": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string",
                    "maxLength": 80
                  },
                  "path": {
                    "type": "string",
                    "maxLength": 240
                  },
                  "method": {
                    "enum": [
                      "GET"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
